esvn-react-barcode-print 1.0.2 → 1.0.3
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 +395 -285
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +408 -288
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -561,7 +561,7 @@ import { QRCodeCanvas } from "qrcode.react";
|
|
|
561
561
|
import { Fragment, useRef, useState } from "react";
|
|
562
562
|
import Barcode from "react-barcode";
|
|
563
563
|
import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
|
|
564
|
-
var PreviewPrint = ({ watch, setValue,
|
|
564
|
+
var PreviewPrint = ({ watch, setValue, sampleData }) => {
|
|
565
565
|
var _a, _b;
|
|
566
566
|
const printType = Number((_a = watch("printType")) != null ? _a : 0);
|
|
567
567
|
const fields = (_b = watch("fields")) != null ? _b : [];
|
|
@@ -576,21 +576,23 @@ var PreviewPrint = ({ watch, setValue, sampleItem }) => {
|
|
|
576
576
|
return "T\xEAn c\xF4ng ty";
|
|
577
577
|
}
|
|
578
578
|
};
|
|
579
|
-
const
|
|
579
|
+
const effectiveSampleData = {
|
|
580
|
+
...sampleData || {},
|
|
580
581
|
companyName: getOrgName(),
|
|
581
|
-
code: "
|
|
582
|
-
productCode: "
|
|
583
|
-
name: "
|
|
584
|
-
productName: "
|
|
582
|
+
code: "SOMI",
|
|
583
|
+
productCode: "SOMI",
|
|
584
|
+
name: "\xC1o s\u01A1 mi nam",
|
|
585
|
+
productName: "\xC1o s\u01A1 mi nam",
|
|
585
586
|
price: "250.000",
|
|
586
587
|
unitPrice: "250.000",
|
|
587
588
|
unitName: "C\xE1i",
|
|
588
589
|
origin: "Vi\u1EC7t Nam",
|
|
589
|
-
categoryRootName: "
|
|
590
|
+
categoryRootName: "Th\u1EDDi trang nam",
|
|
591
|
+
groupProductName: "Th\u1EDDi trang nam",
|
|
590
592
|
lotSerial: "LOT-2026",
|
|
591
593
|
specificationCode: "SIZE-L"
|
|
592
594
|
};
|
|
593
|
-
const barcodeValue =
|
|
595
|
+
const barcodeValue = "Hang-01";
|
|
594
596
|
const hinge = watch("hinge");
|
|
595
597
|
const alignStyle = {
|
|
596
598
|
display: "flex",
|
|
@@ -617,10 +619,12 @@ var PreviewPrint = ({ watch, setValue, sampleItem }) => {
|
|
|
617
619
|
const deltaX = moveEvent.clientX - draggingRef.current.startX;
|
|
618
620
|
const newOffset = Math.max(0, Math.min(180, Math.round(draggingRef.current.initialOffset + deltaX)));
|
|
619
621
|
const currentFields = watch("fields") || [];
|
|
620
|
-
const updatedFields = currentFields.map(
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
622
|
+
const updatedFields = currentFields.map(
|
|
623
|
+
(f) => {
|
|
624
|
+
var _a2;
|
|
625
|
+
return f.id === ((_a2 = draggingRef.current) == null ? void 0 : _a2.fieldId) ? { ...f, offsetX: newOffset } : f;
|
|
626
|
+
}
|
|
627
|
+
);
|
|
624
628
|
setValue("fields", updatedFields);
|
|
625
629
|
};
|
|
626
630
|
const handleMouseUp = () => {
|
|
@@ -717,8 +721,8 @@ var PreviewPrint = ({ watch, setValue, sampleItem }) => {
|
|
|
717
721
|
const renderDynamicFields = () => {
|
|
718
722
|
if (!fields || fields.length === 0) {
|
|
719
723
|
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
720
|
-
/* @__PURE__ */ jsx("div", { style: { ...styles.codeText, ...alignStyle }, children: "
|
|
721
|
-
/* @__PURE__ */ jsx("div", { style: { ...styles.normalText, ...alignStyle }, children: "
|
|
724
|
+
/* @__PURE__ */ jsx("div", { style: { ...styles.codeText, ...alignStyle }, children: "SOMI" }),
|
|
725
|
+
/* @__PURE__ */ jsx("div", { style: { ...styles.normalText, ...alignStyle }, children: "\xC1o s\u01A1 mi nam" }),
|
|
722
726
|
renderCode(),
|
|
723
727
|
/* @__PURE__ */ jsx("div", { style: { ...styles.price, ...alignStyle }, children: "Gi\xE1: 250.000" })
|
|
724
728
|
] });
|
|
@@ -727,7 +731,7 @@ var PreviewPrint = ({ watch, setValue, sampleItem }) => {
|
|
|
727
731
|
if (field.type === "barcode") {
|
|
728
732
|
return renderCode(field);
|
|
729
733
|
}
|
|
730
|
-
const rawVal = field.type === "custom" ? field.customValue || field.label :
|
|
734
|
+
const rawVal = field.type === "custom" ? field.customValue || field.label : effectiveSampleData[field.key] || effectiveSampleData[field.id] || field.label;
|
|
731
735
|
const prefix = field.prefix || "";
|
|
732
736
|
const suffix = field.suffix || "";
|
|
733
737
|
const displayVal = `${prefix}${rawVal}${suffix}`;
|
|
@@ -818,9 +822,20 @@ var styles = {
|
|
|
818
822
|
whiteSpace: "normal"
|
|
819
823
|
}
|
|
820
824
|
};
|
|
825
|
+
var preview_print_default = PreviewPrint;
|
|
821
826
|
|
|
822
827
|
// src/components/setting-print.tsx
|
|
823
|
-
import
|
|
828
|
+
import {
|
|
829
|
+
ArrowDown,
|
|
830
|
+
ArrowUp,
|
|
831
|
+
ChevronDown,
|
|
832
|
+
ChevronRight,
|
|
833
|
+
Menu,
|
|
834
|
+
Minus,
|
|
835
|
+
Plus,
|
|
836
|
+
Settings,
|
|
837
|
+
Trash2
|
|
838
|
+
} from "becoxy-icons";
|
|
824
839
|
import { Fragment as Fragment3, useState as useState2 } from "react";
|
|
825
840
|
import { Controller } from "react-hook-form";
|
|
826
841
|
import {
|
|
@@ -834,11 +849,11 @@ import {
|
|
|
834
849
|
Label,
|
|
835
850
|
UncontrolledDropdown
|
|
836
851
|
} from "reactstrap";
|
|
837
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
838
|
-
var
|
|
852
|
+
import { Fragment as Fragment4, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
853
|
+
var AVAILABLE_EXTRA_FIELDS = [
|
|
839
854
|
{ id: "unitName", key: "unitName", label: "\u0110\u01A1n v\u1ECB t\xEDnh", type: "text", prefix: "\u0110VT: " },
|
|
840
855
|
{ id: "origin", key: "origin", label: "Xu\u1EA5t x\u1EE9", type: "text", prefix: "Xu\u1EA5t x\u1EE9: " },
|
|
841
|
-
{ id: "categoryRootName", key: "categoryRootName", label: "Nh\xF3m
|
|
856
|
+
{ id: "categoryRootName", key: "categoryRootName", label: "Nh\xF3m s\u1EA3n ph\u1EA9m", type: "text", prefix: "Nh\xF3m: " },
|
|
842
857
|
{ id: "specificationCode", key: "specificationCode", label: "M\xE3 quy c\xE1ch", type: "text", prefix: "Quy c\xE1ch: " },
|
|
843
858
|
{ id: "lotSerial", key: "lotSerial", label: "S\u1ED1 l\xF4 / Serial", type: "text", prefix: "L\xF4: " },
|
|
844
859
|
{ id: "customText", key: "custom", label: "V\u0103n b\u1EA3n t\xF9y ch\u1EC9nh", type: "custom", customValue: "H\xE0ng ch\xEDnh h\xE3ng" }
|
|
@@ -851,7 +866,8 @@ var COLOR_PRESETS = [
|
|
|
851
866
|
{ label: "X\xE1m", value: "#6c757d" }
|
|
852
867
|
];
|
|
853
868
|
var SettingPrint = (props) => {
|
|
854
|
-
const
|
|
869
|
+
const t = props.t || ((key) => key);
|
|
870
|
+
const { control, watch, setValue, availableExtraFields, sampleData } = props;
|
|
855
871
|
const [openPaperSection, setOpenPaperSection] = useState2(true);
|
|
856
872
|
const [openInfoSection, setOpenInfoSection] = useState2(true);
|
|
857
873
|
const [openCustomSection, setOpenCustomSection] = useState2(false);
|
|
@@ -892,71 +908,81 @@ var SettingPrint = (props) => {
|
|
|
892
908
|
if (exists) {
|
|
893
909
|
const newFields = fields.map((f) => f.id === fieldTemplate.id ? { ...f, enabled: true } : f);
|
|
894
910
|
setValue("fields", newFields);
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
const newId = fieldTemplate.id === "customText" ? `custom_${Date.now()}` : fieldTemplate.id;
|
|
914
|
+
const newField = {
|
|
915
|
+
id: newId,
|
|
916
|
+
key: fieldTemplate.key,
|
|
917
|
+
label: fieldTemplate.label,
|
|
918
|
+
type: fieldTemplate.type,
|
|
919
|
+
enabled: true,
|
|
920
|
+
bold: false,
|
|
921
|
+
italic: false,
|
|
922
|
+
underline: false,
|
|
923
|
+
color: "#000000",
|
|
924
|
+
fontSize: 13,
|
|
925
|
+
offsetX: 0,
|
|
926
|
+
prefix: fieldTemplate.prefix,
|
|
927
|
+
customValue: fieldTemplate.customValue || "N\u1ED9i dung t\xF9y ch\u1EC9nh"
|
|
928
|
+
};
|
|
929
|
+
setValue("fields", [...fields, newField], { shouldDirty: true, shouldTouch: true });
|
|
930
|
+
if (fieldTemplate.type === "custom") {
|
|
931
|
+
setExpandedFieldId(newId);
|
|
907
932
|
}
|
|
908
933
|
};
|
|
909
|
-
const
|
|
934
|
+
const updateFieldStyle = (index, patch) => {
|
|
910
935
|
const newFields = [...fields];
|
|
911
|
-
newFields[index] = { ...newFields[index],
|
|
912
|
-
setValue("fields", newFields);
|
|
936
|
+
newFields[index] = { ...newFields[index], ...patch };
|
|
937
|
+
setValue("fields", newFields, { shouldDirty: true, shouldTouch: true });
|
|
913
938
|
};
|
|
914
939
|
const handleDragStart = (index) => {
|
|
915
940
|
setDraggedIndex(index);
|
|
916
941
|
};
|
|
917
|
-
const handleDragOver = (e
|
|
942
|
+
const handleDragOver = (e) => {
|
|
918
943
|
e.preventDefault();
|
|
919
|
-
|
|
944
|
+
};
|
|
945
|
+
const handleDrop = (dropIndex) => {
|
|
946
|
+
if (draggedIndex === null || draggedIndex === dropIndex) {
|
|
947
|
+
setDraggedIndex(null);
|
|
920
948
|
return;
|
|
921
949
|
}
|
|
922
950
|
const newFields = [...fields];
|
|
923
|
-
const
|
|
924
|
-
newFields.splice(
|
|
925
|
-
|
|
951
|
+
const draggedItem = newFields[draggedIndex];
|
|
952
|
+
newFields.splice(draggedIndex, 1);
|
|
953
|
+
newFields.splice(dropIndex, 0, draggedItem);
|
|
926
954
|
setValue("fields", newFields);
|
|
927
|
-
};
|
|
928
|
-
const handleDragEnd = () => {
|
|
929
955
|
setDraggedIndex(null);
|
|
930
956
|
};
|
|
931
|
-
return /* @__PURE__ */ jsx2(Fragment3, { children: /* @__PURE__ */ jsxs2("div", { className: "
|
|
932
|
-
/* @__PURE__ */ jsxs2("div", { className: "
|
|
933
|
-
/* @__PURE__ */ jsx2("
|
|
957
|
+
return /* @__PURE__ */ jsx2(Fragment3, { children: /* @__PURE__ */ jsxs2("div", { className: "p-1 setting-print-container", style: { fontSize: "13px" }, children: [
|
|
958
|
+
/* @__PURE__ */ jsx2("div", { className: "mb-2", children: /* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center mb-1", children: [
|
|
959
|
+
/* @__PURE__ */ jsx2("span", { className: "fw-bolder text-dark me-2", children: t("Lo\u1EA1i tem in") }),
|
|
934
960
|
/* @__PURE__ */ jsx2(
|
|
935
961
|
Controller,
|
|
936
962
|
{
|
|
937
963
|
name: "printType",
|
|
938
964
|
control,
|
|
939
|
-
render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsxs2("div", { className: "d-flex", style: { gap: "20px" }, children: [
|
|
965
|
+
render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center", style: { gap: "20px" }, children: [
|
|
940
966
|
/* @__PURE__ */ jsxs2(Label, { className: "d-flex align-items-center mb-0 cursor-pointer", children: [
|
|
941
967
|
/* @__PURE__ */ jsx2(
|
|
942
968
|
Input,
|
|
943
969
|
{
|
|
944
970
|
type: "radio",
|
|
945
|
-
name: "printType",
|
|
946
971
|
className: "me-50 mt-0",
|
|
972
|
+
name: "printType",
|
|
947
973
|
checked: Number(value) === 0,
|
|
948
974
|
onChange: () => onChange(0)
|
|
949
975
|
}
|
|
950
976
|
),
|
|
951
|
-
/* @__PURE__ */ jsx2("span", { children: t("M\xE3 v\u1EA1ch
|
|
977
|
+
/* @__PURE__ */ jsx2("span", { children: t("M\xE3 v\u1EA1ch") })
|
|
952
978
|
] }),
|
|
953
979
|
/* @__PURE__ */ jsxs2(Label, { className: "d-flex align-items-center mb-0 cursor-pointer", children: [
|
|
954
980
|
/* @__PURE__ */ jsx2(
|
|
955
981
|
Input,
|
|
956
982
|
{
|
|
957
983
|
type: "radio",
|
|
958
|
-
name: "printType",
|
|
959
984
|
className: "me-50 mt-0",
|
|
985
|
+
name: "printType",
|
|
960
986
|
checked: Number(value) === 1,
|
|
961
987
|
onChange: () => onChange(1)
|
|
962
988
|
}
|
|
@@ -966,16 +992,16 @@ var SettingPrint = (props) => {
|
|
|
966
992
|
] })
|
|
967
993
|
}
|
|
968
994
|
)
|
|
969
|
-
] }),
|
|
970
|
-
/* @__PURE__ */ jsxs2("div", { className: "
|
|
995
|
+
] }) }),
|
|
996
|
+
/* @__PURE__ */ jsxs2("div", { className: "mb-2", children: [
|
|
971
997
|
/* @__PURE__ */ jsxs2(
|
|
972
998
|
"div",
|
|
973
999
|
{
|
|
974
|
-
className: "d-flex align-items-center
|
|
1000
|
+
className: "d-flex align-items-center cursor-pointer fw-bolder text-dark mb-1",
|
|
975
1001
|
onClick: () => setOpenPaperSection(!openPaperSection),
|
|
976
1002
|
children: [
|
|
977
|
-
/* @__PURE__ */ jsx2(
|
|
978
|
-
|
|
1003
|
+
openPaperSection ? /* @__PURE__ */ jsx2(ChevronDown, { fontSize: 16, className: "me-50" }) : /* @__PURE__ */ jsx2(ChevronRight, { fontSize: 16, className: "me-50" }),
|
|
1004
|
+
/* @__PURE__ */ jsx2("span", { children: t("Ch\u1ECDn kh\u1ED5 gi\u1EA5y") })
|
|
979
1005
|
]
|
|
980
1006
|
}
|
|
981
1007
|
),
|
|
@@ -1063,138 +1089,221 @@ var SettingPrint = (props) => {
|
|
|
1063
1089
|
type: "number",
|
|
1064
1090
|
min: 1,
|
|
1065
1091
|
max: 10,
|
|
1066
|
-
className: "form-control-sm text-center",
|
|
1092
|
+
className: "form-control-sm me-50 text-center",
|
|
1067
1093
|
style: { width: "60px" },
|
|
1068
1094
|
value: stampVal != null ? stampVal : 3,
|
|
1069
|
-
onChange: (e) => onStampChange(
|
|
1095
|
+
onChange: (e) => onStampChange(Number(e.target.value))
|
|
1070
1096
|
}
|
|
1071
1097
|
)
|
|
1072
1098
|
}
|
|
1073
1099
|
),
|
|
1074
|
-
/* @__PURE__ */ jsx2("span", { className: "
|
|
1100
|
+
/* @__PURE__ */ jsx2("span", { className: "text-muted", style: { fontSize: "12px" }, children: t("tem/d\xF2ng") })
|
|
1075
1101
|
] })
|
|
1076
1102
|
] })
|
|
1077
1103
|
] })
|
|
1078
1104
|
}
|
|
1079
1105
|
) })
|
|
1080
1106
|
] }),
|
|
1081
|
-
/* @__PURE__ */ jsxs2("div", { className: "
|
|
1082
|
-
/* @__PURE__ */
|
|
1107
|
+
/* @__PURE__ */ jsxs2("div", { className: "mb-2", children: [
|
|
1108
|
+
/* @__PURE__ */ jsx2(
|
|
1083
1109
|
"div",
|
|
1084
1110
|
{
|
|
1085
|
-
className: "d-flex align-items-center justify-content-between cursor-pointer mb-
|
|
1111
|
+
className: "d-flex align-items-center justify-content-between cursor-pointer fw-bolder text-dark mb-1",
|
|
1086
1112
|
onClick: () => setOpenInfoSection(!openInfoSection),
|
|
1087
|
-
children: [
|
|
1088
|
-
/* @__PURE__ */ jsx2(
|
|
1089
|
-
/* @__PURE__ */
|
|
1090
|
-
|
|
1091
|
-
openInfoSection ? /* @__PURE__ */ jsx2(Icon.ChevronDown, { fontSize: 16 }) : /* @__PURE__ */ jsx2(Icon.ChevronRight, { fontSize: 16 })
|
|
1092
|
-
] })
|
|
1093
|
-
]
|
|
1113
|
+
children: /* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center", children: [
|
|
1114
|
+
openInfoSection ? /* @__PURE__ */ jsx2(ChevronDown, { fontSize: 16, className: "me-50" }) : /* @__PURE__ */ jsx2(ChevronRight, { fontSize: 16, className: "me-50" }),
|
|
1115
|
+
/* @__PURE__ */ jsx2("span", { children: t("Th\xF4ng tin hi\u1EC3n th\u1ECB & \u0110\u1ECBnh d\u1EA1ng") })
|
|
1116
|
+
] })
|
|
1094
1117
|
}
|
|
1095
1118
|
),
|
|
1096
|
-
/* @__PURE__ */ jsx2(Collapse, { isOpen: openInfoSection, children: /* @__PURE__ */ jsxs2("div", { className: "
|
|
1097
|
-
fields.map((field,
|
|
1119
|
+
/* @__PURE__ */ jsx2(Collapse, { isOpen: openInfoSection, children: /* @__PURE__ */ jsxs2("div", { className: "ps-1 pe-1", children: [
|
|
1120
|
+
/* @__PURE__ */ jsx2("div", { className: "d-flex flex-column mb-1", style: { gap: "6px" }, children: fields.map((field, idx) => {
|
|
1098
1121
|
const isExpanded = expandedFieldId === field.id;
|
|
1099
|
-
const
|
|
1122
|
+
const isBold = field.bold !== false;
|
|
1123
|
+
const isItalic = !!field.italic;
|
|
1124
|
+
const isUnderline = !!field.underline;
|
|
1125
|
+
const currentColor = field.color || "#000000";
|
|
1126
|
+
const currentFontSize = field.fontSize || 13;
|
|
1127
|
+
const currentOffset = field.offsetX || 0;
|
|
1100
1128
|
return /* @__PURE__ */ jsxs2(
|
|
1101
1129
|
"div",
|
|
1102
1130
|
{
|
|
1103
|
-
|
|
1104
|
-
onDragStart: () => handleDragStart(index),
|
|
1105
|
-
onDragOver: (e) => handleDragOver(e, index),
|
|
1106
|
-
onDragEnd: handleDragEnd,
|
|
1107
|
-
className: "border rounded p-50",
|
|
1131
|
+
className: "border rounded overflow-hidden",
|
|
1108
1132
|
style: {
|
|
1109
|
-
background:
|
|
1110
|
-
|
|
1111
|
-
transition: "background 0.2s",
|
|
1112
|
-
boxShadow: isExpanded ? "0 2px 6px rgba(0,0,0,0.08)" : "none"
|
|
1133
|
+
background: field.enabled ? "#f8f9fa" : "#ffffff",
|
|
1134
|
+
borderColor: isExpanded ? "#7367f0" : field.enabled ? "#d8d6de" : "#ebe9f1"
|
|
1113
1135
|
},
|
|
1114
1136
|
children: [
|
|
1115
|
-
/* @__PURE__ */ jsxs2(
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1137
|
+
/* @__PURE__ */ jsxs2(
|
|
1138
|
+
"div",
|
|
1139
|
+
{
|
|
1140
|
+
draggable: true,
|
|
1141
|
+
onDragStart: () => handleDragStart(idx),
|
|
1142
|
+
onDragOver: handleDragOver,
|
|
1143
|
+
onDrop: () => handleDrop(idx),
|
|
1144
|
+
className: "d-flex align-items-center justify-content-between p-50",
|
|
1145
|
+
style: {
|
|
1146
|
+
cursor: "grab",
|
|
1147
|
+
userSelect: "none",
|
|
1148
|
+
opacity: draggedIndex === idx ? 0.5 : 1
|
|
1149
|
+
},
|
|
1150
|
+
children: [
|
|
1151
|
+
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center", style: { gap: "8px" }, children: [
|
|
1152
|
+
/* @__PURE__ */ jsx2(Menu, { fontSize: 14, className: "text-muted", style: { cursor: "grab" } }),
|
|
1153
|
+
/* @__PURE__ */ jsx2(
|
|
1154
|
+
Input,
|
|
1155
|
+
{
|
|
1156
|
+
type: "checkbox",
|
|
1157
|
+
checked: field.enabled,
|
|
1158
|
+
onChange: () => handleToggleField(idx),
|
|
1159
|
+
className: "mt-0"
|
|
1160
|
+
}
|
|
1161
|
+
),
|
|
1162
|
+
/* @__PURE__ */ jsx2(
|
|
1163
|
+
"span",
|
|
1164
|
+
{
|
|
1165
|
+
style: {
|
|
1166
|
+
fontWeight: isBold ? 700 : 400,
|
|
1167
|
+
fontStyle: isItalic ? "italic" : "normal",
|
|
1168
|
+
textDecoration: isUnderline ? "underline" : "none",
|
|
1169
|
+
color: field.enabled ? currentColor : "#888"
|
|
1170
|
+
},
|
|
1171
|
+
children: field.type === "custom" && field.customValue ? `T\xF9y ch\u1EC9nh: "${field.customValue}"` : t(field.label)
|
|
1172
|
+
}
|
|
1173
|
+
),
|
|
1174
|
+
currentOffset > 0 && /* @__PURE__ */ jsxs2("span", { className: "badge bg-light-primary text-primary", style: { fontSize: "10px", padding: "2px 4px" }, children: [
|
|
1175
|
+
"+",
|
|
1176
|
+
currentOffset,
|
|
1177
|
+
"px"
|
|
1178
|
+
] })
|
|
1179
|
+
] }),
|
|
1180
|
+
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center", style: { gap: "6px" }, children: [
|
|
1181
|
+
/* @__PURE__ */ jsx2(
|
|
1182
|
+
Button,
|
|
1183
|
+
{
|
|
1184
|
+
size: "sm",
|
|
1185
|
+
color: "flat-primary",
|
|
1186
|
+
className: "p-0 btn-icon",
|
|
1187
|
+
style: {
|
|
1188
|
+
width: "26px",
|
|
1189
|
+
height: "26px",
|
|
1190
|
+
display: "inline-flex",
|
|
1191
|
+
alignItems: "center",
|
|
1192
|
+
justifyContent: "center",
|
|
1193
|
+
borderRadius: "6px",
|
|
1194
|
+
background: isExpanded ? "#7367f0" : "#f0f0f5",
|
|
1195
|
+
color: isExpanded ? "#ffffff" : "#5e5873",
|
|
1196
|
+
border: "none",
|
|
1197
|
+
boxShadow: isExpanded ? "0 2px 6px rgba(115, 103, 240, 0.4)" : "none",
|
|
1198
|
+
transition: "all 0.15s ease"
|
|
1199
|
+
},
|
|
1200
|
+
onClick: (e) => {
|
|
1201
|
+
e.stopPropagation();
|
|
1202
|
+
setExpandedFieldId(isExpanded ? null : field.id);
|
|
1203
|
+
},
|
|
1204
|
+
title: t("T\xF9y ch\u1EC9nh \u0111\u1ECBnh d\u1EA1ng & L\xF9i l\u1EC1"),
|
|
1205
|
+
children: /* @__PURE__ */ jsx2(Settings, { fontSize: 13 })
|
|
1206
|
+
}
|
|
1207
|
+
),
|
|
1208
|
+
/* @__PURE__ */ jsx2(
|
|
1209
|
+
Button,
|
|
1210
|
+
{
|
|
1211
|
+
size: "sm",
|
|
1212
|
+
color: "flat-secondary",
|
|
1213
|
+
className: "p-0 btn-icon",
|
|
1214
|
+
style: {
|
|
1215
|
+
width: "26px",
|
|
1216
|
+
height: "26px",
|
|
1217
|
+
display: "inline-flex",
|
|
1218
|
+
alignItems: "center",
|
|
1219
|
+
justifyContent: "center",
|
|
1220
|
+
borderRadius: "6px",
|
|
1221
|
+
background: "#f0f0f5",
|
|
1222
|
+
border: "none"
|
|
1223
|
+
},
|
|
1224
|
+
disabled: idx === 0,
|
|
1225
|
+
onClick: (e) => {
|
|
1226
|
+
e.stopPropagation();
|
|
1227
|
+
handleMoveUp(idx);
|
|
1228
|
+
},
|
|
1229
|
+
title: t("Di chuy\u1EC3n l\xEAn"),
|
|
1230
|
+
children: /* @__PURE__ */ jsx2(ArrowUp, { fontSize: 13 })
|
|
1231
|
+
}
|
|
1232
|
+
),
|
|
1233
|
+
/* @__PURE__ */ jsx2(
|
|
1234
|
+
Button,
|
|
1235
|
+
{
|
|
1236
|
+
size: "sm",
|
|
1237
|
+
color: "flat-secondary",
|
|
1238
|
+
className: "p-0 btn-icon",
|
|
1239
|
+
style: {
|
|
1240
|
+
width: "26px",
|
|
1241
|
+
height: "26px",
|
|
1242
|
+
display: "inline-flex",
|
|
1243
|
+
alignItems: "center",
|
|
1244
|
+
justifyContent: "center",
|
|
1245
|
+
borderRadius: "6px",
|
|
1246
|
+
background: "#f0f0f5",
|
|
1247
|
+
border: "none"
|
|
1248
|
+
},
|
|
1249
|
+
disabled: idx === fields.length - 1,
|
|
1250
|
+
onClick: (e) => {
|
|
1251
|
+
e.stopPropagation();
|
|
1252
|
+
handleMoveDown(idx);
|
|
1253
|
+
},
|
|
1254
|
+
title: t("Di chuy\u1EC3n xu\u1ED1ng"),
|
|
1255
|
+
children: /* @__PURE__ */ jsx2(ArrowDown, { fontSize: 13 })
|
|
1256
|
+
}
|
|
1257
|
+
),
|
|
1258
|
+
field.type === "custom" || !["companyName", "productCode", "productName", "barcode", "unitPrice"].includes(field.id) ? /* @__PURE__ */ jsx2(
|
|
1259
|
+
Button,
|
|
1260
|
+
{
|
|
1261
|
+
size: "sm",
|
|
1262
|
+
color: "flat-danger",
|
|
1263
|
+
className: "p-0 btn-icon",
|
|
1264
|
+
style: {
|
|
1265
|
+
width: "26px",
|
|
1266
|
+
height: "26px",
|
|
1267
|
+
display: "inline-flex",
|
|
1268
|
+
alignItems: "center",
|
|
1269
|
+
justifyContent: "center",
|
|
1270
|
+
borderRadius: "6px",
|
|
1271
|
+
background: "#fce8e6",
|
|
1272
|
+
color: "#ea5455",
|
|
1273
|
+
border: "none"
|
|
1274
|
+
},
|
|
1275
|
+
onClick: (e) => {
|
|
1276
|
+
e.stopPropagation();
|
|
1277
|
+
handleDeleteField(idx);
|
|
1278
|
+
},
|
|
1279
|
+
title: t("X\xF3a tr\u01B0\u1EDDng"),
|
|
1280
|
+
children: /* @__PURE__ */ jsx2(Trash2, { fontSize: 13 })
|
|
1281
|
+
}
|
|
1282
|
+
) : null
|
|
1283
|
+
] })
|
|
1284
|
+
]
|
|
1285
|
+
}
|
|
1286
|
+
),
|
|
1287
|
+
/* @__PURE__ */ jsx2(Collapse, { isOpen: isExpanded, children: /* @__PURE__ */ jsxs2("div", { className: "p-1 border-top bg-white", style: { fontSize: "12px" }, children: [
|
|
1288
|
+
field.type === "custom" && /* @__PURE__ */ jsxs2("div", { className: "mb-1", children: [
|
|
1289
|
+
/* @__PURE__ */ jsxs2("span", { className: "text-muted d-block mb-25 fw-bolder", children: [
|
|
1290
|
+
t("N\u1ED9i dung v\u0103n b\u1EA3n"),
|
|
1291
|
+
":"
|
|
1292
|
+
] }),
|
|
1125
1293
|
/* @__PURE__ */ jsx2(
|
|
1126
1294
|
Input,
|
|
1127
1295
|
{
|
|
1128
|
-
type: "
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
onChange: () =>
|
|
1133
|
-
}
|
|
1134
|
-
),
|
|
1135
|
-
/* @__PURE__ */ jsx2(
|
|
1136
|
-
Label,
|
|
1137
|
-
{
|
|
1138
|
-
htmlFor: `chk-field-${field.id}`,
|
|
1139
|
-
className: `mb-0 cursor-pointer ${field.enabled ? "fw-bold text-dark" : "text-muted"}`,
|
|
1140
|
-
style: { fontSize: "13px" },
|
|
1141
|
-
children: field.label
|
|
1296
|
+
type: "text",
|
|
1297
|
+
className: "form-control-sm",
|
|
1298
|
+
placeholder: t("Nh\u1EADp n\u1ED9i dung (vd: Hotline: 1900..., H\xE0ng ch\xEDnh h\xE3ng, v.v.)"),
|
|
1299
|
+
value: field.customValue || "",
|
|
1300
|
+
onChange: (e) => updateFieldStyle(idx, { customValue: e.target.value })
|
|
1142
1301
|
}
|
|
1143
1302
|
)
|
|
1144
1303
|
] }),
|
|
1145
|
-
/* @__PURE__ */ jsxs2(
|
|
1146
|
-
/* @__PURE__ */
|
|
1147
|
-
|
|
1148
|
-
{
|
|
1149
|
-
color: "flat-secondary",
|
|
1150
|
-
className: "btn-icon p-0",
|
|
1151
|
-
style: { width: "22px", height: "22px" },
|
|
1152
|
-
onClick: () => handleMoveUp(index),
|
|
1153
|
-
disabled: index === 0,
|
|
1154
|
-
title: t("Di chuy\u1EC3n l\xEAn"),
|
|
1155
|
-
children: /* @__PURE__ */ jsx2(Icon.ArrowUp, { fontSize: 12 })
|
|
1156
|
-
}
|
|
1157
|
-
),
|
|
1158
|
-
/* @__PURE__ */ jsx2(
|
|
1159
|
-
Button,
|
|
1160
|
-
{
|
|
1161
|
-
color: "flat-secondary",
|
|
1162
|
-
className: "btn-icon p-0",
|
|
1163
|
-
style: { width: "22px", height: "22px" },
|
|
1164
|
-
onClick: () => handleMoveDown(index),
|
|
1165
|
-
disabled: index === fields.length - 1,
|
|
1166
|
-
title: t("Di chuy\u1EC3n xu\u1ED1ng"),
|
|
1167
|
-
children: /* @__PURE__ */ jsx2(Icon.ArrowDown, { fontSize: 12 })
|
|
1168
|
-
}
|
|
1169
|
-
),
|
|
1170
|
-
/* @__PURE__ */ jsx2(
|
|
1171
|
-
Button,
|
|
1172
|
-
{
|
|
1173
|
-
color: "flat-secondary",
|
|
1174
|
-
className: "btn-icon p-0",
|
|
1175
|
-
style: { width: "22px", height: "22px" },
|
|
1176
|
-
onClick: () => setExpandedFieldId(isExpanded ? null : field.id),
|
|
1177
|
-
title: t("T\xF9y ch\u1EC9nh \u0111\u1ECBnh d\u1EA1ng"),
|
|
1178
|
-
children: /* @__PURE__ */ jsx2(Icon.Settings, { fontSize: 12, className: isExpanded ? "text-primary" : "" })
|
|
1179
|
-
}
|
|
1180
|
-
),
|
|
1181
|
-
field.type === "custom" && /* @__PURE__ */ jsx2(
|
|
1182
|
-
Button,
|
|
1183
|
-
{
|
|
1184
|
-
color: "flat-danger",
|
|
1185
|
-
className: "btn-icon p-0 text-danger",
|
|
1186
|
-
style: { width: "22px", height: "22px" },
|
|
1187
|
-
onClick: () => handleDeleteField(index),
|
|
1188
|
-
title: t("X\xF3a tr\u01B0\u1EDDng"),
|
|
1189
|
-
children: /* @__PURE__ */ jsx2(Icon.Trash2, { fontSize: 12 })
|
|
1190
|
-
}
|
|
1191
|
-
)
|
|
1192
|
-
] })
|
|
1193
|
-
] }),
|
|
1194
|
-
isExpanded && /* @__PURE__ */ jsxs2("div", { className: "mt-50 pt-50 border-top ps-1 pe-50", children: [
|
|
1195
|
-
field.type !== "barcode" && /* @__PURE__ */ jsxs2("div", { className: "d-flex flex-column", style: { gap: "6px" }, children: [
|
|
1196
|
-
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center justify-content-between", children: [
|
|
1197
|
-
/* @__PURE__ */ jsxs2("span", { className: "small text-muted", children: [
|
|
1304
|
+
field.type !== "barcode" && /* @__PURE__ */ jsxs2(Fragment4, { children: [
|
|
1305
|
+
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center justify-content-between mb-1", children: [
|
|
1306
|
+
/* @__PURE__ */ jsxs2("span", { className: "text-muted", children: [
|
|
1198
1307
|
t("Ki\u1EC3u ch\u1EEF"),
|
|
1199
1308
|
":"
|
|
1200
1309
|
] }),
|
|
@@ -1202,189 +1311,191 @@ var SettingPrint = (props) => {
|
|
|
1202
1311
|
/* @__PURE__ */ jsx2(
|
|
1203
1312
|
Button,
|
|
1204
1313
|
{
|
|
1205
|
-
color:
|
|
1206
|
-
className: "
|
|
1207
|
-
onClick: () =>
|
|
1208
|
-
title: "In \u0111\u1EADm
|
|
1209
|
-
children:
|
|
1314
|
+
color: isBold ? "primary" : "outline-secondary",
|
|
1315
|
+
className: "px-50 py-25 fw-bolder",
|
|
1316
|
+
onClick: () => updateFieldStyle(idx, { bold: !isBold }),
|
|
1317
|
+
title: t("In \u0111\u1EADm"),
|
|
1318
|
+
children: "B"
|
|
1210
1319
|
}
|
|
1211
1320
|
),
|
|
1212
1321
|
/* @__PURE__ */ jsx2(
|
|
1213
1322
|
Button,
|
|
1214
1323
|
{
|
|
1215
|
-
color:
|
|
1216
|
-
className: "
|
|
1217
|
-
onClick: () =>
|
|
1218
|
-
title: "In nghi\xEAng
|
|
1219
|
-
children:
|
|
1324
|
+
color: isItalic ? "primary" : "outline-secondary",
|
|
1325
|
+
className: "px-50 py-25 fst-italic",
|
|
1326
|
+
onClick: () => updateFieldStyle(idx, { italic: !isItalic }),
|
|
1327
|
+
title: t("In nghi\xEAng"),
|
|
1328
|
+
children: "I"
|
|
1220
1329
|
}
|
|
1221
1330
|
),
|
|
1222
1331
|
/* @__PURE__ */ jsx2(
|
|
1223
1332
|
Button,
|
|
1224
1333
|
{
|
|
1225
|
-
color:
|
|
1226
|
-
className: "
|
|
1227
|
-
onClick: () =>
|
|
1228
|
-
title: "G\u1EA1ch ch\xE2n
|
|
1229
|
-
children:
|
|
1334
|
+
color: isUnderline ? "primary" : "outline-secondary",
|
|
1335
|
+
className: "px-50 py-25 text-decoration-underline",
|
|
1336
|
+
onClick: () => updateFieldStyle(idx, { underline: !isUnderline }),
|
|
1337
|
+
title: t("G\u1EA1ch ch\xE2n"),
|
|
1338
|
+
children: "U"
|
|
1230
1339
|
}
|
|
1231
1340
|
)
|
|
1232
1341
|
] })
|
|
1233
1342
|
] }),
|
|
1234
|
-
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center justify-content-between", children: [
|
|
1235
|
-
/* @__PURE__ */ jsxs2("span", { className: "
|
|
1236
|
-
t("C\u1EE1 ch\u1EEF
|
|
1343
|
+
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center justify-content-between mb-1", children: [
|
|
1344
|
+
/* @__PURE__ */ jsxs2("span", { className: "text-muted", children: [
|
|
1345
|
+
t("C\u1EE1 ch\u1EEF"),
|
|
1237
1346
|
":"
|
|
1238
1347
|
] }),
|
|
1239
|
-
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center", children: [
|
|
1348
|
+
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center", style: { gap: "4px" }, children: [
|
|
1240
1349
|
/* @__PURE__ */ jsx2(
|
|
1241
1350
|
Button,
|
|
1242
1351
|
{
|
|
1352
|
+
size: "sm",
|
|
1243
1353
|
color: "outline-secondary",
|
|
1244
|
-
className: "btn-icon
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
children: /* @__PURE__ */ jsx2(Icon.Minus, { fontSize: 10 })
|
|
1354
|
+
className: "p-0 px-25 btn-icon",
|
|
1355
|
+
onClick: () => updateFieldStyle(idx, { fontSize: Math.max(8, currentFontSize - 1) }),
|
|
1356
|
+
children: /* @__PURE__ */ jsx2(Minus, { fontSize: 12 })
|
|
1248
1357
|
}
|
|
1249
1358
|
),
|
|
1250
|
-
/* @__PURE__ */
|
|
1359
|
+
/* @__PURE__ */ jsxs2("span", { className: "fw-bolder px-50 text-center", style: { minWidth: "35px" }, children: [
|
|
1360
|
+
currentFontSize,
|
|
1361
|
+
"px"
|
|
1362
|
+
] }),
|
|
1251
1363
|
/* @__PURE__ */ jsx2(
|
|
1252
1364
|
Button,
|
|
1253
1365
|
{
|
|
1366
|
+
size: "sm",
|
|
1254
1367
|
color: "outline-secondary",
|
|
1255
|
-
className: "btn-icon
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
children: /* @__PURE__ */ jsx2(Icon.Plus, { fontSize: 10 })
|
|
1368
|
+
className: "p-0 px-25 btn-icon",
|
|
1369
|
+
onClick: () => updateFieldStyle(idx, { fontSize: Math.min(24, currentFontSize + 1) }),
|
|
1370
|
+
children: /* @__PURE__ */ jsx2(Plus, { fontSize: 12 })
|
|
1259
1371
|
}
|
|
1260
1372
|
)
|
|
1261
1373
|
] })
|
|
1262
1374
|
] }),
|
|
1263
|
-
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center justify-content-between", children: [
|
|
1264
|
-
/* @__PURE__ */ jsxs2("span", { className: "
|
|
1375
|
+
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center justify-content-between mb-1", children: [
|
|
1376
|
+
/* @__PURE__ */ jsxs2("span", { className: "text-muted", children: [
|
|
1265
1377
|
t("M\xE0u ch\u1EEF"),
|
|
1266
1378
|
":"
|
|
1267
1379
|
] }),
|
|
1268
|
-
/* @__PURE__ */
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1380
|
+
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center", style: { gap: "6px" }, children: [
|
|
1381
|
+
COLOR_PRESETS.map((c) => /* @__PURE__ */ jsx2(
|
|
1382
|
+
"div",
|
|
1383
|
+
{
|
|
1384
|
+
onClick: (e) => {
|
|
1385
|
+
e.stopPropagation();
|
|
1386
|
+
updateFieldStyle(idx, { color: c.value });
|
|
1387
|
+
},
|
|
1388
|
+
style: {
|
|
1389
|
+
width: "18px",
|
|
1390
|
+
height: "18px",
|
|
1391
|
+
borderRadius: "50%",
|
|
1392
|
+
background: c.value,
|
|
1393
|
+
cursor: "pointer",
|
|
1394
|
+
border: currentColor === c.value ? "2px solid #7367f0" : "1px solid #ccc",
|
|
1395
|
+
boxShadow: currentColor === c.value ? "0 0 4px #7367f0" : "none"
|
|
1396
|
+
},
|
|
1397
|
+
title: c.label
|
|
1398
|
+
},
|
|
1399
|
+
c.value
|
|
1400
|
+
)),
|
|
1401
|
+
/* @__PURE__ */ jsx2(
|
|
1402
|
+
Input,
|
|
1403
|
+
{
|
|
1404
|
+
type: "color",
|
|
1405
|
+
value: currentColor,
|
|
1406
|
+
onChange: (e) => updateFieldStyle(idx, { color: e.target.value }),
|
|
1407
|
+
style: { width: "24px", height: "22px", padding: 0, border: "none", cursor: "pointer" },
|
|
1408
|
+
title: t("M\xE0u t\u1EF1 ch\u1ECDn")
|
|
1281
1409
|
}
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1410
|
+
)
|
|
1411
|
+
] })
|
|
1412
|
+
] })
|
|
1413
|
+
] }),
|
|
1414
|
+
/* @__PURE__ */ jsxs2("div", { className: "d-flex flex-column mt-50", children: [
|
|
1415
|
+
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center justify-content-between mb-25", children: [
|
|
1416
|
+
/* @__PURE__ */ jsxs2("span", { className: "text-muted", children: [
|
|
1417
|
+
t("L\xF9i v\xE0o l\u1EC1 tr\xE1i (Th\u1EE5t l\u1EC1)"),
|
|
1289
1418
|
":"
|
|
1290
1419
|
] }),
|
|
1291
|
-
/* @__PURE__ */
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
className: "form-control-sm",
|
|
1296
|
-
style: { width: "120px" },
|
|
1297
|
-
value: field.prefix || "",
|
|
1298
|
-
onChange: (e) => updateFieldProperty(index, "prefix", e.target.value),
|
|
1299
|
-
placeholder: "VD: Gi\xE1: "
|
|
1300
|
-
}
|
|
1301
|
-
)
|
|
1420
|
+
/* @__PURE__ */ jsxs2("span", { className: "fw-bolder text-primary", children: [
|
|
1421
|
+
currentOffset,
|
|
1422
|
+
"px"
|
|
1423
|
+
] })
|
|
1302
1424
|
] }),
|
|
1303
|
-
|
|
1304
|
-
/* @__PURE__ */ jsxs2("span", { className: "small text-muted", children: [
|
|
1305
|
-
t("N\u1ED9i dung"),
|
|
1306
|
-
":"
|
|
1307
|
-
] }),
|
|
1425
|
+
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center", style: { gap: "8px" }, children: [
|
|
1308
1426
|
/* @__PURE__ */ jsx2(
|
|
1309
1427
|
Input,
|
|
1310
1428
|
{
|
|
1311
|
-
type: "
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
] })
|
|
1319
|
-
] }),
|
|
1320
|
-
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center justify-content-between mt-50", children: [
|
|
1321
|
-
/* @__PURE__ */ jsxs2("span", { className: "small text-muted", children: [
|
|
1322
|
-
t("L\xF9i l\u1EC1 tr\xE1i (px)"),
|
|
1323
|
-
":"
|
|
1324
|
-
] }),
|
|
1325
|
-
/* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center", children: [
|
|
1326
|
-
/* @__PURE__ */ jsx2(
|
|
1327
|
-
Button,
|
|
1328
|
-
{
|
|
1329
|
-
color: "outline-secondary",
|
|
1330
|
-
className: "btn-icon p-0",
|
|
1331
|
-
style: { width: "22px", height: "22px" },
|
|
1332
|
-
onClick: () => updateFieldProperty(index, "offsetX", Math.max(0, (field.offsetX || 0) - 2)),
|
|
1333
|
-
children: /* @__PURE__ */ jsx2(Icon.Minus, { fontSize: 10 })
|
|
1429
|
+
type: "range",
|
|
1430
|
+
min: 0,
|
|
1431
|
+
max: 120,
|
|
1432
|
+
step: 2,
|
|
1433
|
+
value: currentOffset,
|
|
1434
|
+
onChange: (e) => updateFieldStyle(idx, { offsetX: Number(e.target.value) }),
|
|
1435
|
+
className: "form-range flex-grow-1"
|
|
1334
1436
|
}
|
|
1335
1437
|
),
|
|
1336
|
-
/* @__PURE__ */ jsx2(
|
|
1337
|
-
/* @__PURE__ */ jsx2(
|
|
1438
|
+
currentOffset > 0 && /* @__PURE__ */ jsx2(
|
|
1338
1439
|
Button,
|
|
1339
1440
|
{
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1441
|
+
size: "sm",
|
|
1442
|
+
color: "flat-secondary",
|
|
1443
|
+
className: "p-0 px-25 text-muted",
|
|
1444
|
+
style: { fontSize: "11px" },
|
|
1445
|
+
onClick: () => updateFieldStyle(idx, { offsetX: 0 }),
|
|
1446
|
+
title: t("\u0110\u1EB7t l\u1EA1i v\u1EC1 0"),
|
|
1447
|
+
children: t("Reset")
|
|
1345
1448
|
}
|
|
1346
1449
|
)
|
|
1450
|
+
] }),
|
|
1451
|
+
/* @__PURE__ */ jsxs2("small", { className: "text-muted", style: { fontSize: "11px" }, children: [
|
|
1452
|
+
"\u{1F4A1} ",
|
|
1453
|
+
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.")
|
|
1347
1454
|
] })
|
|
1348
1455
|
] })
|
|
1349
|
-
] })
|
|
1456
|
+
] }) })
|
|
1350
1457
|
]
|
|
1351
1458
|
},
|
|
1352
1459
|
field.id
|
|
1353
1460
|
);
|
|
1354
|
-
}),
|
|
1355
|
-
/* @__PURE__ */ jsx2("div", { className: "
|
|
1356
|
-
/* @__PURE__ */ jsxs2(DropdownToggle, { color: "
|
|
1357
|
-
/* @__PURE__ */ jsx2(
|
|
1358
|
-
t("Th\xEAm tr\u01B0\u1EDDng th\xF4ng tin
|
|
1461
|
+
}) }),
|
|
1462
|
+
/* @__PURE__ */ jsx2("div", { className: "d-flex justify-content-start mb-1", children: /* @__PURE__ */ jsxs2(UncontrolledDropdown, { children: [
|
|
1463
|
+
/* @__PURE__ */ jsxs2(DropdownToggle, { color: "primary", outline: true, size: "sm", className: "d-flex align-items-center", children: [
|
|
1464
|
+
/* @__PURE__ */ jsx2(Plus, { fontSize: 14, className: "me-50" }),
|
|
1465
|
+
t("Th\xEAm tr\u01B0\u1EDDng th\xF4ng tin")
|
|
1359
1466
|
] }),
|
|
1360
|
-
/* @__PURE__ */ jsx2(DropdownMenu, {
|
|
1467
|
+
/* @__PURE__ */ jsx2(DropdownMenu, { children: (availableExtraFields || AVAILABLE_EXTRA_FIELDS).map((item) => /* @__PURE__ */ jsx2(
|
|
1468
|
+
DropdownItem,
|
|
1469
|
+
{
|
|
1470
|
+
onClick: () => handleAddField(item),
|
|
1471
|
+
children: t(item.label)
|
|
1472
|
+
},
|
|
1473
|
+
item.id
|
|
1474
|
+
)) })
|
|
1361
1475
|
] }) })
|
|
1362
1476
|
] }) })
|
|
1363
1477
|
] }),
|
|
1364
|
-
/* @__PURE__ */ jsxs2("div", { className: "
|
|
1478
|
+
/* @__PURE__ */ jsxs2("div", { className: "mb-2", children: [
|
|
1365
1479
|
/* @__PURE__ */ jsxs2(
|
|
1366
1480
|
"div",
|
|
1367
1481
|
{
|
|
1368
|
-
className: "d-flex align-items-center
|
|
1482
|
+
className: "d-flex align-items-center cursor-pointer fw-bolder text-dark mb-1",
|
|
1369
1483
|
onClick: () => setOpenCustomSection(!openCustomSection),
|
|
1370
1484
|
children: [
|
|
1371
|
-
/* @__PURE__ */ jsx2(
|
|
1372
|
-
|
|
1485
|
+
openCustomSection ? /* @__PURE__ */ jsx2(ChevronDown, { fontSize: 16, className: "me-50" }) : /* @__PURE__ */ jsx2(ChevronRight, { fontSize: 16, className: "me-50" }),
|
|
1486
|
+
/* @__PURE__ */ jsx2("span", { children: t("T\xF9y ch\u1EC9nh gi\u1EA5y in") })
|
|
1373
1487
|
]
|
|
1374
1488
|
}
|
|
1375
1489
|
),
|
|
1376
|
-
/* @__PURE__ */ jsx2(Collapse, { isOpen: openCustomSection, children: /* @__PURE__ */ jsx2("div", { className: "
|
|
1377
|
-
/* @__PURE__ */
|
|
1378
|
-
t("C\u0103n l\u1EC1 ch\u1EEF"),
|
|
1379
|
-
":"
|
|
1380
|
-
] }),
|
|
1490
|
+
/* @__PURE__ */ jsx2(Collapse, { isOpen: openCustomSection, children: /* @__PURE__ */ jsx2("div", { className: "ps-1", children: /* @__PURE__ */ jsxs2("div", { className: "mb-1", children: [
|
|
1491
|
+
/* @__PURE__ */ jsx2("span", { className: "text-muted d-block mb-50", style: { fontSize: "12px" }, children: t("C\u0103n l\u1EC1 n\u1ED9i dung tem") }),
|
|
1381
1492
|
/* @__PURE__ */ jsx2(
|
|
1382
1493
|
Controller,
|
|
1383
1494
|
{
|
|
1384
1495
|
name: "hinge",
|
|
1385
1496
|
control,
|
|
1386
|
-
render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsxs2("div", { className: "d-flex", style: { gap: "
|
|
1387
|
-
/* @__PURE__ */ jsxs2(Label, { className: "d-flex align-items-center mb-0 cursor-pointer
|
|
1497
|
+
render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsxs2("div", { className: "d-flex align-items-center", style: { gap: "20px" }, children: [
|
|
1498
|
+
/* @__PURE__ */ jsxs2(Label, { className: "d-flex align-items-center mb-0 cursor-pointer", children: [
|
|
1388
1499
|
/* @__PURE__ */ jsx2(
|
|
1389
1500
|
Input,
|
|
1390
1501
|
{
|
|
@@ -1397,7 +1508,7 @@ var SettingPrint = (props) => {
|
|
|
1397
1508
|
),
|
|
1398
1509
|
/* @__PURE__ */ jsx2("span", { children: t("C\u0103n tr\xE1i") })
|
|
1399
1510
|
] }),
|
|
1400
|
-
/* @__PURE__ */ jsxs2(Label, { className: "d-flex align-items-center mb-0 cursor-pointer
|
|
1511
|
+
/* @__PURE__ */ jsxs2(Label, { className: "d-flex align-items-center mb-0 cursor-pointer", children: [
|
|
1401
1512
|
/* @__PURE__ */ jsx2(
|
|
1402
1513
|
Input,
|
|
1403
1514
|
{
|
|
@@ -1420,13 +1531,13 @@ var SettingPrint = (props) => {
|
|
|
1420
1531
|
/* @__PURE__ */ jsx2("span", { children: t("Xem tr\u01B0\u1EDBc m\u1EABu in") }),
|
|
1421
1532
|
/* @__PURE__ */ jsx2("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)") })
|
|
1422
1533
|
] }),
|
|
1423
|
-
/* @__PURE__ */ jsx2("div", { className: "d-flex justify-content-center", children: /* @__PURE__ */ jsx2(
|
|
1534
|
+
/* @__PURE__ */ jsx2("div", { className: "d-flex justify-content-center", children: /* @__PURE__ */ jsx2(preview_print_default, { watch, setValue, sampleData }) })
|
|
1424
1535
|
] })
|
|
1425
1536
|
] }) });
|
|
1426
1537
|
};
|
|
1427
1538
|
|
|
1428
1539
|
// src/components/modal-preview-print.tsx
|
|
1429
|
-
import * as
|
|
1540
|
+
import * as Icon from "becoxy-icons";
|
|
1430
1541
|
import { useEffect, useRef as useRef2, useState as useState3 } from "react";
|
|
1431
1542
|
import { Badge, Button as Button2, ButtonGroup as ButtonGroup2, Modal, ModalBody, ModalFooter } from "reactstrap";
|
|
1432
1543
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
@@ -1481,10 +1592,10 @@ var ModalPreviewPrint = ({
|
|
|
1481
1592
|
children: [
|
|
1482
1593
|
/* @__PURE__ */ jsxs3("div", { className: "modal-header d-flex align-items-center justify-content-between px-1_5 py-1 mb-0 border-bottom bg-white", children: [
|
|
1483
1594
|
/* @__PURE__ */ jsxs3("div", { className: "d-flex align-items-center", children: [
|
|
1484
|
-
/* @__PURE__ */ jsx3(
|
|
1595
|
+
/* @__PURE__ */ jsx3(Icon.Printer, { fontSize: 18, className: "text-primary me-50" }),
|
|
1485
1596
|
/* @__PURE__ */ jsx3("h5", { className: "modal-title m-0 fw-bolder text-dark", children: t("Xem tr\u01B0\u1EDBc b\u1EA3n in m\xE3 v\u1EA1ch") })
|
|
1486
1597
|
] }),
|
|
1487
|
-
/* @__PURE__ */ jsx3("div", { className: "cursor-pointer", onClick: toggle, children: /* @__PURE__ */ jsx3(
|
|
1598
|
+
/* @__PURE__ */ jsx3("div", { className: "cursor-pointer", onClick: toggle, children: /* @__PURE__ */ jsx3(Icon.X, { fontSize: 20 }) })
|
|
1488
1599
|
] }),
|
|
1489
1600
|
/* @__PURE__ */ jsxs3(
|
|
1490
1601
|
"div",
|
|
@@ -1554,7 +1665,7 @@ var ModalPreviewPrint = ({
|
|
|
1554
1665
|
style: { width: "22px", height: "22px" },
|
|
1555
1666
|
onClick: handleZoomOut,
|
|
1556
1667
|
title: t("Thu nh\u1ECF"),
|
|
1557
|
-
children: /* @__PURE__ */ jsx3(
|
|
1668
|
+
children: /* @__PURE__ */ jsx3(Icon.Minus, { fontSize: 14 })
|
|
1558
1669
|
}
|
|
1559
1670
|
),
|
|
1560
1671
|
/* @__PURE__ */ jsxs3(
|
|
@@ -1578,7 +1689,7 @@ var ModalPreviewPrint = ({
|
|
|
1578
1689
|
style: { width: "22px", height: "22px" },
|
|
1579
1690
|
onClick: handleZoomIn,
|
|
1580
1691
|
title: t("Ph\xF3ng to"),
|
|
1581
|
-
children: /* @__PURE__ */ jsx3(
|
|
1692
|
+
children: /* @__PURE__ */ jsx3(Icon.Plus, { fontSize: 14 })
|
|
1582
1693
|
}
|
|
1583
1694
|
)
|
|
1584
1695
|
] })
|
|
@@ -1609,7 +1720,7 @@ var ModalPreviewPrint = ({
|
|
|
1609
1720
|
onClick: onPrint,
|
|
1610
1721
|
className: "d-flex align-items-center",
|
|
1611
1722
|
children: [
|
|
1612
|
-
/* @__PURE__ */ jsx3(
|
|
1723
|
+
/* @__PURE__ */ jsx3(Icon.Printer, { fontSize: 14, className: "me-50" }),
|
|
1613
1724
|
t("In")
|
|
1614
1725
|
]
|
|
1615
1726
|
}
|
|
@@ -1622,8 +1733,8 @@ var ModalPreviewPrint = ({
|
|
|
1622
1733
|
};
|
|
1623
1734
|
|
|
1624
1735
|
// src/components/modal-barcode-print.tsx
|
|
1625
|
-
import * as
|
|
1626
|
-
import { Fragment as
|
|
1736
|
+
import * as Icon2 from "becoxy-icons";
|
|
1737
|
+
import { Fragment as Fragment5, useEffect as useEffect2, useState as useState4 } from "react";
|
|
1627
1738
|
import { useForm } from "react-hook-form";
|
|
1628
1739
|
import { Button as Button3, Col, Modal as Modal2, ModalBody as ModalBody2, Row } from "reactstrap";
|
|
1629
1740
|
import Swal from "sweetalert2";
|
|
@@ -1644,8 +1755,10 @@ var ModalBarcodePrint = ({
|
|
|
1644
1755
|
dataSelected,
|
|
1645
1756
|
setDataSelected,
|
|
1646
1757
|
dataItem,
|
|
1758
|
+
initialFields,
|
|
1647
1759
|
defaultFields = DEFAULT_PRINT_FIELDS,
|
|
1648
1760
|
availableExtraFields,
|
|
1761
|
+
sampleData,
|
|
1649
1762
|
renderTable,
|
|
1650
1763
|
children,
|
|
1651
1764
|
windowSize,
|
|
@@ -1654,6 +1767,7 @@ var ModalBarcodePrint = ({
|
|
|
1654
1767
|
notifyError = (msg) => alert(msg),
|
|
1655
1768
|
notifySuccess = (msg) => console.log(msg)
|
|
1656
1769
|
}) => {
|
|
1770
|
+
const effectiveDefaultFields = initialFields || defaultFields;
|
|
1657
1771
|
const defaultValues = {
|
|
1658
1772
|
printType: 0,
|
|
1659
1773
|
paperSize: 2,
|
|
@@ -1665,13 +1779,18 @@ var ModalBarcodePrint = ({
|
|
|
1665
1779
|
unitPrice: true,
|
|
1666
1780
|
printSample: 3,
|
|
1667
1781
|
hinge: false,
|
|
1668
|
-
fields:
|
|
1782
|
+
fields: effectiveDefaultFields
|
|
1669
1783
|
};
|
|
1670
1784
|
const [openPreviewModal, setOpenPreviewModal] = useState4(false);
|
|
1671
1785
|
const { control, watch, setValue, reset, getValues, formState: { errors } } = useForm({
|
|
1672
1786
|
mode: "onChange",
|
|
1673
1787
|
defaultValues
|
|
1674
1788
|
});
|
|
1789
|
+
useEffect2(() => {
|
|
1790
|
+
if (initialFields && initialFields.length > 0) {
|
|
1791
|
+
setValue("fields", initialFields);
|
|
1792
|
+
}
|
|
1793
|
+
}, [initialFields]);
|
|
1675
1794
|
const handleTestPrint = () => {
|
|
1676
1795
|
const settings = getValues();
|
|
1677
1796
|
const targetItems = dataSelected.length > 0 ? dataSelected : dataItem ? [dataItem] : [];
|
|
@@ -1720,25 +1839,25 @@ var ModalBarcodePrint = ({
|
|
|
1720
1839
|
const renderFooterButtons = () => {
|
|
1721
1840
|
return /* @__PURE__ */ jsxs4("div", { className: "d-flex align-items-center", style: { gap: "10px" }, children: [
|
|
1722
1841
|
/* @__PURE__ */ jsxs4(Button3, { color: "primary", onClick: handleResetDefault, className: "d-flex align-items-center text-white", children: [
|
|
1723
|
-
/* @__PURE__ */ jsx4(
|
|
1842
|
+
/* @__PURE__ */ jsx4(Icon2.OutlineReply, { fontSize: 14, className: "me-50" }),
|
|
1724
1843
|
t("Thi\u1EBFt l\u1EADp l\u1EA1i")
|
|
1725
1844
|
] }),
|
|
1726
1845
|
/* @__PURE__ */ jsxs4(Button3, { color: "info", outline: true, onClick: handleOpenPreview, className: "d-flex align-items-center", children: [
|
|
1727
|
-
/* @__PURE__ */ jsx4(
|
|
1846
|
+
/* @__PURE__ */ jsx4(Icon2.Eye, { fontSize: 14, className: "me-50" }),
|
|
1728
1847
|
t("Xem tr\u01B0\u1EDBc")
|
|
1729
1848
|
] }),
|
|
1730
1849
|
/* @__PURE__ */ jsxs4(Button3, { color: "secondary", outline: true, onClick: handleTestPrint, className: "d-flex align-items-center", children: [
|
|
1731
|
-
/* @__PURE__ */ jsx4(
|
|
1850
|
+
/* @__PURE__ */ jsx4(Icon2.Printer, { fontSize: 14, className: "me-50" }),
|
|
1732
1851
|
t("In th\u1EED")
|
|
1733
1852
|
] }),
|
|
1734
1853
|
/* @__PURE__ */ jsxs4(Button3, { color: "primary", onClick: handleRealPrint, className: "d-flex align-items-center", children: [
|
|
1735
|
-
/* @__PURE__ */ jsx4(
|
|
1854
|
+
/* @__PURE__ */ jsx4(Icon2.Printer, { fontSize: 14, className: "me-50" }),
|
|
1736
1855
|
t("In")
|
|
1737
1856
|
] }),
|
|
1738
1857
|
/* @__PURE__ */ jsx4(Button3, { color: "secondary", onClick: toggle, outline: true, children: t("Close") })
|
|
1739
1858
|
] });
|
|
1740
1859
|
};
|
|
1741
|
-
return /* @__PURE__ */ jsxs4(
|
|
1860
|
+
return /* @__PURE__ */ jsxs4(Fragment5, { children: [
|
|
1742
1861
|
/* @__PURE__ */ jsxs4(
|
|
1743
1862
|
Modal2,
|
|
1744
1863
|
{
|
|
@@ -1750,10 +1869,10 @@ var ModalBarcodePrint = ({
|
|
|
1750
1869
|
children: [
|
|
1751
1870
|
/* @__PURE__ */ jsxs4("div", { className: "modal-header d-flex align-items-center justify-content-between p-1 mb-0 border-bottom bg-white flex-shrink-0", children: [
|
|
1752
1871
|
/* @__PURE__ */ jsxs4("div", { className: "d-flex align-items-center", children: [
|
|
1753
|
-
/* @__PURE__ */ jsx4(
|
|
1872
|
+
/* @__PURE__ */ jsx4(Icon2.Printer, { fontSize: 18, className: "text-primary me-50" }),
|
|
1754
1873
|
/* @__PURE__ */ jsx4("h5", { className: "modal-title m-0 fw-bolder text-dark", children: t(title) })
|
|
1755
1874
|
] }),
|
|
1756
|
-
/* @__PURE__ */ jsx4("div", { className: "cursor-pointer", onClick: toggle, children: /* @__PURE__ */ jsx4(
|
|
1875
|
+
/* @__PURE__ */ jsx4("div", { className: "cursor-pointer", onClick: toggle, children: /* @__PURE__ */ jsx4(Icon2.X, { fontSize: 20 }) })
|
|
1757
1876
|
] }),
|
|
1758
1877
|
/* @__PURE__ */ jsx4(ModalBody2, { className: "p-1 flex-grow-1 overflow-hidden", style: { background: "#f8f9fa" }, children: /* @__PURE__ */ jsxs4(Row, { className: "g-1 h-100", children: [
|
|
1759
1878
|
/* @__PURE__ */ jsx4(Col, { lg: 4, md: 12, xs: 12, className: "h-100 overflow-hidden", children: /* @__PURE__ */ jsxs4(
|
|
@@ -1771,6 +1890,7 @@ var ModalBarcodePrint = ({
|
|
|
1771
1890
|
setValue,
|
|
1772
1891
|
errors,
|
|
1773
1892
|
availableExtraFields,
|
|
1893
|
+
sampleData,
|
|
1774
1894
|
t
|
|
1775
1895
|
}
|
|
1776
1896
|
) })
|