               <script src="<?php echo base_url();?>assets/choosen.js"></script>
                <link rel="stylesheet" href="<?php echo base_url();?>assets/style.css">

                    <?php echo form_open_multipart(base_url(''),array('class'=>"form-horizontal add_clear", 'id'=>"add_clear")); ?>
        

                      <?php if($this->session->flashdata('product_success')){ ?>
                            <div class="alert alert-success solid" style='text-align:center;'><?php echo $this->session->flashdata('product_success'); ?></div>
                        <?php } ?>           

                         <div class="col-xl-12 col-xxl-12 col-sm-12">
                            <div class="card">
                                
                                <div class="card-body">
                                    <div id='product_success' class='alert alert-success solid' style='display:none;'></div>

                                    
                                     <div id='vailable_machine' 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">
                                                    <label class="form-label">Machine:</label>
                                                      <select  name="machine" id="machine" class="form-control " required="required">

                                                        <option>Select Machine</option>
                                                       
                                                      <?php 
                                                          foreach ($get_machine_data as $values) { ?>



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


                                                <div class="col-lg-6 col-md-6 col-sm-12">
                                                <div class="form-group">
                                                    <label class="form-label">Day Expected Production:</label>
                                                      <input type="date" name="expected" required="required" id="expected"  class="form-control ">
                                                 </div>
                                                </div>
                                            
                                           
                                             <div class="col-lg-6 col-md-6 col-sm-12" id="carton_div">
                                                <div class="form-group">
                                                    <label class="form-label">Remarks</label>
                                                       <textarea name="remarks" class="form-control" id="remarks"> </textarea>
                                                </div>
                                            </div>
                                       
                       
                                    <input type="hidden" name="so_id" id="so_id" value="<?php echo $get_details_moulds[0]['so_id']; ?>">

                                      <input type="hidden" name="product_id" id="product_id" value="<?php $item = product_id($get_details_moulds[0]['product_name']);  echo $item; ?>"> 
                                        
                                         <input type="hidden" name="created" id="created" value="<?php echo date('Y-m-d H:i:s'); ?>" class="form-control required">

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

	<!-- Required vendors -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

    <script type='text/javascript'>
    $(".machine").chosen();

  var clear = $('#add_clear');   
    
    clear.on('submit',function(e){

       
        e.preventDefault();
        
        var cleardata = clear.serialize();
        if (confirm('Are you sure you want to Add Machine Details.?')) {

      
            $.ajax({
                type:'POST',
                url:'<?php echo base_url('Requisition/machine_department'); ?>',
                data:cleardata,
                dataType:'json',
                success:function(data){
                    console.log('first'+data.status);
                    if(data.status === 'true'){
                        console.log('second'+data.status);
                        $('#product_success').show().html('Machine added Successfully');
                       setTimeout(function(){location.href="<?php echo base_url('Requisition/machine_department'); ?>"} , 3000);
                    }else if(data.status =='available'){

                         $('#vailable_machine').show().html('Machine In-process...!!');
                        console.log('third'+data);          
                    }
                },
                error:function(data){console.log(data.responseText);}
            });
        }
    });

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