<?php

if (!defined('ACCOUNT_AREA')) {
  include(PATH . 'control/system/headers/403.php');
  exit;
}

include(LANG_FLDR . 'footer.php');
include(LANG_FLDR . 'commissions.php');
include(LANG_FLDR . 'payments.php');
include(LANG_FLDR . 'home.php');

$loadJS[] = 'sort-table';
$loadJS[] = 'date-picker';
$jsParams = array(
  'lang' => $DT->jslang($msw_cal)
);
$sysTitle = $msw_footer[9] . ': ' . mswCD($SETTINGS->website);

include(PATH . 'control/system/modules/_header.php');

$PGS = new pages(array(
  'count' => $HTML->payments(array(
    'id' => $loggedInUser['id'],
    'limit' => $limit,
    'count' => 'yes'
  )),
  'text' => $msw_pages,
  'page' => $page,
  'admin' => 'no',
  'flag' => '',
  'limit' => DEF_PER_PAGE,
  's' => $SETTINGS
));

$templateParams = [
  'TEXT' => $msw_payments,
  'FTEXT' => $msw_footer,
  'HTEXT' => $msw_home,
  'CTEXT' => $msw_commissions,
  'PAYMENTS' => $HTML->payments([
    'id' => $loggedInUser['id'],
    'limit' => $limit,
    'lang' => [$msw_common, $msw_common2]
  ]),
  'PAGES' => $PGS->display(),
  'TOTALS' => [
    $ACC->totals(['area' => 'commissions', 'id' => $loggedInUser['id']]),
    $ACC->totals(['area' => 'payments', 'id' => $loggedInUser['id']]),
    $ACC->totals(['area' => 'referrals', 'id' => $loggedInUser['id']])
  ],
  'LAST_PAYMENT' => $ACC->totals(['area' => 'last_payment', 'id' => $loggedInUser['id']])
];

// Global..
include(PATH . 'control/system/global.php');

$latte->render('acc-payments.tpl', $templateParams);

include(PATH . 'control/system/modules/_footer.php');

?>
