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/rabbithabit.com/public_html/application/views/admin/brands/ |
Upload File : |
<div class="row"> <div class="col-sm-12"> <p><a href="<?= base_url('admin/product_index'); ?>"><i class="fa fa-arrow-left" aria-hidden="true"></i> Kembali ke Produk</a></p> <h2>Merek Produk</h2> <?= $this->session->flashdata('success'); ?> </div> </div> <div class="row"> <div class="col-sm-12"> <p><?= anchor('admin/brands/edit', '<i class="fa fa-plus" aria-hidden="true"></i> <strong>Buat Merek baru</strong>', array('class' => 'btn btn-primary')); ?></p> </div> </div> <div class="row"> <div class="col-sm-12"> <?= form_open(base_url('admin/brands/delete_all'),array('id'=>'frm_delete_all')); ?> <table class="table table-striped"> <thead> <tr> <th style="text-align: center;"> <button type="submit" id="delall_slc_checkbox" style="background: transparent;border: none;font-size: 23px;cursor: pointer;"> <i class="fa fa fa-trash-o"></i> </button> <input id="slcall_checkbox" type="checkbox"> </th> <th>Nama Merek</th> <th> Urutan <button style="font-weight: bold;" onclick="refreshDisplayPriority();" class="btn btn-sm btn-success" type="button">Ubah</button> </th> <th>Aktif?</th> <th>Edit</th> <th>Hapus</th> </tr> </thead> <tbody> <?php if(count($brands)) : ?> <?php foreach($brands as $brand): ?> <tr> <td style="text-align: center;"> <input class="checkbox_for_del" name="checkbox_for_del[]" value="<?= $brand->id_brands; ?>" type="checkbox"> </td> <td><a href="<?= base_url() . 'admin/brands/edit/' . $brand->id_brands; ?>"><?= ucwords($brand->brand); ?></a></td> <td> <input data-id="<?= $brand->id_brands; ?>" class="inp_change_priority" type="text" style="border: 0;outline: 0;background: transparent;border-bottom: 1px solid gray; text-align: center; width: 40px;" value="<?= $brand->priority; ?>"> </td> <td> <?php if ($brand->status == 1) { ?> <button onclick="exchangeStatusAct('tidak',<?= $brand->id_brands; ?>);" 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',<?= $brand->id_brands; ?>);" 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><?= bt_edit('admin/brands/edit/' . $brand->id_brands); ?></td> <td><?= bt_delete('admin/brands/delete/' . $brand->id_brands); ?></td> </tr> <?php endforeach; ?> <?php else: ?> <tr> <td colspan="3">Merek produk tidak ditemukan.</td> </tr> <?php endif; ?> </tbody> </table> <?= form_close(); ?> </div> </div> <div class="row"> <div class="col-sm-12"> <?= '<div style="text-align:center;">' . $this->pagination->create_links() . '</div>'; ?> </div> </div> <script> jQuery(document).ready(function($){ $("form#frm_delete_all").submit(function(ev){ ev.preventDefault(); var csrfHash = '<?= $this->security->get_csrf_hash(); ?>'; if(confirm('Are you sure?')==true){ var input_check = $( "input[type='checkbox'].checkbox_for_del:checked" ); var checkbox_del = [[]]; $.each(input_check,function(idx,key){ checkbox_del[idx]=$(this).val(); }); $.ajax({ 'url' : "<?= base_url('admin/brands/delete_all'); ?>", 'type' : 'POST', 'dataType' :'json', 'data' : { 'checkbox_del' : checkbox_del, 'csrftestname' : csrfHash }, 'success' : function(res) { // console.log(res); if (res.result == 'sukses') { window.location.href="<?= base_url('admin/brands'); ?>"; } } }); } }); $("input#slcall_checkbox").click(function(){ var input_check = $( "input[type='checkbox'].checkbox_for_del" ); if($(this).is(':checked')){ input_check.prop('checked',false); input_check.prop('checked',true); }else{ input_check.prop('checked',false); } }); }); 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/brands/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/brands/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>