@extends('layouts.master')
@section('css')
@endsection
@section('title')
{{ __('home.home') }}
@stop
@section('page-header')
{{-- ================= HERO ================= --}}
{{ $greet }}
{{ $t('أهلاً', 'Welcome') }}، {{ Auth::user()->name }} 👋
{{ $t('ده ملخص سريع لأداء النشاط النهارده', "Here's a quick overview of today's activity") }}
{{ ($isAdminBranch ?? false) ? $t('بيانات كل الفروع', 'All branches') : $t('بيانات فرعك فقط', 'Your branch only') }}
{{-- ================= حالة الأسطول (لكل المستخدمين) ================= --}}
@if (!empty($fleet))
{{ $t('الشاحنات المتاحة في كل منطقة (ملك المؤسسة)', 'Available own trucks by region') }}
@foreach ($fleet['byRegion'] as $reg => $cnt)
@if ($reg !== 'غير محدد' || $cnt > 0)
{{ $cnt }}
{{ $reg }}
@endif
@endforeach
@forelse ($fleet['loadedList']->take(8) as $trip)
{{ optional($trip->truck)->plate_number }}
{{ $trip->from_region }}
{{ $trip->to_region }}
{{ $trip->load_type }}{{ $trip->driver_name ? ' · ' . $trip->driver_name : '' }}{{ optional($trip->driver)->phone ? ' · ' . $trip->driver->phone : '' }}
@if (optional($trip->driver)->phone)
@endif
@if ($trip->is_overdue) {{ $t('متأخرة', 'Overdue') }}@endif
{{ optional($trip->expected_unloading_at)->format('m/d h:i A') }}
@empty
{{ $t('مفيش شاحنات محمّلة دلوقتي', 'No loaded trucks right now') }}
@endforelse
@if ($fleet['loaded'] > 8)
{{ $t('عرض الكل', 'View all') }} ({{ $fleet['loaded'] }})
@endif
@endif
@can('Home')
{{-- ================= KPIs ================= --}}
@php
$d1 = $delta($all['trx_today_count'], $all['trx_yest_count']);
$d2 = $delta($all['liq_today_count'], $all['liq_yest_count']);
@endphp
{{ $d1[1] }}
{{ __('home.salesdoday') }}
0{{ __('home.invoice') }}
{{ $t('الشهر', 'Month') }}
{{ __('home.TOTAL_EARNINGS_Month') }}
0{{ $sar }}
{{ $d2[1] }}
{{ __('home.liquitiondoday') }}
0{{ __('home.invoice') }}
{{ $t('بوليصات الشحن', 'Waybills') }}
{{ $t('بوليصات اليوم', 'Waybills today') }}
0{{ $t('بوليصة', 'waybills') }}
{{-- ================= Charts ================= --}}
{{ $t('التحويلات مقابل التصفيات', 'Transfers vs Liquidations') }} {{ $t('آخر 7 أيام', 'Last 7 days') }}
{{ $t('عدد العمليات اليومية', 'Daily operations count') }}
@php
$tc = $all['liq_today_confirmed']; $tu = $all['liq_today_unconfirmed']; $tt = max(1, $tc + $tu);
$mc = $all['liq_month_confirmed']; $mu = $all['liq_month_unconfirmed']; $mt = max(1, $mc + $mu);
@endphp
{{ __('home.liquitiondoday_confirm') }} / {{ __('home.liquitiondoday_notconfirm') }}
{{ $t('حالة التصفيات اليوم والشهر', 'Liquidation status today & this month') }}
{{ __('home.liquitiondoday_confirm') }}
0
{{ __('home.liquitiondoday_confirm_month') }}: {{ $mc }}
{{ __('home.liquitiondoday_notconfirm') }}
0
{{ __('home.liquitiondoday_notconfirm_month') }}: {{ $mu }}
{{-- ================= Accounts ================= --}}
@if ($accounts->count())
{{ $t('الحسابات المالية', 'Financial accounts') }}
{{ $accounts->count() }}
@foreach ($accounts as $k => $acc)
{{ mb_substr(trim($acc->name), 0, 1) }}
@endforeach
{{ $t('العهد', 'Custody') }}
{{ $t('أرصدة حسابات العهدة', 'Custody account balances') }}
@endif
{{-- ================= Recent ================= --}}
@if ($wb['enabled'])
{{ $t('أحدث بوليصات الشحن', 'Latest waybills') }} {{ ($isAdminBranch ?? false) ? $t('كل الفروع', 'All branches') : $t('فرعك', 'Your branch') }} {{ $t('عرض الكل', 'View all') }}
| # | {{ $t('العميل', 'Customer') }} | {{ $t('السائق', 'Driver') }} | {{ $t('المدينة', 'City') }} | {{ $t('الأجرة', 'Fare') }} | |
@forelse ($wb['recent'] as $w)
| {{ $w->waybill_no }} |
{{ \Illuminate\Support\Str::limit($w->customer_name, 22) }} |
{{ \Illuminate\Support\Str::limit($w->driver_name, 18) }} |
{{ $w->destination_city }} |
{{ number_format($w->total_fare, 2) }} |
|
@empty
| {{ $t('لا توجد بوليصات بعد', 'No waybills yet') }} |
@endforelse
@endif
{{ $t('أحدث التحويلات', 'Latest transfers') }} {{ ($isAdminBranch ?? false) ? $t('كل الفروع', 'All branches') : $t('فرعك', 'Your branch') }} {{ $t('عرض الكل', 'View all') }}
| # | {{ $t('المحوَّل له', 'Transferred to') }} | {{ $t('المبلغ', 'Amount') }} | {{ $t('التاريخ', 'Date') }} |
@forelse ($recentTrx as $tr)
| {{ $tr->id }} |
{{ \Illuminate\Support\Str::limit($tr->to_name ?: '—', 28) }}
@if ($tr->from_name || $tr->by_name)
@if ($tr->from_name){{ $t('من', 'From') }}: {{ \Illuminate\Support\Str::limit($tr->from_name, 24) }}@endif
@if ($tr->by_name)· {{ $t('بواسطة', 'by') }} {{ $tr->by_name }}@endif
@endif
|
{{ number_format((float) $tr->price, 2) }} |
{{ $tr->date ? \Carbon\Carbon::parse($tr->date)->format('Y/m/d') : optional($tr->created_at)->format('Y/m/d') }} |
@empty
| {{ $t('لا توجد تحويلات', 'No transfers') }} |
@endforelse
{{-- ================= Recent liquidations (الإدارة) ================= --}}
{{ $t('أحدث التصفيات', 'Latest liquidations') }} {{ ($isAdminBranch ?? false) ? $t('كل الفروع', 'All branches') : $t('فرعك', 'Your branch') }} {{ $t('عرض الكل', 'View all') }}
| # | {{ $t('النوع', 'Type') }} | {{ $t('الفرع', 'Branch') }} | {{ $t('بواسطة', 'By') }} |
{{ $t('المبلغ', 'Amount') }} | {{ $t('الحالة', 'Status') }} | {{ $t('التاريخ', 'Date') }} | |
@forelse ($recentLiq ?? [] as $lq)
| {{ $lq->id }} |
@if ($lq->type == 1) {{ __('home.liquidation_shipments') }}
@elseif ($lq->type == 2) {{ __('home.liquidation_purchase') }}
@else — @endif
|
{{ optional($lq->branch)->name ?? '—' }} |
{{ optional($lq->user)->name ?? '—' }} |
{{ number_format((float) $lq->price_filtering, 2) }} |
@if ($lq->status == 2) {{ __('home.confirm_done') }}
@elseif ($lq->status == 3) {{ __('home.pratiail_of_review') }}
@else {{ __('home.data_complete') }} @endif
|
{{ optional($lq->created_at)->format('Y/m/d') }} |
@if ($lq->type == 1)
@elseif ($lq->type == 2)
@endif
|
@empty
| {{ $t('لا توجد تصفيات', 'No liquidations') }} |
@endforelse
@endcan
{{-- ================= Branch ================= --}}
@if ($branch)
{{ $t('أداء فرعي', 'My branch') }}
{{ $t('فرعي', 'Branch') }}
{{ $t('اليوم', 'Today') }}
{{ __('home.salesdoday') }}
0{{ __('home.invoice') }}
{{ $t('الشهر', 'Month') }}
{{ __('home.TOTAL_EARNINGS_Month') }}
0{{ $sar }}
{{ $t('اليوم', 'Today') }}
{{ __('home.liquitiondoday') }}
0{{ __('home.invoice') }}
{{ $t('الشهر', 'Month') }}
{{ __('home.PRODUCT_number_SOLD_liquition') }}
0{{ __('home.invoice') }}
@endif
@include('trucks._unload_quick')
@include('trucks._load_quick')
@endsection
@section('js')
@endsection