@pisell/private-materials 6.3.220 → 6.3.222
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +13 -13
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +13 -13
- package/es/components/kioskSkuDetail/index.js +7 -7
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +53 -26
- package/es/components/scanOrder/components/Content/index.js +14 -2
- package/es/components/scanOrder/components/ExitConfirmModal/index.js +84 -0
- package/es/components/scanOrder/components/ExitConfirmModal/index.less +182 -0
- package/es/components/scanOrder/locales.js +20 -0
- package/es/index.d.ts +9 -1
- package/es/index.js +6 -2
- package/es/plus/inventory/BindingModal.js +94 -0
- package/es/plus/inventory/InventoryItemManagement.d.ts +7 -0
- package/es/plus/inventory/InventoryItemManagement.js +204 -0
- package/es/plus/inventory/InventoryLocationManagement.d.ts +7 -0
- package/es/plus/inventory/InventoryLocationManagement.js +296 -0
- package/es/plus/inventory/InventoryUnitManagement.d.ts +7 -0
- package/es/plus/inventory/InventoryUnitManagement.js +144 -0
- package/es/plus/inventory/ItemDrawer.js +266 -0
- package/es/plus/inventory/RecordDialog.js +141 -0
- package/es/plus/inventory/StockList.js +132 -0
- package/es/plus/inventory/api.js +66 -0
- package/es/plus/inventory/components.js +172 -0
- package/es/plus/inventory/context.js +118 -0
- package/es/plus/inventory/forms.js +46 -0
- package/es/plus/inventory/hooks.js +235 -0
- package/es/plus/inventory/index.less +559 -0
- package/es/plus/inventory/locales.js +277 -0
- package/es/plus/inventory/types.d.ts +10 -0
- package/es/plus/inventory/utils.js +24 -0
- package/es/plus/panpacificTask/JobCard.js +22 -0
- package/es/plus/panpacificTask/JobDrawer.js +366 -0
- package/es/plus/panpacificTask/JobForm.js +312 -0
- package/es/plus/panpacificTask/JobStatus.js +29 -0
- package/es/plus/panpacificTask/PanpacificTask.d.ts +7 -0
- package/es/plus/panpacificTask/PanpacificTask.js +552 -0
- package/es/plus/panpacificTask/PhotoPreview.js +37 -0
- package/es/plus/panpacificTask/README.md +114 -0
- package/es/plus/panpacificTask/attachments.js +64 -0
- package/es/plus/panpacificTask/index.d.ts +2 -0
- package/es/plus/panpacificTask/index.less +539 -0
- package/es/plus/panpacificTask/locales.js +586 -0
- package/es/plus/panpacificTask/model.js +260 -0
- package/es/plus/panpacificTask/saveJob.js +68 -0
- package/es/plus/panpacificTask/serve.js +243 -0
- package/es/plus/panpacificTask/tenant.js +16 -0
- package/es/plus/panpacificTask/types.d.ts +19 -0
- package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
- package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
- package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
- package/es/plus/pisellSupersetDashboard/README.md +291 -0
- package/es/plus/pisellSupersetDashboard/index.d.ts +15 -0
- package/es/plus/pisellSupersetDashboard/index.js +187 -0
- package/es/plus/pisellSupersetDashboard/index.less +83 -0
- package/es/plus/pisellSupersetDashboard/locales.js +36 -0
- package/es/plus/pisellSupersetDashboard/serve.js +51 -0
- package/es/plus/pisellSupersetDashboard/types.d.ts +17 -0
- package/es/plus/skuOptionsSelection/store/createStore.js +2 -2
- package/es/private-materials/lowcode/authmodal/meta.d.ts +1 -0
- package/es/pro/Login2.0/AuthModal.d.ts +1 -1
- package/es/pro/Login2.0/index.d.ts +1 -2
- package/es/pro/Login2.0/shared/types.d.ts +1 -1
- package/lib/components/kioskSkuDetail/index.js +7 -7
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +53 -26
- package/lib/components/scanOrder/components/Content/index.js +14 -2
- package/lib/components/scanOrder/components/ExitConfirmModal/index.js +86 -0
- package/lib/components/scanOrder/components/ExitConfirmModal/index.less +182 -0
- package/lib/components/scanOrder/locales.js +20 -0
- package/lib/index.d.ts +9 -1
- package/lib/index.js +136 -126
- package/lib/plus/inventory/BindingModal.js +96 -0
- package/lib/plus/inventory/InventoryItemManagement.d.ts +7 -0
- package/lib/plus/inventory/InventoryItemManagement.js +206 -0
- package/lib/plus/inventory/InventoryLocationManagement.d.ts +7 -0
- package/lib/plus/inventory/InventoryLocationManagement.js +298 -0
- package/lib/plus/inventory/InventoryUnitManagement.d.ts +7 -0
- package/lib/plus/inventory/InventoryUnitManagement.js +146 -0
- package/lib/plus/inventory/ItemDrawer.js +268 -0
- package/lib/plus/inventory/RecordDialog.js +143 -0
- package/lib/plus/inventory/StockList.js +134 -0
- package/lib/plus/inventory/api.js +66 -0
- package/lib/plus/inventory/components.js +181 -0
- package/lib/plus/inventory/context.js +121 -0
- package/lib/plus/inventory/forms.js +50 -0
- package/lib/plus/inventory/hooks.js +240 -0
- package/lib/plus/inventory/index.less +559 -0
- package/lib/plus/inventory/locales.js +277 -0
- package/lib/plus/inventory/types.d.ts +10 -0
- package/lib/plus/inventory/utils.js +30 -0
- package/lib/plus/panpacificTask/JobCard.js +24 -0
- package/lib/plus/panpacificTask/JobDrawer.js +368 -0
- package/lib/plus/panpacificTask/JobForm.js +314 -0
- package/lib/plus/panpacificTask/JobStatus.js +33 -0
- package/lib/plus/panpacificTask/PanpacificTask.d.ts +7 -0
- package/lib/plus/panpacificTask/PanpacificTask.js +555 -0
- package/lib/plus/panpacificTask/PhotoPreview.js +39 -0
- package/lib/plus/panpacificTask/README.md +114 -0
- package/lib/plus/panpacificTask/attachments.js +66 -0
- package/lib/plus/panpacificTask/index.d.ts +2 -0
- package/lib/plus/panpacificTask/index.less +539 -0
- package/lib/plus/panpacificTask/locales.js +586 -0
- package/lib/plus/panpacificTask/model.js +289 -0
- package/lib/plus/panpacificTask/saveJob.js +68 -0
- package/lib/plus/panpacificTask/serve.js +260 -0
- package/lib/plus/panpacificTask/tenant.js +17 -0
- package/lib/plus/panpacificTask/types.d.ts +19 -0
- package/lib/plus/pisellSupersetDashboard/README.md +291 -0
- package/lib/plus/pisellSupersetDashboard/index.d.ts +15 -0
- package/lib/plus/pisellSupersetDashboard/index.js +189 -0
- package/lib/plus/pisellSupersetDashboard/index.less +83 -0
- package/lib/plus/pisellSupersetDashboard/locales.js +36 -0
- package/lib/plus/pisellSupersetDashboard/serve.js +52 -0
- package/lib/plus/pisellSupersetDashboard/types.d.ts +17 -0
- package/lowcode/inventory-item-management/meta.ts +20 -0
- package/lowcode/inventory-location-management/meta.ts +20 -0
- package/lowcode/inventory-unit-management/meta.ts +20 -0
- package/lowcode/panpacific-task/meta.ts +51 -0
- package/lowcode/pisell-superset-dashboard/meta.ts +75 -0
- package/package.json +4 -2
- package/es/plus/pisellReservation/index.js +0 -17
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
3
|
+
const require_asyncToGenerator = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
|
|
4
|
+
const require_attachments = require("./attachments.js");
|
|
5
|
+
const require_model = require("./model.js");
|
|
6
|
+
const require_serve = require("./serve.js");
|
|
7
|
+
const require_JobForm = require("./JobForm.js");
|
|
8
|
+
const require_PhotoPreview = require("./PhotoPreview.js");
|
|
9
|
+
const require_JobStatus = require("./JobStatus.js");
|
|
10
|
+
let react = require("react");
|
|
11
|
+
react = require_runtime.__toESM(react);
|
|
12
|
+
let antd = require("antd");
|
|
13
|
+
let _ant_design_icons = require("@ant-design/icons");
|
|
14
|
+
//#region src/plus/panpacificTask/JobDrawer.tsx
|
|
15
|
+
function JobDrawer({ id, request, jobs, base, getText, uploadPhoto, confirm, onClose, onChanged, onDuplicate, startEditing }) {
|
|
16
|
+
var _base$categories$find, _related$photos, _related$payments;
|
|
17
|
+
const [job, setJob] = (0, react.useState)();
|
|
18
|
+
const [related, setRelated] = (0, react.useState)({});
|
|
19
|
+
const [loading, setLoading] = (0, react.useState)(true);
|
|
20
|
+
const [editing, setEditing] = (0, react.useState)(!!startEditing);
|
|
21
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
22
|
+
const [error, setError] = (0, react.useState)("");
|
|
23
|
+
const [recordUncertain, setRecordUncertain] = (0, react.useState)(false);
|
|
24
|
+
const locked = (0, react.useRef)(false);
|
|
25
|
+
const formRef = (0, react.useRef)(null);
|
|
26
|
+
const [direction, setDirection] = (0, react.useState)("payment");
|
|
27
|
+
const [amount, setAmount] = (0, react.useState)(null);
|
|
28
|
+
const [reference, setReference] = (0, react.useState)("");
|
|
29
|
+
const [photo, setPhoto] = (0, react.useState)();
|
|
30
|
+
const pendingPhoto = (0, react.useRef)();
|
|
31
|
+
const mounted = (0, react.useRef)(true);
|
|
32
|
+
const sequence = (0, react.useRef)(0);
|
|
33
|
+
const dirtyPayment = !!amount || !!reference || !!photo;
|
|
34
|
+
const refresh = function() {
|
|
35
|
+
var _ref = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
36
|
+
const token = ++sequence.current;
|
|
37
|
+
setLoading(true);
|
|
38
|
+
try {
|
|
39
|
+
const result = yield require_serve.getJobDetail(request, id);
|
|
40
|
+
if (!mounted.current || token !== sequence.current) return;
|
|
41
|
+
setJob(result);
|
|
42
|
+
const records = yield require_serve.getJobRelated(request, id);
|
|
43
|
+
if (mounted.current && token === sequence.current) setRelated((previous) => {
|
|
44
|
+
var _records$photos, _records$payments;
|
|
45
|
+
return {
|
|
46
|
+
photos: (_records$photos = records.photos) !== null && _records$photos !== void 0 ? _records$photos : previous.photos,
|
|
47
|
+
payments: (_records$payments = records.payments) !== null && _records$payments !== void 0 ? _records$payments : previous.payments
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
} catch (cause) {
|
|
51
|
+
console.warn("[PanpacificTask] Detail load failed", cause);
|
|
52
|
+
} finally {
|
|
53
|
+
if (mounted.current && token === sequence.current) setLoading(false);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return function refresh() {
|
|
57
|
+
return _ref.apply(this, arguments);
|
|
58
|
+
};
|
|
59
|
+
}();
|
|
60
|
+
(0, react.useEffect)(() => {
|
|
61
|
+
mounted.current = true;
|
|
62
|
+
refresh();
|
|
63
|
+
return () => {
|
|
64
|
+
mounted.current = false;
|
|
65
|
+
sequence.current++;
|
|
66
|
+
};
|
|
67
|
+
}, [id, request]);
|
|
68
|
+
const close = function() {
|
|
69
|
+
var _ref2 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
70
|
+
if (locked.current) return;
|
|
71
|
+
if (editing && job) {
|
|
72
|
+
var _formRef$current;
|
|
73
|
+
(_formRef$current = formRef.current) === null || _formRef$current === void 0 || _formRef$current.close();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (dirtyPayment && !(yield confirm("discardConfirm"))) return;
|
|
77
|
+
onClose();
|
|
78
|
+
});
|
|
79
|
+
return function close() {
|
|
80
|
+
return _ref2.apply(this, arguments);
|
|
81
|
+
};
|
|
82
|
+
}();
|
|
83
|
+
const run = function() {
|
|
84
|
+
var _ref3 = require_asyncToGenerator._asyncToGenerator(function* (operation) {
|
|
85
|
+
if (locked.current) return;
|
|
86
|
+
locked.current = true;
|
|
87
|
+
setBusy(true);
|
|
88
|
+
setError("");
|
|
89
|
+
try {
|
|
90
|
+
yield operation();
|
|
91
|
+
} catch (cause) {
|
|
92
|
+
if (mounted.current) {
|
|
93
|
+
if (cause === null || cause === void 0 ? void 0 : cause.uncertainCreate) setRecordUncertain(true);
|
|
94
|
+
setError((cause === null || cause === void 0 ? void 0 : cause.uncertainCreate) ? getText("pisell2.panpacific.task.uncertain") : getText(require_serve.errorText(cause)));
|
|
95
|
+
}
|
|
96
|
+
} finally {
|
|
97
|
+
locked.current = false;
|
|
98
|
+
if (mounted.current) setBusy(false);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return function run(_x) {
|
|
102
|
+
return _ref3.apply(this, arguments);
|
|
103
|
+
};
|
|
104
|
+
}();
|
|
105
|
+
const mark = (status) => run(require_asyncToGenerator._asyncToGenerator(function* () {
|
|
106
|
+
if (status === "cancel" && !(yield confirm("cancelConfirm"))) return;
|
|
107
|
+
if (!job) return;
|
|
108
|
+
yield require_serve.updateJob(request, id, require_model.statusPayload(job, status));
|
|
109
|
+
onChanged(id);
|
|
110
|
+
yield refresh();
|
|
111
|
+
}));
|
|
112
|
+
const remove = () => run(require_asyncToGenerator._asyncToGenerator(function* () {
|
|
113
|
+
if (!(yield confirm("removeConfirm"))) return;
|
|
114
|
+
yield require_serve.removeJob(request, id);
|
|
115
|
+
onChanged(id);
|
|
116
|
+
onClose();
|
|
117
|
+
}));
|
|
118
|
+
const section = (title, children) => /* @__PURE__ */ react.default.createElement("section", { className: "pp-task-section" }, /* @__PURE__ */ react.default.createElement("h3", null, getText(`pisell2.panpacific.task.${title}`)), children);
|
|
119
|
+
const details = (rows) => /* @__PURE__ */ react.default.createElement("dl", { className: "pp-task-details" }, rows.map(([key, value]) => /* @__PURE__ */ react.default.createElement("div", { key }, /* @__PURE__ */ react.default.createElement("dt", null, getText(`pisell2.panpacific.task.${key}`)), /* @__PURE__ */ react.default.createElement("dd", null, value || "—"))));
|
|
120
|
+
const groups = require_model.jobLineGroups(job || {});
|
|
121
|
+
const lines = (kind, status) => {
|
|
122
|
+
const rows = groups[kind][status];
|
|
123
|
+
return rows.length ? /* @__PURE__ */ react.default.createElement("ul", { className: "pp-task-item-summary" }, rows.map((row, i) => {
|
|
124
|
+
var _row$id;
|
|
125
|
+
return /* @__PURE__ */ react.default.createElement("li", { key: String((_row$id = row.id) !== null && _row$id !== void 0 ? _row$id : i) }, require_model.jobLineText(row, kind, base));
|
|
126
|
+
})) : "—";
|
|
127
|
+
};
|
|
128
|
+
const chooseFile = (event, receipt) => {
|
|
129
|
+
var _event$target$files;
|
|
130
|
+
const file = (_event$target$files = event.target.files) === null || _event$target$files === void 0 ? void 0 : _event$target$files[0];
|
|
131
|
+
event.target.value = "";
|
|
132
|
+
if (!file) return;
|
|
133
|
+
run(require_asyncToGenerator._asyncToGenerator(function* () {
|
|
134
|
+
const image = yield uploadPhoto(require_attachments.preparePhoto(file));
|
|
135
|
+
if (!require_attachments.attachments(image).length) throw new Error("pisell2.panpacific.task.uploadFailed");
|
|
136
|
+
if (receipt) {
|
|
137
|
+
if (mounted.current) setPhoto(image);
|
|
138
|
+
} else {
|
|
139
|
+
pendingPhoto.current = image;
|
|
140
|
+
yield savePickup(image);
|
|
141
|
+
}
|
|
142
|
+
}));
|
|
143
|
+
};
|
|
144
|
+
const savePickup = function() {
|
|
145
|
+
var _ref4 = require_asyncToGenerator._asyncToGenerator(function* (image) {
|
|
146
|
+
const prefix = `${String((job === null || job === void 0 ? void 0 : job.job_number) || id).replace(/[^a-zA-Z0-9]+/g, "_")}_pickup_`;
|
|
147
|
+
const next = (related.photos || []).reduce((max, row) => {
|
|
148
|
+
const suffix = String(row.name || "").startsWith(prefix) ? row.name.slice(prefix.length) : "";
|
|
149
|
+
return /^\d+$/.test(suffix) ? Math.max(max, Number(suffix)) : max;
|
|
150
|
+
}, 0) + 1;
|
|
151
|
+
yield require_serve.createJobPickupPhoto(request, {
|
|
152
|
+
job_id: id,
|
|
153
|
+
name: prefix + (related.photos ? String(next).padStart(2, "0") : String(Date.now())),
|
|
154
|
+
photo: image
|
|
155
|
+
});
|
|
156
|
+
pendingPhoto.current = void 0;
|
|
157
|
+
yield refresh();
|
|
158
|
+
onChanged(id);
|
|
159
|
+
});
|
|
160
|
+
return function savePickup(_x2) {
|
|
161
|
+
return _ref4.apply(this, arguments);
|
|
162
|
+
};
|
|
163
|
+
}();
|
|
164
|
+
const savePayment = () => run(require_asyncToGenerator._asyncToGenerator(function* () {
|
|
165
|
+
if (recordUncertain) return;
|
|
166
|
+
if (!amount || !/^\d+(\.\d{1,2})?$/.test(amount) || Number(amount) <= 0 || Number(amount) >= 0xe8d4a51000) throw new Error("pisell2.panpacific.task.invalidAmount");
|
|
167
|
+
yield require_serve.createJobPayment(request, {
|
|
168
|
+
job_id: id,
|
|
169
|
+
direction,
|
|
170
|
+
amount,
|
|
171
|
+
ref_number: reference.trim() || null,
|
|
172
|
+
photo: photo || null
|
|
173
|
+
});
|
|
174
|
+
if (mounted.current) {
|
|
175
|
+
setAmount(null);
|
|
176
|
+
setReference("");
|
|
177
|
+
setPhoto(void 0);
|
|
178
|
+
}
|
|
179
|
+
yield refresh();
|
|
180
|
+
onChanged(id);
|
|
181
|
+
}));
|
|
182
|
+
const primary = job && require_model.nextStatus(job.status);
|
|
183
|
+
const menus = job ? [
|
|
184
|
+
...require_model.statuses.filter((status) => status !== job.status && status !== primary && status !== "cancel").map((status) => ({
|
|
185
|
+
key: status,
|
|
186
|
+
label: `${getText("pisell2.panpacific.task.mark")} ${getText(`pisell2.panpacific.task.${status}`)}`
|
|
187
|
+
})),
|
|
188
|
+
...job.status === "cancel" ? [] : [{
|
|
189
|
+
key: "cancel",
|
|
190
|
+
label: getText("pisell2.panpacific.task.cancelJob")
|
|
191
|
+
}],
|
|
192
|
+
{
|
|
193
|
+
key: "duplicate",
|
|
194
|
+
label: getText("pisell2.panpacific.task.duplicate")
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
key: "remove",
|
|
198
|
+
label: getText("pisell2.panpacific.task.remove"),
|
|
199
|
+
danger: true
|
|
200
|
+
}
|
|
201
|
+
] : [];
|
|
202
|
+
return /* @__PURE__ */ react.default.createElement(antd.Drawer, {
|
|
203
|
+
open: true,
|
|
204
|
+
width: editing ? "min(820px, 96vw)" : "min(520px, 96vw)",
|
|
205
|
+
rootClassName: "pp-task-overlay pp-task-drawer",
|
|
206
|
+
closable: false,
|
|
207
|
+
destroyOnClose: true,
|
|
208
|
+
title: /* @__PURE__ */ react.default.createElement("div", null, editing ? getText("pisell2.panpacific.task.editJob") : (job === null || job === void 0 ? void 0 : job.supplier_name) || getText("pisell2.panpacific.task.job"), /* @__PURE__ */ react.default.createElement("small", null, job === null || job === void 0 ? void 0 : job.job_number)),
|
|
209
|
+
onClose: close,
|
|
210
|
+
extra: /* @__PURE__ */ react.default.createElement("div", { className: "pp-task-drawer-head-actions" }, !editing && job && /* @__PURE__ */ react.default.createElement(antd.Button, {
|
|
211
|
+
type: "primary",
|
|
212
|
+
disabled: busy || loading,
|
|
213
|
+
onClick: require_asyncToGenerator._asyncToGenerator(function* () {
|
|
214
|
+
if (dirtyPayment && !(yield confirm("discardConfirm"))) return;
|
|
215
|
+
setAmount(null);
|
|
216
|
+
setReference("");
|
|
217
|
+
setPhoto(void 0);
|
|
218
|
+
setEditing(true);
|
|
219
|
+
})
|
|
220
|
+
}, getText("pisell2.panpacific.task.edit")), /* @__PURE__ */ react.default.createElement(antd.Button, {
|
|
221
|
+
"aria-label": getText("pisell2.panpacific.task.close"),
|
|
222
|
+
icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.CloseOutlined, null),
|
|
223
|
+
disabled: busy,
|
|
224
|
+
onClick: close
|
|
225
|
+
})),
|
|
226
|
+
footer: !editing && job && /* @__PURE__ */ react.default.createElement("div", { className: "pp-task-drawer-actions" }, primary && /* @__PURE__ */ react.default.createElement(antd.Button, {
|
|
227
|
+
type: "primary",
|
|
228
|
+
loading: busy,
|
|
229
|
+
disabled: loading,
|
|
230
|
+
onClick: () => mark(primary)
|
|
231
|
+
}, getText("pisell2.panpacific.task.mark"), " ", getText(`pisell2.panpacific.task.${primary}`)), /* @__PURE__ */ react.default.createElement(antd.Dropdown, {
|
|
232
|
+
trigger: ["click"],
|
|
233
|
+
disabled: busy || loading,
|
|
234
|
+
menu: {
|
|
235
|
+
items: menus,
|
|
236
|
+
onClick: function() {
|
|
237
|
+
var _ref5 = require_asyncToGenerator._asyncToGenerator(function* ({ key }) {
|
|
238
|
+
if (key === "remove") {
|
|
239
|
+
yield remove();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (key === "duplicate") {
|
|
243
|
+
if (dirtyPayment && !(yield confirm("discardConfirm"))) return;
|
|
244
|
+
onDuplicate(require_model.draftFor(job, void 0, true));
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
yield mark(key);
|
|
248
|
+
});
|
|
249
|
+
return function onClick(_x3) {
|
|
250
|
+
return _ref5.apply(this, arguments);
|
|
251
|
+
};
|
|
252
|
+
}()
|
|
253
|
+
}
|
|
254
|
+
}, /* @__PURE__ */ react.default.createElement(antd.Button, null, getText("pisell2.panpacific.task.more"), " ▾")))
|
|
255
|
+
}, /* @__PURE__ */ react.default.createElement(antd.Spin, { spinning: loading }, !job && /* @__PURE__ */ react.default.createElement(antd.Button, { onClick: refresh }, getText("pisell2.panpacific.task.refresh")), job && editing ? /* @__PURE__ */ react.default.createElement(require_JobForm.JobForm, {
|
|
256
|
+
ref: formRef,
|
|
257
|
+
key: String(job.id),
|
|
258
|
+
initial: require_model.draftFor(job),
|
|
259
|
+
jobs,
|
|
260
|
+
base,
|
|
261
|
+
request,
|
|
262
|
+
getText,
|
|
263
|
+
confirmDiscard: () => confirm("discardConfirm"),
|
|
264
|
+
onCancel: () => setEditing(false),
|
|
265
|
+
onSaved: () => {
|
|
266
|
+
setEditing(false);
|
|
267
|
+
onChanged(id);
|
|
268
|
+
refresh();
|
|
269
|
+
}
|
|
270
|
+
}) : job && /* @__PURE__ */ react.default.createElement("div", { className: "pp-task-drawer-view" }, /* @__PURE__ */ react.default.createElement("div", { className: "pp-task-section pp-task-drawer-hero" }, /* @__PURE__ */ react.default.createElement(require_JobStatus.JobStatus, {
|
|
271
|
+
job,
|
|
272
|
+
getText
|
|
273
|
+
})), section("supplier", details([
|
|
274
|
+
["state", job.supplier_state],
|
|
275
|
+
["supplier", job.supplier_name],
|
|
276
|
+
["branchPostcode", job.supplier_sub_name],
|
|
277
|
+
["contact", job.company_contact],
|
|
278
|
+
["phone", job.supplier_phone],
|
|
279
|
+
["email", job.supplier_email],
|
|
280
|
+
["lead", job.lead_source]
|
|
281
|
+
])), section("basicInfo", details([
|
|
282
|
+
["category", ((_base$categories$find = base.categories.find((row) => String(row.id) === String(job.task_category_id))) === null || _base$categories$find === void 0 ? void 0 : _base$categories$find.name) || job.task_category_id],
|
|
283
|
+
["created", require_model.dateText(job.job_created_date)],
|
|
284
|
+
["dateRange", require_model.scheduleText(job)],
|
|
285
|
+
["due", require_model.dateText(job.due_date)],
|
|
286
|
+
["pickupDate", require_model.dateText(job.pickup_date)],
|
|
287
|
+
["invoiceDate", require_model.dateText(job.invoice_date)]
|
|
288
|
+
])), section("logistics", details([["logisticType", job.logistic_type && getText(`pisell2.panpacific.task.${job.logistic_type}`)], ["logisticsNote", job.logistics_note]])), section("materials", details([["scheduledMaterials", lines("materials", "scheduled")], ["confirmedMaterials", lines("materials", "confirmed")]])), section("products", details([["scheduledItems", lines("products", "scheduled")], ["confirmedItems", lines("products", "confirmed")]])), section("paymentTerm", details([["paymentTerm", [require_model.paymentTerm(job, base), job.payment_term_days != null ? `${job.payment_term_days} ${getText("pisell2.panpacific.task.dayUnit")}` : ""].filter(Boolean).join(" · ")], ["termsNote", job.terms_note]])), section("pickupPhotos", /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: "pp-task-photos" }, ((_related$photos = related.photos) === null || _related$photos === void 0 ? void 0 : _related$photos.length) ? related.photos.map((row) => /* @__PURE__ */ react.default.createElement(require_PhotoPreview.PhotoPreview, {
|
|
289
|
+
key: String(row.id),
|
|
290
|
+
value: row.photo,
|
|
291
|
+
label: row.name,
|
|
292
|
+
getText,
|
|
293
|
+
disabled: busy || loading,
|
|
294
|
+
onRemove: (index) => run(require_asyncToGenerator._asyncToGenerator(function* () {
|
|
295
|
+
yield require_serve.removeJobPickupPhoto(request, row, index);
|
|
296
|
+
const remaining = require_attachments.attachments(row.photo).filter((_, i) => i !== index);
|
|
297
|
+
if (mounted.current) setRelated((previous) => {
|
|
298
|
+
var _previous$photos;
|
|
299
|
+
return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, previous), {}, { photos: (_previous$photos = previous.photos) === null || _previous$photos === void 0 ? void 0 : _previous$photos.flatMap((item) => String(item.id) !== String(row.id) ? [item] : remaining.length ? [require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, item), {}, { photo: remaining })] : []) });
|
|
300
|
+
});
|
|
301
|
+
onChanged(id);
|
|
302
|
+
yield refresh();
|
|
303
|
+
}))
|
|
304
|
+
})) : "—"), /* @__PURE__ */ react.default.createElement("label", { className: `pp-task-upload${busy || recordUncertain ? " is-disabled" : ""}` }, /* @__PURE__ */ react.default.createElement("input", {
|
|
305
|
+
type: "file",
|
|
306
|
+
accept: "image/*",
|
|
307
|
+
capture: "environment",
|
|
308
|
+
disabled: busy || recordUncertain,
|
|
309
|
+
onChange: (event) => chooseFile(event, false)
|
|
310
|
+
}), getText("pisell2.panpacific.task.uploadPickup")), pendingPhoto.current && !recordUncertain && /* @__PURE__ */ react.default.createElement(antd.Button, {
|
|
311
|
+
disabled: busy,
|
|
312
|
+
onClick: () => run(() => savePickup(pendingPhoto.current))
|
|
313
|
+
}, getText("pisell2.panpacific.task.save")))), section("records", /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: "pp-task-payment-records" }, ((_related$payments = related.payments) === null || _related$payments === void 0 ? void 0 : _related$payments.length) ? related.payments.map((row) => /* @__PURE__ */ react.default.createElement("div", { key: String(row.id) }, /* @__PURE__ */ react.default.createElement("strong", null, getText(`pisell2.panpacific.task.${row.direction === "receive" ? "receive" : "payment"}`), " ", "· $", row.amount), row.ref_number && /* @__PURE__ */ react.default.createElement("span", null, " · ", row.ref_number), /* @__PURE__ */ react.default.createElement("small", null, row.created_at && require_model.dateText(row.created_at), " ", row.operator_name), /* @__PURE__ */ react.default.createElement("div", { className: "pp-task-photos" }, /* @__PURE__ */ react.default.createElement(require_PhotoPreview.PhotoPreview, {
|
|
314
|
+
value: row.photo,
|
|
315
|
+
getText
|
|
316
|
+
})))) : "—"), /* @__PURE__ */ react.default.createElement("p", { className: "pp-task-payment-caption" }, getText("pisell2.panpacific.task.createRecord")), /* @__PURE__ */ react.default.createElement(antd.Radio.Group, {
|
|
317
|
+
value: direction,
|
|
318
|
+
disabled: busy || recordUncertain,
|
|
319
|
+
onChange: (event) => setDirection(event.target.value),
|
|
320
|
+
optionType: "button",
|
|
321
|
+
options: [{
|
|
322
|
+
label: getText("pisell2.panpacific.task.payment"),
|
|
323
|
+
value: "payment"
|
|
324
|
+
}, {
|
|
325
|
+
label: getText("pisell2.panpacific.task.receive"),
|
|
326
|
+
value: "receive"
|
|
327
|
+
}]
|
|
328
|
+
}), /* @__PURE__ */ react.default.createElement("div", { className: "pp-task-payment-inputs" }, photo ? /* @__PURE__ */ react.default.createElement("div", { className: "pp-task-photos pp-task-receipt-preview" }, /* @__PURE__ */ react.default.createElement(require_PhotoPreview.PhotoPreview, {
|
|
329
|
+
value: photo,
|
|
330
|
+
compact: true,
|
|
331
|
+
getText,
|
|
332
|
+
disabled: busy || recordUncertain,
|
|
333
|
+
onRemove: () => setPhoto(void 0)
|
|
334
|
+
})) : /* @__PURE__ */ react.default.createElement("label", { className: `pp-task-upload${busy || recordUncertain ? " is-disabled" : ""}` }, /* @__PURE__ */ react.default.createElement("input", {
|
|
335
|
+
type: "file",
|
|
336
|
+
accept: "image/*",
|
|
337
|
+
disabled: busy || recordUncertain,
|
|
338
|
+
onChange: (event) => chooseFile(event, true)
|
|
339
|
+
}), getText("pisell2.panpacific.task.photo")), /* @__PURE__ */ react.default.createElement(antd.InputNumber, {
|
|
340
|
+
stringMode: true,
|
|
341
|
+
min: "0.01",
|
|
342
|
+
max: "999999999999.99",
|
|
343
|
+
precision: 2,
|
|
344
|
+
value: amount,
|
|
345
|
+
onChange: setAmount,
|
|
346
|
+
placeholder: getText("pisell2.panpacific.task.amount"),
|
|
347
|
+
"aria-label": getText("pisell2.panpacific.task.amount"),
|
|
348
|
+
disabled: busy || recordUncertain
|
|
349
|
+
}), /* @__PURE__ */ react.default.createElement(antd.Input, {
|
|
350
|
+
value: reference,
|
|
351
|
+
maxLength: 255,
|
|
352
|
+
onChange: (event) => setReference(event.target.value),
|
|
353
|
+
placeholder: getText("pisell2.panpacific.task.reference"),
|
|
354
|
+
"aria-label": getText("pisell2.panpacific.task.reference"),
|
|
355
|
+
disabled: busy || recordUncertain
|
|
356
|
+
})), /* @__PURE__ */ react.default.createElement(antd.Button, {
|
|
357
|
+
type: "primary",
|
|
358
|
+
loading: busy,
|
|
359
|
+
disabled: recordUncertain,
|
|
360
|
+
onClick: savePayment
|
|
361
|
+
}, getText("pisell2.panpacific.task.saveRecord")))), error && /* @__PURE__ */ react.default.createElement(antd.Alert, {
|
|
362
|
+
type: "error",
|
|
363
|
+
showIcon: true,
|
|
364
|
+
message: error
|
|
365
|
+
}))));
|
|
366
|
+
}
|
|
367
|
+
//#endregion
|
|
368
|
+
exports.JobDrawer = JobDrawer;
|