@nixweb/nixloc-ui 0.0.55 → 0.0.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nixweb/nixloc-ui",
3
- "version": "0.0.55",
3
+ "version": "0.0.58",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -155,6 +155,6 @@ export default {
155
155
  }
156
156
 
157
157
  .margem-botao {
158
- margin-top: -10px;
158
+ margin-top: -15px;
159
159
  }
160
160
  </style>
@@ -58,7 +58,7 @@ export default {
58
58
  </script>
59
59
  <style scoped>
60
60
  .foto-container {
61
- margin-top: -32px;
61
+ margin-top: -15px;
62
62
  padding-right: 10px;
63
63
  cursor: pointer;
64
64
  position: fixed;
@@ -1,84 +1,114 @@
1
1
  <template>
2
- <div>
3
- <sidebar-menu
4
- :menu="menu.itens"
5
- :collapsed="menu.escondeMostra"
6
- theme="white-theme"
7
- width="220px"
8
- />
2
+ <div class="menu-container">
3
+ <ul class="menu">
4
+ <li>
5
+ <a
6
+ href="#"
7
+ @click.prevent="navegarPara('dashboard')"
8
+ :class="sessaoDestaque('home')"
9
+ >
10
+ <i class="fa fa-home menu__icon" aria-hidden="true"></i>
11
+ Dashboard
12
+ </a>
13
+ </li>
14
+
15
+ <li v-for="(item, index) in menuFiltro(true)" :key="index">
16
+ <a
17
+ href="#"
18
+ @click.prevent="abrirSubMenu(item.modulo)"
19
+ :class="sessaoDestaque(item.modulo)"
20
+ >
21
+ <i :class="item.icone" class="menu__icon" aria-hidden="true"></i>
22
+ {{ item.modulo }}
23
+ <i class="fa fa-chevron-right menu__arrow-icon" aria-hidden="true"></i>
24
+ </a>
25
+ </li>
26
+ </ul>
27
+
28
+ <transition name="slide-fade">
29
+ <div class="context-menu-container" v-show="subMenuPrimeiroNivel">
30
+ <ul class="context-menu">
31
+ <li v-for="(item, index) in subMenuFiltro(false)" :key="index">
32
+ <h5 v-if="item.tipo === 'grupo'" class="context-menu__title">
33
+ <i :class="item.icone" aria-hidden="true"></i>
34
+ {{ item.grupoNome }}
35
+ <span
36
+ v-if="index === 0"
37
+ @click.prevent="fecharSubMenu"
38
+ class="context-menu__btn-close"
39
+ href="#"
40
+ >
41
+ <i class="fas fa-times-circle"></i>
42
+ </span>
43
+ </h5>
44
+
45
+ <a
46
+ v-else
47
+ href="#"
48
+ @click.prevent="navegarPara(item.nomeRota)"
49
+ :class="classeSubMenu(item.titulo)"
50
+ >
51
+ {{ item.titulo }}
52
+ </a>
53
+ </li>
54
+ </ul>
55
+ </div>
56
+ </transition>
9
57
  </div>
10
58
  </template>
11
59
 
12
60
  <script>
13
- import { SidebarMenu } from "vue-sidebar-menu";
14
- import { mapState, mapMutations } from "vuex";
61
+ import { mapState } from "vuex";
15
62
 
16
63
  export default {
17
- components: {
18
- SidebarMenu,
19
- },
64
+ name: "Menu",
20
65
  data() {
21
66
  return {
22
- tamanhoPagina: "0",
23
- windowWidth: 0,
24
- windowHeight: 0,
67
+ modulo: "",
68
+ subMenuPrimeiroNivel: false,
25
69
  };
26
70
  },
27
- created() {
28
- this.tamanhoPagina = window.innerWidth;
29
- var corpo = document.getElementsByTagName("body")[0];
30
- corpo.style = "margin-left: 220px;transition: all 0.2s ease-in-out;";
31
- },
32
- mounted() {
33
- this.esconderBotaoRodape();
34
- this.escondeMostra(false);
35
-
36
- this.$nextTick(function () {
37
- window.addEventListener("resize", this.getWindowWidth);
38
- window.addEventListener("resize", this.getWindowHeight);
39
- this.getWindowWidth();
40
- this.getWindowHeight();
41
- });
42
- },
43
- beforeDestroy() {
44
- window.removeEventListener("resize", this.getWindowWidth);
45
- window.removeEventListener("resize", this.getWindowHeight);
46
- },
47
- updated() {
48
- this.esconderBotaoRodape();
49
- },
50
71
  methods: {
51
- ...mapMutations("generic", ["escondeMostraMenu"]),
52
- escondeMostra(esconde) {
53
- var corpo = document.getElementsByTagName("body")[0];
54
- this.escondeMostraMenu(esconde);
55
- if (esconde) {
56
- corpo.style = "margin-left: 50px;transition: all 0.2s ease-in-out;";
57
- } else {
58
- corpo.style = "margin-left: 220px;transition: all 0.2s ease-in-out;";
59
- }
72
+ abrirSubMenu(modulo) {
73
+ this.subMenuPrimeiroNivel = true;
74
+ this.modulo = modulo;
60
75
  },
61
- getWindowWidth(event) {
62
- this.windowWidth = document.documentElement.clientWidth;
76
+ fecharSubMenu() {
77
+ this.subMenuPrimeiroNivel = false;
78
+ this.menuItens = [];
63
79
  },
64
- getWindowHeight(event) {
65
- this.windowHeight = document.documentElement.clientHeight;
80
+ sessaoDestaque(section) {
81
+ return {
82
+ menu__link: true,
83
+ "menu__link--active": section === this.contextSection,
84
+ };
66
85
  },
67
- esconderBotaoRodape() {
68
- var botao = document.getElementsByClassName("collapse-btn")[0];
69
- botao.style = "visibility: hidden !important;";
86
+ classeSubMenu(subMenuName) {
87
+ return {
88
+ "context-menu__link": true,
89
+ "context-menu__link--active": this.activeSubMenu === subMenuName,
90
+ };
70
91
  },
71
- },
72
- watch: {
73
- windowWidth: function () {
74
- if (this.windowWidth < 1280) {
75
- this.escondeMostra(true);
76
- } else {
77
- this.escondeMostra(false);
78
- }
92
+ navegarPara(nomeRota) {
93
+ this.$router.push({
94
+ name: nomeRota,
95
+ });
96
+ this.fecharSubMenu();
79
97
  },
80
- "menu.escondeMostra": function (value) {
81
- this.escondeMostra(value);
98
+ menuFiltro(ehModulo) {
99
+ let filtro = [];
100
+ this.menu.itens.forEach(function (obj) {
101
+ if (obj.ehModulo == ehModulo) filtro.push(obj);
102
+ });
103
+ return filtro;
104
+ },
105
+ subMenuFiltro(ehModulo) {
106
+ let filtro = [];
107
+ let self = this;
108
+ this.menu.itens.forEach(function (obj) {
109
+ if (obj.ehModulo == ehModulo && obj.modulo === self.modulo) filtro.push(obj);
110
+ });
111
+ return filtro;
82
112
  },
83
113
  },
84
114
  computed: {
@@ -86,28 +116,3 @@ export default {
86
116
  },
87
117
  };
88
118
  </script>
89
-
90
- <style>
91
- .v-sidebar-menu .vsm-title {
92
- font-size: 14px !important;
93
- font-weight: normal !important;
94
- }
95
-
96
- .v-sidebar-menu.white-theme .vsm-dropdown > .vsm-list {
97
- background-color: #fafafc !important;
98
- }
99
-
100
- .v-sidebar-menu {
101
- background-color: white !important;
102
- border-right: 1px solid #e1e1e2;
103
- }
104
-
105
- .v-sidebar-menu.white-theme .vsm-item.first-item > .vsm-link > .vsm-icon {
106
- color: #4680a5 !important;
107
- }
108
-
109
- .v-sidebar-menu .vsm-arrow:after {
110
- font-family: "Font Awesome 5 Pro" !important;
111
- content: "\f105" !important;
112
- }
113
- </style>
@@ -98,7 +98,7 @@ export default {
98
98
  <style scoped>
99
99
  .c-container {
100
100
  margin: auto;
101
- padding-left: 30px;
101
+ padding-left: 240px;
102
102
  padding-right: 30px;
103
103
  max-width: 1400px;
104
104
  }
@@ -1,14 +1,9 @@
1
1
  <template>
2
2
  <div>
3
- <div
4
- class="topo"
5
- :class="{ esconde: menu.escondeMostra, mostra: !menu.escondeMostra }"
6
- :style="'background-color:' + corTopo"
7
- >
8
- <div class="lado-a-lado" @click="mostrar = !mostrar">
9
- <span class="icone"><i class="fal fa-bars"></i></span>
3
+ <div class="topo" :style="'background-color:' + corTopo">
4
+ <div class="lado-a-lado">
5
+ <slot></slot>
10
6
  </div>
11
- <div class="lado-a-lado"><slot></slot></div>
12
7
  </div>
13
8
  <br />
14
9
  </div>
@@ -25,20 +20,6 @@ export default {
25
20
  default: "#4680A5",
26
21
  },
27
22
  },
28
- data() {
29
- return { mostrar: false };
30
- },
31
- methods: {
32
- ...mapMutations("generic", ["escondeMostraMenu"]),
33
- },
34
- computed: {
35
- ...mapState("generic", ["menu"]),
36
- },
37
- watch: {
38
- mostrar(valor) {
39
- this.escondeMostraMenu(valor);
40
- },
41
- },
42
23
  };
43
24
  </script>
44
25
 
@@ -51,18 +32,4 @@ export default {
51
32
  left: 0;
52
33
  z-index: 20;
53
34
  }
54
-
55
- .esconde {
56
- padding-left: 60px;
57
- }
58
-
59
- .mostra {
60
- padding-left: 230px;
61
- }
62
-
63
- .icone {
64
- font-size: 25px;
65
- color: white;
66
- cursor: pointer;
67
- }
68
35
  </style>
@@ -18,11 +18,11 @@ export default {
18
18
  },
19
19
  methods: {
20
20
  notifica(value) {
21
- if (value.tipo == "adicionarApiSucesso" || value.tipo == "modificarApiSucesso")
21
+ if (value.tipo == "postApi" || value.tipo == "putApi")
22
22
  this.$toasted.show("Salvo com sucesso", {
23
23
  type: "success",
24
24
  });
25
- if (value.tipo == "adicionarApiErro" || value.tipo == "modificarApiErro") {
25
+ if (value.tipo == "postApiErro" || value.tipo == "putApiErro") {
26
26
  this.$toasted.show("Ops! Algo deu errado", {
27
27
  type: "error",
28
28
  });
@@ -0,0 +1,7 @@
1
+ export default class DadosContato {
2
+ constructor() {
3
+ this.telefone = "";
4
+ this.site = "";
5
+ this.email = "";
6
+ }
7
+ }
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <div>
3
+ <b-row>
4
+ <b-col xs="12" sm="12" md="12" lg="4" xl="4">
5
+ <Texto
6
+ titulo="Telefone"
7
+ campo="telefone"
8
+ :formNome="formNome"
9
+ :mascara="['(##) ####-####', '(##) #####-####']"
10
+ :tamanhoMaximo="20"
11
+ v-model="dadosContato.telefone"
12
+ />
13
+ </b-col>
14
+ <b-col xs="12" sm="12" md="12" lg="4" xl="4">
15
+ <Texto
16
+ titulo="Site"
17
+ campo="site"
18
+ :formNome="formNome"
19
+ mascara=""
20
+ :tamanhoMaximo="100"
21
+ v-model="dadosContato.site"
22
+ />
23
+ </b-col>
24
+ <b-col xs="12" sm="12" md="12" lg="4" xl="4">
25
+ <Texto
26
+ titulo="E-mail"
27
+ campo="email"
28
+ :formNome="formNome"
29
+ mascara=""
30
+ :tamanhoMaximo="100"
31
+ v-model="dadosContato.email"
32
+ />
33
+ </b-col>
34
+ </b-row>
35
+ </div>
36
+ </template>
37
+
38
+ <script>
39
+ import Botao from "@nixweb/nixloc-ui/src/component/forms/Botao";
40
+ import Texto from "@nixweb/nixloc-ui/src/component/forms/Texto";
41
+ import Opcoes from "@nixweb/nixloc-ui/src/component/forms/Opcoes";
42
+ import DadosContato from "@nixweb/nixloc-ui/src/component/value-objects/DadosContato.js";
43
+
44
+ import { mapGetters } from "vuex";
45
+
46
+ export default {
47
+ name: "DadosContato",
48
+ props: {
49
+ formNome: String,
50
+ value: Object,
51
+ },
52
+ components: { Opcoes, Texto, Botao },
53
+ data() {
54
+ return {
55
+ dadosContato: new DadosContato(),
56
+ };
57
+ },
58
+ methods: {
59
+ carregaDados(dados) {
60
+ this.dadosContato.telefone = dados.telefone;
61
+ this.dadosContato.email = dados.email;
62
+ },
63
+ },
64
+ computed: {
65
+ ...mapGetters("generic", ["evento"]),
66
+ },
67
+ watch: {
68
+ value: {
69
+ handler() {
70
+ this.dadosPessoa = this.value;
71
+ },
72
+ deep: true,
73
+ },
74
+ dadosContato: {
75
+ handler() {
76
+ this.$emit("input", this.dadosContato);
77
+ },
78
+ deep: true,
79
+ },
80
+ evento: {
81
+ handler(evento) {
82
+ if (evento.nome == "buscarCnpjReceita") {
83
+ this.carregaDados(evento.dados);
84
+ }
85
+ },
86
+ deep: true,
87
+ },
88
+ },
89
+ };
90
+ </script>
@@ -0,0 +1,10 @@
1
+ export default class DadosPessoa {
2
+ constructor() {
3
+ this.tipoPessoa = 2;
4
+ this.razaoSocialNome = "";
5
+ this.fantasiaApelido = "";
6
+ this.cnpjCpf = "";
7
+ this.inscricaoEstadualRg = "";
8
+ this.inscricaoMunicipal = "";
9
+ }
10
+ }
@@ -0,0 +1,138 @@
1
+ <template>
2
+ <div>
3
+ <b-row>
4
+ <b-col xs="12" sm="12" md="12" lg="4" xl="4">
5
+ <Opcoes
6
+ campo="tipoPessoa"
7
+ :formNome="formNome"
8
+ :opcoes="[
9
+ { text: 'Física', value: 1 },
10
+ { text: 'Jurídica', value: 2 },
11
+ ]"
12
+ v-model="dadosPessoa.tipoPessoa"
13
+ />
14
+ </b-col>
15
+ </b-row>
16
+ <b-row>
17
+ <b-col xs="12" sm="12" md="12" lg="4" xl="4">
18
+ <Texto
19
+ :titulo="dadosPessoa.tipoPessoa == 2 ? 'CNPJ' : 'CPF'"
20
+ campo="cnpjCpf"
21
+ :formNome="formNome"
22
+ :mascara="['##.###.###/####-##', '###.###.###-##']"
23
+ :tamanhoMaximo="30"
24
+ v-model="dadosPessoa.cnpjCpf"
25
+ ><div class="glyphicon margem-botao">
26
+ <Botao
27
+ v-if="dadosPessoa.tipoPessoa == 2"
28
+ chave="buscarCnpjReceita"
29
+ tipo="sucesso"
30
+ classeIcone="fas fa-search"
31
+ :desabilitado="dadosPessoa.cnpjCpf.length < 18"
32
+ tamanho="pequeno"
33
+ :clique="buscarCnpjReceita"
34
+ /></div
35
+ ></Texto>
36
+ </b-col>
37
+ <b-col xs="12" sm="12" md="12" lg="4" xl="4">
38
+ <Texto
39
+ :titulo="dadosPessoa.tipoPessoa == 2 ? 'Inscrição Estadual' : 'RG'"
40
+ campo="inscricaoEstadualRg"
41
+ :formNome="formNome"
42
+ :tamanhoMaximo="50"
43
+ v-model="dadosPessoa.inscricaoEstadualRg"
44
+ />
45
+ </b-col>
46
+ <b-col xs="12" sm="12" md="12" lg="4" xl="4">
47
+ <Texto
48
+ v-if="dadosPessoa.tipoPessoa == 2"
49
+ titulo="Inscrição Municipal"
50
+ campo="inscricaoMunicipal"
51
+ :formNome="formNome"
52
+ :tamanhoMaximo="50"
53
+ v-model="dadosPessoa.inscricaoMunicipal"
54
+ />
55
+ </b-col>
56
+ </b-row>
57
+ <br v-if="dadosPessoa.tipoPessoa == 2" />
58
+ <b-row>
59
+ <b-col xs="12" sm="12" md="12" lg="8" xl="8">
60
+ <Texto
61
+ :titulo="dadosPessoa.tipoPessoa == 2 ? 'Razão Social' : 'Nome'"
62
+ campo="razaoSocialNome"
63
+ :formNome="formNome"
64
+ :requerido="true"
65
+ :tamanhoMaximo="100"
66
+ v-model="dadosPessoa.razaoSocialNome"
67
+ />
68
+ </b-col>
69
+ <b-col xs="12" sm="12" md="12" lg="4" xl="4">
70
+ <Texto
71
+ :titulo="dadosPessoa.tipoPessoa == 2 ? 'Fantasia' : 'Apelido'"
72
+ campo="fantasiaApelido"
73
+ :formNome="formNome"
74
+ :requerido="true"
75
+ :tamanhoMaximo="100"
76
+ v-model="dadosPessoa.fantasiaApelido"
77
+ />
78
+ </b-col>
79
+ </b-row>
80
+ </div>
81
+ </template>
82
+
83
+ <script>
84
+ import Botao from "@nixweb/nixloc-ui/src/component/forms/Botao";
85
+ import Texto from "@nixweb/nixloc-ui/src/component/forms/Texto";
86
+ import Opcoes from "@nixweb/nixloc-ui/src/component/forms/Opcoes";
87
+ import DadosPessoa from "@nixweb/nixloc-ui/src/component/value-objects/DadosPessoa.js";
88
+
89
+ import { mapMutations } from "vuex";
90
+
91
+ export default {
92
+ name: "DadosPessoa",
93
+ props: {
94
+ formNome: String,
95
+ value: Object,
96
+ },
97
+ components: { Opcoes, Texto, Botao },
98
+
99
+ data() {
100
+ return {
101
+ dadosPessoa: new DadosPessoa(),
102
+ };
103
+ },
104
+ methods: {
105
+ ...mapMutations("generic", ["insereEvento", "insereNotificacao", "removeCarregando"]),
106
+ buscarCnpjReceita() {
107
+ let url = `https://ws.hubdodesenvolvedor.com.br/v2/cnpj/?cnpj=${this.dadosPessoa.cnpjCpf}&token=94473735FzLqpNKajP170569464`;
108
+ this.$http.post(url, {}, {}).then((response) => {
109
+ if (response.data.return == "OK") {
110
+ this.insereEvento({
111
+ nome: "buscarCnpjReceita",
112
+ dados: response.data.result,
113
+ });
114
+ this.dadosPessoa.razaoSocialNome = response.data.result.nome;
115
+ this.dadosPessoa.fantasiaApelido = response.data.result.fantasia;
116
+ } else {
117
+ this.insereNotificacao([{ mensagem: "CNPJ inválido ou não encontrado." }]);
118
+ }
119
+ this.removeCarregando(["buscarCnpjReceita"]);
120
+ });
121
+ },
122
+ },
123
+ watch: {
124
+ value: {
125
+ handler() {
126
+ this.dadosPessoa = this.value;
127
+ },
128
+ deep: true,
129
+ },
130
+ dadosPessoa: {
131
+ handler() {
132
+ this.$emit("input", this.dadosPessoa);
133
+ },
134
+ deep: true,
135
+ },
136
+ },
137
+ };
138
+ </script>
@@ -0,0 +1,11 @@
1
+ export default class Endereco {
2
+ constructor() {
3
+ this.cep = "";
4
+ this.logradouro = "";
5
+ this.numero = "";
6
+ this.complemento = "";
7
+ this.bairro = "";
8
+ this.cidade = "";
9
+ this.estado = { id: "", conteudo: "" };
10
+ }
11
+ }
@@ -0,0 +1,183 @@
1
+ <template>
2
+ <div>
3
+ <b-row>
4
+ <b-col xs="12" sm="12" md="12" lg="3" xl="3">
5
+ <Texto
6
+ titulo="CEP"
7
+ campo="cep"
8
+ :formNome="formNome"
9
+ :mascara="'#####-###'"
10
+ :tamanhoMaximo="9"
11
+ v-model="endereco.cep"
12
+ >
13
+ <div class="glyphicon margem-botao">
14
+ <Botao
15
+ chave="buscarCep"
16
+ tipo="sucesso"
17
+ classeIcone="fas fa-search"
18
+ tamanho="pequeno"
19
+ :desabilitado="endereco.cep.length < 9"
20
+ :clique="buscarCep"
21
+ /></div
22
+ ></Texto>
23
+ </b-col>
24
+ <b-col xs="12" sm="12" md="12" lg="5" xl="5">
25
+ <Texto
26
+ titulo="Endereço"
27
+ campo="logradouro"
28
+ :formNome="formNome"
29
+ :tamanhoMaximo="150"
30
+ v-model="endereco.logradouro"
31
+ />
32
+ </b-col>
33
+ <b-col xs="12" sm="12" md="12" lg="2" xl="2">
34
+ <Texto
35
+ titulo="Número"
36
+ campo="numero"
37
+ :formNome="formNome"
38
+ :tamanhoMaximo="20"
39
+ v-model="endereco.numero"
40
+ />
41
+ </b-col>
42
+ <b-col xs="12" sm="12" md="12" lg="2" xl="2">
43
+ <Texto
44
+ titulo="Complemento"
45
+ campo="complemento"
46
+ :formNome="formNome"
47
+ :tamanhoMaximo="50"
48
+ v-model="endereco.complemento"
49
+ />
50
+ </b-col>
51
+ <br />
52
+ </b-row>
53
+ <b-row>
54
+ <b-col xs="12" sm="12" md="12" lg="5" xl="5">
55
+ <Texto
56
+ titulo="Bairro"
57
+ campo="bairro"
58
+ :formNome="formNome"
59
+ :tamanhoMaximo="100"
60
+ v-model="endereco.bairro"
61
+ /> </b-col
62
+ ><b-col xs="12" sm="12" md="12" lg="5" xl="5">
63
+ <Texto
64
+ titulo="Cidade"
65
+ campo="cidade"
66
+ :formNome="formNome"
67
+ :tamanhoMaximo="100"
68
+ v-model="endereco.cidade"
69
+ />
70
+ </b-col>
71
+ <b-col xs="12" sm="12" md="12" lg="2" xl="2">
72
+ <EscolherEstatico
73
+ titulo="UF"
74
+ campoAlvo="uf"
75
+ v-model="endereco.estado"
76
+ :dados="estados"
77
+ /> </b-col
78
+ ></b-row>
79
+ </div>
80
+ </template>
81
+
82
+ <script>
83
+ import Botao from "@nixweb/nixloc-ui/src/component/forms/Botao";
84
+ import Texto from "@nixweb/nixloc-ui/src/component/forms/Texto";
85
+ import Opcoes from "@nixweb/nixloc-ui/src/component/forms/Opcoes";
86
+ import EscolherEstatico from "@nixweb/nixloc-ui/src/component/forms/EscolherEstatico";
87
+
88
+ import Endereco from "@nixweb/nixloc-ui/src/component/value-objects/Endereco.js";
89
+
90
+ import { mapGetters, mapMutations } from "vuex";
91
+
92
+ export default {
93
+ name: "Endereco",
94
+ props: {
95
+ formNome: String,
96
+ value: Object,
97
+ },
98
+ components: { Opcoes, Texto, Botao, EscolherEstatico },
99
+
100
+ data() {
101
+ return {
102
+ endereco: new Endereco(),
103
+ estados: [
104
+ { titulo: "AC", valor: "AC" },
105
+ { titulo: "AL", valor: "AL" },
106
+ { titulo: "AP", valor: "AP" },
107
+ { titulo: "AM", valor: "AM" },
108
+ { titulo: "BA", valor: "BA" },
109
+ { titulo: "CE", valor: "CE" },
110
+ { titulo: "DF", valor: "DF" },
111
+ { titulo: "ES", valor: "ES" },
112
+ { titulo: "GO", valor: "GO" },
113
+ { titulo: "MA", valor: "MA" },
114
+ { titulo: "MT", valor: "MT" },
115
+ { titulo: "MS", valor: "MS" },
116
+ { titulo: "MG", valor: "MG" },
117
+ { titulo: "PA", valor: "PA" },
118
+ { titulo: "PB", valor: "PB" },
119
+ { titulo: "PR", valor: "PR" },
120
+ { titulo: "PE", valor: "PE" },
121
+ { titulo: "PI", valor: "PI" },
122
+ { titulo: "RJ", valor: "RJ" },
123
+ { titulo: "RN", valor: "RN" },
124
+ { titulo: "RS", valor: "RS" },
125
+ { titulo: "RO", valor: "RO" },
126
+ { titulo: "RR", valor: "RR" },
127
+ { titulo: "SC", valor: "SC" },
128
+ { titulo: "SP", valor: "SP" },
129
+ { titulo: "SE", valor: "SE" },
130
+ { titulo: "TO", valor: "TO" },
131
+ ],
132
+ };
133
+ },
134
+ computed: {
135
+ ...mapGetters("generic", ["evento"]),
136
+ },
137
+ methods: {
138
+ ...mapMutations("generic", ["insereEvento", "insereNotificacao", "removeCarregando"]),
139
+ buscarCep() {
140
+ let cep = this.endereco.cep.replace(/\.|\-/g, "");
141
+ let url = `https://viacep.com.br/ws/${cep}/json/`;
142
+ this.$http.get(url).then((response) => {
143
+ let self = this;
144
+ setTimeout(function () {
145
+ self.carregaDados(response.data);
146
+ self.removeCarregando(["buscarCep"]);
147
+ }, 300);
148
+ });
149
+ },
150
+ carregaDados(dados) {
151
+ this.endereco.cep = dados.cep;
152
+ this.endereco.logradouro = dados.logradouro;
153
+ this.endereco.numero = dados.complemento;
154
+ this.endereco.bairro = dados.bairro;
155
+ this.endereco.cidade =
156
+ dados.localidade == undefined ? dados.municipio : dados.localidade;
157
+ this.endereco.estado = { id: dados.uf, conteudo: dados.uf };
158
+ },
159
+ },
160
+ watch: {
161
+ value: {
162
+ handler() {
163
+ this.endereco = this.value;
164
+ },
165
+ deep: true,
166
+ },
167
+ endereco: {
168
+ handler() {
169
+ this.$emit("input", this.endereco);
170
+ },
171
+ deep: true,
172
+ },
173
+ evento: {
174
+ handler(evento) {
175
+ if (evento.nome == "buscarCnpjReceita") {
176
+ this.carregaDados(evento.dados);
177
+ }
178
+ },
179
+ deep: true,
180
+ },
181
+ },
182
+ };
183
+ </script>
@@ -7,7 +7,7 @@ export default {
7
7
  namespaced: true,
8
8
  state: {
9
9
  menu: {
10
- escondeMostra: false, itens: []
10
+ itens: []
11
11
  },
12
12
  modal: {
13
13
  nome: undefined,
@@ -77,9 +77,6 @@ export default {
77
77
  removeItensMenu: (state) => {
78
78
  state.menu.itens = [];
79
79
  },
80
- escondeMostraMenu: (state, escondeMostra) => {
81
- state.menu.escondeMostra = escondeMostra;
82
- },
83
80
  abrirModal: (state, nome) => {
84
81
  state.modal.nome = nome;
85
82
  state.modal.abrir = true;
@@ -176,14 +173,17 @@ export default {
176
173
  .then((response) => {
177
174
  if (response.data.sucesso) {
178
175
  context.commit('insereMetodoExecutadoApi', params.MetodoExecutadoApi);
179
- context.commit('insereToast', 'adicionarApiSucesso');
176
+
177
+ if (!params.naoNotificarToast)
178
+ context.commit('insereToast', 'postApi');
179
+
180
180
  context.commit('removeNotificacao');
181
181
  context.commit('validation/removeFormSujo', null, { root: true });
182
182
  return response.data;
183
183
  } else {
184
184
 
185
185
  context.commit('insereNotificacao', response.data.notificacoes)
186
- context.commit('insereToast', 'falhaGenerica');
186
+ context.commit('insereToast', 'postApiErro');
187
187
  return response.data;
188
188
  }
189
189
  }, (err) => {
@@ -199,12 +199,15 @@ export default {
199
199
  .then((response) => {
200
200
  if (response.data.sucesso) {
201
201
  context.commit('insereMetodoExecutadoApi', params.MetodoExecutadoApi);
202
- context.commit('insereToast', 'modificarApiSucesso');
202
+
203
+ if (!params.naoNotificarToast)
204
+ context.commit('insereToast', 'putApi');
205
+
203
206
  context.commit('removeNotificacao');
204
207
  context.commit('validation/removeFormSujo', null, { root: true });
205
208
  return response.data;
206
209
  } else {
207
- context.commit('insereToast', 'modificarApiErro');
210
+ context.commit('insereToast', 'putApiErro');
208
211
  context.commit('insereNotificacao', response.data.notificacoes)
209
212
  return response.data;
210
213
  }