/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
jQuery(document).on('click', '#contactmodal', function (e) {
if (jQuery('form#contact-dialog-form').valid() === false) {
return false;
} else {
$.ajax({
url: url + "contact/send",
type: 'post',
data: jQuery('form#contact-dialog-form input, form#contact-dialog-form textarea'),
dataType: 'json',
beforeSend: function () {
jQuery('button#contactmodal').button('loading');
},
complete: function () {
jQuery('button#contactmodal').button('reset');
jQuery('#contact-ly').find('input[type=text], textarea').each(function () {
jQuery(this).val('');
});
},
success: function (json) {
if (json.success == "success") {
//jQuery('#contactmodal-msg').html('
We have recieved your querry. Our Team will contact you shortly.
');
jQuery('#contact-ly').modal('hide')
jQuery('#contactmodal-modal').modal('show');
}
setTimeout(function () {
jQuery('#contactmodal-msg').empty(),
jQuery('#contactmodal-modal').modal('hide');
}, 5000);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
}
});
jQuery(document).on('click', '.ano_contact', function () {
var mid = jQuery(this).data('mid');
var mid_type = jQuery(this).data('midtype');
if(mid_type==2){
jQuery('#update-pp-title').html(' Request for Contact No');
jQuery('#contact_content_hide').hide();
} else if(mid_type==3){
jQuery('#update-pp-title').html(' Request for Email ID');
jQuery('#contact_content_hide').hide();
} else {
jQuery('#update-pp-title').html(' Legal Consultation');
jQuery('#contact_content_hide').show();
}
jQuery('input[name="contact_member_id"]').val(mid);
jQuery('input[name="contact_member_id_type"]').val(mid_type);
});
/*Deepak*/
$(document).ready(function () {
$("#consultationFee").keydown(function (e) {
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
(e.keyCode === 65 && (e.ctrlKey === true || e.metaKey === true)) ||
(e.keyCode >= 35 && e.keyCode <= 40)) {
return;
}
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
e.preventDefault();
}
});
$("#contact_contact_num").keydown(function (e) {
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
(e.keyCode === 65 && (e.ctrlKey === true || e.metaKey === true)) ||
(e.keyCode >= 35 && e.keyCode <= 40)) {
return;
}
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
e.preventDefault();
}
});
});
// send response and Save Draft
jQuery(document).on('click', '.sendemailresponse', function (e) {
if (jQuery('form#email_consultation_response').valid() === false) {
return false;
} else {
var consultation_response_id = jQuery('#consultation-response-id').val();
if (consultation_response_id) {
consultation_response_id = consultation_response_id;
} else {
consultation_response_id = 0;
}
var srtype = jQuery(this).data('srtype');
var consultation_title = jQuery('#consultation-title').val();
if (consultation_title) {
consultation_title = consultation_title;
} else {
consultation_title = '';
}
var soolegal_service_fee_total = jQuery('#soolegal-service-fee-total').val();
var soolegal_service_fee = jQuery('#soolegal-service-fee').val();
var legalProcedureDescription = jQuery('form#email_consultation_response').find('textarea.response-text').val();
if (legalProcedureDescription) {
legalProcedureDescription = legalProcedureDescription;
} else {
legalProcedureDescription = '';
}
var consult_type = jQuery('form#email_consultation_response').find('.check-condition:checked').val();
var flag = jQuery('form#email_consultation_response').find('.advance-payment-request:checked').val();
var consultation_advance_fee = jQuery('form#email_consultation_response').find('#advance_fee_total').val();
var request_time = jQuery('form#email_consultation_response').find('#request-time').val();
if (request_time) {
request_time = request_time;
} else {
request_time = 0;
}
//var consult_ID = jQuery('form#email_consultation_response').find('#consult_ID').val();
var consultationFee = jQuery('form#email_consultation_response').find('#consultationFee').val();
//var consultationEmail = jQuery('form#email_consultation_response').find('#consultationEmail').val();
var consult_ID = jQuery(this).data('consultaionid');
var consultationEmail = jQuery(this).data('consultaionemail');
if (consult_ID == "" || consultationFee == "" || consultationEmail == "") {
jQuery('#sendemailresponse-msg').html('*Please fill in the details below.
');
setTimeout(function () {
jQuery('#sendemailresponse-msg').html('');
}, 3000);
} else {
var formData = new FormData();
formData.append('consultation_response_id', consultation_response_id);
formData.append('srtype', srtype);
formData.append('consultation_title', consultation_title);
formData.append('soolegal_service_fee_total', soolegal_service_fee_total);
formData.append('soolegal_service_fee', soolegal_service_fee);
formData.append('consultID', consult_ID);
formData.append('consultationFee', consultationFee);
formData.append('consultationEmail', consultationEmail);
formData.append('content', legalProcedureDescription);
formData.append('consult_type', consult_type);
formData.append('flag', flag);
formData.append('consultation_advance_fee', consultation_advance_fee);
formData.append('request_time', request_time);
jQuery('form#email_consultation_response').find('.multi-attachment-title').each(function () {
formData.append('attachment_title[]', jQuery(this).val());
});
var inputs = jQuery('form#email_consultation_response').find('.multi-attachment-files');
jQuery.each(inputs, function (obj, v) {
var file = v.files[0];
formData.append('attachment_url[]', file);
});
$.ajax({
url: url + "contact/sendconsultationResponse",
type: 'post',
data: formData,
processData: false,
contentType: false,
dataType: 'json',
beforeSend: function () {
jQuery('button.sendemailresponse').button('loading');
},
complete: function () {
jQuery('button.sendemailresponse').button('reset');
jQuery('#email_consultation_response').find('input[type=text], textarea').each(function () {
jQuery(this).val('');
});
jQuery('#legal-consultation-response').modal('hide');
},
success: function (json) {
jQuery('#sendemailresponse-msg').html('Save legal consult successfully.
');
setTimeout(function () {
if (srtype == 1) {
jQuery('#show-legal-consultation-summary').modal('show');
jQuery('#sendemailresponse-msg').empty();
$.ajax({
url: url + "contact/consultationResponse",
type: 'post',
data: {consultID: json.contact_id},
dataType: 'html',
beforeSend: function () {
jQuery('span#render-send-document-response').html('
');
},
success: function (html) {
jQuery('span#render-send-document-response').html(html);
jQuery('.richtext').summernote('code');
jQuery("input.multi-attachment-files").filestyle({buttonText: "Choose file (pdf,xls,doc)"}, {accept: ".pdf, .xlsx, .xls, .doc, .docx"});
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
//
} else {
location.reload();
}
}, 500);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
}
}
});
// open legal consult card summary
jQuery(document).on('click', '#legal-consult-card-summary', function () {
var consultaion_id = jQuery(this).data('consultaionid');
jQuery('#show-Consultation-response-Div').modal('hide');
setTimeout(function () {
jQuery('#show-legal-consultation-summary').modal('show');
$.ajax({
url: url + "contact/consultationResponse",
type: 'post',
data: {consultID: consultaion_id},
dataType: 'html',
beforeSend: function () {
jQuery('span#render-send-document-response').html('
');
},
success: function (html) {
jQuery('span#render-send-document-response').html(html);
jQuery('.richtext').summernote('code');
jQuery("input.multi-attachment-files").filestyle({buttonText: "Choose file (pdf,xls,doc)"}, {accept: ".pdf, .xlsx, .xls, .doc, .docx"});
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
}, 500);
})
jQuery(document).on('click', '.ano_contact', function () {
var mid = jQuery(this).data('mid');
jQuery('input[name="contact_member_id"]').val(mid);
});
jQuery(document).on('click', '.showConsultBTN', function () {
var status = jQuery(this).data('documenttype');
$.ajax({
url: url + "contact/getSingle_ConsultRespaose",
type: 'post',
data: {consultID: $(this).data('id'), status: status},
dataType: 'html',
beforeSend: function () {
jQuery('#responsive_div_DATA').html('
');
},
success: function (html) {
jQuery('#responsive_div_DATA').html(html);
jQuery('[data-countdown]').each(function () {
var $this = $(this), finalDate = $(this).data('countdown');
$(this).countdown(finalDate, function (event) {
$(this).html(event.strftime('%D days %H:%M:%S'));
});
});
jQuery('.richtext').summernote('code');
jQuery("input.multi-attachment-files").filestyle({buttonText: "Choose file (pdf,xls,doc)"}, {accept: ".pdf, .xlsx, .xls, .doc, .docx"});
}
});
});
// edit consultation Response
jQuery(document).on('click', '.get_consultaion_email', function () {
jQuery('span#consultation-response-details').html('
');
var consult_ID = $(this).data('id');
var email = $(this).data('email');
var clientconsultation = $(this).data('clientconsultation');
if (clientconsultation != '' && (clientconsultation == 1)) {
$.ajax({
url: url + "clients/makeclientuser",
type: 'post',
data: {consultID: $(this).data('id'), email: email},
dataType: 'html',
success: function (html) {
}
});
}
jQuery('button.sendemailresponse').data('consultaionid', consult_ID);
jQuery('button.sendemailresponse').data('consultaionemail', email);
var consultation_id = jQuery(this).data('consultationid');
var backedit_id = jQuery(this).data('backeditid');
if (backedit_id == 2) {
jQuery('#show-legal-consultation-summary').modal('hide');
}
var editdoc = $(this).data('editdoc');
if (editdoc) {
editdoc = editdoc;
} else {
editdoc = 0;
}
jQuery('#show-Consultation-response-Div').modal('hide');
setTimeout(function () {
jQuery('#legal-consultation-response').modal('show');
$.ajax({
url: url + "contact/editconsultationResponse",
type: 'post',
data: {consultID: consult_ID, email: email, consultation_id: consultation_id},
dataType: 'html',
beforeSend: function () {
jQuery('span#consultation-response-details').html('
');
},
success: function (html) {
jQuery('span#consultation-response-details').html(html);
jQuery('.richtext').summernote('code');
jQuery("input.multi-attachment-files").filestyle({buttonText: "Choose file (pdf,xls,doc)"}, {accept: ".pdf, .xlsx, .xls, .doc, .docx"});
jQuery('button.sendemailresponse').data('consultaionid', consult_ID);
jQuery('button.sendemailresponse').data('consultaionemail', email);
//jQuery('form#email_consultation_response').find('#consult_ID').val(consult_ID);
//jQuery('form#email_consultation_response').find('#consultationEmail').val(email);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
}, 500);
});
jQuery(document).on('blur', '#consultationFee', function () {
var finalFee = 0;
var total = 0;
var tax = 0;
var consultationFee = jQuery('#consultationFee').val();
finalFee = ((consultationFee * 9) / 100);
var taxVal = jQuery('select#tax-value > option:selected').data('taxtv');
var tax = ((consultationFee * taxVal) / 100);
total = (parseFloat(consultationFee) + parseFloat(finalFee) + parseFloat(tax));
total = total ? total : 0;
jQuery('#soolegal-service-fee').val(finalFee);
jQuery('#soolegal-service-fee-total').val(Math.round(total * 100) / 100);
// set advance fee
var advanceFee = 0;
var finalAdvanceFee = 0;
var advanceFee = jQuery('input.advance-payment-request:checked').val();
var totalFee = total;
finalAdvanceFee = ((totalFee * advanceFee) / 100);
jQuery('#advance_fee_total').val(Math.round(finalAdvanceFee * 100) / 100);
});
jQuery(document).on('change', '#tax-value', function () {
var finalFee = 0;
var total = 0;
var tax = 0;
var consultationFee = jQuery('#consultationFee').val();
finalFee = ((consultationFee * 9) / 100);
var taxVal = jQuery('select#tax-value > option:selected').data('taxtv');
var tax = ((consultationFee * taxVal) / 100);
total = (parseFloat(consultationFee) + parseFloat(finalFee) + parseFloat(tax));
total = total ? total : 0;
jQuery('#soolegal-service-fee').val(finalFee);
jQuery('#soolegal-service-fee-total').val(Math.round(total * 100) / 100);
// set advance fee
var advanceFee = 0;
var finalAdvanceFee = 0;
var advanceFee = jQuery('input.advance-payment-request:checked').val();
var totalFee = total;
finalAdvanceFee = ((totalFee * advanceFee) / 100);
jQuery('#advance_fee_total').val(Math.round(finalAdvanceFee * 100) / 100);
});
jQuery(document).on('change', '.advance-payment-request', function () {
var advanceFee = 0;
var finalAdvanceFee = 0;
var advanceFee = jQuery(this).val();
var totalFee = jQuery('#soolegal-service-fee-total').val();
finalAdvanceFee = ((totalFee * advanceFee) / 100);
jQuery('#advance_fee_total').val(Math.round(finalAdvanceFee * 100) / 100);
});
// add more and remove fuctionality
jQuery(document).on('click', 'a.removelglattach', function () {
var lglattchid = jQuery(this).data('lglattchid');
jQuery("#lglcounter" + lglattchid).remove();
});
// add more attachment on legal Procedures
var addMoreCounter = 1;
jQuery(document).on('click', '#add-more-lgl-atc', function () {
var bindHtml = '';
bindHtml += '';
bindHtml += '
';
bindHtml += '
';
bindHtml += '';
bindHtml += '
';
bindHtml += '
';
bindHtml += '
';
bindHtml += '
';
bindHtml += ' ';
bindHtml += '
';
bindHtml += '
';
bindHtml += '
';
bindHtml += '
';
bindHtml += '
';
bindHtml += '
';
jQuery("span#render-more-attachment").prepend(bindHtml);
jQuery("input.multi-attachment-files").filestyle({buttonText: "Choose file (pdf,xls,doc)"}, {accept: ".pdf, .xlsx, .xls, .doc, .docx"});
addMoreCounter++;
});
//delete legal attachment
jQuery(document).on('click', '.delete-legal-attachment', function () {
lgl_attachment_id = jQuery(this).data('lglattchid');
jQuery('form#delete-legal-consultation-form').find('button#delete-legal-consultation-item').data('lglaid', lgl_attachment_id);
});
jQuery(document).on('click', '#delete-legal-consultation-item', function () {
var lgl_attachment_id = jQuery(this).data('lglaid');
delete_attachment(lgl_attachment_id);
});
// legal consultation delete document
function delete_attachment(attachment_id) {
$.ajax({
url: url + "contact/deleteLegalConsultationAttachment",
type: 'post',
data: {attachment_id: attachment_id},
dataType: 'json',
beforeSend: function () {
jQuery('button#delete-legal-consultation-item').button('loading');
},
complete: function () {
jQuery('button#delete-legal-consultation-item').button('reset');
jQuery('#delete-legal-consultation').modal('hide');
},
success: function (json) {
$('#delete-lgl-aid-' + attachment_id).remove();
$('#send-delete-lgl-aid-' + attachment_id).remove();
}
});
}
//
jQuery(document).on('click', '.delete-consultation-response', function () {
var consult_id = jQuery(this).data('consultid');
jQuery('form#delete-full-legal-consultation-form').find('button#delete-full-legal-consultation-item').data("lgldocid", consult_id);
});
jQuery(document).on('click', '#delete-full-legal-consultation-item', function () {
var consultation_response_id = jQuery(this).data('lgldocid');
delete_consultation(consultation_response_id);
});
function delete_consultation(consultation_response_id) {
if (consultation_response_id) {
$.ajax({
url: url + "contact/deleteLegalConsultation",
type: 'post',
data: {consultation_response_id: consultation_response_id},
dataType: 'json',
beforeSend: function () {
jQuery('button#delete-full-legal-consultation-item').button('loading');
},
complete: function () {
jQuery('button#delete-full-legal-consultation-item').button('reset');
jQuery('#delete-full-legal-consultation').modal('hide');
},
success: function (json) {
$('#consultation-res-' + consultation_response_id).remove();
}
});
}
}
// send email legal response
jQuery(document).on('click', '#send-email-legal-response', function () {
var legal_consult_res_id = jQuery(this).data('legalconsultresid');
if (legal_consult_res_id) {
$.ajax({
url: url + "contact/sendConsultationResponseMail",
type: 'post',
data: {legal_consult_res_id: legal_consult_res_id},
dataType: 'json',
beforeSend: function () {
jQuery('button#send-email-legal-response').button('loading');
},
complete: function () {
jQuery('button#send-email-legal-response').button('reset');
},
success: function (json) {
jQuery('#send-email-legal-response-msg').html('Legal consultation mail has been successfully!
');
setTimeout(function () {
jQuery('#show-legal-consultation-summary').modal('hide'),
jQuery('#send-email-legal-response-msg').empty();
}, 3000);
}
});
}
});
jQuery(document).on("click", ".check-condition", function () {
/*jQuery('input#consultationFee').
jQuery('input#consultationFee').
jQuery('input#consultationFee').
jQuery('input#consultationFee').
jQuery('input#consultationFee').
jQuery('input#consultationFee').
jQuery('input#consultationFee').*/
var get_amt_type = jQuery(this).val();
if (get_amt_type == 2) {
jQuery('span#render-request-time').html('');
jQuery("span#render-consult-details-final").html("");
} else {
jQuery('span#render-request-time').html('');
// render data
$.ajax({
url: url + "contact/checkCondition",
type: 'post',
dataType: 'html',
success: function (html) {
jQuery("span#render-consult-details-final").html(html);
jQuery('.richtext').summernote('code');
jQuery("input.multi-attachment-files").filestyle({buttonText: "Choose file (pdf,xls,doc)"}, {accept: ".pdf, .xlsx, .xls, .doc, .docx"});
}
});
}
var bindHTML = '';
bindHTML += '';
bindHTML += '
';
bindHTML += '
';
bindHTML += '
';
bindHTML += 'Advance Fee ';
bindHTML += '';
bindHTML += '
';
bindHTML += '
';
bindHTML += '
';
jQuery('span#render-payment-type').html(bindHTML)
});
// send-final-consultation
jQuery(document).on('click', '.send-final-consultation', function () {
var consult_id = jQuery(this).data('finalconsultid');
$.ajax({
url: url + "contact/sendFinalResponse",
type: 'post',
data: {consult_id: consult_id},
dataType: 'html',
beforeSend: function () {
jQuery('#final-legal-response').html('
');
},
success: function (html) {
jQuery('#final-legal-response').html(html);
jQuery("input.multi-attachment-files").filestyle({buttonText: "Choose file (pdf,xls,doc)"}, {accept: ".pdf, .xlsx, .xls, .doc, .docx"});
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});