Merge branch 'main' of http://192.168.1.200:3000/Stratawiz/Rapport-Laravel
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m21s Details

This commit is contained in:
Tanuja Pansare 2026-10-30 09:52:17 +05:30
commit 875fccd1a6
3 changed files with 377 additions and 327 deletions

View File

@ -485,38 +485,54 @@ class NeblogisticreportController extends Controller
$data = DB::table('neblogistic')->where('id', $params['record_id'])->first(); $data = DB::table('neblogistic')->where('id', $params['record_id'])->first();
$emailWarnings = [];
if (isset($params['status'])) { if (isset($params['status'])) {
if ($params['status'] == 'Rejected') { if ($params['status'] == 'Rejected') {
$rejectWarn = $this->sendNeblogisticMailSafely(
Mail::to($data->emp_email) new NeblogisticRejection((array) $data),
->cc($data->abm_email) $data->emp_email ?? null,
->send(new NeblogisticRejection((array)$data)); $data->abm_email ?? null,
Mail::to('ravigulhane1983@gmail.com')->send(new NeblogisticRejection((array)$data)); ['id' => $data->id ?? null, 'mail' => 'rejection']
);
if ($rejectWarn !== null) {
$emailWarnings[] = $rejectWarn;
} }
elseif (in_array($params['status'], ['Dispatched', 'Delivered'], true)) { try {
Mail::to('ravigulhane1983@gmail.com')->send(new NeblogisticRejection((array) $data));
} catch (\Throwable $e) {
Log::error('Neblogistic rejection debug email failed', [
'id' => $data->id ?? null,
'message' => $e->getMessage(),
]);
}
} elseif (in_array($params['status'], ['Dispatched', 'Delivered'], true)) {
Log::info('Neblogistic status update email', [ Log::info('Neblogistic status update email', [
'data' => $data, 'data' => $data,
]); ]);
// Send to TM (emp_email) $tmWarn = $this->sendNeblogisticMailSafely(
if (!empty($data->emp_email)) { new NeblogisticStatusUpdate((array) $data, 'tm'),
Mail::to($data->emp_email) $data->emp_email ?? null,
->send(new NeblogisticStatusUpdate((array)$data, 'tm')); null,
['id' => $data->id ?? null, 'mail' => 'status_tm']
);
if ($tmWarn !== null) {
$emailWarnings[] = $tmWarn;
} }
$abmWarn = $this->sendNeblogisticMailSafely(
// Send to ABM (abm_email) new NeblogisticStatusUpdate((array) $data, 'abm'),
if (!empty($data->abm_email)) { $data->abm_email ?? null,
Mail::to($data->abm_email) null,
->send(new NeblogisticStatusUpdate((array)$data, 'abm')); ['id' => $data->id ?? null, 'mail' => 'status_abm']
);
if ($abmWarn !== null) {
$emailWarnings[] = $abmWarn;
} }
// Prevent cron from re-sending the same status email // Prevent cron from re-sending the same status email
DB::table('neblogistic') DB::table('neblogistic')
->where('id', $params['record_id']) ->where('id', $params['record_id'])
->update(['status_email_sent' => $params['status']]); ->update(['status_email_sent' => $params['status']]);
} else {
} }
} }
@ -529,15 +545,22 @@ class NeblogisticreportController extends Controller
$data->pin_code = $data->address_pin_code; $data->pin_code = $data->address_pin_code;
$data->clinic_hospital_home_name = $data->clinic_hospital_name; $data->clinic_hospital_home_name = $data->clinic_hospital_name;
Mail::to($data->emp_email) $editWarn = $this->sendNeblogisticMailSafely(
->cc($data->abm_email) new Neblogistic((array) $data),
->send(new Neblogistic((array)$data)); $data->emp_email ?? null,
$data->abm_email ?? null,
['id' => $data->id ?? null, 'mail' => 'edit_notification']
);
if ($editWarn !== null) {
$emailWarnings[] = $editWarn;
}
//Mail::to('arbaz@stratawiz.com')->send(new NeblogisticSupervisor((array)$data)); //Mail::to('arbaz@stratawiz.com')->send(new NeblogisticSupervisor((array)$data));
$user = Auth::user(); $user = Auth::user();
$successMessage = 'Data Saved';
// echo "<pre>"; if (!empty($emailWarnings)) {
// print_r($params); $successMessage .= '. ' . implode(' ', array_unique($emailWarnings));
}
if(!$params['submission_id'] == ''){ if(!$params['submission_id'] == ''){
// return print_r($params); // return print_r($params);
@ -546,7 +569,7 @@ class NeblogisticreportController extends Controller
$history = LambdaRequest::signedrequest('post', 'form', 'formentity/submitform', $post, 120); $history = LambdaRequest::signedrequest('post', 'form', 'formentity/submitform', $post, 120);
Log::info('formsubmission after edit', [ 'history' => $history]); Log::info('formsubmission after edit', [ 'history' => $history]);
if ($history->status === 'success') { if ($history->status === 'success') {
return redirect()->back()->with('message', 'Data Saved'); return redirect()->back()->with('message', $successMessage);
} else { } else {
return redirect()->back()->with('error', 'Operation failed.'); return redirect()->back()->with('error', 'Operation failed.');
} }
@ -557,7 +580,7 @@ class NeblogisticreportController extends Controller
if ($dataUpdate) { if ($dataUpdate) {
return redirect()->back()->with('message', 'Data Saved'); return redirect()->back()->with('message', $successMessage);
} else { } else {
return redirect()->back()->with('error', 'Operation failed.'); return redirect()->back()->with('error', 'Operation failed.');
} }
@ -2048,6 +2071,76 @@ class NeblogisticreportController extends Controller
return is_object($response) && ($response->status ?? '') === 'success'; return is_object($response) && ($response->status ?? '') === 'success';
} }
/**
* True when value is a real mailbox (rejects empty / Vacant placeholders).
*/
protected function isValidNeblogisticEmail($email): bool
{
$email = trim((string) $email);
if ($email === '' || stripos($email, 'vacant') !== false) {
return false;
}
return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
}
/**
* Send a mailable without letting invalid Vacant/CC addresses 500 the request.
* Returns a short user-facing warning, or null when send succeeded / nothing to warn.
*
* @param mixed $mailable
* @param string|null $to
* @param string|null $cc
* @param array $context
*/
protected function sendNeblogisticMailSafely($mailable, $to, $cc = null, array $context = []): ?string
{
$validTo = $this->isValidNeblogisticEmail($to) ? trim((string) $to) : null;
$validCc = $this->isValidNeblogisticEmail($cc) ? trim((string) $cc) : null;
$warnings = [];
if ($to !== null && trim((string) $to) !== '' && $validTo === null) {
$warnings[] = 'Notification email was not sent because the recipient email is missing or invalid (e.g. Vacant).';
Log::warning('Neblogistic email skipped: invalid to address', $context + [
'to' => $to,
'cc' => $cc,
]);
} elseif ($cc !== null && trim((string) $cc) !== '' && $validCc === null) {
$warnings[] = 'ABM notification was skipped because the ABM email is missing or invalid (e.g. Vacant).';
Log::warning('Neblogistic email CC skipped: invalid cc address', $context + [
'to' => $to,
'cc' => $cc,
]);
}
if ($validTo === null) {
return $warnings[0] ?? 'Notification email was not sent because no valid recipient email was found.';
}
try {
$pending = Mail::to($validTo);
if ($validCc !== null) {
$pending->cc($validCc);
}
$pending->send($mailable);
} catch (\Swift_RfcComplianceException $e) {
Log::error('Neblogistic email RFC error', $context + [
'to' => $validTo,
'cc' => $validCc,
'message' => $e->getMessage(),
]);
return 'Notification email could not be sent due to an invalid email address.';
} catch (\Throwable $e) {
Log::error('Neblogistic email failed', $context + [
'to' => $validTo,
'cc' => $validCc,
'message' => $e->getMessage(),
]);
return 'Notification email could not be sent.';
}
return $warnings[0] ?? null;
}
protected function normalizeNapPartition(?string $partition): string protected function normalizeNapPartition(?string $partition): string
{ {
$partition = trim((string) $partition); $partition = trim((string) $partition);

View File

@ -0,0 +1,92 @@
-- Nebulizers Allocation Data - 28102026 ARAVIND M.xlsx
-- UPDATE incept_neb_allocations for 28 employees (sheet under ARAVIND M).
-- Existing incept_neb_usage rows are left untouched.
-- 27 rows differ from current DB (mostly control_d_qty); 144137 ARAVIND M unchanged.
-- Sheet totals: Robust 332, Mini 395, Control D 319.
START TRANSACTION;
-- 144137 / ARAVIND M Robust 11, Mini 5, Control D 0
UPDATE incept_neb_allocations SET emp_name = 'ARAVIND M', designation = 'Area Business Manager', team = 'Neb - Arise', robust_qty = 11, mini_qty = 5, control_d_qty = 0, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '144137';
-- 179234 / Harish Kumar Robust 0, Mini 10, Control D 0
UPDATE incept_neb_allocations SET emp_name = 'Harish Kumar', designation = 'Therapy Manager', team = 'Neb - Arise', robust_qty = 0, mini_qty = 10, control_d_qty = 0, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '179234';
-- 147085 / Paladi Vikas Robust 11, Mini 15, Control D 0
UPDATE incept_neb_allocations SET emp_name = 'Paladi Vikas', designation = 'Therapy Manager', team = 'Neb 1', robust_qty = 11, mini_qty = 15, control_d_qty = 0, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '147085';
-- 149522 / Banty . Robust 11, Mini 15, Control D 0
UPDATE incept_neb_allocations SET emp_name = 'Banty .', designation = 'Therapy Manager', team = 'Neb 1', robust_qty = 11, mini_qty = 15, control_d_qty = 0, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '149522';
-- 173569 / Raghav Tiwari Robust 11, Mini 15, Control D 0
UPDATE incept_neb_allocations SET emp_name = 'Raghav Tiwari', designation = 'Therapy Manager', team = 'Neb 1', robust_qty = 11, mini_qty = 15, control_d_qty = 0, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '173569';
-- 176198 / Enukonda Vishwanth Robust 11, Mini 15, Control D 0
UPDATE incept_neb_allocations SET emp_name = 'Enukonda Vishwanth', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 0, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '176198';
-- 165632 / Aashi Gupta Robust 11, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Aashi Gupta', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '165632';
-- 168436 / Ashish Singh Chauhan Robust 11, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Ashish Singh Chauhan', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '168436';
-- 169088 / Bharti Rajput Robust 11, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Bharti Rajput', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '169088';
-- 169431 / Anamika Anni Shukla Robust 11, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Anamika Anni Shukla', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '169431';
-- 170212 / Upender Yadav Robust 11, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Upender Yadav', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '170212';
-- 170214 / Priyanshi Sharma Robust 11, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Priyanshi Sharma', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '170214';
-- 170282 / Parshant Mavi Robust 11, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Parshant Mavi', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '170282';
-- 171898 / Priyanshu Pandey Robust 11, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Priyanshu Pandey', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '171898';
-- 172432 / Aditya Joshi Robust 11, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Aditya Joshi', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '172432';
-- 176201 / Deepali shrivastav Robust 11, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Deepali shrivastav', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '176201';
-- 177311 / Sakshi Kanojia Robust 6, Mini 10, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Sakshi Kanojia', designation = 'Management Trainee', team = 'Neb 2', robust_qty = 6, mini_qty = 10, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '177311';
-- 127020 / Pawan Panwar Robust 16, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Pawan Panwar', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 16, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '127020';
-- 129394 / Rakesh Kumar Robust 26, Mini 15, Control D 13
UPDATE incept_neb_allocations SET emp_name = 'Rakesh Kumar', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 26, mini_qty = 15, control_d_qty = 13, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '129394';
-- 139813 / Rohit Dhall Robust 24, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Rohit Dhall', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 24, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '139813';
-- 156360 / Akash Kumar Bharti Robust 11, Mini 15, Control D 13
UPDATE incept_neb_allocations SET emp_name = 'Akash Kumar Bharti', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 13, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '156360';
-- 159248 / Ashok Kumar Robust 11, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Ashok Kumar', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '159248';
-- 161573 / Amandeep . Robust 21, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Amandeep .', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 21, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '161573';
-- 165238 / Ankit . Robust 19, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Ankit .', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 19, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '165238';
-- 172211 / Punit Bhardwaj Robust 11, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Punit Bhardwaj', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '172211';
-- 172442 / Sanjana Kumari Robust 11, Mini 15, Control D 10
UPDATE incept_neb_allocations SET emp_name = 'Sanjana Kumari', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 10, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '172442';
-- 174034 / Nandan . Robust 11, Mini 15, Control D 15
UPDATE incept_neb_allocations SET emp_name = 'Nandan .', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 11, mini_qty = 15, control_d_qty = 15, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '174034';
-- 178614 / Digvijay Sagar Robust 0, Mini 10, Control D 13
UPDATE incept_neb_allocations SET emp_name = 'Digvijay Sagar', designation = 'Therapy Manager', team = 'Neb 2', robust_qty = 0, mini_qty = 10, control_d_qty = 13, updated_at = '2026-10-28 00:00:00' WHERE emp_id = '178614';
COMMIT;

View File

@ -1,311 +1,176 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@include('layouts.shared/title-meta', ['title' => "Form"]) @include('layouts.shared/title-meta', ['title' => $form->title ?? 'TGICS'])
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? '']) @include('layouts.shared/head-css', ['mode' => $mode ?? '', 'demo' => $demo ?? ''])
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
</head> </head>
<div id="pageloader"> <body class="preview-approval-body">
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." /> @php
</div> $skipCodes = [
<body class="loading"> 'tgics_contact_id',
<div class="account-pages"> 'user_id',
<div class="container"> 'hierarchy_id',
<div class="row justify-content-center"> 'id',
<div class="col-md-8 col-lg-6 col-xl-5 p-0"> 'execution_done',
<div class="card bg-pattern"> 'execution_date',
<div class="card-body p-3 row"> 'no_of_attendees',
'total_amount_spent_in_rs',
'upload_photo_1',
'upload_photo_2',
'ziten_m_rx',
'total_camp_rx',
'no_of_strips_left_with_fso',
];
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div> $qualification = '';
<br>@endif foreach ($questions ?? [] as $question) {
@if(session('success'))<div class=" alert alert-success">{{ session('success') }} if (($question->code ?? '') === 'qualification') {
</div> $qualification = trim((string) ($question->value ?? ''));
<br>@endif break;
<div class="col-8"> }
<h4 class="page-title">{{$form->title}}</h4> }
</div> $showOtherQualification = strcasecmp($qualification, 'Others') === 0;
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="col-4">
@if($form->link_type == 'form')
<a href="/form/history" class="float-end pt-1">View History</a>
@else
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
@endif
</div>
@endif
@if(isset($form->user_info))
<div class="col-12">
<h6>Submitted By: {{$form->user_info->name}}</h6>
</div>
@endif
$displayValue = function ($question) {
$value = $question->value ?? '';
$options = $question->options ?? [];
$labelFor = function ($raw) use ($options) {
$raw = trim((string) $raw);
if ($raw === '') {
return '';
}
foreach ($options as $option) {
if ((string) ($option->value ?? '') === $raw) {
$display = trim((string) ($option->display ?? ''));
return $display !== '' ? $display : $raw;
}
}
return $raw;
};
if (is_array($value)) {
$labels = [];
foreach ($value as $item) {
$label = $labelFor($item);
if ($label !== '') {
$labels[] = $label;
}
}
return implode(', ', $labels);
}
return $labelFor($value);
};
$isImage = function ($url) {
$path = (string) parse_url($url, PHP_URL_PATH);
return in_array(strtolower(pathinfo($path, PATHINFO_EXTENSION)), ['jpg', 'jpeg', 'png', 'gif', 'webp'], true);
};
@endphp
<div class="approval-container">
<div class="approval-header">
<h1 class="approval-title">{{ $form->title ?? 'TGICS enrolment' }}</h1>
<p class="approval-subtitle">Submitted enrolment details</p>
@if(isset($form->user_info->name) && $form->user_info->name !== '')
<p class="text-muted mb-0">Submitted by: {{ $form->user_info->name }}</p>
@endif
</div>
<div class="detail-list">
@foreach($questions ?? [] as $question)
@php @php
/* echo "<pre>"; $code = (string) ($question->code ?? '');
print_r($submitted_formdata); $type = (string) ($question->type ?? '');
echo "</pre>"; */ if ($code === '' || $type === 'hidden' || in_array($code, $skipCodes, true)) {
$skuData = []; continue;
foreach($questions as $q){
if($q->code === 'sku'){
foreach($q->options as $opt){
$skuData[$opt->value] = $opt->submitted_value ?? 0;
} }
if ($code === 'other_qualification' && !$showOtherQualification) {
continue;
} }
$shown = $displayValue($question);
if ($shown === '') {
continue;
} }
@endphp @endphp
<div class="detail-row">
<span class="detail-label">{{ $question->question }}</span>
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data"> <span class="detail-value">
<input type="hidden" name="form_id" value="{{$form_id}}"> @if($type === 'file' && $shown !== '')
<input type="hidden" name="user_id" value="{{$form->user_id}}"> @if($isImage($shown))
<a href="{{ $shown }}" target="_blank" rel="noopener">
@csrf <img src="{{ $shown }}" alt="{{ $question->question }}" class="preview-image">
@if($id) </a>
<input type="hidden" name="id" value="{{$id}}">
@endif
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
<div class="col-md-12 mb-2">
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
<select class="form-control" id="field-user_id" name="user_id" required>
<option value=""> -- Select -- </option>
@foreach($form->users as $option)
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
@endforeach
</select>
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
</div>
@endif
@foreach($questions as $question)
@if (in_array($question->code, ['execution_date','executed_as_per_plan' ,'revised_start_time','patient_screened','patients_diagnosed','rxn_of_montair_lc_adult','rxn_of_montair_lc_kid_tab','rxn_of_montair_lc_kid_syrup','rxn_of_furamist','rxn_of_furamist_az','total_rxns']))
@continue
@endif
<div class="col-md-12 mb-2">
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
@switch($question->type)
@case('hidden')
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
@break
@case('text')
@case('email')
@case('tel')
@case('date')
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
@break
@case('number')
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
@break
@case('textarea')
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
@break
@case('dropdown')
<select class="form-control" id="field-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
<option value=""> -- Select -- </option>
@if ($question->code == 'contact_id')
@foreach ($question->options as $option)
<option value="{{ $option->value }}" legacy_code="{{isset($option->contact->legacy_code)?$option->contact->legacy_code:''}}" speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
@endforeach
<option value="others" {{ isset($question->value) && $question->value == 'others' ? 'selected':'' }}>
Others
</option>
@elseif($question->code=='contact_id_2')
@foreach ($question->options as $option)
<option value="{{ $option->value }}" legacy_code="{{isset($option->contact->legacy_code)?$option->contact->legacy_code:''}}" speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
@endforeach
@else @else
@foreach ($question->options as $option) <a href="{{ $shown }}" target="_blank" rel="noopener">Open file</a>
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
@endforeach
@endif @endif
</select> @else
@break {{ $shown }}
@case('checkbox')
@foreach($question->options as $option)
<div class="form-check mb-2 form-check-primary">
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
</div>
@endforeach
@break
@case('file')
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" {{$question->required == 'yes'?'required':'' }}>
@elseif(isset($question->value))
<img src="{{$question->value}}" class="img-fluid">
@endif @endif
</span>
@break
{{-- @case('multitextbox')
<div class="row">
@foreach($question->options as $option)
<div class="col-6">{{$option->display}}</div>
<div class="col-6 mb-1">
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
</div> </div>
@endforeach @endforeach
</div> </div>
@break --}} </div>
@case('multitextbox') <style>
<div class="row"> html, body.preview-approval-body {
@foreach($question->options as $option) background: #fff;
<div class="col-6">{{ $option->display }}</div> margin: 0;
<div class="col-6 mb-1"> padding: 0;
<input type="number"
id="field-{{ $option->value }}"
name="{{ $option->value }}"
class="form-control"
required
value="{{ $submitted_formdata->{$option->value} ?? 0 }}">
</div>
@endforeach
</div>
@break
@endswitch
</div>
@endforeach
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="text-center d-grid mt-3">
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
</div>
@endif
</form>
</div> <!-- end card-body -->
</div>
<!-- end card -->
<!-- end row -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
<style type="text/css">
#pageloader {
background: rgba( 255, 255, 255, 0.8 );
display: none;
height: 100%;
position: fixed;
width: 100%;
z-index: 9999;
}
#pageloader img {
left: 50%;
margin-left: -32px;
margin-top: -32px;
position: absolute;
top: 50%;
}
</style>
@include('layouts.shared/footer-script')
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$('#field-user_id').change(function(){
let hierarchy = $('option:selected', this).attr('hierarchy');
$('#field-hierarchy_id').val(hierarchy)
event.preventDefault();
$.ajax({
type: "GET",
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
processData: false,
contentType: false,
success: function( data ) {
$("#pageloader").fadeOut();
$('#field-contact_id').html('')
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
for (let itm of data) {
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display).attr("msl_code", itm.contact.msl_code));
} }
.approval-container {
$('#field-contact_id').change(function() { max-width: 720px;
$('#field-msl_code').val($('option:selected', this).attr('msl_code')) margin: 0 auto;
}) padding: 16px 16px 32px;
}, background: #fff;
});
console.log(hierarchy)
})
$('#field-contact_id').change(function() {
$('#field-speciality').val($('option:selected', this).attr('speciality'))
})
$('#field-contact_id').change(function() {
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
})
$('#field-contact_id,#field-wfsa_code,#field-whatsapp_mobile_number,#field-email_id,#field-age,#field-years_of_practice,#field-type_of_practice,field-city_town,#field-state,#field-qualification').attr('readonly',"true");
$('#report-form').on('submit', function(event){
event.preventDefault();
const formData = new FormData($('#report-form')[0]);
// Log form data to console
for (let [key, value] of formData.entries()) {
console.log(key, value);
} }
.approval-header {
text-align: center;
$("#pageloader").fadeIn(); margin-bottom: 16px;
$.ajax({ padding-bottom: 12px;
type: "POST", border-bottom: 1px solid #e9ecef;
url: '/form/ajaxsubmit',
data: new FormData($('#report-form')[0]),
processData: false,
contentType: false,
success: function( data ) {
$("#pageloader").fadeOut();
if(data.status == 'success') {
Swal.fire({
title: 'Great!',
text: 'Your data is successfully submitted!',
icon: 'success'
})
$('#report-form').trigger("reset");
} else {
Swal.fire({
icon: 'error',
title: 'Data not submitted',
text: 'Something went wrong, please try again after some time!'
})
} }
}, .approval-title {
}); font-size: 1.35rem;
}); font-weight: 600;
margin-bottom: 4px;
var today = new Date(); }
var dd = String(today.getDate()).padStart(2, '0'); .approval-subtitle {
var mm = String(today.getMonth() + 1).padStart(2, '0'); color: #6c757d;
var yyyy = today.getFullYear(); margin-bottom: 4px;
today = yyyy + '-' + mm + '-' + dd; }
.detail-list {
var plandateField = document.getElementById('field-record_date'); border: 1px solid #dee2e6;
border-radius: 8px;
plandateField.setAttribute('max', today); overflow: hidden;
}); }
</script> .detail-row {
display: flex;
justify-content: space-between;
gap: 16px;
padding: 10px 14px;
border-bottom: 1px solid #f1f3f4;
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
font-weight: 600;
color: #495057;
min-width: 140px;
}
.detail-value {
color: #212529;
flex: 1;
text-align: right;
word-break: break-word;
}
.preview-image {
max-width: 180px;
max-height: 140px;
border: 1px solid #dee2e6;
border-radius: 6px;
}
</style>
</body> </body>
</html> </html>