var isPaymentDisabled = $('#hfDisablePayment').val(); /*----------------------------- Payment Parameters --------------------------------------------------------*/ /*This function is to set the payerType for the case: * Payment is through IAM so, any single payment on (unfiltered violations page) the payerType is undefined */ function checkPayerType(violatorId, payerId) { var payerTypePayment = ''; if (violatorId == payerId) payerTypePayment = 3; else if (violatorId.startsWith(2)) payerTypePayment = 1; else if (violatorId.startsWith(7)) payerTypePayment = 2; return payerTypePayment; } /*----------------------------------------------------------------------------------------------------------*/ function GetFineDetails(fineNumber, ViolatorID, PayerID, PayerType, LoginType, DrowToClass, ShowCheckbox = true, ShowbackBtn = false, FromHome = false) { $('body').attr('fineNumber', fineNumber).attr('ViolatorID', ViolatorID).attr('PayerID', PayerID).attr('PayerType', PayerType).attr('LoginType', LoginType).attr('DrowToClass', DrowToClass).attr('ShowCheckbox', ShowCheckbox).attr('ShowbackBtn', ShowbackBtn).attr('FromHome', FromHome) if (ShowbackBtn == true) { $('.ViolationsList').fadeOut("fast") $('.ViolationDetails').fadeIn() } function hasNumber(myString) { return /\d/.test(myString); } if (ShowbackBtn == false) { $('.CustomModalBodyCard').html('') } else { $('.' + DrowToClass + '').html('') } if ($('.LoadedAfterPopupOpen').length == 0) { LoadDetailsScript() } else { onloadCallbackIndividualDetails() } function LoadDetailsScript() { $('body').append('') DictionaryUtils.LoadExtraScripts() } } var onloadCallbackIndividualDetails = function () { fineNumber = $('body').attr('fineNumber') ViolatorID = $('body').attr('ViolatorID') PayerID = $('body').attr('PayerID') PayerType = $('body').attr('PayerType') LoginType = $('body').attr('LoginType') DrowToClass = $('body').attr('DrowToClass') ShowCheckbox = JSON.parse($('body').attr('ShowCheckbox')) ShowbackBtn = JSON.parse($('body').attr('ShowbackBtn')) FromHome = JSON.parse($('body').attr('FromHome')) if (FromHome == false) { LoginType = 1; PayerType = checkPayerType(ViolatorID, PayerID); } var fineAmount; grecaptcha.ready(function () { grecaptcha.execute($('#hdnReCaptchaKey').val(), { action: 'submit' }).then(function (token) { var HeaderTitle = $('.CustomModalTitle span').html() if (fineNumber.length < 14) { NetworkUtils.TrafficFines.extGetTrafficViolationInfo(fineNumber, ViolatorID, token, FromHome) .done(function (data) { if (FromHome) data = data.violationlInfo fineAmount = data.totalFineItemsAmount; $('.CustomModalBodyCard .LoadingBeforeSendSpan').remove() if (ShowbackBtn == true) { $('.ViolationDetails').append('
') } else { $('.CustomModalBodyCard').append('
') } $('.popupDetails > .row').append('
') $('.popupDetails > .row').append('
') $('.popupDetails > .row').append('
') $('.PopupTrafficHeader').append('
') $('.PopupTrafficHeaderDetails .row').append('
' + data.violatorID + '
') $('.PopupTrafficHeaderDetails .row').append('
' + data.violationNumber + '
') $('.PopupTrafficHeaderDetails .row').append('
' + data.structureName + '
') $('.PopupTrafficHeaderDetails .row').append('
' + data.fineGroupDescription + '
') $('.PopupTrafficHeaderDetails .row').append('
' + DictionaryUtils.GetDateByLanguage(data.violationDateG.toString().substr(6, 2), data.violationDateG.toString().substr(4, 2), data.violationDateG.toString().substr(0, 4)) + '
') $('.PopupTrafficHeaderDetails .row').append('
' + DictionaryUtils.GETTIME(data.violationTime.toString()).substr(0, 2) + ":" + DictionaryUtils.GETTIME(data.violationTime.toString()).substr(2, 2) + '
') $('.PopupTrafficHeaderDetails .row').append('
' + data.violationCity + '
') ////// Map $('.PopupTrafficHeaderMap').append('
') if (data.giS_LATITUDE !== undefined && data.giS_LONGITUDE !== undefined) { if (data.giS_LATITUDE != '' && data.giS_LONGITUDE != '' && data.giS_LATITUDE != '0.0' && data.giS_LONGITUDE != '0.0' && data.giS_LATITUDE != null && data.giS_LONGITUDE != null) { //$('.map-responsive').html('') var _location = " " + DictionaryUtils.getMessage("fine_location") + "

"; $('.map-responsive').html(_location) //if ($.isNumeric(data.giS_LATITUDE) == false) { // var MapCord = ReturnCord(data.giS_LATITUDE, data.giS_LONGITUDE) //} //else { // var MapCord = [data.giS_LATITUDE, data.giS_LONGITUDE] //} //function initMap() { // const location = { lat: parseFloat(MapCord[0]), lng: parseFloat(MapCord[1]) }; // const map = new google.maps.Map(document.getElementById("map"), { // zoom: 14, // center: location, // }); // const marker = new google.maps.Marker({ // position: location, // map: map, // }); //} //initMap() } else { $('.map-responsive').html('
' + DictionaryUtils.getMessage('fine_location') + ' ' + DictionaryUtils.getMessage('not_specified') + '
') } } ///// End Map var platenumber = "", platenumbers = DictionaryUtils.GetPlateNumber(data.vehiclePlate).split(' '); if (DictionaryUtils.getLanguage() == 'ar') { for (var count = platenumbers.length; count > 0; count--) platenumber += (platenumbers[count - 1] == "" ? "" : "" + platenumbers[count - 1] + " "); } else { for (var count = 0; count < platenumbers.length; count++) platenumber += (platenumbers[count] == "" ? "" : "" + platenumbers[count] + " "); } if (platenumbers == "") { platenumber += DictionaryUtils.getMessage("not_specified"); } $('.PopupTrafficHeaderDetails .row').append('
' + data.streetName + '
') $('.PopupTrafficHeaderDetails .row').append('
' + data.streetSpeed + '
') $('.PopupTrafficHeaderDetails .row').append('
' + data.vehicleSpeed + '
') $('.PopupTrafficHeaderDetails .row').append('
' + data.laneNumber + '
') $('.PopupTrafficHeaderDetails .row').append('
' + data.foreignVehicleNumber + '
') $('.PopupTrafficHeaderDetails .row').append('
' + data.vehicleDirection + '
') $('.PopupTrafficHeaderDetails .row').append('
' + data.vehicleSeriallNumber + '
') $('.PopupTrafficHeaderDetails .row').append('
' + DictionaryUtils.chooseWord(data.vehicleTypeDescAr, data.vehicleTypeDescEn) + '
') $('.PopupTrafficHeaderDetails .row').append('
' + data.vehicleMake + '
') $('.PopupTrafficHeaderDetails .row').append('
' + data.vehicleModel + '
') $('.PopupTrafficHeaderDetails .row').append('
' + platenumber + '
') $('.PopupTrafficHeaderDetails .row').append('
' + DictionaryUtils.chooseWord(data.violationStatusDescAr, data.violationStatusDescEn) + '
') if (data.paymentDateG !== undefined && data.paymentDateG !== '' && data.paymentDateG !== null) { $('.PopupTrafficHeaderDetails .row').append('
' + DictionaryUtils.GetDateByLanguage(data.paymentDateG.toString().substr(6, 2), data.paymentDateG.toString().substr(4, 2), data.paymentDateG.toString().substr(0, 4)) + '
') } else { $('.PopupTrafficHeaderDetails .row').append('
' + '-' + '
') } $('.PopupTrafficHeaderDetails .row').append('
' + data.totalFineItemsAmount + ' ' + DictionaryUtils.getMessage('saudi_riyal') + '
') var strFineNumber = fineNumber + ''; // Images /// if (FromHome == false || LoginType == "2") { $('.PopupTrafficHeaderMap').append('
' + DictionaryUtils.getMessage('image_loading') + '
') if (!((strFineNumber.startsWith("3") || strFineNumber.startsWith("4") || strFineNumber.startsWith("6")) && strFineNumber.length == 10)) { $('.TrafficViolationImages').html('
' + DictionaryUtils.getMessage('no_violation_imgs') + '
') } else { var compareDate = new Date(); var compareYear = compareDate.getFullYear() - 1; compareDate = new Date(compareYear, compareDate.getMonth(), compareDate.getDay()); var violationDate = data.violationDateG; violationDate = new Date(violationDate.substr(0, 4) + '-' + violationDate.substr(4, 2) + '-' + violationDate.substr(6, 2)); if (compareDate < violationDate) { NetworkUtils.PDSFines.GetTrafficViolationImages(fineNumber, ViolatorID, FromHome) .done(function (data) { if (data != undefined && data.images.length > 0) { $('.TrafficViolationImages').html('
' + data.images.length + ' ' + DictionaryUtils.getMessage('images_available') + '
') //append ImagesThmbs for (var i = 0; i < data.images.length; i++) { $('.TrafficViolationImages .ImagesThmbs .row').append('') } //Click event for ImagesThmbs $('.ImagesThmbs').click(function (e) { e.stopPropagation(); //Clear Modal $('#CustomModalBodyCardImages').empty(); setTimeout(function () { $('.ImagesCustomModal').fadeIn() }); //Append carousel to Custom Images Modal $('#CustomModalBodyCardImages').html(` `); /*-------------------- append Traffic Violation images to carousel --------------------*/ var isActive = ''; thumbId = $(e.target).attr('id'); for (var i = 0; i < data.images.length; i++) { isActive = i == thumbId ? 'active' : ''; $('.carousel-indicators').append(''); $('.carousel-inner').append(''); } /*------------------------------------------------------------------------*/ //Images Modal close event $('.CustomModalCloseImages').click(function (event) { $('.ImagesCustomModal').fadeOut(); setTimeout(function () { $('.CustomModal').modal('show') }); }); }); } else { $('.TrafficViolationImages').html('
' + DictionaryUtils.getMessage('no_violation_imgs') + '
') } }).always(function (data) { }) .fail(function () { $('.TrafficViolationImages').html('
' + DictionaryUtils.getMessage('no_violation_imgs') + '
') }) } else { //handle show message that date is old $('.TrafficViolationImages').html('
' + DictionaryUtils.getMessage('no_violation_imgs_by_date') + '
') } } } else { var NoImgNote = '' if (!((strFineNumber.startsWith("3") || strFineNumber.startsWith("4") || strFineNumber.startsWith("6")) && strFineNumber.length == 10)) { NoImgNote = DictionaryUtils.getMessage('no_violation_imgs') } else { NoImgNote = DictionaryUtils.getMessage('view_violation_imgs') } //$('.PopupTrafficHeaderMap').append('
' + NoImgNote + '
') } // End Images /// if (data.listOfViolationItems.length > 0) { $('.popupDetailsBody').append('
') for (var i = 0; i < data.listOfViolationItems.length; i++) { $('.popupDetailsBody .note').append('
') $('.popupDetailsBody .note .row-' + i + ' .alert .row').append('
' + (data.listOfViolationItems.length > 0 ? DictionaryUtils.chooseWord(data.listOfViolationItems[i].violationTypeDescAr, data.listOfViolationItems[i].violationTypeDescEn) : '--') + '
') $('.popupDetailsBody .note .row-' + i + ' .alert .row').append('
' + data.listOfViolationItems[i].violationAmount + ' ' + DictionaryUtils.getMessage('saudi_riyal') + '
') } } else { } $('.popupDetails .popupDetailsBTns').append('
') if (data.violationStatusCode == 1) { if (isPaymentDisabled) { $('.popupDetails .BtnToolbar ').before('

' + DictionaryUtils.getMessage('payment_stopped') + '

') } else if (data.lkResolutionType == 55) { $('.popupDetails .BtnToolbar ').before('

' + DictionaryUtils.getMessage('cannot_pay_on_efaa') + '
') } else { $('.popupDetails .popupDetailsBTns .BtnToolbar').append(' ' + DictionaryUtils.getMessage('pay_now') + '') } } if (ShowbackBtn == true) { $('.popupDetails .popupDetailsBTns .BtnToolbar').append(' ' + DictionaryUtils.getMessage('back') + '') $('.BackToList').click(function () { $('.TDClicksCounter').val(0) //console.log($('.TDClicksCounter').val()) $('.TableDetailsCounter').html(0); $('.ViolationDetails').fadeOut("fast", function () { $('.ViolationsList').fadeIn() $('.ViolationDetails').html('') $('.BootstrapCarousel').remove() }); }) } $('.DetailsPayBtn').click(function () { $(this).css('display', 'none') function showpanel() { $('.DetailsPayBtn').css('display', 'inline-block') } setTimeout(showpanel, 1000) var finenumber = $(this).attr('finenumber') var fineAmount = $(this).attr('FineAmount') var violatorid = $(this).attr('violatorid') var PayerID = $(this).attr('PayerID') var PayerType = $(this).attr('PayerType') var LoginType = $(this).attr('LoginType') $('.popupDetails').fadeOut(function () { $('.CheckPayment').fadeIn(function () { var orderInfo = { PayerID: PayerID, ViolatorID: ViolatorID, OrderType: 2, PayerType: PayerType, LoginType: LoginType, FiensInfoDTOs: [{ "FineNumber": finenumber, "FineAmount": fineAmount }] }; NetworkUtils.Payments.CreateOrder(orderInfo).done(function (data) { var form = document.getElementById("payment_confirmation"); for (var key in data) { //console.log(key + ": " + data[key]); var input = document.createElement("input"); input.setAttribute("type", "hidden"); input.setAttribute("id", key); input.setAttribute("name", key); input.setAttribute("value", data[key]); form.appendChild(input); } form.submit(); }).fail(function (data) { var errorText = data.responseText != null ? data.responseText : DictionaryUtils.getMessage('error-occured') bootbox.dialog({ message: errorText, className: DictionaryUtils.getLanguage() === "ar" ? "RTL" : "", buttons: { close: { label: DictionaryUtils.getMessage("close"), className: 'pay-btn' } } }); $('.popupDetails').fadeIn() $('.CheckPayment').fadeOut(function () { $('.CheckPaymentFieldDiv').fadeIn() }); }); }); }); }) $('.popupDetails .BtnToolbar').append('') PrintDetails() $('.popupDetails .BtnToolbar').append('') $('.popupDetails .BtnToolbar').append('') Share() $('.popupDetails').after('
يرجى الانتظار ...
') //$('.popupDetails').after('
لا يمكنك دفع هذه المخالفة
') }).always(function (data) { }) .fail(function () { $('.CustomModalBodyCard .LoadingBeforeSendSpan').remove() if (FromHome == true) { $('.CustomModalBodyCard').html('') } $('.ViolationDetails').html('') }) } else { NetworkUtils.PDSFines.extGetViolationsByFineNumAndViolaterId(fineNumber, ViolatorID, token, FromHome) .done(function (data) { data = data.violationlInfo; fineAmount = data[0].fineAmount; $('.CustomModalBodyCard .LoadingBeforeSendSpan').remove() //console.log(data) if (ShowbackBtn == true) { $('.ViolationDetails').append('
') } else { $('.CustomModalBodyCard').append('
') } $('.popupDetails > .row').append('
') $('.popupDetails > .row').append('
') $('.popupDetails > .row').append('
') $('.popupDetailsHeader .row').append('
' + data[0].violatorId + '
') $('.popupDetailsHeader .row').append('
' + data[0].fineNumber + '
') $('.popupDetailsHeader .row').append('
' + data[0].structureDescription + '
') $('.popupDetailsHeader .row').append('
' + data[0].fineGroupDescription + '
') $('.popupDetailsHeader .row').append('
' + DictionaryUtils.formatDate(data[0].dateTimeHappened) + '
') $('.popupDetailsHeader .row').append('
' + data[0].timeHappened + '
') $('.popupDetailsHeader .row').append('
' + DictionaryUtils.chooseWord(data[0].fineBookingType, data[0].fineBookingTypeEn) + '
') $('.popupDetailsHeader .row').append('
' + DictionaryUtils.chooseWord(data[0].fineStatus.description, data[0].fineStatus.latinDescription) + '
') $('.popupDetailsHeader .row').append('
' + DictionaryUtils.formatDate(data[0].dueDate) + '
') $('.popupDetailsHeader .row').append('
' + data[0].fineBusinessRef + '
') $('.popupDetailsHeader .row').append('
' + data[0].cityName + '
') $('.popupDetailsHeader .row').append('
' + data[0].fineAmount + ' ' + DictionaryUtils.getMessage('saudi_riyal') + '
') if (data[0].resolutionDate == undefined || data[0].resolutionDate == null || data[0].resolutionDate == "0001-01-01T00:00:00") $('.popupDetailsHeader .row').append('
' + "-" + '
') else $('.popupDetailsHeader .row').append('
' + DictionaryUtils.formatDate(data[0].resolutionDate) + '
') //// Plate number : Display Plate info if exists only if (data[0].vehiclePlate !== undefined) { if (data[0].vehiclePlate != "" && data[0].vehiclePlate != null) { plate = data[0].vehiclePlate; var platenumber = "", platenumbers = DictionaryUtils.GetPlateNumber(plate).split(' '); if (DictionaryUtils.getLanguage() == 'ar') { for (var count = platenumbers.length; count > 0; count--) platenumber += (platenumbers[count - 1] == "" ? "" : "" + platenumbers[count - 1] + " "); } else { for (var count = 0; count < platenumbers.length; count++) platenumber += (platenumbers[count] == "" ? "" : "" + platenumbers[count] + " "); } if (platenumbers == "") { platenumber += DictionaryUtils.getMessage("not_specified"); } platenumber == null || platenumber == "" ? $('.popupDetailsHeader .row').append('
' + '-' + '
') : $('.popupDetailsHeader .row').append('
' + platenumber + '
') data[0].vehicleRegistrationType == undefined || data[0].vehicleRegistrationType == "" || data[0].vehicleRegistrationType == null ? $('.popupDetailsHeader .row').append('
' + '-' + '
') : $('.popupDetailsHeader .row').append('
' + data[0].vehicleRegistrationType + '
') data[0].vehicleMake == undefined || data[0].vehicleMake == "" || data[0].vehicleMake == null ? $('.popupDetailsHeader .row').append('
' + '-' + '
') : $('.popupDetailsHeader .row').append('
' + data[0].vehicleMake + '
') } } ////// Map var locationExists = false; if (data[0].giS_LATITUDE !== undefined && data[0].giS_LONGITUDE !== undefined) { if (data[0].giS_LATITUDE !== "0.0" && data[0].giS_LONGITUDE !== "0.0" && data[0].giS_LATITUDE !== '' && data[0].giS_LONGITUDE !== '' && data[0].giS_LATITUDE !== null && data[0].giS_LONGITUDE !== null) { /*set layout first then append location*/ $('.CustomModalBodyCard .popupDetailsHeader').addClass('col-lg-9') $('
').insertAfter('.CustomModalBodyCard .row .popupDetailsHeader'); locationExists = true; var _location = " " + DictionaryUtils.getMessage("fine_location") + "

"; $('.publicFineMap').html(_location) } //else { // /*if this condition used, you have to set layout before*/ // $('.publicFineMap').html('
' + DictionaryUtils.getMessage('fine_location') + ' ' + DictionaryUtils.getMessage('not_specified') + '
') //} } ///// End Map /******************************************************************************/ /** TGA Images **/ if (FromHome == false || LoginType == "2") { //check if its a TGA violation to view the violation images if (data[0].structure.code == 32 && data[0].fineGroup.fineGroupCode !== 184) { if (locationExists) { //insert TGA image tag if location exists $('
').insertAfter('.PopupPublicHeaderMap .publicFineMap'); } else { //change card layout then insert TGA image tag $('.CustomModalBodyCard .popupDetailsHeader').addClass('col-lg-9'); $('
').insertAfter('.CustomModalBodyCard .row .popupDetailsHeader'); } //while checking append loading icon $('.popupTGAHeaderImage').append('
' + DictionaryUtils.getMessage('image_loading') + '
') var compareDate = new Date(); var compareYear = compareDate.getFullYear() - 1; compareDate = new Date(compareYear, compareDate.getMonth(), compareDate.getDay()); var violationDate = new Date(data[0].dateTimeHappened); if (compareDate < violationDate) { var billNo = data[0].resolutionRef; NetworkUtils.PDSFines.GetPublicTransportAuthorityImages(billNo, ViolatorID, FromHome) .done(function (data) { if (data !== undefined) { if (data !== null && data.length > 0) { $('.TGAViolationImages').html('
' + data.length + ' ' + DictionaryUtils.getMessage('images_available') + '
') //append ImagesThmbs for (var i = 0; i < data.length; i++) { $('.TGAViolationImages .ImagesThmbs .row').append('') } //Click event for ImagesThmbs $('.ImagesThmbs').click(function (e) { e.stopPropagation(); //Clear Modal $('#CustomModalBodyCardImages').empty(); setTimeout(function () { $('.ImagesCustomModal').fadeIn() }); //Append carousel to Custom Images Modal $('#CustomModalBodyCardImages').html(` `); /*-------------------- append TGA images to carousel --------------------*/ var isActive = ''; thumbId = $(e.target).attr('id'); for (var i = 0; i < data.length; i++) { isActive = i == thumbId ? 'active' : ''; $('.carousel-indicators').append(''); $('.carousel-inner').append(''); } /*------------------------------------------------------------------------*/ //Images Modal close event $('.CustomModalCloseImages').click(function (event) { $('.ImagesCustomModal').fadeOut(); setTimeout(function () { $('.CustomModal').modal('show') }); }); }); } else { $('.TGAViolationImages').html('
' + DictionaryUtils.getMessage('no_violation_imgs') + '
'); } } //show message if undefined else { $('.TGAViolationImages').html('
' + DictionaryUtils.getMessage('no_violation_imgs') + '
'); } }).always(function (data) { }) .fail(function () { $('.TGAViolationImages').html('
' + DictionaryUtils.getMessage('no_violation_imgs') + '
'); }); } else { //handle show message that date is old $('.TGAViolationImages').html('
' + DictionaryUtils.getMessage('no_violation_imgs_by_date') + '
') } } } else { // } /** End TGA Images **/ /******************************************************************************/ if (data[0].structure.code == 4) { $('.popupDetailsHeader .row').append('
' + DictionaryUtils.getMessage("attachment_link") + '
https://online.mt.gov.sa/PenaltiesInquiry
') } else if (data[0].structure.code == 38) {//MOT $('.popupDetailsHeader .row').append('
' + DictionaryUtils.getMessage("attachment_link_mot") + '
https://mot.gov.sa/ar/Eservices/InquiryServices/Pages/TicketsInfoPage.aspx
') } else if (data[0].structure.code == 12) { if (data[0].fineGroupDescription == "مخالفات أحكام نظام الشركات") $('.popupDetailsHeader .row').append('
' + DictionaryUtils.getMessage("attachment2_link") + '
https://mc.gov.sa/ar/pages/efaa.aspx
') else if (data[0].fineGroupDescription == "VIOLATIONS OF THE PROVISIONS OF THE COMPANIES LAW") $('.popupDetailsHeader .row').append('
' + DictionaryUtils.getMessage("attachment2_link") + '
https://mc.gov.sa/ar/pages/efaa.aspx
') else if (data[0].fineGroupDescription == "VIOLATIONS OF THE PROVISIONS OF THE COMPANIES LAW") $('.popupDetailsHeader .row').append('
' + DictionaryUtils.getMessage("attachment2_link") + '
https://mc.gov.sa/ar/pages/efaa.aspx
') } if (data[0].groupFineDetails.length > 0) { $('.popupDetailsBody').append('
') for (var i = 0; i < data[0].groupFineDetails.length; i++) { $('.popupDetailsBody .note').append('
') $('.popupDetailsBody .note .row-' + i + ' .alert .row').append('
' + data[0].groupFineDetails[i].description + '
') $('.popupDetailsBody .note .row-' + i + ' .alert .row').append('
' + data[0].groupFineDetails[i].fineCount + '
') $('.popupDetailsBody .note .row-' + i + ' .alert .row').append('
' + data[0].groupFineDetails[i].amount + ' ' + DictionaryUtils.getMessage('saudi_riyal') + '
') } } else { } $('.popupDetails .popupDetailsBTns').append('
') if (data[0].fineStatus.code == 1) { if (isPaymentDisabled) { $('.popupDetails .BtnToolbar ').before('
') $('.PaymentIssueMessage').append('

' + DictionaryUtils.getMessage('payment_stopped') + '

') } else if (data[0].lkResolutionType == 55) { $('.popupDetails .BtnToolbar ').before('
') $('.PaymentIssueMessage').append('

' + DictionaryUtils.getMessage('cannot_pay_on_efaa') + '

') if (data[0].resolutionSource == 60) { $('.PaymentIssueMessage').append('

' + DictionaryUtils.getMessage('sadad_modal_title') + '

') $('.PaymentIssueMessage').append('

' + DictionaryUtils.getMessage('sadad_social_sec3') + '

') } else { $('.PaymentIssueMessage').append('

' + DictionaryUtils.getMessage('sadad_modal_steps') + '

    ') $('.PaymentIssueMessage ol').append('
  1. ' + DictionaryUtils.getMessage('sadad_modal_step1') + data[0].resolSourceDescription + '
  2. ') $('.PaymentIssueMessage ol').append('
  3. ' + DictionaryUtils.getMessage('sadad_modal_step2') + data[0].resolutionRef + '
  4. ') $('.PaymentIssueMessage ol').append('
  5. ' + DictionaryUtils.getMessage('sadad_modal_step3') + '
  6. ') } } else { $('.popupDetails .popupDetailsBTns .BtnToolbar').append(' ' + DictionaryUtils.getMessage('pay_now') + '') } } if (ShowbackBtn == true) { $('.popupDetails .popupDetailsBTns .BtnToolbar').append(' ' + DictionaryUtils.getMessage('back') + '') $('.BackToList').click(function () { $('.TDClicksCounter').val(0) console.log($('.TDClicksCounter').val()) $('.TableDetailsCounter').html(0); $('.ViolationDetails').fadeOut("fast", function () { $('.ViolationsList').fadeIn() $('.ViolationDetails').html('') }); }) } $('.DetailsPayBtn').click(function () { $(this).css('display', 'none') function showpanel() { $('.DetailsPayBtn').css('display', 'inline-block') } setTimeout(showpanel, 1000) var finenumber = $(this).attr('finenumber') var fineAmount = $(this).attr('FineAmount') var violatorid = $(this).attr('violatorid') var PayerID = $(this).attr('PayerID') var PayerType = $(this).attr('PayerType') var LoginType = $(this).attr('LoginType') $('.popupDetails').fadeOut(function () { $('.CheckPayment').fadeIn(function () { var orderInfo = { PayerID: PayerID, ViolatorID: ViolatorID, OrderType: 1, PayerType: PayerType, LoginType: LoginType, FiensInfoDTOs: [{ "FineNumber": finenumber, "FineAmount": fineAmount }] }; NetworkUtils.Payments.CreateOrder(orderInfo).done(function (data) { var form = document.getElementById("payment_confirmation"); for (var key in data) { //console.log(key + ": " + data[key]); var input = document.createElement("input"); input.setAttribute("type", "hidden"); input.setAttribute("id", key); input.setAttribute("name", key); input.setAttribute("value", data[key]); form.appendChild(input); } form.submit(); }).fail(function (data) { var errorText = data.responseText != null ? data.responseText : DictionaryUtils.getMessage('error-occured') bootbox.dialog({ message: errorText, className: DictionaryUtils.getLanguage() === "ar" ? "RTL" : "", buttons: { close: { label: DictionaryUtils.getMessage("close"), className: 'pay-btn' } } }); $('.popupDetails').fadeIn() $('.CheckPayment').fadeOut(function () { $('.CheckPaymentFieldDiv').fadeIn() }); }); }); }); }) //Rejection/Objection Section /* finding if rejectionStatements is not empty or null to show the button */ if (!jQuery.isEmptyObject(data[0].rejectionStatements) && data[0].rejectionStatements !== null) { $('.popupDetails .BtnToolbar').append(''); //finding urls and emails by regex var emailExpression = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi; var urlExpression = /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/gi; var urlRegex = new RegExp(urlExpression); var emailRegex = new RegExp(emailExpression); var searchText = DictionaryUtils.getLanguage() === "ar" ? data[0].rejectionStatements.descriptionAr : data[0].rejectionStatements.descriptionEn; var urlResult = searchText.match(urlRegex); var emailResult = searchText.match(emailRegex); var descriptionWithLinks = searchText; if (urlResult) { for (var i = 0; i < urlResult.length; i++) { descriptionWithLinks = descriptionWithLinks.replace(urlResult[i], `` + urlResult[i] + ``); } } if (emailResult) { for (var i = 0; i < emailResult.length; i++) { descriptionWithLinks = descriptionWithLinks.replace(emailResult[i], `` + emailResult[i] + ``); } } //end of finding urls and emails by regex } /* append rejectionStatement box onClick */ $('.ObjectionDetailsBtn').click(function () { this.disabled = true; $('.popupDetailsBody').append('
    '); $('.objection').append('
    '); $('.popupDetailsBody .objection .alert .row').append('
    ' + descriptionWithLinks + '
    ') }); //End of Rejection/Objection Section $('.popupDetails .BtnToolbar').append('') PrintDetails() $('.popupDetails .BtnToolbar').append('') $('.popupDetails .BtnToolbar').append('') Share() $('.popupDetails').after('
    ' + DictionaryUtils.getMessage('please_wait') + '
    ') //$('.popupDetails').after('
    لا يمكنك دفع هذه المخالفة
    ') }).always(function (data) { }) .fail(function () { $('.CustomModalBodyCard .LoadingBeforeSendSpan').remove() if (FromHome == true) { $('.CustomModalBodyCard').html('') } $('.ViolationDetails').html('') }) } }); }); } /* Print Details */ function PrintDetails() { if ($('body').hasClass('rtlDesign')) { var PrintCSS = "PrintAr.css" } else { var PrintCSS = "PrintEn.css" } $('.PrintDetailsBtn').click(function () { var PrintDir = '' if ($('body').hasClass('ltrDesign') == true) { PrintDir = 'ltrDesign' } else { PrintDir = 'rtlDesign' } var DivToPrint = $(this).attr('DivToPrint') var HeaderTXT1 = DictionaryUtils.getMessage('nationalviolationsplatform') + '(' + DictionaryUtils.getMessage('efaa') + ')' var HeaderTXT = $(this).attr('header') $('.' + DivToPrint + '').printThis({ importCSS: true, pageTitle: '', loadCSS: ['/Custom/css/Print.css', '/Custom/css/' + PrintCSS + ''], header: '

    ' + HeaderTXT1 + '

    ' + HeaderTXT + '

    ' + DictionaryUtils.GetDate() + '

    ', footer: '

    ' }); }) } /* Share Details */ function Share() { $('.ShareDetailsBtn').click(function () { var DivToPrint = $(this).attr('DivToPrint') var ShareType = $(this).attr('ShareType') var EmailBody = '' if (ShareType == "Email") { EmailBody += DictionaryUtils.getMessage('nationalviolationsplatform') + ' (' + DictionaryUtils.getMessage('efaa') + ')' + '\n' EmailBody += DictionaryUtils.getMessage('violation_details') + '\n\n' } else if (ShareType == "WhatsApp") { EmailBody += '*' + DictionaryUtils.getMessage('nationalviolationsplatform') + ' (' + DictionaryUtils.getMessage('efaa') + ')' + '*' + '\n' EmailBody += '*' + DictionaryUtils.getMessage('violation_details') + '*' + '\n' } $('.' + DivToPrint + ' .popupDetailsHeader').find('.detailsGroup').each(function () { if ($(this).attr('showInShare') == 'Yes') { var Title = $(this).find('label span').html() var Value = $(this).find('.detailsValue').text() //console.log(Value) EmailBody += (Title + ': ' + Value + '\n') } }); EmailBody += '\n' + DictionaryUtils.getMessage('more_info') + ' https://efaa.sa' var subject = DictionaryUtils.getMessage('nationalviolationsplatform') if (ShareType == "Email") { window.location = 'mailto:?Content-type=text/html&subject=' + subject + '&body=' + encodeURIComponent(EmailBody); } else if (ShareType == "WhatsApp") { window.location = 'https://wa.me/?text=' + encodeURIComponent(EmailBody) + '' } }) }