<!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 -->
       <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap.min.css">

</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><?php echo product_name($this->uri->segment('3')); ?></h4>
                        </div>
                    </div>
                   
                </div>
                <div class="row">
                    <div class="col-12">
                      <div class="col-xl-12 col-xxl-12 col-sm-12">
                             <div class="card">

                               <?php echo form_open(base_url(''),array('class'=>"form-horizontal add_fg_set", 'id'=>"add_fg_set")); ?>
                                 <?php if($this->session->flashdata('purchase_order_success')){ ?>
                                <div class="alert alert-success solid" style='text-align:center;'><?php echo $this->session->flashdata('purchase_order_success'); ?></div>
                            <?php } ?> 
                                <div class="card-body">
                                    <div id='purchase_order_success' class='alert alert-success solid' style='display:none;'></div>
                                       <div class="row">
                                          <input type="hidden" name="created" id="created" value="<?php echo date('Y-m-d H:i:s'); ?>" class="form-control required">
                                          <input type="hidden" value="<?php  echo $this->session->userdata('id'); ?>" name="user_id" id="user_id" class="form-control required">
                                             
                                            <div class="col-lg-4 col-md-6 col-sm-12">
                                              <input type="hidden" name="fg_id" value="<?php echo $this->uri->segment('3'); ?>">
                                                <div class="form-group">
                                                    <label class="form-label">Products:</label>
                                                    <select  data-live-search="true" name="product_id" required="required" id="product">
                                                        <option>Select Products</option>
                                                        <?php foreach ($products as $product) { ?>
                                                          <option value="<?php echo $product['id']; ?>"><?php echo $product['name']; ?></option>
                                                       <?php } ?>
                                                    </select>
                                                 </div>
                                                </div>
                                             </div>
                                                <button type="submit" id="dis_submit" class="btn btn-primary">Save <i class="icon-arrow-right14 position-right"></i></button>

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

                             <?php if($this->session->flashdata('party_danger')){ ?>
                                    <div class="alert alert-danger solid " style='text-align:center;'><?php echo $this->session->flashdata('party_danger'); ?></div>
                                <?php } ?>
                            <div class="card-body">
                                   <div id='party_danger' class='alert alert-danger solid' style='display:none;width: 40%;'></div>

                                <div class="table-responsive">
                                    <table id="example5" class="productDatatable" style="min-width: 775px">
                                         <thead>
                                            <tr>
                                                <th>ID:</th>
                                                <th>FG</th>
                                                <th>Product</th>
                                                <th>Created</th>
                                                <th>Action</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                                if(!empty($get_fg)){
                                             foreach($get_fg as $get_fgs){ ?>
                                            <tr>
                                               <td><?php echo $get_fgs['id']; ?></td>
                                                <td><strong><?php echo product_name($get_fgs['fg_id']); ?></strong></td>
                                                <td><strong><?php echo product_name($get_fgs['product_id']);
                                                  
                                                 ?></strong></td>
                                                <td><?php echo $get_fgs['created']; ?></td>
                                                <td>
                                                    <a href="javascript:void(0);" onclick="delete_data(<?php echo $get_fgs['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>
        <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
         <script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
         <script src="https://cdn.datatables.net/1.11.3/js/dataTables.bootstrap.min.js"></script>

         <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.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'>
        
    var add_order = $('#add_fg_set');   
    
    add_order.on('submit',function(e){
  $("#dis_submit").attr('disabled', true);
        e.preventDefault();
          if (confirm('Are you sure you want to Save.?')) {
  
        var add_add_order = add_order.serialize();
         var fgid = $('#fg_id').val();
      
            $.ajax({
                type:'POST',
                url:'<?php echo base_url('admin/add_fg_set'); ?>',
                data:add_add_order,
                dataType:'json',
                success:function(data){
                
                    console.log('first'+data.status);
                    if(data.status === 'true'){
                        console.log('second'+data.status);
                        $('#purchase_order_success').show().html('Product added Successfully');
                        location.reload(); 
                    }else{
                        console.log('third'+data);          
                    }
                },
                error:function(data){console.log(data.responseText);}
            });
        }
    });

    function delete_data(id) { 
        var id = id;
        if (confirm('Are you sure you want to Delete.?')) {
  

        var pro_id = $('#product_id').val();
         $.ajax({
                type:'POST',
                url:'<?php echo base_url('admin/delete_fg_set/'); ?>'+id,
                data:id,
                dataType:'json',
                success:function(data){
                    location.reload();
                    
                },
                error:function(data){console.log(data.responseText);}
            });

         //location.reload();

         } else {
  
            }
        } 




 function btnExport_monthly()
{
    
    var tab_text="<table border='2px'><tr bgcolor='#ebebeb'>";
    var textRange; var j=0;
    tab = document.getElementById('example'); // id of table

    for(j = 0 ; j < tab.rows.length ; j++) 
    {     
        tab_text=tab_text+tab.rows[j].innerHTML+"</tr>";
        //tab_text=tab_text+"</tr>";
    }

    tab_text=tab_text+"</table>";
    tab_text= tab_text.replace(/<A[^>]*>|<\/A>/g, "");//remove if u want links in your table
    tab_text= tab_text.replace(/<img[^>]*>/gi,""); // remove if u want images in your table
    tab_text= tab_text.replace(/<input[^>]*>|<\/input>/gi, ""); // reomves input params


    var ua = window.navigator.userAgent;
    var msie = ua.indexOf("MSIE "); 

    if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))      // If Internet Explorer
    {
        txtArea2.document.open("txt/html","replace");
        txtArea2.document.write(tab_text);
        txtArea2.document.close();
        txtArea2.focus(); 
        sa=txtArea2.document.execCommand("SaveAs",true,"Generation_School_Report");
    }  
    else                 //other browser not tested on IE 11
        sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text));  

    return (sa);
}
    
    </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> 