@nixweb/nixloc-ui 0.0.172 → 0.0.174

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.172",
3
+ "version": "0.0.174",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -6,32 +6,15 @@
6
6
  <Tip :field="field" :formName="formName" />
7
7
  </label>
8
8
  <div class="inner-addon right-addon">
9
- <i
10
- v-if="notifications.length > 0 && formDirty"
11
- class="required glyphicon fas fa-exclamation-triangle"
12
- ></i>
13
- <date-picker
14
- lang="pt-br"
15
- :range="range"
16
- @confirm="executeConfirm"
17
- @change="executeConfirm"
18
- @clear="close"
19
- :confirm="confirm"
20
- :confirm-text="confirmText"
21
- :format="format"
22
- value-type="format"
23
- :time-picker-options="{
9
+ <i v-if="notifications.length > 0 && formDirty" class="required glyphicon fas fa-exclamation-triangle"></i>
10
+ <date-picker lang="pt-br" :range="range" @confirm="executeConfirm" @change="executeConfirm" @clear="close"
11
+ :confirm="confirm" :confirm-text="confirmText" :format="format" value-type="format" :time-picker-options="{
24
12
  start: '07:00',
25
13
  step: '00:30',
26
14
  end: '23:30',
27
15
  format: 'HH:mm',
28
- }"
29
- width="100%"
30
- :placeholder="placeholder"
31
- :type="type"
32
- v-model="valueLocal"
33
- :class="{ 'is-invalid': notifications.length > 0 && formDirty }"
34
- ></date-picker>
16
+ }" width="100%" :placeholder="placeholder" :type="type" v-model="valueLocal"
17
+ :class="{ 'is-invalid': notifications.length > 0 && formDirty }"></date-picker>
35
18
  </div>
36
19
 
37
20
  <div v-if="formDirty">
@@ -100,7 +83,7 @@ export default {
100
83
  if (this.range) {
101
84
  let obj = {
102
85
  fieldTarget: this.fieldTarget,
103
- valueLocal: { start: this.valueLocal[0], end: this.valueLocal[1] },
86
+ value: { start: this.valueLocal[0], end: this.valueLocal[1] },
104
87
  };
105
88
  this.addFilter(obj);
106
89
  }
@@ -108,7 +91,7 @@ export default {
108
91
  close() {
109
92
  let obj = {
110
93
  fieldTarget: this.fieldTarget,
111
- valueLocal: { start: "", end: "" },
94
+ value: { start: "", end: "" },
112
95
  };
113
96
  this.addFilter(obj);
114
97
  },
@@ -162,10 +145,12 @@ export default {
162
145
  color: #0a0a0a;
163
146
  letter-spacing: 0.5px !important;
164
147
  }
148
+
165
149
  .success {
166
150
  color: #94aa2a;
167
151
  font-size: 14px;
168
152
  }
153
+
169
154
  .invalid {
170
155
  color: #f0134d;
171
156
  font-size: 14px;
@@ -1,21 +1,17 @@
1
1
  <template>
2
2
  <div>
3
+ <label v-if="title">
4
+ <span class="title">{{ title }} </span>
5
+ </label>
3
6
  <div class="wrapper">
4
- <span class="minus" @click="decrement">-</span>
5
- <span class="num" @click="showEdit = true" v-if="!showEdit">{{
6
- number
7
- }}</span>
8
- <input
9
- class="input"
10
- type="number"
11
- @keyup.enter.prevent="showEdit = false"
12
- v-model="number"
13
- v-if="showEdit"
14
- />
15
- <span @click="showEdit = false" v-if="showEdit"
16
- ><i class="fa-solid fa-check"></i
17
- ></span>
18
- <span class="plus" @click="increment">+</span>
7
+ <span :class="{ disabled: disabled }" class="minus" @click="decrement">-</span>
8
+ <span :class="{ disabled: disabled }" class="num" @click="showEdit = true" v-if="!showEdit">{{ number }}</span>
9
+ <input v-if="showEdit" class="input" type="number" @keyup.enter.prevent="showEdit = false" :disabled="disabled"
10
+ v-model="number" />
11
+ <span v-if="showEdit" :class="{ disabled: disabled }" @click="showEdit = false">
12
+ <i class="fa-solid fa-check"></i>
13
+ </span>
14
+ <span :class="{ disabled: disabled }" class="plus" @click="increment">+</span>
19
15
  </div>
20
16
  </div>
21
17
  </template>
@@ -25,7 +21,16 @@ import { mapMutations } from "vuex";
25
21
 
26
22
  export default {
27
23
  name: "IncrementDecrement",
28
- props: ["value", "triggerEvent", "min", "max"],
24
+ props: [
25
+ "title",
26
+ "initialValue",
27
+ "value",
28
+ "disabled",
29
+ "fieldTarget",
30
+ "triggerEvent",
31
+ "min",
32
+ "max",
33
+ ],
29
34
  data() {
30
35
  return {
31
36
  number: 1,
@@ -36,12 +41,24 @@ export default {
36
41
  this.number = this.value;
37
42
  },
38
43
  methods: {
39
- ...mapMutations("generic", ["addEvent"]),
44
+ ...mapMutations("generic", ["addFilter", "addEvent"]),
40
45
  increment() {
41
- this.number++;
46
+ if (!this.disabled) {
47
+ this.number++;
48
+ this.executeFilter();
49
+ }
42
50
  },
43
51
  decrement() {
44
- this.number--;
52
+ if (!this.disabled) {
53
+ this.number--;
54
+ this.executeFilter();
55
+ }
56
+ },
57
+ executeFilter() {
58
+ if (this.fieldTarget) {
59
+ let obj = { fieldTarget: this.fieldTarget, value: this.number };
60
+ this.addFilter(obj);
61
+ }
45
62
  },
46
63
  },
47
64
  watch: {
@@ -89,6 +106,7 @@ export default {
89
106
  border: 1px solid #eaedf3;
90
107
  box-shadow: 0px 10px 20px -6px rgb(0 0 0 / 3%);
91
108
  }
109
+
92
110
  .wrapper span {
93
111
  width: 100%;
94
112
  text-align: center;
@@ -97,6 +115,7 @@ export default {
97
115
  cursor: pointer;
98
116
  user-select: none;
99
117
  }
118
+
100
119
  .wrapper span.num {
101
120
  font-size: 17px;
102
121
  border-right: 1px solid #eaedf3;
@@ -112,4 +131,9 @@ export default {
112
131
  text-decoration: underline;
113
132
  transition: 0.1s;
114
133
  }
134
+
135
+ .disabled {
136
+ color: grey;
137
+ opacity: 0.5;
138
+ }
115
139
  </style>
@@ -3,12 +3,8 @@
3
3
  <span class="title">{{ title }}</span>
4
4
  <div class="options">
5
5
  <b-form-group>
6
- <b-form-radio-group
7
- v-model="selected"
8
- :options="options"
9
- :disabled="disabled"
10
- :stacked="stacked"
11
- ></b-form-radio-group>
6
+ <b-form-radio-group v-model="selected" :options="options" :disabled="disabled"
7
+ :stacked="stacked"></b-form-radio-group>
12
8
  </b-form-group>
13
9
  </div>
14
10
  </div>
@@ -17,7 +13,7 @@
17
13
  <script>
18
14
  import Tip from "../shared/Tip.vue";
19
15
 
20
- import { mapMutations } from "vuex";
16
+ import { mapMutations, mapGetters } from "vuex";
21
17
 
22
18
  export default {
23
19
  components: { Tip },
@@ -25,6 +21,7 @@ export default {
25
21
  props: {
26
22
  title: String,
27
23
  options: Array,
24
+ fieldTarget: String,
28
25
  disabled: Boolean,
29
26
  stacked: Boolean,
30
27
  markFormDirty: {
@@ -38,8 +35,12 @@ export default {
38
35
  selected: this.value,
39
36
  };
40
37
  },
38
+ computed: {
39
+ ...mapGetters("generic", ["event"]),
40
+ },
41
41
  methods: {
42
42
  ...mapMutations("validation", ["updateFormDirty"]),
43
+ ...mapMutations("generic", ["addFilter"]),
43
44
  },
44
45
  watch: {
45
46
  value() {
@@ -47,8 +48,22 @@ export default {
47
48
  },
48
49
  selected() {
49
50
  this.$emit("input", this.selected);
51
+
50
52
  if (this.markFormDirty) this.updateFormDirty(true);
51
53
  if (this.changed) this.changed();
54
+ if (this.fieldTarget) {
55
+ let obj = { tag: `${this.title}: ${this.selected}`, fieldTarget: this.fieldTarget, value: this.selected };
56
+ this.addFilter(obj);
57
+ }
58
+ },
59
+ event: {
60
+ handler(event) {
61
+ if (event.name == "tagRemoved") {
62
+ if (this.fieldTarget == event.data)
63
+ this.$emit("input", "");
64
+ }
65
+ },
66
+ deep: true,
52
67
  },
53
68
  },
54
69
  };
@@ -60,6 +75,7 @@ export default {
60
75
  text-transform: uppercase;
61
76
  color: #778498;
62
77
  }
78
+
63
79
  .options {
64
80
  margin-top: 5px;
65
81
  }
@@ -5,68 +5,27 @@
5
5
  <span class="required" v-if="required">*</span>
6
6
  <Tip :field="field" :formName="formName" />
7
7
  </label>
8
- <div
9
- class="select"
10
- :class="{
11
- 'select-invalid': notifications.length > 0 && formDirty,
12
- border: showBorder,
13
- }"
14
- >
15
- <multiselect
16
- @open="onOpen"
17
- @select="onSelected"
18
- @search-change="onSearch"
19
- :options="data"
20
- v-model.trim="currentValue"
21
- :custom-label="label"
22
- placeholder
23
- :disabled="disabled"
24
- :showLabels="true"
25
- :noResult="false"
26
- :maxHeight="250"
27
- ref="multiselect"
28
- selectLabel
29
- deselectLabel
30
- selectedLabel
31
- >
8
+ <div class="select" :class="{
9
+ 'select-invalid': notifications.length > 0 && formDirty,
10
+ border: showBorder,
11
+ }">
12
+ <multiselect @open="onOpen" @select="onSelected" @search-change="onSearch" :options="data"
13
+ v-model.trim="currentValue" :custom-label="label" placeholder :disabled="disabled" :showLabels="true"
14
+ :noResult="false" :maxHeight="250" ref="multiselect" selectLabel deselectLabel selectedLabel>
32
15
  <div slot="beforeList">
33
- <vue-loading
34
- v-if="loading"
35
- type="bubbles"
36
- color="#577696"
37
- :size="{ width: '40px', height: '40px' }"
38
- ></vue-loading>
16
+ <vue-loading v-if="loading" type="bubbles" color="#577696"
17
+ :size="{ width: '40px', height: '40px' }"></vue-loading>
39
18
  <div class="before-list" v-if="!loading">
40
- <Button
41
- v-if="showNewRegister"
42
- key="addNewRegister"
43
- type="primary"
44
- title="Novo"
45
- size="small"
46
- :clicked="addNewRegister"
47
- />
48
- <Button
49
- key="cleanSelect"
50
- type="warning"
51
- classIcon="fas fa-broom"
52
- size="small"
53
- :clicked="cleanSelect"
54
- />
19
+ <Button v-if="showNewRegister" key="addNewRegister" type="primary" title="Novo" size="small"
20
+ :clicked="addNewRegister" />
21
+ <Button key="cleanSelect" title="Limpar" type="warning" classIcon="fas fa-broom" size="small"
22
+ :clicked="cleanSelect" />
55
23
  </div>
56
24
  </div>
57
- <div
58
- slot="afterList"
59
- v-if="totalRecords > 20 && data.length < totalRecords"
60
- >
25
+ <div slot="afterList" v-if="totalRecords > 20 && data.length < totalRecords">
61
26
  <div class="after-list text-center">
62
- <Button
63
- key="loadingMore"
64
- type="info"
65
- title="Carregar mais..."
66
- classIcon="fas fa-redo-alt"
67
- size="small"
68
- :clicked="loadingMore"
69
- />
27
+ <Button key="loadingMore" type="info" title="Carregar mais..." classIcon="fas fa-redo-alt" size="small"
28
+ :clicked="loadingMore" />
70
29
  </div>
71
30
  </div>
72
31
  <div slot="noOptions">Lista está vazia</div>
@@ -79,16 +38,8 @@
79
38
  </div>
80
39
  </div>
81
40
 
82
- <vodal
83
- v-if="nameNewRegister"
84
- :duration="50"
85
- :show="showVodal(nameNewRegister)"
86
- @hide="hide()"
87
- :width="widthNewRegister"
88
- :height="heightNewRegister"
89
- :closeOnEsc="true"
90
- :closeButton="true"
91
- >
41
+ <vodal v-if="nameNewRegister" :duration="50" :show="showVodal(nameNewRegister)" @hide="hide()"
42
+ :width="widthNewRegister" :height="heightNewRegister" :closeOnEsc="true" :closeButton="true">
92
43
  <Messages v-if="vodal.open" />
93
44
  <div class="title-new-form">{{ titleNewRegister }}</div>
94
45
  <hr class="hr" />
@@ -176,7 +127,7 @@ export default {
176
127
  computed: {
177
128
  ...mapState("validation", ["resetForm", "vodal"]),
178
129
  ...mapState("generic", ["vodal"]),
179
- ...mapGetters("generic", ["showVodal"]),
130
+ ...mapGetters("generic", ["showVodal", "event"]),
180
131
  },
181
132
  methods: {
182
133
  ...mapActions("generic", ["getApi"]),
@@ -200,7 +151,7 @@ export default {
200
151
  this.$emit("input", value);
201
152
  if (this.changed) this.changed();
202
153
  if (this.fieldTarget) {
203
- let obj = { fieldTarget: this.fieldTarget, value: value.id };
154
+ let obj = { tag: `${this.title}: ${value.content}`, fieldTarget: this.fieldTarget, value: value.id };
204
155
  this.addFilter(obj);
205
156
  }
206
157
  },
@@ -267,6 +218,16 @@ export default {
267
218
  },
268
219
  },
269
220
  watch: {
221
+ event: {
222
+ handler(event) {
223
+
224
+ if (event.name == "tagRemoved") {
225
+ if (this.fieldTarget == event.data) this.cleanSelect();
226
+ }
227
+
228
+ },
229
+ deep: true,
230
+ },
270
231
  "value.id": function () {
271
232
  this.validate();
272
233
  this.formDirty = true;
@@ -1,25 +1,13 @@
1
1
  <template>
2
2
  <div>
3
3
  <label>
4
- <span class="title">{{ title }}</span>
4
+ <span class="title">{{ title }} </span>
5
+ <span class="required" v-if="required">*</span>
5
6
  </label>
6
7
  <div class="select" :class="{ border: showBorder }">
7
- <multiselect
8
- @open="onOpen"
9
- @select="onSelected"
10
- @search-change="onSearch"
11
- :options="data"
12
- v-model.trim="currentValue"
13
- :custom-label="label"
14
- :disabled="disabled"
15
- placeholder
16
- :showLabels="true"
17
- :noResult="false"
18
- ref="multiselect"
19
- selectLabel
20
- deselectLabel
21
- selectedLabel
22
- >
8
+ <multiselect @open="onOpen" @select="onSelected" @search-change="onSearch" :options="data"
9
+ v-model.trim="currentValue" :custom-label="label" :disabled="disabled" placeholder :showLabels="true"
10
+ :noResult="false" ref="multiselect" selectLabel deselectLabel selectedLabel>
23
11
  </multiselect>
24
12
  </div>
25
13
  </div>
@@ -35,7 +23,9 @@ export default {
35
23
  props: {
36
24
  title: String,
37
25
  formName: String,
26
+ field: String,
38
27
  fieldTarget: String,
28
+ required: Boolean,
39
29
  initialValue: Object,
40
30
  disabled: {
41
31
  type: Boolean,
@@ -63,8 +53,12 @@ export default {
63
53
  data() {
64
54
  return {
65
55
  currentValue: this.initialValue,
56
+ notifications: [],
66
57
  };
67
58
  },
59
+ created() {
60
+ this.validate();
61
+ },
68
62
  mounted() {
69
63
  let el = this.$el.getElementsByClassName("multiselect")[0];
70
64
  if (el) {
@@ -73,16 +67,20 @@ export default {
73
67
  },
74
68
  methods: {
75
69
  ...mapMutations("generic", ["addFilter", "removeLoading"]),
76
- ...mapMutations("validation", ["updateFormDirty"]),
77
- onOpen() {},
70
+ ...mapMutations("validation", [
71
+ "addValidation",
72
+ "removeValidation",
73
+ "resetValidation",
74
+ "updateFormDirty",
75
+ ]),
76
+ onOpen() { },
78
77
  onSelected(value) {
79
78
  this.$emit("input", value);
80
79
  let obj = { fieldTarget: this.fieldTarget, value: value.id };
81
80
  if (!this.onlyQuery) this.addFilter(obj);
82
-
83
81
  if (this.markFormDirty) this.updateFormDirty(true);
84
82
  },
85
- onSearch(value) {},
83
+ onSearch(value) { },
86
84
  label(value) {
87
85
  return `${value.content}`;
88
86
  },
@@ -98,11 +96,40 @@ export default {
98
96
  this.addFilter(obj);
99
97
  }
100
98
  },
99
+ validate() {
100
+ this.notifications = [];
101
+ if (this.required && !this.value.id) {
102
+ var message = `${this.title} não pode ser vazio!`;
103
+ this.notifications.push(message);
104
+ }
105
+ },
101
106
  },
102
107
  watch: {
103
108
  "value.id": function () {
109
+ this.validate();
110
+ this.formDirty = true;
111
+ if (this.markFormDirty) this.updateFormDirty(true);
104
112
  this.currentValue = { id: this.value.id, content: this.value.content };
105
113
  },
114
+ notifications() {
115
+ let self = this;
116
+ this.notifications.forEach(function (notification) {
117
+ let obj = {
118
+ key: self.field + "&" + self.formName,
119
+ formName: self.formName,
120
+ notification: notification,
121
+ };
122
+ self.addValidation(obj);
123
+ });
124
+
125
+ if (this.notifications.length == 0) {
126
+ let obj = {
127
+ key: self.field + "&" + self.formName,
128
+ formName: self.formName,
129
+ };
130
+ self.removeValidation(obj);
131
+ }
132
+ },
106
133
  "initialValue.id": function () {
107
134
  this.currentValue = { id: this.value.id, content: this.value.content };
108
135
  },
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <div class="div-tag">
3
3
  <div class="tag">
4
- <span @click="execute()">{{ title }}: {{ value }}</span>
5
- <i @click="remove()" class="icon fas fa-times-circle"></i>
4
+ <span @click="execute()">{{ title }} <span v-if="value">:</span> {{ value }}</span>
5
+ <i v-if="showButtonClose" @click="remove()" class="icon-tag fas fa-times-circle"></i>
6
6
  </div>
7
7
  </div>
8
8
  </template>
@@ -13,10 +13,15 @@ import { mapMutations } from "vuex";
13
13
  export default {
14
14
  name: "Tag",
15
15
  props: {
16
+ _key: String,
16
17
  title: String,
17
18
  value: String,
18
19
  eventName: String,
19
20
  eventData: Object,
21
+ showButtonClose: {
22
+ type: Boolean,
23
+ default: true
24
+ }
20
25
  },
21
26
  methods: {
22
27
  ...mapMutations("generic", ["addEvent"]),
@@ -30,7 +35,7 @@ export default {
30
35
  remove() {
31
36
  this.addEvent({
32
37
  name: "tagRemoved",
33
- data: this.eventData,
38
+ data: this.eventData ? this.eventData : this._key,
34
39
  });
35
40
  },
36
41
  },
@@ -59,8 +64,9 @@ export default {
59
64
  margin-right: 10px;
60
65
  }
61
66
 
62
- .icon {
67
+ .icon-tag {
63
68
  color: #9e9e9e;
64
69
  padding-left: 5px;
70
+ font-size: 20px;
65
71
  }
66
72
  </style>
@@ -1,34 +1,25 @@
1
1
  <template>
2
2
  <div class="filter-horizontal">
3
- <Collapse
4
- :buttonShow="{
5
- title: 'Mais filtros',
6
- icon: 'fas fa-arrow-alt-circle-down',
7
- type: 'info',
8
- }"
9
- :buttonHide="{
10
- title: 'Menos filtros',
11
- icon: 'fas fa-arrow-alt-circle-up',
12
- type: 'warning',
13
- }"
14
- >
3
+ <Collapse :buttonShow="{
4
+ title: 'Mais filtros',
5
+ icon: 'fas fa-arrow-alt-circle-down',
6
+ type: 'info',
7
+ }" :buttonHide="{
8
+ title: 'Menos filtros',
9
+ icon: 'fas fa-arrow-alt-circle-up',
10
+ type: 'warning',
11
+ }">
12
+ <slot name="content-filter-horizontal"></slot>
15
13
  <b-row>
16
- <b-col :sm="showTotalPerPage ? 10 : 12">
17
- <slot name="content-filter-horizontal"></slot>
18
- </b-col>
14
+ <b-col :sm="showTotalPerPage ? 10 : 12"></b-col>
19
15
  <b-col xs="12" sm="12" md="12" lg="2" xl="2" v-if="showTotalPerPage">
20
- <SelectStatic
21
- title="Mostrar"
22
- fieldTarget="totalPerPage"
23
- :initialValue="{ content: '10', id: 10 }"
24
- :data="[
25
- { content: '10', id: 10 },
26
- { content: '20', id: 20 },
27
- { content: '30', id: 30 },
28
- { content: '50', id: 50 },
29
- { content: '100', id: 100 },
30
- ]"
31
- />
16
+ <SelectStatic title="Mostrar" fieldTarget="totalPerPage" :initialValue="{ content: '10', id: 10 }" :data="[
17
+ { content: '10', id: 10 },
18
+ { content: '20', id: 20 },
19
+ { content: '30', id: 30 },
20
+ { content: '50', id: 50 },
21
+ { content: '100', id: 100 },
22
+ ]" />
32
23
  </b-col>
33
24
  </b-row>
34
25
  </Collapse>
@@ -4,44 +4,25 @@
4
4
  {{ title }}
5
5
  </div>
6
6
  <div class="alignment" v-for="option in options">
7
- <div
8
- class="option"
9
- :style="'width:' + width + 'px; height:' + height + 'px'"
10
- :class="{ selected: option.value == selected }"
11
- @click="optionSelected(option.value)"
12
- >
13
- <div class="div-content text-center">
14
- <span :style="'font-size:' + option.titleSize + 'px;'">
7
+ <div class="option" :style="'width:' + width + 'px; height:' + height + 'px'"
8
+ :class="{ selected: option.value == selected }" @click="optionSelected(option.value)">
9
+ <div class="text-center">
10
+ <span :class="{ disabled: disabled }" :style="'font-size:' + option.titleSize + 'px;'">
15
11
  <i v-if="size === 'small'" :class="option.icon"></i>
16
12
  {{ option.title }}
17
13
  </span>
18
- <div
19
- v-if="size === 'medium'"
20
- class="icon"
21
- :style="'font-size:' + option.iconSize + 'px;'"
22
- >
14
+ <div v-if="size === 'medium'" class="icon" :style="'font-size:' + option.iconSize + 'px;'">
23
15
  <i :class="option.icon"></i>
24
16
  </div>
25
17
  </div>
26
18
  <div v-if="option.tipId">
27
- <i
28
- v-b-tooltip.hover
29
- :title="tip(option.tipId)"
30
- class="fas fa-question-circle"
31
- ></i>
19
+ <i v-b-tooltip.hover :title="tip(option.tipId)" class="fas fa-question-circle"></i>
32
20
  </div>
33
21
  </div>
34
22
  </div>
35
23
  <div class="div-btn" v-if="showButtonNext">
36
- <Button
37
- _key="btnClickedNext"
38
- type="info"
39
- title="Avançar"
40
- :disabled="selected == null"
41
- :classIcon="buttonClassIcon"
42
- :size="buttonSize"
43
- :clicked="execute"
44
- />
24
+ <Button _key="btnClickedNext" type="info" title="Avançar" :disabled="selected == null" :classIcon="buttonClassIcon"
25
+ :size="buttonSize" :clicked="execute" />
45
26
  </div>
46
27
  </div>
47
28
  </template>
@@ -58,14 +39,17 @@ export default {
58
39
  props: {
59
40
  title: String,
60
41
  titleSize: Number,
42
+ fieldTarget: String,
61
43
  buttonSize: String,
62
44
  buttonClassIcon: String,
63
45
  showButtonNext: { type: Boolean, default: true },
64
46
  size: { type: String, default: "medium" },
65
47
  alignment: { type: String, default: "text-center" },
48
+ disabled: Boolean,
66
49
  width: Number,
67
50
  height: Number,
68
51
  options: Array,
52
+ initialValue: Number,
69
53
  value: Number,
70
54
  clickedNext: Function,
71
55
  },
@@ -74,11 +58,23 @@ export default {
74
58
  selected: null,
75
59
  };
76
60
  },
61
+ created() {
62
+ this.selected = this.initialValue;
63
+ },
77
64
  methods: {
78
- ...mapMutations("generic", ["removeLoading"]),
65
+ ...mapMutations("generic", ["addFilter", "removeLoading"]),
79
66
  optionSelected(value) {
80
- this.selected = value;
81
- this.$emit("input", value);
67
+ if (!this.disabled) {
68
+ this.selected = value;
69
+ this.$emit("input", value);
70
+ this.executeFilter(value);
71
+ }
72
+ },
73
+ executeFilter(value) {
74
+ if (this.fieldTarget) {
75
+ let obj = { fieldTarget: this.fieldTarget, value: value };
76
+ this.addFilter(obj);
77
+ }
82
78
  },
83
79
  execute() {
84
80
  let self = this;
@@ -96,7 +92,7 @@ export default {
96
92
  <style scoped>
97
93
  .div-main {
98
94
  margin: auto;
99
- padding: 10px;
95
+ padding: 0px;
100
96
  }
101
97
 
102
98
  .option {
@@ -110,6 +106,9 @@ export default {
110
106
  margin-bottom: 10px;
111
107
  font-size: 16px;
112
108
  font-weight: normal;
109
+ display: flex;
110
+ align-items: center;
111
+ justify-content: center;
113
112
  box-shadow: 0px 10px 20px -6px rgb(0 0 0 / 2%);
114
113
  }
115
114
 
@@ -121,10 +120,6 @@ export default {
121
120
  background-color: white;
122
121
  }
123
122
 
124
- .div-content {
125
- padding: 10px;
126
- }
127
-
128
123
  .selected {
129
124
  background-color: white;
130
125
  border-color: #4680a5;
@@ -147,4 +142,9 @@ export default {
147
142
  .div-btn {
148
143
  margin-top: 10px;
149
144
  }
145
+
146
+ .disabled {
147
+ color: grey;
148
+ opacity: 0.5;
149
+ }
150
150
  </style>
@@ -25,24 +25,16 @@
25
25
  </b-row>
26
26
  <Loading type="line" :center="false" v-show="isLoading('loadingLine')" />
27
27
  <div class="fixed-bar-options" v-show="selected.length > 0">
28
- <div>
29
- <Button
30
- v-if="buttonRemove"
31
- key="remove"
32
- :title="`Remover ${selected.length}`"
33
- type="danger"
34
- size="small"
35
- :clicked="removeSelected"
36
- />
28
+ <div class="side-by-side">
29
+ <Button v-if="buttonRemove" key="remove" :title="`Remover ${selected.length}`" type="danger" size="small"
30
+ :clicked="confirmRemoved" />
31
+ </div>
32
+ <div class="side-by-side">
37
33
  <slot name="content-buttons-table-header"></slot>
38
34
  </div>
39
35
  </div>
40
- <Table
41
- :header="templateList.headerTable"
42
- :data="content.data"
43
- :showChecks="templateList.showChecks"
44
- :dragAndDrop="templateList.dragAndDrop"
45
- >
36
+ <Table :header="templateList.headerTable" :data="content.data" :showChecks="templateList.showChecks"
37
+ :dragAndDrop="templateList.dragAndDrop">
46
38
  <div slot="content-buttons-table">
47
39
  <slot name="content-buttons-table"></slot>
48
40
  </div>
@@ -50,6 +42,14 @@
50
42
  </div>
51
43
  <br />
52
44
  <Pagination _key="templateList" :totalRecords="content.totalRecords" />
45
+ <Modal title="Tem certeza que deseja remover?" :width="500" v-show="showModal('confirmRemoved')">
46
+ <Alert type="warning">
47
+ <span>
48
+ Atenção, todos os registros relacionados também serão excluídos/cancelados, esta ação é irreversível!
49
+ </span>
50
+ </Alert>
51
+ <Confirmation :isModal="false" title="Você tem certeza?" type="danger" :confirmed="removeSelected" />
52
+ </Modal>
53
53
  </div>
54
54
  </template>
55
55
 
@@ -62,6 +62,9 @@ import TableTotalRecords from "../shared/TableTotalRecords.vue";
62
62
  import TableTotalization from "../shared/TableTotalization.vue";
63
63
  import HorizontalFilter from "../shared/HorizontalFilter.vue";
64
64
  import Loading from "../shared/Loading.vue";
65
+ import Confirmation from "@nixweb/nixloc-ui/src/component/shared/Confirmation.vue";
66
+ import Alert from "@nixweb/nixloc-ui/src/component/layout/Alert";
67
+ import Modal from "@nixweb/nixloc-ui/src/component/forms/Modal";
65
68
 
66
69
  import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
67
70
 
@@ -87,6 +90,9 @@ export default {
87
90
  HorizontalFilter,
88
91
  TableTotalization,
89
92
  TableTotalRecords,
93
+ Confirmation,
94
+ Alert,
95
+ Modal,
90
96
  Loading,
91
97
  FixedBar,
92
98
  Button,
@@ -131,8 +137,9 @@ export default {
131
137
  "clearedSearch",
132
138
  "totalPerPage",
133
139
  "selectStatic",
140
+ "tags"
134
141
  ]),
135
- ...mapGetters("generic", ["pagination", "isLoading", "event"]),
142
+ ...mapGetters("generic", ["pagination", "isLoading", "event", "showModal"]),
136
143
  paginationKey: function () {
137
144
  return this.pagination("templateList");
138
145
  },
@@ -145,6 +152,10 @@ export default {
145
152
  "addSelected",
146
153
  "updatePagination",
147
154
  "updateSearch",
155
+ "addTag",
156
+ "removeTag",
157
+ "openModal",
158
+ "hideModal"
148
159
  ]),
149
160
  getAll() {
150
161
  let obj = {
@@ -171,16 +182,67 @@ export default {
171
182
  notNotifyToast: true,
172
183
  };
173
184
 
174
- this.orderAllApi(params).then((response) => {});
185
+ this.orderAllApi(params).then((response) => { });
175
186
  }
176
187
  },
188
+ selectFilter(value) {
189
+
190
+ let fieldTarget = value.fieldTarget;
191
+ let obj = { tag: value.tag, key: fieldTarget, value: value.value };
192
+
193
+ if (obj.value != "")
194
+ this.paramsFilter.push(obj);
195
+
196
+ this.convertToObjectAndGetAll();
197
+ },
198
+ convertToObjectAndGetAll() {
199
+ var result = {};
200
+ for (var i = 0; i < this.paramsFilter.length; i++) {
201
+ let key = this.paramsFilter[i].key;
202
+ let value = this.paramsFilter[i].value;
203
+ let tag = this.paramsFilter[i].tag;
204
+
205
+
206
+ if (key == "period") {
207
+ result["start"] = value.start;
208
+ result["end"] = value.end;
209
+
210
+ } else {
211
+ result[key] = value;
212
+ }
213
+
214
+ result["tag"] = tag;
215
+
216
+ if (tag) {
217
+ this.removeTag(key); // para não duplicar
218
+ this.addTag({ tag: tag, key: key });
219
+ } else {
220
+ this.removeTag(key);
221
+ }
222
+
223
+ }
224
+
225
+ this.dynamicFilter = result;
226
+
227
+ this.updatePagination({
228
+ key: "templateList",
229
+ totalPerPage: this.dynamicFilter.totalPerPage,
230
+ });
231
+
232
+ this.getAll();
233
+ },
234
+ confirmRemoved() {
235
+ this.removeLoading(["remove"]);
236
+ this.openModal("confirmRemoved");
237
+ },
177
238
  removeSelected() {
178
239
  let params = {
179
240
  url: this.templateList.urlDeleteAllApi,
180
241
  selected: this.selected,
181
242
  };
182
243
  this.deleteAllApi(params).then(() => {
183
- this.removeLoading(["remove"]);
244
+ this.hideModal("confirmRemoved");
245
+ this.removeLoading(["confirm"]);
184
246
  this.addSelected([]);
185
247
  });
186
248
  },
@@ -192,6 +254,15 @@ export default {
192
254
  event: {
193
255
  handler(event) {
194
256
  if (event.name == "tableDragAndDrop") this.orderAll(event.data);
257
+
258
+ if (event.name == "tagRemoved") {
259
+
260
+ this.removeTag(event.data);
261
+ let filter = this.paramsFilter.filter(x => x.key != event.data);
262
+ this.paramsFilter = filter;
263
+
264
+ this.convertToObjectAndGetAll();
265
+ }
195
266
  },
196
267
  deep: true,
197
268
  },
@@ -227,31 +298,7 @@ export default {
227
298
  },
228
299
  selectStatic: {
229
300
  handler(value) {
230
- let fieldTarget = value.fieldTarget;
231
- let obj = { key: fieldTarget, value: value.value };
232
- this.paramsFilter.push(obj);
233
-
234
- var result = {};
235
- for (var i = 0; i < this.paramsFilter.length; i++) {
236
- let key = this.paramsFilter[i].key;
237
- let value = this.paramsFilter[i].value;
238
-
239
- if (key == "period") {
240
- result["start"] = value.inicio;
241
- result["end"] = value.fim;
242
- } else {
243
- result[key] = value;
244
- }
245
- }
246
-
247
- this.dynamicFilter = result;
248
-
249
- this.updatePagination({
250
- key: "templateList",
251
- totalPerPage: this.dynamicFilter.totalPerPage,
252
- });
253
-
254
- this.getAll();
301
+ this.selectFilter(value);
255
302
  },
256
303
  deep: true,
257
304
  },
@@ -379,7 +379,7 @@ export default {
379
379
  : "$apply=";
380
380
  let baseUrl = `${
381
381
  this.templateList.urlGetApi
382
- }?${query}aggregate(${this.oDataFilter.totalization.replace(",", "")})/$count`;
382
+ }?${query}aggregate(${this.oDataFilter.totalization.replace(",", "")})`;
383
383
  return baseUrl;
384
384
  },
385
385
  liveTotalRecords() {
@@ -1,12 +1,7 @@
1
1
  <template>
2
2
  <div>
3
- <Panel
4
- :module="panel.module"
5
- :title="panel.title"
6
- :showVerticalFilter="panel.showVerticalFilter"
7
- :showSearch="panel.showSearch"
8
- :showButtons="panel.showButtons"
9
- >
3
+ <Panel :module="panel.module" :title="panel.title" :showVerticalFilter="panel.showVerticalFilter"
4
+ :showSearch="panel.showSearch" :showButtons="panel.showButtons">
10
5
  <div slot="content-filter-vertical">
11
6
  <slot name="content-filter-vertical"></slot>
12
7
  </div>
@@ -14,11 +9,14 @@
14
9
  <slot name="content-buttons"></slot>
15
10
  </div>
16
11
  <div slot="content-main">
12
+ <slot name="content-between-search-table"></slot>
13
+ <div class="div-tag">
14
+ <div class="side-by-side" v-for="tag in tags">
15
+ <Tag :_key="tag.key" :title="tag.tag" />
16
+ </div>
17
+ </div>
17
18
  <Molded>
18
- <ListViewWithDataHandler
19
- :templateList="templateList"
20
- :buttonRemove="buttonRemove"
21
- >
19
+ <ListViewWithDataHandler :templateList="templateList" :propsParam="propsParam" :buttonRemove="buttonRemove">
22
20
  <div slot="content-buttons-table-header">
23
21
  <slot name="content-buttons-table-header"></slot>
24
22
  </div>
@@ -38,19 +36,26 @@
38
36
  <script>
39
37
  import Panel from "@nixweb/nixloc-ui/src/component/layout/Panel.vue";
40
38
  import Molded from "@nixweb/nixloc-ui/src/component/layout/Molded";
39
+ import Tag from "@nixweb/nixloc-ui/src/component/layout/Tag.vue";
41
40
 
42
41
  import ListViewWithDataHandler from "@nixweb/nixloc-ui/src/component/template/ListViewWithDataHandler.vue";
43
42
 
43
+ import { mapState } from "vuex";
44
+
44
45
  export default {
45
46
  name: "TemplateView",
46
- components: { Panel, Molded, ListViewWithDataHandler },
47
+ components: { Panel, Molded, Tag, ListViewWithDataHandler },
47
48
  props: {
48
49
  panel: Object,
49
50
  templateList: Object,
51
+ propsParam: Object,
50
52
  buttonRemove: {
51
53
  type: Boolean,
52
54
  default: true,
53
55
  },
54
56
  },
57
+ computed: {
58
+ ...mapState("generic", ["tags"]),
59
+ },
55
60
  };
56
61
  </script>
@@ -2,92 +2,40 @@
2
2
  <div>
3
3
  <b-row>
4
4
  <b-col xs="12" sm="12" md="12" lg="3" xl="3">
5
- <InputText
6
- title="CEP"
7
- field="zipCode"
8
- :formName="formName"
9
- :mask="'#####-###'"
10
- :maxLength="9"
11
- :required="required"
12
- :markFormDirty="markFormDirty"
13
- v-model="address.zipCode"
14
- >
5
+ <InputText title="CEP" field="zipCode" :formName="formName" :mask="'#####-###'" :maxLength="9"
6
+ :required="required" :markFormDirty="markFormDirty" v-model="address.zipCode">
15
7
  <div class="glyphicon margin-button">
16
- <Button
17
- _key="searchZipCode"
18
- type="success"
19
- classIcon="fas fa-search"
20
- size="small"
21
- :disabled="address.zipCode.length < 9"
22
- :clicked="searchZipCode"
23
- /></div
24
- ></InputText>
8
+ <Button _key="searchZipCode" type="success" classIcon="fas fa-search" size="small"
9
+ :disabled="address.zipCode.length < 9" :clicked="searchZipCode" />
10
+ </div>
11
+ </InputText>
25
12
  </b-col>
26
13
  <b-col xs="12" sm="12" md="12" lg="5" xl="5">
27
- <InputText
28
- title="Endereço"
29
- field="street"
30
- :formName="formName"
31
- :maxLength="150"
32
- :required="required"
33
- :markFormDirty="markFormDirty"
34
- v-model="address.street"
35
- />
14
+ <InputText title="Endereço" field="street" :formName="formName" :maxLength="150" :required="required"
15
+ :markFormDirty="markFormDirty" v-model="address.street" />
36
16
  </b-col>
37
17
  <b-col xs="12" sm="12" md="12" lg="2" xl="2">
38
- <InputText
39
- title="Número"
40
- field="number"
41
- :formName="formName"
42
- :maxLength="20"
43
- :markFormDirty="markFormDirty"
44
- v-model="address.number"
45
- />
18
+ <InputText title="Número" field="number" :formName="formName" :maxLength="20" :markFormDirty="markFormDirty"
19
+ v-model="address.number" />
46
20
  </b-col>
47
21
  <b-col xs="12" sm="12" md="12" lg="2" xl="2">
48
- <InputText
49
- title="Complemento"
50
- field="complement"
51
- :formName="formName"
52
- :maxLength="50"
53
- :markFormDirty="markFormDirty"
54
- v-model="address.complement"
55
- />
22
+ <InputText title="Complemento" field="complement" :formName="formName" :maxLength="50"
23
+ :markFormDirty="markFormDirty" v-model="address.complement" />
56
24
  </b-col>
57
25
  <br />
58
26
  </b-row>
59
27
  <b-row>
60
28
  <b-col xs="12" sm="12" md="12" lg="5" xl="5">
61
- <InputText
62
- title="Bairro"
63
- field="province"
64
- :formName="formName"
65
- :maxLength="100"
66
- :required="required"
67
- :markFormDirty="markFormDirty"
68
- v-model="address.province"
69
- /> </b-col
70
- ><b-col xs="12" sm="12" md="12" lg="5" xl="5">
71
- <InputText
72
- title="Cidade"
73
- field="city"
74
- :formName="formName"
75
- :maxLength="100"
76
- :required="required"
77
- :markFormDirty="markFormDirty"
78
- v-model="address.city"
79
- />
29
+ <InputText title="Bairro" field="province" :formName="formName" :maxLength="100" :required="required"
30
+ :markFormDirty="markFormDirty" v-model="address.province" />
31
+ </b-col><b-col xs="12" sm="12" md="12" lg="5" xl="5">
32
+ <InputText title="Cidade" field="city" :formName="formName" :maxLength="100" :required="required"
33
+ :markFormDirty="markFormDirty" v-model="address.city" />
80
34
  </b-col>
81
35
  <b-col xs="12" sm="12" md="12" lg="2" xl="2">
82
- <SelectStatic
83
- title="UF"
84
- fieldTarget="uf"
85
- :required="required"
86
- :markFormDirty="markFormDirty"
87
- v-model="address.state"
88
- :data="states"
89
- /> </b-col
90
- ></b-row>
36
+ <SelectStatic title="UF" :formName="formName" field="uf" fieldTarget="uf" :required="required"
37
+ :markFormDirty="markFormDirty" v-model="address.state" :data="states" />
38
+ </b-col></b-row>
91
39
  </div>
92
40
  </template>
93
41
 
@@ -33,7 +33,8 @@ export default {
33
33
  ids: undefined,
34
34
  search: { content: "", filter: { content: "Contém", id: "contains" } },
35
35
  documentHtml: "",
36
- selectStatic: { dateTime: undefined, fieldTarget: undefined, value: undefined },
36
+ selectStatic: { dateTime: undefined, tag: undefined, fieldTarget: undefined, value: undefined },
37
+ tags: [],
37
38
  executedSearch: false,
38
39
  clearedSearch: false,
39
40
  methodExecutedApi: undefined,
@@ -308,9 +309,22 @@ export default {
308
309
  });
309
310
  },
310
311
  addFilter: (state, obj) => {
311
- state.selectStatic.dateTime = new Date();
312
- state.selectStatic.fieldTarget = obj.fieldTarget;
313
- state.selectStatic.value = obj.value;
312
+ setTimeout(function () {
313
+ state.selectStatic.dateTime = new Date();
314
+ state.selectStatic.tag = obj.tag;
315
+ state.selectStatic.fieldTarget = obj.fieldTarget;
316
+ state.selectStatic.value = obj.value;
317
+ }, 100);
318
+ },
319
+ addTag: (state, tag) => {
320
+ state.tags.push(tag);
321
+ },
322
+ removeTag: (state, key) => {
323
+ let filter = state.tags.filter(x => x.key != key);
324
+ state.tags = filter;
325
+ },
326
+ cleanTags: (state) => {
327
+ state.tags = []
314
328
  },
315
329
  },
316
330
  actions: {