ok
Direktori : /home2/selectio/public_html/wedding-info/ |
Current File : /home2/selectio/public_html/wedding-info/product.php |
<div id="reload"> <?php include('header.php'); $ids = $_GET['ids']; $url = "product.php?ids=" . $ids; $url2="sub_product.php?id=".$ids; if(isset($ids) and $ids!=""){ $statement = $pdo->prepare("SELECT * FROM tbl_product WHERE sub_cat_id = $ids"); $statement->execute(); $datas = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $statement_name = $pdo->prepare("SELECT * FROM tbl_product WHERE id = $ids"); $statement_name->execute(); $datas_name = $statement_name->fetchAll(PDO::FETCH_ASSOC); $heading =$datas_name[0]['cat_name']; $sub_product="Sub Product"; } else{ $statement = $pdo->prepare("SELECT * FROM tbl_product WHERE sub_cat_id =0"); $statement->execute(); $datas = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $tag= $datas[0]["add_productdetails"]=="YES"?"Caste Avail":""; $heading="Product"; $sub_product="Product"; print_r($datas); } ?> <div class="page-wrapper"> <div class="page-content" > <div class=" card card-body"> <?= print_r($datas);?> <div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3"> <div class="breadcrumb-title"> <?=$heading?></div> <div class="ms-auto"> <div class="btn-group"> <a href= "product-add.php?ids=<?=$ids?>" class="btn btn-sm btn-add"><i class="lni lni-circle-plus"></i> Create <?=$sub_product?></a> </div> </div> </div> <div class="row g-3"> <div class="col-12 col-lg-4"> <div class="input-group mb-3"> <span class="input-group-text" id="basic-addon1"><i class="lni lni-search-alt"></i></span> <input type="text" class="form-control" id="search-address" autocomplete="off" placeholder="Search <?=$heading?> Details"> </div> </div> <!--address details start--> <div class="row" id="pickup_address_list"> <?php foreach($datas as $data){ ?> <div class="col-12 col-lg-3 col-sm-6"> <a href="<?php if ($data['add_productdetails'] == 'NO') { echo $url2; } else { echo $url; } ?>"> <div class="card" style="position: relative;"> <p style=" position: absolute; width: 74px; background-color: <?=(trim($data["status"]=="ACTIVE")?"green":"red")?>; color: white; text-align: center; border-radius: 15px;"> <?=$data["status"] ?></p> <center><img src="<?=$data['product_img']; ?>" alt="user avatar" style="width: 100%;height: 200px;"></center> <div class="col-12" style="padding:5px 5px;"> <center><b><?=$data['cat_name']?></b></center> </div> <div class="col-12" style="padding:10px 5px;"> <center> <a class="update" href="product-edit.php?id=<?=$data['id'] ?>"><i class="lni lni-pencil-alt"></i> Update</a> <a class="delete" onclick="rel_delete(<?=$data['id'] ?>)"><i class="lni lni-trash"></i> Delete</a> </center> </div> </div></a> </div> <?php } ?> </div> <!--address details end--> </div><!---end row--> </div> </div> </div> </div> <script> function rel_delete(ids){ var result = alert('Do you want to delete this file?'); console.log(result) if(result == undefined){ $.ajax({ url: 'api/product-delete.php?ids='+ids, type: 'post', dataType: 'json', cache: false, contentType: false, processData: false, success: function(response) { console.log(response); if (response['status'] == 200) { success(response['message']); window.location.reload(); } else { warning(response['message']); } } }); } } </script> <?php include('footer.php'); ?>