This commit is contained in:
antv
2026-07-17 14:19:34 +07:00
parent 7af5de6048
commit 98a56eb130
6 changed files with 426 additions and 96 deletions
+38 -4
View File
@@ -123,20 +123,54 @@ class UserController extends Controller
}
// New page: list of ThankCards received by the current user
public function receivedCards(Request $request): View
public function receivedCards(Request $request)
{
$selectedMonth = $request->input('month', Carbon::now()->format('Y-m'));
$user = Auth::user();
$data = $this->userService->getReceivedPageData($user, $selectedMonth);
if ($request->ajax() || $request->wantsJson()) {
$offset = (int) $request->input('offset', 0);
$limit = 12;
$data = $this->userService->getReceivedPageData($user, $selectedMonth, $limit, $offset);
$html = view('user.partials.received_cards_feed', ['cards' => $data['cards']])->render();
return response()->json([
'success' => true,
'html' => $html,
'hasMore' => $data['hasMore'],
'totalCards' => $data['totalCards'],
'totalSenders' => $data['totalSenders']
]);
}
$data = $this->userService->getReceivedPageData($user, $selectedMonth, 12, 0);
$data['selectedMonth'] = $selectedMonth;
return view('user.received', $data);
}
// New page: list of ThankCards sent by the current user
public function sentCards(Request $request): View
public function sentCards(Request $request)
{
$selectedMonth = $request->input('month', Carbon::now()->format('Y-m'));
$user = Auth::user();
$data = $this->userService->getSentPageData($user, $selectedMonth);
if ($request->ajax() || $request->wantsJson()) {
$offset = (int) $request->input('offset', 0);
$limit = 12;
$data = $this->userService->getSentPageData($user, $selectedMonth, $limit, $offset);
$html = view('user.partials.sent_cards_feed', ['cards' => $data['cards']])->render();
return response()->json([
'success' => true,
'html' => $html,
'hasMore' => $data['hasMore'],
'totalCards' => $data['totalCards'],
'totalReceivers' => $data['totalReceivers']
]);
}
$data = $this->userService->getSentPageData($user, $selectedMonth, 12, 0);
$data['selectedMonth'] = $selectedMonth;
return view('user.sent', $data);
}