public function showForm($id = -1)
 {
     $this->prepareForm($id, array('method' => 'post', 'action' => $id > 0 ? 'casting/atualizar/' . $id : 'casting/adicionar/'));
     echo "<div id='infos' class='ls-tab-content ls-active' role='tabpanel'>";
     if ($this->objectID <= 0) {
         SystemHelper::addHiddenfield('', 'dt_criacao', date('Y-m-d'));
     }
     echo "<table class='easy-form-table'>";
     echo "<tr>";
     if ($this->objectID > 0) {
         echo "<td valign='top' rowspan='2'>";
         echo "<div class='casting-profile-container'>";
         if (!is_null($this->fields['foto'])) {
             echo "<img src='assets/pictures/" . $this->fields['foto'] . "' class='casting-profile'></img>";
         } else {
             if ($this->fields['sexo'] == SystemHelper::SEXTYPE_MALE) {
                 echo "<img src='assets/images/no_profile_homem.jpg' class='casting-profile'></img>";
             } else {
                 echo "<img src='assets/images/no_profile_mulher.jpg' class='casting-profile'></img>";
             }
         }
         echo "<a href='#' class='changePhoto' data-url_change='ajax/casting/changePicture/' data-profile_id='" . $id . "'><span class='fa fa-camera fa-2x'></span> Alterar foto</a>";
         echo "</div>";
         echo "</td>";
     }
     echo "<td>";
     echo "<table>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTagLabel(array('label' => 'Status', 'value' => 'Ativo', 'color' => 'success'));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => "Nome completo", 'name' => 'nome_completo', 'required' => true, 'value' => $this->fields['nome_completo']));
     echo "</td>";
     echo "<td>";
     $this->load->model("job_model", "job_model");
     $options = array();
     foreach ($this->job_model->getObjects() as $index => $jobInfo) {
         $options[] = array("value" => $jobInfo['id'], "label" => $jobInfo['nome']);
     }
     SystemHelper::addCombobox(array('label' => "Função", 'name' => 'funcao_id', 'options' => $options, 'required' => true, 'value' => $this->fields['funcao_id']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     $sexo_options = array();
     $this->load->model("sexo_model");
     foreach ($this->sexo_model->getObjects() as $index => $sexoInfo) {
         $sexo_options[] = array('label' => $sexoInfo['nome'], 'value' => $sexoInfo['id']);
     }
     SystemHelper::addRadioGroup(array('label' => "Sexo", 'name' => 'sexo', 'onChange' => '$futuri.showHideUniformSection(this.value);', 'options' => $sexo_options, 'value' => $this->fields['sexo'] ? $this->fields['sexo'] : 'F'));
     echo "</td>";
     echo "<td>";
     SystemHelper::addDatefield(array('label' => "Data de Nascimento", 'name' => 'dt_nascimento', 'useIcon' => true, 'width' => '120px', 'value' => SystemHelper::convertDateFromUS($this->fields['dt_nascimento'])));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     $this->load->model("relationship_model");
     $estado_options = array();
     foreach ($this->relationship_model->getObjects() as $index => $relationInfo) {
         $estado_options[] = array("value" => $relationInfo['id'], "label" => $relationInfo['nome']);
     }
     SystemHelper::addCombobox(array('label' => "Estado Cívil", 'name' => 'estado_civil', 'required' => true, 'options' => $estado_options, 'value' => $this->fields['estado_civil']));
     echo "</td>";
     echo "<td>";
     $this->load->model("nationality_model");
     $country_options = array();
     foreach ($this->nationality_model->getObjects() as $index => $nationInfo) {
         $country_options[] = array("value" => $nationInfo['id'], "label" => $nationInfo['nome']);
     }
     SystemHelper::addCombobox(array('label' => "Nacionalidade", 'name' => 'nacionalidade', 'required' => true, 'options' => $country_options, 'value' => $this->fields['nacionalidade']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td colspan='2'>";
     $this->load->model("profiletype_model");
     $profile_options = array();
     foreach ($this->profiletype_model->getObjects() as $index => $profileInfo) {
         $profile_options[] = array("value" => $profileInfo['id'], "label" => $profileInfo['nome']);
     }
     SystemHelper::addRadioGroup(array('label' => "Perfil", 'name' => 'perfil', 'required' => true, 'options' => $profile_options, 'value' => $this->fields['perfil']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td colspan='2'>";
     $this->load->model("languages_model");
     $this->load->model("castinglanguage_model");
     $languages_options = array();
     foreach ($this->languages_model->getObjects(array("orderBy" => "nome ASC")) as $index => $languageInfo) {
         $languages_options[] = array("value" => $languageInfo['id'], "label" => $languageInfo['nome']);
     }
     // get casting languages
     $my_languages = array();
     foreach ($this->castinglanguage_model->getObjects(array("where" => "promotor_id = '" . $this->objectID . "'")) as $index => $lang) {
         $my_languages[] = $lang['lingua_id'];
     }
     SystemHelper::addCheckboxGroup(array('label' => "Idiomas", 'name' => 'idiomas', 'options' => $languages_options, 'value' => $my_languages));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td colspan='2'>";
     echo "<b>Características Pessoais</b>";
     echo "<div class='ls-box'>";
     echo "<table>";
     echo "<tr>";
     echo "<td>";
     $this->load->model("skincolor_model");
     $skins_options = array();
     foreach ($this->skincolor_model->getObjects() as $index => $skinInfo) {
         $skins_options[] = array("value" => $skinInfo['id'], "label" => $skinInfo['nome']);
     }
     SystemHelper::addCombobox(array('label' => "Cor da pele", 'name' => 'cor_pele', 'options' => $skins_options, 'value' => $this->fields['cor_pele']));
     echo "</td>";
     echo "<td>";
     $this->load->model("eyecolor_model");
     $eye_options = array();
     foreach ($this->eyecolor_model->getObjects() as $index => $eyeInfo) {
         $eye_options[] = array("value" => $eyeInfo['id'], "label" => $eyeInfo['nome']);
     }
     SystemHelper::addCombobox(array('label' => "Cor dos olhos", 'name' => 'cor_olho', 'options' => $eye_options, 'value' => $this->fields['cor_olho']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     $this->load->model("haircolor_model");
     $hair_options = array();
     foreach ($this->haircolor_model->getObjects() as $index => $hairInfo) {
         $hair_options[] = array("value" => $hairInfo['id'], "label" => $hairInfo['nome']);
     }
     SystemHelper::addCombobox(array('label' => "Cor do cabelo", 'name' => 'cor_cabelo', 'options' => $hair_options, 'value' => $this->fields['cor_cabelo']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => "Estilo de Cabelo", 'name' => 'estilo_cabelo', 'value' => $this->fields['estilo_cabelo']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td colspan=2>";
     SystemHelper::addTextfield(array('label' => "Tatuagem", 'name' => 'tatuagem', 'value' => $this->fields['tatuagem']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => "Altura", 'name' => 'altura', 'value' => $this->fields['altura']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => "Peso", 'name' => 'peso', 'value' => $this->fields['peso']));
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "<b>Uniforme</b>";
     echo "<div class='ls-box'>";
     echo "<table id='female-uniform-table' " . ($this->fields['sexo'] == SystemHelper::SEXTYPE_MALE ? "class='hidden'" : "") . ">";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Vestido', 'name' => 'vestido', 'align' => 'center', 'value' => $this->fields['vestido']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Camisa/Camiseta', 'name' => 'camisa_fem', 'align' => 'center', 'value' => $this->fields['camisa_fem']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Quadril', 'name' => 'quadril_fem', 'align' => 'center', 'value' => $this->fields['quadril_fem']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Cintura', 'name' => 'cintura_fem', 'align' => 'center', 'value' => $this->fields['cintura_fem']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Calça', 'name' => 'calca_fem', 'align' => 'center', 'value' => $this->fields['calca_fem']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Sapato', 'name' => 'sapato_fem', 'align' => 'center', 'value' => $this->fields['sapato_fem']));
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "<table id='male-uniform-table' " . ($this->fields['sexo'] == SystemHelper::SEXTYPE_FEMALE ? "class='hidden'" : "") . ">";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Polo/Camiseta', 'name' => 'camisa_masc', 'align' => 'center', 'value' => $this->fields['camisa_masc']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Camisa Social', 'name' => 'camisasocial_masc', 'align' => 'center', 'value' => $this->fields['camisasocial_masc']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Calça', 'name' => 'calca_masc', 'align' => 'center', 'value' => $this->fields['calca_masc']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Toráx', 'name' => 'torax_masc', 'align' => 'center', 'value' => $this->fields['torax_masc']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Sapato', 'name' => 'sapato_masc', 'align' => 'center', 'value' => $this->fields['sapato_masc']));
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "</div>";
     echo "</div>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "<b>Filiação</b>";
     echo "<div class='ls-box'>";
     echo "<table style='width:100%'>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => "Nome da mãe", 'name' => 'nome_mae', 'required' => true, 'value' => $this->fields['nome_mae']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => "Nome do pai", 'name' => 'nome_pai', 'value' => ''));
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "</div>";
     echo "<br>";
     echo "<b>Disponibilidade</b>";
     echo "<div class='ls-box'>";
     echo "<table style='width:100%'>";
     echo "<tr>";
     echo "<td>";
     echo "<b>Horário</b>";
     echo "<div class='ls-box'>";
     $my_horarios = explode(",", $this->fields['disponibilidade_horario']);
     SystemHelper::addCheckboxGroup(array('label' => '', 'name' => 'disponibilidade_horario', 'value' => $my_horarios, 'breakLine' => true, 'options' => $this->hours_disponibles));
     echo "</div>";
     echo "</td>";
     echo "<td>";
     echo "<b>Locomoção</b>";
     echo "<div class='ls-box'>";
     $my_veiculos = explode(",", $this->fields['disponibilidade_veiculos']);
     SystemHelper::addCheckboxGroup(array('label' => '', 'name' => 'disponibilidade_veiculos', 'value' => $my_veiculos, 'breakLine' => true, 'options' => $this->vehicle_disponibles));
     echo "</div>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "</div>";
     SystemHelper::addLargeTextfield(array('label' => 'Observações', 'name' => 'observacoes', 'rows' => '7', 'value' => $this->fields['observacoes']));
     echo "</div>";
     echo "<div id='docs' class='ls-tab-content' role='tabpanel'>";
     echo "<table class='easy-form-table'>";
     echo "<tr>";
     echo "<td colspan='3'>";
     echo "<div id='cpf_duplicity_result'></div>";
     echo "</td>";
     echo "</td>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => "CPF", 'name' => 'CPF', 'required' => true, 'mask' => 'ls-mask-cpf', 'onChange' => '$futuri.checkCPFDuplicity(this)', 'value' => $this->fields['CPF']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => "Identidade (RG)", 'name' => 'RG', 'required' => true, 'mask' => 'ls-mask-rg', 'value' => $this->fields['RG']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addDatefield(array('label' => "Data Expedição", 'name' => 'dt_expedicao', 'useIcon' => true, 'width' => '120px', 'value' => SystemHelper::convertDateFromUS($this->fields['dt_expedicao'])));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => "Titulo Eleitoral", 'name' => 'titulo_eleitor', 'value' => $this->fields['titulo_eleitor']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => "Zona Eleitoral", 'name' => 'zona', 'value' => $this->fields['zona']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => "Seção Eleitoral", 'name' => 'secao', 'value' => $this->fields['secao']));
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "</div>";
     $type_object = $this->getType();
     echo "<div id='enderecos' class='ls-tab-content' role='tabpanel'>";
     include "Address.php";
     $this->address = new Address();
     $this->load->model("address_model");
     $this->address_model = new Address_Model();
     $addresses = array();
     foreach ($this->address_model->getObjects(array("where" => "cadastro_tipo = '" . $type_object . "' AND conexao_id = '" . $this->objectID . "'")) as $index => $addInfo) {
         $this->address->setID($addInfo['id']);
         $addresses[] = array($addInfo['nome_endereco'], $addInfo['endereco_cep'], $addInfo['endereco'] . " " . $addInfo['endereco_numero'] . ", " . $addInfo['endereco_complemento'], array("edit_button" => $this->address->getActionOptions()["actions"][0], "remove_button" => $this->address->getActionOptions()["actions"][1]));
     }
     $this->address->redefineActionsURL($type_object, $this->objectID);
     $this->address->showListPanel(array('title' => 'Endereços', 'id' => 'endereco', 'add_button' => $this->address->getActionOptions()["add"], 'headers' => array('Nome', 'CEP', 'Endereço', ''), 'list' => $addresses));
     echo "<br>";
     include "Contact.php";
     $this->contact = new Contact();
     $this->load->model("contact_model");
     $this->contact_model = new Contact_Model();
     $contacts = array();
     foreach ($this->contact_model->getObjects(array("where" => "cadastro_tipo = '" . $type_object . "' AND conexao_id = '" . $this->objectID . "'")) as $index => $contactInfo) {
         $this->contact->setID($contactInfo['id']);
         $contacts[] = array($contactInfo['nome_contato'], $contactInfo['tel_casa'], $contactInfo['tel_cel'], $contactInfo['tel_outro'], $contactInfo['contato_email'], array("edit_button" => $this->contact->getActionOptions()["actions"][0], "remove_button" => $this->contact->getActionOptions()["actions"][1]));
     }
     $this->contact->redefineActionsURL($type_object, $this->objectID);
     $this->contact->showListPanel(array('title' => 'Contatos', 'id' => 'contatos', 'headers' => array('Nome', 'Tel Casa', 'Cel 1', 'Cel 2', 'Email', ''), 'add_button' => $this->contact->getActionOptions()["add"], 'list' => $contacts));
     echo "<br>";
     include "BankAccount.php";
     $this->bank_account = new Bankaccount();
     $this->load->model("bankaccount_model");
     $this->bankaccount_model = new Bankaccount_Model();
     $bank_accounts = array();
     foreach ($this->bankaccount_model->getObjects(array("where" => "cadastro_tipo = '" . $type_object . "' AND conexao_id = '" . $this->objectID . "'")) as $index => $bankInfo) {
         $this->bank_account->setID($bankInfo['id']);
         $bank_accounts[] = array($bankInfo['nome_titular'], $bankInfo['banco_nome'], $bankInfo['banco_agencia'], $bankInfo['banco_conta'], array("remove_button" => $this->bank_account->getActionOptions()["actions"][1]));
     }
     $this->bank_account->redefineActionsURL($type_object, $this->objectID);
     $this->bank_account->showListPanel(array('title' => 'Contas Bancárias', 'id' => 'bancos', 'headers' => array('Titular', 'Banco', 'Agência', 'Conta', ''), 'add_button' => $this->bank_account->getActionOptions()["add"], 'list' => $bank_accounts));
     echo "</div>";
     $this->addButtons();
 }
 public function showFilterForm($job_id = '')
 {
     switch ($job_id) {
         default:
             $where = array("funcao_id" => self::CASTINGJOB_PROMOTER_ID);
             break;
         case self::CASTINGJOB_SUPERVISOR:
             $where = array("funcao_id" => self::CASTINGJOB_SUPERVISOR_ID);
             break;
         case self::CASTINGJOB_PRODUCER:
             $where = array("funcao_id" => self::CASTINGJOB_PRODUCER_ID);
             break;
     }
     $this->load->model("skincolor_model");
     $skins_options = array();
     foreach ($this->skincolor_model->getObjects() as $index => $skinInfo) {
         $skins_options[] = array("value" => $skinInfo['id'], "label" => $skinInfo['nome']);
     }
     $this->load->model("eyecolor_model");
     $eye_options = array();
     foreach ($this->eyecolor_model->getObjects() as $index => $eyeInfo) {
         $eye_options[] = array("value" => $eyeInfo['id'], "label" => $eyeInfo['nome']);
     }
     $this->load->model("haircolor_model");
     $hair_options = array();
     foreach ($this->haircolor_model->getObjects() as $index => $hairInfo) {
         $hair_options[] = array("value" => $hairInfo['id'], "label" => $hairInfo['nome']);
     }
     include "Casting.php";
     $casting = new Casting();
     echo "<table class='easy-form-table'>";
     echo "<tr>";
     echo "<td colspan='3'>";
     $sexo_options = array();
     $sexo_options[] = array('label' => "Feminino", 'value' => SystemHelper::SEXTYPE_FEMALE);
     $sexo_options[] = array('label' => "Masculino", 'value' => SystemHelper::SEXTYPE_MALE);
     SystemHelper::addCheckboxGroup(array('label' => "Sexo", 'name' => 'filter_sexo', 'breakLine' => false, 'value' => array(SystemHelper::SEXTYPE_FEMALE, SystemHelper::SEXTYPE_MALE), 'options' => $sexo_options));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td valign='top'>";
     SystemHelper::addCheckboxGroup(array('label' => "Cor da pele", 'name' => 'filter_cor_pele', 'breakLine' => true, 'options' => $skins_options));
     echo "</td>";
     echo "<td valign='top'>";
     SystemHelper::addCheckboxGroup(array('label' => "Cor dos olhos", 'name' => 'filter_cor_olho', 'breakLine' => true, 'options' => $eye_options));
     echo "</td>";
     echo "<td valign='top'>";
     SystemHelper::addCheckboxGroup(array('label' => "Cor do cabelo", 'name' => 'filter_cor_cabelo', 'breakLine' => true, 'options' => $hair_options));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td colspan='2'>";
     SystemHelper::addTextfield(array('label' => "Altura <br><span class='ls-color-danger'>* utilize o caracter ~ para buscar entre 2 valores. exemplo: 1.30~2.00 (entre 1 metro e 30 e 2 metros)</span>", 'width' => '100px', 'align' => 'right', 'name' => 'filter_altura'));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => "Peso <br><span class='ls-color-danger'>* utilize o caracter ~ para buscar entre 2 valores. exemplo: 50~90 (entre 50 e 90 kilos)</span>", 'width' => '100px', 'align' => 'right', 'name' => 'filter_peso'));
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     SystemHelper::addCheckboxGroup(array('label' => 'Disponibilidade de horário', 'name' => 'filter_dispo_horario', 'breakLine' => false, 'options' => $casting->hours_disponibles));
     SystemHelper::addCheckboxGroup(array('label' => 'Disponibilidade de locomoção', 'name' => 'filter_dispo_veiculos', 'breakLine' => false, 'options' => $casting->vehicle_disponibles));
     SystemHelper::addButton(array('label' => 'Aplicar', 'icon' => 'ls-ico-checkmark', 'onClick' => '$futuri.updatePromoterByFilter();', 'data' => array('popupcloser' => true)));
     SystemHelper::addButton(array('label' => 'Cancelar', 'icon' => 'ls-ico-close', 'data' => array('popupcloser' => true)));
 }