@nixweb/nixloc-ui 1.19.0 → 1.21.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.
Files changed (110) hide show
  1. package/package.json +1 -1
  2. package/src/component/forms/ButtonFilter.vue +104 -104
  3. package/src/component/forms/ButtonGroup.vue +66 -66
  4. package/src/component/forms/ButtonGroupInline.vue +210 -210
  5. package/src/component/forms/ButtonSub.vue +97 -97
  6. package/src/component/forms/ButtonToggle.vue +76 -76
  7. package/src/component/forms/DateYearMonth.vue +192 -192
  8. package/src/component/forms/ImageUpload.vue +214 -214
  9. package/src/component/forms/IncrementDecrement.vue +151 -151
  10. package/src/component/forms/InputAddressGoogle.vue +171 -171
  11. package/src/component/forms/InputCallToAction.vue +135 -135
  12. package/src/component/forms/InputDecimalDiscount.vue +146 -146
  13. package/src/component/forms/InputTag.vue +124 -124
  14. package/src/component/forms/InputTextEdit.vue +69 -69
  15. package/src/component/forms/InputWhatsApp.vue +47 -47
  16. package/src/component/forms/SideBar.vue +99 -99
  17. package/src/component/forms/Toggle.vue +72 -72
  18. package/src/component/layout/Account.vue +131 -131
  19. package/src/component/layout/AnimatedPhrase.vue +68 -68
  20. package/src/component/layout/BarFloating.vue +67 -67
  21. package/src/component/layout/BottomActionsBar.vue +205 -205
  22. package/src/component/layout/ColorPicker.vue +175 -175
  23. package/src/component/layout/Gantt.vue +128 -128
  24. package/src/component/layout/HideShow.vue +61 -61
  25. package/src/component/layout/IconMolded.vue +58 -58
  26. package/src/component/layout/IconPicker.vue +161 -161
  27. package/src/component/layout/NewAccount.vue +136 -136
  28. package/src/component/layout/NewHeader.vue +59 -59
  29. package/src/component/layout/NewIconMolded.vue +70 -70
  30. package/src/component/layout/NewMenu.vue +472 -472
  31. package/src/component/layout/Tab.vue +259 -259
  32. package/src/component/layout/Tag.vue +97 -97
  33. package/src/component/layout/Tooltip.vue +155 -155
  34. package/src/component/layout/Zoom.vue +111 -111
  35. package/src/component/rental/DisplayCalculatePeriod.vue +48 -48
  36. package/src/component/rental/DisplayPeriodRent.vue +55 -55
  37. package/src/component/rental/DisplayTotalization.vue +86 -86
  38. package/src/component/report/Fields.vue +108 -108
  39. package/src/component/report/Report.vue +377 -377
  40. package/src/component/report/ReportTable.vue +111 -111
  41. package/src/component/report/Totalization.vue +33 -33
  42. package/src/component/shared/CodeEditor.vue +128 -128
  43. package/src/component/shared/Confirmation.vue +74 -74
  44. package/src/component/shared/DocumentEditor.vue +99 -99
  45. package/src/component/shared/DocumentPreview.vue +117 -105
  46. package/src/component/shared/DocumentPublic.vue +33 -33
  47. package/src/component/shared/ExportExcel.vue +56 -56
  48. package/src/component/shared/FullCalendar.vue +175 -175
  49. package/src/component/shared/HeaderReport.vue +47 -47
  50. package/src/component/shared/ListNotifications.vue +70 -70
  51. package/src/component/shared/Loading.vue +1 -4
  52. package/src/component/shared/LoadingCard.vue +64 -64
  53. package/src/component/shared/ParameterLegend.vue +169 -169
  54. package/src/component/shared/Report.vue +250 -250
  55. package/src/component/shared/SaveCancel.vue +99 -117
  56. package/src/component/shared/SelectOption.vue +162 -162
  57. package/src/component/shared/TableDraggable.vue +117 -117
  58. package/src/component/shared/TableImport.vue +93 -93
  59. package/src/component/shared/TableItem.vue +228 -228
  60. package/src/component/shared/TableTotalPerPage.vue +114 -114
  61. package/src/component/shared/TableTotalRecords.vue +44 -44
  62. package/src/component/shared/TimeLine.vue +41 -41
  63. package/src/component/shared/Timer.vue +77 -77
  64. package/src/component/shared/ToggleTheme.vue +127 -127
  65. package/src/component/shared/TotalizationReport.vue +86 -86
  66. package/src/component/shared/actions/ActionButtons.vue +53 -53
  67. package/src/component/shared/actions/ActionErrorContent.vue +103 -103
  68. package/src/component/shared/actions/ActionFooter.vue +93 -99
  69. package/src/component/shared/actions/ActionHeader.vue +110 -110
  70. package/src/component/shared/actions/ActionItemList.vue +143 -143
  71. package/src/component/shared/actions/ActionsOptions.vue +209 -209
  72. package/src/component/shared/actions/ActionsSelected.vue +262 -262
  73. package/src/component/shared/automation/ActivitiesList.vue +43 -43
  74. package/src/component/shared/automation/AddRule.vue +60 -60
  75. package/src/component/shared/automation/AutomationBuilder.vue +26 -26
  76. package/src/component/shared/automation/DynamicComponentList.vue +85 -85
  77. package/src/component/shared/automation/SelectRule.vue +97 -97
  78. package/src/component/shared/automation/components/BillingByRent.vue +97 -97
  79. package/src/component/shared/automation/components/SendEmail.vue +93 -93
  80. package/src/component/shared/file-manager/FileManager.vue +390 -390
  81. package/src/component/shared/filter-builder/FilterBuilder.vue +220 -220
  82. package/src/component/shared/filter-builder/FilterQuery.vue +95 -95
  83. package/src/component/shared/query-builder/ConvertToOdata.js +86 -86
  84. package/src/component/shared/query-builder/DynamicComponent.vue +161 -161
  85. package/src/component/shared/query-builder/Fields.vue +93 -93
  86. package/src/component/shared/query-builder/Rules.vue +68 -68
  87. package/src/component/shared/query-builder/SelectRule.vue +97 -97
  88. package/src/component/shared/query-builder/Tags.vue +59 -59
  89. package/src/component/signature/Payment.vue +160 -160
  90. package/src/component/signature/Warning.vue +75 -75
  91. package/src/component/template/ReportCreateUpdate.vue +110 -110
  92. package/src/component/template/ViewTemplateDocumentView.vue +213 -213
  93. package/src/component/template/ViewTemplateImportFile.vue +347 -347
  94. package/src/component/template/ViewTemplateReportList.vue +240 -240
  95. package/src/component/template/ViewTemplateReportPreview.vue +521 -521
  96. package/src/component/template/ViewTemplateSelectOption.vue +46 -46
  97. package/src/component/template/model/Report.js +5 -5
  98. package/src/component/training/Course.vue +343 -343
  99. package/src/component/training/CourseView.vue +198 -198
  100. package/src/component/value-objects/Address.js +10 -10
  101. package/src/component/value-objects/Address.vue +173 -173
  102. package/src/component/value-objects/Contact.js +6 -6
  103. package/src/component/value-objects/Contact.vue +106 -106
  104. package/src/component/value-objects/Person.js +10 -10
  105. package/src/component/value-objects/Person.vue +130 -130
  106. package/src/store/modules/automation.js +30 -30
  107. package/src/store/modules/generic.js +16 -6
  108. package/src/store/modules/report.js +277 -277
  109. package/src/store/modules/user.js +69 -69
  110. package/src/store/modules/util.js +25 -25
@@ -1,175 +1,175 @@
1
- <template>
2
- <div class="color-picker" ref="root">
3
- <div v-if="title" class="color-picker__title">{{ title }}</div>
4
-
5
- <div class="color-picker__trigger" :style="{ backgroundColor: innerValue }" role="button" tabindex="0"
6
- @click="toggle()" @keydown.enter.prevent="toggle()" @keydown.space.prevent="toggle()"
7
- aria-haspopup="listbox" :aria-expanded="open ? 'true' : 'false'"></div>
8
-
9
- <transition name="color-picker--fade">
10
- <div v-show="open" class="color-picker__menu" role="listbox" :aria-label="title || 'Escolher cor'">
11
- <div class="color-picker__grid">
12
- <div v-for="c in colors" :key="c" class="color-picker__item" :style="{ backgroundColor: c }"
13
- role="option" :aria-selected="c === innerValue ? 'true' : 'false'" tabindex="0"
14
- @click="choose(c)" @keydown.enter.prevent="choose(c)" @keydown.space.prevent="choose(c)">
15
- <span v-if="c === innerValue" class="color-picker__check"></span>
16
- </div>
17
- </div>
18
- </div>
19
- </transition>
20
- </div>
21
- </template>
22
-
23
- <script>
24
- export default {
25
- name: "ColorPicker",
26
- model: { prop: "value", event: "input" },
27
- props: {
28
- value: { type: String, default: "" },
29
- defaultColor: { type: String, default: "#64B5F6" },
30
- title: { type: String, default: "" },
31
- colors: {
32
- type: Array,
33
- default: function () {
34
- return [
35
- "#E57373", "#F06292", "#FF6F61",
36
- "#BA68C8", "#9575CD", "#8E24AA",
37
- "#64B5F6", "#4FC3F7", "#3949AB",
38
- "#039BE5", "#1976D2", "#1E88E5",
39
- "#4DB6AC", "#81C784", "#AED581",
40
- "#26A69A", "#2E7D32", "#0097A7",
41
- "#7CB342", "#C0CA33", "#9CCC65",
42
- "#FFD54F", "#FFB74D", "#FDD835",
43
- "#FB8C00", "#FF8A65", "#F4511E",
44
- "#A1887F", "#6D4C41", "#795548",
45
- "#90A4AE", "#546E7A", "#9E9E9E",
46
- "#000000", "#FFFFFF", "#B0BEC5"
47
- ];
48
- },
49
- },
50
- },
51
- data() {
52
- return { innerValue: "", open: false };
53
- },
54
- created() {
55
- this.initialize();
56
- },
57
- watch: {
58
- value(v) {
59
- if (this.isEmpty(v)) {
60
- const fallback = this.normalizeHex(this.defaultColor);
61
- this.innerValue = fallback;
62
- this.$emit("input", fallback);
63
- } else if (v !== this.innerValue) {
64
- this.innerValue = this.normalizeHex(v);
65
- }
66
- }
67
- },
68
- mounted() {
69
- document.addEventListener("click", this.onClickOutside, { passive: true });
70
- },
71
- beforeDestroy() {
72
- document.removeEventListener("click", this.onClickOutside);
73
- },
74
- methods: {
75
- initialize() {
76
- const start = this.isEmpty(this.value)
77
- ? this.normalizeHex(this.defaultColor)
78
- : this.normalizeHex(this.value);
79
- this.innerValue = start;
80
- if (this.isEmpty(this.value)) this.$emit("input", start);
81
- },
82
- isEmpty(v) {
83
- return v === null || v === undefined || String(v).trim() === "";
84
- },
85
- normalizeHex(v) {
86
- const s = String(v || "").trim().toUpperCase();
87
- const hex = /^#([0-9A-F]{6}|[0-9A-F]{3})$/i;
88
- return hex.test(s) ? s : "#64B5F6";
89
- },
90
- toggle() { this.open = !this.open; },
91
- close() { this.open = false; },
92
- choose(c) {
93
- const val = this.normalizeHex(c);
94
- this.innerValue = val;
95
- this.$emit("input", val);
96
- this.close();
97
- },
98
- onClickOutside(e) {
99
- const root = this.$refs.root;
100
- if (this.open && root && !root.contains(e.target)) this.close();
101
- },
102
- },
103
- };
104
- </script>
105
-
106
- <style scoped>
107
- .color-picker {
108
- position: relative;
109
- display: inline-grid;
110
- gap: .375rem;
111
- }
112
-
113
- .color-picker__title {
114
- font-weight: 500;
115
- }
116
-
117
- .color-picker__trigger {
118
- width: 22px;
119
- height: 22px;
120
- border-radius: 50%;
121
- cursor: pointer;
122
- user-select: none;
123
- }
124
-
125
- .color-picker__menu {
126
- position: absolute;
127
- z-index: 40;
128
- top: calc(100% + 8px);
129
- left: 0;
130
- min-width: 400px;
131
- max-width: 90vw;
132
- background: #fff;
133
- border: 1px solid #e5e7eb;
134
- border-radius: 10px;
135
- box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
136
- padding: .5rem;
137
- }
138
-
139
- .color-picker__grid {
140
- display: grid;
141
- grid-template-columns: repeat(12, 28px);
142
- gap: .5rem;
143
- }
144
-
145
- .color-picker__item {
146
- width: 28px;
147
- height: 28px;
148
- border-radius: 50%;
149
- cursor: pointer;
150
- position: relative;
151
- border: 1px solid rgba(0, 0, 0, .1);
152
- }
153
-
154
- .color-picker__check {
155
- position: absolute;
156
- width: 10px;
157
- height: 10px;
158
- background: white;
159
- border-radius: 50%;
160
- top: 50%;
161
- left: 50%;
162
- transform: translate(-50%, -50%);
163
- }
164
-
165
- .color-picker--fade-enter-active,
166
- .color-picker--fade-leave-active {
167
- transition: all .14s ease;
168
- }
169
-
170
- .color-picker--fade-enter,
171
- .color-picker--fade-leave-to {
172
- opacity: 0;
173
- transform: translateY(-4px) scale(.98);
174
- }
175
- </style>
1
+ <template>
2
+ <div class="color-picker" ref="root">
3
+ <div v-if="title" class="color-picker__title">{{ title }}</div>
4
+
5
+ <div class="color-picker__trigger" :style="{ backgroundColor: innerValue }" role="button" tabindex="0"
6
+ @click="toggle()" @keydown.enter.prevent="toggle()" @keydown.space.prevent="toggle()"
7
+ aria-haspopup="listbox" :aria-expanded="open ? 'true' : 'false'"></div>
8
+
9
+ <transition name="color-picker--fade">
10
+ <div v-show="open" class="color-picker__menu" role="listbox" :aria-label="title || 'Escolher cor'">
11
+ <div class="color-picker__grid">
12
+ <div v-for="c in colors" :key="c" class="color-picker__item" :style="{ backgroundColor: c }"
13
+ role="option" :aria-selected="c === innerValue ? 'true' : 'false'" tabindex="0"
14
+ @click="choose(c)" @keydown.enter.prevent="choose(c)" @keydown.space.prevent="choose(c)">
15
+ <span v-if="c === innerValue" class="color-picker__check"></span>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </transition>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+ export default {
25
+ name: "ColorPicker",
26
+ model: { prop: "value", event: "input" },
27
+ props: {
28
+ value: { type: String, default: "" },
29
+ defaultColor: { type: String, default: "#64B5F6" },
30
+ title: { type: String, default: "" },
31
+ colors: {
32
+ type: Array,
33
+ default: function () {
34
+ return [
35
+ "#E57373", "#F06292", "#FF6F61",
36
+ "#BA68C8", "#9575CD", "#8E24AA",
37
+ "#64B5F6", "#4FC3F7", "#3949AB",
38
+ "#039BE5", "#1976D2", "#1E88E5",
39
+ "#4DB6AC", "#81C784", "#AED581",
40
+ "#26A69A", "#2E7D32", "#0097A7",
41
+ "#7CB342", "#C0CA33", "#9CCC65",
42
+ "#FFD54F", "#FFB74D", "#FDD835",
43
+ "#FB8C00", "#FF8A65", "#F4511E",
44
+ "#A1887F", "#6D4C41", "#795548",
45
+ "#90A4AE", "#546E7A", "#9E9E9E",
46
+ "#000000", "#FFFFFF", "#B0BEC5"
47
+ ];
48
+ },
49
+ },
50
+ },
51
+ data() {
52
+ return { innerValue: "", open: false };
53
+ },
54
+ created() {
55
+ this.initialize();
56
+ },
57
+ watch: {
58
+ value(v) {
59
+ if (this.isEmpty(v)) {
60
+ const fallback = this.normalizeHex(this.defaultColor);
61
+ this.innerValue = fallback;
62
+ this.$emit("input", fallback);
63
+ } else if (v !== this.innerValue) {
64
+ this.innerValue = this.normalizeHex(v);
65
+ }
66
+ }
67
+ },
68
+ mounted() {
69
+ document.addEventListener("click", this.onClickOutside, { passive: true });
70
+ },
71
+ beforeDestroy() {
72
+ document.removeEventListener("click", this.onClickOutside);
73
+ },
74
+ methods: {
75
+ initialize() {
76
+ const start = this.isEmpty(this.value)
77
+ ? this.normalizeHex(this.defaultColor)
78
+ : this.normalizeHex(this.value);
79
+ this.innerValue = start;
80
+ if (this.isEmpty(this.value)) this.$emit("input", start);
81
+ },
82
+ isEmpty(v) {
83
+ return v === null || v === undefined || String(v).trim() === "";
84
+ },
85
+ normalizeHex(v) {
86
+ const s = String(v || "").trim().toUpperCase();
87
+ const hex = /^#([0-9A-F]{6}|[0-9A-F]{3})$/i;
88
+ return hex.test(s) ? s : "#64B5F6";
89
+ },
90
+ toggle() { this.open = !this.open; },
91
+ close() { this.open = false; },
92
+ choose(c) {
93
+ const val = this.normalizeHex(c);
94
+ this.innerValue = val;
95
+ this.$emit("input", val);
96
+ this.close();
97
+ },
98
+ onClickOutside(e) {
99
+ const root = this.$refs.root;
100
+ if (this.open && root && !root.contains(e.target)) this.close();
101
+ },
102
+ },
103
+ };
104
+ </script>
105
+
106
+ <style scoped>
107
+ .color-picker {
108
+ position: relative;
109
+ display: inline-grid;
110
+ gap: .375rem;
111
+ }
112
+
113
+ .color-picker__title {
114
+ font-weight: 500;
115
+ }
116
+
117
+ .color-picker__trigger {
118
+ width: 22px;
119
+ height: 22px;
120
+ border-radius: 50%;
121
+ cursor: pointer;
122
+ user-select: none;
123
+ }
124
+
125
+ .color-picker__menu {
126
+ position: absolute;
127
+ z-index: 40;
128
+ top: calc(100% + 8px);
129
+ left: 0;
130
+ min-width: 400px;
131
+ max-width: 90vw;
132
+ background: #fff;
133
+ border: 1px solid #e5e7eb;
134
+ border-radius: 10px;
135
+ box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
136
+ padding: .5rem;
137
+ }
138
+
139
+ .color-picker__grid {
140
+ display: grid;
141
+ grid-template-columns: repeat(12, 28px);
142
+ gap: .5rem;
143
+ }
144
+
145
+ .color-picker__item {
146
+ width: 28px;
147
+ height: 28px;
148
+ border-radius: 50%;
149
+ cursor: pointer;
150
+ position: relative;
151
+ border: 1px solid rgba(0, 0, 0, .1);
152
+ }
153
+
154
+ .color-picker__check {
155
+ position: absolute;
156
+ width: 10px;
157
+ height: 10px;
158
+ background: white;
159
+ border-radius: 50%;
160
+ top: 50%;
161
+ left: 50%;
162
+ transform: translate(-50%, -50%);
163
+ }
164
+
165
+ .color-picker--fade-enter-active,
166
+ .color-picker--fade-leave-active {
167
+ transition: all .14s ease;
168
+ }
169
+
170
+ .color-picker--fade-enter,
171
+ .color-picker--fade-leave-to {
172
+ opacity: 0;
173
+ transform: translateY(-4px) scale(.98);
174
+ }
175
+ </style>
@@ -1,128 +1,128 @@
1
- <template>
2
- <div>
3
- <div v-if="tasks.length > 0">
4
- <ButtonGroup :initialOption="initialOption" :options="options" />
5
- <slot></slot>
6
- <div class="gantt">
7
- <svg ref="gantt" />
8
- </div>
9
- </div>
10
- <div v-else>
11
- Nenhum registro encontrado!
12
- </div>
13
- </div>
14
- </template>
15
-
16
- <script>
17
- import ButtonGroup from "@nixweb/nixloc-ui/src/component/forms/ButtonGroup";
18
-
19
- import { mapGetters } from "vuex";
20
-
21
- export default {
22
- name: "FrappeGantt",
23
- components: {
24
- ButtonGroup,
25
- },
26
- props: {
27
- initialOption: String,
28
- options: Array,
29
- tasks: Array,
30
- },
31
- data() {
32
- return {
33
- gantt: {},
34
- mode: "day",
35
- viewMode: "",
36
- };
37
- },
38
- mounted() {
39
- this.setupGanttChart();
40
- },
41
- computed: {
42
- ...mapGetters("generic", ["event"]),
43
- },
44
- methods: {
45
- setupGanttChart() {
46
- this.gantt = new Gantt(this.$refs.gantt, this.tasks, {
47
- language: "ptBr",
48
- date_format: "YYYY-MM-DD",
49
- bar_corner_radius: 10,
50
- on_click: (task) => {
51
- this.$emit("task-updated", task);
52
- },
53
- on_date_change: (task, start, end) => {
54
- this.$emit("task-date-updated", { task, start, end });
55
- },
56
- on_progress_change: (task, progress) => {
57
- this.$emit("task-progress-updated", { task, progress });
58
- },
59
- //I doubt you will ever need this as the developer already knows what view mode they set.
60
- on_view_change: (mode) => {
61
- this.$emit("view-mode-updated", mode);
62
- },
63
- custom_popup_html: function (task) {
64
- return `
65
- <div class="details-container">
66
- <p class="title-details">Nº: ${task.number}</p>
67
- <p class="title-details">${task.customer ?? ""}</p>
68
- <p class="title-details">Quantidade: ${task.name}</p>
69
- <p class="title-details">${task.periodRentName}</p>
70
- </div>
71
- `;
72
- },
73
- });
74
- this.updateTasks();
75
- this.updateViewMode();
76
- },
77
-
78
- updateViewMode() {
79
- this.gantt.change_view_mode(
80
- this.viewMode[0].toUpperCase() + this.viewMode.substring(1)
81
- );
82
- },
83
- updateTasks() {
84
- this.gantt.refresh(this.tasks);
85
- },
86
- demoViewMode(viewMode) {
87
- this.mode = viewMode;
88
- this.viewMode = viewMode;
89
- },
90
- },
91
- watch: {
92
- viewMode() {
93
- this.updateViewMode();
94
- },
95
- tasks() {
96
- this.updateTasks();
97
- },
98
- event: {
99
- handler(event) {
100
- if (event.name == "demoViewMode") {
101
- if (event.data.title == "Dia") this.demoViewMode("day");
102
- if (event.data.title == "Semana") this.demoViewMode("week");
103
- if (event.data.title == "Mês") this.demoViewMode("month");
104
- }
105
- },
106
- deep: true,
107
- },
108
- },
109
- };
110
- </script>
111
- <style>
112
- .gantt {
113
- margin-top: 10px;
114
- }
115
-
116
- .details-container {
117
- background-color: white;
118
- width: 400px;
119
- padding: 10px;
120
- border: 1px solid #eaedf3;
121
- color: black;
122
- box-shadow: 0px 10px 20px -6px rgb(0 0 0 / 3%);
123
- }
124
-
125
- .title-details {
126
- font-size: 14px;
127
- }
128
- </style>
1
+ <template>
2
+ <div>
3
+ <div v-if="tasks.length > 0">
4
+ <ButtonGroup :initialOption="initialOption" :options="options" />
5
+ <slot></slot>
6
+ <div class="gantt">
7
+ <svg ref="gantt" />
8
+ </div>
9
+ </div>
10
+ <div v-else>
11
+ Nenhum registro encontrado!
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ import ButtonGroup from "@nixweb/nixloc-ui/src/component/forms/ButtonGroup";
18
+
19
+ import { mapGetters } from "vuex";
20
+
21
+ export default {
22
+ name: "FrappeGantt",
23
+ components: {
24
+ ButtonGroup,
25
+ },
26
+ props: {
27
+ initialOption: String,
28
+ options: Array,
29
+ tasks: Array,
30
+ },
31
+ data() {
32
+ return {
33
+ gantt: {},
34
+ mode: "day",
35
+ viewMode: "",
36
+ };
37
+ },
38
+ mounted() {
39
+ this.setupGanttChart();
40
+ },
41
+ computed: {
42
+ ...mapGetters("generic", ["event"]),
43
+ },
44
+ methods: {
45
+ setupGanttChart() {
46
+ this.gantt = new Gantt(this.$refs.gantt, this.tasks, {
47
+ language: "ptBr",
48
+ date_format: "YYYY-MM-DD",
49
+ bar_corner_radius: 10,
50
+ on_click: (task) => {
51
+ this.$emit("task-updated", task);
52
+ },
53
+ on_date_change: (task, start, end) => {
54
+ this.$emit("task-date-updated", { task, start, end });
55
+ },
56
+ on_progress_change: (task, progress) => {
57
+ this.$emit("task-progress-updated", { task, progress });
58
+ },
59
+ //I doubt you will ever need this as the developer already knows what view mode they set.
60
+ on_view_change: (mode) => {
61
+ this.$emit("view-mode-updated", mode);
62
+ },
63
+ custom_popup_html: function (task) {
64
+ return `
65
+ <div class="details-container">
66
+ <p class="title-details">Nº: ${task.number}</p>
67
+ <p class="title-details">${task.customer ?? ""}</p>
68
+ <p class="title-details">Quantidade: ${task.name}</p>
69
+ <p class="title-details">${task.periodRentName}</p>
70
+ </div>
71
+ `;
72
+ },
73
+ });
74
+ this.updateTasks();
75
+ this.updateViewMode();
76
+ },
77
+
78
+ updateViewMode() {
79
+ this.gantt.change_view_mode(
80
+ this.viewMode[0].toUpperCase() + this.viewMode.substring(1)
81
+ );
82
+ },
83
+ updateTasks() {
84
+ this.gantt.refresh(this.tasks);
85
+ },
86
+ demoViewMode(viewMode) {
87
+ this.mode = viewMode;
88
+ this.viewMode = viewMode;
89
+ },
90
+ },
91
+ watch: {
92
+ viewMode() {
93
+ this.updateViewMode();
94
+ },
95
+ tasks() {
96
+ this.updateTasks();
97
+ },
98
+ event: {
99
+ handler(event) {
100
+ if (event.name == "demoViewMode") {
101
+ if (event.data.title == "Dia") this.demoViewMode("day");
102
+ if (event.data.title == "Semana") this.demoViewMode("week");
103
+ if (event.data.title == "Mês") this.demoViewMode("month");
104
+ }
105
+ },
106
+ deep: true,
107
+ },
108
+ },
109
+ };
110
+ </script>
111
+ <style>
112
+ .gantt {
113
+ margin-top: 10px;
114
+ }
115
+
116
+ .details-container {
117
+ background-color: white;
118
+ width: 400px;
119
+ padding: 10px;
120
+ border: 1px solid #eaedf3;
121
+ color: black;
122
+ box-shadow: 0px 10px 20px -6px rgb(0 0 0 / 3%);
123
+ }
124
+
125
+ .title-details {
126
+ font-size: 14px;
127
+ }
128
+ </style>