@nixweb/nixloc-ui 0.0.125 → 0.0.128
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/docs/src/component/template/ViewTemplateReportPreview.drawio +210 -0
- package/package.json +79 -77
- package/src/App.vue +13 -13
- package/src/component/forms/Button.vue +170 -169
- package/src/component/forms/CheckboxGroup.vue +72 -63
- package/src/component/forms/CheckboxSimple.vue +46 -27
- package/src/component/forms/Color.vue +38 -38
- package/src/component/forms/DateTime.vue +167 -177
- package/src/component/forms/Dropdown.vue +218 -224
- package/src/component/forms/EditorHtml.vue +126 -123
- package/src/component/forms/FileUpload.vue +185 -189
- package/src/component/forms/ImageUpload.vue +230 -0
- package/src/component/forms/IncrementDecrement.vue +101 -0
- package/src/component/forms/InputDecimal.vue +142 -137
- package/src/component/forms/InputNumber.vue +154 -149
- package/src/component/forms/InputPassword.vue +135 -135
- package/src/component/forms/InputText.vue +162 -157
- package/src/component/forms/Modal.vue +65 -60
- package/src/component/forms/RadioGroup.vue +50 -50
- package/src/component/forms/Select.vue +349 -337
- package/src/component/forms/SelectStatic.vue +127 -120
- package/src/component/forms/Slider.vue +18 -18
- package/src/component/forms/TextArea.vue +126 -126
- package/src/component/layout/Alert.vue +92 -92
- package/src/component/layout/Badge.vue +103 -103
- package/src/component/layout/FixedBar.vue +100 -68
- package/src/component/layout/Header.vue +38 -35
- package/src/component/layout/LoadingFullPage.vue +27 -27
- package/src/component/layout/Menu.vue +210 -214
- package/src/component/layout/Molded.vue +28 -27
- package/src/component/layout/Panel.vue +140 -142
- package/src/component/layout/Popover.vue +126 -126
- package/src/component/layout/ScrollBar.vue +42 -43
- package/src/component/layout/Tab.vue +135 -0
- package/src/component/layout/Tag.vue +3 -3
- package/src/component/layout/Wizard.vue +211 -213
- package/src/component/rental/DisplayPeriodRent.vue +81 -0
- package/src/component/rental/DisplayTotalization.vue +47 -0
- package/src/component/shared/Collapse.vue +131 -131
- package/src/component/shared/Confirmation.vue +2 -2
- package/src/component/shared/DocumentEditor.vue +1 -1
- package/src/component/shared/DocumentPreview.vue +1 -1
- package/src/component/shared/DocumentPublic.vue +34 -0
- package/src/component/shared/ExportExcel.vue +1 -8
- package/src/component/shared/ExportPDF.vue +116 -116
- package/src/component/shared/{HeaderPrint.vue → HeaderReport.vue} +4 -4
- package/src/component/shared/HorizontalFilter.vue +59 -59
- package/src/component/shared/Loading.vue +107 -107
- package/src/component/shared/LoadingMoreButton.vue +23 -23
- package/src/component/shared/Messages.vue +81 -83
- package/src/component/shared/PDFViewer.vue +22 -22
- package/src/component/shared/Pagination.vue +52 -53
- package/src/component/shared/{LegendaParametro.vue → ParameterLegend.vue} +22 -26
- package/src/component/shared/ProgressBar.vue +22 -21
- package/src/component/shared/QueryButton.vue +66 -66
- package/src/component/shared/Report.vue +187 -0
- package/src/component/shared/SaveCancel.vue +26 -5
- package/src/component/shared/Search.vue +154 -154
- package/src/component/shared/SelectOption.vue +146 -0
- package/src/component/shared/Table.vue +163 -243
- package/src/component/shared/TableButton.vue +36 -36
- package/src/component/shared/TableDraggable.vue +127 -0
- package/src/component/shared/TableItem.vue +177 -0
- package/src/component/shared/TableTotalRecords.vue +9 -10
- package/src/component/shared/TableTotalization.vue +47 -47
- package/src/component/shared/Tip.vue +42 -42
- package/src/component/shared/Toast.vue +54 -54
- package/src/component/shared/TotalizationReport.vue +59 -0
- package/src/component/shared/VerticalFilter.vue +97 -145
- package/src/component/shared/query-builder/AddRule.vue +181 -187
- package/src/component/shared/query-builder/ConvertToOdata.js +34 -43
- package/src/component/shared/query-builder/DynamicComponent.vue +21 -16
- package/src/component/shared/query-builder/DynamicComponentList.vue +73 -0
- package/src/component/shared/query-builder/Fields.vue +29 -63
- package/src/component/shared/query-builder/QueryBuilder.vue +69 -69
- package/src/component/shared/query-builder/Rules.vue +2 -14
- package/src/component/shared/query-builder/SelectRule.vue +15 -15
- package/src/component/shared/query-builder/Tags.vue +24 -8
- package/src/component/shared/query-builder/utilities.js +21 -21
- package/src/component/template/{ListViewWithHandlerData.vue → ListViewWithDataHandler.vue} +260 -231
- package/src/component/template/{AddEditReport.vue → ReportCreateUpdate.vue} +40 -22
- package/src/component/template/ViewTemplateConfiguration.vue +64 -69
- package/src/component/template/ViewTemplateDocumentView.vue +22 -25
- package/src/component/template/ViewTemplateReportList.vue +39 -57
- package/src/component/template/ViewTemplateReportPreview.vue +270 -341
- package/src/component/template/ViewTemplateReportPreviewCOPIASEGURANCA.vue +497 -0
- package/src/component/template/ViewTemplateSelectOption.vue +60 -0
- package/src/component/template/ViewTemplateWithSalveCancel.vue +32 -32
- package/src/component/template/ViewTemplateWithTable.vue +56 -49
- package/src/component/template/model/Report.js +2 -2
- package/src/component/value-objects/Address.js +11 -0
- package/src/component/value-objects/{Endereco.vue → Address.vue} +39 -40
- package/src/component/value-objects/{DadosContato.js → Contact.js} +2 -2
- package/src/component/value-objects/{DadosContato.vue → Contact.vue} +24 -17
- package/src/component/value-objects/Person.js +10 -0
- package/src/component/value-objects/{DadosPessoa.vue → Person.vue} +50 -35
- package/src/config/axios.js +9 -9
- package/src/config/dicas.js +14 -14
- package/src/config/router.js +13 -13
- package/src/config/token.js +14 -14
- package/src/main.js +23 -23
- package/src/store/modules/generic.js +512 -488
- package/src/store/modules/report.js +156 -127
- package/src/store/modules/user.js +6 -0
- package/src/store/modules/validation.js +38 -38
- package/src/store/store.js +13 -13
- package/docs/src/component/template/ModeloRelatorioView.drawio +0 -160
- package/src/component/shared/query-builder/ListDynamicComponent.vue +0 -42
- package/src/component/shared/query-builder/Totalization.vue +0 -38
- package/src/component/value-objects/DadosPessoa.js +0 -10
- package/src/component/value-objects/Endereco.js +0 -11
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<b-row v-show="loadingAdd || loadingRemove">
|
|
4
|
+
<b-col sm="2">
|
|
5
|
+
<vue-loading
|
|
6
|
+
v-if="true"
|
|
7
|
+
type="bubbles"
|
|
8
|
+
color="#D98621"
|
|
9
|
+
:size="{ width: '50px', height: '50px' }"
|
|
10
|
+
></vue-loading>
|
|
11
|
+
</b-col>
|
|
12
|
+
</b-row>
|
|
13
|
+
<b-row v-show="!loadingAdd && !loadingRemove">
|
|
14
|
+
<b-col sm="12">
|
|
15
|
+
<div class="div-preview">
|
|
16
|
+
<img
|
|
17
|
+
:class="classCss"
|
|
18
|
+
:style="'width:100px;height:100px'"
|
|
19
|
+
:src="'https://espaco.blob.core.windows.net/' + container + '/' + urlImage"
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
<div>
|
|
23
|
+
<div v-if="!value">
|
|
24
|
+
<div class="div-button">
|
|
25
|
+
<button class="button small primary" @click="show = !show">
|
|
26
|
+
<span v-if="!loadingAdd">
|
|
27
|
+
<span><i class="fas fa-camera"></i> Carregar Foto</span>
|
|
28
|
+
</span>
|
|
29
|
+
</button>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<div v-else>
|
|
33
|
+
<div class="div-button">
|
|
34
|
+
<button class="button small danger" v-if="!loadingAdd" @click="remove()">
|
|
35
|
+
<span v-if="!loadingRemove"
|
|
36
|
+
><i class="fas fa-camera"></i> Remover Foto</span
|
|
37
|
+
>
|
|
38
|
+
<vue-loading
|
|
39
|
+
v-if="loadingRemove"
|
|
40
|
+
type="bubbles"
|
|
41
|
+
color="#fff"
|
|
42
|
+
:size="{ width: '20px', height: '20px' }"
|
|
43
|
+
></vue-loading>
|
|
44
|
+
</button>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</b-col>
|
|
49
|
+
</b-row>
|
|
50
|
+
<my-upload
|
|
51
|
+
field="img"
|
|
52
|
+
@crop-success="cropSuccess"
|
|
53
|
+
langType="pt-br"
|
|
54
|
+
v-model="show"
|
|
55
|
+
:width="120"
|
|
56
|
+
:height="100"
|
|
57
|
+
:noCircle="true"
|
|
58
|
+
img-format="png"
|
|
59
|
+
></my-upload>
|
|
60
|
+
</div>
|
|
61
|
+
</template>
|
|
62
|
+
<script>
|
|
63
|
+
import myUpload from "vue-image-crop-upload/upload-2.vue";
|
|
64
|
+
|
|
65
|
+
import { mapActions } from "vuex";
|
|
66
|
+
|
|
67
|
+
export default {
|
|
68
|
+
name: "ImageUpload",
|
|
69
|
+
components: {
|
|
70
|
+
"my-upload": myUpload,
|
|
71
|
+
},
|
|
72
|
+
props: {
|
|
73
|
+
title: String,
|
|
74
|
+
container: String,
|
|
75
|
+
accepted: String,
|
|
76
|
+
classCss:String,
|
|
77
|
+
urlPost: String,
|
|
78
|
+
urlRemove: String,
|
|
79
|
+
onLoad: Function,
|
|
80
|
+
value: String,
|
|
81
|
+
},
|
|
82
|
+
data() {
|
|
83
|
+
return {
|
|
84
|
+
file: "",
|
|
85
|
+
imgBase64: "",
|
|
86
|
+
show: false,
|
|
87
|
+
loadingAdd: false,
|
|
88
|
+
loadingRemove: false,
|
|
89
|
+
urlAzure: "https://espaco.blob.core.windows.net",
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
computed: {
|
|
93
|
+
urlImage() {
|
|
94
|
+
if (this.value) return this.value;
|
|
95
|
+
return "noImage.jpg";
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
methods: {
|
|
99
|
+
...mapActions("generic", ["postFileApi", "deleteFileApi"]),
|
|
100
|
+
cropSuccess(imgBase64) {
|
|
101
|
+
this.file = this.dataBase64ToFile(imgBase64, "image.png");
|
|
102
|
+
this.upload();
|
|
103
|
+
},
|
|
104
|
+
upload() {
|
|
105
|
+
let params = {
|
|
106
|
+
url: this.urlPost,
|
|
107
|
+
file: this.file,
|
|
108
|
+
container: this.container,
|
|
109
|
+
accepted: this.accepted,
|
|
110
|
+
};
|
|
111
|
+
this.loadingAdd = true;
|
|
112
|
+
this.postFileApi(params).then((response) => {
|
|
113
|
+
if (response.success) {
|
|
114
|
+
this.$emit("input", response.content);
|
|
115
|
+
if (this.onLoad) this.onLoad();
|
|
116
|
+
}
|
|
117
|
+
this.loadingAdd = false;
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
remove() {
|
|
121
|
+
let props = {
|
|
122
|
+
url: this.urlRemove,
|
|
123
|
+
container: this.container,
|
|
124
|
+
name: this.value,
|
|
125
|
+
};
|
|
126
|
+
this.loadingRemove = true;
|
|
127
|
+
let params = { url: this.urlRemove, obj: props };
|
|
128
|
+
this.deleteFileApi(params).then((response) => {
|
|
129
|
+
if (response.success) {
|
|
130
|
+
this.$emit("input", "");
|
|
131
|
+
if (this.onLoad) this.onLoad();
|
|
132
|
+
}
|
|
133
|
+
this.loadingRemove = false;
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
download() {
|
|
137
|
+
const url = `${this.urlAzure}/${this.container}/${this.value}`;
|
|
138
|
+
window.location.href = url;
|
|
139
|
+
},
|
|
140
|
+
dataBase64ToFile(dataurl, filename) {
|
|
141
|
+
var arr = dataurl.split(","),
|
|
142
|
+
mime = arr[0].match(/:(.*?);/)[1],
|
|
143
|
+
bstr = atob(arr[1]),
|
|
144
|
+
n = bstr.length,
|
|
145
|
+
u8arr = new Uint8Array(n);
|
|
146
|
+
|
|
147
|
+
while (n--) {
|
|
148
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return new File([u8arr], filename, { type: mime });
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
</script>
|
|
156
|
+
<style scoped>
|
|
157
|
+
.div-preview {
|
|
158
|
+
margin-bottom: 15px;
|
|
159
|
+
margin-left: 15px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.button {
|
|
163
|
+
padding: 8px 12px;
|
|
164
|
+
cursor: pointer;
|
|
165
|
+
border: none;
|
|
166
|
+
border-radius: 40px !important;
|
|
167
|
+
font-size: 14px;
|
|
168
|
+
font-weight: 400;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.primary {
|
|
172
|
+
background: #577696;
|
|
173
|
+
border-color: #577696;
|
|
174
|
+
color: #fff;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.primary:hover {
|
|
178
|
+
background: #355472;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.success {
|
|
182
|
+
color: #fff;
|
|
183
|
+
background: #94aa2a;
|
|
184
|
+
border-color: #94aa2a;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.success:hover {
|
|
188
|
+
background: #6d7e1c;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.danger {
|
|
192
|
+
color: #fff;
|
|
193
|
+
border-color: #f0134d;
|
|
194
|
+
background: #f0134d;
|
|
195
|
+
margin-left: 5px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.danger:hover {
|
|
199
|
+
background: #c70f40;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.small {
|
|
203
|
+
padding: 3px 7px;
|
|
204
|
+
font-size: 13px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.file input[type="file"] {
|
|
208
|
+
font-size: 100px;
|
|
209
|
+
position: absolute;
|
|
210
|
+
left: 0;
|
|
211
|
+
top: 0;
|
|
212
|
+
opacity: 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.div-alert {
|
|
216
|
+
margin-top: 15px;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.div-image {
|
|
220
|
+
margin-bottom: 10px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.img-round {
|
|
224
|
+
border-radius: 50px;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.div-button {
|
|
228
|
+
margin-left: 5px;
|
|
229
|
+
}
|
|
230
|
+
</style>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="wrapper">
|
|
4
|
+
<span class="minus" @click="decrement">-</span>
|
|
5
|
+
<span class="num" @click="showEdit = true" v-if="!showEdit">{{ number }}</span>
|
|
6
|
+
<input
|
|
7
|
+
class="input"
|
|
8
|
+
type="number"
|
|
9
|
+
@keyup.enter.prevent="showEdit = false"
|
|
10
|
+
v-model="number"
|
|
11
|
+
v-if="showEdit"
|
|
12
|
+
/>
|
|
13
|
+
<span @click="showEdit = false" v-if="showEdit"
|
|
14
|
+
><i class="fa-solid fa-check"></i
|
|
15
|
+
></span>
|
|
16
|
+
<span class="plus" @click="increment">+</span>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
export default {
|
|
23
|
+
name: "IncrementDecrement",
|
|
24
|
+
props: ["value", "min", "max"],
|
|
25
|
+
data() {
|
|
26
|
+
return {
|
|
27
|
+
number: 1,
|
|
28
|
+
showEdit: false,
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
increment() {
|
|
33
|
+
this.number++;
|
|
34
|
+
},
|
|
35
|
+
decrement() {
|
|
36
|
+
this.number--;
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
watch: {
|
|
40
|
+
number: {
|
|
41
|
+
handler(number) {
|
|
42
|
+
if (this.min)
|
|
43
|
+
if (this.number < this.min) {
|
|
44
|
+
this.number = this.min;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (this.max)
|
|
48
|
+
if (this.number > this.max) {
|
|
49
|
+
this.number = this.max;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
this.$emit("input", this.number);
|
|
53
|
+
},
|
|
54
|
+
deep: true,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<style scope>
|
|
61
|
+
.input {
|
|
62
|
+
width: 40px;
|
|
63
|
+
border: none;
|
|
64
|
+
text-align: center;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.wrapper {
|
|
68
|
+
height: 37px;
|
|
69
|
+
width: 100%;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
background: #fff;
|
|
74
|
+
border-radius: 8px;
|
|
75
|
+
border: 1px solid #eaedf3;
|
|
76
|
+
box-shadow: 0px 10px 20px -6px rgb(0 0 0 / 3%);
|
|
77
|
+
}
|
|
78
|
+
.wrapper span {
|
|
79
|
+
width: 100%;
|
|
80
|
+
text-align: center;
|
|
81
|
+
font-size: 15px;
|
|
82
|
+
font-weight: 600;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
user-select: none;
|
|
85
|
+
}
|
|
86
|
+
.wrapper span.num {
|
|
87
|
+
font-size: 17px;
|
|
88
|
+
border-right: 1px solid #eaedf3;
|
|
89
|
+
border-left: 1px solid #eaedf3;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
color: #3f529b;
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
font-weight: 400;
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.wrapper span.num:hover {
|
|
98
|
+
text-decoration: underline;
|
|
99
|
+
transition: 0.1s;
|
|
100
|
+
}
|
|
101
|
+
</style>
|
|
@@ -1,137 +1,142 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="form-group">
|
|
3
|
-
<label>
|
|
4
|
-
<span class="title">{{ title }}</span>
|
|
5
|
-
<span class="required" v-if="required">*</span>
|
|
6
|
-
<Tip :field="field" :formName="formName" />
|
|
7
|
-
</label>
|
|
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
|
-
<vue-numeric
|
|
14
|
-
class="form-control"
|
|
15
|
-
v-on:keyup.enter.native="pressedEnter"
|
|
16
|
-
:class="{ 'is-invalid': notifications.length > 0 && formDirty }"
|
|
17
|
-
:placeholder="placeholder"
|
|
18
|
-
:disabled="disabled"
|
|
19
|
-
currency="R$"
|
|
20
|
-
separator="."
|
|
21
|
-
v-bind:precision="2"
|
|
22
|
-
v-model="
|
|
23
|
-
></vue-numeric>
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<div v-if="formDirty">
|
|
27
|
-
<div v-for="message in notifications" :key="message">
|
|
28
|
-
<span class="invalid">{{ message }}</span>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<script>
|
|
35
|
-
import Tip from "../shared/Tip.vue";
|
|
36
|
-
import VueNumeric from "vue-numeric";
|
|
37
|
-
|
|
38
|
-
import { mapState, mapMutations } from "vuex";
|
|
39
|
-
|
|
40
|
-
export default {
|
|
41
|
-
name: "InputDecimal",
|
|
42
|
-
mixins: [],
|
|
43
|
-
props: {
|
|
44
|
-
title: String,
|
|
45
|
-
field: String,
|
|
46
|
-
disabled: Boolean,
|
|
47
|
-
placeholder: String,
|
|
48
|
-
formName: String,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
this.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="form-group">
|
|
3
|
+
<label v-if="title">
|
|
4
|
+
<span class="title">{{ title }}</span>
|
|
5
|
+
<span class="required" v-if="required">*</span>
|
|
6
|
+
<Tip :field="field" :formName="formName" />
|
|
7
|
+
</label>
|
|
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
|
+
<vue-numeric
|
|
14
|
+
class="form-control"
|
|
15
|
+
v-on:keyup.enter.native="pressedEnter"
|
|
16
|
+
:class="{ 'is-invalid': notifications.length > 0 && formDirty }"
|
|
17
|
+
:placeholder="placeholder"
|
|
18
|
+
:disabled="disabled"
|
|
19
|
+
currency="R$"
|
|
20
|
+
separator="."
|
|
21
|
+
v-bind:precision="2"
|
|
22
|
+
v-model="valueLocal"
|
|
23
|
+
></vue-numeric>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div v-if="formDirty">
|
|
27
|
+
<div v-for="message in notifications" :key="message">
|
|
28
|
+
<span class="invalid">{{ message }}</span>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import Tip from "../shared/Tip.vue";
|
|
36
|
+
import VueNumeric from "vue-numeric";
|
|
37
|
+
|
|
38
|
+
import { mapState, mapMutations } from "vuex";
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
name: "InputDecimal",
|
|
42
|
+
mixins: [],
|
|
43
|
+
props: {
|
|
44
|
+
title: String,
|
|
45
|
+
field: String,
|
|
46
|
+
disabled: Boolean,
|
|
47
|
+
placeholder: String,
|
|
48
|
+
formName: String,
|
|
49
|
+
markFormDirty: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: true,
|
|
52
|
+
},
|
|
53
|
+
required: Boolean,
|
|
54
|
+
value: Number,
|
|
55
|
+
enter: Function,
|
|
56
|
+
},
|
|
57
|
+
components: {
|
|
58
|
+
VueNumeric,
|
|
59
|
+
Tip,
|
|
60
|
+
},
|
|
61
|
+
data() {
|
|
62
|
+
return {
|
|
63
|
+
notifications: [],
|
|
64
|
+
formDirty: false,
|
|
65
|
+
_value: 0,
|
|
66
|
+
valueLocal: 20,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
created() {
|
|
70
|
+
// não carregar as validações iniciais para number
|
|
71
|
+
this.valueLocal = this.value;
|
|
72
|
+
},
|
|
73
|
+
methods: {
|
|
74
|
+
...mapMutations("validation", [
|
|
75
|
+
"addValidation",
|
|
76
|
+
"removeValidation",
|
|
77
|
+
"updateFormDirty",
|
|
78
|
+
]),
|
|
79
|
+
validate() {
|
|
80
|
+
this.notifications = [];
|
|
81
|
+
if (this.valueLocal == 0) return;
|
|
82
|
+
if (this.required && !this.valueLocal) {
|
|
83
|
+
var message = `${this.title} não pode ser vazio!`;
|
|
84
|
+
this.notifications.push(message);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
pressedEnter() {
|
|
88
|
+
if (this.enter) this.enter();
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
computed: {
|
|
92
|
+
...mapState("validation", ["resetForm"]),
|
|
93
|
+
},
|
|
94
|
+
watch: {
|
|
95
|
+
value() {
|
|
96
|
+
this.valueLocal = this.value;
|
|
97
|
+
},
|
|
98
|
+
valueLocal() {
|
|
99
|
+
this.validate();
|
|
100
|
+
this.$emit("input", this.valueLocal);
|
|
101
|
+
this.formDirty = true;
|
|
102
|
+
if (this.markFormDirty) this.updateFormDirty(true);
|
|
103
|
+
},
|
|
104
|
+
notifications() {
|
|
105
|
+
let self = this;
|
|
106
|
+
this.notifications.forEach(function (notification) {
|
|
107
|
+
let obj = {
|
|
108
|
+
key: self.field + "&" + self.formName,
|
|
109
|
+
formName: self.formName,
|
|
110
|
+
notification: notification,
|
|
111
|
+
};
|
|
112
|
+
self.addValidation(obj);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (this.notifications.length == 0) {
|
|
116
|
+
let obj = {
|
|
117
|
+
key: self.field + "&" + self.formName,
|
|
118
|
+
formName: self.formName,
|
|
119
|
+
};
|
|
120
|
+
self.removeValidation(obj);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
resetForm: {
|
|
124
|
+
handler(form) {
|
|
125
|
+
if (form.name == this.formName) this.formDirty = false;
|
|
126
|
+
},
|
|
127
|
+
deep: true,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
</script>
|
|
132
|
+
|
|
133
|
+
<style scoped>
|
|
134
|
+
.success {
|
|
135
|
+
color: #94aa2a;
|
|
136
|
+
font-size: 14px;
|
|
137
|
+
}
|
|
138
|
+
.invalid {
|
|
139
|
+
color: #f0134d;
|
|
140
|
+
font-size: 14px;
|
|
141
|
+
}
|
|
142
|
+
</style>
|