Commit 728b5d417ab010325fb8c94d66148ce14309bb8a

Authored by Neeraj Sharma
1 parent ff9003e131

solve bugs in add invoice

src/pages/Account/invoice.vue
1 <template> 1 <template>
2 <v-container fluid class="body-color"> 2 <v-container fluid class="body-color">
3 <!-- ****** Edit INVOICE ****** --> 3 <!-- ****** Edit INVOICE ****** -->
4 <v-dialog v-model="editInvoiceDialog"> 4 <v-dialog v-model="editInvoiceDialog">
5 <v-card flat class="text-xs-center white--text"> 5 <v-card flat class="text-xs-center white--text">
6 <v-layout> 6 <v-layout>
7 <v-flex xs12 class="card-styles pa-2"> 7 <v-flex xs12 class="card-styles pa-2">
8 <label class="title text-xs-center">Edit Invoice</label> 8 <label class="title text-xs-center">Edit Invoice</label>
9 <v-icon size="24" class="right white--text" @click="editInvoiceDialog = false">cancel</v-icon> 9 <v-icon size="24" class="right white--text" @click="editInvoiceDialog = false">cancel</v-icon>
10 </v-flex> 10 </v-flex>
11 </v-layout> 11 </v-layout>
12 <editInvoice :editData="editData" @update-editInvoice="updateDoneInvoice" /> 12 <editInvoice :editData="editData" @update-editInvoice="updateDoneInvoice" />
13 </v-card> 13 </v-card>
14 </v-dialog> 14 </v-dialog>
15 15
16 <!-- ****PAYMENT INVOICE DIALOG --> 16 <!-- ****PAYMENT INVOICE DIALOG -->
17 <v-dialog v-model="paymentInvoiceDialog"> 17 <v-dialog v-model="paymentInvoiceDialog">
18 <v-card flat class="text-xs-center white--text"> 18 <v-card flat class="text-xs-center white--text">
19 <v-layout> 19 <v-layout>
20 <v-flex xs12 class="card-styles pa-2"> 20 <v-flex xs12 class="card-styles pa-2">
21 <label class="title text-xs-center">Payment Template</label> 21 <label class="title text-xs-center">Payment Template</label>
22 <v-icon size="24" class="right white--text" @click="paymentInvoiceDialog = false">cancel</v-icon> 22 <v-icon size="24" class="right white--text" @click="paymentInvoiceDialog = false">cancel</v-icon>
23 </v-flex> 23 </v-flex>
24 </v-layout> 24 </v-layout>
25 <paymentTemplate :editPayment="editPayment" @update-Payment="updatePayment" /> 25 <paymentTemplate :editPayment="editPayment" @update-Payment="updatePayment" />
26 </v-card> 26 </v-card>
27 </v-dialog> 27 </v-dialog>
28 28
29 <!-- ****** PROFILE VIEW SECTION DATA ****** --> 29 <!-- ****** PROFILE VIEW SECTION DATA ****** -->
30 30
31 <v-dialog v-model="dialog1" max-width="800px"> 31 <v-dialog v-model="dialog1" max-width="800px">
32 <v-card flat class="text-xs-center white--text"> 32 <v-card flat class="text-xs-center white--text">
33 <v-layout> 33 <v-layout>
34 <v-flex xs12 class="card-style pa-2"> 34 <v-flex xs12 class="card-style pa-2">
35 <label class="title text-xs-center">View Payments</label> 35 <label class="title text-xs-center">View Payments</label>
36 <v-icon size="24" class="right" color="white" @click="dialog1 = false">cancel</v-icon> 36 <v-icon size="24" class="right" color="white" @click="dialog1 = false">cancel</v-icon>
37 </v-flex> 37 </v-flex>
38 </v-layout> 38 </v-layout>
39 <table class="feeTypeTable tableRsponsive"> 39 <table class="feeTypeTable tableRsponsive">
40 <tr style="color: black"> 40 <tr style="color: black">
41 <th>#</th> 41 <th>#</th>
42 <th>Date</th> 42 <th>Date</th>
43 <th>Paid By</th> 43 <th>Paid By</th>
44 <th>Payment Amount</th> 44 <th>Payment Amount</th>
45 <th>Weaver</th> 45 <th>Weaver</th>
46 <th>Action</th> 46 <th>Action</th>
47 </tr> 47 </tr>
48 <tr v-if="editedItem.paymentStatus !== 'NOT_PAID'"> 48 <tr v-if="editedItem.paymentStatus !== 'NOT_PAID'">
49 <td style="width:40px ; color:black" class="tdFeeType">1</td> 49 <td style="width:40px ; color:black" class="tdFeeType">1</td>
50 <td style="width:120px; color:black" class="tdFeeType">{{dates( editedItem.date) }}</td> 50 <td style="width:120px; color:black" class="tdFeeType">{{dates( editedItem.date) }}</td>
51 <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.paymentMethod }}</td> 51 <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.paymentMethod }}</td>
52 <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.totalPaidAmount }}</td> 52 <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.totalPaidAmount }}</td>
53 <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.totalDiscount}}</td> 53 <td style="width:120px; color:black" class="tdFeeType">{{ editedItem.totalDiscount}}</td>
54 <td class="text-xs-center td td-row"> 54 <td class="text-xs-center td td-row">
55 <router-link 55 <router-link
56 :to="{ name:'View Payment Invoice',params: { viewPaymentInvoiceId:editedItem._id } }" 56 :to="{ name:'View Payment Invoice',params: { viewPaymentInvoiceId:editedItem._id } }"
57 > 57 >
58 <v-tooltip top> 58 <v-tooltip top>
59 <img 59 <img
60 slot="activator" 60 slot="activator"
61 style="cursor:pointer; width:25px; height:25px; " 61 style="cursor:pointer; width:25px; height:25px; "
62 class="mr-3" 62 class="mr-3"
63 src="/static/icon/view.png" 63 src="/static/icon/view.png"
64 /> 64 />
65 <span>View</span> 65 <span>View</span>
66 </v-tooltip> 66 </v-tooltip>
67 </router-link> 67 </router-link>
68 <v-tooltip top> 68 <v-tooltip top>
69 <img 69 <img
70 slot="activator" 70 slot="activator"
71 style="cursor:pointer;width:20px; height:20px; " 71 style="cursor:pointer;width:20px; height:20px; "
72 class="mr-3" 72 class="mr-3"
73 @click="deletePayment(editedItem)" 73 @click="deletePayment(editedItem)"
74 src="/static/icon/delete.png" 74 src="/static/icon/delete.png"
75 /> 75 />
76 <span>Delete</span> 76 <span>Delete</span>
77 </v-tooltip> 77 </v-tooltip>
78 </td> 78 </td>
79 </tr> 79 </tr>
80 </table> 80 </table>
81 </v-card> 81 </v-card>
82 </v-dialog> 82 </v-dialog>
83 83
84 <!-- ****** Invoice Table ****** --> 84 <!-- ****** Invoice Table ****** -->
85 <v-toolbar color="transparent" flat> 85 <v-toolbar color="transparent" flat>
86 <v-btn 86 <v-btn
87 fab 87 fab
88 dark 88 dark
89 class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only" 89 class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
90 small 90 small
91 @click="addInvoiceDialog = true" 91 @click="addInvoiceDialog = true"
92 > 92 >
93 <v-icon dark>add</v-icon> 93 <v-icon dark>add</v-icon>
94 </v-btn> 94 </v-btn>
95 <v-btn 95 <v-btn
96 round 96 round
97 class="open-dialog-button hidden-sm-only hidden-xs-only" 97 class="open-dialog-button hidden-sm-only hidden-xs-only"
98 dark 98 dark
99 @click="addInvoiceDialog = true" 99 @click="addInvoiceDialog = true"
100 > 100 >
101 <v-icon class="white--text pr-1" size="20">add</v-icon>Add Invoice 101 <v-icon class="white--text pr-1" size="20">add</v-icon>Add Invoice
102 </v-btn> 102 </v-btn>
103 <v-spacer></v-spacer> 103 <v-spacer></v-spacer>
104 <v-card-title class="body-1" v-show="show"> 104 <v-card-title class="body-1" v-show="show">
105 <v-btn icon large flat @click="displaySearch"> 105 <v-btn icon large flat @click="displaySearch">
106 <v-avatar size="27"> 106 <v-avatar size="27">
107 <img src="/static/icon/search.png" alt="icon" /> 107 <img src="/static/icon/search.png" alt="icon" />
108 </v-avatar> 108 </v-avatar>
109 </v-btn> 109 </v-btn>
110 </v-card-title> 110 </v-card-title>
111 <v-flex xs8 sm8 md3 lg2 v-show="showSearch"> 111 <v-flex xs8 sm8 md3 lg2 v-show="showSearch">
112 <v-layout> 112 <v-layout>
113 <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field> 113 <v-text-field v-model="search" label="Search" prepend-inner-icon="search" color="primary"></v-text-field>
114 <v-icon @click="closeSearch" color="error">close</v-icon> 114 <v-icon @click="closeSearch" color="error">close</v-icon>
115 </v-layout> 115 </v-layout>
116 </v-flex> 116 </v-flex>
117 </v-toolbar> 117 </v-toolbar>
118 <v-data-table 118 <v-data-table
119 :headers="headers" 119 :headers="headers"
120 :items="invoiceList" 120 :items="invoiceList"
121 :pagination.sync="pagination" 121 :pagination.sync="pagination"
122 :search="search" 122 :search="search"
123 > 123 >
124 <template slot="items" slot-scope="props"> 124 <template slot="items" slot-scope="props">
125 <tr class="tr"> 125 <tr class="tr">
126 <td class="td td-row">{{ props.index + 1 }}</td> 126 <td class="td td-row">{{ props.index + 1 }}</td>
127 <td class="text-xs-center td td-row">{{ props.item.studentId.name }}</td> 127 <td class="text-xs-center td td-row">{{ props.item.studentId.name }}</td>
128 <td class="text-xs-center td td-row">{{ props.item.classId.classNum }}</td> 128 <td class="text-xs-center td td-row">{{ props.item.classId.classNum }}</td>
129 <td class="text-xs-center td td-row">{{ props.item.totalAmount }}</td> 129 <td class="text-xs-center td td-row">{{ props.item.totalAmount }}</td>
130 <td class="text-xs-center td td-row">{{ props.item.totalDiscount}}</td> 130 <td class="text-xs-center td td-row">{{ props.item.totalDiscount}}</td>
131 <td 131 <td
132 class="text-xs-center td td-row" 132 class="text-xs-center td td-row"
133 >{{ props.item.totalPaidAmount ? props.item.totalPaidAmount : 0}}</td> 133 >{{ props.item.totalPaidAmount ? props.item.totalPaidAmount : 0}}</td>
134 <td 134 <td
135 class="text-xs-center td td-row" 135 class="text-xs-center td td-row"
136 >{{ props.item.totalPaidAmount ? props.item.totalSubTotal - props.item.totalPaidAmount : props.item.totalSubTotal }}</td> 136 >{{ props.item.totalPaidAmount ? props.item.totalSubTotal - props.item.totalPaidAmount : props.item.totalSubTotal }}</td>
137 <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'NOT_PAID'"> 137 <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'NOT_PAID'">
138 <span 138 <span
139 class="red lighten-1 py-1 px-2 white--text paymentStatus" 139 class="red lighten-1 py-1 px-2 white--text paymentStatus"
140 >{{ props.item.paymentStatus }}</span> 140 >{{ props.item.paymentStatus }}</span>
141 </td> 141 </td>
142 <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'FULLY_PAID'"> 142 <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'FULLY_PAID'">
143 <span 143 <span
144 class="green lighten-1 py-1 px-2 white--text paymentStatus" 144 class="green lighten-1 py-1 px-2 white--text paymentStatus"
145 >{{ props.item.paymentStatus }}</span> 145 >{{ props.item.paymentStatus }}</span>
146 </td> 146 </td>
147 <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'PARTIALLY_PAID'"> 147 <td class="text-xs-center td td-row" v-if="props.item.paymentStatus === 'PARTIALLY_PAID'">
148 <span 148 <span
149 class="yellow darken-3 py-1 px-2 white--text paymentStatus" 149 class="yellow darken-3 py-1 px-2 white--text paymentStatus"
150 >{{ props.item.paymentStatus }}</span> 150 >{{ props.item.paymentStatus }}</span>
151 </td> 151 </td>
152 <td class="text-xs-center td td-row">{{ dates(props.item.date) }}</td> 152 <td class="text-xs-center td td-row">{{ dates(props.item.date) }}</td>
153 <td class="text-xs-center td td-row"> 153 <td class="text-xs-center td td-row">
154 <router-link :to="{ name:'View Invoice',params: { viewInvoiceId:props.item._id } }"> 154 <router-link :to="{ name:'View Invoice',params: { viewInvoiceId:props.item._id } }">
155 <v-tooltip top> 155 <v-tooltip top>
156 <img 156 <img
157 slot="activator" 157 slot="activator"
158 style="cursor:pointer; width:25px; height:25px; " 158 style="cursor:pointer; width:25px; height:25px; "
159 class="mr-3" 159 class="mr-3"
160 src="/static/icon/view.png" 160 src="/static/icon/view.png"
161 /> 161 />
162 <span>View</span> 162 <span>View</span>
163 </v-tooltip> 163 </v-tooltip>
164 </router-link> 164 </router-link>
165 <span v-if="props.item.paymentStatus === 'NOT_PAID'"> 165 <span v-if="props.item.paymentStatus === 'NOT_PAID'">
166 <!-- <router-link :to="{ name: 'Edit Invoice',params: { invoiceid: editData._id } }"> 166 <!-- <router-link :to="{ name: 'Edit Invoice',params: { invoiceid: editData._id } }">
167 <v-tooltip top> 167 <v-tooltip top>
168 <img 168 <img
169 slot="activator" 169 slot="activator"
170 style="cursor:pointer; width:20px; height:18px; " 170 style="cursor:pointer; width:20px; height:18px; "
171 class="mr-3" 171 class="mr-3"
172 @click="editItem(props.item)" 172 @click="editItem(props.item)"
173 src="/static/icon/edit.png" 173 src="/static/icon/edit.png"
174 /> 174 />
175 <span>Edit</span> 175 <span>Edit</span>
176 </v-tooltip> 176 </v-tooltip>
177 </router-link>--> 177 </router-link>-->
178 <v-tooltip top> 178 <v-tooltip top>
179 <img 179 <img
180 slot="activator" 180 slot="activator"
181 style="cursor:pointer; width:20px; height:18px; " 181 style="cursor:pointer; width:20px; height:18px; "
182 class="mr-3" 182 class="mr-3"
183 @click="editItem(props.item)" 183 @click="editItem(props.item)"
184 src="/static/icon/edit.png" 184 src="/static/icon/edit.png"
185 /> 185 />
186 <span>Edit</span> 186 <span>Edit</span>
187 </v-tooltip> 187 </v-tooltip>
188 <v-tooltip top> 188 <v-tooltip top>
189 <img 189 <img
190 slot="activator" 190 slot="activator"
191 style="cursor:pointer;width:20px; height:20px; " 191 style="cursor:pointer;width:20px; height:20px; "
192 class="mr-3" 192 class="mr-3"
193 @click="deleteItem(props.item)" 193 @click="deleteItem(props.item)"
194 src="/static/icon/delete.png" 194 src="/static/icon/delete.png"
195 /> 195 />
196 <span>Delete</span> 196 <span>Delete</span>
197 </v-tooltip> 197 </v-tooltip>
198 <v-tooltip top> 198 <v-tooltip top>
199 <img 199 <img
200 slot="activator" 200 slot="activator"
201 style="cursor:pointer; width:20px; height:18px; " 201 style="cursor:pointer; width:20px; height:18px; "
202 class="mr-3" 202 class="mr-3"
203 @click="paymentItem(props.item)" 203 @click="paymentItem(props.item)"
204 src="/static/schoolIcons/Account.png" 204 src="/static/schoolIcons/Account.png"
205 /> 205 />
206 <span>Payment</span> 206 <span>Payment</span>
207 </v-tooltip> 207 </v-tooltip>
208 </span> 208 </span>
209 <span v-if="props.item.paymentStatus === 'PARTIALLY_PAID'"> 209 <span v-if="props.item.paymentStatus === 'PARTIALLY_PAID'">
210 <v-tooltip top> 210 <v-tooltip top>
211 <img 211 <img
212 slot="activator" 212 slot="activator"
213 style="cursor:pointer; width:20px; height:18px; " 213 style="cursor:pointer; width:20px; height:18px; "
214 class="mr-3" 214 class="mr-3"
215 @click="paymentItem(props.item)" 215 @click="paymentItem(props.item)"
216 src="/static/schoolIcons/Account.png" 216 src="/static/schoolIcons/Account.png"
217 /> 217 />
218 <span>Payment</span> 218 <span>Payment</span>
219 </v-tooltip> 219 </v-tooltip>
220 </span> 220 </span>
221 <v-tooltip top> 221 <v-tooltip top>
222 <img 222 <img
223 slot="activator" 223 slot="activator"
224 style="cursor:pointer; width:19px; height:19px;" 224 style="cursor:pointer; width:19px; height:19px;"
225 class="mr-3" 225 class="mr-3"
226 @click="profile(props.item)" 226 @click="profile(props.item)"
227 src="/static/icon/eye1.png" 227 src="/static/icon/eye1.png"
228 /> 228 />
229 <span>View Payment</span> 229 <span>View Payment</span>
230 </v-tooltip> 230 </v-tooltip>
231 </td> 231 </td>
232 </tr> 232 </tr>
233 </template> 233 </template>
234 <v-alert 234 <v-alert
235 slot="no-results" 235 slot="no-results"
236 :value="true" 236 :value="true"
237 color="error" 237 color="error"
238 icon="warning" 238 icon="warning"
239 >Your search for "{{ search }}" found no results.</v-alert> 239 >Your search for "{{ search }}" found no results.</v-alert>
240 </v-data-table> 240 </v-data-table>
241 241
242 <!-- ****** ADD INVOICE ****** --> 242 <!-- ****** ADD INVOICE ****** -->
243 <v-snackbar 243 <v-snackbar
244 :timeout="timeout" 244 :timeout="timeout"
245 :top="y === 'top'" 245 :top="y === 'top'"
246 :right="x === 'right'" 246 :right="x === 'right'"
247 :vertical="mode === 'vertical'" 247 :vertical="mode === 'vertical'"
248 v-model="snackbar" 248 v-model="snackbar"
249 :color="color" 249 :color="color"
250 >{{ text }}</v-snackbar> 250 >{{ text }}</v-snackbar>
251 <v-dialog v-model="addInvoiceDialog"> 251 <v-dialog v-model="addInvoiceDialog">
252 <v-card flat class="text-xs-center white--text"> 252 <v-card flat class="text-xs-center white--text">
253 <v-layout> 253 <v-layout>
254 <v-flex xs12 class="card-styles pa-2"> 254 <v-flex xs12 class="card-styles pa-2">
255 <label class="title text-xs-center">Add Invoice</label> 255 <label class="title text-xs-center">Add Invoice</label>
256 <v-icon size="24" class="right white--text" @click="addInvoiceDialog = false">cancel</v-icon> 256 <v-icon size="24" class="right white--text" @click="addInvoiceDialog = false">cancel</v-icon>
257 </v-flex> 257 </v-flex>
258 </v-layout> 258 </v-layout>
259 <v-flex xs12 sm12> 259 <v-flex xs12 sm12>
260 <v-container fluid grid-list-md> 260 <v-container fluid grid-list-md>
261 <v-layout wrap> 261 <v-layout wrap>
262 <v-flex xs12 sm12 md5> 262 <v-flex xs12 sm12 md5>
263 <v-card flat> 263 <v-card flat>
264 <v-toolbar dark class="card-styles" flat> 264 <v-toolbar dark class="card-styles" flat>
265 <v-spacer></v-spacer> 265 <v-spacer></v-spacer>
266 <h3>Invoice</h3> 266 <h3>Invoice</h3>
267 <v-spacer></v-spacer> 267 <v-spacer></v-spacer>
268 </v-toolbar> 268 </v-toolbar>
269 <v-form ref="form" v-model="valid" lazy-validation class="py-4"> 269 <v-form ref="form" v-model="valid" lazy-validation class="py-4">
270 <v-layout> 270 <v-layout>
271 <v-flex xs4 class="pt-4 subheading"> 271 <v-flex xs4 class="pt-4 subheading">
272 <label class="right hidden-xs-only hidden-sm-only">Select Class:</label> 272 <label class="right hidden-xs-only hidden-sm-only">Select Class:</label>
273 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label> 273 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Class:</label>
274 </v-flex> 274 </v-flex>
275 <v-flex xs6 class="ml-3"> 275 <v-flex xs6 class="ml-3">
276 <v-select 276 <v-select
277 :items="addclass" 277 :items="addclass"
278 label="Select Class" 278 label="Select Class"
279 v-model="invoiceData.classNum" 279 v-model="invoiceData.classNum"
280 item-text="classNum" 280 item-text="classNum"
281 item-value="_id" 281 item-value="_id"
282 @change="getAllStudents()" 282 @change="getAllStudents()"
283 :rules="classRules" 283 :rules="classRules"
284 required 284 required
285 ></v-select> 285 ></v-select>
286 </v-flex> 286 </v-flex>
287 </v-layout> 287 </v-layout>
288 <v-layout> 288 <v-layout>
289 <v-flex xs4 class="pt-4 subheading"> 289 <v-flex xs4 class="pt-4 subheading">
290 <label class="right hidden-xs-only hidden-sm-only">Select Student:</label> 290 <label class="right hidden-xs-only hidden-sm-only">Select Student:</label>
291 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Student:</label> 291 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Student:</label>
292 </v-flex> 292 </v-flex>
293 <v-flex xs6 class="ml-3"> 293 <v-flex xs6 class="ml-3">
294 <v-select 294 <v-select
295 :items="studentList" 295 :items="studentList"
296 label="Select Student" 296 label="Select Student"
297 v-model="invoiceData.studentId" 297 v-model="invoiceData.studentId"
298 item-text="name" 298 item-text="name"
299 item-value="_id" 299 item-value="_id"
300 :rules="inchargeRules" 300 :rules="inchargeRules"
301 @change="selectAllStudent()" 301 @change="selectAllStudent()"
302 required 302 required
303 ></v-select> 303 ></v-select>
304 </v-flex> 304 </v-flex>
305 </v-layout> 305 </v-layout>
306 <v-layout> 306 <v-layout>
307 <v-flex xs4 class="pt-4 subheading"> 307 <v-flex xs4 class="pt-4 subheading">
308 <label class="right">Date:</label> 308 <label class="right">Date:</label>
309 </v-flex> 309 </v-flex>
310 <v-flex xs6 class="ml-3"> 310 <v-flex xs6 class="ml-3">
311 <v-menu 311 <v-menu
312 ref="menu1" 312 ref="menu1"
313 :close-on-content-click="false" 313 :close-on-content-click="false"
314 v-model="menu1" 314 v-model="menu1"
315 :nudge-right="40" 315 :nudge-right="40"
316 lazy 316 lazy
317 :return-value.sync="invoiceData.date" 317 :return-value.sync="invoiceData.date"
318 transition="scale-transition" 318 transition="scale-transition"
319 offset-y 319 offset-y
320 full-width 320 full-width
321 min-width="290px" 321 min-width="290px"
322 > 322 >
323 <v-text-field 323 <v-text-field
324 slot="activator" 324 slot="activator"
325 :rules="dateRules" 325 :rules="dateRules"
326 v-model="invoiceData.date" 326 v-model="invoiceData.date"
327 placeholder="Select date" 327 placeholder="Select date"
328 ></v-text-field> 328 ></v-text-field>
329 <v-date-picker 329 <v-date-picker
330 v-model="invoiceData.date" 330 v-model="invoiceData.date"
331 @input="$refs.menu1.save(invoiceData.date)" 331 @input="$refs.menu1.save(invoiceData.date)"
332 ></v-date-picker> 332 ></v-date-picker>
333 </v-menu> 333 </v-menu>
334 </v-flex> 334 </v-flex>
335 </v-layout> 335 </v-layout>
336 <v-layout> 336 <v-layout>
337 <v-flex xs4 class="pt-4 subheading"> 337 <v-flex xs4 class="pt-4 subheading">
338 <label class="right hidden-xs-only hidden-sm-only">Payment Status:</label> 338 <label class="right hidden-xs-only hidden-sm-only">Payment Status:</label>
339 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Payment:</label> 339 <label class="right hidden-lg-only hidden-md-only hidden-xl-only">Payment:</label>
340 </v-flex> 340 </v-flex>
341 <v-flex xs6 class="ml-3"> 341 <v-flex xs6 class="ml-3">
342 <v-select 342 <v-select
343 :items="paymentStatus" 343 :items="paymentStatus"
344 v-model="invoiceData.paymentStatus" 344 v-model="invoiceData.paymentStatus"
345 item-text="name" 345 item-text="name"
346 item-value="value" 346 item-value="value"
347 label="Select Payment Status" 347 label="Select Payment Status"
348 @change="getPayMethodList" 348 @change="getPayMethodList"
349 :rules="paymentStatusRules" 349 :rules="paymentStatusRules"
350 required 350 required
351 ></v-select> 351 ></v-select>
352 </v-flex> 352 </v-flex>
353 </v-layout> 353 </v-layout>
354 <v-layout v-show="showPayMethods"> 354 <v-layout v-show="showPayMethods">
355 <v-flex xs4 class="pt-4 subheading"> 355 <v-flex xs4 class="pt-4 subheading">
356 <label class="right">Payment Method:</label> 356 <label class="right">Payment Method:</label>
357 </v-flex> 357 </v-flex>
358 <v-flex xs6 class="ml-3"> 358 <v-flex xs6 class="ml-3">
359 <v-select 359 <v-select
360 :items="paymentMethods" 360 :items="paymentMethods"
361 v-model="invoiceData.paymentMethod" 361 v-model="invoiceData.paymentMethod"
362 :rules="paymentMethodRules"
362 label="Select Payment Method" 363 label="Select Payment Method"
363 required 364 required
364 ></v-select> 365 ></v-select>
365 </v-flex> 366 </v-flex>
366 </v-layout> 367 </v-layout>
367 <v-layout> 368 <v-layout>
368 <v-flex xs12 sm11> 369 <v-flex xs12 sm11>
369 <v-card-actions> 370 <v-card-actions>
370 <v-spacer></v-spacer> 371 <v-spacer></v-spacer>
371 <v-btn @click="clear" round dark class="clear-button">clear</v-btn> 372 <v-btn @click="clear" round dark class="clear-button">clear</v-btn>
372 <v-btn 373 <v-btn
373 @click="submit" 374 @click="submit"
374 round 375 round
375 dark 376 dark
376 :loading="loading" 377 :loading="loading"
377 class="add-button" 378 class="add-button"
378 >Add</v-btn> 379 >Add</v-btn>
379 </v-card-actions> 380 </v-card-actions>
380 </v-flex> 381 </v-flex>
381 </v-layout> 382 </v-layout>
382 </v-form> 383 </v-form>
383 </v-card> 384 </v-card>
384 </v-flex> 385 </v-flex>
385 <v-flex xs12 sm12 md7> 386 <v-flex xs12 sm12 md7>
386 <v-card> 387 <v-card>
387 <v-toolbar dark class="card-styles" flat> 388 <v-toolbar dark class="card-styles" flat>
388 <v-spacer></v-spacer> 389 <v-spacer></v-spacer>
389 <h3>Fee Type List</h3> 390 <h3>Fee Type List</h3>
390 <v-spacer></v-spacer> 391 <v-spacer></v-spacer>
391 </v-toolbar> 392 </v-toolbar>
392 <v-layout> 393 <v-layout>
393 <v-flex xs4 sm2 class="mt-4 hidden-xs-only hidden-sm-only"> 394 <v-flex xs4 sm2 class="mt-4 hidden-xs-only hidden-sm-only">
394 <label class="right title">Fee Type:</label> 395 <label class="right title">Fee Type:</label>
395 </v-flex> 396 </v-flex>
396 <v-flex xs8 sm4> 397 <v-flex xs8 sm4>
397 <v-select 398 <v-select
398 :items="feeTypes" 399 :items="feeTypes"
399 v-model="feeType.feeTypeName" 400 v-model="feeType.feeTypeName"
400 item-text="feeType" 401 item-text="feeType"
401 item-value="feeType" 402 item-value="feeType"
402 label="Select Fee Type" 403 label="Select Fee Type"
403 required 404 required
404 ></v-select> 405 ></v-select>
405 </v-flex> 406 </v-flex>
406 <v-flex xs4 sm6> 407 <v-flex xs4 sm6>
407 <v-btn 408 <v-btn
408 color="open-dialog-button" 409 color="open-dialog-button"
409 round 410 round
410 dark 411 dark
411 class="right mt-3" 412 class="right mt-3"
412 @click="selectFeeType" 413 @click="selectFeeType"
413 >ADD</v-btn> 414 >ADD</v-btn>
414 </v-flex> 415 </v-flex>
415 </v-layout> 416 </v-layout>
416 <table class="feeTypeTable tableRsponsive"> 417 <table class="feeTypeTable tableRsponsive">
417 <tr class="info white--text"> 418 <tr class="info white--text">
418 <th>#</th> 419 <th>#</th>
419 <th>Fee Type</th> 420 <th>Fee Type</th>
420 <th>Amount</th> 421 <th>Amount</th>
421 <th>Discount(%)</th> 422 <th>Discount(%)</th>
422 <th>Subtotal</th> 423 <th>Subtotal</th>
423 <th>Paid Amount</th> 424 <th>Paid Amount</th>
424 <th>Action</th> 425 <th>Action</th>
425 </tr> 426 </tr>
426 <tr 427 <tr
427 v-show="showFeeType" 428 v-show="showFeeType"
428 v-for="(feeType, index) in feeTypeData" 429 v-for="(feeType, index) in feeTypeData"
429 :key="index" 430 :key="index"
430 v-on:keyup="getAmmountDetails(feeType)" 431 v-on:keyup="getAmmountDetails(feeType)"
431 > 432 >
432 <td style="width:40px" class="tdFeeType">{{ index + 1 }}</td> 433 <td style="width:40px" class="tdFeeType">{{ index + 1 }}</td>
433 <td 434 <td
434 style="width:120px" 435 style="width:120px"
435 class="tdFeeType" 436 class="tdFeeType"
436 :rules="feeTypeNameRules" 437 :rules="feeTypeNameRules"
437 >{{ feeType.feeTypeName }}</td> 438 >{{ feeType.feeTypeName }}</td>
438 <td class="tdFeeType"> 439 <td class="tdFeeType">
439 <v-text-field 440 <v-text-field
440 placeholder="fill your Amount" 441 placeholder="fill your Amount"
441 v-model="feeType.amount" 442 v-model="feeType.amount"
442 type="number" 443 type="number"
443 :rules="amountRules" 444 :rules="amountRules"
444 required 445 required
445 ></v-text-field> 446 ></v-text-field>
446 </td> 447 </td>
447 <td class="tdFeeType"> 448 <td class="tdFeeType">
448 <v-text-field 449 <v-text-field
449 placeholder="fill your Discount" 450 placeholder="fill your Discount"
450 v-model="feeType.discount" 451 v-model="feeType.discount"
451 type="number" 452 type="number"
452 :rules="discountRules" 453 :rules="discountRules"
453 required 454 required
454 ></v-text-field> 455 ></v-text-field>
455 </td> 456 </td>
456 <td class="tdFeeType" :rules="subtotalRules">{{ feeType.subTotal }}</td> 457 <td class="tdFeeType" :rules="subtotalRules">{{ feeType.subTotal }}</td>
457 <td class="tdFeeType" v-if="invoiceData.paymentStatus === 'NOT_PAID'"> 458 <td class="tdFeeType" v-if="invoiceData.paymentStatus === 'NOT_PAID'">
458 <v-text-field 459 <v-text-field
459 placeholder="fill your Paid Amount" 460 placeholder="fill your Paid Amount"
460 v-model="feeType.paidAmount" 461 v-model="feeType.paidAmount"
461 type="number" 462 type="number"
462 :disabled="disabled" 463 :disabled="disabled"
463 ></v-text-field> 464 ></v-text-field>
464 </td> 465 </td>
465 <td class="tdFeeType" v-if="invoiceData.paymentStatus == ''"> 466 <td class="tdFeeType" v-if="invoiceData.paymentStatus == ''">
466 <v-text-field 467 <v-text-field
467 placeholder="fill your Paid Amount" 468 placeholder="fill your Paid Amount"
468 v-model="feeType.paidAmount" 469 v-model="feeType.paidAmount"
469 type="number" 470 type="number"
470 :disabled="disabled" 471 :disabled="disabled"
471 ></v-text-field> 472 ></v-text-field>
472 </td> 473 </td>
473 <td 474 <td
474 class="tdFeeType" 475 class="tdFeeType"
475 v-if="invoiceData.paymentStatus != 'NOT_PAID' && invoiceData.paymentStatus != ''" 476 v-if="invoiceData.paymentStatus != 'NOT_PAID' && invoiceData.paymentStatus != ''"
476 > 477 >
477 <v-text-field 478 <v-text-field
478 placeholder="fill your Paid Amount" 479 placeholder="fill your Paid Amount"
479 v-model="feeType.paidAmount" 480 v-model="feeType.paidAmount"
480 type="number" 481 type="number"
481 ></v-text-field> 482 ></v-text-field>
482 </td> 483 </td>
483 <td class="tdFeeType"> 484 <td class="tdFeeType">
484 <v-icon color="error" @click="deleteSelectFee(index)">delete</v-icon> 485 <v-icon color="error" @click="deleteSelectFee(index)">delete</v-icon>
485 </td> 486 </td>
486 </tr> 487 </tr>
487 <tfoot> 488 <tfoot>
488 <tr> 489 <tr>
489 <td colspan="2" class="tdFeeType">Total:</td> 490 <td colspan="2" class="tdFeeType">Total:</td>
490 <td class="tdFeeType">{{ feeType.amount }}</td> 491 <td class="tdFeeType">{{ feeType.amount }}</td>
491 <td class="tdFeeType">{{ feeType.discount }}</td> 492 <td class="tdFeeType">{{ feeType.discount }}</td>
492 <td class="tdFeeType">{{ feeType.subTotal }}</td> 493 <td class="tdFeeType">{{ feeType.subTotal }}</td>
493 <td class="tdFeeType">{{ feeType.paidAmount }}</td> 494 <td class="tdFeeType">{{ feeType.paidAmount }}</td>
494 <td class="tdFeeType"> 495 <td class="tdFeeType">
495 <v-icon color="error" @click="deleteSelectFee(index)">delete</v-icon> 496 <v-icon color="error" @click="deleteSelectFee(index)">delete</v-icon>
496 </td> 497 </td>
497 </tr> 498 </tr>
498 </tfoot> 499 </tfoot>
499 </table> 500 </table>
500 </v-card> 501 </v-card>
501 </v-flex> 502 </v-flex>
502 </v-layout> 503 </v-layout>
503 </v-container> 504 </v-container>
504 </v-flex> 505 </v-flex>
505 </v-card> 506 </v-card>
506 </v-dialog> 507 </v-dialog>
507 <div class="loader" v-if="showLoader"> 508 <div class="loader" v-if="showLoader">
508 <v-progress-circular indeterminate color="white"></v-progress-circular> 509 <v-progress-circular indeterminate color="white"></v-progress-circular>
509 </div> 510 </div>
510 </v-container> 511 </v-container>
511 </template> 512 </template>
512 513
513 <script> 514 <script>
514 import http from "@/Services/http.js"; 515 import http from "@/Services/http.js";
515 import editInvoice from "./editInvoice"; 516 import editInvoice from "./editInvoice";
516 import paymentTemplate from "./paymentTemplate.vue"; 517 import paymentTemplate from "./paymentTemplate.vue";
517 import moment from "moment"; 518 import moment from "moment";
518 519
519 export default { 520 export default {
520 components: { 521 components: {
521 editInvoice: editInvoice, 522 editInvoice: editInvoice,
522 paymentTemplate: paymentTemplate 523 paymentTemplate: paymentTemplate
523 }, 524 },
524 data: () => ({ 525 data: () => ({
525 snackbar: false, 526 snackbar: false,
526 showPayMethods: false, 527 showPayMethods: false,
527 y: "top", 528 y: "top",
528 x: "right", 529 x: "right",
529 mode: "", 530 mode: "",
530 timeout: 5000, 531 timeout: 5000,
531 text: "", 532 text: "",
532 color: "", 533 color: "",
533 show: true, 534 show: true,
534 showSearch: false, 535 showSearch: false,
535 showLoader: false, 536 showLoader: false,
536 loading: false, 537 loading: false,
537 date: null, 538 date: null,
538 search: "", 539 search: "",
539 dialog: false, 540 dialog: false,
540 dialog1: false, 541 dialog1: false,
541 valid: true, 542 valid: true,
542 validEdit: true, 543 validEdit: true,
543 isActive: true, 544 isActive: true,
544 newActive: false, 545 newActive: false,
545 showFeeType: true, 546 showFeeType: true,
546 addInvoiceDialog: false, 547 addInvoiceDialog: false,
547 editInvoiceDialog: false, 548 editInvoiceDialog: false,
548 paymentInvoiceDialog: false, 549 paymentInvoiceDialog: false,
549 disabled: true, 550 disabled: true,
550 details: [], 551 details: [],
551 feeTypes: [], 552 feeTypes: [],
552 invoiceData: [], 553 invoiceData: [],
553 editData: [], 554 editData: [],
554 invoiceList: [], 555 invoiceList: [],
555 editPayment: { 556 editPayment: {
556 studentId: { 557 studentId: {
557 name: "", 558 name: "",
558 rollNo: "" 559 rollNo: ""
559 }, 560 },
560 classId: { 561 classId: {
561 classNum: "" 562 classNum: ""
562 } 563 }
563 }, 564 },
564 menu1: false, 565 menu1: false,
565 paymentMethods: ["Cash", "Cheque"], 566 paymentMethods: ["Cash", "Cheque"],
566 feeType: { 567 feeType: {
567 amount: "0.00", 568 amount: "0.00",
568 discount: "0.00", 569 discount: "0.00",
569 subTotal: "0.00", 570 subTotal: "0.00",
570 paidAmount: "0.00", 571 paidAmount: "0.00",
571 feeTypeName: "" 572 feeTypeName: ""
572 }, 573 },
573 574
574 feeTypeData: [], 575 feeTypeData: [],
575 editFeeTypeData: [], 576 editFeeTypeData: [],
576 paymentFeeTypeData: [], 577 paymentFeeTypeData: [],
577 pagination: { 578 pagination: {
578 rowsPerPage: 10 579 rowsPerPage: 10
579 }, 580 },
580 classRules: [v => !!v || " Class Name is required"], 581 classRules: [v => !!v || " Class Name is required"],
581 inchargeRules: [v => !!v || "Student Name is required"], 582 inchargeRules: [v => !!v || "Student Name is required"],
582 dateRules: [v => !!v || " Date is required"], 583 dateRules: [v => !!v || " Date is required"],
583 paymentStatusRules: [v => !!v || "Payment Status is required"], 584 paymentStatusRules: [v => !!v || "Payment Status is required"],
584 paymentMethodsRules: [v => !!v || "payment Method is required"], 585 paymentMethodsRules: [v => !!v || "payment Method is required"],
585 feeTypeRules: [v => !!v || "Fee Type is required"], 586 feeTypeRules: [v => !!v || "Fee Type is required"],
586 feeTypeNameRules: [v => !!v || "Fee Type Name is required"], 587 feeTypeNameRules: [v => !!v || "Fee Type Name is required"],
587 amountRules: [v => !!v || "Amount is required"], 588 amountRules: [v => !!v || "Amount is required"],
588 discountRules: [v => !!v || "Discount is required"], 589 discountRules: [v => !!v || "Discount is required"],
589 subtotalRules: [v => !!v || "Subtotal is required"], 590 subtotalRules: [v => !!v || "Subtotal is required"],
590 paymentRules: [v => !!v || "Payment is required"], 591 paymentRules: [v => !!v || "Payment is required"],
591 paidAmountRules: [v => !!v || "Paid Amount is required"], 592 paidAmountRules: [v => !!v || "Paid Amount is required"],
593 paymentMethodRules: [],
592 headers: [ 594 headers: [
593 { 595 {
594 text: "No", 596 text: "No",
595 align: "", 597 align: "",
596 sortable: false, 598 sortable: false,
597 value: "No" 599 value: "No"
598 }, 600 },
599 { 601 {
600 text: "Student", 602 text: "Student",
601 value: "name", 603 value: "name",
602 sortable: false, 604 sortable: false,
603 align: "center" 605 align: "center"
604 }, 606 },
605 { text: "Class", value: "class", sortable: false, align: "center" }, 607 { text: "Class", value: "class", sortable: false, align: "center" },
606 { text: "Total", value: "subtotal", sortable: false, align: "center" }, 608 { text: "Total", value: "subtotal", sortable: false, align: "center" },
607 { 609 {
608 text: "Discount(%)", 610 text: "Discount(%)",
609 value: "discount", 611 value: "discount",
610 sortable: false, 612 sortable: false,
611 align: "center" 613 align: "center"
612 }, 614 },
613 { 615 {
614 text: "Paid Amount", 616 text: "Paid Amount",
615 value: "paidAmount", 617 value: "paidAmount",
616 sortable: false, 618 sortable: false,
617 align: "center" 619 align: "center"
618 }, 620 },
619 { 621 {
620 text: "Balance", 622 text: "Balance",
621 value: "Balance", 623 value: "Balance",
622 sortable: false, 624 sortable: false,
623 align: "center" 625 align: "center"
624 }, 626 },
625 { 627 {
626 text: "Status", 628 text: "Status",
627 value: "paymentStatus", 629 value: "paymentStatus",
628 sortable: false, 630 sortable: false,
629 align: "center" 631 align: "center"
630 }, 632 },
631 { 633 {
632 text: "Date", 634 text: "Date",
633 value: "date", 635 value: "date",
634 sortable: false, 636 sortable: false,
635 align: "center" 637 align: "center"
636 }, 638 },
637 { text: "Action", value: "", sortable: false, align: "center" } 639 { text: "Action", value: "", sortable: false, align: "center" }
638 ], 640 ],
639 641
640 studentId: { 642 studentId: {
641 name: "" 643 name: ""
642 }, 644 },
643 token: "", 645 token: "",
644 editedItem: {}, 646 editedItem: {},
645 invoiceData: { 647 invoiceData: {
646 paymentStatus: "", 648 paymentStatus: "",
647 students: [] 649 students: []
648 }, 650 },
649 addclass: [], 651 addclass: [],
650 studentList: [], 652 studentList: [],
651 paymentStatus: [ 653 paymentStatus: [
652 { 654 {
653 name: "Not Paid", 655 name: "Not Paid",
654 value: "NOT_PAID" 656 value: "NOT_PAID"
655 }, 657 },
656 { 658 {
657 name: "Partially Paid", 659 name: "Partially Paid",
658 value: "PARTIALLY_PAID" 660 value: "PARTIALLY_PAID"
659 }, 661 },
660 { 662 {
661 name: "Fully Paid", 663 name: "Fully Paid",
662 value: "FULLY_PAID" 664 value: "FULLY_PAID"
663 } 665 }
664 ] 666 ]
665 }), 667 }),
666 methods: { 668 methods: {
667 save(date) { 669 save(date) {
668 this.$refs.menu1.save(date); 670 this.$refs.menu1.save(date);
669 }, 671 },
670 dates: function(date) { 672 dates: function(date) {
671 return moment(date).format("MMMM DD, YYYY"); 673 return moment(date).format("MMMM DD, YYYY");
672 }, 674 },
673 profile(item) { 675 profile(item) {
674 // console.log("item", item); 676 // console.log("item", item);
675 this.editedIndex = this.invoiceList.indexOf(item); 677 this.editedIndex = this.invoiceList.indexOf(item);
676 this.editedItem = Object.assign({}, item); 678 this.editedItem = Object.assign({}, item);
677 console.log("editedItem", this.editedItem); 679 console.log("editedItem", this.editedItem);
678 this.dialog1 = true; 680 this.dialog1 = true;
679 }, 681 },
680 editItem(item) { 682 editItem(item) {
681 this.editedIndex = this.invoiceList.indexOf(item); 683 this.editedIndex = this.invoiceList.indexOf(item);
682 this.editData = Object.assign({}, item); 684 this.editData = Object.assign({}, item);
683 this.editData.date = this.editData.date.slice(0, 10); 685 this.editData.date = this.editData.date.slice(0, 10);
684 // console.log("invoiceData", this.editData); 686 // console.log("invoiceData", this.editData);
685 this.editFeeTypeData = this.editData.feeType; 687 this.editFeeTypeData = this.editData.feeType;
686 this.editInvoiceDialog = true; 688 this.editInvoiceDialog = true;
687 }, 689 },
688 paymentItem(item) { 690 paymentItem(item) {
689 // console.log("item", item); 691 // console.log("item", item);
690 this.editedIndex = this.invoiceList.indexOf(item); 692 this.editedIndex = this.invoiceList.indexOf(item);
691 this.editPayment = Object.assign({}, item); 693 this.editPayment = Object.assign({}, item);
692 this.editPayment.date = this.editPayment.date.slice(0, 10); 694 this.editPayment.date = this.editPayment.date.slice(0, 10);
693 if (this.editPayment.paymentStatus == "NOT_PAID") { 695 if (this.editPayment.paymentStatus == "NOT_PAID") {
694 for (let i = 0; i < this.editPayment.feeType.length; i++) { 696 for (let i = 0; i < this.editPayment.feeType.length; i++) {
695 this.editPayment.feeType[i].paidAmount = "0.00"; 697 this.editPayment.feeType[i].paidAmount = "0.00";
696 } 698 }
697 } 699 }
698 // console.log("this.editPayment", this.editPayment); 700 // console.log("this.editPayment", this.editPayment);
699 this.paymentFeeTypeData = this.editPayment.feeType; 701 this.paymentFeeTypeData = this.editPayment.feeType;
700 this.paymentInvoiceDialog = true; 702 this.paymentInvoiceDialog = true;
701 }, 703 },
702 deleteItem(item) { 704 deleteItem(item) {
703 let deleteInvoice = { 705 let deleteInvoice = {
704 invoiceId: item._id 706 invoiceId: item._id
705 }; 707 };
706 http() 708 http()
707 .delete( 709 .delete(
708 "/deleteInvoice", 710 "/deleteInvoice",
709 confirm("Are you sure you want to delete this?") && { 711 confirm("Are you sure you want to delete this?") && {
710 params: deleteInvoice 712 params: deleteInvoice
711 } 713 }
712 ) 714 )
713 .then(response => { 715 .then(response => {
714 this.snackbar = true; 716 this.snackbar = true;
715 this.text = "Successfully delete Existing Invoice"; 717 this.text = "Successfully delete Existing Invoice";
716 this.color = "green"; 718 this.color = "green";
717 this.dialog1 = false; 719 this.dialog1 = false;
718 this.getInvoiceList(); 720 this.getInvoiceList();
719 }) 721 })
720 .catch(error => { 722 .catch(error => {
721 // console.log(error); 723 // console.log(error);
722 }); 724 });
723 }, 725 },
724 deletePayment(editedItem) { 726 deletePayment(editedItem) {
725 let deleteInvoice = { 727 let deleteInvoice = {
726 invoiceId: editedItem._id 728 invoiceId: editedItem._id
727 }; 729 };
728 http() 730 http()
729 .put( 731 .put(
730 "/removePayment", 732 "/removePayment",
731 deleteInvoice, 733 deleteInvoice,
732 confirm("Are you sure you want to delete this?") && { 734 confirm("Are you sure you want to delete this?") && {
733 headers: { 735 headers: {
734 Authorization: "Bearer " + this.token 736 Authorization: "Bearer " + this.token
735 } 737 }
736 } 738 }
737 ) 739 )
738 .then(response => { 740 .then(response => {
739 this.snackbar = true; 741 this.snackbar = true;
740 this.text = "Successfully delete Existing Invoice"; 742 this.text = "Successfully delete Existing Invoice";
741 this.color = "green"; 743 this.color = "green";
742 this.dialog1 = false; 744 this.dialog1 = false;
743 this.getInvoiceList(); 745 this.getInvoiceList();
744 }) 746 })
745 .catch(error => { 747 .catch(error => {
746 // console.log(error); 748 // console.log(error);
747 }); 749 });
748 }, 750 },
749 close() { 751 close() {
750 this.dialog = false; 752 this.dialog = false;
751 }, 753 },
752 // totalAmount() { 754 // totalAmount() {
753 // // console.log("this.feeType.paidAmount ", this.feeType.paidAmount); 755 // // console.log("this.feeType.paidAmount ", this.feeType.paidAmount);
754 // // console.log( 756 // // console.log(
755 // // "this.feeType.subTotalAAAAAAAAAAAAAAA ", 757 // // "this.feeType.subTotalAAAAAAAAAAAAAAA ",
756 // // this.feeType.subTotal 758 // // this.feeType.subTotal
757 // // ); 759 // // );
758 760
759 // if (this.feeType.paidAmount < this.feeType.subTotal) { 761 // if (this.feeType.paidAmount < this.feeType.subTotal) {
760 // console.log("this.feeType.subTotalBBBBBBBBBBB ", this.feeType.subTotal); 762 // console.log("this.feeType.subTotalBBBBBBBBBBB ", this.feeType.subTotal);
761 763
762 // this.feeType.paidAmount = this.feeType.subTotal; 764 // this.feeType.paidAmount = this.feeType.subTotal;
763 // console.log( 765 // console.log(
764 // "this.feeType.paidAmount BBBBBBBBBBB", 766 // "this.feeType.paidAmount BBBBBBBBBBB",
765 // this.feeType.paidAmount 767 // this.feeType.paidAmount
766 // ); 768 // );
767 // } 769 // }
768 // }, 770 // },
769 submit() { 771 submit() {
770 let feeTypeId = ""; 772 let feeTypeId = "";
771 for (let i = 0; i < this.feeTypes.length; i++) { 773 for (let i = 0; i < this.feeTypes.length; i++) {
772 if (this.feeTypes[i].feeType === this.feeType.feeTypeName) { 774 if (this.feeTypes[i].feeType === this.feeType.feeTypeName) {
773 feeTypeId = this.feeTypes[i]._id; 775 feeTypeId = this.feeTypes[i]._id;
774 } 776 }
775 } 777 }
776 if (this.$refs.form.validate()) { 778 if (this.$refs.form.validate()) {
777 let invoiceData = { 779 let invoiceData = {
778 classId: this.invoiceData.classNum, 780 classId: this.invoiceData.classNum,
779 students: this.invoiceData.students, 781 students: this.invoiceData.students,
780 date: this.invoiceData.date, 782 date: this.invoiceData.date,
781 paymentStatus: this.invoiceData.paymentStatus, 783 paymentStatus: this.invoiceData.paymentStatus,
782 paymentMethod: this.invoiceData.paymentMethod, 784 paymentMethod: this.invoiceData.paymentMethod,
783 feeType: this.feeTypeData, 785 feeType: this.feeTypeData,
784 totalAmount: this.feeType.amount.toString(), 786 totalAmount: this.feeType.amount.toString(),
785 totalDiscount: this.feeType.discount.toString(), 787 totalDiscount: this.feeType.discount.toString(),
786 totalSubTotal: this.feeType.subTotal, 788 totalSubTotal: this.feeType.subTotal,
787 totalPaidAmount: this.feeType.paidAmount 789 totalPaidAmount: this.feeType.paidAmount
788 }; 790 };
789 // console.log("invoiceData", invoiceData); 791 // console.log("invoiceData", invoiceData);
790 if (this.feeType.paidAmount != "0.00") { 792 if (this.feeType.paidAmount != "0.00") {
791 if (this.feeType.subTotal == this.feeType.paidAmount) { 793 if (this.feeType.subTotal == this.feeType.paidAmount) {
792 invoiceData.paymentStatus = "FULLY_PAID"; 794 invoiceData.paymentStatus = "FULLY_PAID";
793 console.log("FULLY_PAID"); 795 console.log("FULLY_PAID");
794 } 796 }
795 if (invoiceData.totalPaidAmount) { 797 if (invoiceData.totalPaidAmount) {
796 if (this.feeType.subTotal != this.feeType.paidAmount) { 798 if (this.feeType.subTotal != this.feeType.paidAmount) {
797 invoiceData.paymentStatus = "PARTIALLY_PAID"; 799 invoiceData.paymentStatus = "PARTIALLY_PAID";
798 console.log("PARTIALLY_PAID"); 800 console.log("PARTIALLY_PAID");
799 } 801 }
800 } 802 }
801 } else if (this.feeType.paidAmount === "0.00") { 803 } else if (this.feeType.paidAmount === "0.00") {
802 invoiceData.paymentStatus = "NOT_PAID"; 804 invoiceData.paymentStatus = "NOT_PAID";
803 } 805 }
804 http() 806 http()
805 .post("/createInvoice", invoiceData) 807 .post("/createInvoice", invoiceData)
806 .then(response => { 808 .then(response => {
807 this.getInvoiceList(); 809 this.getInvoiceList();
808 this.snackbar = true; 810 this.snackbar = true;
809 this.text = "New Invoice added successfully"; 811 this.text = "New Invoice added successfully";
810 this.color = "green"; 812 this.color = "green";
811 this.clear(); 813 this.clear();
812 this.feeTypeData = []; 814 this.feeTypeData = [];
813 if (this.feeTypeData.length == 0) { 815 if (this.feeTypeData.length == 0) {
814 this.feeType = { 816 this.feeType = {
815 amount: "0.00", 817 amount: "0.00",
816 discount: "0.00", 818 discount: "0.00",
817 paidAmount: "0.00", 819 paidAmount: "0.00",
818 subTotal: "0.00", 820 subTotal: "0.00",
819 feeTypeList: "" 821 feeTypeList: ""
820 }; 822 };
821 } 823 }
822 this.loading = false; 824 this.loading = false;
823 this.addInvoiceDialog = false; 825 this.addInvoiceDialog = false;
824 }) 826 })
825 .catch(error => { 827 .catch(error => {
826 this.snackbar = true; 828 this.snackbar = true;
827 this.text = error.response.data.errors[0].messages[0]; 829 this.text = error.response.data.errors[0].messages[0];
828 this.color = "error"; 830 this.color = "error";
829 this.loading = false; 831 this.loading = false;
830 }); 832 });
831 } 833 }
832 }, 834 },
833 clear() { 835 clear() {
834 this.$refs.form.reset(); 836 this.$refs.form.reset();
835 }, 837 },
836 getInvoiceList() { 838 getInvoiceList() {
837 this.showLoader = true; 839 this.showLoader = true;
838 http() 840 http()
839 .get("/getInvoicesList", { 841 .get("/getInvoicesList", {
840 params: { schoolId: this.$store.state.schoolId }, 842 params: { schoolId: this.$store.state.schoolId },
841 headers: { Authorization: "Bearer " + this.token } 843 headers: { Authorization: "Bearer " + this.token }
842 }) 844 })
843 .then(response => { 845 .then(response => {
844 this.invoiceList = response.data.data; 846 this.invoiceList = response.data.data;
845 this.showLoader = false; 847 this.showLoader = false;
846 }) 848 })
847 .catch(error => { 849 .catch(error => {
848 // console.log("err====>", err); 850 // console.log("err====>", err);
849 this.showLoader = false; 851 this.showLoader = false;
850 if (error.response.status === 401) { 852 if (error.response.status === 401) {
851 this.$router.replace({ path: "/" }); 853 this.$router.replace({ path: "/" });
852 this.$store.dispatch("setToken", null); 854 this.$store.dispatch("setToken", null);
853 this.$store.dispatch("Id", null); 855 this.$store.dispatch("Id", null);
854 } 856 }
855 }); 857 });
856 }, 858 },
857 selectFeeType() { 859 selectFeeType() {
858 this.showFeeType = true; 860 this.showFeeType = true;
859 this.feeTypeData.push({ feeTypeName: this.feeType.feeTypeName }); 861 this.feeTypeData.push({ feeTypeName: this.feeType.feeTypeName });
860 }, 862 },
861 deleteSelectFee: function(index) { 863 deleteSelectFee: function(index) {
862 console.log("---index----", index); 864 console.log("---index----", index);
863 this.feeTypeData.splice(index, 1); 865 this.feeTypeData.splice(index, 1);
864 for (let i = 0; i < this.feeTypeData.length; i++) { 866 for (let i = 0; i < this.feeTypeData.length; i++) {
865 console.log("this.feeTypeData[i]", this.feeTypeData[i]); 867 console.log("this.feeTypeData[i]", this.feeTypeData[i]);
866 if (this.feeTypeData[i].paidAmount) { 868 if (this.feeTypeData[i].paidAmount) {
867 this.feeType = { 869 this.feeType = {
868 amount: this.feeTypeData[i].amount, 870 amount: this.feeTypeData[i].amount,
869 discount: this.feeTypeData[i].discount, 871 discount: this.feeTypeData[i].discount,
870 subTotal: this.feeTypeData[i].subTotal, 872 subTotal: this.feeTypeData[i].subTotal,
871 paidAmount: this.feeTypeData[i].paidAmount 873 paidAmount: this.feeTypeData[i].paidAmount
872 }; 874 };
873 } else { 875 } else {
874 this.feeType = { 876 this.feeType = {
875 amount: this.feeTypeData[i].amount, 877 amount: this.feeTypeData[i].amount,
876 discount: this.feeTypeData[i].discount, 878 discount: this.feeTypeData[i].discount,
877 subTotal: this.feeTypeData[i].subTotal, 879 subTotal: this.feeTypeData[i].subTotal,
878 paidAmount: "0.00" 880 paidAmount: "0.00"
879 }; 881 };
880 } 882 }
881 } 883 }
882 if (this.feeTypeData.length == 0) { 884 if (this.feeTypeData.length == 0) {
883 this.feeType = { 885 this.feeType = {
884 amount: "0.00", 886 amount: "0.00",
885 discount: "0.00", 887 discount: "0.00",
886 paidAmount: "0.00", 888 paidAmount: "0.00",
887 subTotal: "0.00", 889 subTotal: "0.00",
888 feeTypeName: "" 890 feeTypeName: ""
889 }; 891 };
890 } 892 }
891 }, 893 },
892 getAllClasses() { 894 getAllClasses() {
893 http() 895 http()
894 .get("/getClassesList", { 896 .get("/getClassesList", {
895 params: { schoolId: this.$store.state.schoolId }, 897 params: { schoolId: this.$store.state.schoolId },
896 headers: { Authorization: "Bearer " + this.token } 898 headers: { Authorization: "Bearer " + this.token }
897 }) 899 })
898 .then(response => { 900 .then(response => {
899 this.addclass = response.data.data; 901 this.addclass = response.data.data;
900 }) 902 })
901 .catch(err => { 903 .catch(err => {
902 // console.log("err====>", err); 904 // console.log("err====>", err);
903 // this.$router.replace({ path: "/" }); 905 // this.$router.replace({ path: "/" });
904 }); 906 });
905 }, 907 },
906 getAllStudents() { 908 getAllStudents() {
907 this.showLoader = true; 909 this.showLoader = true;
908 http() 910 http()
909 .get("/getStudentsList", { 911 .get("/getStudentsList", {
910 params: { 912 params: {
911 classId: this.invoiceData.classNum, 913 classId: this.invoiceData.classNum,
912 schoolId: this.$store.state.schoolId 914 schoolId: this.$store.state.schoolId
913 }, 915 },
914 headers: { Authorization: "Bearer " + this.token } 916 headers: { Authorization: "Bearer " + this.token }
915 }) 917 })
916 .then(response => { 918 .then(response => {
917 response.data.data.unshift({ 919 response.data.data.unshift({
918 name: "Select All", 920 name: "Select All",
919 _id: "Select All" 921 _id: "Select All"
920 }); 922 });
921 this.studentList = response.data.data; 923 this.studentList = response.data.data;
922 this.showLoader = false; 924 this.showLoader = false;
923 }) 925 })
924 .catch(err => { 926 .catch(err => {
925 this.showLoader = false; 927 this.showLoader = false;
926 // console.log("err====>", err); 928 // console.log("err====>", err);
927 // this.$router.replace({ path: "/" }); 929 // this.$router.replace({ path: "/" });
928 }); 930 });
929 }, 931 },
930 getfeeType() { 932 getfeeType() {
931 http() 933 http()
932 .get("/getFeesList", { 934 .get("/getFeesList", {
933 params: { 935 params: {
934 schoolId: this.$store.state.schoolId 936 schoolId: this.$store.state.schoolId
935 }, 937 },
936 headers: { Authorization: "Bearer " + this.token } 938 headers: { Authorization: "Bearer " + this.token }
937 }) 939 })
938 .then(response => { 940 .then(response => {
939 this.feeTypes = response.data.data; 941 this.feeTypes = response.data.data;
940 }) 942 })
941 .catch(err => { 943 .catch(err => {
942 // console.log("err====>", err); 944 // console.log("err====>", err);
943 // this.$router.replace({ path: "/" }); 945 // this.$router.replace({ path: "/" });
944 }); 946 });
945 }, 947 },
946 948
947 getAmmountDetails(feeTyp) { 949 getAmmountDetails(feeTyp) {
948 let feeType = { 950 let feeType = {
949 amount: "0.00", 951 amount: "0.00",
950 discount: "0.00", 952 discount: "0.00",
951 subTotal: "0.00", 953 subTotal: "0.00",
952 subParticularTotal: "0.00", 954 subParticularTotal: "0.00",
953 paidAmount: "" 955 paidAmount: ""
954 }; 956 };
955 for (let i = 0; i < this.feeTypeData.length; i++) { 957 for (let i = 0; i < this.feeTypeData.length; i++) {
956 // *********** AMOUNT *********** 958 // *********** AMOUNT ***********
957 if (this.feeTypeData[i].amount) { 959 if (this.feeTypeData[i].amount) {
958 feeType.amount = 960 feeType.amount =
959 Number(feeType.amount) + Number(this.feeTypeData[i].amount); 961 Number(feeType.amount) + Number(this.feeTypeData[i].amount);
960 this.feeType.amount = feeType.amount; 962 this.feeType.amount = feeType.amount;
961 this.feeType.subTotal = feeType.amount; 963 this.feeType.subTotal = feeType.amount;
962 this.feeTypeData[i].subTotal = this.feeTypeData[i].amount; 964 this.feeTypeData[i].subTotal = this.feeTypeData[i].amount;
963 } else if (this.feeTypeData[0].amount == "") { 965 } else if (this.feeTypeData[0].amount == "") {
964 this.feeType.amount = "0.00"; 966 this.feeType.amount = "0.00";
965 this.feeTypeData[i].subTotal = "0.00"; 967 this.feeTypeData[i].subTotal = "0.00";
966 this.feeType.subTotal = "0.00"; 968 this.feeType.subTotal = "0.00";
967 } else if (this.feeTypeData[i].amount == "") { 969 } else if (this.feeTypeData[i].amount == "") {
968 this.feeType.amount = 970 this.feeType.amount =
969 Number(feeType.amount) + Number(this.feeTypeData[i].amount); 971 Number(feeType.amount) + Number(this.feeTypeData[i].amount);
970 this.feeTypeData[i].subTotal = 972 this.feeTypeData[i].subTotal =
971 Number(feeType.amount) + Number(this.feeTypeData[i].amount); 973 Number(feeType.amount) + Number(this.feeTypeData[i].amount);
972 this.feeType.subTotal = 974 this.feeType.subTotal =
973 Number(feeType.amount) + Number(this.feeTypeData[i].amount); 975 Number(feeType.amount) + Number(this.feeTypeData[i].amount);
974 } 976 }
975 // *********** DISCOUNT *********** 977 // *********** DISCOUNT ***********
976 if (this.feeTypeData[i].discount) { 978 if (this.feeTypeData[i].discount) {
977 feeType.discount = 979 feeType.discount =
978 Number(feeType.discount) + Number(this.feeTypeData[i].discount); 980 Number(feeType.discount) + Number(this.feeTypeData[i].discount);
979 this.feeType.discount = feeType.discount; 981 this.feeType.discount = feeType.discount;
980 feeType.subParticularTotal = 982 feeType.subParticularTotal =
981 this.feeTypeData[i].amount - 983 this.feeTypeData[i].amount -
982 (this.feeTypeData[i].amount * this.feeTypeData[i].discount) / 100; 984 (this.feeTypeData[i].amount * this.feeTypeData[i].discount) / 100;
983 this.feeTypeData[i].subTotal = feeType.subParticularTotal.toFixed(2); 985 this.feeTypeData[i].subTotal = feeType.subParticularTotal.toFixed(2);
984 } else if (this.feeTypeData[0].discount == "") { 986 } else if (this.feeTypeData[0].discount == "") {
985 this.feeType.discount = "0.00"; 987 this.feeType.discount = "0.00";
986 } else if (this.feeTypeData[i].discount == "") { 988 } else if (this.feeTypeData[i].discount == "") {
987 this.feeType.discount = 989 this.feeType.discount =
988 Number(feeType.discount) + Number(this.feeTypeData[i].discount); 990 Number(feeType.discount) + Number(this.feeTypeData[i].discount);
989 } 991 }
990 992
991 // *********** SUBTOTAL *********** 993 // *********** SUBTOTAL ***********
992 if (this.feeTypeData[i].subTotal) { 994 if (this.feeTypeData[i].subTotal) {
993 feeType.subTotal = 995 feeType.subTotal =
994 Number(feeType.subTotal) + Number(this.feeTypeData[i].subTotal); 996 Number(feeType.subTotal) + Number(this.feeTypeData[i].subTotal);
995 this.feeType.subTotal = feeType.subTotal.toFixed(2); 997 this.feeType.subTotal = feeType.subTotal.toFixed(2);
996 } 998 }
997 999
998 // *********** PAID-AMOUNT *********** 1000 // *********** PAID-AMOUNT ***********
999 if (this.feeTypeData[i].paidAmount) { 1001 if (this.feeTypeData[i].paidAmount) {
1000 feeType.paidAmount = 1002 feeType.paidAmount =
1001 Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount); 1003 Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount);
1002 this.feeType.paidAmount = feeType.paidAmount.toFixed(2); 1004 this.feeType.paidAmount = feeType.paidAmount.toFixed(2);
1003 } else if (this.feeTypeData[0].paidAmount == "") { 1005 } else if (this.feeTypeData[0].paidAmount == "") {
1004 this.feeType.paidAmount = "0.00"; 1006 this.feeType.paidAmount = "0.00";
1005 } else if (this.feeTypeData[i].paidAmount == "") { 1007 } else if (this.feeTypeData[i].paidAmount == "") {
1006 this.feeType.paidAmount = feeType.paidAmount = 1008 this.feeType.paidAmount = feeType.paidAmount =
1007 Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount); 1009 Number(feeType.paidAmount) + Number(this.feeTypeData[i].paidAmount);
1008 } 1010 }
1009 1011
1010 // if paid Amount fill large of subtotal value so this condition are fixed filled subtotal value. 1012 // if paid Amount fill large of subtotal value so this condition are fixed filled subtotal value.
1011 if (feeType.paidAmount > feeType.subTotal) { 1013 if (feeType.paidAmount > feeType.subTotal) {
1012 this.feeTypeData[i].paidAmount = this.feeTypeData[i].subTotal; 1014 this.feeTypeData[i].paidAmount = this.feeTypeData[i].subTotal;
1013 this.feeType.paidAmount = feeType.subTotal; 1015 this.feeType.paidAmount = feeType.subTotal;
1014 } 1016 }
1015 } 1017 }
1016 }, 1018 },
1017 getPayMethodList() { 1019 getPayMethodList() {
1018 if (this.invoiceData.paymentStatus == "PARTIALLY_PAID") { 1020 if (this.invoiceData.paymentStatus == "PARTIALLY_PAID") {
1019 this.showPayMethods = true; 1021 this.showPayMethods = true;
1022 this.paymentMethodRules = [v => !!v || "Payment Method is required"];
1020 } else if (this.invoiceData.paymentStatus == "FULLY_PAID") { 1023 } else if (this.invoiceData.paymentStatus == "FULLY_PAID") {
1021 this.showPayMethods = true; 1024 this.showPayMethods = true;
1025 this.paymentMethodRules = [v => !!v || "Payment Method is required"];
1022 } else if (this.invoiceData.paymentStatus == "NOT_PAID") { 1026 } else if (this.invoiceData.paymentStatus == "NOT_PAID") {
1023 for (let i = 0; i < this.feeTypeData.length; i++) { 1027 for (let i = 0; i < this.feeTypeData.length; i++) {
1024 this.feeTypeData[i].paidAmount = "0.00"; 1028 this.feeTypeData[i].paidAmount = "0.00";
1025 this.feeType.paidAmount = "0.00"; 1029 this.feeType.paidAmount = "0.00";
1026 } 1030 }
1031 this.paymentMethodRules = "";
1032 this.showPayMethods = false;
1027 } else { 1033 } else {
1028 this.showPayMethods = false; 1034 this.showPayMethods = false;
1029 } 1035 }
1030 }, 1036 },
1031 selectAllStudent() { 1037 selectAllStudent() {
1032 this.invoiceData.students = []; 1038 this.invoiceData.students = [];
1033 if (this.invoiceData.studentId === "Select All") { 1039 if (this.invoiceData.studentId === "Select All") {
1034 for (let i = 1; i < this.studentList.length; i++) { 1040 for (let i = 1; i < this.studentList.length; i++) {
1035 this.invoiceData.students.push(this.studentList[i]._id); 1041 this.invoiceData.students.push(this.studentList[i]._id);
1036 console.log("data", this.invoiceData.students); 1042 console.log("data", this.invoiceData.students);
1037 // data.push(this.studentList[i]._id); 1043 // data.push(this.studentList[i]._id);
1038 // console.log("data", data); 1044 // console.log("data", data);
1039 } 1045 }
1040 } else { 1046 } else {
1041 this.invoiceData.students.push(this.invoiceData.studentId); 1047 this.invoiceData.students.push(this.invoiceData.studentId);
1042 } 1048 }
1043 }, 1049 },
1044 displaySearch() { 1050 displaySearch() {
1045 this.show = false; 1051 this.show = false;
1046 this.showSearch = true; 1052 this.showSearch = true;
1047 }, 1053 },
1048 closeSearch() { 1054 closeSearch() {
1049 this.showSearch = false; 1055 this.showSearch = false;
1050 this.show = true; 1056 this.show = true;
1051 this.search = ""; 1057 this.search = "";
1052 }, 1058 },
1053 updateDoneInvoice() { 1059 updateDoneInvoice() {
1054 this.editInvoiceDialog = false; 1060 this.editInvoiceDialog = false;
1055 this.getInvoiceList(); 1061 this.getInvoiceList();
1056 }, 1062 },
1057 updatePayment() { 1063 updatePayment() {
1058 this.paymentInvoiceDialog = false; 1064 this.paymentInvoiceDialog = false;
1059 this.getInvoiceList(); 1065 this.getInvoiceList();
1060 this.snackbar = true; 1066 this.snackbar = true;
1061 this.text = "Payment added successfully"; 1067 this.text = "Payment added successfully";
1062 this.color = "green"; 1068 this.color = "green";
1063 } 1069 }
1064 }, 1070 },
1065 mounted() { 1071 mounted() {
1066 this.token = this.$store.state.token; 1072 this.token = this.$store.state.token;
1067 this.getInvoiceList(); 1073 this.getInvoiceList();
1068 this.getAllClasses(); 1074 this.getAllClasses();
1069 this.getfeeType(); 1075 this.getfeeType();
1070 this.getAllStudents(); 1076 this.getAllStudents();
1071 } 1077 }
1072 }; 1078 };
1073 </script> 1079 </script>
1074 1080
1075 1081
1076 <style scoped> 1082 <style scoped>
1077 table { 1083 table {
1078 border-collapse: collapse; 1084 border-collapse: collapse;
1079 border: 1px solid #e2e7eb; 1085 border: 1px solid #e2e7eb;
1080 } 1086 }
1081 1087
1082 th, 1088 th,
1083 .tdFeeType { 1089 .tdFeeType {
1084 border: 1px solid #e2e7eb; 1090 border: 1px solid #e2e7eb;
1085 padding: 10px; 1091 padding: 10px;
1086 text-align: center; 1092 text-align: center;
1087 } 1093 }
1088 table.feeTypeTable { 1094 table.feeTypeTable {
1089 table-layout: auto !important; 1095 table-layout: auto !important;
1090 width: 100% !important; 1096 width: 100% !important;
1091 } 1097 }
1092 </style> 1098 </style>
src/pages/Report/progressCardReport.vue
1 <template> 1 <template>
2 <v-container fluid class="body-color"> 2 <v-container fluid class="body-color">
3 <!-- ****** Progress Card Report Table****** --> 3 <!-- ****** Progress Card Report Table****** -->
4 <v-card flat class="elevation-0 transparent"> 4 <v-card flat class="elevation-0 transparent">
5 <v-form ref="form" v-model="valid" lazy-validation> 5 <v-form ref="form" v-model="valid" lazy-validation>
6 <v-flex xs12 sm12 lg12> 6 <v-flex xs12 sm12 lg12>
7 <v-layout wrap> 7 <v-layout wrap>
8 <v-flex xs12 sm12 lg3> 8 <v-flex xs12 sm12 lg3>
9 <v-layout> 9 <v-layout>
10 <v-flex xs3 sm6 lg2 class="subheading mt-4"> 10 <v-flex xs3 sm6 lg2 class="subheading mt-4">
11 <label class="right">Class:</label> 11 <label class="right">Class:</label>
12 </v-flex> 12 </v-flex>
13 <v-flex xs9 sm6 lg8 class="ml-2"> 13 <v-flex xs9 sm6 lg8 class="ml-2">
14 <v-select 14 <v-select
15 v-model="getReport.classId" 15 v-model="getReport.classId"
16 label="Select your class" 16 label="Select your class"
17 type="text" 17 type="text"
18 :items="classList" 18 :items="classList"
19 item-text="classNum" 19 item-text="classNum"
20 item-value="_id" 20 item-value="_id"
21 :rules="classRules" 21 :rules="classRules"
22 @change="getSections(getReport.classId)" 22 @change="getSections(getReport.classId)"
23 required 23 required
24 ></v-select> 24 ></v-select>
25 </v-flex> 25 </v-flex>
26 </v-layout> 26 </v-layout>
27 </v-flex> 27 </v-flex>
28 <v-flex xs12 sm12 lg3> 28 <v-flex xs12 sm12 lg3>
29 <v-layout> 29 <v-layout>
30 <v-flex xs3 sm6 lg2 class="subheading mt-4"> 30 <v-flex xs3 sm6 lg2 class="subheading mt-4">
31 <label class="right">Section:</label> 31 <label class="right">Section:</label>
32 </v-flex> 32 </v-flex>
33 <v-flex xs9 sm6 lg8 class="ml-2"> 33 <v-flex xs9 sm6 lg8 class="ml-2">
34 <v-select 34 <v-select
35 :items="addSection" 35 :items="addSection"
36 label="Select your Section" 36 label="Select your Section"
37 v-model="getReport.sectionId" 37 v-model="getReport.sectionId"
38 item-text="name" 38 item-text="name"
39 item-value="_id" 39 item-value="_id"
40 name="Select Section" 40 name="Select Section"
41 @change="getStudents" 41 @change="getStudents"
42 :rules="sectionRules" 42 :rules="sectionRules"
43 required 43 required
44 ></v-select> 44 ></v-select>
45 </v-flex> 45 </v-flex>
46 </v-layout> 46 </v-layout>
47 </v-flex> 47 </v-flex>
48 <v-flex xs12 sm12 lg3> 48 <v-flex xs12 sm12 lg3>
49 <v-layout> 49 <v-layout>
50 <v-flex xs3 sm6 lg2 class="subheading mt-4"> 50 <v-flex xs3 sm6 lg2 class="subheading mt-4">
51 <label class="right">Student:</label> 51 <label class="right">Student:</label>
52 </v-flex> 52 </v-flex>
53 <v-flex xs9 sm6 lg8 class="ml-2"> 53 <v-flex xs9 sm6 lg8 class="ml-2">
54 <v-select 54 <v-select
55 :items="getStudentsList" 55 :items="getStudentsList"
56 label="Select your student" 56 label="Select your student"
57 v-model="getReport.studentId" 57 v-model="getReport.studentId"
58 item-text="name" 58 item-text="name"
59 item-value="_id" 59 item-value="_id"
60 :rules="studentRules" 60 :rules="studentRules"
61 required 61 required
62 ></v-select> 62 ></v-select>
63 </v-flex> 63 </v-flex>
64 </v-layout> 64 </v-layout>
65 </v-flex> 65 </v-flex>
66 <v-flex xs12 sm12 lg3 class="hidden-xs-only hidden-sm-only"> 66 <v-flex xs12 sm12 lg3 class="hidden-xs-only hidden-sm-only">
67 <v-btn 67 <v-btn
68 @click="getMarkReportList" 68 @click="getMarkReportList"
69 round 69 round
70 dark 70 dark
71 :loading="loading" 71 :loading="loading"
72 class="open-dialog-button mt-3" 72 class="open-dialog-button mt-3"
73 >Get Report</v-btn> 73 >Get Report</v-btn>
74 </v-flex> 74 </v-flex>
75 </v-layout> 75 </v-layout>
76 </v-flex> 76 </v-flex>
77 </v-form> 77 </v-form>
78 </v-card> 78 </v-card>
79 <v-layout v-show="showReport"> 79 <v-layout v-show="showReport">
80 <v-flex xs12> 80 <v-flex xs12>
81 <v-card class="transparent elevation-0"> 81 <v-card class="transparent elevation-0">
82 <v-container grid-list-md v-show="showReport" class="report"> 82 <v-container grid-list-md v-show="showReport" class="report">
83 <v-flex xs12 sm12 id="printMe"> 83 <v-flex xs12 sm12 id="printMe">
84 <v-layout wrap> 84 <v-layout wrap>
85 <!-- ****** TABLE DATA MARK ****** --> 85 <!-- ****** TABLE DATA MARK ****** -->
86 <v-flex xs12 sm12 md12> 86 <v-flex xs12 sm12 md12>
87 <v-layout> 87 <v-layout>
88 <v-flex xs12> 88 <v-flex xs12>
89 <v-btn class="open-dialog-button" round dark @click="printProgressReport()"> 89 <v-btn class="open-dialog-button" round dark @click="printProgressReport()">
90 Print 90 Print
91 <v-icon right dark>print</v-icon> 91 <v-icon right dark>print</v-icon>
92 </v-btn> 92 </v-btn>
93 </v-flex> 93 </v-flex>
94 </v-layout> 94 </v-layout>
95 <v-flex xs12 v-for="(value, id, index) in filterData" :key="index" flat> 95 <v-flex xs12 v-for="(value, id, index) in filterData" :key="index" flat>
96 <!-- Index Loop Start --> 96 <!-- Index Loop Start -->
97 <v-card 97 <v-card
98 v-for="(studentMark,i) in value" 98 v-for="(studentMark,i) in value"
99 :key="i" 99 :key="i"
100 class="pa-3 ma-3" 100 class="pa-3 ma-3"
101 style="border: 1px solid lightgrey;margin-bottom:14px;padding:20px" 101 style="border: 1px solid lightgrey;margin-bottom:14px;padding:20px"
102 > 102 >
103 <!-- Profile School --> 103 <!-- Profile School -->
104 <v-layout> 104 <v-layout>
105 <v-flex xs12 sm12 md12> 105 <v-flex xs12 sm12 md12>
106 <div> 106 <div>
107 <div class="school-logo"> 107 <div class="school-logo">
108 <v-avatar> 108 <v-avatar>
109 <img :src="userData.schoolLogoUrl" v-if="userData.schoolLogoUrl" /> 109 <img :src="userData.schoolLogoUrl" v-if="userData.schoolLogoUrl" />
110 <img 110 <img
111 src="/static/schoolIcons/INTRACK_White.png" 111 src="/static/schoolIcons/INTRACK_White.png"
112 v-else-if="!userData.schoolLogoUrl" 112 v-else-if="!userData.schoolLogoUrl"
113 /> 113 />
114 </v-avatar> 114 </v-avatar>
115 </div> 115 </div>
116 <div class="school-name"> 116 <div class="school-name">
117 <h2>{{ userData.name }}</h2> 117 <h2>{{ userData.name }}</h2>
118 </div> 118 </div>
119 </div> 119 </div>
120 <hr 120 <hr
121 style="border:1px solid #ddd; 121 style="border:1px solid #ddd;
122 overflow: hidden; 122 overflow: hidden;
123 vertical-align: middle; 123 vertical-align: middle;
124 margin-bottom: 4px;" 124 margin-bottom: 4px;"
125 /> 125 />
126 <div class="school-info"> 126 <div class="school-info">
127 <v-layout> 127 <v-layout>
128 <v-flex xs5 class="pl-3"> 128 <v-flex xs5 class="pl-3">
129 <p style="font-size:20px;">{{ userData.name }}</p> 129 <p style="font-size:20px;">{{ userData.name }}</p>
130 <p 130 <p
131 style="font-size: 15px;color: #707478;margin:0px;margin-bottom:8px;" 131 style="font-size: 15px;color: #707478;margin:0px;margin-bottom:8px;"
132 >{{ userData.address }}</p> 132 >{{ userData.address }}</p>
133 <p 133 <p
134 style="font-size: 15px;color: #707478;margin:0px;margin-bottom:8px;" 134 style="font-size: 15px;color: #707478;margin:0px;margin-bottom:8px;"
135 >{{ userData.mobile }}</p> 135 >{{ userData.mobile }}</p>
136 <p 136 <p
137 style="font-size: 15px;color: #707478;margin:0px;margin-bottom:8px;" 137 style="font-size: 15px;color: #707478;margin:0px;margin-bottom:8px;"
138 >{{ userData.email }}</p> 138 >{{ userData.email }}</p>
139 </v-flex> 139 </v-flex>
140 <!-- Profile Student Report Card--> 140 <!-- Profile Student Report Card-->
141 <v-flex xs5> 141 <v-flex xs5>
142 <div v-if="cardData !=''"> 142 <div v-if="cardData !=''">
143 <p style="font-size:20px;">{{ studentMark.studentId.name }}</p> 143 <p style="font-size:20px;">{{ studentMark.studentId.name }}</p>
144 <p 144 <p
145 style="font-size: 15px;color: #707478;margin:0px;margin-bottom:8px;" 145 style="font-size: 15px;color: #707478;margin:0px;margin-bottom:8px;"
146 > 146 >
147 Class : 147 Class :
148 <b>{{ studentMark.classId.classNum }}</b> 148 <b>{{ studentMark.classId.classNum }}</b>
149 </p> 149 </p>
150 <p 150 <p
151 style="font-size: 15px;color: #707478;margin:0px;margin-bottom:8px;" 151 style="font-size: 15px;color: #707478;margin:0px;margin-bottom:8px;"
152 > 152 >
153 Section : 153 Section :
154 <b>{{ studentMark.sectionId.name }}</b> 154 <b>{{ studentMark.sectionId.name }}</b>
155 </p> 155 </p>
156 <p 156 <p
157 style="font-size: 15px;color: #707478;margin:0px;margin-bottom:8px;" 157 style="font-size: 15px;color: #707478;margin:0px;margin-bottom:8px;"
158 > 158 >
159 Roll NO : 159 Roll NO :
160 <b>{{ studentMark.studentId.rollNo }}</b> 160 <b>{{ studentMark.studentId.rollNo }}</b>
161 </p> 161 </p>
162 </div> 162 </div>
163 </v-flex> 163 </v-flex>
164 <v-flex xs2> 164 <v-flex xs2>
165 <v-avatar size="100" style="padding-top:20px"> 165 <v-avatar size="100" style="padding-top:20px">
166 <img 166 <img
167 src="/static/icon/user.png" 167 src="/static/icon/user.png"
168 v-if="!studentMark.studentId.profilePicUrl" 168 v-if="!studentMark.studentId.profilePicUrl"
169 /> 169 />
170 <img 170 <img
171 :src="studentMark.studentId.profilePicUrl" 171 :src="studentMark.studentId.profilePicUrl"
172 v-else-if="studentMark.studentId.profilePicUrl" 172 v-else-if="studentMark.studentId.profilePicUrl"
173 /> 173 />
174 </v-avatar> 174 </v-avatar>
175 </v-flex> 175 </v-flex>
176 </v-layout> 176 </v-layout>
177 </div> 177 </div>
178 </v-flex> 178 </v-flex>
179 </v-layout> 179 </v-layout>
180 <!-- {{studentMark.examId.examName}} -->
181 <!-- Start Table Report Marks --> 180 <!-- Start Table Report Marks -->
182 <v-card class="student-table"> 181 <v-card class="student-table">
183 <table 182 <table
184 class="mb-5 tableRsponsive feeTypeTable subheading" 183 class="mb-5 tableRsponsive feeTypeTable subheading"
185 style="border: 1px solid black; 184 style="border: 1px solid black;
186 border-collapse: collapse;!important 185 border-collapse: collapse;!important
187 table-layout: auto !important; 186 table-layout: auto !important;
188 width: 100% !important; 187 width: 100% !important;
189 overflow: hidden;" 188 overflow: hidden;"
190 > 189 >
191 <thead style="border: 1px solid transparent !important"> 190 <thead style="border: 1px solid transparent !important">
192 <tr style="border: 1px solid transparent !important"> 191 <tr style="border: 1px solid transparent !important">
193 <td 192 <td
194 colspan="4" 193 colspan="4"
195 style="text-align: inherit !important; 194 style="text-align: inherit !important;
196 border-right: inherit; 195 border-right: inherit;
197 border-top: inherit; 196 border-top: inherit;
198 padding:14px;" 197 padding:14px;"
199 >{{studentMark.examId.examName}}</td> 198 >{{studentMark.examId.examName}}</td>
200 </tr> 199 </tr>
201 <tr style="border: 1px solid lightgrey !important;padding:4px;"> 200 <tr style="border: 1px solid lightgrey !important;padding:4px;">
202 <td 201 <td
203 rowspan="2" 202 rowspan="2"
204 style="border: 1px solid lightgrey !important;padding: 10px;" 203 style="border: 1px solid lightgrey !important;padding: 10px;"
205 >Subject</td> 204 >Subject</td>
206 <template> 205 <template>
207 <td 206 <td
208 v-for="(studentMarkData,i) in studentMark.studentsMarks" 207 v-for="(studentMarkData,i) in studentMark.studentsMarks"
209 :key="i" 208 :key="i"
210 colspan="2" 209 colspan="2"
211 style="border: 1px solid lightgrey !important;padding: 10px;" 210 style="border: 1px solid lightgrey !important;padding: 10px;"
212 >{{studentMarkData.markDistributionId.distributionType}}</td> 211 >{{studentMarkData.markDistributionId.distributionType}}</td>
213 <td 212 <td
214 style="border: 1px solid lightgrey !important;padding: 10px;" 213 style="border: 1px solid lightgrey !important;padding: 10px;"
215 >Total Marks</td> 214 >Total Marks</td>
216 </template> 215 </template>
217 </tr> 216 </tr>
218 <tr style="border: 1px solid lightgrey !important;"> 217 <tr style="border: 1px solid lightgrey !important;">
219 <template v-for="(exam, ind) in studentMark.studentsMarks"> 218 <template v-for="(exam, ind) in studentMark.studentsMarks">
220 <td 219 <td
221 :key="ind" 220 :key="ind"
222 style="border: 1px solid lightgrey !important;padding: 10px;" 221 style="border: 1px solid lightgrey !important;padding: 10px;"
223 >Marks</td> 222 >Marks</td>
224 <td 223 <td
225 :key="ind" 224 :key="ind"
226 style="border: 1px solid lightgrey !important;padding: 10px;" 225 style="border: 1px solid lightgrey !important;padding: 10px;"
227 >Highest Marks</td> 226 >Highest Marks</td>
228 </template> 227 </template>
229 </tr> 228 </tr>
230 </thead> 229 </thead>
231 <tbody style="border: 1px solid lightgrey !important;"> 230 <tbody style="border: 1px solid lightgrey !important;">
232 <tr> 231 <tr>
233 <td 232 <td
234 style="border: 1px solid lightgrey !important;padding: 10px;" 233 style="border: 1px solid lightgrey !important;padding: 10px;"
235 >{{studentMark.subjectName}}</td> 234 >{{studentMark.subjectName}}</td>
236 <template v-for="(exam, index) in studentMark.studentsMarks"> 235 <template v-for="(exam, index) in studentMark.studentsMarks">
237 <td 236 <td
238 :key="index" 237 :key="index"
239 style="border: 1px solid lightgrey !important;padding: 10px;" 238 style="border: 1px solid lightgrey !important;padding: 10px;"
240 >{{exam.marksScored}}</td> 239 >{{exam.marksScored}}</td>
241 <td 240 <td
242 :key="index" 241 :key="index"
243 style="border: 1px solid lightgrey !important;padding: 10px;" 242 style="border: 1px solid lightgrey !important;padding: 10px;"
244 >{{exam.markDistributionId.markValue}}</td> 243 >{{exam.markDistributionId.markValue}}</td>
245 </template> 244 </template>
246 <td 245 <td
247 style="border: 1px solid lightgrey !important;padding: 10px;" 246 style="border: 1px solid lightgrey !important;padding: 10px;"
248 >{{studentMark.totalMarks}}</td> 247 >{{studentMark.totalMarks}}</td>
249 </tr> 248 </tr>
250 </tbody> 249 </tbody>
251 <tfoot> 250 <tfoot>
252 <tr style="border: 1px solid lightgrey !important;"> 251 <tr style="border: 1px solid lightgrey !important;">
253 <td colspan="5"> 252 <td
254 <span class="subheding">Total Marks</span> 253 colspan="5"
255 </td> 254 style="text-align:center"
255 class="subheding"
256 >Total Marks</td>
256 <td 257 <td
257 colspan="7" 258 colspan="7"
258 style="border: 1px solid lightgrey !important;padding: 10px;" 259 style="border: 1px solid lightgrey !important;padding: 10px;"
259 >{{ studentMark.totalMarks }}</td> 260 >{{ studentMark.totalMarks }}</td>
260 </tr> 261 </tr>
261 <tr> 262 <tr>
262 <td colspan="5"> 263 <td colspan="5" style="text-align:center" class="subheding">Grade</td>
263 <span class="subheding">Grade</span>
264 </td>
265 <td 264 <td
266 colspan="7" 265 colspan="7"
267 style="border: 1px solid lightgrey !important;padding: 10px;" 266 style="border: 1px solid lightgrey !important;padding: 10px;"
268 >{{ studentMark.grade }}</td> 267 >{{ studentMark.grade }}</td>
269 </tr> 268 </tr>
270 <tr> 269 <tr>
271 <td colspan="5"> 270 <td
272 <span class="subheding">Average Mark</span> 271 colspan="5"
273 </td> 272 style="text-align:center"
273 class="subheding"
274 >Average Mark</td>
274 <td 275 <td
275 colspan="7" 276 colspan="7"
276 style="border: 1px solid lightgrey !important;padding: 10px;" 277 style="border: 1px solid lightgrey !important;padding: 10px;"
277 ></td> 278 ></td>
278 </tr> 279 </tr>
279 <tr> 280 <tr>
280 <td colspan="5"> 281 <td colspan="5" style="text-align:center" class="subheding">GPA</td>
281 <span class="subheding">GPA</span>
282 </td>
283 <td 282 <td
284 colspan="7" 283 colspan="7"
285 style="border: 1px solid lightgrey !important;padding: 10px;" 284 style="border: 1px solid lightgrey !important;padding: 10px;"
286 ></td> 285 ></td>
287 </tr> 286 </tr>
288 </tfoot> 287 </tfoot>
289 </table> 288 </table>
290 </v-card> 289 </v-card>
291 </v-card> 290 </v-card>
292 </v-flex> 291 </v-flex>
293 </v-flex> 292 </v-flex>
294 </v-layout> 293 </v-layout>
295 </v-flex> 294 </v-flex>
296 </v-container> 295 </v-container>
297 </v-card> 296 </v-card>
298 </v-flex> 297 </v-flex>
299 </v-layout> 298 </v-layout>
300 <div class="loader" v-if="showLoader"> 299 <div class="loader" v-if="showLoader">
301 <v-progress-circular indeterminate color="white"></v-progress-circular> 300 <v-progress-circular indeterminate color="white"></v-progress-circular>
302 </div> 301 </div>
303 </v-container> 302 </v-container>
304 </template> 303 </template>
305 304
306 <script> 305 <script>
307 import http from "@/Services/http.js"; 306 import http from "@/Services/http.js";
308 import moment from "moment"; 307 import moment from "moment";
309 import _ from "underscore"; 308 import _ from "underscore";
310 309
311 export default { 310 export default {
312 data: () => ({ 311 data: () => ({
313 showLoader: false, 312 showLoader: false,
314 cardData: [], 313 cardData: [],
315 token: "", 314 token: "",
316 markDistributions: [], 315 markDistributions: [],
317 markParticularDistributionData: [], 316 markParticularDistributionData: [],
318 loading: false, 317 loading: false,
319 valid: true, 318 valid: true,
320 loading: false, 319 loading: false,
321 showReport: false, 320 showReport: false,
322 addSection: [], 321 addSection: [],
323 filterData: [], 322 filterData: [],
324 getStudentsList: [], 323 getStudentsList: [],
325 classRules: [v => !!v || "Class is required"], 324 classRules: [v => !!v || "Class is required"],
326 sectionRules: [v => !!v || "Class is required"], 325 sectionRules: [v => !!v || "Class is required"],
327 studentRules: [v => !!v || "Student is required"], 326 studentRules: [v => !!v || "Student is required"],
328 getReport: {}, 327 getReport: {},
329 classList: [], 328 classList: [],
330 output: null, 329 output: null,
331 userData: {}, 330 userData: {},
332 newData: [], 331 newData: [],
333 gradeAPlus: "A+", 332 gradeAPlus: "A+",
334 gradeA: "A", 333 gradeA: "A",
335 gradeBPlus: "B+", 334 gradeBPlus: "B+",
336 gradeB: "B", 335 gradeB: "B",
337 gradeCPlus: "C+", 336 gradeCPlus: "C+",
338 gradeC: "C", 337 gradeC: "C",
339 totalMarks: "" 338 totalMarks: ""
340 }), 339 }),
341 mounted() { 340 mounted() {
342 this.token = this.$store.state.token; 341 this.token = this.$store.state.token;
343 this.getClass(); 342 this.getClass();
344 this.getUserData(); 343 this.getUserData();
345 }, 344 },
346 methods: { 345 methods: {
347 clear() { 346 clear() {
348 this.$refs.form.reset(); 347 this.$refs.form.reset();
349 }, 348 },
350 getClass() { 349 getClass() {
351 this.showLoader = true; 350 this.showLoader = true;
352 http() 351 http()
353 .get("/getClassesList", { 352 .get("/getClassesList", {
354 headers: { Authorization: "Bearer " + this.token } 353 headers: { Authorization: "Bearer " + this.token }
355 }) 354 })
356 .then(response => { 355 .then(response => {
357 this.classList = response.data.data; 356 this.classList = response.data.data;
358 this.showLoader = false; 357 this.showLoader = false;
359 }) 358 })
360 .catch(error => { 359 .catch(error => {
361 this.showLoader = false; 360 this.showLoader = false;
362 // console.log("err====>", err); 361 // console.log("err====>", err);
363 }); 362 });
364 }, 363 },
365 getSections(_id) { 364 getSections(_id) {
366 this.showLoader = true; 365 this.showLoader = true;
367 http() 366 http()
368 .get( 367 .get(
369 "/getSectionsList", 368 "/getSectionsList",
370 { params: { classId: _id } }, 369 { params: { classId: _id } },
371 { 370 {
372 headers: { Authorization: "Bearer " + this.token } 371 headers: { Authorization: "Bearer " + this.token }
373 } 372 }
374 ) 373 )
375 .then(response => { 374 .then(response => {
376 this.addSection = response.data.data; 375 this.addSection = response.data.data;
377 this.showLoader = false; 376 this.showLoader = false;
378 }) 377 })
379 .catch(err => { 378 .catch(err => {
380 this.showLoader = false; 379 this.showLoader = false;
381 // console.log("err====>", err); 380 // console.log("err====>", err);
382 }); 381 });
383 }, 382 },
384 getStudents() { 383 getStudents() {
385 this.showLoader = true; 384 this.showLoader = true;
386 http() 385 http()
387 .get("/getStudentWithClass", { 386 .get("/getStudentWithClass", {
388 params: { 387 params: {
389 classId: this.getReport.classId, 388 classId: this.getReport.classId,
390 sectionId: this.getReport.sectionId 389 sectionId: this.getReport.sectionId
391 } 390 }
392 }) 391 })
393 .then(response => { 392 .then(response => {
394 response.data.data.unshift({ 393 response.data.data.unshift({
395 name: "Select All", 394 name: "Select All",
396 _id: "Select All" 395 _id: "Select All"
397 }); 396 });
398 this.getStudentsList = response.data.data; 397 this.getStudentsList = response.data.data;
399 this.showLoader = false; 398 this.showLoader = false;
400 // console.log("getSectionsList=====>", response.data.data); 399 // console.log("getSectionsList=====>", response.data.data);
401 }) 400 })
402 .catch(error => { 401 .catch(error => {
403 console.log("err====>", error); 402 console.log("err====>", error);
404 this.showLoader = false; 403 this.showLoader = false;
405 }); 404 });
406 }, 405 },
407 getMarkReportList() { 406 getMarkReportList() {
408 // this.showLoader = true; 407 // this.showLoader = true;
409 this.showReport = true; 408 this.showReport = true;
410 // http() 409 // http()
411 // .get("/getParticularMark", { 410 // .get("/getParticularMark", {
412 // params: { studentId: this.getReport.studentId }, 411 // params: { studentId: this.getReport.studentId },
413 // headers: { Authorization: "Bearer " + this.token } 412 // headers: { Authorization: "Bearer " + this.token }
414 // }) 413 // })
415 // .then(response => { 414 // .then(response => {
416 // this.showLoader = false; 415 // this.showLoader = false;
417 // this.cardData = response.data.data; 416 // this.cardData = response.data.data;
418 // let newData = response.data.data; 417 // let newData = response.data.data;
419 // for (var i = 0; i < newData.length; i++) { 418 // for (var i = 0; i < newData.length; i++) {
420 // newData[i].examination = newData[i].examId._id; 419 // newData[i].examination = newData[i].examId._id;
421 // } 420 // }
422 // this.filterData = _.groupBy(newData, ["examination"]); 421 // this.filterData = _.groupBy(newData, ["examination"]);
423 // for (let data in this.filterData) { 422 // for (let data in this.filterData) {
424 423
425 // for (let item in this.filterData[data]) { 424 // for (let item in this.filterData[data]) {
426 // var totalMarks = 0; 425 // var totalMarks = 0;
427 // for ( 426 // for (
428 // let i = 0; 427 // let i = 0;
429 // i < this.filterData[data][item].studentsMarks.length; 428 // i < this.filterData[data][item].studentsMarks.length;
430 // i++ 429 // i++
431 // ) { 430 // ) {
432 // totalMarks += this.filterData[data][item].studentsMarks[i] 431 // totalMarks += this.filterData[data][item].studentsMarks[i]
433 // .marksScored; 432 // .marksScored;
434 // } 433 // }
435 // this.filterData[data][item].totalMarks = totalMarks; 434 // this.filterData[data][item].totalMarks = totalMarks;
436 // var total = 0; 435 // var total = 0;
437 // total += this.filterData[data][item].totalMarks ; 436 // total += this.filterData[data][item].totalMarks ;
438 // console.log("total", total); 437 // console.log("total", total);
439 // } 438 // }
440 // } 439 // }
441 // }) 440 // })
442 // console.log( 441 // console.log(
443 // "getReport.classId", 442 // "getReport.classId",
444 // this.getReport.classId, 443 // this.getReport.classId,
445 // "getReport.sectionId", 444 // "getReport.sectionId",
446 // this.getReport.sectionId, 445 // this.getReport.sectionId,
447 // "getReport.studentId", 446 // "getReport.studentId",
448 // this.getReport.studentId 447 // this.getReport.studentId
449 // ); 448 // );
450 449
451 var getSelectMarks = {}; 450 var getSelectMarks = {};
452 if (this.getReport.studentId == "Select All") { 451 if (this.getReport.studentId == "Select All") {
453 getSelectMarks = { 452 getSelectMarks = {
454 classId: this.getReport.classId, 453 classId: this.getReport.classId,
455 sectionId: this.getReport.sectionId 454 sectionId: this.getReport.sectionId
456 }; 455 };
457 } else if (this.getReport.studentId != "Select All") { 456 } else if (this.getReport.studentId != "Select All") {
458 getSelectMarks = { 457 getSelectMarks = {
459 classId: this.getReport.classId, 458 classId: this.getReport.classId,
460 sectionId: this.getReport.sectionId, 459 sectionId: this.getReport.sectionId,
461 studentId: this.getReport.studentId 460 studentId: this.getReport.studentId
462 }; 461 };
463 } 462 }
464 http() 463 http()
465 .get("/getParticularMark", { 464 .get("/getParticularMark", {
466 params: getSelectMarks, 465 params: getSelectMarks,
467 headers: { Authorization: "Bearer " + this.token } 466 headers: { Authorization: "Bearer " + this.token }
468 }) 467 })
469 .then(response => { 468 .then(response => {
470 this.cardData = response.data.data; 469 this.cardData = response.data.data;
471 let newData = response.data.data; 470 let newData = response.data.data;
472 // console.log("newData", newData); 471 // console.log("newData", newData);
473 for (var i = 0; i < newData.length; i++) { 472 for (var i = 0; i < newData.length; i++) {
474 newData[i].examination = newData[i].examId._id; 473 newData[i].examination = newData[i].examId._id;
475 } 474 }
476 this.filterData = _.groupBy(newData, ["examination"]); 475 this.filterData = _.groupBy(newData, ["examination"]);
477 // console.log("this.filterData", this.filterData); 476 // console.log("this.filterData", this.filterData);
478 for (let data in this.filterData) { 477 for (let data in this.filterData) {
479 for (let item in this.filterData[data]) { 478 for (let item in this.filterData[data]) {
480 var totalMarks = 0; 479 var totalMarks = 0;
481 for ( 480 for (
482 let i = 0; 481 let i = 0;
483 i < this.filterData[data][item].studentsMarks.length; 482 i < this.filterData[data][item].studentsMarks.length;
484 i++ 483 i++
485 ) { 484 ) {
486 totalMarks += this.filterData[data][item].studentsMarks[i] 485 totalMarks += this.filterData[data][item].studentsMarks[i]
487 .marksScored; 486 .marksScored;
488 } 487 }
489 this.filterData[data][item].totalMarks = totalMarks; 488 this.filterData[data][item].totalMarks = totalMarks;
490 console.log("totalMarks", totalMarks); 489 console.log("totalMarks", totalMarks);
491 this.totalMarks = totalMarks; 490 this.totalMarks = totalMarks;
492 if (totalMarks > 90) { 491 if (totalMarks > 90) {
493 this.filterData[data][item].grade = this.gradeAPlus; 492 this.filterData[data][item].grade = this.gradeAPlus;
494 } else if (totalMarks > 80 && totalMarks < 90) { 493 } else if (totalMarks > 80 && totalMarks < 90) {
495 this.filterData[data][item].grade = this.gradeA; 494 this.filterData[data][item].grade = this.gradeA;
496 } else if (totalMarks > 70 && totalMarks < 80) { 495 } else if (totalMarks > 70 && totalMarks < 80) {
497 this.filterData[data][item].grade = this.gradeBPlus; 496 this.filterData[data][item].grade = this.gradeBPlus;
498 } else if (totalMarks > 60 && totalMarks < 70) { 497 } else if (totalMarks > 60 && totalMarks < 70) {
499 this.filterData[data][item].grade = this.gradeB; 498 this.filterData[data][item].grade = this.gradeB;
500 } else if (totalMarks > 50 && totalMarks < 60) { 499 } else if (totalMarks > 50 && totalMarks < 60) {
501 this.filterData[data][item].grade = this.gradeCPlus; 500 this.filterData[data][item].grade = this.gradeCPlus;
502 } else if (totalMarks > 40 && totalMarks < 50) { 501 } else if (totalMarks > 40 && totalMarks < 50) {
503 this.filterData[data][item].grade = this.gradeC; 502 this.filterData[data][item].grade = this.gradeC;
504 } 503 }
505 } 504 }
506 } 505 }
507 this.showLoader = false; 506 this.showLoader = false;
508 }) 507 })
509 .catch(error => { 508 .catch(error => {
510 // console.log("err====>", err); 509 // console.log("err====>", err);
511 this.showLoader = false; 510 this.showLoader = false;
512 this.snackbar = true; 511 this.snackbar = true;
513 // this.text = error.response.data.message; 512 // this.text = error.response.data.message;
514 // if (error.response.status === 401) { 513 // if (error.response.status === 401) {
515 // this.$router.replace({ path: "/" }); 514 // this.$router.replace({ path: "/" });
516 // this.$store.dispatch("setToken", null); 515 // this.$store.dispatch("setToken", null);
517 // this.$store.dispatch("Id", null); 516 // this.$store.dispatch("Id", null);
518 // } 517 // }
519 }); 518 });
520 }, 519 },
521 printProgressReport() { 520 printProgressReport() {
522 // Pass the element id here 521 // Pass the element id here
523 this.$htmlToPaper("printMe"); 522 this.$htmlToPaper("printMe");
524 }, 523 },
525 getUserData() { 524 getUserData() {
526 http() 525 http()
527 .get("/getParticularUserDetail") 526 .get("/getParticularUserDetail")
528 .then(response => { 527 .then(response => {
529 this.userData = response.data.data; 528 this.userData = response.data.data;
530 }) 529 })
531 .catch(error => { 530 .catch(error => {
532 // if (error.response.status === 401) { 531 // if (error.response.status === 401) {
533 // this.$router.replace({ path: "/" }); 532 // this.$router.replace({ path: "/" });
534 // this.$store.dispatch("setToken", null); 533 // this.$store.dispatch("setToken", null);
535 // this.$store.dispatch("Id", null); 534 // this.$store.dispatch("Id", null);
536 // } 535 // }
537 }); 536 });
538 } 537 }
539 } 538 }
540 }; 539 };
541 </script> 540 </script>
542 541
543 <style scoped> 542 <style scoped>
544 table { 543 table {
545 border-collapse: collapse; 544 border-collapse: collapse;
546 border: 1px solid #e2e7eb; 545 border: 1px solid #e2e7eb;
547 } 546 }
548 547
549 th, 548 th,
550 td { 549 td {
551 border: 1px solid #e2e7eb; 550 border: 1px solid #e2e7eb;
552 padding: 10px; 551 padding: 10px;
553 text-align: center; 552 text-align: center;
554 } 553 }
555 table.feeTypeTable { 554 table.feeTypeTable {
556 table-layout: auto !important; 555 table-layout: auto !important;
557 width: 100% !important; 556 width: 100% !important;
558 } 557 }
559 .bg-sky { 558 .bg-sky {
560 background-color: #98b2cc !important; 559 background-color: #98b2cc !important;
561 } 560 }
562 .bg-sky-light { 561 .bg-sky-light {
563 background-color: #89a0b8; 562 background-color: #89a0b8;
564 } 563 }
565 .bg-purple { 564 .bg-purple {
566 background-color: #9583ac; 565 background-color: #9583ac;
567 } 566 }
568 .bg-skyDark { 567 .bg-skyDark {
569 background-color: #956785; 568 background-color: #956785;
570 } 569 }
571 570
572 /* .report { 571 /* .report {
573 overflow: hidden; 572 overflow: hidden;
574 max-width: 794px; 573 max-width: 794px;
575 margin: 0px auto; 574 margin: 0px auto;
576 margin-bottom: 10px; 575 margin-bottom: 10px;
577 padding: 30px; 576 padding: 30px;
578 } */ 577 } */
579 .line { 578 .line {
580 border-bottom: 1px solid #ddd; 579 border-bottom: 1px solid #ddd;
581 overflow: hidden; 580 overflow: hidden;
582 padding-bottom: 10px; 581 padding-bottom: 10px;
583 vertical-align: middle; 582 vertical-align: middle;
584 margin-bottom: 4px; 583 margin-bottom: 4px;
585 } 584 }
586 .school-logo { 585 .school-logo {
587 float: left; 586 float: left;
588 } 587 }
589 .school-name { 588 .school-name {
590 box-sizing: border-box; 589 box-sizing: border-box;
591 } 590 }
592 .school-info { 591 .school-info {
593 width: 100%; 592 width: 100%;
594 overflow: hidden; 593 overflow: hidden;
595 } 594 }
596 .school-address { 595 .school-address {
597 float: left; 596 float: left;
598 width: 40%; 597 width: 40%;
599 } 598 }
600 .student-data { 599 .student-data {
601 float: right; 600 float: right;
602 width: 40%; 601 width: 40%;
603 } 602 }
604 .student-info { 603 .student-info {
605 float: left; 604 float: left;
606 } 605 }
607 @media screen and (max-width: 380px) { 606 @media screen and (max-width: 380px) {
608 .tableRsponsive { 607 .tableRsponsive {
609 /* display: block; */ 608 /* display: block; */
610 position: relative; 609 position: relative;