ok

Mini Shell

Direktori : /home2/selectio/www/y1jobportal.in/admin/ui-pages/pickup-address/
Upload File :
Current File : //home2/selectio/www/y1jobportal.in/admin/ui-pages/pickup-address/pickup-address-add.php

<?php 
include '../../api/config/config.php';
?>
            <div class="modal-content">
					<div class="modal-header">
						<h6 class="modal-title"> Add New Pick Up Address</h6>
					</div>
				<form id="pickup_address_form" style="background: white;">
					<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" 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">
								<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">
								<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">
								<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" 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,'')" 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" 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,'')" 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"></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"></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,'')" 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" >
											</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" >
											</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" >
											</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" 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" type="checkbox" value="" name="add_supplier_vendor_address" 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" 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" 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" value="" name="add_rto_address" 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">
								             <?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){
                                             echo "<option value='".$rto['id']."'>".$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">
						<button type="button" class="btn btn-info btn-sm" onclick="pickup_address_add_close()">Close</button>
						<button type="submit" name="submit2" class="btn btn-success btn-sm" >Save changes</button>
					</div>
				</form>
            </div>
				
				
<script>
  $(document).ready(function(){  
   
		        $('.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_form" ).validate( {
    				rules: {
    					contact_person: {
    						required: true,
    						minlength: 3
    					},
    					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) {
                            add_pickup_address(form);
                        }
    			} );
  });
  
  function add_pickup_address(form){
    		    $('#loader').show();
    		    var formData = new FormData(form);
    		    formData.append('type','add_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) {
                                if(response['error']==false){
                                    $('#pickup_address_add_model').modal('hide');
                                    $('#pickup_address_form').trigger("reset");
                                    $('#loader').hide();
                                    pickup_address_list();
                                    success(response['message']);
                                }else{
                                    $('#loader').hide();
                                    warning(response['message']);
                                };
                            }
                        });
    		}
</script>

Zerion Mini Shell 1.0