From 2872149abf536edd161ff90df3f4561ec55b476e Mon Sep 17 00:00:00 2001 From: Gianluca Bine Date: Sat, 26 Sep 2020 14:59:44 -0300 Subject: [PATCH] =?UTF-8?q?Adicionado=20observac=C3=B5es=20em=20vendas=20(?= =?UTF-8?q?#965)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adicionado observacões em vendas * Apply php-cs-fixer changes Co-authored-by: Pr3d4dor --- CHANGELOG.md | 7 ++++++- README.md | 2 +- application/config/config.php | 2 +- application/config/form_validation.php | 5 +++++ application/controllers/Vendas.php | 6 ++++-- ...012421_add_observacoes_to_vendas_table.php | 20 +++++++++++++++++++ application/views/vendas/adicionarVenda.php | 15 ++++++++++++++ application/views/vendas/editarVenda.php | 17 ++++++++++++++-- banco.sql | 3 ++- updates/update_4.14.1_to_4.15.0.sql | 2 ++ 10 files changed, 71 insertions(+), 8 deletions(-) create mode 100644 application/database/migrations/20200921012421_add_observacoes_to_vendas_table.php create mode 100644 updates/update_4.14.1_to_4.15.0.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b62257d7..8ca04b776 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,12 @@ Todas as alterações serão documentadas neste arquivo Formato baseado em [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), e [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [4.14.1] - 2020-09-20 +## [4.15.0] - 2020-09-21 + +## Added +- Adicionado observacões em vendas. [@Pr3d4dor](https://github.com/Pr3d4dor) + +## [4.14.1] - 2020-09-21 ## Fixed - Corrigido busca de calendário de OS. [@Pr3d4dor](https://github.com/Pr3d4dor) diff --git a/README.md b/README.md index 3b8c675ea..08274e03d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![MapOS](https://raw.githubusercontent.com/RamonSilva20/mapos/master/assets/img/logo.png) -![version](https://img.shields.io/badge/version-4.14.1-blue.svg?longCache=true&style=flat-square) +![version](https://img.shields.io/badge/version-4.15.0-blue.svg?longCache=true&style=flat-square) ![license](https://img.shields.io/badge/license-MIT-green.svg?longCache=true&style=flat-square) ![theme](https://img.shields.io/badge/theme-Matrix--Admin-lightgrey.svg?longCache=true&style=flat-square) ![issues](https://img.shields.io/github/issues/RamonSilva20/mapos.svg?longCache=true&style=flat-square) diff --git a/application/config/config.php b/application/config/config.php index 5413acc46..9e05e086b 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -4,7 +4,7 @@ /** * App current version */ -$config['app_version'] = '4.14.1'; +$config['app_version'] = '4.15.0'; /** * Nome do sistema diff --git a/application/config/form_validation.php b/application/config/form_validation.php index 1440f9c0b..be3e613b6 100644 --- a/application/config/form_validation.php +++ b/application/config/form_validation.php @@ -357,6 +357,11 @@ 'label' => 'Data da Venda', 'rules' => 'required|trim', ], + [ + 'field' => 'observacoes', + 'label' => 'Observacoes', + 'rules' => 'trim', + ], [ 'field' => 'clientes_id', 'label' => 'clientes', diff --git a/application/controllers/Vendas.php b/application/controllers/Vendas.php index 75d9b7744..a5ecfd8ae 100644 --- a/application/controllers/Vendas.php +++ b/application/controllers/Vendas.php @@ -69,6 +69,7 @@ public function adicionar() $data = [ 'dataVenda' => $dataVenda, + 'observacoes' => $this->input->post('observacoes'), 'clientes_id' => $this->input->post('clientes_id'), 'usuarios_id' => $this->input->post('usuarios_id'), 'faturado' => 0, @@ -116,6 +117,7 @@ public function editar() $data = [ 'dataVenda' => $dataVenda, + 'observacoes' => $this->input->post('observacoes'), 'usuarios_id' => $this->input->post('usuarios_id'), 'clientes_id' => $this->input->post('clientes_id'), ]; @@ -276,7 +278,7 @@ public function adicionarProduto() if ($this->vendas_model->add('itens_de_vendas', $data) == true) { $this->load->model('produtos_model'); - + if ($this->data['configuration']['control_estoque']) { $this->produtos_model->updateEstoque($produto, $quantidade, '-'); } @@ -303,7 +305,7 @@ public function excluirProduto() $produto = $this->input->post('produto'); $this->load->model('produtos_model'); - + if ($this->data['configuration']['control_estoque']) { $this->produtos_model->updateEstoque($produto, $quantidade, '+'); } diff --git a/application/database/migrations/20200921012421_add_observacoes_to_vendas_table.php b/application/database/migrations/20200921012421_add_observacoes_to_vendas_table.php new file mode 100644 index 000000000..9e64af9d8 --- /dev/null +++ b/application/database/migrations/20200921012421_add_observacoes_to_vendas_table.php @@ -0,0 +1,20 @@ +dbforge->add_column('vendas', [ + 'observacoes' => [ + 'type' => 'TEXT', + 'null' => true, + 'default' => null, + ], + ]); + } + + public function down() + { + $this->dbforge->drop_column('vendas', 'observacoes'); + } +} diff --git a/application/views/vendas/adicionarVenda.php b/application/views/vendas/adicionarVenda.php index c1e854bf0..c6c5e76b6 100644 --- a/application/views/vendas/adicionarVenda.php +++ b/application/views/vendas/adicionarVenda.php @@ -1,6 +1,10 @@ + + + +
@@ -38,6 +42,14 @@
+ +
+ + +
+
@@ -106,5 +118,8 @@ $(".datepicker").datepicker({ dateFormat: 'dd/mm/yy' }); + $('.editor').trumbowyg({ + lang: 'pt_br' + }); }); diff --git a/application/views/vendas/editarVenda.php b/application/views/vendas/editarVenda.php index a994f63a8..7be8825a8 100644 --- a/application/views/vendas/editarVenda.php +++ b/application/views/vendas/editarVenda.php @@ -1,7 +1,9 @@ - + + +
@@ -42,6 +44,14 @@
+ +
+ + +
+
faturado == 0) { ?> @@ -329,7 +339,7 @@ - + if (estoque < quantidade) { Swal.fire({ type: "warning", @@ -392,5 +402,8 @@ $(".datepicker").datepicker({ dateFormat: 'dd/mm/yy' }); + $('.editor').trumbowyg({ + lang: 'pt_br' + }); }); diff --git a/banco.sql b/banco.sql index 50681c1e8..4847985ca 100644 --- a/banco.sql +++ b/banco.sql @@ -322,6 +322,7 @@ CREATE TABLE IF NOT EXISTS `vendas` ( `valorTotal` VARCHAR(45) NULL, `desconto` VARCHAR(45) NULL, `faturado` TINYINT(1) NULL, + `observacoes` TEXT NULL, `clientes_id` INT(11) NOT NULL, `usuarios_id` INT(11) NULL, `lancamentos_id` INT(11) NULL, @@ -577,7 +578,7 @@ INSERT INTO `permissoes` (`idPermissao`, `nome`, `permissoes`, `situacao`, `data INSERT INTO `usuarios` (`idUsuarios`, `nome`, `rg`, `cpf`, `cep`, `rua`, `numero`, `bairro`, `cidade`, `estado`, `email`, `senha`, `telefone`, `celular`, `situacao`, `dataCadastro`, `permissoes_id`,`dataExpiracao`) VALUES (1, 'admin_name', 'MG-25.502.560', '600.021.520-87', '70005-115', 'Rua Acima', '12', 'Alvorada', 'Teste', 'MG', 'admin_email', 'admin_password', '000000-0000', '', 1, 'admin_created_at', 1, '3000-01-01'); -INSERT INTO `migrations`(`version`) VALUES ('20200428012421'); +INSERT INTO `migrations`(`version`) VALUES ('20200921012421'); SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; diff --git a/updates/update_4.14.1_to_4.15.0.sql b/updates/update_4.14.1_to_4.15.0.sql new file mode 100644 index 000000000..f5e990094 --- /dev/null +++ b/updates/update_4.14.1_to_4.15.0.sql @@ -0,0 +1,2 @@ +-- Alterando tabela vendas +ALTER TABLE vendas ADD observacoes TEXT DEFAULT NULL NULL;