<?php
loadcontroller('base/module');
class ControllerShippingDlog extends ControllerBaseModule 
{

	protected $referencePathFile = 'shipping/dlog';
	private $error = array();

	public function loadData() {

	$language = $this->load->language('shipping/dlog');
	$this->dataVue = array_merge($this->dataVue, $language);
	$this->document->setTitle($this->language->get('heading_title'));
	$this->load->helper('ftr_geral');

	$this->dataVue['ftr_geral'] = new ftr_geral();
	
	$this->load->type('tipocomum');
    $this->load->type('tipofrete');

    $this->load->model('setting/setting');
    $this->load->model('localisation/geo_zone');


	$this->dataVue['Type_Status']             = Type_Status::getEnumList();
    $this->dataVue['Type_dlog_modal_service'] = Type_DlogModalService::getEnumList();
	

	

  
	$this->dataVue['dlog_geo_zones'] = $this->model_localisation_geo_zone->getGeoZones();

	$this->template = 'shipping/dlog.twig';
	$this->children = array(
		'common/header',
		'common/footer'
	);

	
	$this->dataVue['configurations'] = $this->model_setting_setting->getSetting('dlog');
}


protected function loadModel()
    {
        parent::loadModel();
        $this->load->model('localisation/order_status');
    }

protected function saveSetting()
	{

		$this->load->language('shipping/dlog');
		$response = [];

		if (!$this->user->hasPermission('modify', 'shipping/dlog')) {
			$this->error['warning'] = "Acesso negado!";
		}

		

        $this->load->model('setting/setting');
		$this->model_setting_setting->editSetting('dlog', $this->request->post);
		
		return $this->response->setOutputJson($response);
	}

	protected function validate() {

		$this->load->helper('ftr_validacao');


		$this->loadLanguage();
		

		extract($this->request->post);
  	
	}
 }
