esvn-react-barcode-print 1.0.2 → 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.d.mts +10 -7
- package/dist/index.d.ts +10 -7
- package/dist/index.js +435 -305
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +448 -308
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -184,7 +184,10 @@ var generatePrintDocument = (settings, items, isTest = false, isPreview = false)
|
|
|
184
184
|
labelList = [sampleItem];
|
|
185
185
|
} else {
|
|
186
186
|
items.forEach((item) => {
|
|
187
|
-
|
|
187
|
+
var _a2, _b;
|
|
188
|
+
const rawQty = (_b = (_a2 = item.printQuantity) != null ? _a2 : item.quantity) != null ? _b : 1;
|
|
189
|
+
const parsedQty = typeof rawQty === "number" ? rawQty : parseInt(String(rawQty), 10);
|
|
190
|
+
const qty = Math.max(1, isNaN(parsedQty) ? 1 : parsedQty);
|
|
188
191
|
for (let i = 0; i < qty; i++) {
|
|
189
192
|
labelList.push({ ...item, companyName: orgName });
|
|
190
193
|
}
|
|
@@ -196,6 +199,7 @@ var generatePrintDocument = (settings, items, isTest = false, isPreview = false)
|
|
|
196
199
|
if (labelList.length === 0) {
|
|
197
200
|
return { html: "", totalStamps: 0, paperLabel, uniqueProducts: items.length };
|
|
198
201
|
}
|
|
202
|
+
const enabledFieldsCount = (settings.fields || []).filter((f) => f.enabled).length || 4;
|
|
199
203
|
let cols = 3;
|
|
200
204
|
let pageSizeCss = "105mm auto";
|
|
201
205
|
let pageMargin = "0";
|
|
@@ -203,9 +207,9 @@ var generatePrintDocument = (settings, items, isTest = false, isPreview = false)
|
|
|
203
207
|
let labelHeight = "22mm";
|
|
204
208
|
let labelGap = "1.5mm";
|
|
205
209
|
let bodyPadding = "1mm";
|
|
206
|
-
let stampPadding = "2px
|
|
207
|
-
let dynamicFontSize = "8px";
|
|
208
|
-
let barcodeHeight = 16;
|
|
210
|
+
let stampPadding = enabledFieldsCount >= 5 ? "1px 2px" : "1.5px 3px";
|
|
211
|
+
let dynamicFontSize = enabledFieldsCount >= 5 ? "6.8px" : enabledFieldsCount >= 4 ? "7.2px" : "7.8px";
|
|
212
|
+
let barcodeHeight = enabledFieldsCount >= 5 ? 12 : enabledFieldsCount >= 4 ? 14 : 16;
|
|
209
213
|
let sheetWidth = "105mm";
|
|
210
214
|
let sheetMinHeight = "60mm";
|
|
211
215
|
let sheetPadding = "2mm 1mm";
|
|
@@ -235,9 +239,9 @@ var generatePrintDocument = (settings, items, isTest = false, isPreview = false)
|
|
|
235
239
|
labelHeight = "22mm";
|
|
236
240
|
labelGap = "2mm";
|
|
237
241
|
bodyPadding = "1mm";
|
|
238
|
-
stampPadding = "2px
|
|
239
|
-
dynamicFontSize = "8px";
|
|
240
|
-
barcodeHeight = 18;
|
|
242
|
+
stampPadding = enabledFieldsCount >= 5 ? "1px 2px" : "1.5px 3px";
|
|
243
|
+
dynamicFontSize = enabledFieldsCount >= 5 ? "7px" : enabledFieldsCount >= 4 ? "7.5px" : "8px";
|
|
244
|
+
barcodeHeight = enabledFieldsCount >= 5 ? 13 : enabledFieldsCount >= 4 ? 15 : 18;
|
|
241
245
|
sheetWidth = "80mm";
|
|
242
246
|
sheetMinHeight = "60mm";
|
|
243
247
|
sheetPadding = "2mm 1mm";
|
|
@@ -251,9 +255,9 @@ var generatePrintDocument = (settings, items, isTest = false, isPreview = false)
|
|
|
251
255
|
labelHeight = "22mm";
|
|
252
256
|
labelGap = "1.5mm";
|
|
253
257
|
bodyPadding = "1mm";
|
|
254
|
-
stampPadding = "1px 3px";
|
|
255
|
-
dynamicFontSize = "7.
|
|
256
|
-
barcodeHeight = 16;
|
|
258
|
+
stampPadding = enabledFieldsCount >= 5 ? "1px 2px" : "1px 3px";
|
|
259
|
+
dynamicFontSize = enabledFieldsCount >= 5 ? "6.8px" : enabledFieldsCount >= 4 ? "7.2px" : "7.6px";
|
|
260
|
+
barcodeHeight = enabledFieldsCount >= 5 ? 12 : enabledFieldsCount >= 4 ? 14 : 16;
|
|
257
261
|
sheetWidth = "105mm";
|
|
258
262
|
sheetMinHeight = "60mm";
|
|
259
263
|
sheetPadding = "2mm 1mm";
|
|
@@ -404,6 +408,7 @@ var generatePrintDocument = (settings, items, isTest = false, isPreview = false)
|
|
|
404
408
|
width: 100%;
|
|
405
409
|
min-height: ${isTest ? "48mm" : labelHeight === "auto" ? "22mm" : labelHeight};
|
|
406
410
|
height: ${labelHeight === "auto" ? "auto" : labelHeight};
|
|
411
|
+
max-height: ${isTest ? "none" : labelHeight === "auto" ? "none" : labelHeight};
|
|
407
412
|
padding: ${stampPadding};
|
|
408
413
|
display: flex;
|
|
409
414
|
flex-direction: column;
|
|
@@ -433,17 +438,21 @@ var generatePrintDocument = (settings, items, isTest = false, isPreview = false)
|
|
|
433
438
|
}
|
|
434
439
|
.lbl-dynamic, .lbl-company, .lbl-code, .lbl-name, .lbl-price {
|
|
435
440
|
font-size: ${dynamicFontSize};
|
|
436
|
-
line-height: 1.
|
|
441
|
+
line-height: 1.15;
|
|
437
442
|
word-break: break-word;
|
|
438
|
-
|
|
439
|
-
|
|
443
|
+
overflow: hidden;
|
|
444
|
+
text-overflow: ellipsis;
|
|
445
|
+
display: -webkit-box;
|
|
446
|
+
-webkit-box-orient: vertical;
|
|
447
|
+
-webkit-line-clamp: ${enabledFieldsCount >= 5 ? 1 : 2};
|
|
448
|
+
margin-bottom: ${enabledFieldsCount >= 5 ? "1px" : "1.5px"};
|
|
440
449
|
}
|
|
441
450
|
.code-wrapper {
|
|
442
451
|
display: flex;
|
|
443
452
|
flex-direction: column;
|
|
444
453
|
justify-content: center;
|
|
445
454
|
align-items: center;
|
|
446
|
-
margin:
|
|
455
|
+
margin: ${enabledFieldsCount >= 5 ? "1px 0" : "1.5px 0"};
|
|
447
456
|
width: 100%;
|
|
448
457
|
}
|
|
449
458
|
.barcode-svg-box {
|
|
@@ -507,6 +516,8 @@ var generatePrintDocument = (settings, items, isTest = false, isPreview = false)
|
|
|
507
516
|
.stamp-item {
|
|
508
517
|
width: 100%;
|
|
509
518
|
min-height: ${isTest ? "48mm" : labelHeight === "auto" ? "22mm" : labelHeight};
|
|
519
|
+
height: ${isTest ? "auto" : labelHeight === "auto" ? "auto" : labelHeight};
|
|
520
|
+
max-height: ${isTest ? "none" : labelHeight === "auto" ? "none" : labelHeight};
|
|
510
521
|
padding: ${stampPadding};
|
|
511
522
|
display: flex;
|
|
512
523
|
flex-direction: column;
|
|
@@ -517,6 +528,7 @@ var generatePrintDocument = (settings, items, isTest = false, isPreview = false)
|
|
|
517
528
|
border: 1px solid #d8d6de;
|
|
518
529
|
border-radius: 4px;
|
|
519
530
|
background: #fff;
|
|
531
|
+
box-sizing: border-box;
|
|
520
532
|
}
|
|
521
533
|
.text-left {
|
|
522
534
|
text-align: left;
|
|
@@ -528,17 +540,21 @@ var generatePrintDocument = (settings, items, isTest = false, isPreview = false)
|
|
|
528
540
|
}
|
|
529
541
|
.lbl-dynamic, .lbl-company, .lbl-code, .lbl-name, .lbl-price {
|
|
530
542
|
font-size: ${dynamicFontSize};
|
|
531
|
-
line-height: 1.
|
|
543
|
+
line-height: 1.15;
|
|
532
544
|
word-break: break-word;
|
|
533
|
-
|
|
534
|
-
|
|
545
|
+
overflow: hidden;
|
|
546
|
+
text-overflow: ellipsis;
|
|
547
|
+
display: -webkit-box;
|
|
548
|
+
-webkit-box-orient: vertical;
|
|
549
|
+
-webkit-line-clamp: ${enabledFieldsCount >= 5 ? 1 : 2};
|
|
550
|
+
margin-bottom: ${enabledFieldsCount >= 5 ? "1px" : "1.5px"};
|
|
535
551
|
}
|
|
536
552
|
.code-wrapper {
|
|
537
553
|
display: flex;
|
|
538
554
|
flex-direction: column;
|
|
539
555
|
justify-content: center;
|
|
540
556
|
align-items: center;
|
|
541
|
-
margin:
|
|
557
|
+
margin: ${enabledFieldsCount >= 5 ? "1px 0" : "1.5px 0"};
|
|
542
558
|
width: 100%;
|
|
543
559
|
}
|
|
544
560
|
.barcode-svg-box {
|
|
@@ -605,7 +621,7 @@ var import_qrcode = require("qrcode.react");
|
|
|
605
621
|
var import_react = require("react");
|
|
606
622
|
var import_react_barcode = __toESM(require("react-barcode"));
|
|
607
623
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
608
|
-
var PreviewPrint = ({ watch, setValue,
|
|
624
|
+
var PreviewPrint = ({ watch, setValue, sampleData }) => {
|
|
609
625
|
var _a, _b;
|
|
610
626
|
const printType = Number((_a = watch("printType")) != null ? _a : 0);
|
|
611
627
|
const fields = (_b = watch("fields")) != null ? _b : [];
|
|
@@ -620,21 +636,23 @@ var PreviewPrint = ({ watch, setValue, sampleItem }) => {
|
|
|
620
636
|
return "T\xEAn c\xF4ng ty";
|
|
621
637
|
}
|
|
622
638
|
};
|
|
623
|
-
const
|
|
639
|
+
const effectiveSampleData = {
|
|
640
|
+
...sampleData || {},
|
|
624
641
|
companyName: getOrgName(),
|
|
625
|
-
code: "
|
|
626
|
-
productCode: "
|
|
627
|
-
name: "
|
|
628
|
-
productName: "
|
|
642
|
+
code: "SOMI",
|
|
643
|
+
productCode: "SOMI",
|
|
644
|
+
name: "\xC1o s\u01A1 mi nam",
|
|
645
|
+
productName: "\xC1o s\u01A1 mi nam",
|
|
629
646
|
price: "250.000",
|
|
630
647
|
unitPrice: "250.000",
|
|
631
648
|
unitName: "C\xE1i",
|
|
632
649
|
origin: "Vi\u1EC7t Nam",
|
|
633
|
-
categoryRootName: "
|
|
650
|
+
categoryRootName: "Th\u1EDDi trang nam",
|
|
651
|
+
groupProductName: "Th\u1EDDi trang nam",
|
|
634
652
|
lotSerial: "LOT-2026",
|
|
635
653
|
specificationCode: "SIZE-L"
|
|
636
654
|
};
|
|
637
|
-
const barcodeValue =
|
|
655
|
+
const barcodeValue = "Hang-01";
|
|
638
656
|
const hinge = watch("hinge");
|
|
639
657
|
const alignStyle = {
|
|
640
658
|
display: "flex",
|
|
@@ -661,10 +679,12 @@ var PreviewPrint = ({ watch, setValue, sampleItem }) => {
|
|
|
661
679
|
const deltaX = moveEvent.clientX - draggingRef.current.startX;
|
|
662
680
|
const newOffset = Math.max(0, Math.min(180, Math.round(draggingRef.current.initialOffset + deltaX)));
|
|
663
681
|
const currentFields = watch("fields") || [];
|
|
664
|
-
const updatedFields = currentFields.map(
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
682
|
+
const updatedFields = currentFields.map(
|
|
683
|
+
(f) => {
|
|
684
|
+
var _a2;
|
|
685
|
+
return f.id === ((_a2 = draggingRef.current) == null ? void 0 : _a2.fieldId) ? { ...f, offsetX: newOffset } : f;
|
|
686
|
+
}
|
|
687
|
+
);
|
|
668
688
|
setValue("fields", updatedFields);
|
|
669
689
|
};
|
|
670
690
|
const handleMouseUp = () => {
|
|
@@ -761,8 +781,8 @@ var PreviewPrint = ({ watch, setValue, sampleItem }) => {
|
|
|
761
781
|
const renderDynamicFields = () => {
|
|
762
782
|
if (!fields || fields.length === 0) {
|
|
763
783
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
764
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { ...styles.codeText, ...alignStyle }, children: "
|
|
765
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { ...styles.normalText, ...alignStyle }, children: "
|
|
784
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { ...styles.codeText, ...alignStyle }, children: "SOMI" }),
|
|
785
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { ...styles.normalText, ...alignStyle }, children: "\xC1o s\u01A1 mi nam" }),
|
|
766
786
|
renderCode(),
|
|
767
787
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { ...styles.price, ...alignStyle }, children: "Gi\xE1: 250.000" })
|
|
768
788
|
] });
|
|
@@ -771,7 +791,7 @@ var PreviewPrint = ({ watch, setValue, sampleItem }) => {
|
|
|
771
791
|
if (field.type === "barcode") {
|
|
772
792
|
return renderCode(field);
|
|
773
793
|
}
|
|
774
|
-
const rawVal = field.type === "custom" ? field.customValue || field.label :
|
|
794
|
+
const rawVal = field.type === "custom" ? field.customValue || field.label : effectiveSampleData[field.key] || effectiveSampleData[field.id] || field.label;
|
|
775
795
|
const prefix = field.prefix || "";
|
|
776
796
|
const suffix = field.suffix || "";
|
|
777
797
|
const displayVal = `${prefix}${rawVal}${suffix}`;
|
|
@@ -856,23 +876,28 @@ var styles = {
|
|
|
856
876
|
dynamicText: {
|
|
857
877
|
fontSize: 13,
|
|
858
878
|
color: "#111",
|
|
859
|
-
lineHeight: 1.
|
|
879
|
+
lineHeight: 1.2,
|
|
860
880
|
marginBottom: 2,
|
|
861
881
|
wordBreak: "break-word",
|
|
862
|
-
|
|
882
|
+
overflow: "hidden",
|
|
883
|
+
textOverflow: "ellipsis",
|
|
884
|
+
display: "-webkit-box",
|
|
885
|
+
WebkitBoxOrient: "vertical",
|
|
886
|
+
WebkitLineClamp: 2
|
|
863
887
|
}
|
|
864
888
|
};
|
|
889
|
+
var preview_print_default = PreviewPrint;
|
|
865
890
|
|
|
866
891
|
// src/components/setting-print.tsx
|
|
867
|
-
var
|
|
892
|
+
var import_becoxy_icons = require("becoxy-icons");
|
|
868
893
|
var import_react2 = require("react");
|
|
869
894
|
var import_react_hook_form = require("react-hook-form");
|
|
870
895
|
var import_reactstrap = require("reactstrap");
|
|
871
896
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
872
|
-
var
|
|
897
|
+
var AVAILABLE_EXTRA_FIELDS = [
|
|
873
898
|
{ id: "unitName", key: "unitName", label: "\u0110\u01A1n v\u1ECB t\xEDnh", type: "text", prefix: "\u0110VT: " },
|
|
874
899
|
{ id: "origin", key: "origin", label: "Xu\u1EA5t x\u1EE9", type: "text", prefix: "Xu\u1EA5t x\u1EE9: " },
|
|
875
|
-
{ id: "categoryRootName", key: "categoryRootName", label: "Nh\xF3m
|
|
900
|
+
{ id: "categoryRootName", key: "categoryRootName", label: "Nh\xF3m s\u1EA3n ph\u1EA9m", type: "text", prefix: "Nh\xF3m: " },
|
|
876
901
|
{ id: "specificationCode", key: "specificationCode", label: "M\xE3 quy c\xE1ch", type: "text", prefix: "Quy c\xE1ch: " },
|
|
877
902
|
{ id: "lotSerial", key: "lotSerial", label: "S\u1ED1 l\xF4 / Serial", type: "text", prefix: "L\xF4: " },
|
|
878
903
|
{ id: "customText", key: "custom", label: "V\u0103n b\u1EA3n t\xF9y ch\u1EC9nh", type: "custom", customValue: "H\xE0ng ch\xEDnh h\xE3ng" }
|
|
@@ -885,7 +910,8 @@ var COLOR_PRESETS = [
|
|
|
885
910
|
{ label: "X\xE1m", value: "#6c757d" }
|
|
886
911
|
];
|
|
887
912
|
var SettingPrint = (props) => {
|
|
888
|
-
const
|
|
913
|
+
const t = props.t || ((key) => key);
|
|
914
|
+
const { control, watch, setValue, availableExtraFields, sampleData } = props;
|
|
889
915
|
const [openPaperSection, setOpenPaperSection] = (0, import_react2.useState)(true);
|
|
890
916
|
const [openInfoSection, setOpenInfoSection] = (0, import_react2.useState)(true);
|
|
891
917
|
const [openCustomSection, setOpenCustomSection] = (0, import_react2.useState)(false);
|
|
@@ -926,71 +952,81 @@ var SettingPrint = (props) => {
|
|
|
926
952
|
if (exists) {
|
|
927
953
|
const newFields = fields.map((f) => f.id === fieldTemplate.id ? { ...f, enabled: true } : f);
|
|
928
954
|
setValue("fields", newFields);
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
const newId = fieldTemplate.id === "customText" ? `custom_${Date.now()}` : fieldTemplate.id;
|
|
958
|
+
const newField = {
|
|
959
|
+
id: newId,
|
|
960
|
+
key: fieldTemplate.key,
|
|
961
|
+
label: fieldTemplate.label,
|
|
962
|
+
type: fieldTemplate.type,
|
|
963
|
+
enabled: true,
|
|
964
|
+
bold: false,
|
|
965
|
+
italic: false,
|
|
966
|
+
underline: false,
|
|
967
|
+
color: "#000000",
|
|
968
|
+
fontSize: 13,
|
|
969
|
+
offsetX: 0,
|
|
970
|
+
prefix: fieldTemplate.prefix,
|
|
971
|
+
customValue: fieldTemplate.customValue || "N\u1ED9i dung t\xF9y ch\u1EC9nh"
|
|
972
|
+
};
|
|
973
|
+
setValue("fields", [...fields, newField], { shouldDirty: true, shouldTouch: true });
|
|
974
|
+
if (fieldTemplate.type === "custom") {
|
|
975
|
+
setExpandedFieldId(newId);
|
|
941
976
|
}
|
|
942
977
|
};
|
|
943
|
-
const
|
|
978
|
+
const updateFieldStyle = (index, patch) => {
|
|
944
979
|
const newFields = [...fields];
|
|
945
|
-
newFields[index] = { ...newFields[index],
|
|
946
|
-
setValue("fields", newFields);
|
|
980
|
+
newFields[index] = { ...newFields[index], ...patch };
|
|
981
|
+
setValue("fields", newFields, { shouldDirty: true, shouldTouch: true });
|
|
947
982
|
};
|
|
948
983
|
const handleDragStart = (index) => {
|
|
949
984
|
setDraggedIndex(index);
|
|
950
985
|
};
|
|
951
|
-
const handleDragOver = (e
|
|
986
|
+
const handleDragOver = (e) => {
|
|
952
987
|
e.preventDefault();
|
|
953
|
-
|
|
988
|
+
};
|
|
989
|
+
const handleDrop = (dropIndex) => {
|
|
990
|
+
if (draggedIndex === null || draggedIndex === dropIndex) {
|
|
991
|
+
setDraggedIndex(null);
|
|
954
992
|
return;
|
|
955
993
|
}
|
|
956
994
|
const newFields = [...fields];
|
|
957
|
-
const
|
|
958
|
-
newFields.splice(
|
|
959
|
-
|
|
995
|
+
const draggedItem = newFields[draggedIndex];
|
|
996
|
+
newFields.splice(draggedIndex, 1);
|
|
997
|
+
newFields.splice(dropIndex, 0, draggedItem);
|
|
960
998
|
setValue("fields", newFields);
|
|
961
|
-
};
|
|
962
|
-
const handleDragEnd = () => {
|
|
963
999
|
setDraggedIndex(null);
|
|
964
1000
|
};
|
|
965
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "
|
|
966
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "
|
|
967
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("
|
|
1001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "p-1 setting-print-container", style: { fontSize: "13px" }, children: [
|
|
1002
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center mb-1", children: [
|
|
1003
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "fw-bolder text-dark me-2", children: t("Lo\u1EA1i tem in") }),
|
|
968
1004
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
969
1005
|
import_react_hook_form.Controller,
|
|
970
1006
|
{
|
|
971
1007
|
name: "printType",
|
|
972
1008
|
control,
|
|
973
|
-
render: ({ field: { value, onChange } }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex", style: { gap: "20px" }, children: [
|
|
1009
|
+
render: ({ field: { value, onChange } }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center", style: { gap: "20px" }, children: [
|
|
974
1010
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_reactstrap.Label, { className: "d-flex align-items-center mb-0 cursor-pointer", children: [
|
|
975
1011
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
976
1012
|
import_reactstrap.Input,
|
|
977
1013
|
{
|
|
978
1014
|
type: "radio",
|
|
979
|
-
name: "printType",
|
|
980
1015
|
className: "me-50 mt-0",
|
|
1016
|
+
name: "printType",
|
|
981
1017
|
checked: Number(value) === 0,
|
|
982
1018
|
onChange: () => onChange(0)
|
|
983
1019
|
}
|
|
984
1020
|
),
|
|
985
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("M\xE3 v\u1EA1ch
|
|
1021
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("M\xE3 v\u1EA1ch") })
|
|
986
1022
|
] }),
|
|
987
1023
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_reactstrap.Label, { className: "d-flex align-items-center mb-0 cursor-pointer", children: [
|
|
988
1024
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
989
1025
|
import_reactstrap.Input,
|
|
990
1026
|
{
|
|
991
1027
|
type: "radio",
|
|
992
|
-
name: "printType",
|
|
993
1028
|
className: "me-50 mt-0",
|
|
1029
|
+
name: "printType",
|
|
994
1030
|
checked: Number(value) === 1,
|
|
995
1031
|
onChange: () => onChange(1)
|
|
996
1032
|
}
|
|
@@ -1000,16 +1036,16 @@ var SettingPrint = (props) => {
|
|
|
1000
1036
|
] })
|
|
1001
1037
|
}
|
|
1002
1038
|
)
|
|
1003
|
-
] }),
|
|
1004
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "
|
|
1039
|
+
] }) }),
|
|
1040
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "mb-2", children: [
|
|
1005
1041
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1006
1042
|
"div",
|
|
1007
1043
|
{
|
|
1008
|
-
className: "d-flex align-items-center
|
|
1044
|
+
className: "d-flex align-items-center cursor-pointer fw-bolder text-dark mb-1",
|
|
1009
1045
|
onClick: () => setOpenPaperSection(!openPaperSection),
|
|
1010
1046
|
children: [
|
|
1011
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1012
|
-
|
|
1047
|
+
openPaperSection ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.ChevronDown, { fontSize: 16, className: "me-50" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.ChevronRight, { fontSize: 16, className: "me-50" }),
|
|
1048
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("Ch\u1ECDn kh\u1ED5 gi\u1EA5y") })
|
|
1013
1049
|
]
|
|
1014
1050
|
}
|
|
1015
1051
|
),
|
|
@@ -1097,138 +1133,221 @@ var SettingPrint = (props) => {
|
|
|
1097
1133
|
type: "number",
|
|
1098
1134
|
min: 1,
|
|
1099
1135
|
max: 10,
|
|
1100
|
-
className: "form-control-sm text-center",
|
|
1136
|
+
className: "form-control-sm me-50 text-center",
|
|
1101
1137
|
style: { width: "60px" },
|
|
1102
1138
|
value: stampVal != null ? stampVal : 3,
|
|
1103
|
-
onChange: (e) => onStampChange(
|
|
1139
|
+
onChange: (e) => onStampChange(Number(e.target.value))
|
|
1104
1140
|
}
|
|
1105
1141
|
)
|
|
1106
1142
|
}
|
|
1107
1143
|
),
|
|
1108
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "
|
|
1144
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-muted", style: { fontSize: "12px" }, children: t("tem/d\xF2ng") })
|
|
1109
1145
|
] })
|
|
1110
1146
|
] })
|
|
1111
1147
|
] })
|
|
1112
1148
|
}
|
|
1113
1149
|
) })
|
|
1114
1150
|
] }),
|
|
1115
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "
|
|
1116
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1151
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "mb-2", children: [
|
|
1152
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1117
1153
|
"div",
|
|
1118
1154
|
{
|
|
1119
|
-
className: "d-flex align-items-center justify-content-between cursor-pointer mb-
|
|
1155
|
+
className: "d-flex align-items-center justify-content-between cursor-pointer fw-bolder text-dark mb-1",
|
|
1120
1156
|
onClick: () => setOpenInfoSection(!openInfoSection),
|
|
1121
|
-
children: [
|
|
1122
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1123
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1124
|
-
|
|
1125
|
-
openInfoSection ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon.ChevronDown, { fontSize: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon.ChevronRight, { fontSize: 16 })
|
|
1126
|
-
] })
|
|
1127
|
-
]
|
|
1157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center", children: [
|
|
1158
|
+
openInfoSection ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.ChevronDown, { fontSize: 16, className: "me-50" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.ChevronRight, { fontSize: 16, className: "me-50" }),
|
|
1159
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("Th\xF4ng tin hi\u1EC3n th\u1ECB & \u0110\u1ECBnh d\u1EA1ng") })
|
|
1160
|
+
] })
|
|
1128
1161
|
}
|
|
1129
1162
|
),
|
|
1130
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_reactstrap.Collapse, { isOpen: openInfoSection, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "
|
|
1131
|
-
fields.map((field,
|
|
1163
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_reactstrap.Collapse, { isOpen: openInfoSection, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "ps-1 pe-1", children: [
|
|
1164
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "d-flex flex-column mb-1", style: { gap: "6px" }, children: fields.map((field, idx) => {
|
|
1132
1165
|
const isExpanded = expandedFieldId === field.id;
|
|
1133
|
-
const
|
|
1166
|
+
const isBold = field.bold !== false;
|
|
1167
|
+
const isItalic = !!field.italic;
|
|
1168
|
+
const isUnderline = !!field.underline;
|
|
1169
|
+
const currentColor = field.color || "#000000";
|
|
1170
|
+
const currentFontSize = field.fontSize || 13;
|
|
1171
|
+
const currentOffset = field.offsetX || 0;
|
|
1134
1172
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1135
1173
|
"div",
|
|
1136
1174
|
{
|
|
1137
|
-
|
|
1138
|
-
onDragStart: () => handleDragStart(index),
|
|
1139
|
-
onDragOver: (e) => handleDragOver(e, index),
|
|
1140
|
-
onDragEnd: handleDragEnd,
|
|
1141
|
-
className: "border rounded p-50",
|
|
1175
|
+
className: "border rounded overflow-hidden",
|
|
1142
1176
|
style: {
|
|
1143
|
-
background:
|
|
1144
|
-
|
|
1145
|
-
transition: "background 0.2s",
|
|
1146
|
-
boxShadow: isExpanded ? "0 2px 6px rgba(0,0,0,0.08)" : "none"
|
|
1177
|
+
background: field.enabled ? "#f8f9fa" : "#ffffff",
|
|
1178
|
+
borderColor: isExpanded ? "#7367f0" : field.enabled ? "#d8d6de" : "#ebe9f1"
|
|
1147
1179
|
},
|
|
1148
1180
|
children: [
|
|
1149
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1181
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1182
|
+
"div",
|
|
1183
|
+
{
|
|
1184
|
+
draggable: true,
|
|
1185
|
+
onDragStart: () => handleDragStart(idx),
|
|
1186
|
+
onDragOver: handleDragOver,
|
|
1187
|
+
onDrop: () => handleDrop(idx),
|
|
1188
|
+
className: "d-flex align-items-center justify-content-between p-50",
|
|
1189
|
+
style: {
|
|
1190
|
+
cursor: "grab",
|
|
1191
|
+
userSelect: "none",
|
|
1192
|
+
opacity: draggedIndex === idx ? 0.5 : 1
|
|
1193
|
+
},
|
|
1194
|
+
children: [
|
|
1195
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center", style: { gap: "8px" }, children: [
|
|
1196
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.Menu, { fontSize: 14, className: "text-muted", style: { cursor: "grab" } }),
|
|
1197
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1198
|
+
import_reactstrap.Input,
|
|
1199
|
+
{
|
|
1200
|
+
type: "checkbox",
|
|
1201
|
+
checked: field.enabled,
|
|
1202
|
+
onChange: () => handleToggleField(idx),
|
|
1203
|
+
className: "mt-0"
|
|
1204
|
+
}
|
|
1205
|
+
),
|
|
1206
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1207
|
+
"span",
|
|
1208
|
+
{
|
|
1209
|
+
style: {
|
|
1210
|
+
fontWeight: isBold ? 700 : 400,
|
|
1211
|
+
fontStyle: isItalic ? "italic" : "normal",
|
|
1212
|
+
textDecoration: isUnderline ? "underline" : "none",
|
|
1213
|
+
color: field.enabled ? currentColor : "#888"
|
|
1214
|
+
},
|
|
1215
|
+
children: field.type === "custom" && field.customValue ? `T\xF9y ch\u1EC9nh: "${field.customValue}"` : t(field.label)
|
|
1216
|
+
}
|
|
1217
|
+
),
|
|
1218
|
+
currentOffset > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "badge bg-light-primary text-primary", style: { fontSize: "10px", padding: "2px 4px" }, children: [
|
|
1219
|
+
"+",
|
|
1220
|
+
currentOffset,
|
|
1221
|
+
"px"
|
|
1222
|
+
] })
|
|
1223
|
+
] }),
|
|
1224
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center", style: { gap: "6px" }, children: [
|
|
1225
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1226
|
+
import_reactstrap.Button,
|
|
1227
|
+
{
|
|
1228
|
+
size: "sm",
|
|
1229
|
+
color: "flat-primary",
|
|
1230
|
+
className: "p-0 btn-icon",
|
|
1231
|
+
style: {
|
|
1232
|
+
width: "26px",
|
|
1233
|
+
height: "26px",
|
|
1234
|
+
display: "inline-flex",
|
|
1235
|
+
alignItems: "center",
|
|
1236
|
+
justifyContent: "center",
|
|
1237
|
+
borderRadius: "6px",
|
|
1238
|
+
background: isExpanded ? "#7367f0" : "#f0f0f5",
|
|
1239
|
+
color: isExpanded ? "#ffffff" : "#5e5873",
|
|
1240
|
+
border: "none",
|
|
1241
|
+
boxShadow: isExpanded ? "0 2px 6px rgba(115, 103, 240, 0.4)" : "none",
|
|
1242
|
+
transition: "all 0.15s ease"
|
|
1243
|
+
},
|
|
1244
|
+
onClick: (e) => {
|
|
1245
|
+
e.stopPropagation();
|
|
1246
|
+
setExpandedFieldId(isExpanded ? null : field.id);
|
|
1247
|
+
},
|
|
1248
|
+
title: t("T\xF9y ch\u1EC9nh \u0111\u1ECBnh d\u1EA1ng & L\xF9i l\u1EC1"),
|
|
1249
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.Settings, { fontSize: 13 })
|
|
1250
|
+
}
|
|
1251
|
+
),
|
|
1252
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1253
|
+
import_reactstrap.Button,
|
|
1254
|
+
{
|
|
1255
|
+
size: "sm",
|
|
1256
|
+
color: "flat-secondary",
|
|
1257
|
+
className: "p-0 btn-icon",
|
|
1258
|
+
style: {
|
|
1259
|
+
width: "26px",
|
|
1260
|
+
height: "26px",
|
|
1261
|
+
display: "inline-flex",
|
|
1262
|
+
alignItems: "center",
|
|
1263
|
+
justifyContent: "center",
|
|
1264
|
+
borderRadius: "6px",
|
|
1265
|
+
background: "#f0f0f5",
|
|
1266
|
+
border: "none"
|
|
1267
|
+
},
|
|
1268
|
+
disabled: idx === 0,
|
|
1269
|
+
onClick: (e) => {
|
|
1270
|
+
e.stopPropagation();
|
|
1271
|
+
handleMoveUp(idx);
|
|
1272
|
+
},
|
|
1273
|
+
title: t("Di chuy\u1EC3n l\xEAn"),
|
|
1274
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.ArrowUp, { fontSize: 13 })
|
|
1275
|
+
}
|
|
1276
|
+
),
|
|
1277
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1278
|
+
import_reactstrap.Button,
|
|
1279
|
+
{
|
|
1280
|
+
size: "sm",
|
|
1281
|
+
color: "flat-secondary",
|
|
1282
|
+
className: "p-0 btn-icon",
|
|
1283
|
+
style: {
|
|
1284
|
+
width: "26px",
|
|
1285
|
+
height: "26px",
|
|
1286
|
+
display: "inline-flex",
|
|
1287
|
+
alignItems: "center",
|
|
1288
|
+
justifyContent: "center",
|
|
1289
|
+
borderRadius: "6px",
|
|
1290
|
+
background: "#f0f0f5",
|
|
1291
|
+
border: "none"
|
|
1292
|
+
},
|
|
1293
|
+
disabled: idx === fields.length - 1,
|
|
1294
|
+
onClick: (e) => {
|
|
1295
|
+
e.stopPropagation();
|
|
1296
|
+
handleMoveDown(idx);
|
|
1297
|
+
},
|
|
1298
|
+
title: t("Di chuy\u1EC3n xu\u1ED1ng"),
|
|
1299
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.ArrowDown, { fontSize: 13 })
|
|
1300
|
+
}
|
|
1301
|
+
),
|
|
1302
|
+
field.type === "custom" || !["companyName", "productCode", "productName", "barcode", "unitPrice"].includes(field.id) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1303
|
+
import_reactstrap.Button,
|
|
1304
|
+
{
|
|
1305
|
+
size: "sm",
|
|
1306
|
+
color: "flat-danger",
|
|
1307
|
+
className: "p-0 btn-icon",
|
|
1308
|
+
style: {
|
|
1309
|
+
width: "26px",
|
|
1310
|
+
height: "26px",
|
|
1311
|
+
display: "inline-flex",
|
|
1312
|
+
alignItems: "center",
|
|
1313
|
+
justifyContent: "center",
|
|
1314
|
+
borderRadius: "6px",
|
|
1315
|
+
background: "#fce8e6",
|
|
1316
|
+
color: "#ea5455",
|
|
1317
|
+
border: "none"
|
|
1318
|
+
},
|
|
1319
|
+
onClick: (e) => {
|
|
1320
|
+
e.stopPropagation();
|
|
1321
|
+
handleDeleteField(idx);
|
|
1322
|
+
},
|
|
1323
|
+
title: t("X\xF3a tr\u01B0\u1EDDng"),
|
|
1324
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.Trash2, { fontSize: 13 })
|
|
1325
|
+
}
|
|
1326
|
+
) : null
|
|
1327
|
+
] })
|
|
1328
|
+
]
|
|
1329
|
+
}
|
|
1330
|
+
),
|
|
1331
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_reactstrap.Collapse, { isOpen: isExpanded, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "p-1 border-top bg-white", style: { fontSize: "12px" }, children: [
|
|
1332
|
+
field.type === "custom" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "mb-1", children: [
|
|
1333
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "text-muted d-block mb-25 fw-bolder", children: [
|
|
1334
|
+
t("N\u1ED9i dung v\u0103n b\u1EA3n"),
|
|
1335
|
+
":"
|
|
1336
|
+
] }),
|
|
1159
1337
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1160
1338
|
import_reactstrap.Input,
|
|
1161
1339
|
{
|
|
1162
|
-
type: "
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
onChange: () =>
|
|
1167
|
-
}
|
|
1168
|
-
),
|
|
1169
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1170
|
-
import_reactstrap.Label,
|
|
1171
|
-
{
|
|
1172
|
-
htmlFor: `chk-field-${field.id}`,
|
|
1173
|
-
className: `mb-0 cursor-pointer ${field.enabled ? "fw-bold text-dark" : "text-muted"}`,
|
|
1174
|
-
style: { fontSize: "13px" },
|
|
1175
|
-
children: field.label
|
|
1340
|
+
type: "text",
|
|
1341
|
+
className: "form-control-sm",
|
|
1342
|
+
placeholder: t("Nh\u1EADp n\u1ED9i dung (vd: Hotline: 1900..., H\xE0ng ch\xEDnh h\xE3ng, v.v.)"),
|
|
1343
|
+
value: field.customValue || "",
|
|
1344
|
+
onChange: (e) => updateFieldStyle(idx, { customValue: e.target.value })
|
|
1176
1345
|
}
|
|
1177
1346
|
)
|
|
1178
1347
|
] }),
|
|
1179
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1180
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1181
|
-
|
|
1182
|
-
{
|
|
1183
|
-
color: "flat-secondary",
|
|
1184
|
-
className: "btn-icon p-0",
|
|
1185
|
-
style: { width: "22px", height: "22px" },
|
|
1186
|
-
onClick: () => handleMoveUp(index),
|
|
1187
|
-
disabled: index === 0,
|
|
1188
|
-
title: t("Di chuy\u1EC3n l\xEAn"),
|
|
1189
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon.ArrowUp, { fontSize: 12 })
|
|
1190
|
-
}
|
|
1191
|
-
),
|
|
1192
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1193
|
-
import_reactstrap.Button,
|
|
1194
|
-
{
|
|
1195
|
-
color: "flat-secondary",
|
|
1196
|
-
className: "btn-icon p-0",
|
|
1197
|
-
style: { width: "22px", height: "22px" },
|
|
1198
|
-
onClick: () => handleMoveDown(index),
|
|
1199
|
-
disabled: index === fields.length - 1,
|
|
1200
|
-
title: t("Di chuy\u1EC3n xu\u1ED1ng"),
|
|
1201
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon.ArrowDown, { fontSize: 12 })
|
|
1202
|
-
}
|
|
1203
|
-
),
|
|
1204
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1205
|
-
import_reactstrap.Button,
|
|
1206
|
-
{
|
|
1207
|
-
color: "flat-secondary",
|
|
1208
|
-
className: "btn-icon p-0",
|
|
1209
|
-
style: { width: "22px", height: "22px" },
|
|
1210
|
-
onClick: () => setExpandedFieldId(isExpanded ? null : field.id),
|
|
1211
|
-
title: t("T\xF9y ch\u1EC9nh \u0111\u1ECBnh d\u1EA1ng"),
|
|
1212
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon.Settings, { fontSize: 12, className: isExpanded ? "text-primary" : "" })
|
|
1213
|
-
}
|
|
1214
|
-
),
|
|
1215
|
-
field.type === "custom" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1216
|
-
import_reactstrap.Button,
|
|
1217
|
-
{
|
|
1218
|
-
color: "flat-danger",
|
|
1219
|
-
className: "btn-icon p-0 text-danger",
|
|
1220
|
-
style: { width: "22px", height: "22px" },
|
|
1221
|
-
onClick: () => handleDeleteField(index),
|
|
1222
|
-
title: t("X\xF3a tr\u01B0\u1EDDng"),
|
|
1223
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon.Trash2, { fontSize: 12 })
|
|
1224
|
-
}
|
|
1225
|
-
)
|
|
1226
|
-
] })
|
|
1227
|
-
] }),
|
|
1228
|
-
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "mt-50 pt-50 border-top ps-1 pe-50", children: [
|
|
1229
|
-
field.type !== "barcode" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex flex-column", style: { gap: "6px" }, children: [
|
|
1230
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center justify-content-between", children: [
|
|
1231
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "small text-muted", children: [
|
|
1348
|
+
field.type !== "barcode" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1349
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center justify-content-between mb-1", children: [
|
|
1350
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "text-muted", children: [
|
|
1232
1351
|
t("Ki\u1EC3u ch\u1EEF"),
|
|
1233
1352
|
":"
|
|
1234
1353
|
] }),
|
|
@@ -1236,189 +1355,191 @@ var SettingPrint = (props) => {
|
|
|
1236
1355
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1237
1356
|
import_reactstrap.Button,
|
|
1238
1357
|
{
|
|
1239
|
-
color:
|
|
1240
|
-
className: "
|
|
1241
|
-
onClick: () =>
|
|
1242
|
-
title: "In \u0111\u1EADm
|
|
1243
|
-
children:
|
|
1358
|
+
color: isBold ? "primary" : "outline-secondary",
|
|
1359
|
+
className: "px-50 py-25 fw-bolder",
|
|
1360
|
+
onClick: () => updateFieldStyle(idx, { bold: !isBold }),
|
|
1361
|
+
title: t("In \u0111\u1EADm"),
|
|
1362
|
+
children: "B"
|
|
1244
1363
|
}
|
|
1245
1364
|
),
|
|
1246
1365
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1247
1366
|
import_reactstrap.Button,
|
|
1248
1367
|
{
|
|
1249
|
-
color:
|
|
1250
|
-
className: "
|
|
1251
|
-
onClick: () =>
|
|
1252
|
-
title: "In nghi\xEAng
|
|
1253
|
-
children:
|
|
1368
|
+
color: isItalic ? "primary" : "outline-secondary",
|
|
1369
|
+
className: "px-50 py-25 fst-italic",
|
|
1370
|
+
onClick: () => updateFieldStyle(idx, { italic: !isItalic }),
|
|
1371
|
+
title: t("In nghi\xEAng"),
|
|
1372
|
+
children: "I"
|
|
1254
1373
|
}
|
|
1255
1374
|
),
|
|
1256
1375
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1257
1376
|
import_reactstrap.Button,
|
|
1258
1377
|
{
|
|
1259
|
-
color:
|
|
1260
|
-
className: "
|
|
1261
|
-
onClick: () =>
|
|
1262
|
-
title: "G\u1EA1ch ch\xE2n
|
|
1263
|
-
children:
|
|
1378
|
+
color: isUnderline ? "primary" : "outline-secondary",
|
|
1379
|
+
className: "px-50 py-25 text-decoration-underline",
|
|
1380
|
+
onClick: () => updateFieldStyle(idx, { underline: !isUnderline }),
|
|
1381
|
+
title: t("G\u1EA1ch ch\xE2n"),
|
|
1382
|
+
children: "U"
|
|
1264
1383
|
}
|
|
1265
1384
|
)
|
|
1266
1385
|
] })
|
|
1267
1386
|
] }),
|
|
1268
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center justify-content-between", children: [
|
|
1269
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "
|
|
1270
|
-
t("C\u1EE1 ch\u1EEF
|
|
1387
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center justify-content-between mb-1", children: [
|
|
1388
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "text-muted", children: [
|
|
1389
|
+
t("C\u1EE1 ch\u1EEF"),
|
|
1271
1390
|
":"
|
|
1272
1391
|
] }),
|
|
1273
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center", children: [
|
|
1392
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center", style: { gap: "4px" }, children: [
|
|
1274
1393
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1275
1394
|
import_reactstrap.Button,
|
|
1276
1395
|
{
|
|
1396
|
+
size: "sm",
|
|
1277
1397
|
color: "outline-secondary",
|
|
1278
|
-
className: "btn-icon
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon.Minus, { fontSize: 10 })
|
|
1398
|
+
className: "p-0 px-25 btn-icon",
|
|
1399
|
+
onClick: () => updateFieldStyle(idx, { fontSize: Math.max(8, currentFontSize - 1) }),
|
|
1400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.Minus, { fontSize: 12 })
|
|
1282
1401
|
}
|
|
1283
1402
|
),
|
|
1284
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1403
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "fw-bolder px-50 text-center", style: { minWidth: "35px" }, children: [
|
|
1404
|
+
currentFontSize,
|
|
1405
|
+
"px"
|
|
1406
|
+
] }),
|
|
1285
1407
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1286
1408
|
import_reactstrap.Button,
|
|
1287
1409
|
{
|
|
1410
|
+
size: "sm",
|
|
1288
1411
|
color: "outline-secondary",
|
|
1289
|
-
className: "btn-icon
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon.Plus, { fontSize: 10 })
|
|
1412
|
+
className: "p-0 px-25 btn-icon",
|
|
1413
|
+
onClick: () => updateFieldStyle(idx, { fontSize: Math.min(24, currentFontSize + 1) }),
|
|
1414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.Plus, { fontSize: 12 })
|
|
1293
1415
|
}
|
|
1294
1416
|
)
|
|
1295
1417
|
] })
|
|
1296
1418
|
] }),
|
|
1297
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center justify-content-between", children: [
|
|
1298
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center justify-content-between mb-1", children: [
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "text-muted", children: [
|
|
1299
1421
|
t("M\xE0u ch\u1EEF"),
|
|
1300
1422
|
":"
|
|
1301
1423
|
] }),
|
|
1302
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1424
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center", style: { gap: "6px" }, children: [
|
|
1425
|
+
COLOR_PRESETS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1426
|
+
"div",
|
|
1427
|
+
{
|
|
1428
|
+
onClick: (e) => {
|
|
1429
|
+
e.stopPropagation();
|
|
1430
|
+
updateFieldStyle(idx, { color: c.value });
|
|
1431
|
+
},
|
|
1432
|
+
style: {
|
|
1433
|
+
width: "18px",
|
|
1434
|
+
height: "18px",
|
|
1435
|
+
borderRadius: "50%",
|
|
1436
|
+
background: c.value,
|
|
1437
|
+
cursor: "pointer",
|
|
1438
|
+
border: currentColor === c.value ? "2px solid #7367f0" : "1px solid #ccc",
|
|
1439
|
+
boxShadow: currentColor === c.value ? "0 0 4px #7367f0" : "none"
|
|
1440
|
+
},
|
|
1441
|
+
title: c.label
|
|
1442
|
+
},
|
|
1443
|
+
c.value
|
|
1444
|
+
)),
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1446
|
+
import_reactstrap.Input,
|
|
1447
|
+
{
|
|
1448
|
+
type: "color",
|
|
1449
|
+
value: currentColor,
|
|
1450
|
+
onChange: (e) => updateFieldStyle(idx, { color: e.target.value }),
|
|
1451
|
+
style: { width: "24px", height: "22px", padding: 0, border: "none", cursor: "pointer" },
|
|
1452
|
+
title: t("M\xE0u t\u1EF1 ch\u1ECDn")
|
|
1315
1453
|
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1454
|
+
)
|
|
1455
|
+
] })
|
|
1456
|
+
] })
|
|
1457
|
+
] }),
|
|
1458
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex flex-column mt-50", children: [
|
|
1459
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center justify-content-between mb-25", children: [
|
|
1460
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "text-muted", children: [
|
|
1461
|
+
t("L\xF9i v\xE0o l\u1EC1 tr\xE1i (Th\u1EE5t l\u1EC1)"),
|
|
1323
1462
|
":"
|
|
1324
1463
|
] }),
|
|
1325
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
className: "form-control-sm",
|
|
1330
|
-
style: { width: "120px" },
|
|
1331
|
-
value: field.prefix || "",
|
|
1332
|
-
onChange: (e) => updateFieldProperty(index, "prefix", e.target.value),
|
|
1333
|
-
placeholder: "VD: Gi\xE1: "
|
|
1334
|
-
}
|
|
1335
|
-
)
|
|
1464
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "fw-bolder text-primary", children: [
|
|
1465
|
+
currentOffset,
|
|
1466
|
+
"px"
|
|
1467
|
+
] })
|
|
1336
1468
|
] }),
|
|
1337
|
-
|
|
1338
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "small text-muted", children: [
|
|
1339
|
-
t("N\u1ED9i dung"),
|
|
1340
|
-
":"
|
|
1341
|
-
] }),
|
|
1469
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center", style: { gap: "8px" }, children: [
|
|
1342
1470
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1343
1471
|
import_reactstrap.Input,
|
|
1344
1472
|
{
|
|
1345
|
-
type: "
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
] })
|
|
1353
|
-
] }),
|
|
1354
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center justify-content-between mt-50", children: [
|
|
1355
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "small text-muted", children: [
|
|
1356
|
-
t("L\xF9i l\u1EC1 tr\xE1i (px)"),
|
|
1357
|
-
":"
|
|
1358
|
-
] }),
|
|
1359
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center", children: [
|
|
1360
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1361
|
-
import_reactstrap.Button,
|
|
1362
|
-
{
|
|
1363
|
-
color: "outline-secondary",
|
|
1364
|
-
className: "btn-icon p-0",
|
|
1365
|
-
style: { width: "22px", height: "22px" },
|
|
1366
|
-
onClick: () => updateFieldProperty(index, "offsetX", Math.max(0, (field.offsetX || 0) - 2)),
|
|
1367
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon.Minus, { fontSize: 10 })
|
|
1473
|
+
type: "range",
|
|
1474
|
+
min: 0,
|
|
1475
|
+
max: 120,
|
|
1476
|
+
step: 2,
|
|
1477
|
+
value: currentOffset,
|
|
1478
|
+
onChange: (e) => updateFieldStyle(idx, { offsetX: Number(e.target.value) }),
|
|
1479
|
+
className: "form-range flex-grow-1"
|
|
1368
1480
|
}
|
|
1369
1481
|
),
|
|
1370
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1371
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1482
|
+
currentOffset > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1372
1483
|
import_reactstrap.Button,
|
|
1373
1484
|
{
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1485
|
+
size: "sm",
|
|
1486
|
+
color: "flat-secondary",
|
|
1487
|
+
className: "p-0 px-25 text-muted",
|
|
1488
|
+
style: { fontSize: "11px" },
|
|
1489
|
+
onClick: () => updateFieldStyle(idx, { offsetX: 0 }),
|
|
1490
|
+
title: t("\u0110\u1EB7t l\u1EA1i v\u1EC1 0"),
|
|
1491
|
+
children: t("Reset")
|
|
1379
1492
|
}
|
|
1380
1493
|
)
|
|
1494
|
+
] }),
|
|
1495
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("small", { className: "text-muted", style: { fontSize: "11px" }, children: [
|
|
1496
|
+
"\u{1F4A1} ",
|
|
1497
|
+
t("B\u1EA1n c\u0169ng c\xF3 th\u1EC3 click & k\xE9o chu\u1ED9t tr\u1EF1c ti\u1EBFp tr\xEAn khung xem tr\u01B0\u1EDBc b\xEAn d\u01B0\u1EDBi.")
|
|
1381
1498
|
] })
|
|
1382
1499
|
] })
|
|
1383
|
-
] })
|
|
1500
|
+
] }) })
|
|
1384
1501
|
]
|
|
1385
1502
|
},
|
|
1386
1503
|
field.id
|
|
1387
1504
|
);
|
|
1388
|
-
}),
|
|
1389
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "
|
|
1390
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_reactstrap.DropdownToggle, { color: "
|
|
1391
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1392
|
-
t("Th\xEAm tr\u01B0\u1EDDng th\xF4ng tin
|
|
1505
|
+
}) }),
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "d-flex justify-content-start mb-1", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_reactstrap.UncontrolledDropdown, { children: [
|
|
1507
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_reactstrap.DropdownToggle, { color: "primary", outline: true, size: "sm", className: "d-flex align-items-center", children: [
|
|
1508
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.Plus, { fontSize: 14, className: "me-50" }),
|
|
1509
|
+
t("Th\xEAm tr\u01B0\u1EDDng th\xF4ng tin")
|
|
1393
1510
|
] }),
|
|
1394
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_reactstrap.DropdownMenu, {
|
|
1511
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_reactstrap.DropdownMenu, { children: (availableExtraFields || AVAILABLE_EXTRA_FIELDS).map((item) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1512
|
+
import_reactstrap.DropdownItem,
|
|
1513
|
+
{
|
|
1514
|
+
onClick: () => handleAddField(item),
|
|
1515
|
+
children: t(item.label)
|
|
1516
|
+
},
|
|
1517
|
+
item.id
|
|
1518
|
+
)) })
|
|
1395
1519
|
] }) })
|
|
1396
1520
|
] }) })
|
|
1397
1521
|
] }),
|
|
1398
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "
|
|
1522
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "mb-2", children: [
|
|
1399
1523
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1400
1524
|
"div",
|
|
1401
1525
|
{
|
|
1402
|
-
className: "d-flex align-items-center
|
|
1526
|
+
className: "d-flex align-items-center cursor-pointer fw-bolder text-dark mb-1",
|
|
1403
1527
|
onClick: () => setOpenCustomSection(!openCustomSection),
|
|
1404
1528
|
children: [
|
|
1405
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1406
|
-
|
|
1529
|
+
openCustomSection ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.ChevronDown, { fontSize: 16, className: "me-50" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_becoxy_icons.ChevronRight, { fontSize: 16, className: "me-50" }),
|
|
1530
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("T\xF9y ch\u1EC9nh gi\u1EA5y in") })
|
|
1407
1531
|
]
|
|
1408
1532
|
}
|
|
1409
1533
|
),
|
|
1410
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_reactstrap.Collapse, { isOpen: openCustomSection, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "
|
|
1411
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1412
|
-
t("C\u0103n l\u1EC1 ch\u1EEF"),
|
|
1413
|
-
":"
|
|
1414
|
-
] }),
|
|
1534
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_reactstrap.Collapse, { isOpen: openCustomSection, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "ps-1", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "mb-1", children: [
|
|
1535
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-muted d-block mb-50", style: { fontSize: "12px" }, children: t("C\u0103n l\u1EC1 n\u1ED9i dung tem") }),
|
|
1415
1536
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1416
1537
|
import_react_hook_form.Controller,
|
|
1417
1538
|
{
|
|
1418
1539
|
name: "hinge",
|
|
1419
1540
|
control,
|
|
1420
|
-
render: ({ field: { value, onChange } }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex", style: { gap: "
|
|
1421
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_reactstrap.Label, { className: "d-flex align-items-center mb-0 cursor-pointer
|
|
1541
|
+
render: ({ field: { value, onChange } }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "d-flex align-items-center", style: { gap: "20px" }, children: [
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_reactstrap.Label, { className: "d-flex align-items-center mb-0 cursor-pointer", children: [
|
|
1422
1543
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1423
1544
|
import_reactstrap.Input,
|
|
1424
1545
|
{
|
|
@@ -1431,7 +1552,7 @@ var SettingPrint = (props) => {
|
|
|
1431
1552
|
),
|
|
1432
1553
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("C\u0103n tr\xE1i") })
|
|
1433
1554
|
] }),
|
|
1434
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_reactstrap.Label, { className: "d-flex align-items-center mb-0 cursor-pointer
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_reactstrap.Label, { className: "d-flex align-items-center mb-0 cursor-pointer", children: [
|
|
1435
1556
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1436
1557
|
import_reactstrap.Input,
|
|
1437
1558
|
{
|
|
@@ -1454,13 +1575,13 @@ var SettingPrint = (props) => {
|
|
|
1454
1575
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("Xem tr\u01B0\u1EDBc m\u1EABu in") }),
|
|
1455
1576
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { className: "text-muted fw-normal", style: { fontSize: "11px" }, children: t("(K\xE9o chu\u1ED9t tr\xEAn d\xF2ng \u0111\u1EC3 d\u1ECBch l\u1EC1)") })
|
|
1456
1577
|
] }),
|
|
1457
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "d-flex justify-content-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "d-flex justify-content-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(preview_print_default, { watch, setValue, sampleData }) })
|
|
1458
1579
|
] })
|
|
1459
1580
|
] }) });
|
|
1460
1581
|
};
|
|
1461
1582
|
|
|
1462
1583
|
// src/components/modal-preview-print.tsx
|
|
1463
|
-
var
|
|
1584
|
+
var Icon = __toESM(require("becoxy-icons"));
|
|
1464
1585
|
var import_react3 = require("react");
|
|
1465
1586
|
var import_reactstrap2 = require("reactstrap");
|
|
1466
1587
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -1515,10 +1636,10 @@ var ModalPreviewPrint = ({
|
|
|
1515
1636
|
children: [
|
|
1516
1637
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "modal-header d-flex align-items-center justify-content-between px-1_5 py-1 mb-0 border-bottom bg-white", children: [
|
|
1517
1638
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "d-flex align-items-center", children: [
|
|
1518
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1639
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon.Printer, { fontSize: 18, className: "text-primary me-50" }),
|
|
1519
1640
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h5", { className: "modal-title m-0 fw-bolder text-dark", children: t("Xem tr\u01B0\u1EDBc b\u1EA3n in m\xE3 v\u1EA1ch") })
|
|
1520
1641
|
] }),
|
|
1521
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "cursor-pointer", onClick: toggle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "cursor-pointer", onClick: toggle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon.X, { fontSize: 20 }) })
|
|
1522
1643
|
] }),
|
|
1523
1644
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1524
1645
|
"div",
|
|
@@ -1588,7 +1709,7 @@ var ModalPreviewPrint = ({
|
|
|
1588
1709
|
style: { width: "22px", height: "22px" },
|
|
1589
1710
|
onClick: handleZoomOut,
|
|
1590
1711
|
title: t("Thu nh\u1ECF"),
|
|
1591
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1712
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon.Minus, { fontSize: 14 })
|
|
1592
1713
|
}
|
|
1593
1714
|
),
|
|
1594
1715
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
@@ -1612,7 +1733,7 @@ var ModalPreviewPrint = ({
|
|
|
1612
1733
|
style: { width: "22px", height: "22px" },
|
|
1613
1734
|
onClick: handleZoomIn,
|
|
1614
1735
|
title: t("Ph\xF3ng to"),
|
|
1615
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1736
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon.Plus, { fontSize: 14 })
|
|
1616
1737
|
}
|
|
1617
1738
|
)
|
|
1618
1739
|
] })
|
|
@@ -1643,7 +1764,7 @@ var ModalPreviewPrint = ({
|
|
|
1643
1764
|
onClick: onPrint,
|
|
1644
1765
|
className: "d-flex align-items-center",
|
|
1645
1766
|
children: [
|
|
1646
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1767
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon.Printer, { fontSize: 14, className: "me-50" }),
|
|
1647
1768
|
t("In")
|
|
1648
1769
|
]
|
|
1649
1770
|
}
|
|
@@ -1656,7 +1777,7 @@ var ModalPreviewPrint = ({
|
|
|
1656
1777
|
};
|
|
1657
1778
|
|
|
1658
1779
|
// src/components/modal-barcode-print.tsx
|
|
1659
|
-
var
|
|
1780
|
+
var Icon2 = __toESM(require("becoxy-icons"));
|
|
1660
1781
|
var import_react4 = require("react");
|
|
1661
1782
|
var import_react_hook_form2 = require("react-hook-form");
|
|
1662
1783
|
var import_reactstrap3 = require("reactstrap");
|
|
@@ -1678,8 +1799,10 @@ var ModalBarcodePrint = ({
|
|
|
1678
1799
|
dataSelected,
|
|
1679
1800
|
setDataSelected,
|
|
1680
1801
|
dataItem,
|
|
1802
|
+
initialFields,
|
|
1681
1803
|
defaultFields = DEFAULT_PRINT_FIELDS,
|
|
1682
1804
|
availableExtraFields,
|
|
1805
|
+
sampleData,
|
|
1683
1806
|
renderTable,
|
|
1684
1807
|
children,
|
|
1685
1808
|
windowSize,
|
|
@@ -1688,6 +1811,7 @@ var ModalBarcodePrint = ({
|
|
|
1688
1811
|
notifyError = (msg) => alert(msg),
|
|
1689
1812
|
notifySuccess = (msg) => console.log(msg)
|
|
1690
1813
|
}) => {
|
|
1814
|
+
const effectiveDefaultFields = initialFields || defaultFields;
|
|
1691
1815
|
const defaultValues = {
|
|
1692
1816
|
printType: 0,
|
|
1693
1817
|
paperSize: 2,
|
|
@@ -1699,13 +1823,18 @@ var ModalBarcodePrint = ({
|
|
|
1699
1823
|
unitPrice: true,
|
|
1700
1824
|
printSample: 3,
|
|
1701
1825
|
hinge: false,
|
|
1702
|
-
fields:
|
|
1826
|
+
fields: effectiveDefaultFields
|
|
1703
1827
|
};
|
|
1704
1828
|
const [openPreviewModal, setOpenPreviewModal] = (0, import_react4.useState)(false);
|
|
1705
1829
|
const { control, watch, setValue, reset, getValues, formState: { errors } } = (0, import_react_hook_form2.useForm)({
|
|
1706
1830
|
mode: "onChange",
|
|
1707
1831
|
defaultValues
|
|
1708
1832
|
});
|
|
1833
|
+
(0, import_react4.useEffect)(() => {
|
|
1834
|
+
if (initialFields && initialFields.length > 0) {
|
|
1835
|
+
setValue("fields", initialFields);
|
|
1836
|
+
}
|
|
1837
|
+
}, [initialFields]);
|
|
1709
1838
|
const handleTestPrint = () => {
|
|
1710
1839
|
const settings = getValues();
|
|
1711
1840
|
const targetItems = dataSelected.length > 0 ? dataSelected : dataItem ? [dataItem] : [];
|
|
@@ -1754,19 +1883,19 @@ var ModalBarcodePrint = ({
|
|
|
1754
1883
|
const renderFooterButtons = () => {
|
|
1755
1884
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "d-flex align-items-center", style: { gap: "10px" }, children: [
|
|
1756
1885
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_reactstrap3.Button, { color: "primary", onClick: handleResetDefault, className: "d-flex align-items-center text-white", children: [
|
|
1757
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1886
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon2.OutlineReply, { fontSize: 14, className: "me-50" }),
|
|
1758
1887
|
t("Thi\u1EBFt l\u1EADp l\u1EA1i")
|
|
1759
1888
|
] }),
|
|
1760
1889
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_reactstrap3.Button, { color: "info", outline: true, onClick: handleOpenPreview, className: "d-flex align-items-center", children: [
|
|
1761
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1890
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon2.Eye, { fontSize: 14, className: "me-50" }),
|
|
1762
1891
|
t("Xem tr\u01B0\u1EDBc")
|
|
1763
1892
|
] }),
|
|
1764
1893
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_reactstrap3.Button, { color: "secondary", outline: true, onClick: handleTestPrint, className: "d-flex align-items-center", children: [
|
|
1765
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1894
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon2.Printer, { fontSize: 14, className: "me-50" }),
|
|
1766
1895
|
t("In th\u1EED")
|
|
1767
1896
|
] }),
|
|
1768
1897
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_reactstrap3.Button, { color: "primary", onClick: handleRealPrint, className: "d-flex align-items-center", children: [
|
|
1769
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1898
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon2.Printer, { fontSize: 14, className: "me-50" }),
|
|
1770
1899
|
t("In")
|
|
1771
1900
|
] }),
|
|
1772
1901
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_reactstrap3.Button, { color: "secondary", onClick: toggle, outline: true, children: t("Close") })
|
|
@@ -1784,10 +1913,10 @@ var ModalBarcodePrint = ({
|
|
|
1784
1913
|
children: [
|
|
1785
1914
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "modal-header d-flex align-items-center justify-content-between p-1 mb-0 border-bottom bg-white flex-shrink-0", children: [
|
|
1786
1915
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "d-flex align-items-center", children: [
|
|
1787
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1916
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon2.Printer, { fontSize: 18, className: "text-primary me-50" }),
|
|
1788
1917
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h5", { className: "modal-title m-0 fw-bolder text-dark", children: t(title) })
|
|
1789
1918
|
] }),
|
|
1790
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "cursor-pointer", onClick: toggle, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "cursor-pointer", onClick: toggle, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon2.X, { fontSize: 20 }) })
|
|
1791
1920
|
] }),
|
|
1792
1921
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_reactstrap3.ModalBody, { className: "p-1 flex-grow-1 overflow-hidden", style: { background: "#f8f9fa" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_reactstrap3.Row, { className: "g-1 h-100", children: [
|
|
1793
1922
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_reactstrap3.Col, { lg: 4, md: 12, xs: 12, className: "h-100 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
@@ -1805,6 +1934,7 @@ var ModalBarcodePrint = ({
|
|
|
1805
1934
|
setValue,
|
|
1806
1935
|
errors,
|
|
1807
1936
|
availableExtraFields,
|
|
1937
|
+
sampleData,
|
|
1808
1938
|
t
|
|
1809
1939
|
}
|
|
1810
1940
|
) })
|