Commit 61ab1167f17a5ecb27367bb8b8236b41103d9fef

Authored by Neeraj Sharma
1 parent b8690bbc9e

implement create issue a book all functionality are done

src/Services/http.js
1 import axios from 'axios' 1 import axios from 'axios'
2 import store from '@/store/store' 2 import store from '@/store/store'
3 3
4 export default () => { 4 export default () => {
5 return axios.create({ 5 return axios.create({
6 // baseURL: 'http://192.168.2.221:3002/v1',/ 6 // baseURL: 'http://192.168.2.221:3002/v1',
7 baseURL: 'http://13.234.251.173:8001/v1', 7 baseURL: 'http://13.234.251.173:8001/v1',
8 headers: { 8 headers: {
9 Authorization: `Bearer ${store.state.token}` 9 Authorization: `Bearer ${store.state.token}`
10 } 10 }
11 }) 11 })
12 } 12 }
src/pages/Library/books.vue
1 <template> 1 <template>
2 <v-app id="pages-dasboard"> 2 <v-app id="pages-dasboard">
3 <v-tabs grow slider-color="gray"> 3 <v-tabs grow slider-color="gray">
4 <v-tab 4 <v-tab
5 ripple 5 ripple
6 @click="activeTab('existing')" 6 @click="activeTab('existing')"
7 v-bind:class="{ active: isActive }" 7 v-bind:class="{ active: isActive }"
8 id="tab" 8 id="tab"
9 class="subheading" 9 class="subheading"
10 >Existing Books</v-tab> 10 >Existing Books</v-tab>
11 <v-tab 11 <v-tab
12 ripple 12 ripple
13 @click="activeTab('new')" 13 @click="activeTab('new')"
14 v-bind:class="{ active: newActive }" 14 v-bind:class="{ active: newActive }"
15 id="tab1" 15 id="tab1"
16 User 16 User
17 class="subheading" 17 class="subheading"
18 >Add New Books</v-tab> 18 >Add New Books</v-tab>
19 19
20 <!-- ****** EDIT SECTION ****** --> 20 <!-- ****** EDIT SECTION ****** -->
21 <v-tab-item> 21 <v-tab-item>
22 <v-snackbar 22 <v-snackbar
23 :timeout="timeout" 23 :timeout="timeout"
24 :top="y === 'top'" 24 :top="y === 'top'"
25 :right="x === 'right'" 25 :right="x === 'right'"
26 :vertical="mode === 'vertical'" 26 :vertical="mode === 'vertical'"
27 v-model="snackbar" 27 v-model="snackbar"
28 color="success" 28 color="success"
29 >{{ text }}</v-snackbar> 29 >{{ text }}</v-snackbar>
30 <v-dialog v-model="dialog" max-width="600px"> 30 <v-dialog v-model="dialog" max-width="600px">
31 <v-toolbar color="grey lighten-2"> 31 <v-toolbar color="grey lighten-2">
32 <v-spacer></v-spacer> 32 <v-spacer></v-spacer>
33 <v-toolbar-title> 33 <v-toolbar-title>
34 <h3>Edit Books</h3> 34 <h3>Edit Books</h3>
35 </v-toolbar-title> 35 </v-toolbar-title>
36 <v-spacer></v-spacer> 36 <v-spacer></v-spacer>
37 </v-toolbar> 37 </v-toolbar>
38 <v-card> 38 <v-card>
39 <v-card-text> 39 <v-card-text>
40 <v-container> 40 <v-container>
41 <v-layout wrap justify-center> 41 <v-layout wrap justify-center>
42 <v-flex xs12 sm9> 42 <v-flex xs12 sm9>
43 <v-form> 43 <v-form>
44 <v-layout> 44 <v-layout>
45 <v-flex xs4 class="pt-4 subheading"> 45 <v-flex xs4 class="pt-4 subheading">
46 <label class="right pr-3">Name:</label> 46 <label class="right pr-3">Name:</label>
47 </v-flex> 47 </v-flex>
48 <v-flex xs8> 48 <v-flex xs8>
49 <v-text-field v-model="editedItem.name" placeholder="fill your Name"></v-text-field> 49 <v-text-field v-model="editedItem.name" placeholder="fill your Name"></v-text-field>
50 </v-flex> 50 </v-flex>
51 </v-layout> 51 </v-layout>
52 <v-layout> 52 <v-layout>
53 <v-flex xs4 class="pt-4 subheading"> 53 <v-flex xs4 class="pt-4 subheading">
54 <label class="right pr-3">Author:</label> 54 <label class="right pr-3">Author:</label>
55 </v-flex> 55 </v-flex>
56 <v-flex xs8> 56 <v-flex xs8>
57 <v-text-field 57 <v-text-field
58 v-model="editedItem.author" 58 v-model="editedItem.author"
59 placeholder="fill your Author Name" 59 placeholder="fill your Author Name"
60 ></v-text-field> 60 ></v-text-field>
61 </v-flex> 61 </v-flex>
62 </v-layout> 62 </v-layout>
63 <v-layout> 63 <v-layout>
64 <v-flex xs4 class="pt-4 subheading"> 64 <v-flex xs4 class="pt-4 subheading">
65 <label class="right pr-2">Subject Code:</label> 65 <label class="right pr-2">Subject Code:</label>
66 </v-flex> 66 </v-flex>
67 <v-flex xs8> 67 <v-flex xs8>
68 <v-text-field 68 <v-text-field
69 v-model="editedItem.subjectCode" 69 v-model="editedItem.subjectCode"
70 placeholder="fill your Subject Code" 70 placeholder="fill your Subject Code"
71 ></v-text-field> 71 ></v-text-field>
72 </v-flex> 72 </v-flex>
73 </v-layout> 73 </v-layout>
74 <v-layout> 74 <v-layout>
75 <v-flex xs4 class="pt-4 subheading"> 75 <v-flex xs4 class="pt-4 subheading">
76 <label class="right pr-3">Price :</label> 76 <label class="right pr-3">Price :</label>
77 </v-flex> 77 </v-flex>
78 <v-flex xs8> 78 <v-flex xs8>
79 <v-text-field 79 <v-text-field
80 v-model="editedItem.price" 80 v-model="editedItem.price"
81 placeholder="fill your Subject Code" 81 placeholder="fill your Subject Code"
82 ></v-text-field> 82 ></v-text-field>
83 </v-flex> 83 </v-flex>
84 </v-layout> 84 </v-layout>
85 <v-layout> 85 <v-layout>
86 <v-flex xs4 class="pt-4 subheading"> 86 <v-flex xs4 class="pt-4 subheading">
87 <label class="right pr-3">Quantity:</label> 87 <label class="right pr-3">Quantity:</label>
88 </v-flex> 88 </v-flex>
89 <v-flex xs8> 89 <v-flex xs8>
90 <v-text-field 90 <v-text-field
91 v-model="editedItem.quantity" 91 v-model="editedItem.quantity"
92 type="number" 92 type="number"
93 placeholder="fill your Quantity" 93 placeholder="fill your Quantity"
94 ></v-text-field> 94 ></v-text-field>
95 </v-flex> 95 </v-flex>
96 </v-layout> 96 </v-layout>
97 <v-layout> 97 <v-layout>
98 <v-flex xs4 class="pt-4 subheading"> 98 <v-flex xs4 class="pt-4 subheading">
99 <label class="right pr-3">Rack No:</label> 99 <label class="right pr-3">Rack No:</label>
100 </v-flex> 100 </v-flex>
101 <v-flex xs8> 101 <v-flex xs8>
102 <v-text-field v-model="editedItem.rackNo" placeholder="fill your Rack No"></v-text-field> 102 <v-text-field v-model="editedItem.rackNo" placeholder="fill your Rack No"></v-text-field>
103 </v-flex> 103 </v-flex>
104 </v-layout> 104 </v-layout>
105 <v-card-actions> 105 <v-card-actions>
106 <v-btn round dark @click.native="close">Cancel</v-btn> 106 <v-btn round dark @click.native="close">Cancel</v-btn>
107 <v-spacer></v-spacer> 107 <v-spacer></v-spacer>
108 <v-btn round dark @click="save">Save</v-btn> 108 <v-btn round dark @click="save">Save</v-btn>
109 </v-card-actions> 109 </v-card-actions>
110 </v-form> 110 </v-form>
111 </v-flex> 111 </v-flex>
112 </v-layout> 112 </v-layout>
113 </v-container> 113 </v-container>
114 </v-card-text> 114 </v-card-text>
115 </v-card> 115 </v-card>
116 </v-dialog> 116 </v-dialog>
117 117
118 <!-- ****** PROFILE VIEW BOOKS DATA ****** --> 118 <!-- ****** PROFILE VIEW BOOKS DATA ****** -->
119 119
120 <v-dialog v-model="dialog1" max-width="600px"> 120 <v-dialog v-model="dialog1" max-width="600px">
121 <v-toolbar color="grey lighten-2"> 121 <v-toolbar color="grey lighten-2">
122 <v-spacer></v-spacer> 122 <v-spacer></v-spacer>
123 <v-toolbar-title> 123 <v-toolbar-title>
124 <h3>Books</h3> 124 <h3>Books</h3>
125 </v-toolbar-title> 125 </v-toolbar-title>
126 <v-spacer></v-spacer> 126 <v-spacer></v-spacer>
127 <v-icon @click="close1">close</v-icon> 127 <v-icon @click="close1">close</v-icon>
128 </v-toolbar> 128 </v-toolbar>
129 <v-card> 129 <v-card>
130 <v-card-text> 130 <v-card-text>
131 <v-container grid-list-md> 131 <v-container grid-list-md>
132 <v-layout wrap> 132 <v-layout wrap>
133 <v-flex> 133 <v-flex>
134 <v-layout> 134 <v-layout>
135 <v-flex xs5 sm6> 135 <v-flex xs5 sm6>
136 <h5 class="right my-1"> 136 <h5 class="right my-1">
137 <b>Name:</b> 137 <b>Name:</b>
138 </h5> 138 </h5>
139 </v-flex> 139 </v-flex>
140 <v-flex sm6 xs8> 140 <v-flex sm6 xs8>
141 <h5 class="my-1">{{ editedItem.name }}</h5> 141 <h5 class="my-1">{{ editedItem.name }}</h5>
142 </v-flex> 142 </v-flex>
143 </v-layout> 143 </v-layout>
144 <v-layout> 144 <v-layout>
145 <v-flex xs5 sm6> 145 <v-flex xs5 sm6>
146 <h5 class="right my-1"> 146 <h5 class="right my-1">
147 <b>Author:</b> 147 <b>Author:</b>
148 </h5> 148 </h5>
149 </v-flex> 149 </v-flex>
150 <v-flex sm6 xs8> 150 <v-flex sm6 xs8>
151 <h5 class="my-1">{{ editedItem.author }}</h5> 151 <h5 class="my-1">{{ editedItem.author }}</h5>
152 </v-flex> 152 </v-flex>
153 </v-layout> 153 </v-layout>
154 <v-layout> 154 <v-layout>
155 <v-flex xs5 sm6> 155 <v-flex xs5 sm6>
156 <h5 class="right my-1"> 156 <h5 class="right my-1">
157 <b>Subject Code :</b> 157 <b>Subject Code :</b>
158 </h5> 158 </h5>
159 </v-flex> 159 </v-flex>
160 <v-flex sm6 xs8> 160 <v-flex sm6 xs8>
161 <h5 class="my-1">{{ editedItem.subjectCode }}</h5> 161 <h5 class="my-1">{{ editedItem.subjectCode }}</h5>
162 </v-flex> 162 </v-flex>
163 </v-layout> 163 </v-layout>
164 <v-layout> 164 <v-layout>
165 <v-flex xs5 sm6> 165 <v-flex xs5 sm6>
166 <h5 class="right my-1"> 166 <h5 class="right my-1">
167 <b>Price :</b> 167 <b>Price :</b>
168 </h5> 168 </h5>
169 </v-flex> 169 </v-flex>
170 <v-flex sm6 xs8> 170 <v-flex sm6 xs8>
171 <h5 class="my-1">{{ editedItem.price }}</h5> 171 <h5 class="my-1">{{ editedItem.price }}</h5>
172 </v-flex> 172 </v-flex>
173 </v-layout> 173 </v-layout>
174 <v-layout> 174 <v-layout>
175 <v-flex xs5 sm6> 175 <v-flex xs5 sm6>
176 <h5 class="right my-1"> 176 <h5 class="right my-1">
177 <b>Quantity :</b> 177 <b>Quantity :</b>
178 </h5> 178 </h5>
179 </v-flex> 179 </v-flex>
180 <v-flex sm6 xs8> 180 <v-flex sm6 xs8>
181 <h5 class="my-1">{{ editedItem.quantity}}</h5> 181 <h5 class="my-1">{{ editedItem.quantity}}</h5>
182 </v-flex> 182 </v-flex>
183 </v-layout> 183 </v-layout>
184 <v-layout> 184 <v-layout>
185 <v-flex xs5 sm6> 185 <v-flex xs5 sm6>
186 <h5 class="right my-1"> 186 <h5 class="right my-1">
187 <b>Rack No :</b> 187 <b>Rack No :</b>
188 </h5> 188 </h5>
189 </v-flex> 189 </v-flex>
190 <v-flex sm6 xs8> 190 <v-flex sm6 xs8>
191 <h5 class="my-1">{{ editedItem.rackNo}}</h5> 191 <h5 class="my-1">{{ editedItem.rackNo}}</h5>
192 </v-flex> 192 </v-flex>
193 </v-layout> 193 </v-layout>
194 </v-flex> 194 </v-flex>
195 </v-layout> 195 </v-layout>
196 </v-container> 196 </v-container>
197 </v-card-text> 197 </v-card-text>
198 </v-card> 198 </v-card>
199 </v-dialog> 199 </v-dialog>
200 200
201 <v-snackbar 201 <v-snackbar
202 :timeout="timeout" 202 :timeout="timeout"
203 :top="y === 'top'" 203 :top="y === 'top'"
204 :right="x === 'right'" 204 :right="x === 'right'"
205 :vertical="mode === 'vertical'" 205 :vertical="mode === 'vertical'"
206 v-model="snackbar" 206 v-model="snackbar"
207 color="success" 207 color="success"
208 >{{ text }}</v-snackbar> 208 >{{ text }}</v-snackbar>
209 209
210 <!-- ****** EXISTING-BOOKS TABLE ****** --> 210 <!-- ****** EXISTING-BOOKS TABLE ****** -->
211 211
212 <v-data-table 212 <v-data-table
213 :headers="headers" 213 :headers="headers"
214 :items="bookData" 214 :items="bookData"
215 :pagination.sync="pagination" 215 :pagination.sync="pagination"
216 :search="search" 216 :search="search"
217 > 217 >
218 <template slot="items" slot-scope="props"> 218 <template slot="items" slot-scope="props">
219 <td id="td" class="text-xs-center">{{ props.index + 1}}</td> 219 <td id="td" class="text-xs-center">{{ props.index + 1}}</td>
220 <td id="td" class="text-xs-center">{{ props.item.name }}</td> 220 <td id="td" class="text-xs-center">{{ props.item.name }}</td>
221 <td id="td" class="text-xs-center">{{ props.item.author }}</td> 221 <td id="td" class="text-xs-center">{{ props.item.author }}</td>
222 <td id="td" class="text-xs-center">{{ props.item.subjectCode }}</td> 222 <td id="td" class="text-xs-center">{{ props.item.subjectCode }}</td>
223 <td id="td" class="text-xs-center">{{ props.item.price }}</td> 223 <td id="td" class="text-xs-center">{{ props.item.price }}</td>
224 <td id="td" class="text-xs-center">{{ props.item.quantity }}</td> 224 <td id="td" class="text-xs-center">{{ props.item.quantity }}</td>
225 <td id="td" class="text-xs-center">{{ props.item.rackNo }}</td> 225 <td id="td" class="text-xs-center">{{ props.item.rackNo }}</td>
226 <td id="td" class="text-xs-center">{{ props.item.status }}</td> 226 <td id="td" class="text-xs-center">
227 <span class="green lighten-1 pa-2 white--text paymentStatus">{{ props.item.status }}</span>
228 </td>
227 <!-- <td id="td" class="text-xs-center">{{ props.item.session}}</td> --> 229 <!-- <td id="td" class="text-xs-center">{{ props.item.session}}</td> -->
228 230
229 <td class="text-xs-center"> 231 <td class="text-xs-center">
230 <span> 232 <span>
231 <img 233 <img
232 style="cursor:pointer; width:25px; height:18px; " 234 style="cursor:pointer; width:25px; height:18px; "
233 class="mr-5" 235 class="mr-5"
234 @click="profile(props.item)" 236 @click="profile(props.item)"
235 src="/static/icon/eye1.png" 237 src="/static/icon/eye1.png"
236 /> 238 />
237 <img 239 <img
238 style="cursor:pointer; width:20px; height:18px; " 240 style="cursor:pointer; width:20px; height:18px; "
239 class="mr-5" 241 class="mr-5"
240 @click="editItem(props.item)" 242 @click="editItem(props.item)"
241 src="/static/icon/edit1.png" 243 src="/static/icon/edit1.png"
242 /> 244 />
243 <img 245 <img
244 style="cursor:pointer; width:20px; height:20px; " 246 style="cursor:pointer; width:20px; height:20px; "
245 class="mr-5" 247 class="mr-5"
246 @click="deleteItem(props.item)" 248 @click="deleteItem(props.item)"
247 src="/static/icon/delete1.png" 249 src="/static/icon/delete1.png"
248 /> 250 />
249 </span> 251 </span>
250 </td> 252 </td>
251 </template> 253 </template>
252 <v-alert 254 <v-alert
253 slot="no-results" 255 slot="no-results"
254 :value="true" 256 :value="true"
255 color="error" 257 color="error"
256 icon="warning" 258 icon="warning"
257 >Your search for "{{ search }}" found no results.</v-alert> 259 >Your search for "{{ search }}" found no results.</v-alert>
258 </v-data-table> 260 </v-data-table>
259 </v-tab-item> 261 </v-tab-item>
260 262
261 <!-- ****** ADD multiple Students ****** --> 263 <!-- ****** ADD multiple Students ****** -->
262 264
263 <v-tab-item> 265 <v-tab-item>
264 <v-container> 266 <v-container>
265 <v-snackbar 267 <v-snackbar
266 :timeout="timeout" 268 :timeout="timeout"
267 :top="y === 'top'" 269 :top="y === 'top'"
268 :right="x === 'right'" 270 :right="x === 'right'"
269 :vertical="mode === 'vertical'" 271 :vertical="mode === 'vertical'"
270 v-model="snackbar" 272 v-model="snackbar"
271 color="success" 273 color="success"
272 >{{ text }}</v-snackbar> 274 >{{ text }}</v-snackbar>
273 <v-flex xs12 sm8 offset-sm2 class="top"> 275 <v-flex xs12 sm8 offset-sm2 class="top">
274 <v-card flat> 276 <v-card flat>
275 <v-container fluid fill-height> 277 <v-container fluid fill-height>
276 <v-layout align-center> 278 <v-layout align-center>
277 <v-flex xs12 class="mt-4"> 279 <v-flex xs12 class="mt-4">
278 <v-form ref="form" v-model="valid" lazy-validation> 280 <v-form ref="form" v-model="valid" lazy-validation>
279 <v-layout> 281 <v-layout>
280 <v-flex xs4 class="pt-4 subheading"> 282 <v-flex xs4 class="pt-4 subheading">
281 <label class="right">Name:</label> 283 <label class="right">Name:</label>
282 </v-flex> 284 </v-flex>
283 <v-flex xs6 class="ml-3"> 285 <v-flex xs6 class="ml-3">
284 <v-text-field 286 <v-text-field
285 v-model="BooksData.name" 287 v-model="BooksData.name"
286 placeholder="fill your Name" 288 placeholder="fill your Name"
287 type="text" 289 type="text"
288 :rules="nameRules" 290 :rules="nameRules"
289 required 291 required
290 ></v-text-field> 292 ></v-text-field>
291 </v-flex> 293 </v-flex>
292 </v-layout> 294 </v-layout>
293 <v-layout> 295 <v-layout>
294 <v-flex xs4 class="pt-4 subheading"> 296 <v-flex xs4 class="pt-4 subheading">
295 <label class="right">Author:</label> 297 <label class="right">Author:</label>
296 </v-flex> 298 </v-flex>
297 <v-flex xs6 class="ml-3"> 299 <v-flex xs6 class="ml-3">
298 <v-text-field 300 <v-text-field
299 v-model="BooksData.author" 301 v-model="BooksData.author"
300 placeholder="fill your Author Name" 302 placeholder="fill your Author Name"
301 type="text" 303 type="text"
302 :rules="authorRules" 304 :rules="authorRules"
303 required 305 required
304 ></v-text-field> 306 ></v-text-field>
305 </v-flex> 307 </v-flex>
306 </v-layout> 308 </v-layout>
307 <v-layout> 309 <v-layout>
308 <v-flex xs4 class="pt-4 subheading"> 310 <v-flex xs4 class="pt-4 subheading">
309 <label class="right">Subject Code :</label> 311 <label class="right">Subject Code :</label>
310 </v-flex> 312 </v-flex>
311 <v-flex xs6 class="ml-3"> 313 <v-flex xs6 class="ml-3">
312 <v-text-field 314 <v-text-field
313 v-model="BooksData.subjectCode" 315 v-model="BooksData.subjectCode"
314 placeholder="fill your Subject Code" 316 placeholder="fill your Subject Code"
315 type="text" 317 type="text"
316 :rules="subjectRules" 318 :rules="subjectRules"
317 required 319 required
318 ></v-text-field> 320 ></v-text-field>
319 </v-flex> 321 </v-flex>
320 </v-layout> 322 </v-layout>
321 <v-layout> 323 <v-layout>
322 <v-flex xs4 class="pt-4 subheading"> 324 <v-flex xs4 class="pt-4 subheading">
323 <label class="right">Price:</label> 325 <label class="right">Price:</label>
324 </v-flex> 326 </v-flex>
325 <v-flex xs6 class="ml-3"> 327 <v-flex xs6 class="ml-3">
326 <v-text-field 328 <v-text-field
327 v-model="BooksData.price" 329 v-model="BooksData.price"
328 placeholder="fill your Price" 330 placeholder="fill your Price"
329 :rules="priceRules" 331 :rules="priceRules"
330 required 332 required
331 ></v-text-field> 333 ></v-text-field>
332 </v-flex> 334 </v-flex>
333 </v-layout> 335 </v-layout>
334 <v-layout> 336 <v-layout>
335 <v-flex xs4 class="pt-4 subheading"> 337 <v-flex xs4 class="pt-4 subheading">
336 <label class="right">Quantity:</label> 338 <label class="right">Quantity:</label>
337 </v-flex> 339 </v-flex>
338 <v-flex xs6 class="ml-3"> 340 <v-flex xs6 class="ml-3">
339 <v-text-field 341 <v-text-field
340 v-model="BooksData.quantity" 342 v-model="BooksData.quantity"
341 placeholder="fill your Quantity" 343 placeholder="fill your Quantity"
342 :rules="quantityRules" 344 :rules="quantityRules"
343 required 345 required
344 ></v-text-field> 346 ></v-text-field>
345 </v-flex> 347 </v-flex>
346 </v-layout> 348 </v-layout>
347 <v-layout> 349 <v-layout>
348 <v-flex xs4 class="pt-4 subheading"> 350 <v-flex xs4 class="pt-4 subheading">
349 <label class="right">Rack No:</label> 351 <label class="right">Rack No:</label>
350 </v-flex> 352 </v-flex>
351 <v-flex xs6 class="ml-3"> 353 <v-flex xs6 class="ml-3">
352 <v-text-field 354 <v-text-field
353 v-model="BooksData.rackNo" 355 v-model="BooksData.rackNo"
354 placeholder="fill your Rack No" 356 placeholder="fill your Rack No"
355 :rules="rackNoRules" 357 :rules="rackNoRules"
356 required 358 required
357 ></v-text-field> 359 ></v-text-field>
358 </v-flex> 360 </v-flex>
359 </v-layout> 361 </v-layout>
360 <v-layout> 362 <v-layout>
361 <v-flex xs12 sm9 offset-sm2> 363 <v-flex xs12 sm9 offset-sm2>
362 <v-card-actions> 364 <v-card-actions>
363 <v-btn @click="clear" round dark>clear</v-btn> 365 <v-btn @click="clear" round dark>clear</v-btn>
364 <v-spacer></v-spacer> 366 <v-spacer></v-spacer>
365 <v-btn @click="submit" round dark :loading="loading">Add</v-btn> 367 <v-btn @click="submit" round dark :loading="loading">Add</v-btn>
366 </v-card-actions> 368 </v-card-actions>
367 </v-flex> 369 </v-flex>
368 </v-layout> 370 </v-layout>
369 </v-form> 371 </v-form>
370 </v-flex> 372 </v-flex>
371 </v-layout> 373 </v-layout>
372 </v-container> 374 </v-container>
373 </v-card> 375 </v-card>
374 </v-flex> 376 </v-flex>
375 </v-container> 377 </v-container>
376 </v-tab-item> 378 </v-tab-item>
377 </v-tabs> 379 </v-tabs>
378 <div class="loader" v-if="showLoader"> 380 <div class="loader" v-if="showLoader">
379 <v-progress-circular indeterminate color="white"></v-progress-circular> 381 <v-progress-circular indeterminate color="white"></v-progress-circular>
380 </div> 382 </div>
381 </v-app> 383 </v-app>
382 </template> 384 </template>
383 385
384 <script> 386 <script>
385 import http from "@/Services/http.js"; 387 import http from "@/Services/http.js";
386 import Util from "@/util"; 388 import Util from "@/util";
387 389
388 export default { 390 export default {
389 data: () => ({ 391 data: () => ({
390 snackbar: false, 392 snackbar: false,
391 y: "top", 393 y: "top",
392 x: "right", 394 x: "right",
393 mode: "", 395 mode: "",
394 timeout: 3000, 396 timeout: 3000,
395 text: "", 397 text: "",
396 showLoader: false, 398 showLoader: false,
397 loading: false, 399 loading: false,
398 date: null, 400 date: null,
399 search: "", 401 search: "",
400 dialog: false, 402 dialog: false,
401 dialog1: false, 403 dialog1: false,
402 valid: true, 404 valid: true,
403 validEdit: true, 405 validEdit: true,
404 isActive: true, 406 isActive: true,
405 newActive: false, 407 newActive: false,
406 pagination: { 408 pagination: {
407 rowsPerPage: 15 409 rowsPerPage: 15
408 }, 410 },
409 nameRules: [v => !!v || " Name is required"], 411 nameRules: [v => !!v || " Name is required"],
410 authorRules: [v => !!v || "Author Name Monthly"], 412 authorRules: [v => !!v || "Author Name Monthly"],
411 subjectRules: [v => !!v || "Subject Code is required"], 413 subjectRules: [v => !!v || "Subject Code is required"],
412 priceRules: [v => !!v || "Price is required"], 414 priceRules: [v => !!v || "Price is required"],
413 quantityRules: [v => !!v || "Quantity is required"], 415 quantityRules: [v => !!v || "Quantity is required"],
414 rackNoRules: [v => !!v || "Rack No. is required"], 416 rackNoRules: [v => !!v || "Rack No. is required"],
415 417
416 headers: [ 418 headers: [
417 { 419 {
418 text: "No", 420 text: "No",
419 align: "center", 421 align: "center",
420 sortable: false, 422 sortable: false,
421 value: "No" 423 value: "No"
422 }, 424 },
423 { 425 {
424 text: "Name", 426 text: "Name",
425 value: "name", 427 value: "name",
426 sortable: false, 428 sortable: false,
427 align: "center" 429 align: "center"
428 }, 430 },
429 { text: "Authour", value: "author", sortable: false, align: "center" }, 431 { text: "Authour", value: "author", sortable: false, align: "center" },
430 { 432 {
431 text: "Subject Code", 433 text: "Subject Code",
432 value: "subjectCode", 434 value: "subjectCode",
433 sortable: false, 435 sortable: false,
434 align: "center" 436 align: "center"
435 }, 437 },
436 { text: "Price", value: "price", sortable: false, align: "center" }, 438 { text: "Price", value: "price", sortable: false, align: "center" },
437 { text: "Quantity", value: "quantity", sortable: false, align: "center" }, 439 { text: "Quantity", value: "quantity", sortable: false, align: "center" },
438 { text: "Rack No", value: "rackNo", sortable: false, align: "center" }, 440 { text: "Rack No", value: "rackNo", sortable: false, align: "center" },
439 { text: "Status", value: "status", sortable: false, align: "center" }, 441 { text: "Status", value: "status", sortable: false, align: "center" },
440 442
441 // { text: "Session", value: "session", sortable: false, align: "center" }, 443 // { text: "Session", value: "session", sortable: false, align: "center" },
442 { text: "Action", value: "", sortable: false, align: "center" } 444 { text: "Action", value: "", sortable: false, align: "center" }
443 ], 445 ],
444 bookData: [], 446 bookData: [],
445 select: "", 447 select: "",
446 token: "", 448 token: "",
447 editedItem: {}, 449 editedItem: {},
448 BooksData: {} 450 BooksData: {}
449 }), 451 }),
450 methods: { 452 methods: {
451 getBookData() { 453 getBookData() {
452 this.showLoader = true; 454 this.showLoader = true;
453 http() 455 http()
454 .get("/getBooksList", { 456 .get("/getBooksList", {
455 headers: { Authorization: "Bearer " + this.token } 457 headers: { Authorization: "Bearer " + this.token }
456 }) 458 })
457 .then(response => { 459 .then(response => {
458 this.bookData = response.data.data; 460 this.bookData = response.data.data;
459 this.showLoader = false; 461 this.showLoader = false;
460 // console.log("getAllfeetypes=====>",response.data.data) 462 // console.log("getAllfeetypes=====>",response.data.data)
461 }) 463 })
462 .catch(error => { 464 .catch(error => {
463 // console.log("err====>", err); 465 // console.log("err====>", err);
464 this.showLoader = false; 466 this.showLoader = false;
465 if (error.response.status === 401) { 467 if (error.response.status === 401) {
466 this.$router.replace({ path: "/" }); 468 this.$router.replace({ path: "/" });
467 this.$store.dispatch("setToken", null); 469 this.$store.dispatch("setToken", null);
468 this.$store.dispatch("Id", null); 470 this.$store.dispatch("Id", null);
469 } 471 }
470 }); 472 });
471 }, 473 },
472 editItem(item) { 474 editItem(item) {
473 this.editedIndex = this.bookData.indexOf(item); 475 this.editedIndex = this.bookData.indexOf(item);
474 this.editedItem = Object.assign({}, item); 476 this.editedItem = Object.assign({}, item);
475 console.log(this.editedItem); 477 console.log(this.editedItem);
476 this.dialog = true; 478 this.dialog = true;
477 }, 479 },
478 profile(item) { 480 profile(item) {
479 this.editedIndex = this.bookData.indexOf(item); 481 this.editedIndex = this.bookData.indexOf(item);
480 this.editedItem = Object.assign({}, item); 482 this.editedItem = Object.assign({}, item);
481 this.dialog1 = true; 483 this.dialog1 = true;
482 }, 484 },
483 deleteItem(item) { 485 deleteItem(item) {
484 let deleteStudent = { 486 let deleteStudent = {
485 bookId: item._id 487 bookId: item._id
486 }; 488 };
487 http() 489 http()
488 .delete( 490 .delete(
489 "/deleteBook", 491 "/deleteBook",
490 confirm("Are you sure you want to delete this?") && { 492 confirm("Are you sure you want to delete this?") && {
491 params: deleteStudent 493 params: deleteStudent
492 } 494 }
493 ) 495 )
494 .then(response => { 496 .then(response => {
495 if ((this.snackbar = true)) { 497 if ((this.snackbar = true)) {
496 this.text = "Successfully delete Existing Delete Student "; 498 this.text = "Successfully delete Existing Delete Student ";
497 } 499 }
498 this.getBookData(); 500 this.getBookData();
499 }) 501 })
500 .catch(error => { 502 .catch(error => {
501 // console.log(error); 503 // console.log(error);
502 }); 504 });
503 }, 505 },
504 activeTab(type) { 506 activeTab(type) {
505 switch (type) { 507 switch (type) {
506 case "existing": 508 case "existing":
507 this.newActive = false; 509 this.newActive = false;
508 this.isActive = true; 510 this.isActive = true;
509 break; 511 break;
510 512
511 default: 513 default:
512 this.newActive = true; 514 this.newActive = true;
513 this.isActive = false; 515 this.isActive = false;
514 break; 516 break;
515 } 517 }
516 }, 518 },
517 close() { 519 close() {
518 this.dialog = false; 520 this.dialog = false;
519 setTimeout(() => { 521 setTimeout(() => {
520 this.editedItem = Object.assign({}, this.defaultItem); 522 this.editedItem = Object.assign({}, this.defaultItem);
521 this.editedIndex = -1; 523 this.editedIndex = -1;
522 }, 300); 524 }, 300);
523 }, 525 },
524 close1() { 526 close1() {
525 this.dialog1 = false; 527 this.dialog1 = false;
526 }, 528 },
527 close2() { 529 close2() {
528 this.dialog2 = false; 530 this.dialog2 = false;
529 }, 531 },
530 submit() { 532 submit() {
531 this.BooksData.quantity = Number(this.BooksData.quantity); 533 this.BooksData.quantity = Number(this.BooksData.quantity);
532 if (this.$refs.form.validate()) { 534 if (this.$refs.form.validate()) {
533 this.loading = true; 535 this.loading = true;
534 http() 536 http()
535 .post("/createBook", this.BooksData) 537 .post("/createBook", this.BooksData)
536 .then(response => { 538 .then(response => {
537 console.log(response); 539 console.log(response);
538 this.getBookData(); 540 this.getBookData();
539 if ((this.snackbar = true)) { 541 if ((this.snackbar = true)) {
540 this.text = "New Book added successfully"; 542 this.text = "New Book added successfully";
541 } 543 }
542 544
543 this.clear(); 545 this.clear();
544 this.loading = false; 546 this.loading = false;
545 }) 547 })
546 .catch(error => { 548 .catch(error => {
547 // console.log(error); 549 // console.log(error);
548 if ((this.snackbar = true)) { 550 if ((this.snackbar = true)) {
549 this.text = error.response.data.message; 551 this.text = error.response.data.message;
550 } 552 }
551 this.loading = false; 553 this.loading = false;
552 }); 554 });
553 } 555 }
554 }, 556 },
555 clear() { 557 clear() {
556 this.$refs.form.reset(); 558 this.$refs.form.reset();
557 }, 559 },
558 save() { 560 save() {
559 this.editedItem.bookId = this.editedItem._id; 561 this.editedItem.bookId = this.editedItem._id;
560 http() 562 http()
561 .put("/updateBook", this.editedItem) 563 .put("/updateBook", this.editedItem)
562 .then(response => { 564 .then(response => {
563 if ((this.snackbar = true)) { 565 if ((this.snackbar = true)) {
564 this.text = "Successfully Edit Existing Book"; 566 this.text = "Successfully Edit Existing Book";
565 } 567 }
566 this.getBookData(); 568 this.getBookData();
567 this.close(); 569 this.close();
568 }) 570 })
569 .catch(error => { 571 .catch(error => {
570 this.text = error.response.data.message; 572 this.text = error.response.data.message;
571 // console.log(error); 573 // console.log(error);
572 }); 574 });
573 } 575 }
574 }, 576 },
575 mounted() { 577 mounted() {
576 this.token = this.$store.state.token; 578 this.token = this.$store.state.token;
577 this.getBookData(); 579 this.getBookData();
578 }, 580 },
579 created() { 581 created() {
580 this.$root.$on("app:search", search => { 582 this.$root.$on("app:search", search => {
581 this.search = search; 583 this.search = search;
582 }); 584 });
583 }, 585 },
584 beforeDestroy() { 586 beforeDestroy() {
585 // dont forget to remove the listener 587 // dont forget to remove the listener
586 this.$root.$off("app:search"); 588 this.$root.$off("app:search");
587 } 589 }
588 }; 590 };
589 </script> 591 </script>
590 592
591 <style scoped> 593 <style scoped>
592 .active { 594 .active {
593 background-color: gray; 595 background-color: gray;
594 color: white !important; 596 color: white !important;
595 } 597 }
596 .activebtn { 598 .activebtn {
597 color: black !important; 599 color: black !important;
598 } 600 }
599 </style> 601 </style>
src/pages/Library/issue.vue
1 <template> 1 <template>
2 <v-app id="pages-dasboard"> 2 <v-app id="pages-dasboard">
3 <v-tabs grow slider-color="gray"> 3 <v-tabs grow slider-color="gray">
4 <v-tab 4 <v-tab
5 ripple 5 ripple
6 @click="activeTab('existing')" 6 @click="activeTab('existing')"
7 v-bind:class="{ active: isActive }" 7 v-bind:class="{ active: isActive }"
8 id="tab" 8 id="tab"
9 class="subheading" 9 class="subheading"
10 >Existing Issue</v-tab> 10 >Existing Issue</v-tab>
11 <v-tab 11 <v-tab
12 ripple 12 ripple
13 @click="activeTab('new')" 13 @click="activeTab('new')"
14 v-bind:class="{ active: newActive }" 14 v-bind:class="{ active: newActive }"
15 id="tab1" 15 id="tab1"
16 User 16 User
17 class="subheading" 17 class="subheading"
18 >Add Issue</v-tab> 18 >Add Issue a book</v-tab>
19 19
20 <!-- ****** EDIT ISSUE ****** --> 20 <!-- ****** EDIT ISSUE ****** -->
21 21
22 <v-tab-item> 22 <v-tab-item>
23 <v-snackbar 23 <v-snackbar
24 :timeout="timeout" 24 :timeout="timeout"
25 :top="y === 'top'" 25 :top="y === 'top'"
26 :right="x === 'right'" 26 :right="x === 'right'"
27 :vertical="mode === 'vertical'" 27 :vertical="mode === 'vertical'"
28 v-model="snackbar" 28 v-model="snackbar"
29 color="success" 29 color="success"
30 >{{ text }}</v-snackbar> 30 >{{ text }}</v-snackbar>
31 <v-dialog v-model="dialog" max-width="1000px" scrollable> 31 <v-dialog v-model="dialog" max-width="1000px" scrollable>
32 <v-card flat> 32 <v-card flat>
33 <v-toolbar class="grey lighten-2" flat> 33 <v-toolbar class="grey lighten-2" flat>
34 <v-spacer></v-spacer> 34 <v-spacer></v-spacer>
35 <v-toolbar-title> 35 <v-toolbar-title>
36 <h3>Edit Issue</h3> 36 <h3>Edit Issue</h3>
37 </v-toolbar-title> 37 </v-toolbar-title>
38 <v-spacer></v-spacer> 38 <v-spacer></v-spacer>
39 </v-toolbar> 39 </v-toolbar>
40 <v-card-text style="height:600px;"> 40 <v-card-text style="height:600px;">
41 <v-form ref="form"> 41 <v-form ref="form">
42 <v-container fluid> 42 <v-container fluid>
43 <!-- <v-layout row> 43 <v-layout>
44 <v-flex 44 <v-flex xs12 sm12>
45 xs12 45 <v-layout>
46 class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4" 46 <v-flex xs4 class="pt-4 subheading">
47 > 47 <label class="right">Library Id:</label>
48 <input
49 type="file"
50 style="display: none"
51 ref="image"
52 accept="image/*"
53 multiple
54 @change="onFilePicked"
55 />
56 <v-layout justify-center>
57 <v-flex
58 xs3
59 v-for="Image in editedItem.newsImageUrl"
60 :key="Image._id"
61 v-if="editedItem.newsImageUrl"
62 class="profile-image-wrapper"
63 >
64 <img
65 :src="Image.imageUrl"
66 height="160"
67 width="160"
68 alt="Issue"
69 class="pa-2"
70 />
71 <v-icon
72 class="red edit-profile-icon"
73 dark
74 @click="deleteImage(Image._id,editedItem._id)"
75 >close</v-icon>
76 </v-flex> 48 </v-flex>
77 <v-flex v-for="(file, index) in files" :key="index"> 49 <v-flex xs5 class="ml-3">
78 <img :src="file" height="160" width="160" class="pa-2" /> 50 <v-text-field
51 v-model="editedItem.libraryId"
52 placeholder="fill your Library Id"
53 name="name"
54 type="text"
55 ></v-text-field>
79 </v-flex> 56 </v-flex>
80 </v-layout> 57 </v-layout>
81 <img
82 src="/static/icon/user.png"
83 v-if="editedItem.newsImageUrl ==''"
84 height="160"
85 width="160"
86 alt="Issue"
87 />
88 </v-flex> 58 </v-flex>
89 </v-layout>-->
90 <v-layout>
91 <v-flex xs12 sm12> 59 <v-flex xs12 sm12>
92 <v-layout> 60 <v-layout>
93 <v-flex xs4 class="pt-4 subheading"> 61 <v-flex xs4 class="pt-4 subheading">
94 <label class="right">Title:</label> 62 <label class="right">Book:</label>
95 </v-flex> 63 </v-flex>
96 <v-flex xs5 class="ml-3"> 64 <v-flex xs5 class="ml-3">
97 <v-text-field 65 <v-text-field
98 v-model="editedItem.title" 66 v-model="editedItem.name"
99 placeholder="fill your Title" 67 placeholder="fill your Book name"
100 name="name" 68 name="name"
101 type="text" 69 type="text"
102 required
103 ></v-text-field> 70 ></v-text-field>
104 </v-flex> 71 </v-flex>
105 </v-layout> 72 </v-layout>
106 </v-flex> 73 </v-flex>
107 <v-flex xs12 sm12> 74 <v-flex xs12 sm12>
108 <v-layout> 75 <v-layout>
109 <v-flex xs4 class="pt-4 subheading"> 76 <v-flex xs4 class="pt-4 subheading">
110 <label class="right">Description:</label> 77 <label class="right">Author:</label>
78 </v-flex>
79 <v-flex xs5 class="ml-3">
80 <v-text-field
81 placeholder="fill your Author Name"
82 v-model="editedItem.author"
83 type="text"
84 ></v-text-field>
85 </v-flex>
86 </v-layout>
87 </v-flex>
88 <v-flex xs12 sm12>
89 <v-layout>
90 <v-flex xs4 class="pt-4 subheading">
91 <label class="right">Subject Code:</label>
111 </v-flex> 92 </v-flex>
112 <v-flex xs5 class="ml-3"> 93 <v-flex xs5 class="ml-3">
113 <v-text-field 94 <v-text-field
114 placeholder="fill your Description" 95 placeholder="fill your Subject Codes"
115 v-model="editedItem.description" 96 v-model="editedItem.subjectCode"
116 type="text" 97 type="text"
117 name="email"
118 required
119 ></v-text-field> 98 ></v-text-field>
120 </v-flex> 99 </v-flex>
121 </v-layout> 100 </v-layout>
122 </v-flex> 101 </v-flex>
123 <v-flex xs12> 102 <v-flex xs12 sm12>
124 <v-layout> 103 <v-layout>
125 <v-flex xs4 class="pt-4 subheading"> 104 <v-flex xs4 class="pt-4 subheading">
126 <label class="right">Add New Images:</label> 105 <label class="right">Serial Number:</label>
127 </v-flex> 106 </v-flex>
128 <v-flex xs5 class="ml-3"> 107 <v-flex xs5 class="ml-3">
129 <!-- <v-text-field 108 <v-text-field
130 label="Select Image" 109 placeholder="fill your Serial Number"
131 @click="pickFile" 110 v-model="editedItem.serialNumber"
132 v-model="imageName" 111 type="text"
133 append-icon="attach_file" 112 ></v-text-field>
134 multiple
135 ></v-text-field>-->
136 </v-flex> 113 </v-flex>
137 </v-layout> 114 </v-layout>
138 </v-flex> 115 </v-flex>
116 <v-flex xs12 sm12>
117 <v-layout>
118 <v-flex xs4 class="pt-4 subheading">
119 <label class="right">due Date:</label>
120 </v-flex>
121 <v-flex xs5 class="ml-3">
122 <v-menu
123 ref="menu1"
124 :close-on-content-click="false"
125 v-model="menu1"
126 :nudge-right="40"
127 :return-value.sync="menu1"
128 lazy
129 transition="scale-transition"
130 offset-y
131 full-width
132 min-width="290px"
133 >
134 <v-text-field
135 slot="activator"
136 v-model="editedItem.dueDate"
137 label="Select Due Date"
138 append-icon="event"
139 readonly
140 ></v-text-field>
141 <v-date-picker v-model="editedItem.dueDate" @input="menu1 = false"></v-date-picker>
142 </v-menu>
143 </v-flex>
144 </v-layout>
145 </v-flex>
146 <v-flex xs12 sm12>
147 <v-layout>
148 <v-flex xs4 class="pt-4 subheading">
149 <label class="right">Note:</label>
150 </v-flex>
151 <v-flex xs5 class="ml-3">
152 <v-text-field
153 placeholder="fill your Serial Number"
154 v-model="editedItem.note"
155 type="text"
156 ></v-text-field>
157 </v-flex>
158 </v-layout>
159 </v-flex>
160 <!-- <v-flex xs12 sm12>
161 <v-layout>
162 <v-flex xs4 class="pt-4 subheading">
163 <label class="right">Satus:</label>
164 </v-flex>
165 <v-flex xs5 class="ml-3">
166 <v-text-field
167 placeholder="fill your Serial Number"
168 v-model="editedItem.status"
169 type="text"
170 ></v-text-field>
171 </v-flex>
172 </v-layout>
173 </v-flex>-->
139 </v-layout> 174 </v-layout>
140 <v-layout> 175 <v-layout>
141 <v-flex xs12 sm8 offset-sm2> 176 <v-flex xs12 sm8 offset-sm2>
142 <v-card-actions> 177 <v-card-actions>
143 <v-btn round dark @click.native="close">Cancel</v-btn> 178 <v-btn round dark @click.native="close">Cancel</v-btn>
144 <v-spacer></v-spacer> 179 <v-spacer></v-spacer>
145 <v-btn round dark @click="save">Save</v-btn> 180 <v-btn round dark @click="save">Save</v-btn>
146 </v-card-actions> 181 </v-card-actions>
147 </v-flex> 182 </v-flex>
148 </v-layout> 183 </v-layout>
149 </v-container> 184 </v-container>
150 </v-form> 185 </v-form>
151 </v-card-text> 186 </v-card-text>
152 </v-card> 187 </v-card>
153 </v-dialog> 188 </v-dialog>
154 189
155 <!-- ****** PROFILE VIEW ALL Issue DEATILS ****** --> 190 <!-- ****** PROFILE VIEW ALL Issue DEATILS ****** -->
156 191
157 <v-dialog v-model="dialog1" max-width="800px"> 192 <v-dialog v-model="dialog1" max-width="800px">
158 <v-card> 193 <v-card>
159 <v-toolbar color="grey lighten-2" flat> 194 <v-toolbar color="grey lighten-2" flat>
160 <v-spacer></v-spacer> 195 <v-spacer></v-spacer>
161 <v-toolbar-title> 196 <v-toolbar-title>
162 <h3>Issue</h3> 197 <h3>Issue a Book</h3>
163 </v-toolbar-title> 198 </v-toolbar-title>
164 <v-spacer></v-spacer> 199 <v-spacer></v-spacer>
165 <v-icon @click="close1">close</v-icon> 200 <v-icon @click="close1">close</v-icon>
166 </v-toolbar> 201 </v-toolbar>
167 <!-- <v-flex align-center justify-center layout text-xs-center>
168 <v-avatar size="50px" style="position:absolute; top:20px;">
169 <img src="/static/icon/user.png">
170 </v-avatar>
171 <span v-for="(image,i) in editedItem.newsImageUrl" :key="i" class="mt-4 pa-2">
172 <img :src="image.imageUrl" alt="Issue" width="240" height="180" />
173 </span>
174 </v-flex>-->
175 <v-card-text> 202 <v-card-text>
176 <v-container grid-list-md> 203 <v-container grid-list-md>
177 <v-layout wrap> 204 <v-layout wrap>
178 <v-flex> 205 <v-flex>
179 <v-layout> 206 <v-layout>
180 <v-flex xs5 sm6> 207 <v-flex xs5 sm6>
181 <h5 class="right my-1"> 208 <h5 class="right my-1">
182 <b>Title:</b> 209 <b>Book:</b>
183 </h5> 210 </h5>
184 </v-flex> 211 </v-flex>
185 <v-flex sm6 xs8> 212 <v-flex sm6 xs8>
186 <h5 class="my-1">{{ editedItem.title }}</h5> 213 <h5 class="my-1">{{ editedItem.name }}</h5>
187 </v-flex> 214 </v-flex>
188 </v-layout> 215 </v-layout>
189 <v-layout> 216 <v-layout>
190 <v-flex xs5 sm6> 217 <v-flex xs5 sm6>
191 <h5 class="right my-1"> 218 <h5 class="right my-1">
192 <b>Description:</b> 219 <b>Serial Number:</b>
193 </h5> 220 </h5>
194 </v-flex> 221 </v-flex>
195 <v-flex sm6 xs8> 222 <v-flex sm6 xs8>
196 <h5 class="my-1">{{ editedItem.description }}</h5> 223 <h5 class="my-1">{{ editedItem.serialNumber }}</h5>
224 </v-flex>
225 </v-layout>
226 <v-layout>
227 <v-flex xs5 sm6>
228 <h5 class="right my-1">
229 <b>Issue date:</b>
230 </h5>
231 </v-flex>
232 <v-flex sm6 xs8>
233 <h5 class="my-1">{{ dates(editedItem.creted) }}</h5>
234 </v-flex>
235 </v-layout>
236 <v-layout>
237 <v-flex xs5 sm6>
238 <h5 class="right my-1">
239 <b>Due date:</b>
240 </h5>
241 </v-flex>
242 <v-flex sm6 xs8>
243 <h5 class="my-1">{{ dates(editedItem.dueDate) }}</h5>
244 </v-flex>
245 </v-layout>
246 <v-layout>
247 <v-flex xs5 sm6>
248 <h5 class="right my-1">
249 <b>Status:</b>
250 </h5>
251 </v-flex>
252 <v-flex sm6 xs8>
253 <h5 class="my-1">{{ editedItem.status }}</h5>
197 </v-flex> 254 </v-flex>
198 </v-layout> 255 </v-layout>
199 </v-flex> 256 </v-flex>
200 </v-layout> 257 </v-layout>
201 </v-container> 258 </v-container>
202 </v-card-text> 259 </v-card-text>
203 </v-card> 260 </v-card>
204 </v-dialog> 261 </v-dialog>
205 262
206 <v-snackbar 263 <v-snackbar
207 :timeout="timeout" 264 :timeout="timeout"
208 :top="y === 'top'" 265 :top="y === 'top'"
209 :right="x === 'right'" 266 :right="x === 'right'"
210 :vertical="mode === 'vertical'" 267 :vertical="mode === 'vertical'"
211 v-model="snackbar" 268 v-model="snackbar"
212 color="success" 269 color="success"
213 >{{ text }}</v-snackbar> 270 >{{ text }}</v-snackbar>
214 271
215 <!-- ****** EXISTING ISSUE TABLE****** --> 272 <!-- ****** EXISTING ISSUE TABLE****** -->
216 <v-card> 273 <v-card>
217 <v-layout> 274 <v-layout>
218 <v-flex lg1 xs4 md4 xl1 class="hidden-xs-only"> 275 <v-flex lg1 xs4 md4 xl1 class="hidden-xs-only">
219 <label class="right pt-4">Library ID:</label> 276 <label class="right pt-4">Library ID:</label>
220 </v-flex> 277 </v-flex>
221 <v-flex lg2 md3 xs7> 278 <v-flex lg2 md3 xs7>
222 <v-text-field 279 <v-text-field
223 class="pl-3" 280 class="pl-3"
224 @keyup.enter="searchLibrary" 281 @keyup.enter="getIssueList"
225 v-model="libraryId" 282 v-model="libraryId"
226 placeholder="fill your library Id" 283 placeholder="fill your library Id"
227 ></v-text-field> 284 ></v-text-field>
228 </v-flex> 285 </v-flex>
229 <v-flex lg9 md3 xs5> 286 <v-flex lg9 md3 xs5>
230 <v-btn 287 <v-btn
231 round 288 round
232 class="black mt-1 right hidden-xs-only" 289 class="black mt-1 right hidden-xs-only"
233 @click="searchLibrary" 290 @click="getIssueList"
234 :loading="loadingSearch" 291 :loading="loadingSearch"
235 dark 292 dark
236 >Search</v-btn> 293 >Search</v-btn>
237 <v-btn 294 <v-btn
238 round 295 round
239 class="black mt-4 right hidden-sm-only hidden-xl-only hidden-md-only hidden-lg-only" 296 class="black mt-4 right hidden-sm-only hidden-xl-only hidden-md-only hidden-lg-only"
240 :loading="loadingSearch" 297 :loading="loadingSearch"
241 @click="searchLibrary" 298 @click="getIssueList"
242 small 299 small
243 dark 300 dark
244 >Search</v-btn> 301 >Search</v-btn>
245 </v-flex> 302 </v-flex>
246 </v-layout> 303 </v-layout>
247 </v-card> 304 </v-card>
248 <v-data-table 305 <v-data-table
249 :headers="headers" 306 :headers="headers"
250 :items="desserts" 307 :items="desserts"
251 :pagination.sync="pagination" 308 :pagination.sync="pagination"
252 :search="search" 309 :search="search"
253 > 310 >
254 <template slot="items" slot-scope="props"> 311 <template slot="items" slot-scope="props" v-if="props.item.isReturn != true">
255 <td class="text-xs-center">{{ props.index + 1}}</td> 312 <td class="text-xs-center">{{ props.index + 1}}</td>
256 <td id="td" class="text-xs-center">{{ props.item.title}}</td> 313 <td id="td" class="text-xs-center">{{ props.item.bookId.name}}</td>
257 <td id="td" class="text-xs-center">{{ props.item.description}}</td> 314 <td id="td" class="text-xs-center">{{ props.item.serialNumber}}</td>
258 315 <td id="td" class="text-xs-center">{{ dates(props.item.created) }}</td>
316 <td id="td" class="text-xs-center">{{ dates(props.item.dueDate) }}</td>
317 <td id="td" class="text-xs-center">
318 <span
319 class="green lighten-1 pa-2 white--text paymentStatus"
320 >{{ props.item.bookId.status}}</span>
321 </td>
259 <td class="text-xs-center"> 322 <td class="text-xs-center">
260 <span> 323 <span>
261 <img 324 <img
262 style="cursor:pointer; width:25px; height:18px; " 325 style="cursor:pointer; width:25px; height:18px; "
263 class="mr-5" 326 class="mr-5"
264 @click="profile(props.item)" 327 @click="profile(props.item)"
265 src="/static/icon/eye1.png" 328 src="/static/icon/eye1.png"
266 /> 329 />
267 <img 330 <img
268 style="cursor:pointer; width:20px; height:18px; " 331 style="cursor:pointer; width:20px; height:18px; "
269 class="mr-5" 332 class="mr-5"
270 @click="editItem(props.item)" 333 @click="editItem(props.item)"
271 src="/static/icon/edit1.png" 334 src="/static/icon/edit1.png"
272 /> 335 />
273 <img 336 <img
274 style="cursor:pointer;width:20px; height:20px; " 337 style="cursor:pointer;width:20px; height:20px; "
275 class="mr-5" 338 class="mr-5"
276 @click="deleteItem(props.item)" 339 @click="returnBook(props.item)"
277 src="/static/icon/delete1.png" 340 src="/static/icon/return.jpg"
278 /> 341 />
279 </span> 342 </span>
280 </td> 343 </td>
281 </template> 344 </template>
282 <v-alert 345 <v-alert
283 slot="no-results" 346 slot="no-results"
284 :value="true" 347 :value="true"
285 color="error" 348 color="error"
286 icon="warning" 349 icon="warning"
287 >Your search for "{{ search }}" found no results.</v-alert> 350 >Your search for "{{ search }}" found no results.</v-alert>
288 </v-data-table> 351 </v-data-table>
289 </v-tab-item> 352 </v-tab-item>
290 353
291 <!-- ****** ADD Issue ****** --> 354 <!-- ****** ADD Issue ****** -->
292 355
293 <v-tab-item> 356 <v-tab-item>
294 <v-container> 357 <v-container>
295 <v-snackbar 358 <v-snackbar
296 :timeout="timeout" 359 :timeout="timeout"
297 :top="y === 'top'" 360 :top="y === 'top'"
298 :right="x === 'right'" 361 :right="x === 'right'"
299 :vertical="mode === 'vertical'" 362 :vertical="mode === 'vertical'"
300 v-model="snackbar" 363 v-model="snackbar"
301 :color="color" 364 :color="color"
302 >{{ text }}</v-snackbar> 365 >{{ text }}</v-snackbar>
303 <v-flex xs12 sm12 class="my-4"> 366 <v-flex xs12 sm12 class="my-4">
304 <v-card flat> 367 <v-card flat>
305 <v-form ref="form" v-model="valid" lazy-validation> 368 <v-form ref="form" v-model="valid" lazy-validation>
306 <v-container fluid> 369 <v-container fluid>
307 <v-flex xs12> 370 <v-flex xs12>
308 <v-layout> 371 <v-layout>
309 <v-flex xs4 class="pt-4 subheading"> 372 <v-flex xs4 class="pt-4 subheading">
310 <label class="right">Library ID:</label> 373 <label class="right">Library ID:</label>
311 </v-flex> 374 </v-flex>
312 <v-flex xs4 class="ml-3"> 375 <v-flex xs4 class="ml-3">
313 <v-text-field 376 <v-text-field
314 v-model="libraryID" 377 v-model="libraryID"
315 placeholder="fill your Library ID" 378 placeholder="fill your Library ID"
316 :rules="libraryIDRules" 379 :rules="libraryIDRules"
317 required 380 required
318 ></v-text-field> 381 ></v-text-field>
319 </v-flex> 382 </v-flex>
320 </v-layout> 383 </v-layout>
321 </v-flex> 384 </v-flex>
322 <v-flex xs12> 385 <v-flex xs12>
323 <v-layout> 386 <v-layout>
324 <v-flex xs4 class="pt-4 subheading"> 387 <v-flex xs4 class="pt-4 subheading">
325 <label class="right">Book:</label> 388 <label class="right">Book:</label>
326 </v-flex> 389 </v-flex>
327 <v-flex xs4 class="ml-3"> 390 <v-flex xs4 class="ml-3">
328 <v-select 391 <v-select
329 label="Select Book Name" 392 label="Select Book Name"
330 :rules="bookRules" 393 :rules="bookRules"
331 :items="books" 394 :items="books"
332 item-text="name" 395 item-text="name"
333 item-value="_id" 396 item-value="_id"
334 v-model="bookId" 397 v-model="bookId"
335 @change="getParticularBookData(bookId)" 398 @change="getParticularBookData(bookId)"
336 required 399 required
337 ></v-select> 400 ></v-select>
338 </v-flex> 401 </v-flex>
339 </v-layout> 402 </v-layout>
340 </v-flex> 403 </v-flex>
341 <v-flex xs12> 404 <v-flex xs12>
342 <v-layout> 405 <v-layout>
343 <v-flex xs4 class="pt-4 subheading"> 406 <v-flex xs4 class="pt-4 subheading">
344 <label class="right">Author:</label> 407 <label class="right">Author:</label>
345 </v-flex> 408 </v-flex>
346 <v-flex xs4 class="ml-3"> 409 <v-flex xs4 class="ml-3">
347 <v-text-field 410 <v-text-field
348 placeholder="fill your Author" 411 placeholder="fill your Author"
349 :rules="authorRules" 412 :rules="authorRules"
350 v-model="addIssue.author" 413 v-model="addIssue.author"
351 ></v-text-field> 414 ></v-text-field>
352 </v-flex> 415 </v-flex>
353 </v-layout> 416 </v-layout>
354 </v-flex> 417 </v-flex>
355 <v-flex xs12> 418 <v-flex xs12>
356 <v-layout> 419 <v-layout>
357 <v-flex xs4 class="pt-4 subheading"> 420 <v-flex xs4 class="pt-4 subheading">
358 <label class="right">Subject Code:</label> 421 <label class="right">Subject Code:</label>
359 </v-flex> 422 </v-flex>
360 <v-flex xs4 class="ml-3"> 423 <v-flex xs4 class="ml-3">
361 <v-text-field 424 <v-text-field
362 placeholder="fill your Subject Code" 425 placeholder="fill your Subject Code"
363 :rules="subjectCodeRules" 426 :rules="subjectCodeRules"
364 v-model="addIssue.subjectCode" 427 v-model="addIssue.subjectCode"
365 ></v-text-field> 428 ></v-text-field>
366 </v-flex> 429 </v-flex>
367 </v-layout> 430 </v-layout>
368 </v-flex> 431 </v-flex>
369 <v-flex xs12> 432 <v-flex xs12>
370 <v-layout> 433 <v-layout>
371 <v-flex xs4 class="pt-4 subheading"> 434 <v-flex xs4 class="pt-4 subheading">
372 <label class="right">Serial No:</label> 435 <label class="right">Serial No:</label>
373 </v-flex> 436 </v-flex>
374 <v-flex xs4 class="ml-3"> 437 <v-flex xs4 class="ml-3">
375 <v-text-field 438 <v-text-field
376 placeholder="fill your Serial No" 439 placeholder="fill your Serial No"
377 :rules="authorRules" 440 :rules="authorRules"
378 v-model="serialNo" 441 v-model="serialNo"
379 ></v-text-field> 442 ></v-text-field>
380 </v-flex> 443 </v-flex>
381 </v-layout> 444 </v-layout>
382 </v-flex> 445 </v-flex>
383 <v-flex xs12> 446 <v-flex xs12>
384 <v-layout> 447 <v-layout>
385 <v-flex xs4 class="pt-4 subheading"> 448 <v-flex xs4 class="pt-4 subheading">
386 <label class="right">Serial No:</label> 449 <label class="right">Due Date:</label>
387 </v-flex> 450 </v-flex>
388 <v-flex xs4 class="ml-3"> 451 <v-flex xs4 class="ml-3">
389 <v-menu 452 <v-menu
390 ref="menu2" 453 ref="menu2"
391 :close-on-content-click="false" 454 :close-on-content-click="false"
392 v-model="menu2" 455 v-model="menu2"
393 :nudge-right="40" 456 :nudge-right="40"
394 :return-value.sync="date" 457 :return-value.sync="date"
395 lazy 458 lazy
396 transition="scale-transition" 459 transition="scale-transition"
397 offset-y 460 offset-y
398 full-width 461 full-width
399 min-width="290px" 462 min-width="290px"
400 > 463 >
401 <v-text-field 464 <v-text-field
402 slot="activator" 465 slot="activator"
403 v-model="date" 466 v-model="date"
404 label="Picker without buttons" 467 label="Select Due Date"
405 append-icon="event" 468 append-icon="event"
406 readonly 469 readonly
407 ></v-text-field> 470 ></v-text-field>
408 <v-date-picker v-model="date" @input="$refs.menu2.save(date)"></v-date-picker> 471 <v-date-picker v-model="date" @input="$refs.menu2.save(date)"></v-date-picker>
409 </v-menu> 472 </v-menu>
410 </v-flex> 473 </v-flex>
411 </v-layout> 474 </v-layout>
412 </v-flex> 475 </v-flex>
413 <v-flex xs12> 476 <v-flex xs12>
414 <v-layout> 477 <v-layout>
415 <v-flex xs4 class="pt-4 subheading"> 478 <v-flex xs4 class="pt-4 subheading">
416 <label class="right">Note:</label> 479 <label class="right">Note:</label>
417 </v-flex> 480 </v-flex>
418 <v-flex xs4 class="ml-3"> 481 <v-flex xs4 class="ml-3">
419 <v-text-field 482 <v-text-field
420 placeholder="fill your Note" 483 placeholder="fill your Note"
421 :rules="noteRules" 484 :rules="noteRules"
422 v-model="note" 485 v-model="note"
423 ></v-text-field> 486 ></v-text-field>
424 </v-flex> 487 </v-flex>
425 </v-layout> 488 </v-layout>
426 </v-flex> 489 </v-flex>
427 <v-layout> 490 <v-layout>
428 <v-flex xs12 sm6 offset-sm3> 491 <v-flex xs12 sm6 offset-sm3>
429 <v-card-actions> 492 <v-card-actions>
430 <v-btn @click="clear" round dark>clear</v-btn> 493 <v-btn @click="clear" round dark>clear</v-btn>
431 <v-spacer></v-spacer> 494 <v-spacer></v-spacer>
432 <v-btn @click="submit" round dark :loading="loading" :disabled="disable">Add</v-btn> 495 <v-btn @click="submit" round dark :loading="loading" :disabled="disable">Add</v-btn>
433 </v-card-actions> 496 </v-card-actions>
434 </v-flex> 497 </v-flex>
435 </v-layout> 498 </v-layout>
436 </v-container> 499 </v-container>
437 </v-form> 500 </v-form>
438 </v-card> 501 </v-card>
439 </v-flex> 502 </v-flex>
440 </v-container> 503 </v-container>
441 </v-tab-item> 504 </v-tab-item>
442 </v-tabs> 505 </v-tabs>
443 <div class="loader" v-if="showLoader"> 506 <div class="loader" v-if="showLoader">
444 <v-progress-circular indeterminate color="white"></v-progress-circular> 507 <v-progress-circular indeterminate color="white"></v-progress-circular>
445 </div> 508 </div>
446 </v-app> 509 </v-app>
447 </template> 510 </template>
448 511
449 <script> 512 <script>
450 import http from "@/Services/http.js"; 513 import http from "@/Services/http.js";
451 import Util from "@/util"; 514 import Util from "@/util";
515 import moment from "moment";
452 516
453 export default { 517 export default {
454 data: () => ({ 518 data: () => ({
455 snackbar: false, 519 snackbar: false,
456 date: null, 520 date: null,
521 menu1: false,
457 menu2: false, 522 menu2: false,
458 color: "", 523 color: "",
524 dueDate: null,
459 y: "top", 525 y: "top",
460 x: "right", 526 x: "right",
461 mode: "", 527 mode: "",
462 timeout: 10000, 528 timeout: 10000,
463 text: "", 529 text: "",
464 libraryId: "", 530 libraryId: "",
465 loading: false, 531 loading: false,
466 loadingSearch: false, 532 loadingSearch: false,
467 date: null, 533 date: null,
468 search: "", 534 search: "",
469 showLoader: false, 535 showLoader: false,
470 dialog: false, 536 dialog: false,
471 dialog1: false, 537 dialog1: false,
472 valid: true, 538 valid: true,
473 isActive: true, 539 isActive: true,
474 newActive: false, 540 newActive: false,
475 addclass: [], 541 addclass: [],
476 addSection: [], 542 addSection: [],
477 AddUsercredentials: {}, 543 AddUsercredentials: {},
478 pagination: { 544 pagination: {
479 rowsPerPage: 15 545 rowsPerPage: 15
480 }, 546 },
481 libraryIDRules: [v => !!v || " Library ID is required"], 547 libraryIDRules: [v => !!v || " Library ID is required"],
482 bookRules: [v => !!v || " book Name is required"], 548 bookRules: [v => !!v || " book Name is required"],
483 authorRules: [v => !!v || "Author Name is required"], 549 authorRules: [v => !!v || "Author Name is required"],
484 subjectCodeRules: [v => !!v || "Subject Code is required"], 550 subjectCodeRules: [v => !!v || "Subject Code is required"],
485 authorRules: [v => !!v || "Author is required"], 551 authorRules: [v => !!v || "Author is required"],
486 noteRules: [v => !!v || "Note is required"], 552 noteRules: [v => !!v || "Note is required"],
487 headers: [ 553 headers: [
488 { 554 {
489 align: "justify-center", 555 align: "justify-center",
490 text: "No", 556 text: "No",
491 sortable: false, 557 sortable: false,
492 value: "No" 558 value: "No"
493 }, 559 },
494 { text: "Image", vaue: "image", sortable: false, align: "center" }, 560 { text: "Book", vaue: "name", sortable: false, align: "center" },
495 { text: "Title", value: "title", sortable: false, align: "center" }, 561 {
562 text: "Serial Number",
563 value: "serialNumber",
564 sortable: false,
565 align: "center"
566 },
567 {
568 text: "Issue Date",
569 value: "created",
570 sortable: false,
571 align: "center"
572 },
573 {
574 text: "Due Date",
575 value: "dueDate",
576 sortable: false,
577 align: "center"
578 },
496 { 579 {
497 text: "Description", 580 text: "Status",
498 value: "description", 581 value: "status",
499 sortable: false, 582 sortable: false,
500 align: "center" 583 align: "center"
501 }, 584 },
502 { text: "Action", value: "", sortable: false, align: "center" } 585 { text: "Action", value: "", sortable: false, align: "center" }
503 ], 586 ],
504 desserts: [], 587 desserts: [],
505 addIssue: {}, 588 addIssue: {},
506 bookId: "", 589 bookId: "",
507 libraryID: "", 590 libraryID: "",
508 serialNo: "", 591 serialNo: "",
509 note: "", 592 note: "",
510 editedItem: {}, 593 editedItem: {},
511 books: [], 594 books: [],
512 token: "", 595 token: "",
513 disable: false 596 disable: false
514 }), 597 }),
515 methods: { 598 methods: {
516 getSections(_id) { 599 // getIssueList() {
517 console.log("_id", _id); 600 // console.log("_id", _id);
518 http() 601 // http()
519 .get( 602 // .get(
520 "/getSectionsList", 603 // "/getBooksIssueList",
521 { params: { classId: _id } }, 604 // { params: { libraryId: this.libraryId } },
522 { 605 // {
523 headers: { Authorization: "Bearer " + this.token } 606 // headers: { Authorization: "Bearer " + this.token }
524 } 607 // }
525 ) 608 // )
526 .then(response => { 609 // .then(response => {
527 this.addSection = response.data.data; 610 // // this.addSection = response.data.data;
528 // console.log("getSectionsList=====>", this.addSection); 611 // console.log("getSectionsList=====>", response.data.data);
529 }) 612 // })
530 .catch(err => { 613 // .catch(err => {
531 console.log("err====>", err); 614 // console.log("err====>", err);
532 // this.$router.replace({ path: '/' }); 615 // // this.$router.replace({ path: '/' });
533 }); 616 // });
617 // },
618 dates: function(date) {
619 return moment(date).format("MMMM DD, YYYY");
534 }, 620 },
535 pickFile() { 621 pickFile() {
536 this.$refs.image.click(); 622 this.$refs.image.click();
537 }, 623 },
538 searchLibrary() { 624 getIssueList() {
539 this.showLoader = true; 625 this.showLoader = true;
540 this.loadingSearch = true; 626 this.loadingSearch = true;
541 var token = this.$store.state.token;
542 http() 627 http()
543 .get( 628 .get(
544 "/getLibrary", 629 "/getBooksIssueList",
545 { 630 {
546 params: { libraryId: this.libraryId } 631 params: { libraryId: this.libraryId }
547 }, 632 },
548 { 633 {
549 headers: { Authorization: "Bearer " + this.token } 634 headers: { Authorization: "Bearer " + this.token }
550 } 635 }
551 ) 636 )
552 .then(response => { 637 .then(response => {
553 // this.desserts = response.data.data; 638 this.desserts = response.data.data;
554 this.showLoader = false; 639 this.showLoader = false;
555 this.loadingSearch = false; 640 this.loadingSearch = false;
556
557 // console.log("getIssueList=====>",this.desserts)
558 }) 641 })
559 .catch(error => { 642 .catch(error => {
560 // console.log("err====>", err); 643 // console.log("err====>", err);
561 this.showLoader = false; 644 this.showLoader = false;
562 this.loadingSearch = false; 645 this.loadingSearch = false;
563 this.snackbar = true; 646 this.snackbar = true;
564 this.text = error.response.data.message; 647 this.text = error.response.data.message;
565 if (error.response.status === 401) { 648 if (error.response.status === 401) {
566 this.$router.replace({ path: "/" }); 649 this.$router.replace({ path: "/" });
567 this.$store.dispatch("setToken", null); 650 this.$store.dispatch("setToken", null);
568 this.$store.dispatch("Id", null); 651 this.$store.dispatch("Id", null);
569 } 652 }
570 }); 653 });
571 }, 654 },
572 editItem(item) { 655 editItem(item) {
656 console.log("item", item);
573 this.editedIndex = this.desserts.indexOf(item); 657 this.editedIndex = this.desserts.indexOf(item);
574 this.editedItem = Object.assign({}, item); 658 this.editedItem = Object.assign({}, item);
659 // console.log("this.editedItem", this.editedItem);
660 this.editedItem.name = item.bookId.name;
661 this.editedItem.status = item.bookId.status;
662 this.editedItem.dueDate =
663 this.editedItem.dueDate != undefined
664 ? (this.editedItem.dueDate = this.editedItem.dueDate.substring(0, 10))
665 : (this.editedItem.dueDate = "");
575 this.dialog = true; 666 this.dialog = true;
576 }, 667 },
577 profile(item) { 668 profile(item) {
578 this.editedIndex = this.desserts.indexOf(item); 669 this.editedIndex = this.desserts.indexOf(item);
579 this.editedItem = Object.assign({}, item); 670 this.editedItem = Object.assign({}, item);
671 this.editedItem.name = item.bookId.name;
672 this.editedItem.status = item.bookId.status;
673
580 this.dialog1 = true; 674 this.dialog1 = true;
581 }, 675 },
582 deleteItem(item) { 676 returnBook(item) {
583 let deleteIssue = { 677 let returnBook = {
584 issueId: item._id 678 bookIssueId: item._id
585 }; 679 };
586 http() 680 http()
587 .delete( 681 .put(
588 "/deleteIssue", 682 "/returnBook",
589 confirm("Are you sure you want to delete this?") && { 683 confirm("Are you sure you want to return this?") && returnBook
590 params: deleteIssue
591 }
592 ) 684 )
593 .then(response => { 685 .then(response => {
594 // console.log("deleteIssue",deleteIssue) 686 this.snackbar = true;
595 if ((this.snackbar = true)) { 687 this.text = "Successfully return Issue a Book ";
596 this.text = "Successfully delete Existing Issue";
597 }
598 this.getIssueList(); 688 this.getIssueList();
599 }) 689 })
600 .catch(error => { 690 .catch(error => {
601 // console.log(error); 691 // console.log(error);
602 }); 692 });
603 }, 693 },
604 activeTab(type) { 694 activeTab(type) {
605 switch (type) { 695 switch (type) {
606 case "existing": 696 case "existing":
607 this.newActive = false; 697 this.newActive = false;
608 this.isActive = true; 698 this.isActive = true;
609 break; 699 break;
610 700
611 default: 701 default:
612 this.newActive = true; 702 this.newActive = true;
613 this.isActive = false; 703 this.isActive = false;
614 break; 704 break;
615 } 705 }
616 }, 706 },
617 close() { 707 close() {
618 this.dialog = false; 708 this.dialog = false;
619 setTimeout(() => {
620 this.editedItem = Object.assign({}, this.defaultItem);
621 this.editedIndex = -1;
622 }, 300);
623 }, 709 },
624 close1() { 710 close1() {
625 this.dialog1 = false; 711 this.dialog1 = false;
626 }, 712 },
627 submit() { 713 submit() {
628 this.loading = true; 714 this.loading = true;
629 // if (this.$refs.form.validate()){ 715 if (this.$refs.form.validate()) {
630 // let createBook = { 716 let createBook = {
631 // bookId: this.bookId, 717 bookId: this.bookId,
632 // author: this.addIssue.author, 718 author: this.addIssue.author,
633 // subjectCode: this.addIssue.subjectCode, 719 subjectCode: this.addIssue.subjectCode,
634 // libraryId: this.libraryID, 720 libraryId: this.libraryID,
635 // serialNumber: this.serialNo, 721 serialNumber: this.serialNo,
636 // note: this.note, 722 note: this.note,
637 // dueDate: this.date 723 dueDate: this.date
638 // }; 724 };
639 // console.log("====================", createBook); 725 console.log("====================", createBook);
640 // http() 726 http()
641 // .post("/createBookIssue", createBook) 727 .post("/createBookIssue", createBook)
642 // .then(response => { 728 .then(response => {
643 // this.snackbar = true; 729 this.snackbar = true;
644 // this.text = "New Issue added successfully"; 730 this.text = "New Issue a Book added successfully";
645 // // this.getIssueList(); 731 this.getIssueList();
646 // this.color = "succses"; 732 this.color = "succses";
647 // this.loading = false; 733 this.loading = false;
648 // this.clear(); 734 this.clear();
649 // }) 735 })
650 // .catch(error => { 736 .catch(error => {
651 // if ((this.snackbar = true)) { 737 if ((this.snackbar = true)) {
652 // this.text = error.response.data.message; 738 this.text = error.response.data.message;
653 // } 739 this.color = "red";
654 // }); 740 }
655 // } 741 });
742 }
656 }, 743 },
657 clear() { 744 clear() {
658 this.$refs.form.reset(); 745 this.$refs.form.reset();
746 this.disable = false;
659 }, 747 },
660 save() { 748 save() {
749 this.editedItem.bookIssueId = this.editedItem._id;
750 this.editedItem.bookId = this.editedItem.bookId._id
661 http() 751 http()
662 .put("/updateIssue") 752 .put("/updateBookIssue", this.editedItem)
663 .then(response => { 753 .then(response => {
664 // console.log("updateIssue",updateIssue); 754 console.log("updateIssue", response);
665 if ((this.snackbar = true)) { 755 this.snackbar = true;
666 this.text = "Successfully Edit Existing Issue"; 756 this.text = "Successfully Edit Issue a Book";
667 } 757 this.color = "green";
668 this.getIssueList(); 758 this.getIssueList();
669 this.close(); 759 this.close();
670 }) 760 })
671 .catch(error => { 761 .catch(error => {
672 // console.log(error); 762 // console.log(error);
763 if ((this.snackbar = true)) {
764 this.text = error.response.data.message;
765 this.color = "red";
766 }
673 }); 767 });
674 }, 768 },
675 getBookData() { 769 getBookData() {
676 this.showLoader = true; 770 this.showLoader = true;
677 http() 771 http()
678 .get("/getBooksList", { 772 .get("/getBooksList", {
679 headers: { Authorization: "Bearer " + this.token } 773 headers: { Authorization: "Bearer " + this.token }
680 }) 774 })
681 .then(response => { 775 .then(response => {
static/icon/return.jpg

34.9 KB