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) {
|
public function surveyhandle($finfo, Request $request) {
|
||||||
$request->session()->put('finfo', $finfo);
|
$request->session()->put('finfo', $finfo);
|
||||||
$finfo = LambdaRequest::postrequest('form', 'survey/getforminfo', ['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);
|
$request->session()->put('formdata', $finfo->data->formdata);
|
||||||
if($finfo->status == 'success' && $finfo->data->formdata->link_type == 'form') {
|
if($finfo->status == 'success' && $finfo->data->formdata->link_type == 'form') {
|
||||||
//return $this->deliverform($finfo->data->formdata, $finfo->data->questions);
|
//return $this->deliverform($finfo->data->formdata, $finfo->data->questions);
|
||||||
|
|
@ -858,6 +858,7 @@ class FormController extends Controller
|
||||||
} elseif (\View::exists('form.'.$formdata->form_id)) {
|
} elseif (\View::exists('form.'.$formdata->form_id)) {
|
||||||
return view('srvey.'.$formdata->form_id)->with($data);
|
return view('srvey.'.$formdata->form_id)->with($data);
|
||||||
} else {
|
} else {
|
||||||
|
// return $data;
|
||||||
return view('srvey.common')->with($data);
|
return view('srvey.common')->with($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Requests\LambdaRequest;
|
use App\Http\Requests\LambdaRequest;
|
||||||
use DB;
|
use DB;
|
||||||
|
|
@ -23,29 +24,31 @@ class SurveysubmissionController extends Controller
|
||||||
$this->_base_url = '/surveysubmission';
|
$this->_base_url = '/surveysubmission';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_list_buttons() {
|
protected function get_list_buttons()
|
||||||
return [ ['title' => 'Date Filter', 'link' => '#.' ], ['title' => 'Export Excel', 'link' => $this->_base_url.'/export'] ];
|
{
|
||||||
|
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();
|
$user = Auth::user();
|
||||||
$form_id = $request->session()->get('entity_id');
|
$form_id = $request->session()->get('entity_id');
|
||||||
$post = $request->input();
|
$post = $request->input();
|
||||||
if(isset($post['startdate']))
|
if (isset($post['startdate']))
|
||||||
$startdate = $post['startdate'];
|
$startdate = $post['startdate'];
|
||||||
else
|
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'];
|
$enddate = $post['enddate'];
|
||||||
else
|
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);
|
$request->session()->put('formdata_request', $reqdata);
|
||||||
//echo '<pre>'; print_r($reqdata); exit;
|
//echo '<pre>'; print_r($reqdata); exit;
|
||||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/getformhistory', $reqdata);
|
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module . '/getformhistory', $reqdata);
|
||||||
if($response->statusCode == 401) {
|
if ($response->statusCode == 401) {
|
||||||
return redirect('/unauthorised');
|
return redirect('/unauthorised');
|
||||||
}
|
}
|
||||||
//echo '<pre>'; print_r($response); exit;
|
//echo '<pre>'; print_r($response); exit;
|
||||||
|
|
@ -54,18 +57,34 @@ class SurveysubmissionController extends Controller
|
||||||
'date' => ['title' => 'Record Date', 'type' => 'text'],
|
'date' => ['title' => 'Record Date', 'type' => 'text'],
|
||||||
'sdate' => ['title' => 'Submitted On', 'type' => 'text'],
|
'sdate' => ['title' => 'Submitted On', 'type' => 'text'],
|
||||||
];
|
];
|
||||||
foreach($response->data->questions as $qid => $question){
|
foreach ($response->data->questions as $qid => $question) {
|
||||||
$fields['field_'.$qid] = ['title' => $question->label, 'type' => 'text'];
|
$fields['field_' . $qid] = ['title' => $question->label, 'type' => 'text'];
|
||||||
}
|
}
|
||||||
|
// echo '<pre>'; print_r($fields);
|
||||||
|
// exit;
|
||||||
$items = [];
|
$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))];
|
$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){
|
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};
|
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;
|
$items[] = (object)$item;
|
||||||
}
|
}
|
||||||
//echo '<pre>'; print_r($items); exit;
|
// echo '<pre>';
|
||||||
|
// print_r($items);
|
||||||
|
// exit;
|
||||||
|
|
||||||
return $this->view('list')->with([
|
return $this->view('list')->with([
|
||||||
'title' => $response->data->formname . $this->_title,
|
'title' => $response->data->formname . $this->_title,
|
||||||
'fields' => $fields,
|
'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 = $request->session()->get('formdata_request');
|
||||||
//$reqdata = ["partition" => 'rapport-vitalis1', "form_id" => '1650365457-c86bd7f2-a33c-49a5-9671-3c2511b57f3b', "alldata" => true, "date_range" => '2022/_'.$enddate ];
|
//$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'];
|
$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;
|
$fields[] = $question->label;
|
||||||
}
|
}
|
||||||
list($startdate, $enddate) = explode('_', $reqdata['date_range']);
|
list($startdate, $enddate) = explode('_', $reqdata['date_range']);
|
||||||
$exceldata = [];
|
$exceldata = [];
|
||||||
$exceldata[] = [ucwords($response->data->formname . $this->_title).' Report'];
|
$exceldata[] = [ucwords($response->data->formname . $this->_title) . ' Report'];
|
||||||
$exceldata[] = ['Start Date: '.date("d M Y", strtotime($startdate))];
|
$exceldata[] = ['Start Date: ' . date("d M Y", strtotime($startdate))];
|
||||||
$exceldata[] = ['End Date: '.date("d M Y", strtotime($enddate))];
|
$exceldata[] = ['End Date: ' . date("d M Y", strtotime($enddate))];
|
||||||
$exceldata[] = [''];
|
$exceldata[] = [''];
|
||||||
$exceldata[] = $fields;
|
$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))];
|
$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};
|
$item[] = $submission->formdata->{$qid};
|
||||||
}
|
}
|
||||||
$exceldata[] = $item;
|
$exceldata[] = $item;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
@include('layouts.shared/title-meta', ['title' => 'Form'])
|
||||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
@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/sweetalert2/sweetalert2.min.css') }}" rel="stylesheet" type="text/css" />
|
||||||
</head>
|
</head>
|
||||||
<div id="pageloader">
|
<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>
|
</div>
|
||||||
|
|
||||||
<body class="loading">
|
<body class="loading">
|
||||||
<div class="account-pages">
|
<div class="account-pages">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
@ -16,96 +18,163 @@
|
||||||
<div class="card bg-pattern">
|
<div class="card bg-pattern">
|
||||||
<div class="card-body p-3 row">
|
<div class="card-body p-3 row">
|
||||||
|
|
||||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
@if (Session::has('error'))
|
||||||
<br>@endif
|
<div class="alert alert-danger">{{ Session::get('error') }}</div>
|
||||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
<br>
|
||||||
</div>
|
@endif
|
||||||
<br>@endif
|
@if (session('success'))
|
||||||
<div class="col-12">
|
<div class=" alert alert-success">{{ session('success') }}
|
||||||
<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>
|
</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
|
@endif
|
||||||
|
|
||||||
@foreach($questions as $question)
|
@foreach ($questions as $question)
|
||||||
<div class="col-md-12 mb-2">
|
<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>
|
<label for="field-{{ $question->code }}"
|
||||||
@switch($question->type)
|
class="form-label">{{ $question->question }} {!! $question->required == 'yes' ? '<span class="text-danger">*</span>' : '' !!}
|
||||||
@case('hidden')
|
</label>
|
||||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
@switch($question->type)
|
||||||
|
@case('hidden')
|
||||||
|
<input type="{{ $question->type }}" id="field-{{ $question->code }}"
|
||||||
|
name="{{ $question->code }}"
|
||||||
|
value="{{ isset($question->value) ? $question->value : '' }}">
|
||||||
@break
|
@break
|
||||||
@case('text')
|
|
||||||
@case('email')
|
@case('text')
|
||||||
@case('tel')
|
@case('email')
|
||||||
@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('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
|
@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
|
@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
|
@break
|
||||||
@case('dropdown')
|
|
||||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
@case('dropdown')
|
||||||
<option value=""> -- Select -- </option>
|
<select class="form-control" id="field-{{ $question->code }}"
|
||||||
@foreach($question->options as $option)
|
name="{{ $question->code }}"
|
||||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
{{ $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
|
@endforeach
|
||||||
</select>
|
|
||||||
@break
|
@break
|
||||||
@case('checkbox')
|
|
||||||
@foreach($question->options as $option)
|
@case('radio')
|
||||||
<div class="form-check mb-2 form-check-primary">
|
@foreach ($question->options as $option)
|
||||||
<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':''}}>
|
<div class="form-check">
|
||||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
<input type="radio"
|
||||||
</div>
|
id="field-{{ $question->code }}-{{ $option->value }}"
|
||||||
@endforeach
|
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
|
@break
|
||||||
@case('radio')
|
|
||||||
@foreach($question->options as $option)
|
@case('file')
|
||||||
<div class="form-check">
|
<input type="file" id="field-{{ $question->code }}"
|
||||||
<input type="radio" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}" class="form-check-input" {{isset($question->value) && $question->value != $question->value ? 'checked':''}}>
|
name="{{ $question->code }}" class="form-control" value=""
|
||||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
accept="image/jpg, image/jpeg, image/png" required>
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
@break
|
@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>
|
@case('multitextbox')
|
||||||
@break
|
<div class="row">
|
||||||
@case('multitextbox')
|
@foreach ($question->options as $option)
|
||||||
<div class="row">
|
<div class="col-6">{{ $option->display }}</div>
|
||||||
@foreach($question->options as $option)
|
<div class="col-6 mb-1">
|
||||||
<div class="col-6">{{$option->display}}</div>
|
<input type="number" id="field-{{ $option->value }}"
|
||||||
<div class="col-6 mb-1">
|
name="{{ $option->value }}" class="form-control" required
|
||||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
value="{{ isset($option->val) ? $option->val : 0 }}">
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
@break
|
@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>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
@if (!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
|
||||||
<div class="text-center d-grid mt-3">
|
<div class="text-center d-grid mt-3">
|
||||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit
|
||||||
</div>
|
</button>
|
||||||
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
@ -122,58 +191,58 @@
|
||||||
<!-- end container -->
|
<!-- end container -->
|
||||||
</div>
|
</div>
|
||||||
<!-- end page -->
|
<!-- end page -->
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#pageloader {
|
#pageloader {
|
||||||
background: rgba( 255, 255, 255, 0.8 );
|
background: rgba(255, 255, 255, 0.8);
|
||||||
display: none;
|
display: none;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pageloader img {
|
#pageloader img {
|
||||||
left: 50%;
|
left: 50%;
|
||||||
margin-left: -32px;
|
margin-left: -32px;
|
||||||
margin-top: -32px;
|
margin-top: -32px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@include('layouts.shared/footer-script')
|
@include('layouts.shared/footer-script')
|
||||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
<script src="{{ asset('assets/libs/sweetalert2/sweetalert2.min.js') }}"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function($){
|
jQuery(document).ready(function($) {
|
||||||
$('#report-form').on('submit', function(event){
|
$('#report-form').on('submit', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$("#pageloader").fadeIn();
|
$("#pageloader").fadeIn();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: '/srvey/ajaxsubmit',
|
url: '/srvey/ajaxsubmit',
|
||||||
data: new FormData($('#report-form')[0]),
|
data: new FormData($('#report-form')[0]),
|
||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
success: function( data ) {
|
success: function(data) {
|
||||||
$("#pageloader").fadeOut();
|
$("#pageloader").fadeOut();
|
||||||
if(data.status == 'success') {
|
if (data.status == 'success') {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Great!',
|
title: 'Great!',
|
||||||
text: 'Your data is successfully submitted!',
|
text: 'Your data is successfully submitted!',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
})
|
||||||
$('#report-form').trigger("reset");
|
$('#report-form').trigger("reset");
|
||||||
} else {
|
} else {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
title: 'Data not submitted',
|
title: 'Data not submitted',
|
||||||
text: 'Something went wrong, please try again after some time!'
|
text: 'Something went wrong, please try again after some time!'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
</script>
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue