1var Title, Id, SubmissionId, Owner, DraftSubmission, CaseID, LicenseID, Group, IsCreateLicense, IsEdit, IsAlreadyDraft, LicenseType, IsAutoCreateCase, IsAlreadyCreated, IsCaseAlreadyCreated, InspectionType, OneTimeToken, InspectionContentItemId, IsAdditionalPaymentForm, SubLicenseRenewalJson; 2var isAccessAdminPanel = false; 3var IsCheckDuplicateAddress = false; 4var isCheckCaseNumberExists = false; 5var isCheckLicenseNumberExists = false; 6var isFacilityRequestForm = false; 7var isSaveAndContinue = false; 8 9function initValue(title, id, submissionId, owner, caseId, licenseId, group, isCreateLicense, currentStatus, licenseType, isAutoCreateCase, isAlreadyCreated, isCaseAlreadyCreated, inspectionType, oneTimeToken, inspectionContentItemId, isAdditionalPaymentForm) { 10 Title = title; 11 Id = id; 12 SubmissionId = submissionId; 13 IsEdit = submissionId !== ""; 14 Owner = owner; 15 CaseID = caseId; 16 Group = group; 17 LicenseID = licenseId; 18 IsCreateLicense = (isCreateLicense === 'True'); 19 LicenseType = licenseType; 20 IsAlreadyCreated = (isAlreadyCreated === 'True'); 21 IsAutoCreateCase = (isAutoCreateCase === 'True'); 22 IsCaseAlreadyCreated = (isCaseAlreadyCreated === 'True'); 23 IsAlreadyDraft = currentStatus === "Draft" ? true : false; 24 if (IsAlreadyDraft) { 25 IsEdit = false; 26 } 27 InspectionType = inspectionType;
28 OneTimeToken = oneTimeToken; 29 InspectionContentItemId = inspectionContentItemId; 30 IsAdditionalPaymentForm = (isAdditionalPaymentForm === 'True'); 31 if (typeof SubLicenseRenewal !== 'undefined') { 32 SubLicenseRenewal.SubmissionId = submissionId; 33 SubLicenseRenewal.LicenseID = licenseId; 34 } 35} 36 37function saveDraft() { 38 saveForm(DraftSubmission.data, true, false, false, false, false, false); 39} 40function saveAddCart(submission) { 41 42 saveForm(submission, false, true, false, false, false, false); 43} 44function saveAdminApproved(submission) { 45 saveForm(submission, false, false, true, false, false, false); 46} 47function saveProcessNoCharge(submission) { 48 saveForm(submission, false, false, false, true, false, false); 49} 50function savePayLater(submission) { 51 saveForm(submission, false, false, false, false, true, false); 52} 53function saveandAnother(submission) { 54 $('#saveandAddAnotherModal').modal('hide'); 55 saveForm(submission, false, false, false, false, false, true); 56} 57function saveForm(submission, isDraft, isCart, isAdminApproved, isProcessNoCharge, isPayLater, isSaveandAnother) { 58 $('.loading').show(); 59 IsCheckDuplicateAddress = ($('#IsCheckDuplicateAddress').val() === 'True'); 60 //Is Check Case Number Already Exist 61 isCheckCaseNumberExists = ($('#IsCheckCaseNumberExists').val() === 'True'); 62 //Is Check License Number Already Exist 63 isCheckLicenseNumberExists = ($('#IsCheckLicenseNumberExists').val() === 'True'); 64 if (IsCheckDuplicateAddress) { 65 ValidateCaseAddressForm(submission, isDraft, isCart, isAdminApproved, isProcessNoCharge, isPayLater, isSaveandAnother, isCheckCaseNumberExists, isCheckLicenseNumberExists); 66 } else { 67 IsAnyAdditionalForm(submission); 68 saveFormDate(submission, isDraft, isCart, isAdminApproved, isProcessNoCharge, isPayLater, isSaveandAnother, isCheckCaseNumberExists, isCheckLicenseNumberExists); 69 } 70} 71function saveFormDate(submission, isDraft, isCart, isAdminApproved, isProcessNoCharge, isPayLater, isSaveandAnother, isCheckCaseNumberExists, isCheckLicenseNumberExists) { 72 $('.formSubmittedLoading').show(); 73 var saveAndContinue = isSaveAndContinue; 74 isSaveAndContinue = false; 75 var isFillLatAndLngByEsri = false; 76 var isFillAddressByEsri = false; 77 var isFillMailingLatAndLngByEsri = false; 78 var isFillMailingAddressByEsri = false; 79 if (EsriFillForm.IsFillEsriByMap) { 80 isFillAddressByEsri = EsriAddressDetailsGeolocation.IsMapAddressGeolocationFillAddressByEsri; 81 isFillLatAndLngByEsri = EsriAddressDetailsGeolocation.IsMapAddressGeolocationFillLatAndLngByEsri; 82 } 83 84 if (EsriFillForm.IsFillEsriBySearch) { 85 isFillAddressByEsri = EsriFillForm.IsFillAddressByEsri; 86 isFillLatAndLngByEsri = EsriFillForm.IsFillLatAndLngByEsri; 87 } 88 89 if (EsriFillForm.IsFillMailingEsriByMap) { 90 isFillMailingAddressByEsri = EsriAddressDetailsGeolocation.IsMapMailingAddressGeolocationFillAddressByEsri; 91 isFillMailingLatAndLngByEsri = EsriAddressDetailsGeolocation.IsMapMailingAddressGeolocationFillLatAndLngByEsri; 92 } 93 94 if (EsriFillForm.IsFillMailingEsriBySearch) { 95 isFillMailingAddressByEsri = EsriFillForm.IsFillMailingAddressByEsri; 96 isFillMailingLatAndLngByEsri = EsriFillForm.IsFillMailingLatAndLngByEsri; 97 } 98 99 if ($('#isEditForm').val() === "Edit") { 100 if ($('#isFillAddressByEsri').val()) { 101 isFillAddressByEsri = $('#isFillAddressByEsri').val(); 102 isFillLatAndLngByEsri = $('#isFillLatAndLngByEsri').val(); 103 } 104 105 if ($('#isFillMailingAddressByEsri').val()) { 106 isFillMailingAddressByEsri = $('#isFillMailingAddressByEsri').val(); 107 isFillMailingLatAndLngByEsri = $('#isFillMailingLatAndLngByEsri').val(); 108 } 109 } 110 111 $.ajax({ 112 url: urlConfig.Entry, 113 async: true, 114 method: 'POST', 115 data: { 116 __RequestVerificationToken: $("input[name='__RequestVerificationToken']").val(), 117 submission: JSON.stringify(submission), 118 Title: Title, 119 id: Id, 120 submissionId: SubmissionId, 121 owner: Owner, 122 isDraft: isDraft, 123 group: Group, 124 licenseId: LicenseID, 125 caseId: CaseID, 126 isCart: isCart, 127 isAdminApproved: isAdminApproved, 128 isProcessNoCharge: isProcessNoCharge,
129 isPayLater: isPayLater, 130 parentSubmissionId: $('#ParentSubmissionId').val(), 131 paymentGUID: $('#PaymentGUID').val(), 132 isCheckCaseNumberExists: isCheckCaseNumberExists, 133 isCheckLicenseNumberExists: isCheckLicenseNumberExists, 134 isEdit: IsEdit, 135 facilityId: $('#FacilityContentItemId').val(), 136 jobPostId: $('#JobPostContentItemId').val(), 137 oneTimeToken: OneTimeToken, 138 inspectionContentItemId: InspectionContentItemId, 139 EsriStreetAddress: $('#EsriStreetAddress').val(), 140 EsriCity: $('#EsriCity').val(), 141 EsriZip: $('#EsriZip').val(), 142 EsriState: $('#EsriState').val(), 143 EsriCountry: $('#EsriCountry').val(), 144 EsriLatitude: $('#EsriLatitude').val(), 145 EsriLongitude: $('#EsriLongitude').val(), 146 IsFillAddressByEsri: isFillAddressByEsri, 147 IsFillLatAndLngByEsri: isFillLatAndLngByEsri, 148 IsAdditionalPaymentForm: IsAdditionalPaymentForm, 149 sessionId: $('#SessionId').val(), 150 registrationId: $("#RegistrationId").val(), 151 MailingEsriStreetAddress: $('#MailingEsriStreetAddress').val(), 152 MailingEsriCity: $('#MailingEsriCity').val(), 153 MailingEsriZip: $('#MailingEsriZip').val(), 154 MailingEsriState: $('#MailingEsriState').val(), 155 MailingEsriCountry: $('#MailingEsriCountry').val(), 156 MailingEsriLatitude: $('#MailingEsriLatitude').val(), 157 MailingEsriLongitude: $('#MailingEsriLongitude').val(), 158 IsFillMailingAddressByEsri: isFillMailingAddressByEsri, 159 IsFillMailingLatAndLngByEsri: isFillMailingLatAndLngByEsri, 160 licenseRenewalSubmission: JSON.stringify(SubLicenseRenewalJson), 161 isLicenseRenewalForm: $("#IsLicenseRenewalForm").val(), 162 RentalScapeViolationId: $('#RentalScapeViolationId').val(), 163 productAccountingDetails: $('#ProductAccountingDetails').val(), 164 }, 165 success: function (data) { 166 if (typeof HideLoader !== "undefined" && HideLoader != null) { 167 HideLoader = false;
168 } 169 if (saveAndContinue && data.editFormUrl && (data.additionalFormUrl == undefined || data.additionalFormUrl == null || data.additionalFormUrl == '')) { 170 window.location.href = urlConfig.Entry.replace("AdvancedForms/Entry", "") + data.editFormUrl; 171 } 172 else if (data.isAlreadyChildSubmission && data.editUrl !== null && data.editUrl !== '' && data.editUrl !== undefined) { 173 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", "") + data.editUrl); 174 } 175 else if (data.additionalFormUrl !== null && data.additionalFormUrl !== '' && data.additionalFormUrl !== undefined) { 176 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", "") + data.additionalFormUrl); 177 } else if (data.progressContentItemIds !== null && data.progressContentItemIds !== '' && data.progressContentItemIds !== undefined) { 178 $('.AdditionalFormLoading, .formSubmittedLoading, .loading').hide(); 179 $('#submissionInProgressModal').modal('show'); 180 } else { 181 var returnUrl = GetReturnUrlParameterFromUrl(); 182 var isadvancedFormPreFill = $('#advancedFormPreFill').is(":checked"); 183 if (CaseID !== undefined && CaseID !== null && CaseID !== '' && !IsEdit && !isDraft) { 184 if (isSaveandAnother !== undefined && isSaveandAnother && $('#advancedFormItems').val() !== undefined && $('#advancedFormItems').val() !== null && $('#advancedFormItems').val() !== '' && $('#advancedFormItems').val() !== '-- Select Advanced Form --' && data.contentItem.AdvancedFormSubmissionsPart != null && !IsEdit) { 185 var item = JSON.parse($('#advancedFormItems').val()); 186 if (isadvancedFormPreFill) { 187 setTimeout(function () { 188 window.location.href = urlConfig.Entry.replace("AdvancedForms/Entry", "") + item.AutoroutePart.Path + '/Case/' + CaseID + "/" + data.contentItem.AdvancedFormSubmissionsPart.ContentItemId + "/" + isadvancedFormPreFill; 189 }, 3000); 190 } else if (item.DisplayText !== null && item.DisplayText !== undefined && item.DisplayText !== '') { 191 window.location.href = urlConfig.Entry.replace("AdvancedForms/Entry", "AdvancedForms/") + item.DisplayText.split(" ").join("-"); 192 } 193 } else if (isCart) { 194 setTimeout(function () { 195 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", 'Cart')); 196 }, 3000); 197 } else if (data.contentItem.AdvancedFormSubmissionsPart != null && !IsEdit && CaseID !== undefined && CaseID !== null && CaseID !== '' && isAccessAdminPanel) { 198 setTimeout(function () { 199 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", "OrchardCore.Case/Admin/Edit?ContentItemId=" + CaseID)); 200 }, 3000); 201 } else { 202 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", "") + `AdvancedForms/submission-confirmation?isDraft=${isDraft}&returnUrl=${returnUrl}`); 203 } 204 } else if (LicenseID !== undefined && LicenseID !== null && LicenseID !== '' && !IsEdit && !isDraft) { 205 if (InspectionContentItemId === undefined || InspectionContentItemId == null || InspectionContentItemId === '') { 206 RedirectToLicense(isCart, data.isNotaryRequired, window.location.href.toLowerCase().search("[?&]hideheaderandfooter=") != -1); 207 } else { 208 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", "") + "OrchardCore.License/Admin/Edit?ContentItemId=" + LicenseID); 209 } 210 } else { 211 var item = ''; 212 if ($('#advancedFormItems').val() !== undefined && $('#advancedFormItems').val() !== null && $('#advancedFormItems').val() !== '' && $('#advancedFormItems').val() !== '-- Select Advanced Form --') { 213 item = JSON.parse($('#advancedFormItems').val()); 214 } 215 if (isSaveandAnother !== undefined && isSaveandAnother && isadvancedFormPreFill && $('#advancedFormItems').val() != null && data.contentItem.AdvancedFormSubmissionsPart != null && data.contentItem.AdvancedFormSubmissionsPart.CaseId !== undefined && data.contentItem.AdvancedFormSubmissionsPart.CaseId !== null && data.contentItem.AdvancedFormSubmissionsPart.CaseId !== '' && !IsEdit) { 216 setTimeout(function () { 217 window.location.href = urlConfig.Entry.replace("AdvancedForms/Entry", "") + item.AutoroutePart.Path + '/Case/' + data.contentItem.AdvancedFormSubmissionsPart.CaseId + "/" + data.contentItem.AdvancedFormSubmissionsPart.ContentItemId + "/" + isadvancedFormPreFill; 218 }, 3000); 219 } 220 else if (isSaveandAnother !== undefined && isSaveandAnother && item !== '' && item != '' && item.DisplayText !== null && item.DisplayText !== undefined && item.DisplayText !== '') { 221 window.location.href = urlConfig.Entry.replace("AdvancedForms/Entry", "AdvancedForms/") + item.DisplayText.split(" ").join("-"); 222 } 223 else if (!isDraft && data.contentItem.AdvancedFormSubmissionsPart != null && data.contentItem.AdvancedFormSubmissionsPart.CaseId !== undefined && data.contentItem.AdvancedFormSubmissionsPart.CaseId !== null && data.contentItem.AdvancedFormSubmissionsPart.CaseId !== '' && isAccessAdminPanel) { 224 setTimeout(function () { 225 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", "OrchardCore.Case/Admin/Edit?ContentItemId=" + data.contentItem.AdvancedFormSubmissionsPart.CaseId)); 226 }, 3000); 227 } 228 else if (isDraft) { 229 $('.loading').hide(); 230 $('.formSubmittedLoading').hide(); 231 $('#SaveAsDraftDetailsModal').modal('show'); 232 } 233 else if (!isDraft && !IsEdit && isCart && isPayNow) { 234 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", "CheckOut")); 235 } 236 else if (!isDraft && !IsEdit && isCart && window.location.href.toLowerCase().search("[?&]hideheaderandfooter=") === -1) { 237 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", 'Cart')); 238 } 239 else if (!isCart && !isDraft && !IsEdit && !isSaveandAnother !== undefined && !isSaveandAnother && data.contentItem.AdvancedFormSubmissionsPart != null && data.contentItem.AdvancedFormSubmissionsPart.LicenseContentItemId !== undefined && data.contentItem.AdvancedFormSubmissionsPart.LicenseContentItemId !== null && data.contentItem.AdvancedFormSubmissionsPart.LicenseContentItemId !== '' && isAccessAdminPanel) { 240 setTimeout(function () { 241 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", "OrchardCore.License/Admin/Edit?ContentItemId=" + data.contentItem.AdvancedFormSubmissionsPart.LicenseContentItemId)); 242 }, 3000); 243 } 244 else if (window.location.search != null && window.location.search != "" && window.location.href.toLowerCase().search("[?&]hideheaderandfooter=") != -1) { 245 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", "") + `AdvancedForms/submission-confirmation?isDraft=${isDraft}&HideHeaderAndFooter=true&returnUrl=${returnUrl}`); 246 } 247 else if (!isDraft && data.isShowAdditionalPaymentFormInfo) { 248 setTimeout(function () { 249 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", 'Cart')); 250 }, 3000); 251 } 252 else { 253 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", "") + `AdvancedForms/submission-confirmation?isDraft=${isDraft}&isShowAdditionalPaymentFormInfo=${data.isShowAdditionalPaymentFormInfo}&IsNotaryRequired=${data.isNotaryRequired}&returnUrl=${returnUrl}`); 254 } 255 } 256 } 257 }, 258 error: function (error) { 259 $('.AdditionalFormLoading, .formSubmittedLoading, .loading').hide(); 260 261 let errorData = error.responseJSON || {}; 262 let serverErrorMsg = errorData.message || error.responseText || "An unknown error occurred.";
263 let stackTrace = errorData.stackTrace || ""; 264 265 // Renewal token guard rejected this submission (already submitted / in progress). 266 // Reload the renewal page WITHOUT the one-time token (it was consumed by the winning 267 // submission, so keeping it would fail the OneTimeTokenAuthorize filter with a 401). 268 // With no token the GET re-renders the full "Your Renewal Is Not Ready" / "In Progress" 269 // screen server-side, matching the load-time display. 270 if (errorData.isRenewalBlocked) { 271 window.location.href = window.location.origin + window.location.pathname; 272 return; 273 } 274 275 let errorMsg = `Unable to Save, please <a href='#' target='_blank'>refresh page</a> then try again later.`; 276 let fullErrorMsg = ` 277 <div class="error-details"> 278 <p><strong>Error:</strong> ${serverErrorMsg}</p> 279 ${stackTrace ? '<p><strong>Stack Trace:</strong></p><pre>' + stackTrace + '</pre>' : ''} 280 </div> 281 `; 282 283 let alertDiv = $('<div class="alert alert-danger" role="alert"></div>').html(errorMsg); 284 285 if (isAccessAdminPanel) { 286 let seeMoreLink = $('<a href="#" class="see-more"> Error Details</a>'); 287 seeMoreLink.on('click', function (e) { 288 e.preventDefault(); 289 errorDialog({ 290 title: "Server Error", 291 modalClass: "modal-lg", 292 message: fullErrorMsg 293 }); 294 }); 295 alertDiv.append(seeMoreLink); 296 } 297 298 $('#advancedForm-errors').append(alertDiv); 299 } 300 }); 301} 302function ValidateCaseAddressForm(submission, isDraft, isCart, isAdminApproved, isProcessNoCharge, isPayLater, isSaveandAnother, isCheckCaseNumberExists, isCheckLicenseNumberExists) { 303 $('.loading').show(); 304 $.ajax({ 305 url: urlConfig.CheckEntry, 306 async: true, 307 method: 'POST', 308 data: { 309 __RequestVerificationToken: $("input[name='__RequestVerificationToken']").val(), 310 submission: JSON.stringify(submission), 311 id: Id, 312 caseId: CaseID, 313 licenseId: LicenseID, 314 }, 315 success: function (data) { 316 if (data != undefined && data != null && data != "") { 317 if (data.isAlreadyCaseExists || data.isAlreadyLicenseExists || data.isAlreadyParcelExists) { 318 var caseorLicense = "case(s)"; 319 if (data.isAlreadyParcelExists) { 320 var caseorLicense = "parcel(s)"; 321 } 322 323 if (data.isAlreadyLicenseExists) { 324 caseorLicense = "license(s)"; 325 } 326 327 var profileLink = $("#host").val() + "/Profile/submissions"; 328 $('.loading').hide(); 329 $(".caseExistsError").hide(); $(".alert-success").hide(); 330 var errorMsg = "Only " + data.maxAllowed + " " + caseorLicense + " allowed for your address or parcel number at a time. If you have questions about the old submission, Visit your <a href='" + profileLink + "'>Profile</a> to add a comment."; 331 window.scrollTo({ top: 0, behavior: 'smooth' }); 332 $('<div class="alert alert-danger caseExistsError" role="alert"></div>').html(errorMsg).appendTo($('#advancedForm-errors')); 333 } 334 else { 335 saveFormDate(submission, isDraft, isCart, isAdminApproved, isProcessNoCharge, isPayLater, isSaveandAnother, isCheckCaseNumberExists, isCheckLicenseNumberExists); 336 } 337 } else { 338 $('.loading').hide(); 339 var errorMsg = "Unable to Save. Try again later."; 340 $('<div class="alert alert-danger" role="alert"></div>').text(errorMsg).appendTo($('#advancedForm-errors')); 341 } 342 }, 343 error: function (error) { 344 $('.loading').hide(); 345 var errorMsg = "Unable to Save. Try again later."; 346 $('<div class="alert alert-danger" role="alert"></div>').text(errorMsg).appendTo($('#advancedForm-errors')); 347 } 348 }); 349} 350function IsAnyAdditionalForm(submission) { 351 if (!($("#NextAdvancedForm").val() !== undefined && $("#NextAdvancedForm").val() !== null && $("#NextAdvancedForm").val() !== '') && submission !== '') { 352 $.ajax({ 353 url: urlConfig.IsAnyAdditionalForm, 354 async: true, 355 method: 'POST', 356 data: { 357 __RequestVerificationToken: $("input[name='__RequestVerificationToken']").val(), 358 advancedFormId: $('#Id').val(), 359 submission: JSON.stringify(submission), 360 }, 361 success: function (data) { 362 if (data) { 363 $('.AdditionalFormLoading').show(); 364 } 365 }, 366 error: function () { 367 $('.AdditionalFormLoading').hide(); 368 }, 369 }); 370 } 371} 372var getDateString = function (value) { 373 date = new Date(value); 374 return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear() + ' ' + date.toLocaleTimeString().replace(/:\d{2}\s/, ' '); 375}; 376function addAFCaseItem(content, isDraft) { 377 $.ajax({ 378 url: urlConfig.AddCaseAttachItem, 379 async: true, 380 method: 'POST', 381 data: { 382 __RequestVerificationToken: $("input[name='__RequestVerificationToken']").val(), 383 caseContentItemId: CaseID, 384 attachContentItemId: content.ContentItemId, 385 itemDisplayText: content.DisplayText 386 }, 387 error: function (error) { 388 $('.loading').hide(); 389 var errorMsg = "Unable to Save. Try again later."; 390 $('<div class="alert alert-danger" role="alert"></div>').text(errorMsg).appendTo($('#advancedForm-errors')); 391 } 392 }); 393} 394function RedirectToLicense(isCart, isNotaryRequired, isHideHeaderAndFooter) { 395 if (isCart) { 396 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", 'Cart')); 397 } 398 else if (isAccessAdminPanel) { 399 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", "") + "OrchardCore.License/Admin/Edit?ContentItemId=" + LicenseID); 400 } 401 else { 402 window.location.replace(urlConfig.Entry.replace("AdvancedForms/Entry", "") + `AdvancedForms/submission-confirmation?IsNotaryRequired=${isNotaryRequired}&HideHeaderAndFooter=${isHideHeaderAndFooter}`); 403 } 404} 405function changeIcon() { 406 $(".collapse.in").each(function () { 407 $(this).siblings(".panel-heading").find(".fa").addClass("fa-minus").removeClass("fa-plus"); 408 $(this).siblings(".panel-heading").find("svg").addClass("fa-minus").removeClass("fa-plus"); 409 }); 410 $(".collapse").on('show.bs.collapse', function () { 411 $(this).parent().find(".panel-heading .fa").removeClass("fa-plus").addClass("fa-minus"); 412 $(this).parent().find(".panel-heading svg").removeClass("fa-plus").addClass("fa-minus"); 413 }).on('hide.bs.collapse', function () { 414 $(this).parent().find(".panel-heading .fa").removeClass("fa-minus").addClass("fa-plus"); 415 $(this).parent().find(".panel-heading svg").removeClass("fa-minus").addClass("fa-plus"); 416 }); 417 418 $('#inputTitle').keypress(function (event) { 419 var keycode = (event.keyCode ? event.keyCode : event.which); 420 if (keycode === 13) { 421 formDisplay.loadFormsItems(); 422 } 423 }); 424 $("#btnSearch").click(function () { 425 formDisplay.loadFormsItems(); 426 }); 427} 428function searchForms() { 429 $(".forms_panel .collapse").collapse('show'); 430 var searchTitle = $("#inputTitle").val().toLowerCase(); 431 $(".headGridView").each(function () { 432 var currentTitle = $(this).text().trim(); 433 $(this).parent().parent().parent().parent().show(); 434 if (currentTitle.toLowerCase().indexOf(searchTitle) === -1) { 435 $(this).parent().parent().parent().parent().hide(); 436 } 437 }); 438 439 $(".headListView").each(function () { 440 var currenttitle = $(this).text().trim(); 441 $(this).parent().parent().parent().show(); 442 if (currenttitle.toLowerCase().indexOf(searchTitle) === -1) { 443 $(this).parent().parent().parent().hide(); 444 } 445 }); 446 var noItem = true; 447 $(".noItemAlert").hide(); 448 $(".forms_panel ").each(function () { 449 var isAllHide = true; 450 $(this).show(); 451 if ($(".selectedView").hasClass("gridView")) { 452 var anchor = $(this).find("a span"); 453 anchor.each(function () { 454 if (!$(this).is(":hidden")) { 455 isAllHide = false;
456 noItem = false; 457 } 458 }); 459 } 460 if ($(".selectedView").hasClass("listView")) { 461 var listAnchor = $(this).find("td span"); 462 listAnchor.each(function () { 463 if (!$(this).is(":hidden")) { 464 isAllHide = false; 465 noItem = false; 466 } 467 }); 468 } 469 if (isAllHide) { 470 $(this).hide(); 471 } 472 }); 473 if (noItem) { 474 $(".noItemAlert").show(); 475 } 476 changeIcon(); 477} 478function collapseShow(id) { 479 $("#" + id).collapse('toggle'); 480} 481function getAdvancedFormsItems(contentType) { 482 $.ajax({ 483 url: urlConfig.GetContentItems, 484 async: true, 485 method: 'GET', 486 data: { 487 ContentType: contentType 488 }, 489 success: function (data) { 490 fillAdvnacedFormsItems(data); 491 }, 492 error: function (error) { 493 var errorMsg = "Unable to Save. Try again later."; 494 $('<div class="alert alert-danger" role="alert"></div>').text(errorMsg + error.responseText).appendTo($('#advancedForm-errors')); 495 } 496 }); 497} 498var fillAdvnacedFormsItems = function (data) { 499 var $dropdown = $("#advancedFormItems"); 500 $dropdown.find('option').remove().end().append($("<option />").text('-- Select Advanced Form --')); 501 var optionText = ''; 502 $.each(data, function () { 503 optionText = this.DisplayText; 504 $dropdown.append($("<option />").val(JSON.stringify(this)).text(optionText)); 505 }); 506}; 507function showIFrame(url, title) { 508 if (url !== null && url !== '' && url !== undefined) { 509 $("#modalIFrame").modal('show'); 510 $('#display_IFrame').attr('src', url); 511 $('#display_IFrame_Title').text(title); 512 } 513} 514$(document).ready(function () { 515 $(".listView").click(function () { 516 formDisplay.formDefaultView = 'list'; 517 formDisplay.loadFormsItems(); 518 changeIcon(); 519 }); 520 $(".gridView").click(function () { 521 formDisplay.formDefaultView = 'grid'; 522 formDisplay.loadFormsItems(); 523 changeIcon(); 524 }); 525 526 $(".ADlistView").click(function () { 527 advancedView.formDefaultView = 'list'; 528 advancedView.loadFormsList(); 529 }); 530 $(".ADgridView").click(function () { 531 advancedView.formDefaultView = 'grid'; 532 advancedView.loadFormsList(); 533 }); 534 535 $('#inputTitleAdvanced').keypress(function (event) { 536 var keycode = (event.keyCode ? event.keyCode : event.which); 537 if (keycode === 13) { 538 advancedView.loadFormsList(); 539 } 540 }); 541 542 $('#inputTitleAdvancedMobile').keypress(function (event) { 543 var keycode = (event.keyCode ? event.keyCode : event.which); 544 if (keycode === 13) { 545 advancedView.loadFormsList(); 546 } 547 }); 548 549 $(".btnSearchAdvanced").click(function () { 550 advancedView.loadFormsList(); 551 }); 552 553 $(".clearFilter").click(function () { 554 $('#inputTitleAdvanced').val(''); 555 $('#inputTitleAdvancedMobile').val(''); 556 $('.form-check-input').prop('checked', false); 557 advancedView.formTags = ''; 558 advancedView.loadFormsList(); 559 $(".selcted-filters-card").html(''); 560 }); 561 562}); 563 564var formDisplay = { 565 formResourceUrl: "", 566 formDefaultView: "", 567 FormItems: "", 568 formType: "", 569 formTags: "", 570 initliaze: function (data) { 571 formDisplay.formDefaultView = formDefaultView; 572 if (data.length > 0) { 573 formDisplay.FormItems = data; 574 formDisplay.loadFormsItems(); 575 } 576 }, 577 loadFormsItems: function () { 578 var formTags = formDisplay.formTags; 579 var formTagsAND = formDisplay.formANDTags; 580 var combinedTags = formTags + formTagsAND; 581 $("#formsDataList").html(""); 582 var dataList = formDisplay.FormItems; 583 var searchTitle = $("#inputTitle").val().toLowerCase(); 584 if (formDisplay.formDefaultView == 'list') { 585 $(".listView").addClass('selectedView'); 586 $(".gridView").removeClass('selectedView'); 587 } else { 588 $(".gridView").addClass('selectedView'); 589 $(".listView").removeClass('selectedView'); 590 } 591 var html = ""; var objTagList = ""; 592 var noItem = true; 593 var advtags = $("#AdvFormTags").val(); 594 if (advtags != null) { 595 objTagList = JSON.parse(advtags); 596 } 597 dataList.forEach(obj => { 598 var objItems = obj.items; 599 var objItems1 = []; 600 var objItems2 = []; 601 objItems = obj.items.filter(function (val, index) { 602 return val.displayText.toLowerCase().includes(searchTitle); 603 }); 604 if ((formTags != null && formTags != "" && formTags != undefined) && (formTagsAND == null || formTagsAND == "" || formTagsAND == undefined)) { 605 objItems = objItems.filter(function (val, index) { 606 if (val.formTags != null && val.formTags != "") { 607 var allfiltertags = combinedTags.split(","); 608 var allitemdata = val.formTags.split(","); 609 if ((allfiltertags.filter(value => allitemdata.includes(value))).length > 0) 610 return val.formTags; 611 } 612 }); 613 } 614 if (formTagsAND != null && formTagsAND != "" && formTagsAND != undefined) { 615 objItems1 = objItems.filter(function (val, index) { 616 if (val.formTags != null && val.formTags != "") { 617 var allfiltertags = formTagsAND.split(","); 618 var allitemdata = val.formTags.split(","); 619 function allTagsPresent() { 620 return allfiltertags.every(tag => allitemdata.includes(tag)); 621 } 622 if (allTagsPresent()) { 623 return val.formTags; 624 } 625 } 626 }); 627 objItems2 = objItems.filter(function (val, index) { 628 if (val.formTags != null && val.formTags != "") { 629 var allfiltertags = formTags.split(","); 630 var allitemdata = val.formTags.split(","); 631 if ((allfiltertags.filter(value => allitemdata.includes(value))).length > 0) 632 return val.formTags; 633 } 634 }); 635 var combinedItems = [...objItems1, ...objItems2]; 636 function removeDuplicates(arr) { 637 return arr.filter((value, index, self) => self.indexOf(value) === index); 638 } 639 objItems = removeDuplicates(combinedItems); 640 } 641 if (objItems.length > 0) { 642 noItem = false;
643 var type = obj.type.split(' ').join('_'); 644 html += '<div class="forms_panel"><div class="panel-heading"><h2 class="fs-4">'; 645 html += '<a data-bs-toggle="collapse" href="#' + type + '" onclick="collapseShow(\'' + type + '\')" style="color: #000; text-decoration: none; display: block;">' + obj.type + ' <i class="fa fa-minus" style="float:right;"></i></a>'; 646 html += '</h2></div>'; 647 if (formDisplay.formDefaultView === 'list') { 648 html += '<div id="' + type + '" class="panel-collapse collapse show" style="padding: 5px 0px;">'; 649 html += '<div class="table-responsive"><table class="table">'; 650 html += '<thead><tr><th class="yellow-head">Title</th><th class="yellow-head">Description</th></tr></thead><tbody>'; 651 objItems.forEach(itemData => { 652 if (formType === "downloadableforms") { 653 var downloadUrl = formResourceUrl + itemData.action; var target = ""; 654 if (itemData.formUrl != "") { 655 downloadUrl = itemData.formUrl; target = "_blank"; 656 } 657 html += '<tr tabindex="0" role="button" aria-label="Download ' + itemData.displayText + '" onkeydown="if(event.key===\'Enter\'||event.key===\' \'){downloadFile(\'' + downloadUrl + '\',\'' + itemData.displayText + '\',\'' + target + '\');event.preventDefault();}" onclick="downloadFile(\'' + downloadUrl + '\',\'' + itemData.displayText + '\',\'' + target + '\')"><td style="width: 30%;">'; 658 659 } else { 660 html += '<tr tabindex="0" role="button" aria-label="Navigate to ' + itemData.displayText + '" onkeydown="if(event.key===\'Enter\'||event.key===\' \'){window.location.href=\'' + itemData.action + '\';event.preventDefault();}" onclick="window.location.href = \'' + itemData.action + '\'"><td style="width: 30%;">'; 661 } 662 html += itemData.displayText; 663 if (itemData.formTags != null && itemData.formTags != "") { 664 html += '<div style="margin-top: 0.3rem;">'; 665 objTagList.filter(function (val, index) { 666 if (val.id != null && val.id != "") { 667 var bgColr = (val.color != null && val.color != '') ? val.color : '#2b2d2f !important'; 668 var textColor = (val.textColor && val.textColor != '') ? val.textColor : '#fff'; 669 var allfiltertags = itemData.formTags.split(","); 670 var allitemdata = val.id.split(","); 671 if ((allfiltertags.filter(value => allitemdata.includes(value))).length > 0) { 672 html += '<span class="formTagsCard" style="background-color:' + bgColr + ';color:' + textColor + '">' + val.displayText + '</span>'; 673 } 674 } 675 }); 676 html += '</div>'; 677 } 678 html += '</td><td>' + itemData.description + '</td></tr>'; 679 }); 680 html += '</tbody></table></div>'; 681 } else { 682 html += '<div id="' + type + '" class="row panel-collapse collapse show" style="padding: 5px 0px;">'; 683 objItems.forEach(itemData => { 684 html += '<div class="col-md-4 p0 item-form">'; 685 if (formType == "downloadableforms") { 686 var downloadUrl = formResourceUrl + itemData.action; var target = ""; 687 if (itemData.formUrl != "") { 688 downloadUrl = itemData.formUrl; target = "_blank"; 689 } 690 html += '<div class="form_content" tabindex="0" role="button" aria-label="Download ' + itemData.displayText + '" onkeydown="if(event.key===\'Enter\'||event.key===\' \'){downloadFile(\'' + downloadUrl + '\',\'' + itemData.displayText + '\',\'' + target + '\');event.preventDefault();}" onclick="downloadFile(\'' + downloadUrl + '\',\'' + itemData.displayText + '\',\'' + target + '\')" style="cursor:pointer;"><div class="yellow-head">'; 691 html += '<a target="_blank" class="heading cardHeadTitle" style="color:#fff;font-size:17px;" tabindex="-1" aria-hidden="true">'; 692 } else { 693 html += '<div class="form_content" tabindex="0" role="button" aria-label="Navigate to ' + itemData.displayText + '" onkeydown="if(event.key===\'Enter\'||event.key===\' \'){window.location.href=\'' + itemData.action + '\';event.preventDefault();}" onclick="window.location.href =\'' + itemData.action + '\'" style="cursor:pointer;"><div class="yellow-head">'; 694 html += '<a target="_blank" class="heading cardHeadTitle" style="color:#fff;font-size:17px;" tabindex="-1" aria-hidden="true">'; 695 } 696 html += '<strong><span>' + itemData.displayText + '</span></strong></a></div>'; 697 698 if (itemData.description.length > 170) { 699 html += '<div class="description">' + itemData.description.substr(0, 170) + '<span class="table-form-link" style="text-decoration: none;">...see more</span>'; 700 } else { 701 html += '<div class="description">' + itemData.description; 702 } 703 if (itemData.formTags != null && itemData.formTags != "") { 704 html += '<div style="margin-top: 0.1rem;">'; 705 objTagList.filter(function (val, index) { 706 if (val.id != null && val.id != "") { 707 var bgColr = (val.color != null && val.color != '') ? val.color : '#2b2d2f !important'; 708 var textColor = (val.textColor && val.textColor != '') ? val.textColor : '#fff'; 709 var allfiltertags = itemData.formTags.split(","); 710 var allitemdata = val.id.split(","); 711 if ((allfiltertags.filter(value => allitemdata.includes(value))).length > 0) { 712 html += '<span class="formTagsCard" style="background-color:' + bgColr + ';color:' + textColor + '">' + val.displayText + '</span>'; 713 } 714 } 715 }); 716 html += '</div>'; 717 } 718 html += '</div>'; 719 html += '<p class="form-link" style="text-decoration: none;">Click to Fill Out Form</p></div></div>'; 720 }); 721 } 722 html += '</div></div>'; 723 } 724 }); 725 if (noItem) { 726 $(".noItemAlert").show(); 727 } else { 728 $(".noItemAlert").hide(); 729 } 730 $("#formsDataList").append(html); 731 changeIcon(); 732 } 733}; 734 735$(document).ready(function () { 736 $(".desktop-filter").on('click', function () { 737 var selectedTagsIds = $.map($('.desktop-filter:checkbox:checked'), function (n, i) { 738 return n.value; 739 }).join(','); 740 advancedView.formTags = selectedTagsIds; 741 advancedView.loadFormsList(); 742 }); 743 744 $(".filterByTag").on('click', function () { 745 var selectedTagsIds = $.map($('.mobileTags:checkbox:checked'), function (n, i) { 746 return n.value; 747 }).join(','); 748 $(".selcted-filters-card").html(''); 749 $('.mobileTags:checkbox:checked').each(function () { 750 var $mainTemplate = $($("#selctedFiltersCard").html()); 751 $mainTemplate.find(".selectedTagText").text($(this).parent().find(".form-check-label").text()); 752 $mainTemplate.find(".removeFilterId").attr("onclick", "removeFilter(\"" + $(this).parent().find(".form-check-input").val() + "\",this)"); 753 $(".selcted-filters-card").append($mainTemplate); 754 }); 755 advancedView.formTags = selectedTagsIds; 756 advancedView.loadFormsList(); 757 }); 758 759 $(".mobileTags").on('click', function () { 760 var selectedTagsIds = $.map($('.mobileTags:checkbox:checked'), function (n, i) { 761 return n.value; 762 }).join(','); 763 764 $("#mobileClearFilter").hide(); 765 if (selectedTagsIds != '') { 766 $("#mobileClearFilter").show(); 767 } 768 }); 769 770}); 771 772function removeFilter(id, data) { 773 $(':checkbox[value="' + id + '"]').prop('checked', false); 774 $(data).parent().remove(); 775 var selectedTagsIds = $.map($('.mobileTags:checkbox:checked'), function (n, i) { 776 return n.value; 777 }).join(','); 778 advancedView.formTags = selectedTagsIds; 779 advancedView.loadFormsList(); 780} 781
782function showDetails(data) { 783 if ($(data).parent().parent().siblings(".tab-content").find(".nav-details").hasClass('show')) { 784 $(data).parent().parent().siblings(".tab-content").find(".nav-details").removeClass('show'); 785 $(data).parent().parent().siblings(".tab-content").find(".nav-details").removeClass('active'); 786 $(data).removeClass("active"); 787 $(data).parent().parent().siblings(".tab-content").find(".nav-details").hide(); 788 } else { 789 $(data).parent().parent().siblings(".tab-content").find(".nav-details").addClass('show'); 790 $(data).parent().parent().siblings(".tab-content").find(".nav-details").addClass('active'); 791 $(data).addClass("active"); 792 $(data).parent().parent().siblings(".tab-content").find(".nav-details").show(); 793 } 794} 795 796function showRequirements(data) { 797 if ($(data).parent().parent().siblings(".tab-content").find(".nav-requirements").hasClass('show')) { 798 $(data).parent().parent().siblings(".tab-content").find(".nav-requirements").removeClass('show'); 799 $(data).parent().parent().siblings(".tab-content").find(".nav-requirements").removeClass('active'); 800 $(data).removeClass("active"); 801 $(data).parent().parent().siblings(".tab-content").find(".nav-requirements").hide(); 802 } else { 803 $(data).parent().parent().siblings(".tab-content").find(".nav-requirements").addClass('show'); 804 $(data).parent().parent().siblings(".tab-content").find(".nav-requirements").addClass('active'); 805 $(data).addClass("active"); 806 $(data).parent().parent().siblings(".tab-content").find(".nav-requirements").show(); 807 } 808} 809 810function GetReturnUrlParameterFromUrl() { 811 let redirectUrl = ''; 812 try { 813 const url = new URL(window.location.href); 814 const params = url.searchParams; 815 816 for (const [key, value] of params.entries()) { 817 if (key.toLowerCase() === "returnurl") { 818 redirectUrl = encodeURIComponent(value); 819 break; 820 } 821 } 822 } catch (error) { 823 console.error("Error while retrieving 'returnUrl' from query string:", error); 824 } 825 return redirectUrl || ''; 826} 827 828var advancedView = { 829 formDefaultView: "", 830 FormItems: "", 831 formTags: "", 832 allFormTags: "", 833 initliaze: function (data, allTagList, paramtag) { 834 advancedView.formDefaultView = formDefaultView; 835 advancedView.allFormTags = allTagList; 836 837 if (paramtag) { 838 var arr = paramtag.split(","); 839 allTagList.filter(function (val, index) { 840 if (arr.filter(value => value.toLowerCase().includes(val.displayText.toLowerCase())).length > 0) { 841 $('input:checkbox[value="' + val.id + '"]').prop('checked', true); 842 } 843 }); 844 var selectedTagsIds = $.map($('.mobileTags:checkbox:checked'), function (n, i) { 845 return n.value; 846 }).join(','); 847 advancedView.formTags = selectedTagsIds; 848 } 849 850 if (data.length > 0) { 851 advancedView.FormItems = data; 852 advancedView.loadFormsList(); 853 } 854 }, 855 loadFormsList: function () { 856 var formTagsAND = advancedView.formTags; 857 $(".clearFilter").hide(); 858 $("#mobileClearFilter").hide(); 859 if (advancedView.formTags != "") { 860 $(".clearFilter").show(); 861 $("#mobileClearFilter").show(); 862 } 863 var formTags = ""; 864 var combinedTags = formTags + formTagsAND; 865 $("#formListAdvancedView").html(""); 866 var dataList = advancedView.FormItems; 867 var searchTitle = ($("#inputTitleAdvanced").val() != '') ? $("#inputTitleAdvanced").val().toLowerCase() : $("#inputTitleAdvancedMobile").val().toLowerCase(); 868 if (advancedView.formDefaultView == 'list') { 869 $(".ADlistView").addClass('selectedView'); 870 $(".ADgridView").removeClass('selectedView'); 871 } else { 872 $(".ADgridView").addClass('selectedView'); 873 $(".ADlistView").removeClass('selectedView'); 874 } 875 var noItem = true; 876 var advtags = $("#AdvFormTags").val(); 877 if (advtags != null) { 878 objTagList = JSON.parse(advtags); 879 } 880 var counter = 0; 881 dataList.forEach(obj => { 882 $(".noItemAlert").hide(); 883 var objItems = obj.items; 884 objItems = obj.items.filter(function (val, index) { 885 return val.displayText.toLowerCase().includes(searchTitle); 886 }); 887 if ((formTags != null && formTags != "" && formTags != undefined) && (formTagsAND == null || formTagsAND == "" || formTagsAND == undefined)) { 888 objItems = objItems.filter(function (val, index) { 889 if (val.formTags != null && val.formTags != "") { 890 var allfiltertags = combinedTags.split(","); 891 var allitemdata = val.formTags.split(","); 892 if ((allfiltertags.filter(value => allitemdata.includes(value))).length > 0) 893 return val.formTags; 894 } 895 }); 896 } 897 if (formTagsAND != null && formTagsAND != "" && formTagsAND != undefined) { 898 objItems1 = objItems.filter(function (val, index) { 899 if (val.formTags != null && val.formTags != "") { 900 var allfiltertags = formTagsAND.split(","); 901 var allitemdata = val.formTags.split(","); 902 function allTagsPresent() { 903 return allfiltertags.every(tag => allitemdata.includes(tag)); 904 } 905 if (allTagsPresent()) { 906 return val.formTags; 907 } 908 } 909 }); 910 objItems2 = objItems.filter(function (val, index) { 911 if (val.formTags != null && val.formTags != "") { 912 var allfiltertags = formTags.split(","); 913 var allitemdata = val.formTags.split(","); 914 if ((allfiltertags.filter(value => allitemdata.includes(value))).length > 0) 915 return val.formTags; 916 } 917 }); 918 var combinedItems = [...objItems1, ...objItems2]; 919 function removeDuplicates(arr) { 920 return arr.filter((value, index, self) => self.indexOf(value) === index); 921 } 922 objItems = removeDuplicates(combinedItems); 923 } 924 if (objItems.length > 0) { 925 noItem = false;
926 var type = obj.type.split(' ').join('_'); 927 var mainDivId = "accordionExample_" + counter; 928 var headingHId = "heading_" + counter; 929 var collapse = "collapse_" + counter; 930 var $mainTemplate = $($("#formTypeTemplate").html()); 931 $mainTemplate.find(".accordion").attr("id", mainDivId); 932 $mainTemplate.find(".accordion-collapse").attr("data-bs-parent", "#" + mainDivId); 933 $mainTemplate.find(".accordion-header").attr("id", headingHId); 934 $mainTemplate.find(".accordion-collapse").attr("aria-labelledby", headingHId); 935 $mainTemplate.find(".accordion-collapse").attr("id", collapse); 936 $mainTemplate.find(".accordion-button").attr("data-bs-target", "#" + collapse); 937 $mainTemplate.find(".accordion-button").attr("aria-controls", collapse); 938 $mainTemplate.find(".accordion-button").text(obj.type); 939 $("#formListAdvancedView").append($mainTemplate); 940 941 var innerCounter = 0; 942 if (advancedView.formDefaultView === 'list') { 943 var $table = $($("#formListTemplate").html()); 944 objItems.forEach(itemData => { 945 var $tr = $($("#trTemplateList").html()); 946 var $titleDiv = itemData.displayText; 947 if (itemData.formTags != null && itemData.formTags != "") { 948 $titleDiv += '<div style="margin-top: 0.3rem;">'; 949 var alladvTags = itemData.formTags.split(","); 950 alladvTags.forEach(formTagId => { 951 var tagData = advancedView.allFormTags.filter(element => element.id == formTagId); 952 if (tagData != null && tagData != "") { 953 var bgColr = (tagData[0].color != null && tagData[0].color != '') ? tagData[0].color : '#2b2d2f !important'; 954 var textColor = (tagData[0].textColor && tagData[0].textColor != '') ? tagData[0].textColor : '#fff'; 955 $titleDiv += '<span class="formTagsCard" data-bs-toggle="tooltip" data-bs-original-title="' + tagData[0].displayText + '" style="color:' + textColor + ';background-color: ' + bgColr + ';">' + tagData[0].displayText + '</span>'; 956 } 957 }); 958 $titleDiv += '<div>'; 959 } 960 $tr.find(".form_title").html($titleDiv); 961 $tr.find(".form_title").attr("onclick", "window.location.href = \'" + itemData.action + "\'"); 962 $tr.find(".form_details").html('<div class="td-details" onclick="window.location.href=\'' + itemData.action + '\'">' + itemData.description + '</div>'); 963 $tr.find(".form_requirements").html('<div class="td-details" onclick="window.location.href=\'' + itemData.action + '\'">' + itemData.requirements + '</div>'); 964 $table.find("tbody").append($tr); 965 }); 966 $mainTemplate.find(".accordion-cards-wrapper").html($table); 967 } else { 968 objItems.forEach(itemData => { 969 var cardId = "accordion-cards-" + counter; 970 var descDivId = "nav-details-" + counter + '-' + innerCounter; 971 var reqDivId = "nav-requirements-" + counter + '-' + innerCounter; 972 var $listTemplate = $($("#formGridTemplate").html()); 973 $listTemplate.find(".accordion-cards").attr("id", cardId); 974 $listTemplate.find(".nav-details").attr("id", descDivId); 975 $listTemplate.find(".nav-requirements").attr("id", reqDivId); 976 $listTemplate.find("#nav-details-tab").attr("data-bs-target", "#" + descDivId); 977 $listTemplate.find("#nav-details-tab").attr("aria-controls", descDivId); 978 $listTemplate.find("#nav-details-tab").attr("onclick", "showDetail
978s(this)"); 979 $listTemplate.find("#nav-requirements-tab").attr("data-bs-target", "#" + reqDivId); 980 $listTemplate.find("#nav-requirements-tab").attr("aria-controls", reqDivId); 981 $listTemplate.find("#nav-requirements-tab").attr("onclick", "showRequirements(this)"); 982 $listTemplate.find(".accordion-cards-heading").text(itemData.displayText); 983 $listTemplate.find(".apply-now-btn").attr("href", itemData.action); 984 $listTemplate.find("#" + descDivId).html('<div class="accordion-description-wrapper">' + itemData.description + '</div><button class="see-more">See More</button>'); 985 986 if (itemData.requirements != null && itemData.requirements.length > 0) { 987 $listTemplate.find("#" + reqDivId).html('<div class="accordion-description-wrapper">' + itemData.requirements + '</div><button class="see-more">See More</button>'); 988 } else { 989 $listTemplate.find("#nav-requirements-tab").attr("data-bs-target", "#" + reqDivId).hide(); 990 $listTemplate.find("#" + reqDivId).hide(); 991 } 992 if (itemData.formTags != null && itemData.formTags != "") { 993 var alladvTags = itemData.formTags.split(","); 994 alladvTags.forEach(formTagId => { 995 var tagData = advancedView.allFormTags.filter(element => element.id == formTagId); 996 if (tagData != null && tagData != "") { 997 var bgColr = (tagData[0].color != null && tagData[0].color != '') ? tagData[0].color : '#2b2d2f !important'; 998 $listTemplate.find(".formTagCircle").append('<span class="badge-circle" data-bs-toggle="tooltip" data-bs-original-title="' + tagData[0].displayText + '" style="background-color : ' + bgColr + ';"></span>'); 999 } 1000 }); 1001 } 1002 $mainTemplate.find(".accordion-cards-wrapper").append($listTemplate); 1003 innerCounter++; 1004 }); 1005 } 1006 $("[data-bs-toggle='tooltip']").tooltip(); 1007 counter++; 1008 } 1009 }); 1010 if (noItem) { 1011 $(".noItemAlert").show(); 1012 } else { 1013 $(".noItemAlert").hide(); 1014 } 1015 changeIcon(); 1016 } 1017};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.