Changes
Specific Folder FTP Upload / ftp-deploy (push) Successful in 28s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 28s
Details
This commit is contained in:
parent
caf331d91e
commit
95566c5c1d
|
|
@ -47,3 +47,6 @@ PUSHER_APP_CLUSTER=mt1
|
|||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
|
||||
# TGICS patient survey API (counts for Dr Enrolment form)
|
||||
TGICS_API_BASE=http://localhost:3050
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class TgicsHelper
|
||||
{
|
||||
/**
|
||||
* Batch survey counts from TGICS API keyed by contact_id.
|
||||
*
|
||||
* @param array<int, string> $contactIds
|
||||
* @return array{counts: array<string, int>, total: int}
|
||||
*/
|
||||
public static function getSurveyCounts(array $contactIds): array
|
||||
{
|
||||
$ids = array_values(array_unique(array_filter(array_map(static function ($id) {
|
||||
return trim((string) $id);
|
||||
}, $contactIds))));
|
||||
|
||||
if (count($ids) === 0) {
|
||||
return ['counts' => [], 'total' => 0];
|
||||
}
|
||||
|
||||
$base = rtrim((string) env('TGICS_API_BASE', ''), '/');
|
||||
if ($base === '') {
|
||||
Log::warning('TGICS_API_BASE is not configured; survey counts defaulting to 0');
|
||||
return ['counts' => array_fill_keys($ids, 0), 'total' => 0];
|
||||
}
|
||||
|
||||
try {
|
||||
$response = Http::timeout(8)->acceptJson()->get($base.'/api/surveys/counts', [
|
||||
'contact_ids' => implode(',', $ids),
|
||||
]);
|
||||
|
||||
if (!$response->successful()) {
|
||||
Log::warning('TGICS survey counts request failed', [
|
||||
'status' => $response->status(),
|
||||
'body' => $response->body(),
|
||||
]);
|
||||
return ['counts' => array_fill_keys($ids, 0), 'total' => 0];
|
||||
}
|
||||
|
||||
$json = $response->json();
|
||||
$countsRaw = $json['data']['counts'] ?? [];
|
||||
$counts = [];
|
||||
$total = 0;
|
||||
foreach ($ids as $id) {
|
||||
$n = (int) ($countsRaw[$id] ?? 0);
|
||||
$counts[$id] = $n;
|
||||
$total += $n;
|
||||
}
|
||||
|
||||
return ['counts' => $counts, 'total' => $total];
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('TGICS survey counts error: '.$e->getMessage());
|
||||
return ['counts' => array_fill_keys($ids, 0), 'total' => 0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -796,6 +796,164 @@ class FormController extends Controller
|
|||
$formdata->partition = $post['partition'];
|
||||
}
|
||||
|
||||
// TGICS (The Great Indian Cough Study) — Dr Enrolment
|
||||
if ($formdata->form_id == '1792561624-4466e937-cfb5-4679-989a-c3fea892568f') {
|
||||
if (empty($post['user_id']) && !empty($formdata->user_id)) {
|
||||
$post['user_id'] = $formdata->user_id;
|
||||
}
|
||||
|
||||
$wfsaCode = preg_replace('/\D+/', '', (string) ($post['wfsa_code'] ?? ''));
|
||||
$post['wfsa_code'] = $wfsaCode;
|
||||
|
||||
if ($wfsaCode === '') {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'WFSA code is required.',
|
||||
'description' => 'Please enter a valid WFSA code.',
|
||||
]);
|
||||
}
|
||||
|
||||
list($application, $domain) = explode('-', $formdata->partition);
|
||||
$tokenRows = DB::table('users')
|
||||
->select('access_token')
|
||||
->where('domain', $domain)
|
||||
->where('permissions', 'like', '%contact_create%')
|
||||
->orderBy('updated_at', 'desc')
|
||||
->skip(0)
|
||||
->take(1)
|
||||
->get();
|
||||
|
||||
if ($tokenRows->isEmpty() || empty($tokenRows[0]->access_token)) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Unable to validate doctor enrolment.',
|
||||
'description' => 'Contact create permission is not available. Please try again later.',
|
||||
]);
|
||||
}
|
||||
$accessToken = $tokenRows[0]->access_token;
|
||||
$currentSubmissionId = isset($post['id']) ? (string) $post['id'] : '';
|
||||
$linkedContactId = (string) ($post['tgics_contact_id'] ?? '');
|
||||
$exists = false;
|
||||
|
||||
$previousEntries = \App\Helpers\Formhelper::getMultiformData(
|
||||
$formdata->partition,
|
||||
$formdata->form_id,
|
||||
$formdata->user_id
|
||||
);
|
||||
|
||||
// On edit, keep the existing contact link and resolve it if not posted
|
||||
if ($currentSubmissionId !== '' && isset($previousEntries->data->submissions) && is_array($previousEntries->data->submissions)) {
|
||||
foreach ($previousEntries->data->submissions as $submission) {
|
||||
$submissionId = isset($submission->id) ? (string) $submission->id : '';
|
||||
if ($submissionId !== $currentSubmissionId) {
|
||||
continue;
|
||||
}
|
||||
if ($linkedContactId === '' && !empty($submission->formdata->tgics_contact_id)) {
|
||||
$linkedContactId = (string) $submission->formdata->tgics_contact_id;
|
||||
$post['tgics_contact_id'] = $linkedContactId;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$conts = LambdaRequest::getrequest('contact', 'contact/get_all', [
|
||||
'keyword' => $wfsaCode,
|
||||
'start' => 0,
|
||||
'length' => 10000,
|
||||
], $accessToken);
|
||||
|
||||
if (isset($conts->data->items) && is_array($conts->data->items)) {
|
||||
foreach ($conts->data->items as $item) {
|
||||
$itemMsl = isset($item->msl_code) ? preg_replace('/\D+/', '', (string) $item->msl_code) : '';
|
||||
if ($itemMsl !== '' && strcasecmp($itemMsl, $wfsaCode) === 0) {
|
||||
$itemId = isset($item->id) ? (string) $item->id : '';
|
||||
// On edit, allow the same contact already linked to this enrolment
|
||||
if ($currentSubmissionId !== '' && $linkedContactId !== '' && $itemId === $linkedContactId) {
|
||||
continue;
|
||||
}
|
||||
$exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$exists && 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;
|
||||
}
|
||||
$entryWfsa = isset($submission->formdata->wfsa_code)
|
||||
? preg_replace('/\D+/', '', (string) $submission->formdata->wfsa_code)
|
||||
: '';
|
||||
if ($entryWfsa !== '' && $entryWfsa === $wfsaCode) {
|
||||
$exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($exists) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Doctor with this WFSA code already exists.',
|
||||
'description' => 'Please check the enrolled doctor list or use a different WFSA code.',
|
||||
]);
|
||||
}
|
||||
|
||||
// Create contact only on new enrolments (not edits)
|
||||
if ($currentSubmissionId === '') {
|
||||
$doctorName = trim((string) ($post['contact_id'] ?? ($post['doctor_name'] ?? '')));
|
||||
if ($doctorName === '') {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Doctor name is required.',
|
||||
'description' => 'Please enter the name of the practitioner.',
|
||||
]);
|
||||
}
|
||||
|
||||
$contactdata = [
|
||||
'domain' => $domain,
|
||||
'application' => $application,
|
||||
'user_id' => $post['user_id'] ?? $formdata->user_id,
|
||||
'name' => $doctorName,
|
||||
'msl_code' => $wfsaCode,
|
||||
'phone' => $post['whatsapp_mobile_number'] ?? '',
|
||||
'email' => $post['email_id'] ?? '',
|
||||
'type' => 'doctor',
|
||||
'tgics_enrolled_doctor' => 'Yes',
|
||||
];
|
||||
if (!empty($post['age'])) {
|
||||
$contactdata['age'] = $post['age'];
|
||||
}
|
||||
if (!empty($post['city_town'])) {
|
||||
$contactdata['city'] = $post['city_town'];
|
||||
}
|
||||
if (!empty($post['state'])) {
|
||||
$contactdata['state'] = $post['state'];
|
||||
}
|
||||
if (!empty($post['qualification'])) {
|
||||
$contactdata['qualification'] = $post['qualification'];
|
||||
}
|
||||
if (!empty($post['years_of_practice'])) {
|
||||
$contactdata['years_of_practice'] = $post['years_of_practice'];
|
||||
}
|
||||
if (!empty($post['type_of_practice'])) {
|
||||
$contactdata['type_of_practice'] = $post['type_of_practice'];
|
||||
}
|
||||
|
||||
$cont = LambdaRequest::postrequest('contact', 'contact/create', $contactdata, $accessToken);
|
||||
if (!isset($cont->status) || $cont->status !== 'success' || empty($cont->data->item->id)) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'Unable to create doctor contact.',
|
||||
'description' => $cont->message ?? 'Please try again after some time.',
|
||||
]);
|
||||
}
|
||||
$post['tgics_contact_id'] = $cont->data->item->id;
|
||||
}
|
||||
}
|
||||
|
||||
if($formdata->form_id == '1740377155-6ef021d0-d8cf-42e6-bc7d-d00743b7b354') { // emcurecv Hospital Enrollment
|
||||
$inputs = $request->input();
|
||||
list($application, $domain) = explode("-", $formdata->partition);
|
||||
|
|
@ -5684,26 +5842,44 @@ class FormController extends Controller
|
|||
if ($post['status'] != 'Partially Saved') {
|
||||
$post['record_id'] = $insertedId;
|
||||
$finfo = LambdaRequest::postrequest('form', 'formentity/submitform', ['formdata' => $post, 'entity_id' => $formdata->form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition ]);
|
||||
}
|
||||
// Get old data before update
|
||||
$oldData = DB::table('neblogistic')->where('id', $insertedId)->first();
|
||||
$oldDataArray = $oldData ? json_decode(json_encode($oldData), true) : null;
|
||||
|
||||
$submissionId = isset($finfo->data->submission->id) ? $finfo->data->submission->id : null;
|
||||
$abmid = isset($finfo->data->submission->workflow_next_approver) ? $finfo->data->submission->workflow_next_approver : null;
|
||||
|
||||
if ($post['status'] != 'Partially Saved') {
|
||||
$res = DB::table('neblogistic')->where('id', $insertedId)->update(['submission_id' => $submissionId, 'abm_user_id' => $abmid]);
|
||||
}
|
||||
// Log UPDATE operation
|
||||
if ($res) {
|
||||
$submissionId = isset($finfo->data->submission->id) ? $finfo->data->submission->id : null;
|
||||
$abmid = isset($finfo->data->submission->workflow_next_approver) ? $finfo->data->submission->workflow_next_approver : null;
|
||||
if (!isset($finfo->status) || $finfo->status !== 'success' || empty($submissionId)) {
|
||||
Log::error('NAP create: Dynamo submitform failed or missing submission id', [
|
||||
'neblogistic_id' => $insertedId,
|
||||
'finfo' => $finfo,
|
||||
]);
|
||||
return response()->json([
|
||||
'status' => 'failure',
|
||||
'message' => 'Request could not be submitted for approval. Please try again.',
|
||||
]);
|
||||
}
|
||||
// Get old data before update
|
||||
$oldData = DB::table('neblogistic')->where('id', $insertedId)->first();
|
||||
$oldDataArray = $oldData ? json_decode(json_encode($oldData), true) : null;
|
||||
DB::table('neblogistic')->where('id', $insertedId)->update(['submission_id' => $submissionId, 'abm_user_id' => $abmid]);
|
||||
$linked = DB::table('neblogistic')
|
||||
->where('id', $insertedId)
|
||||
->where('submission_id', $submissionId)
|
||||
->exists();
|
||||
if (!$linked) {
|
||||
Log::error('NAP create: failed to link submission_id on neblogistic', [
|
||||
'neblogistic_id' => $insertedId,
|
||||
'submission_id' => $submissionId,
|
||||
]);
|
||||
return response()->json([
|
||||
'status' => 'failure',
|
||||
'message' => 'Request could not be linked for approval. Please try again.',
|
||||
]);
|
||||
}
|
||||
NeblogisticAuditService::logUpdate(
|
||||
$insertedId,
|
||||
$oldDataArray,
|
||||
['submission_id' => $submissionId],
|
||||
['submission_id' => $submissionId, 'abm_user_id' => $abmid],
|
||||
['submission_id' => ['old' => $oldDataArray['submission_id'] ?? null, 'new' => $submissionId]],
|
||||
$request
|
||||
);
|
||||
$datatosave['submission_id'] = $submissionId;
|
||||
}
|
||||
|
||||
Log::debug("Creating Neblogistics");
|
||||
|
|
@ -7914,7 +8090,35 @@ class FormController extends Controller
|
|||
|
||||
$this->syncNapMysqlFromApproval($request, $post, $finfo);
|
||||
|
||||
return response()->json($post);
|
||||
if (!isset($finfo->status) || $finfo->status !== 'success') {
|
||||
$message = is_string($finfo->data ?? null)
|
||||
? $finfo->data
|
||||
: ($finfo->message ?? 'Unable to process approval action.');
|
||||
$statusCode = isset($finfo->statusCode) && (int) $finfo->statusCode >= 400
|
||||
? (int) $finfo->statusCode
|
||||
: 500;
|
||||
return response()->json([
|
||||
'status' => 'failure',
|
||||
'message' => $message,
|
||||
], $statusCode);
|
||||
}
|
||||
|
||||
$payload = [
|
||||
'status' => 'success',
|
||||
'action' => $post['action'] ?? '',
|
||||
'submission_id' => $post['submission_id'] ?? $post['id'] ?? '',
|
||||
'form_id' => $post['form_id'] ?? '',
|
||||
];
|
||||
if (isset($finfo->data->nap_status)) {
|
||||
$payload['nap_status'] = $finfo->data->nap_status;
|
||||
}
|
||||
if (isset($finfo->data->mysql_synced)) {
|
||||
$payload['mysql_synced'] = $finfo->data->mysql_synced;
|
||||
}
|
||||
if (isset($finfo->data->mysql_id)) {
|
||||
$payload['mysql_id'] = $finfo->data->mysql_id;
|
||||
}
|
||||
return response()->json($payload);
|
||||
}
|
||||
|
||||
public function approverejectmultiple(Request $request) {
|
||||
|
|
@ -7974,11 +8178,30 @@ class FormController extends Controller
|
|||
}
|
||||
|
||||
$record = DB::table('neblogistic')->where('submission_id', $submissionId)->first();
|
||||
$matchedById = false;
|
||||
if (!$record) {
|
||||
$recordId = $post['record_id']
|
||||
?? ($response->data->mysql_id ?? null)
|
||||
?? ($response->data->record_id ?? null)
|
||||
?? null;
|
||||
if ($recordId !== null && $recordId !== '') {
|
||||
$record = DB::table('neblogistic')->where('id', $recordId)->first();
|
||||
$matchedById = (bool) $record;
|
||||
}
|
||||
}
|
||||
if (!$record) {
|
||||
Log::warning('NAP sync: no neblogistic row for approval', [
|
||||
'submission_id' => $submissionId,
|
||||
'nap_status' => $napStatus,
|
||||
'record_id' => $post['record_id'] ?? null,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$update = ['status' => $napStatus];
|
||||
if ($matchedById) {
|
||||
$update['submission_id'] = $submissionId;
|
||||
}
|
||||
$now = date('Y-m-d H:i:s');
|
||||
if ($napStatus === 'Rejected') {
|
||||
$update['rejected_at'] = $now;
|
||||
|
|
@ -7993,7 +8216,7 @@ class FormController extends Controller
|
|||
}
|
||||
|
||||
$old = json_decode(json_encode($record), true);
|
||||
DB::table('neblogistic')->where('submission_id', $submissionId)->update($update);
|
||||
DB::table('neblogistic')->where('id', $record->id)->update($update);
|
||||
NeblogisticAuditService::logUpdate($record->id, $old, $update, null, $request);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,83 +47,127 @@
|
|||
$form->form_id,
|
||||
$form->user_id,
|
||||
);
|
||||
$tgicsSubmissions = collect($history->data->submissions ?? []);
|
||||
$doctorsAddedCount = $tgicsSubmissions->count();
|
||||
|
||||
$tgicsContactIds = $tgicsSubmissions
|
||||
->map(function ($countSub) {
|
||||
return trim((string) ($countSub->formdata->tgics_contact_id ?? ''));
|
||||
})
|
||||
->filter()
|
||||
->unique()
|
||||
->values()
|
||||
->all();
|
||||
|
||||
$tgicsSurveyData = \App\Helpers\TgicsHelper::getSurveyCounts($tgicsContactIds);
|
||||
$tgicsSurveyCounts = $tgicsSurveyData['counts'] ?? [];
|
||||
$totalSurveysDone = (int) ($tgicsSurveyData['total'] ?? 0);
|
||||
|
||||
$tgicsCommonUserId = trim((string) ($form->user_id ?? ''));
|
||||
$tgicsCommonLink = $tgicsCommonUserId !== ''
|
||||
? 'https://tgics.cttr.in/' . $tgicsCommonUserId
|
||||
: '';
|
||||
@endphp
|
||||
|
||||
|
||||
|
||||
<div class="col-12" id="table-wrapper">
|
||||
|
||||
@if ($tgicsCommonLink !== '')
|
||||
<div class="mb-3">
|
||||
<label class="form-label mb-1">Doctor Survey Link</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control form-control-sm tgics-doctor-link" value="{{ $tgicsCommonLink }}" readonly>
|
||||
<button type="button" class="btn btn-outline-secondary btn-copy-tgics-link" data-link="{{ $tgicsCommonLink }}" title="Copy to clipboard">
|
||||
<i class="mdi mdi-content-copy"></i> Copy
|
||||
</button>
|
||||
</div>
|
||||
<small class="text-muted">Common link for all doctors. Doctors enter their WhatsApp number to log in.</small>
|
||||
</div>
|
||||
@endif
|
||||
<div class="row mb-2">
|
||||
<div class="col-6">
|
||||
<div class="border rounded p-2">
|
||||
<small class="text-muted d-block">No. of doctors added</small>
|
||||
<strong>{{ $doctorsAddedCount }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="border rounded p-2">
|
||||
<small class="text-muted d-block">No. of surveys done</small>
|
||||
<strong>{{ $totalSurveysDone }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
|
||||
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Action.</th>
|
||||
|
||||
|
||||
<th>Action</th>
|
||||
<th>Workflow Status</th>
|
||||
<th>Surveys Done</th>
|
||||
<th>Name of the Practitioner</th>
|
||||
|
||||
<th>WFSA Code</th>
|
||||
<th>WhatsApp Mobile Number</th>
|
||||
<th>Email ID</th>
|
||||
<th>Age (in completed years)</th>
|
||||
<th>Years of Practice</th>
|
||||
<th>Type of Practice</th>
|
||||
<th>City/Town</th>
|
||||
<th>State</th>
|
||||
<th>Qualification</th>
|
||||
<th>Other Qualification</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (collect($history->data->submissions)->sortByDesc('formdata.record_date') as $sub)
|
||||
@foreach ($tgicsSubmissions->sortByDesc('formdata.record_date') as $sub)
|
||||
@php
|
||||
$sub->formdata->id = $sub->id;
|
||||
|
||||
$workflowStatus = strtolower(trim((string) ($sub->workflow_status ?? '')));
|
||||
$isApproved = $workflowStatus === 'approved';
|
||||
$whatsappDigits = preg_replace('/\D+/', '', (string) ($sub->formdata->whatsapp_mobile_number ?? ''));
|
||||
if (strlen($whatsappDigits) === 10) {
|
||||
$whatsappDigits = '91' . $whatsappDigits;
|
||||
}
|
||||
$doctorName = '';
|
||||
if (isset($sub->formdata->contact_id) && $sub->formdata->contact_id !== '') {
|
||||
$doctorName = $sub->formdata->contact_id;
|
||||
} elseif (isset($sub->formdata->doctor_name)) {
|
||||
$doctorName = $sub->formdata->doctor_name;
|
||||
}
|
||||
$tgicsContactId = trim((string) ($sub->formdata->tgics_contact_id ?? ''));
|
||||
$rowUserId = trim((string) ($sub->formdata->user_id ?? ($sub->user_id ?? ($form->user_id ?? ''))));
|
||||
$doctorLink = $rowUserId !== ''
|
||||
? 'https://tgics.cttr.in/' . $rowUserId
|
||||
: $tgicsCommonLink;
|
||||
$surveysDone = $tgicsContactId !== ''
|
||||
? (int) ($tgicsSurveyCounts[$tgicsContactId] ?? 0)
|
||||
: 0;
|
||||
$whatsappText = "Dear Doctor" . ($doctorName !== '' ? ' ' . $doctorName : '') . ",\n\nYou have been approved for TGICS (The Great Indian Cough Study).\nPlease open the link and enter your WhatsApp mobile number to continue:\n" . $doctorLink;
|
||||
$whatsappLink = ($whatsappDigits !== '' && $doctorLink !== '')
|
||||
? 'https://api.whatsapp.com/send?phone=' . $whatsappDigits . '&text=' . rawurlencode($whatsappText)
|
||||
: '';
|
||||
@endphp
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-info edit-btn"
|
||||
plan_details="{{ json_encode($sub->formdata) }}"><i
|
||||
class="mdi mdi-pencil"></i> Edit</button>
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
@if (isset($sub->formdata->contact_id) && $sub->formdata->contact_id !== '')
|
||||
{{ $sub->formdata->contact_id }}
|
||||
@elseif (isset($sub->formdata->doctor_name))
|
||||
{{ $sub->formdata->doctor_name }}
|
||||
@if ($isApproved)
|
||||
@if ($whatsappLink !== '')
|
||||
<a href="{{ $whatsappLink }}" target="_blank" rel="noopener noreferrer"
|
||||
class="btn btn-xs btn-success">
|
||||
<i class="mdi mdi-whatsapp"></i> Send WhatsApp
|
||||
</a>
|
||||
@elseif ($doctorLink === '')
|
||||
<span class="text-muted">Link unavailable</span>
|
||||
@else
|
||||
<span class="text-muted">No WhatsApp number</span>
|
||||
@endif
|
||||
@else
|
||||
{{-- Default value or empty string, adjust as needed --}}
|
||||
{{ '' }}
|
||||
<button type="button" class="btn btn-xs btn-info edit-btn"
|
||||
plan_details="{{ json_encode($sub->formdata) }}"><i
|
||||
class="mdi mdi-pencil"></i> Edit</button>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
|
||||
<td>{{ $workflowStatus !== '' ? ucwords($workflowStatus) : '-' }}</td>
|
||||
<td>{{ $surveysDone }}</td>
|
||||
<td>{{ $doctorName }}</td>
|
||||
<td>{{ isset($sub->formdata->wfsa_code) ? $sub->formdata->wfsa_code : '' }}
|
||||
</td>
|
||||
<td>{{ isset($sub->formdata->whatsapp_mobile_number) ? $sub->formdata->whatsapp_mobile_number : '' }}
|
||||
</td>
|
||||
<td>{{ isset($sub->formdata->email_id) ? $sub->formdata->email_id : '' }}
|
||||
</td>
|
||||
<td>{{ isset($sub->formdata->age) ? $sub->formdata->age : '' }}
|
||||
</td>
|
||||
<td>{{ isset($sub->formdata->years_of_practice) ? $sub->formdata->years_of_practice : '' }}
|
||||
</td>
|
||||
<td>{{ isset($sub->formdata->type_of_practice) ? $sub->formdata->type_of_practice : '' }}
|
||||
</td>
|
||||
<td>{{ isset($sub->formdata->city_town) ? $sub->formdata->city_town : '' }}
|
||||
</td>
|
||||
<td>{{ isset($sub->formdata->state) ? $sub->formdata->state : '' }}
|
||||
</td>
|
||||
<td>{{ isset($sub->formdata->qualification) ? $sub->formdata->qualification : '' }}
|
||||
</td>
|
||||
<td>{{ isset($sub->formdata->other_qualification) ? $sub->formdata->other_qualification : '' }}
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
|
@ -380,6 +424,50 @@
|
|||
$('#form-wrapper').hide()
|
||||
$('#execution-form-wrapper').hide()
|
||||
|
||||
function copyTgicsLink(text) {
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('click', '.btn-copy-tgics-link', function() {
|
||||
var link = $(this).data('link') || '';
|
||||
var $btn = $(this);
|
||||
if (!link) {
|
||||
return;
|
||||
}
|
||||
copyTgicsLink(link).then(function() {
|
||||
var original = $btn.html();
|
||||
$btn.html('<i class="mdi mdi-check"></i> Copied');
|
||||
setTimeout(function() {
|
||||
$btn.html(original);
|
||||
}, 1500);
|
||||
}).catch(function() {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Unable to copy',
|
||||
text: 'Please copy the link manually.',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// $('#add-camp-btn').click(function() {
|
||||
// $('#form-wrapper').show()
|
||||
// $('#table-wrapper').hide()
|
||||
|
|
@ -462,17 +550,25 @@
|
|||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
window.location.reload();
|
||||
//$('#report-form').trigger("reset");
|
||||
}).then(function() {
|
||||
window.location.reload();
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
title: data.message || 'Data not submitted',
|
||||
text: data.description || data.message || 'Something went wrong, please try again after some time!'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$("#pageloader").fadeOut();
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -565,18 +661,26 @@
|
|||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
}).then(() => {
|
||||
location.reload(); // 🔥 page refresh here
|
||||
});
|
||||
$('#report-form').trigger("reset");
|
||||
}).then(function() {
|
||||
location.reload();
|
||||
});
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
title: data.message || 'Data not submitted',
|
||||
text: data.description || data.message || 'Something went wrong, please try again after some time!'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$("#pageloader").fadeOut();
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@
|
|||
</td>
|
||||
@endforeach
|
||||
<td>
|
||||
@if(strtolower((string) ($submission->workflow_status ?? '')) !== 'approved')
|
||||
<a href="/form/show?form_id={{ $section['form_id'] }}&id={{ $submission->id }}" class="btn btn-primary btn-xs">Edit</a>
|
||||
@if(strtolower((string) ($submission->workflow_status ?? '')) === 'rejected')
|
||||
<a href="/form/show?form_id={{ $section['form_id'] }}&id={{ $submission->id }}" class="btn btn-primary btn-xs">Edit / Re-upload</a>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
Loading…
Reference in New Issue