m
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user