File manager - Edit - /home/autoph/public_html/connectv1/dist/js/customer/ltms_uploaded.js
Back
var force_update = 0; var force_update_reason = ""; function removeextra() { var initVal = $(this).val(); outputVal = initVal.replace(/[^0-9a-zA-Z]/g, ""); if (initVal != outputVal) { $(this).val(outputVal); } } function removeextranumonly() { var initVal = $(this).val(); outputVal = initVal.replace(/[^0-9()-]/g, ""); if (initVal != outputVal) { $(this).val(outputVal); } } function getCustomerAllModalData() { var /* Create an object. */ obj = {}, /* Create a variable that references the current object (default → obj). */ ref = obj; /* Iterate over every input. */ $("#modal-customer :input").each(function () { /* Cache the id of the input. */ var id = this.id; /* Check whether the nodetype attribute is set to 'parent'. */ if (this.getAttribute("nodetype") == "parent") { /* Set a new object to the property and set ref to refer to it. */ ref = obj[id] = {}; } else { /* Set the value of the input to the referred object. */ if (this.getAttribute("json-modal") == "true") { ref[id] = $(this).val(); } } }); /* Stringify the object and return it. */ return JSON.stringify(obj); } function sweetAlertSimple(icon, title, text) { // Swal.fire({ // icon: icon, // title: title, // text: text, // allowEnterKey: true // default value // }) toastr.remove(); switch (icon) { case "success": toastr.success(text); break; case "info": toastr.info(text); break; case "warning": toastr.warning(text); break; case "error": toastr.error(text); break; } } function getAllDataSourceTableData() { var $table = $("#data-source-list-table"); (rows = []), (header = []); $table.find("thead th").each(function () { var new_header = $(this).html().replace(/\s/g, "_").replace(/\./g, ""); header.push(new_header); }); $table.find("tbody tr").each(function () { var row = {}; $(this) .find("td") .each(function (i) { if (header[i] == "Customer_No") { var key = header[i], value = $(this).find("input").val(); row[key] = value; } else { var key = header[i], value = $(this).find("select").val(); row[key] = value; } }); rows.push(row); }); console.log(rows); return rows; } function checkIfDataSourceIncomplete() { rows = getAllDataSourceTableData(); var dataSourceJsonRow = rows; var hasMatch = true; for (var index = 0; index < dataSourceJsonRow.length; ++index) { var dataSourceJson = dataSourceJsonRow[index]; if ( // dataSourceJson.Customer_No == "" || dataSourceJson.DMS == "" || dataSourceJson.Company == "" || dataSourceJson.Dealer == "" ) { hasMatch = false; break; } } // alert(hasMatch) return hasMatch; } function handleError(xhr, status, error) { //hide loader sweetAlertSimple("error", "Oops...", "Error has occurred, Try again..."); $("#proceed-button").attr("disabled", false); $(".customer-modal-overlay").hide(); force_update = 0; force_update_reason = ""; } function refreshModalCities() { $.ajax({ url: "api/city/city.php", type: "GET", dataType: "json", data: { apiKey: "5881641680981247", }, beforeSend: function () { $("#mod-dd-city-1").prop("disabled", true); $("#mod-dd-city-2").prop("disabled", true); }, success: function (result) { $("#mod-dd-city-1").select2({ data: result, placeholder: "Select City", allowClear: true, }); $("#mod-dd-city-2").select2({ data: result, placeholder: "Select City", allowClear: true, }); $("#mod-dd-city-1").prop("disabled", false); $("#mod-dd-city-2").prop("disabled", false); }, }); } function checkIfChildrenIncomplete() { rows = getAllChildrenTableData(); var childrenJsonRow = rows; var hasMatch = []; hasMatch[0] = true; hasMatch[1] = true; for (var index = 0; index < childrenJsonRow.length; ++index) { var childrenJson = childrenJsonRow[index]; if ( childrenJson.Firstname == "" || childrenJson.Lastname == "" || childrenJson.Birthday == "" ) { hasMatch[0] = false; break; } if (!isEmpty(childrenJson.Mobile)) { if (childrenJson.Mobile.length < 10) { hasMatch[1] = false; break; } } } // alert(hasMatch) return hasMatch; } function getAllChildrenTableData() { var $table = $("#children-list-table"); (rows = []), (header = []); $table.find("thead th").each(function () { header.push($(this).html()); }); $table.find("tbody tr").each(function () { var row = {}; $(this) .find("td") .each(function (i) { var key = header[i], value = $(this).find("input").val(); row[key] = value; }); rows.push(row); }); // alert(JSON.stringify(rows)); // return JSON.stringify(rows); return rows; } function isEmail(email) { var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; return regex.test(email); } function isEmpty(string) { var flag = false; try { if (string.trim() == "") { flag = true; } else if (string == null) { flag = true; } else if (typeof string === "undefined") { flag = true; } } catch (err) { // console.log(err); flag = true; } return flag; } function checkIfContactPersonIncomplete() { rows = getAllContactPersonTableData(); var contactPersonJsonRow = rows; var hasMatch = []; hasMatch[0] = true; hasMatch[1] = true; hasMatch[2] = true; for (var index = 0; index < contactPersonJsonRow.length; ++index) { var contactPersonJson = contactPersonJsonRow[index]; if ( contactPersonJson.Fullname == "" /* || contactPersonJson.Lastname == "" || contactPersonJson.Mobile == ""*/ ) { hasMatch[0] = false; break; } if (contactPersonJson.Email != "") { if (!isEmail(contactPersonJson.Email)) { hasMatch[1] = false; break; } } if (!isEmpty(contactPersonJson.Mobile)) { if (contactPersonJson.Mobile.length < 10) { hasMatch[2] = false; break; } } } // alert(hasMatch) return hasMatch; } function getAllContactPersonTableData() { var $table = $("#contact-person-list-table"); (rows = []), (header = []); $table.find("thead th").each(function () { header.push($(this).html()); }); $table.find("tbody tr").each(function () { var row = {}; $(this) .find("td") .each(function (i) { var key = header[i], value = $(this).find("input").val(); row[key] = value; }); rows.push(row); }); // alert(JSON.stringify(rows)); // return JSON.stringify(rows); return rows; } function addCustomerChildren() { var children_list = document.getElementById("children-list"); const children_list_base = document.querySelector( "#children-list-clone tbody tr" ); children_list.appendChild(children_list_base.cloneNode(true)); // Generate a unique ID for the select> in the new row. var ChildrenIdDateNow = uniqId(); var newChildrenFirstnameId = "children-firstname-" + ChildrenIdDateNow; var newChildrenLastnameId = "children-lastname-" + ChildrenIdDateNow; var newChildrenBirthdayDivId = "div-children-birthday-" + ChildrenIdDateNow; var newChildrenBirthdayAppendId = "append-children-birthday-" + ChildrenIdDateNow; var newChildrenBirthdayId = "children-birthday-" + ChildrenIdDateNow; var newChildrenBirthdayDivId = "children-birthday-div-" + ChildrenIdDateNow; var newChildrenBirthdayAppendId = "children-birthday-append-" + ChildrenIdDateNow; var newChildrenMobileId = "children-mobile-append-" + ChildrenIdDateNow; var item = []; item[0] = newChildrenFirstnameId; item[1] = newChildrenLastnameId; item[2] = newChildrenBirthdayId; item[3] = newChildrenMobileId; $("#mod-children-firstname").attr("id", newChildrenFirstnameId); $("#mod-children-lastname").attr("id", newChildrenLastnameId); $("#mod-children-mobile").attr("id", newChildrenMobileId); $("#mod-children-birthdate") .attr("id", newChildrenBirthdayId) .data("target", "#" + newChildrenBirthdayDivId) .inputmask(); $("#mod-children-birthdate-append") .attr("id", newChildrenBirthdayAppendId) .data("target", "#" + newChildrenBirthdayDivId); $("#mod-children-birthdate-div") .attr("id", newChildrenBirthdayDivId) .datetimepicker({ format: "L", }); return item; } function addCustomerContactPerson() { var contact_person_list = document.getElementById("contact-person-list"); const contact_person_list_base = document.querySelector( "#contact-person-list-clone tbody tr" ); contact_person_list.appendChild(contact_person_list_base.cloneNode(true)); // Generate a unique ID for the select> in the new row. var contactPersonIdDateNow = uniqId(); var newContactPersonFullnameId = "contact-person-fullname-" + contactPersonIdDateNow; var newContactPersonFirstnameId = "contact-person-firstname-" + contactPersonIdDateNow; var newContactPersonLastnameId = "contact-person-lastname-" + contactPersonIdDateNow; var newContactPersonEmailId = "contact-person-email-" + contactPersonIdDateNow; var newContactPersonMobileId = "contact-person-mobile-" + contactPersonIdDateNow; var item = []; item[0] = newContactPersonFullnameId; item[1] = newContactPersonEmailId; item[2] = newContactPersonMobileId; $("#modal-contact-person-fullname").attr("id", newContactPersonFullnameId); $("#modal-contact-person-email").attr("id", newContactPersonEmailId); $("#modal-contact-person-mobile").attr("id", newContactPersonMobileId); return item; } function addRowInterest() { $("#addRow").click(function () { if ( !checkIfInterestIncomplete() && $("#interest-list-table tbody tr").length > 0 ) { sweetAlertSimple( "error", "Oops...", "Complete the interest/hobbies details first" ); } else { addInterestItem(); } }); $("#interest-list").on("click", ".btnRemove", function () { $(this).closest("tr").remove(); }); } function getAllInterestTableData() { var $table = $("#interest-list-table"); (rows = []), (header = []); $table.find("thead th").each(function () { header.push($(this).html()); }); $table.find("tbody tr").each(function () { var row = {}; $(this) .find("td") .each(function (i) { var key = header[i], value = $(this).find("select").val(); row[key] = value; }); rows.push(row); }); // alert(JSON.stringify(rows)); // return JSON.stringify(rows); return rows; } function checkIfInterestIncomplete() { rows = getAllInterestTableData(); var interestJsonRow = rows; var hasMatch = true; for (var index = 0; index < interestJsonRow.length; ++index) { var interestJson = interestJsonRow[index]; if (interestJson.Category == "" || interestJson.Interest == "") { hasMatch = false; break; } } // alert(hasMatch) return hasMatch; } function addRowAffiliations() { $("#addRowAffiliations").click(function () { if ( !checkIfAffiliationsIncomplete() && $("#affiliations-list-table tbody tr").length > 0 ) { sweetAlertSimple( "error", "Oops...", "Complete the affiliation details first" ); } else { addAffiliationsItem(); } }); $("#affiliations-list").on("click", ".btnRemoveAffiliations", function () { $(this).closest("tr").remove(); }); } function getAllAffiliationsTableData() { var $table = $("#affiliations-list-table"); (rows = []), (header = []); $table.find("thead th").each(function () { header.push($(this).html().replace(/\s/g, "_").replace(/\./g, "")); }); $table.find("tbody tr").each(function () { var row = {}; $(this) .find("td") .each(function (i) { var key = header[i], value = $(this).find("select").val(); row[key] = value; }); rows.push(row); }); // alert(JSON.stringify(rows)); // return JSON.stringify(rows); return rows; } function checkIfAffiliationsIncomplete() { rows = getAllAffiliationsTableData(); var jsonRow = rows; var hasMatch = true; for (var index = 0; index < jsonRow.length; ++index) { var json = jsonRow[index]; if (json.Category == "" || json.Affiliations == "") { hasMatch = false; break; } } // alert(hasMatch) return hasMatch; } function refreshModalReligion() { $.ajax({ url: "api/religion/religion.php", method: "POST", data: { apiKey: "2011315786548487", }, cache: false, beforeSend: function () {}, success: function (result) { var obj = jQuery.parseJSON(result); $("#mod-dd-religion").select2({ tags: true, placeholder: "Select Religion", allowClear: true, data: obj, }); }, }); } function resetCustomerModal() { $("#mod-dd-nationality").val("608").trigger("change"); $("#interest-list-table > tbody").empty(); $("#affiliations-list-table > tbody").empty(); $("#contact-person-list-table > tbody").empty(); $("#children-list-table > tbody").empty(); $("#data-source-list-table > tbody").empty(); $("#educational-bg-list-table > tbody").empty(); $("#car-clubs-list-table > tbody").empty(); $("#unit-association-list-table > tbody").empty(); $("#political-clubs-list-table > tbody").empty(); $("#network-marketing-list-table > tbody").empty(); $("#media-publications-list-table > tbody").empty(); $("#sme-groups-list-table > tbody").empty(); $("#fraternities-sororities-list-table > tbody").empty(); $("#facebook-groups-list-table > tbody").empty(); $("#celebrity-influencers-list-table > tbody").empty(); addCustomerModalTabSelectedTab(1); } function checkFieldsModal(isIndividual) { if (isIndividual) { $(".children-stepper").show(); $(".interest-stepper").show(); $(".interest-list").show(); $("#div-mod-firstname").show(); $("#div-mod-middlename").show(); $("#div-mod-lastname").show(); $("#div-mod-suffix").show(); $("#div-corporation-name").hide(); $("#mod-birthdate-label").text("Date of birth"); $("#div-mod-gender").show(); $("#div-mod-nationality").show(); $("#div-mod-occupation").show(); $("#div-mod-marital-status").show(); // $('#mod-contact-corporation-div').hide(); // $('#mod-contact-div').show(); $("#div-mod-spouse").show(); $("#div-mod-no-of-children").show(); $("#div-mod-business-company").show(); $("#div-mod-position").show(); $("#div-mod-religion").show(); $("#div-mod-profession").show(); $("#div-corporation-name").hide(); $("#div-mod-age-of-company").hide(); $("#educational_bg_div").show(); } else { $(".children-stepper").hide(); $(".interest-stepper").hide(); $(".interest-list").hide(); $("#div-mod-firstname").hide(); $("#div-mod-middlename").hide(); $("#div-mod-lastname").hide(); $("#div-mod-suffix").hide(); $("#div-corporation-name").show(); $("#mod-birthdate-label").text("Date Established"); $("#div-mod-gender").hide(); $("#div-mod-nationality").hide(); $("#div-mod-occupation").hide(); $("#div-mod-marital-status").hide(); // $('#mod-contact-corporation-div').show(); // $('#mod-contact-div').hide(); $("#div-mod-spouse").hide(); $("#div-mod-no-of-children").hide(); $("#div-mod-business-company").hide(); $("#div-mod-position").hide(); $("#div-mod-religion").hide(); $("#div-mod-profession").hide(); $("#div-mod-date-established").show(); $("#div-mod-age-of-company").show(); $("#educational_bg_div").hide(); } } function addCustomerModalTabSelectedTab(type) { $("#customer-modal-tab .nav-link").removeClass("active"); $("#customer-modal-tab-content .tab-pane").removeClass("show"); $("#customer-modal-tab-content .tab-pane").removeClass("active"); switch (type) { case 1: $("#customer-modal-tab-information").addClass("active"); $("#customer-modal-information").addClass("active"); $("#customer-modal-information").addClass("show"); break; case 2: $("#customer-modal-tab-contact").addClass("active"); $("#customer-modal-contact").addClass("active"); $("#customer-modal-contact").addClass("show"); break; case 3: $("#customer-modal-tab-children").addClass("active"); $("#customer-modal-children").addClass("active"); $("#customer-modal-children").addClass("show"); break; case 4: $("#customer-modal-tab-affiliations").addClass("active"); $("#customer-modal-affiliations").addClass("active"); $("#customer-modal-affiliations").addClass("show"); break; case 5: $("#customer-modal-tab-interest").addClass("active"); $("#customer-modal-interest").addClass("active"); $("#customer-modal-interest").addClass("show"); break; } } function uniqId() { return Math.round(new Date().getTime() + Math.random() * 100); } function checkIfEmpty(value, row, index) { if (value == "" || value == "-" || value == null) { return "<span style='color:red;'> (Not Provided) </span>"; } return value; } function getCookie(name) { var match = document.cookie.match(RegExp("(?:^|;\\s*)" + name + "=([^;]*)")); return match ? match[1] : null; } function imageFormatter(value, row, index) { return ( '<img width="50px" height="50px" class="user-image img-circle elevation-2" src="dist/img/thumbnail/' + value + '" />' ); } // function initToolTip() { // var bootstrapTooltip = $.fn.tooltip.noConflict(); // $.fn.bstooltip = bootstrapTooltip; // $(".tooltip-me").bstooltip(); // } function tableMobileFormatter(value, row, index) { if ((value != null && value.trim() == "") || value == "-") { return "<span style='color:red;'> (Not Provided) </span>"; } if (value == "-1") { return ""; } return "<a href='tel:" + value + "'>" + value + "</a>"; } function tableNameFormatter(value, row, index) { if ((value != null && value.trim() == "") || value == "-") { return "<span style='color:red;'> (Not Provided) </span>"; } if (value == "-1") { return ""; } //ACTIVE LINK TRIGGER EDIT return "<a href='customer_update_view.php?q=" + row.id + "'>" + value + "</a>"; } function tableEmailFormatter(value, row, index) { if ((value != null && value.trim() == "") || value == "-") { return "<span style='color:red;'> (Not Provided) </span>"; } if (value == "-1") { return ""; } return "<a href='mailto:" + value + "'>" + value + "</a>"; } function addDataSourceItem() { var data_source = document.getElementById("data-source-list"); // console.log('asdfasd'); console.log(data_source); const data_source_base = document.querySelector( "#data-source-list-clone tbody tr" ); data_source.appendChild(data_source_base.cloneNode(true)); console.log(data_source) // Generate a unique ID for the select> in the new row. var dataSourceIdDateNow = uniqId(); var newDataSourceCustomerNoId = "data-source-customer-no-" + dataSourceIdDateNow; var newDataSourceDmsId = "data-source-dms-" + dataSourceIdDateNow; var newDataSourceCompanyId = "data-source-company-" + dataSourceIdDateNow; var newDataSourceDealerId = "data-source-dealer-" + dataSourceIdDateNow; var dataSourceItem = []; dataSourceItem[0] = newDataSourceCustomerNoId; dataSourceItem[1] = newDataSourceDmsId; dataSourceItem[2] = newDataSourceCompanyId; dataSourceItem[3] = newDataSourceDealerId; $("#input-modal-customer-no").attr("id", newDataSourceCustomerNoId); $("#" + newDataSourceCustomerNoId) .on("keyup", removeextra) .blur(removeextra); $("#" + newDataSourceCustomerNoId).on("keypress", function (e) { var regex = new RegExp("^[0-9a-zA-Z]+$"); var str = String.fromCharCode(!e.charCode ? e.which : e.charCode); if (regex.test(str)) { return true; } e.preventDefault(); return false; }); $("#select-modal-dms").attr("id", newDataSourceDmsId).select2({ placeholder: "Select DMS", allowClear: true, }); $("#select-modal-company") .attr("id", newDataSourceCompanyId) .select2({ placeholder: "Select Company", allowClear: true, language: { noResults: function () { return "Select DMS first"; }, }, escapeMarkup: function (markup) { return markup; }, ajax: { url: "api/company/company.php", dataType: "json", delay: 1, data: function (data) { return { search: data.term, // search term dms_id: $("#" + newDataSourceDmsId).val(), apiKey: "3568127986733141", }; }, processResults: function (response) { return { results: response, }; }, cache: true, }, }); $("#mod-preferred-moc").select2({ placeholder: "Select mode of contact", allowClear: true, tags: false, minimumResultsForSearch: -1, language: { noResults: function () { return "Select mode of contact"; }, }, escapeMarkup: function (markup) { return markup; }, ajax: { url: "api/mode_of_contact/mode_of_contact.php", dataType: "json", delay: 250, data: function (data) { return { search: data.term, // search term apiKey: "1557741601453763", }; }, processResults: function (response) { return { results: response, }; }, cache: true, }, }); $("#mod-business-company").select2({ placeholder: "Search Company by name, email and mobile", allowClear: true, language: { noResults: function () { return "Search Company by name, email and mobile"; }, }, escapeMarkup: function (markup) { return markup; }, ajax: { url: "api/customer_update/customerv2_update.php", dataType: "json", delay: 250, data: function (data) { return { search: data.term, // search term apiKey: "3975247589935894", }; }, processResults: function (response) { return { results: response, }; }, cache: true, }, }); $("#select-modal-dealer") .attr("id", newDataSourceDealerId) .select2({ placeholder: "Select Dealer", allowClear: true, language: { noResults: function () { return "Search or enter dealer name"; }, }, escapeMarkup: function (markup) { return markup; }, ajax: { url: "api/dealer/dealer.php", dataType: "json", delay: 250, data: function (data) { return { apiKey: "6209267133015033", company_id: $("#" + newDataSourceCompanyId).val(), search: data.term, // search term }; }, processResults: function (response) { return { results: response, }; }, cache: true, }, }); $("#" + newDataSourceDmsId).on("change", function (event) { $("#" + newDataSourceCompanyId) .val("") .trigger("change"); }); $("#" + newDataSourceCompanyId).on("change", function (event) { $("#" + newDataSourceDealerId) .val("") .trigger("change"); }); return dataSourceItem; } function addInterestItem() { // CREATE ROW var interest_list = document.getElementById("interest-list"); const interest_list_base = document.querySelector( "#interest-list-clone tbody tr" ); var interestItem = []; interest_list.appendChild(interest_list_base.cloneNode(true)); // Generate a unique ID for the select> in the new row. var InterestIdDateNow = uniqId(); var newInterestCategoryId = "interest-category-" + InterestIdDateNow; var newInterestContentId = "interest-content-" + InterestIdDateNow; interestItem[0] = newInterestCategoryId; interestItem[1] = newInterestContentId; // alert(interestItem.pop(0)); // alert(interestItem.pop(1)); // Update the ID of the select> in the new row // (it should be the only one with an `id` of '#element'), // and initialize the Select2. $("#select-category").attr("id", newInterestCategoryId).select2({ placeholder: "Select Category", allowClear: true, }); $("#select-content") .attr("id", newInterestContentId) .select2({ tags: true, placeholder: "Select", allowClear: true, language: { noResults: function () { return "Search or enter interest"; }, }, escapeMarkup: function (markup) { return markup; }, placeholder: "Search or enter interest", ajax: { url: "api/interest_hobbies/interest_hobbies.php", dataType: "json", delay: 250, data: function (data) { return { apiKey: "5068581874181452", interestCategory: $("#" + newInterestCategoryId).val(), search: data.term, // search term }; }, processResults: function (response) { return { results: response, }; }, cache: true, }, }); $("#" + newInterestCategoryId).on("select2:select", function (e) { $("#" + newInterestContentId) .val("") .trigger("change"); }); $("#" + newInterestCategoryId).on("select2:unselecting", function (e) { $("#" + newInterestContentId) .val("") .trigger("change"); }); return interestItem; // CREATE ROW } function addAffiliationsItem() { // CREATE ROW var affiliations_list = document.getElementById("affiliations-list"); const affiliations_list_base = document.querySelector( "#affiliations-list-clone tbody tr" ); var affiliationsItem = []; affiliations_list.appendChild(affiliations_list_base.cloneNode(true)); // Generate a unique ID for the select> in the new row. var affiliationsIdDateNow = uniqId(); var newaffiliationsCategoryId = "affiliations-category-" + affiliationsIdDateNow; var newaffiliationsContentId = "affiliations-content-" + affiliationsIdDateNow; affiliationsItem[0] = newaffiliationsCategoryId; affiliationsItem[1] = newaffiliationsContentId; // alert(affiliationsItem.pop(0)); // alert(affiliationsItem.pop(1)); // Update the ID of the select> in the new row // (it should be the only one with an `id` of '#element'), // and initialize the Select2. $("#select-category-affiliations") .attr("id", newaffiliationsCategoryId) .select2({ placeholder: "Select Category", allowClear: true, }); $("#select-content-affiliations") .attr("id", newaffiliationsContentId) .select2({ tags: true, placeholder: "Search or enter affiliations", allowClear: true, language: { noResults: function () { return "Search or enter affiliations"; }, }, escapeMarkup: function (markup) { return markup; }, placeholder: "Search or enter affiliations", ajax: { url: "api/affiliations/affiliations.php", dataType: "json", delay: 250, data: function (data) { return { apiKey: "8048636851659915", affiliationsCategory: $("#" + newaffiliationsCategoryId).val(), search: data.term, // search term }; }, processResults: function (response) { return { results: response, }; }, cache: true, }, }); // $('#' + newaffiliationsCategoryId).on('select2:select', function(e) { // $('#' + newaffiliationsContentId).val('').trigger('change') // }); // $('#' + newaffiliationsCategoryId).on("select2:unselecting", function(e) { // $('#' + newaffiliationsContentId).val('').trigger('change') // }); return affiliationsItem; // CREATE ROW } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $(document).ready(function () { $("#addRowDataSource").click(function () { if ( !checkIfDataSourceIncomplete() && $("#data-source-list-table tbody tr").length > 0 ) { sweetAlertSimple( "error", "Oops...", "Complete the data source details first" ); } else { addDataSourceItem(); } }); $("#data-source-list").on("click", ".btnRemoveDataSource", function () { if ($("#data-source-list-table tbody tr").length < 2) { sweetAlertSimple("error", "Oops...", "Need at least 1 data source"); } else { $(this).closest("tr").remove(); } }); $("#addRowChildren").click(function () { var validate_data_children_list = checkIfChildrenIncomplete(); if ( !validate_data_children_list[0] && $("#children-list-table tbody tr").length > 0 ) { sweetAlertSimple("error", "Oops...", "Complete the child details first"); } else if (!validate_data_children_list[1]) { sweetAlertSimple("error", "Oops...", "Children data invalid mobile"); } else { addCustomerChildren(); } }); $("#children-list").on("click", ".btnRemoveChildren", function () { $(this).closest("tr").remove(); }); $("#addRowContactPerson").click(function () { var validate_data_contact_person = checkIfContactPersonIncomplete(); if ( !validate_data_contact_person[0] && $("#contact-person-list-table tbody tr").length > 0 ) { sweetAlertSimple( "error", "Oops...", "Complete the data of contact person first" ); } else if (!validate_data_contact_person[1]) { sweetAlertSimple("error", "Oops...", "Contact person invalid email"); } else if (!validate_data_contact_person[2]) { sweetAlertSimple("error", "Oops...", "Contact person invalid mobile"); } else { addCustomerContactPerson(); } }); $("#contact-person-list").on("click", ".btnRemoveContactPerson", function () { $(this).closest("tr").remove(); }); //Date picker $("#mod-birth-date").datetimepicker({ format: "L", }); $("#mod-established-date").datetimepicker({ format: "L", }); $("[data-mask]").inputmask(); $("#modal-customer").on("hidden.bs.modal", function (e) { $(this) .find("input,textarea") .val("") .end() .find("select") .prop("selectedIndex", 0) .find("input[type=checkbox], input[type=radio]") .prop("checked", "") .end(); $(".modal-select2").val("").trigger("change"); }); $("#modal-customer").on("shown.bs.modal", function () { $("input:text:visible:first").focus(); }); $(document).on("wheel", "input[type=number]", function (e) { $(this).blur(); }); $("#mod-nature-of-business").select2({ // tags: true, placeholder: "Select Nature of Business", allowClear: true, escapeMarkup: function (markup) { return markup; }, ajax: { url: "api/nature_of_business/nature_of_business.php", dataType: "json", delay: 250, data: function (data) { return { apiKey: "6902545878701742", search: data.term, // search term }; }, processResults: function (response) { return { results: response, }; }, cache: true, }, }); $("#mod-dd-profession").select2({ tags: true, placeholder: "Select Profession", allowClear: true, escapeMarkup: function (markup) { return markup; }, ajax: { url: "api/profession/profession.php", dataType: "json", delay: 250, data: function (data) { return { apiKey: "8920139547181378", search: data.term, // search term }; }, processResults: function (response) { return { results: response, }; }, cache: true, }, }); $("#mod-dd-inquiry").select2({ placeholder: "Select Source of Inquiry", allowClear: true, }); $("#mod-dd-gender").select2({ placeholder: "Select Gender", allowClear: true, minimumResultsForSearch: -1, }); $("#mod-dd-marital-status").select2({ placeholder: "Select Marital Status", allowClear: true, minimumResultsForSearch: -1, }); $("#mod-dd-nationality").select2({ placeholder: "Select Nationality", allowClear: true, }); addRowInterest(); addRowAffiliations(); refreshModalReligion(); refreshModalCities(); // initToolTip(); $('[data-toggle="tooltip"]').tooltip(); });
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings