@bookmypuja-tech/bmp-pdf 0.3.31 → 0.3.33

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +14 -14
  2. package/dist/index.js +121 -246
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -155,12 +155,25 @@ interface ISummaryPujaList {
155
155
  pujas: ISummaryPuja[];
156
156
  }
157
157
 
158
+ interface IPostalItem {
159
+ id: string;
160
+ name: string;
161
+ pujaDetails: string;
162
+ phone: string;
163
+ address: string;
164
+ }
165
+ interface IPostalReportProps {
166
+ date: Date;
167
+ templeName: string;
168
+ data?: IPostalItem[];
169
+ }
170
+
158
171
  interface CombinedReportData {
159
172
  date: Date;
160
173
  templeName: string;
161
174
  pujaData: IPuja[];
162
175
  prasadData: IPrasadItem[];
163
- deliveryData: IPrasadItem$1[];
176
+ deliveryData: IPostalItem[];
164
177
  }
165
178
 
166
179
  interface ITempleData {
@@ -246,19 +259,6 @@ interface IInvoiceProps {
246
259
  data: IInvoiceData;
247
260
  }
248
261
 
249
- interface IPostalItem {
250
- id: string;
251
- name: string;
252
- pujaDetails: string;
253
- phone: string;
254
- address: string;
255
- }
256
- interface IPostalReportProps {
257
- date: Date;
258
- templeName: string;
259
- data?: IPostalItem[];
260
- }
261
-
262
262
  type sizeOptions = "A4" | "2Inch";
263
263
  declare const getPrintBlob: ({ size, data, dates, }: {
264
264
  size: sizeOptions;
package/dist/index.js CHANGED
@@ -1835,32 +1835,31 @@ var A4PujaList = ({
1835
1835
  gap: 15
1836
1836
  }
1837
1837
  },
1838
- pujas.map((puja, pujaIndex) => {
1839
- if (!puja.bookings.some((booking) => booking.requires_coupon))
1840
- return null;
1841
- return puja.bookings.map((booking, bookingIndex) => {
1842
- if (!booking.requires_coupon) return null;
1843
- return /* @__PURE__ */ React12.createElement(
1844
- View7,
1845
- {
1846
- key: bookingIndex,
1847
- style: {
1848
- marginBottom: 10,
1849
- fontSize: 18,
1850
- padding: 10,
1851
- border: "1px dotted black"
1852
- },
1853
- wrap: false
1854
- },
1855
- /* @__PURE__ */ React12.createElement(
1838
+ (() => {
1839
+ const allCouponBookings = pujas.flatMap(
1840
+ (puja) => puja.bookings.filter((booking) => booking.requires_coupon).map((booking) => ({ ...booking, pujaName: puja.name }))
1841
+ );
1842
+ const grouped = {};
1843
+ for (const booking of allCouponBookings) {
1844
+ if (!grouped[booking.invoiceNumber])
1845
+ grouped[booking.invoiceNumber] = [];
1846
+ grouped[booking.invoiceNumber].push(booking);
1847
+ }
1848
+ return Object.entries(grouped).map(
1849
+ ([invoiceNumber, bookings], groupIdx) => {
1850
+ const bookingsArr = bookings;
1851
+ const first = bookingsArr[0];
1852
+ return /* @__PURE__ */ React12.createElement(
1856
1853
  View7,
1857
1854
  {
1855
+ key: invoiceNumber,
1858
1856
  style: {
1859
- display: "flex",
1860
- flexDirection: "row",
1861
- justifyContent: "space-between",
1862
- gap: 10
1863
- }
1857
+ marginBottom: 10,
1858
+ fontSize: 18,
1859
+ padding: 10,
1860
+ border: "1px dotted black"
1861
+ },
1862
+ wrap: false
1864
1863
  },
1865
1864
  /* @__PURE__ */ React12.createElement(
1866
1865
  View7,
@@ -1868,44 +1867,43 @@ var A4PujaList = ({
1868
1867
  style: {
1869
1868
  display: "flex",
1870
1869
  flexDirection: "row",
1870
+ justifyContent: "space-between",
1871
1871
  gap: 10
1872
1872
  }
1873
1873
  },
1874
1874
  /* @__PURE__ */ React12.createElement(
1875
- Text_default,
1875
+ View7,
1876
1876
  {
1877
1877
  style: {
1878
- fontWeight: "semibold"
1878
+ display: "flex",
1879
+ flexDirection: "row",
1880
+ gap: 10
1879
1881
  }
1880
1882
  },
1881
- booking.invoiceNumber
1883
+ /* @__PURE__ */ React12.createElement(Text_default, { style: { fontWeight: "semibold" } }, invoiceNumber),
1884
+ /* @__PURE__ */ React12.createElement(Text_default, null, first.date ? new Date(first.date).toDateString() : date.toDateString())
1882
1885
  ),
1883
- /* @__PURE__ */ React12.createElement(Text_default, null, booking.date ? new Date(booking.date).toDateString() : date.toDateString())
1886
+ /* @__PURE__ */ React12.createElement(Text_default, null, first.phone_number)
1884
1887
  ),
1885
- /* @__PURE__ */ React12.createElement(Text_default, null, booking.phone_number)
1886
- ),
1887
- /* @__PURE__ */ React12.createElement(
1888
- View7,
1889
- {
1890
- style: {
1891
- height: 15,
1892
- width: "100%"
1893
- }
1894
- }
1895
- ),
1896
- /* @__PURE__ */ React12.createElement(
1897
- View7,
1898
- {
1899
- style: {
1900
- display: "flex",
1901
- flexDirection: "row"
1902
- }
1903
- },
1904
- /* @__PURE__ */ React12.createElement(Text_default, null, `${booking.devoteeName} ----- ${booking.nakshatra} ----- ${puja.name}`)
1905
- )
1906
- );
1907
- });
1908
- })
1888
+ /* @__PURE__ */ React12.createElement(View7, { style: { height: 15, width: "100%" } }),
1889
+ bookingsArr.map(
1890
+ (booking, idx) => /* @__PURE__ */ React12.createElement(
1891
+ View7,
1892
+ {
1893
+ key: idx,
1894
+ style: {
1895
+ display: "flex",
1896
+ flexDirection: "row",
1897
+ marginTop: 25
1898
+ }
1899
+ },
1900
+ /* @__PURE__ */ React12.createElement(Text_default, null, `${booking.devoteeName} ----- ${booking.nakshatra} ----- ${booking.pujaName}`)
1901
+ )
1902
+ )
1903
+ );
1904
+ }
1905
+ );
1906
+ })()
1909
1907
  )) : null));
1910
1908
  };
1911
1909
  var A4PujaList_default = A4PujaList;
@@ -2490,32 +2488,31 @@ var A4CombinedReport = ({
2490
2488
  gap: 15
2491
2489
  }
2492
2490
  },
2493
- pujaData.map((puja, pujaIndex) => {
2494
- if (!puja.bookings.some((booking) => booking.requires_coupon))
2495
- return null;
2496
- return puja.bookings.map((booking, bookingIndex) => {
2497
- if (!booking.requires_coupon) return null;
2498
- return /* @__PURE__ */ React14.createElement(
2499
- View9,
2500
- {
2501
- key: bookingIndex,
2502
- style: {
2503
- marginBottom: 10,
2504
- fontSize: 18,
2505
- padding: 10,
2506
- border: "1px dotted black"
2507
- },
2508
- wrap: false
2509
- },
2510
- /* @__PURE__ */ React14.createElement(
2491
+ (() => {
2492
+ const allCouponBookings = pujaData.flatMap(
2493
+ (puja) => puja.bookings.filter((booking) => booking.requires_coupon).map((booking) => ({ ...booking, pujaName: puja.name }))
2494
+ );
2495
+ const grouped = {};
2496
+ for (const booking of allCouponBookings) {
2497
+ if (!grouped[booking.invoiceNumber])
2498
+ grouped[booking.invoiceNumber] = [];
2499
+ grouped[booking.invoiceNumber].push(booking);
2500
+ }
2501
+ return Object.entries(grouped).map(
2502
+ ([invoiceNumber, bookings], groupIdx) => {
2503
+ const bookingsArr = bookings;
2504
+ const first = bookingsArr[0];
2505
+ return /* @__PURE__ */ React14.createElement(
2511
2506
  View9,
2512
2507
  {
2508
+ key: invoiceNumber,
2513
2509
  style: {
2514
- display: "flex",
2515
- flexDirection: "row",
2516
- justifyContent: "space-between",
2517
- gap: 10
2518
- }
2510
+ marginBottom: 10,
2511
+ fontSize: 18,
2512
+ padding: 10,
2513
+ border: "1px dotted black"
2514
+ },
2515
+ wrap: false
2519
2516
  },
2520
2517
  /* @__PURE__ */ React14.createElement(
2521
2518
  View9,
@@ -2523,44 +2520,43 @@ var A4CombinedReport = ({
2523
2520
  style: {
2524
2521
  display: "flex",
2525
2522
  flexDirection: "row",
2523
+ justifyContent: "space-between",
2526
2524
  gap: 10
2527
2525
  }
2528
2526
  },
2529
2527
  /* @__PURE__ */ React14.createElement(
2530
- Text_default,
2528
+ View9,
2531
2529
  {
2532
2530
  style: {
2533
- fontWeight: "semibold"
2531
+ display: "flex",
2532
+ flexDirection: "row",
2533
+ gap: 10
2534
2534
  }
2535
2535
  },
2536
- booking.invoiceNumber
2536
+ /* @__PURE__ */ React14.createElement(Text_default, { style: { fontWeight: "semibold" } }, invoiceNumber),
2537
+ /* @__PURE__ */ React14.createElement(Text_default, null, first.date ? new Date(first.date).toDateString() : date.toDateString())
2537
2538
  ),
2538
- /* @__PURE__ */ React14.createElement(Text_default, null, booking.date ? new Date(booking.date).toDateString() : date.toDateString())
2539
+ /* @__PURE__ */ React14.createElement(Text_default, null, first.phone_number)
2539
2540
  ),
2540
- /* @__PURE__ */ React14.createElement(Text_default, null, booking.phone_number)
2541
- ),
2542
- /* @__PURE__ */ React14.createElement(
2543
- View9,
2544
- {
2545
- style: {
2546
- height: 15,
2547
- width: "100%"
2548
- }
2549
- }
2550
- ),
2551
- /* @__PURE__ */ React14.createElement(
2552
- View9,
2553
- {
2554
- style: {
2555
- display: "flex",
2556
- flexDirection: "row"
2557
- }
2558
- },
2559
- /* @__PURE__ */ React14.createElement(Text_default, null, `${booking.devoteeName} ----- ${booking.nakshatra} ----- ${puja.name}`)
2560
- )
2561
- );
2562
- });
2563
- })
2541
+ /* @__PURE__ */ React14.createElement(View9, { style: { height: 15, width: "100%" } }),
2542
+ bookingsArr.map(
2543
+ (booking, idx) => /* @__PURE__ */ React14.createElement(
2544
+ View9,
2545
+ {
2546
+ key: idx,
2547
+ style: {
2548
+ display: "flex",
2549
+ flexDirection: "row",
2550
+ marginTop: 25
2551
+ }
2552
+ },
2553
+ /* @__PURE__ */ React14.createElement(Text_default, null, `${booking.devoteeName} ----- ${booking.nakshatra} ----- ${booking.pujaName}`)
2554
+ )
2555
+ )
2556
+ );
2557
+ }
2558
+ );
2559
+ })()
2564
2560
  )), prasadData.length > 0 && /* @__PURE__ */ React14.createElement(Page10, { size: "A4", style: { padding: 30, fontFamily: "Noto Sans" } }, /* @__PURE__ */ React14.createElement(
2565
2561
  Image11,
2566
2562
  {
@@ -2726,177 +2722,56 @@ var A4CombinedReport = ({
2726
2722
  },
2727
2723
  src: bmpLogo
2728
2724
  }
2729
- ), /* @__PURE__ */ React14.createElement(Text_default, { style: { fontSize: 11, marginTop: 5, textAlign: "right" } }, "Date: ", date.toDateString()), /* @__PURE__ */ React14.createElement(Text_default, { style: { fontSize: 14, fontWeight: "bold" } }, "Prasad Delivery Address"), /* @__PURE__ */ React14.createElement(Text_default, { style: { fontSize: 12 } }, `${templeName}`), /* @__PURE__ */ React14.createElement(
2725
+ ), /* @__PURE__ */ React14.createElement(Text_default, { style: { fontSize: 11, marginTop: 5, textAlign: "right" } }, "Date: ", date.toDateString()), /* @__PURE__ */ React14.createElement(Text_default, { style: { fontSize: 14, fontWeight: "bold" } }, "Prasad Delivery Postal Report"), /* @__PURE__ */ React14.createElement(Text_default, { style: { fontSize: 12 } }, `${templeName}`), /* @__PURE__ */ React14.createElement(
2730
2726
  View9,
2731
2727
  {
2732
2728
  style: {
2733
2729
  display: "flex",
2734
- flexDirection: "column",
2735
- marginTop: 20
2730
+ flexDirection: "row",
2731
+ marginTop: 20,
2732
+ width: "100%",
2733
+ gap: 20,
2734
+ flexWrap: "wrap"
2736
2735
  }
2737
2736
  },
2738
- /* @__PURE__ */ React14.createElement(
2739
- View9,
2740
- {
2741
- style: {
2742
- display: "flex",
2743
- flexDirection: "row",
2744
- border: "1px solid black",
2745
- fontWeight: "semibold",
2746
- fontSize: 10
2747
- }
2748
- },
2749
- /* @__PURE__ */ React14.createElement(
2750
- View9,
2751
- {
2752
- style: {
2753
- padding: 6,
2754
- borderRight: "1px solid black",
2755
- width: "10%"
2756
- }
2757
- },
2758
- /* @__PURE__ */ React14.createElement(Text_default, null, "Date")
2759
- ),
2760
- /* @__PURE__ */ React14.createElement(
2761
- View9,
2762
- {
2763
- style: {
2764
- padding: 6,
2765
- borderRight: "1px solid black",
2766
- width: "13%"
2767
- }
2768
- },
2769
- /* @__PURE__ */ React14.createElement(Text_default, null, "Invoice")
2770
- ),
2771
- /* @__PURE__ */ React14.createElement(
2772
- View9,
2773
- {
2774
- style: {
2775
- padding: 6,
2776
- borderRight: "1px solid black",
2777
- width: "18%"
2778
- }
2779
- },
2780
- /* @__PURE__ */ React14.createElement(Text_default, null, "Devotee Name")
2781
- ),
2782
- /* @__PURE__ */ React14.createElement(
2783
- View9,
2784
- {
2785
- style: {
2786
- padding: 6,
2787
- borderRight: "1px solid black",
2788
- width: "25%"
2789
- }
2790
- },
2791
- /* @__PURE__ */ React14.createElement(Text_default, null, "Address")
2792
- ),
2793
- /* @__PURE__ */ React14.createElement(
2794
- View9,
2795
- {
2796
- style: {
2797
- padding: 6,
2798
- borderRight: "1px solid black",
2799
- width: "20%"
2800
- }
2801
- },
2802
- /* @__PURE__ */ React14.createElement(Text_default, null, "Puja Name")
2803
- ),
2804
- /* @__PURE__ */ React14.createElement(
2805
- View9,
2806
- {
2807
- style: {
2808
- padding: 6,
2809
- width: "15%"
2810
- }
2811
- },
2812
- /* @__PURE__ */ React14.createElement(Text_default, null, "Amount")
2813
- )
2814
- ),
2815
- deliveryData.map((item, index) => {
2737
+ deliveryData && deliveryData.map((item) => {
2816
2738
  return /* @__PURE__ */ React14.createElement(
2817
2739
  View9,
2818
2740
  {
2741
+ key: item.id,
2819
2742
  style: {
2743
+ width: "46%",
2820
2744
  display: "flex",
2821
- flexDirection: "row",
2745
+ flexDirection: "column",
2822
2746
  border: "1px solid black",
2823
- borderTop: "none",
2824
- fontSize: 10
2747
+ borderStyle: "dotted",
2748
+ borderWidth: 1.5,
2749
+ padding: 6
2825
2750
  }
2826
2751
  },
2827
2752
  /* @__PURE__ */ React14.createElement(
2828
2753
  View9,
2829
2754
  {
2830
2755
  style: {
2831
- padding: 6,
2832
- borderRight: "1px solid black",
2833
- width: "10%"
2834
- }
2835
- },
2836
- /* @__PURE__ */ React14.createElement(Text_default, null, new Date(item.date).toLocaleDateString("en-GB", {
2837
- day: "2-digit",
2838
- month: "2-digit",
2839
- year: "2-digit"
2840
- }))
2841
- ),
2842
- /* @__PURE__ */ React14.createElement(
2843
- View9,
2844
- {
2845
- style: {
2846
- padding: 6,
2847
- borderRight: "1px solid black",
2848
- width: "13%"
2849
- }
2850
- },
2851
- /* @__PURE__ */ React14.createElement(Text_default, null, item.invoiceNumber)
2852
- ),
2853
- /* @__PURE__ */ React14.createElement(
2854
- View9,
2855
- {
2856
- style: {
2857
- padding: 6,
2858
- borderRight: "1px solid black",
2859
- width: "18%"
2860
- }
2861
- },
2862
- /* @__PURE__ */ React14.createElement(Text_default, null, item.devoteeName)
2863
- ),
2864
- /* @__PURE__ */ React14.createElement(
2865
- View9,
2866
- {
2867
- style: {
2868
- padding: 6,
2869
- borderRight: "1px solid black",
2870
- width: "25%"
2756
+ flexGrow: 1
2871
2757
  }
2872
2758
  },
2873
- /* @__PURE__ */ React14.createElement(Text_default, null, item.address)
2759
+ /* @__PURE__ */ React14.createElement(Text_default, { style: { fontSize: 10, fontWeight: "bold" } }, item.name),
2760
+ /* @__PURE__ */ React14.createElement(Text_default, { style: { fontSize: 10 } }, item.address),
2761
+ /* @__PURE__ */ React14.createElement(Text_default, { style: { fontSize: 10 } }, item.phone)
2874
2762
  ),
2875
2763
  /* @__PURE__ */ React14.createElement(
2876
2764
  View9,
2877
2765
  {
2878
2766
  style: {
2879
- padding: 6,
2880
- borderRight: "1px solid black",
2881
- width: "20%"
2767
+ borderTop: "1px solid black",
2768
+ marginTop: 5,
2769
+ paddingTop: 3,
2770
+ borderStyle: "dotted"
2882
2771
  }
2883
- },
2884
- /* @__PURE__ */ React14.createElement(Text_default, null, item.pujaName)
2772
+ }
2885
2773
  ),
2886
- /* @__PURE__ */ React14.createElement(
2887
- View9,
2888
- {
2889
- style: {
2890
- padding: 6,
2891
- width: "15%"
2892
- }
2893
- },
2894
- /* @__PURE__ */ React14.createElement(Text_default, null, item.amount.toLocaleString("en-IN", {
2895
- maximumFractionDigits: 2,
2896
- style: "currency",
2897
- currency: "INR"
2898
- }))
2899
- )
2774
+ /* @__PURE__ */ React14.createElement(Text_default, { style: { fontSize: 9, marginTop: 3 } }, "Note: ", item.pujaDetails)
2900
2775
  );
2901
2776
  })
2902
2777
  ))));
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.3.31",
4
+ "version": "0.3.33",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",