public function category($args) { list($name, $page) = $args; // $name; $name = urldecode($name); $cat = new ProdCat(); $arr = $cat->getWhere("cat_name LIKE '{$name}'"); // echo $name; ?> <style> .judulcategory { padding-top : 20px; padding-left : 15px; color : #AAA; font-size : 14px; } .judulcategory a { font-size : 14px; color : #AAA; font-family : 'Open Sans', sans-serif; font-weight : normal; } .judulcategory a:hover { text-decoration : underline; } .h1category { padding-top : 20px; padding-bottom : 0px; padding-left : 15px; margin : 0; padding-bottom : 30px; color : #000; font-style : italic; font-family : 'Libre Baskerville', serif; font-size : 28px; } </style> <?php if (count($arr) > 0) { // pr($arr); $arrParent = array(); $arrpp = ProdCat::getAllParents($arr[0]->cat_parent_id, $arrParent); //pr($arrpp); $arrpp2 = array_reverse($arrpp); foreach ($arrpp2 as $bc) { $str[] = "<a href='" . _SPPATH . "pwa/category/" . urlencode($bc->cat_name) . "'>" . $bc->cat_name . "</a>"; } /* * print breadcrumbs if(count($arrpp2)>0) echo "<div class='judulcategory'>".implode(" > ",$str)." > </div>"; */ ?> <h1 class="h1category"><?php echo ucwords($name); ?> </h1> <?php $pc = new ProdModel(); //pagination if ($page < 1 || $page == "") { $page = 1; } $limit = 21; $begin = ($page - 1) * $limit; $link = _SPPATH . "pwa/category/" . urlencode($name) . "/|x|"; $jml = $pc->getJumlah("prod_cat_id = '{$arr[0]->cat_id}'"); //end pagination $arrp = $pc->getWhere("prod_cat_id = '{$arr[0]->cat_id}' LIMIT {$begin},{$limit}"); //pr($arrp); foreach ($arrp as $num => $prod) { $cw = new Cw(); $cw->productPrinter($prod); if ($num % 3 == 2) { ?> <div class="clearfix"></div> <?php } } ?> <div class="clearfix"></div> <div class="gantihal" style="text-align: center;"> <?php //begin pagination BootstrapUX::pagination($page, $jml, $limit, $link); ?> </div> <?php } }
public function addStok() { $p = new ProdModel(); $all = $p->getWhere("prod_active = 1"); ?> <div class="table-responsive"> <table class="table table-bordered"> <thead> <tr> <th>Prod ID</th> <th>Prod Name</th> <th>Stok</th> <th>Action</th> </tr> </thead> <?php foreach ($all as $p) { ?> <tr> <td><?php echo $p->prod_id; ?> </td> <td><?php echo $p->prod_name; ?> </td> <td><?php echo $p->prod_stock; ?> </td> <td> <input id="stock_<?php echo $p->prod_id; ?> " type="number" value="0"><br> <input id="note_<?php echo $p->prod_id; ?> " type="text" placeholder="note"><br> <button id="add_stock_<?php echo $p->prod_id; ?> ">Add Stok</button> </td> <script> $('#add_stock_<?php echo $p->prod_id; ?> ').click(function(){ var nr = $('#stock_<?php echo $p->prod_id; ?> ').val(); var note = $('#note_<?php echo $p->prod_id; ?> ').val(); if(note!=""){ $.post('<?php echo _SPPATH; ?> CustomPO/updateStok?pid=<?php echo $p->prod_id; ?> ',{note:note,nr:nr},function(data){ if(data.bool){ alert('Sukses'); lwrefresh('Add_Stok'); }else{ alert('Gagal'); } },'json'); }else{ alert('note tidak boleh kosong'); } }); </script> </tr> <?php } ?> </table> </div> <?php }