/
home
/
sditechnicalteam
/
socialsolargreens.pk
/
File Upload :
llllll
Current File: /home/sditechnicalteam/socialsolargreens.pk/Create-New-Product.php
<?php session_start(); // Check if the user is logged in, otherwise redirect to login page if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) { header('Location: index.php'); exit; } ?><?php //include 'partial/db.php'; include_once('controller/ProductController.php'); include_once('partial/link.php'); include_once('partial/header.php'); include_once('partial/navbar.php'); $Product = new ProductController(); $Product_List = $Product->ProductList(); $Product_type_List = $Product->ProductTypeList(); // print_r($Product_List); // die; if(isset($_POST['Name'])){ $post_data = $_POST; $inserted_id = $Product->CreateProduct($post_data); } //die; $product_type_data = array(); if(isset($_GET['id']) && isset($_GET['q'])){ if($_GET['q'] == "Edit"){ $product_data = $Product->Edit_p($_GET['id']); //print_r($customer_data); } if($_GET['q'] == "delete"){ $message = $Product->Delete_p($_GET['id']); } } ?> <!-- ============================================================== --> <!-- Start right Content here --> <!-- ============================================================== --> <div class="main-content"> <div class="page-content"> <div class="container"> <!-- start page title --> <div class="row"> <div class="col-md-12"> <a class="btn btn-success fa-pull-right " style="margin-left:30px" href="<?=BASE_URL?>Product-List.php"><i class="fa fa-list"></i> Product Type</a> </div> <div class="col-lg-12" style="margin-top:20px"> <div class="card"> <div class="card-body"> <h5><i class="fa fa-save"></i> Product Type Form</h5> <br> <p class="text-success"><?php if(!empty($inserted_id) && $inserted_id != 0){ unset($_POST['Name']); echo $inserted_id; } ?></p> <p class="text-success"><?php if(!empty($message)){ echo $message; } ?></p> <br> <form method="post" enctype="multipart/form-data" action=""> <div class="form-row"> <div class="col-md-3"> <div class="form-group"> <label>Select Product</label> <i class="fa fa-star text-danger" style="font-size:8px"></i> <select class="form-control" required id="TypeId" name="TypeId"> <?php while($row = mysqli_fetch_assoc($Product_type_List)){ ?> <option value="<?= $row['Id']; ?>" <?php if(!empty($product_data) && $product_data['TypeName'] == $row['TypeName']){ echo 'selected'; } ?>><?= $row['TypeName']; ?></option> <?php } ?> </select> </div> </div> <div class="col-md-3"> <div class="form-group"> <label>Type Name</label> <i class="fa fa-star text-danger" style="font-size:8px"></i> <input class="form-control" required autocomplete="off" type="text" id="Name" name="Name" value="<?php if(!empty($product_data)){ echo $product_data['Name']; } ?>"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label>Watt</label> <i class="fa fa-star text-danger" style="font-size:8px"></i> <input class="form-control" required autocomplete="off" type="number" min="500" max="100000" id="Watt" name="Watt" value="<?php if(!empty($product_data)){ echo $product_data['Watt']; }else{ echo ''; } ?>"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label>Cost Price</label> <i class="fa fa-star text-danger" style="font-size:8px"></i> <input class="form-control" required autocomplete="off" type="text" data-val="true" data-val-number="The field Cp must be a number." data-val-required="The Cp field is required." id="Cp" name="Cp" value="<?php if(!empty($product_data)){ echo $product_data['Cp']; }else{ echo '0.00'; } ?>"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label>Sale Price</label> <i class="fa fa-star text-danger" style="font-size:8px"></i> <input class="form-control" required autocomplete="off" type="text" data-val="true" data-val-number="The field Sp must be a number." data-val-required="The Sp field is required." id="Sp" name="Sp" value="<?php if(!empty($product_data)){ echo $product_data['Sp']; }else{ echo '0.00'; } ?>"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label>Re Order Alert Qty</label> <input class="form-control" autocomplete="off" type="text" data-val="true" data-val-number="The field ReorderLevel must be a number." data-val-required="The ReorderLevel field is required." id="ReorderLevel" name="ReorderLevel" value="<?php if(!empty($product_data)){ echo $product_data['ReorderLevel']; }else{ echo '0'; } ?>"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label>Openng Stock</label> <input class="form-control" autocomplete="off" type="text" data-val="true" data-val-number="The field OpStock must be a number." data-val-required="The OpStock field is required." id="OpStock" name="OpStock" value="<?php if(!empty($product_data)){ echo $product_data['OpStock']; }else{ echo '0'; } ?>"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label>Image</label> <?php if(!empty($product_data)){ echo $product_data['ProductImage']; } ?> <input type="file" class="form-control" name="PImage"> </div> </div> </div> <div class="offset-md-4 col-md-5" style="margin-top:20px"> <button type="submit" onclick="return confirm('../Product/AreyousureyouwanttoExcuteThis.php');" class="btn btn-success pull-right col-md-5"><i class="fa fa-save"></i> Save</button> </div> <input type="hidden" data-val="true" data-val-required="The Id field is required." id="Id" name="Id" value="<?php if(!empty($product_data)){ echo $product_data['Id']; } ?>"/> <input type="hidden" id="ProductImage" name="ProductImage" value="" /> <input name="__RequestVerificationToken" type="hidden" value="CfDJ8Il9f3bA6wZHqe8d2psfqd2khXEmp-7_Duaymvl6MIt7s6sLNRz09SPl5zFYh0sFJBhhtXFLeS4gXNIwaNa40LOMh4y4ZSuuOBDpGB2mP6nyjm4NcqGo90tyKRc88InRqsIB9SI_Bx8V7_yO5gghj8c" /></form> </div> </div> </div> <div class="col-12" style="margin-top:20px"> <div class="card"> <div class="card-body"> <h5><i class="fa fa-table"></i> Product Type Table</h5> <hr> <div style="overflow-x:auto"> <table id="datatable" class="table table-striped table-bordered nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;"> <thead> <tr> <th>Id</th> <th>Type Name</th> <th>Name</th> <th>Watt</th> <th>Cost Price</th> <th>Sale Price</th> <th>Opening Stock</th> <th>Action</th> </tr> </thead> <tfoot> <tr> <th>Id</th> <th>Type Name</th> <th>Name</th> <th>Watt</th> <th>Cost Price</th> <th>Sale Price</th> <th>Opening Stock</th> <th>Action</th> </tr> </tfoot> <tbody> <?php while($row = mysqli_fetch_assoc($Product_List)){ ?> <tr> <td><?= $row['Id']; ?></td> <td><?= $row['TypeName']; ?></td> <td><?= $row['Name']; ?></td> <td><?= $row['Watt']; ?></td> <td><?= $row['Cp']; ?></td> <td><?= $row['Sp']; ?></td> <td><?= $row['OpStock']; ?></td> <td> <a onclick="return confirm('AreyousureyouwanttoExecute.php');" class="badge badge-success" data-toggle="tooltip" data-placement="left" title="Click Me To Edit" href="<?=BASE_URL?>Create-New-Product.php?q=Edit&id=<?= $row['Id']; ?>"><i class="fa fa-edit"></i></a> <!-- <a onclick="return confirm('AreyousureyouwanttoExecute.php');" class="badge badge-success" data-toggle="tooltip" data-placement="left" title="Click Me To Edit" href="<?=BASE_URL?>Create-New-Product-Type.php?q=Delete&id=<?= $row['Id']; ?>"><i class="fa fa-trash-alt"></i></a> --> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> <!-- container-fluid --> </div> <!-- End Page-content --> <?php include 'partial/footer.php'; ?>
Copyright ©2k19 -
Hexid
|
Tex7ure