Rapport-Laravel/resources/views/form/rapport-pulmocare/1741587146-37fc29e4-8f4f-41...

458 lines
30 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
@include('layouts.shared/title-meta', ['title' => "Form"])
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
</head>
<div id="pageloader">
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
</div>
<body class="loading">
<div class="account-pages">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
<div class="card bg-patter" style="background:linear-gradient(125deg,rgba(111, 198, 235, 0.38) 0%, rgba(66, 70, 157, 0.25) 100%);">
<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="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
@break
@case('textarea')
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
@break
@case('dropdown')
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
<option value=""> -- Select -- </option>
@foreach($question->options as $option)
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
@endforeach
</select>
@break
@case('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('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
<div id="errorMessage1"></div>
<div id="errorMessage2"></div>
<div id="errorMessage3"></div>
<div id="errormessage4"></div>
<div id="errorMessage5"></div>
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="text-center d-grid mt-3">
<button class="btn btn-primary btn-orange" 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-size:14px;
}
.field-group-title{
color:#c37736;
font-size:15px;
background: #fff3e8;
padding: 10px 10px 10px;
border-radius: 4px;
margin-bottom:20px;
}
.field-group-title i{
color:#c37736;
}
.btn-primary.btn-orange {
color: #fff;
background-color: #d7a06d;
border-color: #c49060;
}
</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)
})
//$('label[for="field-select_coachee_role"]').html("<h3 style='color:blue;font-size:15px'>Coach & Coachee Details</h3><p style='font-size:14px'>Name of the Coach <span style='color:red'>*</span></p>");
$('label[for="field-key_goals_set_by_coach_and_coachee"]').addClass('w-100').html("<h3 class='field-group-title' ><i class='mdi mdi-apple-keyboard-command me-1'></i> Goals</h3><div style='font-size:14px'>Key Goals set by Coach & Coachee <span style='color:red'>*</span></div>");
$('label[for="field-action_plan"]').addClass('w-100').html("<h3 class='field-group-title' ><i class='mdi mdi-apple-keyboard-command me-1'></i> Goal linked Action Plan</h3><div style='font-size:14px'>Action Plan <span style='color:red'>*</span></div>");
$('label[for="field-enter_question1"]').addClass('w-100').html("<h3 class='field-group-title'><i class='mdi mdi-apple-keyboard-command me-1'></i> Coaching Discussion Summary</h3><div style='font-size:14px'>Enter Question1 <span style='color:red'>*</span></div>");
$('label[for="field-adherance_to_action_plan"]').addClass('w-100').html("<h3 class='field-group-title'><i class='mdi mdi-apple-keyboard-command me-1'></i> Progress Observed</h3><div style='font-size:14px'>Adherance to Action Plan <span style='color:red'>*</span></div>");
$('#field-other_action_plan_for_sbm').parent().hide();
$('#field-other_action_plan_for_sbm').prop({"required":false});
$('#field-other_action_plan_for_rbm').parent().hide();
$('#field-other_action_plan_for_rbm').prop({"required":false});
$('#field-select_coachee_role').on('change',function(){
var dropDown=$('#field-select_coachee_role').val();
console.log("dropDown is : ",dropDown);
if(dropDown==='SBM' ||dropDown==='ME'){
$('#field-key_goals_set_by_coach_and_coachee option[value="tour_plan_adherence"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="mcl_coverage_and_visit_frequency"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="activations"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="tab_detailing"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="new_prescriber_addition"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="tour_plan_adherence_of_self_and_team"]').hide();
$('#field-key_goals_set_by_coach_and_coachee option[value="business_performance"]').hide();
$('#field-key_goals_set_by_coach_and_coachee option[value="mandate_brand_performance"]').hide();
$('#field-key_goals_set_by_coach_and_coachee option[value="ni_brand_performance"]').hide();
$('#field-key_goals_set_by_coach_and_coachee option[value="stretch_working"]').hide();
$('#field-key_goals_set_by_coach_and_coachee option[value="critical_geography_working"]').hide();
$('#field-key_goals_set_by_coach_and_coachee option[value="sponsored_doctor_coverage"]').hide();
$('#field-key_goals_set_by_coach_and_coachee option[value="sponsored_doctor_business"]').hide();
}
else if(dropDown==='RM'){
$('#field-key_goals_set_by_coach_and_coachee option[value="tour_plan_adherence"]').hide();
$('#field-key_goals_set_by_coach_and_coachee option[value="mcl_coverage_and_visit_frequency"]').hide();
$('#field-key_goals_set_by_coach_and_coachee option[value="activations"]').hide();
$('#field-key_goals_set_by_coach_and_coachee option[value="tab_detailing"]').hide();
$('#field-key_goals_set_by_coach_and_coachee option[value="new_prescriber_addition"]').hide();
$('#field-key_goals_set_by_coach_and_coachee option[value="tour_plan_adherence_of_self_and_team"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="business_performance"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="mandate_brand_performance"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="ni_brand_performance"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="stretch_working"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="critical_geography_working"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="sponsored_doctor_coverage"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="sponsored_doctor_business"]').show();
}
else{
$('#field-key_goals_set_by_coach_and_coachee option[value="tour_plan_adherence"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="mcl_coverage_and_visit_frequency"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="activations"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="tab_detailing"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="new_prescriber_addition"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="tour_plan_adherence_of_self_and_team"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="business_performance"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="mandate_brand_performance"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="ni_brand_performance"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="stretch_working"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="critical_geography_working"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="sponsored_doctor_coverage"]').show();
$('#field-key_goals_set_by_coach_and_coachee option[value="sponsored_doctor_business"]').show();
}
})
$('#field-select_coachee_role').on('change',function(){
var dropDown=$('#field-select_coachee_role').val();
console.log("dropDown is : ",dropDown);
if(dropDown==='SBM'|| dropDown==='ME'){
$('#field-action_plan option[value="100_adherence_in_tour_plan"]').show();
$('#field-action_plan option[value="95_mcl_coverage_visit_frequency_90_5_non_visited_doctors"]').show();
$('#field-action_plan option[value="1_camp_and_4_clinics"]').show();
$('#field-action_plan option[value="tab_detailing_in_doctor_calls"]').show();
$('#field-action_plan option[value="new_conversions"]').show();
$('#field-action_plan option[value="mcl_productivity"]').show();
$('#field-action_plan option[value="others_mention_if_any"]').show();
$('#field-action_plan option[value="tour_plan_adherence_of_team"]').hide();
$('#field-action_plan option[value="100_spread_of_performance"]').hide();
$('#field-action_plan option[value="100_rm_region_target_achievement"]').hide();
$('#field-action_plan option[value="sop_at_mandate_brand_performance"]').hide();
$('#field-action_plan option[value="rm_mandate_target_achievement"]').hide();
$('#field-action_plan option[value="sop_at_ni_brand_performance"]').hide();
$('#field-action_plan option[value="rm_ni_target_achievement"]').hide();
$('#field-action_plan option[value="stretch_working_with_sbms"]').hide();
$('#field-action_plan option[value="critical_geography_time_allocation"]').hide();
$('#field-action_plan option[value="critical_geography_revival"]').hide();
$('#field-action_plan option[value="covering_all_sponsored_doctors"]').hide();
$('#field-action_plan option[value="ensuring_equal_spread_at_all_doctors"]').hide();
$('#field-action_plan option[value="ensuring_15_times_roi_from_sponsored_doctors"]').hide();
$('#field-action_plan option[value="others"]').hide();
}
else if(dropDown==='RM'){
$('#field-action_plan option[value="100_adherence_in_tour_plan"]').hide();
$('#field-action_plan option[value="95_mcl_coverage_visit_frequency_90_5_non_visited_doctors"]').hide();
$('#field-action_plan option[value="1_camp_and_4_clinics"]').hide();
$('#field-action_plan option[value="tab_detailing_in_doctor_calls"]').hide();
$('#field-action_plan option[value="new_conversions"]').hide();
$('#field-action_plan option[value="mcl_productivity"]').hide();
$('#field-action_plan option[value="others_mention_if_any"]').hide();
$('#field-action_plan option[value="tour_plan_adherence_of_team"]').show();
$('#field-action_plan option[value="100_spread_of_performance"]').show();
$('#field-action_plan option[value="100_rm_region_target_achievement"]').show();
$('#field-action_plan option[value="sop_at_mandate_brand_performance"]').show();
$('#field-action_plan option[value="rm_mandate_target_achievement"]').show();
$('#field-action_plan option[value="sop_at_ni_brand_performance"]').show();
$('#field-action_plan option[value="rm_ni_target_achievement"]').show();
$('#field-action_plan option[value="stretch_working_with_sbms"]').show();
$('#field-action_plan option[value="critical_geography_time_allocation"]').show();
$('#field-action_plan option[value="critical_geography_revival"]').show();
$('#field-action_plan option[value="covering_all_sponsored_doctors"]').show();
$('#field-action_plan option[value="ensuring_equal_spread_at_all_doctors"]').show();
$('#field-action_plan option[value="ensuring_15_times_roi_from_sponsored_doctors"]').show();
$('#field-action_plan option[value="others"]').show();
}
else{
$('#field-action_plan option[value="100_adherence_in_tour_plan"]').show();
$('#field-action_plan option[value="95_mcl_coverage_visit_frequency_90_5_non_visited_doctors"]').show();
$('#field-action_plan option[value="1_camp_and_4_clinics"]').show();
$('#field-action_plan option[value="tab_detailing_in_doctor_calls"]').show();
$('#field-action_plan option[value="new_conversions"]').show();
$('#field-action_plan option[value="mcl_productivity"]').show();
$('#field-action_plan option[value="others_mention_if_any"]').show();
$('#field-action_plan option[value="tour_plan_adherence_of_team"]').show();
$('#field-action_plan option[value="100_spread_of_performance"]').show();
$('#field-action_plan option[value="100_rm_region_target_achievement"]').show();
$('#field-action_plan option[value="sop_at_mandate_brand_performance"]').show();
$('#field-action_plan option[value="rm_mandate_target_achievement"]').show();
$('#field-action_plan option[value="sop_at_ni_brand_performance"]').show();
$('#field-action_plan option[value="rm_ni_target_achievement"]').show();
$('#field-action_plan option[value="stretch_working_with_sbms"]').show();
$('#field-action_plan option[value="critical_geography_time_allocation"]').show();
$('#field-action_plan option[value="critical_geography_revival"]').show();
$('#field-action_plan option[value="covering_all_sponsored_doctors"]').show();
$('#field-action_plan option[value="ensuring_equal_spread_at_all_doctors"]').show();
$('#field-action_plan option[value="ensuring_15_times_roi_from_sponsored_doctors"]').show();
$('#field-action_plan option[value="others"]').show();
}
})
$('#field-action_plan').on('change',function(){
var dropDown=$('#field-action_plan').val();
if(dropDown==='others_mention_if_any'){
$('#field-other_action_plan_for_sbm').parent().show();
$('#field-other_action_plan_for_sbm').prop({"required":true});
}
else if(dropDown==='others'){
$('#field-other_action_plan_for_rbm').parent().show();
$('#field-other_action_plan_for_rbm').prop({"required":true});
}
else{
$('#field-other_action_plan_for_sbm').parent().hide();
$('#field-other_action_plan_for_sbm').prop({"required":false});
$('#field-other_action_plan_for_rbm').parent().hide();
$('#field-other_action_plan_for_rbm').prop({"required":false});
}
})
$('#report-form').on('submit', function(event){
event.preventDefault();
let ans1=document.getElementById('field-enter_answer_1').value;
if(ans1.length>250){
$('#errorMessage1').html('<p style="color:red;text-align:center">*Please enter answer upto 250 remarks </p>');
return;
}
else{
$('#errorMessage1').html('');
}
let ans2=document.getElementById('field-enter_answer_2').value;
if(ans2.length>250){
$('#errorMessage2').html('<p style="color:red;text-align:center">*Please enter answer upto 250 remarks </p>');
return;
}
else{
$('#errorMessage2').html('');
}
let ans3=document.getElementById('field-enter_answer_3').value;
if(ans3.length>250){
$('#errorMessage3').html('<p style="color:red;text-align:center">*Please enter answer upto 250 remarks </p>');
return;
}
else{
$('#errorMessage3').html('');
}
// let ans4=document.getElementById('field-enter_answer_4').value;
// if(ans4.length>250){
// $('#errorMessage4').html('<p style="color:red;text-align:center">*Please enter answer upto 250 remarks </p>');
// return;
// }
// else{
// $('#errorMessage4').html('');
// }
let feedback=document.getElementById('field-feedback_shared_by_coach').value;
if(feedback.length>250){
$('#errorMessage5').html('<p style="color:red;text-align:center">*Please enter feedback upto 250 remarks </p>');
return;
}
else{
$('#errorMessage5').html('');
}
$("#pageloader").fadeIn();
$('#report-form').append('<input type="hidden" name="'+ $('#field-key_goals_set_by_coach_and_coachee').val() +'" value="1">')
$('#report-form').append('<input type="hidden" name="'+ $('#field-action_plan').val() +'" value="1">');
$('#report-form').append('<input type="hidden" name="'+ $('#field-timeline_agreed_for_selected_action_plans_completion').val() +'" value="1">');
$('#report-form').append('<input type="hidden" name="'+ $('#field-conversation_duration').val() +'" value="1">');
$('#report-form').append('<input type="hidden" name="'+ $('#field-adherance_to_action_plan').val() +'" value="1">');
$.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");
} 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!'
})
}
},
});
});
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>