@tager/admin-banners 1.0.0 → 1.0.2
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/dist/dev/App.vue.d.ts +4 -3
- package/dist/hooks/useFetchBanner.d.ts +3 -3
- package/dist/hooks/useFetchBanners.d.ts +2 -2
- package/dist/hooks/useFetchZoneFields.d.ts +4 -4
- package/dist/hooks/useFetchZones.d.ts +2 -2
- package/dist/index.mjs +584 -666
- package/dist/services/requests.d.ts +3 -3
- package/dist/style.css +1 -1
- package/dist/typings/banners.d.ts +3 -3
- package/dist/typings/common.d.ts +1 -1
- package/dist/typings/model.d.ts +3 -3
- package/dist/typings/zones.d.ts +1 -1
- package/dist/views/Banners/BannerForm/BannerForm.helpers.d.ts +3 -3
- package/dist/views/Banners/BannerForm/BannerForm.vue.d.ts +1845 -370
- package/dist/views/Banners/BannerList/BannerList.helpers.d.ts +4 -4
- package/dist/views/Banners/BannerList/BannerList.vue.d.ts +5 -4
- package/dist/views/Banners/BannerList/hooks/useAdvancedSearch.d.ts +6 -7
- package/dist/views/Zones/ZoneList/ZoneList.helpers.d.ts +3 -3
- package/dist/views/Zones/ZoneList/ZoneList.vue.d.ts +4 -3
- package/package.json +20 -24
- package/src/dev/App.vue +1 -1
- package/src/dev/env.ts +11 -11
- package/src/hooks/useFetchBanner.ts +3 -3
- package/src/hooks/useFetchBanners.ts +3 -3
- package/src/hooks/useFetchZoneFields.ts +4 -4
- package/src/hooks/useFetchZones.ts +2 -2
- package/src/services/requests.ts +3 -3
- package/src/typings/banners.ts +6 -6
- package/src/typings/model.ts +7 -7
- package/src/typings/zones.ts +1 -1
- package/src/utils/paths.ts +5 -5
- package/src/views/Banners/BannerForm/BannerForm.helpers.ts +5 -5
- package/src/views/Banners/BannerForm/BannerForm.vue +6 -6
- package/src/views/Banners/BannerList/BannerList.helpers.ts +4 -4
- package/src/views/Banners/BannerList/BannerList.vue +7 -17
- package/src/views/Banners/BannerList/hooks/useAdvancedSearch.ts +34 -14
- package/src/views/Zones/ZoneList/ZoneList.helpers.ts +3 -3
- package/src/views/Zones/ZoneList/ZoneList.vue +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { i18n, request, useI18n, useResource, useResourceDelete, createId, useToast, navigateBack, convertRequestErrorToMap } from "@tager/admin-services";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { i18n as M, request as L, useI18n as O, useResource as P, isNotNullish as le, useResourceDelete as ue, createId as de, useToast as me, navigateBack as ce, convertRequestErrorToMap as pe } from "@tager/admin-services";
|
|
2
|
+
import { useRoute as Q, useRouter as j } from "vue-router";
|
|
3
|
+
import { defineComponent as q, onMounted as k, computed as f, resolveComponent as m, openBlock as R, createBlock as Z, withCtx as h, createVNode as i, createTextVNode as G, toDisplayString as Y, ref as D, watch as N, createElementVNode as C, withModifiers as be, createElementBlock as fe, Fragment as ve, renderList as ge } from "vue";
|
|
4
|
+
import { DataTable as J, CountButton as Fe, useDataTable as K, getFilterParamAsStringArray as H, getFilterParamAsString as he, getFilterParams as ye, AdvancedSearch as Be, FormFieldMultiSelect as Se, FormField as X, BaseButton as Ne, EditIcon as Le, DeleteIcon as $e, FormFooter as we, FormFieldSelect as Ee, InputLabel as Te, FormFieldCheckbox as De, FormFieldFileInput as Ce } from "@tager/admin-ui";
|
|
5
|
+
import { Page as W } from "@tager/admin-layout";
|
|
6
|
+
import { universalFieldUtils as _, DynamicField as Re } from "@tager/admin-dynamic-field";
|
|
6
7
|
import "i18next";
|
|
7
|
-
import { compile } from "path-to-regexp";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
const EN = {
|
|
8
|
+
import { compile as ze } from "path-to-regexp";
|
|
9
|
+
import Ze from "lodash.isequal";
|
|
10
|
+
import ke from "lodash.pick";
|
|
11
|
+
const Ie = {
|
|
12
12
|
home: "Home",
|
|
13
13
|
zone: "Banner zone",
|
|
14
14
|
zones: "Banner zones",
|
|
@@ -47,100 +47,92 @@ const EN = {
|
|
|
47
47
|
bannerWasSuccessfullyUpdated: "Banner was successfully updated",
|
|
48
48
|
bannerCreationWasFailed: "Banner creation was failed",
|
|
49
49
|
bannerUpdateWasFailed: "Banner update was failed"
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
error: "\u041E\u0448\u0438\u0431\u043A\u0430",
|
|
50
|
+
}, Ae = {
|
|
51
|
+
home: "Главная",
|
|
52
|
+
zone: "Баннерная зона",
|
|
53
|
+
zones: "Баннерные зоны",
|
|
54
|
+
banners: "Баннеры",
|
|
55
|
+
bannerForm: "Форма баннера",
|
|
56
|
+
createBanner: "Добавить баннер",
|
|
57
|
+
updateBanner: "Редактировать баннер",
|
|
58
|
+
link: "Ссылка",
|
|
59
|
+
image: "Картинка",
|
|
60
|
+
openNewTab: "Открывать в новой вкладке",
|
|
61
|
+
period: "Срок действия",
|
|
62
|
+
from: "От",
|
|
63
|
+
to: "До",
|
|
64
|
+
disabled: "Выключен",
|
|
65
|
+
comment: "Комментарий",
|
|
66
|
+
status: "Статус",
|
|
67
|
+
bannerZoneIsDeleted: "Баннерная зона удалена",
|
|
68
|
+
newTab: "Новая вкладка",
|
|
69
|
+
yes: "Да",
|
|
70
|
+
no: "Нет",
|
|
71
|
+
edit: "Редактировать",
|
|
72
|
+
remove: "Удалить",
|
|
73
|
+
actions: "Действия",
|
|
74
|
+
date: "Дата",
|
|
75
|
+
name: "Название",
|
|
76
|
+
priority: "Приоритет",
|
|
77
|
+
success: "Успех",
|
|
78
|
+
error: "Ошибка",
|
|
80
79
|
statuses: {
|
|
81
|
-
waiting: "
|
|
82
|
-
archived: "
|
|
83
|
-
active: "
|
|
84
|
-
disabled: "
|
|
80
|
+
waiting: "В ожидании",
|
|
81
|
+
archived: "Архивный",
|
|
82
|
+
active: "Активный",
|
|
83
|
+
disabled: "Отключен"
|
|
85
84
|
},
|
|
86
|
-
bannerWasSuccessfullyCreated: "
|
|
87
|
-
bannerWasSuccessfullyUpdated: "
|
|
88
|
-
bannerCreationWasFailed: "
|
|
89
|
-
bannerUpdateWasFailed: "
|
|
85
|
+
bannerWasSuccessfullyCreated: "Баннер успешно создан",
|
|
86
|
+
bannerWasSuccessfullyUpdated: "Баннер успешно обновлен",
|
|
87
|
+
bannerCreationWasFailed: "Не удалось создать баннер",
|
|
88
|
+
bannerUpdateWasFailed: "Не удалось обновить баннер"
|
|
90
89
|
};
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
i18n.addTranslations("ru", "banners", RU);
|
|
90
|
+
function Ue() {
|
|
91
|
+
M.addTranslations("en", "banners", Ie), M.addTranslations("ru", "banners", Ae);
|
|
94
92
|
}
|
|
95
|
-
var
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Status2["Active"] = "ACTIVE";
|
|
99
|
-
Status2["Disabled"] = "DISABLED";
|
|
100
|
-
return Status2;
|
|
101
|
-
})(Status || {});
|
|
102
|
-
function getZones(params) {
|
|
103
|
-
return request.get({ path: "/admin/adv/zones", params });
|
|
93
|
+
var T = /* @__PURE__ */ ((e) => (e.Waiting = "WAITING", e.Archived = "ARCHIVED", e.Active = "ACTIVE", e.Disabled = "DISABLED", e))(T || {});
|
|
94
|
+
function x(e) {
|
|
95
|
+
return L.get({ path: "/admin/adv/zones", params: e });
|
|
104
96
|
}
|
|
105
|
-
function
|
|
106
|
-
return
|
|
97
|
+
function Oe(e) {
|
|
98
|
+
return L.get({ path: `/admin/adv/zones/${e}` });
|
|
107
99
|
}
|
|
108
|
-
function
|
|
109
|
-
return
|
|
100
|
+
function Pe(e) {
|
|
101
|
+
return L.get({ path: "/admin/adv", params: e });
|
|
110
102
|
}
|
|
111
|
-
function
|
|
112
|
-
return
|
|
103
|
+
function qe(e) {
|
|
104
|
+
return L.get({ path: `/admin/adv/${e}` });
|
|
113
105
|
}
|
|
114
|
-
function
|
|
115
|
-
return
|
|
106
|
+
function We(e) {
|
|
107
|
+
return L.post({ path: "/admin/adv", body: e });
|
|
116
108
|
}
|
|
117
|
-
function
|
|
118
|
-
return
|
|
119
|
-
path: `/admin/adv/${
|
|
120
|
-
body:
|
|
109
|
+
function Ve(e, n) {
|
|
110
|
+
return L.put({
|
|
111
|
+
path: `/admin/adv/${e}`,
|
|
112
|
+
body: n
|
|
121
113
|
});
|
|
122
114
|
}
|
|
123
|
-
function
|
|
124
|
-
return
|
|
115
|
+
function Me(e) {
|
|
116
|
+
return L.delete({ path: `/admin/adv/${e}` });
|
|
125
117
|
}
|
|
126
|
-
function
|
|
127
|
-
return
|
|
118
|
+
function Bn() {
|
|
119
|
+
return L.get({ path: "/admin/adv/count" });
|
|
128
120
|
}
|
|
129
|
-
const
|
|
121
|
+
const B = {
|
|
130
122
|
ZONE_LIST: "/banners/zones",
|
|
131
123
|
BANNER_LIST: "/banners",
|
|
132
124
|
BANNER_FORM: "/banners/:bannerId"
|
|
133
125
|
};
|
|
134
|
-
function
|
|
135
|
-
return
|
|
126
|
+
function Sn() {
|
|
127
|
+
return B.ZONE_LIST;
|
|
136
128
|
}
|
|
137
|
-
function
|
|
138
|
-
return
|
|
129
|
+
function U() {
|
|
130
|
+
return B.BANNER_LIST;
|
|
139
131
|
}
|
|
140
|
-
function
|
|
141
|
-
return
|
|
132
|
+
function ee(e) {
|
|
133
|
+
return ze(B.BANNER_FORM)(e);
|
|
142
134
|
}
|
|
143
|
-
function
|
|
135
|
+
function He(e) {
|
|
144
136
|
return [
|
|
145
137
|
{
|
|
146
138
|
id: 0,
|
|
@@ -151,84 +143,77 @@ function getColumnDefs$1(t) {
|
|
|
151
143
|
},
|
|
152
144
|
{
|
|
153
145
|
id: 1,
|
|
154
|
-
name:
|
|
146
|
+
name: e("banners:name"),
|
|
155
147
|
field: "name",
|
|
156
148
|
type: "name"
|
|
157
149
|
},
|
|
158
150
|
{
|
|
159
151
|
id: 2,
|
|
160
|
-
name:
|
|
152
|
+
name: e("banners:banners"),
|
|
161
153
|
field: "bannersCount",
|
|
162
154
|
style: { whiteSpace: "nowrap", width: "130px" }
|
|
163
155
|
}
|
|
164
156
|
];
|
|
165
157
|
}
|
|
166
|
-
function
|
|
167
|
-
return `${
|
|
158
|
+
function Qe(e) {
|
|
159
|
+
return `${U()}?filter[zone]=${e}`;
|
|
168
160
|
}
|
|
169
|
-
|
|
170
|
-
const target = sfc.__vccOpts || sfc;
|
|
171
|
-
for (const [key, val] of props) {
|
|
172
|
-
target[key] = val;
|
|
173
|
-
}
|
|
174
|
-
return target;
|
|
175
|
-
};
|
|
176
|
-
const _sfc_main$2 = defineComponent({
|
|
161
|
+
const je = q({
|
|
177
162
|
name: "ZoneList",
|
|
178
|
-
components: { CountButton, Page, DataTable },
|
|
163
|
+
components: { CountButton: Fe, Page: W, DataTable: J },
|
|
179
164
|
setup() {
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
fetchEntityList: getZones,
|
|
165
|
+
const e = O(), {
|
|
166
|
+
fetchEntityList: n,
|
|
167
|
+
isLoading: t,
|
|
168
|
+
rowData: r,
|
|
169
|
+
errorMessage: o,
|
|
170
|
+
handleChange: u
|
|
171
|
+
} = K({
|
|
172
|
+
fetchEntityList: x,
|
|
189
173
|
initialValue: [],
|
|
190
174
|
resourceName: "Banner Zones"
|
|
191
175
|
});
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
handleChange,
|
|
202
|
-
getLinkToBannersByZone
|
|
176
|
+
return k(() => {
|
|
177
|
+
n();
|
|
178
|
+
}), {
|
|
179
|
+
columnDefs: f(() => He(e.t)),
|
|
180
|
+
isRowDataLoading: t,
|
|
181
|
+
rowData: r,
|
|
182
|
+
errorMessage: o,
|
|
183
|
+
handleChange: u,
|
|
184
|
+
getLinkToBannersByZone: Qe
|
|
203
185
|
};
|
|
204
186
|
}
|
|
205
|
-
})
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
187
|
+
}), V = (e, n) => {
|
|
188
|
+
const t = e.__vccOpts || e;
|
|
189
|
+
for (const [r, o] of n)
|
|
190
|
+
t[r] = o;
|
|
191
|
+
return t;
|
|
192
|
+
};
|
|
193
|
+
function Ge(e, n, t, r, o, u) {
|
|
194
|
+
const p = m("CountButton"), l = m("DataTable"), b = m("Page");
|
|
195
|
+
return R(), Z(b, {
|
|
196
|
+
title: e.$i18n.t("banners:zones")
|
|
212
197
|
}, {
|
|
213
|
-
content:
|
|
214
|
-
|
|
215
|
-
"column-defs":
|
|
216
|
-
"row-data":
|
|
217
|
-
loading:
|
|
218
|
-
"error-message":
|
|
198
|
+
content: h(() => [
|
|
199
|
+
i(l, {
|
|
200
|
+
"column-defs": e.columnDefs,
|
|
201
|
+
"row-data": e.rowData,
|
|
202
|
+
loading: e.isRowDataLoading,
|
|
203
|
+
"error-message": e.errorMessage,
|
|
219
204
|
"data-table": "banners-zones",
|
|
220
|
-
"use-search":
|
|
221
|
-
"use-pagination":
|
|
222
|
-
onChange:
|
|
205
|
+
"use-search": !1,
|
|
206
|
+
"use-pagination": !1,
|
|
207
|
+
onChange: e.handleChange
|
|
223
208
|
}, {
|
|
224
|
-
"cell(banners-count)":
|
|
225
|
-
|
|
226
|
-
href:
|
|
209
|
+
"cell(banners-count)": h(({ row: d }) => [
|
|
210
|
+
i(p, {
|
|
211
|
+
href: e.getLinkToBannersByZone(d.id),
|
|
227
212
|
variant: "outline-secondary",
|
|
228
|
-
count:
|
|
213
|
+
count: d.bannersCount
|
|
229
214
|
}, {
|
|
230
|
-
default:
|
|
231
|
-
|
|
215
|
+
default: h(() => [
|
|
216
|
+
G(Y(e.$i18n.t("banners:banners")), 1)
|
|
232
217
|
]),
|
|
233
218
|
_: 2
|
|
234
219
|
}, 1032, ["href", "count"])
|
|
@@ -239,377 +224,354 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
239
224
|
_: 1
|
|
240
225
|
}, 8, ["title"]);
|
|
241
226
|
}
|
|
242
|
-
|
|
243
|
-
function
|
|
244
|
-
const [
|
|
245
|
-
fetchResource:
|
|
227
|
+
const Ye = /* @__PURE__ */ V(je, [["render", Ge]]);
|
|
228
|
+
function ne() {
|
|
229
|
+
const [e, n] = P({
|
|
230
|
+
fetchResource: x,
|
|
246
231
|
initialValue: [],
|
|
247
232
|
resourceName: "Banner zones"
|
|
248
233
|
});
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
});
|
|
252
|
-
return resource;
|
|
234
|
+
return k(() => {
|
|
235
|
+
e();
|
|
236
|
+
}), n;
|
|
253
237
|
}
|
|
254
|
-
function
|
|
255
|
-
switch (
|
|
256
|
-
case
|
|
257
|
-
return
|
|
258
|
-
case
|
|
259
|
-
return
|
|
260
|
-
case
|
|
261
|
-
return
|
|
262
|
-
case
|
|
263
|
-
return
|
|
238
|
+
function ae(e, n) {
|
|
239
|
+
switch (e) {
|
|
240
|
+
case T.Waiting:
|
|
241
|
+
return n("banners:statuses.waiting");
|
|
242
|
+
case T.Archived:
|
|
243
|
+
return n("banners:statuses.archived");
|
|
244
|
+
case T.Active:
|
|
245
|
+
return n("banners:statuses.active");
|
|
246
|
+
case T.Disabled:
|
|
247
|
+
return n("banners:statuses.disabled");
|
|
264
248
|
default:
|
|
265
249
|
return "";
|
|
266
250
|
}
|
|
267
251
|
}
|
|
268
|
-
function
|
|
252
|
+
function Je(e, n) {
|
|
269
253
|
return [
|
|
270
254
|
{
|
|
271
255
|
id: 0,
|
|
272
256
|
name: "#",
|
|
273
257
|
field: "id",
|
|
274
|
-
format: ({ rowIndex }) => String(
|
|
258
|
+
format: ({ rowIndex: t }) => String(t + 1),
|
|
275
259
|
style: { width: "50px", textAlign: "center" },
|
|
276
260
|
headStyle: { width: "50px", textAlign: "center" }
|
|
277
261
|
},
|
|
278
262
|
{
|
|
279
263
|
id: 1,
|
|
280
|
-
name:
|
|
264
|
+
name: n("banners:zone"),
|
|
281
265
|
field: "bannerZone",
|
|
282
|
-
format: ({ row }) => {
|
|
283
|
-
const
|
|
284
|
-
(
|
|
266
|
+
format: ({ row: t }) => {
|
|
267
|
+
const r = e.find(
|
|
268
|
+
(o) => o.id === t.bannerZone
|
|
285
269
|
);
|
|
286
|
-
return
|
|
270
|
+
return r ? r.name : n("banners:bannerZoneIsDeleted");
|
|
287
271
|
}
|
|
288
272
|
},
|
|
289
273
|
{
|
|
290
274
|
id: 2,
|
|
291
|
-
name:
|
|
275
|
+
name: n("banners:status"),
|
|
292
276
|
field: "status",
|
|
293
|
-
format: ({ row }) =>
|
|
277
|
+
format: ({ row: t }) => ae(t.status, n),
|
|
294
278
|
style: { width: "120px" },
|
|
295
279
|
headStyle: { width: "120px" }
|
|
296
280
|
},
|
|
297
281
|
{
|
|
298
282
|
id: 3,
|
|
299
|
-
name:
|
|
283
|
+
name: n("banners:priority"),
|
|
300
284
|
field: "priority",
|
|
301
285
|
style: { width: "100px", textAlign: "center" },
|
|
302
286
|
headStyle: { width: "100px", textAlign: "center" }
|
|
303
287
|
},
|
|
304
288
|
{
|
|
305
289
|
id: 4,
|
|
306
|
-
name:
|
|
290
|
+
name: n("banners:period"),
|
|
307
291
|
field: "dateStart",
|
|
308
|
-
format: ({ row }) => `${
|
|
292
|
+
format: ({ row: t }) => `${t.dateStart ? `${n("banners:from")} ${t.dateStart}` : ""} ${t.dateEnd ? `${n("banners:to")} ${t.dateEnd}` : ""}`
|
|
309
293
|
},
|
|
310
294
|
{
|
|
311
295
|
id: 5,
|
|
312
|
-
name:
|
|
296
|
+
name: n("banners:image"),
|
|
313
297
|
field: "image",
|
|
314
298
|
type: "image"
|
|
315
299
|
},
|
|
316
300
|
{
|
|
317
301
|
id: 6,
|
|
318
|
-
name:
|
|
302
|
+
name: n("banners:link"),
|
|
319
303
|
field: "link",
|
|
320
304
|
type: "name",
|
|
321
|
-
format: ({ row }) => {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
]
|
|
334
|
-
};
|
|
335
|
-
},
|
|
305
|
+
format: ({ row: t }) => ({
|
|
306
|
+
adminLink: {
|
|
307
|
+
url: t.link ?? "",
|
|
308
|
+
text: t.link ?? ""
|
|
309
|
+
},
|
|
310
|
+
paramList: [
|
|
311
|
+
{
|
|
312
|
+
name: n("banners:newTab"),
|
|
313
|
+
value: t.openNewTab ? n("banners:yes") : n("banners:no")
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
}),
|
|
336
317
|
options: {
|
|
337
|
-
shouldOpenNewTab:
|
|
318
|
+
shouldOpenNewTab: !0
|
|
338
319
|
}
|
|
339
320
|
},
|
|
340
321
|
{
|
|
341
322
|
id: 7,
|
|
342
|
-
name:
|
|
323
|
+
name: n("banners:comment"),
|
|
343
324
|
field: "comment"
|
|
344
325
|
},
|
|
345
326
|
{
|
|
346
327
|
id: 8,
|
|
347
|
-
name:
|
|
328
|
+
name: n("banners:actions"),
|
|
348
329
|
field: "actions",
|
|
349
330
|
style: { whiteSpace: "nowrap", width: "100px" },
|
|
350
331
|
headStyle: { whiteSpace: "nowrap", width: "100px" }
|
|
351
332
|
}
|
|
352
333
|
];
|
|
353
334
|
}
|
|
354
|
-
function
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}) {
|
|
360
|
-
const zonesOptionList = computed(
|
|
361
|
-
() => zoneList.value.map(({ id, name }) => ({
|
|
362
|
-
value: id,
|
|
363
|
-
label: name
|
|
335
|
+
function Ke({ t: e, zoneList: n, route: t }) {
|
|
336
|
+
const r = f(
|
|
337
|
+
() => n.value.map(({ id: a, name: s }) => ({
|
|
338
|
+
value: a,
|
|
339
|
+
label: s
|
|
364
340
|
}))
|
|
365
|
-
)
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
route.query,
|
|
341
|
+
), o = f(() => {
|
|
342
|
+
const a = H(
|
|
343
|
+
t.query,
|
|
369
344
|
"zone"
|
|
345
|
+
/* Zone */
|
|
370
346
|
);
|
|
371
|
-
return
|
|
372
|
-
({ value }) =>
|
|
347
|
+
return r.value.filter(
|
|
348
|
+
({ value: s }) => a.some(($) => $ === s)
|
|
373
349
|
);
|
|
350
|
+
}), u = D(o.value);
|
|
351
|
+
N(o, () => {
|
|
352
|
+
u.value = o.value;
|
|
374
353
|
});
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
|
|
354
|
+
const p = f(
|
|
355
|
+
() => he(
|
|
356
|
+
t.query,
|
|
357
|
+
"date"
|
|
358
|
+
/* Date */
|
|
359
|
+
) ?? ""
|
|
360
|
+
), l = D(p.value);
|
|
361
|
+
N(p, () => {
|
|
362
|
+
l.value = p.value;
|
|
378
363
|
});
|
|
379
|
-
const
|
|
380
|
-
() => {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}
|
|
384
|
-
);
|
|
385
|
-
const dateFilter = ref(initialDateFilter.value);
|
|
386
|
-
watch(initialDateFilter, () => {
|
|
387
|
-
dateFilter.value = initialDateFilter.value;
|
|
388
|
-
});
|
|
389
|
-
const statusesOptionList = computed(
|
|
390
|
-
() => Object.entries(Status).map(([_, value]) => ({
|
|
391
|
-
value,
|
|
392
|
-
label: getStatus(value, t)
|
|
364
|
+
const b = f(
|
|
365
|
+
() => Object.entries(T).map(([a, s]) => ({
|
|
366
|
+
value: s,
|
|
367
|
+
label: ae(s, e)
|
|
393
368
|
}))
|
|
394
|
-
)
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
route.query,
|
|
369
|
+
), d = f(() => {
|
|
370
|
+
const a = H(
|
|
371
|
+
t.query,
|
|
398
372
|
"status"
|
|
373
|
+
/* Status */
|
|
399
374
|
);
|
|
400
|
-
return
|
|
401
|
-
({ value }) =>
|
|
375
|
+
return b.value.filter(
|
|
376
|
+
({ value: s }) => a.some(($) => $ === s)
|
|
402
377
|
);
|
|
378
|
+
}), c = D(d.value);
|
|
379
|
+
N(d, () => {
|
|
380
|
+
c.value = d.value;
|
|
403
381
|
});
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
() => getFilterParams({
|
|
410
|
-
["zone"]: zoneFilter.value.map(({ value }) => value),
|
|
411
|
-
["date"]: dateFilter.value || [],
|
|
412
|
-
["status"]: statusFilter.value.map(({ value }) => value)
|
|
382
|
+
const y = f(
|
|
383
|
+
() => ye({
|
|
384
|
+
zone: u.value.map(({ value: a }) => a),
|
|
385
|
+
date: l.value || [],
|
|
386
|
+
status: c.value.map(({ value: a }) => a)
|
|
413
387
|
})
|
|
388
|
+
), v = (a) => {
|
|
389
|
+
a.name === "zone" && (u.value = u.value.filter(
|
|
390
|
+
({ value: s }) => s !== a.value
|
|
391
|
+
)), a.name === "date" && (l.value = ""), a.name === "status" && (c.value = c.value.filter(
|
|
392
|
+
({ value: s }) => s !== a.value
|
|
393
|
+
));
|
|
394
|
+
}, g = f(
|
|
395
|
+
() => [
|
|
396
|
+
...u.value.map(({ value: a, label: s }) => ({
|
|
397
|
+
value: a,
|
|
398
|
+
label: s,
|
|
399
|
+
name: "zone",
|
|
400
|
+
title: e("banners:zone")
|
|
401
|
+
})),
|
|
402
|
+
...c.value.map(({ value: a, label: s }) => ({
|
|
403
|
+
value: a,
|
|
404
|
+
label: s,
|
|
405
|
+
name: "status",
|
|
406
|
+
title: e("banners:status")
|
|
407
|
+
})),
|
|
408
|
+
l.value ? {
|
|
409
|
+
value: l.value,
|
|
410
|
+
label: l.value,
|
|
411
|
+
name: "date",
|
|
412
|
+
title: e("banners:date")
|
|
413
|
+
} : null
|
|
414
|
+
].filter(le)
|
|
414
415
|
);
|
|
415
|
-
const tagRemovalHandler = (event) => {
|
|
416
|
-
if (event.name === "zone") {
|
|
417
|
-
zoneFilter.value = zoneFilter.value.filter(
|
|
418
|
-
({ value }) => value !== event.value
|
|
419
|
-
);
|
|
420
|
-
}
|
|
421
|
-
if (event.name === "date") {
|
|
422
|
-
dateFilter.value = "";
|
|
423
|
-
}
|
|
424
|
-
if (event.name === "status") {
|
|
425
|
-
statusFilter.value = statusFilter.value.filter(
|
|
426
|
-
({ value }) => value !== event.value
|
|
427
|
-
);
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
const tags = computed(() => []);
|
|
431
416
|
return {
|
|
432
|
-
zoneFilter,
|
|
433
|
-
zonesOptionList,
|
|
434
|
-
dateFilter,
|
|
435
|
-
statusFilter,
|
|
436
|
-
statusesOptionList,
|
|
437
|
-
filterParams,
|
|
438
|
-
tags,
|
|
439
|
-
tagRemovalHandler
|
|
417
|
+
zoneFilter: u,
|
|
418
|
+
zonesOptionList: r,
|
|
419
|
+
dateFilter: l,
|
|
420
|
+
statusFilter: c,
|
|
421
|
+
statusesOptionList: b,
|
|
422
|
+
filterParams: y,
|
|
423
|
+
tags: g,
|
|
424
|
+
tagRemovalHandler: v
|
|
440
425
|
};
|
|
441
426
|
}
|
|
442
|
-
|
|
443
|
-
const _sfc_main$1 = defineComponent({
|
|
427
|
+
const Xe = q({
|
|
444
428
|
name: "BannerList",
|
|
445
429
|
components: {
|
|
446
|
-
DeleteIcon,
|
|
447
|
-
EditIcon,
|
|
448
|
-
BaseButton,
|
|
449
|
-
FormField,
|
|
450
|
-
FormFieldMultiSelect,
|
|
451
|
-
AdvancedSearch,
|
|
452
|
-
Page,
|
|
453
|
-
DataTable
|
|
430
|
+
DeleteIcon: $e,
|
|
431
|
+
EditIcon: Le,
|
|
432
|
+
BaseButton: Ne,
|
|
433
|
+
FormField: X,
|
|
434
|
+
FormFieldMultiSelect: Se,
|
|
435
|
+
AdvancedSearch: Be,
|
|
436
|
+
Page: W,
|
|
437
|
+
DataTable: J
|
|
454
438
|
},
|
|
455
|
-
setup(
|
|
456
|
-
const
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
filterParams,
|
|
467
|
-
tags,
|
|
468
|
-
tagRemovalHandler
|
|
469
|
-
} = useAdvancedSearch({
|
|
470
|
-
context,
|
|
439
|
+
setup() {
|
|
440
|
+
const e = Q(), n = j(), { t } = O(), { loading: r, data: o } = ne(), {
|
|
441
|
+
zoneFilter: u,
|
|
442
|
+
zonesOptionList: p,
|
|
443
|
+
dateFilter: l,
|
|
444
|
+
statusFilter: b,
|
|
445
|
+
statusesOptionList: d,
|
|
446
|
+
filterParams: c,
|
|
447
|
+
tags: y,
|
|
448
|
+
tagRemovalHandler: v
|
|
449
|
+
} = Ke({
|
|
471
450
|
t,
|
|
472
|
-
zoneList,
|
|
473
|
-
route
|
|
474
|
-
})
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
...filterParams.value
|
|
451
|
+
zoneList: o,
|
|
452
|
+
route: e
|
|
453
|
+
}), {
|
|
454
|
+
fetchEntityList: g,
|
|
455
|
+
isLoading: a,
|
|
456
|
+
rowData: s,
|
|
457
|
+
errorMessage: $,
|
|
458
|
+
handleChange: I,
|
|
459
|
+
searchQuery: F,
|
|
460
|
+
pageNumber: w,
|
|
461
|
+
pageCount: z,
|
|
462
|
+
pageSize: E
|
|
463
|
+
} = K({
|
|
464
|
+
fetchEntityList: (S) => Pe({
|
|
465
|
+
query: S.searchQuery,
|
|
466
|
+
pageNumber: S.pageNumber,
|
|
467
|
+
pageSize: S.pageSize,
|
|
468
|
+
...c.value
|
|
491
469
|
}),
|
|
492
470
|
initialValue: [],
|
|
493
471
|
resourceName: "Banners"
|
|
494
472
|
});
|
|
495
|
-
|
|
496
|
-
if (
|
|
473
|
+
N(c, () => {
|
|
474
|
+
if (r.value)
|
|
497
475
|
return;
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
...
|
|
501
|
-
...filterParams.value
|
|
476
|
+
const S = {
|
|
477
|
+
...ke(e.query, ["query", "pageNumber"]),
|
|
478
|
+
...c.value
|
|
502
479
|
};
|
|
503
|
-
|
|
504
|
-
router.replace({ query: newQuery });
|
|
505
|
-
fetchBanners();
|
|
506
|
-
}
|
|
480
|
+
Ze(e.query, S) || (n.replace({ query: S }), g());
|
|
507
481
|
});
|
|
508
|
-
const { isDeleting, handleResourceDelete } =
|
|
509
|
-
deleteResource:
|
|
482
|
+
const { isDeleting: te, handleResourceDelete: re } = ue({
|
|
483
|
+
deleteResource: Me,
|
|
510
484
|
resourceName: "Banner",
|
|
511
|
-
onSuccess:
|
|
512
|
-
})
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
const columnDefs = computed(
|
|
517
|
-
() => getColumnDefs(zoneList.value, t)
|
|
518
|
-
);
|
|
519
|
-
const isRowDataLoading = computed(
|
|
520
|
-
() => isBannersLoading.value || isZonesLoading.value
|
|
485
|
+
onSuccess: g
|
|
486
|
+
}), oe = (S) => te(S) || a.value, se = f(
|
|
487
|
+
() => Je(o.value, t)
|
|
488
|
+
), ie = f(
|
|
489
|
+
() => a.value || r.value
|
|
521
490
|
);
|
|
522
491
|
return {
|
|
523
|
-
columnDefs,
|
|
524
|
-
isRowDataLoading,
|
|
525
|
-
rowData,
|
|
526
|
-
errorMessage
|
|
527
|
-
handleChange,
|
|
528
|
-
getBannersBannerFormUrl,
|
|
529
|
-
searchQuery,
|
|
530
|
-
pageNumber,
|
|
531
|
-
pageCount,
|
|
532
|
-
pageSize,
|
|
533
|
-
isBusy,
|
|
534
|
-
handleResourceDelete,
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
492
|
+
columnDefs: se,
|
|
493
|
+
isRowDataLoading: ie,
|
|
494
|
+
rowData: s,
|
|
495
|
+
errorMessage: $,
|
|
496
|
+
handleChange: I,
|
|
497
|
+
getBannersBannerFormUrl: ee,
|
|
498
|
+
searchQuery: F,
|
|
499
|
+
pageNumber: w,
|
|
500
|
+
pageCount: z,
|
|
501
|
+
pageSize: E,
|
|
502
|
+
isBusy: oe,
|
|
503
|
+
handleResourceDelete: re,
|
|
504
|
+
// Advanced search
|
|
505
|
+
zoneFilter: u,
|
|
506
|
+
zonesOptionList: p,
|
|
507
|
+
dateFilter: l,
|
|
508
|
+
statusFilter: b,
|
|
509
|
+
statusesOptionList: d,
|
|
510
|
+
tags: y,
|
|
511
|
+
tagRemovalHandler: v
|
|
542
512
|
};
|
|
543
513
|
}
|
|
544
|
-
});
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
const _component_AdvancedSearch = resolveComponent("AdvancedSearch");
|
|
550
|
-
const _component_EditIcon = resolveComponent("EditIcon");
|
|
551
|
-
const _component_BaseButton = resolveComponent("BaseButton");
|
|
552
|
-
const _component_DeleteIcon = resolveComponent("DeleteIcon");
|
|
553
|
-
const _component_DataTable = resolveComponent("DataTable");
|
|
554
|
-
const _component_Page = resolveComponent("Page");
|
|
555
|
-
return openBlock(), createBlock(_component_Page, {
|
|
556
|
-
title: _ctx.$i18n.t("banners:banners"),
|
|
514
|
+
}), _e = { class: "filters" };
|
|
515
|
+
function xe(e, n, t, r, o, u) {
|
|
516
|
+
const p = m("FormFieldMultiSelect"), l = m("FormField"), b = m("AdvancedSearch"), d = m("EditIcon"), c = m("BaseButton"), y = m("DeleteIcon"), v = m("DataTable"), g = m("Page");
|
|
517
|
+
return R(), Z(g, {
|
|
518
|
+
title: e.$i18n.t("banners:banners"),
|
|
557
519
|
"header-buttons": [
|
|
558
520
|
{
|
|
559
|
-
text:
|
|
560
|
-
href:
|
|
521
|
+
text: e.$i18n.t("banners:createBanner"),
|
|
522
|
+
href: e.getBannersBannerFormUrl({ bannerId: "create" })
|
|
561
523
|
}
|
|
562
524
|
]
|
|
563
525
|
}, {
|
|
564
|
-
content:
|
|
565
|
-
|
|
566
|
-
"column-defs":
|
|
567
|
-
"row-data":
|
|
568
|
-
loading:
|
|
569
|
-
"error-message":
|
|
526
|
+
content: h(() => [
|
|
527
|
+
i(v, {
|
|
528
|
+
"column-defs": e.columnDefs,
|
|
529
|
+
"row-data": e.rowData,
|
|
530
|
+
loading: e.isRowDataLoading,
|
|
531
|
+
"error-message": e.errorMessage,
|
|
570
532
|
"data-table": "banners",
|
|
571
|
-
"use-search":
|
|
572
|
-
"use-pagination":
|
|
573
|
-
"search-query":
|
|
533
|
+
"use-search": !0,
|
|
534
|
+
"use-pagination": !0,
|
|
535
|
+
"search-query": e.searchQuery,
|
|
574
536
|
pagination: {
|
|
575
|
-
pageNumber:
|
|
576
|
-
pageCount:
|
|
577
|
-
pageSize:
|
|
578
|
-
disabled:
|
|
537
|
+
pageNumber: e.pageNumber,
|
|
538
|
+
pageCount: e.pageCount,
|
|
539
|
+
pageSize: e.pageSize,
|
|
540
|
+
disabled: e.isRowDataLoading
|
|
579
541
|
},
|
|
580
|
-
onChange:
|
|
542
|
+
onChange: e.handleChange
|
|
581
543
|
}, {
|
|
582
|
-
filters:
|
|
583
|
-
|
|
584
|
-
tags:
|
|
585
|
-
"onClick:tag":
|
|
544
|
+
filters: h(() => [
|
|
545
|
+
i(b, {
|
|
546
|
+
tags: e.tags,
|
|
547
|
+
"onClick:tag": e.tagRemovalHandler
|
|
586
548
|
}, {
|
|
587
|
-
default:
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
"selected-options":
|
|
591
|
-
"onUpdate:selected-options":
|
|
592
|
-
options:
|
|
549
|
+
default: h(() => [
|
|
550
|
+
C("div", _e, [
|
|
551
|
+
i(p, {
|
|
552
|
+
"selected-options": e.zoneFilter,
|
|
553
|
+
"onUpdate:selected-options": n[0] || (n[0] = (a) => e.zoneFilter = a),
|
|
554
|
+
options: e.zonesOptionList,
|
|
593
555
|
name: "zoneFilter",
|
|
594
|
-
searchable:
|
|
595
|
-
label:
|
|
556
|
+
searchable: !0,
|
|
557
|
+
label: e.$i18n.t("banners:zone"),
|
|
596
558
|
class: "filter"
|
|
597
559
|
}, null, 8, ["selected-options", "options", "label"]),
|
|
598
|
-
|
|
599
|
-
value:
|
|
600
|
-
"onUpdate:value":
|
|
601
|
-
label:
|
|
560
|
+
i(l, {
|
|
561
|
+
value: e.dateFilter,
|
|
562
|
+
"onUpdate:value": n[1] || (n[1] = (a) => e.dateFilter = a),
|
|
563
|
+
label: e.$i18n.t("banners:date"),
|
|
602
564
|
name: "dateFilter",
|
|
603
565
|
type: "date",
|
|
604
566
|
class: "filter"
|
|
605
567
|
}, null, 8, ["value", "label"]),
|
|
606
|
-
|
|
607
|
-
"selected-options":
|
|
608
|
-
"onUpdate:selected-options":
|
|
609
|
-
options:
|
|
568
|
+
i(p, {
|
|
569
|
+
"selected-options": e.statusFilter,
|
|
570
|
+
"onUpdate:selected-options": n[2] || (n[2] = (a) => e.statusFilter = a),
|
|
571
|
+
options: e.statusesOptionList,
|
|
610
572
|
name: "statusFilter",
|
|
611
|
-
searchable:
|
|
612
|
-
label:
|
|
573
|
+
searchable: !0,
|
|
574
|
+
label: e.$i18n.t("banners:status"),
|
|
613
575
|
class: "filter"
|
|
614
576
|
}, null, 8, ["selected-options", "options", "label"])
|
|
615
577
|
])
|
|
@@ -617,26 +579,26 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
617
579
|
_: 1
|
|
618
580
|
}, 8, ["tags", "onClick:tag"])
|
|
619
581
|
]),
|
|
620
|
-
"cell(actions)":
|
|
621
|
-
|
|
582
|
+
"cell(actions)": h(({ row: a }) => [
|
|
583
|
+
i(c, {
|
|
622
584
|
variant: "icon",
|
|
623
|
-
title:
|
|
624
|
-
disabled:
|
|
625
|
-
href:
|
|
585
|
+
title: e.$i18n.t("banners:edit"),
|
|
586
|
+
disabled: e.isBusy(a.id),
|
|
587
|
+
href: e.getBannersBannerFormUrl({ bannerId: a.id })
|
|
626
588
|
}, {
|
|
627
|
-
default:
|
|
628
|
-
|
|
589
|
+
default: h(() => [
|
|
590
|
+
i(d)
|
|
629
591
|
]),
|
|
630
592
|
_: 2
|
|
631
593
|
}, 1032, ["title", "disabled", "href"]),
|
|
632
|
-
|
|
594
|
+
i(c, {
|
|
633
595
|
variant: "icon",
|
|
634
|
-
title:
|
|
635
|
-
disabled:
|
|
636
|
-
onClick: (
|
|
596
|
+
title: e.$i18n.t("banners:remove"),
|
|
597
|
+
disabled: e.isBusy(a.id),
|
|
598
|
+
onClick: (s) => e.handleResourceDelete(a.id)
|
|
637
599
|
}, {
|
|
638
|
-
default:
|
|
639
|
-
|
|
600
|
+
default: h(() => [
|
|
601
|
+
i(y)
|
|
640
602
|
]),
|
|
641
603
|
_: 2
|
|
642
604
|
}, 1032, ["title", "disabled", "onClick"])
|
|
@@ -647,347 +609,303 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
647
609
|
_: 1
|
|
648
610
|
}, 8, ["title", "header-buttons"]);
|
|
649
611
|
}
|
|
650
|
-
|
|
651
|
-
function
|
|
652
|
-
bannerId,
|
|
653
|
-
isCreation
|
|
612
|
+
const en = /* @__PURE__ */ V(Xe, [["render", xe]]);
|
|
613
|
+
function nn({
|
|
614
|
+
bannerId: e,
|
|
615
|
+
isCreation: n
|
|
654
616
|
}) {
|
|
655
|
-
const [
|
|
656
|
-
fetchResource: () =>
|
|
617
|
+
const [t, r] = P({
|
|
618
|
+
fetchResource: () => qe(e.value),
|
|
657
619
|
initialValue: null,
|
|
658
620
|
resourceName: "Banner"
|
|
659
621
|
});
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
});
|
|
666
|
-
watch(bannerId, () => {
|
|
667
|
-
if (isCreation.value || !bannerId.value) {
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
fetchBanner();
|
|
671
|
-
});
|
|
672
|
-
return resource;
|
|
622
|
+
return k(() => {
|
|
623
|
+
n.value || !e.value || t();
|
|
624
|
+
}), N(e, () => {
|
|
625
|
+
n.value || !e.value || t();
|
|
626
|
+
}), r;
|
|
673
627
|
}
|
|
674
|
-
function
|
|
675
|
-
values
|
|
628
|
+
function an({
|
|
629
|
+
values: e
|
|
676
630
|
}) {
|
|
677
|
-
const
|
|
678
|
-
var
|
|
679
|
-
return (
|
|
680
|
-
})
|
|
681
|
-
|
|
682
|
-
fetchResource: () => getZoneFields(zoneId.value),
|
|
631
|
+
const n = f(() => {
|
|
632
|
+
var o;
|
|
633
|
+
return ((o = e.value.bannerZone) == null ? void 0 : o.value) ?? "";
|
|
634
|
+
}), [t, r] = P({
|
|
635
|
+
fetchResource: () => Oe(n.value),
|
|
683
636
|
initialValue: null,
|
|
684
637
|
resourceName: "Zone Fields"
|
|
685
638
|
});
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
});
|
|
692
|
-
watch(zoneId, () => {
|
|
693
|
-
if (!zoneId.value) {
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
696
|
-
fetchZoneFields();
|
|
697
|
-
});
|
|
698
|
-
return resource;
|
|
639
|
+
return k(() => {
|
|
640
|
+
n.value && t();
|
|
641
|
+
}), N(n, () => {
|
|
642
|
+
n.value && t();
|
|
643
|
+
}), r;
|
|
699
644
|
}
|
|
700
|
-
function
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
({ value }) => value === (banner == null ? void 0 : banner.bannerZone)
|
|
645
|
+
function A(e, n) {
|
|
646
|
+
const t = n.find(
|
|
647
|
+
({ value: r }) => r === (e == null ? void 0 : e.bannerZone)
|
|
704
648
|
);
|
|
705
649
|
return {
|
|
706
|
-
priority: String((
|
|
707
|
-
link: (
|
|
708
|
-
image:
|
|
709
|
-
bannerZone:
|
|
710
|
-
openNewTab: (
|
|
711
|
-
dateStart: (
|
|
712
|
-
dateEnd: (
|
|
713
|
-
disabled: (
|
|
714
|
-
comment: (
|
|
650
|
+
priority: String((e == null ? void 0 : e.priority) ?? 1),
|
|
651
|
+
link: (e == null ? void 0 : e.link) ?? "",
|
|
652
|
+
image: e != null && e.image ? { id: de(), file: e.image } : null,
|
|
653
|
+
bannerZone: t ?? null,
|
|
654
|
+
openNewTab: (e == null ? void 0 : e.openNewTab) ?? !1,
|
|
655
|
+
dateStart: (e == null ? void 0 : e.dateStart) ?? "",
|
|
656
|
+
dateEnd: (e == null ? void 0 : e.dateEnd) ?? "",
|
|
657
|
+
disabled: (e == null ? void 0 : e.disabled) ?? !1,
|
|
658
|
+
comment: (e == null ? void 0 : e.comment) ?? "",
|
|
715
659
|
fields: []
|
|
716
660
|
};
|
|
717
661
|
}
|
|
718
|
-
function
|
|
719
|
-
var
|
|
662
|
+
function tn(e) {
|
|
663
|
+
var n, t;
|
|
720
664
|
return {
|
|
721
|
-
...
|
|
722
|
-
priority:
|
|
723
|
-
dateStart:
|
|
724
|
-
dateEnd:
|
|
725
|
-
image: (
|
|
726
|
-
bannerZone: (
|
|
727
|
-
fields:
|
|
728
|
-
name:
|
|
729
|
-
value:
|
|
665
|
+
...e,
|
|
666
|
+
priority: e.priority ? Number(e.priority) : 1,
|
|
667
|
+
dateStart: e.dateStart ? e.dateStart : null,
|
|
668
|
+
dateEnd: e.dateEnd ? e.dateEnd : null,
|
|
669
|
+
image: ((n = e.image) == null ? void 0 : n.file.id) ?? null,
|
|
670
|
+
bannerZone: ((t = e.bannerZone) == null ? void 0 : t.value) ?? "",
|
|
671
|
+
fields: e.fields.map((r) => ({
|
|
672
|
+
name: r.config.name,
|
|
673
|
+
value: _.getOutgoingValue(r)
|
|
730
674
|
}))
|
|
731
675
|
};
|
|
732
676
|
}
|
|
733
|
-
|
|
734
|
-
const _sfc_main = defineComponent({
|
|
677
|
+
const rn = q({
|
|
735
678
|
name: "BannerForm",
|
|
736
679
|
components: {
|
|
737
|
-
FormFieldFileInput,
|
|
738
|
-
FormFieldCheckbox,
|
|
739
|
-
InputLabel,
|
|
740
|
-
FormField,
|
|
741
|
-
FormFieldSelect,
|
|
742
|
-
Page,
|
|
743
|
-
FormFooter,
|
|
744
|
-
DynamicField
|
|
680
|
+
FormFieldFileInput: Ce,
|
|
681
|
+
FormFieldCheckbox: De,
|
|
682
|
+
InputLabel: Te,
|
|
683
|
+
FormField: X,
|
|
684
|
+
FormFieldSelect: Ee,
|
|
685
|
+
Page: W,
|
|
686
|
+
FormFooter: we,
|
|
687
|
+
DynamicField: Re
|
|
745
688
|
},
|
|
746
689
|
setup() {
|
|
747
|
-
const
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
const bannerId = computed(() => route.params.bannerId);
|
|
752
|
-
const isCreation = computed(() => bannerId.value === "create");
|
|
753
|
-
const { data: zones, loading: isZonesLoading } = useFetchZones();
|
|
754
|
-
const zonesOptionList = computed(
|
|
755
|
-
() => zones.value.map((zone) => ({
|
|
756
|
-
value: zone.id,
|
|
757
|
-
label: zone.name
|
|
690
|
+
const e = Q(), n = j(), t = me(), { t: r } = O(), o = f(() => e.params.bannerId), u = f(() => o.value === "create"), { data: p, loading: l } = ne(), b = f(
|
|
691
|
+
() => p.value.map((F) => ({
|
|
692
|
+
value: F.id,
|
|
693
|
+
label: F.name
|
|
758
694
|
}))
|
|
759
|
-
)
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
watch([banner, zones], () => {
|
|
770
|
-
values.value = convertBannerToFormValues(
|
|
771
|
-
banner.value,
|
|
772
|
-
zonesOptionList.value
|
|
695
|
+
), { data: d, loading: c } = nn({
|
|
696
|
+
bannerId: o,
|
|
697
|
+
isCreation: u
|
|
698
|
+
}), y = D(!1), v = D(
|
|
699
|
+
A(d.value, b.value)
|
|
700
|
+
), g = D({});
|
|
701
|
+
N([d, p], () => {
|
|
702
|
+
v.value = A(
|
|
703
|
+
d.value,
|
|
704
|
+
b.value
|
|
773
705
|
);
|
|
774
706
|
});
|
|
775
|
-
const { loading:
|
|
776
|
-
|
|
777
|
-
var
|
|
778
|
-
|
|
779
|
-
(
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
banner.value ? (_a2 = banner.value.fields[index].value) != null ? _a2 : null : null
|
|
784
|
-
);
|
|
785
|
-
}
|
|
707
|
+
const { loading: a, data: s } = an({ values: v });
|
|
708
|
+
N(s, () => {
|
|
709
|
+
var F;
|
|
710
|
+
v.value.fields = (((F = s.value) == null ? void 0 : F.fields) ?? []).map(
|
|
711
|
+
(w, z) => _.createFormField(
|
|
712
|
+
w,
|
|
713
|
+
d.value ? d.value.fields[z].value ?? null : null
|
|
714
|
+
)
|
|
786
715
|
);
|
|
787
716
|
});
|
|
788
|
-
const
|
|
789
|
-
|
|
790
|
-
const
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
} else if (event.type === "create_exit" || event.type === "save_exit") {
|
|
797
|
-
navigateBack(router, getBannersBannerListUrl());
|
|
798
|
-
} else if (event.type === "create_create-another") {
|
|
799
|
-
values.value = convertBannerToFormValues(
|
|
800
|
-
null,
|
|
801
|
-
zonesOptionList.value
|
|
802
|
-
);
|
|
803
|
-
}
|
|
804
|
-
toast.show({
|
|
717
|
+
const $ = (F) => {
|
|
718
|
+
y.value = !0;
|
|
719
|
+
const w = tn(v.value);
|
|
720
|
+
(u.value ? We(w) : Ve(o.value, w)).then(({ data: E }) => {
|
|
721
|
+
g.value = {}, F.type === "create" ? n.push(ee({ bannerId: String(E.id) })) : F.type === "create_exit" || F.type === "save_exit" ? ce(n, U()) : F.type === "create_create-another" && (v.value = A(
|
|
722
|
+
null,
|
|
723
|
+
b.value
|
|
724
|
+
)), t.show({
|
|
805
725
|
variant: "success",
|
|
806
|
-
title:
|
|
807
|
-
body:
|
|
726
|
+
title: r("banners:success"),
|
|
727
|
+
body: u.value ? r("banners:bannerWasSuccessfullyCreated") : r("banners:bannerWasSuccessfullyUpdated")
|
|
808
728
|
});
|
|
809
|
-
}).catch((
|
|
810
|
-
console.error(
|
|
811
|
-
errors.value = convertRequestErrorToMap(error);
|
|
812
|
-
toast.show({
|
|
729
|
+
}).catch((E) => {
|
|
730
|
+
console.error(E), g.value = pe(E), t.show({
|
|
813
731
|
variant: "danger",
|
|
814
|
-
title:
|
|
815
|
-
body:
|
|
732
|
+
title: r("banners:error"),
|
|
733
|
+
body: u.value ? r("banners:bannerCreationWasFailed") : r("banners:bannerUpdateWasFailed")
|
|
816
734
|
});
|
|
817
735
|
}).finally(() => {
|
|
818
|
-
|
|
736
|
+
y.value = !1;
|
|
819
737
|
});
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
() => isBannerLoading.value || isZonesLoading.value || isZoneFieldsLoading.value
|
|
738
|
+
}, I = f(
|
|
739
|
+
() => c.value || l.value || a.value
|
|
823
740
|
);
|
|
824
741
|
return {
|
|
825
|
-
isCreation,
|
|
826
|
-
isContentLoading,
|
|
827
|
-
isSubmitting,
|
|
828
|
-
values,
|
|
829
|
-
errors,
|
|
830
|
-
submitForm
|
|
831
|
-
bannerListUrl:
|
|
832
|
-
zonesOptionList
|
|
742
|
+
isCreation: u,
|
|
743
|
+
isContentLoading: I,
|
|
744
|
+
isSubmitting: y,
|
|
745
|
+
values: v,
|
|
746
|
+
errors: g,
|
|
747
|
+
submitForm: $,
|
|
748
|
+
bannerListUrl: U(),
|
|
749
|
+
zonesOptionList: b
|
|
833
750
|
};
|
|
834
751
|
}
|
|
835
|
-
});
|
|
836
|
-
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
const _component_FormField = resolveComponent("FormField");
|
|
842
|
-
const _component_InputLabel = resolveComponent("InputLabel");
|
|
843
|
-
const _component_FormFieldCheckbox = resolveComponent("FormFieldCheckbox");
|
|
844
|
-
const _component_FormFieldFileInput = resolveComponent("FormFieldFileInput");
|
|
845
|
-
const _component_DynamicField = resolveComponent("DynamicField");
|
|
846
|
-
const _component_FormFooter = resolveComponent("FormFooter");
|
|
847
|
-
const _component_Page = resolveComponent("Page");
|
|
848
|
-
return openBlock(), createBlock(_component_Page, {
|
|
849
|
-
title: _ctx.isCreation ? _ctx.$i18n.t("banners:createBanner") : _ctx.$i18n.t("banners:updateBanner"),
|
|
850
|
-
"is-content-loading": _ctx.isContentLoading
|
|
752
|
+
}), on = { class: "zone" }, sn = { class: "date" }, ln = { class: "link" };
|
|
753
|
+
function un(e, n, t, r, o, u) {
|
|
754
|
+
const p = m("FormFieldSelect"), l = m("FormField"), b = m("InputLabel"), d = m("FormFieldCheckbox"), c = m("FormFieldFileInput"), y = m("DynamicField"), v = m("FormFooter"), g = m("Page");
|
|
755
|
+
return R(), Z(g, {
|
|
756
|
+
title: e.isCreation ? e.$i18n.t("banners:createBanner") : e.$i18n.t("banners:updateBanner"),
|
|
757
|
+
"is-content-loading": e.isContentLoading
|
|
851
758
|
}, {
|
|
852
|
-
content:
|
|
853
|
-
|
|
759
|
+
content: h(() => [
|
|
760
|
+
C("form", {
|
|
854
761
|
novalidate: "",
|
|
855
|
-
onSubmit:
|
|
762
|
+
onSubmit: n[9] || (n[9] = be(() => {
|
|
763
|
+
}, ["prevent"]))
|
|
856
764
|
}, [
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
value:
|
|
860
|
-
"onUpdate:value":
|
|
765
|
+
C("div", on, [
|
|
766
|
+
i(p, {
|
|
767
|
+
value: e.values.bannerZone,
|
|
768
|
+
"onUpdate:value": n[0] || (n[0] = (a) => e.values.bannerZone = a),
|
|
861
769
|
name: "bannerZone",
|
|
862
|
-
label:
|
|
863
|
-
options:
|
|
864
|
-
error:
|
|
770
|
+
label: e.$i18n.t("banners:zone"),
|
|
771
|
+
options: e.zonesOptionList,
|
|
772
|
+
error: e.errors.bannerZone
|
|
865
773
|
}, null, 8, ["value", "label", "options", "error"]),
|
|
866
|
-
|
|
867
|
-
value:
|
|
868
|
-
"onUpdate:value":
|
|
774
|
+
i(l, {
|
|
775
|
+
value: e.values.priority,
|
|
776
|
+
"onUpdate:value": n[1] || (n[1] = (a) => e.values.priority = a),
|
|
869
777
|
name: "priority",
|
|
870
|
-
label:
|
|
871
|
-
error:
|
|
778
|
+
label: e.$i18n.t("banners:priority"),
|
|
779
|
+
error: e.errors.priority
|
|
872
780
|
}, null, 8, ["value", "label", "error"])
|
|
873
781
|
]),
|
|
874
|
-
|
|
875
|
-
default:
|
|
876
|
-
|
|
782
|
+
i(b, null, {
|
|
783
|
+
default: h(() => [
|
|
784
|
+
G(Y(e.$i18n.t("banners:period")), 1)
|
|
877
785
|
]),
|
|
878
786
|
_: 1
|
|
879
787
|
}),
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
value:
|
|
883
|
-
"onUpdate:value":
|
|
884
|
-
label:
|
|
788
|
+
C("div", sn, [
|
|
789
|
+
i(l, {
|
|
790
|
+
value: e.values.dateStart,
|
|
791
|
+
"onUpdate:value": n[2] || (n[2] = (a) => e.values.dateStart = a),
|
|
792
|
+
label: e.$i18n.t("banners:from"),
|
|
885
793
|
name: "dateStart",
|
|
886
794
|
type: "date",
|
|
887
|
-
max:
|
|
795
|
+
max: e.values.dateEnd
|
|
888
796
|
}, null, 8, ["value", "label", "max"]),
|
|
889
|
-
|
|
890
|
-
value:
|
|
891
|
-
"onUpdate:value":
|
|
892
|
-
label:
|
|
797
|
+
i(l, {
|
|
798
|
+
value: e.values.dateEnd,
|
|
799
|
+
"onUpdate:value": n[3] || (n[3] = (a) => e.values.dateEnd = a),
|
|
800
|
+
label: e.$i18n.t("banners:to"),
|
|
893
801
|
name: "dateEnd",
|
|
894
802
|
type: "date",
|
|
895
|
-
min:
|
|
803
|
+
min: e.values.dateStart
|
|
896
804
|
}, null, 8, ["value", "label", "min"])
|
|
897
805
|
]),
|
|
898
|
-
|
|
899
|
-
checked:
|
|
900
|
-
"onUpdate:checked":
|
|
806
|
+
i(d, {
|
|
807
|
+
checked: e.values.disabled,
|
|
808
|
+
"onUpdate:checked": n[4] || (n[4] = (a) => e.values.disabled = a),
|
|
901
809
|
name: "disabled",
|
|
902
|
-
label:
|
|
903
|
-
error:
|
|
810
|
+
label: e.$i18n.t("banners:disabled"),
|
|
811
|
+
error: e.errors.disabled
|
|
904
812
|
}, null, 8, ["checked", "label", "error"]),
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
value:
|
|
908
|
-
"onUpdate:value":
|
|
813
|
+
C("div", ln, [
|
|
814
|
+
i(l, {
|
|
815
|
+
value: e.values.link,
|
|
816
|
+
"onUpdate:value": n[5] || (n[5] = (a) => e.values.link = a),
|
|
909
817
|
name: "link",
|
|
910
|
-
label:
|
|
911
|
-
error:
|
|
818
|
+
label: e.$i18n.t("banners:link"),
|
|
819
|
+
error: e.errors.name
|
|
912
820
|
}, null, 8, ["value", "label", "error"]),
|
|
913
|
-
|
|
914
|
-
checked:
|
|
915
|
-
"onUpdate:checked":
|
|
821
|
+
i(d, {
|
|
822
|
+
checked: e.values.openNewTab,
|
|
823
|
+
"onUpdate:checked": n[6] || (n[6] = (a) => e.values.openNewTab = a),
|
|
916
824
|
name: "openNewTab",
|
|
917
|
-
label:
|
|
918
|
-
error:
|
|
825
|
+
label: e.$i18n.t("banners:openNewTab"),
|
|
826
|
+
error: e.errors.openNewTab
|
|
919
827
|
}, null, 8, ["checked", "label", "error"])
|
|
920
828
|
]),
|
|
921
|
-
|
|
922
|
-
value:
|
|
923
|
-
"onUpdate:value":
|
|
829
|
+
i(c, {
|
|
830
|
+
value: e.values.image,
|
|
831
|
+
"onUpdate:value": n[7] || (n[7] = (a) => e.values.image = a),
|
|
924
832
|
name: "image",
|
|
925
833
|
"file-type": "image",
|
|
926
|
-
label:
|
|
927
|
-
error:
|
|
834
|
+
label: e.$i18n.t("banners:image"),
|
|
835
|
+
error: e.errors.file
|
|
928
836
|
}, null, 8, ["value", "label", "error"]),
|
|
929
|
-
(
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
value: _ctx.values.comment,
|
|
937
|
-
"onUpdate:value": _cache[8] || (_cache[8] = ($event) => _ctx.values.comment = $event),
|
|
837
|
+
(R(!0), fe(ve, null, ge(e.values.fields, (a) => (R(), Z(y, {
|
|
838
|
+
key: a.id,
|
|
839
|
+
field: a
|
|
840
|
+
}, null, 8, ["field"]))), 128)),
|
|
841
|
+
i(l, {
|
|
842
|
+
value: e.values.comment,
|
|
843
|
+
"onUpdate:value": n[8] || (n[8] = (a) => e.values.comment = a),
|
|
938
844
|
name: "comment",
|
|
939
845
|
type: "textarea",
|
|
940
|
-
label:
|
|
941
|
-
error:
|
|
846
|
+
label: e.$i18n.t("banners:comment"),
|
|
847
|
+
error: e.errors.comment
|
|
942
848
|
}, null, 8, ["value", "label", "error"])
|
|
943
849
|
], 32)
|
|
944
850
|
]),
|
|
945
|
-
footer:
|
|
946
|
-
|
|
947
|
-
"back-href":
|
|
948
|
-
"is-submitting":
|
|
949
|
-
"is-creation":
|
|
950
|
-
"can-create-another":
|
|
951
|
-
onSubmit:
|
|
851
|
+
footer: h(() => [
|
|
852
|
+
i(v, {
|
|
853
|
+
"back-href": e.bannerListUrl,
|
|
854
|
+
"is-submitting": e.isSubmitting,
|
|
855
|
+
"is-creation": e.isCreation,
|
|
856
|
+
"can-create-another": e.isCreation,
|
|
857
|
+
onSubmit: e.submitForm
|
|
952
858
|
}, null, 8, ["back-href", "is-submitting", "is-creation", "can-create-another", "onSubmit"])
|
|
953
859
|
]),
|
|
954
860
|
_: 1
|
|
955
861
|
}, 8, ["title", "is-content-loading"]);
|
|
956
862
|
}
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
component: ZoneList,
|
|
863
|
+
const dn = /* @__PURE__ */ V(rn, [["render", un]]), Nn = {
|
|
864
|
+
path: B.ZONE_LIST,
|
|
865
|
+
component: Ye,
|
|
961
866
|
name: "Zones",
|
|
962
867
|
meta: {
|
|
963
|
-
getBreadcrumbs: (
|
|
964
|
-
{ url: "/", text:
|
|
965
|
-
{ url:
|
|
868
|
+
getBreadcrumbs: (e, { t: n }) => [
|
|
869
|
+
{ url: "/", text: n("banners:home") },
|
|
870
|
+
{ url: B.ZONE_LIST, text: n("banners:zones") }
|
|
966
871
|
]
|
|
967
872
|
}
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
component: BannerList,
|
|
873
|
+
}, Ln = {
|
|
874
|
+
path: B.BANNER_LIST,
|
|
875
|
+
component: en,
|
|
972
876
|
name: "Banners",
|
|
973
877
|
meta: {
|
|
974
|
-
getBreadcrumbs: (
|
|
975
|
-
{ url: "/", text:
|
|
976
|
-
{ url:
|
|
878
|
+
getBreadcrumbs: (e, { t: n }) => [
|
|
879
|
+
{ url: "/", text: n("banners:home") },
|
|
880
|
+
{ url: B.BANNER_LIST, text: n("banners:banners") }
|
|
977
881
|
]
|
|
978
882
|
}
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
component: BannerForm,
|
|
883
|
+
}, $n = {
|
|
884
|
+
path: B.BANNER_FORM,
|
|
885
|
+
component: dn,
|
|
983
886
|
name: "Banner Form",
|
|
984
887
|
meta: {
|
|
985
|
-
getBreadcrumbs: (
|
|
986
|
-
{ url: "/", text:
|
|
987
|
-
{ url:
|
|
988
|
-
{ url:
|
|
888
|
+
getBreadcrumbs: (e, { t: n }) => [
|
|
889
|
+
{ url: "/", text: n("banners:home") },
|
|
890
|
+
{ url: B.BANNER_LIST, text: n("banners:banners") },
|
|
891
|
+
{ url: e.path, text: n("banners:bannerForm") }
|
|
989
892
|
]
|
|
990
893
|
}
|
|
991
894
|
};
|
|
992
|
-
|
|
993
|
-
export {
|
|
895
|
+
Ue();
|
|
896
|
+
export {
|
|
897
|
+
$n as BANNERS_BANNER_FORM_ROUTE,
|
|
898
|
+
Ln as BANNERS_BANNER_LIST_ROUTE,
|
|
899
|
+
Nn as BANNERS_ZONE_LIST_ROUTE,
|
|
900
|
+
We as createBanner,
|
|
901
|
+
Me as deleteBanner,
|
|
902
|
+
qe as getBanner,
|
|
903
|
+
Bn as getBannerCount,
|
|
904
|
+
Pe as getBanners,
|
|
905
|
+
ee as getBannersBannerFormUrl,
|
|
906
|
+
U as getBannersBannerListUrl,
|
|
907
|
+
Sn as getBannersZoneListUrl,
|
|
908
|
+
Oe as getZoneFields,
|
|
909
|
+
x as getZones,
|
|
910
|
+
Ve as updateBanner
|
|
911
|
+
};
|