@edutalk/promo-tool 1.0.1 → 1.0.4

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
@@ -265,45 +265,74 @@ var s = {
265
265
  bg: "#F0C030",
266
266
  bg2: "#FFFCF2"
267
267
  }
268
- ], d = (e) => String(e ?? "").trim().toLowerCase(), f = (e, t) => d(e) === d(t), p = (e) => Math.round(Number(e) || 0), m = "OK";
269
- function h(e, t) {
268
+ ], d = (e) => String(e ?? "").trim().toLowerCase(), f = (e, t) => d(e) === d(t), p = (e) => Math.round(Number(e) || 0), m = "OK", h = "Cấu hình riêng";
269
+ function g(e) {
270
+ return !!e && (!e.baseProgram || f(e.baseProgram, "Cấu hình riêng"));
271
+ }
272
+ function _(e, t) {
270
273
  return e.settings.programs.find((e) => f(e.name, t));
271
274
  }
272
- function g(e, t) {
275
+ function v(e, t) {
273
276
  return e.settings.paymentMethods.find((e) => f(e.name, t));
274
277
  }
275
- function _(e, t) {
276
- return g(e, t)?.terms ?? [0];
278
+ function y(e, t) {
279
+ return v(e, t)?.terms ?? [0];
277
280
  }
278
281
  function ee(e, t) {
279
- let n = _(e, t);
282
+ let n = y(e, t);
280
283
  return n.length === 1 && Number(n[0]) === 0;
281
284
  }
282
- function v(e, t) {
285
+ function b(e, t) {
283
286
  return e.settings.courseCodes.slice().sort((e, t) => e.order - t.order).filter((n) => e.courses.some((e) => f(e.label, t) && f(e.code, n.code))).map((n) => ({
284
287
  ...n,
285
288
  name: e.courses.find((e) => f(e.label, t) && f(e.code, n.code))?.name ?? n.code,
286
289
  modes: e.courses.filter((e) => f(e.label, t) && f(e.code, n.code)).map((e) => e.mode)
287
290
  }));
288
291
  }
289
- function y(e, t) {
292
+ function x(e, t) {
290
293
  return e.settings.courseCodes.slice().sort((e, t) => e.order - t.order).filter((e) => t.some((t) => f(t.code, e.code))).map((e) => e.short).join("_");
291
294
  }
292
- function b(e, t) {
295
+ function S(e, t) {
293
296
  return e.settings.lktGroups?.find((e) => f(e.name, t));
294
297
  }
295
- function x(e, t, n) {
298
+ function C(e, t, n) {
296
299
  return e.lkt.filter((e) => f(e.label, t) && f(e.group, n));
297
300
  }
298
- function S(e, t) {
301
+ function w(e, t) {
299
302
  return (e.settings.lktGroups ?? []).filter((n) => e.lkt.some((e) => f(e.label, t) && f(e.group, n.name)));
300
303
  }
301
- function C(e) {
304
+ function T(e, t, n) {
305
+ let r = S(e, n);
306
+ if (!r) return [];
307
+ let i = e.settings.labels.find((e) => f(e.name, t))?.blockedMethods ?? [], a = e.settings.paymentMethods.map((e) => e.name), o;
308
+ if (g(r)) o = (e.lktBase ?? []).filter((e) => f(e.label, t) && f(e.group, r.name));
309
+ else {
310
+ let n = _(e, r.baseProgram);
311
+ if (!n) return [];
312
+ o = n.type === "DAC_BIET" ? e.special.filter((e) => f(e.label, t)) : n.type === "MO_RONG" ? e.extended.filter((e) => f(e.label, t) && f(e.program, n.name)) : [];
313
+ }
314
+ return o.filter((e) => !i.some((t) => f(t, e.method))).slice().sort((e, t) => a.indexOf(e.method) - a.indexOf(t.method) || Number(e.term) - Number(t.term));
315
+ }
316
+ function E(e) {
302
317
  let t = e.settings;
303
- Array.isArray(t.lktGroups) && t.lktGroups.length || (t.lktGroups = [{
318
+ if (Array.isArray(t.lktGroups) && t.lktGroups.length || (t.lktGroups = [{
304
319
  name: "LKT Toàn hệ thống",
305
320
  baseProgram: "Định kỳ đặc biệt"
306
- }]), e.lkt.forEach((e) => {
321
+ }]), !Array.isArray(e.lktBase)) {
322
+ e.lktBase = [];
323
+ for (let n of t.lktGroups) if (f(n.baseProgram, "Định kỳ đặc biệt")) {
324
+ n.baseProgram = h;
325
+ for (let t of e.special ?? []) e.lktBase.push({
326
+ label: t.label,
327
+ group: n.name,
328
+ method: t.method,
329
+ term: Number(t.term) || 0,
330
+ pct: Number(t.pct) || 0,
331
+ note: t.note ?? ""
332
+ });
333
+ }
334
+ }
335
+ e.lkt.forEach((e) => {
307
336
  e.group ||= t.lktGroups[0].name;
308
337
  }), e.courses.forEach((e) => {
309
338
  let t = s[`${e.label}|${e.code}|${e.mode}`];
@@ -342,8 +371,8 @@ function C(e) {
342
371
  ]) e[n] ?? (e[n] = t[n]);
343
372
  }), e;
344
373
  }
345
- function w(e, { label: t, program: n, method: r, keyTerm: i, count: a, lktGroup: o, lktFormat: s }) {
346
- switch (h(e, n)?.type) {
374
+ function te(e, { label: t, program: n, method: r, keyTerm: i, count: a, lktGroup: o, lktFormat: s }) {
375
+ switch (_(e, n)?.type) {
347
376
  case "DINH_KY": {
348
377
  let n = e.periodic.filter((e) => f(e.label, t) && e.from <= a && e.to >= a);
349
378
  return {
@@ -361,24 +390,32 @@ function w(e, { label: t, program: n, method: r, keyTerm: i, count: a, lktGroup:
361
390
  };
362
391
  }
363
392
  case "LKT": {
364
- let n = b(e, o), c = n && s ? e.lkt.find((e) => f(e.label, t) && f(e.group, n.name) && f(e.format, s)) : null, l = h(e, n?.baseProgram), u = l && l.type !== "LKT" ? w(e, {
393
+ let n = S(e, o), c = n && s ? e.lkt.find((e) => f(e.label, t) && f(e.group, n.name) && f(e.format, s)) : null, l = g(n), u = {
394
+ pct: 0,
395
+ found: !1
396
+ }, d = null;
397
+ if (l) {
398
+ let a = (e.lktBase ?? []).find((e) => f(e.label, t) && f(e.group, n.name) && f(e.method, r) && Number(e.term) === i);
399
+ u = {
400
+ pct: a?.pct ?? 0,
401
+ found: !!a
402
+ };
403
+ } else d = _(e, n?.baseProgram), d && d.type !== "LKT" && (u = te(e, {
365
404
  label: t,
366
- program: l.name,
405
+ program: d.name,
367
406
  method: r,
368
407
  keyTerm: i,
369
408
  count: a
370
- }) : {
371
- pct: 0,
372
- found: !1
373
- };
409
+ }));
374
410
  return {
375
411
  pct: u.found && c ? u.pct - c.cut : 0,
376
412
  cashback: 0,
377
413
  found: u.found && !!c,
378
414
  lkt: {
379
415
  group: n?.name ?? "",
380
- baseProgram: l?.name ?? "",
381
- baseType: l?.type ?? "",
416
+ isCustom: l,
417
+ baseProgram: l ? h : d?.name ?? "",
418
+ baseType: l ? "CUSTOM" : d?.type ?? "",
382
419
  basePct: u.pct,
383
420
  baseFound: u.found,
384
421
  cut: c ? c.cut : null
@@ -400,8 +437,8 @@ function w(e, { label: t, program: n, method: r, keyTerm: i, count: a, lktGroup:
400
437
  };
401
438
  }
402
439
  }
403
- function T(e, { label: t, program: n, method: r, count: i }) {
404
- let a = g(e, r)?.giftGroup ?? r, o = e.gifts.filter((e) => f(e.label, t) && f(e.program, n) && f(e.method, a));
440
+ function ne(e, { label: t, program: n, method: r, count: i }) {
441
+ let a = v(e, r)?.giftGroup ?? r, o = e.gifts.filter((e) => f(e.label, t) && f(e.program, n) && f(e.method, a));
405
442
  if (!o.length) return null;
406
443
  let s = Math.max(...e.gifts.filter((e) => f(e.label, t) && f(e.program, n)).map((e) => e.milestone)), c = o.find((e) => Number(e.milestone) === Math.min(i, s));
407
444
  return c ? {
@@ -409,11 +446,11 @@ function T(e, { label: t, program: n, method: r, count: i }) {
409
446
  value: c.value
410
447
  } : null;
411
448
  }
412
- function E(e, t) {
413
- let { label: n, program: r, method: i, warranty: a, lktGroup: o, lktFormat: s } = t, c = Number(t.term) || 0, l = (t.items ?? []).filter((e) => e && e.code), u = h(e, r), d = g(e, i), m = ee(e, i), _ = m ? 0 : c, v = u?.type === "LKT" ? b(e, o)?.baseProgram : r, x = h(e, v)?.type === "MO_RONG", S = l.map((t) => {
449
+ function D(e, t) {
450
+ let { label: n, program: r, method: i, warranty: a, lktGroup: o, lktFormat: s } = t, c = Number(t.term) || 0, l = (t.items ?? []).filter((e) => e && e.code), u = _(e, r), d = v(e, i), m = ee(e, i), h = m ? 0 : c, g = u?.type === "LKT" ? S(e, o)?.baseProgram : r, y = _(e, g)?.type === "MO_RONG", b = l.map((t) => {
414
451
  let r = e.courses.find((e) => f(e.label, n) && f(e.code, t.code) && f(e.mode, t.mode)), i = r?.voucher ?? 0;
415
- if (x) {
416
- let r = e.programVouchers.find((e) => f(e.label, n) && f(e.program, v) && f(e.code, t.code) && f(e.mode, t.mode));
452
+ if (y) {
453
+ let r = e.programVouchers.find((e) => f(e.label, n) && f(e.program, g) && f(e.code, t.code) && f(e.mode, t.mode));
417
454
  r && (i = r.voucher);
418
455
  }
419
456
  let a = e.settings.courseCodes.find((e) => f(e.code, t.code));
@@ -426,58 +463,58 @@ function E(e, t) {
426
463
  found: !!r,
427
464
  warranty: a?.warranty !== !1
428
465
  };
429
- }), C = S.length, E = S.reduce((e, t) => e + t.price, 0), te = S.reduce((e, t) => e + t.voucher, 0), ne = S.filter((e) => e.warranty).reduce((e, t) => e + t.price, 0), O = y(e, l), k = O ? e.citimeRoutes.find((e) => f(e.label, n) && f(e.code, O)) : null, A = k ? k.status : O ? "KHÔNG CÓ" : "", re = k?.maxTerm ?? null, j = w(e, {
466
+ }), C = b.length, w = b.reduce((e, t) => e + t.price, 0), T = b.reduce((e, t) => e + t.voucher, 0), E = b.filter((e) => e.warranty).reduce((e, t) => e + t.price, 0), D = x(e, l), O = D ? e.citimeRoutes.find((e) => f(e.label, n) && f(e.code, D)) : null, k = O ? O.status : D ? "KHÔNG CÓ" : "", ie = O?.maxTerm ?? null, A = te(e, {
430
467
  label: n,
431
468
  program: r,
432
469
  method: i,
433
- keyTerm: _,
470
+ keyTerm: h,
434
471
  count: C,
435
472
  lktGroup: o,
436
473
  lktFormat: s
437
- }), ie = E * j.pct, M = E - ie - j.cashback - te, ae = e.warranty.find((e) => f(e.name, a))?.rate ?? 0, oe = ne * ae, N = {
438
- lines: S,
474
+ }), j = w * A.pct, ae = w - j - A.cashback - T, M = e.warranty.find((e) => f(e.name, a))?.rate ?? 0, oe = E * M, N = {
475
+ lines: b,
439
476
  count: C,
440
- gross: p(E),
441
- voucherTotal: p(te),
442
- pct: j.pct,
443
- cashback: p(j.cashback),
444
- discountAmt: p(ie),
445
- afterPromo: p(M),
446
- warrantyRate: ae,
447
- warrantyBase: p(ne),
477
+ gross: p(w),
478
+ voucherTotal: p(T),
479
+ pct: A.pct,
480
+ cashback: p(A.cashback),
481
+ discountAmt: p(j),
482
+ afterPromo: p(ae),
483
+ warrantyRate: M,
484
+ warrantyBase: p(E),
448
485
  warrantyFee: p(oe),
449
- final: p(M + oe),
450
- gift: T(e, {
486
+ final: p(ae + oe),
487
+ gift: ne(e, {
451
488
  label: n,
452
489
  program: r,
453
490
  method: i,
454
491
  count: C
455
492
  }),
456
- lkt: j.lkt ?? null,
493
+ lkt: A.lkt ?? null,
457
494
  combo: {
458
- code: O,
459
- routeName: k?.name ?? "",
460
- group: k?.group ?? "",
461
- citimeStatus: A,
462
- citimeMax: re
495
+ code: D,
496
+ routeName: O?.name ?? "",
497
+ group: O?.group ?? "",
498
+ citimeStatus: k,
499
+ citimeMax: ie
463
500
  }
464
501
  };
465
- return N.status = D(e, {
502
+ return N.status = re(e, {
466
503
  input: t,
467
504
  term: c,
468
505
  prog: u,
469
506
  pm: d,
470
507
  fixedTerm: m,
471
508
  count: C,
472
- lines: S,
473
- combo: O,
474
- citimeStatus: A,
475
- citimeMax: re,
476
- d: j,
509
+ lines: b,
510
+ combo: D,
511
+ citimeStatus: k,
512
+ citimeMax: ie,
513
+ d: A,
477
514
  result: N
478
515
  }), N.ok = N.status === "OK", N;
479
516
  }
480
- function D(e, t) {
517
+ function re(e, t) {
481
518
  let { input: n, term: r, prog: i, pm: a, fixedTerm: o, count: s, lines: c, combo: l, citimeStatus: u, citimeMax: d, d: p, result: m } = t, h = String(a?.name ?? n.method ?? "").toUpperCase(), g = e.settings.labels.find((e) => f(e.name, n.label));
482
519
  if (!n.label) return "CHƯA CHỌN NHÃN";
483
520
  if (!n.program) return "CHƯA CHỌN CHƯƠNG TRÌNH";
@@ -502,12 +539,12 @@ function D(e, t) {
502
539
  if (!a.terms.map(Number).includes(r)) return `KỲ HẠN ${h} KHÔNG HỢP LỆ`;
503
540
  if (d != null && r > d) return `VƯỢT KỲ HẠN ${h} TỐI ĐA`;
504
541
  }
505
- return p.found ? m.afterPromo < 0 ? "LỖI GIÁ" : "OK" : "KHÔNG ÁP DỤNG CHƯƠNG TRÌNH";
542
+ return i?.type === "LKT" && p.lkt?.isCustom && !p.lkt.baseFound ? "KHÔNG ÁP DỤNG HTTT CHO NHÓM LKT" : p.found ? m.afterPromo < 0 ? "LỖI GIÁ" : "OK" : "KHÔNG ÁP DỤNG CHƯƠNG TRÌNH";
506
543
  }
507
- function te(e, { label: t, program: n, method: r, term: i, warranty: a, lktGroup: o, lktFormat: s, output: c }) {
544
+ function O(e, { label: t, program: n, method: r, term: i, warranty: a, lktGroup: o, lktFormat: s, output: c }) {
508
545
  return e.routes.filter((e) => f(e.label, t) && (!c || f(e.output, c))).map((c) => ({
509
546
  route: c,
510
- quote: E(e, {
547
+ quote: D(e, {
511
548
  label: t,
512
549
  program: n,
513
550
  method: r,
@@ -519,7 +556,7 @@ function te(e, { label: t, program: n, method: r, term: i, warranty: a, lktGroup
519
556
  })
520
557
  }));
521
558
  }
522
- function ne(e) {
559
+ function k(e) {
523
560
  let t = [], n = (e, n, r) => {
524
561
  let i = /* @__PURE__ */ new Map();
525
562
  e.forEach((e, a) => {
@@ -531,12 +568,18 @@ function ne(e) {
531
568
  }) : i.set(o, a);
532
569
  });
533
570
  };
534
- n(e.courses, (e) => d(`${e.label}|${e.code}|${e.mode}`), "courses"), n(e.programVouchers, (e) => d(`${e.label}|${e.program}|${e.code}|${e.mode}`), "programVouchers"), n(e.special, (e) => d(`${e.label}|${e.method}|${e.term}`), "special"), n(e.extended, (e) => d(`${e.label}|${e.program}|${e.method}|${e.term}`), "extended"), n(e.lkt, (e) => d(`${e.label}|${e.group}|${e.format}`), "lkt"), e.lkt.forEach((n, r) => {
535
- b(e, n.group) || t.push({
571
+ n(e.courses, (e) => d(`${e.label}|${e.code}|${e.mode}`), "courses"), n(e.programVouchers, (e) => d(`${e.label}|${e.program}|${e.code}|${e.mode}`), "programVouchers"), n(e.special, (e) => d(`${e.label}|${e.method}|${e.term}`), "special"), n(e.extended, (e) => d(`${e.label}|${e.program}|${e.method}|${e.term}`), "extended"), n(e.lktBase ?? [], (e) => d(`${e.label}|${e.group}|${e.method}|${e.term}`), "lktBase"), n(e.lkt, (e) => d(`${e.label}|${e.group}|${e.format}`), "lkt"), e.lkt.forEach((n, r) => {
572
+ S(e, n.group) || t.push({
536
573
  table: "lkt",
537
574
  row: r,
538
575
  message: `Nhóm "${n.group}" chưa khai báo ở mục Nhóm LKT`
539
576
  });
577
+ }), (e.lktBase ?? []).forEach((n, r) => {
578
+ S(e, n.group) || t.push({
579
+ table: "lktBase",
580
+ row: r,
581
+ message: `Nhóm "${n.group}" chưa khai báo ở mục Nhóm LKT`
582
+ });
540
583
  }), n(e.citimeRoutes, (e) => d(`${e.label}|${e.code}`), "citimeRoutes"), n(e.gifts, (e) => d(`${e.label}|${e.program}|${e.milestone}|${e.method}`), "gifts"), e.courses.forEach((e, n) => {
541
584
  e.price > 0 || t.push({
542
585
  table: "courses",
@@ -551,8 +594,9 @@ function ne(e) {
551
594
  for (let n of [
552
595
  "periodic",
553
596
  "special",
554
- "extended"
555
- ]) e[n].forEach((e, r) => {
597
+ "extended",
598
+ "lktBase"
599
+ ]) (e[n] ?? []).forEach((e, r) => {
556
600
  (e.pct < 0 || e.pct >= 1) && t.push({
557
601
  table: n,
558
602
  row: r,
@@ -562,7 +606,7 @@ function ne(e) {
562
606
  return t;
563
607
  }
564
608
  // src/ui/icons.js
565
- var O = {
609
+ var ie = {
566
610
  calc: "<rect x=\"4\" y=\"2\" width=\"16\" height=\"20\" rx=\"2\"/><path d=\"M8 6h8M16 14v4M8 10h.01M12 10h.01M16 10h.01M8 14h.01M12 14h.01M8 18h.01M12 18h.01\"/>",
567
611
  table: "<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><path d=\"M3 9h18M3 15h18M9 3v18\"/>",
568
612
  db: "<ellipse cx=\"12\" cy=\"5\" rx=\"9\" ry=\"3\"/><path d=\"M3 5v14a9 3 0 0 0 18 0V5\"/><path d=\"M3 12a9 3 0 0 0 18 0\"/>",
@@ -595,7 +639,7 @@ var O = {
595
639
  sparkle: "<path d=\"M12 3l1.9 5.8L20 10l-6.1 1.2L12 17l-1.9-5.8L4 10l6.1-1.2z\"/>",
596
640
  user: "<circle cx=\"12\" cy=\"8\" r=\"4\"/><path d=\"M4 21a8 8 0 0 1 16 0\"/>",
597
641
  sheet: "<path d=\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z\"/><path d=\"M14 2v5h5M8 13h8M8 17h8M8 9h2\"/>"
598
- }, k = (e, t = 18) => `<svg width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${O[e] ?? ""}</svg>`, A = {
642
+ }, A = (e, t = 18) => `<svg width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${ie[e] ?? ""}</svg>`, j = {
599
643
  "classup/ngang-am-ban": {
600
644
  name: "ClassUp · ngang · âm bản (chữ trắng, biểu tượng cam)",
601
645
  file: "classup/ngang-am-ban.png"
@@ -653,14 +697,14 @@ var O = {
653
697
  file: "classup/bieu-tuong-xam.png"
654
698
  }
655
699
  };
656
- function re(e) {
657
- let t = String(e ?? "").trim(), n = A[t];
700
+ function ae(e) {
701
+ let t = String(e ?? "").trim(), n = j[t];
658
702
  return n ? new URL((/* #__PURE__ */ Object.assign({}))[`../assets/brand/${n.file}`], import.meta.url).href : t;
659
703
  }
660
704
  // src/ui/admin-tables.js
661
- var j = (e) => [...new Set(e.filter((e) => e !== "" && e != null))], ie = ["Online", "Offline"];
662
- function M(e) {
663
- let t = e.settings, n = t.labels.map((e) => e.name), r = t.programs.map((e) => e.name), i = t.programs.filter((e) => e.type === "MO_RONG").map((e) => e.name), a = t.paymentMethods.map((e) => e.name), o = j(t.paymentMethods.map((e) => e.giftGroup)), s = t.courseCodes.map((e) => e.code), c = (t.lktGroups ?? []).map((e) => e.name), l = t.programs.filter((e) => e.type !== "LKT").map((e) => e.name);
705
+ var M = (e) => [...new Set(e.filter((e) => e !== "" && e != null))], oe = ["Online", "Offline"];
706
+ function N(e) {
707
+ let t = e.settings, n = t.labels.map((e) => e.name), r = t.programs.map((e) => e.name), i = t.programs.filter((e) => e.type === "MO_RONG").map((e) => e.name), a = t.paymentMethods.map((e) => e.name), o = M(t.paymentMethods.map((e) => e.giftGroup)), s = t.courseCodes.map((e) => e.code), c = (t.lktGroups ?? []).map((e) => e.name), l = (t.lktGroups ?? []).filter((e) => g(e)).map((e) => e.name), u = t.programs.filter((e) => e.type !== "LKT").map((e) => e.name);
664
708
  return [
665
709
  {
666
710
  id: "courses",
@@ -694,7 +738,7 @@ function M(e) {
694
738
  key: "mode",
695
739
  label: "Hình thức",
696
740
  type: "select",
697
- options: ie
741
+ options: oe
698
742
  },
699
743
  {
700
744
  key: "price",
@@ -912,7 +956,7 @@ function M(e) {
912
956
  sheet: "04B_CTKM_LKT",
913
957
  title: "Format liên kết trường",
914
958
  path: ["lkt"],
915
- desc: "Chương trình \"Liên kết trường\": % giảm = % của chương trình nền (theo Nhóm LKT) − Mức cắt. Nhãn không có dòng cho nhóm → sale thấy \"KHÔNG TÌM THẤY CHÍNH SÁCH LKT\".",
959
+ desc: "Chương trình \"Liên kết trường\": % giảm = % nền (từ bảng % nền riêng LKT hoặc chương trình nền của Nhóm LKT) − Mức cắt. Nhãn không có dòng cho nhóm → sale thấy \"KHÔNG TÌM THẤY CHÍNH SÁCH LKT\".",
916
960
  byLabel: !0,
917
961
  columns: [
918
962
  {
@@ -945,6 +989,58 @@ function M(e) {
945
989
  cut: 0
946
990
  })
947
991
  },
992
+ {
993
+ id: "lktBase",
994
+ group: "Chương trình KM",
995
+ icon: "percent",
996
+ title: "% nền riêng LKT",
997
+ path: ["lktBase"],
998
+ desc: "Bảng % nền riêng cho các Nhóm LKT đặt chế độ \"Cấu hình riêng\" (không phụ thuộc Định kỳ đặc biệt). % giảm LKT = % nền này − Mức cắt ở bảng Format liên kết trường.",
999
+ byLabel: !0,
1000
+ columns: [
1001
+ {
1002
+ key: "label",
1003
+ label: "Nhãn",
1004
+ type: "select",
1005
+ options: n
1006
+ },
1007
+ {
1008
+ key: "group",
1009
+ label: "Nhóm LKT",
1010
+ type: "select",
1011
+ options: c
1012
+ },
1013
+ {
1014
+ key: "method",
1015
+ label: "Hình thức TT",
1016
+ type: "select",
1017
+ options: a
1018
+ },
1019
+ {
1020
+ key: "term",
1021
+ label: "Kỳ hạn",
1022
+ type: "int"
1023
+ },
1024
+ {
1025
+ key: "pct",
1026
+ label: "% nền",
1027
+ type: "pct"
1028
+ },
1029
+ {
1030
+ key: "note",
1031
+ label: "Ghi chú",
1032
+ type: "text"
1033
+ }
1034
+ ],
1035
+ blank: (e) => ({
1036
+ label: e,
1037
+ group: l[0] ?? c[0] ?? "",
1038
+ method: a[0],
1039
+ term: 0,
1040
+ pct: 0,
1041
+ note: ""
1042
+ })
1043
+ },
948
1044
  {
949
1045
  id: "extended",
950
1046
  group: "Chương trình KM",
@@ -1047,7 +1143,7 @@ function M(e) {
1047
1143
  key: "mode",
1048
1144
  label: "Hình thức",
1049
1145
  type: "select",
1050
- options: ie
1146
+ options: oe
1051
1147
  },
1052
1148
  {
1053
1149
  key: "voucher",
@@ -1210,7 +1306,7 @@ function M(e) {
1210
1306
  icon: "school",
1211
1307
  title: "Nhóm LKT",
1212
1308
  path: ["settings", "lktGroups"],
1213
- desc: "Mỗi nhóm LKT lấy % giảm và voucher từ 1 chương trình nền, VD \"LKT Thấp điểm\" → Thấp điểm, \"LKT Toàn hệ thống\" → Định kỳ đặc biệt.",
1309
+ desc: "Mỗi nhóm LKT chọn \"Cấu hình riêng\" (lấy % từ bảng % nền riêng LKT) hoặc chọn 1 chương trình nền có sẵn (VD \"LKT Thấp điểm\" → Thấp điểm).",
1214
1310
  columns: [{
1215
1311
  key: "name",
1216
1312
  label: "Nhóm LKT",
@@ -1220,11 +1316,11 @@ function M(e) {
1220
1316
  key: "baseProgram",
1221
1317
  label: "Chương trình nền",
1222
1318
  type: "select",
1223
- options: l
1319
+ options: [h, ...u]
1224
1320
  }],
1225
1321
  blank: () => ({
1226
1322
  name: "",
1227
- baseProgram: l[0] ?? ""
1323
+ baseProgram: h
1228
1324
  })
1229
1325
  },
1230
1326
  {
@@ -1426,14 +1522,14 @@ function M(e) {
1426
1522
  key: "logoUrl",
1427
1523
  label: "Logo trên nền tối (bìa)",
1428
1524
  type: "combo",
1429
- options: Object.keys(A),
1525
+ options: Object.keys(j),
1430
1526
  wide: !0
1431
1527
  },
1432
1528
  {
1433
1529
  key: "logoLight",
1434
1530
  label: "Logo trên nền sáng (chân trang)",
1435
1531
  type: "combo",
1436
- options: Object.keys(A),
1532
+ options: Object.keys(j),
1437
1533
  wide: !0
1438
1534
  },
1439
1535
  {
@@ -1571,7 +1667,7 @@ function M(e) {
1571
1667
  }
1572
1668
  ];
1573
1669
  }
1574
- function ae(e, t) {
1670
+ function se(e, t) {
1575
1671
  switch (e.type) {
1576
1672
  case "money": return t === "" || t == null ? "" : Number(t).toLocaleString("vi-VN");
1577
1673
  case "pct": return t === "" || t == null ? "" : String(+(Number(t) * 100).toFixed(4));
@@ -1581,7 +1677,7 @@ function ae(e, t) {
1581
1677
  default: return t ?? "";
1582
1678
  }
1583
1679
  }
1584
- function oe(e, t) {
1680
+ function ce(e, t) {
1585
1681
  let n = String(t ?? "").trim();
1586
1682
  switch (e.type) {
1587
1683
  case "money": {
@@ -1612,68 +1708,68 @@ function oe(e, t) {
1612
1708
  }
1613
1709
  }
1614
1710
  // src/ui/excel-import.js
1615
- var N = "https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js";
1616
- function P() {
1711
+ var le = "https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js";
1712
+ function ue() {
1617
1713
  return window.XLSX ? Promise.resolve(window.XLSX) : new Promise((e, t) => {
1618
1714
  let n = document.createElement("script");
1619
- n.src = N, n.onload = () => e(window.XLSX), n.onerror = () => t(/* @__PURE__ */ Error("Không tải được thư viện đọc Excel")), document.head.appendChild(n);
1715
+ n.src = le, n.onload = () => e(window.XLSX), n.onerror = () => t(/* @__PURE__ */ Error("Không tải được thư viện đọc Excel")), document.head.appendChild(n);
1620
1716
  });
1621
1717
  }
1622
- var F = (e, t = 0) => e === "" || e == null || Number.isNaN(Number(e)) ? t : Number(e), I = (e) => e == null ? "" : String(e).trim();
1623
- async function se(e, t) {
1624
- let n = await P(), r = n.read(await e.arrayBuffer(), { type: "array" }), i = (e, t) => {
1718
+ var P = (e, t = 0) => e === "" || e == null || Number.isNaN(Number(e)) ? t : Number(e), F = (e) => e == null ? "" : String(e).trim();
1719
+ async function de(e, t) {
1720
+ let n = await ue(), r = n.read(await e.arrayBuffer(), { type: "array" }), i = (e, t) => {
1625
1721
  let i = r.Sheets[e];
1626
1722
  if (!i) throw Error(`File thiếu sheet "${e}"`);
1627
1723
  return n.utils.sheet_to_json(i, {
1628
1724
  header: 1,
1629
1725
  defval: ""
1630
- }).slice(1).map((e) => Array.from({ length: t }, (t, n) => e[n] ?? "")).filter((e) => I(e[0]) !== "");
1726
+ }).slice(1).map((e) => Array.from({ length: t }, (t, n) => e[n] ?? "")).filter((e) => F(e[0]) !== "");
1631
1727
  }, a = JSON.parse(JSON.stringify(t)), o = new Map((t.courses ?? []).map((e) => [`${e.label}|${e.code}|${e.mode}`.toLowerCase(), e]));
1632
1728
  a.courses = i("01_DM_KHOA_HOC", 6).map((e) => {
1633
- let t = o.get(`${I(e[0])}|${I(e[1])}|${I(e[3])}`.toLowerCase());
1729
+ let t = o.get(`${F(e[0])}|${F(e[1])}|${F(e[3])}`.toLowerCase());
1634
1730
  return {
1635
- label: I(e[0]),
1636
- code: I(e[1]),
1637
- name: I(e[2]),
1638
- mode: I(e[3]),
1639
- price: F(e[4]),
1640
- voucher: F(e[5]),
1731
+ label: F(e[0]),
1732
+ code: F(e[1]),
1733
+ name: F(e[2]),
1734
+ mode: F(e[3]),
1735
+ price: P(e[4]),
1736
+ voucher: P(e[5]),
1641
1737
  sessions: t?.sessions ?? "",
1642
1738
  classSize: t?.classSize ?? ""
1643
1739
  };
1644
1740
  }), a.programVouchers = i("01B_VOUCHER_CTKM", 5).map((e) => ({
1645
- label: I(e[0]),
1646
- program: I(e[1]),
1647
- code: I(e[2]),
1648
- mode: I(e[3]),
1649
- voucher: F(e[4])
1741
+ label: F(e[0]),
1742
+ program: F(e[1]),
1743
+ code: F(e[2]),
1744
+ mode: F(e[3]),
1745
+ voucher: P(e[4])
1650
1746
  })), a.warranty = i("02_DM_BAO_HANH", 2).map((e) => ({
1651
- name: I(e[0]),
1652
- rate: F(e[1])
1747
+ name: F(e[0]),
1748
+ rate: P(e[1])
1653
1749
  })), a.periodic = i("03_CTKM_DINH_KY", 5).map((e) => ({
1654
- label: I(e[0]),
1655
- from: F(e[1]),
1656
- to: F(e[2]),
1657
- pct: F(e[3]),
1658
- cashback: F(e[4])
1750
+ label: F(e[0]),
1751
+ from: P(e[1]),
1752
+ to: P(e[2]),
1753
+ pct: P(e[3]),
1754
+ cashback: P(e[4])
1659
1755
  })), a.special = i("04_CTKM_DAC_BIET", 7).map((e) => ({
1660
- label: I(e[0]),
1661
- method: I(e[1]),
1662
- term: F(e[2]),
1663
- pct: F(e[3]),
1664
- applyType: I(e[4]),
1665
- minCourses: F(e[5], 1),
1666
- note: I(e[6])
1667
- })), a.lkt = (n.utils.sheet_to_json(r.Sheets["04B_CTKM_LKT"] ?? {}, { header: 1 })[0] ?? []).some((e) => /nhóm/i.test(I(e))) ? i("04B_CTKM_LKT", 4).map((e) => ({
1668
- label: I(e[0]),
1669
- group: I(e[1]),
1670
- format: I(e[2]),
1671
- cut: F(e[3])
1756
+ label: F(e[0]),
1757
+ method: F(e[1]),
1758
+ term: P(e[2]),
1759
+ pct: P(e[3]),
1760
+ applyType: F(e[4]),
1761
+ minCourses: P(e[5], 1),
1762
+ note: F(e[6])
1763
+ })), a.lkt = (n.utils.sheet_to_json(r.Sheets["04B_CTKM_LKT"] ?? {}, { header: 1 })[0] ?? []).some((e) => /nhóm/i.test(F(e))) ? i("04B_CTKM_LKT", 4).map((e) => ({
1764
+ label: F(e[0]),
1765
+ group: F(e[1]),
1766
+ format: F(e[2]),
1767
+ cut: P(e[3])
1672
1768
  })) : i("04B_CTKM_LKT", 3).map((e) => ({
1673
- label: I(e[0]),
1769
+ label: F(e[0]),
1674
1770
  group: "LKT Toàn hệ thống",
1675
- format: I(e[1]),
1676
- cut: F(e[2])
1771
+ format: F(e[1]),
1772
+ cut: P(e[2])
1677
1773
  }));
1678
1774
  let s = a.settings.lktGroups ??= [];
1679
1775
  for (let e of new Set(a.lkt.map((e) => e.group))) {
@@ -1685,54 +1781,54 @@ async function se(e, t) {
1685
1781
  });
1686
1782
  }
1687
1783
  a.extended = i("04C_CTKM_MO_RONG", 8).map((e) => ({
1688
- label: I(e[0]),
1689
- program: I(e[1]),
1690
- method: I(e[2]),
1691
- term: F(e[3]),
1692
- pct: F(e[4]),
1693
- applyType: I(e[5]),
1694
- minCourses: F(e[6], 1),
1695
- note: I(e[7])
1784
+ label: F(e[0]),
1785
+ program: F(e[1]),
1786
+ method: F(e[2]),
1787
+ term: P(e[3]),
1788
+ pct: P(e[4]),
1789
+ applyType: F(e[5]),
1790
+ minCourses: P(e[6], 1),
1791
+ note: F(e[7])
1696
1792
  })), a.citimeRoutes = i("05_CITIME_LO_TRINH", 7).map((e) => ({
1697
- label: I(e[0]),
1698
- group: I(e[1]),
1699
- count: F(e[2]),
1700
- code: I(e[3]),
1701
- name: I(e[4]),
1702
- status: I(e[5]),
1703
- maxTerm: F(e[6])
1793
+ label: F(e[0]),
1794
+ group: F(e[1]),
1795
+ count: P(e[2]),
1796
+ code: F(e[3]),
1797
+ name: F(e[4]),
1798
+ status: F(e[5]),
1799
+ maxTerm: P(e[6])
1704
1800
  })), a.gifts = i("07_QUA_TANG", 6).map((e) => ({
1705
- label: I(e[0]),
1706
- program: I(e[1]),
1707
- milestone: F(e[2]),
1708
- method: I(e[3]),
1709
- content: I(e[4]),
1710
- value: F(e[5])
1801
+ label: F(e[0]),
1802
+ program: F(e[1]),
1803
+ milestone: P(e[2]),
1804
+ method: F(e[3]),
1805
+ content: F(e[4]),
1806
+ value: P(e[5])
1711
1807
  })), a.routes = i("08_LO_TRINH", 20).map((e) => {
1712
1808
  let t = [];
1713
- for (let n = 4; n < 20; n += 2) I(e[n]) && t.push({
1714
- code: I(e[n]),
1715
- mode: I(e[n + 1])
1809
+ for (let n = 4; n < 20; n += 2) F(e[n]) && t.push({
1810
+ code: F(e[n]),
1811
+ mode: F(e[n + 1])
1716
1812
  });
1717
1813
  return {
1718
- label: I(e[0]),
1719
- output: I(e[1]),
1720
- code: I(e[2]),
1721
- name: I(e[3]),
1814
+ label: F(e[0]),
1815
+ output: F(e[1]),
1816
+ code: F(e[2]),
1817
+ name: F(e[3]),
1722
1818
  items: t
1723
1819
  };
1724
1820
  });
1725
- let c = r.Sheets["06_DM_KY_HAN_CITIME"] ? i("06_DM_KY_HAN_CITIME", 1).map((e) => F(e[0])) : null;
1821
+ let c = r.Sheets["06_DM_KY_HAN_CITIME"] ? i("06_DM_KY_HAN_CITIME", 1).map((e) => P(e[0])) : null;
1726
1822
  return c?.length && a.settings.paymentMethods.filter((e) => e.citime).forEach((e) => e.terms = c), a;
1727
1823
  }
1728
1824
  // src/doc/promo-doc.js
1729
- var L = (e, t) => String(e ?? "").trim().toLowerCase() === String(t ?? "").trim().toLowerCase(), R = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => ({
1825
+ var I = (e, t) => String(e ?? "").trim().toLowerCase() === String(t ?? "").trim().toLowerCase(), L = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => ({
1730
1826
  "&": "&amp;",
1731
1827
  "<": "&lt;",
1732
1828
  ">": "&gt;",
1733
1829
  "\"": "&quot;",
1734
1830
  "'": "&#39;"
1735
- })[e]), z = (e) => Math.round(Number(e) || 0).toLocaleString("vi-VN"), B = (e) => `${+(Number(e || 0) * 100).toFixed(2)}%`, ce = (e) => R(e).replace(/\n/g, "<br>"), V = (e) => String(e).padStart(2, "0"), le = [
1831
+ })[e]), R = (e) => Math.round(Number(e) || 0).toLocaleString("vi-VN"), z = (e) => `${+(Number(e || 0) * 100).toFixed(2)}%`, fe = (e) => L(e).replace(/\n/g, "<br>"), B = (e) => String(e).padStart(2, "0"), pe = [
1736
1832
  {
1737
1833
  id: "cover",
1738
1834
  title: "Trang bìa + điểm nổi bật"
@@ -1766,23 +1862,23 @@ var L = (e, t) => String(e ?? "").trim().toLowerCase() === String(t ?? "").trim(
1766
1862
  title: "Phụ lục thời hạn trả góp Citime"
1767
1863
  }
1768
1864
  ];
1769
- function ue(e, t) {
1865
+ function me(e, t) {
1770
1866
  let n = t || String(e?.settings?.validFrom ?? "").slice(0, 7), [r, i] = String(n ?? "").split("-");
1771
1867
  return r && i ? `${Number(i)}/${r}` : "";
1772
1868
  }
1773
- var de = (e) => {
1869
+ var V = (e) => {
1774
1870
  if (!e || !/^\d{4}-\d{2}$/.test(e)) return ["", ""];
1775
1871
  let [t, n] = e.split("-").map(Number);
1776
1872
  return [`${e}-01`, `${e}-${String(new Date(t, n, 0).getDate()).padStart(2, "0")}`];
1777
- }, H = (e) => {
1873
+ }, he = (e) => {
1778
1874
  let [t, n, r] = String(e ?? "").split("-");
1779
1875
  return t ? `${Number(r)}/${Number(n)}/${t}` : "";
1780
1876
  };
1781
- function fe(e, t, n) {
1782
- return `CHƯƠNG TRÌNH KHUYẾN MÃI ${String(t).toUpperCase()} - THÁNG ${ue(e, n)}`;
1877
+ function ge(e, t, n) {
1878
+ return `CHƯƠNG TRÌNH KHUYẾN MÃI ${String(t).toUpperCase()} - THÁNG ${me(e, n)}`;
1783
1879
  }
1784
- function pe(e, t) {
1785
- return e.settings.brands?.find((e) => L(e.label, t)) ?? {
1880
+ function _e(e, t) {
1881
+ return e.settings.brands?.find((e) => I(e.label, t)) ?? {
1786
1882
  label: t,
1787
1883
  brandName: String(t),
1788
1884
  bg: "#F0C030",
@@ -1793,11 +1889,11 @@ function pe(e, t) {
1793
1889
  footer: ""
1794
1890
  };
1795
1891
  }
1796
- function me(e, t) {
1797
- return [...new Set(e.routes.filter((e) => L(e.label, t)).map((e) => e.output).filter(Boolean))];
1892
+ function ve(e, t) {
1893
+ return [...new Set(e.routes.filter((e) => I(e.label, t)).map((e) => e.output).filter(Boolean))];
1798
1894
  }
1799
- var U = (e, t) => e === 1 ? "Khóa lẻ" : `Combo ${e} khóa${t && e >= t ? " trở lên" : ""}`;
1800
- function W({ head: e, rows: t, merge: n = [], cls: r = "" }) {
1895
+ var H = (e, t) => e === 1 ? "Khóa lẻ" : `Combo ${e} khóa${t && e >= t ? " trở lên" : ""}`;
1896
+ function U({ head: e, rows: t, merge: n = [], cls: r = "" }) {
1801
1897
  let i = e.at(-1).reduce((e, t) => e + (t.colspan ?? 1), 0) + (e.length > 1 ? e[0].filter((e) => e.rowspan > 1).length : 0), a = t.map((e) => e.group == null ? e.map((e) => typeof e == "object" && e ? { ...e } : { html: String(e ?? "") }) : e);
1802
1898
  for (let e of n) {
1803
1899
  let t = -1;
@@ -1806,11 +1902,11 @@ function W({ head: e, rows: t, merge: n = [], cls: r = "" }) {
1806
1902
  t >= 0 && i != null && i === o ? (a[t][e].rowspan = (a[t][e].rowspan ?? 1) + 1, r[e].skip = !0) : t = i == null ? -1 : n;
1807
1903
  }
1808
1904
  }
1809
- return `<table class="t ${r}"><thead>${e.map((e) => `<tr>${e.map((e) => `<th${e.colspan ? ` colspan="${e.colspan}"` : ""}${e.rowspan ? ` rowspan="${e.rowspan}"` : ""}${e.cls ? ` class="${e.cls}"` : ""}>${e.html}</th>`).join("")}</tr>`).join("")}</thead><tbody>${a.map((e) => e.group == null ? `<tr>${e.filter((e) => !e.skip).map((e) => `<td${e.rowspan > 1 ? ` rowspan="${e.rowspan}"` : ""}${e.cls ? ` class="${e.cls}"` : ""}>${e.html}</td>`).join("")}</tr>` : `<tr class="grp"><td colspan="${i}">${R(e.group)}</td></tr>`).join("")}</tbody></table>`;
1905
+ return `<table class="t ${r}"><thead>${e.map((e) => `<tr>${e.map((e) => `<th${e.colspan ? ` colspan="${e.colspan}"` : ""}${e.rowspan ? ` rowspan="${e.rowspan}"` : ""}${e.cls ? ` class="${e.cls}"` : ""}>${e.html}</th>`).join("")}</tr>`).join("")}</thead><tbody>${a.map((e) => e.group == null ? `<tr>${e.filter((e) => !e.skip).map((e) => `<td${e.rowspan > 1 ? ` rowspan="${e.rowspan}"` : ""}${e.cls ? ` class="${e.cls}"` : ""}>${e.html}</td>`).join("")}</tr>` : `<tr class="grp"><td colspan="${i}">${L(e.group)}</td></tr>`).join("")}</tbody></table>`;
1810
1906
  }
1811
- var G = (...e) => e.map((e) => typeof e == "string" ? { html: e } : e);
1812
- function K(e, t) {
1813
- let n = h(e, t.program), r = n?.type === "DINH_KY", i = e.settings.paymentMethods, a = (i.find((e) => e.allowSingle) ?? i[0]).name;
1907
+ var W = (...e) => e.map((e) => typeof e == "string" ? { html: e } : e);
1908
+ function ye(e, t) {
1909
+ let n = _(e, t.program), r = n?.type === "DINH_KY", i = e.settings.paymentMethods, a = (i.find((e) => e.allowSingle) ?? i[0]).name;
1814
1910
  return {
1815
1911
  label: t.label,
1816
1912
  program: t.program,
@@ -1821,7 +1917,7 @@ function K(e, t) {
1821
1917
  lktFormat: t.lktFormat,
1822
1918
  single: a,
1823
1919
  q(n, r = {}) {
1824
- return E(e, {
1920
+ return D(e, {
1825
1921
  label: t.label,
1826
1922
  program: t.program,
1827
1923
  lktGroup: t.lktGroup,
@@ -1835,16 +1931,16 @@ function K(e, t) {
1835
1931
  }
1836
1932
  };
1837
1933
  }
1838
- function he(e, t) {
1839
- let n = h(e, t.program);
1934
+ function be(e, t) {
1935
+ let n = _(e, t.program);
1840
1936
  if (!n || n.type === "DINH_KY") return [];
1841
- let r = n.type === "LKT" ? h(e, b(e, t.lktGroup)?.baseProgram) : n, i = n.type === "LKT" ? x(e, t.label, t.lktGroup).find((e) => L(e.format, t.lktFormat))?.cut ?? 0 : 0, a = e.settings.labels.find((e) => L(e.name, t.label))?.blockedMethods ?? [], o = q(e, t.label, r), s = [];
1937
+ let r = n.type === "LKT" ? C(e, t.label, t.lktGroup).find((e) => I(e.format, t.lktFormat))?.cut ?? 0 : 0, i = e.settings.labels.find((e) => I(e.name, t.label))?.blockedMethods ?? [], a = n.type === "LKT" ? T(e, t.label, t.lktGroup) : we(e, t.label, n), o = [];
1842
1938
  for (let t of e.settings.paymentMethods) {
1843
- if (a.some((e) => L(e, t.name))) continue;
1844
- let e = o.filter((e) => L(e.method, t.name)).sort((e, t) => e.term - t.term);
1939
+ if (i.some((e) => I(e, t.name))) continue;
1940
+ let e = a.filter((e) => I(e.method, t.name)).sort((e, t) => e.term - t.term);
1845
1941
  for (let n of e) {
1846
- let e = s.at(-1);
1847
- e && e.method === t.name && Math.abs(e.basePct - n.pct) < 1e-9 ? e.terms.push(Number(n.term)) : s.push({
1942
+ let e = o.at(-1);
1943
+ e && e.method === t.name && Math.abs(e.basePct - n.pct) < 1e-9 ? e.terms.push(Number(n.term)) : o.push({
1848
1944
  method: t.name,
1849
1945
  terms: [Number(n.term)],
1850
1946
  basePct: n.pct,
@@ -1852,111 +1948,111 @@ function he(e, t) {
1852
1948
  });
1853
1949
  }
1854
1950
  }
1855
- return s.map((e) => {
1951
+ return o.map((e) => {
1856
1952
  let t = e.terms.filter(Boolean), n = e.pm.allowSingle ? "Đóng Full" : t.length ? `Trả góp ${e.method}` : e.pm.promoLabel || e.method;
1857
1953
  return {
1858
1954
  id: `${e.method}|${e.terms.join("-")}`,
1859
1955
  method: e.method,
1860
1956
  term: Math.min(...e.terms),
1861
- pct: e.basePct - i,
1957
+ pct: e.basePct - r,
1862
1958
  title: `${n}${t.length ? ` ${t.join(" & ")} tháng` : ""}`
1863
1959
  };
1864
1960
  });
1865
1961
  }
1866
- function ge(e, t) {
1867
- let n = he(e, t), r = [];
1962
+ function xe(e, t) {
1963
+ let n = be(e, t), r = [];
1868
1964
  for (let t of [...new Set(n.map((e) => e.method))]) {
1869
- let i = n.filter((e) => e.method === t), a = g(e, t);
1965
+ let i = n.filter((e) => e.method === t), a = v(e, t);
1870
1966
  a?.allowSingle ? r.push(...i) : i.some((e) => e.term > 0) && r.push(...i.slice(a?.citime ? -2 : -1));
1871
1967
  }
1872
1968
  return r.map((e) => e.id);
1873
1969
  }
1874
- function _e(e, t, n, r) {
1875
- let i = g(e, n), a = e.gifts.filter((e) => L(e.label, t.label) && L(e.program, t.program) && L(e.method, i?.giftGroup ?? n)), o = Math.max(0, ...e.gifts.filter((e) => L(e.label, t.label) && L(e.program, t.program)).map((e) => e.milestone));
1970
+ function Se(e, t, n, r) {
1971
+ let i = v(e, n), a = e.gifts.filter((e) => I(e.label, t.label) && I(e.program, t.program) && I(e.method, i?.giftGroup ?? n)), o = Math.max(0, ...e.gifts.filter((e) => I(e.label, t.label) && I(e.program, t.program)).map((e) => e.milestone));
1876
1972
  return a.find((e) => Number(e.milestone) === Math.min(r, o)) ?? null;
1877
1973
  }
1878
- function ve(e, t) {
1879
- let n = e.settings.labels.find((e) => L(e.name, t.label))?.blockedMethods ?? [], r = e.settings.paymentMethods.filter((e) => !n.some((t) => L(t, e.name)));
1974
+ function Ce(e, t) {
1975
+ let n = e.settings.labels.find((e) => I(e.name, t.label))?.blockedMethods ?? [], r = e.settings.paymentMethods.filter((e) => !n.some((t) => I(t, e.name)));
1880
1976
  return [...r.filter((e) => !e.giftCondition), ...r.filter((e) => e.giftCondition)];
1881
1977
  }
1882
- function q(e, t, n) {
1883
- return n ? (n.type === "DAC_BIET" ? e.special : n.type === "MO_RONG" ? e.extended.filter((e) => L(e.program, n.name)) : []).filter((e) => L(e.label, t)) : [];
1978
+ function we(e, t, n) {
1979
+ return n ? (n.type === "DAC_BIET" ? e.special : n.type === "MO_RONG" ? e.extended.filter((e) => I(e.program, n.name)) : []).filter((e) => I(e.label, t)) : [];
1884
1980
  }
1885
- function ye(e, t) {
1981
+ function Te(e, t) {
1886
1982
  let n = [], r = t.prog?.type, i = 0;
1887
- if (r === "DINH_KY") i = Math.max(0, ...e.periodic.filter((e) => L(e.label, t.label)).map((e) => e.pct));
1983
+ if (r === "DINH_KY") i = Math.max(0, ...e.periodic.filter((e) => I(e.label, t.label)).map((e) => e.pct));
1888
1984
  else if (r === "LKT") {
1889
- let n = h(e, b(e, t.lktGroup)?.baseProgram), r = x(e, t.label, t.lktGroup).map((e) => e.cut);
1890
- r.length && (i = Math.max(0, ...q(e, t.label, n).map((e) => e.pct)) - Math.min(...r));
1891
- } else i = Math.max(0, ...q(e, t.label, t.prog).map((e) => e.pct));
1985
+ let n = C(e, t.label, t.lktGroup).map((e) => e.cut);
1986
+ n.length && (i = Math.max(0, ...T(e, t.label, t.lktGroup).map((e) => e.pct)) - Math.min(...n));
1987
+ } else i = Math.max(0, ...we(e, t.label, t.prog).map((e) => e.pct));
1892
1988
  if (i > 0 && n.push({
1893
- big: B(i),
1989
+ big: z(i),
1894
1990
  text: "mức giảm học phí cao nhất"
1895
1991
  }), r === "DINH_KY") {
1896
- let r = Math.max(0, ...e.periodic.filter((e) => L(e.label, t.label)).map((e) => e.cashback));
1992
+ let r = Math.max(0, ...e.periodic.filter((e) => I(e.label, t.label)).map((e) => e.cashback));
1897
1993
  r && n.push({
1898
- big: z(r),
1994
+ big: R(r),
1899
1995
  text: `đồng hoàn tiền — ${String(e.settings.docTexts?.cashbackLabel ?? "").toLowerCase()}`
1900
1996
  });
1901
1997
  }
1902
- let a = Math.max(0, ...e.gifts.filter((e) => L(e.label, t.label) && L(e.program, t.program)).map((e) => e.value));
1998
+ let a = Math.max(0, ...e.gifts.filter((e) => I(e.label, t.label) && I(e.program, t.program)).map((e) => e.value));
1903
1999
  a && n.push({
1904
- big: z(a),
2000
+ big: R(a),
1905
2001
  text: "đồng — bộ quà tặng giá trị nhất"
1906
2002
  });
1907
2003
  let o = 0;
1908
- for (let n of v(e, t.label)) for (let e of n.modes) o = Math.max(o, t.q([{
2004
+ for (let n of b(e, t.label)) for (let e of n.modes) o = Math.max(o, t.q([{
1909
2005
  code: n.code,
1910
2006
  mode: e
1911
2007
  }]).lines[0]?.voucher ?? 0);
1912
2008
  return o && n.length < 3 && n.push({
1913
- big: z(o),
2009
+ big: R(o),
1914
2010
  text: "đồng voucher khóa học đặc biệt"
1915
2011
  }), n.slice(0, 3);
1916
2012
  }
1917
- function be(e, t, n, r) {
1918
- let i = e.settings, a = t?.month || String(i.validFrom ?? "").slice(0, 7), o = String(i.validFrom ?? "").slice(0, 7), s = !!(a && o && a !== o), [c, l] = s ? de(a) : [i.validFrom, i.validTo], u = s ? c : i.validFrom, d = s ? l : i.validTo, f = i.campaignName || "";
1919
- s && f && (f = f.replace(/tháng\s*\d+(\/\d+)?/gi, `tháng ${ue(e, a)}`));
1920
- let p = ye(e, t), m = he(e, t).length;
2013
+ function Ee(e, t, n, r) {
2014
+ let i = e.settings, a = t?.month || String(i.validFrom ?? "").slice(0, 7), o = String(i.validFrom ?? "").slice(0, 7), s = !!(a && o && a !== o), [c, l] = s ? V(a) : [i.validFrom, i.validTo], u = s ? c : i.validFrom, d = s ? l : i.validTo, f = i.campaignName || "";
2015
+ s && f && (f = f.replace(/tháng\s*\d+(\/\d+)?/gi, `tháng ${me(e, a)}`));
2016
+ let p = Te(e, t), m = be(e, t).length;
1921
2017
  return {
1922
2018
  cls: "cover",
1923
2019
  html: `<div class="cv-l">
1924
- <div class="kick">Chương trình khuyến mãi · Tháng ${ue(e, a)}</div>
2020
+ <div class="kick">Chương trình khuyến mãi · Tháng ${me(e, a)}</div>
1925
2021
  <div class="cv-main">
1926
- ${n.logoUrl ? `<img class="cv-logo" src="${R(re(n.logoUrl))}" alt="${R(n.brandName)}">` : `<div class="cv-brand">${R(n.brandName)}</div>`}
1927
- <div class="cv-title">${R(r)}</div>
1928
- <div class="cv-date">Áp dụng từ ${H(u)} đến ${H(d)}</div>
2022
+ ${n.logoUrl ? `<img class="cv-logo" src="${L(ae(n.logoUrl))}" alt="${L(n.brandName)}">` : `<div class="cv-brand">${L(n.brandName)}</div>`}
2023
+ <div class="cv-title">${L(r)}</div>
2024
+ <div class="cv-date">Áp dụng từ ${he(u)} đến ${he(d)}</div>
1929
2025
  </div>
1930
2026
  </div>
1931
2027
  <div class="cv-r">
1932
- ${f ? `<div class="cv-theme">${R(f)}</div>` : ""}
1933
- <div class="cv-prog">${R(t.program)}</div>
2028
+ ${f ? `<div class="cv-theme">${L(f)}</div>` : ""}
2029
+ <div class="cv-prog">${L(t.program)}</div>
1934
2030
  <div class="cv-scope">${t.periodic ? "Áp dụng cho toàn bộ hình thức thanh toán" : m ? `${m} mức ưu đãi theo tiến độ thanh toán` : ""}</div>
1935
- <div class="cv-hl">${p.map((e) => `<div><b>${R(e.big)}</b><span>${R(e.text)}</span></div>`).join("")}</div>
2031
+ <div class="cv-hl">${p.map((e) => `<div><b>${L(e.big)}</b><span>${L(e.text)}</span></div>`).join("")}</div>
1936
2032
  </div>`
1937
2033
  };
1938
2034
  }
1939
- function xe(e, t) {
1940
- let n = v(e, t.label);
2035
+ function De(e, t) {
2036
+ let n = b(e, t.label);
1941
2037
  if (!n.length) return null;
1942
2038
  let r = n.map((n) => {
1943
- let r = e.courses.find((e) => L(e.label, t.label) && L(e.code, n.code) && L(e.mode, "Offline")), i = e.courses.find((e) => L(e.label, t.label) && L(e.code, n.code) && L(e.mode, "Online")), a = r ?? i, o = t.q([{
2039
+ let r = e.courses.find((e) => I(e.label, t.label) && I(e.code, n.code) && I(e.mode, "Offline")), i = e.courses.find((e) => I(e.label, t.label) && I(e.code, n.code) && I(e.mode, "Online")), a = r ?? i, o = t.q([{
1944
2040
  code: n.code,
1945
2041
  mode: a.mode
1946
2042
  }]);
1947
2043
  return [
1948
2044
  {
1949
- html: `<b>${R(n.name)}</b>`,
2045
+ html: `<b>${L(n.name)}</b>`,
1950
2046
  cls: "left"
1951
2047
  },
1952
- R(n.code),
1953
- R(a.sessions || i?.sessions || ""),
1954
- R(r?.classSize || "—"),
1955
- R(i?.classSize || "—"),
1956
- z(a.price),
1957
- o.lines[0]?.voucher ? `-${z(o.lines[0].voucher)}` : "—",
2048
+ L(n.code),
2049
+ L(a.sessions || i?.sessions || ""),
2050
+ L(r?.classSize || "—"),
2051
+ L(i?.classSize || "—"),
2052
+ R(a.price),
2053
+ o.lines[0]?.voucher ? `-${R(o.lines[0].voucher)}` : "—",
1958
2054
  {
1959
- html: o.ok ? z(o.afterPromo) : "Không áp dụng",
2055
+ html: o.ok ? R(o.afterPromo) : "Không áp dụng",
1960
2056
  cls: "hot"
1961
2057
  }
1962
2058
  ];
@@ -1965,8 +2061,8 @@ function xe(e, t) {
1965
2061
  kick: "Bảng giá",
1966
2062
  h: "Học phí từng khóa học",
1967
2063
  sub: `${t.program} · giá đăng ký 1 khóa, đóng full học phí, tính theo lớp Offline nếu có`,
1968
- html: W({
1969
- head: [G({
2064
+ html: U({
2065
+ head: [W({
1970
2066
  html: "Khóa học",
1971
2067
  cls: "left"
1972
2068
  }, "Mã khóa", "Thời lượng", "Sĩ số Offline", "Sĩ số Online", "Giá gốc", "Voucher", {
@@ -1978,27 +2074,27 @@ function xe(e, t) {
1978
2074
  })
1979
2075
  };
1980
2076
  }
1981
- function Se(e) {
2077
+ function Oe(e) {
1982
2078
  return e.applyType === "TOAN_BO" ? "Toàn bộ các khóa học" : e.applyType === "LO_TRINH_CU_THE" ? "Theo từng combo có bảng thông tin kèm theo (phụ lục Citime)" : `Combo từ ${Number(e.minCourses) || 2} khoá trở lên`;
1983
2079
  }
1984
- function Ce(e, t, n) {
2080
+ function ke(e, t, n) {
1985
2081
  let r = [];
1986
- for (let n of v(e, t.label)) for (let e of n.modes) {
2082
+ for (let n of b(e, t.label)) for (let e of n.modes) {
1987
2083
  let i = t.q([{
1988
2084
  code: n.code,
1989
2085
  mode: e
1990
2086
  }]).lines[0]?.voucher ?? 0;
1991
2087
  i > 0 && r.push([{
1992
- html: `${R(n.name)}${n.modes.length > 1 ? ` <span class="muted">${R(e)}</span>` : ""}`,
2088
+ html: `${L(n.name)}${n.modes.length > 1 ? ` <span class="muted">${L(e)}</span>` : ""}`,
1993
2089
  cls: "left"
1994
2090
  }, {
1995
- html: `${z(i)}đ`,
2091
+ html: `${R(i)}đ`,
1996
2092
  cls: "hot"
1997
2093
  }]);
1998
2094
  }
1999
2095
  if (!r.length) return "";
2000
- let i = (e) => W({
2001
- head: [G({
2096
+ let i = (e) => U({
2097
+ head: [W({
2002
2098
  html: "Khóa học",
2003
2099
  cls: "left"
2004
2100
  }, {
@@ -2010,24 +2106,24 @@ function Ce(e, t, n) {
2010
2106
  }), a = Math.ceil(r.length / 2);
2011
2107
  return `<div class="sec">Quà tặng khóa học đặc biệt</div>${n ? `<div class="cols2">${i(r.slice(0, a))}${i(r.slice(a))}</div>` : i(r)}`;
2012
2108
  }
2013
- function we(e, t) {
2014
- let n = (e.settings.programRules ?? []).find((e) => L(e.label, t.label) && L(e.program, t.program)), r = String(n?.rules ?? "").split("\n").map((e) => e.trim()).filter(Boolean);
2015
- return r.length ? `<div class="rules"><div class="rules-h">Quy định tham gia chương trình</div><ol>${r.map((e) => `<li>${R(e)}</li>`).join("")}</ol></div>` : "";
2109
+ function Ae(e, t) {
2110
+ let n = (e.settings.programRules ?? []).find((e) => I(e.label, t.label) && I(e.program, t.program)), r = String(n?.rules ?? "").split("\n").map((e) => e.trim()).filter(Boolean);
2111
+ return r.length ? `<div class="rules"><div class="rules-h">Quy định tham gia chương trình</div><ol>${r.map((e) => `<li>${L(e)}</li>`).join("")}</ol></div>` : "";
2016
2112
  }
2017
- function Te(e, t) {
2113
+ function je(e, t) {
2018
2114
  let n = t.prog?.type;
2019
2115
  if (n === "DINH_KY") {
2020
- let n = e.periodic.filter((e) => L(e.label, t.label)).sort((e, t) => e.from - t.from), r = "";
2116
+ let n = e.periodic.filter((e) => I(e.label, t.label)).sort((e, t) => e.from - t.from), r = "";
2021
2117
  if (n.length) {
2022
2118
  let t = Math.max(...n.map((e) => e.from)), i = [];
2023
2119
  for (let e = 1; e <= t; e++) {
2024
2120
  let r = n.find((t) => t.from <= e && t.to >= e), a = e === t ? "k" : e > t / 2 ? "y" : "";
2025
- i.push(`<div class="card ${a}"><div class="no">${V(e)}</div><div class="nm">${U(e, r?.to >= 99 ? e : null)}</div>
2026
- <div class="big">${r ? B(r.pct) : "—"}</div><div class="sm">${r?.cashback ? `Hoàn tiền ${z(r.cashback)}đ` : "Giảm trực tiếp học phí"}</div></div>`);
2121
+ i.push(`<div class="card ${a}"><div class="no">${B(e)}</div><div class="nm">${H(e, r?.to >= 99 ? e : null)}</div>
2122
+ <div class="big">${r ? z(r.pct) : "—"}</div><div class="sm">${r?.cashback ? `Hoàn tiền ${R(r.cashback)}đ` : "Giảm trực tiếp học phí"}</div></div>`);
2027
2123
  }
2028
- r = `<div class="cards" style="grid-template-columns:repeat(${t},1fr)">${i.join("")}</div>`, n.some((e) => e.cashback) && (r += `<p class="note">Hoàn tiền: ${R(e.settings.docTexts?.cashbackLabel ?? "")}.</p>`);
2124
+ r = `<div class="cards" style="grid-template-columns:repeat(${t},1fr)">${i.join("")}</div>`, n.some((e) => e.cashback) && (r += `<p class="note">Hoàn tiền: ${L(e.settings.docTexts?.cashbackLabel ?? "")}.</p>`);
2029
2125
  }
2030
- let i = Ce(e, t, !0), a = we(e, t);
2126
+ let i = ke(e, t, !0), a = Ae(e, t);
2031
2127
  return !r && !i ? null : {
2032
2128
  kick: "Chương trình khuyến mại",
2033
2129
  h: "Ưu đãi Định kỳ theo số khóa đăng ký",
@@ -2037,43 +2133,43 @@ function Te(e, t) {
2037
2133
  }
2038
2134
  let r = "", i = "";
2039
2135
  if (n === "LKT") {
2040
- let n = b(e, t.lktGroup), a = h(e, n?.baseProgram), o = x(e, t.label, t.lktGroup), s = q(e, t.label, a);
2041
- n && o.length && s.length && (r = W({
2042
- head: [G("Hình thức thanh toán", "Tiến độ", `% ${R(a.name)}`, ...o.map((e) => ({
2043
- html: `${R(e.format)}<br><small>cắt ${B(e.cut)}</small>`,
2136
+ let n = S(e, t.lktGroup), a = g(n), o = a ? null : _(e, n?.baseProgram), s = C(e, t.label, t.lktGroup), c = T(e, t.label, t.lktGroup);
2137
+ n && s.length && c.length && (r = U({
2138
+ head: [W("Hình thức thanh toán", "Tiến độ", a ? "% Mức nền riêng" : `% ${L(o?.name ?? "")}`, ...s.map((e) => ({
2139
+ html: `${L(e.format)}<br><small>cắt ${z(e.cut)}</small>`,
2044
2140
  cls: "hot"
2045
2141
  })))],
2046
- rows: s.map((t) => [
2047
- R(g(e, t.method)?.promoLabel || t.method),
2142
+ rows: c.map((t) => [
2143
+ L(v(e, t.method)?.promoLabel || t.method),
2048
2144
  Number(t.term) ? `${t.term} tháng` : "—",
2049
- B(t.pct),
2050
- ...o.map((e) => ({
2051
- html: B(t.pct - e.cut),
2145
+ z(t.pct),
2146
+ ...s.map((e) => ({
2147
+ html: z(t.pct - e.cut),
2052
2148
  cls: "hot"
2053
2149
  }))
2054
2150
  ]),
2055
2151
  merge: [0],
2056
2152
  cls: "t-tight"
2057
- }), i = `${R(n.name)}: % giảm = % chương trình ${R(a.name)} trừ mức cắt của format liên kết trường.`);
2153
+ }), i = a ? `${L(n.name)}: % giảm = % nền riêng LKT trừ mức cắt của format liên kết trường.` : `${L(n.name)}: % giảm = % chương trình ${L(o?.name ?? "")} trừ mức cắt của format liên kết trường.`);
2058
2154
  } else {
2059
- let n = e.settings.labels.find((e) => L(e.name, t.label))?.blockedMethods ?? [], i = e.settings.paymentMethods.map((e) => e.name), a = q(e, t.label, t.prog).filter((e) => !n.some((t) => L(t, e.method))).sort((e, t) => i.indexOf(e.method) - i.indexOf(t.method) || e.term - t.term);
2060
- a.length && (r = W({
2061
- head: [G("STT", "Hình thức thanh toán", "Tiến độ", {
2155
+ let n = e.settings.labels.find((e) => I(e.name, t.label))?.blockedMethods ?? [], i = e.settings.paymentMethods.map((e) => e.name), a = we(e, t.label, t.prog).filter((e) => !n.some((t) => I(t, e.method))).sort((e, t) => i.indexOf(e.method) - i.indexOf(t.method) || e.term - t.term);
2156
+ a.length && (r = U({
2157
+ head: [W("STT", "Hình thức thanh toán", "Tiến độ", {
2062
2158
  html: "Mức ưu đãi",
2063
2159
  cls: "hot"
2064
2160
  }, "Khóa học áp dụng")],
2065
2161
  rows: a.map((t, n) => [
2066
2162
  String(n + 1),
2067
- R(g(e, t.method)?.promoLabel || t.method),
2163
+ L(v(e, t.method)?.promoLabel || t.method),
2068
2164
  {
2069
2165
  html: Number(t.term) ? `${t.term} tháng` : "—",
2070
2166
  cls: "nw"
2071
2167
  },
2072
2168
  {
2073
- html: B(t.pct),
2169
+ html: z(t.pct),
2074
2170
  cls: "hot"
2075
2171
  },
2076
- R(Se(t))
2172
+ L(Oe(t))
2077
2173
  ]),
2078
2174
  merge: [
2079
2175
  1,
@@ -2083,46 +2179,46 @@ function Te(e, t) {
2083
2179
  cls: "t-promo"
2084
2180
  }));
2085
2181
  }
2086
- let a = Ce(e, t, !1);
2182
+ let a = ke(e, t, !1);
2087
2183
  return !r && !a ? null : {
2088
2184
  kick: "Chương trình khuyến mại",
2089
2185
  h: `Ưu đãi ${t.program} theo tiến độ thanh toán`,
2090
2186
  sub: "Áp dụng cho toàn bộ khách hàng",
2091
- html: `<div class="cols2 top" style="grid-template-columns:1.35fr 1fr"><div><div class="sec">Mức ưu đãi</div>${r}${i ? `<p class="note">${i}</p>` : ""}</div><div>${a}</div></div>${we(e, t)}`
2187
+ html: `<div class="cols2 top" style="grid-template-columns:1.35fr 1fr"><div><div class="sec">Mức ưu đãi</div>${r}${i ? `<p class="note">${i}</p>` : ""}</div><div>${a}</div></div>${Ae(e, t)}`
2092
2188
  };
2093
2189
  }
2094
- function Ee(e, t) {
2095
- let n = e.gifts.filter((e) => L(e.label, t.label) && L(e.program, t.program));
2190
+ function Me(e, t) {
2191
+ let n = e.gifts.filter((e) => I(e.label, t.label) && I(e.program, t.program));
2096
2192
  if (!n.length) return null;
2097
- let r = Math.max(...n.map((e) => e.milestone)), i = ve(e, t), a = [{
2193
+ let r = Math.max(...n.map((e) => e.milestone)), i = Ce(e, t), a = [{
2098
2194
  html: "Khóa học",
2099
2195
  rowspan: 2,
2100
2196
  cls: "left"
2101
2197
  }], o = [];
2102
2198
  i.forEach((e) => {
2103
2199
  e.giftCondition ? (a.push({
2104
- html: R(e.docLabel),
2200
+ html: L(e.docLabel),
2105
2201
  colspan: 2
2106
2202
  }), o.push({ html: "Quà tặng" }, { html: "Điều kiện" })) : a.push({
2107
- html: R(e.docLabel),
2203
+ html: L(e.docLabel),
2108
2204
  rowspan: 2
2109
2205
  });
2110
2206
  });
2111
2207
  let s = [];
2112
2208
  for (let n = 1; n <= r; n++) {
2113
2209
  let a = [{
2114
- html: `<b>${U(n, r)}</b>`,
2210
+ html: `<b>${H(n, r)}</b>`,
2115
2211
  cls: "left"
2116
2212
  }];
2117
2213
  for (let r of i) {
2118
- let i = _e(e, t, r.name, n);
2214
+ let i = Se(e, t, r.name, n);
2119
2215
  a.push(n === 1 && !r.allowSingle ? {
2120
2216
  html: "Không áp dụng",
2121
2217
  cls: "muted"
2122
- } : i ? R(i.content) : {
2218
+ } : i ? L(i.content) : {
2123
2219
  html: "—",
2124
2220
  cls: "muted"
2125
- }), r.giftCondition && a.push(i ? R(r.giftCondition) : {
2221
+ }), r.giftCondition && a.push(i ? L(r.giftCondition) : {
2126
2222
  html: "—",
2127
2223
  cls: "muted"
2128
2224
  });
@@ -2133,7 +2229,7 @@ function Ee(e, t) {
2133
2229
  kick: "Quà tặng",
2134
2230
  h: "Quà tặng theo hình thức thanh toán",
2135
2231
  sub: `${t.program} · quà theo số khóa đăng ký`,
2136
- html: W({
2232
+ html: U({
2137
2233
  head: o.length ? [a, o] : [a],
2138
2234
  rows: s,
2139
2235
  merge: s[0].map((e, t) => t).slice(1),
@@ -2141,29 +2237,29 @@ function Ee(e, t) {
2141
2237
  })
2142
2238
  };
2143
2239
  }
2144
- function De(e, t) {
2145
- let n = new Set(e.gifts.filter((e) => L(e.label, t.label) && L(e.program, t.program)).map((e) => Number(e.value))), r = (e.settings.giftSets ?? []).filter((e) => L(e.label, t.label) && (!n.size || n.has(Number(e.value))));
2240
+ function Ne(e, t) {
2241
+ let n = new Set(e.gifts.filter((e) => I(e.label, t.label) && I(e.program, t.program)).map((e) => Number(e.value))), r = (e.settings.giftSets ?? []).filter((e) => I(e.label, t.label) && (!n.size || n.has(Number(e.value))));
2146
2242
  return !r.length || !n.size ? null : (r.sort((e, t) => e.value - t.value), {
2147
2243
  kick: "Quà tặng",
2148
2244
  h: "Bộ quà tặng giá trị dành cho học viên",
2149
2245
  sub: "Nội dung từng bộ quà trong bảng quà tặng theo hình thức thanh toán",
2150
- html: `<div class="cards sets" style="grid-template-columns:repeat(${r.length > 6 ? 4 : 3},1fr)">${r.map((e, t) => `<div class="card ${t === r.length - 1 ? "k" : t % 3 == 1 ? "y" : ""}"><div class="no">Bộ quà ${V(t + 1)}</div>
2151
- <div class="big sm2">${z(e.value)}đ</div><ul>${String(e.items).split("\n").filter(Boolean).map((e) => `<li>${R(e)}</li>`).join("")}</ul></div>`).join("")}</div>`
2246
+ html: `<div class="cards sets" style="grid-template-columns:repeat(${r.length > 6 ? 4 : 3},1fr)">${r.map((e, t) => `<div class="card ${t === r.length - 1 ? "k" : t % 3 == 1 ? "y" : ""}"><div class="no">Bộ quà ${B(t + 1)}</div>
2247
+ <div class="big sm2">${R(e.value)}đ</div><ul>${String(e.items).split("\n").filter(Boolean).map((e) => `<li>${L(e)}</li>`).join("")}</ul></div>`).join("")}</div>`
2152
2248
  });
2153
2249
  }
2154
- function Oe(e, t) {
2155
- let n = e.settings.docTexts ?? {}, r = e.warranty.filter((e) => e.rate > 0), i = (e.settings.services ?? []).filter((e) => L(e.label, t.label));
2250
+ function Pe(e, t) {
2251
+ let n = e.settings.docTexts ?? {}, r = e.warranty.filter((e) => e.rate > 0), i = (e.settings.services ?? []).filter((e) => I(e.label, t.label));
2156
2252
  if (!r.length && !i.length) return null;
2157
- let a = v(e, t.label).filter((e) => e.warranty === !1).map((e) => e.name);
2253
+ let a = b(e, t.label).filter((e) => e.warranty === !1).map((e) => e.name);
2158
2254
  return {
2159
2255
  kick: "Dịch vụ cộng thêm",
2160
2256
  h: "Gói bảo hành & dịch vụ học tập",
2161
2257
  sub: "Bán kèm lộ trình khi khách có nhu cầu",
2162
2258
  html: `<div class="cols2 top"><div>${r.length ? `<div class="sec">Gói bảo hành</div>
2163
- <div class="cards" style="grid-template-columns:repeat(${r.length},1fr)">${r.map((e, t) => `<div class="card ${t === r.length - 1 ? "k" : t ? "y" : ""}"><div class="no">Bảo hành</div><div class="nm">${R(e.name)}</div>
2164
- <div class="big">${B(e.rate)}</div><div class="sm">giá gốc khóa học / combo</div></div>`).join("")}</div>
2165
- <p class="note">Thời lượng: ${R(n.warrantyDuration)} · Hình thức: ${R(n.warrantyForm)}.${a.length ? `<br>Không tính phí bảo hành với các khóa ${R(a.join(", "))}.` : ""}</p>` : ""}</div><div>${i.length ? `<div class="sec">Dịch vụ học tập</div>${W({
2166
- head: [G({
2259
+ <div class="cards" style="grid-template-columns:repeat(${r.length},1fr)">${r.map((e, t) => `<div class="card ${t === r.length - 1 ? "k" : t ? "y" : ""}"><div class="no">Bảo hành</div><div class="nm">${L(e.name)}</div>
2260
+ <div class="big">${z(e.rate)}</div><div class="sm">giá gốc khóa học / combo</div></div>`).join("")}</div>
2261
+ <p class="note">Thời lượng: ${L(n.warrantyDuration)} · Hình thức: ${L(n.warrantyForm)}.${a.length ? `<br>Không tính phí bảo hành với các khóa ${L(a.join(", "))}.` : ""}</p>` : ""}</div><div>${i.length ? `<div class="sec">Dịch vụ học tập</div>${U({
2262
+ head: [W({
2167
2263
  html: "Sản phẩm",
2168
2264
  cls: "left"
2169
2265
  }, "Thời lượng", "Hình thức", {
@@ -2172,58 +2268,58 @@ function Oe(e, t) {
2172
2268
  })],
2173
2269
  rows: i.map((e) => [
2174
2270
  {
2175
- html: R(e.name),
2271
+ html: L(e.name),
2176
2272
  cls: "left"
2177
2273
  },
2178
- R(e.duration),
2179
- R(e.mode),
2274
+ L(e.duration),
2275
+ L(e.mode),
2180
2276
  {
2181
- html: z(e.price),
2277
+ html: R(e.price),
2182
2278
  cls: "hot"
2183
2279
  }
2184
2280
  ])
2185
2281
  })}` : ""}</div></div>`
2186
2282
  };
2187
2283
  }
2188
- function ke(e, t, n, r) {
2189
- let i = e.routes.filter((e) => L(e.label, t.label) && L(e.output, n));
2284
+ function Fe(e, t, n, r) {
2285
+ let i = e.routes.filter((e) => I(e.label, t.label) && I(e.output, n));
2190
2286
  if (!i.length) return [];
2191
- let a = e.warranty.filter((e) => e.rate > 0), o = e.warranty.find((e) => !(e.rate > 0)), s = [...new Set(i.map((e) => e.items.length))].sort((e, t) => e - t), c = e.settings.docTexts?.routeNote ? `<p class="note">* ${R(e.settings.docTexts.routeNote)}</p>` : "", l = (e, t) => ({
2287
+ let a = e.warranty.filter((e) => e.rate > 0), o = e.warranty.find((e) => !(e.rate > 0)), s = [...new Set(i.map((e) => e.items.length))].sort((e, t) => e - t), c = e.settings.docTexts?.routeNote ? `<p class="note">* ${L(e.settings.docTexts.routeNote)}</p>` : "", l = (e, t) => ({
2192
2288
  kick: `Lộ trình gợi ý · Đầu ra ${n}`,
2193
2289
  h: `Bảng giá lộ trình đầu ra IELTS ${n}`,
2194
2290
  sub: e,
2195
2291
  html: t + c
2196
2292
  });
2197
2293
  if (t.periodic) {
2198
- let n = ve(e, t).filter((e) => !e.citime), r = n.some((n) => i.some((r) => _e(e, t, n.name, r.items.length))), o = [G({
2294
+ let n = Ce(e, t).filter((e) => !e.citime), r = n.some((n) => i.some((r) => Se(e, t, n.name, r.items.length))), o = [W({
2199
2295
  html: "Lộ trình",
2200
2296
  cls: "left"
2201
2297
  }, "Giá gốc", {
2202
2298
  html: "Giá sau ưu đãi",
2203
2299
  cls: "hot"
2204
- }, ...a.map((e) => `+ BH ${R(e.name)}<br><small>${B(e.rate)}</small>`), ...r ? n.map((e) => `Quà ${ce(e.docShort.replace(/^Đóng |^Trả /, (e) => e.toLowerCase()))}`) : [])], c = [];
2300
+ }, ...a.map((e) => `+ BH ${L(e.name)}<br><small>${z(e.rate)}</small>`), ...r ? n.map((e) => `Quà ${fe(e.docShort.replace(/^Đóng |^Trả /, (e) => e.toLowerCase()))}`) : [])], c = [];
2205
2301
  for (let o of s) {
2206
- c.push({ group: U(o) });
2302
+ c.push({ group: H(o) });
2207
2303
  for (let s of i.filter((e) => e.items.length === o)) {
2208
2304
  let i = t.q(s.items);
2209
2305
  c.push([
2210
2306
  {
2211
- html: R(s.name),
2307
+ html: L(s.name),
2212
2308
  cls: "left"
2213
2309
  },
2214
- z(i.gross),
2310
+ R(i.gross),
2215
2311
  i.ok ? {
2216
- html: z(i.afterPromo),
2312
+ html: R(i.afterPromo),
2217
2313
  cls: "hot"
2218
2314
  } : {
2219
2315
  html: "Không áp dụng",
2220
2316
  cls: "muted"
2221
2317
  },
2222
- ...a.map((e) => i.ok ? z(t.q(s.items, { warranty: e.name }).final) : "—"),
2318
+ ...a.map((e) => i.ok ? R(t.q(s.items, { warranty: e.name }).final) : "—"),
2223
2319
  ...r ? n.map((n) => {
2224
- let r = _e(e, t, n.name, o);
2320
+ let r = Se(e, t, n.name, o);
2225
2321
  return r ? {
2226
- html: R(r.content),
2322
+ html: L(r.content),
2227
2323
  key: `${o}|${n.name}|${r.content}`,
2228
2324
  cls: "gift"
2229
2325
  } : {
@@ -2235,14 +2331,14 @@ function ke(e, t, n, r) {
2235
2331
  ]);
2236
2332
  }
2237
2333
  }
2238
- return [l(`${t.program} · áp dụng cho toàn bộ hình thức thanh toán`, W({
2334
+ return [l(`${t.program} · áp dụng cho toàn bộ hình thức thanh toán`, U({
2239
2335
  head: o,
2240
2336
  rows: c,
2241
2337
  merge: r ? n.map((e, t) => 3 + a.length + t) : [],
2242
2338
  cls: "t-routes"
2243
2339
  }))];
2244
2340
  }
2245
- let u = he(e, t), d = r?.length ? u.filter((e) => r.includes(e.id)) : u.filter((n) => ge(e, t).includes(n.id)), f = [];
2341
+ let u = be(e, t), d = r?.length ? u.filter((e) => r.includes(e.id)) : u.filter((n) => xe(e, t).includes(n.id)), f = [];
2246
2342
  for (let e = 0; e < d.length; e += 2) {
2247
2343
  let n = d.slice(e, e + 2), r = [[
2248
2344
  {
@@ -2255,30 +2351,30 @@ function ke(e, t, n, r) {
2255
2351
  rowspan: 2
2256
2352
  },
2257
2353
  ...n.map((e) => ({
2258
- html: `${R(e.title)} · Giảm ${B(e.pct)}`,
2354
+ html: `${L(e.title)} · Giảm ${z(e.pct)}`,
2259
2355
  colspan: 1 + a.length,
2260
2356
  cls: "hot"
2261
2357
  }))
2262
2358
  ], n.flatMap(() => [{
2263
- html: `BH ${R(o?.name ?? "tiêu chuẩn")}`,
2359
+ html: `BH ${L(o?.name ?? "tiêu chuẩn")}`,
2264
2360
  cls: "hot"
2265
- }, ...a.map((e) => ({ html: `+ BH ${R(e.name)}<br><small>${B(e.rate)}</small>` }))])], c = [];
2361
+ }, ...a.map((e) => ({ html: `+ BH ${L(e.name)}<br><small>${z(e.rate)}</small>` }))])], c = [];
2266
2362
  for (let e of s) {
2267
- c.push({ group: U(e) });
2363
+ c.push({ group: H(e) });
2268
2364
  for (let r of i.filter((t) => t.items.length === e)) {
2269
2365
  let e = [{
2270
- html: R(r.name),
2366
+ html: L(r.name),
2271
2367
  cls: "left"
2272
- }, z(t.q(r.items).gross)];
2368
+ }, R(t.q(r.items).gross)];
2273
2369
  for (let i of n) {
2274
2370
  let n = t.q(r.items, {
2275
2371
  method: i.method,
2276
2372
  term: i.term
2277
2373
  });
2278
2374
  n.ok ? e.push({
2279
- html: z(n.afterPromo),
2375
+ html: R(n.afterPromo),
2280
2376
  cls: "hot"
2281
- }, ...a.map((e) => z(t.q(r.items, {
2377
+ }, ...a.map((e) => R(t.q(r.items, {
2282
2378
  method: i.method,
2283
2379
  term: i.term,
2284
2380
  warranty: e.name
@@ -2290,7 +2386,7 @@ function ke(e, t, n, r) {
2290
2386
  c.push(e);
2291
2387
  }
2292
2388
  }
2293
- f.push(l(`${t.program} · ${n.map((e) => e.title).join(" và ")} · "x" = lộ trình không áp dụng hình thức này`, W({
2389
+ f.push(l(`${t.program} · ${n.map((e) => e.title).join(" và ")} · "x" = lộ trình không áp dụng hình thức này`, U({
2294
2390
  head: r,
2295
2391
  rows: c,
2296
2392
  cls: "t-routes"
@@ -2298,22 +2394,22 @@ function ke(e, t, n, r) {
2298
2394
  }
2299
2395
  return f;
2300
2396
  }
2301
- function Ae(e, t) {
2302
- let n = e.settings.paymentMethods.find((e) => e.citime), r = e.settings.labels.find((e) => L(e.name, t.label))?.blockedMethods ?? [];
2303
- if (!n || r.some((e) => L(e, n.name))) return null;
2304
- let i = new Set(e.settings.courseCodes.filter((e) => /^M[AB]$/.test(e.short)).map((e) => e.short)), a = e.citimeRoutes.filter((e) => L(e.label, t.label) && L(e.status, "Áp dụng") && !String(e.code).split("_").some((e) => i.has(e)));
2397
+ function Ie(e, t) {
2398
+ let n = e.settings.paymentMethods.find((e) => e.citime), r = e.settings.labels.find((e) => I(e.name, t.label))?.blockedMethods ?? [];
2399
+ if (!n || r.some((e) => I(e, n.name))) return null;
2400
+ let i = new Set(e.settings.courseCodes.filter((e) => /^M[AB]$/.test(e.short)).map((e) => e.short)), a = e.citimeRoutes.filter((e) => I(e.label, t.label) && I(e.status, "Áp dụng") && !String(e.code).split("_").some((e) => i.has(e)));
2305
2401
  if (!a.length) return null;
2306
2402
  let o = [...new Set(a.map((e) => e.group))], s = o.map((e) => {
2307
2403
  let t = [], n = a.filter((t) => t.group === e);
2308
- for (let e of [...new Set(n.map((e) => e.count))].sort((e, t) => e - t)) t.push({ group: U(e) }), n.filter((t) => t.count === e).forEach((e) => t.push([{
2309
- html: R(e.name),
2404
+ for (let e of [...new Set(n.map((e) => e.count))].sort((e, t) => e - t)) t.push({ group: H(e) }), n.filter((t) => t.count === e).forEach((e) => t.push([{
2405
+ html: L(e.name),
2310
2406
  cls: "left"
2311
2407
  }, {
2312
2408
  html: `${e.maxTerm} tháng`,
2313
2409
  cls: "hot"
2314
2410
  }]));
2315
- return `<div><div class="sec">${R(e)}</div>${W({
2316
- head: [G({
2411
+ return `<div><div class="sec">${L(e)}</div>${U({
2412
+ head: [W({
2317
2413
  html: "Lộ trình",
2318
2414
  cls: "left"
2319
2415
  }, {
@@ -2328,14 +2424,14 @@ function Ae(e, t) {
2328
2424
  kick: "Phụ lục",
2329
2425
  h: "Thời hạn trả góp Citime tối đa theo lộ trình",
2330
2426
  sub: `Kỳ hạn Citime: ${n.terms.join(" / ")} tháng`,
2331
- html: `<div class="cols2 top" style="grid-template-columns:repeat(${Math.min(o.length, 3)},1fr)">${s.join("")}</div>${e.settings.docTexts?.citimeNote ? `<p class="note warn">Lưu ý: ${R(e.settings.docTexts.citimeNote)}</p>` : ""}`
2427
+ html: `<div class="cols2 top" style="grid-template-columns:repeat(${Math.min(o.length, 3)},1fr)">${s.join("")}</div>${e.settings.docTexts?.citimeNote ? `<p class="note warn">Lưu ý: ${L(e.settings.docTexts.citimeNote)}</p>` : ""}`
2332
2428
  };
2333
2429
  }
2334
- function je(e, t = {}) {
2335
- let n = K(e, t), r = pe(e, t.label), i = new Set(t.sections ?? le.map((e) => e.id)), a = t.title || fe(e, t.label, t.month), o = [], s = (e, t) => i.has(e) && t && o.push(t);
2336
- if (s("cover", be(e, n, r, a)), s("courses", xe(e, n)), s("promo", Te(e, n)), s("gifts", Ee(e, n)), s("giftSets", De(e, n)), s("services", Oe(e, n)), i.has("routes")) for (let r of t.outputs?.length ? t.outputs : me(e, t.label)) for (let i of ke(e, n, r, t.scenarios)) s("routes", i);
2337
- return s("citime", Ae(e, n)), {
2338
- html: Ie({
2430
+ function Le(e, t = {}) {
2431
+ let n = ye(e, t), r = _e(e, t.label), i = new Set(t.sections ?? pe.map((e) => e.id)), a = t.title || ge(e, t.label, t.month), o = [], s = (e, t) => i.has(e) && t && o.push(t);
2432
+ if (s("cover", Ee(e, n, r, a)), s("courses", De(e, n)), s("promo", je(e, n)), s("gifts", Me(e, n)), s("giftSets", Ne(e, n)), s("services", Pe(e, n)), i.has("routes")) for (let r of t.outputs?.length ? t.outputs : ve(e, t.label)) for (let i of Fe(e, n, r, t.scenarios)) s("routes", i);
2433
+ return s("citime", Ie(e, n)), {
2434
+ html: Ve({
2339
2435
  data: e,
2340
2436
  brand: r,
2341
2437
  title: a,
@@ -2346,32 +2442,32 @@ function je(e, t = {}) {
2346
2442
  title: a
2347
2443
  };
2348
2444
  }
2349
- var Me = (e) => String(e || "#000").replace("#", "").padEnd(6, "0"), Ne = (e) => [
2445
+ var Re = (e) => String(e || "#000").replace("#", "").padEnd(6, "0"), ze = (e) => [
2350
2446
  0,
2351
2447
  2,
2352
2448
  4
2353
- ].map((t) => parseInt(Me(e).slice(t, t + 2), 16)), J = (e) => {
2354
- let [t, n, r] = Ne(e).map((e) => e / 255);
2449
+ ].map((t) => parseInt(Re(e).slice(t, t + 2), 16)), G = (e) => {
2450
+ let [t, n, r] = ze(e).map((e) => e / 255);
2355
2451
  return .2126 * t + .7152 * n + .0722 * r;
2356
- }, Pe = (e, t, n) => `#${Ne(e).map((e, r) => Math.round(e + (Ne(t)[r] - e) * n).toString(16).padStart(2, "0")).join("")}`, Fe = (e) => `<svg class="${e}" viewBox="0 0 400 220" preserveAspectRatio="none" aria-hidden="true">
2452
+ }, K = (e, t, n) => `#${ze(e).map((e, r) => Math.round(e + (ze(t)[r] - e) * n).toString(16).padStart(2, "0")).join("")}`, Be = (e) => `<svg class="${e}" viewBox="0 0 400 220" preserveAspectRatio="none" aria-hidden="true">
2357
2453
  <path d="M10 170 C 70 60, 130 60, 170 120 S 260 200, 300 110 S 370 20, 395 40" fill="none" stroke="currentColor" stroke-width="26" stroke-linecap="round"/></svg>`;
2358
- function Ie({ data: e, brand: t, title: n, pages: r, ctx: i }) {
2359
- let a = e.settings, o = i?.month || String(a.validFrom ?? "").slice(0, 7), s = String(a.validFrom ?? "").slice(0, 7), c = !!(o && s && o !== s), [l, u] = c ? de(o) : [a.validFrom, a.validTo], d = c ? l : a.validFrom, f = c ? u : a.validTo, p = t.bg || "#F0C030", m = t.bg2 && J(t.bg2) > .9 ? t.bg2 : "#FFFCF2", h = t.ink || "#161513", g = t.onMain || (J(p) > .55 ? h : "#FFFFFF"), _ = String(t.gradient || "").split(",").map((e) => e.trim()).filter(Boolean), ee = _.length >= 2 ? `linear-gradient(165deg, ${[..._].reverse().join(", ")})` : p, v = String(t.font || "Be Vietnam Pro").trim(), y = `https://fonts.googleapis.com/css2?family=${encodeURIComponent(v).replace(/%20/g, "+")}:wght@400;500;600;700;800;900&display=swap`, b = t.accent && J(t.accent) < .35 ? t.accent : J(p) > .55 ? Pe(p, "#000000", .5) : p, x = t.neutral || Pe(m, "#8a7f5c", .1), S = t.slate || "#8a8577", C = t.motif === "wave", w = `${R(t.brandName)} · Chương trình khuyến mãi ${ue(e, o)} · ${H(d)} – ${H(f)}`, T = r.map((e, n) => e.cls === "cover" ? `<section class="page cover">${e.html}${C ? Fe("wave wave-cover") : ""}</section>` : `<section class="page">${C ? Fe("wave wave-page") : ""}<div class="inner">
2360
- <div class="kick">${V(n)} · ${R(e.kick)}</div>
2361
- <h2>${R(e.h)}</h2>${e.sub ? `<div class="sub">${R(e.sub)}</div>` : ""}
2454
+ function Ve({ data: e, brand: t, title: n, pages: r, ctx: i }) {
2455
+ let a = e.settings, o = i?.month || String(a.validFrom ?? "").slice(0, 7), s = String(a.validFrom ?? "").slice(0, 7), c = !!(o && s && o !== s), [l, u] = c ? V(o) : [a.validFrom, a.validTo], d = c ? l : a.validFrom, f = c ? u : a.validTo, p = t.bg || "#F0C030", m = t.bg2 && G(t.bg2) > .9 ? t.bg2 : "#FFFCF2", h = t.ink || "#161513", g = t.onMain || (G(p) > .55 ? h : "#FFFFFF"), _ = String(t.gradient || "").split(",").map((e) => e.trim()).filter(Boolean), v = _.length >= 2 ? `linear-gradient(165deg, ${[..._].reverse().join(", ")})` : p, y = String(t.font || "Be Vietnam Pro").trim(), ee = `https://fonts.googleapis.com/css2?family=${encodeURIComponent(y).replace(/%20/g, "+")}:wght@400;500;600;700;800;900&display=swap`, b = t.accent && G(t.accent) < .35 ? t.accent : G(p) > .55 ? K(p, "#000000", .5) : p, x = t.neutral || K(m, "#8a7f5c", .1), S = t.slate || "#8a8577", C = t.motif === "wave", w = `${L(t.brandName)} · Chương trình khuyến mãi ${me(e, o)} · ${he(d)} – ${he(f)}`, T = r.map((e, n) => e.cls === "cover" ? `<section class="page cover">${e.html}${C ? Be("wave wave-cover") : ""}</section>` : `<section class="page">${C ? Be("wave wave-page") : ""}<div class="inner">
2456
+ <div class="kick">${B(n)} · ${L(e.kick)}</div>
2457
+ <h2>${L(e.h)}</h2>${e.sub ? `<div class="sub">${L(e.sub)}</div>` : ""}
2362
2458
  <main>${e.html}</main></div>
2363
- <footer>${t.logoLight ? `<img src="${R(re(t.logoLight))}" alt="">` : ""}<span>${w}</span><span>${String(t.footer || "").split("\n").map(R).join(" · ")}</span><b>${n + 1}</b></footer></section>`).join("");
2364
- return `<!doctype html><html lang="vi"><head><meta charset="utf-8"><title>${R(n)}</title>
2459
+ <footer>${t.logoLight ? `<img src="${L(ae(t.logoLight))}" alt="">` : ""}<span>${w}</span><span>${String(t.footer || "").split("\n").map(L).join(" · ")}</span><b>${n + 1}</b></footer></section>`).join("");
2460
+ return `<!doctype html><html lang="vi"><head><meta charset="utf-8"><title>${L(n)}</title>
2365
2461
  <link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
2366
- <link href="${R(y)}" rel="stylesheet">
2462
+ <link href="${L(ee)}" rel="stylesheet">
2367
2463
  <style>
2368
2464
  @page { size: A4 landscape; margin: 0; }
2369
- :root { --main-fill: ${ee}; --main: ${p}; --paper: ${m}; --ink: ${h}; --on-main: ${g}; --kick: ${b}; --accent: ${t.accent || "#C8102E"};
2370
- --card: ${x}; --beige: ${Pe(x, "#FFFFFF", .55)}; --line: ${Pe(x, "#000000", .12)}; --tint: ${Pe(p, "#FFFFFF", .75)};
2371
- --main2: ${Pe(p, "#FFFFFF", .3)}; --muted: ${S}; }
2465
+ :root { --main-fill: ${v}; --main: ${p}; --paper: ${m}; --ink: ${h}; --on-main: ${g}; --kick: ${b}; --accent: ${t.accent || "#C8102E"};
2466
+ --card: ${x}; --beige: ${K(x, "#FFFFFF", .55)}; --line: ${K(x, "#000000", .12)}; --tint: ${K(p, "#FFFFFF", .75)};
2467
+ --main2: ${K(p, "#FFFFFF", .3)}; --muted: ${S}; }
2372
2468
  * { box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
2373
2469
  html, body { margin: 0; }
2374
- body { font-family: '${R(v)}', 'Be Vietnam Pro', system-ui, sans-serif; color: var(--ink); background: #77746c; }
2470
+ body { font-family: '${L(y)}', 'Be Vietnam Pro', system-ui, sans-serif; color: var(--ink); background: #77746c; }
2375
2471
  .page { width: 297mm; height: 210mm; margin: 0 auto 14px; position: relative; overflow: hidden; background: var(--paper);
2376
2472
  break-after: page; page-break-after: always; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
2377
2473
  .page:last-child { break-after: auto; page-break-after: auto; }
@@ -2442,8 +2538,8 @@ main > .sec:first-child, .cols2 > div > .sec:first-child { margin-top: 2px; }
2442
2538
  .cv-prog { font-size: 34px; font-weight: 900; line-height: 1.05; letter-spacing: -.02em; }
2443
2539
  .cv-scope { font-size: 12.5px; font-weight: 600; margin-top: 8px; opacity: .8; }
2444
2540
  .cv-hl { margin-top: auto; display: grid; gap: 14px; }
2445
- .cv-hl div { border-top: 3px solid ${J(g) > .6 ? "var(--main)" : "var(--ink)"}; padding: 8px 10px 9px;
2446
- background: ${J(g) > .6 ? "var(--ink)" : "rgba(255,255,255,.55)"}; }
2541
+ .cv-hl div { border-top: 3px solid ${G(g) > .6 ? "var(--main)" : "var(--ink)"}; padding: 8px 10px 9px;
2542
+ background: ${G(g) > .6 ? "var(--ink)" : "rgba(255,255,255,.55)"}; }
2447
2543
  .wave { position: absolute; pointer-events: none; color: var(--main); }
2448
2544
  .wave-cover { width: 118mm; height: 58mm; left: 96mm; top: 62mm; opacity: .95; }
2449
2545
  .wave-page { width: 72mm; height: 36mm; right: -16mm; top: -12mm; opacity: .9; }
@@ -2476,8 +2572,8 @@ window.addEventListener('load', function () { (document.fonts ? document.fonts.r
2476
2572
  <\/script></head><body>${T}</body></html>`;
2477
2573
  }
2478
2574
  // src/store.js
2479
- var Le = (e) => JSON.parse(JSON.stringify(e)), Re = /^\d{4}-\d{2}$/, ze = (e) => [...new Set(e)].filter((e) => Re.test(e)).sort().reverse(), Be = (e) => String(e?.settings?.validFrom ?? "").slice(0, 7);
2480
- function Ve(e) {
2575
+ var q = (e) => JSON.parse(JSON.stringify(e)), He = /^\d{4}-\d{2}$/, J = (e) => [...new Set(e)].filter((e) => He.test(e)).sort().reverse(), Ue = (e) => String(e?.settings?.validFrom ?? "").slice(0, 7);
2576
+ function We(e) {
2481
2577
  let t = (e) => `edutalk-promo-tool:month:${e}`, n = "edutalk-promo-tool:months", r = (e) => {
2482
2578
  try {
2483
2579
  let t = localStorage.getItem(e);
@@ -2489,34 +2585,41 @@ function Ve(e) {
2489
2585
  try {
2490
2586
  localStorage.setItem(e, JSON.stringify(t));
2491
2587
  } catch {}
2492
- }, a = () => ze(r(n) ?? []);
2588
+ }, a = () => J(r(n) ?? []);
2493
2589
  if (!a().length) {
2494
- let a = r("edutalk-promo-tool:data") ?? Le(e), o = Be(a);
2495
- Re.test(o) && (i(t(o), a), i(n, [o]));
2590
+ let a = r("edutalk-promo-tool:data") ?? q(e), o = Ue(a);
2591
+ He.test(o) && (i(t(o), a), i(n, [o]));
2496
2592
  }
2497
- return {
2593
+ let o = Ue(e);
2594
+ return He.test(o) && !r(t(o)) && (i(t(o), q(e)), i(n, J([...a(), o]))), {
2498
2595
  kind: "local",
2499
2596
  async listMonths() {
2500
2597
  return a();
2501
2598
  },
2502
- async load(e) {
2503
- return r(t(e));
2599
+ async load(o) {
2600
+ let s = r(t(o));
2601
+ if (s) return s;
2602
+ if (o && o === Ue(e)) {
2603
+ let r = q(e);
2604
+ return i(t(o), r), i(n, J([...a(), o])), r;
2605
+ }
2606
+ return null;
2504
2607
  },
2505
2608
  async save(e, r) {
2506
- i(t(e), r), i(n, ze([...a(), e]));
2609
+ i(t(e), r), i(n, J([...a(), e]));
2507
2610
  },
2508
2611
  async seed() {
2509
- return Le(e);
2612
+ return q(e);
2510
2613
  }
2511
2614
  };
2512
2615
  }
2513
- function He(e, t) {
2616
+ function Ge(e, t) {
2514
2617
  return {
2515
2618
  kind: "supabase",
2516
2619
  async listMonths() {
2517
2620
  let { data: t, error: n } = await e.from("promo_config").select("key");
2518
2621
  if (n) throw n;
2519
- return ze((t ?? []).map((e) => e.key));
2622
+ return J((t ?? []).map((e) => e.key));
2520
2623
  },
2521
2624
  async load(t) {
2522
2625
  let { data: n, error: r } = await e.from("promo_config").select("data").eq("key", t).maybeSingle();
@@ -2531,11 +2634,11 @@ function He(e, t) {
2531
2634
  if (r) throw r;
2532
2635
  },
2533
2636
  async seed() {
2534
- return Le(t);
2637
+ return q(t);
2535
2638
  }
2536
2639
  };
2537
2640
  }
2538
- function Ue(e, t, { headers: n = {} } = {}) {
2641
+ function Ke(e, t, { headers: n = {} } = {}) {
2539
2642
  let r = async (t, r = {}) => fetch(`${e}${t}`, {
2540
2643
  credentials: "include",
2541
2644
  ...r,
@@ -2549,7 +2652,7 @@ function Ue(e, t, { headers: n = {} } = {}) {
2549
2652
  async listMonths() {
2550
2653
  let e = await r("");
2551
2654
  if (!e.ok) throw Error(`Tải danh sách tháng lỗi ${e.status}`);
2552
- return ze(await e.json());
2655
+ return J(await e.json());
2553
2656
  },
2554
2657
  async load(e) {
2555
2658
  let t = await r(`/${e}`);
@@ -2566,12 +2669,12 @@ function Ue(e, t, { headers: n = {} } = {}) {
2566
2669
  if (!n.ok) throw Error(`Lưu dữ liệu lỗi ${n.status}`);
2567
2670
  },
2568
2671
  async seed() {
2569
- return Le(t);
2672
+ return q(t);
2570
2673
  }
2571
2674
  };
2572
2675
  }
2573
2676
  // src/data/seed.js
2574
- var We = {
2677
+ var qe = {
2575
2678
  version: 1,
2576
2679
  settings: {
2577
2680
  campaignName: "Mừng ngày Nhà giáo Việt Nam",
@@ -2661,7 +2764,7 @@ var We = {
2661
2764
  lktGroups: [
2662
2765
  {
2663
2766
  name: "LKT Toàn hệ thống",
2664
- baseProgram: "Định kỳ đặc biệt"
2767
+ baseProgram: "Cấu hình riêng"
2665
2768
  },
2666
2769
  {
2667
2770
  name: "LKT Thấp điểm",
@@ -4180,6 +4283,200 @@ var We = {
4180
4283
  cut: .06
4181
4284
  }
4182
4285
  ],
4286
+ lktBase: [
4287
+ {
4288
+ label: "IELTS Mentor",
4289
+ group: "LKT Toàn hệ thống",
4290
+ method: "Full",
4291
+ term: 0,
4292
+ pct: .4,
4293
+ note: "Khóa lẻ và combo"
4294
+ },
4295
+ {
4296
+ label: "IELTS Mentor",
4297
+ group: "LKT Toàn hệ thống",
4298
+ method: "Giai đoạn",
4299
+ term: 0,
4300
+ pct: .38,
4301
+ note: "Combo từ 2 khóa"
4302
+ },
4303
+ {
4304
+ label: "IELTS Mentor",
4305
+ group: "LKT Toàn hệ thống",
4306
+ method: "Sacombank",
4307
+ term: 6,
4308
+ pct: .37,
4309
+ note: "Combo từ 2 khóa"
4310
+ },
4311
+ {
4312
+ label: "IELTS Mentor",
4313
+ group: "LKT Toàn hệ thống",
4314
+ method: "Sacombank",
4315
+ term: 9,
4316
+ pct: .36,
4317
+ note: "Combo từ 2 khóa"
4318
+ },
4319
+ {
4320
+ label: "IELTS Mentor",
4321
+ group: "LKT Toàn hệ thống",
4322
+ method: "Sacombank",
4323
+ term: 12,
4324
+ pct: .36,
4325
+ note: "Combo từ 2 khóa"
4326
+ },
4327
+ {
4328
+ label: "IELTS Mentor",
4329
+ group: "LKT Toàn hệ thống",
4330
+ method: "Citime",
4331
+ term: 5,
4332
+ pct: .36,
4333
+ note: "Theo Sheet 05"
4334
+ },
4335
+ {
4336
+ label: "IELTS Mentor",
4337
+ group: "LKT Toàn hệ thống",
4338
+ method: "Citime",
4339
+ term: 6,
4340
+ pct: .35,
4341
+ note: "Theo Sheet 05"
4342
+ },
4343
+ {
4344
+ label: "IELTS Mentor",
4345
+ group: "LKT Toàn hệ thống",
4346
+ method: "Citime",
4347
+ term: 8,
4348
+ pct: .34,
4349
+ note: "Theo Sheet 05"
4350
+ },
4351
+ {
4352
+ label: "IELTS Mentor",
4353
+ group: "LKT Toàn hệ thống",
4354
+ method: "Citime",
4355
+ term: 9,
4356
+ pct: .34,
4357
+ note: "Theo Sheet 05"
4358
+ },
4359
+ {
4360
+ label: "IELTS Mentor",
4361
+ group: "LKT Toàn hệ thống",
4362
+ method: "Citime",
4363
+ term: 12,
4364
+ pct: .33,
4365
+ note: "Theo Sheet 05"
4366
+ },
4367
+ {
4368
+ label: "IELTS Mentor",
4369
+ group: "LKT Toàn hệ thống",
4370
+ method: "Citime",
4371
+ term: 15,
4372
+ pct: .33,
4373
+ note: "Theo Sheet 05"
4374
+ },
4375
+ {
4376
+ label: "CLASSUP 1-8",
4377
+ group: "LKT Toàn hệ thống",
4378
+ method: "Full",
4379
+ term: 0,
4380
+ pct: .4,
4381
+ note: "Khóa lẻ và combo"
4382
+ },
4383
+ {
4384
+ label: "CLASSUP 1-8",
4385
+ group: "LKT Toàn hệ thống",
4386
+ method: "Giai đoạn",
4387
+ term: 0,
4388
+ pct: .38,
4389
+ note: "Combo từ 2 khóa"
4390
+ },
4391
+ {
4392
+ label: "CLASSUP 1-8",
4393
+ group: "LKT Toàn hệ thống",
4394
+ method: "Sacombank",
4395
+ term: 6,
4396
+ pct: .37,
4397
+ note: "Combo từ 2 khóa"
4398
+ },
4399
+ {
4400
+ label: "CLASSUP 1-8",
4401
+ group: "LKT Toàn hệ thống",
4402
+ method: "Sacombank",
4403
+ term: 9,
4404
+ pct: .36,
4405
+ note: "Combo từ 2 khóa"
4406
+ },
4407
+ {
4408
+ label: "CLASSUP 1-8",
4409
+ group: "LKT Toàn hệ thống",
4410
+ method: "Sacombank",
4411
+ term: 12,
4412
+ pct: .36,
4413
+ note: "Combo từ 2 khóa"
4414
+ },
4415
+ {
4416
+ label: "CLASSUP 1-8",
4417
+ group: "LKT Toàn hệ thống",
4418
+ method: "Citime",
4419
+ term: 5,
4420
+ pct: .36,
4421
+ note: "Theo Sheet 05"
4422
+ },
4423
+ {
4424
+ label: "CLASSUP 1-8",
4425
+ group: "LKT Toàn hệ thống",
4426
+ method: "Citime",
4427
+ term: 6,
4428
+ pct: .35,
4429
+ note: "Theo Sheet 05"
4430
+ },
4431
+ {
4432
+ label: "CLASSUP 1-8",
4433
+ group: "LKT Toàn hệ thống",
4434
+ method: "Citime",
4435
+ term: 8,
4436
+ pct: .34,
4437
+ note: "Theo Sheet 05"
4438
+ },
4439
+ {
4440
+ label: "CLASSUP 1-8",
4441
+ group: "LKT Toàn hệ thống",
4442
+ method: "Citime",
4443
+ term: 9,
4444
+ pct: .34,
4445
+ note: "Theo Sheet 05"
4446
+ },
4447
+ {
4448
+ label: "CLASSUP 1-8",
4449
+ group: "LKT Toàn hệ thống",
4450
+ method: "Citime",
4451
+ term: 12,
4452
+ pct: .33,
4453
+ note: "Theo Sheet 05"
4454
+ },
4455
+ {
4456
+ label: "CLASSUP 1-8",
4457
+ group: "LKT Toàn hệ thống",
4458
+ method: "Citime",
4459
+ term: 15,
4460
+ pct: .33,
4461
+ note: "Theo Sheet 05"
4462
+ },
4463
+ {
4464
+ label: "CLASSUP 1-1",
4465
+ group: "LKT Toàn hệ thống",
4466
+ method: "Full",
4467
+ term: 0,
4468
+ pct: .3,
4469
+ note: "Khóa lẻ và combo"
4470
+ },
4471
+ {
4472
+ label: "CLASSUP 1-1",
4473
+ group: "LKT Toàn hệ thống",
4474
+ method: "Giai đoạn",
4475
+ term: 0,
4476
+ pct: .27,
4477
+ note: "Combo từ 2 khóa"
4478
+ }
4479
+ ],
4183
4480
  extended: [
4184
4481
  {
4185
4482
  label: "IELTS Mentor",
@@ -7681,23 +7978,23 @@ var We = {
7681
7978
  ]
7682
7979
  }
7683
7980
  ]
7684
- }, Ge = (e) => JSON.parse(JSON.stringify(e)), Y = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => ({
7981
+ }, Je = (e) => JSON.parse(JSON.stringify(e)), Y = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => ({
7685
7982
  "&": "&amp;",
7686
7983
  "<": "&lt;",
7687
7984
  ">": "&gt;",
7688
7985
  "\"": "&quot;",
7689
7986
  "'": "&#39;"
7690
- })[e]), X = (e) => `${Math.round(Number(e) || 0).toLocaleString("vi-VN")}đ`, Z = (e) => `${+(Number(e || 0) * 100).toFixed(2)}%`, Ke = (e) => e ? e.split("-").reverse().join("/") : "", Q = (e, t) => String(e ?? "").trim().toLowerCase() === String(t ?? "").trim().toLowerCase(), qe = () => {
7987
+ })[e]), X = (e) => `${Math.round(Number(e) || 0).toLocaleString("vi-VN")}đ`, Z = (e) => `${+(Number(e || 0) * 100).toFixed(2)}%`, Ye = (e) => e ? e.split("-").reverse().join("/") : "", Q = (e, t) => String(e ?? "").trim().toLowerCase() === String(t ?? "").trim().toLowerCase(), Xe = () => {
7691
7988
  let e = /* @__PURE__ */ new Date();
7692
7989
  return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`;
7693
7990
  }, $ = (e) => {
7694
7991
  let [t, n] = String(e).split("-");
7695
7992
  return `Tháng ${Number(n)}/${t}`;
7696
- }, Je = (e) => {
7993
+ }, Ze = (e) => {
7697
7994
  let [t, n] = e.split("-").map(Number);
7698
7995
  return [`${e}-01`, `${e}-${String(new Date(t, n, 0).getDate()).padStart(2, "0")}`];
7699
7996
  };
7700
- function Ye(e) {
7997
+ function Qe(e) {
7701
7998
  if (!e) throw Error("Cần truyền lớp lưu trữ dữ liệu (store)");
7702
7999
  return {
7703
8000
  ...e,
@@ -7706,7 +8003,7 @@ function Ye(e) {
7706
8003
  let t = await e.listMonths();
7707
8004
  if (Array.isArray(t) && t.length) return t;
7708
8005
  }
7709
- return [qe()];
8006
+ return [Xe()];
7710
8007
  },
7711
8008
  async load(t) {
7712
8009
  if (typeof e.load == "function") {
@@ -7720,17 +8017,17 @@ function Ye(e) {
7720
8017
  if (typeof e.save == "function") return e.save.length === 1 ? await e.save(n) : await e.save(t, n);
7721
8018
  },
7722
8019
  async seed() {
7723
- return typeof e.seed == "function" ? await e.seed() : typeof e.reset == "function" ? await e.reset() : Ge(We);
8020
+ return typeof e.seed == "function" ? await e.seed() : typeof e.reset == "function" ? await e.reset() : Je(qe);
7724
8021
  }
7725
8022
  };
7726
8023
  }
7727
- async function Xe(e, t = {}) {
8024
+ async function $e(e, t = {}) {
7728
8025
  if (!e) throw Error("Cần truyền phần tử DOM để gắn công cụ");
7729
- let n = Ye(t.store), { allowRoleSwitch: r = !1, user: i = null, preview: a = !1 } = t, o = !!a, s = (e) => o ? !0 : confirm(e), c = /* @__PURE__ */ new Map();
8026
+ let n = Qe(t.store), { allowRoleSwitch: r = !1, user: i = null, preview: a = !1 } = t, o = !!a, s = (e) => o ? !0 : confirm(e), c = /* @__PURE__ */ new Map();
7730
8027
  async function l(e) {
7731
8028
  if (!c.has(e)) {
7732
8029
  let t = await n.load(e);
7733
- c.set(e, t ? C(t) : null);
8030
+ c.set(e, t ? E(t) : null);
7734
8031
  }
7735
8032
  return c.get(e);
7736
8033
  }
@@ -7738,7 +8035,7 @@ async function Xe(e, t = {}) {
7738
8035
  role: t.role === "admin" ? "admin" : "sale",
7739
8036
  view: "calc",
7740
8037
  months: await n.listMonths(),
7741
- month: qe(),
8038
+ month: Xe(),
7742
8039
  data: null,
7743
8040
  calc: null,
7744
8041
  table: null,
@@ -7757,16 +8054,16 @@ async function Xe(e, t = {}) {
7757
8054
  };
7758
8055
  u.data = await l(u.month), u.admin.month = u.months.includes(u.month) ? u.month : u.months[0] ?? u.month, await l(u.admin.month);
7759
8056
  let d = () => {
7760
- u.calc = y(u.data), u.table = {
7761
- ...y(u.data),
8057
+ u.calc = h(u.data), u.table = {
8058
+ ...h(u.data),
7762
8059
  output: ""
7763
8060
  };
7764
8061
  };
7765
8062
  d(), u.pdf = {
7766
- ...y(u.data),
8063
+ ...h(u.data),
7767
8064
  month: u.month,
7768
8065
  title: "",
7769
- sections: le.map((e) => e.id),
8066
+ sections: pe.map((e) => e.id),
7770
8067
  outputs: [],
7771
8068
  scenarios: []
7772
8069
  }, e.classList.add("pt-root"), e.innerHTML = "";
@@ -7795,11 +8092,11 @@ async function Xe(e, t = {}) {
7795
8092
  "Quản trị dữ liệu gốc"
7796
8093
  ]] : []
7797
8094
  ];
7798
- u.view === "admin" && u.role !== "admin" && (u.view = "calc"), f.className = "pt-band", f.innerHTML = e.map(([e, t, n]) => `<button class="pt-tab ${u.view === e ? "is-active" : ""}" data-act="view" data-v="${e}">${k(t)}${n}</button>`).join("") + "<span class=\"pt-band-spacer\"></span>" + (r ? `<div class="pt-role" title="Chỉ có ở bản demo — trên portal vai trò lấy từ tài khoản đăng nhập">
8095
+ u.view === "admin" && u.role !== "admin" && (u.view = "calc"), f.className = "pt-band", f.innerHTML = e.map(([e, t, n]) => `<button class="pt-tab ${u.view === e ? "is-active" : ""}" data-act="view" data-v="${e}">${A(t)}${n}</button>`).join("") + "<span class=\"pt-band-spacer\"></span>" + (r ? `<div class="pt-role" title="Chỉ có ở bản demo — trên portal vai trò lấy từ tài khoản đăng nhập">
7799
8096
  <button class="${u.role === "sale" ? "is-active" : ""}" data-act="role" data-v="sale">Sale / TVV</button>
7800
- <button class="${u.role === "admin" ? "is-active" : ""}" data-act="role" data-v="admin">Admin</button></div>` : ""), p.innerHTML = `<div class="pt-container">${u.view === "pdf" ? F() : u.view === "admin" ? ue() : u.data ? u.view === "calc" ? re() : N() : A()}</div>`, u.view === "admin" && U(), u.view === "pdf" && L();
8097
+ <button class="${u.role === "admin" ? "is-active" : ""}" data-act="role" data-v="admin">Admin</button></div>` : ""), p.innerHTML = `<div class="pt-container">${u.view === "pdf" ? oe() : u.view === "admin" ? z() : u.data ? u.view === "calc" ? re() : ae() : ne()}</div>`, u.view === "admin" && V(), u.view === "pdf" && ue();
7801
8098
  }
7802
- function y(e) {
8099
+ function h(e) {
7803
8100
  return e ? {
7804
8101
  label: e.settings.labels[0]?.name ?? "",
7805
8102
  program: e.settings.programs[0]?.name ?? "",
@@ -7820,64 +8117,64 @@ async function Xe(e, t = {}) {
7820
8117
  selected: {}
7821
8118
  };
7822
8119
  }
7823
- let b = (e) => ({
8120
+ let g = (e) => ({
7824
8121
  ...e,
7825
8122
  items: u.data.settings.courseCodes.slice().sort((e, t) => e.order - t.order).filter((t) => e.selected[t.code]).map((t) => ({
7826
8123
  code: t.code,
7827
8124
  mode: e.selected[t.code]
7828
8125
  }))
7829
8126
  });
7830
- function w({ ic: e, title: t, sub: n, actions: r = "", stats: i = "" }) {
8127
+ function x({ ic: e, title: t, sub: n, actions: r = "", stats: i = "" }) {
7831
8128
  return `<div class="pt-page-head">
7832
8129
  <div class="pt-title-row">
7833
- <div class="pt-title-icon">${k(e, 20)}</div>
8130
+ <div class="pt-title-icon">${A(e, 20)}</div>
7834
8131
  <div><h2 class="pt-title">${t}</h2><p class="pt-sub">${n}</p></div>
7835
8132
  <div class="pt-title-actions">${r}</div>
7836
8133
  </div>
7837
8134
  ${i ? `<div class="pt-stats">${i}</div>` : ""}
7838
8135
  </div>`;
7839
8136
  }
7840
- let T = (e, t, n, r, i = !1) => `<div class="pt-stat pt-stat--${e}"><div style="min-width:0"><div class="pt-stat-label">${t}</div>
7841
- <div class="pt-stat-value ${i ? "is-small" : ""}">${n}</div></div><div class="pt-stat-icon">${k(r)}</div></div>`, D = (e, t, n, { disabled: r = () => !1, hint: i = () => "", fmt: a = (e) => e } = {}) => `<div class="pt-chips">${t.map((t) => {
8137
+ let S = (e, t, n, r, i = !1) => `<div class="pt-stat pt-stat--${e}"><div style="min-width:0"><div class="pt-stat-label">${t}</div>
8138
+ <div class="pt-stat-value ${i ? "is-small" : ""}">${n}</div></div><div class="pt-stat-icon">${A(r)}</div></div>`, T = (e, t, n, { disabled: r = () => !1, hint: i = () => "", fmt: a = (e) => e } = {}) => `<div class="pt-chips">${t.map((t) => {
7842
8139
  let o = r(t), s = i(t);
7843
8140
  return `<button class="pt-chip ${Q(t, n) ? "is-active" : ""}" data-act="calc" data-f="${e}" data-v="${Y(t)}" ${o ? "disabled" : ""}
7844
8141
  ${o && typeof o == "string" ? `title="${Y(o)}"` : ""}>${Y(a(t))}${s ? ` <small>${Y(s)}</small>` : ""}</button>`;
7845
8142
  }).join("")}</div>`;
7846
- function O() {
7847
- return `<select class="pt-select" style="height:36px;width:150px" data-act="view-month" title="Tháng chương trình">${[.../* @__PURE__ */ new Set([qe(), ...u.months])].sort().reverse().map((e) => `<option value="${e}" ${e === u.month ? "selected" : ""}>${$(e)}${u.months.includes(e) ? "" : " (trống)"}</option>`).join("")}</select>`;
8143
+ function te() {
8144
+ return `<select class="pt-select" style="height:36px;width:150px" data-act="view-month" title="Tháng chương trình">${[.../* @__PURE__ */ new Set([Xe(), ...u.months])].sort().reverse().map((e) => `<option value="${e}" ${e === u.month ? "selected" : ""}>${$(e)}${u.months.includes(e) ? "" : " (trống)"}</option>`).join("")}</select>`;
7848
8145
  }
7849
- function A() {
7850
- return w({
8146
+ function ne() {
8147
+ return x({
7851
8148
  ic: "calendar",
7852
8149
  title: `Chương trình khuyến mại ${$(u.month).toLowerCase()}`,
7853
8150
  sub: "Chưa có dữ liệu",
7854
- actions: O()
8151
+ actions: te()
7855
8152
  }) + `<div class="pt-section"><div class="pt-empty" style="padding:56px 24px">
7856
8153
  <div style="font-size:16px;font-weight:600;color:var(--pt-ink);margin-bottom:6px">Chưa có chương trình khuyến mại ${$(u.month).toLowerCase()}</div>
7857
8154
  Admin chưa cập nhật chương trình cho tháng này. Bạn có thể chọn xem lại các tháng trước ở ô chọn tháng phía trên.
7858
- ${u.role === "admin" ? `<div style="margin-top:16px"><button class="pt-btn pt-btn--primary" data-act="goto-create" data-v="${u.month}">${k("plus", 16)}Tạo chương trình ${$(u.month).toLowerCase()}</button></div>` : ""}
8155
+ ${u.role === "admin" ? `<div style="margin-top:16px"><button class="pt-btn pt-btn--primary" data-act="goto-create" data-v="${u.month}">${A("plus", 16)}Tạo chương trình ${$(u.month).toLowerCase()}</button></div>` : ""}
7859
8156
  </div></div>`;
7860
8157
  }
7861
8158
  function re() {
7862
- let e = u.data, t = u.calc, n = E(e, b(t)), r = e.settings, i = h(e, t.program), a = r.labels.find((e) => Q(e.name, t.label)), o = _(e, t.method), s = ee(e, t.method), c = g(e, t.method), l = n.discountAmt + n.cashback + n.voucherTotal, d = v(e, t.label), f = e.routes.filter((e) => Q(e.label, t.label)), p = T("grey", "Tổng giá gốc", X(n.gross), "tag") + T("white", `Tổng ưu đãi ${n.pct ? `(${Z(n.pct)})` : ""}`, l ? `-${X(l)}` : "0đ", "percent") + T(n.ok ? "green" : "purple", "Học phí cuối cùng", n.count ? X(n.final) : "—", "wallet") + T(n.ok ? "green" : "red", "Trạng thái", n.ok ? "Hợp lệ" : Y(n.status), n.ok ? "checkCircle" : "alert", !n.ok), m = `<div class="pt-form">
7863
- <div class="pt-form-row"><div class="pt-label">Nhãn</div>${D("label", r.labels.map((e) => e.name), t.label)}</div>
7864
- <div class="pt-form-row"><div class="pt-label">Chương trình</div>${D("program", r.programs.map((e) => e.name), t.program)}</div>
7865
- ${i?.type === "LKT" ? `<div class="pt-form-row"><div class="pt-label">Nhóm LKT<small>${n.lkt?.baseProgram ? `Theo chương trình ${Y(n.lkt.baseProgram)}` : ""}</small></div>${S(e, t.label).length ? D("lktGroup", S(e, t.label).map((e) => e.name), t.lktGroup) : "<span class=\"pt-section-sub\">Nhãn này chưa có chính sách liên kết trường</span>"}</div>
7866
- ${t.lktGroup ? `<div class="pt-form-row"><div class="pt-label">Format LKT</div>${D("lktFormat", x(e, t.label, t.lktGroup).map((e) => e.format), t.lktFormat, { hint: (n) => {
7867
- let r = x(e, t.label, t.lktGroup).find((e) => Q(e.format, n))?.cut;
8159
+ let e = u.data, t = u.calc, n = D(e, g(t)), r = e.settings, i = _(e, t.program), a = r.labels.find((e) => Q(e.name, t.label)), o = y(e, t.method), s = ee(e, t.method), c = v(e, t.method), l = n.discountAmt + n.cashback + n.voucherTotal, d = b(e, t.label), f = e.routes.filter((e) => Q(e.label, t.label)), p = S("grey", "Tổng giá gốc", X(n.gross), "tag") + S("white", `Tổng ưu đãi ${n.pct ? `(${Z(n.pct)})` : ""}`, l ? `-${X(l)}` : "0đ", "percent") + S(n.ok ? "green" : "purple", "Học phí cuối cùng", n.count ? X(n.final) : "—", "wallet") + S(n.ok ? "green" : "red", "Trạng thái", n.ok ? "Hợp lệ" : Y(n.status), n.ok ? "checkCircle" : "alert", !n.ok), m = `<div class="pt-form">
8160
+ <div class="pt-form-row"><div class="pt-label">Nhãn</div>${T("label", r.labels.map((e) => e.name), t.label)}</div>
8161
+ <div class="pt-form-row"><div class="pt-label">Chương trình</div>${T("program", r.programs.map((e) => e.name), t.program)}</div>
8162
+ ${i?.type === "LKT" ? `<div class="pt-form-row"><div class="pt-label">Nhóm LKT<small>${n.lkt?.isCustom ? "Cấu hình % nền riêng" : n.lkt?.baseProgram ? `Theo chương trình ${Y(n.lkt.baseProgram)}` : ""}</small></div>${w(e, t.label).length ? T("lktGroup", w(e, t.label).map((e) => e.name), t.lktGroup) : "<span class=\"pt-section-sub\">Nhãn này chưa có chính sách liên kết trường</span>"}</div>
8163
+ ${t.lktGroup ? `<div class="pt-form-row"><div class="pt-label">Format LKT</div>${T("lktFormat", C(e, t.label, t.lktGroup).map((e) => e.format), t.lktFormat, { hint: (n) => {
8164
+ let r = C(e, t.label, t.lktGroup).find((e) => Q(e.format, n))?.cut;
7868
8165
  return r ? `-${Z(r)}` : "";
7869
8166
  } })}</div>` : ""}` : ""}
7870
- <div class="pt-form-row"><div class="pt-label">Hình thức thanh toán</div>${D("method", r.paymentMethods.map((e) => e.name), t.method, { disabled: (e) => a?.blockedMethods?.some((t) => Q(t, e)) ? `${t.label} không áp dụng ${e}` : !1 })}</div>
7871
- <div class="pt-form-row"><div class="pt-label">Kỳ hạn<small>${c?.citime && n.combo.citimeMax ? `Tối đa ${n.combo.citimeMax} tháng` : ""}</small></div>${s ? "<div class=\"pt-chips\"><span class=\"pt-chip is-active\">Không kỳ hạn</span></div>" : D("term", o.map(String), String(t.term), {
8167
+ <div class="pt-form-row"><div class="pt-label">Hình thức thanh toán</div>${T("method", r.paymentMethods.map((e) => e.name), t.method, { disabled: (e) => a?.blockedMethods?.some((t) => Q(t, e)) ? `${t.label} không áp dụng ${e}` : !1 })}</div>
8168
+ <div class="pt-form-row"><div class="pt-label">Kỳ hạn<small>${c?.citime && n.combo.citimeMax ? `Tối đa ${n.combo.citimeMax} tháng` : ""}</small></div>${s ? "<div class=\"pt-chips\"><span class=\"pt-chip is-active\">Không kỳ hạn</span></div>" : T("term", o.map(String), String(t.term), {
7872
8169
  fmt: (e) => `${e} tháng`,
7873
8170
  disabled: (e) => c?.citime && n.combo.citimeMax != null && Number(e) > n.combo.citimeMax ? "Vượt kỳ hạn Citime tối đa của lộ trình" : !1
7874
8171
  })}</div>
7875
- <div class="pt-form-row"><div class="pt-label">Gói bảo hành</div>${D("warranty", e.warranty.map((e) => e.name), t.warranty, { hint: (t) => {
8172
+ <div class="pt-form-row"><div class="pt-label">Gói bảo hành</div>${T("warranty", e.warranty.map((e) => e.name), t.warranty, { hint: (t) => {
7876
8173
  let n = e.warranty.find((e) => Q(e.name, t))?.rate;
7877
8174
  return n ? `+${Z(n)}` : "";
7878
8175
  } })}</div>
7879
- </div>`, y = d.map((n) => {
7880
- let r = !!t.selected[n.code], i = t.selected[n.code] ?? n.modes[0], a = E(e, {
8176
+ </div>`, h = d.map((n) => {
8177
+ let r = !!t.selected[n.code], i = t.selected[n.code] ?? n.modes[0], a = D(e, {
7881
8178
  ...t,
7882
8179
  items: [{
7883
8180
  code: n.code,
@@ -7885,49 +8182,49 @@ async function Xe(e, t = {}) {
7885
8182
  }]
7886
8183
  }).lines[0];
7887
8184
  return `<div class="pt-course ${r ? "is-on" : ""}" data-act="toggle" data-code="${Y(n.code)}" role="checkbox" aria-checked="${r}" tabindex="0">
7888
- <div class="pt-course-top"><span class="pt-check">${r ? k("check", 14) : ""}</span>
8185
+ <div class="pt-course-top"><span class="pt-check">${r ? A("check", 14) : ""}</span>
7889
8186
  <div style="min-width:0"><div class="pt-course-name">${Y(n.name)}</div><div class="pt-course-code">${Y(n.code)}</div></div></div>
7890
8187
  ${n.modes.length > 1 ? `<div class="pt-seg">${n.modes.map((e) => `<button class="${Q(e, i) ? "is-active" : ""}" data-act="mode" data-code="${Y(n.code)}" data-v="${Y(e)}">${Y(e)}</button>`).join("")}</div>` : `<span class="pt-seg-single">${Y(n.modes[0])}</span>`}
7891
8188
  <div class="pt-course-price"><span>Giá gốc <b>${X(a?.price)}</b></span>${a?.voucher ? `<span>VC -${X(a.voucher)}</span>` : ""}</div>
7892
8189
  </div>`;
7893
- }).join(""), C = n.lines.map((e) => `<tr><td>${Y(e.name)} <span style="color:var(--pt-faint)">· ${Y(e.mode)}</span></td><td>${X(e.price)}</td></tr>`).join(""), te = `<div class="pt-section pt-result">
7894
- <div class="pt-section-head"><div class="pt-section-icon">${k("calc", 16)}</div>
8190
+ }).join(""), E = n.lines.map((e) => `<tr><td>${Y(e.name)} <span style="color:var(--pt-faint)">· ${Y(e.mode)}</span></td><td>${X(e.price)}</td></tr>`).join(""), ne = `<div class="pt-section pt-result">
8191
+ <div class="pt-section-head"><div class="pt-section-icon">${A("calc", 16)}</div>
7895
8192
  <div><div class="pt-section-title">Kết quả báo giá</div><div class="pt-section-sub">${n.count} khóa · ${Y(t.program)} · ${Y(t.method)}${t.term ? ` ${t.term} tháng` : ""}</div></div></div>
7896
8193
  <div class="pt-section-body">
7897
- <div class="pt-status ${n.ok ? "is-ok" : "is-bad"}">${k(n.ok ? "checkCircle" : "alert", 16)}${n.ok ? "Báo giá hợp lệ" : Y(n.status)}</div>
7898
- ${C ? `<table class="pt-lines">${C}</table>` : ""}
8194
+ <div class="pt-status ${n.ok ? "is-ok" : "is-bad"}">${A(n.ok ? "checkCircle" : "alert", 16)}${n.ok ? "Báo giá hợp lệ" : Y(n.status)}</div>
8195
+ ${E ? `<table class="pt-lines">${E}</table>` : ""}
7899
8196
  <ul class="pt-rows">
7900
8197
  <li><span>Tổng giá gốc</span><b>${X(n.gross)}</b></li>
7901
- <li class="is-minus"><span>Ưu đãi ${Z(n.pct)}${n.lkt?.cut != null && n.lkt.baseFound ? `<br><small style="color:var(--pt-faint)">${Y(n.lkt.baseProgram)} ${Z(n.lkt.basePct)} − cắt ${Y(t.lktFormat)} ${Z(n.lkt.cut)}</small>` : ""}</span><b>-${X(n.discountAmt)}</b></li>
8198
+ <li class="is-minus"><span>Ưu đãi ${Z(n.pct)}${n.lkt?.cut != null && n.lkt.baseFound ? `<br><small style="color:var(--pt-faint)">${Y(n.lkt.isCustom ? "Cấu hình riêng" : n.lkt.baseProgram)} ${Z(n.lkt.basePct)} − cắt ${Y(t.lktFormat)} ${Z(n.lkt.cut)}</small>` : ""}</span><b>-${X(n.discountAmt)}</b></li>
7902
8199
  ${n.cashback ? `<li class="is-minus"><span>Hoàn tiền (Định kỳ)</span><b>-${X(n.cashback)}</b></li>` : ""}
7903
8200
  <li class="is-minus"><span>Voucher đặc biệt</span><b>-${X(n.voucherTotal)}</b></li>
7904
8201
  <li><span>Giá sau khuyến mại</span><b>${X(n.afterPromo)}</b></li>
7905
8202
  <li class="is-plus"><span>Bảo hành ${Y(t.warranty)} (${Z(n.warrantyRate)} × ${X(n.warrantyBase)})</span><b>+${X(n.warrantyFee)}</b></li>
7906
8203
  </ul>
7907
8204
  <div class="pt-final ${n.ok ? "" : "is-dim"}"><small>HỌC PHÍ CUỐI CÙNG</small><div>${n.count ? X(n.final) : "—"}</div></div>
7908
- ${n.gift ? `<div class="pt-gift">${k("gift", 18)}<div><b>Quà tặng:</b> ${Y(n.gift.content)}</div></div>` : ""}
8205
+ ${n.gift ? `<div class="pt-gift">${A("gift", 18)}<div><b>Quà tặng:</b> ${Y(n.gift.content)}</div></div>` : ""}
7909
8206
  ${n.combo.code ? `<div class="pt-combo">Mã lộ trình: <b>${Y(n.combo.code)}</b>${n.combo.routeName ? ` · ${Y(n.combo.group)}` : ""}<br>
7910
8207
  Citime: <b>${Y(n.combo.citimeStatus)}</b>${n.combo.citimeMax ? ` · tối đa ${n.combo.citimeMax} tháng` : ""}</div>` : ""}
7911
8208
  <div style="display:flex;gap:8px;margin-top:14px">
7912
- <button class="pt-btn pt-btn--primary" style="flex:1;justify-content:center" data-act="copy" ${n.count ? "" : "disabled"}>${k("copy", 16)}Sao chép báo giá</button>
7913
- <button class="pt-btn pt-btn--ghost" data-act="reset-calc" title="Làm mới">${k("refresh", 16)}</button>
8209
+ <button class="pt-btn pt-btn--primary" style="flex:1;justify-content:center" data-act="copy" ${n.count ? "" : "disabled"}>${A("copy", 16)}Sao chép báo giá</button>
8210
+ <button class="pt-btn pt-btn--ghost" data-act="reset-calc" title="Làm mới">${A("refresh", 16)}</button>
7914
8211
  </div>
7915
8212
  </div></div>`;
7916
- return w({
8213
+ return x({
7917
8214
  ic: "calc",
7918
8215
  title: "Tính giá khuyến mại",
7919
- actions: O(),
7920
- sub: `${Y(r.campaignName)} · Áp dụng ${Ke(r.validFrom)} – ${Ke(r.validTo)}`,
8216
+ actions: te(),
8217
+ sub: `${Y(r.campaignName)} · Áp dụng ${Ye(r.validFrom)} – ${Ye(r.validTo)}`,
7921
8218
  stats: p
7922
8219
  }) + `<div class="pt-grid pt-grid-calc" style="margin-top:14px">
7923
8220
  <div>
7924
8221
  <div class="pt-section" style="margin-top:0">
7925
- <div class="pt-section-head"><div class="pt-section-icon">${k("filter", 16)}</div>
8222
+ <div class="pt-section-head"><div class="pt-section-icon">${A("filter", 16)}</div>
7926
8223
  <div><div class="pt-section-title">Thông tin chung</div><div class="pt-section-sub">Bấm chọn — kết quả tự cập nhật</div></div></div>
7927
8224
  <div class="pt-section-body">${m}</div>
7928
8225
  </div>
7929
8226
  <div class="pt-section">
7930
- <div class="pt-section-head"><div class="pt-section-icon">${k("book", 16)}</div>
8227
+ <div class="pt-section-head"><div class="pt-section-icon">${A("book", 16)}</div>
7931
8228
  <div><div class="pt-section-title">Khóa học đăng ký</div><div class="pt-section-sub">Tích chọn khóa và hình thức học · ${Y(r.note ?? "")}</div></div>
7932
8229
  <div class="pt-section-actions">
7933
8230
  <select class="pt-select" style="height:34px;max-width:260px" data-act="pick-route">
@@ -7936,15 +8233,15 @@ async function Xe(e, t = {}) {
7936
8233
  </select>
7937
8234
  <button class="pt-btn pt-btn--link" data-act="clear-courses">Bỏ chọn</button>
7938
8235
  </div></div>
7939
- <div class="pt-section-body"><div class="pt-courses">${y || "<div class=\"pt-empty\">Nhãn này chưa có khóa học</div>"}</div></div>
8236
+ <div class="pt-section-body"><div class="pt-courses">${h || "<div class=\"pt-empty\">Nhãn này chưa có khóa học</div>"}</div></div>
7940
8237
  </div>
7941
8238
  </div>
7942
- ${te}
8239
+ ${ne}
7943
8240
  </div>`;
7944
8241
  }
7945
- function j(e, t, n, r = u.data) {
8242
+ function ie(e, t, n, r = u.data) {
7946
8243
  if (t === "term" && (n = Number(n)), e[t] = n, t === "label") {
7947
- let t = v(r, n);
8244
+ let t = b(r, n);
7948
8245
  for (let n of Object.keys(e.selected)) {
7949
8246
  let r = t.find((e) => Q(e.code, n));
7950
8247
  r ? r.modes.some((t) => Q(t, e.selected[n])) || (e.selected[n] = r.modes[0]) : delete e.selected[n];
@@ -7953,24 +8250,24 @@ async function Xe(e, t = {}) {
7953
8250
  i.some((t) => Q(t, e.method)) && (e.method = r.settings.paymentMethods.find((e) => !i.some((t) => Q(t, e.name)))?.name ?? "");
7954
8251
  }
7955
8252
  if (t === "method" || t === "label") {
7956
- let t = _(r, e.method).map(Number);
8253
+ let t = y(r, e.method).map(Number);
7957
8254
  t.includes(Number(e.term)) || (e.term = t[0] ?? 0);
7958
8255
  }
7959
8256
  if ([
7960
8257
  "label",
7961
8258
  "program",
7962
8259
  "lktGroup"
7963
- ].includes(t) && h(r, e.program)?.type === "LKT") {
7964
- let t = S(r, e.label);
8260
+ ].includes(t) && _(r, e.program)?.type === "LKT") {
8261
+ let t = w(r, e.label);
7965
8262
  t.some((t) => Q(t.name, e.lktGroup)) || (e.lktGroup = t[0]?.name ?? "");
7966
- let n = x(r, e.label, e.lktGroup);
8263
+ let n = C(r, e.label, e.lktGroup);
7967
8264
  n.some((t) => Q(t.format, e.lktFormat)) || (e.lktFormat = n[0]?.format ?? "");
7968
8265
  }
7969
8266
  }
7970
- function ie() {
7971
- let e = u.calc, t = E(u.data, b(e)), n = [
8267
+ function j() {
8268
+ let e = u.calc, t = D(u.data, g(e)), n = [
7972
8269
  `BÁO GIÁ HỌC PHÍ – ${e.label.toUpperCase()}`,
7973
- `Chương trình: ${e.program}${h(u.data, e.program)?.type === "LKT" ? ` (${[e.lktGroup, e.lktFormat].filter(Boolean).join(" – ")})` : ""}`,
8270
+ `Chương trình: ${e.program}${_(u.data, e.program)?.type === "LKT" ? ` (${[e.lktGroup, e.lktFormat].filter(Boolean).join(" – ")})` : ""}`,
7974
8271
  `Thanh toán: ${e.method}${e.term ? ` – ${e.term} tháng` : ""}`,
7975
8272
  "Khóa học:",
7976
8273
  ...t.lines.map((e) => ` • ${e.name} (${e.mode}): ${X(e.price)}`),
@@ -7981,23 +8278,23 @@ async function Xe(e, t = {}) {
7981
8278
  ...t.warrantyFee ? [`Bảo hành ${e.warranty}: +${X(t.warrantyFee)}`] : [],
7982
8279
  `HỌC PHÍ CUỐI CÙNG: ${X(t.final)}`,
7983
8280
  ...t.gift ? [`Quà tặng: ${t.gift.content}`] : [],
7984
- `(${u.data.settings.campaignName}, áp dụng đến ${Ke(u.data.settings.validTo)})`
8281
+ `(${u.data.settings.campaignName}, áp dụng đến ${Ye(u.data.settings.validTo)})`
7985
8282
  ];
7986
8283
  return t.ok || n.unshift(`⚠ CHƯA HỢP LỆ: ${t.status}`), n.join("\n");
7987
8284
  }
7988
- function N() {
7989
- let e = u.data, t = u.table, n = [...new Set(e.routes.filter((e) => Q(e.label, t.label)).map((e) => e.output).filter(Boolean))], r = te(e, t), i = r.filter((e) => e.quote.ok), a = i.length ? i.reduce((e, t) => e + t.quote.pct, 0) / i.length : 0, o = h(e, t.program), s = (e, t, n, r = (e) => e, i = null) => `<select class="pt-select" data-act="tbl" data-f="${e}">${i == null ? "" : `<option value="">${i}</option>`}${t.map((e) => `<option value="${Y(e)}" ${Q(e, n) ? "selected" : ""}>${Y(r(e))}</option>`).join("")}</select>`, c = `<div class="pt-section">
7990
- <div class="pt-section-head no-line"><div class="pt-section-icon">${k("filter", 16)}</div>
8285
+ function ae() {
8286
+ let e = u.data, t = u.table, n = [...new Set(e.routes.filter((e) => Q(e.label, t.label)).map((e) => e.output).filter(Boolean))], r = O(e, t), i = r.filter((e) => e.quote.ok), a = i.length ? i.reduce((e, t) => e + t.quote.pct, 0) / i.length : 0, o = _(e, t.program), s = (e, t, n, r = (e) => e, i = null) => `<select class="pt-select" data-act="tbl" data-f="${e}">${i == null ? "" : `<option value="">${i}</option>`}${t.map((e) => `<option value="${Y(e)}" ${Q(e, n) ? "selected" : ""}>${Y(r(e))}</option>`).join("")}</select>`, c = `<div class="pt-section">
8287
+ <div class="pt-section-head no-line"><div class="pt-section-icon">${A("filter", 16)}</div>
7991
8288
  <div><div class="pt-section-title">Bộ lọc thông minh</div><div class="pt-section-sub">Bảng giá tự tính lại từ dữ liệu gốc khi đổi bộ lọc</div></div>
7992
- <div class="pt-section-actions"><button class="pt-btn pt-btn--link" data-act="tbl-reset">${k("filter", 14)}Xóa bộ lọc</button></div></div>
8289
+ <div class="pt-section-actions"><button class="pt-btn pt-btn--link" data-act="tbl-reset">${A("filter", 14)}Xóa bộ lọc</button></div></div>
7993
8290
  <div class="pt-section-body"><div class="pt-grid pt-grid-3">
7994
8291
  <div class="pt-field"><label>Nhãn</label>${s("label", e.settings.labels.map((e) => e.name), t.label)}</div>
7995
8292
  <div class="pt-field"><label>Đầu ra</label>${s("output", n, t.output, (e) => e, "Tất cả đầu ra")}</div>
7996
8293
  <div class="pt-field"><label>Chương trình</label>${s("program", e.settings.programs.map((e) => e.name), t.program)}</div>
7997
- ${o?.type === "LKT" ? `<div class="pt-field"><label>Nhóm LKT</label>${s("lktGroup", S(e, t.label).map((e) => e.name), t.lktGroup, (e) => e, "Chọn nhóm")}</div>
7998
- <div class="pt-field"><label>Format LKT</label>${s("lktFormat", x(e, t.label, t.lktGroup).map((e) => e.format), t.lktFormat, (e) => e, "Chọn format")}</div>` : ""}
8294
+ ${o?.type === "LKT" ? `<div class="pt-field"><label>Nhóm LKT</label>${s("lktGroup", w(e, t.label).map((e) => e.name), t.lktGroup, (e) => e, "Chọn nhóm")}</div>
8295
+ <div class="pt-field"><label>Format LKT</label>${s("lktFormat", C(e, t.label, t.lktGroup).map((e) => e.format), t.lktFormat, (e) => e, "Chọn format")}</div>` : ""}
7999
8296
  <div class="pt-field"><label>Hình thức thanh toán</label>${s("method", e.settings.paymentMethods.map((e) => e.name), t.method)}</div>
8000
- <div class="pt-field"><label>Kỳ hạn</label>${s("term", _(e, t.method).map(String), String(t.term), (e) => Number(e) ? `${e} tháng` : "Không kỳ hạn")}</div>
8297
+ <div class="pt-field"><label>Kỳ hạn</label>${s("term", y(e, t.method).map(String), String(t.term), (e) => Number(e) ? `${e} tháng` : "Không kỳ hạn")}</div>
8001
8298
  <div class="pt-field"><label>Gói bảo hành</label>${s("warranty", e.warranty.map((e) => e.name), t.warranty)}</div>
8002
8299
  </div></div></div>`, l = r.map(({ route: e, quote: t }) => `<tr>
8003
8300
  <td><div style="font-weight:500">${Y(e.name)}</div><div class="muted">${Y(e.code)}</div></td>
@@ -8009,14 +8306,14 @@ async function Xe(e, t = {}) {
8009
8306
  <td class="num"><b>${t.ok ? X(t.final) : "—"}</b></td>
8010
8307
  <td class="muted">${t.ok && t.gift ? Y(t.gift.content) : ""}</td>
8011
8308
  <td>${t.ok ? "<span class=\"pt-pill pt-pill--green\"><span class=\"pt-dot\"></span>Hợp lệ</span>" : `<span class="pt-pill pt-pill--red"><span class="pt-dot"></span>${Y(t.status)}</span>`}</td>
8012
- <td><button class="pt-icon-btn" title="Mở trong công cụ tính giá" data-act="open-route" data-code="${Y(e.code)}">${k("eye", 16)}</button></td>
8309
+ <td><button class="pt-icon-btn" title="Mở trong công cụ tính giá" data-act="open-route" data-code="${Y(e.code)}">${A("eye", 16)}</button></td>
8013
8310
  </tr>`).join("");
8014
- return w({
8311
+ return x({
8015
8312
  ic: "table",
8016
8313
  title: "Bảng giá lộ trình gợi ý",
8017
- actions: O(),
8314
+ actions: te(),
8018
8315
  sub: `Học phí đã gồm ưu đãi theo bộ lọc · ${Y(e.settings.campaignName)}`,
8019
- stats: T("grey", "Tổng lộ trình", r.length, "route") + T("white", "Mức giảm trung bình", i.length ? Z(a) : "—", "percent") + T("green", "Hợp lệ", i.length, "checkCircle") + T("red", "Không áp dụng", r.length - i.length, "xCircle")
8316
+ stats: S("grey", "Tổng lộ trình", r.length, "route") + S("white", "Mức giảm trung bình", i.length ? Z(a) : "—", "percent") + S("green", "Hợp lệ", i.length, "checkCircle") + S("red", "Không áp dụng", r.length - i.length, "xCircle")
8020
8317
  }) + c + `<div class="pt-section">
8021
8318
  <div class="pt-section-head"><div><div class="pt-section-title">Danh sách lộ trình</div>
8022
8319
  <div class="pt-section-sub">Tổng <b style="color:var(--pt-purple)">${r.length}</b> lộ trình · Bấm biểu tượng mắt để xem chi tiết & sao chép báo giá</div></div></div>
@@ -8027,8 +8324,8 @@ async function Xe(e, t = {}) {
8027
8324
  </table></div>
8028
8325
  </div>`;
8029
8326
  }
8030
- let P = null;
8031
- function F() {
8327
+ let M = null;
8328
+ function oe() {
8032
8329
  let e = u.pdf, t = c.get(e.month) ?? null, [n, r] = e.month.split("-"), i = [.../* @__PURE__ */ new Set([
8033
8330
  ...u.months.map((e) => e.slice(0, 4)),
8034
8331
  n,
@@ -8036,59 +8333,59 @@ async function Xe(e, t = {}) {
8036
8333
  ])].sort(), a = `<div class="pt-grid" style="grid-template-columns:1fr 1fr;gap:8px">
8037
8334
  <select class="pt-select" data-act="pdf-month" data-part="m">${Array.from({ length: 12 }, (e, t) => String(t + 1).padStart(2, "0")).map((e) => `<option value="${e}" ${e === r ? "selected" : ""}>Tháng ${Number(e)}${u.months.includes(`${n}-${e}`) ? "" : " · trống"}</option>`).join("")}</select>
8038
8335
  <select class="pt-select" data-act="pdf-month" data-part="y">${i.map((e) => `<option ${e === n ? "selected" : ""}>${e}</option>`).join("")}</select></div>`;
8039
- P = t ? je(t, e) : null;
8040
- let s = t ? h(t, e.program) : null, l = (e, t, n, r = (e) => e) => `<select class="pt-select" data-act="pdf" data-f="${e}">${t.map((e) => `<option value="${Y(e)}" ${Q(e, n) ? "selected" : ""}>${Y(r(e))}</option>`).join("")}</select>`, d = (e, t, n, r) => `<label style="display:flex;gap:8px;align-items:center;cursor:pointer;font-size:13px">
8041
- <input type="checkbox" data-act="${e}" value="${Y(t)}" ${n ? "checked" : ""} style="width:16px;height:16px;accent-color:var(--pt-purple)">${r}</label>`, f = t ? me(t, e.label) : [], p = t && s?.type !== "DINH_KY" ? he(t, e) : [], m = e.scenarios.length ? e.scenarios : t ? ge(t, e) : [], g = `<div class="pt-section" style="margin-top:0">
8042
- <div class="pt-section-head"><div class="pt-section-icon">${k("settings", 16)}</div>
8336
+ M = t ? Le(t, e) : null;
8337
+ let s = t ? _(t, e.program) : null, l = (e, t, n, r = (e) => e) => `<select class="pt-select" data-act="pdf" data-f="${e}">${t.map((e) => `<option value="${Y(e)}" ${Q(e, n) ? "selected" : ""}>${Y(r(e))}</option>`).join("")}</select>`, d = (e, t, n, r) => `<label style="display:flex;gap:8px;align-items:center;cursor:pointer;font-size:13px">
8338
+ <input type="checkbox" data-act="${e}" value="${Y(t)}" ${n ? "checked" : ""} style="width:16px;height:16px;accent-color:var(--pt-purple)">${r}</label>`, f = t ? ve(t, e.label) : [], p = t && s?.type !== "DINH_KY" ? be(t, e) : [], m = e.scenarios.length ? e.scenarios : t ? xe(t, e) : [], h = `<div class="pt-section" style="margin-top:0">
8339
+ <div class="pt-section-head"><div class="pt-section-icon">${A("settings", 16)}</div>
8043
8340
  <div><div class="pt-section-title">Tùy chọn ấn phẩm</div><div class="pt-section-sub">Khổ A4 ngang · số liệu lấy từ dữ liệu gốc của tháng đã chọn</div></div></div>
8044
8341
  <div class="pt-section-body"><div class="pt-form" style="gap:12px">
8045
8342
  <div class="pt-field"><label>Thời gian (tháng + năm)</label>${a}</div>
8046
8343
  ${t ? `<div class="pt-field"><label>Nhãn</label>${l("label", t.settings.labels.map((e) => e.name), e.label)}</div>
8047
8344
  <div class="pt-field"><label>Chương trình khuyến mại</label>${l("program", t.settings.programs.map((e) => e.name), e.program)}</div>
8048
- ${s?.type === "LKT" ? `<div class="pt-field"><label>Nhóm LKT</label>${l("lktGroup", S(t, e.label).map((e) => e.name), e.lktGroup)}</div>
8049
- <div class="pt-field"><label>Format LKT (cho bảng giá)</label>${l("lktFormat", x(t, e.label, e.lktGroup).map((e) => e.format), e.lktFormat)}</div>` : ""}
8345
+ ${s?.type === "LKT" ? `<div class="pt-field"><label>Nhóm LKT</label>${l("lktGroup", w(t, e.label).map((e) => e.name), e.lktGroup)}</div>
8346
+ <div class="pt-field"><label>Format LKT (cho bảng giá)</label>${l("lktFormat", C(t, e.label, e.lktGroup).map((e) => e.format), e.lktFormat)}</div>` : ""}
8050
8347
  <div class="pt-field"><label>Tên chương trình (tiêu đề)</label>
8051
- <input class="pt-input" data-act="pdf-title" value="${Y(e.title)}" placeholder="${Y(fe(t, e.label, e.month))}"></div>
8052
- <div class="pt-field"><label>Nội dung xuất</label><div style="display:grid;gap:7px">${le.map((t) => d("pdf-sec", t.id, e.sections.includes(t.id), Y(t.title))).join("")}</div></div>
8348
+ <input class="pt-input" data-act="pdf-title" value="${Y(e.title)}" placeholder="${Y(ge(t, e.label, e.month))}"></div>
8349
+ <div class="pt-field"><label>Nội dung xuất</label><div style="display:grid;gap:7px">${pe.map((t) => d("pdf-sec", t.id, e.sections.includes(t.id), Y(t.title))).join("")}</div></div>
8053
8350
  ${e.sections.includes("routes") && f.length > 1 ? `<div class="pt-field"><label>Đầu ra trong bảng giá lộ trình</label><div class="pt-chips">${f.map((t) => d("pdf-out", t, !e.outputs.length || e.outputs.includes(t), Y(t))).join("")}</div></div>` : ""}
8054
8351
  ${e.sections.includes("routes") && p.length ? `<div class="pt-field"><label>Kịch bản thanh toán trong bảng giá lộ trình <small>(2 kịch bản / trang)</small></label><div style="display:grid;gap:7px">${p.map((e) => d("pdf-scen", e.id, m.includes(e.id), `${Y(e.title)} · <b>${+(e.pct * 100).toFixed(2)}%</b>`)).join("")}</div></div>` : ""}` : ""}
8055
- </div></div></div>`, _ = t ? P.pages ? "<iframe id=\"pt-pdf-frame\" title=\"Xem trước ấn phẩm\" style=\"width:100%;height:78vh;border:0;border-radius:0 0 14px 14px;background:#8a8a8a;display:block\"></iframe>" : "<div class=\"pt-empty\">Chưa chọn nội dung nào hoặc chương trình chưa có dữ liệu</div>" : `<div class="pt-empty" style="padding:56px 24px"><div style="font-size:16px;font-weight:600;color:var(--pt-ink);margin-bottom:6px">${$(e.month)} chưa có chương trình khuyến mại</div>
8056
- Admin chưa tạo / cập nhật chương trình cho tháng này nên chưa có ấn phẩm để xuất.</div>`, ee = o ? `<span class="pt-pill pt-pill--purple" style="padding:8px 14px">${k("eye", 14)}Bản xem thử: chỉ xem trước ấn phẩm, xuất PDF trên portal</span>` : `<button class="pt-btn pt-btn--primary" data-act="pdf-print" ${P?.pages ? "" : "disabled"}>${k("download", 16)}Xuất PDF</button>`;
8352
+ </div></div></div>`, g = t ? M.pages ? "<iframe id=\"pt-pdf-frame\" title=\"Xem trước ấn phẩm\" style=\"width:100%;height:78vh;border:0;border-radius:0 0 14px 14px;background:#8a8a8a;display:block\"></iframe>" : "<div class=\"pt-empty\">Chưa chọn nội dung nào hoặc chương trình chưa có dữ liệu</div>" : `<div class="pt-empty" style="padding:56px 24px"><div style="font-size:16px;font-weight:600;color:var(--pt-ink);margin-bottom:6px">${$(e.month)} chưa có chương trình khuyến mại</div>
8353
+ Admin chưa tạo / cập nhật chương trình cho tháng này nên chưa có ấn phẩm để xuất.</div>`, v = o ? `<span class="pt-pill pt-pill--purple" style="padding:8px 14px">${A("eye", 14)}Bản xem thử: chỉ xem trước ấn phẩm, xuất PDF trên portal</span>` : `<button class="pt-btn pt-btn--primary" data-act="pdf-print" ${M?.pages ? "" : "disabled"}>${A("download", 16)}Xuất PDF</button>`;
8057
8354
  return `<div class="pt-grid" style="grid-template-columns:320px minmax(0,1fr);align-items:start" id="pt-pdf-grid">
8058
- ${g}
8355
+ ${h}
8059
8356
  <div class="pt-section" style="margin-top:0">
8060
8357
  <div class="pt-section-head">
8061
- <div class="pt-section-icon">${k("eye", 16)}</div>
8358
+ <div class="pt-section-icon">${A("eye", 16)}</div>
8062
8359
  <div>
8063
8360
  <div class="pt-section-title">Xem trước</div>
8064
- <div class="pt-section-sub">${P ? `${P.pages} trang A4 ngang · ${Y(P.title)}` : $(e.month)}</div>
8361
+ <div class="pt-section-sub">${M ? `${M.pages} trang A4 ngang · ${Y(M.title)}` : $(e.month)}</div>
8065
8362
  </div>
8066
- <div class="pt-section-actions">${ee}</div>
8363
+ <div class="pt-section-actions">${v}</div>
8067
8364
  </div>
8068
- ${_}
8365
+ ${g}
8069
8366
  </div>
8070
8367
  </div>`;
8071
8368
  }
8072
- async function I(e) {
8369
+ async function le(e) {
8073
8370
  let t = await l(e), n = t && t.settings.labels.some((e) => Q(e.name, u.pdf.label)) && t.settings.programs.some((e) => Q(e.name, u.pdf.program));
8074
8371
  u.pdf = {
8075
8372
  ...n ? u.pdf : {
8076
8373
  ...u.pdf,
8077
- ...y(t)
8374
+ ...h(t)
8078
8375
  },
8079
8376
  month: e,
8080
8377
  outputs: [],
8081
8378
  scenarios: []
8082
8379
  };
8083
8380
  }
8084
- function L() {
8381
+ function ue() {
8085
8382
  let e = p.querySelector("#pt-pdf-frame");
8086
- e && P && (e.addEventListener("load", () => {
8383
+ e && M && (e.addEventListener("load", () => {
8087
8384
  let t = e.contentDocument, n = Math.min(1, (e.clientWidth - 28) / 1123), r = t.createElement("style");
8088
8385
  r.textContent = `@media screen { body { zoom: ${n}; padding: 14px 0; } }`, t.head.appendChild(r);
8089
- }, { once: !0 }), e.srcdoc = P.html);
8386
+ }, { once: !0 }), e.srcdoc = M.html);
8090
8387
  }
8091
- async function R() {
8388
+ async function P() {
8092
8389
  let e = p.querySelector("#pt-pdf-frame");
8093
8390
  if (e?.contentWindow) {
8094
8391
  try {
@@ -8097,14 +8394,14 @@ async function Xe(e, t = {}) {
8097
8394
  e.contentWindow.focus(), e.contentWindow.print();
8098
8395
  }
8099
8396
  }
8100
- let z = () => u.admin.draft ??= Ge(c.get(u.admin.month));
8101
- function B() {
8397
+ let F = () => u.admin.draft ??= Je(c.get(u.admin.month));
8398
+ function I() {
8102
8399
  let e = u.admin, t = [.../* @__PURE__ */ new Set([...u.months, ...e.draft ? [e.month] : []])].sort().reverse(), n = u.months[0], r = (() => {
8103
- let [e, t] = (n ?? qe()).split("-").map(Number);
8104
- return n ? `${t === 12 ? e + 1 : e}-${String(t === 12 ? 1 : t + 1).padStart(2, "0")}` : qe();
8400
+ let [e, t] = (n ?? Xe()).split("-").map(Number);
8401
+ return n ? `${t === 12 ? e + 1 : e}-${String(t === 12 ? 1 : t + 1).padStart(2, "0")}` : Xe();
8105
8402
  })();
8106
8403
  return `<div class="pt-section" style="margin-top:14px"><div class="pt-section-head" style="flex-wrap:wrap">
8107
- <div class="pt-section-icon">${k("calendar", 16)}</div>
8404
+ <div class="pt-section-icon">${A("calendar", 16)}</div>
8108
8405
  <div><div class="pt-section-title">Chương trình theo tháng</div><div class="pt-section-sub">Mỗi tháng lưu riêng — tháng cũ giữ nguyên làm lưu trữ, tháng chưa tạo thì sale thấy trống</div></div>
8109
8406
  <div class="pt-section-actions">
8110
8407
  <label class="pt-label" style="margin-right:2px">Đang sửa</label>
@@ -8114,67 +8411,67 @@ async function Xe(e, t = {}) {
8114
8411
  <select class="pt-select" style="height:36px;width:220px" data-act="copy-from" title="Dữ liệu ban đầu">
8115
8412
  ${u.months.map((t) => `<option value="${t}" ${t === (e.copyFrom || n) ? "selected" : ""}>Sao chép từ ${$(t).toLowerCase()}</option>`).join("")}
8116
8413
  <option value="seed" ${e.copyFrom === "seed" || !n ? "selected" : ""}>Từ dữ liệu Excel gốc</option></select>
8117
- <button class="pt-btn pt-btn--primary pt-btn--sm" data-act="create-month">${k("plus", 15)}Tạo tháng mới</button>
8414
+ <button class="pt-btn pt-btn--primary pt-btn--sm" data-act="create-month">${A("plus", 15)}Tạo tháng mới</button>
8118
8415
  </div></div></div>`;
8119
8416
  }
8120
- async function ce() {
8417
+ async function L() {
8121
8418
  let e = u.admin, t = (p.querySelector("[data-act=\"new-month\"]")?.value || e.newMonth || "").slice(0, 7);
8122
- if (!/^\d{4}-\d{2}$/.test(t)) return K("Chọn tháng cần tạo");
8419
+ if (!/^\d{4}-\d{2}$/.test(t)) return H("Chọn tháng cần tạo");
8123
8420
  if (u.months.includes(t)) {
8124
- e.month = t, e.draft = null, K(`${$(t)} đã có — chuyển sang sửa tháng này`);
8421
+ e.month = t, e.draft = null, H(`${$(t)} đã có — chuyển sang sửa tháng này`);
8125
8422
  return;
8126
8423
  }
8127
8424
  if (e.dirty && !s("Đang có thay đổi chưa lưu. Bỏ thay đổi để tạo tháng mới?")) return;
8128
- let r = e.copyFrom || u.months[0] || "seed", i = C(r === "seed" ? await n.seed() : Ge(await l(r)));
8129
- [i.settings.validFrom, i.settings.validTo] = Je(t), i.settings.campaignName = "", e.month = t, e.draft = i, e.dirty = !0, e.issues = [], K(`Đã tạo ${$(t).toLowerCase()} (chưa lưu) — cập nhật giá, CTKM rồi bấm Lưu & áp dụng`);
8425
+ let r = e.copyFrom || u.months[0] || "seed", i = E(r === "seed" ? await n.seed() : Je(await l(r)));
8426
+ [i.settings.validFrom, i.settings.validTo] = Ze(t), i.settings.campaignName = "", e.month = t, e.draft = i, e.dirty = !0, e.issues = [], H(`Đã tạo ${$(t).toLowerCase()} (chưa lưu) — cập nhật giá, CTKM rồi bấm Lưu & áp dụng`);
8130
8427
  }
8131
- let V = (e) => e.path.reduce((e, t) => e[t], z());
8132
- function ue() {
8428
+ let R = (e) => e.path.reduce((e, t) => e[t], F());
8429
+ function z() {
8133
8430
  let e = u.admin;
8134
- if (!c.get(e.month) && !e.draft) return w({
8431
+ if (!c.get(e.month) && !e.draft) return x({
8135
8432
  ic: "db",
8136
8433
  title: "Quản trị dữ liệu gốc",
8137
8434
  sub: "Chưa có chương trình nào — tạo tháng đầu tiên để bắt đầu."
8138
- }) + B() + `<div class="pt-section"><div class="pt-empty" style="padding:48px 24px">${$(e.month)} chưa có chương trình. Chọn tháng và nguồn dữ liệu ở trên rồi bấm <b>Tạo tháng mới</b>.</div></div>`;
8139
- let t = z(), n = M(t), r = n.find((t) => t.id === e.tab), i = [...new Set(n.map((e) => e.group))].map((t) => `<div class="pt-menu-group">${t}</div>` + n.filter((e) => e.group === t).map((t) => `<button class="${t.id === e.tab ? "is-active" : ""}" data-act="admin-tab" data-v="${t.id}">
8140
- <span class="pt-menu-ic">${k(t.icon, 15)}</span>${t.title}<span class="pt-count">${V(t).length}</span></button>`).join("")).join("") + `<div class="pt-menu-group">Chung</div>
8141
- <button class="${e.tab === "general" ? "is-active" : ""}" data-act="admin-tab" data-v="general"><span class="pt-menu-ic">${k("settings", 15)}</span>Thông tin chương trình</button>`, a = t.periodic.length + t.special.length + t.extended.length + t.lkt.length, s = ne(t).length, l = T("grey", "Khóa học", t.courses.length, "book") + T("white", "Dòng CTKM", a, "percent") + T("green", "Lộ trình gợi ý", t.routes.length, "route") + T(s ? "red" : "green", "Cảnh báo dữ liệu", s, s ? "alert" : "checkCircle"), d = e.tab === "general" ? pe(t) : `<div class="pt-section" style="margin-top:0">
8142
- <div class="pt-section-head"><div class="pt-section-icon">${k(r.icon, 16)}</div>
8435
+ }) + I() + `<div class="pt-section"><div class="pt-empty" style="padding:48px 24px">${$(e.month)} chưa có chương trình. Chọn tháng và nguồn dữ liệu ở trên rồi bấm <b>Tạo tháng mới</b>.</div></div>`;
8436
+ let t = F(), n = N(t), r = n.find((t) => t.id === e.tab), i = [...new Set(n.map((e) => e.group))].map((t) => `<div class="pt-menu-group">${t}</div>` + n.filter((e) => e.group === t).map((t) => `<button class="${t.id === e.tab ? "is-active" : ""}" data-act="admin-tab" data-v="${t.id}">
8437
+ <span class="pt-menu-ic">${A(t.icon, 15)}</span>${t.title}<span class="pt-count">${R(t).length}</span></button>`).join("")).join("") + `<div class="pt-menu-group">Chung</div>
8438
+ <button class="${e.tab === "general" ? "is-active" : ""}" data-act="admin-tab" data-v="general"><span class="pt-menu-ic">${A("settings", 15)}</span>Thông tin chương trình</button>`, a = t.periodic.length + t.special.length + t.extended.length + t.lkt.length + (t.lktBase?.length ?? 0), s = k(t).length, l = S("grey", "Khóa học", t.courses.length, "book") + S("white", "Dòng CTKM", a, "percent") + S("green", "Lộ trình gợi ý", t.routes.length, "route") + S(s ? "red" : "green", "Cảnh báo dữ liệu", s, s ? "alert" : "checkCircle"), d = e.tab === "general" ? me(t) : `<div class="pt-section" style="margin-top:0">
8439
+ <div class="pt-section-head"><div class="pt-section-icon">${A(r.icon, 16)}</div>
8143
8440
  <div><div class="pt-section-title">${r.title}</div><div class="pt-section-sub">${r.sheet ? `Thay cho sheet ${r.sheet}` : "Cấu hình chung"}</div></div>
8144
8441
  <div class="pt-section-actions">
8145
8442
  ${r.byLabel ? `<select class="pt-select" style="height:36px;width:170px" data-act="admin-label"><option value="">Tất cả nhãn</option>${t.settings.labels.map((t) => `<option ${Q(t.name, e.label) ? "selected" : ""}>${Y(t.name)}</option>`).join("")}</select>` : ""}
8146
8443
  <input class="pt-input" style="height:36px;width:180px" placeholder="Tìm…" value="${Y(e.q)}" data-act="admin-q">
8147
- <button class="pt-btn pt-btn--primary" data-act="row-add">${k("plus", 16)}Thêm mới</button>
8444
+ <button class="pt-btn pt-btn--primary" data-act="row-add">${A("plus", 16)}Thêm mới</button>
8148
8445
  </div></div>
8149
8446
  <p class="pt-help" style="margin-top:14px">${Y(r.desc)}</p>
8150
8447
  <div id="pt-issues"></div>
8151
8448
  <div class="pt-table-wrap" id="pt-admin-table"></div>
8152
8449
  </div>`;
8153
- return w({
8450
+ return x({
8154
8451
  ic: "db",
8155
8452
  title: "Quản trị dữ liệu gốc",
8156
- sub: `Đang sửa chương trình ${$(e.month).toLowerCase()} (${Ke(t.settings.validFrom)} – ${Ke(t.settings.validTo)}). Sale chỉ xem kết quả tính theo dữ liệu này.`,
8453
+ sub: `Đang sửa chương trình ${$(e.month).toLowerCase()} (${Ye(t.settings.validFrom)} – ${Ye(t.settings.validTo)}). Sale chỉ xem kết quả tính theo dữ liệu này.`,
8157
8454
  actions: `
8158
- <label class="pt-btn pt-btn--ghost pt-btn--sm" style="cursor:pointer">${k("sheet", 15)}Nhập từ Excel<input type="file" accept=".xlsx" hidden data-act="import-xlsx"></label>
8159
- <label class="pt-btn pt-btn--ghost pt-btn--sm" style="cursor:pointer">${k("upload", 15)}Nhập JSON<input type="file" accept=".json" hidden data-act="import-json"></label>
8160
- ${o ? "" : `<button class="pt-btn pt-btn--ghost pt-btn--sm" data-act="export-json">${k("download", 15)}Xuất JSON</button>`}`,
8455
+ <label class="pt-btn pt-btn--ghost pt-btn--sm" style="cursor:pointer">${A("sheet", 15)}Nhập từ Excel<input type="file" accept=".xlsx" hidden data-act="import-xlsx"></label>
8456
+ <label class="pt-btn pt-btn--ghost pt-btn--sm" style="cursor:pointer">${A("upload", 15)}Nhập JSON<input type="file" accept=".json" hidden data-act="import-json"></label>
8457
+ ${o ? "" : `<button class="pt-btn pt-btn--ghost pt-btn--sm" data-act="export-json">${A("download", 15)}Xuất JSON</button>`}`,
8161
8458
  stats: l
8162
- }) + B() + `<div class="pt-admin"><nav class="pt-menu">${i}</nav><div>${d}</div></div>
8163
- <div class="pt-savebar" id="pt-savebar" ${e.dirty ? "" : "hidden"}>${de()}</div>`;
8459
+ }) + I() + `<div class="pt-admin"><nav class="pt-menu">${i}</nav><div>${d}</div></div>
8460
+ <div class="pt-savebar" id="pt-savebar" ${e.dirty ? "" : "hidden"}>${fe()}</div>`;
8164
8461
  }
8165
- let de = () => `${k("alert", 18)}<span>Có thay đổi chưa lưu cho ${$(u.admin.month).toLowerCase()} — sale vẫn đang dùng dữ liệu cũ.</span>
8462
+ let fe = () => `${A("alert", 18)}<span>Có thay đổi chưa lưu cho ${$(u.admin.month).toLowerCase()} — sale vẫn đang dùng dữ liệu cũ.</span>
8166
8463
  <span class="pt-band-spacer"></span>
8167
8464
  <button class="pt-btn pt-btn--ghost pt-btn--sm" data-act="discard">Hủy thay đổi</button>
8168
- <button class="pt-btn pt-btn--primary pt-btn--sm" data-act="save" style="background:#fff;color:var(--pt-purple)">${k("save", 15)}Lưu & áp dụng</button>`;
8169
- function H() {
8465
+ <button class="pt-btn pt-btn--primary pt-btn--sm" data-act="save" style="background:#fff;color:var(--pt-purple)">${A("save", 15)}Lưu & áp dụng</button>`;
8466
+ function B() {
8170
8467
  u.admin.dirty = !0;
8171
8468
  let e = p.querySelector("#pt-savebar");
8172
8469
  e && (e.hidden = !1);
8173
8470
  }
8174
- function pe(e) {
8471
+ function me(e) {
8175
8472
  let t = e.settings, n = (e, n, r = "text") => `<div class="pt-field"><label>${n}</label><input class="pt-input" type="${r}" value="${Y(t[e])}" data-act="setting" data-k="${e}"></div>`;
8176
8473
  return `<div class="pt-section" style="margin-top:0">
8177
- <div class="pt-section-head"><div class="pt-section-icon">${k("settings", 16)}</div>
8474
+ <div class="pt-section-head"><div class="pt-section-icon">${A("settings", 16)}</div>
8178
8475
  <div><div class="pt-section-title">Thông tin chương trình</div><div class="pt-section-sub">Hiển thị trên trang Tính giá và trong báo giá sao chép</div></div></div>
8179
8476
  <div class="pt-section-body"><div class="pt-grid pt-grid-3">
8180
8477
  ${n("campaignName", "Tên đợt khuyến mại")}${n("validFrom", "Áp dụng từ ngày", "date")}${n("validTo", "Đến ngày", "date")}
@@ -8190,16 +8487,16 @@ async function Xe(e, t = {}) {
8190
8487
  ].map(([e, n]) => `<div class="pt-field" style="margin-top:12px"><label>${n}</label>
8191
8488
  <textarea class="pt-input" rows="2" style="height:auto;padding:8px 12px;resize:vertical" data-act="doc-text" data-k="${e}">${Y(t.docTexts?.[e])}</textarea></div>`).join("")}
8192
8489
  <div style="display:flex;gap:8px;margin-top:20px;flex-wrap:wrap">
8193
- <button class="pt-btn pt-btn--ghost pt-btn--sm" data-act="reset-seed">${k("refresh", 15)}Khôi phục dữ liệu gốc từ file Excel ban đầu</button>
8490
+ <button class="pt-btn pt-btn--ghost pt-btn--sm" data-act="reset-seed">${A("refresh", 15)}Khôi phục dữ liệu gốc từ file Excel ban đầu</button>
8194
8491
  </div></div></div>`;
8195
8492
  }
8196
- function U() {
8493
+ function V() {
8197
8494
  let e = p.querySelector("#pt-admin-table");
8198
8495
  if (!e) return;
8199
- let t = u.admin, n = M(z()).find((e) => e.id === t.tab), r = V(n), i = t.q.trim().toLowerCase(), a = t.issues.filter((e) => e.table === n.id), o = new Set(a.map((e) => e.row)), s = r.map((e, t) => ({
8496
+ let t = u.admin, n = N(F()).find((e) => e.id === t.tab), r = R(n), i = t.q.trim().toLowerCase(), a = t.issues.filter((e) => e.table === n.id), o = new Set(a.map((e) => e.row)), s = r.map((e, t) => ({
8200
8497
  r: e,
8201
8498
  i: t
8202
- })).filter(({ r: e }) => !n.byLabel || !t.label || Q(e.label, t.label)).filter(({ r: e }) => !i || n.columns.some((t) => String(ae(t, e[t.key])).toLowerCase().includes(i))), c = (e, t, n) => {
8499
+ })).filter(({ r: e }) => !n.byLabel || !t.label || Q(e.label, t.label)).filter(({ r: e }) => !i || n.columns.some((t) => String(se(t, e[t.key])).toLowerCase().includes(i))), c = (e, t, n) => {
8203
8500
  let r = t[e.key], i = `data-edit="${n}" data-k="${e.key}"`;
8204
8501
  if (e.type === "bool") return `<input type="checkbox" ${r ? "checked" : ""} ${i} style="width:18px;height:18px;accent-color:var(--pt-purple)">`;
8205
8502
  if (e.type === "select") return `<select class="pt-select" ${i}>${(e.options.includes(r) || r === "" ? e.options : [r, ...e.options]).map((e) => `<option ${e === r ? "selected" : ""}>${Y(e)}</option>`).join("")}</select>`;
@@ -8213,7 +8510,7 @@ async function Xe(e, t = {}) {
8213
8510
  "pct",
8214
8511
  "int"
8215
8512
  ].includes(e.type);
8216
- return `<input class="pt-input ${a ? "num" : ""} ${e.wide ? "w-wide" : ""}" ${a ? "inputmode=\"decimal\"" : ""} value="${Y(ae(e, r))}" ${i}>`;
8513
+ return `<input class="pt-input ${a ? "num" : ""} ${e.wide ? "w-wide" : ""}" ${a ? "inputmode=\"decimal\"" : ""} value="${Y(se(e, r))}" ${i}>`;
8217
8514
  };
8218
8515
  p.querySelector("#pt-issues").innerHTML = a.length ? `<ul class="pt-issues">${a.map((e) => `<li>Dòng ${e.row + 1}: ${Y(e.message)}</li>`).join("")}</ul>` : "", e.innerHTML = `<table class="pt-table pt-table--edit">
8219
8516
  <thead><tr><th class="pt-rowno">#</th>${n.columns.map((e) => `<th class="${[
@@ -8222,27 +8519,27 @@ async function Xe(e, t = {}) {
8222
8519
  "int"
8223
8520
  ].includes(e.type) ? "num" : ""}">${e.label}</th>`).join("")}<th></th></tr></thead>
8224
8521
  <tbody>${s.map(({ r: e, i: t }) => `<tr class="${o.has(t) ? "has-issue" : ""}"><td class="pt-rowno">${t + 1}</td>${n.columns.map((n) => `<td>${c(n, e, t)}</td>`).join("")}
8225
- <td><button class="pt-icon-btn is-danger" title="Xóa dòng" data-act="row-del" data-i="${t}">${k("trash", 15)}</button></td></tr>`).join("") || `<tr><td colspan="${n.columns.length + 2}" class="pt-empty">Chưa có dữ liệu</td></tr>`}</tbody></table>`;
8522
+ <td><button class="pt-icon-btn is-danger" title="Xóa dòng" data-act="row-del" data-i="${t}">${A("trash", 15)}</button></td></tr>`).join("") || `<tr><td colspan="${n.columns.length + 2}" class="pt-empty">Chưa có dữ liệu</td></tr>`}</tbody></table>`;
8226
8523
  }
8227
- async function W() {
8228
- let e = z(), t = ne(e);
8524
+ async function he() {
8525
+ let e = F(), t = k(e);
8229
8526
  if (u.admin.issues = t, t.length && !s(`Có ${t.length} cảnh báo dữ liệu (trùng khóa, giá ≤ 0...). Vẫn lưu?`)) {
8230
8527
  let e = t[0];
8231
8528
  u.admin.tab = e.table, m();
8232
8529
  } else try {
8233
8530
  e.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), i && (e.updatedBy = i.email ?? i.name ?? "");
8234
8531
  let t = u.admin.month;
8235
- await n.save(t, e), c.set(t, C(Ge(e))), u.months = [.../* @__PURE__ */ new Set([...u.months, t])].sort().reverse(), t === u.month && (u.data = c.get(t), d()), u.admin.draft = null, u.admin.dirty = !1, u.admin.issues = [], K(`Đã lưu ${$(t).toLowerCase()}${t === u.month ? " — sale thấy giá mới ngay" : ""}`), m();
8532
+ await n.save(t, e), c.set(t, E(Je(e))), u.months = [.../* @__PURE__ */ new Set([...u.months, t])].sort().reverse(), t === u.month && (u.data = c.get(t), d()), u.admin.draft = null, u.admin.dirty = !1, u.admin.issues = [], H(`Đã lưu ${$(t).toLowerCase()}${t === u.month ? " — sale thấy giá mới ngay" : ""}`), m();
8236
8533
  } catch (e) {
8237
- K(`Lưu thất bại: ${e.message}`);
8534
+ H(`Lưu thất bại: ${e.message}`);
8238
8535
  }
8239
8536
  }
8240
- let G;
8241
- function K(t) {
8537
+ let _e;
8538
+ function H(t) {
8242
8539
  let n = document.querySelector(".pt-root .pt-toast");
8243
- n || (n = document.createElement("div"), n.className = "pt-toast", e.appendChild(n)), n.textContent = t, clearTimeout(G), G = setTimeout(() => n.remove(), 2600);
8540
+ n || (n = document.createElement("div"), n.className = "pt-toast", e.appendChild(n)), n.textContent = t, clearTimeout(_e), _e = setTimeout(() => n.remove(), 2600);
8244
8541
  }
8245
- async function _e(e) {
8542
+ async function U(e) {
8246
8543
  try {
8247
8544
  await navigator.clipboard.writeText(e);
8248
8545
  } catch {
@@ -8250,7 +8547,7 @@ async function Xe(e, t = {}) {
8250
8547
  document.body.appendChild(t), t.select(), document.execCommand("copy"), t.remove();
8251
8548
  }
8252
8549
  }
8253
- function ve(e, t) {
8550
+ function W(e, t) {
8254
8551
  let n = Object.assign(document.createElement("a"), {
8255
8552
  href: URL.createObjectURL(new Blob([t], { type: "application/json" })),
8256
8553
  download: e
@@ -8263,7 +8560,7 @@ async function Xe(e, t = {}) {
8263
8560
  let i = r.dataset.act, a = u.admin;
8264
8561
  switch (i) {
8265
8562
  case "pdf-print":
8266
- await R();
8563
+ await P();
8267
8564
  return;
8268
8565
  case "view":
8269
8566
  u.view = r.dataset.v;
@@ -8272,11 +8569,11 @@ async function Xe(e, t = {}) {
8272
8569
  u.role = r.dataset.v;
8273
8570
  break;
8274
8571
  case "calc":
8275
- j(u.calc, r.dataset.f, r.dataset.v);
8572
+ ie(u.calc, r.dataset.f, r.dataset.v);
8276
8573
  break;
8277
8574
  case "toggle": {
8278
8575
  let e = r.dataset.code;
8279
- u.calc.selected[e] ? delete u.calc.selected[e] : u.calc.selected[e] = v(u.data, u.calc.label).find((t) => Q(t.code, e))?.modes[0];
8576
+ u.calc.selected[e] ? delete u.calc.selected[e] : u.calc.selected[e] = b(u.data, u.calc.label).find((t) => Q(t.code, e))?.modes[0];
8280
8577
  break;
8281
8578
  }
8282
8579
  case "mode":
@@ -8286,14 +8583,14 @@ async function Xe(e, t = {}) {
8286
8583
  u.calc.selected = {};
8287
8584
  break;
8288
8585
  case "reset-calc":
8289
- u.calc = y(u.data);
8586
+ u.calc = h(u.data);
8290
8587
  break;
8291
8588
  case "copy":
8292
- await _e(ie()), K("Đã sao chép báo giá — dán vào Zalo/Messenger để gửi khách");
8589
+ await U(j()), H("Đã sao chép báo giá — dán vào Zalo/Messenger để gửi khách");
8293
8590
  return;
8294
8591
  case "tbl-reset":
8295
8592
  u.table = {
8296
- ...y(u.data),
8593
+ ...h(u.data),
8297
8594
  output: ""
8298
8595
  };
8299
8596
  break;
@@ -8309,8 +8606,8 @@ async function Xe(e, t = {}) {
8309
8606
  a.tab = r.dataset.v, a.q = "";
8310
8607
  break;
8311
8608
  case "row-add": {
8312
- let e = M(z()).find((e) => e.id === a.tab);
8313
- V(e).push(e.blank(a.label || z().settings.labels[0]?.name || "")), a.q = "", H(), U();
8609
+ let e = N(F()).find((e) => e.id === a.tab);
8610
+ R(e).push(e.blank(a.label || F().settings.labels[0]?.name || "")), a.q = "", B(), V();
8314
8611
  let t = p.querySelector("#pt-admin-table tbody tr:last-child");
8315
8612
  t?.scrollIntoView({
8316
8613
  block: "center",
@@ -8319,28 +8616,28 @@ async function Xe(e, t = {}) {
8319
8616
  return;
8320
8617
  }
8321
8618
  case "row-del": {
8322
- let e = M(z()).find((e) => e.id === a.tab);
8323
- V(e).splice(Number(r.dataset.i), 1), a.issues = [], H(), U();
8619
+ let e = N(F()).find((e) => e.id === a.tab);
8620
+ R(e).splice(Number(r.dataset.i), 1), a.issues = [], B(), V();
8324
8621
  return;
8325
8622
  }
8326
8623
  case "save":
8327
- await W();
8624
+ await he();
8328
8625
  return;
8329
8626
  case "discard":
8330
8627
  a.draft = null, a.dirty = !1, a.issues = [], u.months.includes(a.month) || (a.month = u.months[0] ?? u.month);
8331
8628
  break;
8332
8629
  case "create-month":
8333
- await ce();
8630
+ await L();
8334
8631
  break;
8335
8632
  case "goto-create":
8336
8633
  u.view = "admin", a.newMonth = r.dataset.v, u.months.length || (a.month = r.dataset.v);
8337
8634
  break;
8338
8635
  case "export-json":
8339
- ve(`du-lieu-khuyen-mai-${a.month}.json`, JSON.stringify(z(), null, 1));
8636
+ W(`du-lieu-khuyen-mai-${a.month}.json`, JSON.stringify(F(), null, 1));
8340
8637
  return;
8341
8638
  case "reset-seed":
8342
8639
  if (!s(`Thay dữ liệu ${$(a.month).toLowerCase()} bằng bản gốc nhập từ file Excel ban đầu? (chưa lưu cho tới khi bấm Lưu)`)) return;
8343
- a.draft = C(await n.seed()), [a.draft.settings.validFrom, a.draft.settings.validTo] = Je(a.month), H(), a.dirty = !0;
8640
+ a.draft = E(await n.seed()), [a.draft.settings.validFrom, a.draft.settings.validTo] = Ze(a.month), B(), a.dirty = !0;
8344
8641
  break;
8345
8642
  default: return;
8346
8643
  }
@@ -8351,26 +8648,26 @@ async function Xe(e, t = {}) {
8351
8648
  }), e.addEventListener("change", async (e) => {
8352
8649
  let t = e.target, n = u.admin;
8353
8650
  if (t.dataset.edit != null) {
8354
- let e = M(z()).find((e) => e.id === n.tab), r = e.columns.find((e) => e.key === t.dataset.k);
8355
- V(e)[Number(t.dataset.edit)][r.key] = r.type === "bool" ? t.checked : oe(r, t.value), r.type !== "bool" && r.type !== "select" && (t.value = ae(r, V(e)[Number(t.dataset.edit)][r.key])), H();
8651
+ let e = N(F()).find((e) => e.id === n.tab), r = e.columns.find((e) => e.key === t.dataset.k);
8652
+ R(e)[Number(t.dataset.edit)][r.key] = r.type === "bool" ? t.checked : ce(r, t.value), r.type !== "bool" && r.type !== "select" && (t.value = se(r, R(e)[Number(t.dataset.edit)][r.key])), B();
8356
8653
  } else {
8357
8654
  switch (t.dataset.act) {
8358
8655
  case "setting":
8359
- z().settings[t.dataset.k] = t.value, H();
8656
+ F().settings[t.dataset.k] = t.value, B();
8360
8657
  return;
8361
8658
  case "doc-text":
8362
- (z().settings.docTexts ??= {})[t.dataset.k] = t.value, H();
8659
+ (F().settings.docTexts ??= {})[t.dataset.k] = t.value, B();
8363
8660
  return;
8364
8661
  case "pdf":
8365
- j(u.pdf, t.dataset.f, t.value, c.get(u.pdf.month)), t.dataset.f === "label" && (u.pdf.outputs = []), u.pdf.scenarios = [];
8662
+ ie(u.pdf, t.dataset.f, t.value, c.get(u.pdf.month)), t.dataset.f === "label" && (u.pdf.outputs = []), u.pdf.scenarios = [];
8366
8663
  break;
8367
8664
  case "pdf-month": {
8368
8665
  let [e, n] = u.pdf.month.split("-");
8369
- await I(t.dataset.part === "y" ? `${t.value}-${n}` : `${e}-${t.value}`);
8666
+ await le(t.dataset.part === "y" ? `${t.value}-${n}` : `${e}-${t.value}`);
8370
8667
  break;
8371
8668
  }
8372
8669
  case "pdf-scen": {
8373
- let e = c.get(u.pdf.month), n = he(e, u.pdf).map((e) => e.id), r = new Set(u.pdf.scenarios.length ? u.pdf.scenarios : ge(e, u.pdf));
8670
+ let e = c.get(u.pdf.month), n = be(e, u.pdf).map((e) => e.id), r = new Set(u.pdf.scenarios.length ? u.pdf.scenarios : xe(e, u.pdf));
8374
8671
  t.checked ? r.add(t.value) : r.delete(t.value), u.pdf.scenarios = n.filter((e) => r.has(e)), u.pdf.scenarios.length || (u.pdf.scenarios = [n[0]]);
8375
8672
  break;
8376
8673
  }
@@ -8395,12 +8692,12 @@ async function Xe(e, t = {}) {
8395
8692
  break;
8396
8693
  case "pdf-sec":
8397
8694
  case "pdf-out": {
8398
- let e = t.dataset.act === "pdf-sec" ? "sections" : "outputs", n = e === "sections" ? le.map((e) => e.id) : me(c.get(u.pdf.month), u.pdf.label), r = new Set(u.pdf[e].length || e === "sections" ? u.pdf[e] : n);
8695
+ let e = t.dataset.act === "pdf-sec" ? "sections" : "outputs", n = e === "sections" ? pe.map((e) => e.id) : ve(c.get(u.pdf.month), u.pdf.label), r = new Set(u.pdf[e].length || e === "sections" ? u.pdf[e] : n);
8399
8696
  t.checked ? r.add(t.value) : r.delete(t.value), u.pdf[e] = n.filter((e) => r.has(e));
8400
8697
  break;
8401
8698
  }
8402
8699
  case "tbl":
8403
- j(u.table, t.dataset.f, t.value), t.dataset.f === "label" && (u.table.output = "");
8700
+ ie(u.table, t.dataset.f, t.value), t.dataset.f === "label" && (u.table.output = "");
8404
8701
  break;
8405
8702
  case "pick-route": {
8406
8703
  let e = u.data.routes.find((e) => Q(e.label, u.calc.label) && Q(e.code, t.value));
@@ -8408,18 +8705,18 @@ async function Xe(e, t = {}) {
8408
8705
  break;
8409
8706
  }
8410
8707
  case "admin-label":
8411
- n.label = t.value, U();
8708
+ n.label = t.value, V();
8412
8709
  return;
8413
8710
  case "import-json":
8414
8711
  case "import-xlsx": {
8415
8712
  let e = t.files?.[0];
8416
8713
  if (!e) return;
8417
8714
  try {
8418
- let r = t.dataset.act === "import-json" ? JSON.parse(await e.text()) : await se(e, z());
8715
+ let r = t.dataset.act === "import-json" ? JSON.parse(await e.text()) : await de(e, F());
8419
8716
  if (!r?.settings || !Array.isArray(r.courses)) throw Error("File không đúng cấu trúc");
8420
- Be(r) !== n.month && ([r.settings.validFrom, r.settings.validTo] = Je(n.month)), n.draft = C(r), n.issues = ne(r), H(), n.dirty = !0, K(`Đã nạp ${e.name} — kiểm tra rồi bấm Lưu & áp dụng`);
8717
+ Ue(r) !== n.month && ([r.settings.validFrom, r.settings.validTo] = Ze(n.month)), n.draft = E(r), n.issues = k(r), B(), n.dirty = !0, H(`Đã nạp ${e.name} — kiểm tra rồi bấm Lưu & áp dụng`);
8421
8718
  } catch (e) {
8422
- K(`Không nhập được: ${e.message}`);
8719
+ H(`Không nhập được: ${e.message}`);
8423
8720
  }
8424
8721
  break;
8425
8722
  }
@@ -8428,12 +8725,12 @@ async function Xe(e, t = {}) {
8428
8725
  m();
8429
8726
  }
8430
8727
  }), e.addEventListener("input", (e) => {
8431
- e.target.dataset.act === "admin-q" && (u.admin.q = e.target.value, U());
8728
+ e.target.dataset.act === "admin-q" && (u.admin.q = e.target.value, V());
8432
8729
  });
8433
- let q = (e) => {
8730
+ let ye = (e) => {
8434
8731
  u.admin.dirty && e.preventDefault();
8435
8732
  };
8436
- return window.addEventListener("beforeunload", q), m(), {
8733
+ return window.addEventListener("beforeunload", ye), m(), {
8437
8734
  setRole(e) {
8438
8735
  u.role = e, m();
8439
8736
  },
@@ -8441,7 +8738,7 @@ async function Xe(e, t = {}) {
8441
8738
  c.clear(), u.months = await n.listMonths(), u.data = await l(u.month), await l(u.admin.month), await l(u.pdf.month), d(), m();
8442
8739
  },
8443
8740
  destroy() {
8444
- window.removeEventListener("beforeunload", q), e.innerHTML = "";
8741
+ window.removeEventListener("beforeunload", ye), e.innerHTML = "";
8445
8742
  },
8446
8743
  unmount() {
8447
8744
  this.destroy();
@@ -8449,7 +8746,7 @@ async function Xe(e, t = {}) {
8449
8746
  };
8450
8747
  }
8451
8748
  // src/vue/PromoTool.vue
8452
- var Ze = /* @__PURE__ */ t({
8749
+ var et = /* @__PURE__ */ t({
8453
8750
  __name: "PromoTool",
8454
8751
  props: {
8455
8752
  role: { default: "sale" },
@@ -8464,7 +8761,7 @@ var Ze = /* @__PURE__ */ t({
8464
8761
  setup(t, { expose: s, emit: c }) {
8465
8762
  let l = t, u = c, d = a(null), f = null;
8466
8763
  return r(async () => {
8467
- d.value && (f = await Xe(d.value, {
8764
+ d.value && (f = await $e(d.value, {
8468
8765
  role: l.role,
8469
8766
  store: l.store,
8470
8767
  user: l.user,
@@ -8484,7 +8781,7 @@ var Ze = /* @__PURE__ */ t({
8484
8781
  class: "pt-vue-container"
8485
8782
  }, null, 512));
8486
8783
  }
8487
- }), Qe = { install(e) {
8488
- e.component("PromoTool", Ze);
8784
+ }), tt = { install(e) {
8785
+ e.component("PromoTool", et);
8489
8786
  } };
8490
- export { Ze as PromoTool, m as STATUS_OK, v as coursesForLabel, Qe as default, g as findMethod, h as findProgram, ee as isFixedTerm, x as lktFormatsFor, S as lktGroupsFor, Ve as localStore, Xe as mountPromoTool, C as normalizeData, E as quote, Ue as restStore, te as routeTable, We as seed, He as supabaseStore, _ as termsFor, ne as validateData };
8787
+ export { h as LKT_CUSTOM_BASE, et as PromoTool, m as STATUS_OK, b as coursesForLabel, tt as default, v as findMethod, _ as findProgram, g as isCustomLktGroup, ee as isFixedTerm, T as lktBaseRowsFor, C as lktFormatsFor, w as lktGroupsFor, We as localStore, $e as mountPromoTool, E as normalizeData, D as quote, Ke as restStore, O as routeTable, qe as seed, Ge as supabaseStore, y as termsFor, k as validateData };