594 lines
44 KiB
PHP
594 lines
44 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" />
|
|
<link href="{{asset('assets/libs/select2/select2.min.css')}}" rel="stylesheet" type="text/css" />
|
|
<style>
|
|
.quick-action-form-card .form-control {
|
|
font-size: 16px;
|
|
}
|
|
.custom-accordion-outer > .card {
|
|
border: 1px solid #d9d9d9;
|
|
}
|
|
.custom-accordion-outer .card-header {
|
|
/* padding: 1rem 1.5rem; */
|
|
margin-bottom: 0;
|
|
/* background-color: #edeff1; */
|
|
/* border-bottom: 0 solid #f7f7f7; */
|
|
padding: 0;
|
|
}
|
|
.custom-accordion-outer > .card > .card-header {
|
|
background-color: transparent;
|
|
}
|
|
/* .custom-accordion-outer > .card > .collapse > .card-body {
|
|
padding-top: 0.5rem;
|
|
} */
|
|
|
|
.card-header:first-child {
|
|
border-radius: 0.25rem 0.25rem 0 0;
|
|
}
|
|
.custom-accordion-outer .card-header a {
|
|
padding: 1rem 1rem;
|
|
color: var(--bs-primary);
|
|
background-color: transparent;
|
|
display: flex;
|
|
}
|
|
|
|
.custom-accordion.custom-accordion-inner .accordion-arrow {
|
|
font-size: 1.2rem;
|
|
position: absolute;
|
|
right: 0.5rem;
|
|
line-height: 1;
|
|
}
|
|
.custom-accordion.custom-accordion-inner .card {
|
|
box-shadow: 0 0.75rem 6rem rgba(56, 65, 74, 0.05);
|
|
background-color: #f0f6fb;
|
|
}
|
|
|
|
.custom-accordion.custom-accordion-inner .card-header a {
|
|
background-color: #e5eef7;
|
|
color: var(--bs-secondary);
|
|
border-radius: 0.25rem;
|
|
font-size: 0.9rem;
|
|
|
|
}
|
|
/* .custom-accordion.custom-accordion-inner .collapse .card-body {
|
|
} */
|
|
|
|
|
|
</style>
|
|
</head>
|
|
<div id="pageloader">
|
|
Loading
|
|
</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 quick-action-form-card">
|
|
<div class="card-body p-3 row">
|
|
|
|
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
|
<br>@endif
|
|
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
|
</div>
|
|
<br>@endif
|
|
<div class="col-8">
|
|
<h4 class="page-title">{{$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="{{$id?'edit-':''}}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
|
|
@if($id)
|
|
<input type="hidden" name="id" value="{{$id}}">
|
|
@foreach($questions as $question)
|
|
@if($question->code == 'company_name')
|
|
@continue;
|
|
@endif
|
|
<div class="col-md-12 mb-2">
|
|
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
|
@switch($question->type)
|
|
@case('hidden')
|
|
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
|
@break
|
|
@case('text')
|
|
@case('email')
|
|
@case('tel')
|
|
@case('date')
|
|
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
|
@break
|
|
@case('number')
|
|
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
|
@break
|
|
@case('textarea')
|
|
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
|
@break
|
|
@case('dropdown')
|
|
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
|
<option value=""> -- Select -- </option>
|
|
@foreach($question->options as $option)
|
|
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
|
@endforeach
|
|
</select>
|
|
@break
|
|
@case('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
|
|
@else
|
|
@php
|
|
$schema = ['brand' => ['brand_field' => 'brand_name', 'brand_qty_field' => 'qty_cipla_brand' ],
|
|
'competitor' => ['brand_field' => 'brand_name', 'brand_company' => 'company_name', 'brand_qty_field' => 'qty_cipla_brand', 'competitor_field' => 'competitor_brand', 'competitor_qty_field' => 'qty_of_competitor_brand', 'competitor_value_field' => 'net_value', 'scheme' => 'scheme' ]
|
|
];
|
|
|
|
$brands = [
|
|
['name' => 'BUDECORT', 'competitors' => ['BUDASURE','BUDATE','BUDAWAYS','BUDAZA','BUDEFEX','BUDEJOY','BUDEMAC','BUDEMED','BUDESTE','BUDEVENT','BUDEVIN','BUDOHALE','BUDOJET','BUNASE','DERINIDE','DERIVENT-B','IBINIDE R','NEBZMART-B'], 'competitor_company' => ['Zydus Cadila', 'Sun Pharma', 'Lupin', 'Torrent', 'FDC', 'Glenmark', 'Macleods', 'Dr. Reddy\'s', 'Intas', 'Cipla', 'Alkem', 'Mylan', 'AstraZeneca', 'Cipla', 'Cipla', 'Lupin', 'Indoco Remedies', 'Micro Labs']],
|
|
['name' => 'DUOLIN', 'competitors' => ['ASTHACARE','COMBIMIST LD','COMBIMIST-L','DUOHALE','DUOJET','DUORES','DUOZ','DUTARESP','IBIRES I','IPRADIN LS','IPRALUNGS','IPRAMOL','IPRASURE','IPRAZEST','NEBZMART IL','SALBAIR-I','SALVENT-IT','SPIROVENT I'], 'competitor_company' => ['Akums Drugs', 'Lupin', 'Lupin', 'Sun Pharma', 'Glenmark', 'Intas', 'Zydus Cadila', 'Dr. Reddy\'s', 'Indoco Remedies', 'Lupin', 'Lupin', 'Mylan', 'Sun Pharma', 'Intas', 'Micro Labs', 'Cipla', 'Intas', 'Alkem'] ],
|
|
['name' => 'FORACORT', 'competitors' => ['BUDAMATE','BUDESTE F','BUDETROL','FORARESP','FORMONIDE','NEBZMART-FB','PULMOSMART','SPIROFORM B','SPOOK FB','UNIPUFF FB'], 'competitor_company' => ['Lupin', 'Intas', 'Dr. Reddy\'s', 'Sun Pharma', 'Cipla', 'Micro Labs', 'Macleods', 'Alkem', 'Lupin', 'Glenmark'] ],
|
|
['name' => 'LEVOLIN', 'competitors' => ['LEORESP','SALBAIR NEB','SOMAVENT LS'], 'competitor_company' => ['Lupin', 'Cipla', 'Sun Pharma']],
|
|
['name' => 'GLYCOHALE', 'competitors' => ['AIRZ','GLYCOFLO NEB','GLYCOQUIC','GLYCORESP','GLYNIUM','NEBZMART-G','NEXSTEP-G'], 'competitor_company' => ['Cipla', 'Lupin', 'Sun Pharma', 'Glenmark', 'Intas', 'Micro Labs', 'Alkem']],
|
|
['name' => 'HYPERNEB', 'competitors' => ['CLEARNEB'], 'competitor_company' => ['Sun Pharma']],
|
|
['name' => 'BUDESAL', 'competitors' => ['BUDAZA L','BUDESTE-L','BUNASE-L','DERISAL','NEBULAIR','NEBZMART BL','NEBZMART-BL'], 'competitor_company' => ['Torrent', 'Intas', 'Cipla', 'Lupin', 'Mylan', 'Micro Labs', 'Micro Labs'] ],
|
|
['name' => 'TOBAMIST', 'competitors' => ['TOBARESP','TOBIHALE'], 'competitor_company' => ['Lupin', 'Intas']]
|
|
];
|
|
|
|
$fields = array_values(array_merge($schema['brand'], $schema['competitor']));
|
|
$field_questions = [];
|
|
@endphp
|
|
|
|
|
|
@foreach($questions as $question)
|
|
@if(in_array($question->code, $fields))
|
|
@php
|
|
$field_questions[$question->code] = $question;
|
|
@endphp
|
|
@continue;
|
|
@endif
|
|
<div class="col-md-12 mb-2">
|
|
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
|
@switch($question->type)
|
|
@case('hidden')
|
|
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
|
@break
|
|
@case('text')
|
|
@case('email')
|
|
@case('tel')
|
|
@case('date')
|
|
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
|
@break
|
|
@case('number')
|
|
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
|
@break
|
|
@case('textarea')
|
|
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
|
@break
|
|
@case('dropdown')
|
|
<select class="form-control {{$question->code=='speciality' ? 'select2-multiple':''}}" {!!$question->code=='speciality' ? 'data-toggle="select2" multiple="multiple"':''!!} id="field-{{$question->code}}" name="{{$question->code}}{{$question->code=='speciality' ? '[]':''}}" {{$question->required == 'yes'?'required':'' }}>
|
|
<option value=""> -- Select -- </option>
|
|
@foreach($question->options as $option)
|
|
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
|
@endforeach
|
|
</select>
|
|
@break
|
|
@case('checkbox')
|
|
@foreach($question->options as $option)
|
|
<div class="form-check mb-2 form-check-primary">
|
|
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
|
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
|
</div>
|
|
@endforeach
|
|
@break
|
|
@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 class="col-12">
|
|
<label class="form-label">All Brands:</label>
|
|
<div id="accordion" class="mb-3 custom-accordion-outer">
|
|
@foreach($brands as $i => $brand)
|
|
<div class="card mb-1">
|
|
<div class="card-header" id="heading-{{$i}}">
|
|
<h5 class="m-0">
|
|
<a class="text-dar" data-bs-toggle="collapse" href="#collapse-{{$i}}" aria-expanded="true">
|
|
<!-- <i class="mdi mdi-hexagon-multiple me-1 text-primary"></i> -->
|
|
<i class="mdi mdi-apple-keyboard-command text-primary me-1"></i>
|
|
{{$brand['name']}}
|
|
</a>
|
|
</h5>
|
|
</div>
|
|
|
|
<div id="collapse-{{$i}}" class="collapse" aria-labelledby="heading-{{$i}}" data-bs-parent="#accordion">
|
|
<div class="card-body pt-1">
|
|
<div class="accordion custom-accordion custom-accordion-inner" id="custom-accordion-{{$i}}">
|
|
<div class="row">
|
|
@foreach($schema['brand'] as $k => $v)
|
|
@php
|
|
$question = $field_questions[$v];
|
|
if($k == 'brand_field'){
|
|
$question->type = 'hidden';
|
|
$question->value = $brand['name'];
|
|
}
|
|
if($k == 'brand_qty_field'){
|
|
$question->type = 'number';
|
|
$question->value = 0;
|
|
}
|
|
@endphp
|
|
@if($question->type!='hidden')<div class="col-12"><label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>@endif
|
|
@switch($question->type)
|
|
@case('hidden')
|
|
<input type="{{$question->type}}" name="brand_{{$question->code}}[]" value="{{isset($question->value)?$question->value:''}}">
|
|
@break
|
|
@case('text')
|
|
@case('email')
|
|
@case('tel')
|
|
@case('date')
|
|
<input type="{{$question->type}}" name="brand_{{$question->code}}[]" class="form-control brand_{{$question->code}}" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
|
@break
|
|
@case('number')
|
|
<input type="{{$question->type}}" min="0" max="9999999999" step="1" name="brand_{{$question->code}}[]" class="form-control brand_{{$question->code}}" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
|
@break
|
|
@endswitch
|
|
@if($question->type!='hidden')</div>@endif
|
|
@endforeach
|
|
</div>
|
|
<label class="form-label mt-2 mb-0">Competitor Brands:</label>
|
|
@foreach($brand['competitors'] as $j => $competitor)
|
|
|
|
<div class="card mb-1 mt-2">
|
|
<div class="card-header" id="heading-{{$i}}-{{$j}}">
|
|
<h5 class="m-0 position-relative">
|
|
<a class="custom-accordion-title text-reset d-block" data-bs-toggle="collapse" href="#collapse-{{$i}}-{{$j}}" aria-expanded="true" aria-controls="collapse-{{$i}}-{{$j}}">
|
|
{{$competitor}} <i class="mdi mdi-chevron-down accordion-arrow"></i>
|
|
</a>
|
|
</h5>
|
|
</div>
|
|
<div id="collapse-{{$i}}-{{$j}}" class="collapse" aria-labelledby="heading-{{$i}}-{{$j}}" data-bs-parent="#custom-accordion-{{$i}}">
|
|
<div class="card-body">
|
|
<div class="row">
|
|
@foreach($schema['competitor'] as $k => $v)
|
|
@php
|
|
$question = $field_questions[$v];
|
|
if($k == 'competitor_field'){
|
|
$question->type = 'hidden';
|
|
$question->value = $competitor;
|
|
}
|
|
if($k == 'brand_qty_field'){
|
|
$question->type = 'hidden';
|
|
$question->value = 0;
|
|
}
|
|
|
|
if($k == 'brand_field'){
|
|
$question->type = 'hidden';
|
|
$question->value = $brand['name'];
|
|
}
|
|
if($k == 'brand_company'){
|
|
$question->type = 'hidden';
|
|
$question->value = $brand['competitor_company'][$j];
|
|
}
|
|
@endphp
|
|
@if($question->type!='hidden')<div class="col-6"><label for="field-{{$question->code}}" class="form-label mt-1">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>@endif
|
|
@switch($question->type)
|
|
@case('hidden')
|
|
<input type="{{$question->type}}" class="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}}" name="{{$question->code}}[]" class="form-control field_{{$question->code}}" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
|
@break
|
|
@case('number')
|
|
<input type="{{$question->type}}" min="0" max="9999999999" step="1" name="{{$question->code}}[]" class="form-control field_{{$question->code}}" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
|
@break
|
|
@endswitch
|
|
@if($question->type!='hidden')</div>@endif
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
<div class="card mb-1 mt-2">
|
|
<div class="card-header" id="heading-{{$i}}-others">
|
|
<h5 class="m-0 position-relative">
|
|
<a class="custom-accordion-title text-reset d-block" data-bs-toggle="collapse" href="#collapse-{{$i}}-others" aria-expanded="true" aria-controls="collapse-{{$i}}-others">
|
|
Other <i class="mdi mdi-chevron-down accordion-arrow"></i>
|
|
</a>
|
|
</h5>
|
|
</div>
|
|
<div id="collapse-{{$i}}-others" class="collapse" aria-labelledby="heading-{{$i}}-others" data-bs-parent="#custom-accordion-others">
|
|
<div class="card-body">
|
|
<div class="row">
|
|
@foreach($schema['competitor'] as $k => $v)
|
|
@php
|
|
$question = $field_questions[$v];
|
|
if(in_array($question->code, ['company_name', 'competitor_brand'])) {
|
|
$question->type = 'text';
|
|
$question->value = '';
|
|
}
|
|
@endphp
|
|
@if($question->type!='hidden')<div class="col-6"><label for="field-{{$question->code}}" class="form-label mt-1">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>@endif
|
|
@switch($question->type)
|
|
@case('hidden')
|
|
@case('text')
|
|
@case('email')
|
|
@case('tel')
|
|
@case('date')
|
|
<input type="{{$question->type}}" name="{{$question->code}}[]" class="form-control field_{{$question->code}}" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
|
@break
|
|
@case('number')
|
|
<input type="{{$question->type}}" min="0" max="9999999999" step="1" name="{{$question->code}}[]" class="form-control field_{{$question->code}}" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
|
@break
|
|
@case('textarea')
|
|
<textarea name="{{$question->code}}[]" class="form-control field_{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
|
@break
|
|
@case('dropdown')
|
|
<select class="form-control 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
|
|
@endswitch
|
|
@if($question->type!='hidden')</div>@endif
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div> <!-- end #accordions-->
|
|
|
|
</div>
|
|
@endif
|
|
|
|
@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();
|
|
$('#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)
|
|
})
|
|
|
|
$('.brand_qty_cipla_brand').change(function(){
|
|
let vall = $(this).val()
|
|
$(this).parent().parent().parent().find('.field_qty_cipla_brand').each(function(){
|
|
console.log($(this).html())
|
|
$(this).val(vall)
|
|
})
|
|
})
|
|
|
|
|
|
$('#report-form').on('submit', function(event){
|
|
event.preventDefault();
|
|
|
|
let cansubmit = true
|
|
let cipla_brand_missing = [];
|
|
|
|
$('.brand_qty_cipla_brand').each(function(){
|
|
if(parseInt($(this).val()) > 0) {
|
|
let brand_status = false
|
|
$(this).parent().parent().parent().find('.card').each(function(){
|
|
if( parseInt($(this).find('.field_qty_of_competitor_brand').val()) > 0 || parseInt($(this).find('.field_net_value').val()) > 0 ) {
|
|
brand_status = true
|
|
}
|
|
})
|
|
if(!brand_status) {
|
|
cansubmit = false
|
|
cipla_brand_missing.push($(this).parent().parent().parent().find('.field_brand_name').first().val())
|
|
}
|
|
}
|
|
})
|
|
|
|
if(!cansubmit) {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: "Competitor data missing!!",
|
|
text: 'Competitor data for below Cipla Brands is missing. Please enter atleast data for 1 Competitor for Brands : ' + cipla_brand_missing.join(', ')
|
|
})
|
|
} else {
|
|
$("#pageloader").fadeIn();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '/form/ajaxsubmitmultiple',
|
|
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':'Please make sure that atleast 1 competitor details is entered for each Cipla brand quantity entered!'
|
|
})
|
|
}
|
|
},
|
|
});
|
|
}
|
|
});
|
|
|
|
$('#edit-report-form').on('submit', function(event){
|
|
event.preventDefault();
|
|
$("#pageloader").fadeIn();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '/form/ajaxsubmit',
|
|
data: new FormData($('#edit-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':'Please make sure that atleast 1 competitor details is entered for each Cipla brand quantity entered!'
|
|
})
|
|
}
|
|
},
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |