@bookmypuja-tech/bmp-pdf 0.2.9 → 0.2.11

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.ts CHANGED
@@ -125,6 +125,8 @@ interface IPuja {
125
125
  nakshatra: string;
126
126
  quantity: string;
127
127
  priestNote: string;
128
+ is_early_reminder?: boolean;
129
+ date?: string;
128
130
  }[];
129
131
  }
130
132
  interface IPujaList {
package/dist/index.js CHANGED
@@ -1296,6 +1296,8 @@ var A4PujaList = ({
1296
1296
  templeName,
1297
1297
  pujas
1298
1298
  }) => {
1299
+ let serialOfNormalPujas = 0;
1300
+ let serialOfEarlyReminders = 0;
1299
1301
  return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(Document7, null, /* @__PURE__ */ React11.createElement(Page7, { size: "A4", style: { padding: 30, fontFamily: "Noto Sans" } }, /* @__PURE__ */ React11.createElement(
1300
1302
  Image9,
1301
1303
  {
@@ -1317,6 +1319,9 @@ var A4PujaList = ({
1317
1319
  }
1318
1320
  },
1319
1321
  pujas.map((puja, pujaIndex) => {
1322
+ if (puja.bookings.some((booking) => booking.is_early_reminder))
1323
+ return null;
1324
+ serialOfNormalPujas = 0;
1320
1325
  return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(View7, { wrap: false, style: { marginBottom: 25 } }, /* @__PURE__ */ React11.createElement(View7, null, /* @__PURE__ */ React11.createElement(
1321
1326
  Text11,
1322
1327
  {
@@ -1407,6 +1412,7 @@ var A4PujaList = ({
1407
1412
  /* @__PURE__ */ React11.createElement(Text11, null, "Qty")
1408
1413
  )
1409
1414
  ), puja.bookings.map((booking, bookingIndex) => {
1415
+ serialOfNormalPujas++;
1410
1416
  return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
1411
1417
  View7,
1412
1418
  {
@@ -1428,7 +1434,7 @@ var A4PujaList = ({
1428
1434
  width: "10%"
1429
1435
  }
1430
1436
  },
1431
- /* @__PURE__ */ React11.createElement(Text11, null, bookingIndex + 1)
1437
+ /* @__PURE__ */ React11.createElement(Text11, null, serialOfNormalPujas)
1432
1438
  ),
1433
1439
  /* @__PURE__ */ React11.createElement(
1434
1440
  View7,
@@ -1512,7 +1518,136 @@ var A4PujaList = ({
1512
1518
  ));
1513
1519
  })));
1514
1520
  })
1515
- ))));
1521
+ ), pujas.some(
1522
+ (puja) => puja.bookings.some((booking) => booking.is_early_reminder)
1523
+ ) && /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(Text11, { style: { fontSize: 14, fontWeight: "bold", marginTop: 20 } }, "Early Reminders for Upcoming Pujas"), /* @__PURE__ */ React11.createElement(View7, { wrap: false, style: { marginTop: 10 } }, /* @__PURE__ */ React11.createElement(
1524
+ View7,
1525
+ {
1526
+ style: {
1527
+ display: "flex",
1528
+ flexDirection: "row",
1529
+ border: "1px solid black"
1530
+ }
1531
+ },
1532
+ /* @__PURE__ */ React11.createElement(
1533
+ View7,
1534
+ {
1535
+ style: {
1536
+ padding: 6,
1537
+ fontSize: 10,
1538
+ borderRight: "1px solid black",
1539
+ fontWeight: "semibold",
1540
+ width: "10%"
1541
+ }
1542
+ },
1543
+ /* @__PURE__ */ React11.createElement(Text11, null, "Sr No")
1544
+ ),
1545
+ /* @__PURE__ */ React11.createElement(
1546
+ View7,
1547
+ {
1548
+ style: {
1549
+ padding: 6,
1550
+ fontSize: 10,
1551
+ borderRight: "1px solid black",
1552
+ fontWeight: "semibold",
1553
+ width: "60%"
1554
+ }
1555
+ },
1556
+ /* @__PURE__ */ React11.createElement(Text11, null, "Puja Name")
1557
+ ),
1558
+ /* @__PURE__ */ React11.createElement(
1559
+ View7,
1560
+ {
1561
+ style: {
1562
+ padding: 6,
1563
+ fontSize: 10,
1564
+ borderRight: "1px solid black",
1565
+ fontWeight: "semibold",
1566
+ width: "10%"
1567
+ }
1568
+ },
1569
+ /* @__PURE__ */ React11.createElement(Text11, null, "Qty")
1570
+ ),
1571
+ /* @__PURE__ */ React11.createElement(
1572
+ View7,
1573
+ {
1574
+ style: {
1575
+ padding: 6,
1576
+ fontSize: 10,
1577
+ borderRight: "none",
1578
+ fontWeight: "semibold",
1579
+ width: "20%"
1580
+ }
1581
+ },
1582
+ /* @__PURE__ */ React11.createElement(Text11, null, "Date")
1583
+ )
1584
+ ))), pujas.some(
1585
+ (puja) => puja.bookings.some((booking) => booking.is_early_reminder)
1586
+ ) ? pujas.flatMap(
1587
+ (puja, pujaIndex) => puja.bookings.filter((booking) => booking.is_early_reminder).map((booking, bookingIndex) => {
1588
+ serialOfEarlyReminders++;
1589
+ return /* @__PURE__ */ React11.createElement(
1590
+ View7,
1591
+ {
1592
+ key: `${pujaIndex}-${bookingIndex}`,
1593
+ style: {
1594
+ display: "flex",
1595
+ flexDirection: "row",
1596
+ border: "1px solid black",
1597
+ borderTop: "none"
1598
+ }
1599
+ },
1600
+ /* @__PURE__ */ React11.createElement(
1601
+ View7,
1602
+ {
1603
+ style: {
1604
+ padding: 6,
1605
+ fontSize: 10,
1606
+ borderRight: "1px solid black",
1607
+ width: "10%"
1608
+ }
1609
+ },
1610
+ /* @__PURE__ */ React11.createElement(Text11, null, serialOfEarlyReminders)
1611
+ ),
1612
+ /* @__PURE__ */ React11.createElement(
1613
+ View7,
1614
+ {
1615
+ style: {
1616
+ padding: 6,
1617
+ fontSize: 10,
1618
+ borderRight: "1px solid black",
1619
+ width: "60%"
1620
+ }
1621
+ },
1622
+ /* @__PURE__ */ React11.createElement(Text11, null, puja.name)
1623
+ ),
1624
+ /* @__PURE__ */ React11.createElement(
1625
+ View7,
1626
+ {
1627
+ style: {
1628
+ padding: 6,
1629
+ fontSize: 10,
1630
+ borderRight: "1px solid black",
1631
+ width: "10%"
1632
+ }
1633
+ },
1634
+ /* @__PURE__ */ React11.createElement(Text11, null, booking.quantity)
1635
+ ),
1636
+ /* @__PURE__ */ React11.createElement(
1637
+ View7,
1638
+ {
1639
+ style: {
1640
+ padding: 6,
1641
+ fontSize: 10,
1642
+ borderRight: "none",
1643
+ width: "20%"
1644
+ }
1645
+ },
1646
+ /* @__PURE__ */ React11.createElement(Text11, null, booking.date ? new Date(booking.date).toDateString() : "")
1647
+ )
1648
+ );
1649
+ })
1650
+ ) : null)));
1516
1651
  };
1517
1652
  var A4PujaList_default = A4PujaList;
1518
1653
 
@@ -1698,6 +1833,22 @@ var A4CombinedReport = ({
1698
1833
  prasadData,
1699
1834
  deliveryData
1700
1835
  }) => {
1836
+ deliveryData = deliveryData.map((item) => {
1837
+ let address = "";
1838
+ try {
1839
+ const parsedAddress = JSON.parse(item.address);
1840
+ address = `${parsedAddress.address}, ${parsedAddress.locality}, ${parsedAddress.state} - ${parsedAddress.pincode}`;
1841
+ } catch (e) {
1842
+ console.error("Error parsing address:", e);
1843
+ address = item.address;
1844
+ }
1845
+ return {
1846
+ ...item,
1847
+ address
1848
+ };
1849
+ });
1850
+ let serialOfNormalPujas = 0;
1851
+ let serialOfEarlyReminders = 0;
1701
1852
  return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(Document9, null, pujaData.length > 0 && /* @__PURE__ */ React13.createElement(Page9, { size: "A4", style: { padding: 30, fontFamily: "Noto Sans" } }, /* @__PURE__ */ React13.createElement(
1702
1853
  Image11,
1703
1854
  {
@@ -1709,7 +1860,14 @@ var A4CombinedReport = ({
1709
1860
  },
1710
1861
  src: bmpLogo
1711
1862
  }
1712
- ), /* @__PURE__ */ React13.createElement(Text13, { style: { fontSize: 11, marginTop: 5, textAlign: "right" } }, "Date: ", date.toDateString()), /* @__PURE__ */ React13.createElement(Text13, { style: { fontSize: 14, fontWeight: "bold" } }, "Puja List"), /* @__PURE__ */ React13.createElement(Text13, { style: { fontSize: 12 } }, `${templeName}`), /* @__PURE__ */ React13.createElement(
1863
+ ), /* @__PURE__ */ React13.createElement(
1864
+ Text13,
1865
+ {
1866
+ style: { fontSize: 11, marginTop: 5, textAlign: "right" }
1867
+ },
1868
+ "Date: ",
1869
+ date.toDateString()
1870
+ ), /* @__PURE__ */ React13.createElement(Text13, { style: { fontSize: 14, fontWeight: "bold" } }, "Puja List"), /* @__PURE__ */ React13.createElement(Text13, { style: { fontSize: 12 } }, `${templeName}`), /* @__PURE__ */ React13.createElement(
1713
1871
  View9,
1714
1872
  {
1715
1873
  style: {
@@ -1719,6 +1877,9 @@ var A4CombinedReport = ({
1719
1877
  }
1720
1878
  },
1721
1879
  pujaData.map((puja, pujaIndex) => {
1880
+ if (puja.bookings.some((booking) => booking.is_early_reminder))
1881
+ return null;
1882
+ serialOfNormalPujas = 0;
1722
1883
  return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(View9, { wrap: false, style: { marginBottom: 25 } }, /* @__PURE__ */ React13.createElement(View9, null, /* @__PURE__ */ React13.createElement(
1723
1884
  Text13,
1724
1885
  {
@@ -1809,6 +1970,7 @@ var A4CombinedReport = ({
1809
1970
  /* @__PURE__ */ React13.createElement(Text13, null, "Qty")
1810
1971
  )
1811
1972
  ), puja.bookings.map((booking, bookingIndex) => {
1973
+ serialOfNormalPujas++;
1812
1974
  return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
1813
1975
  View9,
1814
1976
  {
@@ -1830,7 +1992,7 @@ var A4CombinedReport = ({
1830
1992
  width: "10%"
1831
1993
  }
1832
1994
  },
1833
- /* @__PURE__ */ React13.createElement(Text13, null, bookingIndex + 1)
1995
+ /* @__PURE__ */ React13.createElement(Text13, null, serialOfNormalPujas)
1834
1996
  ),
1835
1997
  /* @__PURE__ */ React13.createElement(
1836
1998
  View9,
@@ -1914,7 +2076,146 @@ var A4CombinedReport = ({
1914
2076
  ));
1915
2077
  })));
1916
2078
  })
1917
- )), prasadData.length > 0 && /* @__PURE__ */ React13.createElement(Page9, { size: "A4", style: { padding: 30, fontFamily: "Noto Sans" } }, /* @__PURE__ */ React13.createElement(
2079
+ ), pujaData.some(
2080
+ (puja) => puja.bookings.some((booking) => booking.is_early_reminder)
2081
+ ) && /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
2082
+ Text13,
2083
+ {
2084
+ style: {
2085
+ fontSize: 14,
2086
+ fontWeight: "bold",
2087
+ marginTop: 20
2088
+ }
2089
+ },
2090
+ "Early Reminders for Upcoming Pujas"
2091
+ ), /* @__PURE__ */ React13.createElement(View9, { wrap: false, style: { marginTop: 10 } }, /* @__PURE__ */ React13.createElement(
2092
+ View9,
2093
+ {
2094
+ style: {
2095
+ display: "flex",
2096
+ flexDirection: "row",
2097
+ border: "1px solid black"
2098
+ }
2099
+ },
2100
+ /* @__PURE__ */ React13.createElement(
2101
+ View9,
2102
+ {
2103
+ style: {
2104
+ padding: 6,
2105
+ fontSize: 10,
2106
+ borderRight: "1px solid black",
2107
+ fontWeight: "semibold",
2108
+ width: "10%"
2109
+ }
2110
+ },
2111
+ /* @__PURE__ */ React13.createElement(Text13, null, "Sr No")
2112
+ ),
2113
+ /* @__PURE__ */ React13.createElement(
2114
+ View9,
2115
+ {
2116
+ style: {
2117
+ padding: 6,
2118
+ fontSize: 10,
2119
+ borderRight: "1px solid black",
2120
+ fontWeight: "semibold",
2121
+ width: "60%"
2122
+ }
2123
+ },
2124
+ /* @__PURE__ */ React13.createElement(Text13, null, "Puja Name")
2125
+ ),
2126
+ /* @__PURE__ */ React13.createElement(
2127
+ View9,
2128
+ {
2129
+ style: {
2130
+ padding: 6,
2131
+ fontSize: 10,
2132
+ borderRight: "1px solid black",
2133
+ fontWeight: "semibold",
2134
+ width: "10%"
2135
+ }
2136
+ },
2137
+ /* @__PURE__ */ React13.createElement(Text13, null, "Qty")
2138
+ ),
2139
+ /* @__PURE__ */ React13.createElement(
2140
+ View9,
2141
+ {
2142
+ style: {
2143
+ padding: 6,
2144
+ fontSize: 10,
2145
+ borderRight: "none",
2146
+ fontWeight: "semibold",
2147
+ width: "20%"
2148
+ }
2149
+ },
2150
+ /* @__PURE__ */ React13.createElement(Text13, null, "Date")
2151
+ )
2152
+ ))), pujaData.some(
2153
+ (puja) => puja.bookings.some((booking) => booking.is_early_reminder)
2154
+ ) ? pujaData.flatMap(
2155
+ (puja, pujaIndex) => puja.bookings.filter((booking) => booking.is_early_reminder).map((booking, bookingIndex) => {
2156
+ serialOfEarlyReminders++;
2157
+ return /* @__PURE__ */ React13.createElement(
2158
+ View9,
2159
+ {
2160
+ key: `${pujaIndex}-${bookingIndex}`,
2161
+ style: {
2162
+ display: "flex",
2163
+ flexDirection: "row",
2164
+ border: "1px solid black",
2165
+ borderTop: "none"
2166
+ }
2167
+ },
2168
+ /* @__PURE__ */ React13.createElement(
2169
+ View9,
2170
+ {
2171
+ style: {
2172
+ padding: 6,
2173
+ fontSize: 10,
2174
+ borderRight: "1px solid black",
2175
+ width: "10%"
2176
+ }
2177
+ },
2178
+ /* @__PURE__ */ React13.createElement(Text13, null, serialOfEarlyReminders)
2179
+ ),
2180
+ /* @__PURE__ */ React13.createElement(
2181
+ View9,
2182
+ {
2183
+ style: {
2184
+ padding: 6,
2185
+ fontSize: 10,
2186
+ borderRight: "1px solid black",
2187
+ width: "60%"
2188
+ }
2189
+ },
2190
+ /* @__PURE__ */ React13.createElement(Text13, null, puja.name)
2191
+ ),
2192
+ /* @__PURE__ */ React13.createElement(
2193
+ View9,
2194
+ {
2195
+ style: {
2196
+ padding: 6,
2197
+ fontSize: 10,
2198
+ borderRight: "1px solid black",
2199
+ width: "10%"
2200
+ }
2201
+ },
2202
+ /* @__PURE__ */ React13.createElement(Text13, null, booking.quantity)
2203
+ ),
2204
+ /* @__PURE__ */ React13.createElement(
2205
+ View9,
2206
+ {
2207
+ style: {
2208
+ padding: 6,
2209
+ fontSize: 10,
2210
+ borderRight: "none",
2211
+ width: "20%"
2212
+ }
2213
+ },
2214
+ /* @__PURE__ */ React13.createElement(Text13, null, booking.date ? new Date(booking.date).toDateString() : "")
2215
+ )
2216
+ );
2217
+ })
2218
+ ) : null), prasadData.length > 0 && /* @__PURE__ */ React13.createElement(Page9, { size: "A4", style: { padding: 30, fontFamily: "Noto Sans" } }, /* @__PURE__ */ React13.createElement(
1918
2219
  Image11,
1919
2220
  {
1920
2221
  fixed: true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bookmypuja-tech/bmp-pdf",
3
3
  "description": "PDF Report Generation for Temple360 and T-360 by BookMyPuja",
4
- "version": "0.2.9",
4
+ "version": "0.2.11",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",