survey-sdgs/resources/views/pages/admins/surveys/index.blade.php

106 lines
6.4 KiB
PHP
Executable File

@extends('layouts.app')
@section('title', 'Surveys')
@section('content')
<div class="row">
<div class="col-lg-12 d-flex align-items-stretch">
<div class="card w-100">
<div class="card-body p-4">
<div class="d-flex align-items-stretch">
<h5 class="card-title fw-semibold mb-4">Data Survey</h5>
@role(['Admin', 'Staff'])
<div class="d-inline ms-auto">
@method('GET')
<a href="{{ URL::to('admin/surveys/create') }}" class="btn btn-sm btn-success">
<i class="ti ti-circle-plus"></i>&nbsp; Tambah
</a>
</div>
@endrole
</div>
<div class="table-responsive">
<table class="table table-responsive table-bordered text-nowrap mb-0 align-middle">
<thead class="text-dark fs-4">
<tr>
<th class="border-bottom-0" width="45px">
<h6 class="fw-semibold mb-0 text-center">No.</h6>
</th>
<th class="border-bottom-0">
<h6 class="fw-semibold mb-0">Nama</h6>
</th>
<th class="border-bottom-0" width="100px">
<h6 class="fw-semibold mb-0">Tahun</h6>
</th>
<th class="border-bottom-0" width="100px">
<h6 class="fw-semibold mb-0">Status</h6>
</th>
<th class="border-bottom-0" width="100px">
<h6 class="fw-semibold mb-0 text-center">Action</h6>
</th>
</tr>
</thead>
<tbody>
@forelse ($surveys as $survey)
<tr>
<td class="border-bottom-0 text-center">
<span
class="fw-normal mb-0">{{ ($surveys->currentPage() - 1) * $surveys->perPage() + $loop->index + 1 }}</span>
</td>
<td class="border-bottom-0 text-truncate" style="max-width: 170px;">
<span class="fw-normal mb-1">{{ $survey->name }}</span>
</td>
<td class="border-bottom-0">
<span class="fw-normal mb-1 badge text-bg-light">{{ $survey->years }}</span>
</td>
<td class="border-bottom-0">
<span class="fw-normal mb-1 badge text-bg-light">{{ $survey->status }}</span>
</td>
<td class="border-bottom-0">
<div class="d-flex align-items-center gap-2">
@role(['Admin', 'Staff'])
<a href="{{ URL::to('admin/surveys/preview-admin', $survey->id) }}"
class="btn btn-sm bg-secondary-subtle text-secondary mx-auto"
data-bs-toggle="tooltip" title="Preview"><i
class="ti ti-presentation"></i></a>
@endrole
@role(['Responden'])
<a href="{{ URL::to('admin/surveys/preview-user', $survey->id) }}"
class="btn btn-sm bg-secondary-subtle text-secondary mx-auto"
data-bs-toggle="tooltip" title="Preview"><i
class="ti ti-presentation"></i></a>
@endrole
<a href="{{ URL::to('admin/surveys', $survey->id) }}"
class="btn btn-sm bg-primary-subtle text-info mx-auto"
data-bs-toggle="tooltip" title="Lihat Detail"><i
class="ti ti-eye"></i></a>
@role(['Admin', 'Staff'])
<a href="{{ URL::to('admin/surveys/' . $survey->id . '/edit') }}"
class="btn btn-sm bg-warning-subtle text-warning mx-auto"
data-bs-toggle="tooltip" title="Edit survey"><i
class="ti ti-edit"></i></a>
@endrole
</div>
</td>
</tr>
@empty
<div class="alert alert-danger">
Data survey belum Tersedia.
</div>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
@if (Session::has('surveys-message'))
<script>
Swal.fire({
text: "{{ Session::get('surveys-message')['msg'] }}",
icon: "{{ Session::get('surveys-message')['type'] }}",
timer: 2500
});
</script>
@endif
@stop