| Line 489... |
Line 489... |
| 489 |
var currentStatus = $('#editStatus').val();
|
489 |
var currentStatus = $('#editStatus').val();
|
| 490 |
if (currentStatus === 'notInterested') {
|
490 |
if (currentStatus === 'notInterested') {
|
| 491 |
submitLeadEdit();
|
491 |
submitLeadEdit();
|
| 492 |
return;
|
492 |
return;
|
| 493 |
}
|
493 |
}
|
| - |
|
494 |
// Non-sales assignees (BGC / other internal hand-offs) don't need
|
| - |
|
495 |
// geo or a beat-day — the lead just routes to their queue. Skip the
|
| - |
|
496 |
// geo gate and submit straight through, same as the legacy flow.
|
| - |
|
497 |
var assigneeId = parseInt($('#assignTo').val(), 10);
|
| - |
|
498 |
var isSalesAssignee = !isNaN(assigneeId)
|
| - |
|
499 |
&& typeof salesUserIds !== 'undefined'
|
| - |
|
500 |
&& salesUserIds.indexOf(assigneeId) !== -1;
|
| - |
|
501 |
if (!isSalesAssignee) {
|
| - |
|
502 |
submitLeadEdit();
|
| - |
|
503 |
return;
|
| - |
|
504 |
}
|
| 494 |
if (clickedBtn.data('geoChecking')) return;
|
505 |
if (clickedBtn.data('geoChecking')) return;
|
| 495 |
clickedBtn.data('geoChecking', true);
|
506 |
clickedBtn.data('geoChecking', true);
|
| 496 |
doAjaxRequestHandler(
|
507 |
doAjaxRequestHandler(
|
| 497 |
context + "/lead-geo/check/" + leadId,
|
508 |
context + "/lead-geo/check/" + leadId,
|
| 498 |
"GET",
|
509 |
"GET",
|
| Line 586... |
Line 597... |
| 586 |
}
|
597 |
}
|
| 587 |
|
598 |
|
| 588 |
|
599 |
|
| 589 |
if (editStatus == "followUp") {
|
600 |
if (editStatus == "followUp") {
|
| 590 |
leadActivityData['communicationType'] = communicationType
|
601 |
leadActivityData['communicationType'] = communicationType
|
| - |
|
602 |
var assigneeIdForBeat = parseInt(assignTo, 10);
|
| - |
|
603 |
var isSalesAssigneeForBeat = !isNaN(assigneeIdForBeat)
|
| - |
|
604 |
&& typeof salesUserIds !== 'undefined'
|
| - |
|
605 |
&& salesUserIds.indexOf(assigneeIdForBeat) !== -1;
|
| 591 |
var beatVal = $('#beatDate').val();
|
606 |
var beatVal = $('#beatDate').val();
|
| 592 |
// Gate: for followUp, the lead must land on an upcoming beat of the
|
607 |
// Beat-day gate only applies to sales assignees. Non-sales
|
| 593 |
// assignee. If no beat is picked (or the assignee has no upcoming
|
608 |
// (BGC / other) hand-offs are just routed to the user's queue
|
| 594 |
// beat slots at all), block the submit with a clear message.
|
609 |
// without a beat attachment — same as the legacy flow.
|
| - |
|
610 |
if (isSalesAssigneeForBeat) {
|
| 595 |
if (!beatVal) {
|
611 |
if (!beatVal) {
|
| 596 |
var hasBadges = $('#beatBadges .beat-badge').length > 0;
|
612 |
var hasBadges = $('#beatBadges .beat-badge').length > 0;
|
| 597 |
if (!hasBadges) {
|
613 |
if (!hasBadges) {
|
| 598 |
alert('No upcoming beat is available for this assignee. Cannot schedule the lead until they have a beat.');
|
614 |
alert('No upcoming beat is available for this assignee. Cannot schedule the lead until they have a beat.');
|
| 599 |
} else {
|
615 |
} else {
|
| 600 |
alert('Please select a beat date for the assignee before submitting.');
|
616 |
alert('Please select a beat date for the assignee before submitting.');
|
| - |
|
617 |
}
|
| - |
|
618 |
return;
|
| 601 |
}
|
619 |
}
|
| 602 |
return;
|
620 |
var beatDate = beatVal.split('|')[0];
|
| - |
|
621 |
leadActivityData['scheldule'] = beatDate + 'T12:00:00';
|
| - |
|
622 |
leadActivityData['beatSelection'] = beatVal;
|
| 603 |
}
|
623 |
}
|
| 604 |
var beatDate = beatVal.split('|')[0];
|
- |
|
| 605 |
leadActivityData['scheldule'] = beatDate + 'T12:00:00';
|
- |
|
| 606 |
leadActivityData['beatSelection'] = beatVal;
|
- |
|
| 607 |
}
|
624 |
}
|
| 608 |
|
625 |
|
| 609 |
console.log(leadActivityData);
|
626 |
console.log(leadActivityData);
|
| 610 |
if (confirm("Are you sure you want to add lead!") == true) {
|
627 |
if (confirm("Are you sure you want to add lead!") == true) {
|
| 611 |
doPostAjaxRequestWithJsonHandler(context + "/editLead", JSON.stringify(leadActivityData), function (response) {
|
628 |
doPostAjaxRequestWithJsonHandler(context + "/editLead", JSON.stringify(leadActivityData), function (response) {
|
| Line 1013... |
Line 1030... |
| 1013 |
|
1030 |
|
| 1014 |
function fetchBeatDates() {
|
1031 |
function fetchBeatDates() {
|
| 1015 |
var salesAuthId = $('#assignTo').val();
|
1032 |
var salesAuthId = $('#assignTo').val();
|
| 1016 |
if (!salesAuthId || !leadId) return;
|
1033 |
if (!salesAuthId || !leadId) return;
|
| 1017 |
|
1034 |
|
| - |
|
1035 |
// Beat slots only make sense for sales assignees. BGC / other internal
|
| - |
|
1036 |
// hand-offs skip the entire beat panel (and the visit-request CTA that
|
| - |
|
1037 |
// sits inside it). Mirrors the server-side carve-out in /editLead.
|
| - |
|
1038 |
var assigneeIntId = parseInt(salesAuthId, 10);
|
| - |
|
1039 |
var isSalesAssigneeFetch = !isNaN(assigneeIntId)
|
| - |
|
1040 |
&& typeof salesUserIds !== 'undefined'
|
| - |
|
1041 |
&& salesUserIds.indexOf(assigneeIntId) !== -1;
|
| - |
|
1042 |
if (!isSalesAssigneeFetch) {
|
| - |
|
1043 |
$('#beatBadges').empty();
|
| - |
|
1044 |
$('#beatDate').val('');
|
| - |
|
1045 |
$('#beatDateSelection').hide();
|
| - |
|
1046 |
return;
|
| - |
|
1047 |
}
|
| - |
|
1048 |
|
| 1018 |
var badgesDiv = $('#beatBadges');
|
1049 |
var badgesDiv = $('#beatBadges');
|
| 1019 |
badgesDiv.html('<span style="color:#999; font-size:12px;">Loading beats...</span>');
|
1050 |
badgesDiv.html('<span style="color:#999; font-size:12px;">Loading beats...</span>');
|
| 1020 |
$("#beatDateSelection").show();
|
1051 |
$("#beatDateSelection").show();
|
| 1021 |
$('#beatDate').val('');
|
1052 |
$('#beatDate').val('');
|
| 1022 |
|
1053 |
|