<?php

class general extends mainController {

    public function __construct() {
        parent::__construct();
        $this->load->model('general');
    }

    public function landing() {
        $vars['pageName'] = 'general';
        $vars['title'] = CommonLanguage::getMessage('general');
        $vars['system_name'] = CommonLanguage::getMessage('general');

        $vars['menu_blocks'] = array(
            array('msg' => 'archive', 'prmsn' => 'archive', 'icon' => 'fa fa-archive'
                  , 'detail' => array(
                      array('msg' => 'archive', 'prmsn' => 'archive_list', 'lnk' => SITE_LINK . 'general/archive_list', 'icon' => 'fa fa-list'),
                  )
                 ),
            array('msg' => 'route', 'prmsn' => 'route', 'icon' => 'fa fa-minus-circle'
                  , 'detail' => array(
                      array('msg' => 'route_list', 'prmsn' => 'route_list', 'lnk' => SITE_LINK . 'general/route_list', 'icon' => 'fa fa-list'),
                      array('msg' => 'route_schedule', 'prmsn' => 'route_schedule', 'lnk' => SITE_LINK . 'general/route_schedule', 'icon' => 'fa fa-list'),
                      array('msg' => 'inv_route_customer', 'prmsn' => 'inv_route_customer', 'lnk' => SITE_LINK . 'general/route_customer', 'icon' => 'fa fa-list'),
                      array('msg' => 'inv_route_report', 'prmsn' => 'inv_route_report', 'lnk' => SITE_LINK . 'general/route_report', 'icon' => 'fa fa-list'),
                      array('msg' => 'crm_route_customer', 'prmsn' => 'crm_route_customer', 'lnk' => SITE_LINK . 'general/route_customer/crm', 'icon' => 'fa fa-list'),
                      array('msg' => 'crm_route_report', 'prmsn' => 'crm_route_report', 'lnk' => SITE_LINK . 'general/route_report/crm', 'icon' => 'fa fa-list'),
                  )
                 )
        );
        $this->load->view('general', $vars);
    }
    public function archive_list() {
        $vars['pageName'] = 'archive_list';
        $vars['title'] = CommonLanguage::getMessage('archive_list');
        $vars['breadCrumb'] = [[generalModel::getmsg('general'), 'general'], [generalModel::getmsg('archive_list'), 'archive_list']];
        $this->load->view('general/archive_list', $vars);
    }
    public function route_list() {
        $vars['pageName'] = 'route_list';
        $vars['title'] = generalModel::getmsg('route_list');
        $vars['system_name'] = generalModel::getmsg('general');
        $vars['breadCrumb'] = [[generalModel::getmsg('general'), 'general'], [generalModel::getmsg('route_list'), 'route_list']];
        $this->load->view('general/route_list', $vars);
    }

    public function route_schedule() {
        $vars['pageName'] = 'route_schedule';
        $vars['title'] = generalModel::getmsg('route_schedule');
        $vars['system_name'] = generalModel::getmsg('general');
        $vars['breadCrumb'] = [[generalModel::getmsg('general'), 'general'], [generalModel::getmsg('route_schedule'), 'route_schedule']];
        $this->load->view('general/route_schedule', $vars);
    }
    public function route_customer() {
        preg_match("/\/crm\b/i", $_SERVER['REQUEST_URI'], $match_crm);
        $vars['is_crm'] = count($match_crm) > 0 ? true : false;
        $vars['pageName'] = $vars['is_crm'] ? 'crm_route_customer' : 'inv_route_customer';
        $vars['title'] = generalModel::getmsg($vars['is_crm'] ? 'crm_route_customer' : 'inv_route_customer');
        $vars['system_name'] = generalModel::getmsg('general');
        $vars['breadCrumb'] = [[generalModel::getmsg('general'), 'general'], [generalModel::getmsg($vars['is_crm'] ? 'crm_route_customer' : 'inv_route_customer'), 'route_customer'.($vars['is_crm'] ? '/crm' : '')]];
        $this->load->view('general/route_customer', $vars);
    }
    public function route_report() {
        preg_match("/\/crm\b/i", $_SERVER['REQUEST_URI'], $match_crm);
        $vars['is_crm'] = count($match_crm) > 0 ? true : false;
        $vars['pageName'] = $vars['is_crm'] ? 'crm_route_report' : 'inv_route_report';
        $vars['title'] = generalModel::getmsg($vars['is_crm'] ? 'crm_route_report' : 'inv_route_report');
        $vars['system_name'] = generalModel::getmsg('general');
        $vars['breadCrumb'] = [[generalModel::getmsg('general'), 'general'], [generalModel::getmsg($vars['is_crm'] ? 'crm_route_report' : 'inv_route_report'), 'route_report'.($vars['is_crm'] ? '/crm' : '')]];
        $this->load->view('general/route_report', $vars);
    }

}
