Changes
This commit is contained in:
parent
d7be7c3359
commit
1c4c86427c
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
|
||||
class Formhelper
|
||||
{
|
||||
public static function getMultiformData($partition, $form_id, $user_id, $startdate = false, $enddate = false) {
|
||||
if($startdate) {
|
||||
$history = LambdaRequest::postrequest('form', 'formentity/getformhistory', ['form_id' => $form_id, 'user_id' => $user_id, 'partition' => $partition, 'date_range' => $startdate.'_'.$enddate ]);
|
||||
} else {
|
||||
$history = LambdaRequest::postrequest('form', 'formentity/getformhistory', ['form_id' => $form_id, 'user_id' => $user_id, 'partition' => $partition ]);
|
||||
}
|
||||
return $history;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4,7 +4,6 @@ namespace App\Http\Controllers;
|
|||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use DB;
|
||||
|
||||
class ContactController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
|
|
@ -29,6 +28,40 @@ class ContactController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
protected function get_list_buttons() {
|
||||
return [ ['title' => 'Add New', 'link' => $this->_base_url.'/addnew' ], ['title' => 'Import Users', 'link' => $this->_base_url.'/import'] ];
|
||||
}
|
||||
|
||||
protected function get_import_fields($records){
|
||||
$response = LambdaRequest::signedrequest('get', 'ums', 'contactattribute/get_all');
|
||||
$hierar = $this->getlambda('get', 'ums', 'hierarchy', 'dropdown');
|
||||
$hierar_dd = [];
|
||||
foreach($hierar->data->items as $hier){
|
||||
$hierar_dd[$hier->code] = $hier->name . ' (' . $hier->code . ')';
|
||||
}
|
||||
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
$fields = [
|
||||
'name' => ['title' => 'Name', 'type' => 'text', 'required' => true],
|
||||
'email' => ['title' => 'Email', 'type' => 'email', 'required' => true],
|
||||
'phone' => ['title' => 'Phone', 'type' => 'text', 'required' => true],
|
||||
'msl_code' => ['title' => 'MSL Code', 'type' => 'text'],
|
||||
'position' => ['title' => 'Position', 'type' => 'select', 'required' => true, 'values' => $hierar_dd ],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
];
|
||||
|
||||
foreach ($response->data->items as $item) {
|
||||
$values = [];
|
||||
if(in_array($item->type, ['select', 'radio', 'checkbox']) ) {
|
||||
foreach($item->options as $op) {
|
||||
$values[$op->value] = $op->display;
|
||||
}
|
||||
}
|
||||
$fields[$item->code] = ['title' => $item->attribute, 'type' => $item->type, 'required' => $item->required=='yes'?true:false, 'values' => $values];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
// public function list(Request $request) {
|
||||
// $response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all');
|
||||
|
|
|
|||
|
|
@ -270,7 +270,8 @@ class Controller extends BaseController
|
|||
//return redirect($this->_base_url.'/edit?id='.$response->data->item->id)->withMessage('Successfully Saved !!!');
|
||||
return redirect($this->_base_url.'s')->withMessage('Successfully Saved !!!');
|
||||
} else {
|
||||
return \Redirect::back()->withMessage('Some Error occured!');
|
||||
return redirect($this->_base_url.'s')->withError('Some Error occured! '. $response->body->message);
|
||||
//return \Redirect::back()->withMessage('Some Error occured!');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -282,7 +283,8 @@ class Controller extends BaseController
|
|||
//echo '<pre>'; print_r($response); exit;
|
||||
return redirect($this->_base_url.'s')->withMessage('Successfully Marked Deleted !!!');
|
||||
} else {
|
||||
return \Redirect::back()->withMessage('Some Error occured!');
|
||||
return redirect($this->_base_url.'s')->withError('Some Error occured! '. $response->body->message);
|
||||
//return \Redirect::back()->withMessage('Some Error occured!');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,10 +25,13 @@ class FormController extends Controller
|
|||
$this->_base_url = '/formaction';
|
||||
}
|
||||
|
||||
protected function deliverform($formdata, $questions) {
|
||||
protected function deliverform($formdata, $questions, $id = false) {
|
||||
$additional_info = $this->get_additional_info($formdata);
|
||||
if($formdata->form_id == '1653655221-724ec5b4-fccb-4a88-bf25-cf894fa27a77'){
|
||||
//echo '<pre>'; print_r($questions); exit;
|
||||
}
|
||||
//echo '<pre>'; print_r($questions); exit;
|
||||
$data = ['questions' => $questions, 'form' => $formdata, 'form_id' => $formdata->form_id, 'id' => false ];
|
||||
$data = ['questions' => $questions, 'form' => $formdata, 'form_id' => $formdata->form_id, 'id' => false, 'id' => $id ];
|
||||
if(sizeof($additional_info) > 0) {
|
||||
$data['additional'] = $additional_info;
|
||||
}
|
||||
|
|
@ -84,7 +87,7 @@ class FormController extends Controller
|
|||
$id = $request->input('id', false);
|
||||
$finfo = LambdaRequest::postrequest('form', 'formentity/getformdefination', ['form_id' => $formdata->form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition, 'id' => $id ]);
|
||||
$formdata->title = $finfo->data->formdata->title;
|
||||
return $this->deliverform($formdata, $finfo->data->questions);
|
||||
return $this->deliverform($formdata, $finfo->data->questions, $id);
|
||||
}
|
||||
|
||||
public function submit(Request $request) {
|
||||
|
|
@ -92,6 +95,7 @@ class FormController extends Controller
|
|||
$formdata = $request->session()->get('formdata');
|
||||
if(isset($formdata) && !empty($formdata) && $formdata->user_id != '') {
|
||||
$post = $this->processformdata($formdata->form_id, $post);
|
||||
//Log::debug(print_r($post, true));
|
||||
$finfo = LambdaRequest::postrequest('form', 'formentity/submitform', ['formdata' => $post, 'entity_id' => $formdata->form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition ]);
|
||||
if($formdata->link_type == 'list') {
|
||||
return redirect('/form/'.$request->session()->get('finfo') )->withMessage('Successfully Saved !!!');
|
||||
|
|
@ -108,6 +112,7 @@ class FormController extends Controller
|
|||
$formdata = $request->session()->get('formdata');
|
||||
if(isset($formdata) && !empty($formdata) && $formdata->user_id != '') {
|
||||
$post = $this->processformdata($formdata->form_id, $post);
|
||||
//Log::debug(print_r($post, true));
|
||||
$finfo = LambdaRequest::postrequest('form', 'formentity/submitform', ['formdata' => $post, 'entity_id' => $post['form_id'], 'user_id' => $formdata->user_id, 'partition' => $formdata->partition ]);
|
||||
//Log::debug(print_r($finfo, true));
|
||||
if($finfo->status == 'success') {
|
||||
|
|
@ -120,12 +125,44 @@ class FormController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
public function ajaxsubmitmultiple(Request $request) {
|
||||
$post = $request->except('_token');
|
||||
$formdata = $request->session()->get('formdata');
|
||||
|
||||
if(isset($formdata) && !empty($formdata) && $formdata->user_id != '') {
|
||||
$post = $this->processformdata($formdata->form_id, $post);
|
||||
//echo '<pre>'; print_r($post); exit;
|
||||
//Log::debug(print_r($post, true));
|
||||
//echo json_encode(['formdata' => $post, 'entity_id' => $post['form_id'], 'user_id' => $formdata->user_id, 'partition' => $formdata->partition ]);
|
||||
$finfo = LambdaRequest::postrequest('form', 'formentity/submitmultipleform', ['formdata' => $post, 'entity_id' => $post['form_id'], 'user_id' => $formdata->user_id, 'partition' => $formdata->partition ]);
|
||||
//Log::debug(print_r($finfo, true));
|
||||
if($finfo->status == 'success') {
|
||||
return response()->json(['status' => 'success']);
|
||||
} else {
|
||||
return response()->json(['status' => 'failure']);
|
||||
}
|
||||
} else {
|
||||
return response()->json(['status' => 'failure']);
|
||||
}
|
||||
}
|
||||
|
||||
protected function processformdata($form, $post) {
|
||||
switch($form) {
|
||||
case '1650365556-f06dde85-6138-4dae-9c23-5067e318c522':
|
||||
$post[ $post['brand_name'].'-current' ] = $post['current_business_value'];
|
||||
$post[ $post['brand_name'].'-potential' ] = $post['potential_business_value'];
|
||||
break;
|
||||
case '1653655221-724ec5b4-fccb-4a88-bf25-cf894fa27a77':
|
||||
$brands = ['Hinex DM' => 'hinex-dm', 'Hinex HP' => 'hinex-hp', 'Hinex ST' => 'hinex-st', 'Hinex ST +' => 'hinex-st+'];
|
||||
foreach($post['brand'] as $i => $brand) {
|
||||
foreach($brands as $bname => $bkey) {
|
||||
if($bname == $brand)
|
||||
$post[$bkey][$i] = $post['units'][$i];
|
||||
else
|
||||
$post[$bkey][$i] = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $post;
|
||||
|
|
@ -165,6 +202,10 @@ class FormController extends Controller
|
|||
}
|
||||
return ['team' => $team];
|
||||
break;
|
||||
case '1653655221-724ec5b4-fccb-4a88-bf25-cf894fa27a77':
|
||||
|
||||
return [];
|
||||
break;
|
||||
|
||||
default:
|
||||
return [];
|
||||
|
|
|
|||
|
|
@ -178,8 +178,6 @@ return [
|
|||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
Maatwebsite\Excel\ExcelServiceProvider::class,
|
||||
BaoPham\DynamoDb\DynamoDbServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
@ -233,6 +231,7 @@ return [
|
|||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
|
||||
'Formhelper' => App\Helpers\Formhelper::class,
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
<select class="form-control" name="{{$field}}[]" {{isset($props['required'])&&$props['required']?'required':'' }}>
|
||||
<option value=""> -- Select {{$props['title']}} -- </option>
|
||||
@foreach($props['values'] as $k => $v)
|
||||
<option value="{{$k}}" {{ array_key_exists($field, $record) && $record[$field] == $v ? 'selected="selected"':''}}>{{$v}}</option>
|
||||
<option value="{{$k}}" {{ array_key_exists($field, $record) && ($record[$field] == $v || $record[$field] == $k) ? 'selected="selected"':''}}>{{$v}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
|
|
|
|||
|
|
@ -0,0 +1,150 @@
|
|||
<!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="{{asset('assets/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}} asdsds</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
|
||||
<form method="POST" action="/form/submit" id="report-form">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@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
|
||||
@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"> 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($){
|
||||
$('#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'
|
||||
})
|
||||
@if($id)
|
||||
window.location.href = "/form/history";
|
||||
@else
|
||||
$('#report-form').trigger("reset");
|
||||
@endif
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -3,9 +3,10 @@
|
|||
<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 class="loader text-white">
|
||||
<i class="mdi mdi-loading mdi-spin mdi-48px" aria-hidden="true"></i><br />Loading
|
||||
<div id="pageloader">
|
||||
<img src="{{asset('assets/images/loader-large.gif')}}" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
|
|
@ -32,7 +33,8 @@
|
|||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit">
|
||||
<form method="POST" action="/form/submit" id="report-form">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
|
|
@ -87,26 +89,75 @@
|
|||
<!-- 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;
|
||||
}
|
||||
|
||||
@include('layouts.shared/footer-script')
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('.loader').hide()
|
||||
$('#report-form').submit(function(){
|
||||
$('.loader').show()
|
||||
});
|
||||
|
||||
$('#field-metolar-xr-12-5-pob, #field-metolar-xr-25-pob, #field-metolar-xr-50-pob, #field-metolar-xr-100-pob, #field-metolar-tl-25-pob, #field-metolar-tl-50-pob').change(function(){
|
||||
$('#field-total_pob_value').val( (parseInt($('#field-metolar-xr-12-5-pob').val())||0) *46 +
|
||||
(parseInt($('#field-metolar-xr-25-pob').val())*44||0) +
|
||||
(parseInt($('#field-metolar-xr-50-pob').val())*62||0) +
|
||||
(parseInt($('#field-metolar-xr-100-pob').val())*119||0) +
|
||||
(parseInt($('#field-metolar-tl-25-pob').val())*88||0) +
|
||||
(parseInt($('#field-metolar-tl-50-pob').val())*106||0)
|
||||
);
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-metolar-xr-12-5-pob, #field-metolar-xr-25-pob, #field-metolar-xr-50-pob, #field-metolar-xr-100-pob, #field-metolar-tl-25-pob, #field-metolar-tl-50-pob').change(function(){
|
||||
$('#field-total_pob_value').val( (parseInt($('#field-metolar-xr-12-5-pob').val())||0) *46 +
|
||||
(parseInt($('#field-metolar-xr-25-pob').val())*44||0) +
|
||||
(parseInt($('#field-metolar-xr-50-pob').val())*62||0) +
|
||||
(parseInt($('#field-metolar-xr-100-pob').val())*119||0) +
|
||||
(parseInt($('#field-metolar-tl-25-pob').val())*88||0) +
|
||||
(parseInt($('#field-metolar-tl-50-pob').val())*106||0)
|
||||
);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
@if($id)
|
||||
window.location.href = "/form/history";
|
||||
@else
|
||||
$('#report-form').trigger("reset");
|
||||
@endif
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
</script>
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,206 @@
|
|||
<!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
|
||||
<form method="POST" action="/form/submitmultiple" id="report-form">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id[]" value="{{$id}}">
|
||||
@endif
|
||||
<div id="question-set">
|
||||
<div class="border-primary border p-2">
|
||||
@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('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="button-list row">
|
||||
<div class="col-6 text-center d-grid mt-3 ">
|
||||
<button class="btn btn-dark" type="button" id="add-btn" {{$id?'disabled':''}}> Add More </button>
|
||||
</div>
|
||||
<div class="col-6 text-center d-grid mt-3 ">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
</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($){
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#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 not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('#add-btn').click(function(){
|
||||
$('#question-set').append(`<div class="border-primary border p-2 mt-3">
|
||||
@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('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
</div>`)
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,200 @@
|
|||
<!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
|
||||
|
||||
@php
|
||||
$doctorsdetails = Formhelper::getMultiformData( $form->partition, '1653980040-4da0c8f8-1887-4b9e-82ec-6cb7ba50356b', $form->user_id);
|
||||
$doctors = [];
|
||||
foreach($doctorsdetails->data->submissions as $sub) {
|
||||
$doctors[] = $sub->formdata;
|
||||
}
|
||||
$history = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id);
|
||||
$histories = [];
|
||||
$date = '';
|
||||
foreach($history->data->submissions as $sub) {
|
||||
$sub->formdata->id = $sub->id;
|
||||
$histories[$sub->formdata->doctor] = $sub->formdata;
|
||||
$date = $sub->formdata->date;
|
||||
}
|
||||
@endphp
|
||||
|
||||
|
||||
<form method="POST" action="/form/submitmultiple" id="report-form">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-date" class="form-label">Date<span class="text-danger">*</span></label>
|
||||
<input type="date" id="field-date" name="date" class="form-control" value="{{ $date }}" required value="">
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mb-2">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-hover table-nowrap table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Doctor Name</th>
|
||||
<th>Days Visited</th>
|
||||
<th>Started Rxing</th>
|
||||
<th>No. of Rxs</th>
|
||||
<th>Rx Honoured</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($doctors as $doctor)
|
||||
<input type="hidden" name="doctor[]" value="{{$doctor->{'doctor-name'} }}">
|
||||
@if(array_key_exists($doctor->{'doctor-name'}, $histories))
|
||||
<input type="hidden" name="id[]" value="{{$histories[$doctor->{'doctor-name'}]->id}}">
|
||||
@endif
|
||||
@php
|
||||
$hasHistory = false;
|
||||
if(array_key_exists($doctor->{'doctor-name'}, $histories)) {
|
||||
$hasHistory = true;
|
||||
$history = $histories[$doctor->{'doctor-name'}];
|
||||
}
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{$doctor->{'doctor-name'} }}</td>
|
||||
<td style="min-width: 100px;">
|
||||
<select id="days_visited" name="days_visited[]" class="form-control" required>
|
||||
<option value="0" {{$hasHistory && $history->days_visited == "0" ? "selected":"" }}>0</option>
|
||||
<option value="1" {{$hasHistory && $history->days_visited == "1" ? "selected":"" }}>1</option>
|
||||
<option value="2" {{$hasHistory && $history->days_visited == "2" ? "selected":"" }}>2</option>
|
||||
<option value="3" {{$hasHistory && $history->days_visited == "3" ? "selected":"" }}>3</option>
|
||||
</select>
|
||||
</td>
|
||||
<td style="min-width: 100px;">
|
||||
<select id="started_rxing" name="started_rxing[]" class="form-control" required>
|
||||
<option value="yes" {{$hasHistory && $history->started_rxing == "yes" ? "selected":"" }}>Yes</option>
|
||||
<option value="no" {{$hasHistory && $history->started_rxing == "no" ? "selected":"" }}>No</option>
|
||||
</select>
|
||||
</td>
|
||||
<td style="min-width: 100px;">
|
||||
<input type="number" id="no-of-rxs" name="no-of-rxs[]" class="form-control" value="{{$hasHistory?$history->{'no-of-rxs'}:'' }}" required />
|
||||
</td>
|
||||
<td style="min-width: 100px;">
|
||||
<select id="rx-honoured" name="rx-honoured[]" class="form-control" required>
|
||||
<option value="yes" {{$hasHistory && $history->{'rx-honoured'} == "yes" ? "selected":"" }}>Yes</option>
|
||||
<option value="no" {{$hasHistory && $history->{'rx-honoured'} == "no" ? "selected":"" }}>No</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- 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($){
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#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'
|
||||
})
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('#field-record_date').change(function(){
|
||||
window.location.href = window.location.href.split('?')[0] + '?record_date=' + $(this).val()
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
<!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
|
||||
|
||||
@php
|
||||
$start = strtotime("1 May 2021");
|
||||
$till = strtotime("now");
|
||||
if( request()->get('record_date') ) {
|
||||
$target = strtotime(request()->get('record_date'));
|
||||
} else {
|
||||
$target = strtotime("now");
|
||||
}
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id, date("m-01-Y", $target) , date("m-t-Y", $target) );
|
||||
$contacts = [];
|
||||
if(sizeof($history->data->submissions) > 0) {
|
||||
foreach($history->data->submissions as $sub){
|
||||
$contacts[$sub->formdata->contact_id] = ['id' => $sub->id, 'units' => $sub->formdata->units ];
|
||||
}
|
||||
}
|
||||
//echo '<pre>';print_r($history);print_r($contacts);echo '</pre>';
|
||||
@endphp
|
||||
|
||||
<form method="POST" action="/form/submitmultiple" id="report-form">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-date" class="form-label">Date<span class="text-danger">*</span></label>
|
||||
<input type="date" id="field-date" name="date" class="form-control" required value="{{ (sizeof($contacts) > 0 ) ? $history->data->submissions[0]->formdata->date : '' }}">
|
||||
</div>
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-record_date" class="form-label">Month<span class="text-danger">*</span></label>
|
||||
<select id="field-record_date" name="record_date" class="form-control" required>
|
||||
@while ($start < $till)
|
||||
<option value="{{ date("M Y", $start) }}" {{ date("M Y", $target)==date("M Y", $start)?'selected':'' }} >{{ date("M Y", $start) }}</option>
|
||||
{{ $start = $start = $start + 60*60*24*(date("t", $start)) }}
|
||||
@endwhile
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mb-2">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-hover table-nowrap table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>HCP Name</th>
|
||||
<th>Units</th>
|
||||
<th>Brand</th>
|
||||
<th>Speciality</th>
|
||||
<th>Hospital</th>
|
||||
<th>City</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($questions[2]->options as $doctor)
|
||||
@if(sizeof($contacts) > 0 && isset($contacts[$doctor->display]) )
|
||||
<input type="hidden" name="id[]" value="{{$contacts[$doctor->display]['id']}}">
|
||||
@endif
|
||||
<input type="hidden" name="contact_id[]" value="{{$doctor->value}}">
|
||||
<input type="hidden" name="brand[]" value="{{$doctor->contact->brand}}">
|
||||
<tr>
|
||||
<td>{{$doctor->display}}</td>
|
||||
<td style="min-width: 100px;">
|
||||
<input type="number" id="" name="units[]" class="form-control" required value="{{ (sizeof($contacts)>0 && isset($contacts[$doctor->display]) ) ? $contacts[$doctor->display]['units'] : '' }}">
|
||||
</td>
|
||||
<td>{{$doctor->contact->brand}}</td>
|
||||
<td>{{$doctor->contact->speciality}}</td>
|
||||
<td>{{$doctor->contact->hospital}}</td>
|
||||
<td>{{$doctor->contact->city}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- 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($){
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#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'
|
||||
})
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('#field-record_date').change(function(){
|
||||
window.location.href = window.location.href.split('?')[0] + '?record_date=' + $(this).val()
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -66,6 +66,14 @@
|
|||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
@if(count((array)$question->options) > 0 && 1==2 )
|
||||
<td>{{ $question->options->{ $submission->formdata->{$code} } }}</td>
|
||||
@else
|
||||
<td>{{ isset($submission->formdata->{$code}) ? $submission->formdata->{$code} : $code }}</td>
|
||||
<td>{{ isset($submission->formdata->{$code}) ? is_array($submission->formdata->{$code})? implode(', ', $submission->formdata->{$code}) :$submission->formdata->{$code} : $code }}</td>
|
||||
@endif
|
||||
@endforeach
|
||||
<th>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
@section('content')
|
||||
<!-- Start Content-->
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
|
|
|
|||
|
|
@ -116,6 +116,8 @@ Route::get('/form/{finfo}', [FormController::class, 'handle']);
|
|||
Route::post('/form/getformfielddata', [FormController::class, 'getformfielddata']);
|
||||
Route::post('/form/submit', [FormController::class, 'submit']);
|
||||
Route::post('/form/ajaxsubmit', [FormController::class, 'ajaxsubmit']);
|
||||
Route::post('/form/submitmultiple', [FormController::class, 'submitmultiple']);
|
||||
Route::post('/form/ajaxsubmitmultiple', [FormController::class, 'ajaxsubmitmultiple']);
|
||||
|
||||
|
||||
// require __DIR__ . '/auth.php';
|
||||
|
|
|
|||
Loading…
Reference in New Issue