@extends('admin.layouts.app')

@section('title', __('admin/expenses.create_title'))

@section('content')
    <div class="container-fluid px-4">
        <x-admin.page-header
            :title="__('admin/expenses.create_title')"
            icon="fas fa-receipt"
            :buttons="[
                ['label' => __('admin/common.buttons_back'), 'route' => route('admin.expenses.index'), 'icon' => 'fas fa-arrow-left', 'color' => 'outline-secondary'],
            ]"
        />

        <x-admin.alert />

        <form id="expenseForm" enctype="multipart/form-data">
            <x-admin.card>
                @include('admin.expenses.partials.form')
                <x-slot:footer>
                    <x-admin.form-actions :cancel-url="route('admin.expenses.index')" />
                </x-slot:footer>
            </x-admin.card>
        </form>
    </div>
@endsection

@push('scripts')
<script>
    window.pageConfig = window.pageConfig || {};
    window.pageConfig.mode = 'create';
    window.pageConfig.submitUrl = '{{ route("admin.expenses.store") }}';
    window.pageConfig.indexUrl = '{{ route("admin.expenses.index") }}';
    window.pageConfig.linkable = {
        searchUrl: '{{ route("api.admin.expenses.linkable-search") }}',
        referenceUrl: '{{ route("api.admin.expenses.linkable-reference") }}',
    };
    window.translations = {
        save_error: '{{ __("admin/expenses.messages_save_error") }}',
        locale: '{{ app()->getLocale() }}',
        link_target_ph: '{{ __("admin/expenses.field_link_target_ph") }}',
        link_ref_month: '{{ __("admin/expenses.link_reference_month") }}',
        link_ref_year: '{{ __("admin/expenses.link_reference_year") }}',
        link_reference_cost: '{{ __("admin/expenses.link_reference_cost") }}',
    };
</script>
@vite('resources/js/admin/expenses/form.js')
@endpush
