Skip to content

Commit

Permalink
Merge pull request #445 from davidpvilaca/master
Browse files Browse the repository at this point in the history
Adicionado sweetalert2
  • Loading branch information
RamonSilva20 authored Oct 5, 2019
2 parents 9b841c1 + 8b37c61 commit b25e437
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 19 deletions.
13 changes: 11 additions & 2 deletions application/views/clientes/adicionarCliente.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script src="<?php echo base_url()?>assets/js/jquery-3.3.1.min.js"></script>
<script src="<?php echo base_url()?>assets/js/jquery.mask.min.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert2.all.min.js"></script>
<script src="<?php echo base_url()?>assets/js/funcoes.js"></script>

<div class="row-fluid" style="margin-top:0">
Expand Down Expand Up @@ -236,14 +237,22 @@ function limpa_formulario_cep() {
else {
//CEP pesquisado não foi encontrado.
limpa_formulario_cep();
alert("CEP não encontrado.");
Swal.fire({
type: "warning",
title: "Atenção",
text: "CEP não encontrado."
});
}
});
} //end if.
else {
//cep é inválido.
limpa_formulario_cep();
alert("Formato de CEP inválido.");
Swal.fire({
type: "error",
title: "Atenção",
text: "Formato de CEP inválido."
});
}
} //end if.
else {
Expand Down
13 changes: 11 additions & 2 deletions application/views/clientes/editarCliente.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script src="<?php echo base_url()?>assets/js/jquery-3.3.1.min.js"></script>
<script src="<?php echo base_url()?>assets/js/jquery.mask.min.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert2.all.min.js"></script>
<script src="<?php echo base_url()?>assets/js/funcoes.js"></script>

<div class="row-fluid" style="margin-top:0">
Expand Down Expand Up @@ -241,14 +242,22 @@ function limpa_formulario_cep() {
else {
//CEP pesquisado não foi encontrado.
limpa_formulario_cep();
alert("CEP não encontrado.");
Swal.fire({
type: "warning",
title: "Atenção",
text: "CEP não encontrado."
});
}
});
} //end if.
else {
//cep é inválido.
limpa_formulario_cep();
alert("Formato de CEP inválido.");
Swal.fire({
type: "error",
title: "Atenção",
text: "Formato de CEP inválido."
});
}
} //end if.
else {
Expand Down
7 changes: 6 additions & 1 deletion application/views/financeiro/lancamentos.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<link rel="stylesheet" href="<?php echo base_url();?>assets/js/jquery-ui/css/smoothness/jquery-ui-1.9.2.custom.css" />
<script type="text/javascript" src="<?php echo base_url()?>assets/js/jquery-ui/js/jquery-ui-1.9.2.custom.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert2.all.min.js"></script>

<?php $situacao = $this->input->get('situacao');
$periodo = $this->input->get('periodo');
Expand Down Expand Up @@ -573,7 +574,11 @@
}
else{
$("#btnCancelExcluir").trigger('click');
alert('Ocorreu um erro ao tentar excluir produto.');
Swal.fire({
type: "error",
title: "Atenção",
text: "Ocorreu um erro ao tentar excluir produto."
});
}
}
});
Expand Down
49 changes: 41 additions & 8 deletions application/views/os/editarOs.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/js/jquery-ui/css/smoothness/jquery-ui-1.9.2.custom.css" />
<script type="text/javascript" src="<?php echo base_url() ?>assets/js/jquery-ui/js/jquery-ui-1.9.2.custom.js"></script>
<script type="text/javascript" src="<?php echo base_url() ?>assets/js/jquery.validate.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert2.all.min.js"></script>
<link rel="stylesheet" href="<?php echo base_url() ?>assets/trumbowyg/ui/trumbowyg.css">
<script type="text/javascript" src="<?php echo base_url() ?>assets/trumbowyg/trumbowyg.js"></script>
<script type="text/javascript" src="<?php echo base_url() ?>assets/trumbowyg/langs/pt_br.js"></script>
Expand Down Expand Up @@ -450,7 +451,11 @@

window.location.reload(true);
} else {
alert('Ocorreu um erro ao tentar faturar OS.');
Swal.fire({
type: "error",
title: "Atenção",
text: "Ocorreu um erro ao tentar faturar OS."
});
$('#progress-fatura').hide();
}
}
Expand Down Expand Up @@ -511,7 +516,11 @@
$('#termoGarantia').on('change', function(){
if(!$(this).val() && $("#garantias_id").val()){
$("#garantias_id").val('');
alert('Termo de garantia removido');
Swal.fire({
type: "success",
title: "Sucesso",
text: "Termo de garantia removido"
});
}
});

Expand Down Expand Up @@ -570,7 +579,11 @@
var quantidade = parseInt($("#quantidade").val());
var estoque = parseInt($("#estoque").val());
if (estoque < quantidade) {
alert('Você não possui estoque suficiente.');
Swal.fire({
type: "error",
title: "Atenção",
text: "Você não possui estoque suficiente."
});
} else {
var dados = $(form).serialize();
$("#divProdutos").html("<div class='progress progress-info progress-striped active'><div class='bar' style='width: 100%'></div></div>");
Expand All @@ -586,7 +599,11 @@
$("#preco").val('');
$("#produto").val('').focus();
} else {
alert('Ocorreu um erro ao tentar adicionar produto.');
Swal.fire({
type: "error",
title: "Atenção",
text: "Ocorreu um erro ao tentar adicionar produto."
});
}
}
});
Expand Down Expand Up @@ -622,7 +639,11 @@
$("#preco_servico").val('');
$("#servico").val('').focus();
} else {
alert('Ocorreu um erro ao tentar adicionar serviço.');
Swal.fire({
type: "error",
title: "Atenção",
text: "Ocorreu um erro ao tentar adicionar serviço."
});
}
}
});
Expand Down Expand Up @@ -679,7 +700,11 @@
$("#divProdutos").load("<?php echo current_url(); ?> #divProdutos");

} else {
alert('Ocorreu um erro ao tentar excluir produto.');
Swal.fire({
type: "error",
title: "Atenção",
text: "Ocorreu um erro ao tentar excluir produto."
});
}
}
});
Expand All @@ -702,7 +727,11 @@
$("#divServicos").load("<?php echo current_url(); ?> #divServicos");

} else {
alert('Ocorreu um erro ao tentar excluir serviço.');
Swal.fire({
type: "error",
title: "Atenção",
text: "Ocorreu um erro ao tentar excluir serviço."
});
}
}
});
Expand Down Expand Up @@ -737,7 +766,11 @@
if (data.result == true) {
$("#divAnexos").load("<?php echo current_url(); ?> #divAnexos");
} else {
alert(data.mensagem);
Swal.fire({
type: "error",
title: "Atenção",
text: data.mensagem
});
}
}
});
Expand Down
13 changes: 11 additions & 2 deletions application/views/os/os.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/js/jquery-ui/css/smoothness/jquery-ui-1.9.2.custom.css" />
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/table-custom.css" />
<script type="text/javascript" src="<?php echo base_url() ?>assets/js/jquery-ui/js/jquery-ui-1.9.2.custom.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert2.all.min.js"></script>



Expand Down Expand Up @@ -204,10 +205,18 @@
})
.done(function(data) {
if (data.result == true) {
alert('Notificação excluída com sucesso');
Swal.fire({
type: "success",
title: "Sucesso",
text: "Notificação excluída com sucesso."
});
location.reload();
} else {
alert('Ocorreu um problema ao tentar exlcuir notificação.');
Swal.fire({
type: "success",
title: "Sucesso",
text: "Ocorreu um problema ao tentar exlcuir notificação."
});
}
});
});
Expand Down
25 changes: 21 additions & 4 deletions application/views/vendas/editarVenda.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/js/jquery-ui/css/smoothness/jquery-ui-1.9.2.custom.css" />
<script type="text/javascript" src="<?php echo base_url() ?>assets/js/jquery-ui/js/jquery-ui-1.9.2.custom.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert2.all.min.js"></script>


<div class="row-fluid" style="margin-top:0">
Expand Down Expand Up @@ -241,7 +242,11 @@
if (data.result == true) {
window.location.reload(true);
} else {
alert('Ocorreu um erro ao tentar faturar venda.');
Swal.fire({
type: "error",
title: "Atenção",
text: "Ocorreu um erro ao tentar faturar venda."
});
$('#progress-fatura').hide();
}
}
Expand Down Expand Up @@ -321,7 +326,11 @@
var quantidade = parseInt($("#quantidade").val());
var estoque = parseInt($("#estoque").val());
if (estoque < quantidade) {
alert('Você não possui estoque suficiente.');
Swal.fire({
type: "warning",
title: "Atenção",
text: "Você não possui estoque suficiente."
});
} else {
var dados = $(form).serialize();
$("#divProdutos").html("<div class='progress progress-info progress-striped active'><div class='bar' style='width: 100%'></div></div>");
Expand All @@ -337,7 +346,11 @@
$("#preco").val('');
$("#produto").val('').focus();
} else {
alert('Ocorreu um erro ao tentar adicionar produto.');
Swal.fire({
type: "error",
title: "Atenção",
text: "Ocorreu um erro ao tentar adicionar produto."
});
}
}
});
Expand All @@ -360,7 +373,11 @@
if (data.result == true) {
$("#divProdutos").load("<?php echo current_url(); ?> #divProdutos");
} else {
alert('Ocorreu um erro ao tentar excluir produto.');
Swal.fire({
type: "error",
title: "Atenção",
text: "Ocorreu um erro ao tentar excluir produto."
});
}
}
});
Expand Down
2 changes: 2 additions & 0 deletions assets/js/sweetalert2.all.min.js

Large diffs are not rendered by default.

0 comments on commit b25e437

Please sign in to comment.