const view_web_shared = { change_kind_action: function () { let kind_action = sha_control_select.get_val('#drl_kind_action', 0); if (kind_action != "insert" && kind_action != undefined) { $("#div_contain_cer").removeClass("d-none"); $("#div_contract").removeClass("d-none"); $('#hdf_para_kind_action').val(kind_action); } else if (kind_action == "insert") { $("#div_contain_cer").addClass("d-none"); sha_control_input.clear_val('certificate_code'); $('#hdf_para_kind_action').val(kind_action); } }, change_certificate_code: function (_id) { let cer_value = sha_control_input.get_val(_id); if (cer_value.length > 0) { cer_value = cer_value.replaceAll(" ", ""); $('#hdf_para_certificate_code').val(cer_value); const current_product = sha_control_input.get_val('hdf_set_current_product'); let product_config = sha_control_input.get_val('hdf_set_product_config'); if (product_config !== "") { product_config = JSON.parse(product_config); if (current_product === product_config.TRANSPORT) { view_transport.load(); } else if (current_product === product_config.MOTORCYCLE) { view_motorcycle.load(); } else if (current_product === product_config.PHUC_AN_KHANG) { view_phuc_an_khang.load(); } else if (current_product === product_config.MEDICAL_CARE) { view_medical_care.load(); } else if (current_product === product_config.TRAVEL) { view_travel_domestic.load(); } else if (current_product === product_config.TRAVEL_PCV) { view_travel_pcv.load(); } else if (current_product === product_config.ACCIDENT_2424) { view_accident_2424.load(); } else if (current_product === product_config.HOUSE_APARTMENT) { view_house_apartment.load(); } } } }, change_kind_customer: function () { let kind_list = $('#drl_kind_customer .--select-item .active'); if (kind_list.length > 0) { let item = kind_list[0]; let kind_action = shared.GetInput.Attributes(item, 'customer_value'); if (kind_action == "company") { sha_control_input.set_label("#buyer_fullname", "Tên doanh nghiệp (*)"); sha_control_input.set_label("#buyer_identity_card", "Mã số thuế"); sha_control_input.set_label("#buyer_birthday", "Ngày thành lập"); sha_control_input.set_label("#buyer_job", "Ngành nghề kinh doanh"); sha_control_select.clear_select_val('drl_buyer_gender'); $(".personal").addClass("d-none"); } else { sha_control_input.set_label("#buyer_fullname", "Họ và tên (*)"); sha_control_input.set_label("#buyer_identity_card", "Số căn cước công dân"); sha_control_input.set_label("#buyer_birthday", "Ngày sinh (*)"); sha_control_input.set_label("#buyer_job", "Nghề nghiệp"); $(".personal").removeClass("d-none"); } } }, location_load_district: function (_control, _root_id, _district_id) { let dd = {root_id: _root_id}; dd = API.CreateDataSend('base/load/district', dd, { loading: false }); API.POST(dd, function (e) { try { const dd_json = JSON.parse(e); let ll_items = []; for (let i = 0; i < dd_json.length; i++) { let item = dd_json[i]; ll_items.push([item.id, item.name]); } sha_control_select.option_adds(_control, ll_items); sha_control_select.init(_control, 0); if (_district_id != null) sha_control_select.set_val(_control, _district_id); } catch (e) { } Loading.Hide(); }); }, location_load_district: function (_control, _root_id, _district_id) { let dd = {root_id: _root_id}; dd = API.CreateDataSend('base/load/district', dd, { loading: false }); API.POST(dd, function (e) { try { const dd_json = JSON.parse(e); let ll_items = []; for (let i = 0; i < dd_json.length; i++) { let item = dd_json[i]; ll_items.push([item.id, item.name]); } sha_control_select.option_adds(_control, ll_items); sha_control_select.init(_control, 0); if (_district_id != null) sha_control_select.set_val(_control, _district_id); } catch (e) { } Loading.Hide(); }); }, location_load_city: function (_control) { //var dd = {root_id: _root_id}; let dd = API.CreateDataSend('base/load/city/district', null, { loading: false }); API.POST(dd, function (e) { try { const dd_json = JSON.parse(e); let ll_items = []; for (let i = 0; i < dd_json.length; i++) { let item = dd_json[i]; ll_items.push([item.id, item.name]); } sha_control_select.option_adds(_control, ll_items); sha_control_select.init(_control, 0); } catch (e) { } Loading.Hide(); }); }, location_load_district_set_value: function (_control, _root_id, _control_value) { let dd = {root_id: _root_id}; dd = API.CreateDataSend('base/load/district', dd, { loading: false }); API.POST(dd, function (e) { try { const dd_json = JSON.parse(e); let ll_items = []; for (let i = 0; i < dd_json.length; i++) { let item = dd_json[i]; ll_items.push([item.id, item.name]); } sha_control_select.option_adds(_control, ll_items); sha_control_select.init(_control, 0); if (_control_value != null) { sha_control_select.set_val(_control, _control_value, 0) } } catch (e) { } Loading.Hide(); }); }, load_option_map: function (_control, _child_code, _root_id, _product_id, _callback) { let dd = {root_id: _root_id}; dd.child_code = _child_code; dd.product_id = _product_id; dd = API.CreateDataSend('base/load/option/map', dd, { loading: false }); API.POST(dd, function (e) { try { let dd_json = JSON.parse(e); let ll_items = []; for (let i = 0; i < dd_json.length; i++) { let item = dd_json[i]; if (item.code === _child_code) { ll_items.push([item.id, item.name]); } } sha_control_select.option_adds(_control, ll_items); if (_callback != null) { _callback(); } else sha_control_select.init(_control, 0); } catch (e) { } Loading.Hide(); }); }, change_active_date_month: function () { view_web_shared.change_active_date(null, null, null, null, 'month'); }, change_active_date: function (_value, _active_id, _inactive_id, _time_id, _time_kind) { if (_active_id == null) _active_id = "active_date"; if (_inactive_id == null) _inactive_id = "inactive_date"; if (_time_id == null) _time_id = "drl_year_buy"; if (_time_kind == null) _time_kind = "year"; let time_list = $('#' + _time_id + ' .--select-item .active'); let time_config = "1"; if (time_list.length > 0) { let item = time_list[0]; time_config = shared.GetInput.Attributes(item, 'time_config'); } const time_buy = parseInt(time_config); let dd_active = sha_control_datetime.get_value(_active_id); let date = shared.DateTimeFunc.stringToDate(dd_active, "dd/MM/yyyy"); if (_time_kind == "year") date = shared.DateTimeFunc.date_add_year(date, time_buy); else if (_time_kind == "month") date = shared.DateTimeFunc.date_add_month(date, time_buy); const time_value = shared.DateTimeFunc.convertDatetoString(date); sha_control_input.set_val("#" + _inactive_id, time_value) //$("#" + _inactive_id).val(shared.DateTimeFunc.convertDatetoString(date)); //ngay het hieu luc khong cho chon shared.DateTimeFunc.control_input_lock('#' + _inactive_id, true); }, change_discount: function () { if ($('#div_discount_percent').length) { const discount_mode = $("#drl_product_discount").find(':selected').attr('discount_mode'); if (discount_mode == "PERCENT_CONFIG") { const discount_percent = $("#drl_product_discount").find(':selected').attr('discount_percent'); $("#txt_discount_percent").val(discount_percent); $('#txt_discount_percent').prop('readonly', true); } else if (discount_mode == "PERCENT_INPUT") { $("#txt_discount_percent").val(0); $('#txt_discount_percent').prop('readonly', false); } else { $("#txt_discount_percent").val(0); $('#txt_discount_percent').prop('readonly', true); } } }, cer_review: { id: "#b1f8803d8874", open: function (_img) { _img = 'data:application/pdf;base64,' + _img; $('#b630a18a_view').attr('src', _img); $('body').addClass('disabled-overflow'); $(view_web_shared.cer_review.id).addClass('show'); Loading.Hide(); }, close: function (_callback) { $('body').removeClass('disabled-overflow'); $(view_web_shared.cer_review.id).removeClass('show'); if(_callback != null) _callback(); } }, };