Rapport-Laravel/resources/views/form/rapport-gennovadc/1778315917-59987fce-d422-48...

1267 lines
75 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
@include('layouts.shared/title-meta', ['title' => 'Form'])
@include('layouts.shared/head-css', ['mode' => $mode ?? '', 'demo' => $demo ?? ''])
<link href="{{ asset('assets/libs/sweetalert2/sweetalert2.min.css') }}" rel="stylesheet" type="text/css" />
</head>
<div id="pageloader">
<img src="/images/loader-large.gif" alt="processing..." />
</div>
@php
$brandData = [
['brand'=>'VemA Meet', 'slug'=>'vema_meet','pseudoId'=>'vema_meet_1','pseudoId2'=>'vema_meet_2','pseudoId3'=>'vema_meet_3','pseudoId4'=>'vema_meet_4'],
['brand'=>'VemA TECH', 'slug'=>'vema_tech','pseudoId'=>'vema_tech_1','pseudoId2'=>'vema_tech_2','pseudoId3'=>'vema_tech_3','pseudoId4'=>'vema_tech_4'],
['brand'=>'VemA DTECH', 'slug'=>'vema_dtech','pseudoId'=>'vema_dtech_1','pseudoId2'=>'vema_dtech_2','pseudoId3'=>'vema_dtech_3','pseudoId4'=>'vema_dtech_4'],
['brand'=>'VemA Times', 'slug'=>'vema_times','pseudoId'=>'vema_times_1','pseudoId2'=>'vema_times_2','pseudoId3'=>'vema_times_3','pseudoId4'=>'vema_times_4'],
['brand'=>'VemA 360', 'slug'=>'vema_360','pseudoId'=>'vema_360_1','pseudoId2'=>'vema_360_2','pseudoId3'=>'vema_360_3','pseudoId4'=>'vema_360_4'],
['brand'=>'VemA Clinic', 'slug'=>'vema_clinic','pseudoId'=>'vema_clinic_1','pseudoId2'=>'vema_clinic_2','pseudoId3'=>'vema_clinic_3','pseudoId4'=>'vema_clinic_4'],
['brand'=>'CME Event', 'slug'=>'cme_event','pseudoId'=>'cme_event_1','pseudoId2'=>'cme_event_2','pseudoId3'=>'cme_event_3','pseudoId4'=>'cme_event_4'],
['brand'=>'DynaMeet', 'slug'=>'dynameet','pseudoId'=>'dynameet_1','pseudoId2'=>'dynameet_2','pseudoId3'=>'dynameet_3','pseudoId4'=>'dynameet_4'],
['brand'=>'RWE Activity', 'slug'=>'rwe_activity','pseudoId'=>'rwe_activity_1','pseudoId2'=>'rwe_activity_2','pseudoId3'=>'rwe_activity_3','pseudoId4'=>'rwe_activity_4'],
['brand'=>'VemA DT-Tech', 'slug'=>'vema_dt_tech','pseudoId'=>'vema_dt_tech_1','pseudoId2'=>'vema_dt_tech_2','pseudoId3'=>'vema_dt_tech_3','pseudoId4'=>'vema_dt_tech_4'],
['brand'=>'VIMOT', 'slug'=>'vimot','pseudoId'=>'vimot_1','pseudoId2'=>'vimot_2','pseudoId3'=>'vimot_3','pseudoId4'=>'vimot_4'],
['brand'=>'LIVA GRAFTSOL', 'slug'=>'liva_graftsol','pseudoId'=>'liva_graftsol_1','pseudoId2'=>'liva_graftsol_2','pseudoId3'=>'liva_graftsol_3','pseudoId4'=>'liva_graftsol_4'],
['brand'=>'TRANSCOR', 'slug'=>'transcor','pseudoId'=>'transcor_1','pseudoId2'=>'transcor_2','pseudoId3'=>'transcor_3','pseudoId4'=>'transcor_4'],
['brand'=>'Total Monthly Activity Count', 'slug'=>'total','pseudoId'=>'total_1','pseudoId2'=>'total_2','pseudoId3'=>'total_3','pseudoId4'=>'total_4'],
];
$brandData2 = [
['brand'=>'VemA Meet', 'slug'=>'vema_meet_exe_1', 'pseudoId'=>'vema_meet_exe_2', 'pseudoId2'=>'vema_meet_exe_3', 'pseudoId3'=>'vema_meet_exe_4'],
['brand'=>'VemA TECH', 'slug'=>'vema_tech_exe_1', 'pseudoId'=>'vema_tech_exe_2', 'pseudoId2'=>'vema_tech_exe_3', 'pseudoId3'=>'vema_tech_exe_4'],
['brand'=>'VemA DTECH', 'slug'=>'vema_dtech_exe_1', 'pseudoId'=>'vema_dtech_exe_2', 'pseudoId2'=>'vema_dtech_exe_3', 'pseudoId3'=>'vema_dtech_exe_4'],
['brand'=>'VemA Times', 'slug'=>'vema_times_exe_1', 'pseudoId'=>'vema_times_exe_2', 'pseudoId2'=>'vema_times_exe_3', 'pseudoId3'=>'vema_times_exe_4'],
['brand'=>'VemA 360', 'slug'=>'vema_360_exe_1', 'pseudoId'=>'vema_360_exe_2', 'pseudoId2'=>'vema_360_exe_3', 'pseudoId3'=>'vema_360_exe_4'],
['brand'=>'VemA Clinic', 'slug'=>'vema_clinic_exe_1', 'pseudoId'=>'vema_clinic_exe_2', 'pseudoId2'=>'vema_clinic_exe_3', 'pseudoId3'=>'vema_clinic_exe_4'],
['brand'=>'CME Event', 'slug'=>'cme_event_exe_1', 'pseudoId'=>'cme_event_exe_2', 'pseudoId2'=>'cme_event_exe_3', 'pseudoId3'=>'cme_event_exe_4'],
['brand'=>'DynaMeet', 'slug'=>'dynameet_exe_1', 'pseudoId'=>'dynameet_exe_2', 'pseudoId2'=>'dynameet_exe_3', 'pseudoId3'=>'dynameet_exe_4'],
['brand'=>'RWE Activity', 'slug'=>'rwe_activity_exe_1', 'pseudoId'=>'rwe_activity_exe_2', 'pseudoId2'=>'rwe_activity_exe_3', 'pseudoId3'=>'rwe_activity_exe_4'],
['brand'=>'VemA DT-Tech', 'slug'=>'vema_dt_tech_exe_1', 'pseudoId'=>'vema_dt_tech_exe_2', 'pseudoId2'=>'vema_dt_tech_exe_3', 'pseudoId3'=>'vema_dt_tech_exe_4'],
['brand'=>'VIMOT', 'slug'=>'vimot_exe_1', 'pseudoId'=>'vimot_exe_2', 'pseudoId2'=>'vimot_exe_3', 'pseudoId3'=>'vimot_exe_4'],
['brand'=>'LIVA GRAFTSOL', 'slug'=>'liva_graftsol_exe_1', 'pseudoId'=>'liva_graftsol_exe_2', 'pseudoId2'=>'liva_graftsol_exe_3', 'pseudoId3'=>'liva_graftsol_exe_4'],
['brand'=>'TRANSCOR', 'slug'=>'transcor_exe_1', 'pseudoId'=>'transcor_exe_2', 'pseudoId2'=>'transcor_exe_3', 'pseudoId3'=>'transcor_exe_4'],
['brand'=>'Total Monthly Activity Count','slug'=>'total_exe_1', 'pseudoId'=>'total_exe_2', 'pseudoId2'=>'total_exe_3', 'pseudoId3'=>'total_exe_4'],
];
@endphp
<body class="loading">
<div class="account-pages">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
<div class="card">
<div class="card-body p-3 row">
@if (Session::has('error'))
<div class="alert alert-danger">{{ Session::get('error') }}</div>
<br>
@endif
@if (session('success'))
<div class=" alert alert-success">{{ session('success') }}
</div>
<br>
@endif
{{-- <div class="col-8">
<h4 class="page-title">Plan Vs Execution Tracker</h4>
</div> --}}
@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> -->
<button type="button" class="btn btn-primary btn-xs" id="add-camp-btn">Add
Plan</button>
@else
<a href="{{ url()->previous() }}" class="float-end pt-1">Back</a>
@endif
</div>
@endif
@php
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
// echo "<pre>";
// print_r($history);
@endphp
<div class="col-12" id="table-wrapper">
<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>Plan Date</th>
<th>Execution Done</th>
<th>Plan Month</th>
<th>Centre Name</th>
<th>Execution Date</th>
<th>VemA Meet Planned Monthly Count </th>
<th>VemA TECH Planned Monthly Count </th>
<th>VemA DTECH Planned Monthly Count </th>
<th>VemA Times Planned Monthly Count </th>
<th>VemA 360 Planned Monthly Count </th>
<th>VemA Clinic Planned Monthly Count </th>
<th>CME Event Planned Monthly Count </th>
<th>DynaMeet Planned Monthly Count </th>
<th>RWE Activity Planned Monthly Count </th>
<th>VemA DT-Tech Planned Monthly Count </th>
<th>VIMOT Planned Monthly Count </th>
<th>LIVA GRAFTSOL Planned Monthly Count </th>
<th>TRANSCOR Planned Monthly Count </th>
<th>Total Planned Monthly Count</th>
<th>VemA Meet Week 1 Planned </th>
<th>VemA TECH Week 1 Planned </th>
<th>VemA DTECH Week 1 Planned </th>
<th>VemA Times Week 1 Planned </th>
<th>VemA 360 Week 1 Planned</th>
<th>VemA Clinic Week 1 Planned</th>
<th>CME Event Week 1 Planned</th>
<th>DynaMeet Week 1 Planned</th>
<th>RWE Activity Week 1 Planned</th>
<th>VemA DT-Tech Week 1 Planned</th>
<th>VIMOT Week 1 Planned</th>
<th>LIVA GRAFTSOL Week 1 Planned</th>
<th>TRANSCOR Week 1 Planned</th>
<th>Total Week 1 Planned</th>
<th>VemA Meet Week 2 Planned </th>
<th>VemA TECH Week 2 Planned </th>
<th>VemA DTECH Week 2 Planned </th>
<th>VemA Times Week 2 Planned </th>
<th>VemA 360 Week 2 Planned</th>
<th>VemA Clinic Week 2 Planned</th>
<th>CME Event Week 2 Planned</th>
<th>DynaMeet Week 2 Planned</th>
<th>RWE Activity Week 2 Planned</th>
<th>VemA DT-Tech Week 2 Planned</th>
<th>VIMOT Week 2 Planned</th>
<th>LIVA GRAFTSOL Week 2 Planned</th>
<th>TRANSCOR Week 2 Planned</th>
<th>Total Week 2 Planned</th>
<th>VemA Meet Week 3 Planned </th>
<th>VemA TECH Week 3 Planned </th>
<th>VemA DTECH Week 3 Planned </th>
<th>VemA Times Week 3 Planned </th>
<th>VemA 360 Week 3 Planned</th>
<th>VemA Clinic Week 3 Planned</th>
<th>CME Event Week 3 Planned</th>
<th>DynaMeet Week 3 Planned</th>
<th>RWE Activity Week 3 Planned</th>
<th>VemA DT-Tech Week 3 Planned</th>
<th>VIMOT Week 3 Planned</th>
<th>LIVA GRAFTSOL Week 3 Planned</th>
<th>TRANSCOR Week 3 Planned</th>
<th>Total Week 3 Planned</th>
<th>VemA Meet Week 4 Planned </th>
<th>VemA TECH Week 4 Planned </th>
<th>VemA DTECH Week 4 Planned </th>
<th>VemA Times Week 4 Planned </th>
<th>VemA 360 Week 4 Planned</th>
<th>VemA Clinic Week 4 Planned</th>
<th>CME Event Week 4 Planned</th>
<th>DynaMeet Week 4 Planned</th>
<th>RWE Activity Week 4 Planned</th>
<th>VemA DT-Tech Week 4 Planned</th>
<th>VIMOT Week 4 Planned</th>
<th>LIVA GRAFTSOL Week 4 Planned</th>
<th>TRANSCOR Week 4 Planned</th>
<th>Total Week 4 Planned</th>
</tr>
</thead>
<tbody>
@foreach ($history->data->submissions as $sub)
@php
$sub->formdata->id = $sub->id;
@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> Execute</button>
<button type="button" class="btn btn-xs btn-info edit-plan-btn"
plan_details="{{ json_encode($sub->formdata) }}"><i
class="mdi mdi-pencil"></i> Edit Plan</button>
</td>
<td>{{ $sub->formdata->plan_date }}</td>
<td>{{ isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'Yes' ? 'Yes' : 'No' }}
</td>
<td>{{isset($sub->formdata->select_month) ? $sub->formdata->select_month: ''}}</td>
<td>
@if (isset($sub->formdata->center_name) && $sub->formdata->center_name !== '')
{{ $sub->formdata->center_name }}
@endif
</td>
<td>{{$sub->formdata->execution_date}}</td>
<td>{{isset($sub->formdata->vema_meet) ? $sub->formdata->vema_meet: ''}}</td>
<td>{{isset($sub->formdata->vema_tech) ? $sub->formdata->vema_tech: ''}}</td>
<td>{{isset($sub->formdata->vema_dtech) ? $sub->formdata->vema_dtech: ''}}</td>
<td>{{isset($sub->formdata->vema_times) ? $sub->formdata->vema_times: ''}}</td>
<td>{{isset($sub->formdata->vema_360) ? $sub->formdata->vema_360: ''}}</td>
<td>{{isset($sub->formdata->vema_clinic) ? $sub->formdata->vema_clinic: ''}}</td>
<td>{{isset($sub->formdata->cme_event) ? $sub->formdata->cme_event: ''}}</td>
<td>{{isset($sub->formdata->dynameet) ? $sub->formdata->dynameet: ''}}</td>
<td>{{isset($sub->formdata->rwe_activity) ? $sub->formdata->rwe_activity: ''}}</td>
<td>{{isset($sub->formdata->vema_dt_tech) ? $sub->formdata->vema_dt_tech: ''}}</td>
<td>{{isset($sub->formdata->vimot) ? $sub->formdata->vimot: ''}}</td>
<td>{{isset($sub->formdata->liva_graftsol) ? $sub->formdata->liva_graftsol: ''}}</td>
<td>{{isset($sub->formdata->transcor) ? $sub->formdata->transcor: ''}}</td>
<td>{{isset($sub->formdata->total) ? $sub->formdata->total: ''}}</td>
<td>{{isset($sub->formdata->vema_meet_1) ? $sub->formdata->vema_meet_1: ''}}</td>
<td>{{isset($sub->formdata->vema_tech_1) ? $sub->formdata->vema_tech_1: ''}}</td>
<td>{{isset($sub->formdata->vema_dtech_1) ? $sub->formdata->vema_dtech_1: ''}}</td>
<td>{{isset($sub->formdata->vema_times_1) ? $sub->formdata->vema_times_1: ''}}</td>
<td>{{isset($sub->formdata->vema_360_1) ? $sub->formdata->vema_360_1: ''}}</td>
<td>{{isset($sub->formdata->vema_clinic_1) ? $sub->formdata->vema_clinic_1: ''}}</td>
<td>{{isset($sub->formdata->cme_event_1) ? $sub->formdata->cme_event_1: ''}}</td>
<td>{{isset($sub->formdata->dynameet_1) ? $sub->formdata->dynameet_1: ''}}</td>
<td>{{isset($sub->formdata->rwe_activity_1) ? $sub->formdata->rwe_activity_1: ''}}</td>
<td>{{isset($sub->formdata->vema_dt_tech_1) ? $sub->formdata->vema_dt_tech_1: ''}}</td>
<td>{{isset($sub->formdata->vimot_1) ? $sub->formdata->vimot_1: ''}}</td>
<td>{{isset($sub->formdata->liva_graftsol_1) ? $sub->formdata->liva_graftsol_1: ''}}</td>
<td>{{isset($sub->formdata->transcor_1) ? $sub->formdata->transcor_1: ''}}</td>
<td>{{isset($sub->formdata->total_1) ? $sub->formdata->total_1: ''}}</td>
<td>{{isset($sub->formdata->vema_meet_2) ? $sub->formdata->vema_meet_2: ''}}</td>
<td>{{isset($sub->formdata->vema_tech_2) ? $sub->formdata->vema_tech_2: ''}}</td>
<td>{{isset($sub->formdata->vema_dtech_2) ? $sub->formdata->vema_dtech_2: ''}}</td>
<td>{{isset($sub->formdata->vema_times_2) ? $sub->formdata->vema_times_2: ''}}</td>
<td>{{isset($sub->formdata->vema_360_2) ? $sub->formdata->vema_360_2: ''}}</td>
<td>{{isset($sub->formdata->vema_clinic_2) ? $sub->formdata->vema_clinic_2: ''}}</td>
<td>{{isset($sub->formdata->cme_event_2) ? $sub->formdata->cme_event_2: ''}}</td>
<td>{{isset($sub->formdata->dynameet_2) ? $sub->formdata->dynameet_2: ''}}</td>
<td>{{isset($sub->formdata->rwe_activity_2) ? $sub->formdata->rwe_activity_2: ''}}</td>
<td>{{isset($sub->formdata->vema_dt_tech_2) ? $sub->formdata->vema_dt_tech_2: ''}}</td>
<td>{{isset($sub->formdata->vimot_2) ? $sub->formdata->vimot_2: ''}}</td>
<td>{{isset($sub->formdata->liva_graftsol_2) ? $sub->formdata->liva_graftsol_2: ''}}</td>
<td>{{isset($sub->formdata->transcor_2) ? $sub->formdata->transcor_2: ''}}</td>
<td>{{isset($sub->formdata->total_2) ? $sub->formdata->total_2: ''}}</td>
<td>{{isset($sub->formdata->vema_meet_3) ? $sub->formdata->vema_meet_3: ''}}</td>
<td>{{isset($sub->formdata->vema_tech_3) ? $sub->formdata->vema_tech_3: ''}}</td>
<td>{{isset($sub->formdata->vema_dtech_3) ? $sub->formdata->vema_dtech_3: ''}}</td>
<td>{{isset($sub->formdata->vema_times_3) ? $sub->formdata->vema_times_3: ''}}</td>
<td>{{isset($sub->formdata->vema_360_3) ? $sub->formdata->vema_360_3: ''}}</td>
<td>{{isset($sub->formdata->vema_clinic_3) ? $sub->formdata->vema_clinic_3: ''}}</td>
<td>{{isset($sub->formdata->cme_event_3) ? $sub->formdata->cme_event_3: ''}}</td>
<td>{{isset($sub->formdata->dynameet_3) ? $sub->formdata->dynameet_3: ''}}</td>
<td>{{isset($sub->formdata->rwe_activity_3) ? $sub->formdata->rwe_activity_3: ''}}</td>
<td>{{isset($sub->formdata->vema_dt_tech_3) ? $sub->formdata->vema_dt_tech_3: ''}}</td>
<td>{{isset($sub->formdata->vimot_3) ? $sub->formdata->vimot_3: ''}}</td>
<td>{{isset($sub->formdata->liva_graftsol_3) ? $sub->formdata->liva_graftsol_3: ''}}</td>
<td>{{isset($sub->formdata->transcor_3) ? $sub->formdata->transcor_3: ''}}</td>
<td>{{isset($sub->formdata->total_3) ? $sub->formdata->total_3: ''}}</td>
<td>{{isset($sub->formdata->vema_meet_4) ? $sub->formdata->vema_meet_4: ''}}</td>
<td>{{isset($sub->formdata->vema_tech_4) ? $sub->formdata->vema_tech_4: ''}}</td>
<td>{{isset($sub->formdata->vema_dtech_4) ? $sub->formdata->vema_dtech_4: ''}}</td>
<td>{{isset($sub->formdata->vema_times_4) ? $sub->formdata->vema_times_4: ''}}</td>
<td>{{isset($sub->formdata->vema_460_4) ? $sub->formdata->vema_460_4: ''}}</td>
<td>{{isset($sub->formdata->vema_clinic_4) ? $sub->formdata->vema_clinic_4: ''}}</td>
<td>{{isset($sub->formdata->cme_event_4) ? $sub->formdata->cme_event_4: ''}}</td>
<td>{{isset($sub->formdata->dynameet_4) ? $sub->formdata->dynameet_4: ''}}</td>
<td>{{isset($sub->formdata->rwe_activity_4) ? $sub->formdata->rwe_activity_4: ''}}</td>
<td>{{isset($sub->formdata->vema_dt_tech_4) ? $sub->formdata->vema_dt_tech_4: ''}}</td>
<td>{{isset($sub->formdata->vimot_4) ? $sub->formdata->vimot_4: ''}}</td>
<td>{{isset($sub->formdata->liva_graftsol_4) ? $sub->formdata->liva_graftsol_4: ''}}</td>
<td>{{isset($sub->formdata->transcor_4) ? $sub->formdata->transcor_4: ''}}</td>
<td>{{isset($sub->formdata->total_4) ? $sub->formdata->total_4: ''}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<div id="form-wrapper">
<div class="col-8">
<h5 class="page-title">Plan</h5>
</div>
<form method="POST" action="/form/submit" id="report-form"
enctype="multipart/form-data">
<input type="hidden" name="form_id" value="{{ $form_id }}">
@csrf
@if ($id)
<input type="hidden" name="id" value="{{ $id }}">
<input type="hidden" name="dummyformid" value="" id="field-dummyformid">
@endif
@foreach ($questions as $question)
@if (in_array($question->code, ['execution_date','activity_execution','execution_week']))
@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>
@foreach ($question->options as $option)
{{-- Doctor dropdown --}}
@if($question->code == 'contact_id'
&& isset($option->contact->type)
&& $option->contact->type == 'doctor')
<option value="{{ $option->value }}"
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
msl_code="{{ $option->contact->uid_number ?? '' }}"
speciality="{{ $option->contact->speciality ?? '' }}">
{{ $option->display }}
</option>
{{-- Center dropdown --}}
@elseif($question->code == 'center_name'
&& isset($option->contact->type)
&& $option->contact->type == 'center')
<option value="{{ $option->value }}"
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
{{-- Other dropdowns --}}
@elseif($question->code != 'contact_id' && $question->code != 'center_name')
<option value="{{ $option->value }}"
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
@endif
@endforeach
</select>
@break
@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')
<input type="file" id="field-{{ $question->code }}" name="{{ $question->code }}"
class="form-control" value="" accept="image/jpg, image/jpeg, image/png"
required>
@break
@case('multitextbox')
<div class="row">
<div style="width: auto; overflow-y: auto; overflow-x: auto;">
<table class="table tableclass">
<thead id="heading">
<tr>
<th>Activity</th>
<th>Enter Monthly Activity Count</th>
<th>Week 1 Count of Activity Plan</th>
<th>Week 2 Count of Activity Plan</th>
<th>Week 3 Count of Activity Plan</th>
<th>Week 4 Count of Activity Plan</th>
</tr>
</thead>
<tbody>
@foreach($brandData as $brand)
<tr>
<td>{{ $brand['brand'] }}</td>
<td>
<input type="number" step="1" min="0" id="field-{{ $brand['slug'] }}"
name="{{ $brand['slug'] }}"
class="form-control form-control-large" value="{{ $id && isset($formdata) && isset($formdata->{$brand['slug']}) ? $formdata->{$brand['slug']} : 0 }}">
</td>
<td>
<input type="number" step="1" min="0" id="field-{{ $brand['pseudoId'] }}"
name="{{ $brand['pseudoId'] }}"
class="form-control form-control-large" readonly="true" value="{{ $id && isset($formdata) && isset($formdata->{$brand['pseudoId']}) ? $formdata->{$brand['pseudoId']} : 0 }}" >
</td>
<td>
<input type="number" step="1" min="0" id="field-{{ $brand['pseudoId2'] }}"
name="{{ $brand['pseudoId2'] }}"
class="form-control form-control-large" readonly="true" value="{{ $id && isset($formdata) && isset($formdata->{$brand['pseudoId2']}) ? $formdata->{$brand['pseudoId2']} : 0 }}">
</td>
<td>
<input type="number" step="1" min="0" id="field-{{ $brand['pseudoId3'] }}"
name="{{ $brand['pseudoId3'] }}"
class="form-control form-control-large" readonly="true" value="{{ $id && isset($formdata) && isset($formdata->{$brand['pseudoId3']}) ? $formdata->{$brand['pseudoId3']} : 0 }}">
</td>
<td>
<input type="number" step="1" min="0" id="field-{{ $brand['pseudoId4'] }}"
name="{{ $brand['pseudoId4'] }}"
class="form-control form-control-large" readonly="true" value="{{ $id && isset($formdata) && isset($formdata->{$brand['pseudoId4']}) ? $formdata->{$brand['pseudoId4']} : 0 }}">
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</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>
<div id="execution-form-wrapper">
<div class="col-8">
<h5 class="page-title">Execution</h5>
</div>
<form method="POST" action="/form/submit" id="execution-form"
enctype="multipart/form-data">
<input type="hidden" name="form_id" value="{{ $form_id }}">
@csrf
<input type="hidden" name="id" value="" id="execution-id">
<input type="hidden" name="dummyformid" value="" id="execution-dummyformid">
{{-- <input type="hidden" name="execution_done" value="yes"> --}}
@foreach ($questions as $question)
<div class="col-md-12 mb-2">
<label for="execution-{{ $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="execution-{{ $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="execution-{{ $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="execution-{{ $question->code }}" name="{{ $question->code }}"
class="form-control" {{ $question->required == 'yes' ? 'required' : '' }}
value="{{ isset($question->value) ? $question->value : 0 }}">
@break
@case('textarea')
<textarea id="execution-{{ $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="execution-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
<option value=""> -- Select -- </option>
@foreach ($question->options as $option)
{{-- Doctor dropdown --}}
@if($question->code == 'contact_id'
&& isset($option->contact->type)
&& $option->contact->type == 'doctor')
<option value="{{ $option->value }}"
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
msl_code="{{ $option->contact->uid_number ?? '' }}"
speciality="{{ $option->contact->speciality ?? '' }}">
{{ $option->display }}
</option>
{{-- Center dropdown --}}
@elseif($question->code == 'center_name'
&& isset($option->contact->type)
&& $option->contact->type == 'center')
<option value="{{ $option->value }}"
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
{{-- Other dropdowns --}}
@elseif($question->code != 'contact_id' && $question->code != 'center_name')
<option value="{{ $option->value }}"
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
{{ $option->display }}
</option>
@endif
@endforeach
</select>
@break
@case('checkbox')
@foreach ($question->options as $option)
<div class="form-check mb-2 form-check-primary">
<input class="form-check-input" type="checkbox"
id="execution-{{ $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="execution-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
</div>
@endforeach
@break
@case('file')
<input type="file" id="execution-{{ $question->code }}"
name="{{ $question->code }}" class="form-control" value=""
accept="image/jpg, image/jpeg, image/png">
@break
@case('multitextbox')
@if($question->code=='activity')
<div class="row">
<div style="width: auto; overflow-y: auto; overflow-x: auto;">
<table class="table tableclass">
<thead id="heading">
<tr>
<th>Activity</th>
<th>Enter Monthly Activity Count</th>
<th>Week 1 Count of Activity Plan</th>
<th>Week 2 Count of Activity Plan</th>
<th>Week 3 Count of Activity Plan</th>
<th>Week 4 Count of Activity Plan</th>
</tr>
</thead>
<tbody>
@foreach($brandData as $brand)
<tr>
<td>{{ $brand['brand'] }}</td>
<td>
<input type="number" step="1" min="0" id="execution-{{ $brand['slug'] }}"
name="{{ $brand['slug'] }}"
class="form-control form-control-large" readonly="true" value="{{ $id && isset($formdata) && isset($formdata->{$brand['slug']}) ? $formdata->{$brand['slug']} : 0 }}">
</td>
<td>
<input type="number" step="1" min="0" id="execution-{{ $brand['pseudoId'] }}"
name="{{ $brand['pseudoId'] }}"
class="form-control form-control-large" readonly="true" value="{{ $id && isset($formdata) && isset($formdata->{$brand['pseudoId']}) ? $formdata->{$brand['pseudoId']} : 0 }}" >
</td>
<td>
<input type="number" step="1" min="0" id="execution-{{ $brand['pseudoId2'] }}"
name="{{ $brand['pseudoId2'] }}"
class="form-control form-control-large" readonly="true" value="{{ $id && isset($formdata) && isset($formdata->{$brand['pseudoId2']}) ? $formdata->{$brand['pseudoId2']} : 0 }}">
</td>
<td>
<input type="number" step="1" min="0" id="execution-{{ $brand['pseudoId3'] }}"
name="{{ $brand['pseudoId3'] }}"
class="form-control form-control-large" readonly="true" value="{{ $id && isset($formdata) && isset($formdata->{$brand['pseudoId3']}) ? $formdata->{$brand['pseudoId3']} : 0 }}">
</td>
<td>
<input type="number" step="1" min="0" id="execution-{{ $brand['pseudoId4'] }}"
name="{{ $brand['pseudoId4'] }}"
class="form-control form-control-large" readonly="true" value="{{ $id && isset($formdata) && isset($formdata->{$brand['pseudoId4']}) ? $formdata->{$brand['pseudoId4']} : 0 }}">
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
@if($question->code=='activity_execution')
<div class="row" id="execution-table">
<div style="width: auto; overflow-y: auto; overflow-x: auto;">
<table class="table table-bordered tableclass ">
<thead id="heading">
<tr>
<th>Activity</th>
<th>Week 1 Count of Activity Execution</th>
<th>Week 2 Count of Activity Execution</th>
<th>Week 3 Count of Activity Execution</th>
<th>Week 4 Count of Activity Execution</th>
</tr>
</thead>
<tbody>
@foreach($brandData2 as $brand)
<tr>
<td>{{ $brand['brand'] }}</td>
<td>
<input type="number" step="1" min="0" id="execution-{{ $brand['slug'] }}"
name="{{ $brand['slug'] }}"
class="form-control form-control-large" value="{{ $id && isset($formdata) && isset($formdata->{$brand['slug']}) ? $formdata->{$brand['slug']} : 0 }}" >
</td>
<td>
<input type="number" step="1" min="0" id="execution-{{ $brand['pseudoId'] }}"
name="{{ $brand['pseudoId'] }}"
class="form-control form-control-large" value="{{ $id && isset($formdata) && isset($formdata->{$brand['pseudoId']}) ? $formdata->{$brand['pseudoId']} : 0 }}">
</td>
<td>
<input type="number" step="1" min="0" id="execution-{{ $brand['pseudoId2'] }}"
name="{{ $brand['pseudoId2'] }}"
class="form-control form-control-large" value="{{ $id && isset($formdata) && isset($formdata->{$brand['pseudoId2']}) ? $formdata->{$brand['pseudoId2']} : 0 }}">
</td>
<td>
<input type="number" step="1" min="0" id="execution-{{ $brand['pseudoId3'] }}"
name="{{ $brand['pseudoId3'] }}"
class="form-control form-control-large" value="{{ $id && isset($formdata) && isset($formdata->{$brand['pseudoId3']}) ? $formdata->{$brand['pseudoId3']} : 0 }}">
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
@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>
</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%;
}
.form-control-large{
width: 75px;
}
</style>
@include('layouts.shared/footer-script')
<script src="{{ asset('assets/libs/sweetalert2/sweetalert2.min.js') }}"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#form-wrapper').hide()
$('#execution-form-wrapper').hide()
// $('#add-camp-btn').click(function() {
// $('#form-wrapper').show()
// $('#table-wrapper').hide()
// })
$('#add-camp-btn').click(function() {
$('#table-wrapper').hide(0)
$('#form-wrapper').show(100, () => {
$('#add-camp-btn').hide(0);
})
})
$('#field-select_plan_week').on('change',function(){
let week=$('#field-select_plan_week').val();
console.log("week :",week);
})
$('.edit-btn').click(function() {
$('#execution-form-wrapper').show(100, () => {
$('#add-camp-btn').hide(0);
})
$('#table-wrapper').hide()
$('#execution-form').append('<input type="hidden" name="execution_done" value="Yes"/>');
/* let contacts=document.getElementById('execution-contact_id');
contacts.addEventListener('mousedown',function(e){
e.preventDefault();
}) */
let centers=document.getElementById('execution-center_name');
centers.addEventListener('mousedown',function(e){
e.preventDefault();
})
$('#execution-speciality').prop('readonly', true)
$('#execution-plan_date').prop('readonly', true)
$('#execution-msl_code').prop('readonly',true);
//$('#execution-time').prop('disabled', true)
let selected = JSON.parse($(this).attr('plan_details'))
$('#execution-dummyformid').val(selected['proxy_formid'])
console.log("Plan_Details : ",selected);
console.log("Hospital Name is : ",selected['contact_id']);
for (let k of Object.keys(selected)) {
if (selected[k] != '') {
if (k == 'contact_id') {
//$("#execution-contact_id option:contains(" + selected[k] + ")").prop('selected', true)
// console.log($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'))
$('#execution-contact_id').val($("#execution-contact_id option:contains(" +
selected[k] + ")").attr('value'));
}
else
$('#execution-' + k).val(selected[k]);
}
// if(selected[k] != '')
// $('#execution-'+k).val(selected[k]);
}
/* let docid = $('#execution-contact_id option').map(function() {
if ($(this).text().trim() == selected['contact_id']) return this;
}).attr('value')
console.log("docid : ",docid);
$('#execution-contact_id').val(docid)
$('#execution-id').val(selected['id']) */
let centerid = $('#execution-center_name option').map(function() {
if ($(this).text().trim() == selected['center_name']) return this;
}).attr('value')
console.log("docid : ",centerid);
$('#execution-center_name').val(centerid)
$('[id*="_exe_"]').prop('readonly', true);
$('#execution-execution_week').on('change', function () {
let selectedWeek = $(this).val();
const activity = ['vema_meet', 'vema_tech', 'vema_dtech', 'vema_times','vema_360','vema_clinic','cme_event','dynameet','rwe_activity','vema_dt_tech','vimot','liva_graftsol','transcor','total_activity'];
// First enable all fields
$('[id*="_exe_"]').prop('readonly', false);
// Disable all weeks except selected
for (let week = 1; week <= 4; week++) {
if (week == selectedWeek) continue;
activity.forEach(activity => {
let id = `#execution-${activity}_exe_${week}`;
$(id).prop('readonly', true);
});
}
});
$(document).ready(function () {
function calculateWeekTotals() {
// Loop through all 4 weeks
for (let week = 1; week <= 4; week++) {
let total = 0;
// Select all inputs ending with _exe_WEEK
$(`input[id$="_exe_${week}"]`).each(function () {
let id = $(this).attr('id');
// Skip total field itself
if (!id.includes('total_exe')) {
total += parseInt($(this).val()) || 0;
}
});
// Set total in total row
$(`#execution-total_exe_${week}`).val(total);
}
}
// Trigger on any input change
$('.tableclass input[type="number"]').on('input', function () {
calculateWeekTotals();
});
// Initial calculation on page load
calculateWeekTotals();
});
$('#execution-total_exe_1,#execution-total_exe_2,#execution-total_exe_3,#execution-total_exe_4').prop('readonly',true);
})
$('.edit-plan-btn').click(function() {
$('#execution-form-wrapper').show(100, () => {
$('#add-camp-btn').hide(0);
})
$('#table-wrapper').hide()
$('#execution-msl_code').prop('readonly',true);
let selected = JSON.parse($(this).attr('plan_details'))
console.log("Plan_Details : ",selected);
console.log("Hospital Name is : ",selected['contact_id']);
$('#execution-dummyformid').val(selected['proxy_formid'])
for (let k of Object.keys(selected)) {
if (selected[k] != '') {
if (k == 'contact_id') {
//$("#execution-contact_id option:contains(" + selected[k] + ")").prop('selected', true)
// console.log($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'))
$('#execution-contact_id').val($("#execution-contact_id option:contains(" +
selected[k] + ")").attr('value'));
}
else
$('#execution-' + k).val(selected[k]);
}
// if(selected[k] != '')
// $('#execution-'+k).val(selected[k]);
}
let docid = $('#execution-contact_id option').map(function() {
if ($(this).text().trim() == selected['contact_id']) return this;
}).attr('value')
console.log("docid : ",docid);
$('#execution-contact_id').val(docid)
$('#execution-id').val(selected['id'])
let centerid = $('#execution-center_name option').map(function() {
if ($(this).text().trim() == selected['center_name']) return this;
}).attr('value')
console.log("docid : ",centerid);
$('#execution-center_name').val(centerid)
$('#execution-execution_date,#execution-execution_week,#execution-table').parent().hide();
$('#execution-execution_date,#execution-execution_week,#execution-table').attr('required',false);
// Make first column inputs editable except total row
$('input[id^="execution-"]').each(function () {
let id = $(this).attr('id');
// Monthly activity count column only
// Exclude week fields (_1, _2, _3, _4) and total row
if (
!id.match(/_(1|2|3|4)$/) &&
id !== 'execution-total'
) {
$(this).prop('readonly', false);
}
});
$(document).ready(function () {
const activities = [
'vema_meet',
'vema_tech',
'vema_dtech',
'vema_times',
'vema_360',
'vema_clinic',
'cme_event',
'dynameet',
'rwe_activity',
'vema_dt_tech',
'vimot',
'liva_graftsol',
'transcor'
];
function calculateTotals() {
let totalMonthly = 0;
let totalWeek1 = 0;
let totalWeek2 = 0;
let totalWeek3 = 0;
let totalWeek4 = 0;
activities.forEach(function (activity) {
let monthly = parseFloat($('#execution-' + activity).val()) || 0;
let week1 = Math.round(monthly * 0.20);
let week2 = Math.round(monthly * 0.40);
let week3 = Math.round(monthly * 0.70);
let week4 = Math.round(monthly * 1.00);
// Set week values
$('#execution-' + activity + '_1').val(week1);
$('#execution-' + activity + '_2').val(week2);
$('#execution-' + activity + '_3').val(week3);
$('#execution-' + activity + '_4').val(week4);
// Add totals
totalMonthly += monthly;
totalWeek1 += week1;
totalWeek2 += week2;
totalWeek3 += week3;
totalWeek4 += week4;
});
// Set total row values
$('#execution-total').val(totalMonthly);
$('#execution-total_1').val(totalWeek1);
$('#execution-total_2').val(totalWeek2);
$('#execution-total_3').val(totalWeek3);
$('#execution-total_4').val(totalWeek4);
}
// Trigger on input change
activities.forEach(function (activity) {
$('#execution-' + activity).on('input', function () {
calculateTotals();
});
});
// Initial calculation
calculateTotals();
});
$('#field-total').attr('readonly',true);
})
$('#report-form').on('submit', function(event) {
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
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'
})
window.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!'
})
}
},
});
});
$('#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-msl_code').prop('readonly',true);
$('#field-speciality').prop('readonly',true);
$(document).ready(function () {
const activities = [
'vema_meet',
'vema_tech',
'vema_dtech',
'vema_times',
'vema_360',
'vema_clinic',
'cme_event',
'dynameet',
'rwe_activity',
'vema_dt_tech',
'vimot',
'liva_graftsol',
'transcor'
];
function calculateTotals() {
let totalMonthly = 0;
let totalWeek1 = 0;
let totalWeek2 = 0;
let totalWeek3 = 0;
let totalWeek4 = 0;
activities.forEach(function (activity) {
let monthly = parseFloat($('#field-' + activity).val()) || 0;
let week1 = Math.round(monthly * 0.20);
let week2 = Math.round(monthly * 0.40);
let week3 = Math.round(monthly * 0.70);
let week4 = Math.round(monthly * 1.00);
// Set week values
$('#field-' + activity + '_1').val(week1);
$('#field-' + activity + '_2').val(week2);
$('#field-' + activity + '_3').val(week3);
$('#field-' + activity + '_4').val(week4);
// Add totals
totalMonthly += monthly;
totalWeek1 += week1;
totalWeek2 += week2;
totalWeek3 += week3;
totalWeek4 += week4;
});
// Set total row values
$('#field-total').val(totalMonthly);
$('#field-total_1').val(totalWeek1);
$('#field-total_2').val(totalWeek2);
$('#field-total_3').val(totalWeek3);
$('#field-total_4').val(totalWeek4);
}
// Trigger on input change
activities.forEach(function (activity) {
$('#field-' + activity).on('input', function () {
calculateTotals();
});
});
// Initial calculation
calculateTotals();
});
$('#field-total').attr('readonly',true);
$('#execution-form').on('submit', function(event) {
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
url: '/form/ajaxsubmit',
data: new FormData($('#execution-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'
})
window.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!'
})
}
},
});
});
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0');
var yyyy = today.getFullYear();
today = yyyy + '-' + mm + '-' + dd;
var recordDateField = document.getElementById('field-plan_date');
//recordDateField.setAttribute('min', today);
var executionDateField = document.getElementById('execution-plan_date');
//executionDateField.setAttribute('max', today);
// $('.edit-btn').click(function() {
// var executionexeField = document.getElementById('execution-record_date');
// executionexeField.setAttribute('min', executionDateField.value);
// });
$('.edit-btn').click(function() {
var executionexeField = document.getElementById('execution-execution_date');
executionexeField.setAttribute('max',today);
});
/* executionDateField.addEventListener('change', function() {
console.log('gg');
var executionexeField = document.getElementById('execution-record_date');
executionexeField.setAttribute('min', executionDateField.value);
}); */
});
</script>
</body>
</html>