<?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">Home</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">Home</li>
<li class="breadcrumb-item active">Service</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">Update Content</h4>
                
            </div><!-- end card header -->

            
            <div class="card-body">
                <div class="live-preview">
                <form method="post" enctype="multipart/form-data">
                    <div class="row gy-4">
                    
                        
                        <!--end col-->

                        <?php 
                        $sqp=mysqli_query($db,"select * from ser_h");
                        $rqp=mysqli_fetch_row($sqp);
                        ?>
        
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Title<span class="red">*</span></label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a1" value="<?php echo $rqp[1] ?>" required>
                            </div>
                        </div> 
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Heading 1 <span class="red">*</span></label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a2" value="<?php echo $rqp[2] ?>"  required>
                            </div>
                        </div> 
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Heading 2<span class="red">*</span></label>
                                <textarea type="text"  class="form-control" id="exampleInputdate" name="a3" ><?php echo $rqp[3] ?></textarea>
                            </div>
                        </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']))
    {
        $a1=addslashes($_POST['a1']);
        $a2=addslashes($_POST['a2']);
        $a3=addslashes($_POST['a3']);

        $res=mysqli_query($db,"UPDATE ser_h SET t='$a1',h='$a2',m='$a3'");

   msg("Successfully updated","service.php");
    }
if(isset($_REQUEST['deletepro_id']))
{
 $sql_query="DELETE FROM service WHERE id=".$_REQUEST['deletepro_id'];
 
     mysqli_query($db,$sql_query);
     header("Location: service.php");
}

?>




 
      

   <script type="text/javascript">
function deletepro_id(id)
{

 
     if(confirm('Sure To Remove This Details ?'))
     {
        window.location.href='service.php?deletepro_id='+id;
     }
}
</script>



    <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 service</h4>
                
            </div><!-- end card header -->

            
            <div class="card-body">
                <div class="live-preview">
                <form method="post" enctype="multipart/form-data">
                    <div class="row gy-4">
                    
                        
                        <!--end col-->



                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Select service<span class="red">*</span></label>
                                    <select  class="form-control" id="exampleInputdate" name="ss" required>
                                    <option value="">Select service</option>

                                    <?php
            $sse=mysqli_query($db,"select * from mservice ");
            while($rse=mysqli_fetch_row($sse))
            {

            ?>
                                    <option value="<?php echo $rse[0];?>"><?php echo $rse[1];?></option>
                                    <?php
            }
            ?>
                                    
                                    </select>
                            </div>
                        </div> 
        
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Image(width-307px & height-260px)<span class="red">*</span></label>
                                <input type="file"  class="form-control" id="exampleInputdate" name="photo" required>
                            </div>
                        </div> 

                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Number<span class="red">*</span></label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a1" required>
                            </div>
                        </div> 
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Heading 1<span class="red">*</span></label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a2" required>
                            </div>
                        </div> 
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Heading 2<span class="red">*</span></label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a3" required>
                            </div>
                        </div> 
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Description<span class="red">*</span></label>
                                <textarea  class="form-control" id="exampleInputdate" name="a4" required></textarea>
                            </div>
                        </div> 

                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Icon<span class="red">*</span></label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a14" required>
                            </div>
                        </div> 
                       
</div>
<center>Service Details</center>
<div class="row gy-4">
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Image(width-640px & height-440px)<span class="red">*</span></label>
                                <input type="file"  class="form-control" id="exampleInputdate" name="photo1" required>
                            </div>
                        </div> 
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Image(width-491px & height-553px)<span class="red">*</span></label>
                                <input type="file"  class="form-control" id="exampleInputdate" name="photo2" required>
                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div>
                                <label for="labelInput" class="form-label">Description<span class="red">*</span></label>
                                <textarea  class="form-control" id="exampleInputdate" name="a5" required></textarea>
                            </div>
                        </div> 

                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 1</label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a6">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 2</label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a7">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 3</label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a8">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 4</label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a9">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 5</label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a10">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 6</label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a11">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 7</label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a12">
                            </div>
                        </div> 
                        <div class="col-lg-3">
                            <div>
                                <label for="labelInput" class="form-label">Service Title 8</label>
                                <input type="text"  class="form-control" id="exampleInputdate" name="a13">
                            </div>
                        </div> 

                        
                        <div class="mt-3">
                        <input type="submit" class="btn btn-primary"  name="sub2" value="Submit">
                        <!-- staticBackdrop Modal -->
                        </div>

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

<?php
                    
if(isset($_POST['sub2']))
{
$fileName=$_FILES['photo']['name'];
$fileName1=$_FILES['photo1']['name'];
$fileName2=$_FILES['photo2']['name'];


$a1=addslashes($_POST['a1']);
$a2=addslashes($_POST['a2']);
$a3=addslashes($_POST['a3']);
$a4=addslashes($_POST['a4']);
$a5=addslashes($_POST['a5']);
$a6=addslashes($_POST['a6']);
$a7=addslashes($_POST['a7']);
$a8=addslashes($_POST['a8']);
$a9=addslashes($_POST['a9']);
$a10=addslashes($_POST['a10']);
$a11=addslashes($_POST['a11']);
$a12=addslashes($_POST['a12']);
$a13=addslashes($_POST['a13']);

$a14=addslashes($_POST['a14']);

$ss=addslashes($_POST['ss']);



// $sqr=mysqli_query($db,"select * from service where a1='$a1' and image='$fileName' ");

// $sqr1=mysqli_query($db,"select * from service where a1='$a1' or image='$fileName' ");

// $sqr2=mysqli_query($db,"select * from service where h!='$a1' and image=='$fileName' ");

// if (mysqli_num_rows($sqr)>0)
// {
//     msg("This service and image already exist","service.php");
// }
// else if (mysqli_num_rows($sqr1)>0)
// {
//     msg("This service name or service image already exist","service.php");
// }
// else if (mysqli_num_rows($sqr2)>0)
// {
//     msg("This service image already exist","service.php");
// }
// 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/service/"; 
        $dest_path = $uploadFileDir . $newFileName;
        //$pd=date("d/m/y");
        
        
        list($width, $height, $type, $attr) = getimagesize($fileTmpPath);
           
        
      if($width=="307" && $height=="260")
       {
        CompressImage($_FILES['photo']['tmp_name'],  $dest_path,80);

        

        
        $fileTmpPath1 = $_FILES['photo1']['tmp_name'];
       
        $fileSize1 = $_FILES['photo1']['size'];
        $fileType1 = $_FILES['photo1']['type'];
        $fileNameCmps1 = explode(".", $fileName1);
        $fileExtension1 = strtolower(end($fileNameCmps1));
        $newFileName1 = md5(time() . $fileName1) . '.' . $fileExtension1;
        
        
        $newFileName1 = md5(time() . $fileName1) . '.' . $fileExtension1;
        $allowedfileExtensions1 = array('jpg', 'gif', 'png','jpeg');
        if (in_array($fileExtension1, $allowedfileExtensions1))
         {
        $uploadFileDir1 = "../images/service/"; 
        $dest_path1 = $uploadFileDir1 . $newFileName1;
        //$pd=date("d/m/y");
        
        
        list($width, $height, $type, $attr) = getimagesize($fileTmpPath1);
           
        
      if($width=="640" && $height=="440")
       {
        
        
            CompressImage($_FILES['photo1']['tmp_name'],  $dest_path1,80);

            $fileTmpPath2 = $_FILES['photo2']['tmp_name'];
       
        $fileSize2 = $_FILES['photo2']['size'];
        $fileType2 = $_FILES['photo2']['type'];
        $fileNameCmps2 = explode(".", $fileName2);
        $fileExtension2 = strtolower(end($fileNameCmps2));
        $newFileName2 = md5(time() . $fileName2) . '.' . $fileExtension2;
        
        
        $newFileName2 = md5(time() . $fileName2) . '.' . $fileExtension2;
        $allowedfileExtensions2 = array('jpg', 'gif', 'png','jpeg');
        if (in_array($fileExtension2, $allowedfileExtensions2))
         {
        $uploadFileDir2 = "../images/service/"; 
        $dest_path2 = $uploadFileDir2 . $newFileName2;
        //$pd=date("d/m/y");
        
        
        list($width, $height, $type, $attr) = getimagesize($fileTmpPath2);
           
        
      if($width=="491" && $height=="553")
       {
        
        
            CompressImage($_FILES['photo2']['tmp_name'],  $dest_path2,80);

            $ins=mysqli_query($db,"insert into service values('0','$newFileName','$a1','$a2','$a3','$a4','$a5','$a6','$a7','$a8','$a9','$a10','$a11','$a12','$a13','$newFileName1','$newFileName2','$a14','$ss')");

            msg(" successfully added","service.php");

        }
        else
        {
        
        
            msg("Image Size should be in width - 491px & height - 553px", "service.php");
       }
    }
    else
        {
        
        
            msg("Image extension should be jpg or png", "service.php");
        }
    }
    else
    {
    
    
        msg("Image Size should be in width - 640px & height - 440px", "service.php");
   }
}
else
    {
    
    
        msg("Image extension should be jpg or png", "service.php");
    }
}
else
{


    msg("Image Size should be in width - 307px & height - 260px", "service.php");
}
}
else
{


    msg("Image extension should be jpg or png", "service.php");
}
}


?>

<div class="row">
                        <div class="col-lg-12">
                            <div class="card">
                                <div class="card-header card-header2">
                                    <h4 class="card-title mb-0">View data</h4>
                                </div><!-- end card header -->

                                <div class="card-body">
                                    


                                    <table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%">
                                    <thead>
                                        <tr>
                                            <th>Image</th>
											<th>Heading</th>
                                            <th>Description</th>
                                            <th>Action</th>
                                           
                                          
                                        </tr>
                                    </thead>
                                    <tbody>

                                    <?php
                                    $s=mysqli_query($db,"select * from service order by id desc");
                                    while($r=mysqli_fetch_row($s))
                                    {

                                    ?>
                                        <tr>
                                        
                                            <td><img src="../images/service/<?php echo $r[1]?>" width="120" height="150px" class="img img-responsive img-circle"></td>
                                            <td><?php echo $r[3]?></td>
                                            <td><?php echo $r[4]?></td>
			
                                            <td>
                                                <a href="editservice.php?id=<?php echo $r[0]?>" title="Edit">
                                                <i class="ti-pencil-alt" class="mst"style="font-size: 15px !important;"></i>
                                                 </a>
                                                 <a href="javascript:deletepro_id(<?php echo $r[0]; ?>)" title="Delete" data-toggle="tooltip" data-original-title="Delete" title="Delete"><i class="ti-trash" class="mst"style="font-size: 15px !important;"></i>  </a>           
                                            </td>
                                            
                                        </tr>
                                        
                                       
                                        <?php
                                    }


                              ?>
                                       
                                        
                                    </tbody>
                                </table>
                                </div><!-- end card-body -->
                            </div><!-- end card -->
                        </div>
                        <!-- end col -->
                    </div>



</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>
