@use('App\Services\Date') @extends('companyuser::layouts.master') @section('title', __('sales::invoices.create_debit_note')) @section('extra-styles') @if (app()->getLocale() == 'en') @else @endif @endsection @php if (array_keys(request()->query()) && array_keys(request()->query())[0] != 'type') { request()->merge(['type' => array_keys(request()->query())[0]]); } $queryType = request()->query()['type']; $isSimplifiedType = false; if (in_array($queryType, Modules\Sales\Enums\InvoiceTypesEnum::SIMPLIFIED_TYPES) && $isNotSimplifiedOnlyInvoiceCompany) { $isSimplifiedType = true; } @endphp @section('breadcrumb') @endsection @section('content')
@csrf
@if ($isSimplifiedType && $companyInfo->zatca_comply)

{{ __('sales::invoices.note_for_simplified_invoice_b2b_client') }}

@endif @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('remaining') @enderror @error('type') @enderror @error('attachment_id') @enderror @if ($remaining)
@if (isset($taxableUser) && $taxableUser && !request('type'))
@error('type') @enderror
@else @endif
@error('code') @enderror
( @lang('optional') )
@error('description')

{{ $message }}

@enderror
*
@php $selectedCustomerId = old('customer') ?? ($invoice ? $invoice->customer_id : null) ?? request('customer') ?? request('customer_id'); @endphp
@error('customer') @enderror
@error('payment_date') @enderror @error('current_fiscal_year_id') @enderror
@error('time') @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 ($invoice) { $oldPaymentTermId = $invoice->payment_term_id ?? 'cash'; } else { $oldPaymentTermId = null; } @endphp
@error('payment_term') @enderror
@if (!str_contains(request()->getRequestUri(), 'debit') || !isset($invoice->id))
@error('supply_date') @enderror
@endif @if ($companyInfo->zatca_comply)
*
@error('reason') @enderror
@endif

@lang('sales::invoices.Customer Details'):

@lang('sales::invoices.Phone'):
@lang('sales::invoices.Email'):
@lang('sales::invoices.Outstanding Balance'):
@php $returnFormInvoice = str_contains(url()->current(), 'create-invoice-debit-from-invoice'); @endphp

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

@error('products.*')

{!! $message !!}

@enderror @error('products')

{!! $message !!}

@enderror @error('labor_fee')

{!! $message !!}

@enderror
@if (!$returnFormInvoice)
@error('products.*')

{!! $message !!}

@enderror @error('products')

{!! $message !!}

@enderror
@endif
@if ($customFields->count())
@foreach ($customFields as $key => $field)
@if ($field['type'] == 'checkbox') @else @endif
@endforeach
@endif
@error('zatca_errors') @enderror
@if ($companyInfo->zatca_comply)

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

@endif
@error('terms') @enderror
@if ($companyInfo->zatca_comply)

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

@endif
@error('notes') @enderror
@if (!old('attachment_id') && !request('attachment_id')) @endif
@if ($invoice && $invoice->deletedProducts) {{-- -------------- popup for displaying bill deleted products ------------------- --}} @endif
@else @include('info.limit_reached') @endif
@endsection @section('extra_scripts') @include('sales::scripts.get_products_sales_script') @endsection