Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/indolok.id/application/views/admin/products/ |
Upload File : |
<div class="row"> <div class="col-sm-12"> <p><a href="<?= base_url('admin/dashboard'); ?>"><i class="fa fa-arrow-left" aria-hidden="true"></i> Kembali ke Awal</a></p><br> <h2>Products Administration</h2> <?= $this->session->flashdata('success'); //to display success message ?> <?= $this->session->flashdata('result'); //to display result message ?> </div><!-- end class="col-sm-12" --> </div> <!-- end row --> <div class="row" style="display:none;"> <div class="col-sm-12"> <p><a href="<?= base_url('admin/product_excel_export'); ?>"><img src="<?= base_url('assets/admin/img/excel-icon.png'); ?>"> EXPORT KE MS EXCEL</a></p> <p>(Export File Excel)</p> </div> </div> <div> <!-- Nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a aria-controls="search" href="#search" role="tab" data-toggle="tab">Cari Produk</a></li> <!-- <li role="presentation"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Quick Edit Product</a></li> <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Category Discount</a></li> <li role="presentation"><a href="#productordering" aria-controls="productordering" role="tab" data-toggle="tab">Product Ordering</a></li> <li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Import Product Photo</a></li> --> <!-- <li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Update Harga Produk </a></li> --> <!-- <?php if($role == 'super admin') : ?> <li role="presentation"><a href="#settings2" aria-controls="settings" role="tab" data-toggle="tab">Update Stok </a></li> <?php endif; ?> --> </ul> <!-- Tab panes --> <div class="tab-content"> <div role="tabpanel" class="tab-pane active" id="search"> <h3>Cari Produk</h3> <div class="row"> <?= form_open('admin/products'); ?> <div class="col-sm-5 col-xs-6"> <input class="form-control" type="text" placeholder="Enter Product Name" name="product" required <?php if (isset($keyword)) : ?> value="<?= ucwords($keyword); ?>" <?php endif; ?>> </div><!-- end class="col-sm-8" --> <div class="col-sm-3 col-xs-6"> <input class="btn btn-primary form-control" type="submit" name="search_product" value="SEARCH PRODUCT"> </div><!-- end class="col-sm-6" --> <?= form_close(); ?> </div> <!-- end row --> <div class="row"> <?= form_open('admin/products/search_category'); ?> <div class="col-sm-5 col-xs-6"> <?php //get parent category id and name and parent from categories table $this->db->select('id_categories, category')->from('categories')->where('parent', NULL)->order_by('priority', 'ASC'); $categories = $this->db->get()->result(); ?> <select name="category" class="form-control"> <option value="">Select Category ...</option> <?php foreach ($categories as $category) : ?> <option value="<?= $category->id_categories; ?>" <?php if (isset($category_id)) : ?> <?php if ($category->id_categories == $category_id) : ?> selected <?php endif; ?> <?php endif; ?> ><?= ucwords($category->category); ?></option> <?php //check if the current id does have child $this->db->select('*')->from('categories')->where('parent', $category->id_categories); $count_child_category = $this->db->get()->num_rows(); ?> <?php if ($count_child_category > 0): ?> <?php //get all existing child categories $this->db->select('id_categories, category')->from('categories')->where('parent', $category->id_categories)->order_by('priority', 'ASC'); $child_categories = $this->db->get()->result(); ?> <?php foreach ($child_categories as $child_category) : ?> <option style="margin-left: 10px;"value="<?= $child_category->id_categories; ?>" <?php if (isset($category_id)) : ?> <?php if ($child_category->id_categories == $category_id) : ?> selected <?php endif; ?> <?php endif; ?> >- <?= ucwords($child_category->category); ?></option> <?php //check if the current id does have child $this->db->select('*')->from('categories')->where('parent', $child_category->id_categories); $count_child2_category = $this->db->get()->num_rows(); ?> <?php if ($count_child2_category > 0): ?> <?php //get all existing child categories $this->db->select('id_categories, category')->from('categories')->where('parent', $child_category->id_categories)->order_by('priority', 'ASC'); $child2_categories = $this->db->get()->result(); ?> <?php foreach ($child2_categories as $child2_category) : ?> <option style="margin-left: 10px;"value="<?= $child2_category->id_categories; ?>" <?php if (isset($category_id)) : ?> <?php if ($child2_category->id_categories == $category_id) : ?> selected <?php endif; ?> <?php endif; ?> >-- <?= ucwords($child2_category->category); ?></option> <?php endforeach; ?> <?php endif ?> <?php endforeach; ?> <?php endif ?> <?php endforeach; ?> </select> </div><!-- end class="col-sm-5" --> <div class="col-sm-3 col-xs-6"> <input class="btn btn-primary form-control" type="submit" name="search_category" value="SEARCH BY CATEGORY"> </div><!-- end class="col-sm-3" --> <?= form_close(); ?> </div> <!-- end row --> <div class="row"> <?= form_open('admin/products/search_brand'); ?> <div class="col-sm-5 col-xs-6"> <select name="brand" class="form-control"> <?php //get brands id and name from brandsa table $this->db->select('id_brands, brand')->from('brands')->order_by('brand', 'ASC'); $brands = $this->db->get()->result(); ?> <option value="">Select Brand ...</option> <?php foreach ($brands as $brand) : ?> <?php if ($brand->id_brands != 0) : ?> <option value="<?= $brand->id_brands; ?>" <?php if (isset($brand_id)) : ?> <?php if ($brand->id_brands == $brand_id) : ?> selected <?php endif; ?> <?php endif; ?> ><?= ucwords($brand->brand); ?></option> <?php endif; ?> <?php endforeach; ?> </select> </div><!-- end class="col-sm-8" --> <div class="col-sm-3 col-xs-6"> <input class="btn btn-primary form-control" type="submit" name="search_brand" value="SEARCH BY BRAND"> </div><!-- end class="col-sm-6" --> <?= form_close(); ?> </div> <!-- end row --> </div> <div role="tabpanel" class="tab-pane" id="home"> <div class="row" style="border:1px solid #ddd;"> <div class="col-sm-12"> <h3>Quick Edit Product Price & Stock</h3> <p><a href="<?= base_url('admin/products/quick_edit'); ?>"><button class="btn btn-primary">CLICK HERE TO EDIT</button></a></p> </div><!-- end class="col-sm-12" --> </div> <!-- end row --> </div> <div role="tabpanel" class="tab-pane" id="profile"> <div class="row" style="border:1px solid #ddd;"> <div class="col-sm-12"> <h3>Edit Category Discount</h3> <p><a href="<?= base_url('admin/category_discount'); ?>"><button class="btn btn-primary">CLICK HERE TO EDIT</button></a></p> </div><!-- end class="col-sm-12" --> </div> <!-- end row --> </div> <div role="tabpanel" class="tab-pane" id="productordering"> <div class="row" style="border:1px solid #ddd;"> <div class="col-sm-12"> <h3>Website Product ordering</h3> <?= form_open('admin/products/change_product_ordering'); ?> <div class="row"> <div class="col-sm-8"> <select class="form-control" name="change_product_ordering"> <option value="random" <?php if($website_product_ordering == 'random') : ?> selected <?php endif; ?> >Random</option> <option value="manual-order" <?php if($website_product_ordering == 'manual-order') : ?> selected <?php endif; ?> >Manual Order</option> <option value="input-date-desc" <?php if($website_product_ordering == 'input-date-desc') : ?> selected <?php endif; ?> >Input Date (Descending)</option> <option value="input-date-asc" <?php if($website_product_ordering == 'input-date-asc') : ?> selected <?php endif; ?> >Input Date (Ascending)</option> </select> </div> <div class="col-sm-4"> <input class="btn btn-primary" type="submit" name="change_ordering" value="CHANGE ORDERING"> </div> </div> <?= form_close(); ?> <br> </div><!-- end class="col-sm-12" --> </div> <!-- end row --> </div> <div role="tabpanel" class="tab-pane" id="settings"> <div class="row" style="border:1px solid #ddd;"> <div class="col-sm-12"> <h3>Update Products Price</h3> <p style="display: none;">UPLOAD PRODUCTS DATA. ACCEPT ONLY CSV. PLEASE SAVE EXCEL AS CSV. CSV USE ~ AS SEPARATION. DOWNLOAD EXCEL SAMPLE <a style="color:blue;" href="<?= base_url('uploads/products.xls'); ?>">HERE</a>.</p> <!-- <p>PS: Products data with same SKU will be updated.</p> --> <?php $attributes = array( 'name' => 'uploadcsv', 'id' => 'uploadcsv' ); ?> <?= form_open_multipart('admin/products/uploadHarga', $attributes); ?> <table> <tr> <td> ULPLOAD PRODUCTS DATA: </td> <td> <div class="form-group"> <input style="float:left; width:60%;" type="file" class="form-control" name="userfile" id="userfile" align="center"/><input type="submit" name="upload_csv" class="btn btn-info" value="UPLOAD"><?= $this->session->flashdata('upload_excel_info'); //to display success message ?> </div> </td> </tr> </table> </form> <p>Note: During Upload, please wait until process finish. Do not close current window. <a href="<?= base_url('uploads/product_price_master.xlsx'); ?>">GET SAMPLE HERE</a></p> </div><!-- end class="col-sm-12" --> <?= form_close(); ?> </div> <!-- end row; --> </div> <div role="tabpanel" class="tab-pane" id="settings2"> <div class="row" style="border:1px solid #ddd;"> <div class="col-sm-12"> <h3>Update Stocks</h3> <p style="display: none;">UPLOAD PRODUCTS STOCK. ACCEPT ONLY XLS.</p> <!-- <p>PS: Products data with same SKU will be updated.</p> --> <?php $attributes = array( 'name' => 'uploadcsv', 'id' => 'uploadcsv' ); ?> <?= form_open_multipart('admin/products/uploadStock', $attributes); ?> <table> <tr> <td> ULPLOAD STOCKS DATA: </td> <td> <div class="form-group"> <input style="float:left; width:60%;" type="file" class="form-control" name="userfile" id="userfile" align="center"/><input type="submit" name="upload_csv" class="btn btn-info" value="UPLOAD"><?= $this->session->flashdata('upload_excel_info'); //to display success message ?> </div> </td> </tr> </table> </form> <p>Note: During Upload, please wait until process finish. Do not close current window. <a href="<?= base_url('uploads/product_stock_master.xlsx'); ?>">GET SAMPLE HERE</a></p> <?= form_close(); ?> </div><!-- end class="col-sm-12" --> </div> <!-- end row --> </div> </div> </div> <div class="row"> <div class="col-sm-12"> <br> <?php if($allowed == true) : ?> <p><?= anchor('admin/products/add', '<i class="fa fa-plus" aria-hidden="true"></i> ADD A NEW PRODUCT'); ?></p> <?php endif; ?> </div><!-- end class="col-sm-12" --> </div> <!-- end row --> <div class="row"> <div class="col-sm-12"> <div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th>ID</th> <th>Kode Produk</th> <th>Nama Produk</th> <th> Urutan <button style="font-weight: bold;" onclick="refreshDisplayPriority();" class="btn btn-sm btn-success" type="button">Ubah</button> </th> <th>Bisa Indent</th> <th>Diskontinue</th> <th>Tampilkan</th> <th>Edit</th> <th>Preview</th> <?php if($allowed == true && $role != 'admin') : ?> <th>Hapus</th> <?php endif; ?> <th></th> </tr> </thead> <tbody> <?php if(count($products)) : ?> <?php foreach($products as $product): ?> <tr> <td><?= $product->id_products; ?></td> <td><?= $product->product_code; ?></td> <td><img style="width:50px;" src="<?= base_url() . 'uploads/product/thumbnail/' . $product->image1; ?>"> <?= ucfirst($product->title); ?></td> <td> <input data-id="<?= $product->id_products; ?>" class="inp_change_priority" type="text" style="border: 0;outline: 0;background: transparent;border-bottom: 1px solid gray; text-align: center; width: 40px;" value="<?= $product->priority; ?>"> </td> <td><?= $product->is_backorder; ?></td> <td><?= $product->is_discontinue; ?></td> <td> <?php if ($product->product_status == 1) { ?> <button onclick="exchangeStatusAct('tidak',<?= $product->id_products; ?>);" type="button" style="border:none; background: transparent;"> <span style="padding: 5px; border-radius: 5px; background: silver;">Ya</span> <span style="padding: 5px; border-radius: 5px; ">Tidak</span> </button> <?php } else { ?> <button onclick="exchangeStatusAct('ya',<?= $product->id_products; ?>);" type="button" style="border:none; background: transparent;"> <span style="padding: 5px; border-radius: 5px; ">Ya</span> <span style="padding: 5px; border-radius: 5px; background: silver;">Tidak</span> </button> <?php } ?> </td> <!-- <td><a class="quickedit" href="<?= $product->id_products; ?>"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a></td> --> <td><?= bt_edit('admin/products/edit/' . $product->id_products); ?></td> <!-- <td><a href="<?= base_url() . 'admin/products/duplicate_product/' . $product->id_products; ?>"><i class="fa fa-files-o" aria-hidden="true"></i></a></td> --> <td><a href="<?= base_url() . 'product/' . $product->alias; ?>" target="_blank"><i class="fa fa-eye" aria-hidden="true"></i></a></td> <?php if($allowed == true && $role != 'admin') : ?> <td> <?= bt_delete('admin/products/delete/' . $product->id_products); ?> </td> <?php endif; ?> <td><span style="background:orange; width:20px; height: 20px;"></span></td> </tr> <?php endforeach; ?> <?php else: ?> <tr> <td colspan="3">We could not find any product.</td> </tr> <?php endif; ?> </tbody> </table> </div><!-- end class responsive--> </div><!-- end class="col-sm-12" --> </div> <!-- end row --> <div class="row"> <div class="col-sm-12"> <?php if(isset($use_pagination)) : ?> <div style="text-align:center;"><?= $this->pagination->create_links(); ?></div> <?php endif; ?> </div><!-- end class="col-sm-12" --> </div> <!-- end row --> <div id="getProductDetail"></div> <script> $(document).ready(function() { var controller = 'admin/products'; var base_url = '<?php echo base_url(); ?>'; $('a.quickedit').click(function(event) { event.preventDefault(); var id_product = $(this).attr('href'); ajax_getproductdetails(id_product); }); function ajax_getproductdetails(id_product) { $.ajax({ 'url' : base_url + controller + '/ajax_getproductdetails', 'type' : 'POST', 'data' : {'id_product' : id_product}, 'success' : function(data) { var container = $('#getProductDetail'); if (data) { /*---success----*/ $('#getProductDetail').html(data); $('#showModal').trigger('click'); }; } }); } }); </script> <script> function refreshDisplayPriority(){ /* if (confirm("Are you sure?")==true) { */ var inp_change_priority = jQuery("input.inp_change_priority"); var csrfHash = '<?= $this->security->get_csrf_hash(); ?>'; var data = [[]]; jQuery.each(inp_change_priority,function(idx,key){ data[idx] = { id : jQuery(this).data('id'), val : jQuery(this).val(), }; }); $.ajax({ 'url' : "<?= base_url('admin/products/refreshDisplayPriority'); ?>", 'type' : 'POST', 'dataType' :'json', 'data' : { 'this_data' : data, 'csrftestname' : csrfHash }, 'success' : function(res) { if (res.res == 'sukses') { // console.log(res.data); // alert('Successfully'); location.reload(); } } }); /* } */ } function exchangeStatusAct(earlyStat,this_id){ var toStat = ''; var csrfHash = '<?= $this->security->get_csrf_hash(); ?>'; if (earlyStat == 'ya') { toStat = 'Ya'; }else{ toStat = 'Tidak'; } $.ajax({ 'url' : "<?= base_url('admin/products/changeStatusAct'); ?>", 'type' : 'POST', 'dataType' :'json', 'data' : { 'this_id' : this_id, 'toStat' : toStat, 'csrftestname' : csrfHash }, 'success' : function(res) { if (res.res == 'sukses') { // alert('Successfully'); location.reload(); } } }); } </script>