ok
Direktori : /proc/self/root/home2/selectio/www/vijay-gases/ |
Current File : //proc/self/root/home2/selectio/www/vijay-gases/product-add.php |
<?php include "header.php"; if(isset($_POST['add_customer'])){ try{ $date = date('Y-m-d h:i:s a', time()); $statement = $pdo->prepare("INSERT INTO `tbl_customer`(`customer_name`, `mobile_number`, `address`, `location_id`, `cust_type`) VALUES (?,?,?,?,?)"); $result=$statement->execute(array($_POST['name'],$_POST['mobile_no'],$_POST['address'],$_POST['location'],1)); if($result){ $message = 'Customer is Added Successfully!'; unset($_POST); }else{ $warning="Something went wrong try again..."; } }catch(Exception $e){ $error=$e; } } ?> ?> <div class="content-wrapper"> <section class="content-header"> <div class="row" style=""> <div class="col-md-10 col-sm-10 col-xs-8"> <div style="list-style: none; padding-inline-start: 0px; padding: 5px 0px 5px 0px;"> <?php include "header/product_header.php"; ?> </div> </div> <div class="col-md-2 col-sm-2 col-xs-4"> <?php //include "header/buttons-ui.php"; ?> </div> </div> </section> <div class="col-lg-12 alerts"> <div id="custom-alerts" style="display:none;"> <div class="alert alert-dismissable"> <div class="custom-msg"></div> </div> </div> <?php if ($error) { ?> <div class="alert alert-danger alert-dismissable"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <h4><i class="icon fa fa-ban"></i> Error</h4> <?= $error; ?> </div> <?php $error=0;} if ($warning) { ?> <div class="alert alert-warning alert-dismissable"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <h4><i class="icon fa fa-warning"></i> Warning</h4> <?= $warning; ?> </div> <?php $warning=0;} if ($message) { ?> <div class="alert alert-success alert-dismissable"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <h4> <i class="icon fa fa-check"></i> Success</h4> <?= $message; ?> </div> <?php $message=0; } ?> </div> <div class="clearfix"></div> <section class="content"> <div class="row"> <div class="col-xs-12"> <div class="box box-primary"> <div class="box-header"> </div> <div class="box-body"> <div class="col-lg-12"> <form id="add_form"> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label class="required">Company Name</label> <select class="form-control select2" name="location_id" id="location_id" style="width:100%;" required> <option value="">Select The company Name</option> <?php $statement = $pdo->prepare("SELECT * FROM `tbl_location` where status=1"); $statement->execute(); $location_result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($location_result as $result) { echo "<option value=".$result['id'].">".$result['name']."</option>"; } ?> </select> </div> </div> <div class="col-md-4"> <div class="form-group"> <label class="required">Gas Type</label> <select class="form-control select2" name="gas_id" id="gas_id" style="width:100%;" required> <option value="">Select Gas Type</option> <?php $statement = $pdo->prepare("SELECT * FROM `tbl_gas` where status=1 ORDER BY gas_name"); $statement->execute(); $location_result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($location_result as $result) { echo "<option value=".$result['id'].">".$result['gas_name']."</option>"; } ?> </select> </div> </div> <div class="col-md-4"> <div class="form-group"> <label>Actions</label><br> <span id="add_new_cylinder_no" class="btn btn-warning btn-sm"><i class="fa fa-plus"></i></span> </div> </div> </div> <br><br> <table style="width: 100%;"> <thead> <tr> <th style="width: 30%;">Gas Type</th> <th style="width: 30%;">Cylinder Number</th> <th style="width: 10%;">Actions</th> </tr> </thead> <tbody id="append_row_cylinder_no"> </tbody> </table> <br><br> <div class="form-group" style="text-align:center;"> <input type="submit" name="add_products" value="Add Products" class="btn btn-success" /> </form> </div> </div> <div class="form-group" style="text-align:center;"> <a href="product-add.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a> <a href="product.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a> </div> <div class="clearfix"></div> </div> </div> </div> </div> </section> <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> <style> .select2-container--default .select2-selection--multiple .select2-selection__choice { background-color: rgb(228, 228, 228); box-sizing: border-box; display: inline-block; margin-left: 5px; margin-top: 5px; position: relative; max-width: 100%; text-overflow: ellipsis; vertical-align: bottom; white-space-collapse: collapse; text-wrap: nowrap; border-width: 1px; border-style: solid; border-color: rgb(170, 170, 170); border-image: initial; border-radius: 4px; padding: 0px 10px 0px 20px; overflow: hidden; color: black; font-weight: 800; } .select2-container--default .select2-selection--multiple { background-color: white; border: 1px solid #aaa; border-radius: 4px; cursor: text; height: 100px; padding-bottom: 5px; padding-right: 5px; position: relative; } </style> <script> $(document).on('click', '.remove_rows', function() { $(this).closest('.cylinder_row').remove(); }); $('#add_new_cylinder_no').on('click', function() { /*$.ajax({ type: 'POST', url: 'ui-api/current-shift-users.php', success: function(response) { console.log(response); $('#shift_emp_details').append(response); } });*/ var gas_id = $("#gas_id").val(); if(gas_id!=""){ $.ajax({ url: 'api/add_product_ui_api.php', type: 'POST', data: {gas_id:gas_id}, success: function (response) { console.log(response); $('#append_row_cylinder_no').prepend(response); } }); }else{ alert("Please Select Gas Type"); } html = `<tr class="cylinder_row"> <th> <select class="form-control select2" name="gas_id[]" id="gas_id" style="width:100%;" required> <option value="">Select Gas Type</option> <?php $statement = $pdo->prepare("SELECT * FROM `tbl_gas` where status=1"); $statement->execute(); $location_result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($location_result as $result) { echo "<option value=".$result['id'].">".$result['gas_name']."</option>"; } ?> </select> </th> <th> <input type="text" name="cy_no[]" id="cy_no" class="form-control" required> </th> <th> <span class="btn btn-danger btn-sm remove_rows"><i class="fa fa-close"></i></span> </th> </tr>`; /* $('#append_row_cylinder_no').prepend(html);*/ $('.select2').select2(); }); </script> <?php include "footer.php"; ?> <script> $(document).ready(function() { $("form").bind("keypress", function(e) { if (e.keyCode == 13) { return false; } }); }); </script> <script> $('#add_form').on('submit', function(e){ console.log("Click And Form Working"); e.preventDefault(); $('#loading-div').show(); $('#content-div').hide(); var formData = new FormData(this); formData.append('type', 'create_multiple_product'); $.ajax({ url: 'apis/product-add-api.php', type: 'post', dataType: 'json', data: formData, cache: false, contentType: false, processData: false, enctype: 'multipart/form-data', success: function (response) { if(response['status']==200){ alert(response['message']); location.reload(); }else{ alert(response['message']); $('#loading-div').hide(); $('#content-div').show(); } } }); }); </script>