From f8bcb30ead89f8c4136c7666f953645696153994 Mon Sep 17 00:00:00 2001 From: Kenio de Souza Date: Fri, 22 Aug 2025 04:52:21 -0300 Subject: [PATCH] Atualizando abas documentos --- vendor/model/Documents.class.php | 28 +-- vendor/view/documents/documents_datagrid.php | 228 ++++++++----------- 2 files changed, 96 insertions(+), 160 deletions(-) diff --git a/vendor/model/Documents.class.php b/vendor/model/Documents.class.php index 30c2acc..5cafbbf 100644 --- a/vendor/model/Documents.class.php +++ b/vendor/model/Documents.class.php @@ -107,13 +107,12 @@ class Documents } /** Lista todos os egistros do banco com ou sem paginação*/ - public function All(? int $start, ? int $max, ? int $documentsCategorysId, ? string $tag, ? string $label, ? bool $companyId) + public function All(? int $start, ? int $max, ? int $documentsCategorysId, ? string $tag, ? string $label) { /** Parametros de entrada */ $this->start = $start; $this->max = $max; $this->documentsCategorysId = $documentsCategorysId; - $this->companyId = $companyId; $this->tag = $tag; $this->label = $label; $this->and = ""; @@ -128,17 +127,7 @@ class Documents /** Verifico se há paginação */ if($this->max){ $this->limit = "limit $this->start, $this->max"; - } - - /** Se houver um cliente informado, crio o filtro de consulta */ - if($this->companyId === true){ - - $this->and = " and d.company_id is not null"; - - } elseif ($this->companyId === false) { - - $this->and = " and d.company_id is null"; - } + } /** Consulta SQL */ $this->sql = 'select d.documents_id, @@ -176,13 +165,12 @@ class Documents } /** Conta a quantidades de registros */ - public function Count(? int $documentsCategorysId, ? string $tag, ? string $label, ? bool $companyId) + public function Count(? int $documentsCategorysId, ? string $tag, ? string $label) { /** Parametros de entraa */ $this->documentsCategorysId = $documentsCategorysId; $this->tag = $tag; $this->label = $label; - $this->companyId = $companyId; $this->and = ""; /** Se houver categoria informada, crio o filtro de consulta*/ @@ -192,16 +180,6 @@ class Documents $this->and .= " and json_search(tag, 'all', '".$this->tag."', null, '$.".$this->label."') is not null"; } - /** Se houver um cliente informado, crio o filtro de consulta */ - if($this->companyId === true){ - - $this->and = " and company_id is not null"; - - } elseif ($this->companyId === false) { - - $this->and = " and company_id is null"; - } - /** Consulta SQL */ $this->sql = 'select count(documents_id) as qtde from documents diff --git a/vendor/view/documents/documents_datagrid.php b/vendor/view/documents/documents_datagrid.php index d4b8d49..e537a5c 100644 --- a/vendor/view/documents/documents_datagrid.php +++ b/vendor/view/documents/documents_datagrid.php @@ -29,9 +29,14 @@ if($Main->verifyToken()){ $page = strtolower(isset($_POST['page']) ? (int)$Main->antiInjection( filter_input(INPUT_POST,'page', FILTER_SANITIZE_SPECIAL_CHARS) ) : 0); $max = isset($settings->{'app'}->{'datagrid'}->{'rows'}) ? $settings->{'app'}->{'datagrid'}->{'rows'} : 20; + /** Consulta a quantidade de registros */ + $NumberRecords += $Documents->Count((int)$documentsCategorysId, (string)$tag, (string)$label); + /** Cores do card */ $colors = [ 'success', 'info', 'warning', 'danger', 'secondary']; + /** Verifico a quantidade de registros localizados */ + if ($NumberRecords > 0){ //Caso tenha registros cadastrados, carrego o layout ?> @@ -78,171 +83,124 @@ if($Main->verifyToken()){
- -
-
- -
- - +
+
+ +
- - - - - - - - - - - - - Count((int)$documentsCategorysId, (string)$tag, (string)$label, true); - - /** Consulta os usuário cadastrados*/ - $DocumentsResult = $Documents->All($start, $max, (int)$documentsCategorysId, (string)$tag, (string)$label, true); - foreach($DocumentsResult as $DocumentsKey => $Result){ - ?> - - - - - - - - - - - - - - - - - - - - - -
DataDescriçãoCliente
setZeros($Result->documents_id, 3);?>date_register));?>description;?>name_fantasy;?>
- - pagination($NumberRecords, $start, $max, $page, 'FOLDER=view&ACTION=documents_datagrid&TABLE=documents', 'Aguarde'); ?> - -
- + /** Consulta as categorias de documentos cadastradas*/ + $DocumentsCategorysResult = $DocumentsCategorys->All($start, $max); + foreach($DocumentsCategorysResult as $DocumentsCategorysKey => $Result){ + ?> + + +
-
-
+
+ + -
+
- - - - - - - - - - - - - +
DataDescriçãoCliente
+ + + + + + + + + + + + - - - + + Count((int)$documentsCategorysId, (string)$tag, (string)$label, false); - - /** Consulta os usuário cadastrados*/ - $DocumentsResult = $Documents->All($start, $max, (int)$documentsCategorysId, (string)$tag, (string)$label, false); - foreach($DocumentsResult as $DocumentsKey => $Result){ - ?> - - - - - - - - - - + /** Consulta os usuário cadastrados*/ + $DocumentsResult = $Documents->All($start, $max, (int)$documentsCategorysId, (string)$tag, (string)$label); + foreach($DocumentsResult as $DocumentsKey => $Result){ + ?> + + + + + + + + + + - - - + + + - - - + + - - + + + -
DataDescriçãoCliente
setZeros($Result->documents_id, 3);?>date_register));?>description;?>name_fantasy;?>
setZeros($Result->documents_id, 3);?>date_register));?>description;?>name_fantasy;?>
+
- pagination($NumberRecords, $start, $max, $page, 'FOLDER=view&ACTION=documents_datagrid&TABLE=documents', 'Aguarde'); ?> + pagination($NumberRecords, $start, $max, $page, 'FOLDER=view&ACTION=documents_datagrid&TABLE=documents', 'Aguarde'); ?> -
+ -
- -
+
+ - - + + + + + + + + +