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

87 lines
4.8 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'])
<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">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->status }}</span>
</td>
<td class="border-bottom-0">
<div class="d-flex align-items-center gap-2">
<a href="{{ URL::to('admin/surveys/preview', $survey->id) }}" class="btn btn-sm bg-info-subtle text-primary mx-auto" data-bs-toggle="tooltip" title="Preview"><i class="ti ti-presentation"></i></a>
@role(['Admin'])
<a href="{{ URL::to('admin/surveys', $survey->id) }}" class="btn btn-sm bg-info-subtle text-info mx-auto" data-bs-toggle="tooltip" title="Lihat Detail"><i class="ti ti-eye"></i></a>
<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>
<!-- <form onsubmit="return confirm('Apakah Anda Yakin ?');" action="{{ URL::to('admin/surveys/' . $survey->id) }}" method="POST">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sm bg-danger-subtle text-danger mx-auto" data-bs-toggle="tooltip" title="Hapus survey"><i class="ti ti-trash"></i></button>
</form> -->
@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