@props([ 'id' => 'accountPickerModal', ]) @php $allAccounts = \App\Models\Account::orderBy('account_code')->get()->map(function($acc) { $bal = (float)$acc->getBalance(); return [ 'id' => $acc->id, 'code' => $acc->account_code, 'name' => $acc->name, 'type' => $acc->account_type, 'nature' => $acc->account_nature, 'currency' => $acc->currency ?? 'شيكل', 'classification' => $acc->classification ?? ($acc->is_postable ? 'حساب فرعي' : 'حساب رئيسي'), 'group' => $acc->account_group ?? 'عام', 'national_id' => $acc->national_id ?? '', 'is_postable' => $acc->is_postable, 'is_active' => $acc->is_active, 'system_tag' => $acc->system_tag, 'balance' => $bal, 'balance_formatted' => $bal < 0 ? '(' . number_format(abs($bal), 2) . ')' : number_format($bal, 2), 'equiv_balance' => $bal < 0 ? '(' . number_format(abs($bal), 2) . ')' : number_format($bal, 2), ]; }); @endphp