@nixweb/nixloc-ui 0.0.300 → 0.0.301
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 +1 -1
- package/src/App.vue +13 -0
- package/src/component/forms/Button.vue +163 -0
- package/src/component/forms/ButtonFilter.vue +75 -0
- package/src/component/forms/ButtonGroup.vue +67 -0
- package/src/component/forms/ButtonSub.vue +98 -0
- package/src/component/forms/ButtonToggle.vue +77 -0
- package/src/component/forms/CheckboxGroup.vue +69 -0
- package/src/component/forms/CheckboxServer.vue +192 -0
- package/src/component/forms/CheckboxSimple.vue +60 -0
- package/src/component/forms/Color.vue +38 -0
- package/src/component/forms/DateTime.vue +170 -0
- package/src/component/forms/DateYearMonth.vue +193 -0
- package/src/component/forms/Dropdown.vue +236 -0
- package/src/component/forms/EditorHtml.vue +132 -0
- package/src/component/forms/FileUpload.vue +170 -0
- package/src/component/forms/ImageUpload.vue +214 -0
- package/src/component/forms/IncrementDecrement.vue +148 -0
- package/src/component/forms/InputAddressGoogle.vue +171 -0
- package/src/component/forms/InputCallToAction.vue +135 -0
- package/src/component/forms/InputDecimal.vue +153 -0
- package/src/component/forms/InputDecimalDiscount.vue +78 -0
- package/src/component/forms/InputNumber.vue +160 -0
- package/src/component/forms/InputPassword.vue +148 -0
- package/src/component/forms/InputTag.vue +125 -0
- package/src/component/forms/InputText.vue +174 -0
- package/src/component/forms/InputTextEdit.vue +69 -0
- package/src/component/forms/InputWhatsApp.vue +48 -0
- package/src/component/forms/Modal.vue +57 -0
- package/src/component/forms/RadioGroup.vue +91 -0
- package/src/component/forms/Select.vue +378 -0
- package/src/component/forms/SelectStatic.vue +198 -0
- package/src/component/forms/SideBar.vue +100 -0
- package/src/component/forms/Slider.vue +18 -0
- package/src/component/forms/TextArea.vue +138 -0
- package/src/component/forms/Toggle.vue +72 -0
- package/src/component/layout/Account.vue +131 -0
- package/src/component/layout/Alert.vue +88 -0
- package/src/component/layout/Badge.vue +111 -0
- package/src/component/layout/BarFloating.vue +68 -0
- package/src/component/layout/FixedBar.vue +103 -0
- package/src/component/layout/Gantt.vue +128 -0
- package/src/component/layout/Header.vue +56 -0
- package/src/component/layout/HideShow.vue +62 -0
- package/src/component/layout/IconMolded.vue +59 -0
- package/src/component/layout/LoadingFullPage.vue +27 -0
- package/src/component/layout/Menu.vue +287 -0
- package/src/component/layout/Molded.vue +30 -0
- package/src/component/layout/NewAccount.vue +136 -0
- package/src/component/layout/NewHeader.vue +60 -0
- package/src/component/layout/NewIconMolded.vue +71 -0
- package/src/component/layout/NewMenu.vue +456 -0
- package/src/component/layout/Panel.vue +185 -0
- package/src/component/layout/Popover.vue +126 -0
- package/src/component/layout/ScrollBar.vue +57 -0
- package/src/component/layout/Tab.vue +135 -0
- package/src/component/layout/Tag.vue +97 -0
- package/src/component/layout/Wizard.vue +211 -0
- package/src/component/rental/DisplayCalculatePeriod.vue +49 -0
- package/src/component/rental/DisplayPeriodRent.vue +55 -0
- package/src/component/rental/DisplayTotalization.vue +86 -0
- package/src/component/report/Fields.vue +109 -0
- package/src/component/report/Report.vue +314 -0
- package/src/component/report/ReportTable.vue +112 -0
- package/src/component/report/Totalization.vue +34 -0
- package/src/component/shared/CodeEditor.vue +128 -0
- package/src/component/shared/Collapse.vue +131 -0
- package/src/component/shared/Confirmation.vue +74 -0
- package/src/component/shared/DocumentEditor.vue +99 -0
- package/src/component/shared/DocumentPreview.vue +81 -0
- package/src/component/shared/DocumentPublic.vue +33 -0
- package/src/component/shared/ExportExcel.vue +56 -0
- package/src/component/shared/ExportPDF.vue +116 -0
- package/src/component/shared/FullCalendar.vue +174 -0
- package/src/component/shared/HeaderReport.vue +47 -0
- package/src/component/shared/HorizontalFilter.vue +64 -0
- package/src/component/shared/ListNotifications.vue +70 -0
- package/src/component/shared/Loading.vue +107 -0
- package/src/component/shared/LoadingCard.vue +65 -0
- package/src/component/shared/LoadingMoreButton.vue +23 -0
- package/src/component/shared/Messages.vue +109 -0
- package/src/component/shared/PDFViewer.vue +24 -0
- package/src/component/shared/Pagination.vue +108 -0
- package/src/component/shared/ParameterLegend.vue +169 -0
- package/src/component/shared/ProgressBar.vue +25 -0
- package/src/component/shared/QueryButton.vue +66 -0
- package/src/component/shared/Report.vue +200 -0
- package/src/component/shared/SaveCancel.vue +99 -0
- package/src/component/shared/Search.vue +174 -0
- package/src/component/shared/SelectOption.vue +162 -0
- package/src/component/shared/Table.vue +174 -0
- package/src/component/shared/TableButton.vue +36 -0
- package/src/component/shared/TableDraggable.vue +117 -0
- package/src/component/shared/TableImport.vue +93 -0
- package/src/component/shared/TableItem.vue +214 -0
- package/src/component/shared/TableTotalPerPage.vue +78 -0
- package/src/component/shared/TableTotalRecords.vue +44 -0
- package/src/component/shared/TableTotalization.vue +47 -0
- package/src/component/shared/TimeLine.vue +42 -0
- package/src/component/shared/Timer.vue +78 -0
- package/src/component/shared/Tip.vue +42 -0
- package/src/component/shared/Toast.vue +69 -0
- package/src/component/shared/ToggleTheme.vue +128 -0
- package/src/component/shared/TotalizationReport.vue +86 -0
- package/src/component/shared/VerticalFilter.vue +97 -0
- package/src/component/shared/automation/ActivitiesList.vue +44 -0
- package/src/component/shared/automation/AddRule.vue +61 -0
- package/src/component/shared/automation/AutomationBuilder.vue +27 -0
- package/src/component/shared/automation/DynamicComponentList.vue +86 -0
- package/src/component/shared/automation/SelectRule.vue +98 -0
- package/src/component/shared/automation/components/BillingByRent.vue +98 -0
- package/src/component/shared/automation/components/SendEmail.vue +94 -0
- package/src/component/shared/file-manager/FileManager.vue +391 -0
- package/src/component/shared/filter-builder/FilterBuilder.vue +221 -0
- package/src/component/shared/filter-builder/FilterQuery.vue +94 -0
- package/src/component/shared/query-builder/AddRule.vue +203 -0
- package/src/component/shared/query-builder/ConvertToOdata.js +86 -0
- package/src/component/shared/query-builder/DynamicComponent.vue +161 -0
- package/src/component/shared/query-builder/DynamicComponentList.vue +70 -0
- package/src/component/shared/query-builder/Fields.vue +93 -0
- package/src/component/shared/query-builder/QueryBuilder.vue +69 -0
- package/src/component/shared/query-builder/Rules.vue +68 -0
- package/src/component/shared/query-builder/SelectRule.vue +97 -0
- package/src/component/shared/query-builder/Tags.vue +59 -0
- package/src/component/shared/query-builder/utilities.js +22 -0
- package/src/component/signature/Payment.vue +161 -0
- package/src/component/signature/Warning.vue +76 -0
- package/src/component/template/ListViewWithDataHandler.vue +429 -0
- package/src/component/template/ReportCreateUpdate.vue +110 -0
- package/src/component/template/ViewTemplateConfiguration.vue +64 -0
- package/src/component/template/ViewTemplateDocumentView.vue +213 -0
- package/src/component/template/ViewTemplateImportFile.vue +347 -0
- package/src/component/template/ViewTemplateReportList.vue +217 -0
- package/src/component/template/ViewTemplateReportPreview.vue +432 -0
- package/src/component/template/ViewTemplateSelectOption.vue +46 -0
- package/src/component/template/ViewTemplateWithSalveCancel.vue +32 -0
- package/src/component/template/ViewTemplateWithTable.vue +62 -0
- package/src/component/template/model/Report.js +6 -0
- package/src/component/training/Course.vue +344 -0
- package/src/component/training/CourseView.vue +190 -0
- package/src/component/value-objects/Address.js +11 -0
- package/src/component/value-objects/Address.vue +157 -0
- package/src/component/value-objects/Contact.js +7 -0
- package/src/component/value-objects/Contact.vue +106 -0
- package/src/component/value-objects/Person.js +10 -0
- package/src/component/value-objects/Person.vue +129 -0
- package/src/config/axios.js +9 -0
- package/src/config/dicas.js +15 -0
- package/src/config/router.js +14 -0
- package/src/config/token.js +15 -0
- package/src/main.js +23 -0
- package/src/store/modules/automation.js +31 -0
- package/src/store/modules/generic.js +816 -0
- package/src/store/modules/report.js +278 -0
- package/src/store/modules/user.js +67 -0
- package/src/store/modules/util.js +26 -0
- package/src/store/modules/validation.js +39 -0
- package/src/store/store.js +14 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import ConvertToOdata from "@nixweb/nixloc-ui/src/component/shared/query-builder/ConvertToOdata.js";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
namespaced: true,
|
|
5
|
+
state: {
|
|
6
|
+
report: { id: "", fields: [], rules: [], },
|
|
7
|
+
selectedFields: {},
|
|
8
|
+
selectedRules: [],
|
|
9
|
+
finalQueryFormatOData: {
|
|
10
|
+
fields: [], totalization: [],
|
|
11
|
+
},
|
|
12
|
+
tags: []
|
|
13
|
+
},
|
|
14
|
+
getters: {
|
|
15
|
+
headerTable: (state) => {
|
|
16
|
+
let list = [];
|
|
17
|
+
state.report.fields.forEach(function (field) {
|
|
18
|
+
if (field.selected) list.push(field);
|
|
19
|
+
});
|
|
20
|
+
return list;
|
|
21
|
+
},
|
|
22
|
+
fields: (state) => {
|
|
23
|
+
// esse getter serve somente para carregar informações no component Fields
|
|
24
|
+
var fields = { selected: [], options: [], sort: { content: "", id: "asc" }, orderBy: "" };
|
|
25
|
+
|
|
26
|
+
state.report.fields.forEach(function (value) {
|
|
27
|
+
let option = { text: value.title, value: value.field };
|
|
28
|
+
fields.options.push(option);
|
|
29
|
+
|
|
30
|
+
// se o relatório for o padrão, carrega as info default
|
|
31
|
+
if (state.report.id == undefined) {
|
|
32
|
+
if (value.selected)
|
|
33
|
+
fields.selected.push(value.field);
|
|
34
|
+
|
|
35
|
+
if (value.orderBy) {
|
|
36
|
+
fields.sort = { content: value.title, id: value.field };
|
|
37
|
+
fields.orderBy = value.orderBy;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
fields.selected = state.selectedFields.selected;
|
|
42
|
+
fields.sort = state.selectedFields.sort;
|
|
43
|
+
fields.orderBy = state.selectedFields.orderBy;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
});
|
|
47
|
+
return fields;
|
|
48
|
+
},
|
|
49
|
+
oDataOrderBy: (state) => {
|
|
50
|
+
let orderBy = "";
|
|
51
|
+
if (state.selectedFields.sort != undefined)
|
|
52
|
+
orderBy = `$orderby=${state.selectedFields.sort.id} ${state.selectedFields.orderBy}`;
|
|
53
|
+
return orderBy;
|
|
54
|
+
},
|
|
55
|
+
oDataSelect: (state) => {
|
|
56
|
+
let selectedFields = [];
|
|
57
|
+
|
|
58
|
+
// verifica os campos obrigatórios por default "requiredOData"
|
|
59
|
+
state.report.fields.forEach(value => {
|
|
60
|
+
if (value.requiredOData)
|
|
61
|
+
selectedFields.push(value.field);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// verifica os campos selecionados pelo usuário
|
|
65
|
+
if (state.selectedFields.selected != undefined) {
|
|
66
|
+
state.selectedFields.selected.forEach(function (field) {
|
|
67
|
+
selectedFields.push(field);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let query = "";
|
|
72
|
+
let indexQuery = 0;
|
|
73
|
+
|
|
74
|
+
// remove itens duplicados e monta a query select
|
|
75
|
+
[...new Set(selectedFields)].forEach(field => {
|
|
76
|
+
if (indexQuery == 0) query += `$select=${field}`;
|
|
77
|
+
if (indexQuery > 0) query += `,${field}`;
|
|
78
|
+
indexQuery++;
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
return query;
|
|
82
|
+
},
|
|
83
|
+
oDataFilter: (state) => {
|
|
84
|
+
let query = "";
|
|
85
|
+
let totalization = "";
|
|
86
|
+
let indexQuery = 0;
|
|
87
|
+
let indexTotalization = 0;
|
|
88
|
+
var sizeFields = state.finalQueryFormatOData.fields.length;
|
|
89
|
+
var sizeTotalization = state.finalQueryFormatOData.totalization.length;
|
|
90
|
+
var andOr = [];
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
state.finalQueryFormatOData.fields.forEach(function (rule) {
|
|
94
|
+
|
|
95
|
+
if (rule.type == "field") {
|
|
96
|
+
if (indexQuery == 0 && sizeFields > 0) query += `$filter=${rule.formatOdata}`;
|
|
97
|
+
|
|
98
|
+
if (indexQuery > 0 && sizeFields > 0) {
|
|
99
|
+
query += ` ${rule.andOr} ${rule.formatOdata}`;
|
|
100
|
+
andOr.push(rule.andOr);
|
|
101
|
+
}
|
|
102
|
+
indexQuery++;
|
|
103
|
+
|
|
104
|
+
// verifica no array se o último item é o "and", se sim será necessário inserir "(" depois do filter = e ")" antes do "and"
|
|
105
|
+
// para que o oData consiga efetuar a query corretamente
|
|
106
|
+
if (andOr[andOr.length - 1] == "and") {
|
|
107
|
+
|
|
108
|
+
let initIndex = query.indexOf("=");
|
|
109
|
+
let lastIndex = query.indexOf("and");
|
|
110
|
+
|
|
111
|
+
var query1 = [query.slice(0, initIndex + 1), "(", query.slice(initIndex)].join('').replace("=(=", "=(");
|
|
112
|
+
var query2 = [query1.slice(0, lastIndex + 1), ")", query1.slice(lastIndex)].join('');
|
|
113
|
+
query = query2;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
} else {
|
|
117
|
+
if (indexTotalization == 0 && size > 0) totalization += `${rule.formatOdata}`;
|
|
118
|
+
if (indexTotalization > 0 && size > 0) totalization += `,${rule.formatOdata}`;
|
|
119
|
+
indexTotalization++;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
state.finalQueryFormatOData.totalization.forEach(function (rule) {
|
|
124
|
+
|
|
125
|
+
if (indexTotalization == 0 && sizeTotalization > 0) totalization = `${rule.formatOdata}`;
|
|
126
|
+
if (indexTotalization > 0 && sizeTotalization > 0) totalization = `,${rule.formatOdata}`;
|
|
127
|
+
indexTotalization++;
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
return { query, totalization };
|
|
131
|
+
},
|
|
132
|
+
tags: (state) => {
|
|
133
|
+
state.tags = [];
|
|
134
|
+
let description = "";
|
|
135
|
+
|
|
136
|
+
state.finalQueryFormatOData.fields.forEach(function (rule) {
|
|
137
|
+
description = "";
|
|
138
|
+
|
|
139
|
+
if (rule.typeField == "dateTime") {
|
|
140
|
+
description = `${rule.value[0]} - ${rule.value[1]}`;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (rule.typeField == "select") {
|
|
144
|
+
description = rule.value.content;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (rule.typeField == "text" || rule.typeField == "numeric") {
|
|
148
|
+
description = `${rule.operator} "${rule.value}"`;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (rule.typeField == "checkbox") {
|
|
152
|
+
rule.options.forEach(function (option) {
|
|
153
|
+
rule.value.forEach(function (value) {
|
|
154
|
+
if (option.value == value) {
|
|
155
|
+
description += `${option.title},`;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
let tag = { id: rule.id, title: rule.title, value: description };
|
|
162
|
+
state.tags.push(tag);
|
|
163
|
+
|
|
164
|
+
});
|
|
165
|
+
return state.tags;
|
|
166
|
+
|
|
167
|
+
},
|
|
168
|
+
rulesIsValid: (state) => {
|
|
169
|
+
let isValid = false;
|
|
170
|
+
let rulesRequired = state.report.rules.filter(x => x.isRequired);
|
|
171
|
+
let rulesRequiredSelected = state.selectedRules.filter(x => x.isRequired);
|
|
172
|
+
|
|
173
|
+
if (rulesRequired.length == rulesRequiredSelected.length)
|
|
174
|
+
isValid = true;
|
|
175
|
+
|
|
176
|
+
return isValid;
|
|
177
|
+
},
|
|
178
|
+
rulesRequired: (state) => {
|
|
179
|
+
return state.report.rules.filter(x => x.isRequired);
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
mutations: {
|
|
183
|
+
updateSelectedFields: (state, selectedFields) => {
|
|
184
|
+
state.selectedFields = selectedFields;
|
|
185
|
+
// após selecionar o campo, atualiza tambem quais campos deverão aparecer no report
|
|
186
|
+
// se foi selecionado é marcado como selected = true
|
|
187
|
+
state.report.fields.forEach(function (value) {
|
|
188
|
+
var hasSelected = selectedFields.selected.find((selected) => {
|
|
189
|
+
if (value.field == selected) return true;
|
|
190
|
+
});
|
|
191
|
+
if (value.field === hasSelected) {
|
|
192
|
+
value.selected = true;
|
|
193
|
+
} else {
|
|
194
|
+
value.selected = false;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
addSelectedRules: (state, selectedRule) => {
|
|
199
|
+
state.selectedRules.push(selectedRule);
|
|
200
|
+
},
|
|
201
|
+
removeSelectedRule: (state, id) => {
|
|
202
|
+
var filter = state.selectedRules.filter((item) => {
|
|
203
|
+
return id != item.id;
|
|
204
|
+
})
|
|
205
|
+
state.selectedRules = filter;
|
|
206
|
+
},
|
|
207
|
+
mountFinalQueryFormatOData: (state, selectedRules) => {
|
|
208
|
+
// aqui faz a conversão das regras selecionadas no padrão do query-builder para o formato oData carregando no objeto finalQueryFormatOData
|
|
209
|
+
// para ser consumido nos getters oDataSelect e oDataFilter
|
|
210
|
+
|
|
211
|
+
state.finalQueryFormatOData = { fields: [], totalization: [] };
|
|
212
|
+
var convertToOdata = new ConvertToOdata();
|
|
213
|
+
|
|
214
|
+
selectedRules.forEach(function (rule) {
|
|
215
|
+
|
|
216
|
+
if (rule.value != null && rule.value != "" && rule.value != undefined && rule.type == "totalization") {
|
|
217
|
+
let formatOdata = convertToOdata.convertRule(rule);
|
|
218
|
+
|
|
219
|
+
rule.value.forEach(value => {
|
|
220
|
+
// adiciona no array somente a opção da regra selecionada
|
|
221
|
+
var ruleSelected = rule.options.filter(x => x.value == value);
|
|
222
|
+
|
|
223
|
+
let ruleOdata = {
|
|
224
|
+
title: ruleSelected[0].aggregate.title,
|
|
225
|
+
value: ruleSelected[0].aggregate.value,
|
|
226
|
+
classCss: ruleSelected[0].aggregate.classCss,
|
|
227
|
+
type: ruleSelected[0].aggregate.type,
|
|
228
|
+
formatOdata: formatOdata,
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
state.finalQueryFormatOData.totalization.push(ruleOdata);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (rule.value != null && rule.value != "" && rule.value != undefined && rule.type == "field") {
|
|
236
|
+
|
|
237
|
+
let formatOdata = convertToOdata.convertRule(rule);
|
|
238
|
+
|
|
239
|
+
let ruleOdata = {
|
|
240
|
+
id: rule.id,
|
|
241
|
+
title: rule.title,
|
|
242
|
+
type: rule.type,
|
|
243
|
+
typeField: rule.typeField,
|
|
244
|
+
options: rule.options,
|
|
245
|
+
operator: rule.operator,
|
|
246
|
+
selected: rule.selected,
|
|
247
|
+
isRequired: rule.isRequired,
|
|
248
|
+
formatOdata: formatOdata,
|
|
249
|
+
andOr: rule.andOr,
|
|
250
|
+
value: rule.value,
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
state.finalQueryFormatOData.fields.push(ruleOdata);
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
},
|
|
257
|
+
clearTotalization: (state) => {
|
|
258
|
+
state.finalQueryFormatOData.totalization = [];
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
actions: {
|
|
262
|
+
addReport: async function (context, report) {
|
|
263
|
+
context.state.report = report;
|
|
264
|
+
context.state.selectedFields = context.getters.fields;
|
|
265
|
+
},
|
|
266
|
+
addInitialReportCustom: async function (context, report) {
|
|
267
|
+
context.state.selectedFields = report.selectedFields;
|
|
268
|
+
context.state.selectedRules = report.selectedRules;
|
|
269
|
+
context.commit('mountFinalQueryFormatOData', report.selectedRules);
|
|
270
|
+
context.commit('updateSelectedFields', report.selectedFields);
|
|
271
|
+
},
|
|
272
|
+
removeInitialReportCustom: async function (context) {
|
|
273
|
+
context.state.selectedFields = {};
|
|
274
|
+
context.state.selectedRules = [];
|
|
275
|
+
context.state.finalQueryFormatOData.fields = [];
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
namespaced: true,
|
|
3
|
+
state: {
|
|
4
|
+
userLogged: {
|
|
5
|
+
},
|
|
6
|
+
menu: {
|
|
7
|
+
items: []
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
getters: {
|
|
11
|
+
hasRule: (state) => (name) => {
|
|
12
|
+
var hasRule = state.userLogged.user.rules.find(obj => {
|
|
13
|
+
return obj.name === name
|
|
14
|
+
})
|
|
15
|
+
if (hasRule == undefined) return false;
|
|
16
|
+
return true;
|
|
17
|
+
},
|
|
18
|
+
hasPermission: (state) => (name) => {
|
|
19
|
+
var hasRule = state.userLogged.user.rules.find(obj => {
|
|
20
|
+
return obj.name === name
|
|
21
|
+
})
|
|
22
|
+
if (hasRule == undefined) return undefined;
|
|
23
|
+
return hasRule.permission;
|
|
24
|
+
},
|
|
25
|
+
hasModule: (state) => (name) => {
|
|
26
|
+
var hasRule = state.userLogged.user.modules.find(obj => {
|
|
27
|
+
return obj.name === name
|
|
28
|
+
})
|
|
29
|
+
if (hasRule == undefined) return false;
|
|
30
|
+
return true;
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
},
|
|
34
|
+
mutations: {
|
|
35
|
+
addUserLogged: (state, obj) => {
|
|
36
|
+
state.userLogged = obj;
|
|
37
|
+
},
|
|
38
|
+
addItemMenu: (state, items) => {
|
|
39
|
+
items.forEach(function (obj) {
|
|
40
|
+
state.menu.items.push(obj);
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
removeItemMenu: (state) => {
|
|
44
|
+
state.menu.items = [];
|
|
45
|
+
},
|
|
46
|
+
updateParameterRental: (state, parameterRental) => {
|
|
47
|
+
state.userLogged.parameterRental = parameterRental;
|
|
48
|
+
},
|
|
49
|
+
updateParameterStock: (state, parameterStock) => {
|
|
50
|
+
state.userLogged.parameterStock = parameterStock;
|
|
51
|
+
},
|
|
52
|
+
updateParameterDangerZone: (state, parameterDangerZone) => {
|
|
53
|
+
state.userLogged.parameterStock.calculateByFullPeriod = parameterDangerZone.calculateByFullPeriod;
|
|
54
|
+
state.userLogged.parameterStock.displayPeriod = parameterDangerZone.displayPeriod;
|
|
55
|
+
state.userLogged.parameterStock.manageByPatrimony = parameterDangerZone.manageByPatrimony;
|
|
56
|
+
},
|
|
57
|
+
updateToken: (state, token) => {
|
|
58
|
+
state.userLogged.token = token;
|
|
59
|
+
},
|
|
60
|
+
updateComunication: (state) => {
|
|
61
|
+
state.userLogged.user.showComunication = false;
|
|
62
|
+
},
|
|
63
|
+
updatePhoto: (state, photo) => {
|
|
64
|
+
state.userLogged.user.photo = photo;
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
namespaced: true,
|
|
3
|
+
getters: {
|
|
4
|
+
formatMoney: (state) => (amount) => {
|
|
5
|
+
|
|
6
|
+
var decimalCount = 2;
|
|
7
|
+
var decimal = ",";
|
|
8
|
+
var thousands = ".";
|
|
9
|
+
|
|
10
|
+
decimalCount = Math.abs(decimalCount);
|
|
11
|
+
decimalCount = isNaN(decimalCount) ? 2 : decimalCount;
|
|
12
|
+
|
|
13
|
+
const negativeSign = amount < 0 ? "-" : "";
|
|
14
|
+
|
|
15
|
+
let i = parseInt((amount = Math.abs(Number(amount) || 0).toFixed(decimalCount))).toString();
|
|
16
|
+
let j = i.length > 3 ? i.length % 3 : 0;
|
|
17
|
+
|
|
18
|
+
var ret = negativeSign + (j ? i.substring(0, j) + thousands : "") +
|
|
19
|
+
i.substring(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands) +
|
|
20
|
+
(decimalCount ? decimal + Math.abs(amount - i).toFixed(decimalCount).slice(2) : "");
|
|
21
|
+
|
|
22
|
+
return ret;
|
|
23
|
+
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
namespaced: true,
|
|
3
|
+
state: {
|
|
4
|
+
formDirty: false,
|
|
5
|
+
validations: [],
|
|
6
|
+
resetForm: {
|
|
7
|
+
name: undefined,
|
|
8
|
+
dateTime: undefined
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
getters: {
|
|
12
|
+
isFormValid: (state) => (formName) => {
|
|
13
|
+
var hasNotification = state.validations.find(obj => {
|
|
14
|
+
return obj.formName === formName
|
|
15
|
+
})
|
|
16
|
+
if (hasNotification != undefined) return false;
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
mutations: {
|
|
21
|
+
addValidation: (state, obj) => {
|
|
22
|
+
state.validations.push(obj);
|
|
23
|
+
},
|
|
24
|
+
removeValidation: (state, obj) => {
|
|
25
|
+
let filter = state.validations.filter(v => v.key != obj.key);
|
|
26
|
+
state.validations = filter;
|
|
27
|
+
},
|
|
28
|
+
resetValidation: (state, formName) => {
|
|
29
|
+
state.resetForm.dateTime = new Date();
|
|
30
|
+
state.resetForm.name = formName;
|
|
31
|
+
},
|
|
32
|
+
updateFormDirty: (state, formDirty) => {
|
|
33
|
+
state.formDirty = formDirty;
|
|
34
|
+
},
|
|
35
|
+
removeFormDirty: (state) => {
|
|
36
|
+
state.formDirty = false;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import Vuex from 'vuex';
|
|
3
|
+
|
|
4
|
+
import user from './modules/user'
|
|
5
|
+
import generic from './modules/generic'
|
|
6
|
+
import validation from './modules/validation'
|
|
7
|
+
|
|
8
|
+
Vue.use(Vuex)
|
|
9
|
+
|
|
10
|
+
export default new Vuex.Store({
|
|
11
|
+
modules: {
|
|
12
|
+
generic, validation, user
|
|
13
|
+
}
|
|
14
|
+
})
|