<!DOCTYPE html>
<html lang="en">


<!-- Mirrored from edumin.dexignlab.com/xhtml/add-departments.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 17 Nov 2020 13:56:15 GMT -->
<head>
  
  <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Rizwan </title>
  <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="<?php echo base_url();?>assets/images/favicon.png">
    <link rel="stylesheet" href="<?php echo base_url();?>assets/vendor/bootstrap-select/dist/css/bootstrap-select.min.css">
    <link rel="stylesheet" href="<?php echo base_url();?>assets/css/style.css">
  <!-- Pick date -->
    <link rel="stylesheet" href="<?php echo base_url();?>assets/vendor/pickadate/themes/default.css">
    <link rel="stylesheet" href="<?php echo base_url();?>assets/vendor/pickadate/themes/default.date.css">
     <link href="<?php echo base_url();?>assets/vendor/datatables/css/jquery.dataTables.min.css" rel="stylesheet">
    <!-- Custom Stylesheet -->
     

</head>

<body>

    <!--*******************
        Preloader start
    ********************-->
        <div id="preloader">
        <div class="sk-three-bounce">
            <div class="sk-child sk-bounce1"></div>
            <div class="sk-child sk-bounce2"></div>
            <div class="sk-child sk-bounce3"></div>
        </div>
    </div>
    <!--*******************
        Preloader end
    ********************-->

    <!--**********************************
        Main wrapper start
    ***********************************-->
    <div id="main-wrapper">

      <?php  $this->load->view('header'); ?>
    
        <!--**********************************
            Content body start
        ***********************************-->
        <div class="content-body">
            <!-- row -->
            <div class="container-fluid">
            
                <div class="row page-titles mx-0">
                    <div class="col-sm-6 p-md-0">
                        <div class="welcome-text">
                            <h4>QC Machine</h4>
                        </div>
                    </div>
                    <div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="index.html">Home</a></li>
                            <li class="breadcrumb-item active"><a href="javascript:void(0);">QC Machine</a></li>
                            <li class="breadcrumb-item active"><a href="javascript:void(0);">Add QC Machine</a></li>
                        </ol>
                    </div>
                </div>
        
        <div class="row">


      <div class="col-12">
          <div class="card">
              <div class="card-header">
                
                                    
                                                
      <?php echo form_open(base_url(''),array('class'=>"form-horizontal add_qc_machine", 'id'=>"add_qc_machine")); ?>
                            
        <div class="col-xl-12 col-xxl-12 col-sm-12">
           <div class="card">
              <div class="card-header">
                  <h5 class="card-title"></h5>
              </div>
                  <div class="card-body">
                <div id='add_qc_machines' class='alert alert-success solid' style='display:none;'></div>
                
                   <div id='party_danger' class='alert alert-danger solid' style='display:none;'></div>
          <div class="row">

                                     <div class="col-lg-6 col-md-6 col-sm-12">
            <div class="form-group">
               
                <input type="hidden" name="created" id="created" value="<?php echo date('Y-m-d H:i:s'); ?>" class="form-control required">
            </div>
        </div>

        <div class="col-lg-6 col-md-6 col-sm-12">
            <div class="form-group">
               
                <input type="hidden" value="<?php echo date('Y-m-d H:i:s'); ?>" name="modified" id="modified" class="form-control required">
                <input type="hidden" value="<?php echo date('Y-m-d'); ?>" name="insert_date" id="insert_date" class="form-control required">
               
            </div>
        </div>

          <input type="hidden" name="user_id" id="user_id" value="<?php echo $this->session->userdata('id');?>">

                    <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Select Shift:</label>
                                 <select class="form-control day_night" data-live-search="true" required name="day_night" required id="day_night">
                                <option value="">Select Shift</option>
                                <option value="1">Day</option>
                                <option value="2">Night</option>
                            </select>
                             </div> 
                             
                           </div>
                      

                               <!--      <div class="col-lg-3 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Machine Type:</label>
                                                <select data-live-search="true" name="machine_type" required  id="machine_type" class="form-control" tabindex="-98">
                                                    <option value="">Select Option</option>
                                                    <option value="2">Injection</option>
                                                   <option value="1">Blow</option>
                                                  
                                                   
                                                    </select>
                                            </div>
                                        </div>
 -->

                         <div class="col-lg-3 col-md-6 col-sm-12">
                         <div class="form-group">
                                          <label class="form-label">Machine:</label>
                                          <select class="form-control machine"  name="machine" required="required" id="machine">
                                              <option>Select Machine</option>
                                              <?php foreach ($get_machine as $machine) { ?>
                                                <option value="<?php echo $machine['machine']; ?>"><?php echo machine_name($machine['machine']); ?></option>
                                             <?php } ?>
                                          </select>
                                       </div>
                                      </div>   


                                       <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Job No:</label>
                                  <input type="number" id="job" name="job" readonly="readonly" required  class="form-control job">
                             </div> 
                             
                           </div>    

                         <!--    <div class="col-lg-3 col-md-6 col-sm-12">
                          <div class="form-group product_id">
                            <label class="form-label">Moulds:</label>
                         </div>
                        </div> -->


                           <!-- <div class="col-lg-3 col-md-6 col-sm-12">
                          <div class="form-group">
                            <label class="form-label">Raw Materials:</label>
                            <select class="form-control material_id" data-live-search="true" required  name="material_id"  id="material_id">
                                <option>Select Raw Materials</option>
                                <?php foreach ($get_materials as $get_raws) { ?>
                                  <option value="<?php echo $get_raws['id']; ?>"><?php echo $get_raws['name']; ?></option>

                               <?php } ?>
                            </select>
                         </div>
                        </div> -->

                        <div class="col-lg-3 col-md-6 col-sm-12">
                       <div class="form-group">
                            <label class="form-label">Product:</label>
                             <input type="text" id="product_name" name="product_id" readonly="readonly" placeholder="Product Name" required="required"  class="form-control product_name">
                         </div>
                        </div>

                        <div class="col-lg-3 col-md-6 col-sm-12">
                       <div class="form-group">
                            <label class="form-label">Material:</label>
                             <input type="text" id="material" name="material_id"  placeholder="Material Name" readonly="readonly" required="required"  class="form-control ">
                         </div>
                        </div>

                         <!-- <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Report Date:</label>
                                  <input type="date" id="report_date" name="report_date" required  class="form-control job">
                             </div> 
                             
                           </div> -->
                    <!--       <input type="hidden" id="report_date" name="report_date" value="<?php echo date('Y-m-d'); ?>" required="required"  class="form-control job">-->
                              <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Date:</label>
                                  <input type="date" id="report_date" name="report_date" required="required"  class="form-control job">
                             </div> 
                             
                           </div>

                           <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">10 M.R.Mould:</label>
                                  <input type="number" id="mr_mould" name="mr_mould" required  class="form-control mr_mould">
                             </div> 
                             
                           </div>


                           <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">PCS Of Cavity:</label>
                                  <input type="text" id="pcs_cavity" name="pcs_cavity" onkeypress="return isNumberKey(event)" required  class="form-control pcs_cavity">
                             </div> 
                             
                           </div>


                           <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Weight:</label>
                                  <input type="text" id="weight" name="weight" onkeypress="return isNumberKey(event)" required  class="form-control weight">
                             </div> 
                             
                           </div>

                         <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Finishing:</label>
                                 <select name="finishing" id="finishing" required class="form-control finishing">
                                  <option>Select Finishing</option>
                                  <option value="OK">OK</option>
                                  <option value="NOT OK">NOT OK</option>
                                 </select>
                             </div> 
                             
                           </div>


                           <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Fitting:</label>
                                 <select name="fitting" id="fitting" required class="form-control fitting">
                                  <option>Select Fitting</option>
                                  <option value="OK">OK</option>
                                  <option value="NOT OK">NOT OK</option>
                                 </select>
                             </div> 
                             
                           </div>
                           
                           
                           <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Engriving:</label>
                                 <select name="engriving" id="engriving" required class="form-control engriving">
                                  <option>Select Fitting</option>
                                  <option value="OK">OK</option>
                                  <option value="NOT OK">NOT OK</option>
                                 </select>
                             </div> 
                             
                           </div>


                           <div class="col-lg-3 col-md-6 col-sm-12">
                           <div class="form-group">
                                <label class="form-label">Color:</label>
                                  <input type="text" id="color" name="color" required  class="form-control color">
                             </div> 
                             
                           </div>


                        <div class="col-lg-6 col-md-6 col-sm-12">
                            <div class="form-group">
                                <label class="form-label">Remarks:</label>
                                <textarea  class="form-control remarks" name="remarks" id="remarks"></textarea>  
                             </div>
                         </div>
                        
                 </div>
                  <button type="submit" id="dis_submit" class="btn btn-primary">Save <i class="icon-arrow-right14 position-right"></i></button>
                    </div>
                                        
                                  </div>
                              </div></div>
                    
                              <?php form_close();?>
                              <div class="card-body">
                                
                                <div class="table-responsive">
                                    <table id="example5" class="display" style="min-width: 845px;font-size: 12px;">

                                        <thead>
                                            <tr>
                                               <th>Shift</th>
                                                <th>Machine</th>
                                                <th>Item</th>
                                                <th>Material</th>
                                                <th>10 M.R.Mould</th>
                                                <th>PCS Cavity</th>
                                                <th>Weight</th>
                                                <th>Finishing</th>
                                                <th>Fitting</th>
                                                <th>Color</th>
                                                
                                                <th>Date</th>
                                                <th>Action</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                           
                                          <?php
                                                if(!empty($get_qc_machine)){
                                             foreach($get_qc_machine as $get_qc_machines){ ?>
                                            <tr>

                                              <td>
                                                <?php 
                                                if($get_qc_machines['day_night']==1){ ?>

                                                 <img src="<?php echo base_url(); ?>/assets/image/day.png" style="width: 45px;border-radius: 23px;">
                                              <?php }else if($get_qc_machines['day_night']==2){ ?>

                                                <img src="<?php echo base_url(); ?>/assets/image/night.png" style="width: 45px;border-radius: 23px;">

                                             <?php }

                                               ?></td>
                                               
                                                <td><?php echo @machine_name($get_qc_machines['machine_id']); ?></td>
                                                <?php  if($get_qc_machines['product_id']!=""){ ?>
                                                <td><?php echo @product_name($get_qc_machines['product_id']); ?></td>
                                                <?php }else{ ?>
                                                <td><?php echo "0"; ?></td>
                                                <?php } ?>
                                                <td><?php echo material_name($get_qc_machines['material_id']); ?></td>
                                                <td><?php echo $get_qc_machines['mr_mould']; ?></td>
                                                <td><?php echo $get_qc_machines['pcs_cavity']; ?></td>
                                                <td><?php echo $get_qc_machines['weight']; ?></td>
                                                <td><?php echo $get_qc_machines['finishing']; ?></td>
                                                <td><?php echo $get_qc_machines['fitting']; ?></td>
                                                <td><?php echo $get_qc_machines['color']; ?></td>
                                               
                                                <td><?php echo $get_qc_machines['created']; ?></td>
                                                <td>
                                                    <a href="<?php echo base_url('Order_qc/edit_machine_qc/'.$get_qc_machines['id']); ?>" class="btn btn-sm btn-primary"><i class="la la-pencil"></i></a>
                                                   <a href="javascript:void(0);" onclick="delete_data(<?php echo $get_qc_machines['id']; ?>)" class="btn btn-sm btn-danger"><i class="la la-trash-o"></i></a>
                                                </td>                                               
                                            </tr>
                                           <?php }
                                                }
                                            ?> 
                                        </tbody>
                                    </table>
                                </div>


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

    
                            
                        





          
        </div>
            </div>
        </div>
        <!--**********************************
            Content body end
        ***********************************-->


        <!--**********************************
            Footer start
        ***********************************-->
        
        <!--**********************************
            Footer end
        ***********************************-->

    <!--**********************************
           Support ticket button start
        ***********************************-->

        <!--**********************************
           Support ticket button end
        ***********************************-->


    </div>
    <!--**********************************
        Main wrapper end
    ***********************************-->

    <!--**********************************
        Scripts
    ***********************************-->
  <!-- Required vendors -->
        <script src="<?php echo base_url();?>assets/js/jjquery.min.js"></script>
        <style>
        .redborder{
            border:1px solid red;
        }
        </style>

        <SCRIPT language=Javascript>
       <!--
       function isNumberKey(evt)
       {
          var charCode = (evt.which) ? evt.which : evt.keyCode;
          if (charCode != 46 && charCode > 31 
            && (charCode < 48 || charCode > 57))
             return false;

          return true;
       }
       //-->
    </SCRIPT>

   <script type='text/javascript'>


     $("#machine").change(function() {

           var machine =  this.value;
                //alert(id);

        $.ajax({
                    type:'POST',
                    url:'<?php echo base_url('Order_qc/get_item_production'); ?>',
                    data:{machine:machine},
                    dataType:'json',
                    success:function(data){
                    
                            $('#product_name').val(data.product_name);
                            $('#job').val(data.job);
                            $('#material').val(data.material);

                            $('#material_id').val(data.material_id);
                              
                          
                    },
                    error:function(data){console.log(data.responseText);}
                });

    });


       var add_qc_machines = $('#add_qc_machine');   
    
    add_qc_machines.on('submit',function(e){
      
        e.preventDefault();
        if (confirm('Are you sure you want to Add.?')) {
        var add_qc_machinesdata = add_qc_machines.serialize();
        
      $("#dis_submit").attr('disabled', true);
            $.ajax({
                type:'POST',
                url:'<?php echo base_url('Order_qc/add_qc_machine'); ?>',
                data:add_qc_machinesdata,
                dataType:'json',
                success:function(data){
                    console.log('first'+data.status);
                    if(data.status === 'true'){
                        console.log('second'+data.status);
                        $('#add_qc_machines').show().html('Added Successfully');
                       location.href="<?php echo base_url('Order_qc/add_qc_machine'); ?>";
                    }else{
                        console.log('third'+data);          
                    }
                },
                error:function(data){console.log(data.responseText);}
            });
       }
    });


    
    $("#machine_type").change(function() {

                
    
                var machine_type =  this.value;
                //alert(id);
               
                $.ajax({
                            type:'POST',
                            url:'<?php echo base_url('Order_qc/get_mould_product'); ?>',
                            data:{machine_type:machine_type},
                            dataType:'json',
                            success:function(data){
                            
                                    
                                    $('.product_id').show().html(data.html);

                                   
                               
                            },
                            error:function(data){console.log(data.responseText);}
                        });

              

    });


    $("#machine_type").change(function() {

                
    
                var machine_type =  this.value;
              
                $.ajax({
                            type:'POST',
                            url:'<?php echo base_url('Order_qc/get_machine'); ?>',
                            data:{machine_type:machine_type},
                            dataType:'json',
                            success:function(data){
                            

                                     $('.machine_id').show().html(data.html);
                               
                            },
                            error:function(data){console.log(data.responseText);}
                        });

              

    });

    function delete_data(id) { 
        var id = id;
        
         $.ajax({
                type:'POST',
                url:'<?php echo base_url('Order_qc/delete_qc_machine_entry/'); ?>'+id,
                data:id,
                dataType:'json',
                success:function(data){
                    console.log('first'+data.status);
                    
                        console.log('second'+data.status);
                        //debugger;
                        $('#party_danger').show().html('Qc Machine Deleted Successfully');
                       setTimeout(function(){location.href="<?php echo base_url('Order_qc/add_qc_machine'); ?>"} , 3000);
                    
                },
                error:function(data){console.log(data.responseText);}
            });
        } 


    
    </script>   

     <?php  $this->load->view('footer'); ?>
        
</body>

<!-- Mirrored from edumin.dexignlab.com/xhtml/add-departments.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 17 Nov 2020 13:56:15 GMT -->
</html>