Skip to content

Commit 9ac2670

Browse files
Merge pull request #18 from ArthurPedroti/feat/freight-infomations
feat: different freight delivered option
2 parents ad916ec + 79e4ead commit 9ac2670

File tree

7 files changed

+249
-25
lines changed

7 files changed

+249
-25
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pv-agf-frontend",
3-
"version": "1.0.11",
3+
"version": "1.0.2",
44
"private": true,
55
"dependencies": {
66
"@date-io/date-fns": "^2.4.0",

src/components/PdfMakeDefault.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,35 @@ export default function PdfMakeDefault({
139139
return [...arr1, ...arr2];
140140
};
141141

142+
const differentFreghtLocation = () => {
143+
if (values.freight_options) {
144+
return [
145+
'\n',
146+
{ text: 'ENDEREÇO DE ENTREGA: ', bold: true },
147+
'\n',
148+
{ text: 'Endereço: ', bold: true },
149+
values.freight_address,
150+
'\n',
151+
{ text: 'Bairro: ', bold: true },
152+
values.freight_neighborhood,
153+
'\n',
154+
{ text: 'Cidade: ', bold: true },
155+
values.freight_city,
156+
'\n',
157+
{ text: 'UF: ', bold: true },
158+
values.freight_uf,
159+
'\n',
160+
{ text: 'CEP: ', bold: true },
161+
values.freight_cep,
162+
'\n',
163+
values.freight_tel && { text: 'Telefone: ', bold: true },
164+
values.freight_tel && values.freight_tel,
165+
values.freight_tel && '\n',
166+
];
167+
}
168+
return [];
169+
};
170+
142171
const mapProducts = produtos.map(produto => produto.value * produto.qtd);
143172
const sumProducts =
144173
mapProducts.length > 0 ? mapProducts.reduce((a, b) => a + b) : 0;
@@ -233,6 +262,7 @@ export default function PdfMakeDefault({
233262
.concat(values.data_pc.slice(0, 4))
234263
: null;
235264

265+
const differentFreghtDetails = differentFreghtLocation();
236266
const contrato = values.contrato === 'sim' ? 'SIM' : 'NÃO';
237267
const formattedProducts = productsFormat(produtos);
238268
const formattedPayments = paymentsFormat(parcelas);
@@ -469,6 +499,7 @@ export default function PdfMakeDefault({
469499
? dataAtualFormatada(values.delivery_date)
470500
: 'A COMBINAR',
471501
'\n',
502+
...differentFreghtDetails,
472503
],
473504
},
474505
{

src/components/PdfMakeKit.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,35 @@ export default function PdfMakeKit({ cliente, values, produtos, parcelas }) {
151151
return [];
152152
};
153153

154+
const differentFreghtLocation = () => {
155+
if (values.freight_options) {
156+
return [
157+
'\n',
158+
{ text: 'ENDEREÇO DE ENTREGA: ', bold: true },
159+
'\n',
160+
{ text: 'Endereço: ', bold: true },
161+
values.freight_address,
162+
'\n',
163+
{ text: 'Bairro: ', bold: true },
164+
values.freight_neighborhood,
165+
'\n',
166+
{ text: 'Cidade: ', bold: true },
167+
values.freight_city,
168+
'\n',
169+
{ text: 'UF: ', bold: true },
170+
values.freight_uf,
171+
'\n',
172+
{ text: 'CEP: ', bold: true },
173+
values.freight_cep,
174+
'\n',
175+
values.freight_tel && { text: 'Telefone: ', bold: true },
176+
values.freight_tel && values.freight_tel,
177+
values.freight_tel && '\n',
178+
];
179+
}
180+
return [];
181+
};
182+
154183
const mapProducts = produtos.map(produto => produto.value * produto.qtd);
155184
const sumProducts =
156185
mapProducts.length > 0 ? mapProducts.reduce((a, b) => a + b) : 0;
@@ -255,6 +284,7 @@ export default function PdfMakeKit({ cliente, values, produtos, parcelas }) {
255284
.concat(values.data_pc.slice(0, 4))
256285
: null;
257286

287+
const differentFreghtDetails = differentFreghtLocation();
258288
const engate = values.engate === true ? 'SIM' : 'NÃO';
259289
const contrato = values.contrato === 'sim' ? 'SIM' : 'NÃO';
260290
const pontExtraFormated = pontExtraFormat();
@@ -558,6 +588,7 @@ export default function PdfMakeKit({ cliente, values, produtos, parcelas }) {
558588
{ text: 'DATA PREVISTA DE INSTALAÇÃO: ', bold: true },
559589
'3 a 10 dias após a chegada do equipamento',
560590
'\n',
591+
...differentFreghtDetails,
561592
],
562593
},
563594
{

src/components/PdfMakeMonofio.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,35 @@ export default function PdfMakeDefault({
139139
return [];
140140
};
141141

142+
const differentFreghtLocation = () => {
143+
if (values.freight_options) {
144+
return [
145+
'\n',
146+
{ text: 'ENDEREÇO DE ENTREGA: ', bold: true },
147+
'\n',
148+
{ text: 'Endereço: ', bold: true },
149+
values.freight_address,
150+
'\n',
151+
{ text: 'Bairro: ', bold: true },
152+
values.freight_neighborhood,
153+
'\n',
154+
{ text: 'Cidade: ', bold: true },
155+
values.freight_city,
156+
'\n',
157+
{ text: 'UF: ', bold: true },
158+
values.freight_uf,
159+
'\n',
160+
{ text: 'CEP: ', bold: true },
161+
values.freight_cep,
162+
'\n',
163+
values.freight_tel && { text: 'Telefone: ', bold: true },
164+
values.freight_tel && values.freight_tel,
165+
values.freight_tel && '\n',
166+
];
167+
}
168+
return [];
169+
};
170+
142171
const mapProducts = produtos.map(produto => produto.value * produto.qtd);
143172
const sumProducts =
144173
mapProducts.length > 0 ? mapProducts.reduce((a, b) => a + b) : 0;
@@ -233,6 +262,7 @@ export default function PdfMakeDefault({
233262
.concat(values.data_pc.slice(0, 4))
234263
: null;
235264

265+
const differentFreghtDetails = differentFreghtLocation();
236266
const contrato = values.contrato === 'sim' ? 'SIM' : 'NÃO';
237267
const kit_instalacao = values.kit_instalacao === true ? 'SIM' : 'NÃO';
238268
const formattedProducts = productsFormat(produtos);
@@ -495,6 +525,7 @@ export default function PdfMakeDefault({
495525
? dataAtualFormatada(values.delivery_date)
496526
: 'A COMBINAR',
497527
'\n',
528+
...differentFreghtDetails,
498529
],
499530
},
500531
{

src/components/PdfMakeQC.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,35 @@ export default function PdfMakeKit({ cliente, values, produtos, parcelas }) {
134134
return [];
135135
};
136136

137+
const differentFreghtLocation = () => {
138+
if (values.freight_options) {
139+
return [
140+
'\n',
141+
{ text: 'ENDEREÇO DE ENTREGA: ', bold: true },
142+
'\n',
143+
{ text: 'Endereço: ', bold: true },
144+
values.freight_address,
145+
'\n',
146+
{ text: 'Bairro: ', bold: true },
147+
values.freight_neighborhood,
148+
'\n',
149+
{ text: 'Cidade: ', bold: true },
150+
values.freight_city,
151+
'\n',
152+
{ text: 'UF: ', bold: true },
153+
values.freight_uf,
154+
'\n',
155+
{ text: 'CEP: ', bold: true },
156+
values.freight_cep,
157+
'\n',
158+
values.freight_tel && { text: 'Telefone: ', bold: true },
159+
values.freight_tel && values.freight_tel,
160+
values.freight_tel && '\n',
161+
];
162+
}
163+
return [];
164+
};
165+
137166
const mapProducts = produtos.map(produto => produto.value * produto.qtd);
138167
const sumProducts =
139168
mapProducts.length > 0 ? mapProducts.reduce((a, b) => a + b) : 0;
@@ -229,6 +258,7 @@ export default function PdfMakeKit({ cliente, values, produtos, parcelas }) {
229258
.concat(values.data_pc.slice(0, 4))
230259
: null;
231260

261+
const differentFreghtDetails = differentFreghtLocation();
232262
const contrato = values.contrato === 'sim' ? 'SIM' : 'NÃO';
233263
const formattedProducts = productsFormat(produtos);
234264
const formattedPayments = paymentsFormat(parcelas);
@@ -506,6 +536,7 @@ export default function PdfMakeKit({ cliente, values, produtos, parcelas }) {
506536
{ text: 'DATA PREVISTA DE INSTALAÇÃO: ', bold: true },
507537
'3 a 10 dias após a chegada do equipamento',
508538
'\n',
539+
...differentFreghtDetails,
509540
],
510541
},
511542
{

0 commit comments

Comments
 (0)