Atualizando CompaniesValidate

This commit is contained in:
Kenio 2025-07-15 20:41:43 -03:00
parent c70a78f128
commit 742f48c65a

View file

@ -2,32 +2,29 @@
/** Importação de classes */
use vendor\model\Users;
use vendor\model\Clients;
use vendor\model\Company;
use vendor\model\Companies;
use vendor\controller\users\UsersValidate;
use vendor\controller\company\CompanyValidate;
use vendor\controller\clients\ClientsValidate;
use vendor\controller\Companies\CompaniesValidate;
/** Verifica se o token de acesso é válido */
if($Main->verifyToken()){
/** Instânciamento de classes */
$Users = new Users();
$Clients = new clients();
$Company = new Company();
$Companies = new Companies();
$UsersValidate = new UsersValidate();
$ClientsValidate = new ClientsValidate;
$CompaniesValidate = new CompaniesValidate;
$CompanyValidate = new CompanyValidate();
/** Parametros de entrada */
$usersId = isset($_POST['users_id']) ? (int)filter_input(INPUT_POST, 'users_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0;
$companyId = isset($_POST['company_id']) ? (int)filter_input(INPUT_POST, 'company_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0;
$clientsId = isset($_POST['clients_id']) ? (int)filter_input(INPUT_POST, 'clients_id', FILTER_SANITIZE_NUMBER_INT) : 0;
$companiesId = isset($_POST['company_id']) ? (int)filter_input(INPUT_POST, 'company_id', FILTER_SANITIZE_NUMBER_INT) : 0;
/** Validando os campos de entrada */
$UsersValidate->setUsersId($usersId);
$CompanyValidate->setCompanyId($companyId);
$ClientsValidate->setClientsId($clientsId);
$ClientsValidate->setcompaniesId($companiesId);
/** Verifica se o ID do usuário foi informado */
if ($UsersValidate->getUserId() > 0) {
@ -80,10 +77,10 @@ if($Main->verifyToken()){
<?php
if($ClientsValidate->getClientsId() > 0){
if($ClientsValidate->getCompaniesId() > 0){
?>
<button type="button" class="btn btn-success btn-sm" onclick="request('FOLDER=view&TABLE=clients&ACTION=clients_form&clients_id=<?php echo $ClientsValidate->getClientsId();?>', '#loadContent', true, '', '', '', 'Carregando usuários cadastrados', 'blue', 'circle', 'sm', true)" data-toggle="tooltip" data-placement="left" title="Retornar a tela anterior">
<button type="button" class="btn btn-success btn-sm" onclick="request('FOLDER=view&TABLE=clients&ACTION=clients_form&clients_id=<?php echo $ClientsValidate->getCompaniesId();?>', '#loadContent', true, '', '', '', 'Carregando usuários cadastrados', 'blue', 'circle', 'sm', true)" data-toggle="tooltip" data-placement="left" title="Retornar a tela anterior">
<i class="fa fa-backward mr-1"></i>Retornar
@ -91,7 +88,7 @@ if($Main->verifyToken()){
<?php } ?>
<button type="button" class="btn btn-info btn-sm" onclick="request('FOLDER=view&TABLE=users&ACTION=users_datagrid&company_id=<?php echo $CompanyValidate->getCompanyId();?>&clients_id=<?php echo $ClientsValidate->getClientsId();?>', '#loadContent', true, '', '', '', 'Carregando usuários cadastrados', 'blue', 'circle', 'sm', true)" data-toggle="tooltip" data-placement="left" title="Carregar usuários cadastrados">
<button type="button" class="btn btn-info btn-sm" onclick="request('FOLDER=view&TABLE=users&ACTION=users_datagrid&company_id=<?php echo $CompanyValidate->getCompanyId();?>&clients_id=<?php echo $ClientsValidate->getCompaniesId();?>', '#loadContent', true, '', '', '', 'Carregando usuários cadastrados', 'blue', 'circle', 'sm', true)" data-toggle="tooltip" data-placement="left" title="Carregar usuários cadastrados">
<i class="fas fa-plus-circle mr-1"></i>Usuários Cadastrados
@ -141,7 +138,7 @@ if($Main->verifyToken()){
foreach($ClientsResult as $ClientsKey => $Result){
?>
<option value="<?php echo $Result->clients_id;?>" <?php echo $Result->clients_id == $ClientsValidate->getClientsId() ? 'selected' : '';?> ><?php echo $Result->fantasy_name;?></option>
<option value="<?php echo $Result->clients_id;?>" <?php echo $Result->clients_id == $ClientsValidate->getCompaniesId() ? 'selected' : '';?> ><?php echo $Result->fantasy_name;?></option>
<?php } ?>