@ -6,7 +6,7 @@
"Qualification Tester"< / h3 >
< div class = "InquiryBox" >
< form action = "" method = "post" novalidate = "" id = "qualification_tester_form" >
< p > 1. I will depart from:< / p >
< p > 1. I will depart from:< / p >
< select id = "depart_from" name = "depart_from" class = "country_code" style = "width: 100%;" >
< option value = "United States " > United States< / option >
< option value = "United Kingdom " > United Kingdom< / option >
@ -260,7 +260,7 @@
< option value = "Zimbabwe " > Zimbabwe< / option >
< option value = "Åland Islands" > Åland Islands< / option >
< / select >
< p > 2. I will arrive in China at [city], [airport / railway station / port].< / p >
< p > 2. I will arrive in China at [city], [airport / railway station / port].< / p >
< select id = "arrive_at_city" name = "arrive_at_city" class = "country_code" >
< option value = "Beijing" > Beijing< / option >
< option value = "Shanghai" > Shanghai< / option >
@ -287,78 +287,17 @@
< / select >
< select id = "airport_or_railway_station" name = "airport_or_railway_station" class = "country_code" >
< option data-hour = "72,144" value = "Guangzhou Baiyun International Airport" > Guangzhou Baiyun International
Airport, CAN< / option >
< option data-hour = "72" value = "Guilin Liangjiang International Airport" > Guilin Liangjiang International Airport,
KWL< / option >
< option data-hour = "72,144" value = "Chengdu Shuangliu International Airport" > Chengdu Shuangliu International
Airport, CTU< / option >
< option data-hour = "72,144" value = "Chongqing Jiangbei International Airport" > Chongqing Jiangbei International
Airport, CKG< / option >
< option data-hour = "72,144" value = "Xi'an Xianyang International Airport" > Xi'an Xianyang International Airport,
XIY< / option >
< option data-hour = "72,144" value = "Kunming Changshui International Airport" > Kunming Changshui International
Airport, KMG< / option >
< option data-hour = "72" value = "Xiamen Gaoqi International Airport" > Xiamen Gaoqi International Airport, XMN
< / option >
< option data-hour = "72,144" value = "Wuhan Tianhe International Airport" > Wuhan Tianhe International Airport, WUH
< / option >
< option data-hour = "72" value = "Harbin Taiping International Airport" > Harbin Taiping International Airport, HRB
< / option >
< option data-hour = "72" value = "Changsha Huanghua International Airport" > Changsha Huanghua International Airport,
CSX< / option >
< option data-hour = "72" value = "Qingdao Liuting International Airport" > Qingdao Liuting International Airport, TAO
< / option >
< option data-hour = "144" value = "Qingdao Jiaodong International Airport" > Qingdao Jiaodong International Airport,
TAO< / option >
< option data-hour = "144" value = "Xiamen Wutong Wharf" > Xiamen Wutong Wharf< / option >
< option data-hour = "144" value = "Chongqing Wanzhou Wuqiao Airport" > Chongqing Wanzhou Wuqiao Airport, WXN< / option >
< option data-hour = "144" value = "Qingdao Port" > Qingdao Port< / option >
< option data-hour = "144" value = "Chengdu Tianfu International Airport" > Chengdu Tianfu International Airport, TFU
< / option >
< option data-hour = "144" value = "Beijing Capital International Airport" > Beijing Capital International Airport, PEK
< / option >
< option data-hour = "144" value = "Beijing Capital International Airport" > Beijing Capital International Airport, PEK< / option >
< option data-hour = "144" value = "Beijingxi Railway Station" > Beijingxi Railway Station< / option >
< option data-hour = "144" value = "Beijing Daxing International Airport" > Beijing Daxing International Airport, PKX
< / option >
< option data-hour = "144" value = "Tianjin Binhai International Airport" > Tianjin Binhai International Airport, TSN
< / option >
< option data-hour = "144" value = "Tianjin International Cruise Home Port" > Tianjin International Cruise Home Port
< / option >
< option data-hour = "144" value = "Shijiazhuang Zhengding International Airport" > Shijiazhuang Zhengding
International Airport, SJW< / option >
< option data-hour = "144" value = "Qinhuangdao Port" > Qinhuangdao Port< / option >
< option data-hour = "144" value = "Shenzhen Bao'an International Airport" > Shenzhen Bao'an International Airport, SZX
< / option >
< option data-hour = "144" value = "Jieyang Chaoshan International Airport" > Jieyang Chaoshan International Airport,
SWA< / option >
< option data-hour = "144" value = "Shanghai Pudong International Airport" > Shanghai Pudong International Airport, PVG
< / option >
< option data-hour = "144" value = "Shanghai Hongqiao International Airport" > Shanghai Hongqiao International Airport,
SHA< / option >
< option data-hour = "144" value = "Shanghai Port International Cruise Terminal" > Shanghai Port International Cruise
Terminal< / option >
< option data-hour = "144" value = "Shanghai Wusongkou International Cruise Terminal" > Shanghai Wusongkou
International Cruise Terminal< / option >
< option data-hour = "144" value = "Shanghai Railway Station" > Shanghai Railway Station< / option >
< option data-hour = "144" value = "Shanghainan Railway Station" > Shanghainan Railway Station< / option >
< option data-hour = "144" value = "Shanghaixi Railway Station" > Shanghaixi Railway Station< / option >
< option data-hour = "144" value = "Shanghai Hongqiao Railway Station" > Shanghai Hongqiao Railway Station< / option >
< option data-hour = "144" value = "Hangzhou International Airport" > Hangzhou International Airport, HGH< / option >
< option data-hour = "144" value = "Nanjing Lukou International Airport" > Nanjing Lukou International Airport, NKG
< / option >
< option data-hour = "144" value = "Ningbo Lishe International Airport" > Ningbo Lishe International Airport, NGB
< / option >
< option data-hour = "144" value = "Shenyang Taoxian International Airport" > Shenyang Taoxian International Airport,
SHE< / option >
< option data-hour = "144" value = "Dalian Zhoushuizi International Airport" > Dalian Zhoushuizi International Airport,
DLC< / option >
< option data-hour = "144" value = "Beijing Daxing International Airport" > Beijing Daxing International Airport, PKX< / option >
< / select >
< p > 3. My arrival date is...< / p >
< input id = "arrival_date" name = "arrival_date" type = "date" >
< p > 4. I will leave for [country] from China.< / p >
< p > 3. My arrival date is...< / p >
< input id = "arrival_date" name = "arrival_date" type = "date" >
< span id = "arrival_date_errmsg" style = "display: none;" >
< span class = "requiredArea" > Please select your arrival date.< / span >
< / span >
< p > 4. I will leave for [country] from China.< / p >
< select id = "leave_for_country" name = "leave_for_country" class = "country_code" style = "width: 100%;" >
< option value = "United States " > United States< / option >
< option value = "United Kingdom " > United Kingdom< / option >
@ -613,9 +552,12 @@
< option value = "Åland Islands" > Åland Islands< / option >
< / select >
< p > 5. My departure date is...< / p >
< input id = "departure_date" name = "departure_date" type = "date" >
< p > 6. My nationality is... and my passport expiry date is< / p >
< p > 5. My departure date is...< / p >
< input id = "departure_date" name = "departure_date" type = "date" >
< span id = "departure_date_errmsg" style = "display: none;" >
< span class = "requiredArea" > Please select your departure date.< / span >
< / span >
< p > 6. My nationality is... and my passport expiry date is< / p >
< select id = "nationality" name = "nationality" class = "country_code" style = "float: left;" >
< option data-qualify = "enable" value = "United States " > United States< / option >
< option data-qualify = "enable" value = "United Kingdom " > United Kingdom< / option >
@ -869,49 +811,44 @@
< option value = "Zimbabwe " > Zimbabwe< / option >
< option value = "Åland Islands" > Åland Islands< / option >
< / select >
< input id = "expiry_date" name = "expiry_date" type = "date" >
< p > 8. I have no Chinese visa refusal stamps in my passport.< / p >
< div class = "checkYes" >
< input type = "radio" value = "I have no Chinese visa refusal stamps in my passport." name = "visa_refusal_stamps"
id="visa_refusal_stamps_yes" class="checkBorder">
< input id = "expiry_date" name = "expiry_date" type = "date" >
< span id = "expiry_date_errmsg" style = "display: none;" >
< span class = "requiredArea" > Please select your passport expiry date.< / span >
< / span >
< p > 8. I have no Chinese visa refusal stamps in my passport.< / p >
< div class = "checkYes" >
< input type = "radio" value = "I have no Chinese visa refusal stamps in my passport." name = "visa_refusal_stamps" id = "visa_refusal_stamps_yes" class = "checkBorder" >
< label for = "visa_refusal_stamps_yes" > Yes< / label >
< / div >
< div class = "checkYes" >
< input type = "radio" value = "I have Chinese visa refusal stamps in my passport." name = "visa_refusal_stamps"
id="visa_refusal_stamps_no" class="checkBorder">
< / div >
< div class = "checkYes" >
< input type = "radio" value = "I have Chinese visa refusal stamps in my passport." name = "visa_refusal_stamps" id = "visa_refusal_stamps_no" class = "checkBorder" >
< label for = "visa_refusal_stamps_no" > No< / label >
< / div >
< button class = "sendButton" id = "take_a_test_button" name = "take_a_test_button" type = "button"
style="width: 100%;">Check Your Resul t< / button >
< / div >
< button class = "sendButton" id = "take_a_test_button" name = "take_a_test_button" type = "button" style = "width: 100%;" > Take a Tes t< / button >
< / div >
< / form >
< div id = "result_box" style = "display: none; padding: 0 20px; text-align: left;" >
< h3 style = "text-align: left; padding-bottom: 0;" > Result:< / h3 >
< p id = "qualify_72hours" style = "display: none" > You qualify to enjoy China's 72-hour visa-free policy.< / p >
< p id = "qualify_144hours" style = "display: none" > You qualify to enjoy China's 144-hour visa-free policy.< / p >
< p id = "qualify_no" style = "display: none" > You don't qualify to enjoy China's 72-hour or 144-hour visa-free policy.
< / p >
< p id = "qualify_no" style = "display: none" > You don't qualify to enjoy China's 72-hour or 144-hour visa-free policy.< / p >
< / div >
< div id = "reason_box" style = "display: none; padding: 0 20px; text-align: left;" >
< p > Reason you not qualify:< / p >
< p > Reason you no not qualify:< / p >
< ul class = "infolist" >
< li id = "error_transit" style = "display: none" > You must be in transit to a third country or region.< / li >
< li id = "error_72hours" style = "display: none" > You must not leave the city area (prefecture or municipality) during
the 72/144 hours (the 72/144-hour limit is calculated starting from 00:00 on the day after arrival, i.e. 24:00
on the arrival date).< / li >
< li id = "error_3months" style = "display: none" > Your passport must be valid for more than 3 months at the time of
entry into China.< / li >
< li id = "error_eligible" style = "display: none" > Your passport nationality is not eligible for the 72/144-hour visa
exemption program.< / li >
< li id = "error_72hours" style = "display: none" > You must not leave the city area (prefecture or municipality) during the 72/144 hours (the 72/144-hour limit is calculated starting from 00:00 on the day after arrival, i.e. 24:00 on the arrival date).< / li >
< li id = "error_3months" style = "display: none" > Your passport must be valid for more than 3 months at the time of entry into China.< / li >
< li id = "error_eligible" style = "display: none" > Your passport nationality is not eligible for the 72/144-hour visa exemption program.< / li >
< li id = "error_refusal" style = "display: none" > You have Chinese visa refusal stamps in your passport.< / li >
< / ul >
< p >
< / div >
< strong id = "tip_box" style = "display: none" > We suggest you bring your China hotel reservation in case it is needed at
the time of entry into China.< / strong > < / p >
< strong id = "tip_box" style = "display: none" > We suggest you bring your China hotel reservation in case it is needed at the time of entry into China.< / strong > < / p >
< / div >
< script >
function ready(fn) {
function ready(fn) {
const el = (elementId) => {
var element = document.getElementById(elementId);
if (element === null) console.error('element is null: ' + elementId);
@ -936,19 +873,15 @@
document.addEventListener('DOMContentLoaded', () => {
fn(el);
});
}
}
function calcDiffInDays(fromDate, thruDate) {
function calcDiffInDays(fromDate, thruDate) {
const diffInMs = Math.abs(thruDate - fromDate);
const diffInDays = Math.ceil(diffInMs / (1000 * 60 * 60 * 24));
return diffInDays;
}
function validation() {
///
}
}
ready(el => {
ready(el => {
flatpickr("#arrival_date", {
dateFormat: "Y-m-d",
@ -989,11 +922,145 @@
const qualify_144hours = el('qualify_144hours');
const qualify_no = el('qualify_no');
const expiry_date_errmsg = el('expiry_date_errmsg');
const departure_date_errmsg = el('departure_date_errmsg');
const arrival_date_errmsg = el('arrival_date_errmsg');
const cityAirportMap = new Map([
['Beijing', [
{text: 'Beijing Capital International Airport, PEK', hour: '144'},
{text: 'Beijingxi Railway Station', hour: '144'},
{text: 'Beijing Daxing International Airport, PKX', hour: '144'},
]
],
['Shanghai', [
{text: 'Shanghai Pudong International Airport, PVG', hour: '144'},
{text: 'Shanghai Hongqiao International Airport, SHA', hour: '144'},
{text: 'Shanghai Port International Cruise Terminal', hour: '144'},
{text: 'Shanghai Wusongkou International Cruise Terminal', hour: '144'},
{text: 'Shanghai Railway Station', hour: '144'},
{text: 'Shanghainan Railway Station', hour: '144'},
{text: 'Shanghaixi Railway Station', hour: '144'},
{text: 'Shanghai Hongqiao Railway Station', hour: '144'},
]
],
['Guangzhou', [
{text: 'Guangzhou Baiyun International Airport, CAN', hour: '72,144'},
]
],
['Chengdu', [
{text: 'Chengdu Shuangliu International Airport, CTU', hour: '72,144'},
{text: 'Chengdu Tianfu International Airport, TFU', hour: '144'},
]
],
['Chongqing', [
{text: 'Chongqing Jiangbei International Airport, CKG', hour: '72,144'},
{text: 'Chongqing Wanzhou Wuqiao Airport, WXN', hour: '144'},
]
],
['Guilin', [
{text: 'Guilin Liangjiang International Airport, KWL', hour: '72'},
]
],
["Xi'an", [
{text: "Xi'an Xianyang International Airport, XIY", hour: '72,144'},
]
],
["Kunming", [
{text: "Kunming Changshui International Airport, KMG", hour: '72,144'},
]
],
["Qingdao", [
{text: "Qingdao Liuting International Airport, TAO", hour: '72'},
{text: "Qingdao Jiaodong International Airport, TAO", hour: '144'},
{text: "Qingdao Port", hour: '144'},
]
],
["Xiamen", [
{text: "Xiamen Gaoqi International Airport, XMN", hour: '72'},
{text: "Xiamen Wutong Wharf", hour: '144'},
]
],
["Wuhan", [
{text: "Wuhan Tianhe International Airport, WUH", hour: '72,144'},
]
],
["Harbin", [
{text: "Harbin Taiping International Airport, HRB", hour: '72'},
]
],
["Changsha", [
{text: "Changsha Huanghua International Airport, CSX", hour: '72'},
]
],
["Tianjin", [
{text: "Tianjin Binhai International Airport, TSN", hour: '144'},
{text: "Tianjin International Cruise Home Port", hour: '144'},
]
],
["Shijiazhuang", [
{text: "Shijiazhuang Zhengding International Airport, SJW", hour: '144'},
]
],
["Qinhuangdao", [
{text: "Qinhuangdao Port", hour: '144'},
]
],
["Shenzhen", [
{text: "Shenzhen Bao'an International Airport, SZX", hour: '144'},
]
],
["Hangzhou", [
{text: "Hangzhou International Airport, HGH", hour: '144'},
]
],
["Nanjing", [
{text: "Nanjing Lukou International Airport, NKG", hour: '144'},
]
],
["Ningbo", [
{text: "Ningbo Lishe International Airport, NGB", hour: '144'},
]
],
["Shenyang", [
{text: "Shenyang Taoxian International Airport, SHE", hour: '144'},
]
],
["Jieyang", [
{text: "Jieyang Chaoshan International Airport, SWA", hour: '144'},
]
],
["Dalian", [
{text: "Dalian Zhoushuizi International Airport, DLC", hour: '144'},
]
],
]);
const arriveAtCitySelect = el('arrive_at_city');
const airportSelect = el('airport_or_railway_station');
arriveAtCitySelect.on('change', () => {
const selectedCity = arriveAtCitySelect.options[arriveAtCitySelect.selectedIndex].value;
console.info('selectedCity: ' + selectedCity);
const airportList = cityAirportMap.get(selectedCity)
airportSelect.options.length = 0;
airportList.forEach(element => {
let opt = new Option(element.text, element.text);
opt.setAttribute('data-hour', element.hour);
airportSelect.options.add(opt);
});
});
takeATestButton.on('click', () => {
var validateSuccess = true;
const departFrom = el('depart_from').value.trim();
const leave4Country = el('leave_for_country').value.trim();
const arrivalDateVal = el('arrival_date').value;
const departureDateVal = el('departure_date').value;
const expiryDateVal = el('expiry_date').value
error_transit.hide();
error_72hours.hide();
error_3months.hide();
@ -1002,6 +1069,18 @@
qualify_72hours.hide();
qualify_144hours.hide();
qualify_no.hide();
expiry_date_errmsg.hide();
departure_date_errmsg.hide();
arrival_date_errmsg.hide();
if (arrivalDateVal === '') {
arrival_date_errmsg.show();
}
if (departureDateVal === '') {
departure_date_errmsg.show();
}if (expiryDateVal === '') {
expiry_date_errmsg.show();
}
if (departFrom === leave4Country) {
console.info('You must be in transit to a third country or region.');
@ -1030,7 +1109,7 @@
const today = new Date();
today.setHours(0, 0, 0, 0);
const expiryDate = new Date(el('expiry_date').value );
const expiryDate = new Date(expiryDateVal );
const diffExpiryDate = calcDiffInDays(today, expiryDate);
console.log(diffExpiryDate);
if (isNaN(diffExpiryDate) || diffExpiryDate < = 180) {
@ -1039,9 +1118,6 @@
error_3months.show();
}
const arrivalDateVal = el('arrival_date').value;
const departureDateVal = el('departure_date').value;
const arrivalDate = new Date(arrivalDateVal);
const departureDate = new Date(departureDateVal);
const diffInDays = calcDiffInDays(arrivalDate, departureDate);
@ -1067,6 +1143,18 @@
qualify_144hours.show();
}
if (diffInDays > 0 & & diffInDays < = 3) {
qualify_72hours.show();
} else {
qualify_72hours.hide();
}
if (diffInDays > 3 & & diffInDays < = 6) {
qualify_144hours.show();
} else {
qualify_144hours.hide();
}
result_box.show();
if (validateSuccess) {
tip_box.show();
@ -1077,7 +1165,7 @@
reason_box.show();
}
});
});
});
< / script >
< style >
.tmbottom {