@use('App\Services\Date') @extends('companyuser::layouts.master') @section('title', __('sales::invoice_returns.create_new')) @section('extra-styles') @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('code') @enderror
( @lang('optional') )
@error('description')

{{ $message }}

@enderror
*
@php $selectedCustomerId = old('customer') ?? ($invoiceReturn ? $invoiceReturn->customer_id : null) ?? request('customer') ?? request('customer_id'); @endphp
@error('customer') @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 ($invoiceReturn) { $oldPaymentTermId = $invoiceReturn->payment_term_id ?? 'cash'; } else { $oldPaymentTermId = null; } @endphp
@error('payment_term') @enderror
@if (!isset($invoiceReturn->invoice_id))
@error('supply_date') @enderror
@endif @if ($companyInfo->zatca_comply)
*
@error('reason') @enderror
@endif

@lang('sales::invoice_returns.customer Details'):

@lang('sales::invoice_returns.Phone'):
@lang('sales::invoice_returns.Email'):
@lang('sales::invoice_returns.Outstanding Balance'):
@php $returnFormInvoice = str_contains(url()->current(), 'create-invoice-return-from-invoice'); $canMultipleReturn = $invoiceReturn ? $invoiceReturn->canMultipleReturn : true; @endphp
@if ($invoiceReturn) @else @endif

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

@error('products.*')

{!! $message !!}

@enderror @error('products')

{!! $message !!}

@enderror
@if (!$returnFormInvoice && $canMultipleReturn)
@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
@if($companyInfo->zatca_comply)

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

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

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

@endif
@error('notes') @enderror
@if($invoiceReturn) {{---------------- popup for displaying bill deleted products ---------------------}} @endif
@endsection @section('extra_scripts') @include('sales::scripts.get_products_sales_script') @endsection