shareneus 1.5.65 → 1.5.66
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/accounting/invoice/invoice-pdf/invoice-pdf.service.js +8 -8
- package/dist/shared/header-footer-section/pdf-header-footer.section.js +23 -23
- package/dist/shared/party-details-section/pdf-party-details.section.d.ts +1 -1
- package/dist/shared/party-details-section/pdf-party-details.section.js +6 -6
- package/package.json +1 -1
|
@@ -76,7 +76,7 @@ function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printC
|
|
|
76
76
|
copyLabels.forEach((copyLabel, index) => {
|
|
77
77
|
const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(PrintConfig, PDFInvoiceData);
|
|
78
78
|
const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(PDFInvoiceData, PrintConfig, availableWidth);
|
|
79
|
-
const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildInvoicePartyDetailsSection)(PDFInvoiceData);
|
|
79
|
+
const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildInvoicePartyDetailsSection)(PDFInvoiceData, PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Customer);
|
|
80
80
|
const invoiceTotalsAndNotesContent = (0, pdf_totals_section_1.buildInvoiceTotalsAndNotesSection)(PDFInvoiceData, availableWidth);
|
|
81
81
|
const signatureContent = (0, pdf_totals_section_1.buildSignatureSection)(PrintConfig, PDFInvoiceData, availableWidth);
|
|
82
82
|
const tableData = (0, pdf_table_section_1.buildInvoiceTableData)(PDFInvoiceData, PrintConfig, availableWidth);
|
|
@@ -124,16 +124,16 @@ function normalizeCopyLabels(printCopies = []) {
|
|
|
124
124
|
return labels.length > 0 ? labels : [''];
|
|
125
125
|
}
|
|
126
126
|
function normalizePrintConfig(PDFInvoiceData, PrintConfigData) {
|
|
127
|
-
var _a, _b;
|
|
127
|
+
var _a, _b, _c;
|
|
128
128
|
const config = PrintConfigData || {};
|
|
129
129
|
const itemsHeader = Array.isArray(config === null || config === void 0 ? void 0 : config.TableConfig) ? config.TableConfig : [];
|
|
130
130
|
const headerData = (config === null || config === void 0 ? void 0 : config.headerData) ? config.headerData : (0, pdf_header_footer_section_1.deriveHeaderDataFromInvoice)(PDFInvoiceData);
|
|
131
|
-
const pageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)((_a = config === null || config === void 0 ? void 0 : config.
|
|
132
|
-
const watermarkText = (0, pdf_shared_utils_1.toStr)(config === null || config === void 0 ? void 0 : config.
|
|
133
|
-
const watermark = !!(config === null || config === void 0 ? void 0 : config.
|
|
134
|
-
const watermarkEnabled = !!(config === null || config === void 0 ? void 0 : config.
|
|
135
|
-
const footerText = (0, pdf_shared_utils_1.toStr)(config === null || config === void 0 ? void 0 : config.
|
|
136
|
-
const headerStyles = (0, pdf_header_footer_section_1.normalizeHeaderStyle)((
|
|
131
|
+
const pageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)((_a = config === null || config === void 0 ? void 0 : config.Margin) !== null && _a !== void 0 ? _a : PAGE_MARGINS);
|
|
132
|
+
const watermarkText = (0, pdf_shared_utils_1.toStr)(config === null || config === void 0 ? void 0 : config.WatermarkText);
|
|
133
|
+
const watermark = !!(config === null || config === void 0 ? void 0 : config.Watermark);
|
|
134
|
+
const watermarkEnabled = !!(config === null || config === void 0 ? void 0 : config.WatermarkEnabled);
|
|
135
|
+
const footerText = (0, pdf_shared_utils_1.toStr)((_b = config === null || config === void 0 ? void 0 : config.Footer) === null || _b === void 0 ? void 0 : _b.Text);
|
|
136
|
+
const headerStyles = (0, pdf_header_footer_section_1.normalizeHeaderStyle)((_c = config === null || config === void 0 ? void 0 : config.headerStyles) !== null && _c !== void 0 ? _c : {
|
|
137
137
|
OrgNameFsize: config === null || config === void 0 ? void 0 : config.OrgNameFsize,
|
|
138
138
|
OrgNameClr: config === null || config === void 0 ? void 0 : config.OrgNameClr,
|
|
139
139
|
AdrsFsize: config === null || config === void 0 ? void 0 : config.AdrsFsize,
|
|
@@ -110,8 +110,8 @@ function buildDocumentHeaderSection(PrintConfig, DocumentData = {}) {
|
|
|
110
110
|
AdrsFsize: PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.AdrsFsize,
|
|
111
111
|
AdrsClr: PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.AdrsClr
|
|
112
112
|
});
|
|
113
|
-
const headerSettings = normalizeHeaderSettings((_t = (_s = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.
|
|
114
|
-
if (!headerSettings.
|
|
113
|
+
const headerSettings = normalizeHeaderSettings((_t = (_s = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Header) !== null && _s !== void 0 ? _s : PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Header) !== null && _t !== void 0 ? _t : {});
|
|
114
|
+
if (!headerSettings.Show) {
|
|
115
115
|
return [];
|
|
116
116
|
}
|
|
117
117
|
const hasOrganizationData = !!(((_u = mergedHeaderData.organization) === null || _u === void 0 ? void 0 : _u.cName) || ((_v = mergedHeaderData.organization) === null || _v === void 0 ? void 0 : _v.address1)
|
|
@@ -119,13 +119,13 @@ function buildDocumentHeaderSection(PrintConfig, DocumentData = {}) {
|
|
|
119
119
|
|| ((_z = mergedHeaderData.organization) === null || _z === void 0 ? void 0 : _z.pin) || ((_0 = mergedHeaderData.organization) === null || _0 === void 0 ? void 0 : _0.gstin) || ((_1 = mergedHeaderData.organization) === null || _1 === void 0 ? void 0 : _1.email)
|
|
120
120
|
|| ((_2 = mergedHeaderData.organization) === null || _2 === void 0 ? void 0 : _2.phone) || ((_3 = mergedHeaderData.organization) === null || _3 === void 0 ? void 0 : _3.phone2) || ((_4 = mergedHeaderData.organization) === null || _4 === void 0 ? void 0 : _4.dlNo)
|
|
121
121
|
|| ((_5 = mergedHeaderData.organization) === null || _5 === void 0 ? void 0 : _5.cin) || ((_6 = mergedHeaderData.organization) === null || _6 === void 0 ? void 0 : _6.pan));
|
|
122
|
-
const hasLogo = !!mergedHeaderData.logoDataUrl && headerSettings.
|
|
122
|
+
const hasLogo = !!mergedHeaderData.logoDataUrl && headerSettings.ShowLogo;
|
|
123
123
|
if (!hasOrganizationData && !hasLogo) {
|
|
124
124
|
return [];
|
|
125
125
|
}
|
|
126
|
-
const textAlignment = toPdfAlignment(headerSettings.
|
|
126
|
+
const textAlignment = toPdfAlignment(headerSettings.Position);
|
|
127
127
|
const organizationStack = buildOrganizationStack(mergedHeaderData.organization, headerStyles, textAlignment);
|
|
128
|
-
const headerContent = buildHeaderContentWithLogo(mergedHeaderData.logoDataUrl, hasLogo, organizationStack, headerSettings.
|
|
128
|
+
const headerContent = buildHeaderContentWithLogo(mergedHeaderData.logoDataUrl, hasLogo, organizationStack, headerSettings.LogoPosition, textAlignment);
|
|
129
129
|
return [{
|
|
130
130
|
columns: [
|
|
131
131
|
Object.assign({ width: '*' }, headerContent)
|
|
@@ -155,8 +155,8 @@ function buildDocumentHeadingSection(PDFInvoiceData, PrintConfig, availableWidth
|
|
|
155
155
|
];
|
|
156
156
|
}
|
|
157
157
|
function buildWatermark(PrintConfig) {
|
|
158
|
-
const value = (0, pdf_shared_utils_1.firstValue)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.
|
|
159
|
-
const isEnabled = !!((PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.
|
|
158
|
+
const value = (0, pdf_shared_utils_1.firstValue)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.WatermarkText);
|
|
159
|
+
const isEnabled = !!((PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Watermark) || (PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.WatermarkEnabled) || value);
|
|
160
160
|
if (!isEnabled) {
|
|
161
161
|
return null;
|
|
162
162
|
}
|
|
@@ -172,8 +172,8 @@ function buildWatermark(PrintConfig) {
|
|
|
172
172
|
}
|
|
173
173
|
function buildLogoWatermarkBackground(PrintConfig, DocumentData = {}) {
|
|
174
174
|
var _a;
|
|
175
|
-
const value = (0, pdf_shared_utils_1.firstValue)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.
|
|
176
|
-
const isEnabled = !!((PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.
|
|
175
|
+
const value = (0, pdf_shared_utils_1.firstValue)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.WatermarkText);
|
|
176
|
+
const isEnabled = !!((PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Watermark) || (PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.WatermarkEnabled) || value);
|
|
177
177
|
if (!isEnabled || value) {
|
|
178
178
|
return null;
|
|
179
179
|
}
|
|
@@ -197,16 +197,16 @@ function resolveDocumentLogoDataUrl(DocumentData) {
|
|
|
197
197
|
}
|
|
198
198
|
function buildFooter(PrintConfig) {
|
|
199
199
|
var _a, _b, _c, _d, _e;
|
|
200
|
-
const footerConfig = (_b = (_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.
|
|
201
|
-
const showFooter = (footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.
|
|
200
|
+
const footerConfig = (_b = (_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Footer) !== null && _a !== void 0 ? _a : PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Footer) !== null && _b !== void 0 ? _b : {};
|
|
201
|
+
const showFooter = (footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Show) !== false && (footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Show) !== false;
|
|
202
202
|
if (!showFooter) {
|
|
203
203
|
return null;
|
|
204
204
|
}
|
|
205
|
-
const value = (0, pdf_shared_utils_1.firstValue)((_d = (_c = footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.
|
|
205
|
+
const value = (0, pdf_shared_utils_1.firstValue)((_d = (_c = footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Text) !== null && _c !== void 0 ? _c : footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Text) !== null && _d !== void 0 ? _d : PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.FooterText);
|
|
206
206
|
if (!value) {
|
|
207
207
|
return null;
|
|
208
208
|
}
|
|
209
|
-
const textAlignment = normalizeFooterAlignment((_e = footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.
|
|
209
|
+
const textAlignment = normalizeFooterAlignment((_e = footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Position) !== null && _e !== void 0 ? _e : footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Position);
|
|
210
210
|
const pageAlignment = textAlignment === 'right' ? 'left' : 'right';
|
|
211
211
|
return (_currentPage, pageCount) => ({
|
|
212
212
|
margin: [20, 0, 20, 6],
|
|
@@ -228,10 +228,10 @@ function normalizeFooterAlignment(value) {
|
|
|
228
228
|
}
|
|
229
229
|
function buildOrganizationStack(organization, headerStyles, alignment) {
|
|
230
230
|
const stack = [];
|
|
231
|
-
const orgNameFontSize = (0, pdf_shared_utils_1.readPositiveNumber)(headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.
|
|
232
|
-
const orgAddressFontSize = (0, pdf_shared_utils_1.readPositiveNumber)(headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.
|
|
233
|
-
const orgNameFontColor = (0, pdf_shared_utils_1.normalizeColor)(headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.
|
|
234
|
-
const orgAddressFontColor = (0, pdf_shared_utils_1.normalizeColor)(headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.
|
|
231
|
+
const orgNameFontSize = (0, pdf_shared_utils_1.readPositiveNumber)(headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.OrgNameFsize, DEFAULT_ORG_NAME_FONT_SIZE);
|
|
232
|
+
const orgAddressFontSize = (0, pdf_shared_utils_1.readPositiveNumber)(headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.AdrsFsize, DEFAULT_ORG_ADDRESS_FONT_SIZE);
|
|
233
|
+
const orgNameFontColor = (0, pdf_shared_utils_1.normalizeColor)(headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.OrgNameClr, DEFAULT_ORG_NAME_FONT_COLOR);
|
|
234
|
+
const orgAddressFontColor = (0, pdf_shared_utils_1.normalizeColor)(headerStyles === null || headerStyles === void 0 ? void 0 : headerStyles.AdrsClr, DEFAULT_ORG_ADDRESS_FONT_COLOR);
|
|
235
235
|
if (organization === null || organization === void 0 ? void 0 : organization.cName) {
|
|
236
236
|
stack.push({ text: organization.cName, bold: true, fontSize: orgNameFontSize, color: orgNameFontColor, lineHeight: 1.1, alignment });
|
|
237
237
|
}
|
|
@@ -278,13 +278,13 @@ function buildOrganizationStack(organization, headerStyles, alignment) {
|
|
|
278
278
|
return stack;
|
|
279
279
|
}
|
|
280
280
|
function normalizeHeaderSettings(value) {
|
|
281
|
-
const
|
|
282
|
-
const
|
|
281
|
+
const Position = normalizePosition(value === null || value === void 0 ? void 0 : value.Position, DEFAULT_HEADER_POSITION);
|
|
282
|
+
const LogoPosition = normalizeLogoPosition(value === null || value === void 0 ? void 0 : value.LogoPosition, DEFAULT_LOGO_POSITION);
|
|
283
283
|
return {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
284
|
+
Position,
|
|
285
|
+
LogoPosition,
|
|
286
|
+
Show: (value === null || value === void 0 ? void 0 : value.Show) !== false,
|
|
287
|
+
ShowLogo: (value === null || value === void 0 ? void 0 : value.ShowLogo) !== false
|
|
288
288
|
};
|
|
289
289
|
}
|
|
290
290
|
function normalizePosition(value, fallback) {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.buildInvoicePartyDetailsSection = buildInvoicePartyDetailsSection;
|
|
7
7
|
const jsbarcode_1 = __importDefault(require("jsbarcode"));
|
|
8
8
|
const pdf_shared_utils_1 = require("../header-footer-section/pdf-shared.utils");
|
|
9
|
-
function buildInvoicePartyDetailsSection(PDFInvoiceData) {
|
|
9
|
+
function buildInvoicePartyDetailsSection(PDFInvoiceData, customerLayout) {
|
|
10
10
|
const invoiceData = PDFInvoiceData || {};
|
|
11
11
|
const billTo = resolveBillToDetails(invoiceData);
|
|
12
12
|
const shipTo = resolveShipToDetails(invoiceData);
|
|
@@ -17,10 +17,10 @@ function buildInvoicePartyDetailsSection(PDFInvoiceData) {
|
|
|
17
17
|
const billToCode = resolveBillToCode(invoiceData);
|
|
18
18
|
const otherDetails = resolveOtherDetails(invoiceData);
|
|
19
19
|
const shouldShowSecondaryBarcode = !secondaryParty.hasData && showBarCode && !!billToCode;
|
|
20
|
-
const billToStack = billTo.hasData ? buildPartyStack('Bill To', billTo) : [{ text: '' }];
|
|
20
|
+
const billToStack = billTo.hasData ? buildPartyStack('Bill To', billTo, customerLayout) : [{ text: '' }];
|
|
21
21
|
const secondaryTitle = useInsurance ? 'Insurance' : 'Ship To';
|
|
22
22
|
const secondaryStack = secondaryParty.hasData
|
|
23
|
-
? buildPartyStack(secondaryTitle, secondaryParty)
|
|
23
|
+
? buildPartyStack(secondaryTitle, secondaryParty, customerLayout)
|
|
24
24
|
: (shouldShowSecondaryBarcode ? buildBarcodeStack(billToCode) : [{ text: '' }]);
|
|
25
25
|
const otherDetailsStack = otherDetails.hasData ? buildOtherDetailsStack(otherDetails) : [{ text: '' }];
|
|
26
26
|
const hasAnyData = billTo.hasData || secondaryParty.hasData || shouldShowSecondaryBarcode || otherDetails.hasData;
|
|
@@ -121,7 +121,7 @@ function resolveOtherDetails(invoiceData) {
|
|
|
121
121
|
hasData: lines.length > 0
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
-
function buildPartyStack(title, party) {
|
|
124
|
+
function buildPartyStack(title, party, customerLayout) {
|
|
125
125
|
const stack = [
|
|
126
126
|
{ text: title, bold: true, fontSize: 9, color: '#374151', margin: [0, 0, 0, 4] }
|
|
127
127
|
];
|
|
@@ -129,8 +129,8 @@ function buildPartyStack(title, party) {
|
|
|
129
129
|
stack.push({
|
|
130
130
|
text: party.name,
|
|
131
131
|
bold: true,
|
|
132
|
-
fontSize: 9,
|
|
133
|
-
color: '#111827',
|
|
132
|
+
fontSize: (customerLayout === null || customerLayout === void 0 ? void 0 : customerLayout.NameFsize) || 9,
|
|
133
|
+
color: (customerLayout === null || customerLayout === void 0 ? void 0 : customerLayout.NameClr) || '#111827',
|
|
134
134
|
// background: '#e5e7eb',
|
|
135
135
|
margin: [0, 0, 0, 2]
|
|
136
136
|
});
|