@use('App\Services\Date') @extends('companyuser::layouts.master') @section('title', __('purchases::purchase_bills.edit_purchase_bill')) @section('extra-styles') @endsection @section('breadcrumb') @endsection @section('content')
@method('PUT') @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
{{-- @include('companyuser::errors.all') --}} @include('companyuser::errors.operation-locked') @include('companyuser::errors.lists')
@error('code') @enderror
(@lang('optional'))
@error('supplier_invoice_reference_number') @enderror
( @lang('optional') )
@error('description')

{{ $message }}

@enderror
@error('supplier') @enderror
@error('payment_date') @enderror @error('current_fiscal_year_id') @enderror
@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) { $oldPaymentTermId = $purchaseBill->payment_term_id ?? 'cash'; } else if (old('payment_account')) { $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() ) {{-- this to handle the case when user create item when there is no custom fields then add custom fields from setting then open the edit page this means get the custom fields in bill , if it is empty it means there wasn't customfields so get the noraml custom fields that came from settings --}} @php $customFields = json_decode($purchaseBill->custom_fields, true) ?? $customFields @endphp
@foreach($customFields as $key=>$field)
@if($field['type']=='checkbox') @else @endif
@endforeach
@endif
@error('terms') @enderror
@error('notes') @enderror
{{-- Warning Modal --}} @endsection @section('extra_scripts') @include('purchases::scripts.get_products_script') @endsection