public function showForm($id = -1)
 {
     $this->prepareForm($id, array('method' => 'post', 'action' => ''));
     echo "<div class='ls-tab-content ls-active' id='infos'>";
     echo '<table class="easy-form-table">';
     echo '<tr>';
     echo '<td>';
     SystemHelper::addTextfield(array('label' => 'Nome', 'name' => 'nome_relatorio', 'value' => $this->fields['nome_relatorio']));
     echo '</td>';
     echo '<td>';
     SystemHelper::addCombobox(array('label' => 'Ícone', 'name' => 'icone', 'value' => $this->fields['icone']));
     echo '</td>';
     echo '</tr>';
     echo '</table>';
     SystemHelper::addSQLTextBox(array('label' => 'Sentença SQL', 'name' => 'sentenca_sql', 'value' => $this->fields['sentenca_sql']));
     echo "</div>";
     echo "<div class='ls-tab-content' id='parameters'>";
     include "ParamTableComponent.php";
     $this->params_table = new ParamTableComponent();
     $this->params_table->show();
     echo "</div>";
     echo "<div class='ls-tab-content' id='headers'>";
     include "HeaderTableComponent.php";
     $this->headers_table = new HeaderTableComponent();
     $this->headers_table->show();
     echo "</div>";
     $this->addButtons();
 }
 public function showForm($id = -1)
 {
     $this->load->model("product_model", "product_manager");
     $products = array();
     foreach ($this->product_manager->getObjects() as $index => $productInfo) {
         $products[] = array("label" => $productInfo['nome'], "value" => $productInfo['id']);
     }
     SystemHelper::addCombobox(array('label' => 'Produto/Serviço', 'name' => 'task_select_product', 'options' => $products));
     SystemHelper::addTextfield(array('label' => 'Quantidade', 'name' => 'task_select_quantity', 'width' => '80px', 'align' => 'center'));
     SystemHelper::addButton(array('label' => 'Adicionar', 'onClick' => '$futuri.addProductTask();', 'data' => array('popupcloser' => true)));
     SystemHelper::addButton(array('label' => 'Cancelar', 'data' => array('popupcloser' => true)));
 }
 public function getFields()
 {
     include "application/helpers/system_helper.php";
     include "ParamTableComponent.php";
     echo '<tr>';
     echo '<td>';
     SystemHelper::addTextfield(array('name' => 'header_name[]'));
     echo '</td>';
     echo '<td>';
     SystemHelper::addCombobox(array('name' => 'header_type', 'options' => ParamTableComponent::$types));
     echo '</td>';
     echo '<td>';
     SystemHelper::addCombobox(array('name' => 'header_align', 'options' => $this->aligns));
     echo '</td>';
     echo '<td>';
     SystemHelper::addIconButton(['icon' => 'fa fa-times', 'onClick' => '$paramTable.removeFields(this);', 'tooltip' => 'Remover', 'tooltip-align' => 'right']);
     echo '</td>';
     echo '</tr>';
 }
 public function showForm($id = -1)
 {
     $this->prepareForm($id, array('method' => 'post', 'action' => $id > 0 ? 'produto/atualizar/' . $id : 'produto/adicionar'));
     echo "<div id='infos' class='ls-tab-content ls-active' role='tabpanel'>";
     echo "<table class='easy-form-table'>";
     echo "<tr>";
     echo "<td colspan='2'>";
     SystemHelper::addTextfield(array('label' => 'Produto / Serviço', 'name' => 'nome', 'value' => $this->fields['nome']));
     echo "</td>";
     echo "<td>";
     $fornecedor_options = array();
     $this->load->model("supplier_model");
     foreach ($this->supplier_model->getObjects() as $index => $supInfo) {
         $fornecedor_options[] = array("value" => $supInfo['id'], "label" => $supInfo['nome_fantasia']);
     }
     SystemHelper::addCombobox(array('label' => 'Fornecedor', 'name' => 'fornecedor_id', 'options' => $fornecedor_options, 'value' => $this->fields['fornecedor_id']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Quantidade', 'name' => 'quantidade', 'align' => 'right', 'value' => $this->fields['quantidade']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Valor Unitário (R$)', 'name' => 'valor_unitario', 'align' => 'right', 'mask' => 'ls-mask-money', 'value' => $this->fields['valor_unitario']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Valor Total (R$)', 'name' => 'valor', 'align' => 'right', 'mask' => 'ls-mask-money', 'value' => $this->fields['valor']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addDatefield(array('label' => 'Data da compra', 'name' => 'dt_compra', 'width' => '120px', 'value' => SystemHelper::convertDateFromUS($this->fields['dt_compra']), 'useIcon' => true));
     echo "</td>";
     echo "<td>";
     SystemHelper::addDatefield(array('label' => 'Data do recebimento', 'name' => 'dt_entrega', 'width' => '140px', 'value' => SystemHelper::convertDateFromUS($this->fields['dt_entrega']), 'useIcon' => true));
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     SystemHelper::addLargeTextfield(array('label' => 'Observações', 'name' => 'observacoes', 'rows' => 8, 'value' => $this->fields['observacoes']));
     echo "</div>";
     $this->addButtons();
 }
 public function showForm($id = -1)
 {
     $this->prepareForm($id, array('method' => 'post', 'action' => $id > 0 ? "grafico/atualizar/" . $id : "grafico/adicionar"));
     echo "<div class='ls-tab-content ls-active' id='infos'>";
     echo '<table class="easy-form-table">';
     echo '<tr>';
     echo '<td>';
     SystemHelper::addTextfield(array('label' => 'Nome', 'name' => 'nome_grafico', 'value' => $this->fields['nome_grafico']));
     echo '</td>';
     echo '<td>';
     SystemHelper::addCombobox(array('label' => 'Ícone', 'name' => 'icone', 'value' => $this->fields['icone']));
     echo '</td>';
     echo '</tr>';
     echo '</table>';
     SystemHelper::addSQLTextBox(array('label' => 'Sentença SQL', 'name' => 'sentenca_sql', 'value' => $this->fields['sentenca_sql']));
     echo "</div>";
     echo "<div class='ls-tab-content' id='parameters'>";
     include "ParamTableComponent.php";
     $this->params_table = new ParamTableComponent();
     $this->params_table->show(array("cadastro_tipo" => $this->getType(), "conexao_id" => $this->objectID));
     echo "</div>";
     $this->addButtons();
 }
 public function getFields()
 {
     include "application/helpers/system_helper.php";
     echo '<tr>';
     echo '<td>';
     SystemHelper::addTextfield(array('name' => 'param_displayname[]'));
     echo '</td>';
     echo '<td>';
     SystemHelper::addTextfield(array('name' => 'param_name[]'));
     echo '</td>';
     echo '<td>';
     SystemHelper::addCombobox(array('name' => 'param_type[]', 'options' => self::$types));
     echo '</td>';
     echo '<td>';
     SystemHelper::addTextfield(array('name' => 'param_default[]'));
     echo '</td>';
     echo '<td>';
     SystemHelper::addYesNoToggle(array('name' => 'param_userinput[]'));
     echo '</td>';
     echo '<td>';
     SystemHelper::addIconButton(['icon' => 'fa fa-times', 'onClick' => '$paramTable.removeFields(this);', 'tooltip' => 'Remover', 'tooltip-align' => 'right']);
     echo '</td>';
     echo '</tr>';
 }
 public function getTRSearchClausure()
 {
     $tr = "<tr>";
     $tr .= "<td></td>";
     $tr .= "<td>" . SystemHelper::addCombobox(array('label' => '', 'name' => 'search_field[]', 'returnHTML' => true, 'onChange' => '$futuri.loadAsyncSearchOption(this,"' . $this->getType() . '");', 'options' => $this->createFieldOptionsForCombobox(), 'value' => $this->input->post("search_field") ? $this->input->post("search_field")[0] : '')) . "</td>";
     $tr .= "<td>" . SystemHelper::addTextfield(array('label' => '', 'name' => 'search_value[]', 'returnHTML' => true, 'value' => $this->input->post("search_value") ? $this->input->post("search_value")[0] : '')) . "</td>";
     $tr .= "<td>" . SystemHelper::addIconButton(array('icon' => 'fa fa-trash', 'tooltip' => 'Remover', 'onClick' => '$futuri.removeSeachClausure(this)', 'tooltip-align' => 'right', 'returnHTML' => true)) . "</td>";
     $tr .= "</tr>";
     echo $tr;
 }
 public function getAsyncSearch($fieldname = '', $fieldvalue = '')
 {
     switch ($fieldname) {
         case "sexo":
             $this->load->model("sexo_model");
             $opt = array();
             foreach ($this->sexo_model->getObjects() as $index => $sexInfo) {
                 $opt[] = array("label" => $sexInfo['nome'], "value" => $sexInfo['id']);
             }
             SystemHelper::addCombobox(array('name' => 'search_value[]', 'value' => $fieldvalue, 'options' => $opt));
             break;
         case "perfil":
             $this->load->model("profiletype_model");
             $opt = array();
             foreach ($this->profiletype_model->getObjects() as $index => $profileInfo) {
                 $opt[] = array("label" => $profileInfo['nome'], "value" => $profileInfo['id']);
             }
             SystemHelper::addCombobox(array('name' => 'search_value[]', 'value' => $fieldvalue, 'options' => $opt));
             break;
         case "status":
             $this->load->model("castingstatus_model");
             $opt = array();
             foreach ($this->castingstatus_model->getObjects() as $index => $statusInfo) {
                 $opt[] = array("label" => $statusInfo['nome'], "value" => $statusInfo['id']);
             }
             SystemHelper::addCombobox(array('name' => 'search_value[]', 'value' => $fieldvalue, 'options' => $opt));
             break;
         case "cor_cabelo":
             $this->load->model("haircolor_model");
             $opt = array();
             foreach ($this->haircolor_model->getObjects() as $index => $hairInfo) {
                 $opt[] = array("label" => $hairInfo['nome'], "value" => $hairInfo['id']);
             }
             SystemHelper::addCombobox(array('name' => 'search_value[]', 'value' => $fieldvalue, 'options' => $opt));
             break;
         case "cor_pele":
             $this->load->model("skincolor_model");
             $opt = array();
             foreach ($this->skincolor_model->getObjects() as $index => $skinInfo) {
                 $opt[] = array("label" => $skinInfo['nome'], "value" => $skinInfo['id']);
             }
             SystemHelper::addCombobox(array('name' => 'search_value[]', 'value' => $fieldvalue, 'options' => $opt));
             break;
         default:
             parent::getAsyncSearch($fieldname, $fieldvalue);
             break;
     }
 }
 public function getBanks($id_casting = -1)
 {
     include_once "Casting.php";
     $this->load->model("bankaccount_model", "bankaccount_model");
     $options = array();
     $each_bank_option = array();
     foreach ($this->bankaccount_model->getObjects(array("where" => "cadastro_tipo = 'Casting' AND conexao_id = " . $id_casting)) as $index => $bankInfo) {
         $options[] = SystemHelper::createComboboxOption($bankInfo['id'], $bankInfo['nome_titular']);
         $each_bank_option[$bankInfo['id']] = ["banco" => $bankInfo['banco_nome'], "agencia" => $bankInfo['banco_agencia'], "conta" => $bankInfo["banco_conta"]];
     }
     $data = array();
     $data["combox"] = SystemHelper::addCombobox(array('label' => 'Conta Bancária', 'name' => 'trabalho_select_bank', 'onChange' => '$futuri.displayAccountInfo(this);', 'returnHTML' => true, 'options' => $options));
     $data["banco_infos"] = $each_bank_option;
     $casting = new Casting($id_casting);
     $data["profile_image"] = "assets/pictures/" . $casting->fields['foto'];
     echo json_encode($data);
 }
            echo '</td>';
            echo '<td valign="bottom">';
            SystemHelper::addButton(array('label' => '', 'id' => 'add_search_clausure', 'onClick' => '$futuri.addSearchClausure("' . $controller->getType() . '");', 'icon' => 'ls-ico-plus'));
            echo '</td>';
        } else {
            echo '<td>';
            SystemHelper::addIconButton(array('icon' => 'fa fa-trash', 'tooltip' => 'Remover', 'onClick' => '$futuri.removeSeachClausure(this)', 'tooltip-align' => 'right', 'returnHTML' => false));
            echo '</td>';
        }
        echo "</tr>";
    }
} else {
    echo "<tr>";
    echo "<td>Buscar</td>";
    echo "<td>";
    SystemHelper::addCombobox(array('name' => 'search_field[]', 'onChange' => '$futuri.loadAsyncSearchOption(this,"' . $controller->getType() . '");', 'options' => $controller->createFieldOptionsForCombobox(), 'value' => ''));
    echo "</td>";
    echo "<td>";
    SystemHelper::addTextfield(array('name' => 'search_value[]'));
    echo "</td>";
    echo '<td valign="bottom">';
    SystemHelper::addSubmitButton(array('label' => 'Aplicar'));
    echo '</td>';
    echo '<td valign="bottom">';
    SystemHelper::addButton(array('label' => '', 'id' => 'add_search_clausure', 'onClick' => '$futuri.addSearchClausure("' . $controller->getType() . '");', 'icon' => 'ls-ico-plus'));
    echo '</td>';
    echo "</tr>";
}
?>
							
						</tr>
		<?php 
if (count($objectList)) {
    ?>
		<div class="dataviewPage-pager ls-float-right">
			<div class="ls-pagination-filter">
					<div class="ls-filter-view">
						<form method='post'>
					      Exibir
					      <?php 
    if ($input->post("search_field")) {
        foreach ($input->post("search_field") as $ind => $search_field) {
            SystemHelper::addHiddenfield('', 'search_field[]', $search_field);
            SystemHelper::addHiddenfield('', 'search_value[]', $input->post("search_value")[$ind]);
        }
    }
    SystemHelper::addCombobox(array('label' => '', 'options' => $controller->getPagerLimits(), 'value' => $controller->selectedPagerLimit, 'onChange' => 'submit();', 'name' => 'pager_limit'));
    ?>
					      ítens por página
				       </form>
				  </div>
				  <div class="dataviewPage-pagination">
					  <ul> 
					  <?php 
    if ($controller->selectedPage > 1) {
        echo '<li class="' . ($controller->selectedPage == 1 ? "ls-disabled" : "") . '">';
        echo "<form method='post'>";
        echo "<a href='#' onClick='this.parentNode.submit();'>";
        if ($input->post("search_field")) {
            foreach ($input->post("search_field") as $ind => $search_field) {
                SystemHelper::addHiddenfield('', 'search_field[]', $search_field);
                SystemHelper::addHiddenfield('', 'search_value[]', $input->post("search_value")[$ind]);
 public function showForm($id = -1)
 {
     $this->prepareForm($id, array('method' => 'post', 'action' => $id > 0 ? 'trabalho/atualizar/' . $id : 'trabalho/adicionar'));
     if ($this->objectID < 0) {
         SystemHelper::addHiddenfield('', 'dt_criacao', date('Y-m-d H:i:s'));
         SystemHelper::addHiddenfield('', 'usuario_id_criacao', FUTURI_Session::getUserID());
     }
     echo "<div id='infos' class='ls-tab-content ls-active' role='tabpanel'>";
     echo "<table class='easy-form-table'>";
     echo "<tr>";
     echo "<td colspan='2'>";
     $status_options = array();
     $this->load->model("taskstatus_model");
     foreach ($this->taskstatus_model->getObjects() as $index => $stInfo) {
         $status_options[] = array("value" => $stInfo['id'], "label" => $stInfo['nome']);
     }
     SystemHelper::addCombobox(array('label' => 'Status', 'name' => 'status', 'options' => $status_options, 'value' => $this->fields['status']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td colspan='5'>";
     SystemHelper::addRadioGroup(array('label' => 'Empresa', 'name' => 'empresa_id', 'options' => $this->empresas_options, 'value' => $this->fields['empresa_id']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td colspan='2'>";
     SystemHelper::addTextfield(array('label' => 'Nome do evento', 'name' => 'nome_evento', 'required' => true, 'value' => $this->fields['nome_evento']));
     echo "</td>";
     echo "<td colspan='3'>";
     $client_options = array();
     $this->load->model("client_model");
     foreach ($this->client_model->getObjects() as $index => $cliInfo) {
         $client_options[] = array("value" => $cliInfo['id'], "label" => $cliInfo['nome_fantasia']);
     }
     SystemHelper::addCombobox(array('label' => 'Cliente', 'name' => 'cliente_id', 'required' => true, 'options' => $client_options, 'value' => $this->fields['cliente_id']));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td colspan='2'>";
     SystemHelper::addDatefield(array('label' => 'Data de início', 'name' => 'dt_inicio', 'width' => '120px', 'value' => SystemHelper::convertDateFromUS($this->fields['dt_inicio']), 'useIcon' => true));
     echo "</td>";
     echo "<td colspan='3'>";
     SystemHelper::addDatefield(array('label' => 'Data de término', 'name' => 'dt_termino', 'width' => '120px', 'value' => SystemHelper::convertDateFromUS($this->fields['dt_termino']), 'useIcon' => true));
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Custo real (R$)', 'name' => 'custo_real', 'mask' => 'ls-mask-money', 'value' => $this->fields['custo_real']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Lucro (R$)', 'name' => 'lucro', 'mask' => 'ls-mask-money', 'value' => $this->fields['lucro']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Margem Contrib(%)', 'name' => 'margem_contrib', 'mask' => 'ls-mask-percent', 'align' => 'right', 'value' => $this->fields['margem_contrib']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Extras (R$)', 'name' => 'despesas_extras', 'mask' => 'ls-mask-money', 'value' => $this->fields['despesas_extras']));
     echo "</td>";
     echo "<td>";
     SystemHelper::addTextfield(array('label' => 'Total (R$)', 'name' => 'valor_total', 'required' => true, 'mask' => 'ls-mask-money', 'value' => $this->fields['valor_total']));
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     SystemHelper::addLargeTextfield(array('label' => 'Observações', 'name' => 'observacoes', 'rows' => 8, 'value' => $this->fields['observacoes']));
     echo "</div>";
     echo "<div id='efetivo' class='ls-tab-content' role='tabpanel'>";
     include "TaskCasting.php";
     include "Casting.php";
     include "BankAccount.php";
     $this->task_casting = new TaskCasting();
     $add_button = $this->task_casting->getActionOptions()["add"];
     $base_url = $add_button["url"];
     $add_button["url"] = $base_url . "/promotor";
     $promotores = array();
     $supervisores = array();
     $produtores = array();
     $this->load->model("taskcasting_model");
     $this->taskcasting_model = new Taskcasting_Model();
     $remove_bt = array('icon' => 'ls-ico-close', 'url' => '#', 'label' => '', 'onClick' => '$futuri.removeCastingOrProductTask(this);');
     //$this->taskcasting_model->debugMode = true;
     foreach ($this->taskcasting_model->getObjects(array("where" => "trabalho_id = " . $this->objectID)) as $index => $promInfo) {
         $this->casting = new Casting($promInfo['promotor_id']);
         $this->bank_account = new BankAccount($promInfo['promotor_conta_banco_id']);
         $hidden = "<input type='hidden' name='trabalho_select_casting[]' value='" . $promInfo['promotor_id'] . "'>";
         $hidden2 = "<input type='hidden' name='trabalho_select_bank[]' value='" . $promInfo['promotor_conta_banco_id'] . "'>";
         $hidden3 = "<input type='hidden' name='trabalho_select_valor[]' value='" . $promInfo['promotor_valor_recebido'] . "'>";
         switch ($this->casting->fields['funcao_id']) {
             case TaskCasting::CASTINGJOB_PROMOTER_ID:
                 $promotores[] = array($hidden . $this->casting->fields['nome_completo'], $hidden3 . $promInfo['promotor_valor_recebido'], $hidden2 . $this->bank_account->fields['banco_nome'], $this->bank_account->fields['banco_agencia'], $this->bank_account->fields['banco_conta'], array("remove_button" => $remove_bt));
                 break;
             case TaskCasting::CASTINGJOB_SUPERVISOR_ID:
                 $supervisores[] = array($hidden . $this->casting->fields['nome_completo'], $hidden3 . $promInfo['promotor_valor_recebido'], $hidden2 . $this->bank_account->fields['banco_nome'], $this->bank_account->fields['banco_agencia'], $this->bank_account->fields['banco_conta'], array("remove_button" => $remove_bt));
                 break;
             case TaskCasting::CASTINGJOB_PRODUCER_ID:
                 $produtores[] = array($hidden . $this->casting->fields['nome_completo'], $hidden3 . $promInfo['promotor_valor_recebido'], $hidden2 . $this->bank_account->fields['banco_nome'], $this->bank_account->fields['banco_agencia'], $this->bank_account->fields['banco_conta'], array("remove_button" => $remove_bt));
                 break;
         }
     }
     $headers = array('Nome', 'Valor recebido', 'Banco', 'Agencia', 'Conta', '');
     $this->task_casting->showListPanel(array('title' => 'Promotores', 'hideNoneRowsMsg' => true, 'id' => 'task_promotores', 'headers' => $headers, 'list' => $promotores, 'add_button' => $add_button));
     $add_button["url"] = $base_url . "/supervisor";
     $this->task_casting->showListPanel(array('title' => 'Supervisores', 'id' => 'task_supervisores', 'hideNoneRowsMsg' => true, 'headers' => $headers, 'list' => $supervisores, 'add_button' => $add_button));
     $add_button["url"] = $base_url . "/produtor";
     $this->task_casting->showListPanel(array('title' => 'Produtores', 'id' => 'task_produtores', 'hideNoneRowsMsg' => true, 'headers' => $headers, 'list' => $produtores, 'add_button' => $add_button));
     echo "<table class='easy-form-table'>";
     echo "<tr>";
     echo "</tr>";
     echo "</table>";
     echo "</div>";
     echo "<div id='produtos_servicos' class='ls-tab-content' role='tabpanel'>";
     include "Product.php";
     include "TaskProduct.php";
     $this->products = new TaskProduct();
     $this->load->model("taskproduct_model");
     $produtos = array();
     $this->taskproduct_model = new Taskproduct_Model();
     foreach ($this->taskproduct_model->getObjects(array("where" => "trabalho_id = '" . $this->objectID . "'")) as $ind => $prodInfo) {
         $this->product = new Product($prodInfo['produto_id']);
         $produtos[] = array("<input type='hidden' name='trabalho_select_produto[]' value='" . $prodInfo['produto_id'] . "'>" . $this->product->fields['nome'], "<input type='hidden' name='trabalho_select_quantidade[]' value='" . $prodInfo['produto_quantidade'] . "'>" . $prodInfo['produto_quantidade'], array("remove_button" => $remove_bt));
     }
     $this->products->showListPanel(array('title' => 'Produtos/Serviços', 'hideNoneRowsMsg' => true, 'id' => 'task_produtos', 'list' => $produtos, 'headers' => array('Nome', 'Quantidade', ''), 'add_button' => $this->products->getActionOptions()["add"]));
     echo "</div>";
     $this->addButtons();
 }