511 lines
34 KiB
PHP
511 lines
34 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/flatpickr/flatpickr.min.css') }}" rel="stylesheet" type="text/css" />
|
|
|
|
<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,
|
|
);
|
|
@endphp
|
|
|
|
{{-- @php
|
|
echo "<pre>";
|
|
print_r($history->data->submissions);
|
|
echo "</pre>";
|
|
@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>Plan Date</th>
|
|
<th>Execution Done</th>
|
|
<th>Status</th>
|
|
|
|
<th>HCP name</th>
|
|
<th>Speciality</th>
|
|
<th>MSL Code</th>
|
|
<th>P-Code</th>
|
|
<th>Current Arnicor Rx/month</th>
|
|
<th>Expected Arnicor Rx/month post conducting the camp</th>
|
|
|
|
<th>Number of NT-pro BNP reagents allocated</th>
|
|
<th>Number of NT-pro BNP reagents utilized in the camp</th>
|
|
<th>Balance reagents</th>
|
|
<th>Number of pts screened</th>
|
|
<th>Upload scanned NT-pro BNP report generated</th>
|
|
<th>No. of Arnicor Rx generated</th>
|
|
<th>HCP Feedback</th>
|
|
<th>Innova success story</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($history->data->submissions as $sub)
|
|
@php
|
|
$sub->formdata->id = $sub->id;
|
|
@endphp
|
|
<tr>
|
|
@php
|
|
$isDisabled = isset($sub->workflow_status) && strtolower($sub->workflow_status) == 'unapproved';
|
|
@endphp
|
|
<td> <button type="button" class="btn btn-xs btn-info edit-btn" plan_details="{{ json_encode($sub->formdata) }}" @if($isDisabled) disabled @endif><i class="mdi mdi-pencil"></i> Edit</button> </td>
|
|
<td>{{ $sub->formdata->plan_date }}</td>
|
|
<td>{{ isset($sub->formdata->execution_date) && $sub->formdata->execution_date > 0 ? 'Yes' : 'No' }} </td>
|
|
<td data-workflow_status="{{ isset($sub->workflow_status) ? $sub->workflow_status : '' }}">{{ isset($sub->workflow_status) ? $sub->workflow_status : '' }}</td>
|
|
|
|
|
|
<td>{{ isset($sub->formdata->contact_id) ? $sub->formdata->contact_id : ''}}</td>
|
|
<td>{{ isset($sub->formdata->speciality) ? $sub->formdata->speciality : ''}}</td>
|
|
<td>{{ isset($sub->formdata->msl_code) ? $sub->formdata->msl_code : ''}}</td>
|
|
<td>{{ isset($sub->formdata->pcode) ? $sub->formdata->pcode : ''}}</td>
|
|
<td>{{ isset($sub->formdata->current_arnicor_rxmonth) ? $sub->formdata->current_arnicor_rxmonth : ''}}</td>
|
|
<td>{{ isset($sub->formdata->expected_arnicor_rxmonth_post_conducting_the_camp) ? $sub->formdata->expected_arnicor_rxmonth_post_conducting_the_camp : ''}}</td>
|
|
|
|
<td>{{ isset($sub->formdata->number_of_nt_pro_bnp_reagents_allocated) ? $sub->formdata->number_of_nt_pro_bnp_reagents_allocated : ''}}</td>
|
|
<td>{{ isset($sub->formdata->number_of_nt_pro_bnp_reagents_utilized_in_the_camp) ? $sub->formdata->number_of_nt_pro_bnp_reagents_utilized_in_the_camp : ''}}</td>
|
|
<td>{{ isset($sub->formdata->balance_reagents) ? $sub->formdata->balance_reagents : ''}}</td>
|
|
<td>{{ isset($sub->formdata->number_of_pts_screened) ? $sub->formdata->number_of_pts_screened : ''}}</td>
|
|
<td> <a target="_blank" href="{{ isset($sub->formdata->upload_scanned_nt_pro_bnp_report_generated) ? $sub->formdata->upload_scanned_nt_pro_bnp_report_generated : '' }}" download="{{ isset($sub->formdata->upload_scanned_nt_pro_bnp_report_generated) ? $sub->formdata->upload_scanned_nt_pro_bnp_report_generated : '' }}" class="btn btn-dark btn-xs"><i class="mdi mdi-cloud-download me-1"></i> Download</a> </td>
|
|
<td>{{ isset($sub->formdata->no_of_arnicor_rx_generated) ? $sub->formdata->no_of_arnicor_rx_generated : ''}}</td>
|
|
<td>{{ isset($sub->formdata->hcp_feedback) ? $sub->formdata->hcp_feedback : ''}}</td>
|
|
<td>{{ isset($sub->formdata->innova_success_story) ? $sub->formdata->innova_success_story : ''}}</td>
|
|
</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
|
|
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
|
@foreach($form->users as $option)
|
|
@endforeach
|
|
<div class="col-md-12 mb-2">
|
|
<label for="field-tm_name" class="form-label"> Select User <span class="text-danger">*</span> </label>
|
|
<select class="form-control" id="field-tm_name" name="tm_name" required>
|
|
<option value=""> -- Select -- </option>
|
|
@foreach($form->users as $option)
|
|
<option value="{{$option->user_info->name}}" employee_code="{{$option->user_info->employee_code}}" {{isset($question->value) && $question->value == $option->user_info->name ? 'selected':''}}>{{$option->user_info->name}}</option>
|
|
@endforeach
|
|
</select>
|
|
<input type="hidden" id="field-tm_employee_code" name="tm_employee_code" value="">
|
|
</div>
|
|
@endif
|
|
@foreach ($questions as $question)
|
|
@if (in_array($question->code, [
|
|
'execution_date',
|
|
'number_of_nt_pro_bnp_reagents_allocated',
|
|
'number_of_nt_pro_bnp_reagents_utilized_in_the_camp',
|
|
'balance_reagents',
|
|
'number_of_pts_screened',
|
|
'upload_scanned_nt_pro_bnp_report_generated',
|
|
'no_of_arnicor_rx_generated',
|
|
'hcp_feedback',
|
|
'innova_success_story',
|
|
]))
|
|
@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('time')
|
|
<input type="text" id="field-{{ $question->code }}"
|
|
name="{{ $question->code }}" class="form-control timepicker"
|
|
value="{{ isset($question->value) ? $question->value : '' }}"
|
|
{{ $question->required == 'yes' ? 'required' : '' }}>
|
|
@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' : '' }}
|
|
{{ $question->code == 'contact_id' ? 'msl_code= ' . $option->contact->msl_code . ' ' : '' }}
|
|
{{ $question->code == 'contact_id' && isset($option->contact->speciality) ? 'speciality= ' . $option->contact->speciality . ' ' : '' }}
|
|
{{ $question->code == 'contact_id' && isset($option->contact->pcode) ? 'pcode= ' . $option->contact->pcode . ' ' : '' }}
|
|
>
|
|
{{ $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
|
|
@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)
|
|
<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('time')
|
|
<input type="text" id="execution-{{ $question->code }}"
|
|
name="{{ $question->code }}" class="form-control timepicker"
|
|
value="{{ isset($question->value) ? $question->value : '' }}"
|
|
{{ $question->required == 'yes' ? 'required' : '' }}>
|
|
@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' : '' }}
|
|
{{ $question->code == 'contact_id' ? 'msl_code= ' . $option->contact->msl_code . ' ' : '' }}
|
|
{{ $question->code == 'contact_id' && isset($option->contact->speciality) ? 'speciality= ' . $option->contact->speciality . ' ' : '' }}
|
|
{{ $question->code == 'contact_id' && isset($option->contact->pcode) ? 'pcode= ' . $option->contact->pcode . ' ' : '' }}
|
|
>
|
|
{{ $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
|
|
@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%;
|
|
}
|
|
</style>
|
|
@include('layouts.shared/footer-script')
|
|
<script src="{{ asset('assets/libs/sweetalert2/sweetalert2.min.js') }}"></script>
|
|
<script src="{{ asset('assets/libs/flatpickr/flatpickr.min.js') }}"></script>
|
|
|
|
<script type="text/javascript">
|
|
$('.timepicker').flatpickr({
|
|
enableTime: true,
|
|
noCalendar: true,
|
|
dateFormat: "H:i"
|
|
});
|
|
|
|
$('#field-tm_name').change(function(){
|
|
let employee_code = $('option:selected', this).attr('employee_code');
|
|
$('#field-tm_employee_code').val(employee_code)
|
|
})
|
|
|
|
$('#form-wrapper').hide()
|
|
$('#execution-form-wrapper').hide()
|
|
|
|
$('#add-camp-btn').click(function() {
|
|
$('#form-wrapper').show()
|
|
$('#table-wrapper').hide()
|
|
$('#execution-form-wrapper').hide()
|
|
$('#execution-execution_date').prop('required', false);
|
|
})
|
|
|
|
$('#field-contact_id').change(function() {
|
|
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
|
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
|
$('#field-pcode').val($('option:selected', this).attr('pcode'))
|
|
});
|
|
$('#execution-contact_id').change(function() {
|
|
$('#execution-msl_code').val($('option:selected', this).attr('msl_code'))
|
|
$('#execution-speciality').val($('option:selected', this).attr('speciality'))
|
|
$('#execution-pcode').val($('option:selected', this).attr('pcode'))
|
|
});
|
|
|
|
$('#execution-number_of_nt_pro_bnp_reagents_allocated').val(100);
|
|
$('#execution-number_of_nt_pro_bnp_reagents_allocated').prop('readonly', true);
|
|
$('#execution-number_of_nt_pro_bnp_reagents_utilized_in_the_camp').on('input', function () {
|
|
const allocated = parseInt($('#execution-number_of_nt_pro_bnp_reagents_allocated').val()) || 0;
|
|
const utilized = parseInt($(this).val()) || 0;
|
|
const balance = Math.max(allocated - utilized, 0);
|
|
$('#execution-balance_reagents').val(balance);
|
|
});
|
|
|
|
|
|
$('.edit-btn').click(function () {
|
|
let selected = JSON.parse($(this).attr('plan_details'))
|
|
console.log(selected)
|
|
for (let k of Object.keys(selected)) {
|
|
if (k !== "upload_scanned_nt_pro_bnp_report_generated" && selected[k] !== '') {
|
|
if (k == 'contact_id') {
|
|
$('#execution-contact_id').append('<option value="' + selected['cont_id'] + '" selected>' + selected['contact_id'] + '</option>')
|
|
}else{
|
|
$('#execution-' + k).val(selected[k]);
|
|
}
|
|
}
|
|
}
|
|
$('#execution-id').val(selected['id'])
|
|
$('#form-wrapper').hide()
|
|
$('#execution-form-wrapper').show()
|
|
$('#table-wrapper').hide()
|
|
$('#execution-execution_date').prop('required', true);
|
|
|
|
});
|
|
|
|
|
|
jQuery(document).ready(function($) {
|
|
$('#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;
|
|
});
|
|
</script>
|