897 lines
32 KiB
JavaScript
897 lines
32 KiB
JavaScript
var GLOBAL_URL = "";
|
|
var DEFAULT_CLENT_LIST = "";
|
|
var hasHistory = false;
|
|
var is_editable = false;
|
|
var history_id = 0;
|
|
|
|
function isEmptyString(value) {
|
|
var result = false;
|
|
|
|
if (typeof value === "undefined") {
|
|
result = true;
|
|
} else if (value == null) {
|
|
result = true;
|
|
} else if (!value) {
|
|
result = true;
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
|
|
var url = $(location).attr('hostname');
|
|
var folder_path = window.location.pathname.split('/').slice(0, 2).join('/');
|
|
|
|
$('#client-contact-id').addClass('client-dropdown');
|
|
$('#client-contact-id').parents('div.col-md-10').first().prepend(affiliateCheckboxContent())
|
|
$('#client-contact-loading-img').after(viewDFtButton());
|
|
|
|
hideOldImageTagForNotExistImg()
|
|
setClientFilesButton();
|
|
$('#resetForm').click(function() {
|
|
|
|
$('form#inputformId')[0].reset();
|
|
$('input#image1').show();
|
|
$('input#image2').show();
|
|
$('input#image3').show();
|
|
$('input#image4').show();
|
|
$('input#image5').show();
|
|
|
|
$('#label1').show();
|
|
$('#label2').show();
|
|
$('#label3').show();
|
|
$('#label4').show();
|
|
$('#label5').show();
|
|
$('#label6').show();
|
|
$('#label7').show();
|
|
$('#label8').show();
|
|
|
|
$("input#image1new").val('');
|
|
$("input#image2new").val('');
|
|
$("input#image3new").val('');
|
|
$("input#image4new").val('');
|
|
$("input#image5new").val('');
|
|
$("input#image6new").val('');
|
|
$("input#image7new").val('');
|
|
$("input#image8new").val('');
|
|
|
|
$('#clientId').val('');
|
|
$('#cra_report').val('');
|
|
$('#first_name').val('');
|
|
$('#last_name').val('');
|
|
$('#street_no').val('');
|
|
$('#street_name').val('');
|
|
$('#city').val('');
|
|
$('#state').val('');
|
|
$('#credit_bureau_address').val('');
|
|
$('#sincerely').val('');
|
|
$('#clientInfo').val('');
|
|
$('#social_security_no').val('');
|
|
$('#birth_date').val('');
|
|
|
|
$('img#image1-old-view').removeAttr('src');
|
|
$('img#image2-old-view').removeAttr('src');
|
|
$('img#image3-old-view').removeAttr('src');
|
|
$('img#image4-old-view').removeAttr('src');
|
|
$('img#image5-old-view').removeAttr('src');
|
|
$('img#image6-old-view').removeAttr('src');
|
|
$('img#image7-old-view').removeAttr('src');
|
|
$('img#image8-old-view').removeAttr('src');
|
|
});
|
|
$('.loading').show();
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: APP_SERVER_HOST_URL + 'dashboard/clientContact',
|
|
cache: false,
|
|
success: function(data) {
|
|
var response = JSON.parse(data);
|
|
var json = response.contacts;
|
|
|
|
var dropdown = $('#client-contact-id');
|
|
DEFAULT_CLENT_LIST = json;
|
|
|
|
dropdown.empty();
|
|
dropdown.append(new Option("Please select client", "0"));
|
|
$.each(json, function(index, contact) {
|
|
dropdown.append('<option data-id="' + contact.client_id + '" value="' + contact.id + '" >' + contact.first_name + ' ' + contact.last_name + ' ' + "(" + '' + contact.email + ")" + '</option>');
|
|
});
|
|
$('.loading').hide();
|
|
$('img#client-contact-loading-img').css('display', 'none');
|
|
if (HAS_RTG_LS_FAX_ACCESS) {
|
|
setSelectedDataForRTGLetters();
|
|
}
|
|
}
|
|
|
|
});
|
|
//$('#view-report-btn').click(function())
|
|
|
|
|
|
$('#report_file_name').change(function() {
|
|
var reportId = $(this).val();
|
|
if (reportId !== '0') {
|
|
$('#credit_bureau_address').attr('required', false);
|
|
$('#credit_bureau_field').hide();
|
|
} else {
|
|
$('#credit_bureau_address').attr('required', true);
|
|
$('#credit_bureau_field').show();
|
|
}
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
function hideOldImageTagForNotExistImg() {
|
|
$('img#image1-old-view').hide();
|
|
$('img#image2-old-view').hide();
|
|
$('img#image3-old-view').hide();
|
|
$('img#image4-old-view').hide();
|
|
$('img#image5-old-view').hide();
|
|
$('img#image6-old-view').hide();
|
|
$('img#image7-old-view').hide();
|
|
$('img#image8-old-view').hide();
|
|
}
|
|
|
|
function showOldImageTag() {
|
|
$('img#image1-old-view').show();
|
|
$('img#image2-old-view').show();
|
|
$('img#image3-old-view').show();
|
|
$('img#image4-old-view').show();
|
|
$('img#image5-old-view').show();
|
|
$('img#image6-old-view').show();
|
|
$('img#image7-old-view').show();
|
|
$('img#image8-old-view').show();
|
|
}
|
|
|
|
|
|
|
|
$('#client-contact-id').change(function() {
|
|
var url = $(location).attr('hostname');
|
|
var folder_path = window.location.pathname.split('/').slice(0, 2).join('/');
|
|
var contactId = $(this).val();
|
|
//var brTag = document.write('<br/>');
|
|
var clientId = $('#client-contact-id').val();
|
|
var client_id = $('#client-contact-id option:selected').data('id');
|
|
var report_type = $('select[name=report_type]').val();
|
|
var formData = {
|
|
contactId: contactId,
|
|
'report_type': report_type,
|
|
'HAS_RTG_ACCESS_PKG': HAS_RTG_ACCESS_PKG
|
|
};
|
|
|
|
if (contactId !== '0') {
|
|
$("#view-report-btn").remove();
|
|
//$('img#client-contact-loading-img').css('display', 'block');
|
|
$('.loading').show();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: APP_SERVER_HOST_URL + 'dashboard/getContact',
|
|
data: formData,
|
|
success: function(data) {
|
|
var json = JSON.parse(data);
|
|
//console.log('response', response)
|
|
//var json = response.contacts;
|
|
var form = $('form#inputformId');
|
|
form.find('textarea,input').val('');
|
|
clientChangeEvent(json.report_type_id);
|
|
|
|
CLIENT_EMAIL = json.client_email;
|
|
if (json.clientDetails) {
|
|
if (json.clientDetails.first_name) {
|
|
CLIENT_NAME = json.clientDetails.first_name;
|
|
}
|
|
|
|
if (json.clientDetails.last_name) {
|
|
CLIENT_NAME += " " + json.clientDetails.last_name;
|
|
}
|
|
|
|
DOB = json.clientDetails.birth_date;
|
|
SSN = json.clientDetails.social_secuirty_no;
|
|
}
|
|
|
|
console.log(json);
|
|
var form_id = json.form_id;
|
|
setAllpopupLink(json);
|
|
|
|
//console.log('NEGATIVE_ALL',NEGATIVE_ALL);
|
|
|
|
if (json.clientDetails != null) {
|
|
$('#uploadSection').show();
|
|
|
|
var clientId = json.clientDetails.client_id;
|
|
var clientMediaUrl = APP_SERVER_HOST_URL + 'Client/uploadmedia/' + clientId + '#uploadMedia';
|
|
$("#uploadSection button").attr('data-toggle', '');
|
|
$('#uploadSection button').on("click", function() {
|
|
var redirectConfirm = confirm('Are you sure you want to leave this page for uploading photo?');
|
|
if (redirectConfirm === true) {
|
|
return window.location.href = clientMediaUrl;
|
|
}
|
|
});
|
|
|
|
$('input#image1').hide();
|
|
$('input#image2').hide();
|
|
$('input#image3').hide();
|
|
$('input#image4').hide();
|
|
$('input#image5').hide();
|
|
$('input#image6').hide();
|
|
|
|
$('#label1').hide();
|
|
$('#label2').hide();
|
|
$('#label3').hide();
|
|
$('#label4').hide();
|
|
$('#label5').hide();
|
|
$('#label6').hide();
|
|
$('#label7').hide();
|
|
$('#label8').hide();
|
|
|
|
$("input#image1new").val('');
|
|
$("input#image2new").val('');
|
|
$("input#image3new").val('');
|
|
$("input#image4new").val('');
|
|
$("input#image5new").val('');
|
|
$("input#image6new").val('');
|
|
$("input#image7new").val('');
|
|
$("input#image8new").val('');
|
|
|
|
$('img#image1-old-view').removeAttr('src');
|
|
$('img#image2-old-view').removeAttr('src');
|
|
$('img#image3-old-view').removeAttr('src');
|
|
$('img#image4-old-view').removeAttr('src');
|
|
$('img#image5-old-view').removeAttr('src');
|
|
$('img#image6-old-view').removeAttr('src');
|
|
$('img#image7-old-view').removeAttr('src');
|
|
$('img#image8-old-view').removeAttr('src');
|
|
|
|
$('#cra_report').val(json.clientDetails.cra_report);
|
|
$('#first_name').val(json.clientDetails.first_name);
|
|
$('#last_name').val(json.clientDetails.last_name);
|
|
$('#street_no').val(json.clientDetails.street_no);
|
|
$('#street_name').val(json.clientDetails.street_name);
|
|
$('#city').val(json.clientDetails.city);
|
|
$('#state').val(json.clientDetails.state);
|
|
$('#credit_bureau_address').val(json.clientDetails.credit_bureau_address);
|
|
$('#sincerely').val(json.clientDetails.sincerely);
|
|
$('#social_security_no').val(json.clientDetails.social_secuirty_no);
|
|
$('#birth_date').val(moment(json.clientDetails.birth_date).format('YYYY-MM-DD'));
|
|
$('#clientId').val(contactId);
|
|
$('#clientInfo').val(json.clientDetails.first_name + ' ' + json.clientDetails.last_name + ', ' + json.clientDetails.street_no + ', ' + json.clientDetails.street_name + ', ' + json.clientDetails.city + ', ' + json.clientDetails.state);
|
|
removeUnwantedText();
|
|
setCraReportText(json.report_type_id)
|
|
|
|
//console.log('image', json.clientMedias);
|
|
$.each(json.clientMedias, function(index, media) {
|
|
var imageUrl = APP_SERVER_HOST_URL + 'webroot/contact_photo/';
|
|
var image = imageUrl + media.image_path;
|
|
var mediaType = media.rtg_letter_image_id;
|
|
var mediaImage = media.image_path;
|
|
|
|
if (mediaType === 1 && mediaImage && image) { //Evidence of my Proof of identification
|
|
$('img#image1-old-view').attr("src", image);
|
|
$('img#image1-old-view').show();
|
|
$("input#image1new").val(image);
|
|
$('#label1').show();
|
|
}
|
|
if (mediaType === 2 && mediaImage && image) {
|
|
$('img#image2-old-view').attr("src", image);
|
|
$('img#image2-old-view').show();
|
|
$("input#image2new").val(image);
|
|
$('#label2').show();
|
|
}
|
|
if (mediaType === 3 && mediaImage && image) {
|
|
$('img#image3-old-view').attr("src", image);
|
|
$('img#image3-old-view').show();
|
|
$("input#image3new").val(image);
|
|
$('#label3').show();
|
|
}
|
|
if (mediaType === 4 && mediaImage && image) {
|
|
$('img#image4-old-view').attr("src", image);
|
|
$('img#image4-old-view').show();
|
|
$("input#image4new").val(image);
|
|
$('#label4').show();
|
|
|
|
}
|
|
if (mediaType === 5 && mediaImage && image) {
|
|
$('img#image5-old-view').attr("src", image);
|
|
$('img#image5-old-view').show();
|
|
$("input#image5new").val(image);
|
|
$('#label5').show();
|
|
}
|
|
if (mediaType === 6 && mediaImage && image) {
|
|
$('img#image6-old-view').attr("src", image);
|
|
$('img#image6-old-view').show();
|
|
$("input#image6new").val(image);
|
|
$('#label6').show();
|
|
}
|
|
if (mediaType === 7 && mediaImage && image) {
|
|
$('img#image7-old-view').attr("src", image);
|
|
$('img#image7-old-view').show();
|
|
$("input#image8new").val(image);
|
|
$('#label7').show();
|
|
}
|
|
if (mediaType === 8 && mediaImage && image) {
|
|
$('img#image8-old-view').attr("src", image);
|
|
$('img#image8-old-view').show();
|
|
$("input#image8new").val(image);
|
|
$('#label8').show();
|
|
}
|
|
});
|
|
//showOldImageTag();
|
|
$('.loading').hide();
|
|
//$('img#client-contact-loading-img').css('display', 'none');
|
|
|
|
} else {
|
|
|
|
var client_id_ajax = json.client_id;
|
|
$('.loading').hide();
|
|
//$('img#client-contact-loading-img').css('display', 'none');
|
|
$('.loading').hide();
|
|
if (window.confirm('Credit report has not been setup for this client. Please click ok to setup credit report.')) {
|
|
window.location.href = APP_SERVER_HOST_URL + 'Client/creditreportsetup/' + client_id_ajax;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
} else {
|
|
$('#resetForm').click();
|
|
$('.loading').hide();
|
|
//$('img#client-contact-loading-img').css('display', 'none');
|
|
$('#uploadSection').css('display', 'none');
|
|
}
|
|
|
|
|
|
$('#label1').click(function() {
|
|
$("input#image1new").val('');
|
|
$('img#image1-old-view').removeAttr('src');
|
|
if (contactId !== '0') {
|
|
$('#label1').hide();
|
|
} else {
|
|
$('#label1').show();
|
|
}
|
|
});
|
|
$('#label2').click(function() {
|
|
$("input#image2new").val('');
|
|
$('img#image2-old-view').removeAttr('src');
|
|
if (contactId !== '0') {
|
|
$('#label2').hide();
|
|
} else {
|
|
$('#label2').show();
|
|
}
|
|
});
|
|
$('#label3').click(function() {
|
|
$("input#image3new").val('');
|
|
$('img#image3-old-view').removeAttr('src');
|
|
if (contactId !== '0') {
|
|
$('#label3').hide();
|
|
} else {
|
|
$('#label3').show();
|
|
}
|
|
});
|
|
$('#label4').click(function() {
|
|
$("input#image4new").val('');
|
|
$('img#image4-old-view').removeAttr('src');
|
|
if (contactId !== '0') {
|
|
$('#label4').hide();
|
|
} else {
|
|
$('#label4').show();
|
|
}
|
|
});
|
|
$('#label5').click(function() {
|
|
$("input#image5new").val('');
|
|
$('img#image5-old-view').removeAttr('src');
|
|
if (contactId !== '0') {
|
|
$('#label5').hide();
|
|
} else {
|
|
$('#label5').show();
|
|
}
|
|
});
|
|
$('#label6').click(function() {
|
|
$("input#image6new").val('');
|
|
$('img#image6-old-view').removeAttr('src');
|
|
if (contactId !== '0') {
|
|
$('#label6').hide();
|
|
} else {
|
|
$('#label6').show();
|
|
}
|
|
});
|
|
$('#label7').click(function() {
|
|
$("input#image7new").val('');
|
|
$('img#image7-old-view').removeAttr('src');
|
|
if (contactId !== '0') {
|
|
$('#label7').hide();
|
|
} else {
|
|
$('#label7').show();
|
|
}
|
|
});
|
|
$('#label8').click(function() {
|
|
$("input#image8new").val('');
|
|
$('img#image8-old-view').removeAttr('src');
|
|
if (contactId !== '0') {
|
|
$('#label8').hide();
|
|
} else {
|
|
$('#label8').show();
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function removeUnwantedText() {
|
|
$('.rtg-make-empty-field').val('');
|
|
}
|
|
|
|
function getHTMLByClientId(elem) {
|
|
var client_id = $('#client-contact-id option:selected').data('id');
|
|
var source_type = 1;
|
|
if ($('select[name=report_type]').val()) {
|
|
source_type = $('select[name=report_type]').val();
|
|
}
|
|
//source_type = 1;
|
|
//var saveIdentityID = GLOBAL_URL+'uploadhtml/identityIQSave';
|
|
if (client_id > 0) {
|
|
$('#client-contact-loading-img').show();
|
|
var formData = { 'action': 'htmlinfo', 'client_id': client_id, 'source_type': source_type };
|
|
//console.log('formData', formData)
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: saveIdentityID,
|
|
data: formData,
|
|
cache: false,
|
|
success: function(data) {
|
|
$('#client-contact-loading-img').hide();
|
|
var response = JSON.parse(data);
|
|
//console.log(json)
|
|
if (response.html) {
|
|
var json = response.html;
|
|
//$('.view-html').html(json);
|
|
json = json.replace('https://www.identityiq.com/Scripts/jquery-1.7.2.min.js', '');
|
|
json = json.replace('https://www.identityiq.com/Scripts/angular.js', '');
|
|
$('textarea[name=html_content]').val(json)
|
|
uploadHTMLUICode(json, true, source_type)
|
|
$('#client-html .modal-body').show();
|
|
$('.modal-dialog').css({ "margin": "0 auto" });
|
|
//$.noConflict();
|
|
$('#client-html').modal('show');
|
|
|
|
} else {
|
|
alert('There is no credit report for the client.')
|
|
}
|
|
}
|
|
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
function sourceTypeDropdown(elem, report_type = 0) {
|
|
|
|
var form = $(elem).closest("form");
|
|
var class_name = 'rtg-charge-off-form';
|
|
var label = '<label class="col-sm-5 control-label">Source</label>'
|
|
var start_div = '<div class="col-sm-7">';
|
|
if (form.hasClass(class_name)) {
|
|
label = '<label class="col-sm-6 control-label">Source</label>';
|
|
start_div = '<div class="col-sm-6">';
|
|
}
|
|
var iQ_selected = "";
|
|
var sc_selected = "";
|
|
var privacy_guard_selected = "";
|
|
|
|
if (report_type == 1) {
|
|
iQ_selected = "selected";
|
|
} else if (report_type == 2) {
|
|
privacy_guard_selected = "selected";
|
|
} else if (report_type == 3) {
|
|
sc_selected = "selected";
|
|
}
|
|
|
|
var html = "";
|
|
html = '<div class="form-group report_type-div required" style="display:none">' +
|
|
label + start_div +
|
|
'<select name="report_type" class="form-control" onchange="reportTypeChange(this)" required>' +
|
|
'<option value="">Please Select</option>' +
|
|
'<option value="1" ' + iQ_selected + '>Identity IQ</option>' +
|
|
'<option value="2" ' + privacy_guard_selected + '>Privacy Guard</option>' +
|
|
'<option value="3" ' + sc_selected + '>Smart Credit</option>' +
|
|
'</select>' +
|
|
'</div>' +
|
|
'</div>';
|
|
return html;
|
|
}
|
|
|
|
function showmodal() {
|
|
$('#df-address').modal('show');
|
|
}
|
|
|
|
function clientFilesButton() {
|
|
var html = '<button type="button" style="width: 100%;margin-bottom:10px;" id="view-client-files" class="btn btn-success btn-orange-color" onclick="getRTGFormData(this)">Client Files</button>';
|
|
|
|
return html;
|
|
}
|
|
|
|
function viewReportButton() {
|
|
var html = '<button type="button" style="width: 100%;display:none; margin-bottom:10px;" id="view-report-btn" class="btn btn-success btn-orange-color" onclick="getHTMLByClientId(this)">View Credit Report</button>';
|
|
|
|
return html;
|
|
}
|
|
|
|
function viewDFtButton() {
|
|
var html = '<button type="button" style="width:100%;" class="btn btn-success btn-orange-color" onclick=" showmodal(this)">Data Furnishers</button>';
|
|
return html;
|
|
}
|
|
|
|
function viewDashboardtButton(client_id) {
|
|
var html = '<a href="' + APP_SERVER_HOST_URL + 'Client/clientdashboard/' + client_id + '" style="width:100%;" class="btn btn-success btn-orange-color" >Client Dashboard</a>';
|
|
return html;
|
|
}
|
|
|
|
function viewLetterStepsButton(client_id) {
|
|
var html = '<a id="stt-pi-letter-btn" href="#" onclick="getSttInfo();" style="width: 100%; margin-bottom: 10px;" class="btn btn-success btn-orange-color">Letter Sets</a>'
|
|
return html;
|
|
}
|
|
|
|
function affiliateCheckboxContent() {
|
|
var url = $(location).attr('hostname');
|
|
var folder_path = window.location.pathname.split('/').slice(0, 2).join('/');
|
|
var form_element = $('#client-contact-id').parents('form#inputformId').first();
|
|
var affiliate_label_col = 'col-sm-5';
|
|
var affiliate_div_col = 'col-sm-7';
|
|
var affiliate_div_col1 = 'col-sm-3';
|
|
|
|
if (form_element.hasClass('rtg-charge-off-form')) {
|
|
affiliate_label_col = 'col-sm-6';
|
|
affiliate_div_col = 'col-sm-6';
|
|
affiliate_div_col1 = 'col-sm-3';
|
|
}
|
|
//alert(form_element.attr('class'));
|
|
var employee_checkbox = '<div class="col-sm-3 client-status">' +
|
|
'<div class="checkbox">' +
|
|
' <label>' +
|
|
'<input type="checkbox" value="2" onclick="employeeShow(this)" name="employee_client_type"> ' +
|
|
'Show employee clients' +
|
|
'<img id="employee-loader" src="' + APP_SERVER_HOST_URL + 'images/ajax-loader.gif" style="display: none;width: 15px;">' +
|
|
'</label>' +
|
|
'</div>' +
|
|
'</div>';
|
|
|
|
var html = '<div class="form-group">' +
|
|
'<label class="' + affiliate_label_col + ' control-label"></label>' +
|
|
'<div class="' + affiliate_div_col1 + ' client-status">' +
|
|
'<div class="checkbox" style="text-align:left">' +
|
|
'<label>' +
|
|
'<input type="checkbox" value="2" onclick="affiliateShow(this)" name="client_type">' +
|
|
'Show affiliate clients' +
|
|
'<img id="affiliate-loader" src="' + APP_SERVER_HOST_URL + 'webroot/images/ajax-loader.gif" style="width: 15px; display: none;">' +
|
|
'</label>' +
|
|
'</div>' +
|
|
'</div>' + employee_checkbox +
|
|
'</div>'
|
|
|
|
var affiliate_list_html = '<div class="form-group affiliate-hide client-status affiliate-list">' +
|
|
'<label class="' + affiliate_label_col + ' control-label">Affiliate List</label>' +
|
|
' <div class="' + affiliate_label_col + '">' +
|
|
'<select name="affiliate_client_id" class="form-control" onchange="generateAffiliateClientList(this)">' +
|
|
'</select>' +
|
|
'<img src="' + APP_SERVER_HOST_URL + 'webroot/images/ajax-loader.gif" style="display: none;position: absolute;top: 0; right: 0;">' +
|
|
'</div>' +
|
|
'</div>'
|
|
|
|
|
|
//
|
|
return html + affiliate_list_html;
|
|
}
|
|
|
|
function getRTGFormData(elem) {
|
|
|
|
var formData = {
|
|
'action': 'GET_RTG_FORM_DATA',
|
|
'form_id': FORM_ID,
|
|
'member_id': MEMBER_ID,
|
|
};
|
|
|
|
readyDatatableFromServerSide(formData)
|
|
}
|
|
|
|
|
|
function deleteRTGFormData(id) {
|
|
|
|
var action_url = APP_SERVER_HOST_URL + 'getRTGData.php';
|
|
|
|
var formData = {
|
|
'action': 'CHECK_HAS_AUTOMATION',
|
|
'form_id': FORM_ID,
|
|
'member_id': MEMBER_ID,
|
|
'id': id
|
|
};
|
|
|
|
var message = "You're about to permanently delete this file, Do you want to Delete it ?";
|
|
$('.loading').show();
|
|
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: action_url,
|
|
data: formData,
|
|
success: function(data) {
|
|
$('.loading').hide();
|
|
var response = JSON.parse(data);
|
|
|
|
if (response.status) {
|
|
message = response.message;
|
|
}
|
|
deleteLetterPermanently(id, message);
|
|
}
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
function deleteLetterPermanently(id, message) {
|
|
var action_url = APP_SERVER_HOST_URL + 'getRTGData.php';
|
|
var formData = {
|
|
'action': 'DELETE_RTG_FORM_DATA',
|
|
'form_id': FORM_ID,
|
|
'member_id': MEMBER_ID,
|
|
'id': id
|
|
};
|
|
Swal.fire({
|
|
width: '40rem',
|
|
text: message,
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: 'Yes',
|
|
cancelButtonText: 'No'
|
|
}).then((result) => {
|
|
if (result.value) {
|
|
$('#client-file-' + id).show();
|
|
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: action_url,
|
|
data: formData,
|
|
success: function(data) {
|
|
$('.loading').hide();
|
|
$('#client-file-' + id).hide();
|
|
$('#saveloading-letter').hide();
|
|
var response = JSON.parse(data);
|
|
|
|
if (response.status) {
|
|
//alert(response.message);
|
|
Swal.fire({
|
|
position: 'top-end',
|
|
icon: 'success',
|
|
title: response.message,
|
|
showConfirmButton: false,
|
|
timer: 1500
|
|
})
|
|
getRTGFormData($('#view-client-files'));
|
|
}
|
|
}
|
|
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function readyDatatableFromServerSide(formData) {
|
|
|
|
var url = APP_SERVER_HOST_URL + 'getRTGData.php';
|
|
var table = $('#form-table');
|
|
table.DataTable().clear();
|
|
table.DataTable().destroy();
|
|
table.DataTable({
|
|
'pageLength': 25,
|
|
'processing': true,
|
|
|
|
'language': {
|
|
'processing': '<i class="fa fa-spinner fa-spin fa-3x fa-fw"></i><span class="sr-only">Loading...</span> '
|
|
},
|
|
'serverSide': true,
|
|
'serverMethod': 'POST',
|
|
'ajax': {
|
|
'url': url,
|
|
'data': formData
|
|
|
|
},
|
|
'columns': [
|
|
{ data: 'id' },
|
|
{ data: 'personal_info' },
|
|
{ data: 'dob' },
|
|
{ data: 'ssn' },
|
|
{ data: 'report_source_type' },
|
|
{ data: 'slected_letter' },
|
|
{ data: 'modified_on' },
|
|
{ data: 'next_section_date' },
|
|
{ data: 'action_btn' }
|
|
]
|
|
})
|
|
|
|
$('#rtg-formModal').show();
|
|
}
|
|
|
|
|
|
function setSelectedDataForRTGLetters() {
|
|
|
|
var data = letter_saved_data;
|
|
console.log('letter_data', data);
|
|
if (data) {
|
|
var form = $('#inputformId');
|
|
form.prepend('<input type="hidden" name="onload_form_id" value="' + letter_id + '"/>');
|
|
clientChangeEvent(data.report_type);
|
|
Object.keys(data).forEach(function(key) {
|
|
if (key && key.indexOf('image') == -1) {
|
|
if ($('select[name="' + key + '"]').length && !isEmptyString(data[key])) {
|
|
$('select[name="' + key + '"]').val(data[key]);
|
|
}
|
|
|
|
if ($('input[name="' + key + '"]').length && !isEmptyString(data[key])) {
|
|
$('input[name="' + key + '"]').val(data[key]);
|
|
}
|
|
|
|
if ($('textarea[name="' + key + '"]').length && !isEmptyString(data[key])) {
|
|
$('textarea[name="' + key + '"]').val(data[key]);
|
|
}
|
|
} else if (key && !isEmptyString(data[key])) {
|
|
|
|
var counter = key.replace("image", "");
|
|
var image_path = APP_SERVER_HOST_URL + 'webroot/' + data[key];
|
|
$('img#image' + counter + '-old-view').attr("src", image_path);
|
|
$("input#image" + counter + "new").val(image_path);
|
|
$('#label1' + counter).show();
|
|
$('img#image' + counter + '-old-view').show();
|
|
}
|
|
});
|
|
|
|
if (!isEmptyString(data.select)) {
|
|
$("#client-contact-id").val(data.select).trigger('change');
|
|
}
|
|
|
|
|
|
//$('#client-contact-id').trigger('change');
|
|
|
|
|
|
// $('select[name=select]').val(data.select).trigger('change');
|
|
// $('select[name=report_type]').val(data.report_type).trigger('change');
|
|
// $('input[name=first_name]').val(data.first_name);
|
|
// $('input[name=last_name]').val(data.last_name);
|
|
// $('input[name=street_no]').val(data.street_no);
|
|
// $('input[name=street_name]').val(data.street_name);
|
|
// $('input[name=credit_bureau_name_address]').val(data.credit_bureau_name_address);
|
|
// $('input[name=sincerely]').val(data.sincerely);
|
|
// $('input[name=city]').val(data.city);
|
|
// $('input[name=state]').val(data.state);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
function clientChangeEvent(report_type_id) {
|
|
|
|
$('.report_type-div').remove();
|
|
if (!report_type_id) {
|
|
// return false;
|
|
}
|
|
var client_div = $('#client-contact-id').parents('.form-group').first();
|
|
var client_div_area_col_10_next_col_2 = $('#client-contact-id').parents('.col-md-10').first().next('.col-md-2');
|
|
if (!client_div.next('div').hasClass('.report_type-div') && $('.report_type-div').length == 0) {
|
|
client_div.after(sourceTypeDropdown($('#client-contact-id'), report_type_id));
|
|
} else {
|
|
$('select[name=report_type]').val(report_type_id).trigger('change');
|
|
}
|
|
|
|
if ($('#client-contact-loading-img').next('button').length == 1) {
|
|
|
|
var rtg_button_html = "";
|
|
rtg_button_html += viewReportButton();
|
|
rtg_button_html += viewLetterStepsButton($('#client-contact-id').find(':selected').attr('data-id'));
|
|
|
|
if (rtg_button_html) {
|
|
$('#view-report-btn').remove();
|
|
|
|
if ($('#client-contact-loading-img').next('#view-client-files').length > 0) {
|
|
$('#client-contact-loading-img').next('#view-client-files').after(rtg_button_html);
|
|
} else {
|
|
$('#client-contact-loading-img').after(rtg_button_html);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$('#view-report-btn').show();
|
|
$('.report_type-div').show();
|
|
}
|
|
|
|
|
|
function setClientFilesButton() {
|
|
var rtg_button_html = "";
|
|
if (HAS_RTG_LS_FAX_ACCESS) {
|
|
$('#view-client-files').remove();
|
|
rtg_button_html = clientFilesButton()
|
|
}
|
|
|
|
$('#client-contact-loading-img').after(rtg_button_html);
|
|
}
|
|
|
|
function setAllpopupLink(json) {
|
|
|
|
if (HAS_RTG_ACCESS_PKG) {
|
|
ALL_BANK_ASSOC = json.bankAssoc;
|
|
// inquiries
|
|
INQ_WITH_COMPANY_ASSOC = json.inq_with_company;
|
|
LATE_PAYS_ALL = json.latepayList;
|
|
NEGATIVE_ALL = json.bankList;
|
|
LATE_PAYS_CATEGORY = json.latepayscategory;
|
|
NEGATIVE_CATEGORY = json.negativecategory;
|
|
INQ_ALL_ASSOC = json.inquries;
|
|
MAIN_PUBLIC_RECORDS = json.main_public_records;
|
|
PUBLIC_RECORD_CATEGORY_WISE = json.publicCategoryWiseResult;
|
|
ALL_PERSONAL_INFO = json.personal_info_assoc.all_key_name_list;
|
|
PERSONAL_INFO_CATEGORY_WISE = json.personal_info_assoc.key_name_list;
|
|
PERSONAL_INFO_ALL_CATEGORY = json.personal_info_assoc.all_category_list;
|
|
INQ_WITH_ADDRESS = json.inq_address_assoc;
|
|
PERSONAL_INFO_CATEGORY_WISE_ASSOC = json.personal_info_assoc.category_wise_assoc
|
|
PUBLIC_RECORD_ADDRESS_LIST = json.publicrecordAddressList;
|
|
|
|
var bank_assco = json.bankAssoc;
|
|
|
|
for (var i in bank_assco) {
|
|
RTG_BANK_ASSOC[i] = {
|
|
'value1': bank_assco[i].value1,
|
|
'value2': bank_assco[i].value2,
|
|
'value3': bank_assco[i].value3,
|
|
'value4': bank_assco[i].value4,
|
|
'value5': bank_assco[i].value5,
|
|
'value6': bank_assco[i].value6,
|
|
'isJson': bank_assco[i].isJson
|
|
};
|
|
}
|
|
|
|
// rtg_popup_dropdown.js
|
|
setInquiriesIcon();
|
|
setInquryList(json.inquries.key_date, json.inquries.key_name);
|
|
|
|
setLatePaysIcon();
|
|
setlatepaysList(LATE_PAYS_ALL);
|
|
|
|
setNegativeIcon();
|
|
setNegativeList(NEGATIVE_ALL);
|
|
|
|
setPublicRecordIcon();
|
|
setPublicRecordList(MAIN_PUBLIC_RECORDS);
|
|
|
|
setPersonalInfoIcon();
|
|
setPersonalInfoList(ALL_PERSONAL_INFO)
|
|
|
|
setNegativeCreditorIcon()
|
|
setNegativeCreditorList(NEGATIVE_ALL)
|
|
|
|
setInquiryCreditorIcon();
|
|
setInquriesCreditorList(json.inquries.key_date, json.inquries.key_name);
|
|
|
|
setLatePaysCreditorIcon();
|
|
setLatepaysCreditorList(LATE_PAYS_ALL);
|
|
|
|
setCreditorAccountIcon()
|
|
setCreditorAccountList(NEGATIVE_ALL);
|
|
|
|
|
|
setPublicRecordCreditorList(MAIN_PUBLIC_RECORDS);
|
|
|
|
setCreditorNameIcon();
|
|
//setCreditorAccountOnlyIcon();
|
|
|
|
//setNegativeCreditorAccountOnlyList(NEGATIVE_ALL);
|
|
|
|
// rtg_popup_dropdown.js
|
|
}
|
|
|
|
} |