<!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>Edit Moulds</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);">Moulds</a></li>
                            <li class="breadcrumb-item active"><a href="javascript:void(0);">Edit Moulds</a></li>
                        </ol>
                    </div>
                </div>
				
				<div class="row">


                    <div class="col-12">
                        <div class="card">
                            <div class="card-header">
                               
                                   <!--  <div class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true"> -->
                                        <!-- <div class="modal-dialog modal-lg"> -->
                                           <!--  <div class="modal-content"> -->
                                                <!-- <div class="modal-header">
                                                  
                                                    
                                                </div> -->
                                           <div class="modal-body">

                                         <?php echo form_open_multipart(base_url(''),array('class'=>"form-horizontal edit_mold", 'id'=>"edit_mold")); ?>
                                                    
                                                        <?php if($this->session->flashdata('mold_success')){ ?>
                                                <div class="alert alert-success solid" style='text-align:center;'><?php echo $this->session->flashdata('mold_success'); ?></div>
                                            <?php } ?>              

                    <div class="col-xl-12 col-xxl-12 col-sm-12">
                        <div class="card">
                            <div class="card-header">
                                <h5 class="card-title">Edit Mold</h5>
                            </div>
                            <div class="card-body">
                               <div id='mold_success' class='alert alert-success solid' style='display:none;'></div>
                                    <div class="row">
                                        <input type="hidden" value="<?php echo $this->uri->segment(3); ?>" name="id" id="id" required="required">
                                        <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">
                                            </div>
                                        </div>

                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Mold Code:</label>
                                                <input type="text" required="required" name="code" id="code" value="<?php echo $get_mold_data[0]['code']; ?>"  class="form-control">
                                            </div>
                                        </div>
                                      
                                       
                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                                <div class="form-group">
                                                    <label class="form-label">Component:</label>
                                                    
                                                       <select data-live-search="true" name="product_id" id="product_id" class="form-control product_id">

                                                        <?php if($get_mold_data[0]['product_id']==0) { ?>

                                                            <option>Select Option</option>
                                                             <?php 

                                                          foreach ($get_products as $values) { ?>

                                                        <option value="<?php echo $values['id']; ?>"><?php echo $values['name']; ?></option>
                                                        
                                                     <?php  } ?>

                                                 <?php }else{ ?>

                                                        <option value="<?php echo $get_mold_data[0]['product_id']; ?>"><?php echo product_name($get_mold_data[0]['product_id']); ?></option>
                                                        
                                                             <?php 
                                                          foreach ($get_products as $values) { ?>

                                                        <option value="<?php echo $values['id']; ?>"><?php echo $values['name']; ?></option>
                                                        
                                                     <?php  } ?>

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

                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Manufacture:</label>
                                                <input type="text" name="manufacture" required="required" value="<?php echo $get_mold_data[0]['manufacture']; ?>" id="manufacture" placeholder="manufacture" class="form-control">
                                              
                                                
                                            </div>
                                        </div>


                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Mfg. Date:</label>
                                                    <input type="date" name="mfg_date" required="required" id="mfg_date" value="<?php echo $get_mold_data[0]['mfg_date']; ?>" placeholder="Date" class="form-control">
                                            </div>
                                        </div>

                                        

                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Cavity:</label>
                                                    <input type="text" name="cavity" id="cavity" placeholder="Cavity" value="<?php echo $get_mold_data[0]['cavity']; ?>" class="form-control">
                                            </div>
                                        </div>
                                        
                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Cycle Time (Minutes):</label>
                                                    <input type="text" name="cycle_time" required="required" id="cycle_time" value="<?php echo $get_mold_data[0]['cycle_time']; ?>" placeholder="Cycle Time" class="form-control">
                                            </div>
                                        </div>


                                          <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Total Cost:</label>
                                                    <input type="text" name="cost" id="cost" required="required" value="<?php echo $get_mold_data[0]['cost']; ?>" placeholder="Cost" class="form-control">
                                            </div>
                                        </div>

                                          <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Shelf Life Actual(Pcs):</label>
                                                    <input type="text" id="self_life" name="self_life" value="<?php echo $get_mold_data[0]['self_life']; ?>" placeholder="Self Life Actual" class="form-control">
                                            </div>
                                        </div> 

                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                               <label class="form-label">Shelf Life Start(Pcs):</label>
                                                    <input type="text" name="self_life_start" id="self_life_start" value="<?php echo $get_mold_data[0]['self_life_start']; ?>" placeholder="Selft Life Start" class="form-control">
                                            </div>
                                        </div>

                                    <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                               <label class="form-label">Shelf Life Remain(Pcs):</label>
                                                    <input type="text" name="self_life_remain" id="self_life_remain" value="<?php echo $get_mold_data[0]['self_life_remain']; ?>" placeholder="Selft Life Remain" class="form-control">
                                            </div>
                                        </div>


                                         <div class="col-lg-6 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"  id="machine_type" class="form-control" tabindex="-98">
                                                   <?php  if($get_mold_data[0]['machine_type']==0){ ?>
                                                    
                                                    <?php echo "<option value=''>Select Option</option>";?>

                                                   <?php } ?>
                                                        <?php  if($get_mold_data[0]['machine_type']==1){ ?>
                                                             <?php echo "<option value='1'>Blow</option>";?>
                                                        <?php }else if($get_mold_data[0]['machine_type']==2){ ?>
                                                             <?php echo "<option value='2'>Injection</option>"; ?>
                                                        <?php } ?>
                                                    </option>
                                                    <option value="2">Injection</option>
                                                   <option value="1">Blow</option>
                                                  
                                                   
                                                    </select>
                                            </div>
                                        </div>


                                      
                                        <input type="hidden" name="user_id" id="user_id" value="<?php echo $this->session->userdata('id');?>">
                                    </div>
                               
                            </div>
                        </div>
                    </div>
                     <button type="submit" class="btn btn-primary">Submit <i class="icon-arrow-right14 position-right"></i></button>


                                                </div>
                                                 
                                                    <?php form_close();?>
                                           <!--  </div> -->


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


        <!--**********************************
            Footer start
        ***********************************-->
        <div class="footer">
            <div class="copyright">
                <p>Copyright © Designed &amp; Developed by  2020</p>
            </div>
        </div>
        <!--**********************************
            Footer end
        ***********************************-->

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

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


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





  <script type='text/javascript'>

    $("#self_life_start").keyup(function() {

          var self_life = $('#self_life').val();
          var self_life_start = $('#self_life_start').val();
           var total = self_life-self_life_start;
          var output=parseInt(total).toLocaleString(); 
          $('#self_life_remain').val(output);
        });
        
    var edit_mold = $('#edit_mold');   
    
    edit_mold.on('submit',function(e){

        e.preventDefault();
        
        var molddata = edit_mold.serialize();
        
        var id = $('#id').val();

            $.ajax({
                type:'POST',
                url:'<?php echo base_url('Admin/edit_get_mold/');?>'+id,
                data:molddata,
                dataType:'json',
                success:function(data){
                    console.log('first'+data.status);
                    if(data.status === 'true'){
                        console.log('second'+data.status);
                        $('#mold_success').show().html('Mould Update Successfully').hide(3000);
                       setTimeout(function(){location.href="<?php echo base_url('Admin/mold'); ?>"} , 3000);
                    }else{
                        console.log('third'+data);          
                    }
                },
                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>