<?php

loadController('base/module');

class ControllerDesignColors extends ControllerBaseModule
{
    protected $referencePathFile = 'design/colors';

    protected function loadScript()
    {
        $this->document->addScript([
            'view/public/js/design/colors.js',
            'view/javascript/chroma/chroma.min.js',
            'view/javascript/colorthief/color-thief.js',
        ]);

    }

    protected function breadcrumbs()
    {
        $this->dataVue['breadcrumbs'] = [
            [
                'href' => $this->url->link('common/home', 'token=' . $this->token, 'SSL'),
                'text' => $this->language->get('text_home'),
            ],
            [
                'href' => $this->url->link($this->referencePathFile, 'token=' . $this->token, 'SSL'),
                'text' => $this->language->get('heading_title'),
            ]
        ];
    }

    protected function actionUrls()
    {
        $this->dataVue['action'] = $this->url->link(
            "$this->referencePathFile/save",
            'token=' . $this->token,
            'SSL'
        );

        $this->dataVue['back'] = $this->url->link(
            'common/home',
            'token=' . $this->token,
            'SSL'
        );
    }

    public function loadModel()
    {
        parent::loadModel();
        $this->load->dmodel('tool/image');
    }

    public function loadData()
    {
        parent::loadData();

        $this->dataVue['logo'] = $this->dmodel_tool_image->resize($this->config->get('config_logo'), 150, 150);
        $this->dataVue['configurations'] = $this->model_setting_setting->getSetting('colors');
    }
}