<?php
namespace Modules\Partners\Corporates\Offices;

class View_Options extends \App\Mvc\View_Window_PaginatedListing_OptionsAbstract
{
	/**
	 * (non-PHPdoc)
	 * @see \App\Mvc\View_Window_PaginatedListing_OptionsAbstract::populateDefinedOptions()
	 */
	public function populateDefinedOptions(\App\Mvc\View\Utils\RowOptions\Container\Simple $options)
	{
		$options
			->append(\App\Mvc\View\Utils\RowOptions\Option\Popup\Insert::create("insert")
				->setDescription($this->lang['index']['options']['buttons']['insert'])
				->setDimensions(800, 570)
				->addParamFromJs('corporate[id]', "\$F('filters_corporate_')")
			)

			->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("setDefault")
				->setDescription($this->lang['index']['options']['buttons']['setDefault'])
				->setIcon("default")
				->setJsCallback("MVC.listing.installedHandlers.listing.setDefaultSelectedItemsWithConfirmation(this)")
			)

			->append(\App\Mvc\View\Utils\RowOptions\Option\Popup\Update::create("update")
				->setDescription($this->lang['index']['options']['buttons']['update'])
				->setDimensions(800, 570)
			)

			->append(\App\Mvc\View\Utils\RowOptions\Container\OptionsMenu::create("mainOptions")

				->append(\App\Mvc\View\Utils\RowOptions\Option\Window::create("listCorporate")
					->setLabel($this->lang['index']['options']['buttons']['listCorporate'])
					->setIcon("company")
					->setModule("Modules/Partners/Corporates")
					->setAction('index')
					->addParamFromJs('filters[text]', "MVC.listing.installedHandlers.listing.getItemData(this).get('idCorporate')")
					->addParam('filters[searchField]', "corp.id")
					->addParam('filters[searchMode]', "exact")
					->addParam('listing[paramsSlot]', 1)
					->resetWindowListing()
				)

				->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create("addContactPerson") // TODO: la adaugare sa nu faca refresh pagina in spate
					->setLabel($this->lang['index']['options']['buttons']['addContactPerson'])
					->setIcon("userAdd")
					->setModule("Modules/Partners/Corporates/ContactPersons")->setAction("insert")
					->addParamFromJs('office[id]', "MVC.listing.installedHandlers.listing.getItemId(this)")
					->setDimensions(750, 560)
				)
				->append(\App\Mvc\View\Utils\RowOptions\Option\Delete::create("delete")
					->setLabel($this->lang['index']['options']['buttons']['delete'])
				)

			)
			->append(\App\Mvc\View\Utils\RowOptions\Option\DeleteSelected::create("delete")
				->setDescription($this->lang['index']['options']['buttons']['delete'])
			)

		;
	}

}
