@tager/admin-banners 1.0.1 → 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 +576 -673
- package/dist/services/requests.d.ts +3 -3
- 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 +5 -5
- 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/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 +3 -3
- package/src/views/Banners/BannerList/hooks/useAdvancedSearch.ts +6 -6
- 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, isNotNullish, 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,392 +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
|
-
const
|
|
356
|
-
() =>
|
|
357
|
-
value:
|
|
358
|
-
label:
|
|
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
|
|
359
340
|
}))
|
|
360
|
-
)
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
route.query,
|
|
341
|
+
), o = f(() => {
|
|
342
|
+
const a = H(
|
|
343
|
+
t.query,
|
|
364
344
|
"zone"
|
|
345
|
+
/* Zone */
|
|
365
346
|
);
|
|
366
|
-
return
|
|
367
|
-
({ value }) =>
|
|
347
|
+
return r.value.filter(
|
|
348
|
+
({ value: s }) => a.some(($) => $ === s)
|
|
368
349
|
);
|
|
350
|
+
}), u = D(o.value);
|
|
351
|
+
N(o, () => {
|
|
352
|
+
u.value = o.value;
|
|
369
353
|
});
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
);
|
|
380
|
-
const dateFilter = ref(initialDateFilter.value);
|
|
381
|
-
watch(initialDateFilter, () => {
|
|
382
|
-
dateFilter.value = initialDateFilter.value;
|
|
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;
|
|
383
363
|
});
|
|
384
|
-
const
|
|
385
|
-
() => Object.entries(
|
|
386
|
-
value,
|
|
387
|
-
label:
|
|
364
|
+
const b = f(
|
|
365
|
+
() => Object.entries(T).map(([a, s]) => ({
|
|
366
|
+
value: s,
|
|
367
|
+
label: ae(s, e)
|
|
388
368
|
}))
|
|
389
|
-
)
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
route.query,
|
|
369
|
+
), d = f(() => {
|
|
370
|
+
const a = H(
|
|
371
|
+
t.query,
|
|
393
372
|
"status"
|
|
373
|
+
/* Status */
|
|
394
374
|
);
|
|
395
|
-
return
|
|
396
|
-
({ value }) =>
|
|
375
|
+
return b.value.filter(
|
|
376
|
+
({ value: s }) => a.some(($) => $ === s)
|
|
397
377
|
);
|
|
378
|
+
}), c = D(d.value);
|
|
379
|
+
N(d, () => {
|
|
380
|
+
c.value = d.value;
|
|
398
381
|
});
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
() => getFilterParams({
|
|
405
|
-
["zone"]: zoneFilter.value.map(({ value }) => value),
|
|
406
|
-
["date"]: dateFilter.value || [],
|
|
407
|
-
["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)
|
|
408
387
|
})
|
|
409
|
-
)
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
if (event.name === "date") {
|
|
417
|
-
dateFilter.value = "";
|
|
418
|
-
}
|
|
419
|
-
if (event.name === "status") {
|
|
420
|
-
statusFilter.value = statusFilter.value.filter(
|
|
421
|
-
({ value }) => value !== event.value
|
|
422
|
-
);
|
|
423
|
-
}
|
|
424
|
-
};
|
|
425
|
-
const tags = computed(
|
|
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(
|
|
426
395
|
() => [
|
|
427
|
-
...
|
|
428
|
-
value,
|
|
429
|
-
label,
|
|
396
|
+
...u.value.map(({ value: a, label: s }) => ({
|
|
397
|
+
value: a,
|
|
398
|
+
label: s,
|
|
430
399
|
name: "zone",
|
|
431
|
-
title:
|
|
400
|
+
title: e("banners:zone")
|
|
432
401
|
})),
|
|
433
|
-
...
|
|
434
|
-
value,
|
|
435
|
-
label,
|
|
402
|
+
...c.value.map(({ value: a, label: s }) => ({
|
|
403
|
+
value: a,
|
|
404
|
+
label: s,
|
|
436
405
|
name: "status",
|
|
437
|
-
title:
|
|
406
|
+
title: e("banners:status")
|
|
438
407
|
})),
|
|
439
|
-
|
|
440
|
-
value:
|
|
441
|
-
label:
|
|
408
|
+
l.value ? {
|
|
409
|
+
value: l.value,
|
|
410
|
+
label: l.value,
|
|
442
411
|
name: "date",
|
|
443
|
-
title:
|
|
412
|
+
title: e("banners:date")
|
|
444
413
|
} : null
|
|
445
|
-
].filter(
|
|
414
|
+
].filter(le)
|
|
446
415
|
);
|
|
447
416
|
return {
|
|
448
|
-
zoneFilter,
|
|
449
|
-
zonesOptionList,
|
|
450
|
-
dateFilter,
|
|
451
|
-
statusFilter,
|
|
452
|
-
statusesOptionList,
|
|
453
|
-
filterParams,
|
|
454
|
-
tags,
|
|
455
|
-
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
|
|
456
425
|
};
|
|
457
426
|
}
|
|
458
|
-
|
|
459
|
-
const _sfc_main$1 = defineComponent({
|
|
427
|
+
const Xe = q({
|
|
460
428
|
name: "BannerList",
|
|
461
429
|
components: {
|
|
462
|
-
DeleteIcon,
|
|
463
|
-
EditIcon,
|
|
464
|
-
BaseButton,
|
|
465
|
-
FormField,
|
|
466
|
-
FormFieldMultiSelect,
|
|
467
|
-
AdvancedSearch,
|
|
468
|
-
Page,
|
|
469
|
-
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
|
|
470
438
|
},
|
|
471
439
|
setup() {
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
filterParams,
|
|
483
|
-
tags,
|
|
484
|
-
tagRemovalHandler
|
|
485
|
-
} = useAdvancedSearch({
|
|
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({
|
|
486
450
|
t,
|
|
487
|
-
zoneList,
|
|
488
|
-
route
|
|
489
|
-
})
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
...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
|
|
506
469
|
}),
|
|
507
470
|
initialValue: [],
|
|
508
471
|
resourceName: "Banners"
|
|
509
472
|
});
|
|
510
|
-
|
|
511
|
-
if (
|
|
473
|
+
N(c, () => {
|
|
474
|
+
if (r.value)
|
|
512
475
|
return;
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
...
|
|
516
|
-
...filterParams.value
|
|
476
|
+
const S = {
|
|
477
|
+
...ke(e.query, ["query", "pageNumber"]),
|
|
478
|
+
...c.value
|
|
517
479
|
};
|
|
518
|
-
|
|
519
|
-
router.replace({ query: newQuery });
|
|
520
|
-
fetchBanners();
|
|
521
|
-
}
|
|
480
|
+
Ze(e.query, S) || (n.replace({ query: S }), g());
|
|
522
481
|
});
|
|
523
|
-
const { isDeleting, handleResourceDelete } =
|
|
524
|
-
deleteResource:
|
|
482
|
+
const { isDeleting: te, handleResourceDelete: re } = ue({
|
|
483
|
+
deleteResource: Me,
|
|
525
484
|
resourceName: "Banner",
|
|
526
|
-
onSuccess:
|
|
527
|
-
})
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
const columnDefs = computed(
|
|
532
|
-
() => getColumnDefs(zoneList.value, t)
|
|
533
|
-
);
|
|
534
|
-
const isRowDataLoading = computed(
|
|
535
|
-
() => 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
|
|
536
490
|
);
|
|
537
491
|
return {
|
|
538
|
-
columnDefs,
|
|
539
|
-
isRowDataLoading,
|
|
540
|
-
rowData,
|
|
541
|
-
errorMessage
|
|
542
|
-
handleChange,
|
|
543
|
-
getBannersBannerFormUrl,
|
|
544
|
-
searchQuery,
|
|
545
|
-
pageNumber,
|
|
546
|
-
pageCount,
|
|
547
|
-
pageSize,
|
|
548
|
-
isBusy,
|
|
549
|
-
handleResourceDelete,
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
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
|
|
557
512
|
};
|
|
558
513
|
}
|
|
559
|
-
});
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
const _component_AdvancedSearch = resolveComponent("AdvancedSearch");
|
|
565
|
-
const _component_EditIcon = resolveComponent("EditIcon");
|
|
566
|
-
const _component_BaseButton = resolveComponent("BaseButton");
|
|
567
|
-
const _component_DeleteIcon = resolveComponent("DeleteIcon");
|
|
568
|
-
const _component_DataTable = resolveComponent("DataTable");
|
|
569
|
-
const _component_Page = resolveComponent("Page");
|
|
570
|
-
return openBlock(), createBlock(_component_Page, {
|
|
571
|
-
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"),
|
|
572
519
|
"header-buttons": [
|
|
573
520
|
{
|
|
574
|
-
text:
|
|
575
|
-
href:
|
|
521
|
+
text: e.$i18n.t("banners:createBanner"),
|
|
522
|
+
href: e.getBannersBannerFormUrl({ bannerId: "create" })
|
|
576
523
|
}
|
|
577
524
|
]
|
|
578
525
|
}, {
|
|
579
|
-
content:
|
|
580
|
-
|
|
581
|
-
"column-defs":
|
|
582
|
-
"row-data":
|
|
583
|
-
loading:
|
|
584
|
-
"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,
|
|
585
532
|
"data-table": "banners",
|
|
586
|
-
"use-search":
|
|
587
|
-
"use-pagination":
|
|
588
|
-
"search-query":
|
|
533
|
+
"use-search": !0,
|
|
534
|
+
"use-pagination": !0,
|
|
535
|
+
"search-query": e.searchQuery,
|
|
589
536
|
pagination: {
|
|
590
|
-
pageNumber:
|
|
591
|
-
pageCount:
|
|
592
|
-
pageSize:
|
|
593
|
-
disabled:
|
|
537
|
+
pageNumber: e.pageNumber,
|
|
538
|
+
pageCount: e.pageCount,
|
|
539
|
+
pageSize: e.pageSize,
|
|
540
|
+
disabled: e.isRowDataLoading
|
|
594
541
|
},
|
|
595
|
-
onChange:
|
|
542
|
+
onChange: e.handleChange
|
|
596
543
|
}, {
|
|
597
|
-
filters:
|
|
598
|
-
|
|
599
|
-
tags:
|
|
600
|
-
"onClick:tag":
|
|
544
|
+
filters: h(() => [
|
|
545
|
+
i(b, {
|
|
546
|
+
tags: e.tags,
|
|
547
|
+
"onClick:tag": e.tagRemovalHandler
|
|
601
548
|
}, {
|
|
602
|
-
default:
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
"selected-options":
|
|
606
|
-
"onUpdate:selected-options":
|
|
607
|
-
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,
|
|
608
555
|
name: "zoneFilter",
|
|
609
|
-
searchable:
|
|
610
|
-
label:
|
|
556
|
+
searchable: !0,
|
|
557
|
+
label: e.$i18n.t("banners:zone"),
|
|
611
558
|
class: "filter"
|
|
612
559
|
}, null, 8, ["selected-options", "options", "label"]),
|
|
613
|
-
|
|
614
|
-
value:
|
|
615
|
-
"onUpdate:value":
|
|
616
|
-
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"),
|
|
617
564
|
name: "dateFilter",
|
|
618
565
|
type: "date",
|
|
619
566
|
class: "filter"
|
|
620
567
|
}, null, 8, ["value", "label"]),
|
|
621
|
-
|
|
622
|
-
"selected-options":
|
|
623
|
-
"onUpdate:selected-options":
|
|
624
|
-
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,
|
|
625
572
|
name: "statusFilter",
|
|
626
|
-
searchable:
|
|
627
|
-
label:
|
|
573
|
+
searchable: !0,
|
|
574
|
+
label: e.$i18n.t("banners:status"),
|
|
628
575
|
class: "filter"
|
|
629
576
|
}, null, 8, ["selected-options", "options", "label"])
|
|
630
577
|
])
|
|
@@ -632,26 +579,26 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
632
579
|
_: 1
|
|
633
580
|
}, 8, ["tags", "onClick:tag"])
|
|
634
581
|
]),
|
|
635
|
-
"cell(actions)":
|
|
636
|
-
|
|
582
|
+
"cell(actions)": h(({ row: a }) => [
|
|
583
|
+
i(c, {
|
|
637
584
|
variant: "icon",
|
|
638
|
-
title:
|
|
639
|
-
disabled:
|
|
640
|
-
href:
|
|
585
|
+
title: e.$i18n.t("banners:edit"),
|
|
586
|
+
disabled: e.isBusy(a.id),
|
|
587
|
+
href: e.getBannersBannerFormUrl({ bannerId: a.id })
|
|
641
588
|
}, {
|
|
642
|
-
default:
|
|
643
|
-
|
|
589
|
+
default: h(() => [
|
|
590
|
+
i(d)
|
|
644
591
|
]),
|
|
645
592
|
_: 2
|
|
646
593
|
}, 1032, ["title", "disabled", "href"]),
|
|
647
|
-
|
|
594
|
+
i(c, {
|
|
648
595
|
variant: "icon",
|
|
649
|
-
title:
|
|
650
|
-
disabled:
|
|
651
|
-
onClick: (
|
|
596
|
+
title: e.$i18n.t("banners:remove"),
|
|
597
|
+
disabled: e.isBusy(a.id),
|
|
598
|
+
onClick: (s) => e.handleResourceDelete(a.id)
|
|
652
599
|
}, {
|
|
653
|
-
default:
|
|
654
|
-
|
|
600
|
+
default: h(() => [
|
|
601
|
+
i(y)
|
|
655
602
|
]),
|
|
656
603
|
_: 2
|
|
657
604
|
}, 1032, ["title", "disabled", "onClick"])
|
|
@@ -662,347 +609,303 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
662
609
|
_: 1
|
|
663
610
|
}, 8, ["title", "header-buttons"]);
|
|
664
611
|
}
|
|
665
|
-
|
|
666
|
-
function
|
|
667
|
-
bannerId,
|
|
668
|
-
isCreation
|
|
612
|
+
const en = /* @__PURE__ */ V(Xe, [["render", xe]]);
|
|
613
|
+
function nn({
|
|
614
|
+
bannerId: e,
|
|
615
|
+
isCreation: n
|
|
669
616
|
}) {
|
|
670
|
-
const [
|
|
671
|
-
fetchResource: () =>
|
|
617
|
+
const [t, r] = P({
|
|
618
|
+
fetchResource: () => qe(e.value),
|
|
672
619
|
initialValue: null,
|
|
673
620
|
resourceName: "Banner"
|
|
674
621
|
});
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
});
|
|
681
|
-
watch(bannerId, () => {
|
|
682
|
-
if (isCreation.value || !bannerId.value) {
|
|
683
|
-
return;
|
|
684
|
-
}
|
|
685
|
-
fetchBanner();
|
|
686
|
-
});
|
|
687
|
-
return resource;
|
|
622
|
+
return k(() => {
|
|
623
|
+
n.value || !e.value || t();
|
|
624
|
+
}), N(e, () => {
|
|
625
|
+
n.value || !e.value || t();
|
|
626
|
+
}), r;
|
|
688
627
|
}
|
|
689
|
-
function
|
|
690
|
-
values
|
|
628
|
+
function an({
|
|
629
|
+
values: e
|
|
691
630
|
}) {
|
|
692
|
-
const
|
|
693
|
-
var
|
|
694
|
-
return (
|
|
695
|
-
})
|
|
696
|
-
|
|
697
|
-
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),
|
|
698
636
|
initialValue: null,
|
|
699
637
|
resourceName: "Zone Fields"
|
|
700
638
|
});
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
});
|
|
707
|
-
watch(zoneId, () => {
|
|
708
|
-
if (!zoneId.value) {
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
711
|
-
fetchZoneFields();
|
|
712
|
-
});
|
|
713
|
-
return resource;
|
|
639
|
+
return k(() => {
|
|
640
|
+
n.value && t();
|
|
641
|
+
}), N(n, () => {
|
|
642
|
+
n.value && t();
|
|
643
|
+
}), r;
|
|
714
644
|
}
|
|
715
|
-
function
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
({ 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)
|
|
719
648
|
);
|
|
720
649
|
return {
|
|
721
|
-
priority: String((
|
|
722
|
-
link: (
|
|
723
|
-
image:
|
|
724
|
-
bannerZone:
|
|
725
|
-
openNewTab: (
|
|
726
|
-
dateStart: (
|
|
727
|
-
dateEnd: (
|
|
728
|
-
disabled: (
|
|
729
|
-
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) ?? "",
|
|
730
659
|
fields: []
|
|
731
660
|
};
|
|
732
661
|
}
|
|
733
|
-
function
|
|
734
|
-
var
|
|
662
|
+
function tn(e) {
|
|
663
|
+
var n, t;
|
|
735
664
|
return {
|
|
736
|
-
...
|
|
737
|
-
priority:
|
|
738
|
-
dateStart:
|
|
739
|
-
dateEnd:
|
|
740
|
-
image: (
|
|
741
|
-
bannerZone: (
|
|
742
|
-
fields:
|
|
743
|
-
name:
|
|
744
|
-
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)
|
|
745
674
|
}))
|
|
746
675
|
};
|
|
747
676
|
}
|
|
748
|
-
|
|
749
|
-
const _sfc_main = defineComponent({
|
|
677
|
+
const rn = q({
|
|
750
678
|
name: "BannerForm",
|
|
751
679
|
components: {
|
|
752
|
-
FormFieldFileInput,
|
|
753
|
-
FormFieldCheckbox,
|
|
754
|
-
InputLabel,
|
|
755
|
-
FormField,
|
|
756
|
-
FormFieldSelect,
|
|
757
|
-
Page,
|
|
758
|
-
FormFooter,
|
|
759
|
-
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
|
|
760
688
|
},
|
|
761
689
|
setup() {
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
const bannerId = computed(() => route.params.bannerId);
|
|
767
|
-
const isCreation = computed(() => bannerId.value === "create");
|
|
768
|
-
const { data: zones, loading: isZonesLoading } = useFetchZones();
|
|
769
|
-
const zonesOptionList = computed(
|
|
770
|
-
() => zones.value.map((zone) => ({
|
|
771
|
-
value: zone.id,
|
|
772
|
-
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
|
|
773
694
|
}))
|
|
774
|
-
)
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
watch([banner, zones], () => {
|
|
785
|
-
values.value = convertBannerToFormValues(
|
|
786
|
-
banner.value,
|
|
787
|
-
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
|
|
788
705
|
);
|
|
789
706
|
});
|
|
790
|
-
const { loading:
|
|
791
|
-
|
|
792
|
-
var
|
|
793
|
-
|
|
794
|
-
(
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
banner.value ? (_a2 = banner.value.fields[index].value) != null ? _a2 : null : null
|
|
799
|
-
);
|
|
800
|
-
}
|
|
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
|
+
)
|
|
801
715
|
);
|
|
802
716
|
});
|
|
803
|
-
const
|
|
804
|
-
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
} else if (event.type === "create_exit" || event.type === "save_exit") {
|
|
812
|
-
navigateBack(router, getBannersBannerListUrl());
|
|
813
|
-
} else if (event.type === "create_create-another") {
|
|
814
|
-
values.value = convertBannerToFormValues(
|
|
815
|
-
null,
|
|
816
|
-
zonesOptionList.value
|
|
817
|
-
);
|
|
818
|
-
}
|
|
819
|
-
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({
|
|
820
725
|
variant: "success",
|
|
821
|
-
title:
|
|
822
|
-
body:
|
|
726
|
+
title: r("banners:success"),
|
|
727
|
+
body: u.value ? r("banners:bannerWasSuccessfullyCreated") : r("banners:bannerWasSuccessfullyUpdated")
|
|
823
728
|
});
|
|
824
|
-
}).catch((
|
|
825
|
-
console.error(
|
|
826
|
-
errors.value = convertRequestErrorToMap(error);
|
|
827
|
-
toast.show({
|
|
729
|
+
}).catch((E) => {
|
|
730
|
+
console.error(E), g.value = pe(E), t.show({
|
|
828
731
|
variant: "danger",
|
|
829
|
-
title:
|
|
830
|
-
body:
|
|
732
|
+
title: r("banners:error"),
|
|
733
|
+
body: u.value ? r("banners:bannerCreationWasFailed") : r("banners:bannerUpdateWasFailed")
|
|
831
734
|
});
|
|
832
735
|
}).finally(() => {
|
|
833
|
-
|
|
736
|
+
y.value = !1;
|
|
834
737
|
});
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
() => isBannerLoading.value || isZonesLoading.value || isZoneFieldsLoading.value
|
|
738
|
+
}, I = f(
|
|
739
|
+
() => c.value || l.value || a.value
|
|
838
740
|
);
|
|
839
741
|
return {
|
|
840
|
-
isCreation,
|
|
841
|
-
isContentLoading,
|
|
842
|
-
isSubmitting,
|
|
843
|
-
values,
|
|
844
|
-
errors,
|
|
845
|
-
submitForm
|
|
846
|
-
bannerListUrl:
|
|
847
|
-
zonesOptionList
|
|
742
|
+
isCreation: u,
|
|
743
|
+
isContentLoading: I,
|
|
744
|
+
isSubmitting: y,
|
|
745
|
+
values: v,
|
|
746
|
+
errors: g,
|
|
747
|
+
submitForm: $,
|
|
748
|
+
bannerListUrl: U(),
|
|
749
|
+
zonesOptionList: b
|
|
848
750
|
};
|
|
849
751
|
}
|
|
850
|
-
});
|
|
851
|
-
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
const _component_FormField = resolveComponent("FormField");
|
|
857
|
-
const _component_InputLabel = resolveComponent("InputLabel");
|
|
858
|
-
const _component_FormFieldCheckbox = resolveComponent("FormFieldCheckbox");
|
|
859
|
-
const _component_FormFieldFileInput = resolveComponent("FormFieldFileInput");
|
|
860
|
-
const _component_DynamicField = resolveComponent("DynamicField");
|
|
861
|
-
const _component_FormFooter = resolveComponent("FormFooter");
|
|
862
|
-
const _component_Page = resolveComponent("Page");
|
|
863
|
-
return openBlock(), createBlock(_component_Page, {
|
|
864
|
-
title: _ctx.isCreation ? _ctx.$i18n.t("banners:createBanner") : _ctx.$i18n.t("banners:updateBanner"),
|
|
865
|
-
"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
|
|
866
758
|
}, {
|
|
867
|
-
content:
|
|
868
|
-
|
|
759
|
+
content: h(() => [
|
|
760
|
+
C("form", {
|
|
869
761
|
novalidate: "",
|
|
870
|
-
onSubmit:
|
|
762
|
+
onSubmit: n[9] || (n[9] = be(() => {
|
|
763
|
+
}, ["prevent"]))
|
|
871
764
|
}, [
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
value:
|
|
875
|
-
"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),
|
|
876
769
|
name: "bannerZone",
|
|
877
|
-
label:
|
|
878
|
-
options:
|
|
879
|
-
error:
|
|
770
|
+
label: e.$i18n.t("banners:zone"),
|
|
771
|
+
options: e.zonesOptionList,
|
|
772
|
+
error: e.errors.bannerZone
|
|
880
773
|
}, null, 8, ["value", "label", "options", "error"]),
|
|
881
|
-
|
|
882
|
-
value:
|
|
883
|
-
"onUpdate:value":
|
|
774
|
+
i(l, {
|
|
775
|
+
value: e.values.priority,
|
|
776
|
+
"onUpdate:value": n[1] || (n[1] = (a) => e.values.priority = a),
|
|
884
777
|
name: "priority",
|
|
885
|
-
label:
|
|
886
|
-
error:
|
|
778
|
+
label: e.$i18n.t("banners:priority"),
|
|
779
|
+
error: e.errors.priority
|
|
887
780
|
}, null, 8, ["value", "label", "error"])
|
|
888
781
|
]),
|
|
889
|
-
|
|
890
|
-
default:
|
|
891
|
-
|
|
782
|
+
i(b, null, {
|
|
783
|
+
default: h(() => [
|
|
784
|
+
G(Y(e.$i18n.t("banners:period")), 1)
|
|
892
785
|
]),
|
|
893
786
|
_: 1
|
|
894
787
|
}),
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
value:
|
|
898
|
-
"onUpdate:value":
|
|
899
|
-
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"),
|
|
900
793
|
name: "dateStart",
|
|
901
794
|
type: "date",
|
|
902
|
-
max:
|
|
795
|
+
max: e.values.dateEnd
|
|
903
796
|
}, null, 8, ["value", "label", "max"]),
|
|
904
|
-
|
|
905
|
-
value:
|
|
906
|
-
"onUpdate:value":
|
|
907
|
-
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"),
|
|
908
801
|
name: "dateEnd",
|
|
909
802
|
type: "date",
|
|
910
|
-
min:
|
|
803
|
+
min: e.values.dateStart
|
|
911
804
|
}, null, 8, ["value", "label", "min"])
|
|
912
805
|
]),
|
|
913
|
-
|
|
914
|
-
checked:
|
|
915
|
-
"onUpdate:checked":
|
|
806
|
+
i(d, {
|
|
807
|
+
checked: e.values.disabled,
|
|
808
|
+
"onUpdate:checked": n[4] || (n[4] = (a) => e.values.disabled = a),
|
|
916
809
|
name: "disabled",
|
|
917
|
-
label:
|
|
918
|
-
error:
|
|
810
|
+
label: e.$i18n.t("banners:disabled"),
|
|
811
|
+
error: e.errors.disabled
|
|
919
812
|
}, null, 8, ["checked", "label", "error"]),
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
value:
|
|
923
|
-
"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),
|
|
924
817
|
name: "link",
|
|
925
|
-
label:
|
|
926
|
-
error:
|
|
818
|
+
label: e.$i18n.t("banners:link"),
|
|
819
|
+
error: e.errors.name
|
|
927
820
|
}, null, 8, ["value", "label", "error"]),
|
|
928
|
-
|
|
929
|
-
checked:
|
|
930
|
-
"onUpdate:checked":
|
|
821
|
+
i(d, {
|
|
822
|
+
checked: e.values.openNewTab,
|
|
823
|
+
"onUpdate:checked": n[6] || (n[6] = (a) => e.values.openNewTab = a),
|
|
931
824
|
name: "openNewTab",
|
|
932
|
-
label:
|
|
933
|
-
error:
|
|
825
|
+
label: e.$i18n.t("banners:openNewTab"),
|
|
826
|
+
error: e.errors.openNewTab
|
|
934
827
|
}, null, 8, ["checked", "label", "error"])
|
|
935
828
|
]),
|
|
936
|
-
|
|
937
|
-
value:
|
|
938
|
-
"onUpdate:value":
|
|
829
|
+
i(c, {
|
|
830
|
+
value: e.values.image,
|
|
831
|
+
"onUpdate:value": n[7] || (n[7] = (a) => e.values.image = a),
|
|
939
832
|
name: "image",
|
|
940
833
|
"file-type": "image",
|
|
941
|
-
label:
|
|
942
|
-
error:
|
|
834
|
+
label: e.$i18n.t("banners:image"),
|
|
835
|
+
error: e.errors.file
|
|
943
836
|
}, null, 8, ["value", "label", "error"]),
|
|
944
|
-
(
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
value: _ctx.values.comment,
|
|
952
|
-
"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),
|
|
953
844
|
name: "comment",
|
|
954
845
|
type: "textarea",
|
|
955
|
-
label:
|
|
956
|
-
error:
|
|
846
|
+
label: e.$i18n.t("banners:comment"),
|
|
847
|
+
error: e.errors.comment
|
|
957
848
|
}, null, 8, ["value", "label", "error"])
|
|
958
849
|
], 32)
|
|
959
850
|
]),
|
|
960
|
-
footer:
|
|
961
|
-
|
|
962
|
-
"back-href":
|
|
963
|
-
"is-submitting":
|
|
964
|
-
"is-creation":
|
|
965
|
-
"can-create-another":
|
|
966
|
-
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
|
|
967
858
|
}, null, 8, ["back-href", "is-submitting", "is-creation", "can-create-another", "onSubmit"])
|
|
968
859
|
]),
|
|
969
860
|
_: 1
|
|
970
861
|
}, 8, ["title", "is-content-loading"]);
|
|
971
862
|
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
component: ZoneList,
|
|
863
|
+
const dn = /* @__PURE__ */ V(rn, [["render", un]]), Nn = {
|
|
864
|
+
path: B.ZONE_LIST,
|
|
865
|
+
component: Ye,
|
|
976
866
|
name: "Zones",
|
|
977
867
|
meta: {
|
|
978
|
-
getBreadcrumbs: (
|
|
979
|
-
{ url: "/", text:
|
|
980
|
-
{ url:
|
|
868
|
+
getBreadcrumbs: (e, { t: n }) => [
|
|
869
|
+
{ url: "/", text: n("banners:home") },
|
|
870
|
+
{ url: B.ZONE_LIST, text: n("banners:zones") }
|
|
981
871
|
]
|
|
982
872
|
}
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
component: BannerList,
|
|
873
|
+
}, Ln = {
|
|
874
|
+
path: B.BANNER_LIST,
|
|
875
|
+
component: en,
|
|
987
876
|
name: "Banners",
|
|
988
877
|
meta: {
|
|
989
|
-
getBreadcrumbs: (
|
|
990
|
-
{ url: "/", text:
|
|
991
|
-
{ url:
|
|
878
|
+
getBreadcrumbs: (e, { t: n }) => [
|
|
879
|
+
{ url: "/", text: n("banners:home") },
|
|
880
|
+
{ url: B.BANNER_LIST, text: n("banners:banners") }
|
|
992
881
|
]
|
|
993
882
|
}
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
component: BannerForm,
|
|
883
|
+
}, $n = {
|
|
884
|
+
path: B.BANNER_FORM,
|
|
885
|
+
component: dn,
|
|
998
886
|
name: "Banner Form",
|
|
999
887
|
meta: {
|
|
1000
|
-
getBreadcrumbs: (
|
|
1001
|
-
{ url: "/", text:
|
|
1002
|
-
{ url:
|
|
1003
|
-
{ 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") }
|
|
1004
892
|
]
|
|
1005
893
|
}
|
|
1006
894
|
};
|
|
1007
|
-
|
|
1008
|
-
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
|
+
};
|