JezK
Edit File: req.php
<?php include("app/checkSession.php"); include("header.php"); // include("app/adminObj.php"); if(!isset($_SESSION['customer_user_id'])){ $customerObj->redirect('login.php'); } if(!isset($_GET['id']) || $_GET['id'] <1) { echo "<script>location.replace('./warehouse.php')</script>"; } $dealsData=$customerObj->getWarehouseDealList($_GET['id'],"productwareHouseDeals"); $warehouseType=$customerObj->getWarehouseType($_GET['id'],'wareHousePriceType'); $warehouseDetails=$customerObj->getWarehouseData($_GET['id']); // print_r($_SESSION); // exit; if(!$warehouseDetails) { echo "<script>alert('Unable to request this warehouse please try again later.')</script>"; echo "<script>location.replace('./warehouse.php')</script>"; } //~ echo "<pre>"; //~ print_r($warehouseDetails);exit; $pricePerDay=''; $warehouseSelect=''; if(isset($warehouseType) && count($warehouseType)>0){ $optionType=''; foreach($warehouseType as $type){ $optionType.= '<option value='.$type['pricetype_id'].'>'.$lang[$type['lang_variables']].'</option>'; } } $currencyType=''; $warehouseName=''; $warehouseCountry=''; $warehouseCity=''; $warehouseAddress=''; $warehouseLogo = ''; if(count($warehouseDetails)>0){ //~ $warehouseDetails['country_name']; if(isset($warehouseDetails[0]['warehouse_name'])){ $warehouseName=$warehouseDetails[0]['warehouse_name']; } if(isset($warehouseDetails[0]['display_name'])){ $warehouseCountry= $warehouseDetails[0]['display_name']; } if(isset($warehouseDetails[0]['warehouse_city'])){ $warehouseCity= $warehouseDetails[0]['warehouse_city']; } if(isset($warehouseDetails[0]['warehouse_address'])){ $warehouseAddress= $warehouseDetails[0]['warehouse_address']; } if(isset($warehouseDetails[0]['warehouse_logo'])){ $warehouseLogo= $warehouseDetails[0]['warehouse_logo']; } $countryId = $warehouseDetails[0]['warehouse_country_id']; $pricePerDay=''; if($warehouseDetails[0]['warehouse_country_id']=='2'){ $currencyType="AED" ; } else if($warehouseDetails[0]['warehouse_country_id']=='3'){ $currencyType="JD" ; } else if($warehouseDetails[0]['warehouse_country_id']=='1'){ $currencyType="SAR" ; } } $minPallet=0; $maxPallet=0; $minSpace=0; $maxSpace=0; $minPalletPeriod=0; $maxPalletPeriod=0; $minSpacePeriod=0; $maxSpacePeriod=0; if(count($warehouseDetails)>0){ foreach($warehouseDetails as $data){ if($data['price_type']==2){ // for MINPALLET if($data['minimum']!=''){ $minPallet=$data['minimum']; }else{ $minPallet=0;} // for maxpallet if($data['maximum']!=''){ $maxPallet=$data['maximum']; }else{$maxPallet=0;} // for minperiod if($data['minimum_period']!=''){ $minPalletPeriod=$data['minimum_period']; }else{ $minPalletPeriod=0;} // for maxperiod if($data['maximum_period']!=''){ $maxPalletPeriod=$data['maximum_period']; }else{$maxPalletPeriod=0;} } else if($data['price_type']==3){ // for MINSpace if($data['minimum']!=''){ $minSpace=$data['minimum']; }else{ $minSpace=0;} // for maxspace if($data['maximum']!=''){ $maxSpace=$data['maximum']; }else{$maxSpace=0;} // for minperiod if($data['minimum_period']!=''){ $minSpacePeriod=$data['minimum_period']; }else{ $minSpacePeriod=0;} // for maxperiod if($data['maximum_period']!=''){ $maxSpacePeriod=$data['maximum_period']; }else{$maxSpacePeriod=0;} } } } $dealsCheckboxes=''; if(isset($dealsData) && count($dealsData)>0) { foreach($dealsData as $v) { $activeClass=''; if($v['deal_id']==1) $selectAllClass="id='prdDeal'"; else $selectAllClass="class='prdd1'"; $dealsCheckboxes.="<div class='col-lg-4 col-md-6 col-sm-12'><label class='ml-4 custom-label' title='".trim($lang[$v['lang_variables']])."'>".trim($lang[$v['lang_variables']]). "<input type='checkbox' name='productwareHouseDeals[]' ischecked $selectAllClass value='".$v['deal_id']."' $activeClass><span class='checkbox'></span></label></div>"; } } $countryList=$customerObj->getCountryList(); $optionData=''; foreach($countryList as $val) { $optionData.= '<option class="text-uppercase" value='.$val['country_id'].'>'.$val['display_name'].'</option>'; } ?> <style> /* Hide the browser's default checkbox */ input[type="checkbox"] { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; } .checkbox { position: absolute; top: 2px; left: 15px; height: 20px; width: 20px; background-color: #eee; border-radius:12px; cursor:pointer; } :hover input ~ .checkbox { background-color: #ccc; } /* When the checkbox is checked, add a blue background */ input[type="checkbox"]:checked ~ .checkbox { background-color: #2196F3; } /* Create the checkmark/indicator (hidden when not checked) */ .checkbox:after { content: ""; position: absolute; display: none; } /* Show the checkmark when checked */ input[type="checkbox"]:checked ~ .checkbox:after { display: block; } /* Style the checkmark/indicator */ .checkbox:after { left: 8px; top: 5px; width: 5px; height: 10px; border: solid white; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } /* .frm-input, .datepicker { border: unset!important; background-color: #f5f9ff !important; } */ .shadow { border: 0; box-shadow: 0px 3px 5px #04c6ff45 !important; } .border-10 { border-radius: 18px !important; } input[type="radio"] { position: absolute; opacity: 7; cursor: pointer; } span.checkmark { border-radius: 50%; height: 24px; width: 24px; position: relative; background-color: grey; color: #fff; display: inline-block; text-align: center; margin-right: 9px; } input:checked~.checkmark { background-color: #2196F3; } input:checked~.radio-inline { background-color: #2196F3; } .calendericon { position: absolute; top: 52px; right: 20px; } .currencyType { position: absolute; right: 0px; bottom: 0px; border: 1px solid #ced4da; padding: 6px; color: #2c60d0; font-weight: bold; } input.value { width: 75%; } .custom-label{ width: 100%; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } </style> <div class="container mt-2"> <a href="javascript:history.go(-1)" class="ml-5"><img src="images/back_main.png" class="pb-3"></a> <div class="row d-flex justify-content-center"> <div class="col-md-11 "> <div class="row"> <div class=" col-lg-4 col-md-6 col-sm-12 my-3"> <h5><?php echo $lang['REQUEST_A_QUOTE']; ?></h5> </div> </div> <div class="container"> <form method="post" action="app/request_quote_app.php"> <input type="hidden" name="warehouse_id" value="<?php if(isset($_GET['id'])) echo $_GET['id']; else " "?>"> <input type="hidden" name="warehouse_type" value="0"> <div class="row justify-content-center flex-column bg-white p-md-4 px-2 card shadow border-10 "> <div class="row col-sm-12"> <?php if(isset($warehouseLogo) && isset($warehouseLogo)!=''){ ?> <img src="./uploads/warehouse_imgs/<?php echo $warehouseLogo ?>" alt="image1" height="100px" width="150px" > <?php } else{ ?> <img src="pictures/img1.png" alt="image1" height="100px" width="150px" > <?php } ?> <div class="card-body"> <h6 class="card-title"><?php echo $warehouseName ?></h6> <div class=" col-lg-6 col-md-12 col-sm-12 px-md-0"> <p class="card-text text-dark"> <img src="images/location.png"> <?php echo $warehouseCountry.', '.$warehouseCity.', '.$warehouseAddress ?> </p> </div> </div> </div> <div class="alignmentclass row"> <div class=" col-lg-3 col-md-6 col-sm-12 pt-3"> <label for="servicetype" class="inpt-label d-block"><?php echo $lang ['SERVICE_TYPE']; ?></label> <div class="input-container"> <select id="service" name="pallet_or_space_type" class="form-control frm-input" onChange="return serviceType()"> <option value=""><?php echo $lang ['SELECT']?></option> <?php echo $optionType ?> </select> <div class="error pallet_or_space_type_error "></div> </div> </div> <div class="pallet pt-4 col-lg-3 col-md-6 col-sm-12" style="display:block"> <label for="pallet" class="inpt-label"></label> <div class="input-container"> <input type="text" id="none" name="pallet" value="" class="form-control frm-input" placeholder="" /> </div> </div> <div class="pallet pt-3 col-lg-3 col-md-6 col-sm-12" style="display:none"> <label for="pallet" class="inpt-label"><?php echo $lang['NUMBER_OF_PALLETS']; ?></label> <div class="input-container"> <input type="text" id="pallet" name="pallet" value="" class="form-control frm-input onChange" /> <div class="error numberOfPallets"></div> </div> </div> <div class="space pt-3 col-lg-3 col-md-6 col-sm-12" style="display:none"> <label for="space" class="inpt-label"><?php echo $lang['NUMBER_OF_SQUARE_METERS']; ?></label> <div class="input-container"> <input type="text" id="space" name="space" value="" class="form-control frm-input onChange" placeholder="<?php echo $lang['SQMTS']?>" /> <div class="error numberOfSpace"></div> </div> </div> <div class=" pt-3 pb-3 col-lg-3 col-md-6 col-sm-12"> <label><?php echo $lang['FROM_DATE']; ?></label> <div class="input-container"> <input type="text" name="fromdate" id="datepicker" class="form-control datepicker time_req FromDate" onclick=" return fromDate()" autocomplete="off"> <div class="calendericon"> <img src="images/Customer_croppings/calender.png"> </div> <div class="error fromDate"></div> </div> <!-- <label for="space" class="inpt-label">Number of days</label> <div class="input-container"> <input type="text" id="total_days" name="total_days" value="" class="form-control onChange frm-input" placeholder="No of Days" onkeyup="totalPrice(this.value)" /> <div class="error numberOfdays"></div> </div> --> </div> <div class=" pt-3 pb-3 col-lg-3 col-md-6 col-sm-12"> <label><?php echo $lang['TO_DATE']; ?></label> <div class="input-container"> <input type="text" name="todate" id="datepicker1" class="form-control datepicker time_req1 todate Todate" onclick=" return toDate()" autocomplete="off"> <div class="calendericon"> <img src="images/Customer_croppings/calender.png" > </div> <div class="error toDate"></div> </div> <!-- <label for="space" class="inpt-label">Expected Value</label> <div class="input-container "> <div class="position-relative"> <input type="text" name="currency" class="form-control value" placeholder style="padding-right: 40px;" id="currencyValue"> <span class="currencyType"><?php echo $currencyType ?></span> </div> <input type="hidden" name="currency_type" value="<?php echo $countryId ?>" id="currencyType" /> <div class="error expectedValue"></div> <div class="alert alert-info msg mt-1 " style="display: none;"> <strong id="expectedValue"></strong> </div> </div> --> </div> </div> <div class="alignmentclass row"> <div class=" pt-3 pb-3 col-lg-3 col-md-6 col-sm-12"> <label for="space" class="inpt-label"><?php echo $lang['NUMBER_OF_DAYS']; ?></label> <div class="input-container"> <input type="text" id="total_days" name="total_days" value="" class="form-control frm-input" placeholder="<?php echo $lang['NO_OF_DAYS'] ?>" readonly /> <div class="error numberOfdays"></div> </div> </div> <div class=" pt-3 pb-3 col-lg-3 col-md-6 col-sm-12"> <label for="space" class="inpt-label"> <?php echo $lang['TOTAL_VALUE_FOR_QUOTATION']; ?> </label> <div class="input-container "> <div class="position-relative col-sm-12 pl-0"> <div class="row"> <div class="col-md-8 col-10"> <input type="text" name="currency" class="form-control" placeholder id="currencyValue" onkeypress="return number(event)" / > </div> <div class="col-md-2 col-2"> <span class="currencyType"><?php echo $currencyType ?></span> </div> </div> <!-- class for input is value --> <div class="error expectedValue"></div> </div> <input type="hidden" name="currency_type" value="<?php echo $countryId ?>" id="currencyType" /> </div> </div> <div class=" pt-3 pb-3 col-lg-3 col-md-6 col-sm-12"> <label for="space" class="inpt-label"><?php echo $lang['TOTAL_WEIGHT_FOR_GOODS']; ?></label> <div class="input-container"> <input type="text" id="total_goods" name="total_goods" value="" class="form-control frm-input" placeholder="<?php echo $lang['TOTAL_WEIGHT_FOR_GOODS'] ?>" /> <div class="error totalWgtGoods"></div> </div> </div> </div> </div> </div> <div class="row justify-content-center flex-column bg-white p-md-4 p-2 card shadow card-alignment border-10 mt-3"> <!-- <label for="dealswedealwith" class="inpt-label">Products we deal with</label> --> <label for="dealswedealwith" class="inpt-label mb-0" data-toggle="collapse" data-target="#demo"><?php echo $lang['Products_we_deal_with']; ?><i class="fa fa-angle-down float-right" style="font-size: 25px;"></i></label> <div class="error checkboxes"></div> <div id="demo" class="collapse"> <div class="row mt-3"> <?php echo $dealsCheckboxes ?> </div> </div> </div> <div class="row justify-content-center flex-column bg-white p-md-4 p-2 card shadow card-alignment border-10 mt-3"> <!-- <label for="todate" class="inpt-label">Description if any</label> --> <label for="dealswedealwith" class="inpt-label mb-0" data-toggle="collapse" data-target="#demo1"><?php echo $lang['DESCRIPTION']; ?><i class="fa fa-angle-down float-right" style="font-size: 25px;"></i></label> <div id="demo1" class="collapse mt-3"> <div class="input-container"> <textarea type="text" id="description" name="description" rows="5" class="form-control frm-input col-sm-12" placeholder="<?php echo $lang['DESCRIPTION']; ?>"></textarea> </div> </div> </div> <div class="row mt-3 justify-content-end "> <button class="btn btn-primary" name="request_quote" onclick=" return requestQuoteValidation()"><span><?php echo $lang['Send_Request']; ?></span></button> </div> </form> </div> </div> </div> </div> <?php include("footer.php"); ?> <script src="js/validations.js"></script> <!-- <script type="text/javascript" src="js/jquery-3.5.1.min.js"></script> --> <!-- <script type="text/javascript" src="js/date_time/nl.js"></script> --> <script> var minimumPeriod; var maximumPeriod; function serviceType() { var x = document.getElementById("service").value; if (x =='2') { minimumPeriod=<?php echo $minPalletPeriod ?>; maximumPeriod=<?php echo $maxPalletPeriod ?>; $(".pallet").attr("style", "display:block") $(".space").attr("style", "display:none") $("#none").parent().parent().attr("style", "display:none") } else if(x=='3'){ minimumPeriod=<?php echo $minSpacePeriod ?>; maximumPeriod=<?php echo $maxSpacePeriod ?>; $(".space").attr("style", "display:block") $(".pallet").attr("style", "display:none") $("#none").parent().parent().attr("style", "display:none") } } $ = jQuery; function toDate(){ if (document.getElementById("datepicker1").value != '' ) { $('#datepicker1').datetimepicker({ format: 'MM-DD-YYYY', }) } } $('#datepicker1').datetimepicker({ format: 'MM-DD-YYYY', minDate:new Date(), }).on('dp.change',function(e){ var fromDate=document.getElementById("datepicker").value var toDate=document.getElementById("datepicker1").value var yo = fromDate.split("-"); var yoo = toDate.split("-"); var date1 = new Date(yo[2],yo[0],yo[1]); var date2 = new Date(yoo[2],yoo[0],yoo[1]); var Time = parseInt(date2.getTime()) - parseInt(date1.getTime()); var Days = Time / (1000 * 3600 * 24) if(Days != 0){ document.getElementById("total_days").value = parseInt(Days); if(Days>=minimumPeriod && Days<=maximumPeriod){ $('.numberOfdays').html(''); }else{ $('.numberOfdays').html('<?php echo $lang['MINIMUM_DAYS_IS'];?> '+minimumPeriod+" <?php echo $lang['AND_MAXIMUM_DAYS_IS']; ?> "+ maximumPeriod); //~ alert("else") $('.toDate').html('<?php echo $lang['PLEASE_CHANGE_TO_DATE'];?>'); return false; } var daysInputValue=document.getElementById('total_days').value; // var price=<?php echo $pricePerDay ?>; if(Days!='' && Days!=0){ // var totalValue=price*Days; // $('#currencyValue').val(totalValue) // return false; } } }); $('#datepicker').datetimepicker({ format: 'MM-DD-YYYY', minDate:new Date(), }).on('dp.change',function(e){ $('.fromDate').html(''); date = moment($('#datepicker').val(), 'MM-DD-YYYY') $('#datepicker1').data("DateTimePicker").minDate(date); $('#datepicker1').val('') }); function fromDate() { $('#datepicker1').datetimepicker({ format: 'MM-DD-YYYY', }).on('dp.change',function(){ $(".toDate").html("") }); } $(function() { $(document).on('click', '#prdDeal', function() { if ($("#prdDeal").prop('checked') == true) { $('.prdd1').prop('checked', true); } else { $('.prdd1').prop('checked', false); } }); }); $(function() { $(document).on('change', '.onChange', function() { var minPallet=<?php echo $minPallet ?>; var maxPallet=<?php echo $maxPallet ?>; var minSpace= <?php echo $minSpace ?>; var maxSpace=<?php echo $maxSpace ?>; var palletInputValue=document.getElementById('pallet').value; var spaceInputValue=document.getElementById('space').value; if(palletInputValue!=''){ if((palletInputValue>=minPallet) && (palletInputValue<=maxPallet)){ $('.numberOfPallets').html('') }else{ $('.numberOfPallets').html('<?php echo $lang['MINIMUM_VALUE_IS'];?> '+minPallet+' <?php echo $lang['AND_MAXIMUM_VALUE'];?> '+ maxPallet); $("#pallet").val('') $('#pallet').focus(); } } if(spaceInputValue!=''){ if(spaceInputValue>=minSpace && spaceInputValue<=maxSpace){ $('.numberOfSpace').html(''); }else{ $('.numberOfSpace').html('<?php echo $lang['MINIMUM_VALUE_IS'];?> '+minSpace+' <?php echo $lang['AND_MAXIMUM_VALUE'];?> '+ maxSpace); $("#space").val('') $('#space').focus(); } } }); }); function currencyChange(country_id) { jQuery.ajax({ type: "POST", url: 'ajax.php', data: ({action:'get_currency',country_id:country_id}), success: function(data) { jQuery('.currency').html(data); } }); } function requestQuoteValidation(){ let serviceType=document.getElementById('service').value; let palletInputValue=document.getElementById('pallet').value; let spaceInputValue=document.getElementById('space').value; let numberOfDays=document.getElementById('total_days').value; let expectedValue=document.getElementById('currencyValue').value; let fromDate=document.getElementById('datepicker').value; let toDate=document.getElementById('datepicker1').value; let totalWgtGoods = document.getElementById('total_goods').value; let productDealsValue= jQuery('input[name="productwareHouseDeals[]"]:checked').length; $('.error').html(''); if( serviceType==''){ $('.pallet_or_space_type_error').html('<?php echo $lang['SELECT_SERVICE_TYPE']; ?>'); $('#service').focus(); return false; } else if(serviceType==2 && palletInputValue==''){ // alert('hello') $('.numberOfPallets').html('<?php echo $lang['PLEASE_ENTER_PALLET_VALUE']; ?>'); $('#pallet').focus() return false; } else if(serviceType==3 && spaceInputValue==''){ $('.numberOfSpace').html(' <?php echo $lang['PLEASE_ENTER_SPACE_VALUE']; ?>'); $('#space').focus(); return false; } else if(fromDate=='') { $('.fromDate').html('<?php echo $lang['PLEASE_ENTER_FROM_DATE']; ?>'); $('#datepicker').focus(); return false; } else if(toDate==''){ $('.toDate').html('<?php echo $lang['PLEASE_ENTER_TO_DATE']; ?>'); $('#datepicker1').focus(); return false; } else if(numberOfDays==''){ $('.numberOfdays').html(' <?php echo $lang['PLEASE_ENTER_NUMBER_OF_DAYS']; ?>'); $('#total_days').focus(); return false; } else if(expectedValue==''){ $('.expectedValue').html('<?php echo $lang['PLEASE_ENTER_TOTAL_EXPECTED_VALUE']; ?>'); $('#currencyValue').focus(); return false; }else if(totalWgtGoods == "") { $('.totalWgtGoods').html(' <?php echo $lang['PLEASE_ENTER_TOTAL_WEIGHT_FOR_GOODS']; ?>'); $('#total_goods').focus(); return false; }else if(productDealsValue==0){ $('.checkboxes').html(' <?php echo $lang['SELECT_MINIMUM_ONE_PRODUCT_WE_DEAL_WITH']; ?>'); return false; } else if(numberOfDays>=minimumPeriod && numberOfDays<=maximumPeriod){ $('.numberOfdays').html(''); }else{ $('.numberOfdays').html('<?php echo $lang['MINIMUM_DAYS_IS']; ?> '+minimumPeriod+' <?php echo $lang['AND_MAXIMUM_DAYS_IS']; ?> '+ maximumPeriod); $('.toDate').html(' <?php echo $lang['PLEASE_CHANGE_TO_DATE']; ?>'); return false; } } function number(e) { var key = e.keyCode || e.charCode; if(key == 13 || key == 43 || (key >= 48 && key <= 57) || key == 8 || key == 46) { return true; } else { return false; } } </script>