642 lines
38 KiB
PHP
642 lines
38 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="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
|
</div>
|
|
|
|
<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 bg-pattern">
|
|
<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">{{ $form->title }}</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-md-12" id="table-wrapper">
|
|
<div class="card">
|
|
<div class="card-body p-0">
|
|
<div class="table-responsive">
|
|
<table
|
|
class="table table-striped table-hover table-nowrap table-centered m-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Action</th>
|
|
{{-- <th>Execution Done</th> --}}
|
|
<th>Plan Date</th>
|
|
{{-- <th>Execution Date</th> --}}
|
|
@for ($i = 1; $i <= 25; $i++)
|
|
<th>Doctor Name {{ $i }}</th>
|
|
<th>MSL Code {{ $i }}</th>
|
|
<th>Speciality {{ $i }}</th>
|
|
<th>Role {{ $i }}</th>
|
|
@endfor
|
|
</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> Edit</button>
|
|
</td>
|
|
{{-- <td>{{ isset($sub->formdata->record_date) && $sub->formdata->record_date > 0 ? 'Yes' : 'No' }}
|
|
</td> --}}
|
|
<td>{{ $sub->formdata->record_date }}</td>
|
|
{{-- <td>{{ $sub->formdata->execution_date }}</td> --}}
|
|
|
|
@for ($j = 1; $j <= 25; $j++)
|
|
<td>{{ isset($sub->formdata->{"doctor_name_{$j}"}) ? $sub->formdata->{"doctor_name_{$j}"} : '' }}
|
|
</td>
|
|
<td>{{ isset($sub->formdata->{"msl_code_{$j}"}) ? $sub->formdata->{"msl_code_{$j}"} : '' }}
|
|
</td>
|
|
<td>{{ isset($sub->formdata->{"role_{$j}"}) ? $sub->formdata->{"role_{$j}"} : '' }}
|
|
</td>
|
|
<td>{{ isset($sub->formdata->{"speciality_{$j}"}) ? $sub->formdata->{"speciality_{$j}"} : '' }}
|
|
</td>
|
|
@endfor
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="form-wrapper">
|
|
<form method="POST" action="/form/submit" id="report-form">
|
|
<input type="hidden" name="form_id" value="{{ $form_id }}">
|
|
@csrf
|
|
|
|
@php
|
|
$multitextbox = [];
|
|
@endphp
|
|
@foreach ($questions as $question)
|
|
@if (in_array($question->code, ['execution_date', 'doctor_name', 'msl_code', 'speciality', 'role']))
|
|
@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)
|
|
<option value="{{ $option->value }}"
|
|
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
|
{{ $option->display }}</option>
|
|
@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
|
|
@endswitch
|
|
</div>
|
|
@endforeach
|
|
|
|
{{-- Add doctor --}}
|
|
|
|
@foreach ($questions as $question)
|
|
@switch($question->type)
|
|
@case('multitextbox')
|
|
@php
|
|
$multitextbox[$question->code] = [];
|
|
@endphp
|
|
@foreach ($question->options as $option)
|
|
@if (isset($option->val))
|
|
@php
|
|
$multitextbox[$question->code][$option->value] = isset($option->val) ? $option->val : '';
|
|
@endphp
|
|
@endif
|
|
@endforeach
|
|
@break
|
|
@endswitch
|
|
@endforeach
|
|
|
|
<div class="row pt-2 pb-2">
|
|
<div class="col-6">
|
|
|
|
</div>
|
|
<div class="col-6">
|
|
<button type="button" class="btn btn-primary btn-xs float-end"
|
|
id="btn-add-doctor">Add Doctor</button>
|
|
</div>
|
|
</div>
|
|
<div class="col-12" id="doctor-wrapper">
|
|
@if (sizeof($multitextbox['doctor_name']) > 0)
|
|
@foreach ($multitextbox['doctor_name'] as $k => $v)
|
|
@php
|
|
$docnum = str_replace('doctor_name_', '', $k);
|
|
@endphp
|
|
<div class="row doctorblock" id="element_block_{{ $docnum }}">
|
|
<div class="col-4"><label
|
|
for="field-doctor_name_{{ $docnum }}"
|
|
class="form-label">Doctor Name <span
|
|
class="text-danger">*</span></label></div>
|
|
<div class="col-8"><input type="text"
|
|
id="field-doctor_name_{{ $docnum }}"
|
|
name="doctor_name_{{ $docnum }}"
|
|
placeholder="Doctor Name" class="form-control"
|
|
value="{{ $multitextbox['doctor_name'][$k] }}" required>
|
|
</div>
|
|
|
|
<div class="col-4 mt-2"><label
|
|
for="field-msl_code_{{ $docnum }}"
|
|
class="form-label">MSL Code <span
|
|
class="text-danger">*</span></label></div>
|
|
<div class="col-8 mt-2"><input type="text"
|
|
id="field-msl_code_{{ $docnum }}"
|
|
name="msl_code_{{ $docnum }}"
|
|
placeholder="MSL Code" class="form-control"
|
|
value="{{ $multitextbox['msl_code']['msl_code_' . $docnum] }}"
|
|
required></div>
|
|
|
|
<div class="col-4 mt-2"><label
|
|
for="field-speciality_{{ $docnum }}"
|
|
class="form-label">Speciality <span
|
|
class="text-danger">*</span></label></div>
|
|
<div class="col-8 mt-2"><input type="text"
|
|
id="field-speciality_{{ $docnum }}"
|
|
name="speciality_{{ $docnum }}"
|
|
placeholder="Speciality" class="form-control"
|
|
value="{{ $multitextbox['speciality']['speciality_' . $docnum] }}"
|
|
required></div>
|
|
|
|
<div class="col-4 mt-2"><label
|
|
for="field-role_{{ $docnum }}"
|
|
class="form-label">Role <span
|
|
class="text-danger">*</span></label></div>
|
|
<div class="col-8 mt-2">
|
|
<select class="form-control"
|
|
id="field-role_{{ $docnum }}"
|
|
name="role_{{ $docnum }}" required>
|
|
<option value=""> -- Select -- </option>
|
|
<option value="Speaker"
|
|
{{ $multitextbox['role']['role_' . $docnum] == 'Speaker' ? 'selected' : '' }}>
|
|
Speaker</option>
|
|
<option value="Panelist"
|
|
{{ $multitextbox['role']['role_' . $docnum] == 'Panelist' ? 'selected' : '' }}>
|
|
Panelist</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
@endif
|
|
</div>
|
|
|
|
{{-- end add doctor --}}
|
|
|
|
@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">
|
|
<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">
|
|
@foreach ($questions as $question)
|
|
@if (in_array($question->code, ['doctor_name', 'msl_code', 'speciality', 'role']))
|
|
@continue
|
|
@endif
|
|
<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)
|
|
<option value="{{ $option->value }}"
|
|
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
|
{{ $option->display }}</option>
|
|
@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
|
|
@endswitch
|
|
</div>
|
|
@endforeach
|
|
|
|
<div class="col-12" id="edit-doctor-wrapper">
|
|
<div class="row doctorblock mt-2" id="element_block">
|
|
</div>
|
|
</div>
|
|
|
|
@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%;
|
|
}
|
|
|
|
.doctorblock {
|
|
border: solid 1px #ccc;
|
|
border-radius: 10px;
|
|
padding: 10px;
|
|
margin-bottom: 10px;
|
|
}
|
|
</style>
|
|
@include('layouts.shared/footer-script')
|
|
<script src="{{ asset('assets/libs/sweetalert2/sweetalert2.min.js') }}"></script>
|
|
<script type="text/javascript">
|
|
const slugify = str =>
|
|
str
|
|
.toLowerCase()
|
|
.trim()
|
|
.replace(/[^\w\s-]/g, '')
|
|
.replace(/[\s_-]+/g, '-')
|
|
.replace(/^-+|-+$/g, '');
|
|
|
|
$('#form-wrapper').hide()
|
|
$('#execution-form-wrapper').hide()
|
|
|
|
$('#add-camp-btn').click(function() {
|
|
$('#form-wrapper').show()
|
|
$('#table-wrapper').hide()
|
|
$('#execution-form-wrapper').hide()
|
|
})
|
|
|
|
$('.edit-btn').click(function() {
|
|
let selected = JSON.parse($(this).attr('plan_details'));
|
|
console.log(selected)
|
|
$('#execution-record_date').val(selected.record_date);
|
|
$('#execution-execution_date').val(selected.execution_date);
|
|
|
|
let doctorBlock = $('.doctorblock');
|
|
let groupedValues = [];
|
|
|
|
function capitalizeEveryWord(str) {
|
|
return str.replace(/\b\w/g, function(char) {
|
|
return char.toUpperCase();
|
|
});
|
|
}
|
|
|
|
for (let k of Object.keys(selected)) {
|
|
if (selected[k] !== '' && k !== 'id' && k !== 'form_id' && k !== 'record_date') {
|
|
let num = k.match(/\d+/);
|
|
let existingGroup = groupedValues.find(group => group.num === num);
|
|
if (!existingGroup) {
|
|
existingGroup = {
|
|
num: num,
|
|
values: []
|
|
};
|
|
groupedValues.push(existingGroup);
|
|
}
|
|
existingGroup.values.push({
|
|
key: k,
|
|
value: selected[k]
|
|
});
|
|
}
|
|
}
|
|
|
|
groupedValues.sort((a, b) => parseInt(a.num) - parseInt(b.num));
|
|
|
|
for (let group of groupedValues) {
|
|
let groupDiv = $('<div/>', {
|
|
class: 'group mb-4 row',
|
|
});
|
|
|
|
for (let item of group.values) {
|
|
let colDiv = $('<div/>', {
|
|
class: 'col-4',
|
|
});
|
|
|
|
let colDivinput = $('<div/>', {
|
|
class: 'col-8',
|
|
});
|
|
|
|
let labelElement = $('<label/>', {
|
|
class: 'form-label',
|
|
for: 'execution-' + item.key,
|
|
text: capitalizeEveryWord(item.key.replace(/_/g, ' '))
|
|
});
|
|
|
|
let inputElement = $('<input/>', {
|
|
type: 'text',
|
|
class: 'form-control',
|
|
id: 'execution-' + item.key,
|
|
name: item.key,
|
|
value: item.value,
|
|
placeholder: item.key.replace(/_/g, ' '),
|
|
});
|
|
|
|
colDiv.append(labelElement);
|
|
colDivinput.append(inputElement);
|
|
groupDiv.append(colDiv, colDivinput);
|
|
}
|
|
|
|
doctorBlock.append(groupDiv);
|
|
}
|
|
|
|
$('#execution-id').val(selected['id']);
|
|
$('#form-wrapper').hide();
|
|
$('#execution-form-wrapper').show();
|
|
$('#table-wrapper').hide();
|
|
});
|
|
|
|
var j = 3;
|
|
var docnum = 1;
|
|
jQuery(document).ready(function($) {
|
|
|
|
$('#btn-add-doctor').click(function() {
|
|
let template = `<div class="row doctorblock mt-2" id="element_block_${docnum}">
|
|
<div class="col-4"><label for="field-doctor_name_${docnum}" class="form-label">Doctor Name <span class="text-danger">*</span></label></div>
|
|
<div class="col-8"><input type="text" id="field-doctor_name_${docnum}" name="doctor_name_${docnum}" placeholder="Doctor Name" class="form-control" value="" required></div>
|
|
|
|
<div class="col-4 mt-2"><label for="field-msl_code_${docnum}" class="form-label">MSL Code <span class="text-danger">*</span></label></div>
|
|
<div class="col-8 mt-2"><input type="text" id="field-msl_code_${docnum}" name="msl_code_${docnum}" placeholder="MSL Code" class="form-control" value="" required></div>
|
|
|
|
<div class="col-4 mt-2"><label for="field-speciality_${docnum}" class="form-label">Speciality <span class="text-danger">*</span></label></div>
|
|
<div class="col-8 mt-2"><input type="text" id="field-speciality_${docnum}" name="speciality_${docnum}" placeholder="Speciality" class="form-control" value="" required></div>
|
|
|
|
<div class="col-4 mt-2"><label for="field-role_${docnum}" class="form-label">Role <span class="text-danger">*</span></label></div>
|
|
<div class="col-8 mt-2">
|
|
<select class="form-control" id="field-role_${docnum}" name="role_${docnum}" required>
|
|
<option value=""> -- Select -- </option>
|
|
<option value="Speaker">Speaker</option>
|
|
<option value="Panelist">Panelist</option>
|
|
</select>
|
|
</div>
|
|
</div>`
|
|
$('#doctor-wrapper').append(template)
|
|
docnum++;
|
|
})
|
|
|
|
for (var i = 3; i <= 25; i++) {
|
|
console.log('kjhg')
|
|
$('#element_block_' + i).hide();
|
|
}
|
|
|
|
$('#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();
|
|
} else {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Data not submitted',
|
|
text: 'Something went wrong, please try again after some time!'
|
|
})
|
|
}
|
|
},
|
|
});
|
|
});
|
|
|
|
$('#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_of_camp');
|
|
recordDateField.setAttribute('min', today);
|
|
|
|
var executionDateField = document.getElementById('execution-plan_date_of_camp');
|
|
// executionDateField.setAttribute('min', today);
|
|
|
|
var executionDateField = document.getElementById('execution-execution_date');
|
|
executionDateField.addEventListener('change', function() {
|
|
var selectedDate = this.value;
|
|
if (selectedDate !== '2023-11-06' && selectedDate !== '2023-11-21') {
|
|
this.value = '';
|
|
alert("Execution Date Should Be 6th Nov Or 21th Nov");
|
|
}
|
|
});
|
|
|
|
executionDateField.value = '2023-11-06';
|
|
|
|
var editBtn = document.querySelector('.edit-btn');
|
|
editBtn.addEventListener('click', function() {
|
|
executionDateField.value = '2023-11-06';
|
|
});
|
|
|
|
});
|
|
</script>
|