223 lines
10 KiB
JavaScript
223 lines
10 KiB
JavaScript
function sertgAffiliateFormList(elem){
|
|
var employee_id = $('input[name=employee_id]').val()
|
|
var formData = {
|
|
'action':'CLIENT_FILES_BY_CLIENT_CATEGORY',
|
|
'member_id': $('input[name=member_id]').val(),
|
|
'form_afiiliate_id':$(elem).val(),
|
|
'employee_id':employee_id
|
|
};
|
|
|
|
$('#affiliate-loader-form').show();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: EPICVELOCITY_AJAX_URL,
|
|
data: formData,
|
|
success: function (data) {
|
|
$('#affiliate-loader-form').hide();
|
|
var data = JSON.parse(data);
|
|
|
|
//console.log('member_id');
|
|
//console.log('dashboard_data',data);
|
|
var table = $('#form-table').DataTable();
|
|
|
|
table.clear().draw();
|
|
table.order([6,'desc'])
|
|
$.each(data, function (index, json) {
|
|
var next_section_date = "";
|
|
if(json.next_section_date){
|
|
next_section_date = moment(json.next_section_date).format('YYYY-MM-DD')
|
|
}
|
|
|
|
|
|
var rows = [json.id, json.personal_info, json.dob, json.ssn,json.source_type, json.slected_letter, moment(json.created_on).format('YYYY-MM-DD'),next_section_date, '<a href="javascript:;" onclick="deleteLetter('+json.letter_id+',this)" data-toggle="tooltip" title="Delete" data-id="' + json.id + '" id="formDelete_"' + json.id + '"><span style="color:#dd4b39;padding-left:10px;font-size:18px;"><i class="fa fa-trash" aria-hidden="true"></i></span></a>' + ' ' + '<a href="javascript:;" onclick="letterLoad('+json.letter_id+')" data-toggle="tooltip" title="Load" data-id="' + json.id + '" id="formLoad_"' + json.id + '"><span style="color:#00a65a;padding-left:5px;font-size:18px;"><i class="fa fa-external-link-square" aria-hidden="true"></i></span></a>'];
|
|
table.row.add(rows).draw();
|
|
});
|
|
|
|
|
|
//console.log(get_page);
|
|
// if (action === 1) {
|
|
// //console.log(info);
|
|
// if (info === get_page) {
|
|
// table.page(info - 1).draw('page');
|
|
// } else {
|
|
// table.page(info).draw('page');
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
function sertgEmployeeFormList(elem){
|
|
var formData = {
|
|
'action':'CLIENT_FILES_BY_CLIENT_CATEGORY',
|
|
'member_id': $('input[name=member_id]').val(),
|
|
'form_employee_id':$(elem).val()
|
|
};
|
|
$('#employee-loader-form').show();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: EPICVELOCITY_AJAX_URL,
|
|
data: formData,
|
|
success: function (data) {
|
|
$('#employee-loader-form').hide();
|
|
var data = JSON.parse(data);
|
|
|
|
//console.log('member_id');
|
|
|
|
var table = $('#form-table').DataTable();
|
|
|
|
table.clear().draw();
|
|
table.order([6,'desc'])
|
|
$.each(data, function (index, json) {
|
|
var next_section_date = "";
|
|
if(json.next_section_date){
|
|
next_section_date = moment(json.next_section_date).format('YYYY-MM-DD')
|
|
}
|
|
|
|
|
|
var rows = [json.id, json.personal_info, json.dob, json.ssn,json.source_type, json.slected_letter, moment(json.created_on).format('YYYY-MM-DD'),next_section_date, '<a href="javascript:;" onclick="deleteLetter('+json.letter_id+',this)" data-toggle="tooltip" title="Delete" data-id="' + json.id + '" id="formDelete_"' + json.id + '"><span style="color:#dd4b39;padding-left:10px;font-size:18px;"><i class="fa fa-trash" aria-hidden="true"></i></span></a>' + ' ' + '<a href="javascript:;" onclick="letterLoad('+json.letter_id+')" data-toggle="tooltip" title="Load" data-id="' + json.id + '" id="formLoad_"' + json.id + '"><span style="color:#00a65a;padding-left:5px;font-size:18px;"><i class="fa fa-external-link-square" aria-hidden="true"></i></span></a>'];
|
|
table.row.add(rows).draw();
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
|
|
function affiliateFormShow(elem){
|
|
$('.form-affiliate-list').hide();
|
|
$('.form-employee-list').hide();
|
|
if($(elem).prop('checked')){
|
|
if($(elem).val() == 2){
|
|
$('#client_type_id').val($(elem).val());
|
|
$('#affiliate_client_type_id').val(-1);
|
|
$('#affiliate-loader-form').show();
|
|
var formData = {'action':'AFFILIATE_LIST','employee_id':0};
|
|
//formData[''] =
|
|
$.ajax({
|
|
type: "POST",
|
|
data: formData,
|
|
url: AFFILIATE_URL,
|
|
success: function (response) {
|
|
$('#affiliate-loader-form').hide();
|
|
var show_client_checkbox = $('input[name=show_client_checkbox]');
|
|
response = JSON.parse(response);
|
|
console.log(response);
|
|
var s = $('select[name=form_affiliate_client_id]');
|
|
s.empty()
|
|
//$('<option />', {value: -1, text: "All"}).appendTo(s);
|
|
if(response.iscmsuser){
|
|
s.html(response.affilistHTML)
|
|
|
|
}else{
|
|
$('<option />', {value: -1, text: "All"}).appendTo(s);
|
|
|
|
for(var val in response.affiliateList) {
|
|
$('<option />', {value: val, text: response.affiliateList[val]}).appendTo(s);
|
|
}
|
|
}
|
|
|
|
s.trigger('change')
|
|
$('.form-affiliate-list').show();
|
|
|
|
|
|
$('select[name=affiliate_client_id]').attr('disabled',false);
|
|
if(response.employee_affiliste_list && show_client_checkbox.prop('checked')){
|
|
$('select[name=affiliate_client_id]').html(response.employee_affiliste_list);
|
|
}
|
|
},error: function () {
|
|
$(elem).next('img').hide();
|
|
alert("Failed. Try again later.111");
|
|
}
|
|
});
|
|
}else if($(elem).val() == 1){
|
|
$('#employee-loader-form').show();
|
|
var formData = {
|
|
'action': 'EMPLOYEE_LIST'
|
|
};
|
|
$.ajax({
|
|
type: "POST",
|
|
data: formData,
|
|
url: AFFILIATE_URL,
|
|
success: function (response) {
|
|
$('#employee-loader-form').hide();
|
|
response = JSON.parse(response);
|
|
|
|
var s = $('select[name=form_dropdown_employee_id]');
|
|
s.empty()
|
|
$('<option />', {
|
|
value: -1,
|
|
text: "All"
|
|
}).appendTo(s);
|
|
for (var val in response.affiliateList) {
|
|
var attr = {
|
|
value: val,
|
|
text: response.affiliateList[val]
|
|
}
|
|
var selected = "";
|
|
|
|
$('<option />', attr).appendTo(s);
|
|
}
|
|
s.trigger('change')
|
|
|
|
$('.form-employee-list').show();
|
|
$('select[name=affiliate_client_id]').attr('disabled', false);
|
|
|
|
|
|
|
|
},
|
|
error: function () {
|
|
$(elem).next('img').hide();
|
|
alert("Failed. Try again later.111");
|
|
}
|
|
});
|
|
} else if($(elem).val() == 3){
|
|
var formData = {
|
|
'action':'GET_CLIENT_FILES_LIST_POPUP',
|
|
'member_id': $('input[name=member_id]').val(),
|
|
'employee_id': $('input[name=employee_id]').val(),
|
|
'form_employee_id':0
|
|
};
|
|
|
|
$('#all-loader-form').show();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: EPICVELOCITY_AJAX_URL,
|
|
data: formData,
|
|
success: function (data) {
|
|
$('#all-loader-form').hide();
|
|
var data = JSON.parse(data);
|
|
|
|
//console.log('member_id');
|
|
console.log('dashboard_data',data);
|
|
var table = $('#form-table').DataTable();
|
|
|
|
table.clear().draw();
|
|
table.order([6,'desc'])
|
|
$.each(data, function (index, json) {
|
|
var next_section_date = "";
|
|
if(json.next_section_date){
|
|
next_section_date = moment(json.next_section_date).format('YYYY-MM-DD')
|
|
}
|
|
|
|
|
|
var rows = [json.id, json.personal_info, json.dob, json.ssn,json.source_type, json.slected_letter, moment(json.created_on).format('YYYY-MM-DD'),next_section_date, '<a href="javascript:;" onclick="deleteLetter('+json.letter_id+',this)" data-toggle="tooltip" title="Delete" data-id="' + json.id + '" id="formDelete_"' + json.id + '"><span style="color:#dd4b39;padding-left:10px;font-size:18px;"><i class="fa fa-trash" aria-hidden="true"></i></span></a>' + ' ' + '<a href="javascript:;" onclick="letterLoad('+json.letter_id+')" data-toggle="tooltip" title="Load" data-id="' + json.id + '" id="formLoad_"' + json.id + '"><span style="color:#00a65a;padding-left:5px;font-size:18px;"><i class="fa fa-external-link-square" aria-hidden="true"></i></span></a>'];
|
|
table.row.add(rows).draw();
|
|
});
|
|
|
|
|
|
}
|
|
|
|
});
|
|
}
|
|
}
|
|
} |