diff --git a/CHANGELOG.md b/CHANGELOG.md
index f1baf5e94..b4e7e726e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,21 @@ 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.36.0] - 2022-02-20
+
+### Added
+- Adicionado novo layout referente a área do usuário e do cliente. Sendo o mesmo também responsivo. [@MilsonElias](https://github.com/MilsonElias)
+
+- Adicionado novo tema claro e tema escuro referente a área do usuário. [@MilsonElias](https://github.com/MilsonElias)
+
+- Adicionado nova logomarca. [@MilsonElias](https://github.com/MilsonElias)
+
+- Adicionado função em os.php para facilitar a visualização da OS em garantia, sem garantia e garantia vencida. [Luccas Woiciechoski] e [@Wilmerson](https://github.com/willph)
+
+- Adicionado função em painel.php mostrando receita dia e despesa dia. [@MilsonElias](https://github.com/MilsonElias) e [@Wilmerson](https://github.com/willph)
+
+- Adicionado função de adicionar e alterar imagem do usuário (foto do perfil). [@MilsonElias](https://github.com/MilsonElias) e [@Wilmerson](https://github.com/willph)
+
## [4.35.2] - 2021-10-10
### Fixed
diff --git a/README.md b/README.md
index f5c52a932..da5af825b 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.35.2-blue.svg?longCache=true&style=flat-square)
+![version](https://img.shields.io/badge/version-4.36.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)
@@ -108,7 +108,7 @@ Doações podem ser realizadas nos links:
|:-:|:-:|:-:|:-:|:-:|
| [
Daniel Bastos](https://github.com/daniellbastos) | [
drelldeveloper](https://github.com/drelldeveloper) | [
Samuel Fontebasso](https://github.com/fontebasso) | [
marllonferreira](https://github.com/marllonferreira) | [
Rodrigo Ribeiro](https://github.com/rodrigo3d)
| [
Wilmerson](https://github.com/willph) | [
Thiago Rodrigues](https://github.com/bulfaitelo) | [
Marcos Pereira](https://github.com/mvnp)| [
Marcos](https://github.com/marcotuliomtb)| [
ZanzouShio](https://github.com/ZanzouShio)
-| [
Djunio](https://github.com/seitbnao)
+| [
Djunio](https://github.com/seitbnao) | [
Milson Elias](https://github.com/MilsonElias) |
## Autor
diff --git a/application/config/config.php b/application/config/config.php
index b0704c7b8..3c9285bfe 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -4,7 +4,7 @@
/**
* App current version
*/
-$config['app_version'] = '4.35.2';
+$config['app_version'] = '4.36.0';
/**
* Nome do sistema
diff --git a/application/controllers/Cobrancas.php b/application/controllers/Cobrancas.php
index d307a6a3b..03a23e0cc 100644
--- a/application/controllers/Cobrancas.php
+++ b/application/controllers/Cobrancas.php
@@ -17,7 +17,7 @@ public function __construct()
$this->load->helper('form');
$this->load->model('cobrancas_model');
- $this->data['menuFinanceiro'] = 'cobrancas';
+ $this->data['menuCobrancas'] = 'financeiro';
}
public function index()
diff --git a/application/controllers/Financeiro.php b/application/controllers/Financeiro.php
index 5b1e08592..2891818b2 100644
--- a/application/controllers/Financeiro.php
+++ b/application/controllers/Financeiro.php
@@ -16,7 +16,7 @@ public function __construct()
parent::__construct();
$this->load->model('financeiro_model');
$this->load->helper('codegen_helper');
- $this->data['menuFinanceiro'] = 'financeiro';
+ $this->data['menuLancamentos'] = 'financeiro';
}
public function index()
diff --git a/application/controllers/Login.php b/application/controllers/Login.php
index 679909f4e..eefab111a 100644
--- a/application/controllers/Login.php
+++ b/application/controllers/Login.php
@@ -48,7 +48,7 @@ public function verificarLogin()
// Verificar credenciais do usuário
if (password_verify($password, $user->senha)) {
- $session_data = ['nome' => $user->nome, 'email' => $user->email, 'id' => $user->idUsuarios, 'permissao' => $user->permissoes_id, 'logado' => true];
+ $session_data = ['nome' => $user->nome, 'email' => $user->email, 'url_image_user' => $user->url_image_user, 'id' => $user->idUsuarios, 'permissao' => $user->permissoes_id, 'logado' => true];
$this->session->set_userdata($session_data);
log_info('Efetuou login no sistema');
$json = ['result' => true];
diff --git a/application/controllers/Mapos.php b/application/controllers/Mapos.php
index 79dd9684a..8d6044e53 100644
--- a/application/controllers/Mapos.php
+++ b/application/controllers/Mapos.php
@@ -1,7 +1,6 @@
data['produtos'] = $this->mapos_model->getProdutosMinimo();
$this->data['os'] = $this->mapos_model->getOsEstatisticas();
$this->data['estatisticas_financeiro'] = $this->mapos_model->getEstatisticasFinanceiro();
+ $this->data['financeiro_mes_dia'] = $this->mapos_model->getEstatisticasFinanceiroDia($this->input->get('year'));
$this->data['financeiro_mes'] = $this->mapos_model->getEstatisticasFinanceiroMes($this->input->get('year'));
$this->data['financeiro_mesinadipl'] = $this->mapos_model->getEstatisticasFinanceiroMesInadimplencia($this->input->get('year'));
$this->data['menuPainel'] = 'Painel';
@@ -153,6 +153,41 @@ public function do_upload()
}
}
+ public function do_upload_user()
+ {
+ if (!$this->permission->checkPermission($this->session->userdata('permissao'), 'cEmitente')) {
+ $this->session->set_flashdata('error', 'Você não tem permissão para configurar emitente.');
+ redirect(base_url());
+ }
+
+ $this->load->library('upload');
+
+ $image_upload_folder = FCPATH . 'assets/userImage/';
+
+ if (!file_exists($image_upload_folder)) {
+ mkdir($image_upload_folder, DIR_WRITE_MODE, true);
+ }
+
+ $this->upload_config = [
+ 'upload_path' => $image_upload_folder,
+ 'allowed_types' => 'png|jpg|jpeg|bmp',
+ 'max_size' => 2048,
+ 'remove_space' => true,
+ 'encrypt_name' => true,
+ ];
+
+ $this->upload->initialize($this->upload_config);
+
+ if (!$this->upload->do_upload()) {
+ $upload_error = $this->upload->display_errors();
+ print_r($upload_error);
+ exit();
+ } else {
+ $file_info = [$this->upload->data()];
+ return $file_info[0]['file_name'];
+ }
+ }
+
public function cadastrarEmitente()
{
if (!$this->permission->checkPermission($this->session->userdata('permissao'), 'cEmitente')) {
@@ -278,6 +313,39 @@ public function editarLogo()
redirect(site_url('mapos/emitente'));
}
+ public function uploadUserImage()
+ {
+ if (!$this->permission->checkPermission($this->session->userdata('permissao'), 'cUsuario')) {
+ $this->session->set_flashdata('error', 'Você não tem permissão para mudar a foto.');
+ redirect(base_url());
+ }
+
+ $id = $this->session->userdata('id');
+ if ($id == null || !is_numeric($id)) {
+ $this->session->set_flashdata('error', 'Ocorreu um erro ao tentar alterar sua foto.');
+ redirect(site_url('mapos/minhaConta'));
+ }
+
+ $usuario = $this->mapos_model->getById($id);
+
+ if (is_file(FCPATH . 'assets/userImage/' . $usuario->url_image_user)) {
+ unlink(FCPATH . 'assets/userImage/' . $usuario->url_image_user);
+ }
+
+ $image = $this->do_upload_user();
+ $imageUserPath = $image;
+ $retorno = $this->mapos_model->editImageUser($id, $imageUserPath);
+
+ if ($retorno) {
+ $this->session->set_userdata('url_image_user', $imageUserPath);
+ $this->session->set_flashdata('success', 'Foto alterada com sucesso.');
+ log_info('Alterou a Imagem do Usuario.');
+ } else {
+ $this->session->set_flashdata('error', 'Ocorreu um erro ao tentar alterar sua foto.');
+ }
+ redirect(site_url('mapos/minhaConta'));
+ }
+
public function emails()
{
if (!$this->permission->checkPermission($this->session->userdata('permissao'), 'cEmail')) {
diff --git a/application/database/migrations/20220216173741_upload_image_user.php b/application/database/migrations/20220216173741_upload_image_user.php
new file mode 100644
index 000000000..155b9d865
--- /dev/null
+++ b/application/database/migrations/20220216173741_upload_image_user.php
@@ -0,0 +1,20 @@
+db->query($sql);
+ }
+
+ public function down()
+ {
+ $sql = "
+ ALTER TABLE usuarios DROP COLUMN url_image_user;
+ ";
+ $this->db->query($sql);
+ }
+}
diff --git a/application/models/Mapos_model.php b/application/models/Mapos_model.php
index 6a8638689..64a28e307 100644
--- a/application/models/Mapos_model.php
+++ b/application/models/Mapos_model.php
@@ -234,6 +234,22 @@ public function getEstatisticasFinanceiroMes($year)
return $this->db->query($sql, [intval($numbersOnly)])->row();
}
+ public function getEstatisticasFinanceiroDia($year)
+ {
+ $numbersOnly = preg_replace('/[^0-9]/', '', $year);
+ if (!$numbersOnly) {
+ $numbersOnly = date('Y');
+ }
+ $sql = "
+ SELECT
+ SUM(CASE WHEN (EXTRACT(DAY FROM data_pagamento) = " . date('d') . ") AND baixado = 1 AND tipo = 'receita' THEN valor END) AS VALOR_" . date('m') . "_REC,
+ SUM(CASE WHEN (EXTRACT(DAY FROM data_pagamento) = " . date('d') . ") AND baixado = 1 AND tipo = 'despesa' THEN valor END) AS VALOR_" . date('m') . "_DES
+ FROM lancamentos
+ WHERE EXTRACT(YEAR FROM data_pagamento) = ?
+ ";
+ return $this->db->query($sql, [intval($numbersOnly)])->row();
+ }
+
public function getEstatisticasFinanceiroMesInadimplencia($year)
{
$numbersOnly = preg_replace('/[^0-9]/', '', $year);
@@ -321,6 +337,13 @@ public function editLogo($id, $logo)
return $this->db->update('emitente');
}
+ public function editImageUser($id, $imageUserPath)
+ {
+ $this->db->set('url_image_user', $imageUserPath);
+ $this->db->where('idUsuarios', $id);
+ return $this->db->update('usuarios');
+ }
+
public function check_credentials($email)
{
$this->db->where('email', $email);
diff --git a/application/views/arquivos/adicionarArquivo.php b/application/views/arquivos/adicionarArquivo.php
index c4f875fd8..f44b45073 100644
--- a/application/views/arquivos/adicionarArquivo.php
+++ b/application/views/arquivos/adicionarArquivo.php
@@ -4,7 +4,7 @@