Commit 37cab6c1 by Chanachai

Add ปุ่มอนุมัติได้

parent c709d9e1
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { NgbDate, NgbCalendar, NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap'; import { NgbDate, NgbCalendar, NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap';
import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap';
import { Equirment } from 'src/app/models/equirment.model';
import { itemDetail } from 'src/app/models/itemDetail.model'; import { itemDetail } from 'src/app/models/itemDetail.model';
import { itemDetailService } from 'src/app/service/item-detail.service';
import { roomDetail } from 'src/app/models/roomDetail.model';
import { roomDetailService } from 'src/app/service/room-detail.service';
import { Room } from 'src/app/models/rooms.model';
@Component({ @Component({
selector: 'app-admin-pending', selector: 'app-admin-pending',
...@@ -41,21 +46,28 @@ export class AdminPendingComponent implements OnInit { ...@@ -41,21 +46,28 @@ export class AdminPendingComponent implements OnInit {
closeResult = ''; closeResult = '';
item: itemDetail[] = []; listitemDetail : itemDetail[] = [];
listroomDetail : roomDetail[] = [];
collectionSize = this.item.length; modelEquirment = new Equirment();
modelRoom = new Room();
modelitemDetail = new itemDetail();
modelroomDetail = new roomDetail();
collectionSize = this.listitemDetail.length;
hoveredDate: NgbDate | null = null; hoveredDate: NgbDate | null = null;
fromDate: NgbDate | null; fromDate: NgbDate | null;
toDate: NgbDate | null; toDate: NgbDate | null;
constructor(private calendar: NgbCalendar, public formatter: NgbDateParserFormatter , private modalService: NgbModal) { constructor(private calendar: NgbCalendar, public formatter: NgbDateParserFormatter, private modalService: NgbModal, private itemDetailService: itemDetailService, private roomDetailService: roomDetailService) {
this.fromDate = calendar.getToday(); this.fromDate = calendar.getToday();
this.toDate = calendar.getNext(calendar.getToday(), 'd', 10); this.toDate = calendar.getNext(calendar.getToday(), 'd', 10);
this.refreshitemDetail(); this.refreshitemDetail();
} }
refreshitemDetail() { refreshitemDetail() {
this.item = this.item this.listitemDetail = this.listitemDetail
.map((country, i) => ({ id: i + 1, ...country })) .map((country, i) => ({ id: i + 1, ...country }))
.slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize); .slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize);
} }
...@@ -79,6 +91,26 @@ export class AdminPendingComponent implements OnInit { ...@@ -79,6 +91,26 @@ export class AdminPendingComponent implements OnInit {
}); });
} }
openItemDetail(content : string ,item : itemDetail) {
this.modelitemDetail = item ;
console.log(item);
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
});
}
openRoomDetail(content : string ,item : roomDetail) {
this.modelroomDetail = item ;
console.log(item);
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
});
}
private getDismissReason(reason: any): string { private getDismissReason(reason: any): string {
if (reason === ModalDismissReasons.ESC) { if (reason === ModalDismissReasons.ESC) {
return 'by pressing ESC'; return 'by pressing ESC';
...@@ -107,8 +139,12 @@ export class AdminPendingComponent implements OnInit { ...@@ -107,8 +139,12 @@ export class AdminPendingComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.listitemDetail = this.itemDetailService.getListitemDetail();
this.listroomDetail = this.roomDetailService.getListroomDetail();
console.log(this.listitemDetail);
} }
} }
export class NgbdDropdownBasic { export class NgbdDropdownBasic {
......
...@@ -120,7 +120,7 @@ export class EquipmentComponent implements OnInit { ...@@ -120,7 +120,7 @@ export class EquipmentComponent implements OnInit {
this.roomService.addRoom(this.modelRoom); this.roomService.addRoom(this.modelRoom);
this.modalService.dismissAll(); this.modalService.dismissAll();
this.ngOnInit(); this.ngOnInit();
} }
saveLend() { saveLend() {
......
...@@ -182,9 +182,9 @@ ...@@ -182,9 +182,9 @@
<div [ngbNavOutlet]="nav"></div> <div [ngbNavOutlet]="nav"></div>
</div> </div>
<ng-template #Room let-modal style="padding: 0; "> <ng-template #Room let-modal>
<div class=" col-md-12"> <div class=" col-md-12" style="padding: 0; ">
<div class="card"> <div class="card" style="margin: 0; ">
<div class=" card-header"> <div class=" card-header">
<h5 class=" title">การจอง</h5> <h5 class=" title">การจอง</h5>
</div> </div>
...@@ -253,9 +253,9 @@ ...@@ -253,9 +253,9 @@
</div> </div>
</ng-template> </ng-template>
<ng-template #lend let-modal style="padding: 0; "> <ng-template #lend let-modal>
<div class=" col-md-12"> <div class=" col-md-12" style="padding: 0; ">
<div class="card"> <div class="card" style="margin: 0; ">
<div class=" card-header"> <div class=" card-header">
<h5 class=" title">Lend Equirment</h5> <h5 class=" title">Lend Equirment</h5>
</div> </div>
...@@ -328,4 +328,5 @@ ...@@ -328,4 +328,5 @@
</div> </div>
</div> </div>
</div> </div>
</ng-template> </ng-template>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment