Changes
This commit is contained in:
parent
21ac0e7c4b
commit
e0ca3eec38
|
|
@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
|||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use DB;
|
||||
use Auth;
|
||||
|
||||
class CampaignController extends Controller
|
||||
{
|
||||
|
|
@ -123,7 +124,20 @@ class CampaignController extends Controller
|
|||
$post = $request->except('_token');
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/view', $post, 60);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return $this->view('report')->with(['periods' => $response->data->periods, 'users' => $response->data->users, 'metrics' => $response->data->metrics, 'post' => $response->data->post ]);
|
||||
return $this->view('report')->with(['periods' => $response->data->periods, 'users' => $response->data->users, 'metrics' => $response->data->metrics, 'post' => $response->data->post, 'base_level' => $response->data->base_level ]);
|
||||
|
||||
}
|
||||
public function dashboard(Request $request) {
|
||||
$post = $request->except('_token');
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/view', $post, 60);
|
||||
$user = false;
|
||||
foreach($response->data->users as $u) {
|
||||
if($u->user_id == Auth::user()->user_id) {
|
||||
$user = $u;
|
||||
}
|
||||
}
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return $this->view('dashboard')->with(['periods' => $response->data->periods, 'user' => $user, 'metrics' => $response->data->metrics, 'post' => $response->data->post ]);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,10 +186,26 @@ class CampaignreportController extends Controller
|
|||
}
|
||||
|
||||
} else {
|
||||
return $this->view('appreport')->with(['periods' => $response->data->periods, 'users' => $response->data->users, 'metrics' => $response->data->metrics, 'post' => $response->data->post ]);
|
||||
return $this->view('appreport')->with(['periods' => $response->data->periods, 'users' => $response->data->users, 'metrics' => $response->data->metrics, 'post' => $response->data->post, 'base_level' => $response->data->base_level ]);
|
||||
}
|
||||
}
|
||||
|
||||
public function dashboard(Request $request) {
|
||||
$post = $request->except('_token');
|
||||
$token = $request->header('Authorization');
|
||||
if($token != '') {
|
||||
$request->session()->put('metric_access_key', $token);
|
||||
} else {
|
||||
$token = $request->session()->get('metric_access_key');
|
||||
}
|
||||
$post['type'] = 'leaderboard';
|
||||
$post['chart'] = 'leaderboard';
|
||||
$response = LambdaRequest::postrequest($this->_service, $this->_module.'/view', $post, $token);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return $this->view('appdashboard')->with(['periods' => $response->data->periods, 'user' => $response->data->user, 'metrics' => $response->data->metrics, 'post' => $response->data->post ]);
|
||||
}
|
||||
|
||||
|
||||
public function metriclist(Request $request) {
|
||||
$post = $request->input();
|
||||
$token = $request->header('Authorization');
|
||||
|
|
|
|||
|
|
@ -24,8 +24,14 @@ class DashboardController extends Controller
|
|||
$reports = $this->getlambda('get', 'metric', 'metric_report', 'list', $params);
|
||||
$widgets = $this->getlambda('get', 'wall', 'widgets', 'list');
|
||||
$campaigns = $this->getlambda('get', 'competition', 'campaign', 'list', $params);
|
||||
if($campaigns->statusCode == 200) {
|
||||
$campaigns = $campaigns->data->campaigns;
|
||||
} else {
|
||||
$campaigns = [];
|
||||
}
|
||||
//echo '<pre>'; print_r($campaigns); exit;
|
||||
return view('index')->with(['metrics' => isset($reports->data->metrics) ? $reports->data->metrics : [], 'widgets' => $widgets->data->widgets, 'campaigns' => $campaigns->data->campaigns]);
|
||||
|
||||
return view('index')->with(['metrics' => isset($reports->data->metrics) ? $reports->data->metrics : [], 'widgets' => $widgets->data->widgets, 'campaigns' => $campaigns]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class DomainController extends Controller
|
|||
'PM' => 'PM',
|
||||
'MM' => 'MM',
|
||||
'BH' => 'BH',
|
||||
'HO' => 'HO',
|
||||
'DSH' => 'DSH',
|
||||
'NSM' => 'NSM',
|
||||
'ZBM' => 'ZBM',
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ class FormController extends Controller
|
|||
if(isset($formdata) && !empty($formdata) && $formdata->user_id != '') {
|
||||
$post = $this->processformdata($formdata->form_id, $post, $formdata->user_id, $formdata->partition);
|
||||
|
||||
//Log::debug(print_r($post, true));
|
||||
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($finfo->status == 'success') {
|
||||
return response()->json(['status' => 'success']);
|
||||
|
|
@ -346,6 +346,19 @@ class FormController extends Controller
|
|||
case '1669979081-e991fc27-e8c1-4120-9883-b42af09244d3':
|
||||
$post[$post['activity_type']] = 1;
|
||||
break;
|
||||
|
||||
case '1672032315-9b267137-4b81-425c-afb4-a4c0fa701372':
|
||||
if($post['powerof5'] == 'Yes') {
|
||||
$post['powerof5_duova_rx'] = $post['duova_rx'];
|
||||
$post['powerof5_glycohale_fb_rx'] = $post['glycohale_fb_rx'];
|
||||
$post['powerof5_maxiflo_rx'] = $post['maxiflo_rx'];
|
||||
$post['powerof5_maxiflo_sb_rx'] = $post['maxiflo_sb_rx'];
|
||||
$post['powerof5_nistami_rx'] = $post['nistami_rx'];
|
||||
$post['powerof5_tiova_rx'] = $post['tiova_rx'];
|
||||
$post['powerof5_tiova_sb_rx'] = $post['tiova_sb_rx'];
|
||||
$post['powerof5_triohale_rx'] = $post['triohale_rx'];
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ class HierarchyController extends Controller
|
|||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all', ['positions' => true, 'export' => true]);
|
||||
//$users = LambdaRequest::signedrequest('get', $this->_service, 'users/get_all', ['raw' => true]);
|
||||
|
||||
//echo '<pre>'; print_r($response->data->hierarchys); exit;
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
|
||||
$headers = ['Sub Department Name', 'Employee Code', 'Business Email', 'Display Name', 'Mobile 1 Phone', 'Position Code', 'Position Title', 'Designation', 'Zone', 'Region', 'Area', 'Territory', 'Manager 1 Employee Code', 'Manager 1 Name', 'Manager\'s 1 Email', 'Manager 2 Employee Code', 'Manager 2 Name', 'Manager\'s 2 Email'];
|
||||
// foreach($response->data->graph->values->metrics as $metric) {
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ class SurveyController extends Controller
|
|||
|
||||
return [
|
||||
'title' => ['title' => 'Title', 'type' => 'text', 'required' => true],
|
||||
'description' => ['title' => 'Description', 'type' => 'textarea', 'required' => true, 'fullwidth' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class SurveyquestionController extends Controller
|
|||
return [
|
||||
'question' => ['title' => 'Question', 'type' => 'text', 'required' => true, 'fullwidth' => true],
|
||||
'code' => ['title' => 'Code (small caps without spaces and special chars except "_")', 'type' => 'text', 'required' => true],
|
||||
'type' => ['title' => 'Question Type', 'type' => 'select', 'required' => true, 'values' => ['text' => 'Text', 'number' => 'Number', 'date' => 'Date', 'email' => 'Email', 'url' => 'Url', 'dropdown' => 'Dropdown', 'checkbox' => 'Checkbox', 'radio' => 'Radio', 'multitextbox' => 'Multi Text Boxes', 'contacts' => 'Contacts', 'file' => 'File Upload'] ],
|
||||
'type' => ['title' => 'Question Type', 'type' => 'select', 'required' => true, 'values' => ['text' => 'Text', 'number' => 'Number', 'date' => 'Date', 'email' => 'Email', 'url' => 'Url', 'dropdown' => 'Dropdown', 'checkbox' => 'Checkbox', 'radio' => 'Radio', 'radiometrix' => 'RadioMetrix', 'multitextbox' => 'Multi Text Boxes', 'contacts' => 'Contacts', 'file' => 'File Upload'] ],
|
||||
'required' => ['title' => 'Is Required', 'type' => 'yesno', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
'options' => ['title' => 'Options', 'type' => 'mapping', 'fullwidth' => true ],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,194 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Report"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/flatpickr/flatpickr.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body class="loading" style="background:#fff">
|
||||
<div id="pageloader">
|
||||
<img src="{{asset('assets/images/loader-large.gif')}}" alt="processing..." />
|
||||
</div>
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<h4 class="page-title">Campaign Dashboard</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row" id="graph-wrapper">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8 text-center">
|
||||
<div class="button-list">
|
||||
<a href="/campaignreport/report?id={{$post->id}}&type=details&chart=tabular&period=month-0" class="btn {{($post->type == 'details' ) ? 'btn-soft-warning' : 'btn-soft-blue' }} btn-rounded">Details</a>
|
||||
<a href="/campaignreport/report?id={{$post->id}}&type=leaderboard&chart=leaderboard&period=month-0" class="btn btn-soft-blue btn-rounded">Leaderboard</a>
|
||||
<a href="/campaignreport/report?id={{$post->id}}&type=myteam&chart=myteam&period=month-0" class="btn {{($post->type == 'myteam' ) ? 'btn-soft-warning' : 'btn-soft-blue' }} btn-rounded">My Team</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 mt-2">
|
||||
<div class="row">
|
||||
<label for="period" class="col-6 col-xl-5 col-form-label">Select Period</label>
|
||||
<div class="col-6 col-xl-7">
|
||||
<select class="form-control" id="period" name="period">
|
||||
@foreach($periods as $v)
|
||||
<option value="{{$v->value}}" {{$post->period == $v->value ? "selected":""}}>{{$v->label}}</option>
|
||||
@endforeach
|
||||
<option value="custom-date" {{$post->period == $v->value ? "selected":""}}>Custom Date</option>
|
||||
</select>
|
||||
<div class="input-group input-group-sm" id="period-daterange-wrapper">
|
||||
<input type="text" class="form-control border" id="period-daterange">
|
||||
<span class="input-group-text bg-blue border-blue text-white" id="custom-date-submit">
|
||||
<i class="mdi mdi-arrow-right-bold"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="widget-chart" dir="ltr">
|
||||
<div id="cardCollpase4" class="collapse pt-3 show">
|
||||
<div class="table-responsive">
|
||||
@if(isset($user))
|
||||
<table class="table table-centered table-nowrap table-borderless mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Metric</th>
|
||||
<th>Unit</th>
|
||||
<th>Points</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($metrics as $metric)
|
||||
<tr>
|
||||
<td>{{$metric->name}}</td>
|
||||
<td>{{ isset($user->metrics->{$metric->id}) ? $user->metrics->{$metric->id} : '-' }}</td>
|
||||
<td>{{ isset($user->metric_points->{$metric->id}) ? $user->metric_points->{$metric->id} : '-' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div> <!-- .table-responsive -->
|
||||
</div> <!-- end collapse-->
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- container -->
|
||||
<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')
|
||||
<!-- third party js -->
|
||||
<script src="{{asset('assets/libs/flatpickr/flatpickr.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/apexcharts/apexcharts.min.js')}}"></script>
|
||||
<!-- third party js ends -->
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#period-daterange-wrapper').hide()
|
||||
$('#period').change(function(){
|
||||
if($(this).val() == 'custom-date') {
|
||||
$('#period-daterange-wrapper').show()
|
||||
} else {
|
||||
$('#period-daterange-wrapper').hide()
|
||||
$("#pageloader").fadeIn();
|
||||
let href = new URL(window.location.href);
|
||||
href.searchParams.delete('refresh')
|
||||
href.searchParams.set('period', $(this).val() );
|
||||
window.location.href = href.toString()
|
||||
}
|
||||
});
|
||||
|
||||
$('#period-daterange').flatpickr({
|
||||
altInput: true,
|
||||
mode: "range",
|
||||
altFormat: "F j, y",
|
||||
defaultDate: 'today'
|
||||
});
|
||||
|
||||
$('#custom-date-submit').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let href = new URL(window.location.href);
|
||||
href.searchParams.delete('refresh')
|
||||
href.searchParams.set('period', $('#period').val() );
|
||||
href.searchParams.set('dates', $('#period-daterange').val().replace(" to ", "--"))
|
||||
window.location.href = href.toString()
|
||||
})
|
||||
|
||||
$('#graph-wrapper .button-list a').click(function(event) {
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
console.log($(this).attr('href'))
|
||||
let href = new URL(document.location.origin + $(this).attr('href'));
|
||||
href.searchParams.delete('refresh')
|
||||
href.searchParams.set('period', $('#period').val() );
|
||||
window.location.href = href.toString()
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#export').click(function(){
|
||||
//$("#pageloader").fadeIn();
|
||||
let href = new URL(window.location.href);
|
||||
window.location.href = href.origin + '/metricreport/export' + href.search
|
||||
})
|
||||
// $('#export').click(function(){
|
||||
// let href = new URL(window.location.href);
|
||||
// $('.loader').show()
|
||||
// $.get( href.origin + '/metricreport/export' + href.search + '&download=1&s3=1', function( data ) {
|
||||
// console.log(data)
|
||||
// $('.loader').hide()
|
||||
// $('#graph-wrapper').prepend('<div class="button-list pe-xl-4 d-grid"><a href="" download class="btn btn--md btn-pink waves-effect waves-light">Download Report</a></div>');
|
||||
// });
|
||||
// })
|
||||
$('#email-export').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let href = new URL(window.location.href);
|
||||
$.get( href.origin + '/metricreport/export' + href.search + '&email=1', function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
alert( "Email has been sent to your email id." );
|
||||
});
|
||||
})
|
||||
$('#refresh-data').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
window.location.href = '{!! request()->fullUrlWithQuery(['refresh' => true]) !!}'
|
||||
})
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
@ -7,8 +7,8 @@
|
|||
<link href="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body class="loading" style="background:#fff">
|
||||
<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>
|
||||
<div class="card p-2" id="graph-wrapper">
|
||||
<div class="card-body p-0">
|
||||
|
|
@ -24,93 +24,187 @@
|
|||
<!-- end page title -->
|
||||
|
||||
<div class="row" id="graph-wrapper">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"></h4>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="row mb-3">
|
||||
<label for="period" class="col-6 col-xl-5 col-form-label">Select Period</label>
|
||||
<div class="col-6 col-xl-7">
|
||||
<select class="form-control" id="period" name="period">
|
||||
@foreach($periods as $v)
|
||||
<option value="{{$v->value}}" {{$post->period == $v->value ? "selected":""}}>{{$v->label}}</option>
|
||||
@endforeach
|
||||
<option value="custom-date" {{$post->period == $v->value ? "selected":""}}>Custom Date</option>
|
||||
</select>
|
||||
<div class="input-group input-group-sm" id="period-daterange-wrapper">
|
||||
<input type="text" class="form-control border" id="period-daterange">
|
||||
<span class="input-group-text bg-blue border-blue text-white" id="custom-date-submit">
|
||||
<i class="mdi mdi-arrow-right-bold"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="widget-chart text-center" dir="ltr">
|
||||
<div class="col-md-8 text-center">
|
||||
<div class="button-list">
|
||||
<a href="/campaignreport/report?id={{$post->id}}&type=details&chart=tabular&period=month-0" class="btn {{($post->type == 'details' ) ? 'btn-soft-warning' : 'btn-soft-blue' }} btn-rounded">Details</a>
|
||||
<a href="/campaignreport/report?id={{$post->id}}&type=leaderboard&chart=leaderboard&period=month-0" class="btn {{($post->type == 'leaderboard' ) ? 'btn-soft-warning' : 'btn-soft-blue' }} btn-rounded">Leaderboard</a>
|
||||
<a href="/campaignreport/report?id={{$post->id}}&type=myteam&chart=myteam&period=month-0" class="btn {{($post->type == 'myteam' ) ? 'btn-soft-warning' : 'btn-soft-blue' }} btn-rounded">My Team</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@switch(true)
|
||||
@case($post->type == 'details')
|
||||
<div id="cardCollpase4" class="collapse pt-3 show">
|
||||
<div class="table-responsive">
|
||||
@if(isset($users))
|
||||
<table class="table table-centered table-nowrap table-borderless mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th colspan="2">User</th>
|
||||
<th>Employee Code</th>
|
||||
<th>Zone</th>
|
||||
<th>Region</th>
|
||||
<th>Area</th>
|
||||
<th>Territory</th>
|
||||
<th>Rank</th>
|
||||
<th>Total Units</th>
|
||||
<th>Total Points</th>
|
||||
@foreach($metrics as $metric)
|
||||
<th>{{$metric->name}} Units</th>
|
||||
<th>{{$metric->name}} Points</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($users as $user)
|
||||
<tr>
|
||||
<td><img src="{{isset($user->user_info->avatar) ? $user->user_info->avatar : ''}}" class="avatar-sm rounded-circle"></td>
|
||||
<td>{{ $user->user_info->name }} <br/>{{$user->user_info->designation}}</td>
|
||||
<td>{{ isset($user->user_info->employee_code) ? $user->user_info->employee_code:''}}</td>
|
||||
<td>{{ isset($user->user_info->positions->Zone) ? $user->user_info->positions->Zone : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Region) ? $user->user_info->positions->Region : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Area) ? $user->user_info->positions->Area : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Territory) ? $user->user_info->positions->Territory : '-' }}</td>
|
||||
<td>{{ $user->rank }}</td>
|
||||
<td>{{ $user->units }}</td>
|
||||
<td>{{ $user->total }}</td>
|
||||
@foreach($metrics as $metric)
|
||||
<td>{{ $user->metrics->{$metric->id} }}</td>
|
||||
<td>{{ $user->metric_points->{$metric->id} }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div> <!-- .table-responsive -->
|
||||
</div> <!-- end collapse-->
|
||||
@break
|
||||
@endswitch
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="row mt-3 mb-2">
|
||||
<label for="period" class="col-6 col-xl-5 col-form-label">Select Period</label>
|
||||
<div class="col-6 col-xl-7">
|
||||
<select class="form-control" id="period" name="period">
|
||||
@foreach($periods as $v)
|
||||
<option value="{{$v->value}}" {{$post->period == $v->value ? "selected":""}}>{{$v->label}}</option>
|
||||
@endforeach
|
||||
<option value="custom-date" {{$post->period == $v->value ? "selected":""}}>Custom Date</option>
|
||||
</select>
|
||||
<div class="input-group input-group-sm" id="period-daterange-wrapper">
|
||||
<input type="text" class="form-control border" id="period-daterange">
|
||||
<span class="input-group-text bg-blue border-blue text-white" id="custom-date-submit">
|
||||
<i class="mdi mdi-arrow-right-bold"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
@switch(true)
|
||||
@case($post->type == 'leaderboard')
|
||||
<div class="btn-group mb-2">
|
||||
<button type="button" class="btn btn-info leaderboard-prev" {{isset($post->level) && $base_level==$post->level?'disabled':''}}><i class="mdi mdi-play mdi-rotate-180 mdi-18px"></i></button>
|
||||
<button type="button" class="btn btn-info">Level {{$users[0]->level}}</button>
|
||||
<button type="button" class="btn btn-info leaderboard-next" {{$users[0]->level==1?'disabled':''}}><i class="mdi mdi-play mdi-18px"></i></button>
|
||||
</div>
|
||||
|
||||
<div id="cardCollpase4" class="collapse pt-3 show">
|
||||
<div class="table-responsive">
|
||||
@if(isset($users))
|
||||
<table class="table table-centered table-nowrap table-borderless mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Rank</th>
|
||||
<th colspan="2">User</th>
|
||||
<th>Employee Code</th>
|
||||
<th>Zone</th>
|
||||
<th>Region</th>
|
||||
<th>Area</th>
|
||||
<th>Territory</th>
|
||||
|
||||
<th>Total Units</th>
|
||||
<th>Total Points</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($users as $user)
|
||||
<tr>
|
||||
<td><img src="https://ui-avatars.com/api/?background=FFFFFF&name={{$user->rank}}" class="avatar-md"></td>
|
||||
<td><img src="{{isset($user->user_info->avatar) ? $user->user_info->avatar : ''}}" class="avatar-sm rounded-circle"></td>
|
||||
<td>{{ $user->user_info->name }} <br/>{{$user->user_info->designation}}</td>
|
||||
<td>{{ isset($user->user_info->employee_code) ? $user->user_info->employee_code:''}}</td>
|
||||
<td>{{ isset($user->user_info->positions->Zone) ? $user->user_info->positions->Zone : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Region) ? $user->user_info->positions->Region : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Area) ? $user->user_info->positions->Area : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Territory) ? $user->user_info->positions->Territory : '-' }}</td>
|
||||
<td>{{ $user->units }}</td>
|
||||
<td>{{ $user->total }}</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div> <!-- .table-responsive -->
|
||||
</div> <!-- end collapse-->
|
||||
@break
|
||||
@case($post->type == 'details')
|
||||
<div id="cardCollpase4" class="collapse pt-3 show">
|
||||
<div class="table-responsive">
|
||||
@if(isset($users))
|
||||
<table class="table table-centered table-nowrap table-borderless mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th colspan="2">User</th>
|
||||
<th>Employee Code</th>
|
||||
<th>Zone</th>
|
||||
<th>Region</th>
|
||||
<th>Area</th>
|
||||
<th>Territory</th>
|
||||
<th>Rank</th>
|
||||
<th>Total Units</th>
|
||||
<th>Total Points</th>
|
||||
@foreach($metrics as $metric)
|
||||
<th>{{$metric->name}} Units</th>
|
||||
<th>{{$metric->name}} Points</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($users as $user)
|
||||
<tr>
|
||||
<td><img src="{{isset($user->user_info->avatar) ? $user->user_info->avatar : ''}}" class="avatar-sm rounded-circle"></td>
|
||||
<td>{{ $user->user_info->name }} <br/>{{$user->user_info->designation}}</td>
|
||||
<td>{{ isset($user->user_info->employee_code) ? $user->user_info->employee_code:''}}</td>
|
||||
<td>{{ isset($user->user_info->positions->Zone) ? $user->user_info->positions->Zone : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Region) ? $user->user_info->positions->Region : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Area) ? $user->user_info->positions->Area : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Territory) ? $user->user_info->positions->Territory : '-' }}</td>
|
||||
<td>{{ $user->rank }}</td>
|
||||
<td>{{ $user->units }}</td>
|
||||
<td>{{ $user->total }}</td>
|
||||
@foreach($metrics as $metric)
|
||||
<td>{{ isset($user->metrics->{$metric->id}) ? $user->metrics->{$metric->id} : '-' }}</td>
|
||||
<td>{{ isset($user->metric_points->{$metric->id}) ? $user->metric_points->{$metric->id} : '-' }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div> <!-- .table-responsive -->
|
||||
</div> <!-- end collapse-->
|
||||
@break
|
||||
@case($post->type == 'myteam')
|
||||
<div class="btn-group mb-2">
|
||||
<button type="button" class="btn btn-info leaderboard-prev" {{isset($post->level) && $base_level==$post->level?'disabled':''}}><i class="mdi mdi-play mdi-rotate-180 mdi-18px"></i></button>
|
||||
<button type="button" class="btn btn-info">Level {{$users[0]->level}}</button>
|
||||
<button type="button" class="btn btn-info leaderboard-next" {{$users[0]->level==1?'disabled':''}}><i class="mdi mdi-play mdi-18px"></i></button>
|
||||
</div>
|
||||
|
||||
<div id="cardCollpase4" class="collapse pt-3 show">
|
||||
<div class="table-responsive">
|
||||
@if(isset($users))
|
||||
<table class="table table-centered table-nowrap table-borderless mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Rank</th>
|
||||
<th colspan="2">User</th>
|
||||
<th>Employee Code</th>
|
||||
<th>Zone</th>
|
||||
<th>Region</th>
|
||||
<th>Area</th>
|
||||
<th>Territory</th>
|
||||
|
||||
<th>Total Units</th>
|
||||
<th>Total Points</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($users as $user)
|
||||
<tr>
|
||||
<td><img src="https://ui-avatars.com/api/?background=FFFFFF&name={{$user->rank}}" class="avatar-md"></td>
|
||||
<td><img src="{{isset($user->user_info->avatar) ? $user->user_info->avatar : ''}}" class="avatar-sm rounded-circle"></td>
|
||||
<td>{{ $user->user_info->name }} <br/>{{$user->user_info->designation}}</td>
|
||||
<td>{{ isset($user->user_info->employee_code) ? $user->user_info->employee_code:''}}</td>
|
||||
<td>{{ isset($user->user_info->positions->Zone) ? $user->user_info->positions->Zone : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Region) ? $user->user_info->positions->Region : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Area) ? $user->user_info->positions->Area : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Territory) ? $user->user_info->positions->Territory : '-' }}</td>
|
||||
<td>{{ $user->units }}</td>
|
||||
<td>{{ $user->total }}</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div> <!-- .table-responsive -->
|
||||
</div> <!-- end collapse-->
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
</div> <!-- container -->
|
||||
|
||||
<style type="text/css">
|
||||
.btn-xs {border-radius: 6px!important;}
|
||||
.underline {border-bottom: 2px solid #B9B970;}
|
||||
|
|
@ -123,6 +217,22 @@
|
|||
padding-top: calc(50vh - 24px);
|
||||
padding-left: calc(50vw - 24px);
|
||||
}
|
||||
#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>
|
||||
|
||||
<!-- end container -->
|
||||
|
|
@ -175,7 +285,22 @@
|
|||
window.location.href = href.toString()
|
||||
});
|
||||
|
||||
|
||||
@if($post->type == 'leaderboard' || $post->type == 'myteam')
|
||||
$('.leaderboard-next').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let href = new URL(window.location.href);
|
||||
href.searchParams.delete('refresh')
|
||||
href.searchParams.set('level', {{$users[0]->level}}-1 );
|
||||
window.location.href = href.toString()
|
||||
})
|
||||
$('.leaderboard-prev').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let href = new URL(window.location.href);
|
||||
href.searchParams.delete('refresh')
|
||||
href.searchParams.set('level', {{$users[0]->level}}+1 );
|
||||
window.location.href = href.toString()
|
||||
})
|
||||
@endif
|
||||
|
||||
$('#export').click(function(){
|
||||
//$("#pageloader").fadeIn();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,193 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Dashboard", "mode" => $mode ?? "", "demo" => $demo ?? ""])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
<link href="{{asset('assets/libs/flatpickr/flatpickr.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/selectize/selectize.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<!-- third party css end -->
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div id="pageloader">
|
||||
<img src="{{asset('assets/images/loader-large.gif')}}" alt="processing..." />
|
||||
</div>
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<h4 class="page-title">Campaign Dashboard</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row" id="graph-wrapper">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"></h4>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="row mb-3">
|
||||
<label for="period" class="col-6 col-xl-5 col-form-label">Select Period</label>
|
||||
<div class="col-6 col-xl-7">
|
||||
<select class="form-control" id="period" name="period">
|
||||
@foreach($periods as $v)
|
||||
<option value="{{$v->value}}" {{$post->period == $v->value ? "selected":""}}>{{$v->label}}</option>
|
||||
@endforeach
|
||||
<option value="custom-date" {{$post->period == $v->value ? "selected":""}}>Custom Date</option>
|
||||
</select>
|
||||
<div class="input-group input-group-sm" id="period-daterange-wrapper">
|
||||
<input type="text" class="form-control border" id="period-daterange">
|
||||
<span class="input-group-text bg-blue border-blue text-white" id="custom-date-submit">
|
||||
<i class="mdi mdi-arrow-right-bold"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="widget-chart" dir="ltr">
|
||||
<div id="cardCollpase4" class="collapse pt-3 show">
|
||||
<div class="table-responsive">
|
||||
@if(isset($user))
|
||||
<table class="table table-centered table-nowrap table-borderless mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Metric</th>
|
||||
<th>Unit</th>
|
||||
<th>Points</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($metrics as $metric)
|
||||
<tr>
|
||||
<td>{{$metric->name}}</td>
|
||||
<td>{{ isset($user->metrics->{$metric->id}) ? $user->metrics->{$metric->id} : '-' }}</td>
|
||||
<td>{{ isset($user->metric_points->{$metric->id}) ? $user->metric_points->{$metric->id} : '-' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div> <!-- .table-responsive -->
|
||||
</div> <!-- end collapse-->
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- container -->
|
||||
<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>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<!-- third party js -->
|
||||
<script src="{{asset('assets/libs/flatpickr/flatpickr.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/apexcharts/apexcharts.min.js')}}"></script>
|
||||
<!-- third party js ends -->
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#period-daterange-wrapper').hide()
|
||||
$('#period').change(function(){
|
||||
if($(this).val() == 'custom-date') {
|
||||
$('#period-daterange-wrapper').show()
|
||||
} else {
|
||||
$('#period-daterange-wrapper').hide()
|
||||
$("#pageloader").fadeIn();
|
||||
let href = new URL(window.location.href);
|
||||
href.searchParams.delete('refresh')
|
||||
href.searchParams.set('period', $(this).val() );
|
||||
window.location.href = href.toString()
|
||||
}
|
||||
});
|
||||
|
||||
$('#period-daterange').flatpickr({
|
||||
altInput: true,
|
||||
mode: "range",
|
||||
altFormat: "F j, y",
|
||||
defaultDate: 'today'
|
||||
});
|
||||
|
||||
$('#custom-date-submit').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let href = new URL(window.location.href);
|
||||
href.searchParams.delete('refresh')
|
||||
href.searchParams.set('period', $('#period').val() );
|
||||
href.searchParams.set('dates', $('#period-daterange').val().replace(" to ", "--"))
|
||||
window.location.href = href.toString()
|
||||
})
|
||||
|
||||
$('#graph-wrapper .button-list a').click(function(event) {
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
console.log($(this).attr('href'))
|
||||
let href = new URL(document.location.origin + $(this).attr('href'));
|
||||
href.searchParams.delete('refresh')
|
||||
href.searchParams.set('period', $('#period').val() );
|
||||
window.location.href = href.toString()
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#export').click(function(){
|
||||
//$("#pageloader").fadeIn();
|
||||
let href = new URL(window.location.href);
|
||||
window.location.href = href.origin + '/metricreport/export' + href.search
|
||||
})
|
||||
// $('#export').click(function(){
|
||||
// let href = new URL(window.location.href);
|
||||
// $('.loader').show()
|
||||
// $.get( href.origin + '/metricreport/export' + href.search + '&download=1&s3=1', function( data ) {
|
||||
// console.log(data)
|
||||
// $('.loader').hide()
|
||||
// $('#graph-wrapper').prepend('<div class="button-list pe-xl-4 d-grid"><a href="" download class="btn btn--md btn-pink waves-effect waves-light">Download Report</a></div>');
|
||||
// });
|
||||
// })
|
||||
$('#email-export').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let href = new URL(window.location.href);
|
||||
$.get( href.origin + '/metricreport/export' + href.search + '&email=1', function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
alert( "Email has been sent to your email id." );
|
||||
});
|
||||
})
|
||||
$('#refresh-data').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
window.location.href = '{!! request()->fullUrlWithQuery(['refresh' => true]) !!}'
|
||||
})
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@endsection
|
||||
|
|
@ -30,6 +30,13 @@
|
|||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"></h4>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="button-list">
|
||||
<a href="/campaign/report?id={{$post->id}}&type=details&chart=tabular&period=month-0" class="btn {{($post->type == 'details' ) ? 'btn-soft-warning' : 'btn-soft-blue' }} btn-rounded">Details</a>
|
||||
<a href="/campaign/report?id={{$post->id}}&type=leaderboard&chart=leaderboard&period=month-0" class="btn {{($post->type == 'leaderboard' ) ? 'btn-soft-warning' : 'btn-soft-blue' }} btn-rounded">Leaderboard</a>
|
||||
<a href="/campaign/report?id={{$post->id}}&type=myteam&chart=myteam&period=month-0" class="btn {{($post->type == 'myteam' ) ? 'btn-soft-warning' : 'btn-soft-blue' }} btn-rounded">My Team</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="row mb-3">
|
||||
<label for="period" class="col-6 col-xl-5 col-form-label">Select Period</label>
|
||||
|
|
@ -55,6 +62,54 @@
|
|||
<div class="widget-chart text-center" dir="ltr">
|
||||
|
||||
@switch(true)
|
||||
@case($post->type == 'leaderboard')
|
||||
<div class="btn-group mb-2">
|
||||
<button type="button" class="btn btn-info leaderboard-prev" {{isset($post->level) && $base_level==$post->level?'disabled':''}}><i class="mdi mdi-play mdi-rotate-180 mdi-18px"></i></button>
|
||||
<button type="button" class="btn btn-info">Level {{$users[0]->level}}</button>
|
||||
<button type="button" class="btn btn-info leaderboard-next" {{$users[0]->level==1?'disabled':''}}><i class="mdi mdi-play mdi-18px"></i></button>
|
||||
</div>
|
||||
|
||||
<div id="cardCollpase4" class="collapse pt-3 show">
|
||||
<div class="table-responsive">
|
||||
@if(isset($users))
|
||||
<table class="table table-centered table-nowrap table-borderless mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Rank</th>
|
||||
<th colspan="2">User</th>
|
||||
<th>Employee Code</th>
|
||||
<th>Zone</th>
|
||||
<th>Region</th>
|
||||
<th>Area</th>
|
||||
<th>Territory</th>
|
||||
|
||||
<th>Total Units</th>
|
||||
<th>Total Points</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($users as $user)
|
||||
<tr>
|
||||
<td><img src="https://ui-avatars.com/api/?background=FFFFFF&name={{$user->rank}}" class="avatar-md"></td>
|
||||
<td><img src="{{isset($user->user_info->avatar) ? $user->user_info->avatar : ''}}" class="avatar-sm rounded-circle"></td>
|
||||
<td>{{ $user->user_info->name }} <br/>{{$user->user_info->designation}}</td>
|
||||
<td>{{ isset($user->user_info->employee_code) ? $user->user_info->employee_code:''}}</td>
|
||||
<td>{{ isset($user->user_info->positions->Zone) ? $user->user_info->positions->Zone : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Region) ? $user->user_info->positions->Region : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Area) ? $user->user_info->positions->Area : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Territory) ? $user->user_info->positions->Territory : '-' }}</td>
|
||||
<td>{{ $user->units }}</td>
|
||||
<td>{{ $user->total }}</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div> <!-- .table-responsive -->
|
||||
</div> <!-- end collapse-->
|
||||
@break
|
||||
@case($post->type == 'details')
|
||||
<div id="cardCollpase4" class="collapse pt-3 show">
|
||||
<div class="table-responsive">
|
||||
|
|
@ -91,8 +146,8 @@
|
|||
<td>{{ $user->units }}</td>
|
||||
<td>{{ $user->total }}</td>
|
||||
@foreach($metrics as $metric)
|
||||
<td>{{ $user->metrics->{$metric->id} }}</td>
|
||||
<td>{{ $user->metric_points->{$metric->id} }}</td>
|
||||
<td>{{ isset($user->metrics->{$metric->id}) ? $user->metrics->{$metric->id} : '-' }}</td>
|
||||
<td>{{ isset($user->metric_points->{$metric->id}) ? $user->metric_points->{$metric->id} : '-' }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
|
|
@ -102,6 +157,54 @@
|
|||
</div> <!-- .table-responsive -->
|
||||
</div> <!-- end collapse-->
|
||||
@break
|
||||
@case($post->type == 'myteam')
|
||||
<div class="btn-group mb-2">
|
||||
<button type="button" class="btn btn-info leaderboard-prev" {{isset($post->level) && $base_level==$post->level?'disabled':''}}><i class="mdi mdi-play mdi-rotate-180 mdi-18px"></i></button>
|
||||
<button type="button" class="btn btn-info">Level {{$users[0]->level}}</button>
|
||||
<button type="button" class="btn btn-info leaderboard-next" {{$users[0]->level==1?'disabled':''}}><i class="mdi mdi-play mdi-18px"></i></button>
|
||||
</div>
|
||||
|
||||
<div id="cardCollpase4" class="collapse pt-3 show">
|
||||
<div class="table-responsive">
|
||||
@if(isset($users))
|
||||
<table class="table table-centered table-nowrap table-borderless mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Rank</th>
|
||||
<th colspan="2">User</th>
|
||||
<th>Employee Code</th>
|
||||
<th>Zone</th>
|
||||
<th>Region</th>
|
||||
<th>Area</th>
|
||||
<th>Territory</th>
|
||||
|
||||
<th>Total Units</th>
|
||||
<th>Total Points</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($users as $user)
|
||||
<tr>
|
||||
<td><img src="https://ui-avatars.com/api/?background=FFFFFF&name={{$user->rank}}" class="avatar-md"></td>
|
||||
<td><img src="{{isset($user->user_info->avatar) ? $user->user_info->avatar : ''}}" class="avatar-sm rounded-circle"></td>
|
||||
<td>{{ $user->user_info->name }} <br/>{{$user->user_info->designation}}</td>
|
||||
<td>{{ isset($user->user_info->employee_code) ? $user->user_info->employee_code:''}}</td>
|
||||
<td>{{ isset($user->user_info->positions->Zone) ? $user->user_info->positions->Zone : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Region) ? $user->user_info->positions->Region : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Area) ? $user->user_info->positions->Area : '-' }}</td>
|
||||
<td>{{ isset($user->user_info->positions->Territory) ? $user->user_info->positions->Territory : '-' }}</td>
|
||||
<td>{{ $user->units }}</td>
|
||||
<td>{{ $user->total }}</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div> <!-- .table-responsive -->
|
||||
</div> <!-- end collapse-->
|
||||
@break
|
||||
@endswitch
|
||||
|
||||
</div>
|
||||
|
|
@ -180,7 +283,22 @@
|
|||
window.location.href = href.toString()
|
||||
});
|
||||
|
||||
|
||||
@if($post->type == 'leaderboard' || $post->type == 'myteam')
|
||||
$('.leaderboard-next').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let href = new URL(window.location.href);
|
||||
href.searchParams.delete('refresh')
|
||||
href.searchParams.set('level', {{$users[0]->level}}-1 );
|
||||
window.location.href = href.toString()
|
||||
})
|
||||
$('.leaderboard-prev').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let href = new URL(window.location.href);
|
||||
href.searchParams.delete('refresh')
|
||||
href.searchParams.set('level', {{$users[0]->level}}+1 );
|
||||
window.location.href = href.toString()
|
||||
})
|
||||
@endif
|
||||
|
||||
$('#export').click(function(){
|
||||
//$("#pageloader").fadeIn();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,295 @@
|
|||
<!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="/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">
|
||||
<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 = $month = strtotime('2023-01-01');
|
||||
$end = strtotime('now');
|
||||
$months = [];
|
||||
while($month < $end)
|
||||
{
|
||||
$months[date('Y-m', $month)] = date('F Y', $month);
|
||||
$month = strtotime("+1 month", $month);
|
||||
}
|
||||
krsort($months);
|
||||
|
||||
if( request()->get('month') ) {
|
||||
$target = strtotime(request()->get('month').'-01');
|
||||
} 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 = [];
|
||||
foreach($questions as $question) {
|
||||
if($question->code == 'contact_id') {
|
||||
$contacts = $question->options;
|
||||
}
|
||||
}
|
||||
foreach($contacts as &$contact) {
|
||||
$contact->duova_rx = 0;
|
||||
$contact->glycohale_fb_rx = 0;
|
||||
$contact->maxiflo_rx = 0;
|
||||
$contact->maxiflo_sb_rx = 0;
|
||||
$contact->nistami_rx = 0;
|
||||
$contact->tiova_rx = 0;
|
||||
$contact->tiova_sb_rx = 0;
|
||||
$contact->triohale_rx = 0;
|
||||
|
||||
if(sizeof($history->data->submissions) > 0) {
|
||||
foreach($history->data->submissions as $sub){
|
||||
if($contact->display == $sub->formdata->contact_id) {
|
||||
$contact->duova_rx += (int)$sub->formdata->duova_rx;
|
||||
$contact->glycohale_fb_rx += (int)$sub->formdata->glycohale_fb_rx;
|
||||
$contact->maxiflo_rx += (int)$sub->formdata->maxiflo_rx;
|
||||
$contact->maxiflo_sb_rx += (int)$sub->formdata->maxiflo_sb_rx;
|
||||
$contact->nistami_rx += (int)$sub->formdata->nistami_rx;
|
||||
$contact->tiova_rx += (int)$sub->formdata->tiova_rx;
|
||||
$contact->tiova_sb_rx += (int)$sub->formdata->tiova_sb_rx;
|
||||
$contact->triohale_rx += (int)$sub->formdata->triohale_rx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//echo '<pre>'; print_r($contacts); exit;
|
||||
@endphp
|
||||
|
||||
<div class="col-12">
|
||||
<div class="row mb-3">
|
||||
<label for="inputEmail3" class="col-4 col-xl-3 col-form-label">Selected Month</label>
|
||||
<div class="col-8 col-xl-9">
|
||||
<select class="form-control" id="month-selector">
|
||||
@foreach($months as $k => $v)
|
||||
<option value="{{$k}}" {{ $k==app('request')->input('month', '')?'selected':'' }} >{{$v}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-12" id="table-wrapper">
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
|
||||
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
<th>Doctor</th>
|
||||
<th>Powerof5 ?</th>
|
||||
<th>Duova Rx</th>
|
||||
<th>Glycohale FB Rx</th>
|
||||
<th>Maxiflo Rx</th>
|
||||
<th>Maxiflo SB Rx</th>
|
||||
<th>Nistami Rx</th>
|
||||
<th>Tiova Rx</th>
|
||||
<th>Tiova SB Rx</th>
|
||||
<th>Triohale Rx</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($contacts as $contact)
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-info add-btn" doc_id="{{$contact->contact->id}}"><i class="mdi mdi-pencil"></i> Add</button>
|
||||
</td>
|
||||
<td><h5 class="m-0 fw-normal">{{$contact->display}}</h5></td>
|
||||
<td>{{isset($contact->contact->powerof5) ? $contact->contact->powerof5 : 'No'}}</td>
|
||||
<td>{{$contact->duova_rx}}</td>
|
||||
<td>{{$contact->glycohale_fb_rx}}</td>
|
||||
<td>{{$contact->maxiflo_rx}}</td>
|
||||
<td>{{$contact->maxiflo_sb_rx}}</td>
|
||||
<td>{{$contact->nistami_rx}}</td>
|
||||
<td>{{$contact->tiova_rx}}</td>
|
||||
<td>{{$contact->tiova_sb_rx}}</td>
|
||||
<td>{{$contact->triohale_rx}}</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="form-wrapper">
|
||||
<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
|
||||
@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
|
||||
@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
|
||||
@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>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</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($){
|
||||
let powerof5 = {}
|
||||
@foreach($contacts as $contact)
|
||||
powerof5['{{$contact->value}}'] = '{{isset($contact->contact->powerof5) ? $contact->contact->powerof5 : 'No'}}'
|
||||
@endforeach
|
||||
$('#form-wrapper').hide()
|
||||
$('.add-btn').click(function(){
|
||||
$('#field-contact_id').val( $(this).attr('doc_id') )
|
||||
$('#form-wrapper').show()
|
||||
$('#table-wrapper').hide()
|
||||
})
|
||||
|
||||
console.log(document.location.href)
|
||||
$('#month-selector').change(function() {
|
||||
$("#pageloader").fadeIn();
|
||||
let href = new URL(document.location.href);
|
||||
console.log(href)
|
||||
href.searchParams.set('month', $('#month-selector').val() );
|
||||
window.location.href = href.toString()
|
||||
});
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#report-form').append('<input type="hidden" name="powerof5" value="'+powerof5[$('#field-contact_id').val()]+'">')
|
||||
$.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'
|
||||
})
|
||||
window.location.reload();
|
||||
//$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -27,67 +27,30 @@
|
|||
@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> -->
|
||||
<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
|
||||
$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;
|
||||
}
|
||||
@endphp
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover table-nowrap table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
<th>Plan Date</th>
|
||||
<th>Team Name</th>
|
||||
<th>Type of meeting</th>
|
||||
<th>Execution Date</th>
|
||||
<th>Name of speaker</th>
|
||||
<th>MSL Code</th>
|
||||
<th>No. og Doctors/Paramedics attended</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($histories as $his)
|
||||
<tr>
|
||||
<td>
|
||||
<button class="btn btn-primary btn-xs edit-button" type="button" data="{{json_encode($his)}}">Edit</button>
|
||||
</td>
|
||||
<td>{{$his->record_date}}</td>
|
||||
<td>{{$his->team_name}}</td>
|
||||
<td>{{$his->type_of_meeting}}</td>
|
||||
<td>{{$his->execution_date}}</td>
|
||||
<td>{{$his->name_of_the_speaker}}</td>
|
||||
<td>{{$his->msl_code}}</td>
|
||||
<td>{{$his->attendence}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<form method="POST" action="/form/submit" id="report-form">
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
<input type="hidden" name="id" id="field-id" value="{{$id?$id:''}}">
|
||||
@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)
|
||||
<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>
|
||||
|
|
@ -123,6 +86,19 @@
|
|||
</div>
|
||||
@endforeach
|
||||
@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}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
|
|
@ -168,9 +144,31 @@
|
|||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#report-form').append('<input type="hidden" name="'+ $('#field-brand_name').val() +'" value="1">')
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
|
|
@ -196,14 +194,6 @@
|
|||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('.edit-button').click(function(){
|
||||
let data = JSON.parse( $(this).attr('data') )
|
||||
for(let k of Object.keys(data)) {
|
||||
$('#field-' + k).val( data[k] )
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,291 @@
|
|||
<!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="/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">
|
||||
<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 = $month = strtotime('2023-01-01');
|
||||
$end = strtotime('now');
|
||||
$months = [];
|
||||
while($month < $end)
|
||||
{
|
||||
$months[date('Y-m', $month)] = date('F Y', $month);
|
||||
$month = strtotime("+1 month", $month);
|
||||
}
|
||||
krsort($months);
|
||||
|
||||
if( request()->get('month') ) {
|
||||
$target = strtotime(request()->get('month').'-01');
|
||||
} 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 = [];
|
||||
foreach($questions as $question) {
|
||||
if($question->code == 'contact_id') {
|
||||
$contacts = $question->options;
|
||||
}
|
||||
}
|
||||
foreach($contacts as &$contact) {
|
||||
$contact->tiova = 0;
|
||||
$contact->duova = 0;
|
||||
$contact->triohale = 0;
|
||||
$contact->nistami = 0;
|
||||
$contact->glycohale_fb = 0;
|
||||
$contact->maxiflo = 0;
|
||||
$contact->maxiflo_sb = 0;
|
||||
$contact->tiova_synchrobreathe = 0;
|
||||
|
||||
if(sizeof($history->data->submissions) > 0) {
|
||||
foreach($history->data->submissions as $sub){
|
||||
if($contact->display == $sub->formdata->contact_id) {
|
||||
$contact->{$sub->formdata->brand_name} += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//echo '<pre>'; print_r($contacts); exit;
|
||||
@endphp
|
||||
|
||||
<div class="col-12">
|
||||
<div class="row mb-3">
|
||||
<label for="inputEmail3" class="col-4 col-xl-3 col-form-label">Selected Month</label>
|
||||
<div class="col-8 col-xl-9">
|
||||
<select class="form-control" id="month-selector">
|
||||
@foreach($months as $k => $v)
|
||||
<option value="{{$k}}" {{ $k==app('request')->input('month', '')?'selected':'' }} >{{$v}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-12" id="table-wrapper">
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
|
||||
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
<th>Doctor</th>
|
||||
<th>Powerof5 ?</th>
|
||||
<th>Tiova</th>
|
||||
<th>Duova</th>
|
||||
<th>Triohale</th>
|
||||
<th>Nistami</th>
|
||||
<th>Glycohale FB</th>
|
||||
<th>Maxiflo</th>
|
||||
<th>Maxiflo SB</th>
|
||||
<th>Tiova Synchrobreathe</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($contacts as $contact)
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-info add-btn" doc_id="{{$contact->contact->id}}"><i class="mdi mdi-pencil"></i> Add</button>
|
||||
</td>
|
||||
<td><h5 class="m-0 fw-normal">{{$contact->display}}</h5></td>
|
||||
<td>{{isset($contact->contact->powerof5) ? $contact->contact->powerof5 : 'No'}}</td>
|
||||
<td>{{$contact->tiova}}</td>
|
||||
<td>{{$contact->duova}}</td>
|
||||
<td>{{$contact->triohale}}</td>
|
||||
<td>{{$contact->nistami}}</td>
|
||||
<td>{{$contact->glycohale_fb}}</td>
|
||||
<td>{{$contact->maxiflo}}</td>
|
||||
<td>{{$contact->maxiflo_sb}}</td>
|
||||
<td>{{$contact->tiova_synchrobreathe}}</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="form-wrapper">
|
||||
<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
|
||||
@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
|
||||
@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
|
||||
@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>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</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($){
|
||||
let powerof5 = {}
|
||||
@foreach($contacts as $contact)
|
||||
powerof5['{{$contact->value}}'] = '{{isset($contact->contact->powerof5) ? $contact->contact->powerof5 : 'No'}}'
|
||||
@endforeach
|
||||
$('#form-wrapper').hide()
|
||||
$('.add-btn').click(function(){
|
||||
$('#field-contact_id').val( $(this).attr('doc_id') )
|
||||
$('#form-wrapper').show()
|
||||
$('#table-wrapper').hide()
|
||||
})
|
||||
|
||||
console.log(document.location.href)
|
||||
$('#month-selector').change(function() {
|
||||
$("#pageloader").fadeIn();
|
||||
let href = new URL(document.location.href);
|
||||
console.log(href)
|
||||
href.searchParams.set('month', $('#month-selector').val() );
|
||||
window.location.href = href.toString()
|
||||
});
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#report-form').append('<input type="hidden" name="'+ $('#field-brand_name').val() +'" value="1">')
|
||||
if(powerof5[$('#field-contact_id').val()] == 'Yes') {
|
||||
$('#report-form').append('<input type="hidden" name="powerof5_'+ $('#field-brand_name').val() +'" value="1">')
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
window.location.reload();
|
||||
//$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
<!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/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)
|
||||
@if($question->code == 'contact_id')
|
||||
@php
|
||||
$options = [];
|
||||
foreach($question->options as $ops) {
|
||||
if(!isset($ops->contact->type)) {
|
||||
$options[] = $ops;
|
||||
}
|
||||
}
|
||||
$question->options = $options;
|
||||
@endphp
|
||||
@endif
|
||||
|
||||
@if($question->code == 'stockist_name')
|
||||
@php
|
||||
$options = [];
|
||||
foreach($question->options as $ops) {
|
||||
if(isset($ops->contact->type) && $ops->contact->type == 'Stokiest') {
|
||||
$options[] = $ops;
|
||||
}
|
||||
}
|
||||
$question->options = $options;
|
||||
@endphp
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'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}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@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>
|
||||
@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($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
$('#field-total_pob_strips').prop('readonly',true)
|
||||
$('#field-emildap_trio_chemist_avail,#field-exduo_50_chemist_avail,#field-exduo_100_chemist_avail,#field-exduo_200_chemist_avail').change(function(){
|
||||
$('#field-total_pob_strips').val( parseInt($('#field-emildap_trio_chemist_avail').val() ) + parseInt($('#field-exduo_50_chemist_avail').val()) + parseInt($('#field-exduo_100_chemist_avail').val()) + parseInt($('#field-exduo_200_chemist_avail').val()) )
|
||||
})
|
||||
|
||||
$('#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'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
<!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/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)
|
||||
@if($question->code == 'contact_id')
|
||||
@php
|
||||
$options = [];
|
||||
foreach($question->options as $ops) {
|
||||
if(!isset($ops->contact->type)) {
|
||||
$options[] = $ops;
|
||||
}
|
||||
}
|
||||
$question->options = $options;
|
||||
@endphp
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'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}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@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>
|
||||
@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($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#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'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
<!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/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)
|
||||
@if($question->code == 'contact_id')
|
||||
@php
|
||||
$options = [];
|
||||
foreach($question->options as $ops) {
|
||||
if(isset($ops->contact->type) && $ops->contact->type == 'Stokiest') {
|
||||
$options[] = $ops;
|
||||
}
|
||||
}
|
||||
$question->options = $options;
|
||||
@endphp
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'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}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@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>
|
||||
@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($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#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'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
<!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/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)
|
||||
@if($question->code == 'contact_id')
|
||||
@php
|
||||
$options = [];
|
||||
foreach($question->options as $ops) {
|
||||
if(!isset($ops->contact->type)) {
|
||||
$options[] = $ops;
|
||||
}
|
||||
}
|
||||
$question->options = $options;
|
||||
@endphp
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'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}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@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>
|
||||
@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($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#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'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,325 @@
|
|||
<!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> -->
|
||||
<button type="button" class="btn btn-primary btn-xs" id="add-camp-btn">Add Plan</button>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
||||
@endphp
|
||||
|
||||
<div class="col-md-12" id="table-wrapper">
|
||||
<div class="card">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover table-nowrap table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
<th>Execution Done</th>
|
||||
<th>Plan Date</th>
|
||||
<th>Team Name</th>
|
||||
<th>Type of meeting</th>
|
||||
<th>Execution Date</th>
|
||||
<th>Name of speaker</th>
|
||||
<th>MSL Code</th>
|
||||
<th>No. og Doctors/Paramedics attended</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($history->data->submissions as $sub)
|
||||
@php
|
||||
$sub->formdata->id = $sub->id;
|
||||
@endphp
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-info edit-btn" plan_details="{{json_encode($sub->formdata)}}"><i class="mdi mdi-pencil"></i> Edit</button>
|
||||
</td>
|
||||
<td>{{(isset($sub->formdata->record_date) && $sub->formdata->record_date > 0) ?'Yes':'No' }}</td>
|
||||
<td>{{$sub->formdata->plan_date}}</td>
|
||||
<td>{{$sub->formdata->team_name}}</td>
|
||||
<td>{{$sub->formdata->type_of_meeting}}</td>
|
||||
<td>{{$sub->formdata->record_date}}</td>
|
||||
<td>{{$sub->formdata->name_of_the_speaker}}</td>
|
||||
<td>{{$sub->formdata->msl_code}}</td>
|
||||
<td>{{$sub->formdata->attendence}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="report-form">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@foreach($questions as $question)
|
||||
@if(in_array($question->code, ['record_date','name_of_the_speaker','msl_code', 'attendence']))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('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
|
||||
@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>
|
||||
|
||||
|
||||
<div id="execution-form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="execution-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
<input type="hidden" name="id" value="" id="execution-id">
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{$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="execution-{{$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="execution-{{$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="execution-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="execution-{{$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="execution-{{$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="execution-{{$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="execution-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="execution-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png">
|
||||
@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>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</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">
|
||||
const slugify = str =>
|
||||
str
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/[^\w\s-]/g, '')
|
||||
.replace(/[\s_-]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '');
|
||||
|
||||
$('#form-wrapper').hide()
|
||||
$('#execution-form-wrapper').hide()
|
||||
|
||||
$('#add-camp-btn').click(function(){
|
||||
$('#form-wrapper').show()
|
||||
$('#table-wrapper').hide()
|
||||
$('#execution-form-wrapper').hide()
|
||||
})
|
||||
|
||||
$('.edit-btn').click(function(){
|
||||
let selected = JSON.parse($(this).attr('plan_details'))
|
||||
for(let k of Object.keys(selected)) {
|
||||
if(selected[k] != '')
|
||||
$('#execution-'+k).val(selected[k]);
|
||||
}
|
||||
$('#execution-id').val(selected['id'])
|
||||
$('#form-wrapper').hide()
|
||||
$('#execution-form-wrapper').show()
|
||||
$('#table-wrapper').hide()
|
||||
})
|
||||
|
||||
jQuery(document).ready(function($){
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#report-form').append('<input type="hidden" name="'+ slugify($('#field-type_of_meeting').val()) +'" value="1">')
|
||||
$('#execution-form').append('<input type="hidden" name="'+ slugify($('#execution-type_of_meeting').val()) +'" value="1">')
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
window.location.reload();
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('#execution-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#execution-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'
|
||||
})
|
||||
window.location.reload();
|
||||
//$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,325 @@
|
|||
<!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> -->
|
||||
<button type="button" class="btn btn-primary btn-xs" id="add-camp-btn">Add Plan</button>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
||||
@endphp
|
||||
|
||||
<div class="col-md-12" id="table-wrapper">
|
||||
<div class="card">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover table-nowrap table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
<th>Execution Done</th>
|
||||
<th>Plan Date</th>
|
||||
<th>Team Name</th>
|
||||
<th>Type of meeting</th>
|
||||
<th>Execution Date</th>
|
||||
<th>Name of speaker</th>
|
||||
<th>MSL Code</th>
|
||||
<th>No. og Doctors/Paramedics attended</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($history->data->submissions as $sub)
|
||||
@php
|
||||
$sub->formdata->id = $sub->id;
|
||||
@endphp
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-info edit-btn" plan_details="{{json_encode($sub->formdata)}}"><i class="mdi mdi-pencil"></i> Edit</button>
|
||||
</td>
|
||||
<td>{{(isset($sub->formdata->record_date) && $sub->formdata->record_date > 0) ?'Yes':'No' }}</td>
|
||||
<td>{{$sub->formdata->plan_date}}</td>
|
||||
<td>{{$sub->formdata->team_name}}</td>
|
||||
<td>{{$sub->formdata->type_of_meeting}}</td>
|
||||
<td>{{$sub->formdata->record_date}}</td>
|
||||
<td>{{$sub->formdata->name_of_the_speaker}}</td>
|
||||
<td>{{$sub->formdata->msl_code}}</td>
|
||||
<td>{{$sub->formdata->attendence}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="report-form">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@foreach($questions as $question)
|
||||
@if(in_array($question->code, ['record_date','name_of_the_speaker','msl_code', 'attendence']))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('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
|
||||
@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>
|
||||
|
||||
|
||||
<div id="execution-form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="execution-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
<input type="hidden" name="id" value="" id="execution-id">
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{$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="execution-{{$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="execution-{{$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="execution-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="execution-{{$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="execution-{{$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="execution-{{$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="execution-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="execution-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png">
|
||||
@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>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</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">
|
||||
const slugify = str =>
|
||||
str
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/[^\w\s-]/g, '')
|
||||
.replace(/[\s_-]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '');
|
||||
|
||||
$('#form-wrapper').hide()
|
||||
$('#execution-form-wrapper').hide()
|
||||
|
||||
$('#add-camp-btn').click(function(){
|
||||
$('#form-wrapper').show()
|
||||
$('#table-wrapper').hide()
|
||||
$('#execution-form-wrapper').hide()
|
||||
})
|
||||
|
||||
$('.edit-btn').click(function(){
|
||||
let selected = JSON.parse($(this).attr('plan_details'))
|
||||
for(let k of Object.keys(selected)) {
|
||||
if(selected[k] != '')
|
||||
$('#execution-'+k).val(selected[k]);
|
||||
}
|
||||
$('#execution-id').val(selected['id'])
|
||||
$('#form-wrapper').hide()
|
||||
$('#execution-form-wrapper').show()
|
||||
$('#table-wrapper').hide()
|
||||
})
|
||||
|
||||
jQuery(document).ready(function($){
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#report-form').append('<input type="hidden" name="'+ slugify($('#field-type_of_meeting').val()) +'" value="1">')
|
||||
$('#execution-form').append('<input type="hidden" name="'+ slugify($('#execution-type_of_meeting').val()) +'" value="1">')
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
window.location.reload();
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('#execution-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#execution-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'
|
||||
})
|
||||
window.location.reload();
|
||||
//$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,325 @@
|
|||
<!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> -->
|
||||
<button type="button" class="btn btn-primary btn-xs" id="add-camp-btn">Add Plan</button>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
||||
@endphp
|
||||
|
||||
<div class="col-md-12" id="table-wrapper">
|
||||
<div class="card">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover table-nowrap table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
<th>Execution Done</th>
|
||||
<th>Plan Date</th>
|
||||
<th>Team Name</th>
|
||||
<th>Type of meeting</th>
|
||||
<th>Execution Date</th>
|
||||
<th>Name of speaker</th>
|
||||
<th>MSL Code</th>
|
||||
<th>No. og Doctors/Paramedics attended</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($history->data->submissions as $sub)
|
||||
@php
|
||||
$sub->formdata->id = $sub->id;
|
||||
@endphp
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-info edit-btn" plan_details="{{json_encode($sub->formdata)}}"><i class="mdi mdi-pencil"></i> Edit</button>
|
||||
</td>
|
||||
<td>{{(isset($sub->formdata->record_date) && $sub->formdata->record_date > 0) ?'Yes':'No' }}</td>
|
||||
<td>{{$sub->formdata->plan_date}}</td>
|
||||
<td>{{$sub->formdata->team_name}}</td>
|
||||
<td>{{$sub->formdata->type_of_meeting}}</td>
|
||||
<td>{{$sub->formdata->record_date}}</td>
|
||||
<td>{{$sub->formdata->name_of_the_speaker}}</td>
|
||||
<td>{{$sub->formdata->msl_code}}</td>
|
||||
<td>{{$sub->formdata->attendence}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="report-form">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@foreach($questions as $question)
|
||||
@if(in_array($question->code, ['record_date','name_of_the_speaker','msl_code', 'attendence']))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('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
|
||||
@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>
|
||||
|
||||
|
||||
<div id="execution-form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="execution-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
<input type="hidden" name="id" value="" id="execution-id">
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{$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="execution-{{$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="execution-{{$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="execution-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="execution-{{$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="execution-{{$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="execution-{{$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="execution-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="execution-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png">
|
||||
@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>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</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">
|
||||
const slugify = str =>
|
||||
str
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/[^\w\s-]/g, '')
|
||||
.replace(/[\s_-]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '');
|
||||
|
||||
$('#form-wrapper').hide()
|
||||
$('#execution-form-wrapper').hide()
|
||||
|
||||
$('#add-camp-btn').click(function(){
|
||||
$('#form-wrapper').show()
|
||||
$('#table-wrapper').hide()
|
||||
$('#execution-form-wrapper').hide()
|
||||
})
|
||||
|
||||
$('.edit-btn').click(function(){
|
||||
let selected = JSON.parse($(this).attr('plan_details'))
|
||||
for(let k of Object.keys(selected)) {
|
||||
if(selected[k] != '')
|
||||
$('#execution-'+k).val(selected[k]);
|
||||
}
|
||||
$('#execution-id').val(selected['id'])
|
||||
$('#form-wrapper').hide()
|
||||
$('#execution-form-wrapper').show()
|
||||
$('#table-wrapper').hide()
|
||||
})
|
||||
|
||||
jQuery(document).ready(function($){
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#report-form').append('<input type="hidden" name="'+ slugify($('#field-type_of_meeting').val()) +'" value="1">')
|
||||
$('#execution-form').append('<input type="hidden" name="'+ slugify($('#execution-type_of_meeting').val()) +'" value="1">')
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
window.location.reload();
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('#execution-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#execution-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'
|
||||
})
|
||||
window.location.reload();
|
||||
//$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,318 @@
|
|||
<!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> -->
|
||||
<button type="button" class="btn btn-primary btn-xs" id="add-camp-btn">Add Plan</button>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
||||
@endphp
|
||||
|
||||
<div class="col-md-12" id="table-wrapper">
|
||||
<div class="card">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover table-nowrap table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
<th>Execution Done</th>
|
||||
<th>Tour</th>
|
||||
<th>Plan Date</th>
|
||||
<th>Execution Date</th>
|
||||
<th>Total POB</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($history->data->submissions as $sub)
|
||||
@php
|
||||
$sub->formdata->id = $sub->id;
|
||||
@endphp
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-info edit-btn" plan_details="{{json_encode($sub->formdata)}}"><i class="mdi mdi-pencil"></i> Edit</button>
|
||||
</td>
|
||||
<td>{{(isset($sub->formdata->record_date) && $sub->formdata->record_date > 0) ?'Yes':'No' }}</td>
|
||||
<td>{{$sub->formdata->tour}}</td>
|
||||
<td>{{$sub->formdata->plan_date}}</td>
|
||||
<td>{{$sub->formdata->record_date}}</td>
|
||||
<td>{{$sub->formdata->total_pob}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="report-form">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@foreach($questions as $question)
|
||||
@if(in_array($question->code, ['record_date','total_pob']))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('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
|
||||
@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>
|
||||
|
||||
|
||||
<div id="execution-form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="execution-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
<input type="hidden" name="id" value="" id="execution-id">
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{$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="execution-{{$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="execution-{{$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="execution-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="execution-{{$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="execution-{{$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="execution-{{$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="execution-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="execution-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png">
|
||||
@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>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</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">
|
||||
const slugify = str =>
|
||||
str
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/[^\w\s-]/g, '')
|
||||
.replace(/[\s_-]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '');
|
||||
|
||||
$('#form-wrapper').hide()
|
||||
$('#execution-form-wrapper').hide()
|
||||
|
||||
$('#add-camp-btn').click(function(){
|
||||
$('#form-wrapper').show()
|
||||
$('#table-wrapper').hide()
|
||||
$('#execution-form-wrapper').hide()
|
||||
})
|
||||
|
||||
$('.edit-btn').click(function(){
|
||||
let selected = JSON.parse($(this).attr('plan_details'))
|
||||
for(let k of Object.keys(selected)) {
|
||||
if(selected[k] != '')
|
||||
$('#execution-'+k).val(selected[k]);
|
||||
}
|
||||
$('#execution-id').val(selected['id'])
|
||||
$('#form-wrapper').hide()
|
||||
$('#execution-form-wrapper').show()
|
||||
$('#table-wrapper').hide()
|
||||
})
|
||||
|
||||
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'
|
||||
})
|
||||
window.location.reload();
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('#execution-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#execution-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'
|
||||
})
|
||||
window.location.reload();
|
||||
//$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,201 @@
|
|||
<!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/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)
|
||||
<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
|
||||
@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}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@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>
|
||||
@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($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#report-form').append('<input type="hidden" name="'+ $('#field-brand').val() +'" value="'+ $('#field-current_business_value').val() +'">')
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,216 @@
|
|||
<!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/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)
|
||||
<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
|
||||
@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}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@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>
|
||||
@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">
|
||||
const slugify = str =>
|
||||
str
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/[^\w\s-]/g, '')
|
||||
.replace(/[\s_-]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '');
|
||||
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
|
||||
$('#report-form input').each(function(index){
|
||||
if (!isNaN( $(this).val() ) && parseInt($(this).val()) > 0 ) {
|
||||
$('#report-form').append('<input type="hidden" name="'+ $(this).attr('name') +'_conversion" value="1">')
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -15,7 +15,6 @@
|
|||
<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') }}
|
||||
|
|
@ -39,6 +38,18 @@
|
|||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && (bool)$form->manager_can_submit)
|
||||
<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)
|
||||
<div class="col-md-12 mb-2" id="wrapper-{{$question->code}}">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
|
|
@ -122,11 +133,17 @@
|
|||
jQuery(document).ready(function($){
|
||||
$('#report-form input').parent().find('.col-md-12').hide()
|
||||
$('#field-customer_type').parent().show()
|
||||
$('#field-user_id').parent().show()
|
||||
|
||||
$('#field-pob_arni_50mg,#field-pob_arni_100mg,#field-pob_arni_200mg').change(function(){
|
||||
$('#field-pob_total').val( parseInt($('#field-pob_arni_50mg').val()) + parseInt($('#field-pob_arni_100mg').val()) + parseInt($('#field-pob_arni_200mg').val()) )
|
||||
})
|
||||
|
||||
$('#field-customer_type').change(function(){
|
||||
$('#report-form input').parent().find('.col-md-12').hide()
|
||||
$('#field-customer_type').parent().show()
|
||||
console.log($(this).val())
|
||||
$('#field-user_id').parent().show()
|
||||
|
||||
if($(this).val() == 'Doctor') {
|
||||
$('#field-doctor_name').parent().show()
|
||||
$('#field-brand_selected').parent().show()
|
||||
|
|
@ -148,6 +165,25 @@
|
|||
$('#report-form input:visible').prop('required',true)
|
||||
})
|
||||
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-doctor_name').html('')
|
||||
$('#field-doctor_name').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-doctor_name').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,222 @@
|
|||
<!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/submit" id="report-form">
|
||||
<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) && (bool)$form->manager_can_submit)
|
||||
<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)
|
||||
<div class="col-md-12 mb-2" id="wrapper-{{$question->code}}">
|
||||
<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')
|
||||
<div id="field-{{$question->code}}"></div>
|
||||
@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
|
||||
@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 input').parent().find('.col-md-12').hide()
|
||||
$('#field-customer_type').parent().show()
|
||||
$('#field-user_id').parent().show()
|
||||
|
||||
$('#field-pob_arni_50mg,#field-pob_arni_100mg,#field-pob_arni_200mg').change(function(){
|
||||
$('#field-pob_total').val( parseInt($('#field-pob_arni_50mg').val()) + parseInt($('#field-pob_arni_100mg').val()) + parseInt($('#field-pob_arni_200mg').val()) )
|
||||
})
|
||||
|
||||
$('#field-customer_type').change(function(){
|
||||
$('#report-form input').parent().find('.col-md-12').hide()
|
||||
$('#field-customer_type').parent().show()
|
||||
$('#field-user_id').parent().show()
|
||||
|
||||
if($(this).val() == 'Doctor') {
|
||||
$('#field-contact_id').parent().show()
|
||||
$('#field-msl_code').parent().show()
|
||||
$('#field-contact_id').prop('required',true)
|
||||
$('#field-rx_arnicode_50mg').parent().show()
|
||||
$('#field-rx_arnicode_100mg').parent().show()
|
||||
$('#field-rx_arnicode_200mg').parent().show()
|
||||
} else {
|
||||
$('#field-retailer_name').parent().show()
|
||||
$('#field-pob_arni_50mg').parent().show()
|
||||
$('#field-pob_arni_100mg').parent().show()
|
||||
$('#field-pob_arni_200mg').parent().show()
|
||||
$('#field-pob_total').parent().show()
|
||||
$('#field-contact_id').removeAttr('required')
|
||||
}
|
||||
$('#field-record_date').parent().show()
|
||||
$('#report-form input').removeAttr('required')
|
||||
$('#report-form input:visible').prop('required',true)
|
||||
})
|
||||
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-doctor_name').html('')
|
||||
$('#field-doctor_name').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-doctor_name').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
if($('#field-customer_type').val() == 'Retailer') {
|
||||
$('#report-form').append('<input type="hidden" name="retailer_count" value="1">')
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -93,6 +93,7 @@
|
|||
<div class="col-12">
|
||||
<div class="button-list">
|
||||
<div class="text-center" dir="ltr">
|
||||
<a href="/campaign/dashboard?id={{$campaign->id}}" class="btn btn-soft-blue btn-rounded">Dashboard</a>
|
||||
<a href="/campaign/report?id={{$campaign->id}}" class="btn btn-soft-blue btn-rounded">Detail View</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -29,9 +29,8 @@
|
|||
|
||||
<!--- Sidemenu -->
|
||||
<div id="sidebar-menu">
|
||||
|
||||
<ul id="side-menu">
|
||||
<li class="menu-title">User Management</li>
|
||||
<li class="menu-title">Domain: {{auth()->user()->domain}}</li>
|
||||
<li>
|
||||
<a href="/">
|
||||
<i data-feather="airplay"></i>
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@
|
|||
<th>Designation</th>
|
||||
<th>Total</th>
|
||||
<!-- <th>Percent</th> -->
|
||||
<th>User Count</th>
|
||||
<th>Active User</th>
|
||||
@foreach($graph->metrics as $val)
|
||||
<th>{{$val->display}}</th>
|
||||
@endforeach
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<div class="col-12">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
|
||||
|
|
@ -78,6 +78,14 @@
|
|||
</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
|
||||
@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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,192 @@
|
|||
<!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-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)
|
||||
<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" id="field-{{$question->code}}">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('radio')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check" 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':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@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}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@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>
|
||||
@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 .col-md-12').hide()
|
||||
$('#report-form input').removeAttr('required')
|
||||
$('#field-record_region').parent().show()
|
||||
$('#field-record_subject_type').parent().show()
|
||||
|
||||
$('#field-record_subject_type').change(function(){
|
||||
$('#report-form .col-md-12').hide()
|
||||
$('#report-form input').removeAttr('required')
|
||||
$('#field-record_region').parent().show()
|
||||
$('#field-record_subject_type').parent().show()
|
||||
$("[id^='field-" + $(this).val() + "_" + "']").parent().show()
|
||||
})
|
||||
|
||||
$('#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>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -184,13 +184,13 @@
|
|||
}
|
||||
});
|
||||
|
||||
@if($mode=='edit' && ($fields['type'] == 'dropdown' || $fields['type'] == 'checkbox' || $fields['type'] == 'radio' || $fields['type'] == 'multitextbox' ))
|
||||
@if($mode=='edit' && ($fields['type'] == 'dropdown' || $fields['type'] == 'checkbox' || $fields['type'] == 'radio' || $fields['type'] == 'radiometrix' || $fields['type'] == 'multitextbox' ))
|
||||
$('#field-wrapper-options').show();
|
||||
@else
|
||||
$('#field-wrapper-options').hide();
|
||||
@endif
|
||||
$('#field-type').change(function(){
|
||||
if($(this).val() == 'dropdown' || $(this).val() == 'checkbox' || $(this).val() == 'radio' || $(this).val() == 'multitextbox' ) {
|
||||
if($(this).val() == 'dropdown' || $(this).val() == 'checkbox' || $(this).val() == 'radiometrix' || $(this).val() == 'radio' || $(this).val() == 'multitextbox' ) {
|
||||
$('#field-wrapper-options').show();
|
||||
} else {
|
||||
$('#field-wrapper-options').hide();
|
||||
|
|
|
|||
Loading…
Reference in New Issue