@extends('companyuser::layouts.master') @section('title', __('sales::customers.Edit Customer')) @section('extra-styles') @endsection @section('breadcrumb') @endsection @php $complyWithTaxInvoice = ($companyInfo->zatca_comply && $isNotSimplifiedOnly); @endphp @section('content') @php $optionalAddressFields = ['building_number', 'address_number', 'district', 'province']; // Keep the KSA-only fields open when the user already put something in them, // so a failed submit never hides what they typed. $revealOptionalAddress = $errors->hasAny($optionalAddressFields) || collect($optionalAddressFields)->contains(fn ($field) => filled(old($field) ?? $customer->{$field})); @endphp
@csrf @method('PUT')
{{-- @include('superadmin::errors.lists') --}}
{{-- customer code --}}
*
@error('code')

{{ $message }}

@enderror
{{-- customer name --}}
*
@error('name')

{{ $message }}

@enderror
{{-- accounts receivables --}}
@error('account_receivable_id')

{{ $message }}

@enderror
{{-- phone number --}}
@if(Lang::locale() == 'ar')
@error('mobile')

{{ $message }}

@enderror
{{-- here we pass the customer var named as user to the include to be able to use this file without modifying it --}} @include('superadmin::includes.selectCountry' , ['user' => $customer]) @error('country_code')

{{ $message }}

@enderror
@else
@include('superadmin::includes.selectCountry', ['user' => $customer]) @error('country_code')

{{ $message }}

@enderror
@error('mobile')

{{ $message }}

@enderror
@endif
{{-- email --}}
@if($complyWithTaxInvoice) * @endif
@error('email')

{{ $message }}

@enderror
@if(checkZatcaComply()) {{-- taxable --}}
tax_number) ? 'checked' : '' }}>
@endif {{-- tax number --}}
*
@error('tax_number')

{{ $message }}

@enderror
@if ($complyWithTaxInvoice) @php $isTaxInvoiceType = $customer->type == Modules\Sales\Enums\InvoiceTypesEnum::TAX_INVOICE; $query = request()->query() ? request()->query()['customer_type'] : $customer->type; @endphp @if (!$isTaxInvoiceType)
@error('customer_type')

{{ $message }}

@enderror
@else @endif @if ($query == Modules\Sales\Enums\InvoiceTypesEnum::TAX_INVOICE)
@error('serial_number')

{{ $message }}

@enderror
*
@error('province')

{{ $message }}

@enderror
*
@error('district')

{{ $message }}

@enderror
*
@error('address_number')

{{ $message }}

@enderror
*
@error('building_number')

{{ $message }}

@enderror
*
@error('commercial_schema')

{{ $message }}

@enderror
*
@error('commercial_number')

{{ $message }}

@enderror
@endif @endif
@lang('sales::customers.Billing Address') @if ($complyWithTaxInvoice) @if($query == Modules\Sales\Enums\InvoiceTypesEnum::TAX_INVOICE) * @endif @endif
@error('street')

{{ $message }}

@enderror
@error('city')

{{ $message }}

@enderror
@error('country')

{{ $message }}

@enderror
@error('postal_code')

{{ $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 ---------- My brother/sister, I don't know who you are but i wanna thank your from the deepest part of my heart about this comment, may you live long to see the day when you will be able to code without any issues or problems Amen. Love, @faniabdo99 --}} @php $customFields = json_decode($customer->custom_fields, true) ?? $customFields @endphp
@foreach($customFields as $key=>$field)
@if($field['type']=='checkbox') @else @endif
@endforeach
@endif
@include('sales::includes.redirect_popup')
@stop @section('extra_scripts') @endsection