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


                    <div class="col-12">
                        <div class="card">
                            <div class="card-header">
                               <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bd-example-modal-lg">Add Vendor</button>
                               <button type="button" class="btn btn-rounded btn-success" onclick="btnExport_monthly();"><span class="btn-icon-left text-success"><i class="fa fa-download color-success"></i>
                                    </span>Download</button>
                                    <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">
                                                  
                                                    <button type="button" class="close" data-dismiss="modal"><span>&times;</span>
                                                    </button>
                                                </div>
                                                <div class="modal-body">
                                             <?php echo form_open(base_url(''),array('class'=>"form-horizontal add_vendor", 'id'=>"add_vendor")); ?>
                                                    
                                                        <?php if($this->session->flashdata('vendor_success')){ ?>
                                                <div class="alert alert-success solid" style='text-align:center;'><?php echo $this->session->flashdata('vendor_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">Add Vendor</h5>
                                                </div>
                                                <div class="card-body">
                                                    <div id='vendor_success' class='alert alert-success 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">Vendor Name</label>
                                                <input type="text" placeholder="Vendor Name" required="required" name="vendor_name" id="vendor_name" class="form-control">
                                            </div>
                                        </div>

                                       <!-- <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Vendor Category</label>

                                                <select class="form-control" name="type_vender" tabindex="-98">
                                                    <option value="">Select Type</option>
                                                    <?php //foreach ($vendor_type as $vendor_types)
                                                    //{ ?>
                                                   <option value="<?php //echo $vendor_types['id']; ?>"><?php// echo $vendor_types['type']; ?></option>
                                                    <?php //}?>
                                                  </select>

                                            </div>
                                        </div>-->

                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Contact Person</label>
                                                <input type="text" placeholder="Contact Person Name" required="required" name="contact_person" id="contact_person" class="form-control">
                                            </div>
                                        </div>


                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Company/Occupation</label>

                                                <select class="form-control" name="occupation" tabindex="-98">
                                                    <option value="">Select Product</option>
                                                   <option value="RAW MATERIAL">RAW MATERIAL</option>
                                                    <option value="SECONDARY PACKING">SECONDARY PACKING</option>
                                                     <option value="Mould">Mould</option>
                                                    <option value="MASTERBATCHES">MASTERBATCHES</option>
                                                    <option value="MACHINERY">MACHINERY</option>
                                                    <option value="WAD/INDUCTION SEAL">WAD/INDUCTION SEAL</option>
                                                    <option value="DIESEL">DIESEL</option>
                                                     <option value="FG SUPPLIER">FG SUPPLIER</option>
                                                     <option value="PRINTING(OUTSIE LABOUR)">PRINTING(OUTSIE LABOUR)</option>
                                                     <option value="OUTSIDE LABOUR">OUTSIDE LABOUR</option>
                                                     <option value="MASTERBATCHES/COLOR">MASTERBATCHES/COLOR</option>


                                                    </select>

                                            </div>
                                        </div>
                                        
                                       
                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Attn Number</label>
                                                    <input type="number" id="attn" name="attn" required="required" placeholder="Attn Number" class="form-control">
                                            </div>
                                        </div>
                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Strn Number</label>
                                                    <input type="number" id="strn" name="strn" required="required" placeholder="Strn Number" class="form-control">
                                            </div>
                                        </div>
                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">Phone</label>
                                                    <input type="text" name="phone" id="phone" required="required" placeholder="Phone" class="form-control">
                                            </div>
                                        </div>

                                      

                                        <div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label class="form-label">E-mail</label>
                                                    <input type="email" name="email" required="required" id="email" placeholder="E-mail" class="form-control">
                                            </div>
                                            </div>

                                            <div class="col-lg-6 col-md-6 col-sm-12">
                                                <div class="form-group">
                                                    <label class="form-label">Address:</label>
                                                    <textarea name="address" id="address" required="required" class="form-control required" rows="5"></textarea>
                                                </div>
                                            </div>
                                            <input type="hidden" name="user_id" id="user_id" value="<?php echo $this->session->userdata('id');?>">
                                                        </div>
                                                    
                                                </div>
                                            </div>
                                        </div>



                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                                                    <button type="submit" class="btn btn-primary">Submit <i class="icon-arrow-right14 position-right"></i></button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <?php form_close();?>
                            </div>
                            <div class="card-body">
                                <?php if($this->session->flashdata('vendor_danger')){ ?>
                                    <div class="alert alert-danger solid " style='text-align:center;'><?php echo $this->session->flashdata('vendor_danger'); ?></div>
                                <?php } ?>
                                 <div id='vendor_danger' class='alert alert-danger solid' style='display:none;width: 25%;'></div>
                                <div class="table-responsive">
                                    <table id="example5" class="display" style="min-width: 845px">
                                        <thead>
                                            <tr>
                                                <th>Vendor Name</th>
                                                <th>Contact Person</th>
                                                
                                                <th>Phone</th>
                                               
                                                <th>Action</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                                if(!empty($get_vendors)){
                                             foreach($get_vendors as $get_vendors){ ?>
                                            <tr>
                                               <td><?php echo $get_vendors['vendor_name']; ?></td>
                                                <td><strong><?php echo $get_vendors['contact_person']; ?></strong></td>
                                              
                                               <td><?php echo $get_vendors['phone']; ?></td>
                                               
                                                <td>
                                                    <a href="<?php echo base_url('Admin/edit_get_vendor/'.$get_vendors['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_vendors['id']; ?>)" class="btn btn-sm btn-danger"><i class="la la-trash-o"></i></a>

                                                    <a href="javascript:void(0);" onclick="get_data(<?php echo $get_vendors['id']; ?>)" class="btn btn-sm btn-warning">View</a>
                                                </td>                                               
                                            </tr>
                                           <?php }
                                                }
                                            ?>
                                           
                                        </tbody>
                                    </table>
                                </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 type='text/javascript'>
        
    var vendor = $('#add_vendor');   
    
    vendor.on('submit',function(e){

        e.preventDefault();
        
        var vendordata = vendor.serialize();
        
      
            $.ajax({
                type:'POST',
                url:'<?php echo base_url('Admin/vendors'); ?>',
                data:vendordata,
                dataType:'json',
                success:function(data){
                    console.log('first'+data.status);
                    if(data.status === 'true'){
                        console.log('second'+data.status);
                        $('#vendor_success').show().html('vendor added Successfully').hide(3000);
                       setTimeout(function(){location.href="<?php echo base_url('Admin/vendors'); ?>"} , 3000);
                    }else{
                        console.log('third'+data);          
                    }
                },
                error:function(data){console.log(data.responseText);}
            });
       // }
    });

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



         function btnExport_monthly()
{
    
    var tab_text="<table border='2px'><tr bgcolor='#ebebeb'>";
    var textRange; var j=0;
    tab = document.getElementById('example5'); // 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>