chore: remove APAW from tracking; gitignore agent-generated files
This commit is contained in:
26
resources/views/form_data/file_view.blade.php
Normal file
26
resources/views/form_data/file_view.blade.php
Normal file
@@ -0,0 +1,26 @@
|
||||
@php
|
||||
$datas = implode(',', $form_upload);
|
||||
$files = explode(',', $datas);
|
||||
@endphp
|
||||
@foreach($files as $file)
|
||||
@php
|
||||
$url = Storage::url(config('constants.doc_path').'/'.$file);
|
||||
$path = public_path('uploads/'.config('constants.doc_path').'/'.$file);
|
||||
@endphp
|
||||
@if(file_exists($path))
|
||||
@php
|
||||
$media = explode('_', $file, 2);
|
||||
$file_name = !empty($media[1]) ? $media[1]: $media[0];
|
||||
@endphp
|
||||
@if(in_array(mime_content_type($path), ['image/jpeg', 'image/png', 'image/webp']))
|
||||
<a target="_blank" href="{{$url}}" download="{{$file_name}}">
|
||||
<img src="{{$url}}" alt="{{$file_name}}" style="width:100px;height: 90px;object-fit: contain;max-width: 100%;">
|
||||
</a>
|
||||
@else
|
||||
<a target="_blank" href="{{$url}}" download="{{$file_name}}">
|
||||
{{$file_name}}
|
||||
</a>
|
||||
@endif
|
||||
<br>
|
||||
@endif
|
||||
@endforeach
|
||||
22
resources/views/form_data/partials/comment.blade.php
Normal file
22
resources/views/form_data/partials/comment.blade.php
Normal file
@@ -0,0 +1,22 @@
|
||||
@foreach($comments as $comment)
|
||||
<div class="direct-chat-msg">
|
||||
<div class="direct-chat-info clearfix">
|
||||
<span class="direct-chat-name pull-left">
|
||||
{{$comment->commentedBy->name}}
|
||||
</span>
|
||||
<span class="direct-chat-timestamp pull-right">
|
||||
{{\Carbon\Carbon::parse($comment->created_at)->isoFormat("D/M/YY HH:mm A")}}
|
||||
</span>
|
||||
</div>
|
||||
<!-- /.direct-chat-info -->
|
||||
<img class="direct-chat-img" src="https://ui-avatars.com/api/?name={{$comment->commentedBy->name}}">
|
||||
<!-- /.direct-chat-img -->
|
||||
<div class="direct-chat-text">
|
||||
{!! $comment->comment !!}
|
||||
@if(Auth::user()->id == $comment->user_id)
|
||||
<i class="delete-comment fa fa-trash float-right text-danger cursor-pointer" data-comment_id="{{$comment->id}}" data-form_data_id="{{$comment->form_data_id}}"></i>
|
||||
@endif
|
||||
</div>
|
||||
<!-- /.direct-chat-text -->
|
||||
</div>
|
||||
@endforeach
|
||||
75
resources/views/form_data/partials/form_data_pdf.blade.php
Normal file
75
resources/views/form_data/partials/form_data_pdf.blade.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{ucFirst($form_data->form->name)}}</title>
|
||||
<style type="text/css">
|
||||
th, td {
|
||||
padding: 15px;
|
||||
text-align: left;
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="width: 100% !important;text-align: center;margin-bottom: 20px;">
|
||||
@if(!empty($pdf_header))
|
||||
{!! $pdf_header !!}
|
||||
@else
|
||||
<div style="width: 50% !important;">
|
||||
<h3>
|
||||
{{ucFirst($form_data->form->name)}}
|
||||
@if(!empty($form_data->submittedBy))
|
||||
<small>
|
||||
(
|
||||
@lang('messages.submitted_by'):
|
||||
{{$form_data->submittedBy->name}}
|
||||
)
|
||||
</small>
|
||||
@endif
|
||||
</h3>
|
||||
</div>
|
||||
<div style="width: 50% !important;">
|
||||
@if(isset($form_data->form->schema['settings']['form_submision_ref']['is_enabled']) && $form_data->form->schema['settings']['form_submision_ref']['is_enabled'] && !empty($form_data->submission_ref))
|
||||
<b>@lang('messages.submission_numbering'):</b>
|
||||
{{$form_data->submission_ref}}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<table style="width:100%">
|
||||
<tbody>
|
||||
@foreach($form_data->form->schema['form'] as $element)
|
||||
@isset($form_data->data[$element['name']])
|
||||
<tr>
|
||||
<td style="width: 50% !important;">
|
||||
<strong>{{$element['label']}}</strong>
|
||||
</td>
|
||||
<td style="width: 50% !important;">
|
||||
@if($element['type'] == 'file_upload')
|
||||
@include('form_data.file_view', ['form_upload' => $form_data->data[$element['name']]])
|
||||
@elseif($element['type'] == 'signature')
|
||||
@if(!empty($form_data->data[$element['name']]))
|
||||
<a target="_blank" href="{{$form_data->data[$element['name']]}}"
|
||||
download="Signature">
|
||||
<img src="{{$form_data->data[$element['name']]}}" class="signature">
|
||||
</a>
|
||||
@endif
|
||||
@elseif(is_array($form_data->data[$element['name']]) && $element['type'] != 'file_upload')
|
||||
|
||||
{{implode(', ', $form_data->data[$element['name']])}}
|
||||
|
||||
@else
|
||||
{!! nl2br($form_data->data[$element['name']]) !!}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endisset
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
69
resources/views/form_data/partials/submission_msg.blade.php
Normal file
69
resources/views/form_data/partials/submission_msg.blade.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Запускаем обратный отсчет
|
||||
var timeLeft = 3;
|
||||
var countdown = setInterval(function() {
|
||||
timeLeft--;
|
||||
$('#countdown').text(timeLeft);
|
||||
|
||||
// Если обратный отсчет закончился, закрываем вкладку
|
||||
if (timeLeft <= 0) {
|
||||
clearInterval(countdown);
|
||||
window.close();
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
</script>
|
||||
<div class="row">
|
||||
<div class="col-md-6 offset-md-3 text-center mt-3">
|
||||
<div class="alert alert-success">
|
||||
<h5>
|
||||
<i class="far fa-check-circle"></i>
|
||||
{!!$form->schema['settings']['notification']['success_msg']!!}
|
||||
<span id="countdown">3</span>
|
||||
</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
@if(isset($data['sub_ref_qr_code']) && !empty($data['sub_ref_qr_code']))
|
||||
<div class="col-md-4 text-center">
|
||||
<img src="{!!$data['sub_ref_qr_code']!!}"
|
||||
alt="{{$form->name}} Ref Num Qr Code"
|
||||
style="padding: 2.5rem;"/>
|
||||
<a href="{!!$data['sub_ref_qr_code']!!}"
|
||||
class="btn btn-outline-primary btn-block mt-2"
|
||||
role="button"
|
||||
download="{{$form->name}} Ref Num Qr Code">
|
||||
<i class="far fa-arrow-alt-circle-down fa-fw fa-lg"></i>
|
||||
{{__('messages.download_qr_code')}}
|
||||
</a>
|
||||
</div>
|
||||
@elseif(isset($data['sub_ref_bar_code']) && !empty($data['sub_ref_bar_code']))
|
||||
<div class="col-md-4 text-center">
|
||||
<img src="{!!$data['sub_ref_bar_code']!!}" alt="{{$form->name}} Ref Num Bar Code"
|
||||
style="padding: 2.5rem;"/>
|
||||
<a href="{!!$data['sub_ref_bar_code']!!}"
|
||||
class="btn btn-outline-primary btn-block mt-2"
|
||||
role="button"
|
||||
download="{{$form->name}} Ref Num Bar Code">
|
||||
<i class="far fa-arrow-alt-circle-down fa-fw fa-lg"></i>
|
||||
{{__('messages.download_bar_code')}}
|
||||
</a>
|
||||
</div>
|
||||
@elseif(!in_array($form->schema['settings']['notification']['post_submit_action'], ['redirect']) &&
|
||||
isset($form->schema['settings']['is_qr_code_enabled']) &&
|
||||
$form->schema['settings']['is_qr_code_enabled'])
|
||||
<div class="col-md-4 text-center">
|
||||
<div id="qrcode" style="padding: 1.2rem;"></div>
|
||||
<a href=""
|
||||
class="btn btn-outline-primary btn-block mt-2"
|
||||
role="button"
|
||||
download="{{$form->name}} Qr Code"
|
||||
id="download_qrcode">
|
||||
<i class="far fa-arrow-alt-circle-down fa-fw fa-lg"></i>
|
||||
{{__('messages.download_qr_code')}}
|
||||
</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
204
resources/views/form_data/report.blade.php
Normal file
204
resources/views/form_data/report.blade.php
Normal file
@@ -0,0 +1,204 @@
|
||||
@extends('layouts.app')
|
||||
@section('css')
|
||||
<style type="text/css">
|
||||
@page {
|
||||
size: A4 landscape;
|
||||
max-height:100%;
|
||||
max-width:100%;
|
||||
margin-top: 1.2cm;
|
||||
margin-bottom: 1.2cm;
|
||||
margin-left: 1cm;
|
||||
margin-right: 1cm;
|
||||
size: 210mm 287mm;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<h5>
|
||||
<i class="fab fa-wpforms"></i>
|
||||
@lang('messages.reports_for_form', ['form_name' => $form->name])
|
||||
</h5>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12">
|
||||
<div class="card card-outline card-info">
|
||||
<div class="card-header">
|
||||
<i class="fas fa-chart-line"></i>
|
||||
@lang('messages.analytics')
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row mb-5">
|
||||
<div class="col-md-12">
|
||||
<div id="visitors_chart"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div id="referrers_chart"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="card card-outline card-info">
|
||||
<div class="card-header">
|
||||
<i class="fas fa-chart-pie"></i>
|
||||
@lang('messages.reports')
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
@forelse($charts as $key => $chart)
|
||||
<div class="col-md-6 mb-5">
|
||||
<div id="{{$key}}"></div>
|
||||
</div>
|
||||
@empty
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-info" role="alert">
|
||||
@lang('messages.no_report_found')
|
||||
</div>
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
@section('footer')
|
||||
<script src="https://code.highcharts.com/highcharts.js"></script>
|
||||
<script src="https://code.highcharts.com/modules/exporting.js"></script>
|
||||
<script src="https://code.highcharts.com/modules/export-data.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
@if(!empty($charts))
|
||||
@foreach($charts as $key => $chart)
|
||||
@php
|
||||
$chart_data = [];
|
||||
foreach($chart['values'] as $label => $data) {
|
||||
$chart_data[]= ['name' => $label, 'y' => $data];
|
||||
}
|
||||
@endphp
|
||||
|
||||
//initializing highchart.js
|
||||
var high_chart_data = {!!json_encode($chart_data)!!};
|
||||
|
||||
Highcharts.chart('{{$key}}', {
|
||||
chart: {
|
||||
plotBackgroundColor: null,
|
||||
plotBorderWidth: null,
|
||||
plotShadow: true,
|
||||
type: 'pie',
|
||||
events: {
|
||||
beforePrint: function() {
|
||||
this.orgChartWidth = this.chartWidth;
|
||||
this.orgChartHeight = this.chartHeight;
|
||||
this.setSize(8500, this.orgChartHeight);
|
||||
},
|
||||
afterPrint: function() {
|
||||
this.setSize(this.orgChartWidth, this.orgChartHeight);
|
||||
}
|
||||
}
|
||||
},
|
||||
title: {
|
||||
text: '{{$chart["name"]}}'
|
||||
},
|
||||
tooltip: {
|
||||
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b> <i>({point.y})</i>'
|
||||
},
|
||||
plotOptions: {
|
||||
pie: {
|
||||
allowPointSelect: true,
|
||||
cursor: 'pointer',
|
||||
dataLabels: {
|
||||
enabled: true,
|
||||
format: '<b>{point.name}</b>: {point.percentage:.1f} % <i>({point.y})</i>'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '{{$chart["name"]}}',
|
||||
colorByPoint: true,
|
||||
data: high_chart_data
|
||||
}
|
||||
]
|
||||
});
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
//vistors chart
|
||||
Highcharts.chart('visitors_chart', {
|
||||
xAxis: {
|
||||
categories: {!!json_encode($visitors_chart['labels'])!!}
|
||||
},
|
||||
chart: {
|
||||
type: 'line',
|
||||
events: {
|
||||
beforePrint: function() {
|
||||
this.orgChartWidth = this.chartWidth;
|
||||
this.orgChartHeight = this.chartHeight;
|
||||
this.setSize(8500, this.orgChartHeight);
|
||||
},
|
||||
afterPrint: function() {
|
||||
this.setSize(this.orgChartWidth, this.orgChartHeight);
|
||||
}
|
||||
}
|
||||
},
|
||||
title: {
|
||||
text: "{{$visitors_chart['title']}}"
|
||||
},
|
||||
series: [{
|
||||
name: "{{$visitors_chart['total_visits_label']}}",
|
||||
data: {!!json_encode($visitors_chart['total_visits'])!!}
|
||||
}, {
|
||||
name: "{{$visitors_chart['unique_visits_label']}}",
|
||||
data: {!!json_encode($visitors_chart['unique_visits'])!!}
|
||||
}]
|
||||
});
|
||||
|
||||
//referrers chart
|
||||
Highcharts.chart('referrers_chart', {
|
||||
chart: {
|
||||
type: 'pie',
|
||||
events: {
|
||||
beforePrint: function() {
|
||||
this.orgChartWidth = this.chartWidth;
|
||||
this.orgChartHeight = this.chartHeight;
|
||||
this.setSize(8500, this.orgChartHeight);
|
||||
},
|
||||
afterPrint: function() {
|
||||
this.setSize(this.orgChartWidth, this.orgChartHeight);
|
||||
}
|
||||
}
|
||||
},
|
||||
title: {
|
||||
text: "{{$referrers_chart['name']}}"
|
||||
},
|
||||
tooltip: {
|
||||
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b> <i>({point.y})</i>'
|
||||
},
|
||||
plotOptions: {
|
||||
pie: {
|
||||
allowPointSelect: true,
|
||||
cursor: 'pointer',
|
||||
dataLabels: {
|
||||
enabled: true,
|
||||
format: '<b>{point.name}</b>: {point.percentage:.1f} % <i>({point.y})</i>'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "{{$referrers_chart['name']}}",
|
||||
colorByPoint: true,
|
||||
data: {!!json_encode($referrers_chart['values'])!!}
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
298
resources/views/form_data/show.blade.php
Normal file
298
resources/views/form_data/show.blade.php
Normal file
@@ -0,0 +1,298 @@
|
||||
@extends('layouts.app')
|
||||
@section('css')
|
||||
<style type="text/css">
|
||||
.no-print {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@media screen {
|
||||
#printSection {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
body * {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#printSection, #printSection * {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#printSection {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.no-print {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<div class="row justify-content-center no-print">
|
||||
<div class="col-md-12">
|
||||
@php
|
||||
$date_format = config('constants.APP_DATE_FORMAT');
|
||||
if (config('constants.APP_TIME_FORMAT') == '12') {
|
||||
$date_format .= ' h:i A';
|
||||
} else if (config('constants.APP_TIME_FORMAT') == '24') {
|
||||
$date_format .= ' H:i';
|
||||
} else {
|
||||
$date_format = 'm/d/Y h:i A';
|
||||
}
|
||||
@endphp
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{{$form->name}}
|
||||
</div>
|
||||
|
||||
<form action="{{ @route('form-data.show', ['id' => $form->id]) }}" class="form row mt-3 mx-2 mb-0">
|
||||
<div class="form-group mb-0 col-1">
|
||||
<input type="date" class="form-control" name="start_date" value="{{ request()->get('start_date') ?? \Carbon\Carbon::now()->subDays(7)->toDateString() }}">
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-0 col-1">
|
||||
<input type="date" class="form-control" name="end_date" value="{{ request()->get('end_date') ?? \Carbon\Carbon::now()->toDateString() }}">
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-0 col-2 d-flex">
|
||||
<button class="btn btn-primary mx-1" type="submit">@lang('messages.search_without_dots')</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@php
|
||||
$is_enabled_sub_ref_no = false;
|
||||
if(isset($form->schema['settings']['form_submision_ref']['is_enabled']) && $form->schema['settings']['form_submision_ref']['is_enabled']) {
|
||||
$is_enabled_sub_ref_no = true;
|
||||
}
|
||||
|
||||
@endphp
|
||||
<div class="tab-content card-body table-responsive" role="tabpanel">
|
||||
@if(!empty($form->schema))
|
||||
@php
|
||||
$schema = $form->schema['form'];
|
||||
$col_visible = $form['schema']['settings']['form_data']['col_visible'];
|
||||
$btn_enabled = $form['schema']['settings']['form_data']['btn_enabled'];
|
||||
@endphp
|
||||
<table class="table" id="submitted_data_table" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>@lang('messages.action')</th>
|
||||
|
||||
@if($is_enabled_sub_ref_no)
|
||||
<th>@lang('messages.submission_numbering')</th>
|
||||
@endif
|
||||
<th>@lang('messages.username')</th>
|
||||
@foreach($schema as $element)
|
||||
@if(in_array($element['name'], $col_visible))
|
||||
<th>
|
||||
{{$element['label']}}
|
||||
</th>
|
||||
@endif
|
||||
@endforeach
|
||||
<th>@lang('messages.submitted_on')</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach($data as $k => $row)
|
||||
<tr>
|
||||
<td>
|
||||
{{-- Кнопка просмотра для всех, у кого есть права --}}
|
||||
@if(in_array('view', $btn_enabled) && $has_permission)
|
||||
<button type="button" class="btn btn-info btn-sm view_form_data m-1"
|
||||
data-href="{{action([\App\Http\Controllers\FormDataController::class, 'viewData'], [$row->id])}}"
|
||||
data-toggle="modal">
|
||||
<i class="fa fa-eye" aria-hidden="true"></i>
|
||||
@lang('messages.view')
|
||||
</button>
|
||||
@endif
|
||||
|
||||
{{-- Кнопки только для админов/супервайзеров --}}
|
||||
@if(auth()->user()->hasRole([\App\Enums\User\RoleEnum::SUPERVISOR->value, \App\Enums\User\RoleEnum::ADMIN->value], 'web'))
|
||||
@if(in_array('delete', $btn_enabled))
|
||||
<button type="button"
|
||||
class="btn btn-danger btn-sm delete_form_data m-1"
|
||||
data-href="{{action([\App\Http\Controllers\FormDataController::class, 'destroy'], [$row->id])}}">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||
@lang('messages.delete')
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$form_id = !empty($form->slug) ? $form->slug : $form->id;
|
||||
@endphp
|
||||
<a class="btn btn-dark btn-sm m-1"
|
||||
href="{{action([\App\Http\Controllers\FormDataController::class, 'getEditformData'], ['slug' => $form_id,'id' => $row->id])}}">
|
||||
<i class="far fa-edit" aria-hidden="true"></i>
|
||||
@lang('messages.edit')
|
||||
</a>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
@if($is_enabled_sub_ref_no)
|
||||
<td>
|
||||
{{$row['submission_ref']}}
|
||||
</td>
|
||||
@endif
|
||||
|
||||
<td>{{ $row->submittedBy?->name }}</td>
|
||||
|
||||
@foreach($schema as $row_element)
|
||||
@if(in_array($row_element['name'], $col_visible))
|
||||
<td>
|
||||
@isset($row->data[$row_element['name']])
|
||||
@if($row_element['type'] == 'file_upload')
|
||||
|
||||
@include('form_data.file_view', ['form_upload' => $row->data[$row_element['name']]])
|
||||
@elseif($row_element['type'] == 'signature')
|
||||
@if(!empty($row->data[$row_element['name']]))
|
||||
<a target="_blank"
|
||||
href="{{$row->data[$row_element['name']]}}"
|
||||
download="Signature">
|
||||
<img src="{{$row->data[$row_element['name']]}}"
|
||||
class="signature">
|
||||
</a>
|
||||
@endif
|
||||
@elseif(is_array($row->data[$row_element['name']]) && $row_element['type'] != 'file_upload')
|
||||
{{implode(', ', $row->data[$row_element['name']])}}
|
||||
@else
|
||||
{!! nl2br($row->data[$row_element['name']]) !!}
|
||||
@endif
|
||||
|
||||
@endisset
|
||||
</td>
|
||||
@endif
|
||||
@endforeach
|
||||
<td>
|
||||
{{\Carbon\Carbon::createFromTimestamp(strtotime($row->updated_at))->format($date_format)}}
|
||||
<br/>
|
||||
<small>
|
||||
{{$row->updated_at->diffForHumans()}}
|
||||
</small>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@else
|
||||
<p>Form Not found</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('footer')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#submitted_data_table').DataTable({
|
||||
scrollY: "600px",
|
||||
scrollX: true,
|
||||
scrollCollapse: true,
|
||||
paging: true,
|
||||
fixedColumns: {
|
||||
leftColumns: 2
|
||||
}
|
||||
});
|
||||
// view form data
|
||||
$(document).on('click', '.view_form_data', function () {
|
||||
var url = $(this).data("href");
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
dataType: "html",
|
||||
url: url,
|
||||
success: function (result) {
|
||||
$("#modal_div").html(result).modal("show");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//delete form data
|
||||
$(document).on('click', '.delete_form_data', function () {
|
||||
var url = $(this).data("href");
|
||||
var result = confirm('Are You Sure?');
|
||||
if (result == true) {
|
||||
$.ajax({
|
||||
method: "DELETE",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
success: function (result) {
|
||||
if (result.success == true) {
|
||||
toastr.success(result.msg);
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 1000);
|
||||
} else {
|
||||
toastr.error(result.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//print form data on btn click
|
||||
$(document).on('click', '.formDataPrintBtn', function () {
|
||||
printElement(document.getElementById("print_form_data"));
|
||||
});
|
||||
|
||||
$("#modal_div").on('shown.bs.modal', function () {
|
||||
if ($("form#add_comment_form").length) {
|
||||
$("form#add_comment_form").validate();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('submit', 'form#add_comment_form', function (e) {
|
||||
e.preventDefault();
|
||||
var data = $("form#add_comment_form").serialize();
|
||||
var url = $("form#add_comment_form").attr('action');
|
||||
var ladda = Ladda.create(document.querySelector('.add_comment_btn'));
|
||||
ladda.start();
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: data,
|
||||
success: function (response) {
|
||||
ladda.stop();
|
||||
if (response.success) {
|
||||
$("#comment").val('');
|
||||
$('.direct-chat-messages').prepend(response.comment);
|
||||
toastr.success(response.msg);
|
||||
} else {
|
||||
toastr.error(response.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.delete-comment', function (e) {
|
||||
e.preventDefault();
|
||||
var element = $(this);
|
||||
var comment_id = $(this).data('comment_id');
|
||||
var form_data_id = $(this).data('form_data_id');
|
||||
if (confirm('Are you sure.?')) {
|
||||
$.ajax({
|
||||
method: 'DELETE',
|
||||
dataType: 'json',
|
||||
url: '/form-data-comment/' + comment_id + '?form_data_id=' + form_data_id,
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
toastr.success(response.msg);
|
||||
element.closest('.direct-chat-msg').remove();
|
||||
} else {
|
||||
toastr.error(response.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
113
resources/views/form_data/view_form_data.blade.php
Normal file
113
resources/views/form_data/view_form_data.blade.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<div class="modal-dialog modal-xl" role="document">
|
||||
<div class="modal-content" id="print_form_data">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">
|
||||
{{ucFirst($form_data->form->name)}}
|
||||
@if(!empty($form_data->submittedBy))
|
||||
<small>
|
||||
(
|
||||
<b>@lang('messages.submitted_by'): </b>
|
||||
{{$form_data->submittedBy->name}}
|
||||
)
|
||||
</small>
|
||||
@endif
|
||||
</h5>
|
||||
<button type="button" class="ml-auto btn btn-info no-print btn-sm formDataPrintBtn">
|
||||
<i class="fas fa-print"></i>
|
||||
@lang('messages.print')
|
||||
</button>
|
||||
<button type="button" class="close ml-0 no-print" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-6">
|
||||
@if(isset($form_data->form->schema['settings']['form_submision_ref']['is_enabled']) && $form_data->form->schema['settings']['form_submision_ref']['is_enabled'] && !empty($form_data->submission_ref))
|
||||
<b>@lang('messages.submission_numbering'):</b>
|
||||
{{$form_data->submission_ref}}
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-striped">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>@lang('messages.field')</th>
|
||||
<th>@lang('messages.value')</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($form_data->form->schema['form'] as $element)
|
||||
@isset($form_data->data[$element['name']])
|
||||
<tr>
|
||||
<td>
|
||||
<strong>{{$element['label']}}</strong>
|
||||
</td>
|
||||
<td>
|
||||
@if($element['type'] == 'file_upload')
|
||||
|
||||
@include('form_data.file_view', ['form_upload' => $form_data->data[$element['name']]])
|
||||
@elseif($element['type'] == 'signature')
|
||||
@if(!empty($form_data->data[$element['name']]))
|
||||
<a target="_blank" href="{{$form_data->data[$element['name']]}}"
|
||||
download="Signature">
|
||||
<img src="{{$form_data->data[$element['name']]}}" class="signature">
|
||||
</a>
|
||||
@endif
|
||||
@elseif(is_array($form_data->data[$element['name']]) && $element['type'] != 'file_upload')
|
||||
|
||||
{{implode(', ', $form_data->data[$element['name']])}}
|
||||
|
||||
@else
|
||||
{!! nl2br($form_data->data[$element['name']]) !!}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endisset
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="no-print mt-4">
|
||||
<hr>
|
||||
<form id="add_comment_form" action="{{action([\App\Http\Controllers\FormDataCommentController::class, 'store'])}}" method="POST">
|
||||
{{ csrf_field() }}
|
||||
<!-- hiden fields -->
|
||||
<input type="hidden" name="form_data_id" id="form_data_id" value="{{$form_data->id}}">
|
||||
<div class="form-group">
|
||||
<label for="comment">
|
||||
@lang('messages.comment'):
|
||||
</label>
|
||||
<textarea class="form-control" name="comment" id="comment" rows="3" required></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success add_comment_btn">
|
||||
@lang('messages.add_comment')
|
||||
</button>
|
||||
</form>
|
||||
<div class="row mt-5">
|
||||
<div class="col-md-12">
|
||||
<h5>
|
||||
<i class="fas fa-comments"></i>
|
||||
@lang('messages.comments')
|
||||
</h5>
|
||||
<div class="direct-chat-messages" style="max-height: 500px;height: auto;">
|
||||
@includeIf('form_data.partials.comment', ['comments' => $form_data->comments])
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer no-print">
|
||||
<button type="button" class="float-right m-1 btn btn-secondary btn-sm" data-dismiss="modal">
|
||||
@lang('messages.close')
|
||||
</button>
|
||||
<button type="button" class="float-right m-1 btn btn-info btn-sm formDataPrintBtn">
|
||||
<i class="fas fa-print"></i>
|
||||
@lang('messages.print')
|
||||
</button>
|
||||
<a class="btn float-right btn-primary btn-sm m-1" target="_blank" href="{{action([\App\Http\Controllers\FormDataController::class, 'downloadPdf'], [$form_data->id])}}">
|
||||
<i class="far fa-file-pdf" aria-hidden="true"></i>
|
||||
@lang('messages.download_pdf')
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user