ok
Direktori : /home2/selectio/www/vijay-gases/modal/ |
Current File : /home2/selectio/www/vijay-gases/modal/create-product.php |
<?php include"../config/config.php";?> <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> <!--<link href="assets/dist/css/styles.css" rel="stylesheet" type="text/css" /> <script src="assets/plugins/jQuery/jQuery-2.1.4.min.js"></script> <script src="assets/dist/js/libraries.min.js" type="text/javascript"></script> <script src="assets/dist/js/scripts.min.js" type="text/javascript"></script>--> <div class="modal-dialog modal-lg" role="document" id="add_modal" style="overflow-x: hidden; overflow-y: hidden;"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title mt-0" id="myLargeModalLabel"><b>Create Product Details</b></h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-top: -25px;"><i class="fa fa-times"></i></button> </div> <form id="add_form" method="post"> <div id="content-div"> <div class="modal-body" style="padding: 20px 40px 20px 40px;"> <div class="row"> <div class="col-md-6" hidden> <label class="required">HSN /SAC Number</label> <input type="text" name="sku_no" id="sku_no" class="form-control"> </div> <div class="col-md-6" hidden> <div class="form-group"> <label class="required">Purchase Price</label> <input type="text" name="purchase_price" id="purchase_price" onkeypress="return isNumberKey(this, event);" value="0" class="form-control"> </div> </div> <div class="col-md-6" style="display:none;"> <div class="form-group"> <label >Stock</label> <input type="number" name="stock" id="stock" value="1" class="form-control" required> </div> </div> <div class="col-md-6" hidden> <div class="form-group"> <label class="required">Sell Price</label> <input type="text" name="sell_price" id="sell_price" onkeypress="return isNumberKey(this, event);" class="form-control" value="0"> </div> </div> <div class="col-md-6"> <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"); $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 class="col-md-6"> <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 class="col-md-2"> <a href="modal/create-location.php?purchase_location=2" data-toggle='ajax-modal' class="tip btn btn-warning btn-xs" style="margin-top:28px;"><i class="fa fa-plus-circle" aria-hidden="true" style="font-size:22px;"></i></a> </div>--> </div> <div class="row" style="margin-top: 10px;"> <div class="col-md-5"> <label class="required">Cylinder Number</label> <input type="text" name="cy_no[]" id="cy_no" class="form-control cylinder" required> </div> <div class="col-md-1"> <label>Actions</label> <span id="add_new_cylinder_no" class="btn btn-warning btn-sm"><i class="fa fa-plus"></i></span> </div> <div class="col-md-1" hidden> <label>Check</label> <span id="check_products" class="btn btn-success btn-sm"><i class="fa fa-spinner"></i></span> </div> </div> <div id="append_row_cylinder_no" class="row" style="padding-top: 10px;"></div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-primary">Submit</button> </div> </div> </form> <div id="loading-div" style="display: none; padding-bottom: 80px;"> <center> <img src="img/loading.gif" style="width: 250px;"><br><b class="blinking">Processing Please Wait...</b></center> </div> </div> </div> <script> $(document).on('click', '.remove_rows', function() { $(this).closest('.cylinder_row').remove(); }); $('#add_new_cylinder_no').on('click', function() { row = `<div class="cylinder_row"> <div class="col-md-4"> <label class="required">Cylinder Number</label> <input type="text" name="cy_no[]" id="cy_no" class="form-control cylinder" required> </div> <div class="col-md-2"> <label class="">Delete</label><br> <span class='btn btn-danger btn-xs remove_rows'><i class='fa fa-times'></i></span> </div> </div>`; $('#append_row_cylinder_no').prepend(row); }); </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_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']); $("#add_modal .close").click(); $('#add_form').trigger("reset"); emp_datas(); $('#loading-div').hide(); $('#content-div').show(); }else{ alert(response['message']); $('#loading-div').hide(); $('#content-div').show(); } } }); }); function CheckProductNames(){ } </script> <!--<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>--> <!--<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css" />--> <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).ready(function(){ $(".select2").select2(); $('.select2-search__field').focus(); });*/ /*$(document).on('select2:open', function() { $('.select2-search__field').focus(); });*/ </script> <script> $(document).ready(function(){ $(".select2").select2(); /*$('.select2-search__field').focus();*/ }); /*$(document).on('select2:opening', function() { $('.select2-search__field').focus(); });*/ </script>