Importer update add support for meta data and multiple inserts for some entities like addresses and phones, updated other things

This commit is contained in:
Simon Pocrnjič
2025-10-09 22:28:48 +02:00
parent c8029c9eb0
commit 0598261cdc
27 changed files with 2517 additions and 375 deletions
+45 -3
View File
@@ -18,9 +18,15 @@ public function index(Request $request)
->whereNull('cancelled_at')
->with([
'contract' => function ($q) {
$q->with(['type:id,name', 'account', 'clientCase.person' => function ($pq) {
$pq->with(['addresses', 'phones']);
}]);
$q->with([
'type:id,name',
'account',
'clientCase.person' => function ($pq) {
$pq->with(['addresses', 'phones']);
},
'clientCase.client:id,uuid,person_id',
'clientCase.client.person:id,full_name',
]);
},
])
->orderByDesc('assigned_at')
@@ -29,6 +35,41 @@ public function index(Request $request)
return Inertia::render('Phone/Index', [
'jobs' => $jobs,
'view_mode' => 'assigned',
]);
}
public function completedToday(Request $request)
{
$userId = $request->user()->id;
$start = now()->startOfDay();
$end = now()->endOfDay();
$jobs = FieldJob::query()
->where('assigned_user_id', $userId)
->whereNull('cancelled_at')
->whereBetween('completed_at', [$start, $end])
->with([
'contract' => function ($q) {
$q->with([
'type:id,name',
'account',
'clientCase.person' => function ($pq) {
$pq->with(['addresses', 'phones']);
},
'clientCase.client:id,uuid,person_id',
'clientCase.client.person:id,full_name',
]);
},
])
->orderByDesc('completed_at')
->limit(100)
->get();
return Inertia::render('Phone/Index', [
'jobs' => $jobs,
'view_mode' => 'completed-today',
]);
}
@@ -136,6 +177,7 @@ public function showCase(\App\Models\ClientCase $clientCase, Request $request)
'account_types' => \App\Models\AccountType::all(),
'actions' => \App\Models\Action::with('decisions')->get(),
'activities' => $activities,
'completed_mode' => (bool) $request->boolean('completed'),
]);
}
}