conutry-code:GWM

This commit is contained in:
sriramv 2023-07-21 19:55:20 +05:30
parent 7eaf4fa744
commit 59622f4e62
2 changed files with 38 additions and 7 deletions

View File

@ -292,10 +292,11 @@ $web_payment_sdk_url = $_ENV["ENVIRONMENT"] === Environment::PRODUCTION ? "https
<div class="col-lg-4 mb-3">
<label for="state">Province<span class="text-danger">*</span></label>
<input type="hidden" id="state_value" value="<?= $userdata[0]['state']; ?>" >
<input type="text" name="state" id="state" value="<?= $userdata[0]['state']; ?>" required>
<select name="canada_state" id="state2" >
<select name="canada_state" id="state2" required>
</select>
<span id="state_span_message"> </span>
<span id="state_span_message"> </span> <span id="state2_span_message"> </span>
</div>
<div class="col-lg-4 mb-3">
@ -612,7 +613,36 @@ $web_payment_sdk_url = $_ENV["ENVIRONMENT"] === Environment::PRODUCTION ? "https
$('#card-button').prop("disabled", true);
$('#card-button').css("background-color", "gray");
$('.js-example-basic-single').select2();
var country = $("#country").val();
if(country == 'Canada')
{
$('#state').attr('required', false);
$('#state').val($('#state_value').val());
$('#state2').attr('required', true);
$('#state_span_message').hide();
} else{
$('#state2').attr('required', false);
$('#state').attr('required', true);
$('#state2_span_message').hide();
}
});
$('#country').change(function() {
var country = $("#country").val();
if(country == 'Canada')
{
$('#state').attr('required', false);
$('#state').val($('#state_value').val());
$('#state2').attr('required', true);
$('#state_span_message').hide();
$('#state2_span_message').show();
} else{
$('#state2').attr('required', false);
$('#state2').val($('#state_value').val());
$('#state').attr('required', true);
$('#state2_span_message').hide();
$('#state_span_message').show();
}
});
$('#card-button').click(function() {
@ -634,11 +664,10 @@ $web_payment_sdk_url = $_ENV["ENVIRONMENT"] === Environment::PRODUCTION ? "https
function ValidateForm() {
var formInvalid = false;
$('#member_address input').each(function() {
$('#member_address input,select').each(function() {
if ($(this).val() === '') {
var id = $(this).attr('id');
var input_id = id+'_span_message';
$('#'+input_id+'').html('input required').css('color','red');
formInvalid = true;
}
@ -659,10 +688,12 @@ $web_payment_sdk_url = $_ENV["ENVIRONMENT"] === Environment::PRODUCTION ? "https
$('#last_name').keyup(function() {$('#last_name_span_message').html(''); if($('#last_name').val().length == 0){uncheck() }});
$('#address').keyup(function() {$('#address_span_message').html(''); if($('#address').val().length == 0){uncheck() } });
$('#state').keyup(function() {$('#state_span_message').html(''); if($('#state').val().length == 0){uncheck() }});
$('#state2').change(function() {$('#state2_span_message').html(''); if($('#state2').val().length == 0){uncheck() }});
$('#city').keyup(function() { $('#city_span_message').html('');if($('#city').val().length == 0){uncheck() }});
$('#country').keyup(function() {$('#country_span_message').html(''); if($('#country').val().length == 0){uncheck() }});
$('#pincode').keyup(function() {$('#pincode_span_message').html(''); if($('#pincode').val().length == 0){uncheck() }});
function uncheck(){ $('#rememberMe').prop('checked', false); $('#card-button').prop("disabled", true); $('#card-button').css("background-color", "gray"); }
</script>
</body>

View File

@ -174,7 +174,7 @@ $(document).ready(function(e){
{
canada_array = ["Alberta (AB)","British Columbia (BC)","Manitoba (MB)","New Brunswick (NB)","Newfoundland and Labrador (NL)","Northwest Territories (NT)","Nova Scotia (NS)","Nunavut (NU)","Ontario (ON)","Prince Edward Island (PE)","Quebec (QC)","Saskatchewan (SK)","Yukon (YT)"];
let result = '';
if($('#state').val() == ''){ result += ' <option>Select Province</option>'; }else{ result += ' <option value="'+$('#state').val()+'">'+$('#state').val()+'</option>'; }
if($('#state').val() == ''){ result += ' <option value="">Select Province</option>'; }else{ result += ' <option value="'+$('#state').val()+'">'+$('#state').val()+'</option>'; }
canada_array.forEach((element) => {
result += ' <option value="'+element+'">'+element+'</option>';
@ -193,7 +193,7 @@ $(document).ready(function(e){
if(country == 'Canada')
{
canada_array = ["Alberta (AB)","British Columbia (BC)","Manitoba (MB)","New Brunswick (NB)","Newfoundland and Labrador (NL)","Northwest Territories (NT)","Nova Scotia (NS)","Nunavut (NU)","Ontario (ON)","Prince Edward Island (PE)","Quebec (QC)","Saskatchewan (SK)","Yukon (YT)"];
let result = ' <option>Select Province</option>';
let result = ' <option value="">Select Province</option>';
canada_array.forEach((element) => {
result += ' <option value="'+element+'">'+element+'</option>';
});