@webx-ui/module-vacancies 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,53 +1,53 @@
1
- import { reorderItems as Ke, useAdmin as ce, useTranslate as oe, useErrorText as Ve, WxListScreen as je, WxFilterChips as Ye, WxRowMenu as Ge, WxAddressNote as Je, useDates as Qe, provideRelationOwner as Xe, provideRecordAddress as Ze, WxScreenHead as et, WxScreen as tt, WxSaveState as at, WxDate as nt, categoryRoutes as lt } from "@webx-ui/module-admin";
2
- import { defineComponent as pe, ref as W, useTemplateRef as st, onMounted as Ee, nextTick as it, openBlock as y, createBlock as $, unref as e, isRef as ot, withCtx as i, createVNode as p, createElementVNode as A, withKeys as rt, createTextVNode as x, toDisplayString as g, computed as h, watch as re, onBeforeUnmount as Oe, createElementBlock as z, createCommentVNode as R, Fragment as ne, normalizeClass as De, resolveDynamicComponent as ct, mergeProps as ut, renderList as Ae, provide as dt, inject as pt } from "vue";
3
- import { useRoute as Pe, useRouter as ze, onBeforeRouteLeave as vt } from "vue-router";
4
- import { useModal as ht, WxDialog as yt, WxFormItem as $e, WxInput as Me, WxSpace as ft, WxButton as K, createModal as mt, WxIcon as ie, WxPopover as gt, WxSelect as Ie, WxIndicator as bt, WxAction as wt, WxSkeleton as de, WxEmpty as Le, WxSortableList as _t, WxTooltip as Ne, WxBadge as J, WxAlert as Fe, toast as _, confirm as j, useLocales as xt, localizedValue as kt, WxCard as Tt, WxBreadcrumb as $t, WxBreadcrumbItem as Re, WxActionBar as Vt, WxText as Wt } from "@webx-ui/core";
5
- const Se = "vacancies";
6
- function ve(c) {
7
- const u = `${c.apiPath}/${Se}`, f = (n) => n.data, v = (n, m) => c.http.post(`${u}/${n}/${m}`, {}).then(f);
1
+ import { reorderItems as He, useAdmin as de, useTranslate as ce, useErrorText as Ve, WxListScreen as Ke, WxFilterChips as je, WxRowMenu as Ye, WxAddressNote as Je, useDates as Ge, useEditing as Qe, provideRelationOwner as Xe, provideRecordAddress as Ze, WxScreenHead as et, WxEditingAlerts as tt, WxScreen as at, WxSaveState as lt, WxDate as nt, WxDrafts as st, categoryRoutes as it } from "@webx-ui/module-admin";
2
+ import { defineComponent as ye, ref as C, useTemplateRef as ot, onMounted as qe, nextTick as rt, openBlock as y, createBlock as $, unref as e, isRef as ct, withCtx as c, createVNode as p, createElementVNode as D, withKeys as ut, createTextVNode as V, toDisplayString as _, computed as h, watch as ue, onBeforeUnmount as Oe, createElementBlock as z, createCommentVNode as R, Fragment as ne, normalizeClass as De, resolveDynamicComponent as dt, mergeProps as vt, renderList as Ae, provide as pt, inject as ht } from "vue";
3
+ import { useRoute as Pe, useRouter as ze, onBeforeRouteLeave as yt } from "vue-router";
4
+ import { useModal as ft, WxDialog as mt, WxFormItem as $e, WxInput as Me, WxSpace as gt, WxButton as ae, createModal as bt, WxIcon as re, WxPopover as wt, WxSelect as Ie, WxIndicator as _t, WxAction as xt, WxSkeleton as he, WxEmpty as Le, WxSortableList as kt, WxTooltip as Ne, WxBadge as Y, WxAlert as Tt, toast as w, confirm as J, useLocales as $t, localizedValue as Vt, WxCard as Wt, WxBreadcrumb as Ct, WxBreadcrumbItem as Se, WxActionBar as It, WxText as Nt } from "@webx-ui/core";
5
+ const Re = "vacancies";
6
+ function fe(u) {
7
+ const d = `${u.apiPath}/${Re}`, f = (l) => l.data, v = (l, m, a = {}) => u.http.post(`${d}/${l}/${m}`, a).then(f);
8
8
  return {
9
- list: (n = {}) => {
9
+ list: (l = {}) => {
10
10
  const m = new URLSearchParams();
11
- return n.trashed ? m.set("trashed", "1") : m.set("state", n.state ?? "open"), n.q && m.set("q", n.q), n.category != null && m.set("category", String(n.category)), n.status && m.set("status", n.status), c.http.get(`${u}?${m}`);
11
+ return l.trashed ? m.set("trashed", "1") : m.set("state", l.state ?? "open"), l.q && m.set("q", l.q), l.category != null && m.set("category", String(l.category)), l.status && m.set("status", l.status), u.http.get(`${d}?${m}`);
12
12
  },
13
- get: (n) => c.http.get(`${u}/${n}`).then(f),
14
- create: (n) => c.http.post(u, n).then(f),
15
- save: (n, m) => c.http.put(`${u}/${n}`, m).then(f),
16
- discard: (n) => c.http.post(`${u}/${n}/discard`, {}).then(f),
17
- duplicate: (n) => c.http.post(`${u}/${n}/duplicate`, {}).then(f),
18
- publish: (n) => v(n, "publish"),
19
- unpublish: (n) => v(n, "unpublish"),
20
- close: (n) => v(n, "close"),
21
- reopen: (n) => v(n, "reopen"),
22
- remove: (n) => c.http.delete(`${u}/${n}`).then(() => {
13
+ get: (l) => u.http.get(`${d}/${l}`).then(f),
14
+ create: (l) => u.http.post(d, l).then(f),
15
+ save: (l, m) => u.http.put(`${d}/${l}`, m).then(f),
16
+ discard: (l) => u.http.post(`${d}/${l}/discard`, {}).then(f),
17
+ duplicate: (l) => u.http.post(`${d}/${l}/duplicate`, {}).then(f),
18
+ publish: (l, m) => v(l, "publish", m ? { revision: m } : {}),
19
+ unpublish: (l) => v(l, "unpublish"),
20
+ close: (l) => v(l, "close"),
21
+ reopen: (l) => v(l, "reopen"),
22
+ remove: (l) => u.http.delete(`${d}/${l}`).then(() => {
23
23
  }),
24
- restore: (n) => v(n, "restore"),
24
+ restore: (l) => v(l, "restore"),
25
25
  // No `category`, ever: vacancies have one order (§4.11), unlike services.
26
- reorder: (n) => Ke(c, Se, n, null),
27
- versions: (n) => c.http.get(`${u}/${n}/versions`).then(f),
28
- restoreVersion: (n, m) => c.http.post(`${u}/${n}/versions/${m}/restore`, {}).then(f)
26
+ reorder: (l) => He(u, Re, l, null),
27
+ versions: (l) => u.http.get(`${d}/${l}/versions`).then(f),
28
+ restoreVersion: (l, m) => u.http.post(`${d}/${l}/versions/${m}/restore`, {}).then(f)
29
29
  };
30
30
  }
31
- const Ct = /^(\d{4})-(\d{2})-(\d{2})$/;
32
- function Ue(c) {
33
- const u = typeof c == "string" ? Ct.exec(c.slice(0, 10)) : null;
34
- if (u === null) return null;
35
- const [, f, v, n] = u, m = new Date(Number(f), Number(v) - 1, Number(n));
31
+ const St = /^(\d{4})-(\d{2})-(\d{2})$/;
32
+ function Fe(u) {
33
+ const d = typeof u == "string" ? St.exec(u.slice(0, 10)) : null;
34
+ if (d === null) return null;
35
+ const [, f, v, l] = d, m = new Date(Number(f), Number(v) - 1, Number(l));
36
36
  return Number.isNaN(m.getTime()) ? null : m;
37
37
  }
38
- function It(c, u, f = /* @__PURE__ */ new Date()) {
39
- const v = Ue(c);
40
- return v === null ? "" : new Intl.DateTimeFormat(u, {
38
+ function Rt(u, d, f = /* @__PURE__ */ new Date()) {
39
+ const v = Fe(u);
40
+ return v === null ? "" : new Intl.DateTimeFormat(d, {
41
41
  day: "numeric",
42
42
  month: "short",
43
43
  ...v.getFullYear() === f.getFullYear() ? {} : { year: "numeric" }
44
44
  }).format(v);
45
45
  }
46
- function Be(c, u) {
47
- const f = Ue(c);
48
- return f === null ? "" : new Intl.DateTimeFormat(u, { day: "numeric", month: "long", year: "numeric" }).format(f);
46
+ function Ue(u, d) {
47
+ const f = Fe(u);
48
+ return f === null ? "" : new Intl.DateTimeFormat(d, { day: "numeric", month: "long", year: "numeric" }).format(f);
49
49
  }
50
- const Nt = {
50
+ const Et = {
51
51
  module: {
52
52
  group: "Vacancies",
53
53
  vacancies: "Vacancies",
@@ -188,64 +188,64 @@ const Nt = {
188
188
  }
189
189
  }
190
190
  };
191
- function Rt(c) {
192
- return `vacancy.employment.${c}`;
191
+ function qt(u) {
192
+ return `vacancy.employment.${u}`;
193
193
  }
194
- const qe = /* @__PURE__ */ new WeakSet();
195
- function he() {
194
+ const Ee = /* @__PURE__ */ new WeakSet();
195
+ function me() {
196
196
  try {
197
- const { i18n: c } = ce();
198
- qe.has(c) || (c.defaults("webx-vacancies", Nt), qe.add(c));
197
+ const { i18n: u } = de();
198
+ Ee.has(u) || (u.defaults("webx-vacancies", Et), Ee.add(u));
199
199
  } catch {
200
200
  }
201
201
  }
202
- const St = /* @__PURE__ */ pe({
202
+ const Ot = /* @__PURE__ */ ye({
203
203
  __name: "VacancyCreateDialog",
204
- setup(c) {
205
- const { open: u, resolve: f, dismiss: v } = ht(), n = ce(), m = ve(n);
206
- he();
207
- const a = oe("webx-vacancies"), I = W(""), l = W(!1), k = W({}), C = st("field");
208
- Ee(async () => {
209
- await it(), C.value?.querySelector("input")?.focus();
204
+ setup(u) {
205
+ const { open: d, resolve: f, dismiss: v } = ft(), l = de(), m = fe(l);
206
+ me();
207
+ const a = ce("webx-vacancies"), N = C(""), n = C(!1), k = C({}), I = ot("field");
208
+ qe(async () => {
209
+ await rt(), I.value?.querySelector("input")?.focus();
210
210
  });
211
- async function F() {
212
- if (!(I.value.trim() === "" || l.value)) {
213
- l.value = !0, k.value = {};
211
+ async function M() {
212
+ if (!(N.value.trim() === "" || n.value)) {
213
+ n.value = !0, k.value = {};
214
214
  try {
215
- f((await m.create({ title: I.value.trim() })).vacancy);
215
+ f((await m.create({ title: N.value.trim() })).vacancy);
216
216
  } catch (q) {
217
217
  k.value = q.body?.errors ?? {};
218
218
  } finally {
219
- l.value = !1;
219
+ n.value = !1;
220
220
  }
221
221
  }
222
222
  }
223
- return (q, o) => (y(), $(e(yt), {
224
- open: e(u),
225
- "onUpdate:open": o[2] || (o[2] = (T) => ot(u) ? u.value = T : null),
223
+ return (q, i) => (y(), $(e(mt), {
224
+ open: e(d),
225
+ "onUpdate:open": i[2] || (i[2] = (x) => ct(d) ? d.value = x : null),
226
226
  title: e(a)("panel.new-title"),
227
227
  width: 440
228
228
  }, {
229
- footer: i(() => [
230
- p(e(ft), { size: "sm" }, {
231
- default: i(() => [
232
- p(e(K), {
229
+ footer: c(() => [
230
+ p(e(gt), { size: "sm" }, {
231
+ default: c(() => [
232
+ p(e(ae), {
233
233
  variant: "outline",
234
- onClick: o[1] || (o[1] = (T) => e(v)())
234
+ onClick: i[1] || (i[1] = (x) => e(v)())
235
235
  }, {
236
- default: i(() => [
237
- x(g(e(a)("panel.cancel")), 1)
236
+ default: c(() => [
237
+ V(_(e(a)("panel.cancel")), 1)
238
238
  ]),
239
239
  _: 1
240
240
  }),
241
- p(e(K), {
241
+ p(e(ae), {
242
242
  type: "primary",
243
- loading: l.value,
244
- disabled: I.value.trim() === "",
245
- onClick: F
243
+ loading: n.value,
244
+ disabled: N.value.trim() === "",
245
+ onClick: M
246
246
  }, {
247
- default: i(() => [
248
- x(g(e(a)("panel.create")), 1)
247
+ default: c(() => [
248
+ V(_(e(a)("panel.create")), 1)
249
249
  ]),
250
250
  _: 1
251
251
  }, 8, ["loading", "disabled"])
@@ -253,22 +253,22 @@ const St = /* @__PURE__ */ pe({
253
253
  _: 1
254
254
  })
255
255
  ]),
256
- default: i(() => [
256
+ default: c(() => [
257
257
  p(e($e), {
258
258
  label: e(a)("panel.field-title"),
259
259
  error: k.value.title?.[0] ?? k.value.slug?.[0],
260
260
  required: ""
261
261
  }, {
262
- default: i(() => [
263
- A("div", {
262
+ default: c(() => [
263
+ D("div", {
264
264
  ref_key: "field",
265
- ref: C
265
+ ref: I
266
266
  }, [
267
267
  p(e(Me), {
268
- modelValue: I.value,
269
- "onUpdate:modelValue": o[0] || (o[0] = (T) => I.value = T),
268
+ modelValue: N.value,
269
+ "onUpdate:modelValue": i[0] || (i[0] = (x) => N.value = x),
270
270
  "aria-label": e(a)("panel.field-title"),
271
- onKeyup: rt(F, ["enter"])
271
+ onKeyup: ut(M, ["enter"])
272
272
  }, null, 8, ["modelValue", "aria-label"])
273
273
  ], 512)
274
274
  ]),
@@ -278,308 +278,308 @@ const St = /* @__PURE__ */ pe({
278
278
  _: 1
279
279
  }, 8, ["open", "title"]));
280
280
  }
281
- }), qt = { class: "wx-vacancies" }, Et = { class: "wx-vacancies__bar" }, Ot = { class: "wx-vacancies__filters" }, Dt = {
281
+ }), Dt = { class: "wx-vacancies" }, At = { class: "wx-vacancies__bar" }, Pt = { class: "wx-vacancies__filters" }, zt = {
282
282
  key: 0,
283
283
  class: "wx-vacancies__applied"
284
- }, At = { class: "wx-vacancy-row__name" }, Pt = { class: "wx-vacancy-row__title" }, zt = { class: "wx-vacancy-row__address" }, Mt = { class: "wx-vacancy-row__facts" }, Lt = { class: "wx-vacancy-row__where" }, Ft = {
284
+ }, Mt = { class: "wx-vacancy-row__name" }, Lt = { class: "wx-vacancy-row__title" }, Ft = { class: "wx-vacancy-row__address" }, Ut = { class: "wx-vacancy-row__facts" }, Bt = { class: "wx-vacancy-row__where" }, Ht = {
285
285
  key: 0,
286
286
  class: "wx-vacancy-row__employment"
287
- }, Ut = { class: "wx-vacancy-row__until" }, Bt = { class: "wx-vacancy-row__state" }, Ht = /* @__PURE__ */ pe({
287
+ }, Kt = { class: "wx-vacancy-row__until" }, jt = { class: "wx-vacancy-row__state" }, Yt = /* @__PURE__ */ ye({
288
288
  __name: "VacanciesPage",
289
289
  props: {
290
290
  base: { default: "/vacancies" }
291
291
  },
292
- setup(c) {
293
- const u = c, f = ce(), v = ve(f), n = Pe(), m = ze();
294
- he();
295
- const a = oe("webx-vacancies"), I = Ve(), l = W([]), k = W({ categories: [] }), C = W(!0), F = mt(St), q = h(() => f.can("vacancies.manage")), o = h(
292
+ setup(u) {
293
+ const d = u, f = de(), v = fe(f), l = Pe(), m = ze();
294
+ me();
295
+ const a = ce("webx-vacancies"), N = Ve(), n = C([]), k = C({ categories: [] }), I = C(!0), M = bt(Ot), q = h(() => f.can("vacancies.manage")), i = h(
296
296
  () => f.state.manifest?.modules.find((t) => t.id === "vacancies")?.title ?? a("module.vacancies")
297
- ), T = h(() => f.i18n.state.locale), b = h({
298
- get: () => typeof n.query.view == "string" ? n.query.view : "",
297
+ ), x = h(() => f.i18n.state.locale), b = h({
298
+ get: () => typeof l.query.view == "string" ? l.query.view : "",
299
299
  set: (t) => {
300
300
  m.replace({
301
- query: { ...n.query, view: t === "" ? void 0 : String(t) }
301
+ query: { ...l.query, view: t === "" ? void 0 : String(t) }
302
302
  });
303
303
  }
304
- }), V = h(() => b.value === "trashed"), M = h(() => b.value === "closed" ? "closed" : b.value === "all" ? "all" : "open"), U = h(() => {
305
- const t = n.query.category;
304
+ }), T = h(() => b.value === "trashed"), A = h(() => b.value === "closed" ? "closed" : b.value === "all" ? "all" : "open"), B = h(() => {
305
+ const t = l.query.category;
306
306
  return typeof t == "string" && t !== "" && Number(t) || null;
307
307
  }), E = h(
308
- () => typeof n.query.status == "string" ? n.query.status : ""
309
- ), N = h(() => typeof n.query.q == "string" ? n.query.q : ""), Q = W(N.value), D = h(() => [
308
+ () => typeof l.query.status == "string" ? l.query.status : ""
309
+ ), S = h(() => typeof l.query.q == "string" ? l.query.q : ""), G = C(S.value), Q = h(() => [
310
310
  { value: "", label: a("panel.view-open") },
311
311
  { value: "closed", label: a("panel.view-closed") },
312
312
  { value: "all", label: a("panel.view-all") },
313
313
  { value: "trashed", label: a("panel.bin"), icon: "trash" }
314
- ]), te = h(
314
+ ]), L = h(
315
315
  () => ["published", "draft", "unpublished"].map((t) => ({
316
316
  value: t,
317
317
  label: a(`panel.status-${t}`)
318
318
  }))
319
- ), P = h(
320
- () => N.value.trim() === "" && U.value === null && E.value === ""
321
- ), ue = h(() => M.value !== "closed" && !V.value), X = h(() => q.value && ue.value && P.value), O = h(() => ue.value ? a(P.value ? "panel.order-all" : "panel.order-locked") : a("panel.order-closed")), ye = h(() => N.value !== "" ? a("panel.empty-search") : V.value ? a("panel.empty-bin") : M.value === "closed" ? a("panel.empty-closed") : M.value === "all" ? a("panel.empty") : a("panel.empty-open")), B = h(() => {
319
+ ), W = h(
320
+ () => S.value.trim() === "" && B.value === null && E.value === ""
321
+ ), H = h(() => A.value !== "closed" && !T.value), ve = h(() => q.value && H.value && W.value), le = h(() => H.value ? a(W.value ? "panel.order-all" : "panel.order-locked") : a("panel.order-closed")), O = h(() => S.value !== "" ? a("panel.empty-search") : T.value ? a("panel.empty-bin") : A.value === "closed" ? a("panel.empty-closed") : A.value === "all" ? a("panel.empty") : a("panel.empty-open")), X = h(() => {
322
322
  const t = [];
323
323
  E.value !== "" && t.push({
324
324
  key: "status",
325
325
  label: `${a("panel.filter-status")}: ${a(`panel.status-${E.value}`)}`,
326
- clear: () => L("status", void 0)
326
+ clear: () => Z("status", void 0)
327
327
  });
328
- const d = k.value.categories.find((r) => r.id === U.value);
329
- return d && t.push({
328
+ const o = k.value.categories.find((r) => r.id === B.value);
329
+ return o && t.push({
330
330
  key: "category",
331
- label: `${a("panel.filter-category")}: ${d.title}`,
332
- clear: () => L("category", void 0)
331
+ label: `${a("panel.filter-category")}: ${o.title}`,
332
+ clear: () => Z("category", void 0)
333
333
  }), t;
334
334
  });
335
- async function Z() {
336
- C.value = !0;
335
+ async function K() {
336
+ I.value = !0;
337
337
  try {
338
338
  const t = await v.list({
339
- state: M.value,
340
- q: N.value,
341
- category: U.value,
342
- status: V.value ? "" : E.value,
343
- trashed: V.value
339
+ state: A.value,
340
+ q: S.value,
341
+ category: B.value,
342
+ status: T.value ? "" : E.value,
343
+ trashed: T.value
344
344
  });
345
- l.value = t.data, k.value = t.filters;
345
+ n.value = t.data, k.value = t.filters;
346
346
  } catch (t) {
347
- _.danger(I(t));
347
+ w.danger(N(t));
348
348
  } finally {
349
- C.value = !1;
349
+ I.value = !1;
350
350
  }
351
351
  }
352
- re([b, U, E, N], () => {
353
- Z();
354
- }), Z();
355
- let ae;
356
- re(Q, (t) => {
357
- clearTimeout(ae), ae = setTimeout(() => {
358
- m.replace({ query: { ...n.query, q: t.trim() === "" ? void 0 : t } });
352
+ ue([b, B, E, S], () => {
353
+ K();
354
+ }), K();
355
+ let se;
356
+ ue(G, (t) => {
357
+ clearTimeout(se), se = setTimeout(() => {
358
+ m.replace({ query: { ...l.query, q: t.trim() === "" ? void 0 : t } });
359
359
  }, 300);
360
- }), Oe(() => clearTimeout(ae));
361
- function L(t, d) {
360
+ }), Oe(() => clearTimeout(se));
361
+ function Z(t, o) {
362
362
  m.replace({
363
363
  query: {
364
- ...n.query,
365
- [t]: typeof d == "number" || typeof d == "string" && d !== "" ? String(d) : void 0
364
+ ...l.query,
365
+ [t]: typeof o == "number" || typeof o == "string" && o !== "" ? String(o) : void 0
366
366
  }
367
367
  });
368
368
  }
369
- function ee() {
370
- const t = { ...n.query };
369
+ function j() {
370
+ const t = { ...l.query };
371
371
  delete t.category, delete t.status, m.replace({ query: t });
372
372
  }
373
- function le(t) {
374
- m.push({ path: `${u.base}/${t.id}`, query: { ...n.query } });
373
+ function ie(t) {
374
+ m.push({ path: `${d.base}/${t.id}`, query: { ...l.query } });
375
375
  }
376
- async function fe() {
377
- const t = await F({});
378
- t && le(t);
376
+ async function ee() {
377
+ const t = await M({});
378
+ t && ie(t);
379
379
  }
380
- async function H() {
380
+ async function ge() {
381
381
  try {
382
- await v.reorder(l.value.map((t) => t.id));
382
+ await v.reorder(n.value.map((t) => t.id));
383
383
  } catch (t) {
384
- _.danger(I(t, a("panel.reorder-failed"))), await Z();
384
+ w.danger(N(t, a("panel.reorder-failed"))), await K();
385
385
  }
386
386
  }
387
- const se = (t) => t.status === "published" || t.status === "modified";
388
- function me(t) {
387
+ const oe = (t) => t.status === "published" || t.status === "modified";
388
+ function U(t) {
389
389
  if (!q.value) return [];
390
- if (V.value)
390
+ if (T.value)
391
391
  return [
392
392
  {
393
393
  key: "restore",
394
394
  icon: "refresh",
395
395
  label: a("panel.restore"),
396
396
  run: () => {
397
- xe(t);
397
+ ke(t);
398
398
  }
399
399
  }
400
400
  ];
401
- const d = [
402
- { key: "open", icon: "edit", label: a("panel.open"), run: () => le(t) },
401
+ const o = [
402
+ { key: "open", icon: "edit", label: a("panel.open"), run: () => ie(t) },
403
403
  {
404
404
  key: "duplicate",
405
405
  icon: "copy",
406
406
  label: a("panel.duplicate"),
407
407
  run: () => {
408
- ge(t);
408
+ be(t);
409
409
  }
410
410
  }
411
411
  ];
412
- return t.url && t.status !== "draft" && d.push({
412
+ return t.url && t.status !== "draft" && o.push({
413
413
  key: "site",
414
414
  icon: "external-link",
415
415
  label: a("panel.open-on-site"),
416
416
  href: t.url
417
- }), se(t) && t.closed_reason === "manual" ? d.push({
417
+ }), oe(t) && t.closed_reason === "manual" ? o.push({
418
418
  key: "reopen",
419
419
  icon: "refresh",
420
420
  label: a("panel.reopen"),
421
421
  run: () => {
422
- we(t);
422
+ _e(t);
423
423
  }
424
- }) : se(t) && t.closed_reason === null && d.push({
424
+ }) : oe(t) && t.closed_reason === null && o.push({
425
425
  key: "close",
426
426
  icon: "lock",
427
427
  label: a("panel.close"),
428
428
  run: () => {
429
- be(t);
429
+ we(t);
430
430
  }
431
- }), d.push(
432
- se(t) ? {
431
+ }), o.push(
432
+ oe(t) ? {
433
433
  key: "unpublish",
434
434
  icon: "eye-off",
435
435
  label: a("panel.unpublish"),
436
436
  run: () => {
437
- Y(() => v.unpublish(t.id), a("panel.unpublished-done"));
437
+ te(() => v.unpublish(t.id), a("panel.unpublished-done"));
438
438
  }
439
439
  } : {
440
440
  key: "publish",
441
441
  icon: "upload",
442
442
  label: a("panel.publish"),
443
443
  run: () => {
444
- Y(() => v.publish(t.id), a("panel.published"));
444
+ te(() => v.publish(t.id), a("panel.published"));
445
445
  }
446
446
  }
447
- ), d.push({
447
+ ), o.push({
448
448
  key: "delete",
449
449
  icon: "trash",
450
450
  label: a("panel.delete"),
451
451
  danger: !0,
452
452
  run: () => {
453
- _e(t);
453
+ xe(t);
454
454
  }
455
- }), d;
455
+ }), o;
456
456
  }
457
- async function ge(t) {
457
+ async function be(t) {
458
458
  try {
459
- const d = await v.duplicate(t.id);
460
- _.success(a("panel.duplicated")), le(d.vacancy);
461
- } catch (d) {
462
- _.danger(I(d));
459
+ const o = await v.duplicate(t.id);
460
+ w.success(a("panel.duplicated")), ie(o.vacancy);
461
+ } catch (o) {
462
+ w.danger(N(o));
463
463
  }
464
464
  }
465
- async function be(t) {
465
+ async function we(t) {
466
466
  if (t.status === "modified") {
467
- _.warning(a("panel.close-edits"));
467
+ w.warning(a("panel.close-edits"));
468
468
  return;
469
469
  }
470
- await j({
470
+ await J({
471
471
  title: a("panel.close-title", { title: t.title }),
472
472
  message: a("panel.close-text"),
473
473
  confirmText: a("panel.close"),
474
474
  cancelText: a("panel.cancel")
475
- }) && await Y(() => v.close(t.id), a("panel.closed"));
475
+ }) && await te(() => v.close(t.id), a("panel.closed"));
476
476
  }
477
- async function we(t) {
477
+ async function _e(t) {
478
478
  if (t.status === "modified") {
479
- _.warning(a("panel.close-edits"));
479
+ w.warning(a("panel.close-edits"));
480
480
  return;
481
481
  }
482
- if (await j({
482
+ if (await J({
483
483
  title: a("panel.reopen-title", { title: t.title }),
484
484
  message: a("panel.reopen-text"),
485
485
  confirmText: a("panel.reopen"),
486
486
  cancelText: a("panel.cancel")
487
487
  }))
488
488
  try {
489
- (await v.reopen(t.id)).closed ? _.warning(a("panel.reopen-expired")) : _.success(a("panel.reopened"));
489
+ (await v.reopen(t.id)).closed ? w.warning(a("panel.reopen-expired")) : w.success(a("panel.reopened"));
490
490
  } catch (r) {
491
- _.danger(I(r));
491
+ w.danger(N(r));
492
492
  } finally {
493
- await Z();
493
+ await K();
494
494
  }
495
495
  }
496
- async function _e(t) {
497
- await j({
496
+ async function xe(t) {
497
+ await J({
498
498
  title: a("panel.delete-title", { title: t.title }),
499
499
  message: a("panel.delete-text"),
500
500
  confirmText: a("panel.delete"),
501
501
  cancelText: a("panel.cancel"),
502
502
  tone: "danger"
503
- }) && await Y(() => v.remove(t.id), a("panel.deleted"));
503
+ }) && await te(() => v.remove(t.id), a("panel.deleted"));
504
504
  }
505
- async function xe(t) {
506
- await Y(() => v.restore(t.id), a("panel.restored"));
505
+ async function ke(t) {
506
+ await te(() => v.restore(t.id), a("panel.restored"));
507
507
  }
508
- async function Y(t, d) {
508
+ async function te(t, o) {
509
509
  try {
510
- await t(), _.success(d);
510
+ await t(), w.success(o);
511
511
  } catch (r) {
512
- _.danger(I(r));
512
+ w.danger(N(r));
513
513
  } finally {
514
- await Z();
514
+ await K();
515
515
  }
516
516
  }
517
- function ke(t) {
517
+ function pe(t) {
518
518
  return t === "published" || t === "modified" ? "success" : "default";
519
519
  }
520
- function s(t) {
521
- return V.value ? "—" : t.path === null ? a("panel.no-address") : `/${t.path}`;
520
+ function Te(t) {
521
+ return T.value ? "—" : t.path === null ? a("panel.no-address") : `/${t.path}`;
522
522
  }
523
- function w(t) {
523
+ function s(t) {
524
524
  if (t.workplace === "remote") return a("vacancy.workplace.remote");
525
- const d = t.city !== "" ? t.city : a("panel.no-city");
526
- return t.workplace === "hybrid" ? `${d} · ${a("vacancy.workplace.hybrid")}` : d;
525
+ const o = t.city !== "" ? t.city : a("panel.no-city");
526
+ return t.workplace === "hybrid" ? `${o} · ${a("vacancy.workplace.hybrid")}` : o;
527
527
  }
528
- function S(t) {
529
- return t.employment_types.map((d) => a(Rt(d))).join(", ");
528
+ function g(t) {
529
+ return t.employment_types.map((o) => a(qt(o))).join(", ");
530
530
  }
531
- function G(t) {
532
- return t.closed && M.value === "all" && !V.value;
531
+ function F(t) {
532
+ return t.closed && A.value === "all" && !T.value;
533
533
  }
534
- const Te = h(
534
+ const P = h(
535
535
  () => q.value ? [{ key: "new", label: a("panel.new"), icon: "plus", primary: !0, run: () => {
536
- fe();
536
+ ee();
537
537
  } }] : []
538
538
  );
539
- return (t, d) => (y(), z("div", qt, [
540
- p(e(je), {
539
+ return (t, o) => (y(), z("div", Dt, [
540
+ p(e(Ke), {
541
541
  view: b.value,
542
- "onUpdate:view": d[4] || (d[4] = (r) => b.value = r),
543
- title: o.value,
544
- views: D.value,
545
- actions: Te.value,
542
+ "onUpdate:view": o[4] || (o[4] = (r) => b.value = r),
543
+ title: i.value,
544
+ views: Q.value,
545
+ actions: P.value,
546
546
  padding: "sm"
547
547
  }, {
548
- default: i(() => [
549
- A("div", Et, [
548
+ default: c(() => [
549
+ D("div", At, [
550
550
  p(e(Me), {
551
- modelValue: Q.value,
552
- "onUpdate:modelValue": d[0] || (d[0] = (r) => Q.value = r),
551
+ modelValue: G.value,
552
+ "onUpdate:modelValue": o[0] || (o[0] = (r) => G.value = r),
553
553
  class: "wx-vacancies__search",
554
554
  size: "sm",
555
555
  clearable: "",
556
556
  placeholder: e(a)("panel.search"),
557
557
  "aria-label": e(a)("panel.search")
558
558
  }, {
559
- prefix: i(() => [
560
- p(e(ie), {
559
+ prefix: c(() => [
560
+ p(e(re), {
561
561
  name: "search",
562
562
  size: "sm"
563
563
  })
564
564
  ]),
565
565
  _: 1
566
566
  }, 8, ["modelValue", "placeholder", "aria-label"]),
567
- p(e(gt), {
567
+ p(e(wt), {
568
568
  title: e(a)("panel.filters"),
569
569
  width: 280,
570
570
  side: "bottom",
571
571
  align: "end"
572
572
  }, {
573
- trigger: i(() => [
574
- p(e(bt), {
573
+ trigger: c(() => [
574
+ p(e(_t), {
575
575
  class: "wx-vacancies__funnel",
576
- value: B.value.length,
577
- hidden: B.value.length === 0,
576
+ value: X.value.length,
577
+ hidden: X.value.length === 0,
578
578
  type: "primary",
579
579
  label: e(a)("panel.filters")
580
580
  }, {
581
- default: i(() => [
582
- p(e(wt), {
581
+ default: c(() => [
582
+ p(e(xt), {
583
583
  icon: "filter",
584
584
  size: "sm",
585
585
  title: e(a)("panel.filters")
@@ -588,20 +588,20 @@ const St = /* @__PURE__ */ pe({
588
588
  _: 1
589
589
  }, 8, ["value", "hidden", "label"])
590
590
  ]),
591
- default: i(() => [
592
- A("div", Ot, [
593
- V.value ? R("", !0) : (y(), $(e($e), {
591
+ default: c(() => [
592
+ D("div", Pt, [
593
+ T.value ? R("", !0) : (y(), $(e($e), {
594
594
  key: 0,
595
595
  label: e(a)("panel.filter-status")
596
596
  }, {
597
- default: i(() => [
597
+ default: c(() => [
598
598
  p(e(Ie), {
599
599
  "model-value": E.value === "" ? null : E.value,
600
- options: te.value,
600
+ options: L.value,
601
601
  placeholder: e(a)("panel.any-status"),
602
602
  clearable: "",
603
603
  size: "sm",
604
- "onUpdate:modelValue": d[1] || (d[1] = (r) => L("status", r))
604
+ "onUpdate:modelValue": o[1] || (o[1] = (r) => Z("status", r))
605
605
  }, null, 8, ["model-value", "options", "placeholder"])
606
606
  ]),
607
607
  _: 1
@@ -609,30 +609,30 @@ const St = /* @__PURE__ */ pe({
609
609
  p(e($e), {
610
610
  label: e(a)("panel.filter-category")
611
611
  }, {
612
- default: i(() => [
612
+ default: c(() => [
613
613
  p(e(Ie), {
614
- "model-value": U.value,
614
+ "model-value": B.value,
615
615
  options: k.value.categories.map((r) => ({ value: r.id, label: r.title })),
616
616
  placeholder: e(a)("panel.any-category"),
617
617
  clearable: "",
618
618
  size: "sm",
619
- "onUpdate:modelValue": d[2] || (d[2] = (r) => L("category", r))
619
+ "onUpdate:modelValue": o[2] || (o[2] = (r) => Z("category", r))
620
620
  }, null, 8, ["model-value", "options", "placeholder"])
621
621
  ]),
622
622
  _: 1
623
623
  }, 8, ["label"]),
624
- B.value.length > 0 ? (y(), $(e(K), {
624
+ X.value.length > 0 ? (y(), $(e(ae), {
625
625
  key: 1,
626
626
  variant: "text",
627
627
  size: "sm",
628
628
  block: "",
629
- onClick: ee
629
+ onClick: j
630
630
  }, {
631
- icon: i(() => [
632
- p(e(ie), { name: "close" })
631
+ icon: c(() => [
632
+ p(e(re), { name: "close" })
633
633
  ]),
634
- default: i(() => [
635
- x(" " + g(e(a)("panel.filters-reset")), 1)
634
+ default: c(() => [
635
+ V(" " + _(e(a)("panel.filters-reset")), 1)
636
636
  ]),
637
637
  _: 1
638
638
  })) : R("", !0)
@@ -641,77 +641,77 @@ const St = /* @__PURE__ */ pe({
641
641
  _: 1
642
642
  }, 8, ["title"])
643
643
  ]),
644
- B.value.length > 0 ? (y(), z("div", Dt, [
645
- p(e(Ye), { filters: B.value }, null, 8, ["filters"])
644
+ X.value.length > 0 ? (y(), z("div", zt, [
645
+ p(e(je), { filters: X.value }, null, 8, ["filters"])
646
646
  ])) : R("", !0),
647
- C.value && l.value.length === 0 ? (y(), $(e(de), {
647
+ I.value && n.value.length === 0 ? (y(), $(e(he), {
648
648
  key: 1,
649
649
  class: "wx-vacancies__loading",
650
650
  rows: 5
651
- })) : l.value.length === 0 ? (y(), $(e(Le), {
651
+ })) : n.value.length === 0 ? (y(), $(e(Le), {
652
652
  key: 2,
653
- title: ye.value,
654
- description: M.value === "all" && !V.value && P.value ? e(a)("panel.empty-help") : void 0
653
+ title: O.value,
654
+ description: A.value === "all" && !T.value && W.value ? e(a)("panel.empty-help") : void 0
655
655
  }, null, 8, ["title", "description"])) : (y(), z(ne, { key: 3 }, [
656
- p(e(_t), {
657
- modelValue: l.value,
658
- "onUpdate:modelValue": d[3] || (d[3] = (r) => l.value = r),
659
- class: De(["wx-vacancies__list", { "is-loading": C.value }]),
656
+ p(e(kt), {
657
+ modelValue: n.value,
658
+ "onUpdate:modelValue": o[3] || (o[3] = (r) => n.value = r),
659
+ class: De(["wx-vacancies__list", { "is-loading": I.value }]),
660
660
  plain: "",
661
661
  "item-key": "id",
662
- handle: X.value ? "grip" : "row",
662
+ handle: ve.value ? "grip" : "row",
663
663
  "item-label": (r) => r.title,
664
- disabled: !X.value,
665
- onMove: H
664
+ disabled: !ve.value,
665
+ onMove: ge
666
666
  }, {
667
- default: i(({ item: r }) => [
668
- (y(), $(ct(V.value ? "div" : "router-link"), ut({
669
- class: ["wx-vacancy-row", { "is-closed": G(r) }]
670
- }, V.value ? {} : { to: { path: `${u.base}/${r.id}`, query: e(n).query } }), {
671
- default: i(() => [
672
- A("span", At, [
673
- A("span", Pt, g(r.title), 1),
674
- A("span", zt, [
675
- x(g(s(r)), 1),
676
- V.value ? R("", !0) : (y(), $(e(Je), {
667
+ default: c(({ item: r }) => [
668
+ (y(), $(dt(T.value ? "div" : "router-link"), vt({
669
+ class: ["wx-vacancy-row", { "is-closed": F(r) }]
670
+ }, T.value ? {} : { to: { path: `${d.base}/${r.id}`, query: e(l).query } }), {
671
+ default: c(() => [
672
+ D("span", Mt, [
673
+ D("span", Lt, _(r.title), 1),
674
+ D("span", Ft, [
675
+ V(_(Te(r)), 1),
676
+ T.value ? R("", !0) : (y(), $(e(Je), {
677
677
  key: 0,
678
678
  locale: r.address_locale
679
679
  }, null, 8, ["locale"]))
680
680
  ])
681
681
  ]),
682
- A("span", Mt, [
683
- A("span", Lt, [
684
- p(e(ie), {
682
+ D("span", Ut, [
683
+ D("span", Bt, [
684
+ p(e(re), {
685
685
  name: r.workplace === "remote" ? "monitor" : "map-pin",
686
686
  size: "sm"
687
687
  }, null, 8, ["name"]),
688
- x(" " + g(w(r)), 1)
688
+ V(" " + _(s(r)), 1)
689
689
  ]),
690
- r.employment_types.length > 0 ? (y(), z("span", Ft, g(S(r)), 1)) : R("", !0),
690
+ r.employment_types.length > 0 ? (y(), z("span", Ht, _(g(r)), 1)) : R("", !0),
691
691
  r.valid_through ? (y(), $(e(Ne), {
692
692
  key: 1,
693
- content: e(a)("panel.until-help", { date: e(Be)(r.valid_through, T.value) })
693
+ content: e(a)("panel.until-help", { date: e(Ue)(r.valid_through, x.value) })
694
694
  }, {
695
- default: i(() => [
696
- A("span", Ut, [
697
- p(e(ie), {
695
+ default: c(() => [
696
+ D("span", Kt, [
697
+ p(e(re), {
698
698
  name: "calendar",
699
699
  size: "sm"
700
700
  }),
701
- x(" " + g(e(a)("panel.until", { date: e(It)(r.valid_through, T.value) })), 1)
701
+ V(" " + _(e(a)("panel.until", { date: e(Rt)(r.valid_through, x.value) })), 1)
702
702
  ])
703
703
  ]),
704
704
  _: 2
705
705
  }, 1032, ["content"])) : R("", !0)
706
706
  ]),
707
- A("span", Bt, [
708
- (y(!0), z(ne, null, Ae(r.categories, (Ce) => (y(), $(e(J), {
707
+ D("span", jt, [
708
+ (y(!0), z(ne, null, Ae(r.categories, (Ce) => (y(), $(e(Y), {
709
709
  key: Ce.id,
710
710
  size: "sm",
711
711
  round: ""
712
712
  }, {
713
- default: i(() => [
714
- x(g(Ce.title), 1)
713
+ default: c(() => [
714
+ V(_(Ce.title), 1)
715
715
  ]),
716
716
  _: 2
717
717
  }, 1024))), 128)),
@@ -719,38 +719,38 @@ const St = /* @__PURE__ */ pe({
719
719
  key: 0,
720
720
  content: e(a)(`panel.closed-${r.closed_reason}-help`)
721
721
  }, {
722
- default: i(() => [
723
- p(e(J), {
722
+ default: c(() => [
723
+ p(e(Y), {
724
724
  type: "warning",
725
725
  size: "sm",
726
726
  round: ""
727
727
  }, {
728
- default: i(() => [
729
- x(g(e(a)(`panel.closed-${r.closed_reason}`)), 1)
728
+ default: c(() => [
729
+ V(_(e(a)(`panel.closed-${r.closed_reason}`)), 1)
730
730
  ]),
731
731
  _: 2
732
732
  }, 1024)
733
733
  ]),
734
734
  _: 2
735
735
  }, 1032, ["content"])) : R("", !0),
736
- p(e(J), {
737
- type: ke(r.status),
736
+ p(e(Y), {
737
+ type: pe(r.status),
738
738
  dot: "",
739
739
  size: "sm"
740
740
  }, {
741
- default: i(() => [
742
- x(g(e(a)(`panel.status-${r.status}`)), 1)
741
+ default: c(() => [
742
+ V(_(e(a)(`panel.status-${r.status}`)), 1)
743
743
  ]),
744
744
  _: 2
745
745
  }, 1032, ["type"]),
746
- r.status === "modified" ? (y(), $(e(J), {
746
+ r.status === "modified" ? (y(), $(e(Y), {
747
747
  key: 1,
748
748
  type: "primary",
749
749
  size: "sm",
750
750
  round: ""
751
751
  }, {
752
- default: i(() => [
753
- x(g(e(a)("panel.edits")), 1)
752
+ default: c(() => [
753
+ V(_(e(a)("panel.edits")), 1)
754
754
  ]),
755
755
  _: 1
756
756
  })) : R("", !0)
@@ -759,19 +759,19 @@ const St = /* @__PURE__ */ pe({
759
759
  _: 2
760
760
  }, 1040, ["class"]))
761
761
  ]),
762
- actions: i(({ item: r }) => [
763
- p(e(Ge), {
764
- actions: me(r),
762
+ actions: c(({ item: r }) => [
763
+ p(e(Ye), {
764
+ actions: U(r),
765
765
  label: r.title
766
766
  }, null, 8, ["actions", "label"])
767
767
  ]),
768
768
  _: 1
769
769
  }, 8, ["modelValue", "class", "handle", "item-label", "disabled"]),
770
- q.value && !V.value ? (y(), $(e(Fe), {
770
+ q.value && !T.value ? (y(), $(e(Tt), {
771
771
  key: 0,
772
772
  class: "wx-vacancies__note",
773
773
  type: "info",
774
- description: O.value
774
+ description: le.value
775
775
  }, null, 8, ["description"])) : R("", !0)
776
776
  ], 64))
777
777
  ]),
@@ -779,224 +779,251 @@ const St = /* @__PURE__ */ pe({
779
779
  }, 8, ["view", "title", "views", "actions"])
780
780
  ]));
781
781
  }
782
- }), We = (c, u) => {
783
- const f = c.__vccOpts || c;
784
- for (const [v, n] of u)
785
- f[v] = n;
782
+ }), We = (u, d) => {
783
+ const f = u.__vccOpts || u;
784
+ for (const [v, l] of d)
785
+ f[v] = l;
786
786
  return f;
787
- }, Kt = /* @__PURE__ */ We(Ht, [["__scopeId", "data-v-491c2b10"]]), He = /* @__PURE__ */ Symbol("wx-vacancy-editor");
788
- function jt(c) {
789
- dt(He, c);
787
+ }, Jt = /* @__PURE__ */ We(Yt, [["__scopeId", "data-v-491c2b10"]]), Be = /* @__PURE__ */ Symbol("wx-vacancy-editor");
788
+ function Gt(u) {
789
+ pt(Be, u);
790
790
  }
791
- function Yt() {
792
- return pt(He, null);
791
+ function Qt() {
792
+ return ht(Be, null);
793
793
  }
794
- const Gt = { class: "wx-vacancy-editor__word" }, Jt = 1200, Qt = /* @__PURE__ */ pe({
794
+ const Xt = { class: "wx-vacancy-editor__word" }, Zt = 1200, ea = /* @__PURE__ */ ye({
795
795
  __name: "VacancyEditorPage",
796
796
  props: {
797
797
  base: { default: "/vacancies" }
798
798
  },
799
- setup(c) {
800
- const u = c, f = ce(), v = ve(f), n = Pe(), m = ze(), a = xt(), I = Qe();
801
- he();
802
- const l = oe("webx-vacancies"), k = oe("webx-admin"), C = Ve(), F = h(() => Number(n.params.id)), q = h(() => u.base), o = W(null), T = W({}), b = W(""), V = W(null), M = W(null), U = W(!0), E = W(!1), N = W(!1), Q = W({}), D = W(null), te = W(""), P = h(() => f.can("vacancies.manage")), ue = h(() => !P.value || N.value), X = h(() => JSON.stringify(T.value)), O = h(() => te.value !== "" && X.value !== te.value), ye = h(() => E.value ? "saving" : O.value ? "unsaved" : "saved"), B = h(() => {
803
- const s = T.value.title;
804
- return kt(s, a.active.value, o.value?.title ?? "");
805
- }), Z = h(() => {
806
- const s = o.value;
799
+ setup(u) {
800
+ const d = u, f = de(), v = fe(f), l = Pe(), m = ze(), a = $t(), N = Ge();
801
+ me();
802
+ const n = ce("webx-vacancies"), k = ce("webx-admin"), I = Ve(), M = h(() => Number(l.params.id)), q = h(() => d.base), i = C(null), x = C({}), b = C(""), T = C(null), A = C(null), B = C(!0), E = C(!1), S = C(!1), G = C({}), Q = C(""), L = h(() => f.can("vacancies.manage")), W = Qe({
803
+ entity: "vacancies",
804
+ id: () => i.value?.id,
805
+ values: x,
806
+ revision: b,
807
+ read: async () => {
808
+ const s = await v.get(M.value);
809
+ return { values: s.values, revision: s.revision };
810
+ },
811
+ adopt: (s) => {
812
+ Q.value = JSON.stringify(s.values);
813
+ },
814
+ // Published or restored by somebody else: the badge and the address follow, and the form
815
+ // stays as it is.
816
+ refresh: () => ie(),
817
+ restore: async () => {
818
+ i.value && await v.restore(i.value.id);
819
+ },
820
+ canWrite: () => L.value,
821
+ busy: () => E.value,
822
+ screen: "vacancies.form"
823
+ }), H = W.conflict, ve = h(() => !L.value || S.value), le = h(() => JSON.stringify(x.value)), O = h(() => Q.value !== "" && le.value !== Q.value), X = h(() => E.value ? "saving" : O.value ? "unsaved" : "saved"), K = h(() => {
824
+ const s = x.value.title;
825
+ return Vt(s, a.active.value, i.value?.title ?? "");
826
+ }), se = h(() => {
827
+ const s = i.value;
807
828
  if (!s) return "";
808
- const w = [];
809
- return s.valid_through !== null && !s.closed && w.push(
810
- l("editor.open-until", { date: Be(s.valid_through, f.i18n.state.locale) })
811
- ), (s.status === "published" || s.status === "modified") && w.push(l("editor.live-since", { date: I.short(s.published_at) })), w.join(" · ");
829
+ const g = [];
830
+ return s.valid_through !== null && !s.closed && g.push(
831
+ n("editor.open-until", { date: Ue(s.valid_through, f.i18n.state.locale) })
832
+ ), (s.status === "published" || s.status === "modified") && g.push(n("editor.live-since", { date: N.short(s.published_at) })), g.join(" · ");
812
833
  });
813
- Xe({ type: "vacancy", id: h(() => o.value?.id ?? null) }), Ze({
814
- values: T,
815
- prefix: V,
816
- path: h(() => o.value?.path),
817
- moving: () => l("editor.address-moving")
818
- }), jt({ vacancy: o, canManage: P.value, reload: () => L(!0) });
819
- function ae(s) {
820
- const w = s.values;
821
- o.value = s.vacancy, T.value = w, b.value = s.revision, V.value = s.prefix, M.value = s.preview_url, te.value = JSON.stringify(w), D.value = null;
834
+ Xe({ type: "vacancy", id: h(() => i.value?.id ?? null) }), Ze({
835
+ values: x,
836
+ prefix: T,
837
+ path: h(() => i.value?.path),
838
+ moving: () => n("editor.address-moving")
839
+ }), Gt({ vacancy: i, canManage: L.value, reload: () => j(!0) });
840
+ function Z(s) {
841
+ const g = s.values;
842
+ i.value = s.vacancy, x.value = g, b.value = s.revision, T.value = s.prefix, A.value = s.preview_url, Q.value = JSON.stringify(g), W.opened(g), H.value = null;
822
843
  }
823
- async function L(s = !1) {
824
- s || (U.value = !0);
844
+ async function j(s = !1) {
845
+ s || (B.value = !0);
825
846
  try {
826
- ae(await v.get(F.value));
827
- } catch (w) {
828
- _.danger(C(w)), m.push(q.value);
847
+ Z(await v.get(M.value));
848
+ } catch (g) {
849
+ w.danger(I(g)), m.push(q.value);
829
850
  } finally {
830
- U.value = !1;
851
+ B.value = !1;
852
+ }
853
+ }
854
+ async function ie() {
855
+ try {
856
+ const s = await v.get(M.value);
857
+ i.value = s.vacancy, T.value = s.prefix, A.value = s.preview_url;
858
+ } catch {
831
859
  }
832
860
  }
833
861
  let ee;
834
- function le() {
835
- !P.value || D.value || !O.value || (clearTimeout(ee), ee = setTimeout(() => {
836
- H();
837
- }, Jt));
862
+ function ge() {
863
+ !L.value || H.value || !O.value || W.stopped.value || (clearTimeout(ee), ee = setTimeout(() => {
864
+ U();
865
+ }, Zt));
838
866
  }
839
- function fe() {
840
- !P.value || D.value || !O.value || E.value || (clearTimeout(ee), H());
867
+ function oe() {
868
+ !L.value || H.value || !O.value || E.value || W.stopped.value || (clearTimeout(ee), U());
841
869
  }
842
- async function H() {
843
- if (!o.value || E.value || !P.value) return;
870
+ async function U() {
871
+ if (!i.value || E.value || !L.value) return;
844
872
  clearTimeout(ee);
845
- const s = X.value, w = T.value;
846
- E.value = !0, Q.value = {};
873
+ const s = le.value, g = x.value;
874
+ E.value = !0, G.value = {};
875
+ let F = !1;
847
876
  try {
848
- const S = await v.save(o.value.id, { values: w, revision: b.value });
849
- o.value = S.vacancy, b.value = S.revision, V.value = S.prefix, M.value = S.preview_url, D.value = null, X.value === s && (te.value = s);
850
- } catch (S) {
851
- const G = S;
852
- G.status === 409 && G.body?.data ? D.value = G.body : G.body?.errors ? (Q.value = G.body.errors, _.danger(l("editor.save-failed"))) : _.danger(C(S));
877
+ const P = await v.save(i.value.id, { values: g, revision: b.value });
878
+ i.value = P.vacancy, b.value = P.revision, T.value = P.prefix, A.value = P.preview_url, H.value = null, le.value === s && (Q.value = s), W.opened(g);
879
+ } catch (P) {
880
+ const t = P;
881
+ if (t.status === 409 && t.body?.data) {
882
+ const o = t.body.data;
883
+ W.refused({
884
+ values: o.values,
885
+ revision: o.revision,
886
+ changed: t.body.changed
887
+ }) && (i.value = o.vacancy, F = !0);
888
+ } else t.body?.errors ? (G.value = t.body.errors, w.danger(n("editor.save-failed"))) : await W.failed(P) || w.danger(I(P));
853
889
  } finally {
854
890
  E.value = !1;
855
891
  }
892
+ F && await U();
856
893
  }
857
- async function se() {
858
- await j({
859
- title: l("editor.conflict-theirs-title"),
860
- message: l("editor.conflict-theirs-text"),
861
- confirmText: l("editor.conflict-theirs"),
862
- cancelText: l("panel.cancel"),
863
- tone: "danger"
864
- }) && await L(!0);
865
- }
866
- async function me() {
867
- const s = D.value;
868
- s && (b.value = s.data.revision, D.value = null, await H());
894
+ async function be() {
895
+ await j(!0);
869
896
  }
870
- async function ge() {
871
- if (!(!o.value || !await j({
897
+ async function we() {
898
+ if (!(!i.value || !await J({
872
899
  title: k("editor.discard-title"),
873
900
  message: k("editor.discard-text"),
874
- confirmText: l("editor.discard"),
901
+ confirmText: n("editor.discard"),
875
902
  // Not «Cancel»: beside «Discard changes» the two read as the same word.
876
903
  cancelText: k("editor.keep-changes"),
877
904
  tone: "danger"
878
905
  }))) {
879
- N.value = !0;
906
+ S.value = !0;
880
907
  try {
881
- ae(await v.discard(o.value.id)), _.success(l("editor.discarded"));
882
- } catch (w) {
883
- _.danger(C(w));
908
+ Z(await v.discard(i.value.id)), w.success(n("editor.discarded"));
909
+ } catch (g) {
910
+ w.danger(I(g));
884
911
  } finally {
885
- N.value = !1;
912
+ S.value = !1;
886
913
  }
887
914
  }
888
915
  }
889
- async function be() {
890
- if (O.value && await H(), D.value || O.value) return;
891
- const s = o.value;
916
+ async function _e() {
917
+ if (O.value && await U(), H.value || O.value || !i.value) return;
918
+ const s = await W.beforePublish();
892
919
  if (!s) return;
893
- const w = s.next_path ?? s.path, S = s.next_path != null && s.path !== null ? ` ${k("editor.publish-moves", { old: `/${s.path}` })}` : "";
894
- if (await j({
895
- title: l("editor.publish-title", { title: B.value || s.title }),
896
- message: w === null ? l("editor.publish-nowhere") : l("editor.publish-text", { address: `/${w}` }) + S,
897
- confirmText: l("panel.publish"),
898
- cancelText: l("panel.cancel")
920
+ const g = i.value, F = g.next_path ?? g.path, P = g.next_path != null && g.path !== null ? ` ${k("editor.publish-moves", { old: `/${g.path}` })}` : "";
921
+ if (s.asked || await J({
922
+ title: n("editor.publish-title", { title: K.value || g.title }),
923
+ message: F === null ? n("editor.publish-nowhere") : n("editor.publish-text", { address: `/${F}` }) + P,
924
+ confirmText: n("panel.publish"),
925
+ cancelText: n("panel.cancel")
899
926
  })) {
900
- N.value = !0;
927
+ S.value = !0;
901
928
  try {
902
- await v.publish(s.id), await L(!0), _.success(l("panel.published"));
903
- } catch (Te) {
904
- _.danger(C(Te));
929
+ await v.publish(g.id, s.revision), await j(!0), w.success(n("panel.published"));
930
+ } catch (o) {
931
+ await W.failed(o) || w.danger(I(o));
905
932
  } finally {
906
- N.value = !1;
933
+ S.value = !1;
907
934
  }
908
935
  }
909
936
  }
910
- async function we() {
911
- const s = o.value;
912
- if (s && (O.value && await H(), !(D.value || O.value))) {
913
- N.value = !0;
937
+ async function xe() {
938
+ const s = i.value;
939
+ if (s && (O.value && await U(), !(H.value || O.value))) {
940
+ S.value = !0;
914
941
  try {
915
- const w = await v.duplicate(s.id);
916
- _.success(l("panel.duplicated")), await m.push({ path: `${q.value}/${w.vacancy.id}`, query: { ...n.query } });
917
- } catch (w) {
918
- _.danger(C(w));
942
+ const g = await v.duplicate(s.id);
943
+ w.success(n("panel.duplicated")), await m.push({ path: `${q.value}/${g.vacancy.id}`, query: { ...l.query } });
944
+ } catch (g) {
945
+ w.danger(I(g));
919
946
  } finally {
920
- N.value = !1;
947
+ S.value = !1;
921
948
  }
922
949
  }
923
950
  }
924
- async function _e() {
925
- const s = o.value;
926
- if (!(!s || !await j({
951
+ async function ke() {
952
+ const s = i.value;
953
+ if (!(!s || !await J({
927
954
  title: k("editor.unpublish-title"),
928
955
  message: k("editor.unpublish-text"),
929
956
  confirmText: k("editor.unpublish"),
930
957
  cancelText: k("editor.keep-published")
931
958
  }))) {
932
- N.value = !0;
959
+ S.value = !0;
933
960
  try {
934
- await v.unpublish(s.id), await L(!0), _.success(k("editor.unpublished"));
935
- } catch (S) {
936
- _.danger(C(S));
961
+ await v.unpublish(s.id), await j(!0), w.success(k("editor.unpublished"));
962
+ } catch (F) {
963
+ w.danger(I(F));
937
964
  } finally {
938
- N.value = !1;
965
+ S.value = !1;
939
966
  }
940
967
  }
941
968
  }
942
- function xe() {
943
- const s = o.value?.status;
969
+ function te() {
970
+ const s = i.value?.status;
944
971
  return s === "published" || s === "modified" ? "success" : "default";
945
972
  }
946
- function Y(s) {
973
+ function pe(s) {
947
974
  O.value && s.preventDefault();
948
975
  }
949
- re(X, le), re(F, () => {
950
- L();
951
- }), Ee(() => {
952
- L(), window.addEventListener("beforeunload", Y);
976
+ ue(le, ge), ue(M, () => {
977
+ j();
978
+ }), qe(() => {
979
+ j(), window.addEventListener("beforeunload", pe);
953
980
  }), Oe(() => {
954
- clearTimeout(ee), window.removeEventListener("beforeunload", Y);
955
- }), vt(async () => !O.value || !P.value || (await H(), !O.value) ? !0 : await j({
956
- title: l("editor.leave-title"),
957
- message: l("editor.leave-text"),
958
- confirmText: l("editor.leave"),
959
- cancelText: l("panel.cancel"),
981
+ clearTimeout(ee), window.removeEventListener("beforeunload", pe);
982
+ }), yt(async () => !O.value || !L.value || (await U(), !O.value) ? !0 : await J({
983
+ title: n("editor.leave-title"),
984
+ message: n("editor.leave-text"),
985
+ confirmText: n("editor.leave"),
986
+ cancelText: n("panel.cancel"),
960
987
  tone: "danger"
961
988
  }));
962
- const ke = h(() => {
989
+ const Te = h(() => {
963
990
  const s = [];
964
- return M.value && s.push({ key: "preview", label: l("editor.preview"), icon: "eye", href: M.value }), o.value?.url && o.value.status !== "draft" && s.push({
991
+ return A.value && s.push({ key: "preview", label: n("editor.preview"), icon: "eye", href: A.value }), i.value?.url && i.value.status !== "draft" && s.push({
965
992
  key: "site",
966
- label: l("panel.open-on-site"),
993
+ label: n("panel.open-on-site"),
967
994
  icon: "link",
968
- href: o.value.url
969
- }), P.value && (o.value?.status === "published" || o.value?.status === "modified") && s.push({
995
+ href: i.value.url
996
+ }), L.value && (i.value?.status === "published" || i.value?.status === "modified") && s.push({
970
997
  key: "unpublish",
971
998
  label: k("editor.unpublish"),
972
999
  icon: "eye-off",
973
1000
  run: () => {
974
- _e();
1001
+ ke();
975
1002
  }
976
- }), o.value?.status === "modified" && s.push({
1003
+ }), i.value?.status === "modified" && s.push({
977
1004
  key: "discard",
978
- label: l("editor.discard"),
1005
+ label: n("editor.discard"),
979
1006
  icon: "refresh",
980
1007
  danger: !0,
981
1008
  menu: !0,
982
1009
  run: () => {
983
- ge();
1010
+ we();
984
1011
  }
985
1012
  }), s;
986
1013
  });
987
- return (s, w) => (y(), z("div", {
1014
+ return (s, g) => (y(), z("div", {
988
1015
  class: "wx-vacancy-editor",
989
- onFocusout: fe
1016
+ onFocusout: oe
990
1017
  }, [
991
- U.value || !o.value ? (y(), z(ne, { key: 0 }, [
992
- p(e(de), {
1018
+ B.value || !i.value ? (y(), z(ne, { key: 0 }, [
1019
+ p(e(he), {
993
1020
  class: "wx-vacancy-editor__ghost",
994
1021
  title: "",
995
1022
  rows: 1
996
1023
  }),
997
- p(e(Tt), null, {
998
- default: i(() => [
999
- p(e(de), { rows: 8 })
1024
+ p(e(Wt), null, {
1025
+ default: c(() => [
1026
+ p(e(he), { rows: 8 })
1000
1027
  ]),
1001
1028
  _: 1
1002
1029
  })
@@ -1004,29 +1031,29 @@ const Gt = { class: "wx-vacancy-editor__word" }, Jt = 1200, Qt = /* @__PURE__ */
1004
1031
  p(e(et), {
1005
1032
  divider: "",
1006
1033
  back: q.value,
1007
- "back-label": e(l)("module.vacancies"),
1008
- title: B.value || e(l)("editor.untitled"),
1009
- subtitle: Z.value,
1010
- actions: ke.value
1034
+ "back-label": e(n)("module.vacancies"),
1035
+ title: K.value || e(n)("editor.untitled"),
1036
+ subtitle: se.value,
1037
+ actions: Te.value
1011
1038
  }, {
1012
- trail: i(() => [
1013
- p(e($t), {
1039
+ trail: c(() => [
1040
+ p(e(Ct), {
1014
1041
  size: "sm",
1015
- label: e(l)("editor.trail")
1042
+ label: e(n)("editor.trail")
1016
1043
  }, {
1017
- default: i(() => [
1018
- p(e(Re), {
1044
+ default: c(() => [
1045
+ p(e(Se), {
1019
1046
  as: "router-link",
1020
1047
  to: q.value
1021
1048
  }, {
1022
- default: i(() => [
1023
- x(g(e(l)("module.vacancies")), 1)
1049
+ default: c(() => [
1050
+ V(_(e(n)("module.vacancies")), 1)
1024
1051
  ]),
1025
1052
  _: 1
1026
1053
  }, 8, ["to"]),
1027
- p(e(Re), { current: "" }, {
1028
- default: i(() => [
1029
- x(g(B.value || e(l)("editor.untitled")), 1)
1054
+ p(e(Se), { current: "" }, {
1055
+ default: c(() => [
1056
+ V(_(K.value || e(n)("editor.untitled")), 1)
1030
1057
  ]),
1031
1058
  _: 1
1032
1059
  })
@@ -1034,235 +1061,225 @@ const Gt = { class: "wx-vacancy-editor__word" }, Jt = 1200, Qt = /* @__PURE__ */
1034
1061
  _: 1
1035
1062
  }, 8, ["label"])
1036
1063
  ]),
1037
- "title-after": i(() => [
1038
- p(e(J), {
1039
- type: xe(),
1064
+ "title-after": c(() => [
1065
+ p(e(Y), {
1066
+ type: te(),
1040
1067
  dot: ""
1041
1068
  }, {
1042
- default: i(() => [
1043
- x(g(e(l)(`panel.status-${o.value.status}`)), 1)
1069
+ default: c(() => [
1070
+ V(_(e(n)(`panel.status-${i.value.status}`)), 1)
1044
1071
  ]),
1045
1072
  _: 1
1046
1073
  }, 8, ["type"]),
1047
- o.value.status === "modified" ? (y(), $(e(J), {
1074
+ i.value.status === "modified" ? (y(), $(e(Y), {
1048
1075
  key: 0,
1049
1076
  type: "primary",
1050
1077
  round: ""
1051
1078
  }, {
1052
- default: i(() => [
1053
- x(g(e(l)("panel.edits")), 1)
1079
+ default: c(() => [
1080
+ V(_(e(n)("panel.edits")), 1)
1054
1081
  ]),
1055
1082
  _: 1
1056
1083
  })) : R("", !0),
1057
- o.value.closed_reason ? (y(), $(e(J), {
1084
+ i.value.closed_reason ? (y(), $(e(Y), {
1058
1085
  key: 1,
1059
1086
  type: "warning",
1060
1087
  round: ""
1061
1088
  }, {
1062
- default: i(() => [
1063
- x(g(e(l)(`panel.closed-${o.value.closed_reason}`)), 1)
1089
+ default: c(() => [
1090
+ V(_(e(n)(`panel.closed-${i.value.closed_reason}`)), 1)
1064
1091
  ]),
1065
1092
  _: 1
1066
1093
  })) : R("", !0)
1067
1094
  ]),
1068
1095
  _: 1
1069
1096
  }, 8, ["back", "back-label", "title", "subtitle", "actions"]),
1070
- D.value ? (y(), $(e(Fe), {
1071
- key: 0,
1072
- type: "warning",
1073
- title: e(l)("editor.conflict-title"),
1074
- description: D.value.message
1075
- }, {
1076
- actions: i(() => [
1077
- p(e(K), {
1078
- size: "sm",
1079
- variant: "outline",
1080
- onClick: se
1081
- }, {
1082
- default: i(() => [
1083
- x(g(e(l)("editor.conflict-theirs")), 1)
1084
- ]),
1085
- _: 1
1086
- }),
1087
- p(e(K), {
1088
- size: "sm",
1089
- type: "primary",
1090
- onClick: me
1091
- }, {
1092
- default: i(() => [
1093
- x(g(e(l)("editor.conflict-mine")), 1)
1094
- ]),
1095
- _: 1
1096
- })
1097
- ]),
1098
- _: 1
1099
- }, 8, ["title", "description"])) : R("", !0),
1100
1097
  p(e(tt), {
1101
- modelValue: T.value,
1102
- "onUpdate:modelValue": w[0] || (w[0] = (S) => T.value = S),
1098
+ editing: e(W),
1099
+ onSave: U,
1100
+ onTheirs: be
1101
+ }, null, 8, ["editing"]),
1102
+ p(e(at), {
1103
+ modelValue: x.value,
1104
+ "onUpdate:modelValue": g[0] || (g[0] = (F) => x.value = F),
1103
1105
  name: "vacancies.form",
1104
- errors: Q.value,
1105
- disabled: ue.value
1106
+ errors: G.value,
1107
+ disabled: ve.value
1106
1108
  }, null, 8, ["modelValue", "errors", "disabled"]),
1107
- P.value ? (y(), $(e(Vt), { key: 1 }, {
1108
- state: i(() => [
1109
- p(e(at), { state: ye.value }, null, 8, ["state"])
1109
+ L.value ? (y(), $(e(It), { key: 0 }, {
1110
+ state: c(() => [
1111
+ e(W).stopped.value ? R("", !0) : (y(), $(e(lt), {
1112
+ key: 0,
1113
+ state: X.value
1114
+ }, null, 8, ["state"]))
1110
1115
  ]),
1111
- default: i(() => [
1112
- p(e(K), {
1116
+ default: c(() => [
1117
+ p(e(ae), {
1113
1118
  variant: "text",
1114
- disabled: N.value,
1115
- "aria-label": e(l)("panel.duplicate"),
1116
- onClick: we
1119
+ disabled: S.value,
1120
+ "aria-label": e(n)("panel.duplicate"),
1121
+ onClick: xe
1117
1122
  }, {
1118
- icon: i(() => [
1119
- p(e(ie), { name: "copy" })
1123
+ icon: c(() => [
1124
+ p(e(re), { name: "copy" })
1120
1125
  ]),
1121
- default: i(() => [
1122
- A("span", Gt, g(e(l)("panel.duplicate")), 1)
1126
+ default: c(() => [
1127
+ D("span", Xt, _(e(n)("panel.duplicate")), 1)
1123
1128
  ]),
1124
1129
  _: 1
1125
1130
  }, 8, ["disabled", "aria-label"]),
1126
- p(e(K), {
1131
+ p(e(ae), {
1127
1132
  variant: "outline",
1128
1133
  loading: E.value,
1129
- disabled: !O.value,
1130
- onClick: H
1134
+ disabled: !O.value || e(W).stopped.value,
1135
+ title: e(W).blocked.value,
1136
+ onClick: U
1131
1137
  }, {
1132
- default: i(() => [
1133
- x(g(e(l)("editor.save")), 1)
1138
+ default: c(() => [
1139
+ V(_(e(n)("editor.save")), 1)
1134
1140
  ]),
1135
1141
  _: 1
1136
- }, 8, ["loading", "disabled"]),
1137
- p(e(K), {
1142
+ }, 8, ["loading", "disabled", "title"]),
1143
+ p(e(ae), {
1138
1144
  type: "primary",
1139
- loading: N.value,
1140
- disabled: o.value.status === "published" && !O.value,
1141
- onClick: be
1145
+ loading: S.value,
1146
+ disabled: e(W).stopped.value || i.value.status === "published" && !O.value,
1147
+ title: e(W).blocked.value,
1148
+ onClick: _e
1142
1149
  }, {
1143
- default: i(() => [
1144
- x(g(e(l)("panel.publish")), 1)
1150
+ default: c(() => [
1151
+ V(_(e(n)("panel.publish")), 1)
1145
1152
  ]),
1146
1153
  _: 1
1147
- }, 8, ["loading", "disabled"])
1154
+ }, 8, ["loading", "disabled", "title"])
1148
1155
  ]),
1149
1156
  _: 1
1150
1157
  })) : R("", !0)
1151
1158
  ], 64))
1152
1159
  ], 32));
1153
1160
  }
1154
- }), Xt = /* @__PURE__ */ We(Qt, [["__scopeId", "data-v-12e705f9"]]), Zt = { class: "wx-vacancy-history" }, ea = { class: "wx-vacancy-history__number" }, ta = { class: "wx-vacancy-history__who" }, aa = /* @__PURE__ */ pe({
1161
+ }), ta = /* @__PURE__ */ We(ea, [["__scopeId", "data-v-d2657864"]]), aa = { class: "wx-vacancy-history-tab" }, la = { class: "wx-vacancy-history" }, na = { class: "wx-vacancy-history__number" }, sa = { class: "wx-vacancy-history__who" }, ia = /* @__PURE__ */ ye({
1155
1162
  name: "WxVacancyHistory",
1156
1163
  __name: "VacancyHistory",
1157
- setup(c) {
1158
- const u = ce(), f = ve(u), v = Yt();
1159
- he();
1160
- const n = oe("webx-vacancies"), m = Ve(), a = W(null), I = W(!1), l = h(() => v?.vacancy.value ?? null), k = h(() => v?.canManage ?? !1), C = h(
1161
- () => l.value?.status === "published" || l.value?.status === "modified" ? a.value?.[0]?.number ?? null : null
1164
+ setup(u) {
1165
+ const d = de(), f = fe(d), v = Qt();
1166
+ me();
1167
+ const l = ce("webx-vacancies"), m = Ve(), a = C(null), N = C(!1), n = h(() => v?.vacancy.value ?? null), k = h(() => v?.canManage ?? !1), I = h(
1168
+ () => n.value?.status === "published" || n.value?.status === "modified" ? a.value?.[0]?.number ?? null : null
1162
1169
  );
1163
- async function F() {
1164
- const o = l.value;
1165
- if (o)
1170
+ async function M() {
1171
+ const i = n.value;
1172
+ if (i)
1166
1173
  try {
1167
- a.value = await f.versions(o.id);
1168
- } catch (T) {
1169
- a.value = [], _.danger(m(T));
1174
+ a.value = await f.versions(i.id);
1175
+ } catch (x) {
1176
+ a.value = [], w.danger(m(x));
1170
1177
  }
1171
1178
  }
1172
- async function q(o) {
1173
- const T = l.value;
1174
- if (!(!T || !await j({
1175
- title: n("editor.restore-title", { number: o.number }),
1176
- message: n("editor.restore-text"),
1177
- confirmText: n("editor.restore-version"),
1178
- cancelText: n("panel.cancel")
1179
+ async function q(i) {
1180
+ const x = n.value;
1181
+ if (!(!x || !await J({
1182
+ title: l("editor.restore-title", { number: i.number }),
1183
+ message: l("editor.restore-text"),
1184
+ confirmText: l("editor.restore-version"),
1185
+ cancelText: l("panel.cancel")
1179
1186
  }))) {
1180
- I.value = !0;
1187
+ N.value = !0;
1181
1188
  try {
1182
- await f.restoreVersion(T.id, o.number), await v?.reload(), _.success(n("editor.restored-version", { number: o.number }));
1183
- } catch (V) {
1184
- _.danger(m(V));
1189
+ await f.restoreVersion(x.id, i.number), await v?.reload(), w.success(l("editor.restored-version", { number: i.number }));
1190
+ } catch (T) {
1191
+ w.danger(m(T));
1185
1192
  } finally {
1186
- I.value = !1;
1193
+ N.value = !1;
1187
1194
  }
1188
1195
  }
1189
1196
  }
1190
- return re(
1191
- () => [l.value?.id, l.value?.published_at, l.value?.updated_at],
1197
+ return ue(
1198
+ () => [n.value?.id, n.value?.published_at, n.value?.updated_at],
1192
1199
  () => {
1193
- F();
1200
+ M();
1194
1201
  },
1195
1202
  { immediate: !0 }
1196
- ), (o, T) => (y(), z("div", Zt, [
1197
- a.value === null ? (y(), $(e(de), {
1198
- key: 0,
1199
- class: "wx-vacancy-history__ghost",
1200
- rows: 3
1201
- })) : a.value.length === 0 ? (y(), $(e(Le), {
1202
- key: 1,
1203
- description: e(n)("editor.history-empty")
1204
- }, null, 8, ["description"])) : (y(!0), z(ne, { key: 2 }, Ae(a.value, (b) => (y(), z("div", {
1205
- key: b.number,
1206
- class: De(["wx-vacancy-history__row", { "is-live": b.number === C.value }])
1207
- }, [
1208
- A("code", ea, g(e(n)("editor.version", { number: b.number })), 1),
1209
- A("div", ta, [
1210
- b.created_at ? (y(), $(e(nt), {
1203
+ ), (i, x) => (y(), z("div", aa, [
1204
+ D("div", la, [
1205
+ a.value === null ? (y(), $(e(he), {
1206
+ key: 0,
1207
+ class: "wx-vacancy-history__ghost",
1208
+ rows: 3
1209
+ })) : a.value.length === 0 ? (y(), $(e(Le), {
1210
+ key: 1,
1211
+ description: e(l)("editor.history-empty")
1212
+ }, null, 8, ["description"])) : (y(!0), z(ne, { key: 2 }, Ae(a.value, (b) => (y(), z("div", {
1213
+ key: b.number,
1214
+ class: De(["wx-vacancy-history__row", { "is-live": b.number === I.value }])
1215
+ }, [
1216
+ D("code", na, _(e(l)("editor.version", { number: b.number })), 1),
1217
+ D("div", sa, [
1218
+ b.created_at ? (y(), $(e(nt), {
1219
+ key: 0,
1220
+ value: b.created_at,
1221
+ size: "md",
1222
+ tone: "default"
1223
+ }, null, 8, ["value"])) : R("", !0),
1224
+ p(e(Nt), {
1225
+ size: "sm",
1226
+ tone: "muted"
1227
+ }, {
1228
+ default: c(() => [
1229
+ V(_(b.author ?? e(l)(`editor.source-${b.source}`)) + " ", 1),
1230
+ b.comment ? (y(), z(ne, { key: 0 }, [
1231
+ V(" · " + _(b.comment), 1)
1232
+ ], 64)) : R("", !0)
1233
+ ]),
1234
+ _: 2
1235
+ }, 1024)
1236
+ ]),
1237
+ b.number === I.value ? (y(), $(e(Y), {
1211
1238
  key: 0,
1212
- value: b.created_at,
1213
- size: "md",
1214
- tone: "default"
1215
- }, null, 8, ["value"])) : R("", !0),
1216
- p(e(Wt), {
1239
+ type: "success",
1240
+ dot: ""
1241
+ }, {
1242
+ default: c(() => [
1243
+ V(_(e(l)("editor.version-live")), 1)
1244
+ ]),
1245
+ _: 1
1246
+ })) : R("", !0),
1247
+ k.value && b.number !== I.value ? (y(), $(e(ae), {
1248
+ key: 1,
1217
1249
  size: "sm",
1218
- tone: "muted"
1250
+ variant: "outline",
1251
+ loading: N.value,
1252
+ onClick: (T) => q(b)
1219
1253
  }, {
1220
- default: i(() => [
1221
- x(g(b.author ?? e(n)(`editor.source-${b.source}`)) + " ", 1),
1222
- b.comment ? (y(), z(ne, { key: 0 }, [
1223
- x(" · " + g(b.comment), 1)
1224
- ], 64)) : R("", !0)
1254
+ default: c(() => [
1255
+ V(_(e(l)("editor.restore-version")), 1)
1225
1256
  ]),
1226
- _: 2
1227
- }, 1024)
1228
- ]),
1229
- b.number === C.value ? (y(), $(e(J), {
1230
- key: 0,
1231
- type: "success",
1232
- dot: ""
1233
- }, {
1234
- default: i(() => [
1235
- x(g(e(n)("editor.version-live")), 1)
1236
- ]),
1237
- _: 1
1238
- })) : R("", !0),
1239
- k.value && b.number !== C.value ? (y(), $(e(K), {
1240
- key: 1,
1241
- size: "sm",
1242
- variant: "outline",
1243
- loading: I.value,
1244
- onClick: (V) => q(b)
1245
- }, {
1246
- default: i(() => [
1247
- x(g(e(n)("editor.restore-version")), 1)
1248
- ]),
1249
- _: 1
1250
- }, 8, ["loading", "onClick"])) : R("", !0)
1251
- ], 2))), 128))
1257
+ _: 1
1258
+ }, 8, ["loading", "onClick"])) : R("", !0)
1259
+ ], 2))), 128))
1260
+ ]),
1261
+ p(e(st), {
1262
+ id: n.value?.id,
1263
+ entity: "vacancies",
1264
+ screen: "vacancies.form",
1265
+ "can-restore": k.value,
1266
+ stamp: [n.value?.published_at, n.value?.updated_at],
1267
+ onRestored: x[0] || (x[0] = (b) => e(v)?.reload())
1268
+ }, null, 8, ["id", "can-restore", "stamp"])
1252
1269
  ]));
1253
1270
  }
1254
- }), na = /* @__PURE__ */ We(aa, [["__scopeId", "data-v-77bc9b70"]]);
1255
- function la(c = "/vacancies") {
1271
+ }), oa = /* @__PURE__ */ We(ia, [["__scopeId", "data-v-1db40d1b"]]);
1272
+ function ra(u = "/vacancies") {
1256
1273
  return {
1257
1274
  api: "vacancies/categories",
1258
- path: `${c}/categories`,
1275
+ path: `${u}/categories`,
1259
1276
  name: "webx.vacancies.categories",
1260
1277
  module: "vacancy-categories",
1261
1278
  screen: "vacancies.category-form",
1262
1279
  manage: "vacancies.categories.manage",
1263
1280
  count: "vacancies_count",
1264
1281
  // Every vacancy of the category, closed ones included: "what is filed here" is the question.
1265
- items: (u) => ({ path: c, query: { category: String(u), view: "all" } }),
1282
+ items: (d) => ({ path: u, query: { category: String(d), view: "all" } }),
1266
1283
  words: {
1267
1284
  new: "webx-vacancies::category.new",
1268
1285
  empty: "webx-vacancies::category.empty",
@@ -1281,19 +1298,19 @@ function la(c = "/vacancies") {
1281
1298
  }
1282
1299
  };
1283
1300
  }
1284
- function ca(c = {}) {
1285
- const u = c.path ?? "/vacancies";
1301
+ function pa(u = {}) {
1302
+ const d = u.path ?? "/vacancies";
1286
1303
  return [
1287
1304
  {
1288
1305
  id: "vacancies",
1289
- path: u,
1306
+ path: d,
1290
1307
  routes: [
1291
- { path: u, name: "webx.vacancies", component: Kt, props: { base: u } },
1308
+ { path: d, name: "webx.vacancies", component: Jt, props: { base: d } },
1292
1309
  {
1293
- path: `${u}/:id(\\d+)`,
1310
+ path: `${d}/:id(\\d+)`,
1294
1311
  name: "webx.vacancies.edit",
1295
- component: Xt,
1296
- props: { base: u }
1312
+ component: ta,
1313
+ props: { base: d }
1297
1314
  }
1298
1315
  ],
1299
1316
  /*
@@ -1302,28 +1319,28 @@ function ca(c = {}) {
1302
1319
  * `wx-date-picker`, `wx-checkbox-group`).
1303
1320
  */
1304
1321
  types: {
1305
- "wx-vacancy-history": { component: na, kind: "display" }
1322
+ "wx-vacancy-history": { component: oa, kind: "display" }
1306
1323
  }
1307
1324
  },
1308
1325
  {
1309
1326
  id: "vacancy-categories",
1310
- path: `${u}/categories`,
1311
- routes: lt(la(u))
1327
+ path: `${d}/categories`,
1328
+ routes: it(ra(d))
1312
1329
  }
1313
1330
  ];
1314
1331
  }
1315
1332
  export {
1316
- Se as VACANCIES_API,
1317
- Kt as WxVacanciesPage,
1318
- St as WxVacancyCreateDialog,
1319
- Xt as WxVacancyEditorPage,
1320
- na as WxVacancyHistory,
1321
- ve as createVacanciesApi,
1322
- jt as provideVacancyEditor,
1323
- Yt as useVacancyEditor,
1324
- ca as vacancies,
1325
- Nt as vacanciesMessages,
1326
- la as vacancyCategoriesOptions,
1327
- He as vacancyEditorKey
1333
+ Re as VACANCIES_API,
1334
+ Jt as WxVacanciesPage,
1335
+ Ot as WxVacancyCreateDialog,
1336
+ ta as WxVacancyEditorPage,
1337
+ oa as WxVacancyHistory,
1338
+ fe as createVacanciesApi,
1339
+ Gt as provideVacancyEditor,
1340
+ Qt as useVacancyEditor,
1341
+ pa as vacancies,
1342
+ Et as vacanciesMessages,
1343
+ ra as vacancyCategoriesOptions,
1344
+ Be as vacancyEditorKey
1328
1345
  };
1329
1346
  //# sourceMappingURL=index.js.map