@extends('layouts.admin')
@section('styles')
    <link rel="stylesheet" type="text/css" href="{{ asset('assets/admin/css/vendors/datatables.css') }}">
@endsection
@section('app')
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <div class="list-product-header">
                    <div>
                        <a class="btn btn-primary" href="{{ route('master.service.create') }}">Tambah</a>
                    </div>
                </div>
                <div class="card">
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="display" id="datatable">
                                <thead>
                                    <tr>
                                        <th>No</th>
                                        <th>Nama</th>
                                        <th>Harga</th>
                                        <th>Deskripsi</th>
                                        <th>Tanggal</th>
                                        <th>Aksi</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach ($services as $service)
                                        <tr>
                                            <td>{{ $loop->iteration }}</td>
                                            <td>{{ $service->name }}</td>
                                            <td>{{ formatToRupiah($service->price) }}</td>
                                            <td>{{ $service->description }}</td>
                                            <td>{{ formatDateIndo($service->created_at) }}</td>
                                            <td>
                                                <ul class="action">
                                                    <li class="edit">
                                                        <a href="{{ route('master.service.edit', encryptId($service->id)) }}"
                                                            data-bs-toggle="tooltip" data-bs-placement="left"
                                                            data-bs-title="Edit">
                                                            <i data-feather="edit"></i>
                                                        </a>
                                                    </li>
                                                    <li class="delete">
                                                        <form
                                                            action="{{ route('master.service.delete', encryptId($service->id)) }}"
                                                            method="post">
                                                            @csrf
                                                            @method('delete')
                                                            <a href="javascript:void(0)" class="delete-data"
                                                                data-bs-toggle="tooltip" data-bs-placement="left"
                                                                data-bs-title="Hapus">
                                                                <i data-feather="trash-2"></i>
                                                            </a>
                                                        </form>
                                                    </li>
                                                </ul>
                                            </td>
                                        </tr>
                                    @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
@section('afterScripts')
    <script src="{{ asset('assets/admin/js/datatable/jquery.dataTables.min.js?ver=1.0.0') }}"></script>
    <script src="{{ asset('assets/admin/js/datatable/client-side.js?ver=1.0.0') }}"></script>
    <script src="{{ asset('assets/js/interactions/confirmation.js?ver=1.0.0') }}"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
@endsection
