263 lines
14 KiB
PHP
263 lines
14 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
@include('layouts.shared/title-meta', ['title' => "History"])
|
|
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
|
</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">
|
|
|
|
<!-- start page title -->
|
|
<div class="row">
|
|
<div class="col-8 p-2">
|
|
<h4 class="page-title">{{$formname}}</h4>
|
|
</div>
|
|
<div class="col-4 p-2">
|
|
<a href="/form/downloaddata?form_id={{$form_id}}" class="btn btn-info btn-xs float-end">Download</a>
|
|
<button type="button" id="emailme" class="btn btn-warning btn-xs float-end me-2">Email</button>
|
|
</div>
|
|
<div class="col-12">
|
|
<p>Showing data for last 30 days, please use above button "Download" to download all submissions</p>
|
|
</div>
|
|
</div>
|
|
<!-- end page title -->
|
|
@if(session()->has('message'))
|
|
<div class="alert alert-success">
|
|
{{ session()->get('message') }}
|
|
</div>
|
|
@endif
|
|
@if(session()->has('error'))
|
|
<div class="alert alert-danger">
|
|
{{ session()->get('error') }}
|
|
</div>
|
|
@endif
|
|
<div id="notifications"></div>
|
|
|
|
<div class="row">
|
|
<div class="col-12 p-0">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="responsive-table-plugin">
|
|
<div class="table-rep-plugin">
|
|
<div class="table-responsive" data-pattern="priority-columns">
|
|
<table id="tech-companies-1" class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th data-priority="1">Submission Date</th>
|
|
<th data-priority="1" >Submitted By</th>
|
|
<th data-priority="1">Employee Code</th>
|
|
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
|
|
<th data-priority="1">Workflow Status</th>
|
|
@endif
|
|
@foreach($questions as $code => $question)
|
|
@if($question->type == 'multitextbox')
|
|
@foreach( $question->options as $k => $v )
|
|
@if($question->type == 'hidden')
|
|
@continue;
|
|
@endif
|
|
<th data-priority="1">{{$v}} ({{$question->label}})</th>
|
|
@endforeach
|
|
@else
|
|
<th data-priority="1">{{$question->label}}</th>
|
|
@endif
|
|
@endforeach
|
|
<th data-priority="1">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($submissions as $submission)
|
|
@if(isset($submission->user_info->name))
|
|
<tr>
|
|
<th>{{date("d M Y", strtotime($submission->updatedAt))}}</th>
|
|
<!-- <th>
|
|
<img src="{{isset($submission->user_info->avatar) ? $submission->user_info->avatar : 'https://ui-avatars.com/api/?background=random&name='.$submission->user_info->name}}" class="rounded-circle avatar-sm" />
|
|
</th> -->
|
|
<td>
|
|
<h5 class="m-0 fw-normal">{{$submission->user_info->name}}</h5>
|
|
<p class="mb-0 text-muted"><small>{{$submission->user_info->designation}}</small></p>
|
|
</td>
|
|
<td>
|
|
<h5 class="m-0 fw-normal">{{isset($submission->user_info->employee_code)?$submission->user_info->employee_code:''}}</h5>
|
|
</td>
|
|
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
|
|
<td>{{ucwords($submission->workflow_status)}}</td>
|
|
@endif
|
|
@foreach($questions as $code => $question)
|
|
@if($question->type == 'hidden')
|
|
@continue;
|
|
@endif
|
|
@if($question->type == 'multitextbox')
|
|
@foreach( $question->options as $k => $v )
|
|
<td>{{ isset($submission->formdata->{$k}) ? (is_array($submission->formdata->{$k}) ? implode(', ', $submission->formdata->{$k}) : $submission->formdata->{$k}) : '' }}</td>
|
|
@endforeach
|
|
@elseif($question->type == 'file')
|
|
<!-- <td><a target="_blank" href="{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}" download="{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}" class="btn btn-dark btn-xs"><i class="mdi mdi-cloud-download me-1"></i> Download</a></td> -->
|
|
@php
|
|
$filepath = isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '';
|
|
@endphp
|
|
<td> @if(!empty($filepath)) <img src="{{ $filepath }}" class="avatar-md" /> <a target="_blank" href="{{ $filepath }}" download="{{ $filepath }}" class="btn btn-dark btn-xs"><i class="mdi mdi-cloud-download me-1"></i></a>@endif </td>
|
|
@else
|
|
<td>{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}</td>
|
|
@endif
|
|
@endforeach
|
|
<th>
|
|
@if( in_array('edit', $submission->actions) )
|
|
<a href="/form/edit?id={{$submission->id}}" class="btn btn-primary btn-xs">Edit</a>
|
|
@endif
|
|
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' && $submission->workflow_status == 'unapproved' )
|
|
<button class="btn btn-success btn-xs btn-approve m-1" submission="{{$submission->id}}">Approve</button>
|
|
<button class="btn btn-danger btn-xs btn-reject m-1" submission="{{$submission->id}}">Reject</button>
|
|
@endif
|
|
</th>
|
|
</tr>
|
|
@endif
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div> <!-- end .table-responsive -->
|
|
|
|
</div> <!-- end .table-rep-plugin-->
|
|
</div> <!-- end .responsive-table-plugin-->
|
|
@if($lastkey)
|
|
<div class="text-center d-grid mt-3">
|
|
<button class="btn btn-info" type="button" id="load-btn"> Load More ... </button>
|
|
</div>
|
|
@endif
|
|
</div> <!-- end card body-->
|
|
</div> <!-- end card -->
|
|
</div><!-- end col-->
|
|
</div>
|
|
<!-- end row-->
|
|
</div> <!-- container -->
|
|
|
|
</div>
|
|
<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>
|
|
|
|
<!-- end page -->
|
|
@include('layouts.shared/footer-script')
|
|
<script type="text/javascript">
|
|
jQuery(document).ready(function($){
|
|
$('.btn-primary').click(function(){
|
|
$("#pageloader").fadeIn();
|
|
})
|
|
|
|
$('#emailme').click(function(){
|
|
$("#pageloader").fadeIn();
|
|
$.ajax({
|
|
type: "GET",
|
|
url: '/form/downloaddata?form_id={{$form_id}}&email=1',
|
|
success: function( data ) {
|
|
$('#notifications').append('<div class="alert alert-success">Email Sent Successfully</div>');
|
|
$("#pageloader").fadeOut();
|
|
},
|
|
});
|
|
})
|
|
|
|
var lastkey = '{{$lastkey}}';
|
|
$('#load-btn').click(function(){
|
|
$("#pageloader").fadeIn();
|
|
$.get( "/form/loadmore?lastkey=" + lastkey, function( data ) {
|
|
$("#pageloader").fadeOut();
|
|
lastkey = data.lastkey;
|
|
$( "#tech-companies-1 tbody" ).append( data.html );
|
|
if(!data.lastkey) {
|
|
$('#load-btn').hide()
|
|
}
|
|
|
|
$('.btn-approve').unbind()
|
|
$('.btn-reject').unbind()
|
|
$('.btn-approve').click(function(){
|
|
$("#pageloader").fadeIn();
|
|
let that = $(this)
|
|
$.ajax({
|
|
type: "GET",
|
|
url: '/form/approvereject?action=approve&id=' + $(this).attr('submission'),
|
|
//data: new FormData($('#report-form')[0]),
|
|
processData: false,
|
|
contentType: false,
|
|
success: function( data ) {
|
|
$("#pageloader").fadeOut();
|
|
console.log(data)
|
|
that.parent().html('')
|
|
},
|
|
});
|
|
})
|
|
$('.btn-reject').click(function(){
|
|
$("#pageloader").fadeIn();
|
|
let that = $(this)
|
|
$.ajax({
|
|
type: "GET",
|
|
url: '/form/approvereject?action=reject&id=' + $(this).attr('submission'),
|
|
//data: new FormData($('#report-form')[0]),
|
|
processData: false,
|
|
contentType: false,
|
|
success: function( data ) {
|
|
$("#pageloader").fadeOut();
|
|
console.log(data)
|
|
that.parent().html('')
|
|
},
|
|
});
|
|
})
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
$('.btn-approve').click(function(){
|
|
$("#pageloader").fadeIn();
|
|
let that = $(this)
|
|
$.ajax({
|
|
type: "GET",
|
|
url: '/form/approvereject?action=approve&id=' + $(this).attr('submission'),
|
|
//data: new FormData($('#report-form')[0]),
|
|
processData: false,
|
|
contentType: false,
|
|
success: function( data ) {
|
|
$("#pageloader").fadeOut();
|
|
console.log(data)
|
|
that.parent().html('')
|
|
},
|
|
});
|
|
})
|
|
$('.btn-reject').click(function(){
|
|
$("#pageloader").fadeIn();
|
|
let that = $(this)
|
|
$.ajax({
|
|
type: "GET",
|
|
url: '/form/approvereject?action=reject&id=' + $(this).attr('submission'),
|
|
//data: new FormData($('#report-form')[0]),
|
|
processData: false,
|
|
contentType: false,
|
|
success: function( data ) {
|
|
$("#pageloader").fadeOut();
|
|
console.log(data)
|
|
that.parent().html('')
|
|
},
|
|
});
|
|
})
|
|
})
|
|
</script>
|
|
</body>
|
|
</html> |