Новая логика поисковой выдачи

И добавлена кнопка Добавить карту в архив
This commit is contained in:
brusnitsyn
2025-12-26 17:41:25 +09:00
parent 329304076d
commit c5c1a2b3e1
14 changed files with 508 additions and 38 deletions

View File

@@ -2,21 +2,25 @@
namespace App\Http\Controllers;
use App\Http\Resources\IndexSttMedicalHistoryResource;
use App\Http\Resources\SI\SttMedicalHistoryResource as SiSttMedicalHistoryResource;
use App\Http\Resources\Mis\SttMedicalHistoryResource as MisSttMedicalHistoryResource;
use App\Models\ArchiveStatus;
use App\Models\SI\SttMedicalHistory;
use App\Repositories\MedicalHistoryRepository;
use App\Services\ArchiveCardService;
use Illuminate\Http\Request;
use Inertia\Inertia;
class IndexController extends Controller
{
private MedicalHistoryRepository $repository;
private ArchiveCardService $cardService;
public function __construct(MedicalHistoryRepository $repository)
public function __construct(MedicalHistoryRepository $repository, ArchiveCardService $cardService)
{
$this->repository = $repository;
$this->cardService = $cardService;
}
public function index(Request $request)
@@ -27,7 +31,15 @@ class IndexController extends Controller
$dateExtractTo = $request->get('date_extract_to', null);
$status = $request->get('status', null);
$data = $this->repository->unifiedSearch(
// $data = $this->repository->unifiedSearch(
// $searchText,
// $dateExtractFrom,
// $dateExtractTo,
// $status,
// $pageSize
// );
$data = $this->cardService->get(
$searchText,
$dateExtractFrom,
$dateExtractTo,
@@ -35,6 +47,8 @@ class IndexController extends Controller
$pageSize
);
// dd($data);
$statuses = ArchiveStatus::all()->map(function ($status) {
return [
'value' => $status->id,
@@ -42,13 +56,8 @@ class IndexController extends Controller
];
});
$statuses->push([
'value' => 0,
'label' => 'Нет в архиве',
]);
return Inertia::render('Home/Index', [
'cards' => MisSttMedicalHistoryResource::collection($data),
'cards' => IndexSttMedicalHistoryResource::collection($data),
'statuses' => $statuses,
'filters' => array_merge($request->only([
'search', 'date_extract_from', 'date_extract_to',