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


                    <div class="col-12">
                        <div class="card">
                            
                            <div class="card-body">
                              <div class="modal-body">
                                          <?php echo form_open(base_url(''),array('class'=>"form-horizontal edit_products", 'id'=>"edit_products")); ?>   

                                          <?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-header">
                                                        <h5 class="card-title">Edit Products</h5>
                                                    </div>
                                                    <div class="card-body">
                                                        <div id='product_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">Product Type</label>
                                                                        <select name="product_type" id="product_type" required="required" class="form-control" tabindex="-98">
                                                                            <option value="<?php echo $get_products_data[0]['product_type']; ?>"><?php echo get_product_type($get_products_data[0]['product_type']); ?></option>
                                                                            <?php foreach ($get_pro_type as $get_pro_type) { ?>
                                                                                <option value="<?php echo $get_pro_type['id']; ?>"><?php echo $get_pro_type['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">Description</label>
                                                                            <input type="text" name="name" required="required" id="name" placeholder="Product Name" value="<?php echo $get_products_data[0]['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">Product Weight</label>
                                                                            <input type="text" name="weight" required="required" value="<?php echo $get_products_data[0]['weight']; ?>" required id="weight" placeholder="Product Weight" class="form-control">
                                                                    </div>
                                                                </div>

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

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

                                                                <div class="col-lg-6 col-md-6 col-sm-12">
                                                                    <div class="form-group">
                                                                        <label class="form-label">Color Code</label>
                                                                            <input type="text" required name="color_code" required="required" value="<?php echo $get_products_data[0]['color_code']; ?>" id="color_code" placeholder="Color 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">Color Ratio</label>
                                                                            <input type="text"  name="color_ratio" required="required" value="<?php echo $get_products_data[0]['color_ratio']; ?>" id="color_ratio" placeholder="Color Ratio" class="form-control">
                                                                    </div>
                                                                </div>

                                                                <div class="col-lg-6 col-md-6 col-sm-12">
                                                                    <div class="form-group">
                                                                        <label class="form-label">Remarks</label>
                                                                            <input type="text" required name="remarks" value="<?php echo $get_products_data[0]['remarks']; ?>" id="remarks" placeholder="Remarks" class="form-control">
                                                                    </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>
                                                                <input type="hidden" name="user_id" id="user_id" value="<?php echo $this->session->userdata('id');?>"> 

                                                                
                                                                <button type="submit" class="btn btn-primary">Submit <i class="icon-arrow-right14 position-right"></i></button>
                                                            </div>
                                                       
                                                    </div>
                                                </div>
                                            </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="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
        <style>
        .redborder{
            border:1px solid red;
        }
        </style>

    <script type='text/javascript'>
        
    var edit_products = $('#edit_products');   
    
    edit_products.on('submit',function(e){

        e.preventDefault();
        
        var productdata = edit_products.serialize();
        var id = $('#id').val();
       /* var assetserror = 0;
        $('.required').each(function(){
            if($(this).val() == ''){$(this).addClass('redborder');assetserror = assetserror + 1;}else{$(this).removeClass('redborder');}
        });
        if(assetserror > 0){return false;}
        else
        {*/
            $.ajax({
                type:'POST',
                url:'<?php echo base_url('Masterlist/edit_get_products/'); ?>'+id,
                data:productdata,
                dataType:'json',
                success:function(data){
                    console.log('first'+data.status);
                    if(data.status === 'true'){
                        console.log('second'+data.status);
                        $('#product_success').show().html('Product Update Successfully').hide(3000);
                       setTimeout(function(){location.href="<?php echo base_url('Masterlist/products'); ?>"} , 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>