admin-pending.component.html 28.7 KB
Newer Older
1 2
<div class=" content">
    <div class="row">
3
        <div class="col-sm-8">
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
            <div class="card">
                <div class="card-body">
                    <form class="form-inline">
                        <div class="form-group hidden">
                            <div class="input-group">
                                <input name="datepicker" class="form-control" ngbDatepicker #datepicker="ngbDatepicker"
                                    [autoClose]="'outside'" (dateSelect)="onDateSelection($event)" [displayMonths]="2"
                                    [dayTemplate]="t" outsideDays="hidden" [startDate]="fromDate!" tabindex="-1">
                                <ng-template #t let-date let-focused="focused">
                                    <span class="custom-day" [class.focused]="focused" [class.range]="isRange(date)"
                                        [class.faded]="isHovered(date) || isInside(date)"
                                        (mouseenter)="hoveredDate = date" (mouseleave)="hoveredDate = null">
                                        {{ date.day }}
                                    </span>
                                </ng-template>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="input-group">
                                <input #dpFromDate class="form-control" placeholder="yyyy-mm-dd" name="dpFromDate"
                                    [value]="formatter.format(fromDate)"
                                    (input)="fromDate = validateInput(fromDate, dpFromDate.value)">
                                <div class="input-group-append">
                                    <button class="btn btn-outline-secondary calendar" (click)="datepicker.toggle()"
                                        type="button"></button>
                                </div>
                            </div>
                        </div>
                        <div class="form-group ml-2">
                            <div class="input-group">
                                <input #dpToDate class="form-control" placeholder="yyyy-mm-dd" name="dpToDate"
                                    [value]="formatter.format(toDate)"
                                    (input)="toDate = validateInput(toDate, dpToDate.value)">
                                <div class="input-group-append">
                                    <button class="btn btn-outline-secondary calendar" (click)="datepicker.toggle()"
                                        type="button"></button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
47 48 49 50
        <div class="col-4">
            <div class="card">
                <div class="card-body">
                    <div ngbDropdown class="d-inline-block">
51 52
                        <button class="btn btn-sm btn-outline-primary" id="dropdownBasic1"
                            ngbDropdownToggle>ประเภทการค้นหา</button>
53 54 55 56 57 58
                        <div ngbDropdownMenu aria-labelledby="dropdownBasic1">
                            <button ngbDropdownItem>รอดำเนินการ</button>
                            <button ngbDropdownItem>อนุมัติ</button>
                            <button ngbDropdownItem>ยกเลิก</button>
                            <button ngbDropdownItem>สำเร็จแล้ว</button>
                        </div>
59
                        <button class="btn btn-sm btn-outline-success" type="submit">Search</button>
60 61 62 63
                    </div>
                </div>
            </div>
        </div>
64
    </div>
65

66

67 68 69 70
    <ul ngbNav #nav="ngbNav" class="nav-tabs">
        <li ngbNavItem>
            <a ngbNavLink>การจอง</a>
            <ng-template ngbNavContent>
71
                <div class="row text-center">
72 73 74 75 76 77 78
                    <div class="col-sm-12">
                        <div class="card">
                            <div class="card-body">
                                <table class="table table-striped">
                                    <thead>
                                        <tr>
                                            <th scope="col">#</th>
79 80
                                            <th scope="col">หมวดหมู่</th>
                                            <th scope="col">ชื่อการจอง</th>
81
                                            <th scope="col">รายละเอียด</th>
82
                                            <th scope="col">ชื่อผู้จอง</th>
83 84 85
                                            <th scope="col">วันที่เริ่มต้น</th>
                                            <th scope="col">วันที่สิ้นสุด</th>
                                            <th scope="col">สถานะ</th>
86 87 88
                                        </tr>
                                    </thead>
                                    <tbody>
89
                                        <tr *ngFor="let item of listRoomDetail">
90
                                            <th scope="row">{{ item.id }}</th>
91
                                            <td>{{ item.room.rType }}</td>
92 93 94
                                            <td>{{ item.room.rName }}</td>
                                            <td>{{ item.room.rDesc }}</td>
                                            <td>{{ item.userName }}</td>
95 96
                                            <td>{{ item.sDate | date : 'dd/MM/yyyy' }} {{ item.sTime }}</td>
                                            <td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime }}</td>
97 98
                                            <td *ngIf="item.rStatus==0">จอง</td>
                                            <td *ngIf="item.rStatus==1">ไม่อนุมัติ</td>
99 100
                                            <td *ngIf="item.rStatus==2">ยกเลิก</td>
                                            <div class="col-auto align-self-sm-center">
101 102 103
                                                <button type="button" class="btn btn-info btn-sm btn-circle "
                                                    style="line-height: 0px" (click)="openRoomDetail(Room,item)"><i
                                                        class="fa fa-search"></i> </button>
104 105 106 107 108
                                            </div>
                                        </tr>
                                    </tbody>
                                </table>
                                <div class="d-flex justify-content-between p-2">
109 110 111 112
                                    <ngb-pagination [collectionSize]="collectionSizeListRoom" [(page)]="pageListRoom"
                                        [pageSize]="pageSizeListRoom">
                                        <ng-template ngbPaginationPrevious>Previous</ng-template>
                                        <ng-template ngbPaginationNext>Next</ng-template>
113
                                    </ngb-pagination>
114

115 116
                                    <select class="custom-select" style="width: auto" [(ngModel)]="pageSizeListRoom"
                                        (ngModelChange)="pageListRoom=1">
117 118 119 120 121 122 123 124 125 126
                                        <option [ngValue]="10">10 items per page</option>
                                        <option [ngValue]="50">50 items per page</option>
                                        <option [ngValue]="100">100 items per page</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </ng-template>
127

128
        </li>
129 130 131
        <li ngbNavItem>
            <a ngbNavLink>การเบิก</a>
            <ng-template ngbNavContent>
132
                <div class="row text-center">
133 134 135 136 137 138 139
                    <div class="col-sm-12">
                        <div class="card">
                            <div class="card-body">
                                <table class="table table-striped">
                                    <thead>
                                        <tr>
                                            <th scope="col">#</th>
140
                                            <th scope="col">หมวดหมู่</th>
141
                                            <th scope="col">ชื่ออุปกรณ์</th>
142
                                            <th scope="col">รายละเอียด</th>
143
                                            <th scope="col">ชื่อผู้เบิก</th>
144
                                            <th scope="col">วันที่เริ่มใช้</th>
145 146 147
                                            <th scope="col">วันที่สิ้นสุด</th>
                                            <th scope="col">จำนวน</th>
                                            <th scope="col">สถานะ</th>
148 149 150
                                        </tr>
                                    </thead>
                                    <tbody>
151
                                        <tr *ngFor="let item of listItemDetail">
152
                                            <th scope="row">{{ item.id }}</th>
153 154 155 156
                                            <td>{{ item.equirment.eqType }}</td>
                                            <td>{{ item.equirment.eqName }}</td>
                                            <td>{{ item.equirment.eqDesc }}</td>
                                            <td>{{ item.userName }}</td>
157 158
                                            <td>{{ item.sDate | date : 'dd/MM/yyyy' }} {{ item.sTime }}</td>
                                            <td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime }}</td>
159
                                            <td>{{ item.Quantity }}</td>
160 161 162 163 164
                                            <td *ngIf="item.eStatus==0">รอดำเนินการ</td>
                                            <td *ngIf="item.eStatus==1">อนุมัติ</td>
                                            <td *ngIf="item.eStatus==2">ยกเลิก</td>
                                            <td *ngIf="item.eStatus==3">สำเร็จแล้ว</td>
                                            <div class="col-auto align-self-sm-center">
165 166 167
                                                <button type="button" class="btn btn-info btn-sm btn-circle "
                                                    style="line-height: 0px" (click)="openItemDetail(lend,item)"><i
                                                        class="fa fa-search"></i> </button>
168 169 170 171 172
                                            </div>
                                        </tr>
                                    </tbody>
                                </table>
                                <div class="d-flex justify-content-between p-2">
173 174 175 176
                                    <ngb-pagination [collectionSize]="collectionSizeListRoom" [(page)]="pageListRoom"
                                        [pageSize]="pageSizeListRoom">
                                        <ng-template ngbPaginationPrevious>Previous</ng-template>
                                        <ng-template ngbPaginationNext>Next</ng-template>
177
                                    </ngb-pagination>
178

179 180
                                    <select class="custom-select" style="width: auto" [(ngModel)]="pageSizeListRoom"
                                        (ngModelChange)="pageListRoom=1">
181 182 183 184 185 186 187 188 189 190
                                        <option [ngValue]="10">10 items per page</option>
                                        <option [ngValue]="50">50 items per page</option>
                                        <option [ngValue]="100">100 items per page</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </ng-template>
191 192
        </li>
    </ul>
193
    <div [ngbNavOutlet]="nav"></div>
194 195
</div>

196 197 198
<ng-template #Room let-modal>
    <div class=" col-md-12" style="padding: 0;">
        <div class="card" style="margin: 0; ">
199 200 201 202
            <div class=" card-header">
                <h5 class=" title">การจอง</h5>
            </div>
            <div class=" card-body">
203 204 205 206 207 208
                <form [formGroup]="myFormRoom" class="needs-validation">
                    <div class=" row">
                        <div class=" col-md-12">
                            <div class=" form-group">
                                <label> ชื่อผู้จอง </label>
                                <input class=" form-control" placeholder="" type="text"
209 210 211
                                    formControlName="userNameForm" />
                                <div style="color: red;" *ngIf="myFormRoom.controls.userNameForm.status=='INVALID'">
                                    กรุณากรอกชื่อผู้จอง.</div>
212
                            </div>
213 214
                        </div>
                    </div>
215 216 217 218
                    <div class=" row">
                        <div class=" col-sm-12 mb-1">
                            <div class=" form-group">
                                <label> อีเมล </label>
219 220 221
                                <input class=" form-control" placeholder="" type="text" formControlName="email" />
                                <div style="color: red;" *ngIf="myFormRoom.controls.email.status=='INVALID'">
                                    กรุณากรอกอีเมล.</div>
222
                            </div>
223 224
                        </div>
                    </div>
225 226 227 228
                    <div class=" row">
                        <div class=" col-md-12">
                            <div class=" form-group">
                                <label> เบอร์โทร </label>
229 230 231
                                <input class=" form-control" placeholder="" type="text" formControlName="rTelephone" />
                                <div style="color: red;" *ngIf="myFormRoom.controls.rTelephone.status=='INVALID'">
                                    กรุณากรอกหมายเลขโทรศัพท์.</div>
232
                            </div>
233 234
                        </div>
                    </div>
235 236 237
                    <div class="row">
                        <div class="col-sm-12 mb-1">
                            <label for="exampleFormControlSelect1">ชื่อห้อง</label>
238
                            <input readonly class="form-control" type="text" formControlName="rName" />
239 240
                            <div style="color: red;" *ngIf="myFormRoom.controls.rName.status=='INVALID'">
                                กรุณากรอกชื่อห้อง.</div>
241
                        </div>
242
                    </div>
243 244 245
                    <div class="row">
                        <div class="col-sm-12 mb-1">
                            <label for="exampleFormControlSelect1">รายละเอียด</label>
246
                            <input readonly class="form-control" type="text" formControlName="rDesc" />
247 248
                            <div style="color: red;" *ngIf="myFormRoom.controls.rDesc.status=='INVALID'">
                                กรุณากรอกรายละเอียดการจอง.</div>
249
                        </div>
250
                    </div>
251
                    <div class="row">
252 253 254 255 256 257 258 259 260 261 262 263
                        <div class="col-12 mb-1">
                            <div class=" form-check">
                                <label class=" form-check-label">
                                    <input class=" form-check" type="checkbox" [(ngModel)]="modelRoomDetail.allDay" formControlName="allDay"  />
                                    <span class=" form-check-sign">
                                        <span class="check">ทั้งวัน</span>
                                    </span>
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="row" *ngIf="!modelRoomDetail.allDay">
264 265 266
                        <div class="col-6 mb-1">
                            <label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
                            <input type="date" class="form-control" [(ngModel)]="sDate"
267
                            formControlName="sDate" />
268 269
                            <div style="color: red;" *ngIf="myFormRoom.controls.sDate.status=='INVALID'">
                                กรุณากรอกวันที่เริ่มต้นการจอง.</div>
270 271 272 273
                        </div>
                        <div class="col-6 mb-1">
                            <label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
                            <input type="date" class="form-control" [(ngModel)]="eDate"
274
                             formControlName="eDate" />
275 276
                            <div style="color: red;" *ngIf="myFormRoom.controls.eDate.status=='INVALID'">
                                กรุณากรอกวันที่สิ้นสุดการจอง.</div>
277
                        </div>
278
                    </div>
279 280 281
                    <div class="row">
                        <div class="col-6 mb-1">
                            <label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
282 283
                            <input class="form-control" type="time" 
                            formControlName="sTime" />
284 285
                            <div style="color: red;" *ngIf="myFormRoom.controls.sTime.status=='INVALID'">
                                กรุณากรอกเวลาที่เริ่มต้นการจอง.</div>
286 287 288
                        </div>
                        <div class="col-6 mb-1">
                            <label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
289 290
                            <input class="form-control" type="time" 
                              formControlName="eTime" />
291 292
                            <div style="color: red;" *ngIf="myFormRoom.controls.eTime.status=='INVALID'">
                                กรุณากรอกเวลาที่สิ้นสุดการจอง</div>
293
                        </div>
294
                    </div>
295 296 297 298 299
                    <div class=" row">
                        <div class=" col-md-12">
                            <div class=" form-group">
                                <label> หมายเหตุ </label>
                                <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
300
                                    placeholder="......" formControlName="Remark"></textarea>
301
                            </div>
302 303
                        </div>
                    </div>
304 305
                    <div class=" row">
                        <div class=" col-md-6 mb-2">
306
                            <label> สถานะ </label>
307 308
                            <select class="custom-select form-control" aria-label="Default select example"
                            formControlName="rStatus">
309 310
                                <option value="0" selected style="color: black;">จอง</option>
                                <option value="1" style="color: black;">ไม่อนุมัติ</option>
311 312
                                <option value="2" style="color: black;">ยกเลิก</option>
                            </select>
313 314
                        </div>
                    </div>
315
                </form>
316
                <div class=" card-footer">
317
                    <button class=" btn btn-fill btn-danger" type="submit" (click)="saveStatusRoom()">บันทึก</button>
318 319 320
                    <button class=" btn btn-fill btn-danger" type="cancel"
                        (click)="modal.dismiss('Cross click')">ยกเลิก</button>
                </div>
321 322 323 324 325
            </div>
        </div>
    </div>
</ng-template>

326 327 328
<ng-template #lend let-modal>
    <div class=" col-md-12" style="padding: 0; ">
        <div class="card" style="margin: 0; ">
329
            <div class=" card-header">
330
                <h5 class=" title">การเบิก</h5>
331 332
            </div>
            <div class=" card-body">
333 334 335 336 337 338
                <form [formGroup]="myFormEquir" class="needs-validation">
                    <div class=" row">
                        <div class=" col-sm-12 mb-1">
                            <div class=" form-group">
                                <label> ชื่อผู้จอง </label>
                                <input class=" form-control" placeholder="" type="text"
339
                                 formControlName="userNameForm" />
340 341
                                <div style="color: red;" *ngIf="myFormEquir.controls.userNameForm.status=='INVALID'">
                                    กรุณากรอกชื่อผู้จอง.</div>
342
                            </div>
343 344
                        </div>
                    </div>
345 346 347 348 349
                    <div class=" row">
                        <div class=" col-sm-12 mb-1">
                            <div class=" form-group">
                                <label> อีเมล </label>
                                <input class=" form-control" placeholder="" type="text"
350
                                formControlName="email" />
351 352
                                <div style="color: red;" *ngIf="myFormEquir.controls.email.status=='INVALID'">
                                    กรุณากรอกอีเมล.</div>
353
                            </div>
354 355
                        </div>
                    </div>
356 357 358 359 360
                    <div class=" row">
                        <div class=" col-md-12">
                            <div class=" form-group">
                                <label> เบอร์โทร </label>
                                <input class=" form-control" placeholder="" type="text"
361
                                formControlName="eTelephone" />
362 363
                                <div style="color: red;" *ngIf="myFormEquir.controls.eTelephone.status=='INVALID'">
                                    กรุณากรอกหมายเลขโทรศัพท์</div>
364
                            </div>
365 366
                        </div>
                    </div>
367 368 369
                    <div class="row">
                        <div class="col-sm-12 mb-1">
                            <label for="exampleFormControlSelect1">ชื่ออุปกรณ์</label>
370
                            <input readonly class="form-control" type="text"
371 372 373
                                formControlName="eqName" />
                            <div style="color: red;" *ngIf="myFormEquir.controls.eqName.status=='INVALID'">
                                กรุณากรอกชื่ออุปกรณ์.</div>
374
                        </div>
375
                    </div>
376 377 378
                    <div class="row">
                        <div class="col-sm-12 mb-1">
                            <label for="exampleFormControlSelect1">รายละเอียดอุปกรณ์</label>
379
                            <input readonly class="form-control" type="text" 
380 381 382
                                formControlName="eqDesc" />
                            <div style="color: red;" *ngIf="myFormEquir.controls.eqDesc.status=='INVALID'">
                                กรุณากรอกรายละเอียดการเบิก.</div>
383
                        </div>
384
                    </div>
385 386 387 388 389
                    <div class="row">
                        <div class="col-6 mb-1">
                            <label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
                            <input type="date" class="form-control" [(ngModel)]="sDate"
                                (ngModelChange)="rDate(sDate,'sdate')" formControlName="sDate" />
390 391
                            <div style="color: red;" *ngIf="myFormEquir.controls.sDate.status=='INVALID'">
                                กรุณากรอกวันที่เริ่มต้นการเบิก</div>
392 393 394 395 396
                        </div>
                        <div class="col-6 mb-1">
                            <label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
                            <input type="date" class="form-control" [(ngModel)]="eDate"
                                (ngModelChange)="rDate(eDate,'edate')" formControlName="eDate" />
397 398
                            <div style="color: red;" *ngIf="myFormEquir.controls.eDate.status=='INVALID'">
                                กรุณากรอกวันที่สิ้นสุดการเบิก.</div>
399
                        </div>
400
                    </div>
401 402 403
                    <div class="row">
                        <div class="col-6 mb-1">
                            <label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
404 405
                            <input class="form-control" type="time"
                             formControlName="sTime" />
406 407
                            <div style="color: red;" *ngIf="myFormEquir.controls.sTime.status=='INVALID'">
                                กรุณากรอกเวลาที่เริ่มต้นการเบิก</div>
408 409 410
                        </div>
                        <div class="col-6 mb-1">
                            <label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
411 412
                            <input class="form-control" type="time"
                             formControlName="eTime" />
413 414
                            <div style="color: red;" *ngIf="myFormEquir.controls.eTime.status=='INVALID'">
                                กรุณากรอกเวลาที่สิ้นสุดการเบิก</div>
415
                        </div>
416
                    </div>
417 418 419 420
                    <div class=" row">
                        <div class=" col-sm-6 mb-1">
                            <label for="changequantity">จำนวน</label>
                            <input id="changequantity" type="number" class="form-control form-control-sm"
421
                            formControlName="Quantity" />
422 423
                            <div style="color: red;" *ngIf="myFormEquir.controls.Quantity.status=='INVALID'">
                                กรุณากรอกจำนวนการเบิก.</div>
424
                        </div>
425
                    </div>
426 427 428 429 430
                    <div class=" row">
                        <div class=" col-md-12">
                            <div class=" form-group">
                                <label> หมายเหตุ </label>
                                <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
431 432
                                    placeholder="......" [(ngModel)]="modelItemDetail.Remark"
                                    formControlName="Remark"></textarea>
433
                            </div>
434 435
                        </div>
                    </div>
436 437 438 439 440 441
                    <div class=" row">
                        <div class=" col-md-6 mb-2">
                            <div class=" form-group">
                                <label> สถานะ </label>
                                <br>
                                <select class="form-select form-control" aria-label="Default select example"
442
                                    formControlName="eStatus">
443 444 445
                                    <option value="0" style="color: black;">รอดำเนินการ</option>
                                    <option value="1" style="color: black;">อนุมัติ</option>
                                    <option value="2" style="color: black;">ยกเลิก</option>
446
                                    <option value="3" style="color: black;">คืนแล้ว</option>
447 448 449 450
                                </select>
                            </div>
                        </div>
                    </div>
451
                </form>
452
                <div class=" card-footer">
453
                    <button class=" btn btn-fill btn-danger" type="submit" (click)="saveStatusEquirment()">บันทึก</button>
454 455
                    <button class=" btn btn-fill btn-danger" type="cancel"
                        (click)="modal.dismiss('Cross click')">ยกเลิก</button>
456
                </div>
457 458 459 460
            </div>
        </div>
    </div>
</ng-template>