<?php
namespace Modules\Admin\Config\Customers\Flags;

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)
	{
		//$toggleMandatoryIcon = \App\Config\CustomersFlags::getAdmin()->getMandatory() ? 'optional' : 'mandatory';
		$options
			// insert
			->append( \App\Mvc\View\Utils\RowOptions\Option\Popup::create("insert")
				->setDescription($this->lang['index']['options']['description']['insert'])
				->setIcon('add')
				->setSection('global')
				->setAction('insert')
				->setDimensions(450, 300)
			)

			// toggle mandatory
			->append(\App\Mvc\View\Utils\RowOptions\Container\OptionEmulator::create()->setSection('global')
				//set mandatory
				->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("setMandatory")
					->setDescription($this->lang['index']['options']['description']['setMandatory'])
					->setIcon("optional")
					->setJsCallback("MVC.listing.installedHandlers.listing.toggleMandatory();")
				)
				//unset mandatory
				->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("unsetMandatory")
					->setDescription($this->lang['index']['options']['description']['unsetMandatory'])
					->setIcon("mandatory")
					->setJsCallback("MVC.listing.installedHandlers.listing.toggleMandatory();")
				)
			)

			//set default
			->append(\App\Mvc\View\Utils\RowOptions\Container\OptionEmulator::create()
				// set default
				->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("setDefault")
					->setDescription($this->lang['index']['options']['description']['setDefault'])
					->setIcon("default")
					->setJsCallback("MVC.listing.installedHandlers.listing.setDefaultCurrentItem(this);")
				)

				// unset default
				->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("unsetDefault")
					->setDescription($this->lang['index']['options']['description']['unsetDefault'])
					->setIcon("defaultSelected")
					->setJsCallback("MVC.listing.installedHandlers.listing.unsetDefaultCurrentItem(this);")
				)
			)

			// move up
			->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("moveUp")
				->setDescription($this->lang['index']['options']['description']['moveUp'])
				->setIcon("moveUp")
				->setJsCallback("MVC.listing.installedHandlers.listing.moveUpCurrentItem(this);")
			)

			// move down
			->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("moveDown")
				->setDescription($this->lang['index']['options']['description']['moveDown'])
				->setIcon("moveDown")
				->setJsCallback("MVC.listing.installedHandlers.listing.moveDownCurrentItem(this);")
			)

			// move up bulk
			->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("moveUp")
				->setSection('bulk')
				->setDescription($this->lang['index']['options']['description']['moveUp'])
				->setIcon("moveUp")
				->setJsCallback("MVC.listing.installedHandlers.listing.moveUpSelected(this);")
			)

			// move down bulk
			->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("moveDown")
				->setSection('bulk')
				->setDescription($this->lang['index']['options']['description']['moveDown'])
				->setIcon("moveDown")
				->setJsCallback("MVC.listing.installedHandlers.listing.moveDownSelected(this);")
			)


			// update
			->append(\App\Mvc\View\Utils\RowOptions\Option\Popup::create("update")
				->setDescription($this->lang['index']['options']['description']['update'])
				->setIcon('edit')
				->setAction('update')
				->setDimensions(450, 300)
				->setKeyForCurrentRow('id')
			)


			// delete
			->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("delete")
				->setDescription($this->lang['index']['options']['description']['delete'])
				->setIcon("delete")
				->setJsCallback("MVC.listing.installedHandlers.listing.deleteCurrentItemWithConfirmation(this);")
			)

			// reset
			->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("reset")
				->setDescription($this->lang['index']['options']['description']['reset'])
				->setIcon("reset")
				->setSection('global')
				->setJsCallback("MVC.listing.installedHandlers.listing.resetWithConfirmation(this);")
			)

			// save
			->append(\App\Mvc\View\Utils\RowOptions\Option\Option::create("save")
				->setDescription($this->lang['index']['options']['description']['save'])
				->setIcon("save")
				->setSection('global')
				->setJsCallback("MVC.listing.installedHandlers.listing.saveWithConfirmation(this);")
			)
		;
	}

}
