Changes
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m20s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m20s
Details
This commit is contained in:
parent
cc0b8144d3
commit
b6121f9980
|
|
@ -126,64 +126,28 @@ class AdherencePobDriveExport
|
||||||
'Days Daily Target Met',
|
'Days Daily Target Met',
|
||||||
'Target Status',
|
'Target Status',
|
||||||
];
|
];
|
||||||
$summaryHelp = [
|
|
||||||
'No. of Total W',
|
|
||||||
'Count of Active TMs',
|
|
||||||
'No. of Total W x Count of Active TMs',
|
|
||||||
'Sum of count of all Days',
|
|
||||||
'Total TMs Qualified / Month Target (POBs)',
|
|
||||||
'No. of Unique Chemists with ≥₹15k POB Value',
|
|
||||||
'No. of Days on which Daily Target is achieved',
|
|
||||||
'If Month Target achieved = Achieved, If Month Target not achieved = In Progress',
|
|
||||||
];
|
|
||||||
|
|
||||||
$dayStart = count($identity) + 1;
|
$dayStart = count($identity) + 1;
|
||||||
$summaryStart = $dayStart + count($this->dayTemplate);
|
$summaryStart = $dayStart + count($this->dayTemplate);
|
||||||
$lastCol = $summaryStart + count($summary) - 1;
|
$lastCol = $summaryStart + count($summary) - 1;
|
||||||
|
|
||||||
$sheet->setCellValue('A1', 'Adherence Pack POB Drive – ABM – ' . $this->month);
|
$sheet->setCellValue('A1', 'Adherence Pack POB Drive – ABM');
|
||||||
$sheet->mergeCells('A1:' . $this->col($lastCol) . '1');
|
$sheet->setCellValue('A3', 'Data of no. of chemists with Adherence Pack POB ≥ ₹15,000 will be added by Smartian App');
|
||||||
$sheet->setCellValue('A3', 'Legend: pink = vacant HQ; green day = working day; grey day = holiday.');
|
|
||||||
$sheet->mergeCells('A3:' . $this->col($lastCol) . '3');
|
|
||||||
$sheet->setCellValue('A5', 'Data of no. of chemists with Adherence Pack POB ≥ ₹15,000');
|
|
||||||
$sheet->setCellValue('J5', 'Day type (W / H) →');
|
|
||||||
foreach ($this->dayTemplate as $index => $day) {
|
foreach ($this->dayTemplate as $index => $day) {
|
||||||
$sheet->setCellValue($this->col($dayStart + $index) . '5', $day['type'] === 'H' ? 'H' : 'W');
|
$sheet->setCellValue($this->col($dayStart + $index) . '4', $day['type'] === 'H' ? 'H' : 'W');
|
||||||
}
|
}
|
||||||
|
|
||||||
$help = [
|
|
||||||
'Zone',
|
|
||||||
'Region',
|
|
||||||
'Area',
|
|
||||||
'as it is',
|
|
||||||
'ABM Emp Name',
|
|
||||||
'ABM Emp Code',
|
|
||||||
'RBM Name',
|
|
||||||
'ABM Email ID',
|
|
||||||
'Count of Active TMs',
|
|
||||||
'Blank Remarks Column',
|
|
||||||
];
|
|
||||||
$this->writeValues($sheet, 6, $help);
|
|
||||||
if (count($this->dayTemplate) > 0) {
|
|
||||||
$sheet->setCellValue($this->col($dayStart) . '6', 'No. of TMs with at least 1 Chemist with ≥₹15k POB Value');
|
|
||||||
if (count($this->dayTemplate) > 1) {
|
|
||||||
$sheet->mergeCells($this->col($dayStart) . '6:' . $this->col($summaryStart - 1) . '6');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->writeValues($sheet, 6, $summaryHelp, $summaryStart);
|
|
||||||
|
|
||||||
$headers = $identity;
|
$headers = $identity;
|
||||||
foreach ($this->dayTemplate as $day) {
|
foreach ($this->dayTemplate as $day) {
|
||||||
$headers[] = $this->dayHeader($day['label']);
|
$headers[] = $this->dayHeader($day['label']);
|
||||||
}
|
}
|
||||||
$headers = array_merge($headers, $summary);
|
$headers = array_merge($headers, $summary);
|
||||||
$this->writeValues($sheet, 7, $headers);
|
$this->writeValues($sheet, 5, $headers);
|
||||||
$this->styleHeaderRow($sheet, 7, $lastCol, count($identity), $summaryStart);
|
$this->styleHeaderRow($sheet, 5, $lastCol, count($identity), $summaryStart);
|
||||||
$sheet->getStyle('A5')->getFont()->setName('Century Gothic')->setBold(true)->setSize(9)->getColor()->setARGB(self::BLUE);
|
$sheet->getStyle('A3')->getFont()->setName('Century Gothic')->setBold(true)->setSize(9)->getColor()->setARGB(self::BLUE);
|
||||||
$this->paintDayTypes($sheet, 5, $dayStart, false);
|
$this->paintDayTypes($sheet, 4, $dayStart, false);
|
||||||
$this->paintDayHeaders($sheet, 7, $dayStart, false);
|
$this->paintDayHeaders($sheet, 5, $dayStart, false);
|
||||||
|
|
||||||
$rowNumber = 8;
|
$rowNumber = 6;
|
||||||
foreach ($this->abmRows as $row) {
|
foreach ($this->abmRows as $row) {
|
||||||
$values = [];
|
$values = [];
|
||||||
foreach ($identity as $key) {
|
foreach ($identity as $key) {
|
||||||
|
|
@ -204,49 +168,31 @@ class AdherencePobDriveExport
|
||||||
$rowNumber++;
|
$rowNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->finishSheet($sheet, 7, max(7, $rowNumber - 1), $lastCol, $dayStart, 14);
|
$this->finishSheet($sheet, 5, max(5, $rowNumber - 1), $lastCol, $dayStart, 14);
|
||||||
$sheet->freezePane('A8');
|
$sheet->getStyle('A3')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT);
|
||||||
|
$sheet->freezePane('A6');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function writeRegionSheet($sheet): void
|
private function writeRegionSheet($sheet): void
|
||||||
{
|
{
|
||||||
$columns = $this->regionColumns();
|
$columns = $this->regionColumns();
|
||||||
$lastCol = 3 + count($columns);
|
$lastCol = 3 + count($columns);
|
||||||
$sheet->setCellValue('A1', 'Region-wise Daily Winner – Highest no. of chemists with Adherence Pack POB ≥ ₹15,000 – ' . $this->month);
|
$sheet->setCellValue('A1', 'Region-wise Daily Winner – Highest no. of chemists with Adherence Pack POB ≥ ₹15,000');
|
||||||
$sheet->mergeCells('A1:' . $this->col($lastCol) . '1');
|
|
||||||
|
|
||||||
$typeRow = ['', '', ''];
|
$typeRow = ['', '', ''];
|
||||||
$helpRow = ['', '', ''];
|
|
||||||
$headerRow = ['Region (RBM)', 'RBM Name', 'RBM Employee Code'];
|
$headerRow = ['Region (RBM)', 'RBM Name', 'RBM Employee Code'];
|
||||||
$pairHelp = 0;
|
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
if ($column['kind'] === 'total-tm' || $column['kind'] === 'total-chemist') {
|
if ($column['kind'] === 'total-tm' || $column['kind'] === 'total-chemist') {
|
||||||
$typeRow[] = 'Sum of count of all Days';
|
$typeRow[] = '';
|
||||||
$helpRow[] = $column['kind'] === 'total-tm'
|
|
||||||
? 'No. of TMs with at least 1 Chemist with ≥₹15k POB Value'
|
|
||||||
: 'No. of Unique Chemists with ≥₹15k POB Value';
|
|
||||||
$headerRow[] = $column['header'];
|
$headerRow[] = $column['header'];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$typeRow[] = $column['type'] === 'H' ? 'H' : 'W';
|
$typeRow[] = $column['type'] === 'H' ? 'H' : 'W';
|
||||||
if ($pairHelp === 0 && $column['kind'] === 'tm') {
|
|
||||||
$helpRow[] = 'No. of TMs with at least 1 Chemist with ≥₹15k POB Value';
|
|
||||||
$pairHelp = 1;
|
|
||||||
} elseif ($pairHelp === 1 && $column['kind'] === 'chemist') {
|
|
||||||
$helpRow[] = 'No. of Unique Chemists with ≥₹15k POB Value';
|
|
||||||
$pairHelp = 2;
|
|
||||||
} else {
|
|
||||||
$helpRow[] = '';
|
|
||||||
}
|
|
||||||
$headerRow[] = $column['header'];
|
$headerRow[] = $column['header'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->writeValues($sheet, 2, $typeRow);
|
$this->writeValues($sheet, 3, $typeRow);
|
||||||
$this->writeValues($sheet, 3, $helpRow);
|
|
||||||
$this->writeValues($sheet, 4, $headerRow);
|
$this->writeValues($sheet, 4, $headerRow);
|
||||||
if (count($columns) >= 2 && $columns[count($columns) - 1]['kind'] === 'total-chemist') {
|
|
||||||
$sheet->mergeCells($this->col($lastCol - 1) . '2:' . $this->col($lastCol) . '2');
|
|
||||||
}
|
|
||||||
$this->styleHeaderRow($sheet, 4, $lastCol, 3, $lastCol - 1);
|
$this->styleHeaderRow($sheet, 4, $lastCol, 3, $lastCol - 1);
|
||||||
$this->paintRegionDayMarks($sheet, $columns);
|
$this->paintRegionDayMarks($sheet, $columns);
|
||||||
|
|
||||||
|
|
@ -288,30 +234,25 @@ class AdherencePobDriveExport
|
||||||
{
|
{
|
||||||
$dayStart = 4;
|
$dayStart = 4;
|
||||||
$totalCol = $dayStart + count($this->dayTemplate);
|
$totalCol = $dayStart + count($this->dayTemplate);
|
||||||
$sheet->setCellValue('A1', 'Territory-wise Daily Winner – Highest no. of chemists with Adherence Pack POB ≥ ₹15,000 – ' . $this->month);
|
$sheet->setCellValue('A1', 'Territory-wise Daily Winner – Highest no. of chemists with Adherence Pack POB ≥ ₹15,000');
|
||||||
$sheet->mergeCells('A1:' . $this->col($totalCol) . '1');
|
|
||||||
|
|
||||||
$typeRow = ['', '', ''];
|
$typeRow = ['', '', ''];
|
||||||
foreach ($this->dayTemplate as $day) {
|
foreach ($this->dayTemplate as $day) {
|
||||||
$typeRow[] = $day['type'] === 'H' ? 'H' : 'W';
|
$typeRow[] = $day['type'] === 'H' ? 'H' : 'W';
|
||||||
}
|
}
|
||||||
$this->writeValues($sheet, 3, $typeRow);
|
$this->writeValues($sheet, 3, $typeRow);
|
||||||
if (count($this->dayTemplate) > 0) {
|
|
||||||
$sheet->setCellValue('D4', 'No. of Unique Chemists with ≥₹15k POB Value');
|
|
||||||
}
|
|
||||||
$sheet->setCellValue($this->col($totalCol) . '4', 'Sum of all Days of No. of Unique Chemists with ≥₹15k POB Value');
|
|
||||||
|
|
||||||
$headers = ['Territory', 'TM Name', 'TM Employee Code'];
|
$headers = ['Territory', 'TM Name', 'TM Employee Code'];
|
||||||
foreach ($this->dayTemplate as $day) {
|
foreach ($this->dayTemplate as $day) {
|
||||||
$headers[] = $this->dayHeader($day['label']);
|
$headers[] = $this->dayHeader($day['label']);
|
||||||
}
|
}
|
||||||
$headers[] = 'Total Chemists Qualified (≥₹15k POB)';
|
$headers[] = 'Total Chemists Qualified (≥₹15k POB)';
|
||||||
$this->writeValues($sheet, 5, $headers);
|
$this->writeValues($sheet, 4, $headers);
|
||||||
$this->styleHeaderRow($sheet, 5, $totalCol, 3, $totalCol);
|
$this->styleHeaderRow($sheet, 4, $totalCol, 3, $totalCol);
|
||||||
$this->paintDayTypes($sheet, 3, $dayStart, true);
|
$this->paintDayTypes($sheet, 3, $dayStart, true);
|
||||||
$this->paintDayHeaders($sheet, 5, $dayStart, true);
|
$this->paintDayHeaders($sheet, 4, $dayStart, true);
|
||||||
|
|
||||||
$rowNumber = 6;
|
$rowNumber = 5;
|
||||||
foreach ($this->tmRows as $row) {
|
foreach ($this->tmRows as $row) {
|
||||||
$dayMap = $this->dayMap($this->field($row, 'days'));
|
$dayMap = $this->dayMap($this->field($row, 'days'));
|
||||||
$values = [
|
$values = [
|
||||||
|
|
@ -331,8 +272,8 @@ class AdherencePobDriveExport
|
||||||
$rowNumber++;
|
$rowNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->finishSheet($sheet, 5, max(5, $rowNumber - 1), $totalCol, $dayStart, 13);
|
$this->finishSheet($sheet, 4, max(4, $rowNumber - 1), $totalCol, $dayStart, 13);
|
||||||
$sheet->freezePane('A6');
|
$sheet->freezePane('A5');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -713,7 +654,7 @@ class AdherencePobDriveExport
|
||||||
}
|
}
|
||||||
$cell = $this->col(4 + $index);
|
$cell = $this->col(4 + $index);
|
||||||
$color = $column['type'] === 'H' ? self::GREY : self::GREEN;
|
$color = $column['type'] === 'H' ? self::GREY : self::GREEN;
|
||||||
$this->paintCell($sheet, $cell . '2', $color);
|
$this->paintCell($sheet, $cell . '3', $color);
|
||||||
$this->paintCell($sheet, $cell . '4', $color);
|
$this->paintCell($sheet, $cell . '4', $color);
|
||||||
$sheet->getStyle($cell . '4')->getFont()->setBold(true)->setSize(11)->getColor()->setARGB('000000');
|
$sheet->getStyle($cell . '4')->getFont()->setBold(true)->setSize(11)->getColor()->setARGB('000000');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -901,6 +901,72 @@ class FormController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$whatsapp = preg_replace('/\D+/', '', (string) ($post['whatsapp_mobile_number'] ?? ''));
|
||||||
|
if (strlen($whatsapp) > 10) {
|
||||||
|
$whatsapp = substr($whatsapp, -10);
|
||||||
|
}
|
||||||
|
$post['whatsapp_mobile_number'] = $whatsapp;
|
||||||
|
|
||||||
|
if (!preg_match('/^[6-9]\d{9}$/', $whatsapp)) {
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'WhatsApp number is invalid.',
|
||||||
|
'description' => 'Please enter a valid 10-digit WhatsApp mobile number starting with 6, 7, 8, or 9.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$whatsappExists = false;
|
||||||
|
$phoneContacts = LambdaRequest::getrequest('contact', 'contact/get_all', [
|
||||||
|
'keyword' => $whatsapp,
|
||||||
|
'start' => 0,
|
||||||
|
'length' => 10000,
|
||||||
|
], $accessToken);
|
||||||
|
|
||||||
|
if (isset($phoneContacts->data->items) && is_array($phoneContacts->data->items)) {
|
||||||
|
foreach ($phoneContacts->data->items as $item) {
|
||||||
|
$itemPhone = isset($item->phone) ? preg_replace('/\D+/', '', (string) $item->phone) : '';
|
||||||
|
if (strlen($itemPhone) > 10) {
|
||||||
|
$itemPhone = substr($itemPhone, -10);
|
||||||
|
}
|
||||||
|
if ($itemPhone === '' || $itemPhone !== $whatsapp) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$itemId = isset($item->id) ? (string) $item->id : '';
|
||||||
|
if ($currentSubmissionId !== '' && $linkedContactId !== '' && $itemId === $linkedContactId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$whatsappExists = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$whatsappExists && isset($previousEntries->data->submissions) && is_array($previousEntries->data->submissions)) {
|
||||||
|
foreach ($previousEntries->data->submissions as $submission) {
|
||||||
|
$submissionId = isset($submission->id) ? (string) $submission->id : '';
|
||||||
|
if ($currentSubmissionId !== '' && $submissionId === $currentSubmissionId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$entryPhone = isset($submission->formdata->whatsapp_mobile_number)
|
||||||
|
? preg_replace('/\D+/', '', (string) $submission->formdata->whatsapp_mobile_number)
|
||||||
|
: '';
|
||||||
|
if (strlen($entryPhone) > 10) {
|
||||||
|
$entryPhone = substr($entryPhone, -10);
|
||||||
|
}
|
||||||
|
if ($entryPhone !== '' && $entryPhone === $whatsapp) {
|
||||||
|
$whatsappExists = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($whatsappExists) {
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Doctor with this WhatsApp number already exists.',
|
||||||
|
'description' => 'Please check the enrolled doctor list or use a different WhatsApp number.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// Create contact only on new enrolments (not edits)
|
// Create contact only on new enrolments (not edits)
|
||||||
if ($currentSubmissionId === '') {
|
if ($currentSubmissionId === '') {
|
||||||
$doctorName = trim((string) ($post['contact_id'] ?? ($post['doctor_name'] ?? '')));
|
$doctorName = trim((string) ($post['contact_id'] ?? ($post['doctor_name'] ?? '')));
|
||||||
|
|
@ -1543,6 +1609,33 @@ class FormController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($formdata->form_id == '1741155802-25a7600f-1613-4a82-af1d-f460a8f79ffa') {
|
||||||
|
$contactIds = [];
|
||||||
|
foreach (['contact_id', 'contact_id_2'] as $contactKey) {
|
||||||
|
$contactId = trim((string) ($post[$contactKey] ?? ''));
|
||||||
|
if ($contactId !== '' && strcasecmp($contactId, 'others') !== 0) {
|
||||||
|
$contactIds[] = $contactId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$contactIds = array_values(array_unique($contactIds));
|
||||||
|
if ($contactIds !== [] && !empty($formdata->partition)) {
|
||||||
|
list($application, $domain) = explode('-', $formdata->partition);
|
||||||
|
$token = DB::table('users')->select('access_token')->where('domain', $domain)->where('permissions', 'like', '%contact_create%')->orderBy('updated_at', 'desc')->skip(0)->take(1)->get();
|
||||||
|
$userId = trim((string) ($post['user_id'] ?? ($formdata->user_id ?? '')));
|
||||||
|
if ($token->isNotEmpty() && $userId !== '') {
|
||||||
|
foreach ($contactIds as $contactId) {
|
||||||
|
LambdaRequest::postrequest('contact', 'contact/update', [
|
||||||
|
'domain' => $domain,
|
||||||
|
'application' => $application,
|
||||||
|
'user_id' => $userId,
|
||||||
|
'id' => $contactId,
|
||||||
|
'ardc_camps_ardc_poster_execution_dr_tagging' => 'Yes',
|
||||||
|
], $token[0]->access_token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($formdata->form_id == '1757055046-ba0eff4e-0d4a-4e90-b190-c59f12ef6edd') {
|
if($formdata->form_id == '1757055046-ba0eff4e-0d4a-4e90-b190-c59f12ef6edd') {
|
||||||
// if(isset($post['cresar_bs_launched']) && $post['cresar_bs_launched'] == 'Yes' ) {
|
// if(isset($post['cresar_bs_launched']) && $post['cresar_bs_launched'] == 'Yes' ) {
|
||||||
list($application, $domain) = explode("-", $formdata->partition);
|
list($application, $domain) = explode("-", $formdata->partition);
|
||||||
|
|
|
||||||
|
|
@ -425,30 +425,36 @@
|
||||||
$('#execution-form-wrapper').hide()
|
$('#execution-form-wrapper').hide()
|
||||||
|
|
||||||
function copyTgicsLink(text) {
|
function copyTgicsLink(text) {
|
||||||
if (navigator.clipboard && window.isSecureContext) {
|
function fallbackCopy() {
|
||||||
return navigator.clipboard.writeText(text);
|
return new Promise(function(resolve, reject) {
|
||||||
|
var textArea = document.createElement('textarea');
|
||||||
|
textArea.value = text;
|
||||||
|
textArea.style.position = 'fixed';
|
||||||
|
textArea.style.left = '-9999px';
|
||||||
|
document.body.appendChild(textArea);
|
||||||
|
textArea.focus();
|
||||||
|
textArea.select();
|
||||||
|
try {
|
||||||
|
var ok = document.execCommand('copy');
|
||||||
|
document.body.removeChild(textArea);
|
||||||
|
ok ? resolve() : reject();
|
||||||
|
} catch (err) {
|
||||||
|
document.body.removeChild(textArea);
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return new Promise(function(resolve, reject) {
|
|
||||||
var textArea = document.createElement('textarea');
|
if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
|
||||||
textArea.value = text;
|
return navigator.clipboard.writeText(text).catch(function() {
|
||||||
textArea.style.position = 'fixed';
|
return fallbackCopy();
|
||||||
textArea.style.left = '-9999px';
|
});
|
||||||
document.body.appendChild(textArea);
|
}
|
||||||
textArea.focus();
|
return fallbackCopy();
|
||||||
textArea.select();
|
|
||||||
try {
|
|
||||||
var ok = document.execCommand('copy');
|
|
||||||
document.body.removeChild(textArea);
|
|
||||||
ok ? resolve() : reject();
|
|
||||||
} catch (err) {
|
|
||||||
document.body.removeChild(textArea);
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('click', '.btn-copy-tgics-link', function() {
|
$(document).on('click', '.btn-copy-tgics-link', function() {
|
||||||
var link = $(this).data('link') || '';
|
var link = $(this).attr('data-link') || '';
|
||||||
var $btn = $(this);
|
var $btn = $(this);
|
||||||
if (!link) {
|
if (!link) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -460,6 +466,11 @@
|
||||||
$btn.html(original);
|
$btn.html(original);
|
||||||
}, 1500);
|
}, 1500);
|
||||||
}).catch(function() {
|
}).catch(function() {
|
||||||
|
var $input = $btn.closest('.input-group').find('.tgics-doctor-link');
|
||||||
|
if ($input.length) {
|
||||||
|
$input.trigger('focus');
|
||||||
|
$input[0].select();
|
||||||
|
}
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
title: 'Unable to copy',
|
title: 'Unable to copy',
|
||||||
|
|
@ -527,11 +538,7 @@
|
||||||
|
|
||||||
$('#execution-contact_id').val(docid) */
|
$('#execution-contact_id').val(docid) */
|
||||||
$('#execution-id').val(selected['id'])
|
$('#execution-id').val(selected['id'])
|
||||||
|
toggleOtherQualification('execution');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#report-form').on('submit', function(event) {
|
$('#report-form').on('submit', function(event) {
|
||||||
|
|
@ -579,21 +586,29 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#field-other_qualification').prop({"required":false});
|
function toggleOtherQualification(prefix) {
|
||||||
$('#field-other_qualification').parent().hide();
|
var $qualification = $('#' + prefix + '-qualification');
|
||||||
|
var $other = $('#' + prefix + '-other_qualification');
|
||||||
|
if (!$qualification.length || !$other.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($qualification.val() === 'Others') {
|
||||||
|
$other.parent().show();
|
||||||
|
$other.prop('required', true);
|
||||||
|
} else {
|
||||||
|
$other.val('');
|
||||||
|
$other.prop('required', false);
|
||||||
|
$other.parent().hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$('#field-qualification').on('change',function(){
|
toggleOtherQualification('field');
|
||||||
let dropDown=$('#field-qualification').val();
|
toggleOtherQualification('execution');
|
||||||
if(dropDown==='Others'){
|
|
||||||
$('#field-other_qualification').parent().show();
|
$('#field-qualification, #execution-qualification').on('change', function() {
|
||||||
$('#field-other_qualification').prop({"required":true});
|
var prefix = this.id.indexOf('execution-') === 0 ? 'execution' : 'field';
|
||||||
}
|
toggleOtherQualification(prefix);
|
||||||
else{
|
});
|
||||||
$('#field-other_qualification').parent().hide();
|
|
||||||
$('#field-other_qualification').prop({"required":false});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
$('#field-contact_id,#field-city_town,#field-state,#field-other_qualification').on('input', function () {
|
$('#field-contact_id,#field-city_town,#field-state,#field-other_qualification').on('input', function () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue