@extends('layouts.layoutMaster')

@section('title', __('Suppliers'))

@section('vendor-style')
@vite([
    'resources/assets/vendor/libs/datatables-bs5/datatables.bootstrap5.scss',
    'resources/assets/vendor/libs/datatables-responsive-bs5/responsive.bootstrap5.scss',
    'resources/assets/vendor/libs/sweetalert2/sweetalert2.scss'
])
@endsection

@section('vendor-script')
@vite([
    'resources/assets/vendor/libs/datatables-bs5/datatables-bootstrap5.js',
    'resources/assets/vendor/libs/sweetalert2/sweetalert2.js'
])
@endsection

@section('content')
<x-breadcrumb
    :title="__('Suppliers')"
    :breadcrumbs="[
        ['name' => __('System Core'), 'url' => route('systemcore.dashboard')],
        ['name' => __('Suppliers')]
    ]"
/>

<div class="card">
    <div class="card-header d-flex justify-content-between align-items-center">
        <h5 class="mb-0">{{ __('Suppliers') }}</h5>
        <a href="{{ route('systemcore.suppliers.create') }}" class="btn btn-primary">
            <i class="bx bx-plus"></i> {{ __('Add Supplier') }}
        </a>
    </div>
    <div class="card-body">
        <div class="table-responsive">
            <table id="suppliersTable" class="table table-hover">
                <thead>
                    <tr>
                        <th>{{ __('Supplier Code') }}</th>
                        <th>{{ __('Name') }}</th>
                        <th>{{ __('Email') }}</th>
                        <th>{{ __('Phone') }}</th>
                        <th>{{ __('Status') }}</th>
                        <th>{{ __('Actions') }}</th>
                    </tr>
                </thead>
            </table>
        </div>
    </div>
</div>
@endsection

@section('page-script')
<script>
const pageData = {
    urls: {
        datatable: '{{ route("systemcore.suppliers.ajax") }}',
        store: '{{ route("systemcore.suppliers.store") }}',
        update: (id) => '{{ route("systemcore.suppliers.index") }}/' + id,
        destroy: (id) => '{{ route("systemcore.suppliers.index") }}/' + id
    },
    labels: {
        comingSoon: @json(__('Coming Soon')),
        addSupplierMessage: @json(__('Add supplier functionality will be implemented soon')),
        ok: @json(__('OK')),
        confirmDelete: @json(__('Are you sure?')),
        deleteWarning: @json(__('You will not be able to recover this supplier!')),
        yesDelete: @json(__('Yes, delete it!')),
        cancel: @json(__('Cancel')),
        success: @json(__('Success')),
        deleteSuccess: @json(__('Supplier deleted successfully')),
        error: @json(__('Error')),
        deleteError: @json(__('Failed to delete supplier')),
        // DataTable language labels
        searchPlaceholder: @json(__('Search suppliers...')),
        processing: @json(__('Processing...')),
        lengthMenu: @json(__('Show _MENU_ entries')),
        info: @json(__('Showing _START_ to _END_ of _TOTAL_ entries')),
        infoEmpty: @json(__('No entries to show')),
        infoFiltered: @json(__('(filtered from _MAX_ total entries)')),
        emptyTable: @json(__('No data available')),
        zeroRecords: @json(__('No matching records found')),
        paginate: {
            first: @json(__('First')),
            last: @json(__('Last')),
            next: @json(__('Next')),
            previous: @json(__('Previous'))
        }
    }
};
</script>
@vite(['Modules/SystemCore/resources/assets/js/suppliers.js'])
@endsection
