create radiometrix with subquestions and radio element show value
This commit is contained in:
parent
f11024b323
commit
9a7e5d7993
|
|
@ -846,7 +846,7 @@ class FormController extends Controller
|
|||
public function surveyhandle($finfo, Request $request) {
|
||||
$request->session()->put('finfo', $finfo);
|
||||
$finfo = LambdaRequest::postrequest('form', 'survey/getforminfo', ['finfo' => $finfo]);
|
||||
//echo '<pre>'; print_r($finfo); exit;
|
||||
// echo '<pre>'; print_r($finfo); exit;
|
||||
$request->session()->put('formdata', $finfo->data->formdata);
|
||||
if($finfo->status == 'success' && $finfo->data->formdata->link_type == 'form') {
|
||||
//return $this->deliverform($finfo->data->formdata, $finfo->data->questions);
|
||||
|
|
@ -858,6 +858,7 @@ class FormController extends Controller
|
|||
} elseif (\View::exists('form.'.$formdata->form_id)) {
|
||||
return view('srvey.'.$formdata->form_id)->with($data);
|
||||
} else {
|
||||
// return $data;
|
||||
return view('srvey.common')->with($data);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use DB;
|
||||
|
|
@ -23,29 +24,31 @@ class SurveysubmissionController extends Controller
|
|||
$this->_base_url = '/surveysubmission';
|
||||
}
|
||||
|
||||
protected function get_list_buttons() {
|
||||
return [ ['title' => 'Date Filter', 'link' => '#.' ], ['title' => 'Export Excel', 'link' => $this->_base_url.'/export'] ];
|
||||
protected function get_list_buttons()
|
||||
{
|
||||
return [['title' => 'Date Filter', 'link' => '#.'], ['title' => 'Export Excel', 'link' => $this->_base_url . '/export']];
|
||||
}
|
||||
|
||||
public function list(Request $request) {
|
||||
public function list(Request $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$form_id = $request->session()->get('entity_id');
|
||||
$post = $request->input();
|
||||
if(isset($post['startdate']))
|
||||
if (isset($post['startdate']))
|
||||
$startdate = $post['startdate'];
|
||||
else
|
||||
$startdate = date("Y/m/d", strtotime("-1 day") );
|
||||
$startdate = date("Y/m/d", strtotime("-1 day"));
|
||||
|
||||
if(isset($post['enddate']))
|
||||
if (isset($post['enddate']))
|
||||
$enddate = $post['enddate'];
|
||||
else
|
||||
$enddate = date("Y/m/d", strtotime("now") + 86400 );
|
||||
$enddate = date("Y/m/d", strtotime("now") + 86400);
|
||||
|
||||
$reqdata = ["partition" => 'rapport-'.$user->domain, "form_id" => $form_id, "alldata" => true, "date_range" => $startdate.'_'.$enddate ];
|
||||
$reqdata = ["partition" => 'rapport-' . $user->domain, "form_id" => $form_id, "alldata" => true, "date_range" => $startdate . '_' . $enddate];
|
||||
$request->session()->put('formdata_request', $reqdata);
|
||||
//echo '<pre>'; print_r($reqdata); exit;
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/getformhistory', $reqdata);
|
||||
if($response->statusCode == 401) {
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module . '/getformhistory', $reqdata);
|
||||
if ($response->statusCode == 401) {
|
||||
return redirect('/unauthorised');
|
||||
}
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
|
|
@ -54,18 +57,34 @@ class SurveysubmissionController extends Controller
|
|||
'date' => ['title' => 'Record Date', 'type' => 'text'],
|
||||
'sdate' => ['title' => 'Submitted On', 'type' => 'text'],
|
||||
];
|
||||
foreach($response->data->questions as $qid => $question){
|
||||
$fields['field_'.$qid] = ['title' => $question->label, 'type' => 'text'];
|
||||
foreach ($response->data->questions as $qid => $question) {
|
||||
$fields['field_' . $qid] = ['title' => $question->label, 'type' => 'text'];
|
||||
}
|
||||
// echo '<pre>'; print_r($fields);
|
||||
// exit;
|
||||
$items = [];
|
||||
foreach($response->data->submissions as $submission) {
|
||||
// print_r($response->data->questions);
|
||||
// print_r($response->data->submissions);
|
||||
// exit;
|
||||
foreach ($response->data->submissions as $submission) {
|
||||
$item = ['user' => $submission->user_info->name, 'date' => date("d M Y", strtotime($submission->record_date)), 'sdate' => date("d M Y", strtotime($submission->createdAt))];
|
||||
foreach($response->data->questions as $qid => $question){
|
||||
$item['field_'.$qid] = count((array)$question->options) > 0 && isset($question->options->{ $submission->formdata->{$qid} }) ? $question->options->{ $submission->formdata->{$qid} } : $submission->formdata->{$qid};
|
||||
foreach ($response->data->questions as $qid => $question) {
|
||||
if ($question->type == 'radiometrix') {
|
||||
$rm = [];
|
||||
foreach ($submission->formdata->$qid as $key => $val) {
|
||||
$rm[] = $key . ':' . $val;
|
||||
}
|
||||
$item['field_' . $qid] = implode(', ', $rm);
|
||||
} else {
|
||||
$item['field_' . $qid] = count((array)$question->options) > 0 && isset($question->options->{$submission->formdata->{$qid}}) ? $question->options->{$submission->formdata->{$qid}} : $submission->formdata->{$qid};
|
||||
}
|
||||
}
|
||||
$items[] = (object)$item;
|
||||
}
|
||||
//echo '<pre>'; print_r($items); exit;
|
||||
// echo '<pre>';
|
||||
// print_r($items);
|
||||
// exit;
|
||||
|
||||
return $this->view('list')->with([
|
||||
'title' => $response->data->formname . $this->_title,
|
||||
'fields' => $fields,
|
||||
|
|
@ -77,25 +96,26 @@ class SurveysubmissionController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
public function export(Request $request) {
|
||||
public function export(Request $request)
|
||||
{
|
||||
$reqdata = $request->session()->get('formdata_request');
|
||||
//$reqdata = ["partition" => 'rapport-vitalis1', "form_id" => '1650365457-c86bd7f2-a33c-49a5-9671-3c2511b57f3b', "alldata" => true, "date_range" => '2022/_'.$enddate ];
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/getformhistory', $reqdata);
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module . '/getformhistory', $reqdata);
|
||||
$fields = ['Submitted By', 'User identification', 'Record Date', 'Submitted On'];
|
||||
foreach($response->data->questions as $qid => $question){
|
||||
foreach ($response->data->questions as $qid => $question) {
|
||||
$fields[] = $question->label;
|
||||
}
|
||||
list($startdate, $enddate) = explode('_', $reqdata['date_range']);
|
||||
$exceldata = [];
|
||||
$exceldata[] = [ucwords($response->data->formname . $this->_title).' Report'];
|
||||
$exceldata[] = ['Start Date: '.date("d M Y", strtotime($startdate))];
|
||||
$exceldata[] = ['End Date: '.date("d M Y", strtotime($enddate))];
|
||||
$exceldata[] = [ucwords($response->data->formname . $this->_title) . ' Report'];
|
||||
$exceldata[] = ['Start Date: ' . date("d M Y", strtotime($startdate))];
|
||||
$exceldata[] = ['End Date: ' . date("d M Y", strtotime($enddate))];
|
||||
$exceldata[] = [''];
|
||||
$exceldata[] = $fields;
|
||||
|
||||
foreach($response->data->submissions as $submission) {
|
||||
foreach ($response->data->submissions as $submission) {
|
||||
$item = [$submission->user_info->name, $submission->user_info->id, date("d M Y", strtotime($submission->record_date)), date("d M Y", strtotime($submission->createdAt))];
|
||||
foreach($response->data->questions as $qid => $question){
|
||||
foreach ($response->data->questions as $qid => $question) {
|
||||
$item[] = $submission->formdata->{$qid};
|
||||
}
|
||||
$exceldata[] = $item;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
<!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" />
|
||||
@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..." />
|
||||
<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">
|
||||
|
|
@ -16,96 +18,163 @@
|
|||
<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-12">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
@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-12">
|
||||
<h4 class="page-title">{{ $form->title }}</h4>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
@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:''}}">
|
||||
<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:''}}">
|
||||
|
||||
@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}}">
|
||||
|
||||
@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>
|
||||
|
||||
@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>
|
||||
|
||||
@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
|
||||
</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
|
||||
|
||||
@case('radio')
|
||||
@foreach ($question->options as $option)
|
||||
<div class="form-check">
|
||||
<input type="radio"
|
||||
id="field-{{ $question->code }}-{{ $option->value }}"
|
||||
name="{{ $question->code }}" class="form-check-input" value="{{$option->value}}"
|
||||
{{ isset($question->value) && $question->value != $question->value ? 'checked' : '' }}>
|
||||
<label class="form-check-label"
|
||||
for="field-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('radio')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check">
|
||||
<input type="radio" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}" class="form-check-input" {{isset($question->value) && $question->value != $question->value ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@case('file')
|
||||
<input type="file" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control" value=""
|
||||
accept="image/jpg, image/jpeg, image/png" required>
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" required>
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
|
||||
@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>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
|
||||
@case('radiometrix')
|
||||
@foreach ($question->options as $option)
|
||||
<div class="row">
|
||||
<div class="col-5">{{ $option->display }}</div>
|
||||
<div class="col-7 mb-1">
|
||||
@php
|
||||
$nn = json_decode($option->value);
|
||||
@endphp
|
||||
@foreach ($nn as $value)
|
||||
<input type="radio"
|
||||
id="field-{{ $option->display }}-{{ $value }}"
|
||||
name="{{ $question->code }}[{{$option->display}}]" value="{{$value}}" class="form-check-input"
|
||||
{{ isset($question->display) && $option->display != $option->display ? 'checked' : '' }}>
|
||||
{{ $value }}
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@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>
|
||||
|
||||
|
|
@ -122,58 +191,58 @@
|
|||
<!-- 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;
|
||||
}
|
||||
<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: '/srvey/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 not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
#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: '/srvey/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 not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue