2025-04-27 22:36:03 +07:00

124 lines
7.6 KiB
PHP

@extends('layouts.app')
@section('content')
<div class="flex justify-center items-start mt-16">
<div class="container max-w-6xl px-6 mx-auto">
@include('partials.messages')
<div class="flex justify-between items-center mb-6">
<h2 class="text-lg font-semibold text-gray-700 dark:text-gray-200">
Data Asuransi
</h2>
<a href="{{ route('master-asuransi.create') }}"
class="px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
<div class="flex items-center">
<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd"
d="M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z"
clip-rule="evenodd">
</path>
</svg>
<span>Tambah Asuransi</span>
</div>
</a>
</div>
<div class="w-full overflow-hidden rounded-lg shadow-xs">
<div class="w-full overflow-x-auto">
<table class="w-full whitespace-no-wrap">
<thead>
<tr
class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800">
<th class="px-4 py-3">Nama Asuransi</th>
<th class="px-4 py-3">Aksi</th>
</tr>
</thead>
<tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
@foreach ($MsAsuransi as $asuransi)
<tr class="text-gray-700 dark:text-gray-400">
<td class="px-4 py-3">
{{ $asuransi->NamaAsuransi }}
</td>
<td class="px-4 py-3 text-sm">
<div class="flex items-center space-x-4 text-sm">
<a href="{{ route('master-asuransi.show', $asuransi) }}"
class="flex items-center justify-between px-2 py-2 text-sm font-medium leading-5 text-purple-600 rounded-lg dark:text-gray-400 focus:outline-none focus:shadow-outline-gray"
aria-label="Show">
<svg class="w-5 h-5" aria-hidden="true" fill="currentColor"
viewBox="0 0 20 20">
<path d="M1 10s3-7 9-7 9 7 9 7-3 7-9 7-9-7-9-7z" />
<path d="M10 13a3 3 0 100-6 3 3 0 000 6z" />
</svg>
</a>
<a href="{{ route('master-asuransi.edit', $asuransi) }}"
class="flex items-center justify-between px-2 py-2 text-sm font-medium leading-5 text-purple-600 rounded-lg dark:text-gray-400 focus:outline-none focus:shadow-outline-gray"
aria-label="Edit">
<svg class="w-5 h-5" aria-hidden="true" fill="currentColor"
viewBox="0 0 20 20">
<path
d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z">
</path>
</svg>
</a>
<form id="delete-form-{{ $asuransi->IdAsuransi }}"
action="{{ route('master-pasien.destroy', $asuransi) }}" method="POST"
class="inline-block">
@csrf
@method('DELETE')
<button type="button" onclick="confirmDelete({{ $asuransi->IdAsuransi }})"
class="flex items-center justify-between px-2 py-2 text-sm font-medium leading-5 text-purple-600 rounded-lg dark:text-gray-400 focus:outline-none focus:shadow-outline-gray"
aria-label="Delete">
<svg class="w-5 h-5" aria-hidden="true" fill="currentColor"
viewBox="0 0 20 20">
<path fill-rule="evenodd"
d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z"
clip-rule="evenodd"></path>
</svg>
</button>
</form>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div
class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800">
<span class="flex items-center col-span-3">
Menampilkan {{ $MsAsuransi->firstItem() ?? 0 }} - {{ $MsAsuransi->lastItem() ?? 0 }} dari
{{ $MsAsuransi->total() ?? 0 }} data
</span>
<span class="col-span-2"></span>
<!-- Pagination -->
<span class="flex col-span-4 mt-2 sm:mt-auto sm:justify-end">
{{ $MsAsuransi->links() }}
</span>
</div>
</div>
</div>
</div>
@endsection
@section('scripts')
<script>
const confirmDelete = (IdAsuransi) => {
Swal.fire({
title: "Hapus data?",
text: "Data yang sudah dihapus tidak dapat dikembalikan. Yakin ingin melanjutkan?",
icon: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: "Ya, hapus!",
cancelButtonText: "Batal"
}).then((result) => {
if (result.isConfirmed) {
document.getElementById(`delete-form-${IdAsuransi}`).submit();
}
});
}
</script>
@endsection