<?php
class ftr_proccess {

  public function __construct($registry) {
    $this->registry = $registry;
    $this->load     = $registry->get('load');
	  $this->config   = $registry->get('config');
	  $this->session  = $registry->get('session');
    $this->db       = $registry->get('db');
    $this->cache    = $registry->get('cache');
    $this->request  = $registry->get('request');
    $this->ftrgeralregistry  = $registry->get('ftrgeralregistry');
	}

  public function getProcessIcon($type){

    $this->load->type('tipofuturaserver');

    $icon = array(
      Type_ContrlProcVenda::TpStContrlProcVenda_ProdInicial => 'fas fa-shopping-cart',
      Type_ContrlProcVenda::TpStContrlProcVenda_LiberaoFinanceira => 'fas fa-dollar-sign',
      Type_ContrlProcVenda::TpStContrlProcVenda_LiberacaoSeparacao => 'fas fa-box-open',
      Type_ContrlProcVenda::TpStContrlProcVenda_LiberacaoConferencia => 'fas fa-clipboard-check',
      Type_ContrlProcVenda::TpStContrlProcVenda_LiberacaoBaixa => 'fas fa-cash-register',
      Type_ContrlProcVenda::TpStContrlProcVenda_LiberacaoFaturamento => 'fas fa-file-alt',
      Type_ContrlProcVenda::TpStContrlProcVenda_LiberacaoControleEntrega => 'fas fa-truck',
      Type_ContrlProcVenda::TpStContrlProcVenda_PedidoCancelado => 'fas fa-times',
	  Type_ContrlProcVenda::TpStContrlProcVenda_ConferenciaEntrega =>'fas fa-clipboard-check'
    );

    $iconApp = array(
      Type_ContrlProcVenda::TpStContrlProcVenda_ProdInicial => '&#xe8cc',
      Type_ContrlProcVenda::TpStContrlProcVenda_LiberaoFinanceira => '&#xe227',
      Type_ContrlProcVenda::TpStContrlProcVenda_LiberacaoSeparacao => '&#xe168',
      Type_ContrlProcVenda::TpStContrlProcVenda_LiberacaoConferencia => '&#xe862',
      Type_ContrlProcVenda::TpStContrlProcVenda_LiberacaoBaixa => '&#xe53e',
      Type_ContrlProcVenda::TpStContrlProcVenda_LiberacaoFaturamento => '&#xe8b0',
      Type_ContrlProcVenda::TpStContrlProcVenda_LiberacaoControleEntrega => '&#xe558',
      Type_ContrlProcVenda::TpStContrlProcVenda_PedidoCancelado => '&#xe5cd',
	  Type_ContrlProcVenda::TpStContrlProcVenda_ConferenciaEntrega =>'&#xe862'
    );

    return ($this->ftrgeralregistry->isApp()) ? $iconApp[$type] : $icon[$type];
  }

  public function getProcessStatusToSetColor($type){

    $this->load->type('tipofuturaserver');

    switch ($type) {
      case Type_StatusProcVenda::TpStProcVend_Iniciado :
        $statusClassColor = 'background-process-default';
        break;
      case Type_StatusProcVenda::TpStProcVend_Finalizado :
        $statusClassColor = 'background-process-success';
        break;
      case Type_StatusProcVenda::TpStProcVend_EmErro :
      case Type_ContrlProcVenda::TpStContrlProcVenda_PedidoCancelado :
        $statusClassColor = 'background-process-error';
        break;

      default:
        $statusClassColor = 'background-process-default';
        break;
    }

    return $statusClassColor;

  }

  public function getProcessStatus($type){

    $this->load->type('tipofuturaserver');

    switch ($type) {
      case Type_StatusProcVenda::TpStProcVend_Iniciado :
        $statusType = 'sale-process-default';
        break;
      case Type_StatusProcVenda::TpStProcVend_Finalizado :
        $statusType = 'sale-process-success';
        break;
      case Type_StatusProcVenda::TpStProcVend_EmErro :
        $statusType = 'sale-process-error';
        break;
      default:
        $statusType = 'sale-process-default';
        break;
    }

    return $statusType;

  }


}
