<?php
namespace Modules\Partners\Corporates;

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(750, 650)
			)

			->append(\App\Mvc\View\Utils\RowOptions\Option\Window::create("dashboard")
				->setDescription($this->lang['index']['options']['buttons']['dashboard'])
				->setIcon("quickNav")
				->setModule('Modules/Partners/Corporates/Dashboard')
				->setAction('index')
				->setKeyForCurrentRow('idEntity')
				->setOpenInNewTab(true)
			)

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

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

				->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create("profile")
					->setLabel($this->lang['index']['options']['buttons']['profile'])
					->setIcon("profile")
					->setModule("Modules/Partners/Corporates/Profile")
					->setAction('index')
					->setKeyForCurrentRow('id')
					->setDimensions(920, 520)
				)

				->append(\App\Mvc\View\Utils\RowOptions\Option\Window::create('corporateCreditCards')
					->setLabel($this->lang['index']['options']['buttons']['corporateCreditCards'])
					->setIcon('card')
					->setModule("Modules/Partners/Corporates/CreditCards")
					->setAction('index')
					->setKeyForCurrentRow("filters[corporate][id]")
					->addParam("listing[paramsSlot]", 1)
					->resetWindowListing()
					->setOpenInNewTab(true)
				)

				->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create("gdsProfile")
					->setLabel($this->lang['index']['options']['buttons']['gdsProfile'])
					->setIcon("profile")
					->setModule("Modules/Partners/Corporates/GdsProfile")
					->setAction('index')
					->setKeyForCurrentRow('id')
					->setDimensions(750, 500)
				)

				->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create("dueDatesManagement")
					->setLabel($this->lang['index']['options']['buttons']['dueDatesManagement'])
					->setIcon("profile")
					->setModule("Modules/Partners/DueDatesManagement")
					->setAction('index')
					->setKeyForCurrentRow('ids[0]')
					->addParam('entity', 'corporate')
					->setDimensions(1200, 520)
				)

				// separator
				->append(\App\Mvc\View\Utils\RowOptions\Option\Separator::create('separator_coll'))

				->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create("collectionProfile")
					->setLabel($this->lang['index']['options']['buttons']['collectionProfile'])
					->setIcon('settings')
					->setModule('Modules/Partners/Corporates/CollectionProfile')
					->setAction('index')
					->setDimensions(800, 650)
					->addParamFromJs('idCompany', "MVC.listing.installedHandlers.listing.getItemId(this)")
				)
				->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("sendAlert")
					->setLabel($this->lang['index']['options']['buttons']['sendAlert'])
					->setIcon('email')
					->setJsCallback("MVC.listing.installedHandlers.listing.sendEmailWithConfirmation(this);")
				)

				// separator
				->append(\App\Mvc\View\Utils\RowOptions\Option\Separator::create('separator_opt'))

				->append(\App\Mvc\View\Utils\RowOptions\Container\OptionEmulator::create()
					->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create("lock")
						->setLabel($this->lang['index']['options']['buttons']['lock'])
						->setAction("lock")
						->setDimensions(550, 350)
						->setKeyForCurrentRow('id')
					)
					->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("unlock")
						->setLabel($this->lang['index']['options']['buttons']['unlock'])
						->setJsCallback("MVC.listing.installedHandlers.listing.unlockCurrent(this);")
					)
				)

				->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("unmarkDuplicate")
					->setLabel($this->lang['index']['options']['buttons']['unmarkDuplicate'])
					->setIcon('unmerge')
					->setJsCallback("MVC.listing.installedHandlers.listing.unmarkDuplicateItemsWithConfirmation(this);")
				)

				// separator
				->append(\App\Mvc\View\Utils\RowOptions\Option\Separator::create('separator_refs'))

				// compensate
				->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create("autoCompensate")
					->setLabel($this->lang['index']['options']['buttons']['autoCompensate'])
					->setIcon("balance")
					->setModule('Modules/Partners/Corporates/AutoCompensate')
					->setAction('index')
					->setDimensions(1000, 550)
					->setKeyForCurrentRow('idCorporate')
				)

				// separator
				->append(\App\Mvc\View\Utils\RowOptions\Option\Separator::create('separator_compensate'))

				->append(\App\Mvc\View\Utils\RowOptions\Option\Window::create("listOffices")
					->setLabel($this->lang['index']['options']['buttons']['listOffices'])
					->setIcon("offices")
					->setModule("Modules/Partners/Corporates/Offices")
					->setAction('index')
					->setKeyForCurrentRow('filters[corporate][id]')
					->addParam('listing[paramsSlot]', 1)
					->resetWindowListing()
					->setOpenInNewTab(true)
				)

				->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("addCustomer")
					->setLabel($this->lang['index']['options']['buttons']['addCustomer'])
					->setJsCallback("customerInsert('idCorporate[id]='+MVC.listing.installedHandlers.listing.getItemId(this))")
					->setIcon("userAdd")
				)

				->append(\App\Mvc\View\Utils\RowOptions\Option\Window::create("listCustomers")
					->setLabel($this->lang['index']['options']['buttons']['listCustomers'])
					->setIcon("users")
					->setModule('Modules/Partners/Customers')->setAction('index')
					->addParam('filters[clientType]', 'withCompany')
					->resetWindowListing()
					->addParamFromJs('filters[corporate][id]', 'MVC.listing.installedHandlers.listing.getItemId(this)')
					->setOpenInNewTab(true)
				)

				->append(\App\Mvc\View\Utils\RowOptions\Option\Window::create("contactPersons")
					->setLabel($this->lang['index']['options']['buttons']['contactPersons'])
					->setIcon("contacts")
					->setModule("Modules/Partners/Corporates/ContactPersons")
					->setAction('index')
					->addParamFromJs('filters[corporate][id]', "MVC.listing.installedHandlers.listing.getItemId(this)")
					->addParam('listing[paramsSlot]', 1)
					->resetWindowListing()
					->setOpenInNewTab(true)
				)

				->append(\App\Mvc\View\Utils\RowOptions\Option\Window::create("contacts")
					->setLabel($this->lang['index']['options']['buttons']['contacts'])
					->setIcon("userContact")
					->setModule("Modules/Partners/Corporates/Contacts")
					->setAction('index')
					->addParamFromJs('filters[corporate][id]', "MVC.listing.installedHandlers.listing.getItemId(this)")
					->addParam('listing[paramsSlot]', 1)
					->resetWindowListing()
					->setOpenInNewTab(true)
				)

				->append(\App\Mvc\View\Utils\RowOptions\Option\Window::create("contracts")
					->setLabel($this->lang['index']['options']['buttons']['contracts'])
					->setIcon("contracts")
					->setModule("Modules/Partners/Corporates/Contracts")
					->setAction('index')
					->addParamFromJs('filters[corporate][id]', "MVC.listing.installedHandlers.listing.getItemId(this)")
					->addParam('listing[paramsSlot]', 1)
					->setOpenInNewTab(true)
				)

				->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("supplierInsert")
					->setLabel($this->lang['index']['options']['buttons']['addSupplier'])
					->setJsCallback("supplierInsert('inheritFromIdCorporate='+MVC.listing.installedHandlers.listing.getItemId(this));")
					->setIcon("add")
				)

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

			)

			->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create("markDuplicate")
				->setDescription($this->lang['index']['options']['buttons']['markDuplicate'])
				->setIcon("merge")
				->setAction("markDuplicate")
				->setDimensions(600, 300)
				->setSection('bulk')
			)

			->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create("bulkUpdate")
				->setDescription($this->lang['index']['options']['buttons']['bulkUpdate'])
				->setIcon("edit2")
				->setAction("bulkUpdate")
				->setDimensions(700, 500)
				->setSection('bulk')
			)

			->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create("addRemarksBulk")
				->setDescription($this->lang['index']['options']['buttons']['addBulkRemarks'])
				->setModule('Modules/Utils/AddRemarksBulk')
				->setAction('index')
				->setSection('bulk')
				->addParamFromJs('ids', "MVC.listing.installedHandlers.listing.getSelectedIds(this)")
				->addParam('remarkType', 'corporate')
				->setIcon('quickDetails')
				->setDimensions(700, 500)
			)

			->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create("dueDatesManagement")
				->setDescription($this->lang['index']['options']['buttons']['dueDatesManagement'])
				->setIcon("profile")
				->setModule("Modules/Partners/DueDatesManagement")
				->setAction('index')
				->addParamFromJs('ids', "MVC.listing.installedHandlers.listing.getSelectedIds(this)")
				->addParam('entity', 'corporate')
				->setDimensions(1200, 520)
				->setSection('bulk')
			)

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



	}

}
