meemup-library 1.8.8 → 1.8.9
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.
|
@@ -12,6 +12,7 @@ import IPointOfSaleSetting from "../interfaces/pos/IPointOfSaleSetting";
|
|
|
12
12
|
import IPointOfSaleActionFormCashDrawer from "../interfaces/pos/IPointOfSaleActionFormCashDrawer";
|
|
13
13
|
import IPointOfSaleApiClosingWorkDay from "../interfaces/pos/IPointOfSaleApiClosingWorkDay";
|
|
14
14
|
import IReservationTableRow from "../interfaces/reservation/IReservationTableRow";
|
|
15
|
+
import IPointOfSalePrintAction from "../interfaces/pos/IPointOfSalePrintAction";
|
|
15
16
|
declare class _PreviewContentController {
|
|
16
17
|
createReservationMarkup(reservation: IReservationTableRow | undefined, template: IPrintTemplate): string;
|
|
17
18
|
calculatePaperSize: (paper: number, width: string | number) => string;
|
|
@@ -20,13 +21,14 @@ declare class _PreviewContentController {
|
|
|
20
21
|
convertTimeStringToDateByT(data?: Date | string | null): Date | string | null;
|
|
21
22
|
formatAMPMDate(date: Date | string | null): string;
|
|
22
23
|
formatDateTime(dateTime: string, mode?: string): string;
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
private buildLayout;
|
|
25
|
+
simpleLayout(account: IAccount, detail: IOrderDetails, template: IPrintTemplate, task: IPointOfSalePrintAction): string;
|
|
26
|
+
largeLayout(account: IAccount, detail: IOrderDetails, template: IPrintTemplate, task: IPointOfSalePrintAction): string;
|
|
25
27
|
labelLayout(detail: IOrderDetails, template: IPrintTemplate): string;
|
|
26
28
|
paymentFailed(detail: IOrderDetails, currency: string): string;
|
|
27
29
|
packageLabel(detail: IOrderDetails, template: IPrintTemplate): string;
|
|
28
|
-
preview(account: IAccount, detail: IOrderDetails, template: IPrintTemplate): string;
|
|
29
|
-
previewForPos(account: IAccount, detail: IOrderDetails, template: IPrintTemplate): string;
|
|
30
|
+
preview(account: IAccount, detail: IOrderDetails, template: IPrintTemplate, task: IPointOfSalePrintAction): string;
|
|
31
|
+
previewForPos(account: IAccount, detail: IOrderDetails, template: IPrintTemplate, task: IPointOfSalePrintAction): string;
|
|
30
32
|
createPrintFromTurnoverDetail(data: ITurnover, currency: string, printParts: IPointOfSalePrintParts): Promise<string>;
|
|
31
33
|
createCashDrawerPaidInOutMarkup(device: IPointOfSaleActionFormCashDrawer, setting: IPointOfSaleSetting, member: IPointOfSaleTeamMember): Promise<string>;
|
|
32
34
|
openCashDrawerMarkup(label?: string): Promise<string>;
|
|
@@ -195,81 +195,55 @@ class _PreviewContentController {
|
|
|
195
195
|
return dateTime;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
|
|
199
|
-
const { order
|
|
198
|
+
buildLayout(account, detail, template, task, isLargeLayout = false) {
|
|
199
|
+
const { order } = detail;
|
|
200
200
|
const { font, width, paper, paddingTop, paddingBottom, orderSummaryPrintPlacement } = template;
|
|
201
|
-
const fontFamily = (font === "Font A" || font === "Font B")
|
|
202
|
-
|
|
201
|
+
const fontFamily = (font === "Font A" || font === "Font B")
|
|
202
|
+
? "arial"
|
|
203
|
+
: font;
|
|
204
|
+
let content = `
|
|
205
|
+
<div
|
|
206
|
+
style="
|
|
207
|
+
font-family:${fontFamily};
|
|
208
|
+
font-weight:normal;
|
|
209
|
+
padding:${paddingTop}px 0 ${paddingBottom}px 0;
|
|
210
|
+
width:${this.calculatePaperSize(paper, width)};
|
|
211
|
+
"
|
|
212
|
+
>
|
|
213
|
+
`;
|
|
203
214
|
if (!order.asSoonAsPossible) {
|
|
204
215
|
content += SimplePreviewController.printPreOrderText(template);
|
|
205
216
|
}
|
|
206
|
-
if (orderSummaryPrintPlacement ===
|
|
217
|
+
if (orderSummaryPrintPlacement ===
|
|
218
|
+
EnumOrderSummaryPrintPlacementType.BeforePageHeader) {
|
|
207
219
|
content += SimplePreviewController.printSummary(template, order);
|
|
208
220
|
}
|
|
209
221
|
content += SimplePreviewController.printTitle(template);
|
|
210
|
-
if (orderSummaryPrintPlacement ===
|
|
222
|
+
if (orderSummaryPrintPlacement ===
|
|
223
|
+
EnumOrderSummaryPrintPlacementType.AfterPageHeader) {
|
|
211
224
|
content += SimplePreviewController.printSummary(template, order);
|
|
212
225
|
}
|
|
213
226
|
content += SimplePreviewController.printLogo(template, detail, account);
|
|
214
227
|
content += SimplePreviewController.printCompanyNameAndAddress(template, detail);
|
|
215
|
-
if (orderSummaryPrintPlacement ===
|
|
228
|
+
if (orderSummaryPrintPlacement ===
|
|
229
|
+
EnumOrderSummaryPrintPlacementType.AfterCompanyInformation) {
|
|
216
230
|
content += SimplePreviewController.printSummary(template, order);
|
|
217
231
|
}
|
|
218
232
|
content += SimplePreviewController.printTextAfterCompanyAddress(template);
|
|
219
|
-
// content += SimplePreviewController.printDash();
|
|
220
233
|
content += SimplePreviewController.printShowPayment(template, detail);
|
|
221
234
|
content += SimplePreviewController.printOrderInformation(template, detail);
|
|
222
235
|
content += SimplePreviewController.printCustomerInformation(template, detail);
|
|
223
|
-
content += SimplePreviewController.printProductCount(template, detail);
|
|
236
|
+
content += SimplePreviewController.printProductCount(template, detail, task);
|
|
224
237
|
content += SimplePreviewController.printTextBeforeProducts(template);
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
content += SimplePreviewController.printCustomerRemark(template, detail);
|
|
231
|
-
content += SimplePreviewController.printDeliveryInstructionsRemarks(template, detail);
|
|
232
|
-
content += SimplePreviewController.printCustomerSignature(template, detail);
|
|
233
|
-
content += SimplePreviewController.printPromotionNote(template);
|
|
234
|
-
content += SimplePreviewController.printMetaData(template, detail);
|
|
235
|
-
content += SimplePreviewController.printSplitPayments(template, detail);
|
|
236
|
-
content += SimplePreviewController.printQrCode(template, detail);
|
|
237
|
-
content += SimplePreviewController.printTextEnd(template);
|
|
238
|
-
content += SimplePreviewController.printFooter(template, detail);
|
|
239
|
-
content += `</div>`;
|
|
240
|
-
return (`<div style="display: flex;"><div style="width : auto;">${content}</div></div>`);
|
|
241
|
-
}
|
|
242
|
-
largeLayout(account, detail, template) {
|
|
243
|
-
const { order, } = detail;
|
|
244
|
-
const { font, width, paper, paddingTop, paddingBottom, orderSummaryPrintPlacement } = template;
|
|
245
|
-
const fontFamily = (font === "Font A" || font === "Font B") ? "arial" : font;
|
|
246
|
-
let content = `<div style="font-family : ${fontFamily}; font-weight : normal; padding : ${paddingTop}px 0 ${paddingBottom}px 0; width: ${this.calculatePaperSize(paper, width)};"> `;
|
|
247
|
-
if (!order.asSoonAsPossible) {
|
|
248
|
-
content += SimplePreviewController.printPreOrderText(template);
|
|
249
|
-
}
|
|
250
|
-
if (orderSummaryPrintPlacement === EnumOrderSummaryPrintPlacementType.BeforePageHeader) {
|
|
251
|
-
content += SimplePreviewController.printSummary(template, order);
|
|
252
|
-
}
|
|
253
|
-
content += SimplePreviewController.printTitle(template);
|
|
254
|
-
if (orderSummaryPrintPlacement === EnumOrderSummaryPrintPlacementType.AfterPageHeader) {
|
|
255
|
-
content += SimplePreviewController.printSummary(template, order);
|
|
256
|
-
}
|
|
257
|
-
content += SimplePreviewController.printLogo(template, detail, account);
|
|
258
|
-
content += SimplePreviewController.printCompanyNameAndAddress(template, detail);
|
|
259
|
-
if (orderSummaryPrintPlacement === EnumOrderSummaryPrintPlacementType.AfterCompanyInformation) {
|
|
260
|
-
content += SimplePreviewController.printSummary(template, order);
|
|
238
|
+
const productsContent = isLargeLayout
|
|
239
|
+
? SimplePreviewController.printLargeProducts(template, detail)
|
|
240
|
+
: SimplePreviewController.printProducts(template, detail);
|
|
241
|
+
if (productsContent !== "") {
|
|
242
|
+
content += productsContent;
|
|
261
243
|
}
|
|
262
|
-
|
|
263
|
-
content += SimplePreviewController.printShowPayment(template, detail);
|
|
264
|
-
content += SimplePreviewController.printOrderInformation(template, detail);
|
|
265
|
-
content += SimplePreviewController.printCustomerInformation(template, detail);
|
|
266
|
-
content += SimplePreviewController.printProductCount(template, detail);
|
|
267
|
-
content += SimplePreviewController.printTextBeforeProducts(template);
|
|
268
|
-
let value = SimplePreviewController.printLargeProducts(template, detail);
|
|
269
|
-
if (value !== "")
|
|
270
|
-
content += value;
|
|
271
|
-
else
|
|
244
|
+
else {
|
|
272
245
|
return "";
|
|
246
|
+
}
|
|
273
247
|
content += SimplePreviewController.printCustomerRemark(template, detail);
|
|
274
248
|
content += SimplePreviewController.printDeliveryInstructionsRemarks(template, detail);
|
|
275
249
|
content += SimplePreviewController.printCustomerSignature(template, detail);
|
|
@@ -280,7 +254,19 @@ class _PreviewContentController {
|
|
|
280
254
|
content += SimplePreviewController.printTextEnd(template);
|
|
281
255
|
content += SimplePreviewController.printFooter(template, detail);
|
|
282
256
|
content += `</div>`;
|
|
283
|
-
return
|
|
257
|
+
return `
|
|
258
|
+
<div style="display:flex;">
|
|
259
|
+
<div style="width:auto;">
|
|
260
|
+
${content}
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
`;
|
|
264
|
+
}
|
|
265
|
+
simpleLayout(account, detail, template, task) {
|
|
266
|
+
return this.buildLayout(account, detail, template, task, false);
|
|
267
|
+
}
|
|
268
|
+
largeLayout(account, detail, template, task) {
|
|
269
|
+
return this.buildLayout(account, detail, template, task, true);
|
|
284
270
|
}
|
|
285
271
|
labelLayout(detail, template) {
|
|
286
272
|
const { products } = detail;
|
|
@@ -363,12 +349,12 @@ class _PreviewContentController {
|
|
|
363
349
|
</div>
|
|
364
350
|
</div>`;
|
|
365
351
|
}
|
|
366
|
-
preview(account, detail, template) {
|
|
352
|
+
preview(account, detail, template, task) {
|
|
367
353
|
switch (template.layout) {
|
|
368
354
|
case EnumPrintLayout.SIMPLE:
|
|
369
|
-
return this.simpleLayout(account, detail, template);
|
|
355
|
+
return this.simpleLayout(account, detail, template, task);
|
|
370
356
|
case EnumPrintLayout.LARGE:
|
|
371
|
-
return this.largeLayout(account, detail, template);
|
|
357
|
+
return this.largeLayout(account, detail, template, task);
|
|
372
358
|
case EnumPrintLayout.LABEL:
|
|
373
359
|
const products = this.filterByCategoryList(this.sortProduct(detail.products, template.sortProducts), template.printOnlyCertainCategoriesList, template.printOnlyCertainCategories, template.printOnlyCertainProductsList, template.printOnlyCertainProducts);
|
|
374
360
|
if (products.length === 0) {
|
|
@@ -381,14 +367,14 @@ class _PreviewContentController {
|
|
|
381
367
|
return `<div> template.layout : ${template.layout}</div>`;
|
|
382
368
|
}
|
|
383
369
|
}
|
|
384
|
-
previewForPos(account, detail, template) {
|
|
370
|
+
previewForPos(account, detail, template, task) {
|
|
385
371
|
let content;
|
|
386
372
|
switch (template.layout) {
|
|
387
373
|
case EnumPrintLayout.SIMPLE:
|
|
388
|
-
content = this.simpleLayout(account, detail, template);
|
|
374
|
+
content = this.simpleLayout(account, detail, template, task);
|
|
389
375
|
break;
|
|
390
376
|
case EnumPrintLayout.LARGE:
|
|
391
|
-
content = this.largeLayout(account, detail, template);
|
|
377
|
+
content = this.largeLayout(account, detail, template, task);
|
|
392
378
|
break;
|
|
393
379
|
case EnumPrintLayout.LABEL:
|
|
394
380
|
const products = this.filterByCategoryList(this.sortProduct(detail.products, template.sortProducts), template.printOnlyCertainCategoriesList, template.printOnlyCertainCategories, template.printOnlyCertainProductsList, template.printOnlyCertainProducts);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import IAccount from "../interfaces/IAccount";
|
|
2
2
|
import IPrintTemplate from "../interfaces/IPrintTemplate";
|
|
3
|
+
import IPointOfSalePrintAction from "../interfaces/pos/IPointOfSalePrintAction.js";
|
|
3
4
|
import IOrderDetailOrder from "../interfaces/print/IOrderDetailOrder";
|
|
4
5
|
import IOrderDetails from "../interfaces/print/IOrderDetails";
|
|
5
6
|
declare class SimplePreviewController {
|
|
@@ -12,7 +13,7 @@ declare class SimplePreviewController {
|
|
|
12
13
|
printShowPayment(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
13
14
|
printOrderInformation(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
14
15
|
printCustomerInformation(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
15
|
-
printProductCount(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
16
|
+
printProductCount(template: IPrintTemplate, detail: IOrderDetails, task: IPointOfSalePrintAction): string;
|
|
16
17
|
printTextBeforeProducts(template: IPrintTemplate): string;
|
|
17
18
|
printProductInDineIn(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
18
19
|
printProducts(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
@@ -210,13 +210,16 @@ class SimplePreviewController {
|
|
|
210
210
|
content += `</div>`;
|
|
211
211
|
return content;
|
|
212
212
|
}
|
|
213
|
-
printProductCount(template, detail) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
213
|
+
printProductCount(template, detail, task) {
|
|
214
|
+
if (!Array.isArray(task.seats) || task.seats.length === 0) {
|
|
215
|
+
const list = this.filterByCategoryList(this.sortProduct(detail.products, template.sortProducts), template.printOnlyCertainCategoriesList, template.printOnlyCertainCategories, template.printOnlyCertainProductsList, template.printOnlyCertainProducts);
|
|
216
|
+
const count = MoneyController.sum(list.map(i => i.quantity));
|
|
217
|
+
let content = this.createDivContainer(template);
|
|
218
|
+
content += `<p style="display: block; font-size: ${template.fontSize + 10}px; text-align: left; margin-top : 8px;">${count} ITEM</p>`;
|
|
219
|
+
content += `</div>`;
|
|
220
|
+
return content;
|
|
221
|
+
}
|
|
222
|
+
return "";
|
|
220
223
|
}
|
|
221
224
|
printTextBeforeProducts(template) {
|
|
222
225
|
if (template.textBeforeProducts === "")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meemup-library",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"remove:one": "rimraf dist",
|
|
12
12
|
"remove:two": "rimraf ./src/dist",
|
|
13
13
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
-
"commit": "git add . && git commit -m \"version.1.8.
|
|
14
|
+
"commit": "git add . && git commit -m \"version.1.8.9\" && git push origin "
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"/dist"
|