Team3 : Doctor Activities for Neb Arise changes
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m47s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m47s
Details
This commit is contained in:
commit
6e6066d8c2
|
|
@ -24,7 +24,7 @@ class DomainController extends Controller
|
|||
//echo '<pre>'; print_r($response); exit;
|
||||
$values = $response->data->item;
|
||||
}
|
||||
$data = $this->_beforeform($type, $values);
|
||||
$values = $this->_beforeform($type, $values);
|
||||
$fields = $this->get_form_fields($type, $values);
|
||||
//echo '<pre>'; print_r($data); exit;
|
||||
return $this->view('form')->with([
|
||||
|
|
@ -125,12 +125,22 @@ class DomainController extends Controller
|
|||
'badges_recipient_list' => ['title' => 'Badges Recipient List', 'type' => 'select', 'required' => true, 'values' => ['show_all_users' => 'Show all users', 'show_users_under_hierarchy' => 'Show users under hierarchy', 'show_users_under_hierarchy_and_peers' => 'Show users under hierarchy & peers', 'show_users_under_hierarchy_same_level' => 'Show users under hierarchy & at same level'] ],
|
||||
|
||||
'users_extra_profile_fields' => ['title' => 'Extra Profile Fields(comma seperated)', 'type' => 'textarea', 'fullwidth' => true],
|
||||
'doctor_tags_roles' => ['title' => 'Doctor Tags Roles', 'type' => 'multiselect', 'values' => $roles_dd, 'fullwidth' => true],
|
||||
'terms_text' => ['title' => 'Login Terms & Conditions Text', 'type' => 'textarea', 'required' => true, 'fullwidth' => true],
|
||||
'android_server_key' => ['title' => 'Android Server Key', 'type' => 'textarea', 'fullwidth' => true],
|
||||
'ios_server_key' => ['title' => 'IOS Server Key', 'type' => 'textarea', 'fullwidth' => true],
|
||||
];
|
||||
}
|
||||
|
||||
protected function _beforeform($type, $values) {
|
||||
if ($type == 'edit' && is_object($values)) {
|
||||
if (!isset($values->doctor_tags_roles) || !is_array($values->doctor_tags_roles)) {
|
||||
$values->doctor_tags_roles = [];
|
||||
}
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
protected function _beforesave($type, $request) {
|
||||
$data = $request->except('_token');
|
||||
$static_otp_for_roles = [];
|
||||
|
|
@ -140,6 +150,9 @@ class DomainController extends Controller
|
|||
}
|
||||
}
|
||||
$data['static_otp_for_roles'] = json_encode($static_otp_for_roles);
|
||||
if (!isset($data['doctor_tags_roles']) || !is_array($data['doctor_tags_roles'])) {
|
||||
$data['doctor_tags_roles'] = [];
|
||||
}
|
||||
if( $request->file('logo') ) {
|
||||
$data['logo'] = $this->_uploadMedia($request, 'logo', 'domain');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1081,6 +1081,36 @@ class FormController extends Controller
|
|||
$cont = LambdaRequest::postrequest('contact', 'contact/update', $contactdata, $token[0]->access_token);
|
||||
}
|
||||
|
||||
// Zenova - Glipiq & Sitazit Tracker Copy
|
||||
if($formdata->form_id == '1788239728-6f7f3c27-c5dc-4e6e-a042-aefd5681af3a' && isset($post['contact_id']) && !empty($post['contact_id'])) {
|
||||
list($application, $domain) = explode("-", $formdata->partition);
|
||||
$token = DB::table('users')->select("access_token","user_id")->where("domain", $domain)->where("permissions", 'like', '%contact_create%')->orderBy('updated_at', 'desc')->skip(0)->take(1)->get();
|
||||
$contactdata = [
|
||||
'domain' => $domain,
|
||||
'application' => $application,
|
||||
'user_id' => $post['user_id'],
|
||||
'id' => $post['contact_id'],
|
||||
];
|
||||
$contactAttributes = [
|
||||
'sankalp_lead_received_penvial',
|
||||
'sankalp_lead_enrolled_penvial',
|
||||
'pmos_dr',
|
||||
'qbs_dr',
|
||||
'adboard_dr',
|
||||
'fb_live_dr',
|
||||
'ecme_dr',
|
||||
'rtm_dr',
|
||||
];
|
||||
foreach ($contactAttributes as $attr) {
|
||||
if (isset($post[$attr]) && $post[$attr] !== '') {
|
||||
$contactdata[$attr] = $post[$attr];
|
||||
}
|
||||
}
|
||||
if (count($contactdata) > 4) {
|
||||
LambdaRequest::postrequest('contact', 'contact/update', $contactdata, $token[0]->access_token);
|
||||
}
|
||||
}
|
||||
|
||||
// if($formdata->form_id == '1758800833-00e44f7c-1857-4109-8ad4-2789d49a78fa') {
|
||||
|
||||
// list($application, $domain) = explode("-", $formdata->partition);
|
||||
|
|
|
|||
|
|
@ -335,6 +335,8 @@ class LeaderboardController extends Controller
|
|||
'title' => 'Leaderboard',
|
||||
'subtitle' => '',
|
||||
'period_label' => '',
|
||||
'periods' => [],
|
||||
'selected_period' => (string) $request->query('period', ''),
|
||||
'users' => [],
|
||||
'metrics' => [],
|
||||
'pills' => [],
|
||||
|
|
@ -377,6 +379,11 @@ class LeaderboardController extends Controller
|
|||
}
|
||||
|
||||
$pills = $this->roleLeaderboardPills($id, $roleId, $groups, $request->query('period'));
|
||||
$periods = $this->uniquePeriodOptions($view->periods ?? []);
|
||||
$selectedPeriod = (string) ($request->query('period') ?: ($view->interval ?? ''));
|
||||
if ($selectedPeriod === '') {
|
||||
$selectedPeriod = 'all';
|
||||
}
|
||||
|
||||
if (!$selected) {
|
||||
return [
|
||||
|
|
@ -384,6 +391,8 @@ class LeaderboardController extends Controller
|
|||
'title' => $view->name ?? 'Leaderboard',
|
||||
'subtitle' => '',
|
||||
'period_label' => '',
|
||||
'periods' => $periods,
|
||||
'selected_period' => $selectedPeriod,
|
||||
'users' => [],
|
||||
'metrics' => [],
|
||||
'pills' => $pills,
|
||||
|
|
@ -449,6 +458,8 @@ class LeaderboardController extends Controller
|
|||
'title' => $view->name ?? 'Leaderboard',
|
||||
'subtitle' => $subtitle,
|
||||
'period_label' => $periodLabel,
|
||||
'periods' => $periods,
|
||||
'selected_period' => $selectedPeriod,
|
||||
'users' => $users,
|
||||
'metrics' => $metrics,
|
||||
'pills' => $pills,
|
||||
|
|
@ -456,6 +467,30 @@ class LeaderboardController extends Controller
|
|||
];
|
||||
}
|
||||
|
||||
protected function uniquePeriodOptions($periods): array
|
||||
{
|
||||
if (is_object($periods)) {
|
||||
$periods = array_values((array) $periods);
|
||||
}
|
||||
if (!is_array($periods)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$out = [];
|
||||
$seen = [];
|
||||
foreach ($periods as $period) {
|
||||
$period = is_object($period) ? $period : (object) $period;
|
||||
$value = (string) ($period->value ?? '');
|
||||
if ($value === '' || isset($seen[$value])) {
|
||||
continue;
|
||||
}
|
||||
$seen[$value] = true;
|
||||
$out[] = $period;
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
protected function roleLeaderboardPills($leaderboardId, $selectedRoleId, array $groups, $period = null): array
|
||||
{
|
||||
$rankRoles = [];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,309 @@
|
|||
<!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>
|
||||
@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
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
<input type="hidden" name="user_id" value="{{$form->user_id}}">
|
||||
|
||||
@csrf
|
||||
@if($id)
|
||||
<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)
|
||||
<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)
|
||||
@if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type != 'Chemist' )
|
||||
<option value="{{ $option->value }}"
|
||||
@if(isset($question->value) && $question->value == $option->value) selected @endif
|
||||
@if($question->code == 'contact_id')
|
||||
msl_code="{{ (isset($option->contact->msl_code) ? $option->contact->msl_code : '') }}"
|
||||
speciality="{{ (isset($option->contact->speciality) ? $option->contact->speciality : '') }}"
|
||||
@endif
|
||||
>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@elseif($question->code != 'contact_id')
|
||||
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'pcode= ' . (isset($option->contact->pcode)?$option->contact->pcode:'') . ' ' : '' }} {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
@endforeach
|
||||
{{-- @if($question->code=='contact_id')
|
||||
<option value="others" {{ isset($question->value) && $question->value == 'others' ? 'selected' : '' }}>Others</option>
|
||||
@endif --}}
|
||||
</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')
|
||||
@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
|
||||
|
||||
@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>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
|
||||
@case('time')
|
||||
<input type="time"
|
||||
id="field-{{$question->code}}"
|
||||
name="{{$question->code}}"
|
||||
class="form-control"
|
||||
{{$question->required == 'yes' ? 'required' : ''}}
|
||||
value="{{isset($question->value) ? $question->value : ''}}">
|
||||
@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();
|
||||
$("#pageloader").fadeIn();
|
||||
$.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).attr('speciality',itm.contact.speciality));
|
||||
}
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
||||
})
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
// $('#field-select_brand').on('change',function(){
|
||||
// $('#report-form input.dynamic-hidden').remove();
|
||||
// $('#report-form').append('<input type="hidden" class="dynamic-hidden" name="'+ $('#field-select_brand').val() +'" value="1">')
|
||||
// })
|
||||
|
||||
$('#field-select_brand').on('change', function () {
|
||||
$('#report-form input.dynamic-hidden').remove();
|
||||
|
||||
let value = $(this).val();
|
||||
|
||||
// Convert to slug
|
||||
let slug = value
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/\s+/g, '_') // spaces → underscore
|
||||
.replace(/[^\w\-]+/g, ''); // remove special chars
|
||||
|
||||
$('#report-form').append(
|
||||
'<input type="hidden" class="dynamic-hidden" name="' + slug + '" value="1">'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
$('#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,#field-speciality').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);
|
||||
}
|
||||
$("#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'
|
||||
}).then(() => {
|
||||
location.reload(); // 🔥 page refresh here
|
||||
});
|
||||
$('#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 plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,315 @@
|
|||
<!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>
|
||||
@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
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
<input type="hidden" name="user_id" value="{{$form->user_id}}">
|
||||
|
||||
@csrf
|
||||
@if($id)
|
||||
<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)
|
||||
<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)
|
||||
@if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor' )
|
||||
<option value="{{ $option->value }}"
|
||||
@if(isset($question->value) && $question->value == $option->value) selected @endif
|
||||
@if($question->code == 'contact_id')
|
||||
msl_code="{{ (isset($option->contact->msl_code) ? $option->contact->msl_code : '') }}"
|
||||
speciality="{{ (isset($option->contact->speciality) ? $option->contact->speciality : '') }}"
|
||||
@endif
|
||||
>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@elseif($question->code != 'contact_id')
|
||||
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'pcode= ' . (isset($option->contact->pcode)?$option->contact->pcode:'') . ' ' : '' }} {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
||||
{{ $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')
|
||||
@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
|
||||
|
||||
@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>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
|
||||
@case('time')
|
||||
<input type="time"
|
||||
id="field-{{$question->code}}"
|
||||
name="{{$question->code}}"
|
||||
class="form-control"
|
||||
{{$question->required == 'yes' ? 'required' : ''}}
|
||||
value="{{isset($question->value) ? $question->value : ''}}">
|
||||
@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();
|
||||
$("#pageloader").fadeIn();
|
||||
$.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).attr('speciality',itm.contact.speciality));
|
||||
}
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
||||
})
|
||||
},
|
||||
});
|
||||
|
||||
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-msl_code,#field-speciality').attr('readonly',true);
|
||||
|
||||
|
||||
$('#field-pob_unit,#field-number_of_conversion,#field-rx,#field-brand_pob').parent().hide();
|
||||
$('#field-pob_unit,#field-number_of_conversion,#field-rx,#field-brand_pob').attr('required',false);
|
||||
|
||||
$('#field-type').on('change',function(){
|
||||
let value=$(this).val();
|
||||
console.log("Value is : ",value);
|
||||
if(value==='POB Details'){
|
||||
$('#field-pob_unit,#field-brand_pob').parent().show();
|
||||
$('#field-pob_unit,#field-brand_pob').attr('required',true);
|
||||
$('#field-number_of_conversion,#field-rx').parent().hide();
|
||||
$('#field-number_of_conversion,#field-rx').attr('required',false);
|
||||
}
|
||||
else if(value==='New Conversion'){
|
||||
$('#field-number_of_conversion,#field-brand_pob').parent().show();
|
||||
$('#field-number_of_conversion,#field-brand_pob').attr('required',true);
|
||||
$('#field-pob_unit,#field-rx').parent().hide();
|
||||
$('#field-pob_unit,#field-rx').attr('required',false);
|
||||
}
|
||||
else if(value==='Rx'){
|
||||
$('#field-rx,#field-brand_pob').parent().show();
|
||||
$('#field-rx,#field-brand_pob').attr('required',true);
|
||||
$('#field-number_of_conversion,#field-pob_unit').parent().hide();
|
||||
$('#field-number_of_conversion,#field-pob_unit').attr('required',false);
|
||||
}
|
||||
})
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#field-contact_id').trigger('change');
|
||||
$('#field-type').trigger('change');
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$('#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);
|
||||
}
|
||||
$("#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'
|
||||
}).then(() => {
|
||||
location.reload(); // 🔥 page refresh here
|
||||
});
|
||||
$('#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 plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,315 @@
|
|||
<!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>
|
||||
@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
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
<input type="hidden" name="user_id" value="{{$form->user_id}}">
|
||||
|
||||
@csrf
|
||||
@if($id)
|
||||
<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)
|
||||
<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)
|
||||
@if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor' )
|
||||
<option value="{{ $option->value }}"
|
||||
@if(isset($question->value) && $question->value == $option->value) selected @endif
|
||||
@if($question->code == 'contact_id')
|
||||
msl_code="{{ (isset($option->contact->msl_code) ? $option->contact->msl_code : '') }}"
|
||||
speciality="{{ (isset($option->contact->speciality) ? $option->contact->speciality : '') }}"
|
||||
@endif
|
||||
>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@elseif($question->code != 'contact_id')
|
||||
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'pcode= ' . (isset($option->contact->pcode)?$option->contact->pcode:'') . ' ' : '' }} {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
||||
{{ $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')
|
||||
@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
|
||||
|
||||
@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>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
|
||||
@case('time')
|
||||
<input type="time"
|
||||
id="field-{{$question->code}}"
|
||||
name="{{$question->code}}"
|
||||
class="form-control"
|
||||
{{$question->required == 'yes' ? 'required' : ''}}
|
||||
value="{{isset($question->value) ? $question->value : ''}}">
|
||||
@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();
|
||||
$("#pageloader").fadeIn();
|
||||
$.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).attr('speciality',itm.contact.speciality));
|
||||
}
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
||||
})
|
||||
},
|
||||
});
|
||||
|
||||
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-msl_code,#field-speciality').attr('readonly',true);
|
||||
|
||||
|
||||
$('#field-pob_unit,#field-number_of_conversion,#field-rx,#field-brand_pob').parent().hide();
|
||||
$('#field-pob_unit,#field-number_of_conversion,#field-rx,#field-brand_pob').attr('required',false);
|
||||
|
||||
$('#field-type').on('change',function(){
|
||||
let value=$(this).val();
|
||||
console.log("Value is : ",value);
|
||||
if(value==='POB Details'){
|
||||
$('#field-pob_unit,#field-brand_pob').parent().show();
|
||||
$('#field-pob_unit,#field-brand_pob').attr('required',true);
|
||||
$('#field-number_of_conversion,#field-rx').parent().hide();
|
||||
$('#field-number_of_conversion,#field-rx').attr('required',false);
|
||||
}
|
||||
else if(value==='New Conversion'){
|
||||
$('#field-number_of_conversion,#field-brand_pob').parent().show();
|
||||
$('#field-number_of_conversion,#field-brand_pob').attr('required',true);
|
||||
$('#field-pob_unit,#field-rx').parent().hide();
|
||||
$('#field-pob_unit,#field-rx').attr('required',false);
|
||||
}
|
||||
else if(value==='Rx'){
|
||||
$('#field-rx,#field-brand_pob').parent().show();
|
||||
$('#field-rx,#field-brand_pob').attr('required',true);
|
||||
$('#field-number_of_conversion,#field-pob_unit').parent().hide();
|
||||
$('#field-number_of_conversion,#field-pob_unit').attr('required',false);
|
||||
}
|
||||
})
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#field-contact_id').trigger('change');
|
||||
$('#field-type').trigger('change');
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$('#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);
|
||||
}
|
||||
$("#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'
|
||||
}).then(() => {
|
||||
location.reload(); // 🔥 page refresh here
|
||||
});
|
||||
$('#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 plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,906 @@
|
|||
<!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>
|
||||
|
||||
@php
|
||||
$history = Formhelper::getMultiformData($form->partition, $form_id, $form->user_id);
|
||||
$doctorNameById = [];
|
||||
$doctorIdByName = [];
|
||||
|
||||
foreach ($questions as $question) {
|
||||
if ($question->code == 'contact_id' && is_iterable($question->options ?? null)) {
|
||||
foreach ($question->options as $opt) {
|
||||
$doctorNameById[$opt->value] = $opt->display;
|
||||
$doctorIdByName[$opt->display] = $opt->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resolveContactId = function ($raw) use ($doctorNameById, $doctorIdByName) {
|
||||
if (is_array($raw) || $raw instanceof \Traversable) {
|
||||
$raw = trim((string) (array_values((array) $raw)[0] ?? ''));
|
||||
} else {
|
||||
$raw = trim((string) ($raw ?? ''));
|
||||
}
|
||||
|
||||
if ($raw === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (isset($doctorNameById[$raw])) {
|
||||
return $raw;
|
||||
}
|
||||
|
||||
if (isset($doctorIdByName[$raw])) {
|
||||
return $doctorIdByName[$raw];
|
||||
}
|
||||
|
||||
return $raw;
|
||||
};
|
||||
|
||||
$latestByContact = [];
|
||||
if (isset($history->data->submissions) && is_iterable($history->data->submissions)) {
|
||||
foreach ($history->data->submissions as $sub) {
|
||||
$formdata = $sub->formdata ?? null;
|
||||
if (!$formdata) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$contactId = $resolveContactId($formdata->contact_id ?? '');
|
||||
|
||||
if ($contactId === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ts = 0;
|
||||
if (!empty($sub->createdAt)) {
|
||||
$ts = strtotime($sub->createdAt) ?: 0;
|
||||
} elseif (!empty($sub->updatedAt)) {
|
||||
$ts = strtotime($sub->updatedAt) ?: 0;
|
||||
} elseif (!empty($formdata->record_date)) {
|
||||
$ts = strtotime($formdata->record_date) ?: 0;
|
||||
}
|
||||
|
||||
if (!isset($latestByContact[$contactId]) || $ts >= $latestByContact[$contactId]['ts']) {
|
||||
$latestByContact[$contactId] = ['sub' => $sub, 'ts' => $ts];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$latestDoctorRows = collect(array_values($latestByContact))
|
||||
->map(function ($item) {
|
||||
return $item['sub'];
|
||||
})
|
||||
->sortByDesc(function ($sub) {
|
||||
$fd = $sub->formdata ?? null;
|
||||
if (!$fd) {
|
||||
return 0;
|
||||
}
|
||||
return strtotime($sub->createdAt ?? $sub->updatedAt ?? ($fd->record_date ?? '')) ?: 0;
|
||||
})
|
||||
->values();
|
||||
|
||||
$reportFormId = '1781620356-76fde7ab-e939-44ff-b0be-c33e7f2a05a7';
|
||||
$report_form = Formhelper::getformdefination($form->partition, $reportFormId, $form->user_id);
|
||||
$reportQuestions = $report_form->data->questions ?? [];
|
||||
$reportHistory = Formhelper::getMultiformData($form->partition, $reportFormId, $form->user_id);
|
||||
|
||||
$reportMonths = [
|
||||
'January', 'February', 'March', 'April', 'May', 'June',
|
||||
'July', 'August', 'September', 'October', 'November', 'December',
|
||||
];
|
||||
$reportMonthNumToName = array_combine(range(1, 12), $reportMonths);
|
||||
$reportMonthShortNames = [
|
||||
'January' => 'Jan', 'February' => 'Feb', 'March' => 'Mar',
|
||||
'April' => 'Apr', 'May' => 'May', 'June' => 'Jun',
|
||||
'July' => 'Jul', 'August' => 'Aug', 'September' => 'Sep',
|
||||
'October' => 'Oct', 'November' => 'Nov', 'December' => 'Dec',
|
||||
];
|
||||
$fiscalMonthColumns = [
|
||||
'Apr-26', 'May-26', 'Jun-26', 'Jul-26', 'Aug-26', 'Sep-26',
|
||||
'Oct-26', 'Nov-26', 'Dec-26', 'Jan-27', 'Feb-27', 'Mar-27',
|
||||
];
|
||||
|
||||
$normalizeReportMonth = function ($month) use ($reportMonths, $reportMonthNumToName) {
|
||||
if (is_array($month) || $month instanceof \Traversable) {
|
||||
$month = array_values((array) $month)[0] ?? '';
|
||||
}
|
||||
|
||||
$month = trim((string) $month);
|
||||
if ($month === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (is_numeric($month)) {
|
||||
return $reportMonthNumToName[(int) $month] ?? '';
|
||||
}
|
||||
|
||||
foreach ($reportMonths as $monthName) {
|
||||
if (strcasecmp($month, $monthName) === 0) {
|
||||
return $monthName;
|
||||
}
|
||||
}
|
||||
|
||||
return $month;
|
||||
};
|
||||
|
||||
$reportMonthColumnKey = function ($month, $year) use ($normalizeReportMonth, $reportMonthShortNames, $fiscalMonthColumns) {
|
||||
$monthName = $normalizeReportMonth($month);
|
||||
$year = trim((string) $year);
|
||||
|
||||
if ($monthName === '' || $year === '' || !isset($reportMonthShortNames[$monthName])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$columnKey = $reportMonthShortNames[$monthName] . '-' . substr($year, -2);
|
||||
return in_array($columnKey, $fiscalMonthColumns, true) ? $columnKey : null;
|
||||
};
|
||||
|
||||
$reportTotalsByContact = [];
|
||||
if (isset($reportHistory->data->submissions) && is_iterable($reportHistory->data->submissions)) {
|
||||
foreach ($reportHistory->data->submissions as $reportSub) {
|
||||
$reportFd = $reportSub->formdata ?? null;
|
||||
if (!$reportFd) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$reportContactId = $resolveContactId($reportFd->contact_id ?? '');
|
||||
if ($reportContactId === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$columnKey = $reportMonthColumnKey($reportFd->month ?? '', $reportFd->year ?? '');
|
||||
if ($columnKey === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$totalValue = $reportFd->total_actual_value ?? $reportFd->total ?? 0;
|
||||
if (is_array($totalValue) || $totalValue instanceof \Traversable) {
|
||||
$totalValue = array_values((array) $totalValue)[0] ?? 0;
|
||||
}
|
||||
$totalValue = (float) $totalValue;
|
||||
|
||||
if (!isset($reportTotalsByContact[$reportContactId][$columnKey])) {
|
||||
$reportTotalsByContact[$reportContactId][$columnKey] = 0;
|
||||
}
|
||||
$reportTotalsByContact[$reportContactId][$columnKey] += $totalValue;
|
||||
}
|
||||
}
|
||||
|
||||
$formatReportTotal = function ($value) {
|
||||
if ($value === null || (float) $value === 0.0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$formatted = number_format((float) $value, 2, '.', '');
|
||||
return rtrim(rtrim($formatted, '0'), '.');
|
||||
};
|
||||
|
||||
$reportCurrentMonth = $reportMonths[(int) date('n') - 1];
|
||||
$reportCurrentYear = (int) date('Y');
|
||||
if ($reportCurrentYear < 2026) {
|
||||
$reportCurrentYear = 2026;
|
||||
} elseif ($reportCurrentYear > 2028) {
|
||||
$reportCurrentYear = 2028;
|
||||
}
|
||||
|
||||
$reportReadonlyCalcFields = [
|
||||
'pulmosmart_group_actual_value',
|
||||
'pulmosamrt_group_actual_value',
|
||||
'total_actual_value',
|
||||
'ps_share',
|
||||
];
|
||||
|
||||
foreach ($reportQuestions as $question) {
|
||||
if ($question->code == 'contact_id' && is_iterable($question->options ?? null)) {
|
||||
foreach ($question->options as $opt) {
|
||||
$doctorNameById[$opt->value] = $opt->display;
|
||||
$doctorIdByName[$opt->display] = $opt->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 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 text-end">
|
||||
@if($form->link_type == 'form')
|
||||
<button type="button" class="btn btn-primary btn-sm" id="add-doctor-btn">Add New Doctor</button>
|
||||
@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
|
||||
|
||||
<div class="col-12" id="table-wrapper">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover mb-0 doctor-report-table">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
<th>Doctor Name</th>
|
||||
<th>Garnet Code</th>
|
||||
<th>PBS Amount</th>
|
||||
<th>Month & Year</th>
|
||||
@foreach($fiscalMonthColumns as $fiscalColumn)
|
||||
<th class="text-center">{{ $fiscalColumn }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($latestDoctorRows as $sub)
|
||||
@php
|
||||
$fd = $sub->formdata;
|
||||
$contactId = $resolveContactId($fd->contact_id ?? '');
|
||||
$doctorName = $doctorNameById[$contactId] ?? trim((string) ($fd->contact_id ?? ''));
|
||||
$reportPlanDetails = json_decode(json_encode($fd), true) ?: [];
|
||||
$reportPlanDetails['contact_id'] = $contactId;
|
||||
$recordDate = $fd->record_date ?? '';
|
||||
$monthYear = $recordDate;
|
||||
if ($recordDate && ($parsed = strtotime($recordDate))) {
|
||||
$monthYear = date('M Y', $parsed);
|
||||
}
|
||||
$doctorReportTotals = $reportTotalsByContact[$contactId] ?? [];
|
||||
@endphp
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button"
|
||||
class="btn btn-xs btn-info report-btn"
|
||||
data-contact-id="{{ $contactId }}"
|
||||
data-doctor-name="{{ $doctorName }}"
|
||||
plan_details="{{ json_encode($reportPlanDetails) }}">
|
||||
Report
|
||||
</button>
|
||||
</td>
|
||||
<td>{{ $doctorName }}</td>
|
||||
<td>{{ $fd->msl_code ?? '' }}</td>
|
||||
<td>{{ $fd->pbc_amt ?? '' }}</td>
|
||||
<td>{{ $monthYear }}</td>
|
||||
@foreach($fiscalMonthColumns as $fiscalColumn)
|
||||
<td class="text-center">{{ $formatReportTotal($doctorReportTotals[$fiscalColumn] ?? null) }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="{{ 5 + count($fiscalMonthColumns) }}" class="text-center text-muted">No doctors added yet.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="form-wrapper" class="col-12">
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
|
||||
@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)
|
||||
<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')
|
||||
@if($question->code == 'contact_id')
|
||||
<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':''}}
|
||||
msl_code="{{ $option->contact->msl_code ?? '' }}"
|
||||
speciality="{{ $option->contact->speciality ?? '' }}">
|
||||
{{$option->display}}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
<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>
|
||||
@endif
|
||||
@break
|
||||
@case('radio')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-success">
|
||||
<input class="form-check-input" type="radio" name="{{$question->code}}" id="field-{{$question->code}}_{{$option->value}}" value="{{$option->value}}">
|
||||
<label class="form-check-label" for="field-{{$question->code}}_{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('radiometrix')
|
||||
@php
|
||||
$headings =
|
||||
count($question->options) > 0
|
||||
? json_decode($question->options[0]->value)
|
||||
: [];
|
||||
@endphp
|
||||
<div class="table-responsive">
|
||||
<div class="d-table w-100">
|
||||
<div class="d-table-row font-weight-bold">
|
||||
<div class="d-table-cell p-2" style="width: 150px;"></div>
|
||||
@foreach ($headings as $head)
|
||||
<div class="d-table-cell text-center p-2">{{ $head }}</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@foreach ($question->options as $option)
|
||||
@php $nn = json_decode($option->value); @endphp
|
||||
<div class="d-table-row align-middle">
|
||||
<div class="d-table-cell font-weight-bold p-2" style="width: 150px;">
|
||||
{{ $option->display }}
|
||||
</div>
|
||||
@foreach ($nn as $value)
|
||||
<div class="d-table-cell text-center p-2">
|
||||
<input type="radio"
|
||||
id="field-{{ $option->display }}-{{ $value }}"
|
||||
name="{{ $question->code }}[{{$option->display}}]" value="{{$value}}" class="form-check-input"
|
||||
{{ isset($question->display) && $option->display != $option->display ? 'checked' : '' }}>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary ms-2">
|
||||
<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
|
||||
@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>
|
||||
@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 type="button" class="btn btn-light me-2" id="cancel-form-btn">Cancel</button>
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="report-entry-form-wrapper" class="col-12">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h5 class="mb-0">Report</h5>
|
||||
</div>
|
||||
<form method="POST" action="/form/submit" id="report-entry-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{ $reportFormId }}">
|
||||
@csrf
|
||||
|
||||
@foreach($reportQuestions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="report-field-{{ $question->code == 'contact_id' ? 'contact_id-display' : $question->code }}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@if($question->code == 'year')
|
||||
<select class="form-control" id="report-field-year" name="year" {{$question->required == 'yes'?'required':'' }}>
|
||||
@for($y = 2026; $y <= 2028; $y++)
|
||||
<option value="{{ $y }}" {{ $reportCurrentYear === $y ? 'selected' : '' }}>{{ $y }}</option>
|
||||
@endfor
|
||||
</select>
|
||||
@elseif($question->code == 'month')
|
||||
<select class="form-control" id="report-field-month" name="month" {{$question->required == 'yes'?'required':'' }}>
|
||||
@foreach($reportMonths as $monthName)
|
||||
<option value="{{ $monthName }}" {{ $reportCurrentMonth === $monthName ? 'selected' : '' }}>{{ $monthName }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@elseif($question->code == 'contact_id')
|
||||
<input type="hidden" id="report-field-contact_id" name="contact_id" value="">
|
||||
<input type="text" id="report-field-contact_id-display" class="form-control" readonly tabindex="-1">
|
||||
@else
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="report-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="report-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="any" id="report-field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} {{ in_array($question->code, $reportReadonlyCalcFields) ? 'readonly' : '' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="report-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="report-field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}">{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('radio')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-success">
|
||||
<input class="form-check-input" type="radio" name="{{$question->code}}" id="report-field-{{$question->code}}_{{$option->value}}" value="{{$option->value}}">
|
||||
<label class="form-check-label" for="report-field-{{$question->code}}_{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary ms-2">
|
||||
<input class="form-check-input" type="checkbox" id="report-field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}">
|
||||
<label class="form-check-label" for="report-field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="report-field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>
|
||||
@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="report-field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<div class="text-center d-grid mt-3 report-entry-actions">
|
||||
<button type="button" class="btn btn-light me-2" id="cancel-report-form-btn">Cancel</button>
|
||||
<button class="btn btn-primary" type="submit" id="report-entry-submit-btn"> Submit </button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
</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-label {
|
||||
font-weight:bold;
|
||||
font-size:16px;
|
||||
}
|
||||
#form-wrapper .text-center.d-grid,
|
||||
#report-entry-form-wrapper .report-entry-actions {
|
||||
display: flex !important;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
#table-wrapper .doctor-report-table {
|
||||
font-size: 12px;
|
||||
}
|
||||
#table-wrapper .doctor-report-table th,
|
||||
#table-wrapper .doctor-report-table td {
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</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();
|
||||
$('#report-entry-form-wrapper').hide();
|
||||
|
||||
const doctorNameById = @json($doctorNameById);
|
||||
const doctorIdByName = @json($doctorIdByName);
|
||||
|
||||
function normalizeContactId(value) {
|
||||
if (value === null || value === undefined) {
|
||||
return '';
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
return String(value[0] || '').trim();
|
||||
}
|
||||
if (typeof value === 'object') {
|
||||
return String(Object.values(value)[0] || '').trim();
|
||||
}
|
||||
return String(value).trim();
|
||||
}
|
||||
|
||||
function resolveContactId(value) {
|
||||
const raw = normalizeContactId(value);
|
||||
if (!raw) {
|
||||
return '';
|
||||
}
|
||||
if (doctorNameById[raw]) {
|
||||
return raw;
|
||||
}
|
||||
if (doctorIdByName[raw]) {
|
||||
return doctorIdByName[raw];
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
function setReportContactFields(contactId, doctorName) {
|
||||
contactId = resolveContactId(contactId);
|
||||
doctorName = String(doctorName || '').trim();
|
||||
|
||||
if (!doctorName && contactId && doctorNameById[contactId]) {
|
||||
doctorName = doctorNameById[contactId];
|
||||
}
|
||||
|
||||
$('#report-field-contact_id').val(contactId);
|
||||
$('#report-field-contact_id-display').val(doctorName);
|
||||
}
|
||||
|
||||
const reportGroupTotalSelectors = [
|
||||
'#report-field-pulmosmart_group_actual_value',
|
||||
'#report-field-pulmosamrt_group_actual_value',
|
||||
];
|
||||
|
||||
function parseReportNumber(selector) {
|
||||
const $field = $(selector);
|
||||
if (!$field.length) {
|
||||
return null;
|
||||
}
|
||||
const value = parseFloat($field.val());
|
||||
return isNaN(value) ? 0 : value;
|
||||
}
|
||||
|
||||
function setReportNumber(selectors, value) {
|
||||
const rounded = Math.round(value * 100) / 100;
|
||||
(Array.isArray(selectors) ? selectors : [selectors]).forEach(function(selector) {
|
||||
const $field = $(selector);
|
||||
if ($field.length) {
|
||||
$field.val(rounded);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function recalculateReportFields() {
|
||||
const dpiPmdi = parseReportNumber('#report-field-pulmosmart_dpi_pmdi_actual_value');
|
||||
const neb = parseReportNumber('#report-field-pulmosmart_neb_actual_value');
|
||||
const pulmosmartG = parseReportNumber('#report-field-pulmosmart_g_actual_value');
|
||||
setReportNumber(reportGroupTotalSelectors, dpiPmdi + neb + pulmosmartG);
|
||||
|
||||
const budasure = parseReportNumber('#report-field-budasure_actual_value');
|
||||
const vilorespU = parseReportNumber('#report-field-viloresp_u');
|
||||
const totalActual = budasure + vilorespU;
|
||||
setReportNumber('#report-field-total_actual_value', totalActual);
|
||||
|
||||
let psShare = 0;
|
||||
if (totalActual > 0) {
|
||||
psShare = (dpiPmdi / totalActual) * 100;
|
||||
}
|
||||
setReportNumber('#report-field-ps_share', psShare);
|
||||
}
|
||||
|
||||
function bindReportCalculations() {
|
||||
const sourceSelectors = [
|
||||
'#report-field-pulmosmart_dpi_pmdi_actual_value',
|
||||
'#report-field-pulmosmart_neb_actual_value',
|
||||
'#report-field-pulmosmart_g_actual_value',
|
||||
'#report-field-budasure_actual_value',
|
||||
'#report-field-viloresp_u',
|
||||
].join(', ');
|
||||
|
||||
$(document).off('input.reportCalc change.reportCalc', sourceSelectors);
|
||||
$(document).on('input.reportCalc change.reportCalc', sourceSelectors, recalculateReportFields);
|
||||
|
||||
reportGroupTotalSelectors.forEach(function(selector) {
|
||||
$(selector).prop('readonly', true);
|
||||
});
|
||||
$('#report-field-total_actual_value, #report-field-ps_share').prop('readonly', true);
|
||||
}
|
||||
|
||||
bindReportCalculations();
|
||||
|
||||
function showTable() {
|
||||
$('#form-wrapper').hide();
|
||||
$('#report-entry-form-wrapper').hide();
|
||||
$('#table-wrapper').show();
|
||||
$('#add-doctor-btn').show();
|
||||
}
|
||||
|
||||
function showForm() {
|
||||
$('#table-wrapper').hide();
|
||||
$('#report-entry-form-wrapper').hide();
|
||||
$('#form-wrapper').show();
|
||||
$('#add-doctor-btn').hide();
|
||||
}
|
||||
|
||||
function showReportForm(contactId, planDetails, doctorName) {
|
||||
$('#table-wrapper').hide();
|
||||
$('#form-wrapper').hide();
|
||||
$('#add-doctor-btn').hide();
|
||||
$('#report-entry-form-wrapper').show();
|
||||
|
||||
$('#report-entry-form')[0].reset();
|
||||
$('#report-entry-form input[name="id"]').remove();
|
||||
|
||||
if (planDetails) {
|
||||
for (let key of Object.keys(planDetails)) {
|
||||
if (key === 'contact_id' || key === 'id' || key === 'month' || key === 'year') {
|
||||
continue;
|
||||
}
|
||||
let $field = $('#report-field-' + key);
|
||||
if ($field.length && !$field.is('#report-field-contact_id') && !$field.is('#report-field-contact_id-display')) {
|
||||
$field.val(planDetails[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($('#report-field-msl_code').length) {
|
||||
$('#report-field-msl_code').prop('readonly', true);
|
||||
}
|
||||
|
||||
let reportMonths = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
||||
let now = new Date();
|
||||
if ($('#report-field-month').length) {
|
||||
$('#report-field-month').val(reportMonths[now.getMonth()]);
|
||||
}
|
||||
if ($('#report-field-year').length) {
|
||||
let currentYear = now.getFullYear();
|
||||
if (currentYear < 2026) {
|
||||
currentYear = 2026;
|
||||
} else if (currentYear > 2028) {
|
||||
currentYear = 2028;
|
||||
}
|
||||
$('#report-field-year').val(String(currentYear));
|
||||
}
|
||||
|
||||
setReportContactFields(contactId, doctorName);
|
||||
recalculateReportFields();
|
||||
}
|
||||
|
||||
$('#add-doctor-btn').on('click', function() {
|
||||
$('#report-form')[0].reset();
|
||||
$('#report-form input[name="id"]').remove();
|
||||
showForm();
|
||||
});
|
||||
|
||||
$('#cancel-form-btn').on('click', function() {
|
||||
showTable();
|
||||
});
|
||||
|
||||
$('#cancel-report-form-btn').on('click', function() {
|
||||
showTable();
|
||||
});
|
||||
|
||||
$(document).on('click', '.report-btn', function() {
|
||||
let contactId = resolveContactId($(this).attr('data-contact-id'));
|
||||
let doctorName = String($(this).attr('data-doctor-name') || '').trim();
|
||||
let planDetails = {};
|
||||
try {
|
||||
planDetails = JSON.parse($(this).attr('plan_details') || '{}');
|
||||
} catch (e) {
|
||||
planDetails = {};
|
||||
}
|
||||
if (!contactId) {
|
||||
contactId = resolveContactId(planDetails.contact_id);
|
||||
}
|
||||
if (!doctorName && contactId && doctorNameById[contactId]) {
|
||||
doctorName = doctorNameById[contactId];
|
||||
}
|
||||
showReportForm(contactId, planDetails, doctorName);
|
||||
});
|
||||
|
||||
if ($('#field-user_id').length) {
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy);
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
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)
|
||||
.attr("msl_code", itm.contact?.msl_code || '')
|
||||
.attr("speciality", itm.contact?.speciality || '')
|
||||
.text(itm.display)
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if ($('#field-contact_id').length) {
|
||||
$('#field-contact_id').on('change', function() {
|
||||
let $selected = $('option:selected', this);
|
||||
$('#field-msl_code').val($selected.attr('msl_code') || '');
|
||||
$('#field-speciality').val($selected.attr('speciality') || '');
|
||||
});
|
||||
}
|
||||
|
||||
if ($('#field-msl_code').length) {
|
||||
$('#field-msl_code').prop('readonly', true);
|
||||
}
|
||||
|
||||
$('#report-entry-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
recalculateReportFields();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-entry-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your report is successfully submitted!',
|
||||
icon: 'success'
|
||||
}).then(function() {
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: data.hasOwnProperty('message') ? 'You are not mapped to any position code' : 'Data not submitted',
|
||||
text: data.hasOwnProperty('message') ? 'for resolution please email Position code, L1 Manager and L2 Manager details to support1@stratawiz.com' : 'Something went wrong, please try again after some time!'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$("#pageloader").fadeOut();
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Error',
|
||||
text: 'Something went wrong'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#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'
|
||||
}).then(function() {
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: data.hasOwnProperty('message') ? 'You are not mapped to any position code' : 'Data not submitted',
|
||||
text: data.hasOwnProperty('message') ? 'for resolution please email Position code, L1 Manager and L2 Manager details to support1@stratawiz.com' : 'Something went wrong, please try again after some time!'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$("#pageloader").fadeOut();
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Error',
|
||||
text: 'Something went wrong'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
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-record_date');
|
||||
if (recordDateField) {
|
||||
recordDateField.setAttribute('max', today);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -44,7 +44,18 @@
|
|||
@endif
|
||||
|
||||
@php
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
||||
$submissions = [];
|
||||
if (isset($form->manager_can_submit) && $form->manager_can_submit == true && isset($form->users) && count($form->users) > 0) {
|
||||
foreach ($form->users as $option) {
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $option->value);
|
||||
if (isset($history->data->submissions) && is_array($history->data->submissions)) {
|
||||
$submissions = array_merge($submissions, $history->data->submissions);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
||||
$submissions = $history->data->submissions ?? [];
|
||||
}
|
||||
@endphp
|
||||
|
||||
<div class="col-md-12" id="table-wrapper">
|
||||
|
|
@ -56,6 +67,9 @@
|
|||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<th>User</th>
|
||||
@endif
|
||||
<th>Execution Done</th>
|
||||
<th>Plan Date</th>
|
||||
{{-- <th>Team Name</th> --}}
|
||||
|
|
@ -68,18 +82,52 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($history->data->submissions as $sub)
|
||||
@foreach ($submissions as $sub)
|
||||
@php
|
||||
$sub->formdata->id = $sub->id;
|
||||
if (isset($sub->user_info->id)) {
|
||||
$sub->formdata->user_id = $sub->user_info->id;
|
||||
}
|
||||
if (isset($sub->hierarchy_id) && $sub->hierarchy_id != '') {
|
||||
$sub->formdata->hierarchy_id = $sub->hierarchy_id;
|
||||
} elseif (isset($form->users) && isset($sub->formdata->user_id)) {
|
||||
foreach ($form->users as $option) {
|
||||
if ($option->value == $sub->formdata->user_id && isset($option->hierarchy_id)) {
|
||||
$sub->formdata->hierarchy_id = $option->hierarchy_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button"
|
||||
|
||||
@if($sub->workflow_status=='approved' || isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'Yes' )
|
||||
<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-danger btn-xs delete-btn" data-form-id="{{ $sub->formdata->form_id }}" data-id="{{ $sub->id }}">Delete</button>
|
||||
|
||||
|
||||
|
||||
@elseif($sub->workflow_status=='rejected')
|
||||
<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>
|
||||
@else
|
||||
<button type="button" class="btn btn-danger btn-xs delete-btn" data-form-id="{{ $sub->formdata->form_id }}" data-id="{{ $sub->id }}">Delete</button>
|
||||
|
||||
|
||||
@endif
|
||||
<!-- <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-danger btn-xs delete-btn" data-form-id="{{ $sub->formdata->form_id }}" data-id="{{ $sub->id }}">Delete</button>
|
||||
<button type="button" class="btn btn-danger btn-xs delete-btn" data-form-id="{{ $sub->formdata->form_id }}" data-id="{{ $sub->id }}">Delete</button> -->
|
||||
</td>
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<td>{{ $sub->user_info->name ?? '' }}</td>
|
||||
@endif
|
||||
<td>{{ isset($sub->formdata->record_date) && $sub->formdata->record_date > 0 ? 'Yes' : 'No' }}
|
||||
</td>
|
||||
<td>{{ $sub->formdata->plan_date }}</td>
|
||||
|
|
@ -116,7 +164,7 @@
|
|||
</div>
|
||||
@endif
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, ['record_date', 'name_of_the_speaker', 'msl_code', 'attendence','speciality','honorarium_amount','other_expenses','total_eas','no_of_patients_on_duolin','no_of_units_duolin_respules','other_msl_code','other_speciality']))
|
||||
@if (in_array($question->code, ['record_date', 'attendence','honorarium_amount','other_expenses','total_eas','no_of_patients_on_duolin','no_of_units_duolin_respules']))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
|
|
@ -155,14 +203,40 @@
|
|||
@break
|
||||
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
<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
|
||||
@if ($question->code == 'name_of_the_speaker')
|
||||
@foreach ($question->options as $option)
|
||||
@if( isset($option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors) && $option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors == 'Yes' )
|
||||
<option value="{{ $option->value }}" speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" msl_code="{{isset($option->contact->msl_code)?$option->contact->msl_code:''}}"
|
||||
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
<option value="other" speciality="" msl_code="">Other</option>
|
||||
|
||||
@elseif ($question->code == 'other_speaker_name')
|
||||
@foreach ($question->options as $option)
|
||||
@if(!isset($option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors) ||
|
||||
$option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors === null
|
||||
)
|
||||
<option value="{{ $option->value }}" speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" msl_code="{{isset($option->contact->msl_code)?$option->contact->msl_code:''}}"
|
||||
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
@else
|
||||
@foreach ($question->options as $option)
|
||||
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@break
|
||||
|
||||
|
|
@ -197,6 +271,10 @@
|
|||
<input type="hidden" name="form_id" value="{{ $form_id }}">
|
||||
@csrf
|
||||
<input type="hidden" name="id" value="" id="execution-id">
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<input type="hidden" name="user_id" value="" id="execution-user_id">
|
||||
<input type="hidden" name="hierarchy_id" value="" id="execution-hierarchy_id">
|
||||
@endif
|
||||
@foreach ($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{ $question->code }}"
|
||||
|
|
@ -235,26 +313,40 @@
|
|||
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="execution-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@if ($question->code == 'name_of_the_speaker')
|
||||
@foreach ($question->options as $option)
|
||||
@if( isset($option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors) && $option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors == 'Yes' )
|
||||
<option value="{{ $option->value }}" speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" msl_code="{{isset($option->contact->msl_code)?$option->contact->msl_code:''}}"
|
||||
<option value=""> -- Select -- </option>
|
||||
@if ($question->code == 'name_of_the_speaker')
|
||||
@foreach ($question->options as $option)
|
||||
@if( isset($option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors) && $option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors == 'Yes' )
|
||||
<option value="{{ $option->value }}" speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" msl_code="{{isset($option->contact->msl_code)?$option->contact->msl_code:''}}"
|
||||
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
<option value="other" speciality="" msl_code="">Other</option>
|
||||
@else
|
||||
@foreach ($question->options as $option)
|
||||
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
<option value="other" speciality="" msl_code="">Other</option>
|
||||
|
||||
@elseif ($question->code == 'other_speaker_name')
|
||||
@foreach ($question->options as $option)
|
||||
@if(!isset($option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors) ||
|
||||
$option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors === null
|
||||
)
|
||||
<option value="{{ $option->value }}" speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" msl_code="{{isset($option->contact->msl_code)?$option->contact->msl_code:''}}"
|
||||
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
@else
|
||||
@foreach ($question->options as $option)
|
||||
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@break
|
||||
|
||||
@case('checkbox')
|
||||
|
|
@ -369,6 +461,61 @@
|
|||
.replace(/[\s_-]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '');
|
||||
|
||||
function fillSpeakerDropdown($select, data, includeOther) {
|
||||
$select.html('');
|
||||
$select.append($("<option></option>").attr("value", '').text('-- Select --'));
|
||||
for (let itm of data) {
|
||||
const activities = itm?.contact?.doctor_activities_for_neb_2_top_30_next_30_doctors;
|
||||
if (typeof activities !== 'undefined' && activities !== null && activities !== 'Yes') continue;
|
||||
$select.append(
|
||||
$("<option></option>")
|
||||
.attr("value", itm.value)
|
||||
.text(itm.display)
|
||||
.attr("msl_code", itm?.contact?.msl_code ?? '')
|
||||
.attr('speciality', itm?.contact?.speciality ?? '')
|
||||
);
|
||||
}
|
||||
if (includeOther) {
|
||||
$select.append(
|
||||
$("<option></option>")
|
||||
.attr("value", 'other')
|
||||
.text('Other')
|
||||
.attr("msl_code", '')
|
||||
.attr('speciality', '')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function fillOtherSpeakerDropdown($select, data) {
|
||||
$select.html('');
|
||||
$select.append($("<option></option>").attr("value", '').text('-- Select --'));
|
||||
for (let itm of data) {
|
||||
const activities = itm?.contact?.doctor_activities_for_neb_2_top_30_next_30_doctors;
|
||||
if (typeof activities !== 'undefined' && activities !== null) continue;
|
||||
$select.append(
|
||||
$("<option></option>")
|
||||
.attr("value", itm.value)
|
||||
.text(itm.display)
|
||||
.attr("msl_code", itm?.contact?.msl_code ?? '')
|
||||
.attr('speciality', itm?.contact?.speciality ?? '')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function applySpeakerValue($select, savedValue) {
|
||||
if (!savedValue) return;
|
||||
$select.val(savedValue);
|
||||
if ($select.val() !== savedValue) {
|
||||
let match = $select.find('option').filter(function() {
|
||||
return $(this).text().trim() == String(savedValue).trim();
|
||||
}).attr('value');
|
||||
if (match) {
|
||||
$select.val(match);
|
||||
}
|
||||
}
|
||||
$select.trigger('change');
|
||||
}
|
||||
|
||||
$('#form-wrapper').hide()
|
||||
$('#execution-form-wrapper').hide()
|
||||
|
||||
|
|
@ -378,30 +525,88 @@
|
|||
$('#execution-form-wrapper').hide()
|
||||
})
|
||||
|
||||
|
||||
$('#field-msl_code,#field-speciality,#field-other_msl_code,#field-other_speciality').attr('readonly',true);
|
||||
|
||||
$('#field-name_of_the_speaker').change(function() {
|
||||
let value=$(this).val();
|
||||
if(value==='other'){
|
||||
$('#field-other_msl_code,#field-other_speciality,#field-other_speaker_name').parent().show();
|
||||
$('#field-other_msl_code,#field-other_speciality,#field-other_speaker_name').attr('required',true);
|
||||
|
||||
$('#field-msl_code,#field-speciality').parent().hide();
|
||||
$('#field-msl_code,#field-speciality').attr('required',false);
|
||||
}
|
||||
else{
|
||||
$('#field-other_msl_code,#field-other_speciality,#field-other_speaker_name').parent().hide();
|
||||
$('#field-other_msl_code,#field-other_speciality,#field-other_speaker_name').attr('required',false);
|
||||
$('#field-msl_code,#field-speciality').parent().show();
|
||||
$('#field-msl_code,#field-speciality').attr('required',true);
|
||||
}
|
||||
})
|
||||
|
||||
$('#field-other_msl_code,#field-other_speciality,#field-other_speaker_name,#field-other_type_of_meeting').parent().hide();
|
||||
$('#field-other_msl_code,#field-other_speciality,#field-other_speaker_name,#field-other_type_of_meeting').attr('required',false);
|
||||
|
||||
$('#field-name_of_the_speaker').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-name_of_the_speaker').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
||||
})
|
||||
|
||||
$('#field-other_speaker_name').change(function() {
|
||||
$('#field-other_msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-other_speaker_name').change(function() {
|
||||
$('#field-other_speciality').val($('option:selected', this).attr('speciality'))
|
||||
})
|
||||
|
||||
|
||||
$('#field-type_of_meeting').on('change',function(){
|
||||
let type_of_meet=$('#field-type_of_meeting').val();
|
||||
console.log("Type of Meet",type_of_meet);
|
||||
|
||||
if(type_of_meet==='Other'){
|
||||
$('#field-other_type_of_meeting').parent().show();
|
||||
$('#field-other_type_of_meeting').attr('required',true);
|
||||
|
||||
}
|
||||
else{
|
||||
$('#field-other_type_of_meeting').parent().hide();
|
||||
$('#field-other_type_of_meeting').attr('required',false);
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
$('.edit-btn').click(function() {
|
||||
let selected = JSON.parse($(this).attr('plan_details'))
|
||||
/*for (let k of Object.keys(selected)) {
|
||||
if (selected[k] != '')
|
||||
$('#execution-' + k).val(selected[k]);
|
||||
}*/
|
||||
let hierarchy = selected['hierarchy_id'] || '';
|
||||
if (!hierarchy && selected['user_id']) {
|
||||
hierarchy = $('#field-user_id option[value="' + selected['user_id'] + '"]').attr('hierarchy') || '';
|
||||
}
|
||||
|
||||
for (let k of Object.keys(selected)) {
|
||||
if (selected[k] != '') {
|
||||
if (k == 'name_of_the_speaker') {
|
||||
console.log('cc',selected[k]);
|
||||
$('#execution-name_of_the_speaker').val($("#execution-name_of_the_speaker option:contains(" +
|
||||
selected[k] + ")").attr('value'));
|
||||
if (k == 'name_of_the_speaker' || k == 'other_speaker_name') {
|
||||
continue;
|
||||
} else {
|
||||
$('#execution-' + k).val(selected[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let docid = $('#execution-name_of_the_speaker option').map(function() {
|
||||
if ($(this).text().trim() == selected['name_of_the_speaker']) return this;
|
||||
}).attr('value')
|
||||
|
||||
$('#execution-name_of_the_speaker').val(docid)
|
||||
$('#execution-id').val(selected['id'])
|
||||
if (selected['user_id'] && $('#execution-user_id').length) {
|
||||
$('#execution-user_id').val(selected['user_id'])
|
||||
}
|
||||
if ($('#execution-hierarchy_id').length) {
|
||||
$('#execution-hierarchy_id').val(hierarchy)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -411,11 +616,37 @@
|
|||
$('#table-wrapper').hide()
|
||||
$('#execution-no_of_patients_on_duolin').attr('max',10);
|
||||
|
||||
function setExecutionSpeakers(data) {
|
||||
fillSpeakerDropdown($('#execution-name_of_the_speaker'), data, true);
|
||||
if ($('#execution-other_speaker_name').length) {
|
||||
fillOtherSpeakerDropdown($('#execution-other_speaker_name'), data);
|
||||
}
|
||||
applySpeakerValue($('#execution-name_of_the_speaker'), selected['name_of_the_speaker']);
|
||||
applySpeakerValue($('#execution-other_speaker_name'), selected['other_speaker_name']);
|
||||
}
|
||||
|
||||
if (hierarchy) {
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy=' + hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
$("#pageloader").fadeOut();
|
||||
setExecutionSpeakers(data);
|
||||
},
|
||||
error: function() {
|
||||
$("#pageloader").fadeOut();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#execution-type_of_meeting').on('change',function(){
|
||||
let type_of_meet=$('#execution-type_of_meeting').val();
|
||||
console.log("Type of Meet",type_of_meet);
|
||||
|
||||
if(type_of_meet==='Asthma camp'){
|
||||
if(type_of_meet==='GNP Camp'){
|
||||
$('#execution-no_of_patients_on_duolin,#execution-no_of_units_duolin_respules').parent().show();
|
||||
$('#execution-no_of_patients_on_duolin,#execution-no_of_units_duolin_respules').attr('required',true);
|
||||
$('label[for="execution-name_of_the_speaker"]').html('Name of the Speaker (Pedia or GP only) ');
|
||||
|
|
@ -428,14 +659,14 @@
|
|||
}
|
||||
})
|
||||
|
||||
$('#execution-other_msl_code,#execution-other_speciality').parent().hide();
|
||||
$('#execution-other_msl_code,#execution-other_speciality').attr('required',false);
|
||||
$('#execution-other_msl_code,#execution-other_speciality,#execution-other_speaker_name').parent().hide();
|
||||
$('#execution-other_msl_code,#execution-other_speciality,#execution-other_speaker_name').attr('required',false);
|
||||
|
||||
|
||||
let type_of_meet=$('#execution-type_of_meeting').val();
|
||||
console.log("Type of Meet without change",type_of_meet);
|
||||
|
||||
if(type_of_meet==='Asthma camp'){
|
||||
if(type_of_meet==='GNP Camp'){
|
||||
$('#execution-no_of_patients_on_duolin,#execution-no_of_units_duolin_respules').parent().show();
|
||||
$('#execution-no_of_patients_on_duolin,#execution-no_of_units_duolin_respules').attr('required',true);
|
||||
$('label[for="execution-name_of_the_speaker"]').html('Name of the Speaker (Pedia or GP only) ');
|
||||
|
|
@ -448,32 +679,26 @@
|
|||
|
||||
}
|
||||
|
||||
$('#execution-name_of_the_speaker').change(function() {
|
||||
$('#execution-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#execution-name_of_the_speaker').change(function() {
|
||||
$('#execution-speciality').val($('option:selected', this).attr('speciality'))
|
||||
})
|
||||
})
|
||||
$('#execution-msl_code,#execution-speciality').attr('readonly',true);
|
||||
$('#execution-msl_code,#execution-speciality,#execution-other_msl_code,#execution-other_speciality').attr('readonly',true);
|
||||
|
||||
$('#execution-name_of_the_speaker').change(function() {
|
||||
$('#execution-name_of_the_speaker').change(function() {
|
||||
let value=$(this).val();
|
||||
if(value==='other'){
|
||||
$('#execution-other_msl_code,#execution-other_speciality').parent().show();
|
||||
$('#execution-other_msl_code,#execution-other_speciality').attr('required',true);
|
||||
$('#execution-other_msl_code,#execution-other_speciality,#execution-other_speaker_name').parent().show();
|
||||
$('#execution-other_msl_code,#execution-other_speciality,#execution-other_speaker_name').attr('required',true);
|
||||
|
||||
$('#execution-msl_code,#execution-speciality').parent().hide();
|
||||
$('#execution-msl_code,#execution-speciality').attr('required',false);
|
||||
}
|
||||
else{
|
||||
$('#execution-other_msl_code,#execution-other_speciality').parent().hide();
|
||||
$('#execution-other_msl_code,#execution-other_speciality').attr('required',false);
|
||||
$('#execution-other_msl_code,#execution-other_speciality,#execution-other_speaker_name').parent().hide();
|
||||
$('#execution-other_msl_code,#execution-other_speciality,#execution-other_speaker_name').attr('required',false);
|
||||
$('#execution-msl_code,#execution-speciality').parent().show();
|
||||
$('#execution-msl_code,#execution-speciality').attr('required',true);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
$('#field-user_id').change(function(){
|
||||
|
|
@ -488,19 +713,10 @@
|
|||
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).attr('speciality',itm.contact.speciality));
|
||||
fillSpeakerDropdown($('#field-name_of_the_speaker'), data, true);
|
||||
if ($('#field-other_speaker_name').length) {
|
||||
fillOtherSpeakerDropdown($('#field-other_speaker_name'), data);
|
||||
}
|
||||
|
||||
$('#field-name_of_the_speaker').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-name_of_the_speaker').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
||||
})
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@
|
|||
{{-- @endif --}}
|
||||
|
||||
@foreach ($questions as $question)
|
||||
|
||||
<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>' : '' !!}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,622 @@
|
|||
<!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" />
|
||||
<link href="{{ asset('assets/libs/select2/select2.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>
|
||||
@php
|
||||
$brandData = [
|
||||
|
||||
['brand'=>'JUNIOR LANZOL 15', 'slug'=>'junior_lanzol_15_units','pseudoId'=>'junior_lanzol_15_value'],
|
||||
['brand'=>'JUNIOR LANZOL 30', 'slug'=>'junior_lanzol_30_units','pseudoId'=>'junior_lanzol_30_value'],
|
||||
['brand'=>"LEVOFLOX 250 (10'S) IP", 'slug'=>'levoflox_250_10s_ip_units','pseudoId'=>'levoflox_250_10s_ip_value'],
|
||||
['brand'=>"LEVOFLOX 250 TAB 10'", 'slug'=>'levoflox_250_tab_10_units','pseudoId'=>'levoflox_250_tab_10_value'],
|
||||
['brand'=>"LEVOFLOX 500 (10'S) IP", 'slug'=>'levoflox_500_10s_ip_units','pseudoId'=>'levoflox_500_10s_ip_value'],
|
||||
['brand'=>"LEVOFLOX 500 10'S", 'slug'=>'levoflox_500_10s_units','pseudoId'=>'levoflox_500_10s_value'],
|
||||
['brand'=>"LEVOFLOX 750 (5'S) IP", 'slug'=>'levoflox_750_5s_ip_units','pseudoId'=>'levoflox_750_5s_ip_value'],
|
||||
['brand'=>"LEVOFLOX 750 TAB 5'S", 'slug'=>'levoflox_750_tab_5s_units','pseudoId'=>'levoflox_750_tab_5s_value'],
|
||||
['brand'=>'LEVOFLOX INFUSION', 'slug'=>'levoflox_infusion_units','pseudoId'=>'levoflox_infusion_value'],
|
||||
['brand'=>'METASPRAY 100AQ', 'slug'=>'metaspray_100aq_units','pseudoId'=>'metaspray_100aq_value'],
|
||||
|
||||
['brand'=>'MONTAIR FX', 'slug'=>'montair_fx_units','pseudoId'=>'montair_fx_value'],
|
||||
['brand'=>'Montair FX 15s', 'slug'=>'montair_fx_15s_units','pseudoId'=>'montair_fx_15s_value'],
|
||||
['brand'=>'CEFOPROX 100 30ML(60)', 'slug'=>'cefoprox_100_30ml60_units','pseudoId'=>'cefoprox_100_30ml60_value'],
|
||||
['brand'=>'CEFOPROX 100DT', 'slug'=>'cefoprox_100dt_units','pseudoId'=>'cefoprox_100dt_value'],
|
||||
['brand'=>"CEFOPROX 200 10'S", 'slug'=>'cefoprox_200_10s_units','pseudoId'=>'cefoprox_200_10s_value'],
|
||||
['brand'=>'CEFOPROX 50 30ml', 'slug'=>'cefoprox_50_30ml_units','pseudoId'=>'cefoprox_50_30ml_value'],
|
||||
['brand'=>'CEFOPROX CV 325 TAB', 'slug'=>'cefoprox_cv_325_tab_units','pseudoId'=>'cefoprox_cv_325_tab_value'],
|
||||
['brand'=>'Cheston DUO 100ml Syrup', 'slug'=>'cheston_duo_100ml_syrup_units','pseudoId'=>'cheston_duo_100ml_syrup_value'],
|
||||
['brand'=>'Cheston LS Junior 100 ML', 'slug'=>'cheston_ls_junior_100_ml_units','pseudoId'=>'cheston_ls_junior_100_ml_value'],
|
||||
['brand'=>'Cheston-D Cough Syrup 100 ML', 'slug'=>'cheston_d_cough_syrup_100_ml_units','pseudoId'=>'cheston_d_cough_syrup_100_ml_value'],
|
||||
|
||||
['brand'=>"Cheston-D Plus 1 x 10'S", 'slug'=>'cheston_d_plus_1_x_10s_units','pseudoId'=>'cheston_d_plus_1_x_10s_value'],
|
||||
['brand'=>'Cheston-LS Cough Syrup 100 ML', 'slug'=>'cheston_ls_cough_syrup_100_ml_units','pseudoId'=>'cheston_ls_cough_syrup_100_ml_value'],
|
||||
['brand'=>'Cheston-LS Junior 60 ML', 'slug'=>'cheston_ls_junior_60_ml_units','pseudoId'=>'cheston_ls_junior_60_ml_value'],
|
||||
['brand'=>'DALACIN C 150MG CAPS 10s', 'slug'=>'dalacin_c_150mg_caps_10s_units','pseudoId'=>'dalacin_c_150mg_caps_10s_value'],
|
||||
['brand'=>'DALACIN C 300MG CAPS 10s', 'slug'=>'dalacin_c_300mg_caps_10s_units','pseudoId'=>'dalacin_c_300mg_caps_10s_value'],
|
||||
['brand'=>'DOLONEX DISP 20MG TABS (IP)', 'slug'=>'dolonex_disp_20mg_tabs_ip_units','pseudoId'=>'dolonex_disp_20mg_tabs_ip_value'],
|
||||
['brand'=>'DOLONEX IM 20MG/1ML INJ', 'slug'=>'dolonex_im_20mg1ml_inj_units','pseudoId'=>'dolonex_im_20mg1ml_inj_value'],
|
||||
['brand'=>"DOLONEX IM 40MG 2ML INJ HOSP (IP)", 'slug'=>'dolonex_im_40mg_2ml_inj_hosp_ip_units','pseudoId'=>'dolonex_im_40mg_2ml_inj_hosp_ip_value'],
|
||||
['brand'=>"DOLONEX IM 40MG/2ML INJ (IP)", 'slug'=>'dolonex_im_40mg2ml_inj_ip_units','pseudoId'=>'dolonex_im_40mg2ml_inj_ip_value'],
|
||||
['brand'=>'DUONASE - F 70 MD', 'slug'=>'duonase_f_70_md_units','pseudoId'=>'duonase_f_70_md_value'],
|
||||
|
||||
['brand'=>"DUONASE NASAL SPRAY", 'slug'=>'duonase_nasal_spray_units','pseudoId'=>'duonase_nasal_spray_value'],
|
||||
['brand'=>"IBUGESIC PLUS SUSP", 'slug'=>'ibugesic_plus_susp_units','pseudoId'=>'ibugesic_plus_susp_value'],
|
||||
['brand'=>'IBUGESIC PLUS SUSP 1', 'slug'=>'ibugesic_plus_susp_1_units','pseudoId'=>'ibugesic_plus_susp_1_value'],
|
||||
['brand'=>"IBUGESIC PLUS SUSPENSION 100ML - ORANGE", 'slug'=>'ibugesic_plus_suspension_100ml_orange_units','pseudoId'=>'ibugesic_plus_suspension_100ml_orange_value'],
|
||||
['brand'=>"MUCINAC 200 TABLET 1 X 10'S", 'slug'=>'mucinac_200_tablet_1_x_10s_units','pseudoId'=>'mucinac_200_tablet_1_x_10s_value'],
|
||||
['brand'=>'MUCINAC 600 TABLETS', 'slug'=>'mucinac_600_tablets_units','pseudoId'=>'mucinac_600_tablets_value'],
|
||||
['brand'=>'Mucinac AB 1 X 10 TABLETS', 'slug'=>'mucinac_ab_1_x_10_tablets_units','pseudoId'=>'mucinac_ab_1_x_10_tablets_value'],
|
||||
['brand'=>"Mucinac AB Tablet", 'slug'=>'mucinac_ab_tablet_units','pseudoId'=>'mucinac_ab_tablet_value'],
|
||||
['brand'=>"MUCINAC C Tablets 1 x 15'S", 'slug'=>'mucinac_c_tablets_1_x_15s_units','pseudoId'=>'mucinac_c_tablets_1_x_15s_value'],
|
||||
['brand'=>'Mucinac Oral Solution 100ml', 'slug'=>'mucinac_oral_solution_100ml_units','pseudoId'=>'mucinac_oral_solution_100ml_value'],
|
||||
|
||||
|
||||
['brand'=>"NOVAMOX - 500", 'slug'=>'novamox_500_units','pseudoId'=>'novamox_500_value'],
|
||||
['brand'=>"NOVAMOX 125 REDIUSE 30 ML", 'slug'=>'novamox_125_rediuse_30_ml_units','pseudoId'=>'novamox_125_rediuse_30_ml_value'],
|
||||
['brand'=>'NOVAMOX 125 REDIUSE 60 ML', 'slug'=>'novamox_125_rediuse_60_ml_units','pseudoId'=>'novamox_125_rediuse_60_ml_value'],
|
||||
['brand'=>"NOVAMOX 250 DT 15's", 'slug'=>'novamox_250_dt_15s_units','pseudoId'=>'novamox_250_dt_15s_value'],
|
||||
['brand'=>"NOVAMOX 250 R/U 30", 'slug'=>'novamox_250_ru_30_units','pseudoId'=>'novamox_250_ru_30_value'],
|
||||
['brand'=>'NOVAMOX 250 REDIUSE', 'slug'=>'novamox_250_rediuse_units','pseudoId'=>'novamox_250_rediuse_value'],
|
||||
['brand'=>'NOVAMOX 30ML', 'slug'=>'novamox_30ml_units','pseudoId'=>'novamox_30ml_value'],
|
||||
['brand'=>"NOVAMOX 60ML", 'slug'=>'novamox_60ml_units','pseudoId'=>'novamox_60ml_value'],
|
||||
['brand'=>"NOVAMOX CV 1000 MG", 'slug'=>'novamox_cv_1000_mg_units','pseudoId'=>'novamox_cv_1000_mg_value'],
|
||||
['brand'=>"NOVAMOX CV 228.5 DT TABLETS", 'slug'=>'novamox_cv_2285_dt_tablets_units','pseudoId'=>'novamox_cv_2285_dt_tablets_value'],
|
||||
|
||||
['brand'=>"NOVAMOX CV 228.5 MG SYRUP", 'slug'=>'novamox_cv_2285_mg_syrup_units','pseudoId'=>'novamox_cv_2285_mg_syrup_value'],
|
||||
['brand'=>"NOVAMOX CV 375 TAB 10s", 'slug'=>'novamox_cv_375_tab_10s_units','pseudoId'=>'novamox_cv_375_tab_10s_value'],
|
||||
['brand'=>"NOVAMOX CV 457 DT 10's", 'slug'=>'novamox_cv_457_dt_10s_units','pseudoId'=>'novamox_cv_457_dt_10s_value'],
|
||||
['brand'=>"NOVAMOX CV 625 TABLETS 10", 'slug'=>'novamox_cv_625_tablets_10_units','pseudoId'=>'novamox_cv_625_tablets_10_value'],
|
||||
['brand'=>"NOVAMOX CV DROPS", 'slug'=>'novamox_cv_drops_units','pseudoId'=>'novamox_cv_drops_value'],
|
||||
['brand'=>'Novamox CV Dry Syrup 30 ML', 'slug'=>'novamox_cv_dry_syrup_30_ml_units','pseudoId'=>'novamox_cv_dry_syrup_30_ml_value'],
|
||||
['brand'=>'NOVAMOX CV DS', 'slug'=>'novamox_cv_ds_units','pseudoId'=>'novamox_cv_ds_value'],
|
||||
['brand'=>"NOVAMOX CV FORTE SYP", 'slug'=>'novamox_cv_forte_syp_units','pseudoId'=>'novamox_cv_forte_syp_value'],
|
||||
['brand'=>"Novamox CV Forte Syp 60 ml", 'slug'=>'novamox_cv_forte_syp_60_ml_units','pseudoId'=>'novamox_cv_forte_syp_60_ml_value'],
|
||||
['brand'=>"NOVAMOX DROPS", 'slug'=>'novamox_drops_units','pseudoId'=>'novamox_drops_value'],
|
||||
|
||||
['brand'=>"NOVAMOX LB 500", 'slug'=>'novamox_lb_500_units','pseudoId'=>'novamox_lb_500_value'],
|
||||
['brand'=>"NOVAMOX RDU DROPS", 'slug'=>'novamox_rdu_drops_units','pseudoId'=>'novamox_rdu_drops_value'],
|
||||
['brand'=>"NOVAMOX-125 DT 15'S", 'slug'=>'novamox_125_dt_15s_units','pseudoId'=>'novamox_125_dt_15s_value'],
|
||||
['brand'=>"NOVAMOX-250 [15'S]", 'slug'=>'novamox_250_15s_units','pseudoId'=>'novamox_250_15s_value'],
|
||||
['brand'=>"TEDISPAN 200 TABLETS 6S", 'slug'=>'tedispan_200_tablets_6s_units','pseudoId'=>'tedispan_200_tablets_6s_value'],
|
||||
['brand'=>"RABICIP - L CAPSULES", 'slug'=>'rabicip_l_capsules_units','pseudoId'=>'rabicip_l_capsules_value'],
|
||||
['brand'=>"RABICIP 20 15'S", 'slug'=>'rabicip_20_15s_units','pseudoId'=>'rabicip_20_15s_value'],
|
||||
['brand'=>"RABICIP 20 TABLETS 15S", 'slug'=>'rabicip_20_tablets_15s_units','pseudoId'=>'rabicip_20_tablets_15s_value'],
|
||||
['brand'=>"RABICIP 20mg (IP) 1 x 15s TABLETS", 'slug'=>'rabicip_20mg_ip_1_x_15s_tablets_units','pseudoId'=>'rabicip_20mg_ip_1_x_15s_tablets_value'],
|
||||
['brand'=>"RABICIP D CAPSULES 1 X 15'S", 'slug'=>'rabicip_d_capsules_1_x_15s_units','pseudoId'=>'rabicip_d_capsules_1_x_15s_value'],
|
||||
['brand'=>"ANTIFLU SYRUP 75 ML", 'slug'=>'antiflu_syrup_75_ml_units','pseudoId'=>'antiflu_syrup_75_ml_value']
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
];
|
||||
|
||||
@endphp
|
||||
|
||||
|
||||
@php
|
||||
// echo "<pre>";
|
||||
// print_r($submitted_formdata);
|
||||
// echo "</pre>";
|
||||
$skuData = [];
|
||||
|
||||
foreach($questions as $q){
|
||||
if($q->code === 'sku'){
|
||||
foreach($q->options as $opt){
|
||||
$skuData[$opt->value] = $opt->submitted_value ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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 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>
|
||||
@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
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
<input type="hidden" name="record_date" value="" id="field-record_date">
|
||||
@csrf
|
||||
@if($id)
|
||||
<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, ['record_date', 'attendence','honorarium_amount','other_expenses','total_eas','no_of_patients_on_duolin','no_of_units_duolin_respules']))
|
||||
@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="0.01"
|
||||
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 == 'name_of_the_speaker')
|
||||
@foreach ($question->options as $option)
|
||||
@if(!isset($option->value))
|
||||
@continue
|
||||
@endif
|
||||
@if(isset($option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors) && $option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors == 'Yes')
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
||||
msl_code="{{ isset($option->contact->msl_code) ? $option->contact->msl_code : '' }}"
|
||||
speciality="{{ isset($option->contact->speciality) ? $option->contact->speciality : '' }}">
|
||||
{{ $option->display ?? '' }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
<option value="other" msl_code="" speciality="" {{ isset($question->value) && $question->value == 'other' ? 'selected' : '' }}>Other</option>
|
||||
@elseif ($question->code == 'other_speaker_name')
|
||||
@foreach ($question->options as $option)
|
||||
@if(!isset($option->value))
|
||||
@continue
|
||||
@endif
|
||||
@if(!isset($option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors) ||
|
||||
$option->contact->doctor_activities_for_neb_2_top_30_next_30_doctors === null
|
||||
)
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
||||
msl_code="{{ isset($option->contact->msl_code) ? $option->contact->msl_code : '' }}"
|
||||
speciality="{{ isset($option->contact->speciality) ? $option->contact->speciality : '' }}">
|
||||
{{ $option->display ?? '' }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
@else
|
||||
@foreach ($question->options as $option)
|
||||
@if(!isset($option->value))
|
||||
@continue
|
||||
@endif
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
||||
msl_code="{{ isset($option->contact) && isset($option->contact->msl_code) ? $option->contact->msl_code : '' }}"
|
||||
speciality="{{ isset($option->contact) && isset($option->contact->speciality) ? $option->contact->speciality : '' }}">
|
||||
{{ $option->display ?? '' }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
@if(!isset($option->value))
|
||||
@continue
|
||||
@endif
|
||||
<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
|
||||
|
||||
@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>Brand</th>
|
||||
<th>Units</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($brandData as $brand)
|
||||
@php
|
||||
//$unitVal = $skuData[$brand['slug']] ?? 0;
|
||||
$unitVal = $submitted_formdata->{$brand['slug']} ?? 0;
|
||||
$valueVal = $submitted_formdata->{$brand['pseudoId']} ?? 0;
|
||||
@endphp
|
||||
<tr>
|
||||
|
||||
<td>{{ $brand['brand'] }}</td>
|
||||
<td>
|
||||
<input type="number" id="field-{{ $brand['slug'] }}"
|
||||
name="{{ $brand['slug'] }}"
|
||||
class="form-control form-control-large" readonly="true" value="{{$unitVal}}" >
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" id="field-{{ $brand['pseudoId'] }}"
|
||||
name="{{ $brand['pseudoId'] }}"
|
||||
class="form-control form-control-large" readonly="true" value="{{$valueVal}}" >
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- @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>
|
||||
@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 src="{{ asset('assets/libs/select2/select2.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($) {
|
||||
$('[data-toggle="select2"]').select2();
|
||||
let selected_user_id = ''
|
||||
$('#field-user_id').change(function() {
|
||||
$("#pageloader").fadeIn();
|
||||
selected_user_id = $(this).val()
|
||||
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) {
|
||||
if(itm.contact.c2c == 'Yes') {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",
|
||||
itm.value).text(itm.display).attr("speciality", itm
|
||||
.contact.speciality));
|
||||
}
|
||||
}
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr(
|
||||
'speciality'))
|
||||
})
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
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-chemist_name,#field-contact_id,#field-msl_code,#field-speciality').parent().hide();
|
||||
$('#field-chemist_name,#field-contact_id,#field-msl_code,#field-speciality').attr('required',false);
|
||||
|
||||
$('#field-speciality,#field-msl_code').attr('readonly',true);
|
||||
|
||||
$('#field-pob_type').on('change',function(){
|
||||
let value=$(this).val();
|
||||
console.log("Value is : ",value);
|
||||
if(value==='Doctor'){
|
||||
$('#field-chemist_name').parent().hide();
|
||||
$('#field-chemist_name').attr('required',false);
|
||||
$('#field-contact_id,#field-msl_code,#field-speciality').parent().show();
|
||||
$('#field-contact_id,#field-msl_code,#field-speciality').attr('required',true);
|
||||
|
||||
}
|
||||
else if(value==='Chemist'){
|
||||
$('#field-contact_id,#field-msl_code,#field-speciality').parent().hide();
|
||||
$('#field-contact_id,#field-msl_code,#field-speciality').attr('required',false);
|
||||
$('#field-chemist_name').parent().show();
|
||||
$('#field-chemist_name').attr('required',true);
|
||||
|
||||
}
|
||||
else{
|
||||
$('#field-chemist_name,#field-contact_id,#field-msl_code,#field-speciality').parent().hide();
|
||||
$('#field-chemist_name,#field-contact_id,#field-msl_code,#field-speciality').attr('required',false);
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const products = {
|
||||
"junior_lanzol_15": 154.63,
|
||||
"junior_lanzol_30": 165.61,
|
||||
"levoflox_250_10s_ip": 39.20,
|
||||
"levoflox_250_tab_10": 39.20,
|
||||
"levoflox_500_10s_ip": 73.19,
|
||||
"levoflox_500_10s": 73.19,
|
||||
"levoflox_750_5s_ip": 50.67,
|
||||
"levoflox_750_tab_5s": 50.67,
|
||||
"levoflox_infusion": 217.11,
|
||||
"metaspray_100aq": 454.72,
|
||||
|
||||
"montair_fx": 158.96,
|
||||
"montair_fx_15s": 307.73,
|
||||
"cefoprox_100_30ml60": 195.91,
|
||||
"cefoprox_100dt": 153.44,
|
||||
"cefoprox_200_10s": 199.70,
|
||||
"cefoprox_50_30ml": 105.24,
|
||||
"cefoprox_cv_325_tab": 332.14,
|
||||
"cheston_duo_100ml_syrup": 94.29,
|
||||
"cheston_ls_junior_100_ml": 82.23,
|
||||
"cheston_d_cough_syrup_100_ml": 96.62,
|
||||
|
||||
"cheston_d_plus_1_x_10s": 39.92,
|
||||
"cheston_ls_cough_syrup_100_ml": 99.50,
|
||||
"cheston_ls_junior_60_ml": 49.33,
|
||||
"dalacin_c_150mg_caps_10s": 140.47,
|
||||
"dalacin_c_300mg_caps_10s": 243.75,
|
||||
"dolonex_disp_20mg_tabs_ip": 204.79,
|
||||
"dolonex_im_20mg1ml_inj": 30.24,
|
||||
"dolonex_im_40mg_2ml_inj_hosp_ip": 55.30,
|
||||
"dolonex_im_40mg2ml_inj_ip": 55.30,
|
||||
"duonase_f_70_md": 455.86,
|
||||
|
||||
|
||||
"duonase_nasal_spray": 462.13,
|
||||
"ibugesic_plus_susp": 37.48,
|
||||
"ibugesic_plus_susp_1": 47.44,
|
||||
"ibugesic_plus_suspension_100ml_orange": 47.44,
|
||||
"mucinac_200_tablet_1_x_10s": 125.97,
|
||||
"mucinac_600_tablets": 279.00,
|
||||
"mucinac_ab_1_x_10_tablets": 109.81,
|
||||
"mucinac_ab_tablet": 199.31,
|
||||
"mucinac_c_tablets_1_x_15s": 369.15,
|
||||
"mucinac_oral_solution_100ml": 111.86,
|
||||
|
||||
|
||||
"novamox_500": 89.87,
|
||||
"novamox_125_rediuse_30_ml": 24.95,
|
||||
"novamox_125_rediuse_60_ml": 49.91,
|
||||
"novamox_250_dt_15s": 147.57,
|
||||
"novamox_250_ru_30": 38.16,
|
||||
"novamox_250_rediuse": 76.31,
|
||||
"novamox_30ml": 24.95,
|
||||
"novamox_60ml": 49.91,
|
||||
"novamox_cv_1000_mg": 421.74,
|
||||
"novamox_cv_2285_dt_tablets": 158.79,
|
||||
|
||||
|
||||
"novamox_cv_2285_mg_syrup": 98.87,
|
||||
"novamox_cv_375_tab_10s": 234.08,
|
||||
"novamox_cv_457_dt_10s": 257.26,
|
||||
"novamox_cv_625_tablets_10": 148.95,
|
||||
"novamox_cv_drops": 91.43,
|
||||
"novamox_cv_dry_syrup_30_ml": 49.43,
|
||||
"novamox_cv_ds": 49.43,
|
||||
"novamox_cv_forte_syp": 184.18,
|
||||
"novamox_cv_forte_syp_60_ml": 227.76,
|
||||
"novamox_drops": 61.98,
|
||||
|
||||
|
||||
"novamox_lb_500": 186.64,
|
||||
"novamox_rdu_drops": 58.44,
|
||||
"novamox_125_dt_15s": 85.14,
|
||||
"novamox_250_15s": 29.75,
|
||||
"tedispan_200_tablets_6s": 777.90,
|
||||
"rabicip_l_capsules": 219.20,
|
||||
"rabicip_20_15s": 139.12,
|
||||
"rabicip_20_tablets_15s": 139.12,
|
||||
"rabicip_20mg_ip_1_x_15s_tablets": 139.12,
|
||||
"rabicip_d_capsules_1_x_15s": 263.05,
|
||||
|
||||
// 👉 Continue adding all products same way
|
||||
};
|
||||
|
||||
$(document).on('change', '[id$="_units"]', function () {
|
||||
|
||||
let totalValue = 0;
|
||||
let totalUnits = 0;
|
||||
|
||||
$.each(products, function (key, price) {
|
||||
|
||||
let unitField = $(`#field-${key}_units`);
|
||||
let valueField = $(`#field-${key}_value`);
|
||||
|
||||
let units = parseFloat(unitField.val()) || 0;
|
||||
let value = units * price;
|
||||
|
||||
// Set individual value
|
||||
valueField.val(value.toFixed(2));
|
||||
|
||||
totalValue += value;
|
||||
totalUnits += units;
|
||||
});
|
||||
|
||||
$('#field-total_pob_value').val(totalValue.toFixed(2));
|
||||
$('#field-total_pob_units').val(totalUnits);
|
||||
});
|
||||
|
||||
|
||||
$('#field-total_pob_value,#field-total_pob_units').attr('readonly',true);
|
||||
|
||||
$('#field-pob_type').trigger('change');
|
||||
|
||||
|
||||
|
||||
$('#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'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
$('#field-user_id').val(selected_user_id)
|
||||
$('#field-user_id').trigger("change");
|
||||
} 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 plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,324 @@
|
|||
<!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>
|
||||
@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
|
||||
<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}}">
|
||||
@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)
|
||||
<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="number"
|
||||
min="0"
|
||||
step="1"
|
||||
inputmode="numeric"
|
||||
id="field-{{$question->code}}"
|
||||
name="{{$question->code}}"
|
||||
class="form-control"
|
||||
{{$question->required == 'yes'?'required':''}}
|
||||
value="{{isset($question->value) ? $question->value : ''}}"
|
||||
>
|
||||
@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}}"
|
||||
msl_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
|
||||
</select>
|
||||
@break
|
||||
@case('radio')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-success">
|
||||
<input class="form-check-input" type="radio" name="{{$question->code}}" id="field-{{$question->code}}_{{$option->value}}" value="{{$option->value}}">
|
||||
<label class="form-check-label" for="field-{{$question->code}}_{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('radiometrix')
|
||||
@php
|
||||
// Decode the first option's value to use as heading labels
|
||||
$headings =
|
||||
count($question->options) > 0
|
||||
? json_decode($question->options[0]->value)
|
||||
: [];
|
||||
@endphp
|
||||
|
||||
{{-- Matrix Wrapper with Horizontal Scroll on Small Screens --}}
|
||||
<div class="table-responsive">
|
||||
<div class="d-table w-100">
|
||||
{{-- Table Headers --}}
|
||||
<div class="d-table-row font-weight-bold">
|
||||
<div class="d-table-cell p-2" style="width: 150px;"></div>
|
||||
{{-- Placeholder for row labels --}}
|
||||
@foreach ($headings as $head)
|
||||
<div class="d-table-cell text-center p-2">{{ $head }}
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
{{-- Table Rows --}}
|
||||
@foreach ($question->options as $option)
|
||||
@php $nn = json_decode($option->value); @endphp
|
||||
<div class="d-table-row align-middle">
|
||||
<div class="d-table-cell font-weight-bold p-2"
|
||||
style="width: 150px;">
|
||||
{{ $option->display }}
|
||||
</div>
|
||||
|
||||
@foreach ($nn as $value)
|
||||
<div class="d-table-cell text-center p-2">
|
||||
<input type="radio"
|
||||
id="field-{{ $option->display }}-{{ $value }}"
|
||||
name="{{ $question->code }}[{{$option->display}}]" value="{{$value}}" class="form-check-input"
|
||||
{{ isset($question->display) && $option->display != $option->display ? 'checked' : '' }}>
|
||||
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary ms-2">
|
||||
<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"
|
||||
accept=".jpg,.jpeg,.png,image/jpeg,image/png"
|
||||
{{$question->required == 'yes'?'required':''}}
|
||||
> @elseif(isset($question->value))
|
||||
<img src="{{$question->value}}" class="img-fluid">
|
||||
@endif
|
||||
|
||||
@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>
|
||||
@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%;
|
||||
}
|
||||
.form-label {
|
||||
font-weight:bold;
|
||||
font-size:16px;
|
||||
}
|
||||
</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));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#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) {
|
||||
|
||||
console.log("FULL DOCTOR DATA:", data);
|
||||
|
||||
/*for (let itm of data) {
|
||||
console.log("DOCTOR:", itm);
|
||||
console.log("LEGACY CODE:", itm.legacy_code);
|
||||
console.log("CONTACT:", itm.contact);
|
||||
console.log("CONTACT LEGACY CODE:", itm.contact ? itm.contact.legacy_code : 'NO CONTACT');
|
||||
}*/
|
||||
|
||||
$("#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)
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
console.log("CONTACT SELECTED:", this.value);
|
||||
$('#field-legacy_code').val($('option:selected', this).attr('msl_code'));
|
||||
});
|
||||
|
||||
$('#field-no_units_confirmed').on('input', function () {
|
||||
this.value = this.value.replace(/[^0-9]/g, '');
|
||||
});
|
||||
|
||||
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 conversionDateField = document.getElementById('field-record_date');
|
||||
|
||||
if (conversionDateField) {
|
||||
conversionDateField.setAttribute('min', '2026-07-01');
|
||||
conversionDateField.setAttribute('max', today);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,223 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "History"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
</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">
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-8 p-2">
|
||||
<h4 class="page-title">{{$formname}}</h4>
|
||||
</div>
|
||||
<div class="col-4 p-2">
|
||||
<a href="/form/downloaddata?form_id={{$form_id}}" class="btn btn-info btn-xs float-end">Download</a>
|
||||
<button type="button" id="emailme" class="btn btn-warning btn-xs float-end me-2">Email</button>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div id="notifications"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 p-0">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="responsive-table-plugin">
|
||||
<div class="table-rep-plugin">
|
||||
<div class="table-responsive" data-pattern="priority-columns">
|
||||
<table id="tech-companies-1" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-priority="1">Submission Date</th>
|
||||
<th data-priority="1" colspan="2">Submitted By</th>
|
||||
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
|
||||
<th data-priority="1">Workflow Status</th>
|
||||
@endif
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'multitextbox')
|
||||
@foreach( $question->options as $k => $v )
|
||||
@if($question->type == 'hidden')
|
||||
@continue;
|
||||
@endif
|
||||
<th data-priority="1">{{$v}} ({{$question->label}})</th>
|
||||
@endforeach
|
||||
@else
|
||||
<th data-priority="1">{{$question->label}}</th>
|
||||
@endif
|
||||
@endforeach
|
||||
<th data-priority="1">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($submissions as $submission)
|
||||
@if(isset($submission->user_info->name))
|
||||
<tr>
|
||||
<th>{{date("d M Y", strtotime($submission->createdAt))}}</th>
|
||||
<th>
|
||||
<img src="{{isset($submission->user_info->avatar) ? $submission->user_info->avatar : 'https://ui-avatars.com/api/?background=random&name='.$submission->user_info->name}}" class="rounded-circle avatar-sm" />
|
||||
</th>
|
||||
<td>
|
||||
<h5 class="m-0 fw-normal">{{$submission->user_info->name}}</h5>
|
||||
<p class="mb-0 text-muted"><small>{{$submission->user_info->designation}}</small></p>
|
||||
</td>
|
||||
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
|
||||
<td>{{ucwords($submission->workflow_status)}}</td>
|
||||
@endif
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'hidden')
|
||||
@continue;
|
||||
@endif
|
||||
@if($question->type == 'multitextbox')
|
||||
@foreach( $question->options as $k => $v )
|
||||
<td>{{ isset($submission->formdata->{$k}) ? (is_array($submission->formdata->{$k}) ? implode(', ', $submission->formdata->{$k}) : $submission->formdata->{$k}) : '' }}</td>
|
||||
@endforeach
|
||||
@elseif($question->type == 'file')
|
||||
<td><a target="_blank" href="{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}" download="{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}" class="btn btn-dark btn-xs"><i class="mdi mdi-cloud-download me-1"></i> Download</a></td>
|
||||
@else
|
||||
<td>{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}</td>
|
||||
@endif
|
||||
@endforeach
|
||||
<th>
|
||||
<a href="/form/edit?id={{$submission->id}}" class="btn btn-primary btn-xs">Edit</a>
|
||||
@if( in_array('edit', $submission->actions) && (strtotime("now") - strtotime($submission->createdAt)) < 432000 )
|
||||
|
||||
@endif
|
||||
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' && $submission->workflow_status == 'unapproved' )
|
||||
<button class="btn btn-success btn-xs btn-approve m-1" submission="{{$submission->id}}">Approve</button>
|
||||
<button class="btn btn-danger btn-xs btn-reject m-1" submission="{{$submission->id}}">Reject</button>
|
||||
@endif
|
||||
</th>
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end .table-responsive -->
|
||||
|
||||
</div> <!-- end .table-rep-plugin-->
|
||||
</div> <!-- end .responsive-table-plugin-->
|
||||
@if($lastkey)
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-info" type="button" id="load-btn"> Load More ... </button>
|
||||
</div>
|
||||
@endif
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
|
||||
</div>
|
||||
<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>
|
||||
|
||||
<!-- end page -->
|
||||
@include('layouts.shared/footer-script')
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('.btn-primary').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
})
|
||||
|
||||
$('#emailme').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/downloaddata?form_id={{$form_id}}&email=1',
|
||||
success: function( data ) {
|
||||
$('#notifications').append('<div class="alert alert-success">Email Sent Successfully</div>');
|
||||
$("#pageloader").fadeOut();
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
var lastkey = '{{$lastkey}}';
|
||||
var page = 2
|
||||
lastkey = lastkey.replace('_2', '')
|
||||
|
||||
|
||||
$('#load-btn').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
$.get( "/form/loadmore?lastkey=" + lastkey + '_' + page, function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
//lastkey = data.lastkey;
|
||||
$( "#tech-companies-1 tbody" ).append( data.html );
|
||||
if(!data.lastkey) {
|
||||
$('#load-btn').hide()
|
||||
}
|
||||
page++;
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
$('.btn-approve').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let that = $(this)
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/approvereject?action=approve&id=' + $(this).attr('submission') + '&user_id={{ $formdata->user_id ?? '' }}&partition={{ $formdata->partition ?? '' }}',
|
||||
//data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
console.log(data)
|
||||
that.parent().html('')
|
||||
},
|
||||
});
|
||||
})
|
||||
$('.btn-reject').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let that = $(this)
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/approvereject?action=reject&id=' + $(this).attr('submission') + '&user_id={{ $formdata->user_id ?? '' }}&partition={{ $formdata->partition ?? '' }}',
|
||||
//data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
console.log(data)
|
||||
that.parent().html('')
|
||||
},
|
||||
});
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => 'Workflow Approval'])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
</head>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-4 text-center">
|
||||
<h4 class="page-title text-danger">Unable to load approval page</h4>
|
||||
<p class="text-muted mb-0">{{ $message }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@include('layouts.shared/footer-script')
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,301 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
@include('layouts.shared/title-meta', ['title' => $form_name ?: 'Workflow Approval'])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<style>
|
||||
html, body.workflow-approval-body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
body.workflow-approval-body .account-pages {
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
}
|
||||
body.workflow-approval-body .account-pages > .container,
|
||||
body.workflow-approval-body .account-pages > .container > .row,
|
||||
body.workflow-approval-body .account-pages .col-lg-10 {
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
.workflow-approval-shell {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0.5rem 0.75rem 0.75rem;
|
||||
}
|
||||
.workflow-approval-shell .card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
.workflow-approval-shell .card-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 0.5rem 0.75rem !important;
|
||||
}
|
||||
.workflow-approval-header {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.workflow-approval-header .page-title {
|
||||
font-size: 1.1rem;
|
||||
margin-bottom: 0.15rem !important;
|
||||
}
|
||||
.workflow-approval-header .submitted-by {
|
||||
font-size: 0.85rem;
|
||||
margin-bottom: 0.25rem !important;
|
||||
}
|
||||
.workflow-approval-header .status-row {
|
||||
margin-bottom: 0.35rem !important;
|
||||
}
|
||||
.workflow-preview-wrap {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.workflow-preview-frame {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 4px;
|
||||
display: block;
|
||||
}
|
||||
.workflow-actions {
|
||||
flex: 0 0 auto;
|
||||
margin-top: 0.5rem;
|
||||
padding: 0.35rem 0 0;
|
||||
}
|
||||
#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>
|
||||
</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 workflow-approval-body">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-10 col-xl-9 p-0">
|
||||
<div class="workflow-approval-shell">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body">
|
||||
<div class="workflow-approval-header">
|
||||
<h4 class="page-title mb-1">{{ $form_name }}</h4>
|
||||
@if(!empty($submitted_by))
|
||||
<p class="text-muted submitted-by mb-1">Submitted by: {{ $submitted_by }}</p>
|
||||
@endif
|
||||
<p class="status-row mb-0">
|
||||
<span id="workflow-status-badge" class="badge bg-secondary text-uppercase">{{ $workflow_status }}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="workflow-preview-wrap">
|
||||
<iframe
|
||||
class="workflow-preview-frame"
|
||||
src="{{ $preview_url }}"
|
||||
title="Form preview"
|
||||
frameborder="0"
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
<div class="workflow-actions text-center" id="workflow-actions">
|
||||
@if($actions_disabled)
|
||||
<p class="text-muted mb-0 small">{{ $status_message ?? 'This submission has already been ' . $workflow_status . '.' }}</p>
|
||||
@else
|
||||
<button type="button" class="btn btn-success me-2" id="btn-approve">Approve</button>
|
||||
<button type="button" class="btn btn-danger" id="btn-reject">Reject</button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script>
|
||||
const approvalParams = {
|
||||
submission_id: @json($submission_id),
|
||||
user_id: @json($user_id),
|
||||
form_id: @json($form_id),
|
||||
partition: @json($partition),
|
||||
entity_id: @json($entity_id),
|
||||
form_name: @json($form_name),
|
||||
};
|
||||
|
||||
function hidePageLoader() {
|
||||
$("#pageloader").fadeOut();
|
||||
$("body").removeClass("loading");
|
||||
}
|
||||
|
||||
function resizeWorkflowPreview() {
|
||||
var $shell = $('.workflow-approval-shell');
|
||||
var $header = $('.workflow-approval-header');
|
||||
var $actions = $('.workflow-actions');
|
||||
var $wrap = $('.workflow-preview-wrap');
|
||||
var $frame = $('.workflow-preview-frame');
|
||||
if (!$shell.length || !$wrap.length) {
|
||||
return;
|
||||
}
|
||||
var shellTop = $shell[0].getBoundingClientRect().top;
|
||||
var actionsH = $actions.outerHeight(true) || 0;
|
||||
var headerH = $header.outerHeight(true) || 0;
|
||||
var pad = 12;
|
||||
var available = window.innerHeight - shellTop - headerH - actionsH - pad;
|
||||
if (available < 120) {
|
||||
available = 120;
|
||||
}
|
||||
$wrap.height(available);
|
||||
$frame.height(available);
|
||||
}
|
||||
|
||||
function postApprovalAction(action, reason) {
|
||||
$("#pageloader").fadeIn();
|
||||
const payload = Object.assign({}, approvalParams, {
|
||||
action: action,
|
||||
_token: $('meta[name="csrf-token"]').attr('content'),
|
||||
});
|
||||
if (reason) {
|
||||
payload.reason = reason;
|
||||
}
|
||||
return $.ajax({
|
||||
url: '/form/workflow-approval/action',
|
||||
type: 'POST',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content'),
|
||||
},
|
||||
data: payload,
|
||||
}).always(function() {
|
||||
hidePageLoader();
|
||||
});
|
||||
}
|
||||
|
||||
function showActionCompletedUI(res, action) {
|
||||
var label = (res && res.status_label) ? res.status_label : (action === 'approve' ? 'approved' : 'rejected');
|
||||
var message = (res && res.status_message) ? res.status_message : (res && res.message ? res.message : 'Action completed successfully.');
|
||||
var $badge = $('#workflow-status-badge');
|
||||
$badge.removeClass('bg-secondary bg-success bg-danger');
|
||||
if (label === 'approved') {
|
||||
$badge.addClass('bg-success');
|
||||
} else if (label === 'rejected') {
|
||||
$badge.addClass('bg-danger');
|
||||
} else {
|
||||
$badge.addClass('bg-secondary');
|
||||
}
|
||||
$badge.text(label);
|
||||
$('#workflow-actions').empty().append(
|
||||
$('<p class="text-muted mb-0 small"></p>').text(message)
|
||||
);
|
||||
resizeWorkflowPreview();
|
||||
}
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
hidePageLoader();
|
||||
resizeWorkflowPreview();
|
||||
$(window).on('resize orientationchange', resizeWorkflowPreview);
|
||||
|
||||
var $previewFrame = $('.workflow-preview-frame');
|
||||
$previewFrame.on('load', function() {
|
||||
hidePageLoader();
|
||||
resizeWorkflowPreview();
|
||||
});
|
||||
if ($previewFrame[0] && $previewFrame[0].complete) {
|
||||
hidePageLoader();
|
||||
}
|
||||
|
||||
$('#btn-approve').on('click', function() {
|
||||
Swal.fire({
|
||||
title: 'Approve submission?',
|
||||
text: 'Are you sure you want to approve this submission?',
|
||||
icon: 'question',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#28a745',
|
||||
cancelButtonColor: '#6c757d',
|
||||
confirmButtonText: 'Yes, approve'
|
||||
}).then(function(result) {
|
||||
if (!result.isConfirmed) {
|
||||
return;
|
||||
}
|
||||
postApprovalAction('approve').done(function(res) {
|
||||
if (res.status === 'success') {
|
||||
showActionCompletedUI(res, 'approve');
|
||||
Swal.fire('Approved', res.message, 'success');
|
||||
} else {
|
||||
Swal.fire('Error', res.message || 'Could not approve submission.', 'error');
|
||||
}
|
||||
}).fail(function(xhr) {
|
||||
Swal.fire('Error', xhr.responseJSON?.message || 'Could not approve submission.', 'error');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#btn-reject').on('click', function() {
|
||||
Swal.fire({
|
||||
title: 'Reject submission',
|
||||
input: 'textarea',
|
||||
inputLabel: 'Reason for rejection',
|
||||
inputPlaceholder: 'Enter reason...',
|
||||
inputAttributes: { 'aria-label': 'Reason for rejection' },
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#dc3545',
|
||||
cancelButtonColor: '#6c757d',
|
||||
confirmButtonText: 'Reject',
|
||||
inputValidator: function(value) {
|
||||
if (!value || !value.trim()) {
|
||||
return 'Reject reason is required';
|
||||
}
|
||||
}
|
||||
}).then(function(result) {
|
||||
if (!result.isConfirmed) {
|
||||
return;
|
||||
}
|
||||
postApprovalAction('reject', result.value.trim()).done(function(res) {
|
||||
if (res.status === 'success') {
|
||||
showActionCompletedUI(res, 'reject');
|
||||
Swal.fire('Rejected', res.message, 'success');
|
||||
} else {
|
||||
Swal.fire('Error', res.message || 'Could not reject submission.', 'error');
|
||||
}
|
||||
}).fail(function(xhr) {
|
||||
Swal.fire('Error', xhr.responseJSON?.message || 'Could not reject submission.', 'error');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -32,6 +32,34 @@
|
|||
color: #2b2b2b;
|
||||
pointer-events: none;
|
||||
}
|
||||
.mlb-toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
margin: 0 0 16px;
|
||||
}
|
||||
.mlb-toolbar .mlb-pills {
|
||||
margin: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.mlb-period {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 220px;
|
||||
}
|
||||
.mlb-period label {
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
color: #6f6f6f;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.mlb-period select {
|
||||
min-width: 180px;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
|
|
@ -58,12 +86,28 @@
|
|||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@if(!empty($pills))
|
||||
<div class="mlb-pills">
|
||||
@foreach($pills as $pill)
|
||||
<a class="mlb-pill {{ !empty($pill['active']) ? 'is-active' : '' }}"
|
||||
href="{{ $pill['url'] }}">{{ $pill['label'] }}</a>
|
||||
@endforeach
|
||||
@if(!empty($pills) || !empty($periods))
|
||||
<div class="mlb-toolbar">
|
||||
@if(!empty($pills))
|
||||
<div class="mlb-pills">
|
||||
@foreach($pills as $pill)
|
||||
<a class="mlb-pill {{ !empty($pill['active']) ? 'is-active' : '' }}"
|
||||
href="{{ $pill['url'] }}">{{ $pill['label'] }}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
<div></div>
|
||||
@endif
|
||||
@if(!empty($periods))
|
||||
<div class="mlb-period">
|
||||
<label for="period">Period</label>
|
||||
<select class="form-control form-control-sm" id="period" name="period">
|
||||
@foreach($periods as $period)
|
||||
<option value="{{ $period->value }}" {{ (string) ($selected_period ?? '') === (string) $period->value ? 'selected' : '' }}>{{ $period->label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@if(session('error'))
|
||||
|
|
@ -123,3 +167,15 @@
|
|||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#period').on('change', function(){
|
||||
let href = new URL(window.location.href);
|
||||
href.searchParams.set('period', $(this).val());
|
||||
window.location.href = href.toString();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
|
|||
Loading…
Reference in New Issue