Changes to import / template pages frontend updated design
This commit is contained in:
@@ -21,14 +21,35 @@ class ImportController extends Controller
|
||||
// List imports (paginated)
|
||||
public function index(Request $request)
|
||||
{
|
||||
$paginator = Import::query()
|
||||
$query = Import::query()
|
||||
->with([
|
||||
'client:id,uuid,person_id',
|
||||
'client.person:id,uuid,full_name',
|
||||
'template:id,name',
|
||||
])
|
||||
->orderByDesc('created_at')
|
||||
->paginate(15);
|
||||
->orderByDesc('created_at');
|
||||
|
||||
// Apply search filter
|
||||
if ($search = $request->input('search')) {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('original_name', 'LIKE', "%{$search}%")
|
||||
->orWhere('status', 'LIKE', "%{$search}%")
|
||||
->orWhereHas('client.person', function ($q) use ($search) {
|
||||
$q->where('full_name', 'LIKE', "%{$search}%");
|
||||
})
|
||||
->orWhereHas('template', function ($q) use ($search) {
|
||||
$q->where('name', 'LIKE', "%{$search}%");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Get per_page from request, default to 25
|
||||
$perPage = (int) $request->input('per_page', 25);
|
||||
if ($perPage < 1 || $perPage > 100) {
|
||||
$perPage = 25;
|
||||
}
|
||||
|
||||
$paginator = $query->paginate($perPage);
|
||||
|
||||
$imports = [
|
||||
'data' => $paginator->items(),
|
||||
|
||||
@@ -547,6 +547,7 @@ public function updateMapping(Request $request, ImportTemplate $template, Import
|
||||
'options' => 'nullable|array',
|
||||
'position' => 'nullable|integer',
|
||||
])->validate();
|
||||
|
||||
$mapping->update([
|
||||
'source_column' => $data['source_column'],
|
||||
'entity' => $data['entity'] ?? null,
|
||||
@@ -557,8 +558,7 @@ public function updateMapping(Request $request, ImportTemplate $template, Import
|
||||
'position' => $data['position'] ?? $mapping->position,
|
||||
]);
|
||||
|
||||
return redirect()->route('importTemplates.edit', ['template' => $template->uuid])
|
||||
->with('success', 'Mapping updated');
|
||||
return back()->with('success', 'Mapping updated');
|
||||
}
|
||||
|
||||
// Delete a mapping
|
||||
|
||||
Reference in New Issue
Block a user