100 lines
5.5 KiB
PHP
100 lines
5.5 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>
|
|
<body class="loading">
|
|
<div class="account-pages">
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-8 p-2">
|
|
<h4 class="page-title">Doctor & Chemist Survey</h4>
|
|
</div>
|
|
<div class="col-4 p-2">
|
|
<a href="/form/show?form_id={{ $doctor_form_id }}" class="float-end pt-1">New Submission</a>
|
|
</div>
|
|
</div>
|
|
@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
|
|
|
|
@foreach([
|
|
['title' => 'Doctor Survey', 'form_id' => $doctor_form_id, 'questions' => $doctor_questions, 'submissions' => $doctor_submissions],
|
|
['title' => 'Chemist Survey', 'form_id' => $chemist_form_id, 'questions' => $chemist_questions, 'submissions' => $chemist_submissions],
|
|
] as $section)
|
|
<div class="row">
|
|
<div class="col-12 p-0">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h5 class="mb-3">{{ $section['title'] }}</h5>
|
|
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Submission Date</th>
|
|
<th>Submitted By</th>
|
|
<th>Workflow Status</th>
|
|
@foreach($section['questions'] as $code => $question)
|
|
@if(($question->type ?? '') === 'hidden')
|
|
@continue
|
|
@endif
|
|
<th>{{ $question->label ?? $code }}</th>
|
|
@endforeach
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($section['submissions'] as $submission)
|
|
<tr>
|
|
<td>{{ date('d M Y', strtotime($submission->updatedAt ?? $submission->createdAt)) }}</td>
|
|
<td>{{ $submission->user_info->name ?? '' }}</td>
|
|
<td>{{ $submission->workflow_status ?? '' }}</td>
|
|
@foreach($section['questions'] as $code => $question)
|
|
@if(($question->type ?? '') === 'hidden')
|
|
@continue
|
|
@endif
|
|
@php
|
|
$cell = $submission->formdata->{$code} ?? '';
|
|
if (is_array($cell)) {
|
|
$cell = implode(', ', $cell);
|
|
} elseif (is_object($cell)) {
|
|
$cell = collect((array) $cell)->map(function ($val, $key) {
|
|
return $key.': '.$val;
|
|
})->implode(', ');
|
|
}
|
|
@endphp
|
|
<td>
|
|
@if(($question->type ?? '') === 'file' && $cell)
|
|
<a href="{{ $cell }}" target="_blank" rel="noopener">View</a>
|
|
@else
|
|
{{ $cell }}
|
|
@endif
|
|
</td>
|
|
@endforeach
|
|
<td>
|
|
<a href="/form/show?form_id={{ $section['form_id'] }}&id={{ $submission->id }}" class="btn btn-primary btn-xs">Edit</a>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="4">No submissions</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
@include('layouts.shared/footer-script')
|
|
</body>
|
|
</html>
|