|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Ajax\Web\Meeting; |
|
4
|
|
|
|
|
5
|
|
|
use App\Ajax\CallableClass; |
|
6
|
|
|
use Siak\Tontine\Service\Meeting\SessionService; |
|
7
|
|
|
|
|
8
|
|
|
use function Jaxon\jq; |
|
9
|
|
|
use function trans; |
|
10
|
|
|
|
|
11
|
|
|
class Session extends CallableClass |
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* @param SessionService |
|
15
|
|
|
*/ |
|
16
|
|
|
public function __construct(protected SessionService $sessionService) |
|
17
|
|
|
{} |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @before checkRoundSessions |
|
21
|
|
|
* @after hideMenuOnMobile |
|
22
|
|
|
*/ |
|
23
|
|
|
public function home() |
|
24
|
|
|
{ |
|
25
|
|
|
$this->response->html('section-title', trans('tontine.menus.meeting')); |
|
26
|
|
|
$html = $this->render('pages.meeting.session.list'); |
|
27
|
|
|
$this->response->html('content-home', $html); |
|
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
$this->jq('#btn-sessions-refresh')->click($this->rq()->page()); |
|
30
|
|
|
|
|
31
|
|
|
return $this->page(); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function page(int $pageNumber = 0) |
|
35
|
|
|
{ |
|
36
|
|
|
$sessionCount = $this->sessionService->getSessionCount(); |
|
37
|
|
|
[$pageNumber, $perPage] = $this->pageNumber($pageNumber, $sessionCount, 'session', 'page'); |
|
38
|
|
|
$sessions = $this->sessionService->getSessions($pageNumber); |
|
39
|
|
|
$pagination = $this->rq()->page()->paginate($pageNumber, $perPage, $sessionCount); |
|
40
|
|
|
|
|
41
|
|
|
$html = $this->render('pages.meeting.session.page') |
|
42
|
|
|
->with('sessions', $sessions) |
|
43
|
|
|
->with('statuses', $this->sessionService->getSessionStatuses()) |
|
44
|
|
|
->with('pagination', $pagination); |
|
45
|
|
|
$this->response->html('content-page', $html); |
|
|
|
|
|
|
46
|
|
|
|
|
47
|
|
|
$sessionId = jq()->parent()->attr('data-session-id')->toInt(); |
|
48
|
|
|
$this->jq('.btn-session-show')->click($this->cl(Session\Home::class)->rq()->home($sessionId)); |
|
49
|
|
|
|
|
50
|
|
|
return $this->response; |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|