Skip to content

Commit

Permalink
Merge branch 'master' of github.com:RamonSilva20/mapos
Browse files Browse the repository at this point in the history
  • Loading branch information
Pr3d4dor committed Feb 24, 2022
2 parents e79ab09 + 559d84a commit dde7c0e
Show file tree
Hide file tree
Showing 112 changed files with 7,125 additions and 4,666 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ 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
- Adequação para exibir mensagem de erro ao tentar faturar venda sem produtos e OS sem produtos e/ou serviços. [@visaotec](https://github.com/visaotec)

## [4.35.1] - 2021-10-02

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

![MapOS](https://raw.githubusercontent.com/RamonSilva20/mapos/master/assets/img/logo.png)

![version](https://img.shields.io/badge/version-4.35.1-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)
![contributors](https://img.shields.io/github/contributors/RamonSilva20/mapos.svg?longCache=true&style=flat-square)

### [Feedback](https://mapos.fider.io/) - Vote ou sugira melhorias
### [Feedback](https://github.com/RamonSilva20/mapos/discussions) - Vote ou sugira melhorias

![Map-OS](https://raw.githubusercontent.com/RamonSilva20/mapos/master/docs/dashboard.png)

Expand Down Expand Up @@ -108,7 +108,7 @@ Doações podem ser realizadas nos links:
|:-:|:-:|:-:|:-:|:-:|
| [<img src="https://avatars.githubusercontent.com/daniellbastos?s=115"><br><sub>Daniel Bastos</sub>](https://github.com/daniellbastos) | [<img src="https://avatars.githubusercontent.com/github?s=115"><br><sub>drelldeveloper</sub>](https://github.com/drelldeveloper) | [<img src="https://avatars.githubusercontent.com/fontebasso?s=115"><br><sub>Samuel Fontebasso</sub>](https://github.com/fontebasso) | [<img src="https://avatars.githubusercontent.com/marllonferreira?s=115"><br><sub>marllonferreira</sub>](https://github.com/marllonferreira) | [<img src="https://avatars.githubusercontent.com/rodrigo3d?s=115"><br><sub>Rodrigo Ribeiro</sub>](https://github.com/rodrigo3d)
| [<img src="https://avatars.githubusercontent.com/willph?s=115"><br><sub>Wilmerson</sub>](https://github.com/willph) | [<img src="https://avatars.githubusercontent.com/bulfaitelo?s=115"><br><sub>Thiago Rodrigues</sub>](https://github.com/bulfaitelo) | [<img src="https://avatars.githubusercontent.com/mvnp?s=115"><br><sub>Marcos Pereira</sub>](https://github.com/mvnp)| [<img src="https://avatars.githubusercontent.com/marcotuliomtb?s=115"><br><sub>Marcos</sub>](https://github.com/marcotuliomtb)| [<img src="https://avatars.githubusercontent.com/zanzoushio?s=115"><br><sub>ZanzouShio</sub>](https://github.com/ZanzouShio)
| [<img src="https://avatars.githubusercontent.com/seitbnao?s=115"><br><sub>Djunio</sub>](https://github.com/seitbnao)
| [<img src="https://avatars.githubusercontent.com/seitbnao?s=115"><br><sub>Djunio</sub>](https://github.com/seitbnao) | [<img src="https://avatars.githubusercontent.com/MilsonElias?s=115"><br><sub>Milson Elias</sub>](https://github.com/MilsonElias) |


## Autor
Expand Down
2 changes: 1 addition & 1 deletion application/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/**
* App current version
*/
$config['app_version'] = '4.35.1';
$config['app_version'] = '4.36.0';

/**
* Nome do sistema
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Cobrancas.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Financeiro.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
70 changes: 69 additions & 1 deletion application/controllers/Mapos.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}

class Mapos extends MY_Controller
{

Expand All @@ -25,6 +24,7 @@ public function index()
$this->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';
Expand Down Expand Up @@ -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')) {
Expand Down Expand Up @@ -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')) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

class Migration_upload_image_user extends CI_Migration
{
public function up()
{
$sql = "
ALTER TABLE usuarios ADD url_image_user varchar(255) NULL;
";
$this->db->query($sql);
}

public function down()
{
$sql = "
ALTER TABLE usuarios DROP COLUMN url_image_user;
";
$this->db->query($sql);
}
}
23 changes: 23 additions & 0 deletions application/models/Mapos_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 7 additions & 5 deletions application/views/arquivos/adicionarArquivo.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="row-fluid" style="margin-top:0">
<div class="span12">
<div class="widget-box">
<div class="widget-title">
<div class="widget-title" style="margin: -20px 0 0">
<span class="icon">
<i class="fas fa-hdd"></i>
</span>
Expand All @@ -18,7 +18,7 @@
<div class="control-group">
<label for="preco" class="control-label"><span class="required">Arquivo*</span></label>
<div class="controls">
<input id="arquivo" type="file" name="userfile" /> (txt|pdf|gif|png|jpg|jpeg)
<input id="arquivo" type="file" name="userfile" /> (Arquivos suportados .txt .pdf .gif .png .jpg .jpeg)
</div>
</div>

Expand All @@ -45,9 +45,11 @@

<div class="form-actions">
<div class="span12">
<div class="span6 offset3">
<button type="submit" class="btn btn-success"><i class="fas fa-plus"></i> Adicionar</button>
<a href="<?= base_url() ?>index.php/arquivos" class="btn"><i class="fas fa-backward"></i> Voltar</a>
<div class="span6 offset3" style="display:flex;justify-content: center">
<button type="submit" class="button btn btn-mini btn-success" style="max-width: 160px">
<span class="button__icon"><i class='bx bx-plus-circle'></i></span><span class="button__text2">Adicionar</span></a></button>
<a href="<?= base_url() ?>index.php/arquivos" class="button btn btn-mini btn-warning" style="max-width: 160px">
<span class="button__icon"><i class="bx bx-undo"></i></span><span class="button__text2">Voltar</span></a>
</div>
</div>
</div>
Expand Down
33 changes: 15 additions & 18 deletions application/views/arquivos/arquivos.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<div class="new122" style="margin-top: 0; min-height: 100vh">
<link rel="stylesheet" href="<?= base_url(); ?>assets/js/jquery-ui/css/smoothness/jquery-ui-1.9.2.custom.css" />
<script type="text/javascript" src="<?= base_url() ?>assets/js/jquery-ui/js/jquery-ui-1.9.2.custom.js"></script>

<div class="span12" style="margin-left: 0">
<form method="get" action="<?= current_url(); ?>">
<?php if ($this->permission->checkPermission($this->session->userdata('permissao'), 'aArquivo')) : ?>
<div class="span3">
<a href="<?= base_url(); ?>index.php/arquivos/adicionar" class="btn btn-success span12">
<i class="fas fa-plus"></i>
Adicionar Arquivo
</a>
<a href="<?= base_url(); ?>index.php/arquivos/adicionar" class="button btn btn-mini btn-success" style="max-width:150px">
<span class="button__icon"><i class='bx bx-plus-circle'></i></span><span class="button__text2">Arquivo</span></a>
</div>
<?php endif ?>

Expand All @@ -20,14 +19,14 @@
<input type="text" name="data2" id="data2" placeholder="Data até" class="span6 datepicker" value="<?= $this->input->get('data2') ?>">
</div>
<div class="span1">
<button class="span12 btn"> <i class="fas fa-search"></i> </button>
<button class="button btn btn-mini btn-warning" style="min-width: 30px"><span class="button__icon"><i class='bx bx-search-alt'></i></span></button>
</div>
</form>
</div>

<div class="span12" style="margin-left: 0">
<div class="widget-box">
<div class="widget-title">
<div class="widget-title" style="margin: -20px 0 0">
<span class="icon">
<i class="fas fa-hdd"></i>
</span>
Expand All @@ -52,7 +51,7 @@

if (!$results) {
echo '<tr>
<td colspan="5">Nenhum Arquivo Encontrado</td>
<td colspan="8">Nenhum Arquivo Encontrado</td>
</tr>';
}
foreach ($results as $r) : ?>
Expand All @@ -71,20 +70,15 @@
<td><?= $r->tamanho ?> KB</td>
<td><?= $r->tipo ?></td>
<td><?php if ($this->permission->checkPermission($this->session->userdata('permissao'), 'vArquivo')) : ?>
<a href="<?= base_url() ?>index.php/arquivos/download/<?= $r->idDocumentos; ?>" class="btn tip-top" style="margin-right: 1%" title="Download">
<i class="fas fa-download"></i>
</a>
<a href="<?= base_url() ?>index.php/arquivos/download/<?= $r->idDocumentos; ?>" class="btn-nwe" title="Baixar Arquivo"><i class="bx bx-download"></i>
<?php endif ?>

<?php if ($this->permission->checkPermission($this->session->userdata('permissao'), 'eArquivo')) : ?>
<a href="<?= base_url() ?>index.php/arquivos/editar/<?= $r->idDocumentos ?>" class="btn btn-info tip-top" style="margin-right: 1%" title="Editar">
<i class="fas fa-edit"></i>
</a>
<a href="<?= base_url() ?>index.php/arquivos/editar/<?= $r->idDocumentos ?>" class="btn-nwe3" title="Editar"><i class="bx bx-edit"></i></a>
<?php endif ?>

<?php if ($this->permission->checkPermission($this->session->userdata('permissao'), 'dArquivo')) : ?>
<a href="#modal-excluir" style="margin-right: 1%" role="button" data-toggle="modal" arquivo="<?= $r->idDocumentos ?>" class="btn btn-danger tip-top" title="Excluir Arquivo">
<i class="fas fa-trash-alt"></i>
<a href="#modal-excluir" style="margin-right: 1%" role="button" data-toggle="modal" arquivo="<?= $r->idDocumentos ?>" class="btn-nwe4" title="Excluir"><i class="bx bx-trash-alt"></i></a>
</a>
<?php endif ?>
</td>
Expand All @@ -108,9 +102,10 @@
<input type="hidden" id="idDocumento" name="id" value="" />
<h5 style="text-align: center">Deseja realmente excluir este arquivo?</h5>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancelar</button>
<button class="btn btn-danger">Excluir</button>
<div class="modal-footer" style="display:flex;justify-content: center">
<button class="button btn btn-warning" data-dismiss="modal" aria-hidden="true">
<span class="button__icon"><i class="bx bx-x"></i></span><span class="button__text2">Cancelar</span></button>
<button class="button btn btn-danger"><span class="button__icon"><i class='bx bx-trash'></i></span> <span class="button__text2">Excluir</span></button>
</div>
</form>
</div>
Expand All @@ -126,3 +121,5 @@
});
});
</script>

</div>
6 changes: 3 additions & 3 deletions application/views/arquivos/editarArquivo.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@

<div class="form-actions">
<div class="span12">
<div class="span6 offset3">
<button type="submit" class="btn btn-primary"><i class="fas fa-sync-alt"></i> Atualizar</button>
<a href="<?php echo base_url() ?>index.php/arquivos" class="btn"><i class="fas fa-backward"></i> Voltar</a>
<div class="span6 offset3" style="display:flex;justify-content: center">
<button type="submit" class="button btn btn-primary"><span class="button__icon"><i class="bx bx-sync"></i></span><span class="button__text2">Atualizar</span></button>
<a href="<?php echo base_url() ?>index.php/arquivos" class="button btn btn-mini btn-warning"><span class="button__icon"><i class="bx bx-undo"></i></span> <span class="button__text2">Voltar</span></a>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit dde7c0e

Please sign in to comment.