Blame view

src/pages/Account/viewInvoice.vue 10.6 KB
687e0b929   Neeraj Sharma   add user,attenden...
1
2
  <template>
    <v-app id="pages-dasboard">
99cd79184   Neeraj Sharma   implement all tas...
3
      <!-- ****** Edit INVOICE ****** -->
687e0b929   Neeraj Sharma   add user,attenden...
4
      <v-container fluid grid-list-md>
25205ccca   Shikha Mishra   show school logo ...
5
6
7
8
9
10
11
12
13
        <v-layout>
          <v-flex xs12 sm8 md10>
            <v-btn class="open-dialog-button mt-3" round dark @click="printInvoice()">
              Print
              <v-icon size="18" right dark>print</v-icon>
            </v-btn>
          </v-flex>
        </v-layout>
        <v-flex xs12 sm12 id="printMe">
687e0b929   Neeraj Sharma   add user,attenden...
14
          <v-layout wrap>
25205ccca   Shikha Mishra   show school logo ...
15
16
17
            <!-- ****** TABLE DATA MARK  ****** -->
            <v-flex xs12 sm12 md12>
              <v-card>
81d876b5d   Shikha Mishra   salary invoice de...
18
19
20
21
22
23
                <v-layout wrap>
                  <v-flex 12>
                    <br />
                    <v-layout>
                      <v-flex xs12 sm12 md12 class="text-xs-center">
                        <!-- <img :src="userData.schoolLogoUrl" width="140" alt="logo" />
25205ccca   Shikha Mishra   show school logo ...
24
                          <p class="title">{{ userData.name }}</p>
81d876b5d   Shikha Mishra   salary invoice de...
25
26
27
28
29
30
31
32
33
34
35
                        <p>{{ userData.address }}</p>-->
                        <v-avatar>
                          <img :src="userData.schoolLogoUrl" v-if="userData.schoolLogoUrl" />
                          <img
                            src="/static/schoolIcons/INTRACK_White.png"
                            v-else-if="!userData.schoolLogoUrl"
                          />
                        </v-avatar>
                        <p class="title">{{ userData.name }}</p>
                        <p>{{ userData.address }}</p>
                      </v-flex>
25205ccca   Shikha Mishra   show school logo ...
36

81d876b5d   Shikha Mishra   salary invoice de...
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
                      <v-flex xs12 sm12 md12 class="text-xs-center">
                        <v-layout>
                          <v-flex xs4 sm2>
                            <h5 class="right my-1">
                              <b>Name:</b>
                            </h5>
                          </v-flex>
                          <v-flex sm11 xs8>
                            <h5 class="my-1">{{ invoiceParticularData.studentId.name }}</h5>
                          </v-flex>
                        </v-layout>
                        <v-layout>
                          <v-flex xs4 sm2>
                            <h5 class="right my-1">
                              <b>Class:</b>
                            </h5>
                          </v-flex>
                          <v-flex sm11 xs8>
                            <h5 class="my-1">{{ invoiceParticularData.classId.classNum }}</h5>
                          </v-flex>
                        </v-layout>
                        <!-- <v-flex xs12 sm6> -->
                        <v-layout>
                          <v-flex xs4 sm2>
                            <h5 class="right my-1">
                              <b>Roll No:</b>
                            </h5>
                          </v-flex>
                          <v-flex sm6 xs8>
                            <h5 class="my-1">{{ invoiceParticularData.studentId.rollNo }}</h5>
                          </v-flex>
                        </v-layout>
                        <v-layout>
                          <v-flex xs4 sm2>
                            <h5 class="right my-1">
                              <b>email:</b>
                            </h5>
                          </v-flex>
                          <v-flex sm6 xs8>
                            <h5 class="my-1 linkCover">{{ invoiceParticularData.studentId.email }}</h5>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                      <v-flex xs12 sm12 md12 class="text-xs-center">
                        <v-layout>
                          <v-flex xs4 sm2>
                            <h5 class="right my-1">
                              <b>invoice:</b>
                            </h5>
                          </v-flex>
                          <v-flex sm11 xs8>
                            <h5 class="my-1">#{{ invoiceParticularData.invoiceNumber }}</h5>
                          </v-flex>
                        </v-layout>
                        <v-layout>
                          <v-flex xs4 sm2>
                            <h5 class="right my-1">
                              <b>Status :</b>
                            </h5>
                          </v-flex>
                          <v-flex sm6 xs8>
                            <h5 class="my-1">{{ invoiceParticularData.paymentStatus }}</h5>
                          </v-flex>
                        </v-layout>
                      </v-flex>
                    </v-layout>
                  </v-flex>
                </v-layout>
25205ccca   Shikha Mishra   show school logo ...
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
                <table class="feeTypeTable tableRsponsive">
                  <tr class="info white--text">
                    <th>#</th>
                    <th>Fee Type</th>
                    <th>Amount</th>
                    <th>Discount</th>
                    <th>Subtotal</th>
                  </tr>
                  <tr
                    v-for="(feeType, index) in feeTypeData"
                    :key="index"
                    v-on:keyup="getAmmountDetails(feeType)"
                  >
                    <td style="width:40px">{{ index + 1 }}</td>
                    <td style="width:120px">{{ feeType.feeTypeName }}</td>
                    <td style="width:120px">{{ feeType.amount }}</td>
                    <td style="width:120px">{{ feeType.amount-feeType.subTotal }}</td>
                    <td style="width:120px">{{ feeType.subTotal }}</td>
                  </tr>
81d876b5d   Shikha Mishra   salary invoice de...
124
                  <tfoot>
25205ccca   Shikha Mishra   show school logo ...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
                    <tr>
                      <td colspan="4">
                        <span class="right subheding">Total Amount (RS) :</span>
                      </td>
                      <td>{{ feeType.subTotal }}</td>
                    </tr>
                    <tr>
                      <td colspan="4">
                        <span class="right subheding">Paid (RS) :</span>
                      </td>
                      <td>{{ feeType.totalPaidAmount ? feeType.totalPaidAmount : 0 }}</td>
                    </tr>
                    <tr>
                      <td colspan="4">
6df6faccd   Rishav Singla   design changes
139
                        <span class="right subheding">Discount (%) :</span>
81d876b5d   Shikha Mishra   salary invoice de...
140
                      </td>
6df6faccd   Rishav Singla   design changes
141
                      <td>{{ feeType.discount}}</td>
81d876b5d   Shikha Mishra   salary invoice de...
142
143
144
                    </tr>
                    <tr>
                      <td colspan="4">
25205ccca   Shikha Mishra   show school logo ...
145
146
147
148
                        <span class="right subheding">Balance (RS) :</span>
                      </td>
                      <td>{{ feeType.totalPaidAmount ? feeType.subTotal - feeType.totalPaidAmount : feeType.subTotal }}</td>
                    </tr>
81d876b5d   Shikha Mishra   salary invoice de...
149
                  </tfoot>
25205ccca   Shikha Mishra   show school logo ...
150
151
                </table>
              </v-card>
006544386   Neeraj Sharma   implement task
152
153
            </v-flex>
          </v-layout>
25205ccca   Shikha Mishra   show school logo ...
154
        </v-flex>
687e0b929   Neeraj Sharma   add user,attenden...
155
156
157
158
159
160
161
162
163
      </v-container>
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
    </v-app>
  </template>
  
  <script>
  import http from "@/Services/http.js";
687e0b929   Neeraj Sharma   add user,attenden...
164
165
166
167
168
169
  import moment from "moment";
  
  export default {
    data: () => ({
      showLoader: false,
      feeTypes: [],
25205ccca   Shikha Mishra   show school logo ...
170
      filterData: [],
687e0b929   Neeraj Sharma   add user,attenden...
171
172
173
174
175
176
177
178
179
180
      invoiceData: {},
      feeType: {
        amount: "",
        discount: "",
        totalPaidAmount: "",
        subTotal: "",
        feeTypeName: ""
      },
      feeTypeData: [],
      token: "",
c34b2bc04   Shikha Mishra   solved issues rel...
181
182
183
184
185
186
      invoiceParticularData: {
        studentId: {
          name: ""
        },
        classId: {
          classNum: ""
81d876b5d   Shikha Mishra   salary invoice de...
187
        }
c34b2bc04   Shikha Mishra   solved issues rel...
188
189
190
      },
      userData: {
        name: ""
81d876b5d   Shikha Mishra   salary invoice de...
191
      }
687e0b929   Neeraj Sharma   add user,attenden...
192
    }),
006544386   Neeraj Sharma   implement task
193

687e0b929   Neeraj Sharma   add user,attenden...
194
    methods: {
687e0b929   Neeraj Sharma   add user,attenden...
195
196
197
      getInvoiceList() {
        http()
          .get("/getParticularInvoice", {
99cd79184   Neeraj Sharma   implement all tas...
198
199
200
201
            params: {
              invoiceId: this.$route.params.viewInvoiceId,
              schoolId: this.$store.state.schoolId
            },
687e0b929   Neeraj Sharma   add user,attenden...
202
203
204
205
206
207
208
209
210
211
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.invoiceParticularData = response.data.data;
            this.invoiceData = this.invoiceParticularData;
            this.invoiceData.date = this.invoiceParticularData.date.slice(0, 10);
            this.feeTypeData = this.invoiceParticularData.feeType;
            (this.feeType.amount = response.data.data.totalAmount),
              (this.feeType.discount = response.data.data.totalDiscount),
              (this.feeType.subTotal = response.data.data.totalSubTotal),
d9bb52b5b   Neeraj Sharma   implement trello ...
212
213
              (this.feeType.totalPaidAmount = response.data.data.totalPaidAmount);
            this.showLoader = false;
687e0b929   Neeraj Sharma   add user,attenden...
214
          })
00e4bc4e1   Neeraj Sharma   fixed auntentication
215
          .catch(error => {
687e0b929   Neeraj Sharma   add user,attenden...
216
            this.showLoader = false;
00e4bc4e1   Neeraj Sharma   fixed auntentication
217
218
219
220
221
222
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
              this.$store.dispatch("Role", null);
            }
687e0b929   Neeraj Sharma   add user,attenden...
223
224
225
226
227
          });
      },
      getfeeType() {
        http()
          .get("/getFeesList", {
99cd79184   Neeraj Sharma   implement all tas...
228
            params: { schoolId: this.$store.state.schoolId },
687e0b929   Neeraj Sharma   add user,attenden...
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.feeTypes = response.data.data;
          })
          .catch(err => {
            // console.log("err====>", err);
          });
      },
      getAmmountDetails(feeTyp) {
        let feeType = {
          subTotal: "",
          subParticularTotal: "",
          paidAmount: ""
        };
006544386   Neeraj Sharma   implement task
244
245
246
247
248
249
250
251
        // *********** SUBTOTAL ***********
        feeType.subTotal =
          Number(feeType.subTotal) + Number(this.feeTypeData[i].subTotal);
        this.feeType.subTotal = feeType.subTotal.toFixed(2);
        // *********** PAID-AMOUNT ***********
        feeType.paidAmount =
          Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount);
        this.feeType.paidAmount = feeType.paidAmount.toFixed(2);
25205ccca   Shikha Mishra   show school logo ...
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
      },
      printInvoice() {
        // Pass the element id here
        this.$htmlToPaper("printMe");
      },
      getUserData() {
        http()
          .get("/getParticularUserDetail")
          .then(response => {
            this.userData = response.data.data;
          })
          .catch(error => {
            // if (error.response.status === 401) {
            //   this.$router.replace({ path: "/" });
            //   this.$store.dispatch("setToken", null);
            //   this.$store.dispatch("Id", null);
            // }
          });
687e0b929   Neeraj Sharma   add user,attenden...
270
271
272
273
274
275
      }
    },
    mounted() {
      this.token = this.$store.state.token;
      this.getInvoiceList();
      this.getfeeType();
25205ccca   Shikha Mishra   show school logo ...
276
      this.getUserData();
687e0b929   Neeraj Sharma   add user,attenden...
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
    },
    created() {
      this.$root.$on("app:search", search => {
        this.search = search;
      });
    },
    beforeDestroy() {
      // dont forget to remove the listener
      this.$root.$off("app:search");
    }
  };
  </script>
  
  
  <style scoped>
  .active {
    background-color: gray;
    color: white !important;
  }
  .activebtn {
    color: black !important;
  }
  table {
    border-collapse: collapse;
    border: 1px solid #e2e7eb;
  }
25205ccca   Shikha Mishra   show school logo ...
303
304
305
306
307
  .open-dialog-button {
    background: #827bfa !important;
    border-color: #827bfa !important;
    text-transform: none !important;
  }
687e0b929   Neeraj Sharma   add user,attenden...
308
309
310
311
312
313
314
315
316
317
318
  
  th,
  td {
    border: 1px solid #e2e7eb;
    padding: 10px;
    text-align: center;
  }
  table.feeTypeTable {
    table-layout: auto !important;
    width: 100% !important;
  }
aa8fc5033   Neeraj Sharma   implenment all pa...
319
  @media screen and (max-width: 380px) {
006544386   Neeraj Sharma   implement task
320
321
322
323
324
    .tableRsponsive {
      display: block;
      position: relative;
      overflow: scroll;
    }
aa8fc5033   Neeraj Sharma   implenment all pa...
325
  }
687e0b929   Neeraj Sharma   add user,attenden...
326
  </style>