<?php
namespace Modules\Admin\BankOffices;

use \App\Mvc\View\Utils\Types\ListingColumn;
use \App\Mvc\View\Utils\Types\ListingColumns;

class View_List extends \App\Mvc\View_Window_PaginatedListing_ListAbstract
{
	/**
	 * Results per page list
	 */
	protected $resultsPerPageList = [5, 10, 15, 20, 25, 50, 100];

	/**
	 *
	 * {@inheritDoc}
	 * @see \App\Mvc\View_Window_PaginatedListing_ListAbstract::list_getThDetails()
	 */
	protected function list_getThDetails()
	{
		$columns = ListingColumns::create()
			->append( ListingColumn::create('name') )

			->append( ListingColumn::create('idBank'))

			->append( ListingColumn::create('address') )

			->append( ListingColumn::create('mfo') )

			->append( ListingColumn::create('swiftCode') )

			->append( ListingColumn::create('addTime')
				->setSortable('DESC')
				->setType('datetime')
			)

		->loadLabels($this->lang['index']['listCols'])
		->loadSettings($this->input['listingParams']->getDynamicColumnsSettings());

		return $columns;
	}

	/**
	 * (non-PHPdoc)
	 * @see \App\Mvc\ViewAbstract::render_prepare()
	 */
	protected function render_prepare($smarty)
	{
		$CFG   = \Engine\Loader_Cfg::getInstance()->getGlobal();
		$smarty->assign("enableAlternativeNames", $CFG['useAlternativeNames']['bankOfficeName']);
		$smarty->assign("enableAlternativeAddress", $CFG['useAlternativeNames']['bankOfficeAddress']);

		parent::render_prepare($smarty);
	}
}