jp-shared 1.1.17 → 1.1.19

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.
@@ -1,3 +1,5 @@
1
+ const { salesModel } = require("./sales-model");
2
+
1
3
  module.exports = {
2
4
  ActiveRecruiterModel: require("./active-model"),
3
5
  PendingRecruiterModel: require("./pending-model"),
@@ -7,5 +9,6 @@ module.exports = {
7
9
  RequestRecruiterModel: require("./request-model"),
8
10
  VerificationRecruiterModel: require("./verification-model"),
9
11
  RecruiterMobileOTPModel: require("./mobileOTP-model"),
12
+ SalesModel : require("./sales-model"),
10
13
  RecruiterEmailOTPModel: require("./emailOTP-model")
11
14
  };
@@ -0,0 +1,39 @@
1
+ const mongoose = require("mongoose");
2
+ const { getDatabaseName } = require("../../constants");
3
+
4
+ const schema = new mongoose.Schema({
5
+ lookingFor: {
6
+ type: String,
7
+ required: true
8
+ },
9
+ name:{
10
+ type: String,
11
+ required: true
12
+ },
13
+ contactNumber:{
14
+ type: Number,
15
+ required: true,
16
+ },
17
+ companyName:{
18
+ type: String,
19
+ required: true
20
+ },
21
+ designation:{
22
+ type: String,
23
+ required: true
24
+ },
25
+ email:{
26
+ type: String,
27
+ required: true
28
+ },
29
+ city:{
30
+ type: String,
31
+ required: true
32
+ }
33
+ });
34
+
35
+ const myDB = mongoose.connection.useDb(getDatabaseName());
36
+
37
+ const SalesModel = myDB.model("sales", schema);
38
+
39
+ module.exports = { SalesModel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jp-shared",
3
- "version": "1.1.17",
3
+ "version": "1.1.19",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -6,7 +6,7 @@ module.exports.invoiceEmailTemplate = ({
6
6
  totalAmount = "470.82",
7
7
  totalAmountWords = "Four Hundred Seventy Rupees and Eighty-Two Paise Only",
8
8
  gstPercentage = "18",
9
- gstAmount ,
9
+ gstAmount = "6",
10
10
  companyAddress,
11
11
  companyName,
12
12
  gstNumber,
@@ -14,10 +14,7 @@ module.exports.invoiceEmailTemplate = ({
14
14
  supportEmail,
15
15
  supportMobile,
16
16
  termsUrl,
17
-
18
17
  }) => {
19
- console.log(gstAmount,"gstAmount");
20
-
21
18
  return `
22
19
  <!DOCTYPE html>
23
20
  <html lang="en">
@@ -80,7 +77,7 @@ module.exports.invoiceEmailTemplate = ({
80
77
  item.description
81
78
  }</td>
82
79
  <td style="border: 1px solid #000; padding: 10px; text-align: center;">${
83
- item.amount
80
+ Number(item.amount).toFixed(2)
84
81
  }</td>
85
82
  </tr>`
86
83
  )
@@ -91,9 +88,7 @@ module.exports.invoiceEmailTemplate = ({
91
88
  </tr>
92
89
  <tr>
93
90
  <td colspan="2" style="text-align: right; border: 1px solid #000; padding: 10px;"><strong>Total Amount</strong></td>
94
- <td style="border: 1px solid #000; padding: 10px; text-align: center;"><strong>${
95
- Number(totalAmount).toFixed(2)
96
- }</strong></td>
91
+ <td style="border: 1px solid #000; padding: 10px; text-align: center;"><strong>${totalAmount}</strong></td>
97
92
  </tr>
98
93
  </tbody>
99
94
  </table>
@@ -53,20 +53,15 @@ const sendInvoice = async (invoiceInput) => {
53
53
  // Destructure the validated value
54
54
  const {
55
55
  recruiterEmail,
56
- gstPercentage,
56
+ gstAmount,
57
+ totalAmount,
57
58
  amount,
59
+ gstPercentage,
58
60
  billNumber,
59
61
  jobId,
60
62
  planName,
61
63
  } = value;
62
64
 
63
- // Calculate GST and total amount
64
- const gstAmount = parseFloat(((amount * gstPercentage) / 100).toFixed(2));
65
- const totalAmount = parseFloat((amount + gstAmount).toFixed(2));
66
-
67
- console.log(gstAmount,"gstAmount");
68
-
69
-
70
65
  // Check if the required environment variables are set
71
66
  if (!process.env.EMAIL || !process.env.EMAIL_PASSWORD) {
72
67
  const errorMsg = "Email credentials are not set in environment variables.";
@@ -85,17 +80,15 @@ console.log(gstAmount,"gstAmount");
85
80
  billNo: billNumber,
86
81
  jobId,
87
82
  items: [{ description: `${planName}`, amount: `${amount}` }],
88
- totalAmount :totalAmount.toFixed(2),
83
+ totalAmount,
89
84
  totalAmountWords: toWords.convert(totalAmount, { currency: true }),
90
85
  gstPercentage,
91
- gstAmount: gstAmount.toFixed(2),
86
+ gstAmount,
92
87
  ...OUR_ORG_INFO,
93
88
  };
94
89
 
95
90
  // Generate the invoice HTML content
96
91
  const invoiceHTML = invoiceEmailTemplate(invoiceData);
97
- console.log(invoiceHTML,"invoiceHTML");
98
-
99
92
  const pdfBuffer = await generatePDF(invoiceHTML);
100
93
 
101
94
  // Create a transporter using your email credentials