@use('App\Services\Date') @extends('companyuser::layouts.master') @section('title', __('purchases::purchase_bills.create_purchase_bill')) @section('extra-styles') @if (app()->getLocale() == 'en') @endif @endsection @section('breadcrumb') @endsection @section('content')
@csrf
@if (!isset($currentFiscalYearId))
@lang('superadmin::Dashboard.Please set your ')   @lang('settings::general_settings.accounting settings')   @lang('superadmin::Dashboard.to start adding accounting transactions')
@endif
@error('remaining') @enderror
@include('companyuser::errors.operation-locked') @include('companyuser::errors.lists') @error('remaining') @enderror @error('attachment_id') @enderror @if ($remaining)
@error('code') @enderror
(@lang('optional'))
@error('supplier_invoice_reference_number') @enderror
( @lang('optional') )
@error('description')

{{ $message }}

@enderror
@error('supplier') @enderror
{{-- Hidden field to keep track of requisition conversion --}} @php $convertedRequisitionId = old('converted_requisition_id', $purchaseBill ? $purchaseBill->requisition_id : ''); @endphp @if ($convertedRequisitionId) @endif @error('payment_date') @enderror @error('current_fiscal_year_id') @enderror
@if(!empty($disableCostCenter)) @php $preloadedCostCenterId = old('cost_center_id', $cost_center_id ?? ($purchaseBill ? $purchaseBill->cost_center_id : '')); @endphp @endif @error('cost_center_id')

{{ $message }}

@enderror @if(isFeatureActive(Modules\Settings\Enums\FeaturesEnum::INVENTORY))

{{ __('validation.change_warning', ['field' => __('products::cost_center.Cost Center')]) }}

@endif
@php // Replicate the original select logic: if (old('payment_term')) { $oldPaymentTermId = old('payment_term'); } elseif ($purchaseBill && ! old('payment_account')) { $oldPaymentTermId = $purchaseBill->payment_term_id ?? null; } elseif (old('payment_account') && old('payment_account') != 1) { $oldPaymentTermId = 'cash'; }else { $oldPaymentTermId = null; } @endphp
@error('payment_term') @enderror

@lang('purchases::purchase_bills.Supplier Details'):

@lang('purchases::purchase_bills.Phone'):
@lang('purchases::purchase_bills.Email'):
@lang('purchases::purchase_bills.Outstanding Balance'):

@lang('sales::invoices.validate_minimum_quantity_message')

@error('products.*')

{{ $message }}

@enderror @error('products')

{{ $message }}

@enderror
@if ($customFields->count())
@foreach ($customFields as $key => $field)
@if ($field['type'] == 'checkbox') @else @endif
@endforeach
@endif
{{-- commented payment section till further notes --}} {{--
--}}
@error('terms') @enderror
@error('notes') @enderror
@if (!old('attachment_id') && !request('attachment_id')) @endif
@else @include('info.limit_reached') @endif
{{-- Warning Modal --}}
@endsection @section('extra_scripts') @include('purchases::scripts.get_products_script') {{-- Save Actions Loading State Handler (reusable script) --}} @endsection