@nixweb/nixloc-ui 1.19.0 → 1.20.0
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/component/forms/ButtonFilter.vue +104 -104
- package/src/component/forms/ButtonGroup.vue +66 -66
- package/src/component/forms/ButtonGroupInline.vue +210 -210
- package/src/component/forms/ButtonSub.vue +97 -97
- package/src/component/forms/ButtonToggle.vue +76 -76
- package/src/component/forms/DateYearMonth.vue +192 -192
- package/src/component/forms/ImageUpload.vue +214 -214
- package/src/component/forms/IncrementDecrement.vue +151 -151
- package/src/component/forms/InputAddressGoogle.vue +171 -171
- package/src/component/forms/InputCallToAction.vue +135 -135
- package/src/component/forms/InputDecimalDiscount.vue +146 -146
- package/src/component/forms/InputTag.vue +124 -124
- package/src/component/forms/InputTextEdit.vue +69 -69
- package/src/component/forms/InputWhatsApp.vue +47 -47
- package/src/component/forms/SideBar.vue +99 -99
- package/src/component/forms/Toggle.vue +72 -72
- package/src/component/layout/Account.vue +131 -131
- package/src/component/layout/AnimatedPhrase.vue +68 -68
- package/src/component/layout/BarFloating.vue +67 -67
- package/src/component/layout/BottomActionsBar.vue +205 -205
- package/src/component/layout/ColorPicker.vue +175 -175
- package/src/component/layout/Gantt.vue +128 -128
- package/src/component/layout/HideShow.vue +61 -61
- package/src/component/layout/IconMolded.vue +58 -58
- package/src/component/layout/IconPicker.vue +161 -161
- package/src/component/layout/NewAccount.vue +136 -136
- package/src/component/layout/NewHeader.vue +59 -59
- package/src/component/layout/NewIconMolded.vue +70 -70
- package/src/component/layout/NewMenu.vue +472 -472
- package/src/component/layout/Tab.vue +259 -259
- package/src/component/layout/Tag.vue +97 -97
- package/src/component/layout/Tooltip.vue +155 -155
- package/src/component/layout/Zoom.vue +111 -111
- package/src/component/rental/DisplayCalculatePeriod.vue +48 -48
- package/src/component/rental/DisplayPeriodRent.vue +55 -55
- package/src/component/rental/DisplayTotalization.vue +86 -86
- package/src/component/report/Fields.vue +108 -108
- package/src/component/report/Report.vue +377 -377
- package/src/component/report/ReportTable.vue +111 -111
- package/src/component/report/Totalization.vue +33 -33
- package/src/component/shared/CodeEditor.vue +128 -128
- package/src/component/shared/Confirmation.vue +74 -74
- package/src/component/shared/DocumentEditor.vue +99 -99
- package/src/component/shared/DocumentPreview.vue +105 -105
- package/src/component/shared/DocumentPublic.vue +33 -33
- package/src/component/shared/ExportExcel.vue +56 -56
- package/src/component/shared/FullCalendar.vue +175 -175
- package/src/component/shared/HeaderReport.vue +47 -47
- package/src/component/shared/ListNotifications.vue +70 -70
- package/src/component/shared/Loading.vue +1 -4
- package/src/component/shared/LoadingCard.vue +64 -64
- package/src/component/shared/ParameterLegend.vue +169 -169
- package/src/component/shared/Report.vue +250 -250
- package/src/component/shared/SaveCancel.vue +99 -117
- package/src/component/shared/SelectOption.vue +162 -162
- package/src/component/shared/TableDraggable.vue +117 -117
- package/src/component/shared/TableImport.vue +93 -93
- package/src/component/shared/TableItem.vue +228 -228
- package/src/component/shared/TableTotalPerPage.vue +114 -114
- package/src/component/shared/TableTotalRecords.vue +44 -44
- package/src/component/shared/TimeLine.vue +41 -41
- package/src/component/shared/Timer.vue +77 -77
- package/src/component/shared/ToggleTheme.vue +127 -127
- package/src/component/shared/TotalizationReport.vue +86 -86
- package/src/component/shared/actions/ActionButtons.vue +53 -53
- package/src/component/shared/actions/ActionErrorContent.vue +103 -103
- package/src/component/shared/actions/ActionFooter.vue +93 -99
- package/src/component/shared/actions/ActionHeader.vue +110 -110
- package/src/component/shared/actions/ActionItemList.vue +143 -143
- package/src/component/shared/actions/ActionsOptions.vue +209 -209
- package/src/component/shared/actions/ActionsSelected.vue +262 -262
- package/src/component/shared/automation/ActivitiesList.vue +43 -43
- package/src/component/shared/automation/AddRule.vue +60 -60
- package/src/component/shared/automation/AutomationBuilder.vue +26 -26
- package/src/component/shared/automation/DynamicComponentList.vue +85 -85
- package/src/component/shared/automation/SelectRule.vue +97 -97
- package/src/component/shared/automation/components/BillingByRent.vue +97 -97
- package/src/component/shared/automation/components/SendEmail.vue +93 -93
- package/src/component/shared/file-manager/FileManager.vue +390 -390
- package/src/component/shared/filter-builder/FilterBuilder.vue +220 -220
- package/src/component/shared/filter-builder/FilterQuery.vue +95 -95
- package/src/component/shared/query-builder/ConvertToOdata.js +86 -86
- package/src/component/shared/query-builder/DynamicComponent.vue +161 -161
- package/src/component/shared/query-builder/Fields.vue +93 -93
- package/src/component/shared/query-builder/Rules.vue +68 -68
- package/src/component/shared/query-builder/SelectRule.vue +97 -97
- package/src/component/shared/query-builder/Tags.vue +59 -59
- package/src/component/signature/Payment.vue +160 -160
- package/src/component/signature/Warning.vue +75 -75
- package/src/component/template/ReportCreateUpdate.vue +110 -110
- package/src/component/template/ViewTemplateDocumentView.vue +213 -213
- package/src/component/template/ViewTemplateImportFile.vue +347 -347
- package/src/component/template/ViewTemplateReportList.vue +240 -240
- package/src/component/template/ViewTemplateReportPreview.vue +521 -521
- package/src/component/template/ViewTemplateSelectOption.vue +46 -46
- package/src/component/template/model/Report.js +5 -5
- package/src/component/training/Course.vue +343 -343
- package/src/component/training/CourseView.vue +198 -198
- package/src/component/value-objects/Address.js +10 -10
- package/src/component/value-objects/Address.vue +173 -173
- package/src/component/value-objects/Contact.js +6 -6
- package/src/component/value-objects/Contact.vue +106 -106
- package/src/component/value-objects/Person.js +10 -10
- package/src/component/value-objects/Person.vue +130 -130
- package/src/store/modules/automation.js +30 -30
- package/src/store/modules/generic.js +15 -1
- package/src/store/modules/report.js +277 -277
- package/src/store/modules/user.js +69 -69
- package/src/store/modules/util.js +25 -25
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
export default class ConvertToOdata {
|
|
2
|
-
convertRule(rule) {
|
|
3
|
-
let operator = rule.operator;
|
|
4
|
-
|
|
5
|
-
if (operator === "igual" && rule.typeField === "text") return `${rule.name} eq '${rule.value}'`;
|
|
6
|
-
if (operator === "diferente" && rule.typeField === "text") return `${rule.name} ne '${rule.value}'`;
|
|
7
|
-
if (operator === "contem") return `contains(${rule.name},'${rule.value}')`;
|
|
8
|
-
|
|
9
|
-
if (operator === "igual" && rule.typeField === "numeric") return `${rule.name} eq ${rule.value}`;
|
|
10
|
-
if (operator === "diferente" && rule.typeField === "numeric") return `${rule.name} ne ${rule.value}`;
|
|
11
|
-
if (operator === "menor") return `${rule.name} lt ${rule.value}`;
|
|
12
|
-
if (operator === "menor ou igual") return `${rule.name} le ${rule.value}`;
|
|
13
|
-
if (operator === "maior") return `${rule.name} gt ${rule.value}`;
|
|
14
|
-
if (operator === "maior ou igual") return `${rule.name} ge ${rule.value}`;
|
|
15
|
-
|
|
16
|
-
if (rule.typeField === "dateTime") return this.convertDateTime(rule);
|
|
17
|
-
if (rule.typeField === "select") return this.convertSelect(rule.name, rule.value);
|
|
18
|
-
if (rule.typeField === "checkbox") return this.convertCheckbox(rule.name, rule.title, rule.type, rule.value);
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
convertDateTime(rule) {
|
|
22
|
-
let start = this.convertDate(rule.value[0]);
|
|
23
|
-
let end = this.convertDate(rule.value[1]);
|
|
24
|
-
|
|
25
|
-
if (rule.name.includes("&")) {
|
|
26
|
-
var parts = rule.name.split("&");
|
|
27
|
-
var first = parts[0];
|
|
28
|
-
var second = parts[1];
|
|
29
|
-
return `${first} ge ${start} and ${second} le ${end}`;
|
|
30
|
-
} else {
|
|
31
|
-
return `${rule.name} ge ${start} and ${rule.name} le ${end}`;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
convertSelect(name, value) {
|
|
35
|
-
return `${name} eq '${value.id}'`;
|
|
36
|
-
}
|
|
37
|
-
convertCheckbox(name, title, type, options) {
|
|
38
|
-
let query = "";
|
|
39
|
-
let seq = 0;
|
|
40
|
-
var size = options.length;
|
|
41
|
-
let self = this;
|
|
42
|
-
options.forEach(function (value) {
|
|
43
|
-
|
|
44
|
-
if (type == "field") {
|
|
45
|
-
query += `${name} eq ${value}`;
|
|
46
|
-
if (seq + 1 != size) query += ` or `;
|
|
47
|
-
}
|
|
48
|
-
if (type == "totalization") {
|
|
49
|
-
|
|
50
|
-
let field = value.split('_').pop();
|
|
51
|
-
field = field.charAt(0).toLowerCase() + field.slice(1);
|
|
52
|
-
|
|
53
|
-
query += `${field} with ${value.split('_')[0]} as ${value.replace(/_/g, '')}`;
|
|
54
|
-
if (seq + 1 != size) query += `,`;
|
|
55
|
-
}
|
|
56
|
-
seq++;
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
if (size > 1 && type == "field") return `(${query})`;
|
|
60
|
-
return `${query}`;
|
|
61
|
-
}
|
|
62
|
-
convertDate(data) {
|
|
63
|
-
// a verificação abaixo valida se tem valor, pois quando não tem está retornando um array com 3 posições em brando
|
|
64
|
-
if (data.length == 3) return;
|
|
65
|
-
|
|
66
|
-
let str = data.replace("/", "").replace("/", "");
|
|
67
|
-
|
|
68
|
-
let date = {
|
|
69
|
-
day: str.substr(0, 2),
|
|
70
|
-
month: str.substr(2, 2),
|
|
71
|
-
year: str.substr(4, 4),
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
var iso = date.year + "-" + date.month + "-" + date.day;
|
|
75
|
-
|
|
76
|
-
/*
|
|
77
|
-
iso += date.day + "T";
|
|
78
|
-
iso += "00:00:00.000Z";
|
|
79
|
-
iso += d.getHours().toString().padStart(2, "0") + ":";
|
|
80
|
-
iso += d.getMinutes().toString().padStart(2, "0") + ":";
|
|
81
|
-
iso += d.getSeconds().toString().padStart(2, "0");
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
return iso;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
1
|
+
export default class ConvertToOdata {
|
|
2
|
+
convertRule(rule) {
|
|
3
|
+
let operator = rule.operator;
|
|
4
|
+
|
|
5
|
+
if (operator === "igual" && rule.typeField === "text") return `${rule.name} eq '${rule.value}'`;
|
|
6
|
+
if (operator === "diferente" && rule.typeField === "text") return `${rule.name} ne '${rule.value}'`;
|
|
7
|
+
if (operator === "contem") return `contains(${rule.name},'${rule.value}')`;
|
|
8
|
+
|
|
9
|
+
if (operator === "igual" && rule.typeField === "numeric") return `${rule.name} eq ${rule.value}`;
|
|
10
|
+
if (operator === "diferente" && rule.typeField === "numeric") return `${rule.name} ne ${rule.value}`;
|
|
11
|
+
if (operator === "menor") return `${rule.name} lt ${rule.value}`;
|
|
12
|
+
if (operator === "menor ou igual") return `${rule.name} le ${rule.value}`;
|
|
13
|
+
if (operator === "maior") return `${rule.name} gt ${rule.value}`;
|
|
14
|
+
if (operator === "maior ou igual") return `${rule.name} ge ${rule.value}`;
|
|
15
|
+
|
|
16
|
+
if (rule.typeField === "dateTime") return this.convertDateTime(rule);
|
|
17
|
+
if (rule.typeField === "select") return this.convertSelect(rule.name, rule.value);
|
|
18
|
+
if (rule.typeField === "checkbox") return this.convertCheckbox(rule.name, rule.title, rule.type, rule.value);
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
convertDateTime(rule) {
|
|
22
|
+
let start = this.convertDate(rule.value[0]);
|
|
23
|
+
let end = this.convertDate(rule.value[1]);
|
|
24
|
+
|
|
25
|
+
if (rule.name.includes("&")) {
|
|
26
|
+
var parts = rule.name.split("&");
|
|
27
|
+
var first = parts[0];
|
|
28
|
+
var second = parts[1];
|
|
29
|
+
return `${first} ge ${start} and ${second} le ${end}`;
|
|
30
|
+
} else {
|
|
31
|
+
return `${rule.name} ge ${start} and ${rule.name} le ${end}`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
convertSelect(name, value) {
|
|
35
|
+
return `${name} eq '${value.id}'`;
|
|
36
|
+
}
|
|
37
|
+
convertCheckbox(name, title, type, options) {
|
|
38
|
+
let query = "";
|
|
39
|
+
let seq = 0;
|
|
40
|
+
var size = options.length;
|
|
41
|
+
let self = this;
|
|
42
|
+
options.forEach(function (value) {
|
|
43
|
+
|
|
44
|
+
if (type == "field") {
|
|
45
|
+
query += `${name} eq ${value}`;
|
|
46
|
+
if (seq + 1 != size) query += ` or `;
|
|
47
|
+
}
|
|
48
|
+
if (type == "totalization") {
|
|
49
|
+
|
|
50
|
+
let field = value.split('_').pop();
|
|
51
|
+
field = field.charAt(0).toLowerCase() + field.slice(1);
|
|
52
|
+
|
|
53
|
+
query += `${field} with ${value.split('_')[0]} as ${value.replace(/_/g, '')}`;
|
|
54
|
+
if (seq + 1 != size) query += `,`;
|
|
55
|
+
}
|
|
56
|
+
seq++;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (size > 1 && type == "field") return `(${query})`;
|
|
60
|
+
return `${query}`;
|
|
61
|
+
}
|
|
62
|
+
convertDate(data) {
|
|
63
|
+
// a verificação abaixo valida se tem valor, pois quando não tem está retornando um array com 3 posições em brando
|
|
64
|
+
if (data.length == 3) return;
|
|
65
|
+
|
|
66
|
+
let str = data.replace("/", "").replace("/", "");
|
|
67
|
+
|
|
68
|
+
let date = {
|
|
69
|
+
day: str.substr(0, 2),
|
|
70
|
+
month: str.substr(2, 2),
|
|
71
|
+
year: str.substr(4, 4),
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var iso = date.year + "-" + date.month + "-" + date.day;
|
|
75
|
+
|
|
76
|
+
/*
|
|
77
|
+
iso += date.day + "T";
|
|
78
|
+
iso += "00:00:00.000Z";
|
|
79
|
+
iso += d.getHours().toString().padStart(2, "0") + ":";
|
|
80
|
+
iso += d.getMinutes().toString().padStart(2, "0") + ":";
|
|
81
|
+
iso += d.getSeconds().toString().padStart(2, "0");
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
return iso;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vqb-rule card move">
|
|
3
|
-
<div class="form-inline">
|
|
4
|
-
<label :class="rule.classCss" class="mr-5">
|
|
5
|
-
<i class="icon-query-builder" :class="rule.icon"></i>
|
|
6
|
-
<span class="title" style="margin-left: 10px">{{ rule.title }} </span>
|
|
7
|
-
</label>
|
|
8
|
-
<div style="margin-right: 20px">
|
|
9
|
-
<RadioGroup v-if="index > 0" :options="[
|
|
10
|
-
{ text: 'e', value: 'and' },
|
|
11
|
-
{ text: 'ou', value: 'or' },
|
|
12
|
-
]" v-model="rule.andOr" />
|
|
13
|
-
</div>
|
|
14
|
-
<select v-if="rule.typeField == 'text' || rule.typeField == 'numeric'" v-model="rule.operator"
|
|
15
|
-
class="select-query-builder form-control mr-2">
|
|
16
|
-
<option v-for="operator in rule.operators" :key="operator">
|
|
17
|
-
<span>{{ operator }}</span>
|
|
18
|
-
</option>
|
|
19
|
-
</select>
|
|
20
|
-
<input v-if="rule.typeField == 'text' || rule.typeField == 'numeric'" class="form-control"
|
|
21
|
-
:type="rule.typeField == 'text' ? 'text' : 'number'" placeholder="Valor" v-model="rule.value" />
|
|
22
|
-
<CheckboxGroup v-if="rule.typeField == 'checkbox'" :options="options" :initialValue="rule.value"
|
|
23
|
-
v-model="rule.value" />
|
|
24
|
-
<div v-if="rule.typeField == 'dateTime'">
|
|
25
|
-
<div class="side-by-side">
|
|
26
|
-
<DateTime :format="rule.props.format" :type="rule.props.type" :range="rule.props.range" v-model="rule.value" />
|
|
27
|
-
</div>
|
|
28
|
-
<div class="side-by-side margin">ou</div>
|
|
29
|
-
<div class="side-by-side margin">
|
|
30
|
-
<select @change="verifyCalculate" v-model="rule.value[2]" class="form-control mr-2">
|
|
31
|
-
<option v-for="period in optionsPeriodCustom" :key="period">
|
|
32
|
-
{{ period }}
|
|
33
|
-
</option>
|
|
34
|
-
</select>
|
|
35
|
-
</div>
|
|
36
|
-
<div v-if="rule.props.filterByField">
|
|
37
|
-
<RadioGroup v-if="rule.props.filterByField" :options="rule.props.filterByField" v-model="rule.name" />
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<Select v-if="rule.typeField == 'select'" :showNewRegister="false" :url="rule.props.url" v-model="rule.value" />
|
|
42
|
-
<div @click="removeRule" class="ml-auto btn-remove">
|
|
43
|
-
<i class="fas fa-times"></i>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</template>
|
|
48
|
-
|
|
49
|
-
<script>
|
|
50
|
-
import DateTime from "@nixweb/nixloc-ui/src/component/forms/DateTime";
|
|
51
|
-
import Select from "@nixweb/nixloc-ui/src/component/forms/Select";
|
|
52
|
-
import CheckboxGroup from "@nixweb/nixloc-ui/src/component/forms/CheckboxGroup";
|
|
53
|
-
import RadioGroup from "@nixweb/nixloc-ui/src/component/forms/RadioGroup.vue";
|
|
54
|
-
|
|
55
|
-
import { mapMutations, mapActions } from "vuex";
|
|
56
|
-
|
|
57
|
-
export default {
|
|
58
|
-
name: "DynamicComponent",
|
|
59
|
-
components: {
|
|
60
|
-
DateTime,
|
|
61
|
-
Select,
|
|
62
|
-
CheckboxGroup,
|
|
63
|
-
RadioGroup,
|
|
64
|
-
},
|
|
65
|
-
props: ["rule", "index"],
|
|
66
|
-
created() {
|
|
67
|
-
if (this.rule.typeField == "dateTime") {
|
|
68
|
-
if (this.rule.value == null) {
|
|
69
|
-
this.rule.value = ["", "", ""];
|
|
70
|
-
} else {
|
|
71
|
-
if (this.rule.value.length == 3) {
|
|
72
|
-
this.verifyCalculate();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
data() {
|
|
78
|
-
return {
|
|
79
|
-
urlCalculate: "/api/v1/rental/period-rent/calculate-period-query-builder",
|
|
80
|
-
optionsPeriodCustom: [
|
|
81
|
-
"hoje",
|
|
82
|
-
"próximos 7 dias",
|
|
83
|
-
"próximos 15 dias",
|
|
84
|
-
"próximos 30 dias",
|
|
85
|
-
"próximos 45 dias",
|
|
86
|
-
"últimos 7 dias",
|
|
87
|
-
"últimos 15 dias",
|
|
88
|
-
"últimos 30 dias",
|
|
89
|
-
"últimos 45 dias",
|
|
90
|
-
],
|
|
91
|
-
};
|
|
92
|
-
},
|
|
93
|
-
methods: {
|
|
94
|
-
...mapMutations("generic", ["addEvent"]),
|
|
95
|
-
...mapMutations("report", ["removeSelectedRule"]),
|
|
96
|
-
...mapActions("generic", ["postApi"]),
|
|
97
|
-
removeRule() {
|
|
98
|
-
this.removeSelectedRule(this.rule.id);
|
|
99
|
-
this.addEvent({
|
|
100
|
-
name: "selectedRuleRemoved",
|
|
101
|
-
data: { id: this.rule.id },
|
|
102
|
-
});
|
|
103
|
-
},
|
|
104
|
-
verifyCalculate() {
|
|
105
|
-
let title = this.rule.value[2];
|
|
106
|
-
if (title == "hoje") this.calculate(0, title);
|
|
107
|
-
if (title == "próximos 7 dias") this.calculate(7, title);
|
|
108
|
-
if (title == "próximos 15 dias") this.calculate(15, title);
|
|
109
|
-
if (title == "próximos 30 dias") this.calculate(30, title);
|
|
110
|
-
if (title == "próximos 45 dias") this.calculate(45, title);
|
|
111
|
-
if (title == "últimos 7 dias") this.calculate(-7, title);
|
|
112
|
-
if (title == "últimos 15 dias") this.calculate(-15, title);
|
|
113
|
-
if (title == "últimos 30 dias") this.calculate(-30, title);
|
|
114
|
-
if (title == "últimos 45 dias") this.calculate(-45, title);
|
|
115
|
-
},
|
|
116
|
-
calculate(days, title) {
|
|
117
|
-
let params = {
|
|
118
|
-
url: this.urlCalculate,
|
|
119
|
-
obj: { days: days },
|
|
120
|
-
notNotifyToast: true,
|
|
121
|
-
};
|
|
122
|
-
this.postApi(params).then((response) => {
|
|
123
|
-
this.rule.value = [];
|
|
124
|
-
this.rule.value[0] = response.content.start;
|
|
125
|
-
this.rule.value[1] = response.content.end;
|
|
126
|
-
this.rule.value[2] = title;
|
|
127
|
-
});
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
computed: {
|
|
131
|
-
options() {
|
|
132
|
-
let options = [];
|
|
133
|
-
this.rule.options.forEach((item) => {
|
|
134
|
-
let option = { text: item.title, value: item.value };
|
|
135
|
-
options.push(option);
|
|
136
|
-
});
|
|
137
|
-
return options;
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
</script>
|
|
142
|
-
<style scoped>
|
|
143
|
-
.move {
|
|
144
|
-
cursor: move;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.btn-remove {
|
|
148
|
-
font-size: 16px;
|
|
149
|
-
color: darkgray;
|
|
150
|
-
cursor: pointer;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.div-select {
|
|
154
|
-
width: 330px;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.margin {
|
|
158
|
-
margin-left: 30px;
|
|
159
|
-
padding: 10px;
|
|
160
|
-
}
|
|
161
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vqb-rule card move">
|
|
3
|
+
<div class="form-inline">
|
|
4
|
+
<label :class="rule.classCss" class="mr-5">
|
|
5
|
+
<i class="icon-query-builder" :class="rule.icon"></i>
|
|
6
|
+
<span class="title" style="margin-left: 10px">{{ rule.title }} </span>
|
|
7
|
+
</label>
|
|
8
|
+
<div style="margin-right: 20px">
|
|
9
|
+
<RadioGroup v-if="index > 0" :options="[
|
|
10
|
+
{ text: 'e', value: 'and' },
|
|
11
|
+
{ text: 'ou', value: 'or' },
|
|
12
|
+
]" v-model="rule.andOr" />
|
|
13
|
+
</div>
|
|
14
|
+
<select v-if="rule.typeField == 'text' || rule.typeField == 'numeric'" v-model="rule.operator"
|
|
15
|
+
class="select-query-builder form-control mr-2">
|
|
16
|
+
<option v-for="operator in rule.operators" :key="operator">
|
|
17
|
+
<span>{{ operator }}</span>
|
|
18
|
+
</option>
|
|
19
|
+
</select>
|
|
20
|
+
<input v-if="rule.typeField == 'text' || rule.typeField == 'numeric'" class="form-control"
|
|
21
|
+
:type="rule.typeField == 'text' ? 'text' : 'number'" placeholder="Valor" v-model="rule.value" />
|
|
22
|
+
<CheckboxGroup v-if="rule.typeField == 'checkbox'" :options="options" :initialValue="rule.value"
|
|
23
|
+
v-model="rule.value" />
|
|
24
|
+
<div v-if="rule.typeField == 'dateTime'">
|
|
25
|
+
<div class="side-by-side">
|
|
26
|
+
<DateTime :format="rule.props.format" :type="rule.props.type" :range="rule.props.range" v-model="rule.value" />
|
|
27
|
+
</div>
|
|
28
|
+
<div class="side-by-side margin">ou</div>
|
|
29
|
+
<div class="side-by-side margin">
|
|
30
|
+
<select @change="verifyCalculate" v-model="rule.value[2]" class="form-control mr-2">
|
|
31
|
+
<option v-for="period in optionsPeriodCustom" :key="period">
|
|
32
|
+
{{ period }}
|
|
33
|
+
</option>
|
|
34
|
+
</select>
|
|
35
|
+
</div>
|
|
36
|
+
<div v-if="rule.props.filterByField">
|
|
37
|
+
<RadioGroup v-if="rule.props.filterByField" :options="rule.props.filterByField" v-model="rule.name" />
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<Select v-if="rule.typeField == 'select'" :showNewRegister="false" :url="rule.props.url" v-model="rule.value" />
|
|
42
|
+
<div @click="removeRule" class="ml-auto btn-remove">
|
|
43
|
+
<i class="fas fa-times"></i>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script>
|
|
50
|
+
import DateTime from "@nixweb/nixloc-ui/src/component/forms/DateTime";
|
|
51
|
+
import Select from "@nixweb/nixloc-ui/src/component/forms/Select";
|
|
52
|
+
import CheckboxGroup from "@nixweb/nixloc-ui/src/component/forms/CheckboxGroup";
|
|
53
|
+
import RadioGroup from "@nixweb/nixloc-ui/src/component/forms/RadioGroup.vue";
|
|
54
|
+
|
|
55
|
+
import { mapMutations, mapActions } from "vuex";
|
|
56
|
+
|
|
57
|
+
export default {
|
|
58
|
+
name: "DynamicComponent",
|
|
59
|
+
components: {
|
|
60
|
+
DateTime,
|
|
61
|
+
Select,
|
|
62
|
+
CheckboxGroup,
|
|
63
|
+
RadioGroup,
|
|
64
|
+
},
|
|
65
|
+
props: ["rule", "index"],
|
|
66
|
+
created() {
|
|
67
|
+
if (this.rule.typeField == "dateTime") {
|
|
68
|
+
if (this.rule.value == null) {
|
|
69
|
+
this.rule.value = ["", "", ""];
|
|
70
|
+
} else {
|
|
71
|
+
if (this.rule.value.length == 3) {
|
|
72
|
+
this.verifyCalculate();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
data() {
|
|
78
|
+
return {
|
|
79
|
+
urlCalculate: "/api/v1/rental/period-rent/calculate-period-query-builder",
|
|
80
|
+
optionsPeriodCustom: [
|
|
81
|
+
"hoje",
|
|
82
|
+
"próximos 7 dias",
|
|
83
|
+
"próximos 15 dias",
|
|
84
|
+
"próximos 30 dias",
|
|
85
|
+
"próximos 45 dias",
|
|
86
|
+
"últimos 7 dias",
|
|
87
|
+
"últimos 15 dias",
|
|
88
|
+
"últimos 30 dias",
|
|
89
|
+
"últimos 45 dias",
|
|
90
|
+
],
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
methods: {
|
|
94
|
+
...mapMutations("generic", ["addEvent"]),
|
|
95
|
+
...mapMutations("report", ["removeSelectedRule"]),
|
|
96
|
+
...mapActions("generic", ["postApi"]),
|
|
97
|
+
removeRule() {
|
|
98
|
+
this.removeSelectedRule(this.rule.id);
|
|
99
|
+
this.addEvent({
|
|
100
|
+
name: "selectedRuleRemoved",
|
|
101
|
+
data: { id: this.rule.id },
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
verifyCalculate() {
|
|
105
|
+
let title = this.rule.value[2];
|
|
106
|
+
if (title == "hoje") this.calculate(0, title);
|
|
107
|
+
if (title == "próximos 7 dias") this.calculate(7, title);
|
|
108
|
+
if (title == "próximos 15 dias") this.calculate(15, title);
|
|
109
|
+
if (title == "próximos 30 dias") this.calculate(30, title);
|
|
110
|
+
if (title == "próximos 45 dias") this.calculate(45, title);
|
|
111
|
+
if (title == "últimos 7 dias") this.calculate(-7, title);
|
|
112
|
+
if (title == "últimos 15 dias") this.calculate(-15, title);
|
|
113
|
+
if (title == "últimos 30 dias") this.calculate(-30, title);
|
|
114
|
+
if (title == "últimos 45 dias") this.calculate(-45, title);
|
|
115
|
+
},
|
|
116
|
+
calculate(days, title) {
|
|
117
|
+
let params = {
|
|
118
|
+
url: this.urlCalculate,
|
|
119
|
+
obj: { days: days },
|
|
120
|
+
notNotifyToast: true,
|
|
121
|
+
};
|
|
122
|
+
this.postApi(params).then((response) => {
|
|
123
|
+
this.rule.value = [];
|
|
124
|
+
this.rule.value[0] = response.content.start;
|
|
125
|
+
this.rule.value[1] = response.content.end;
|
|
126
|
+
this.rule.value[2] = title;
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
computed: {
|
|
131
|
+
options() {
|
|
132
|
+
let options = [];
|
|
133
|
+
this.rule.options.forEach((item) => {
|
|
134
|
+
let option = { text: item.title, value: item.value };
|
|
135
|
+
options.push(option);
|
|
136
|
+
});
|
|
137
|
+
return options;
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
</script>
|
|
142
|
+
<style scoped>
|
|
143
|
+
.move {
|
|
144
|
+
cursor: move;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.btn-remove {
|
|
148
|
+
font-size: 16px;
|
|
149
|
+
color: darkgray;
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.div-select {
|
|
154
|
+
width: 330px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.margin {
|
|
158
|
+
margin-left: 30px;
|
|
159
|
+
padding: 10px;
|
|
160
|
+
}
|
|
161
|
+
</style>
|