django-smartbase-admin 1.0.6b3__py3-none-any.whl → 1.0.7__py3-none-any.whl
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.
- django_smartbase_admin/actions/admin_action_list.py +4 -1
- django_smartbase_admin/engine/admin_base_view.py +4 -1
- django_smartbase_admin/engine/const.py +1 -0
- django_smartbase_admin/engine/dashboard.py +10 -5
- django_smartbase_admin/engine/filter_widgets.py +26 -1
- django_smartbase_admin/static/sb_admin/build/webpack.common.js +2 -0
- django_smartbase_admin/static/sb_admin/dist/calendar.js +1 -0
- django_smartbase_admin/static/sb_admin/dist/calendar_style.css +1 -0
- django_smartbase_admin/static/sb_admin/dist/calendar_style.js +0 -0
- django_smartbase_admin/static/sb_admin/dist/chart.js +1 -1
- django_smartbase_admin/static/sb_admin/dist/main.js +1 -1
- django_smartbase_admin/static/sb_admin/dist/main_style.css +1 -1
- django_smartbase_admin/static/sb_admin/dist/table.js +1 -1
- django_smartbase_admin/static/sb_admin/js/fullcalendar.min.js +14804 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Phone-telephone.svg +3 -0
- django_smartbase_admin/static/sb_admin/src/css/_colors.css +19 -19
- django_smartbase_admin/static/sb_admin/src/css/calendar.css +130 -0
- django_smartbase_admin/static/sb_admin/src/css/components/_button.css +34 -0
- django_smartbase_admin/static/sb_admin/src/css/components/_tooltip.css +8 -22
- django_smartbase_admin/static/sb_admin/src/js/calendar.js +56 -0
- django_smartbase_admin/static/sb_admin/src/js/chart.js +3 -18
- django_smartbase_admin/static/sb_admin/src/js/main.js +1 -1
- django_smartbase_admin/static/sb_admin/src/js/multiselect.js +39 -23
- django_smartbase_admin/static/sb_admin/src/js/utils.js +3 -0
- django_smartbase_admin/templates/sb_admin/dashboard/calendar_widget.html +35 -0
- django_smartbase_admin/templates/sb_admin/dashboard/chart_widget.html +19 -1
- django_smartbase_admin/templates/sb_admin/filter_widgets/multiple_choice_field.html +14 -0
- django_smartbase_admin/templates/sb_admin/sprites/sb_admin.svg +1 -1
- django_smartbase_admin/templates/sb_admin/tailwind_whitelist.html +5 -3
- {django_smartbase_admin-1.0.6b3.dist-info → django_smartbase_admin-1.0.7.dist-info}/METADATA +1 -1
- {django_smartbase_admin-1.0.6b3.dist-info → django_smartbase_admin-1.0.7.dist-info}/RECORD +33 -25
- {django_smartbase_admin-1.0.6b3.dist-info → django_smartbase_admin-1.0.7.dist-info}/LICENSE.md +0 -0
- {django_smartbase_admin-1.0.6b3.dist-info → django_smartbase_admin-1.0.7.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M8.49816 2.8429C9.22459 2.84295 9.89352 3.23718 10.2462 3.87219L11.4698 6.07532L11.5265 6.18469C11.7735 6.70215 11.7862 7.3015 11.5616 7.82922L11.5099 7.94055L10.5011 9.95813C10.5468 10.1047 10.6129 10.2956 10.7062 10.5138C10.9356 11.0505 11.3151 11.7282 11.9152 12.3282C12.515 12.9281 13.1911 13.3055 13.7257 13.5333C13.9426 13.6257 14.1327 13.6903 14.2784 13.7355L16.296 12.7277L16.4083 12.6759C16.9738 12.4354 17.6212 12.468 18.1622 12.7687L20.3722 13.9972L20.4884 14.0665C21.0544 14.4334 21.4005 15.0644 21.4005 15.7452V18.2814C21.4005 20.1384 19.6956 21.5976 17.837 21.0958L17.6564 21.0411C15.2008 20.2125 11.2816 18.6155 8.63195 16.1095L8.38 15.8634C5.89768 13.3811 4.27053 9.62736 3.37218 7.07922L3.20226 6.58704C2.55214 4.66007 4.04522 2.84307 5.96203 2.8429H8.49816ZM5.96203 4.8429C5.29555 4.84306 4.92207 5.42648 5.09777 5.94739L5.26378 6.42786C6.13627 8.89807 7.63867 12.2939 9.79406 14.4493L10.0138 14.6632C12.3238 16.8452 15.881 18.3307 18.296 19.1456L18.3946 19.172C18.8879 19.2732 19.4005 18.9063 19.4005 18.2814V15.7452L17.1905 14.5167L14.8341 15.6945C14.6869 15.768 14.5243 15.8041 14.3614 15.7999L14.1984 15.7823H14.1974L14.1954 15.7814H14.1925C14.1901 15.7809 14.1869 15.7801 14.1837 15.7794C14.177 15.7781 14.1682 15.7757 14.1583 15.7736C14.1383 15.7693 14.1116 15.7636 14.0792 15.756C14.0139 15.7405 13.9234 15.7174 13.8136 15.6857C13.5942 15.6223 13.2919 15.5225 12.9415 15.3732C12.244 15.0759 11.3302 14.5714 10.5011 13.7423C9.67207 12.9132 9.16585 11.9983 8.8673 11.2999C8.71718 10.9488 8.61673 10.6456 8.55285 10.4259C8.52097 10.3162 8.49814 10.2266 8.48253 10.1613C8.47473 10.1286 8.46831 10.1012 8.46398 10.0812C8.46184 10.0712 8.46046 10.0624 8.4591 10.0558C8.45844 10.0526 8.45762 10.0494 8.45714 10.047C8.45692 10.0459 8.45634 10.045 8.45617 10.0441V10.0421C8.46048 10.041 8.52416 10.0284 9.43761 9.85071L8.45519 10.0411C8.41318 9.82481 8.44458 9.60057 8.54308 9.40344L9.72082 7.04602L8.49816 4.8429H5.96203Z"/>
|
|
3
|
+
</svg>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
--color-dark-50: #F9FAFB;
|
|
16
16
|
--color-dark-a: 17 24 39; /* rgb value from which the alpha values are generated */
|
|
17
17
|
|
|
18
|
-
--color-primary-900: #
|
|
18
|
+
--color-primary-900: #002729;
|
|
19
19
|
--color-primary-800: #003A3D;
|
|
20
20
|
--color-primary-700: #006166;
|
|
21
21
|
--color-primary-600: #008188;
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
--color-success-300: #6EE7B7;
|
|
47
47
|
--color-success-200: #A7F3D0;
|
|
48
48
|
--color-success-100: #D1FAE5;
|
|
49
|
-
--color-success-50: #
|
|
49
|
+
--color-success-50: #ECFDF5;
|
|
50
50
|
|
|
51
51
|
--color-warning-900: #78350F;
|
|
52
52
|
--color-warning-800: #78350F;
|
|
@@ -59,26 +59,26 @@
|
|
|
59
59
|
--color-warning-100: #FEF3C7;
|
|
60
60
|
--color-warning-50: #FFFBEB;
|
|
61
61
|
|
|
62
|
-
--color-negative-900: #
|
|
63
|
-
--color-negative-800: #
|
|
64
|
-
--color-negative-700: #
|
|
65
|
-
--color-negative-600: #
|
|
66
|
-
--color-negative: #
|
|
67
|
-
--color-negative-400: #
|
|
68
|
-
--color-negative-300: #
|
|
69
|
-
--color-negative-200: #
|
|
70
|
-
--color-negative-100: #
|
|
71
|
-
--color-negative-50: #
|
|
62
|
+
--color-negative-900: #330000;
|
|
63
|
+
--color-negative-800: #660000;
|
|
64
|
+
--color-negative-700: #990000;
|
|
65
|
+
--color-negative-600: #CC0000;
|
|
66
|
+
--color-negative: #FF0917;
|
|
67
|
+
--color-negative-400: #FF3A45;
|
|
68
|
+
--color-negative-300: #FF6B74;
|
|
69
|
+
--color-negative-200: #FF9DA2;
|
|
70
|
+
--color-negative-100: #FFCED1;
|
|
71
|
+
--color-negative-50: #FFE6E8;
|
|
72
72
|
|
|
73
73
|
--color-notice-900: #0C4A6E;
|
|
74
74
|
--color-notice-800: #075985;
|
|
75
75
|
--color-notice-700: #0369A1;
|
|
76
|
-
--color-notice-600: #
|
|
77
|
-
--color-notice: #
|
|
78
|
-
--color-notice-400: #
|
|
79
|
-
--color-notice-300: #
|
|
80
|
-
--color-notice-200: #
|
|
81
|
-
--color-notice-100: #
|
|
82
|
-
--color-notice-50: #
|
|
76
|
+
--color-notice-600: #0284C7;
|
|
77
|
+
--color-notice: #0EA5E9;
|
|
78
|
+
--color-notice-400: #38BDF8;
|
|
79
|
+
--color-notice-300: #7DD3FC;
|
|
80
|
+
--color-notice-200: #BAE6FD;
|
|
81
|
+
--color-notice-100: #F0F9FF;
|
|
82
|
+
--color-notice-50: #F0F9FF;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--fc-small-font-size: .75rem;
|
|
3
|
+
--fc-border-color: var(--color-dark-200);
|
|
4
|
+
--fc-today-bg-color: var(--color-primary-50);
|
|
5
|
+
--fc-neutral-bg-color: var(--color-dark-100);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.fc-theme-standard {
|
|
9
|
+
th.fc-col-header-cell {
|
|
10
|
+
@apply px-24 py-8;
|
|
11
|
+
@apply bg-dark-100;
|
|
12
|
+
}
|
|
13
|
+
td.fc-daygrid-day {
|
|
14
|
+
@apply p-8;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.fc {
|
|
19
|
+
table {
|
|
20
|
+
@apply text-12;
|
|
21
|
+
}
|
|
22
|
+
.fc-col-header-cell-cushion {
|
|
23
|
+
@apply p-0;
|
|
24
|
+
@apply text-14 font-medium;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.fc-daygrid-day {
|
|
28
|
+
height: 9rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.fc-day-other {
|
|
32
|
+
@apply bg-dark-100;
|
|
33
|
+
.fc-daygrid-day-top {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
.fc-daygrid-day-number {
|
|
36
|
+
@apply text-dark;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
.fc-daygrid-day-events {
|
|
40
|
+
opacity: 0.6;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.fc-daygrid-day-frame,
|
|
45
|
+
.fc-daygrid-day-events,
|
|
46
|
+
.fc-daygrid-event-harness,
|
|
47
|
+
.fc-daygrid-day-bottom {
|
|
48
|
+
&:before,
|
|
49
|
+
&:after {
|
|
50
|
+
@apply hidden;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.fc-daygrid-day-frame {
|
|
55
|
+
@apply flex flex-col gap-4;
|
|
56
|
+
}
|
|
57
|
+
.fc-daygrid-day-events {
|
|
58
|
+
@apply m-0 flex flex-col gap-4;
|
|
59
|
+
}
|
|
60
|
+
.fc-daygrid-day-top {
|
|
61
|
+
@apply flex-row;
|
|
62
|
+
}
|
|
63
|
+
.fc-daygrid-day-number {
|
|
64
|
+
@apply w-24 h-24 flex justify-center items-center leading-none font-semibold text-dark-900 p-4;
|
|
65
|
+
}
|
|
66
|
+
.fc-day-today {
|
|
67
|
+
.fc-daygrid-day-number {
|
|
68
|
+
@apply bg-primary rounded-full text-light;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
.fc-daygrid-event {
|
|
72
|
+
@apply !m-0 flex gap-4;
|
|
73
|
+
}
|
|
74
|
+
.fc-daygrid-dot-event {
|
|
75
|
+
@apply px-8 py-0 border border-dark-200 rounded h-24;
|
|
76
|
+
.fc-event-time {
|
|
77
|
+
@apply hidden;
|
|
78
|
+
}
|
|
79
|
+
.fc-event-title {
|
|
80
|
+
@apply font-normal text-dark-900 text-ellipsis leading-16;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
.fc-daygrid-event-dot {
|
|
84
|
+
box-sizing: border-box;
|
|
85
|
+
@apply w-12 h-12 m-0 shrink-0;
|
|
86
|
+
@apply rounded-full border-2 border-current;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.fc-daygrid-day-bottom {
|
|
90
|
+
@apply text-12 !m-0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.fc-daygrid-more-link {
|
|
94
|
+
@apply m-0 p-0;
|
|
95
|
+
&:hover {
|
|
96
|
+
background: none;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.fc-daygrid-body-unbalanced .fc-daygrid-day-events {
|
|
101
|
+
min-height: 4rem;
|
|
102
|
+
@apply mb-0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.fc-daygrid-day-bg {
|
|
106
|
+
@apply hidden;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.fc-popover {
|
|
110
|
+
z-index: 10;
|
|
111
|
+
.fc-popover-header {
|
|
112
|
+
@apply p-4;
|
|
113
|
+
}
|
|
114
|
+
.fc-popover-title {
|
|
115
|
+
@apply text-14;
|
|
116
|
+
}
|
|
117
|
+
.fc-popover-body {
|
|
118
|
+
@apply p-8 flex flex-col gap-4;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.fc-scrollgrid {
|
|
123
|
+
border-left-width: 0;
|
|
124
|
+
}
|
|
125
|
+
.fc-scrollgrid-section {
|
|
126
|
+
>th,>td {
|
|
127
|
+
border: 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -195,4 +195,38 @@
|
|
|
195
195
|
@apply max-sm:hidden;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
+
|
|
199
|
+
.btn-group {
|
|
200
|
+
@apply flex;
|
|
201
|
+
> * {
|
|
202
|
+
&:first-child {
|
|
203
|
+
@apply rounded-r-none;
|
|
204
|
+
>.btn,
|
|
205
|
+
>.input {
|
|
206
|
+
@apply rounded-r-none;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
&:last-child {
|
|
210
|
+
@apply rounded-l-none;
|
|
211
|
+
>.btn,
|
|
212
|
+
.input {
|
|
213
|
+
@apply rounded-l-none;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
&:not(:first-child) {
|
|
217
|
+
margin-left: -1px;
|
|
218
|
+
}
|
|
219
|
+
&:not(:first-child):not(:last-child) {
|
|
220
|
+
@apply rounded-none;
|
|
221
|
+
>.btn,
|
|
222
|
+
>.input{
|
|
223
|
+
@apply rounded-none;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
&:hover,
|
|
227
|
+
&:focus {
|
|
228
|
+
z-index: 1;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
198
232
|
}
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.tooltip.bs-tooltip-top
|
|
31
|
+
.tooltip.bs-tooltip-top,
|
|
32
|
+
.tooltip.bs-tooltip-auto[data-popper-placement^="top"] {
|
|
32
33
|
|
|
33
34
|
.tooltip-arrow {
|
|
34
35
|
bottom: 0;
|
|
@@ -41,7 +42,8 @@
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
.tooltip.bs-tooltip-bottom
|
|
45
|
+
.tooltip.bs-tooltip-bottom,
|
|
46
|
+
.tooltip.bs-tooltip-auto[data-popper-placement^="bottom"] {
|
|
45
47
|
|
|
46
48
|
.tooltip-arrow {
|
|
47
49
|
top: 0;
|
|
@@ -54,7 +56,8 @@
|
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
.tooltip.bs-tooltip-end
|
|
59
|
+
.tooltip.bs-tooltip-end,
|
|
60
|
+
.tooltip.bs-tooltip-auto[data-popper-placement^="right"] {
|
|
58
61
|
padding: 0 .5rem;
|
|
59
62
|
|
|
60
63
|
.tooltip-arrow {
|
|
@@ -72,7 +75,8 @@
|
|
|
72
75
|
|
|
73
76
|
|
|
74
77
|
|
|
75
|
-
.tooltip.bs-tooltip-start
|
|
78
|
+
.tooltip.bs-tooltip-start,
|
|
79
|
+
.tooltip.bs-tooltip-auto[data-popper-placement^="left"] {
|
|
76
80
|
padding: 0 .5rem;
|
|
77
81
|
|
|
78
82
|
.tooltip-arrow {
|
|
@@ -88,24 +92,6 @@
|
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
|
|
91
|
-
.tooltip.bs-tooltip-auto {
|
|
92
|
-
&[data-popper-placement^="top"] {
|
|
93
|
-
@extend .tooltip.bs-tooltip-top;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
&[data-popper-placement^="right"] {
|
|
97
|
-
@extend .tooltip.bs-tooltip-end;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
&[data-popper-placement^="bottom"] {
|
|
101
|
-
@extend .tooltip.bs-tooltip-bottom;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
&[data-popper-placement^="left"] {
|
|
105
|
-
@extend .tooltip.bs-tooltip-start;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
95
|
.tooltip-inner {
|
|
110
96
|
max-width: 200px;
|
|
111
97
|
@apply p-8;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {filterInputValueChangedUtil, filterInputValueChangeListener} from "./utils"
|
|
2
|
+
|
|
3
|
+
class SBAdminCalendar {
|
|
4
|
+
constructor(options) {
|
|
5
|
+
this.options = options
|
|
6
|
+
this.calendar = null
|
|
7
|
+
this.options['calendarOptions'] = this.options['calendarOptions'] || {}
|
|
8
|
+
|
|
9
|
+
if(!Object.hasOwn(this.options.calendarOptions, "events") || !this.options.calendarOptions.events) {
|
|
10
|
+
throw Error('Missing events property!')
|
|
11
|
+
}
|
|
12
|
+
if(typeof this.options.calendarOptions.events === 'string') {
|
|
13
|
+
this.options.calendarOptions.events = {
|
|
14
|
+
url: this.options.calendarOptions.events
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
this.options.calendarOptions.events['extraParams'] = this.options.calendarOptions.events['extraParams'] || {}
|
|
18
|
+
this.options.calendarOptions.events.extraParams = () => {
|
|
19
|
+
return {
|
|
20
|
+
...this.options.calendarOptions.events['extraParams'] || {},
|
|
21
|
+
...this.getFilterData()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
this.initCalendar()
|
|
25
|
+
this.initFilters()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
initCalendar() {
|
|
29
|
+
const calendarEl = document.getElementById(`${this.options.widgetId}-calendar`)
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line no-undef
|
|
32
|
+
this.calendar = new FullCalendar.Calendar(calendarEl, this.options.calendarOptions || {})
|
|
33
|
+
this.calendar.render()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getFilterData() {
|
|
37
|
+
const filterForm = document.querySelector(`#${this.options.widgetId}-filter-form`)
|
|
38
|
+
const filterData = new FormData(filterForm).entries()
|
|
39
|
+
const filterDataNotEmpty = {}
|
|
40
|
+
for (const [key, value] of filterData) {
|
|
41
|
+
if (value) {
|
|
42
|
+
filterDataNotEmpty[key] = value
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return filterDataNotEmpty
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
initFilters() {
|
|
49
|
+
filterInputValueChangeListener(`[form="${this.options.widgetId}-filter-form"]`, (event) => {
|
|
50
|
+
this.calendar.refetchEvents()
|
|
51
|
+
filterInputValueChangedUtil(event.target)
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
window.SBAdminCalendarClass = SBAdminCalendar
|
|
@@ -28,24 +28,8 @@ class SBAdminChart {
|
|
|
28
28
|
this.chart = new Chart(ctx, {
|
|
29
29
|
type: this.options.chartType,
|
|
30
30
|
data: {},
|
|
31
|
-
options: {
|
|
32
|
-
|
|
33
|
-
x: {
|
|
34
|
-
ticks: {
|
|
35
|
-
font: {
|
|
36
|
-
weight: 600,
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
y: {
|
|
41
|
-
ticks: {
|
|
42
|
-
font: {
|
|
43
|
-
weight: 600,
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
31
|
+
options: this.options.chartOptions || {},
|
|
32
|
+
plugins: this.options.chartPlugins || []
|
|
49
33
|
})
|
|
50
34
|
this.refreshData()
|
|
51
35
|
document.addEventListener(window.sb_admin_const.TABLE_RELOAD_DATA_EVENT_NAME, () => {
|
|
@@ -112,6 +96,7 @@ class SBAdminChart {
|
|
|
112
96
|
}
|
|
113
97
|
})
|
|
114
98
|
}
|
|
99
|
+
this.chart.canvas.dispatchEvent(new CustomEvent('chartDataLoaded'))
|
|
115
100
|
})
|
|
116
101
|
}
|
|
117
102
|
|
|
@@ -101,7 +101,7 @@ class Main {
|
|
|
101
101
|
initInputs(target) {
|
|
102
102
|
this.datepicker = new Datepicker(target)
|
|
103
103
|
this.range = new Range(null, null, target)
|
|
104
|
-
this.multiselect = new Multiselect()
|
|
104
|
+
this.multiselect = new Multiselect(null, null, target)
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
handleLocationHashFromTabs() {
|
|
@@ -1,37 +1,53 @@
|
|
|
1
1
|
export default class Multiselect {
|
|
2
|
-
constructor(selector_override, options_override) {
|
|
2
|
+
constructor(selector_override, options_override, target) {
|
|
3
|
+
target = target || document
|
|
3
4
|
const selector = selector_override || '.js-simple-multiselect'
|
|
4
5
|
const selectorDetail = '.js-simple-multiselect-detail'
|
|
6
|
+
const selectAllClass = 'js-simple-multiselect-all'
|
|
5
7
|
this.wrapperSelector = '.js-simple-multiselect-wrapper'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
if(target === document) {
|
|
9
|
+
document.addEventListener('change', e => {
|
|
10
|
+
const wrapperEl = e.target.closest(this.wrapperSelector)
|
|
11
|
+
const multiselectInput = wrapperEl?.querySelector(selector)
|
|
12
|
+
const isCheckboxClicked = e.target.type === 'checkbox'
|
|
13
|
+
const selectAllEl = wrapperEl.querySelector(`.${selectAllClass}`)
|
|
14
|
+
if(multiselectInput && isCheckboxClicked) {
|
|
15
|
+
const checkboxes = Array.from(this.getCheckboxes(multiselectInput))
|
|
16
|
+
if(e.target.classList.contains(selectAllClass)) {
|
|
17
|
+
checkboxes.forEach(el => {
|
|
18
|
+
el.checked = e.target.checked
|
|
17
19
|
})
|
|
20
|
+
} else {
|
|
21
|
+
selectAllEl.checked = false
|
|
18
22
|
}
|
|
23
|
+
if(!checkboxes.some(el => el.checked)) {
|
|
24
|
+
selectAllEl.checked = true
|
|
25
|
+
}
|
|
26
|
+
let checked = []
|
|
27
|
+
checkboxes.forEach(el => {
|
|
28
|
+
if(el.checked) {
|
|
29
|
+
checked.push({
|
|
30
|
+
value: el.value,
|
|
31
|
+
label: el.dataset.label,
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
multiselectInput.value = JSON.stringify(checked)
|
|
36
|
+
multiselectInput.dispatchEvent(new Event('change', {bubbles: true}))
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
document.addEventListener('formset:added', (event) => {
|
|
40
|
+
event.target.querySelectorAll(selectorDetail).forEach(el => {
|
|
41
|
+
this.initDetailMultiselect(el)
|
|
19
42
|
})
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
document.querySelectorAll(selector).forEach(el => {
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
target.querySelectorAll(selector).forEach(el => {
|
|
25
46
|
this.initMultiselect(el, options_override)
|
|
26
47
|
})
|
|
27
|
-
|
|
48
|
+
target.querySelectorAll(selectorDetail).forEach(el => {
|
|
28
49
|
this.initDetailMultiselect(el)
|
|
29
50
|
})
|
|
30
|
-
document.addEventListener('formset:added', (event) => {
|
|
31
|
-
event.target.querySelectorAll(selectorDetail).forEach(el => {
|
|
32
|
-
this.initDetailMultiselect(el)
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
51
|
}
|
|
36
52
|
|
|
37
53
|
getCheckboxes(base_input) {
|
|
@@ -95,6 +95,9 @@ export const filterInputValueChangedUtil = (field) => {
|
|
|
95
95
|
if (index === window.sb_admin_const.MULTISELECT_FILTER_MAX_CHOICES_SHOWN) {
|
|
96
96
|
break
|
|
97
97
|
}
|
|
98
|
+
if(entries.length > 1 && item.value === window.sb_admin_const.SELECT_ALL_KEYWORD) {
|
|
99
|
+
continue
|
|
100
|
+
}
|
|
98
101
|
if (index === window.sb_admin_const.MULTISELECT_FILTER_MAX_CHOICES_SHOWN - 2 && entries[index + 2]) {
|
|
99
102
|
labelArray.push(item.label)
|
|
100
103
|
hasMaxEntries = true
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{% extends "sb_admin/dashboard/widget_base.html" %}
|
|
2
|
+
{% load sb_admin_tags static i18n %}
|
|
3
|
+
|
|
4
|
+
{% block filters %}{% endblock %}
|
|
5
|
+
|
|
6
|
+
{% block content_inner %}
|
|
7
|
+
<div class="card p-16 pb-0">
|
|
8
|
+
<div class="mt-16 -mx-16">
|
|
9
|
+
<script type="text/javascript" src="{% static 'sb_admin/js/fullcalendar.min.js' %}"></script>
|
|
10
|
+
<link rel="stylesheet" href="{% static 'sb_admin/dist/calendar_style.css' %}">
|
|
11
|
+
<script type="text/javascript" src="{% static 'sb_admin/dist/calendar.js' %}"></script>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
15
|
+
window.SBAdminCalendar = window.SBAdminCalendar || {};
|
|
16
|
+
window.SBAdminCalendar["{{ widget_id }}"] = new window.SBAdminCalendarClass({
|
|
17
|
+
"widgetId": "{{ widget_id }}",
|
|
18
|
+
"calendarOptions": {
|
|
19
|
+
initialView: 'dayGridMonth',
|
|
20
|
+
events: {
|
|
21
|
+
url: "{{ ajax_url }}",
|
|
22
|
+
},
|
|
23
|
+
dayMaxEvents: 3,
|
|
24
|
+
height: 'auto',
|
|
25
|
+
locale: 'sk',
|
|
26
|
+
headerToolbar: false,
|
|
27
|
+
fixedWeekCount: false,
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
</script>
|
|
32
|
+
<div id="{{ widget_id }}-calendar"></div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
{% endblock %}
|
|
@@ -19,7 +19,25 @@
|
|
|
19
19
|
window.SBAdminChart["{{ widget_id }}"] = new window.SBAdminChartClass({
|
|
20
20
|
"widgetId": "{{ widget_id }}",
|
|
21
21
|
"ajaxUrl": "{{ ajax_url }}",
|
|
22
|
-
"chartType": "{{ chart_type }}"
|
|
22
|
+
"chartType": "{{ chart_type }}",
|
|
23
|
+
"chartOptions": {
|
|
24
|
+
scales: {
|
|
25
|
+
x: {
|
|
26
|
+
ticks: {
|
|
27
|
+
font: {
|
|
28
|
+
weight: 600,
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
y: {
|
|
33
|
+
ticks: {
|
|
34
|
+
font: {
|
|
35
|
+
weight: 600,
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
23
41
|
});
|
|
24
42
|
</script>
|
|
25
43
|
</div>
|
|
@@ -6,6 +6,20 @@
|
|
|
6
6
|
{% if not all_filters_visible %}disabled{% endif %}{% if filter_widget.get_default_value %}
|
|
7
7
|
value="{{ filter_widget.get_default_value }}"{% endif %}>
|
|
8
8
|
<ul class="relative py-8">
|
|
9
|
+
{% if filter_widget.enable_select_all %}
|
|
10
|
+
<li>
|
|
11
|
+
<div class="relative px-12 py-8">
|
|
12
|
+
<input type="checkbox"
|
|
13
|
+
value="{{ filter_widget.select_all_keyword }}"
|
|
14
|
+
name="{{ filter_widget.input_name }}_dummy"
|
|
15
|
+
class="checkbox js-simple-multiselect-all"
|
|
16
|
+
id="{{ filter_widget.input_id }}_all" {% if filter_widget.get_default_value == filter_widget.select_all_keyword %} checked{% endif %} data-label="{{ filter_widget.select_all_label }}">
|
|
17
|
+
<label for="{{ filter_widget.input_id }}_all">
|
|
18
|
+
{{ filter_widget.select_all_label }}
|
|
19
|
+
</label>
|
|
20
|
+
</div>
|
|
21
|
+
</li>
|
|
22
|
+
{% endif %}
|
|
9
23
|
{% for choice in filter_widget.choices %}
|
|
10
24
|
<li>
|
|
11
25
|
<div class="relative px-12 py-8">
|