<?php
include("topmenu.php");

?>

<div class="main_content_iner overly_inner ">
<div class="container-fluid p-0 ">

<div class="row">
<div class="col-12">
<div class="page_title_box d-flex align-items-center justify-content-between">
<div class="page_title_left">
<h3 class="f_s_30 f_w_700 text_white">Add Feature</h3>
<ol class="breadcrumb page_bradcam mb-0">
<li class="breadcrumb-item"><a href="javascript:void(0);">Al Barsha Electronics LLC </a></li>
<li class="breadcrumb-item"><a href="javascript:void(0);">Dashboard</a></li>
<li class="breadcrumb-item active">Branch</li>
<li class="breadcrumb-item active">Branch Services</li>
<li class="breadcrumb-item active">Add Feature</li>
</ol>

</div>
</div>



<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-header align-items-center d-flex card-header2">
                <h4 class="card-title mb-0 flex-grow-1">Add Feature</h4>
                
            </div><!-- end card header -->

            
            <div class="card-body">
                <div class="live-preview">
                <form method="post" enctype="multipart/form-data">
                    <?php 
                    $id= isset($_GET['id']) ? $_GET['id'] : '';
                    $s=mysqli_query($db,"select * from branch_srvc_ftimg where id=$id");
                    $r=mysqli_fetch_row($s);
                    ?>
                    <input type="hidden" name="id" value="<?= $r[0] ?>">
                    <input type="hidden" name="srvc_id" value="<?= $r[1] ?>">
                    <div class="row gy-4">
        
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Feature name<span class="red">*</span></label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a1" required value="<?= $r[2] ?>">
                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Feature Image(width-54 & height-55)<span class="red">*</span></label>
                                <input type="file"  class="form-control" id="exampleInputdate" name="photo">
                            </div>
                            <img src="../images/branch/srvc/ft/<?php echo htmlspecialchars($r[3]); ?>" 
                                width="120" height="150" 
                                style="background-color: blue;" 
                                class="img-responsive img-circle">
                        </div>
                        
                        <div class="mt-3">
                        <input type="submit" class="btn btn-primary"  name="sub1" value="Submit">
                        <!-- staticBackdrop Modal -->
                        </div>

                    
                </form>
                </div>
                    <!--end row-->
               </div>
            </div>
        </div>   
        
        
        
    </div>
    </div>

    <?php
    if(isset($_POST['sub1']))
    {
        $id=$_POST['id'];
        $srvc_id = $_POST['srvc_id'];
        $a1=addslashes($_POST['a1']);
        
        //$c=addslashes($_POST['c']);
       
        $fileName=$_FILES['photo']['name'];
       
        if($fileName=="")
        {
        
            $ins=mysqli_query($db,"update branch_srvc_ftimg set d='$a1' where id=$id");
    
            msg("Successfully updated","branch_srvs_ftimg.php?id=$srvc_id");
        
        }else{
            $fileTmpPath = $_FILES['photo']['tmp_name'];
           
            $fileSize = $_FILES['photo']['size'];
            $fileType = $_FILES['photo']['type'];
            $fileNameCmps = explode(".", $fileName);
            $fileExtension = strtolower(end($fileNameCmps));
            $newFileName = md5(time() . $fileName) . '.' . $fileExtension;
            
            
            $newFileName = md5(time() . $fileName) . '.' . $fileExtension;
            $allowedfileExtensions = array('jpg', 'gif', 'png','jpeg');
            if (in_array($fileExtension, $allowedfileExtensions))
            {
                $uploadFileDir = "../images/branch/srvc/ft/"; 
                $dest_path = $uploadFileDir . $newFileName;
                //$pd=date("d/m/y");
                
                
                list($width, $height, $type, $attr) = getimagesize($fileTmpPath);
                
                
                if($width=="54" && $height=="55")
                {
                    move_uploaded_file($_FILES['photo']['tmp_name'],  $dest_path);
                    $ins=mysqli_query($db,"update branch_srvc_ftimg set d='$a1',image='$newFileName' where id=$id");
                    msg("Successfully updated","branch_srvs_ftimg.php?id=$srvc_id");
                }else{
                    msg("Image Size should be in width - 54px & height - 55px", "branch_srvs_ftimgedit.php?id=$srvc_id");
                }
            }else{
                msg("Image extension should be jpg or png", "branch_srvs_ftimgedit.php?id=$srvc_id");
            }
        } 
    
    }

?>




 





</div>
</div>
</div>
</div>
    









<div id="back-top" style="display: none;">
<a title="Go to Top" href="#">
<i class="ti-angle-up"></i>
</a>
</div>

<div class="footer_part">
                <div class="container-fluid">
                <div class="row">
                <div class="col-lg-12">
                <div class="footer_iner text-center">
                <p>2023 © Al Barsha Electronics LLC  - Designed by <a href="https://www.oracuz.com/">Oracuz</a></p>
                </div>
                </div>
                </div>
                </div>
                </div>
                </section>

<script src="js/jquery1-3.4.1.min.js"></script>

<script src="js/popper1.min.js"></script>

<script src="js/bootstrap.min.php"></script>

<script src="js/metisMenu.js"></script>

<script src="vendors/count_up/jquery.waypoints.min.js"></script>

<script src="vendors/chartlist/Chart.min.js"></script>

<script src="vendors/count_up/jquery.counterup.min.js"></script>

<script src="vendors/niceselect/js/jquery.nice-select.min.js"></script>

<script src="vendors/owl_carousel/js/owl.carousel.min.js"></script>

<script src="vendors/datatable/js/jquery.dataTables.min.js"></script>
<script src="vendors/datatable/js/dataTables.responsive.min.js"></script>
<script src="vendors/datatable/js/dataTables.buttons.min.js"></script>
<script src="vendors/datatable/js/buttons.flash.min.js"></script>
<script src="vendors/datatable/js/jszip.min.js"></script>
<script src="vendors/datatable/js/pdfmake.min.js"></script>
<script src="vendors/datatable/js/vfs_fonts.js"></script>
<script src="vendors/datatable/js/buttons.php5.min.js"></script>
<script src="vendors/datatable/js/buttons.print.min.js"></script>

<script src="vendors/datepicker/datepicker.js"></script>
<script src="vendors/datepicker/datepicker.en.js"></script>
<script src="vendors/datepicker/datepicker.custom.js"></script>
<script src="js/chart.min.js"></script>
<script src="vendors/chartjs/roundedBar.min.js"></script>

<script src="vendors/progressbar/jquery.barfiller.js"></script>

<script src="vendors/tagsinput/tagsinput.js"></script>

<script src="vendors/text_editor/summernote-bs4.js"></script>
<script src="vendors/am_chart/amcharts.js"></script>

<script src="vendors/scroll/perfect-scrollbar.min.js"></script>
<script src="vendors/scroll/scrollable-custom.js"></script>

<script src="vendors/vectormap-home/vectormap-2.0.2.min.js"></script>
<script src="vendors/vectormap-home/vectormap-world-mill-en.js"></script>

<script src="vendors/apex_chart/apex-chart2.js"></script>
<script src="vendors/apex_chart/apex_dashboard.js"></script>
<script src="vendors/echart/echarts.min.js"></script>
<script src="vendors/chart_am/core.js"></script>
<script src="vendors/chart_am/charts.js"></script>
<script src="vendors/chart_am/animated.js"></script>
<script src="vendors/chart_am/kelly.js"></script>
<script src="vendors/chart_am/chart-custom.js"></script>

<script src="js/dashboard_init.js"></script>
<script src="js/custom.js"></script>


<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.13.2/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.4/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.4/js/buttons.html5.min.js"></script>

<script type="text/javascript">
    

    $(document).ready(function() {
    $('#example').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'
        ]
    } );
} );
</script>




</body>

<!-- Mirrored from demo.dashboardpack.com/sales.php/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 15 Feb 2023 12:12:37 GMT -->
 </html>
