✏️ 正在编辑: CallcenterAtendimento.php
路径:
/srv/systems_dir/yuppiecred/application/forms/CallcenterAtendimento.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Form_CallcenterAtendimento extends Core_Form { private $_params = array(); public function init() { $request = Zend_Controller_Front::getInstance()->getRequest(); $this->_params = $request->getParams(); $this->setAction($this->getView()->url(array( 'action' => 'save-cliente' ))); $this->setName('cliente'); $this->setAttrib('onsubmit', 'return validarForm(this);'); $this->addElement('hidden', 'id', array( 'class' => 'invisivel' )); $element = $this->createElement('hidden', 'chamada_id', array( 'class' => 'invisivel' )); $element->setDecorators([ 'ViewHelper', 'Errors', [ 'HtmlTag', [ 'tag' => 'dt', 'class'=>'invisivel' ] ] ]); $this->addElement($element); $element = $this->createElement('hidden', 'ativo', array( 'class' => 'invisivel' )); $element->setDecorators([ 'ViewHelper', 'Errors', [ 'HtmlTag', [ 'tag' => 'dt', 'class'=>'invisivel' ] ] ]); $this->addElement($element); $this->addElement('text', 'nome', array( 'label' => 'Nome:', 'size' => 35, 'required' => true, 'class' => 'require' )); $select = new Zend_Form_Element_Select('tipo_pessoa'); $select->setLabel('Tipo de pessoa:') ->addMultiOptions([ '' => '', 'fisica' => 'FÍSICA', 'juridica' => 'JURÍDICA' ]); $this->addElement($select); $this->getElement('tipo_pessoa')->setAttrib('onchange', 'camposClienteEmpresaCallcenter(this)'); $this->addElement('text', 'cpf', array( 'label' => 'CPF:', 'onkeypress' => 'mascara(this, cpfCnpj)', 'maxlength' => 18, 'required' => true, 'class' => 'require', 'validators' => array( new Validators_CpfCnpj() ) )); $this->addElement('text', 'razao_social', array( 'label' => 'Razão social:', 'size' => 35 )); $this->addElement('text', 'nome_responsavel', array( 'label' => 'Nome responsável:', 'size' => 35 )); $this->addElement('text', 'cpf_responsavel', array( 'label' => 'CPF responsável:', 'onkeypress' => 'mascara(this, fcpf)', 'maxlength' => 14, 'validators' => array( new Validators_Cpf() ) )); $this->addElement('text', 'rg', array( 'label' => 'RG:', )); $this->addElement('text', 'orgao_expedidor', array( 'label' => 'Órgão Expedidor:', )); $this->addElement('text', 'data_expedicao', [ 'label' => 'Data Expedição:', 'onkeypress' => 'mascara(this, data)', 'maxlength' => 10, 'size' => 11 ]); $this->addElement('text', 'data_nascimento', array( 'label' => 'Data Nascimento:', 'onkeypress' => 'mascara(this, data)', 'maxlength' => 10, 'size' => 11, 'validators' => array( new Validators_DataNascimento() ) )); $this->addElement('select', 'sexo', [ 'label' => 'Sexo:', 'multiOptions' => [ '' => '', 'F' => 'F', 'M' => 'M', ] ]); $this->addElementWith('nome_mae', $this->getOptions('Nome Mãe:', 35)) ->addElementWith('nome_pai', $this->getOptions('Nome Pai:', 35)); $this->getElement('nome_mae')->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addElement('text', 'endereco', array( 'label' => 'Endereço:', 'size' => 35, )); $this->addElement('text', 'complemento', array( 'label' => 'Complemento:', 'size' => 35, )); $this->addElement('text', 'bairro', array( 'label' => 'Bairro:', )); $this->addElement('text', 'cidade', array( 'label' => 'Cidade:', )); $this->addElement('text', 'uf', array( 'label' => 'UF:', 'maxlength' => 2, 'size' => 3, 'validators' => array( new Validators_Uf() ) )); $this->addElement('text', 'cep', array( 'label' => 'CEP:', 'maxlength' => 8, 'onchange'=> "initBuscaEndereco(this, 'f_save_base-')" )); $this->getElement('cep')->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addElement('text', 'email', array( 'label' => 'E-mail:', 'validators' => array( 'EmailAddress' ), 'size' => 35 )); $this->addElement('text', 'email2', array( 'label' => 'E-mail 2:', 'validators' => array( 'EmailAddress' ), 'size' => 35 )); $this->addElement('text', 'email3', array( 'label' => 'E-mail 3:', 'validators' => array( 'EmailAddress' ), 'size' => 35 )); $this->addElement('text', 'sigla_upg', array( 'label' => 'Sigla UPG:', 'maxlength' => 15 )); $this->addElement('text', 'senha_contra_cheque', array( 'label' => 'Senha contra-cheque:', 'class' => 'not_upper', 'maxlength' => 20 )); $this->addElement('text', 'cargo', array( 'label' => 'Cargo:', 'maxlength' => 20 )); $select = new Zend_Form_Element_Select('secretaria_id'); $select->setLabel('Secretaria:') ->addMultiOptions(Core_Combos::getSecretariasOptions()); $this->addElement($select); $this->getElement('secretaria_id')->setAttrib('class', 'select_orgao'); $select = new Zend_Form_Element_Select('orgao_id'); $select->setLabel('Orgão:') ->addMultiOptions(Core_Combos::getOrgaosOptions()); $this->addElement($select); $this->getElement('orgao_id')->setAttrib('class', 'select_orgao'); $this->addElement('checkbox', 'obito', array( 'label' => 'Possível Óbito:', )); $this->addElement('checkbox', 'rep_legal', array( 'label' => 'Representante Legal:', )); $this->addElement('select', 'midia_origem_id', [ 'label' => 'Mídia Origem:', 'multiOptions' => Core_Combos::getMidiasOrigemOptions(), 'style' => 'width: 250px' ]); $element = $this->createElement('hidden', 'base_legal_id', [ 'class' => 'invisivel', 'readonly' => true, ]); $element->setDecorators([ 'ViewHelper', 'Errors', [ 'HtmlTag', [ 'tag' => 'dt', 'class'=>'invisivel' ] ] ]); $this->addElement($element); $this->addElement('textarea', 'obs', array( 'label' => 'Descrição do atendimento:', 'cols' => 80, 'rows' => 5, 'class' => 'require', 'required' => true, )); $this->getElement('obs')->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $multiOptions = Core_Combos::getCallcenterStatusOptions(); unset($multiOptions['EM ATENDIMENTO']); if( isset($multiOptions['SEM_STATUS']) ){ unset($multiOptions['SEM_STATUS']); } $selectStatus = new Zend_Form_Element_Select('status_atendimento'); $selectStatus->setLabel('Status Atendimento:') ->setRequired(true) ->setAttrib('class', 'require') ->setAttrib('set_agendamento', true) ->addMultiOptions($multiOptions); $this->addElement($selectStatus); $this->addElement('textarea', 'comentario', array( 'label' => 'Comentário (sobre o cliente):', 'cols' => 80, 'rows' => 5, )); $this->getElement('comentario')->addDecorator('Label', array( 'tag' => 'dt', 'tagClass' => 'clear' )); $this->addDisplayGroup(array( 'nome','tipo_pessoa', 'razao_social', 'nome_responsavel', 'cpf_responsavel', 'cpf', 'data_nascimento', 'rg', 'orgao_expedidor', 'data_expedicao', 'sexo', 'nome_mae', 'nome_pai', 'cep', 'endereco', 'bairro', 'cidade', 'uf', 'complemento', 'email', 'email2', 'email3', 'sigla_upg', 'senha_contra_cheque', 'cargo', 'secretaria_id', 'orgao_id','obito', 'rep_legal', 'midia_origem_id' ), 'dados_cliente', array( 'legend' => 'Dados do cliente', 'decorators' => array( 'FormElements', 'Fieldset', array('HtmlTag', array('style' => 'width:100%')) ) ) ); $this->addDisplayGroup(array( 'modelo_id', 'btn_imprimir_modelo', 'status_atendimento', 'agendado_para', 'hora_agendada', 'loja_finalizar', 'obs', 'comentario' ), 'dados_atendimento', array( 'legend' => 'Dados do Atendimento', 'decorators' => array( 'FormElements', 'FieldSet', array('HtmlTag', array('style' => 'width:100%')) ) ) ); $this->_initButtons(); } protected function _initButtons() { if( !empty($this->_params['id']) && $this->_params['id'] > 0 ){ $this->addElement('select', 'modelo_id', array( 'label' => 'Script:', 'style' => 'width: 244px;', 'multiOptions' => array("" => "" ) + Core_Combos::getCallcenterModelosAtendimentoOptions(), 'ignore' => true, 'order' => 0 )); $this->addElement('button', 'btn_imprimir_modelo', array( 'label' => 'Visualizar Script', 'style' => 'margin-left: -132px;', 'class' => 'bt_find', 'onclick' => "imprimirModeloAtendimento({$this->_params['id']})", 'order' => 1 )); $groupAtendimento = $this->getDisplayGroup('dados_atendimento'); $groupAtendimento->addElement($this->getElement('modelo_id')); $groupAtendimento->addElement($this->getElement('btn_imprimir_modelo')); } $this->addElement('submit', 'btn_save', array( 'label' => 'Finalizar e Próximo', 'class' => 'bt_save' )); $ajax = !empty($this->_params['popup']) ? ' btn_save_ajax' : ""; $button = !empty($this->_params['popup']) ? 'button' : 'submit'; $this->addElement($button, 'btn_save2', array( 'label' => 'Finalizar Atendimento', 'class' => "bt_save{$ajax}" )); $this->addDisplayGroup(array( 'btn_save', 'btn_save2'), 'buttons'); } public function populate(array $values) { unset($values['status_atendimento']); if( isset($values['uf']) ){ $values['uf'] = strtoupper($values['uf']); } $values['valor_beneficio'] = isset($values['valor_beneficio']) ? number_format($values['valor_beneficio'], 2, ',', '.') : ""; $values['margem_livre'] = isset($values['margem_livre']) ? number_format($values['margem_livre'], 2, ',', '.') : ""; $values['margem_cartao'] = isset($values['margem_cartao']) ? number_format($values['margem_cartao'], 2, ',', '.') : ""; $values['valor_saque'] = isset($values['valor_saque']) ? number_format($values['valor_saque'], 2, ',', '.') : ""; $values['cpf'] = String_Refatorar::resetCpf($values['cpf']); //calcular a idade do cliente if( $values['data_nascimento'] ){ if( $values['data_nascimento'] == '0000-00-00' ){ $values['data_nascimento'] = NULL; } if( Zend_Date::isDate($values['data_nascimento'], 'yyyy-MM-dd') ){ $dataNasc = new Zend_Date($values['data_nascimento'], 'yyyy-MM-dd'); $values['data_nascimento'] = $dataNasc->get('dd/MM/yyyy'); } $this->getElement('data_nascimento')->setDescription($this->getView()->idade($values['data_nascimento'])); } return parent::populate($values); } public function callcenterVerCliente(){ $this->getDisplayGroup("buttons")->addElement( $this->createElement('button', 'btn_back', array( 'label' => 'Voltar', 'onclick' => 'window.close()' )) ); $this->removeElement('btn_save'); $this->removeElement('btn_save2'); $this->removeElement('btn_consulta_telefones'); $this->removeElement('btn_consulta_beneficios'); $this->removeElement('btn_consulta_siape'); $this->removeElement('btn_consulta_bmg'); $this->removeElement('sistema_consulta'); $this->removeElement('status_atendimento'); $this->removeElement('obs'); $this->setAttrib('onsubmit', 'return false;'); } public function isValid($data) { if ($data['cpf_responsavel'] == "00000000000") { unset($data['cpf_responsavel']); } return parent::isValid($data); } }
💾 保存文件
← 返回文件管理器