ok
Direktori : /home2/selectio/www/y1jobportal.in/admin/ui-pages/pickup-address/ |
Current File : //home2/selectio/www/y1jobportal.in/admin/ui-pages/pickup-address/pickup-address-edit.php |
<?php include '../../api/config/config.php'; $id=10; if(isset($_POST['id'])){ $id=$_POST['id']; } $statement = $pdo->prepare("SELECT * FROM `pickup_address` WHERE id='$id'"); $statement->execute(); $res = $statement->fetchAll(PDO::FETCH_ASSOC); $num = $statement->rowCount(); if($num>0){ ?> <div class="modal-content"> <div class="modal-header"> <h6 class="modal-title"> Update Pick Up Address</h6> </div> <form id="pickup_address_update_form" style="background: white;"> <input type="hidden" name="id" value="<?=$res[0]['id']?>"> <div class="modal-body"> <div class="row"> <div class="col-12 col-lg-12"> <span>Tag this address as </span> <div class="d-flex align-items-center gap-3"> <div class="form-check form-check-success"> <input class="form-check-input" type="radio" name="address_type" value="Home" id="flexRadioDefault1" <?php if($res[0]['type']=="Home"){ echo "checked";}?>> <label class="form-check-label bg-light-gray" for="flexRadioDefault1"> Home </label> </div> <div class="form-check form-check-success"> <input class="form-check-input" type="radio" name="address_type" value="Work" id="flexRadioSuccess" <?php if($res[0]['type']=="Work"){ echo "checked";}?>> <label class="form-check-label bg-light-gray" for="flexRadioSuccess"> Work </label> </div> <div class="form-check form-check-success"> <input class="form-check-input" type="radio" name="address_type" value="Warehouse" id="flexRadioDanger" <?php if($res[0]['type']=="Warehouse"){ echo "checked";}?>> <label class="form-check-label bg-light-gray" for="flexRadioDanger"> Warehouse </label> </div> <div class="form-check form-check-success"> <input class="form-check-input" type="radio" name="address_type" value="Other" id="flexRadioWarning" <?php if($res[0]['type']=="Other"){ echo "checked";}?>> <label class="form-check-label bg-light-gray" for="flexRadioWarning"> Other </label> </div> </div> </div> <div class="col-12 col-lg-12 mr-top-20 mr-bottom-10"> <b >Contact information for this location</b> </div> <div class="col-12 col-lg-3"> <label for="FisrtName" class="form-label required">Contact Person</label> <input type="text" class="form-control" name="contact_person" value="<?=$res[0]['name']?>" placeholder="Name of the person to contacted"> </div> <div class="col-12 col-lg-3"> <label for="FisrtName" class="form-label required">Contact Number</label> <input type="text" class="form-control" oninput="this.value=this.value.replace(/[^0-9]/g,'')" value="<?=$res[0]['mobile']?>" name="contact_number" placeholder="Enter 10 digit mobile number"> </div> <div class="col-12 col-lg-3"> <label for="FisrtName" class="form-label required">Email Address</label> <input type="email" class="form-control" name="contact_email" value="<?=$res[0]['email']?>" placeholder="i.e smanth@gmail.com"> </div> <div class="col-12 col-lg-3"> <label for="FisrtName" class="form-label optional">Alternate Phone No</label> <input type="text" class="form-control" oninput="this.value=this.value.replace(/[^0-9]/g,'')" value="<?=$res[0]['alter_mobile']?>" name="contact_phone" placeholder="Enter 10 digit mobile number"> </div> <div class="col-12 col-lg-12 mr-top-20"> <b>How can the delivery person reach the address?</b> </div> <div class="row mr-top-20"> <div class="col-12 col-lg-6"> <label for="FisrtName" class="form-label required">Complete Address</label> <textarea class="form-control" placeholder="House/Floor No., Building Name or Street, Locality " rows="2" cols="3" name="contact_address"><?=$res[0]['address_line1']?></textarea> </div> <div class="col-12 col-lg-6"> <label for="FisrtName" class="form-label optional">Landmark </label> <textarea class="form-control" placeholder="Any nearby post office, market,Hospital as the landmark " rows="2" cols="3" name="contact_landmark"><?=$res[0]['address_line2']?></textarea> <span class="font-size10 color-liht-gray">Note: If you're Shipping B2B, Please Enter the Company's name</span> </div> <div class="col-6 col-lg-3"> <label for="FisrtName" class="form-label required">Pincode</label> <input type="text" class="form-control " oninput="this.value=this.value.replace(/[^0-9]/g,'')" value="<?=$res[0]['pincode']?>" onkeypress="if(this.value.length==6) return false;" name="contact_pincode" placeholder="Add Pincode"> </div> <div class="col-6 col-lg-3"> <label for="FisrtName" class="form-label">City<span class="color-liht-gray">(Pincode based on auto fill)</span></label> <input type="text" class="form-control " name="contact_city" placeholder="City" value="<?=$res[0]['city']?>" > </div> <div class="col-6 col-lg-3"> <label for="FisrtName" class="form-label">State<span class="color-liht-gray">(Pincode based on auto fill)</span></label> <input type="text" class="form-control " name="contact_state" placeholder="State" value="<?=$res[0]['state']?>"> </div> <div class="col-6 col-lg-3"> <label for="FisrtName" class="form-label">Country <span class="color-liht-gray">(Pincode based on auto fill)</span></label> <input type="text" class="form-control " name="contact_country" placeholder="Country" value="<?=$res[0]['country']?>" > </div> </div> <div class="col-12 col-lg-12 mr-top-20 color-blue"> <b class="color-blue accordion-button font-size12 collapsed" data-bs-toggle="collapse" data-bs-target="#RTO_Supplier" aria-expanded="false" aria-controls="RTO_Supplier">+ Add RTO Address and Supplier</b> </div> <div class=" row accordion-collapse collapse <?php if(isset($res[0]['suplier_vendor_name']) || isset($res[0]['supllier_vendor_gst']) || $res[0]['rto_address']!=0){ echo "show";} ?>" id="RTO_Supplier"> <div class="row mr-top-20"> <div class="col-12 col-lg-4"> <div class="col-12 col-lg-12 form-check form-check-success"> <input class="form-check-input supplier_vendor_address" name="add_supplier_vendor_address" type="checkbox" <?php if(isset($res[0]['supplier_vendor_name']) || isset($res[0]['supllier_vendor_gst'])){ echo "checked";} ?> id="supplier_vendor_address" > <label class="form-check-label" for="supplier_vendor_address"><b> Add this address as supplier/vendor address </b></label> </div> </div> <div class="col-12 col-lg-4 supplier_vendor_address_div" style="display: none;"> <label for="FisrtName" class="form-label">Supplier/Vendor's Name</label> <input type="text" class="form-control" name="supplier_vendor_name" value="<?=$res[0]['supplier_vendor_name']?>" placeholder="Enter Supplier/Vendor's Name"> </div> <div class="col-12 col-lg-4 supplier_vendor_address_div" style="display: none;"> <label for="FisrtName" class="form-label">Supplier/Vendor's GSTIN</label> <input type="text" class="form-control" name="supplier_vendor_gst" value="<?=$res[0]['supllier_vendor_gst']?>" placeholder="Enter Supplier/Vendor's GSTIN"> </div> </div> <div class="row mr-top-20"> <div class="col-12 col-lg-4"> <div class="col-12 col-lg-12 form-check form-check-success"> <input class="form-check-input add_rto_address" type="checkbox" name="add_rto_address" <?php if(isset($res[0]['rto_address']) && $res[0]['rto_address']!=0){ echo "checked";} ?> id="add_rto_address" > <label class="form-check-label" for="add_rto_address"><b>Add RTO Address</b></label> </div> </div> <div class="col-12 col-lg-6 add_rto_address_div" style="display: none;"> <label for="FisrtName" class="form-label">Select RTO Address</label> <select name="rto_address" class="form-control"> <option value="">Select Address</option> <?php $client_id=0; if(isset($_POST['client_id'])){ $client_id =$_POST['client_id']; } $statement = $pdo->prepare("SELECT * FROM `pickup_address` where client_id=$client_id"); $statement->execute(); $rto_res = $statement->fetchAll(PDO::FETCH_ASSOC); foreach($rto_res as $rto){ $selected=''; if($res[0]['rto_address']==$rto['id']){ $selected='selected';} echo "<option value='".$rto['id']."' ".$selected.">".$rto['name'].",".$rto['mobile'].",".$rto['address_line1']."</option>"; } ?> </select> <input type="hidden" class="form-control" name="contact_client_id" value="<?=$client_id?>" placeholder="Name of the person to contacted"> <span class="font-size10 color-liht-gray">Note: RTO address is only applicable for Xpressbees, Delhivery and Ecom express.</span> </div> </div> </div> </div> </div> <div class="modal-footer"> <span class="btn btn-info btn-sm" onclick="pickup_address_edit_close()">Close</span> <button type="submit" name="submit2" class="btn btn-success btn-sm" >Save changes</button> </div> </form> </div> </div> </div> <?php }else{ ?> <div class="modal-content"> <div class="modal-header"> <h6 class="modal-title"> Update Pick Up Address</h6> </div> <div class="modal-body"> <center>No data Found</center> </div> <div class="modal-footer"> <span class="btn btn-info btn-sm" onclick="pickup_address_edit_close()">Close</span> </div> </div> </div> </div> <?php } ?> <script> $(document).ready(function(){ $('.same_shipping_address').change(function () { if ($(this).is(':checked')) { $("div#shipping_address_div").hide(); }else{ $("div#shipping_address_div").show(); } }); if ($('.supplier_vendor_address').is(':checked')) { $(".supplier_vendor_address_div").css("display","block"); }else{ $(".supplier_vendor_address_div").css("display","none"); } if ($('.add_rto_address').is(':checked')) { $(".add_rto_address_div").css("display","block"); }else{ $(".add_rto_address_div").css("display","none"); } $('.supplier_vendor_address').change(function () { if ($(this).is(':checked')) { $(".supplier_vendor_address_div").css("display","block"); }else{ $(".supplier_vendor_address_div").css("display","none"); } }); $('.add_rto_address').change(function () { if ($(this).is(':checked')) { $(".add_rto_address_div").css("display","block"); }else{ $(".add_rto_address_div").css("display","none"); } }); $( "#pickup_address_update_form" ).validate( { rules: { contact_person: { required: true, minlength: 6 }, contact_number:{ required: true, minlength: 10, maxlength: 12 }, contact_email: { required: true, email: true }, contact_phone:{ minlength: 10, maxlength: 12 }, address_type: "required", contact_address: "required", contact_pincode:{ required: true, minlength: 6 }, contact_city: "required", contact_state: "required", contact_country: "required", }, messages: { contact_person: { required: "please enter a contact person name", minlength: "your contact person name must consist of at least 6 characters" }, contact_number: { required: "please enter a contact mobile number", minlength: "your contact mobile number must consist of at least 10 digit number", maxlength: "your contact mobile number max 12 digit only allowed" }, contact_phone: { minlength: "your contact alter mobile number must consist of at least 10 digit number", maxlength: "your contact alter mobile number max 12 digit only allowed" }, contact_pincode: { required: "please enter valid pincode", minlength: "pincode min 6 digits required", }, contact_email: "Please enter a valid email address", address_type: "click address type", contact_address: "pickup address is required", contact_city: "pickup city is required", contact_state: "pickup state is required", contact_country: "pickup country is required", }, submitHandler: function(form) { pickup_address_update(form); } } ); function pickup_address_update(form){ $('#loader').show(); var formData = new FormData(form); formData.append('type','update_pickup_address'); $.ajax({ url: 'api/pickup-address.php', type: 'post', dataType: 'json', data: formData, cache: false, contentType: false, processData: false, enctype: 'multipart/form-data', success: function (response) { console.log(response); if(response['error']==false){ $('#pickup_address_edit_model').modal('hide'); $('#pickup_address_update_form').trigger("reset"); $('#loader').hide(); pickup_address_list(); success(response['message']); }else{ $('#loader').hide(); warning(response['message']); }; } }); } }); </script>