@extends('layouts.app')
@section('title', 'تعديل الميزانية - '.config('app.name'))
@section('breadcrumb')
الرئيسية
›
المحاسبة
›
الموازنات
›
تعديل
@endsection
@section('content')
@php
$monthKeys = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
$budgetEditItems = old('items', $budget->items->map(function ($item) use ($monthKeys) {
$months = is_array($item->monthly_amounts) ? $item->monthly_amounts : [];
$payload = [
'account_id' => $item->account_id,
'cost_center_id' => $item->cost_center_id,
'target_total' => (float) $item->planned_amount,
];
foreach ($monthKeys as $key) {
$payload[$key] = (float) ($months[$key] ?? 0);
}
return $payload;
})->all());
@endphp
@endsection
@push('scripts')
@endpush