Commit 5b5cd234 by Your Name

update show detail api

parent 78537743
...@@ -2,14 +2,14 @@ import { Equirment } from "./equirment.model"; ...@@ -2,14 +2,14 @@ import { Equirment } from "./equirment.model";
export class ItemDetail { export class ItemDetail {
id?: number; id?: number;
equirment : Equirment; equirments : Equirment;
userName: string; userName: string;
sDate: string; sDate: string;
eDate: string; eDate: string;
sTime: string; sTime: string;
eTime: string; eTime: string;
eStatus: number; eStatus: number;
Quantity: string; quantity: string;
eTelephone: string; eTelephone: string;
email: string; email: string;
remark: string; remark: string;
...@@ -18,12 +18,12 @@ export class ItemDetail { ...@@ -18,12 +18,12 @@ export class ItemDetail {
constructor(init?: ItemDetail) { constructor(init?: ItemDetail) {
Object.assign(this, init); Object.assign(this, init);
this.id = 0; this.id = 0;
this.equirment = this.equirment; this.equirments = this.equirments;
this.userName = ''; this.userName = '';
this.sDate = ''; this.sDate = '';
this.eDate = ''; this.eDate = '';
this.eStatus = 0; this.eStatus = 0;
this.Quantity = ''; this.quantity = '';
this.eTelephone = ''; this.eTelephone = '';
this.email = ''; this.email = '';
this.remark = ''; this.remark = '';
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<div class="card" style=" <div class="card" style="
padding: 10px;"> padding: 10px;">
<div class="card-body"> <div class="card-body">
<img style="object-fit: cover;" [src]="item.rPic" class="nav justify-content-center" <img style="object-fit: cover;" [src]="item.rPic" class="nav justify-content-center" width="150px" height="150px"
alt="..."> alt="...">
<br> <br>
<p class="text-left">ชื่อ : {{item.rName}}</p> <p class="text-left">ชื่อ : {{item.rName}}</p>
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
<div class="card" style=" <div class="card" style="
padding: 10px;"> padding: 10px;">
<div class="card-body"> <div class="card-body">
<img style="object-fit: cover;" [src]="item.eqPic" class="nav justify-content-center" <img style="object-fit: cover;" [src]="item.eqPic" class="nav justify-content-center" width="150px" height="150px"
alt="..."> alt="...">
<br> <br>
<p class="text-left">ชื่อ : {{item.eqName}}</p> <p class="text-left">ชื่อ : {{item.eqName}}</p>
......
...@@ -103,7 +103,7 @@ export class AdminEquirmentComponent implements OnInit { ...@@ -103,7 +103,7 @@ export class AdminEquirmentComponent implements OnInit {
bookEquir(editLend, item: Equirment) { bookEquir(editLend, item: Equirment) {
this.modelItemDetail = new ItemDetail(); this.modelItemDetail = new ItemDetail();
this.modelItemDetail.equirment = item; this.modelItemDetail.equirments = item;
console.log("item", this.modelItemDetail); console.log("item", this.modelItemDetail);
this.modalService.open(editLend, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(editLend, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
...@@ -280,7 +280,7 @@ export class AdminEquirmentComponent implements OnInit { ...@@ -280,7 +280,7 @@ export class AdminEquirmentComponent implements OnInit {
this.listRoomModel[this.index].rName = this.myFormRoom.value.rName this.listRoomModel[this.index].rName = this.myFormRoom.value.rName
this.listRoomModel[this.index].rDesc = this.myFormRoom.value.rDesc this.listRoomModel[this.index].rDesc = this.myFormRoom.value.rDesc
this.listRoomModel[this.index].rType = this.myFormRoom.value.rType this.listRoomModel[this.index].rType = this.myFormRoom.value.rType
this.roomService.updateRoomProfile(this.listRoomModel[this.index]) this.roomService.updateRoom(this.listRoomModel[this.index])
this.modalService.dismissAll(); this.modalService.dismissAll();
this.ngOnInit(); this.ngOnInit();
} }
...@@ -289,19 +289,19 @@ export class AdminEquirmentComponent implements OnInit { ...@@ -289,19 +289,19 @@ export class AdminEquirmentComponent implements OnInit {
this.listEquirmentModel[this.index].eqName = this.myFormEquir.value.eqName this.listEquirmentModel[this.index].eqName = this.myFormEquir.value.eqName
this.listEquirmentModel[this.index].eqDesc = this.myFormEquir.value.eqDesc this.listEquirmentModel[this.index].eqDesc = this.myFormEquir.value.eqDesc
this.listEquirmentModel[this.index].eqType = this.myFormEquir.value.eqType this.listEquirmentModel[this.index].eqType = this.myFormEquir.value.eqType
this.equirmentService.updateEquirProfile(this.listEquirmentModel[this.index]) this.equirmentService.updateEquirment(this.listEquirmentModel[this.index])
this.modalService.dismissAll(); this.modalService.dismissAll();
this.ngOnInit(); this.ngOnInit();
} }
deleteRoomProfile() { deleteRoomProfile() {
this.roomService.deleteRoomProfile(this.modelRoom) this.roomService.deleteRoom(this.modelRoom)
this.modalService.dismissAll(); this.modalService.dismissAll();
this.ngOnInit(); this.ngOnInit();
} }
deleteEquirProfile() { deleteEquirProfile() {
this.equirmentService.deleteEquirProfile(this.modelEquirment) this.equirmentService.deleteEquirment(this.modelEquirment)
this.modalService.dismissAll(); this.modalService.dismissAll();
this.ngOnInit(); this.ngOnInit();
} }
......
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
<td>{{ item.equirments.eqDesc }}</td> <td>{{ item.equirments.eqDesc }}</td>
<td>{{ item.userName }}</td> <td>{{ item.userName }}</td>
<td>{{ item.sDate | date : 'dd/MM/yyyy' }}</td> <td>{{ item.sDate | date : 'dd/MM/yyyy' }}</td>
<td>{{ item.Quantity }}</td> <td>{{ item.quantity }}</td>
<td *ngIf="item.eStatus==0">รอดำเนินการ</td> <td *ngIf="item.eStatus==0">รอดำเนินการ</td>
<td *ngIf="item.eStatus==1">อนุมัติ</td> <td *ngIf="item.eStatus==1">อนุมัติ</td>
<td *ngIf="item.eStatus==2">ยกเลิก</td> <td *ngIf="item.eStatus==2">ยกเลิก</td>
......
...@@ -115,14 +115,14 @@ export class AdminPendingComponent implements OnInit { ...@@ -115,14 +115,14 @@ export class AdminPendingComponent implements OnInit {
userNameForm: new FormControl(this.modelItemDetail.userName, [Validators.required]), userNameForm: new FormControl(this.modelItemDetail.userName, [Validators.required]),
eTelephone: new FormControl(this.modelItemDetail.eTelephone, [Validators.required]), eTelephone: new FormControl(this.modelItemDetail.eTelephone, [Validators.required]),
email: new FormControl(this.modelItemDetail.email, [Validators.required, Validators.email]), email: new FormControl(this.modelItemDetail.email, [Validators.required, Validators.email]),
eqName: new FormControl(this.modelItemDetail.equirment.eqName, [Validators.required]), eqName: new FormControl(this.modelItemDetail.equirments.eqName, [Validators.required]),
eqDesc: new FormControl(this.modelItemDetail.equirment.eqDesc, [Validators.required]), eqDesc: new FormControl(this.modelItemDetail.equirments.eqDesc, [Validators.required]),
eqType: new FormControl(this.modelItemDetail.equirment.eqType, [Validators.required]), eqType: new FormControl(this.modelItemDetail.equirments.eqType, [Validators.required]),
sDate: new FormControl(this.modelItemDetail.sDate, [Validators.required]), sDate: new FormControl(this.modelItemDetail.sDate, [Validators.required]),
eDate: new FormControl(this.modelItemDetail.eDate, [Validators.required]), eDate: new FormControl(this.modelItemDetail.eDate, [Validators.required]),
sTime: new FormControl(this.modelItemDetail.sTime, [Validators.required]), sTime: new FormControl(this.modelItemDetail.sTime, [Validators.required]),
eTime: new FormControl(this.modelItemDetail.eTime, [Validators.required]), eTime: new FormControl(this.modelItemDetail.eTime, [Validators.required]),
Quantity: new FormControl(this.modelItemDetail.Quantity, [Validators.required]), Quantity: new FormControl(this.modelItemDetail.quantity, [Validators.required]),
remark: new FormControl(this.modelItemDetail.remark), remark: new FormControl(this.modelItemDetail.remark),
eStatus: new FormControl(this.modelItemDetail.eStatus), eStatus: new FormControl(this.modelItemDetail.eStatus),
allDay: new FormControl(this.modelItemDetail.allDay), allDay: new FormControl(this.modelItemDetail.allDay),
...@@ -261,9 +261,9 @@ export class AdminPendingComponent implements OnInit { ...@@ -261,9 +261,9 @@ export class AdminPendingComponent implements OnInit {
this.modelItemDetail.userName = this.myFormEquir.value.userNameForm; this.modelItemDetail.userName = this.myFormEquir.value.userNameForm;
this.modelItemDetail.eTelephone = this.myFormEquir.value.eTelephone this.modelItemDetail.eTelephone = this.myFormEquir.value.eTelephone
this.modelItemDetail.email = this.myFormEquir.value.email this.modelItemDetail.email = this.myFormEquir.value.email
this.modelItemDetail.equirment.eqName = this.myFormEquir.value.eqName this.modelItemDetail.equirments.eqName = this.myFormEquir.value.eqName
this.modelItemDetail.equirment.eqDesc = this.myFormEquir.value.eqDesc this.modelItemDetail.equirments.eqDesc = this.myFormEquir.value.eqDesc
this.modelItemDetail.equirment.eqType = this.myFormEquir.value.eqType this.modelItemDetail.equirments.eqType = this.myFormEquir.value.eqType
this.modelItemDetail.sDate = this.myFormEquir.value.sDate this.modelItemDetail.sDate = this.myFormEquir.value.sDate
this.modelItemDetail.eDate = this.myFormEquir.value.eDate this.modelItemDetail.eDate = this.myFormEquir.value.eDate
this.modelItemDetail.sTime = this.myFormEquir.value.sTime this.modelItemDetail.sTime = this.myFormEquir.value.sTime
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<div class="card" style=" <div class="card" style="
padding: 10px;"> padding: 10px;">
<div class="card-body"> <div class="card-body">
<img style="object-fit: cover;" [src]="item.rPic" <img style="object-fit: cover;" [src]="item.rPic" width="150px" height="150px"
class="nav justify-content-center" alt="..."> class="nav justify-content-center" alt="...">
<br> <br>
<p class="text-left">ชื่อ : {{item.rName}}</p> <p class="text-left">ชื่อ : {{item.rName}}</p>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<div class="card" style=" <div class="card" style="
padding: 10px;"> padding: 10px;">
<div class="card-body"> <div class="card-body">
<img style="object-fit: cover;" [src]="item.eqPic" <img style="object-fit: cover;" [src]="item.eqPic" width="150px" height="150px"
class="nav justify-content-center" alt="..."> class="nav justify-content-center" alt="...">
<br> <br>
<p class="text-left">ชื่อ : {{item.eqName}}</p> <p class="text-left">ชื่อ : {{item.eqName}}</p>
......
...@@ -114,14 +114,14 @@ export class EquipmentComponent implements OnInit { ...@@ -114,14 +114,14 @@ export class EquipmentComponent implements OnInit {
bookEquir(Lend,item : Equirment) { bookEquir(Lend,item : Equirment) {
this.modelItemDetail = new ItemDetail(); this.modelItemDetail = new ItemDetail();
this.modelItemDetail.equirment = item ; this.modelItemDetail.equirments = item ;
this.myFormEquir = new FormGroup({ this.myFormEquir = new FormGroup({
userNameForm : new FormControl(this.modelItemDetail.userName,[Validators.required]), userNameForm : new FormControl(this.modelItemDetail.userName,[Validators.required]),
eTelephone : new FormControl(this.modelItemDetail.eTelephone,[Validators.required]), eTelephone : new FormControl(this.modelItemDetail.eTelephone,[Validators.required]),
email : new FormControl(this.modelItemDetail.email,[Validators.required, Validators.email]), email : new FormControl(this.modelItemDetail.email,[Validators.required, Validators.email]),
eqName : new FormControl(this.modelItemDetail.equirment.eqName,[Validators.required]), eqName : new FormControl(this.modelItemDetail.equirments.eqName,[Validators.required]),
eqDesc : new FormControl(this.modelItemDetail.equirment.eqDesc,[Validators.required]), eqDesc : new FormControl(this.modelItemDetail.equirments.eqDesc,[Validators.required]),
sDate : new FormControl(this.modelItemDetail.sDate,[Validators.required]), sDate : new FormControl(this.modelItemDetail.sDate,[Validators.required]),
eDate : new FormControl(''), eDate : new FormControl(''),
sTime : new FormControl(''), sTime : new FormControl(''),
......
...@@ -230,7 +230,7 @@ export class HomePageComponent implements OnInit { ...@@ -230,7 +230,7 @@ export class HomePageComponent implements OnInit {
if (this.listItemDetail[i].eStatus == 0) { if (this.listItemDetail[i].eStatus == 0) {
this.eventEquirment.push({ this.eventEquirment.push({
id: this.listItemDetail[i].id, id: this.listItemDetail[i].id,
title: this.listItemDetail[i].equirment.eqName + " (" + this.listItemDetail[i].userName + ")", title: this.listItemDetail[i].equirments.eqName + " (" + this.listItemDetail[i].userName + ")",
start: '2021-12-16T10:30:00', start: '2021-12-16T10:30:00',
end: '2021-12-16T11:30:00', end: '2021-12-16T11:30:00',
extendedProps: this.listItemDetail[i], extendedProps: this.listItemDetail[i],
...@@ -299,8 +299,8 @@ export class HomePageComponent implements OnInit { ...@@ -299,8 +299,8 @@ export class HomePageComponent implements OnInit {
const modalRef = this.modalService.open(NgbdModalLendContent); const modalRef = this.modalService.open(NgbdModalLendContent);
modalRef.componentInstance.name = this.selectedItemDetail.userName; modalRef.componentInstance.name = this.selectedItemDetail.userName;
modalRef.componentInstance.telephone = this.selectedItemDetail.eTelephone; modalRef.componentInstance.telephone = this.selectedItemDetail.eTelephone;
modalRef.componentInstance.eqName = this.selectedItemDetail.equirment.eqName; modalRef.componentInstance.eqName = this.selectedItemDetail.equirments.eqName;
modalRef.componentInstance.quantity = this.selectedItemDetail.Quantity; modalRef.componentInstance.quantity = this.selectedItemDetail.quantity;
modalRef.componentInstance.sDate = this.selectedRoomDetail.sDate; modalRef.componentInstance.sDate = this.selectedRoomDetail.sDate;
} }
} }
\ No newline at end of file
...@@ -119,14 +119,14 @@ export class PendingComponent implements OnInit { ...@@ -119,14 +119,14 @@ export class PendingComponent implements OnInit {
userNameForm: new FormControl(this.modelItemDetail.userName, [Validators.required]), userNameForm: new FormControl(this.modelItemDetail.userName, [Validators.required]),
eTelephone: new FormControl(this.modelItemDetail.eTelephone, [Validators.required]), eTelephone: new FormControl(this.modelItemDetail.eTelephone, [Validators.required]),
email: new FormControl(this.modelItemDetail.email, [Validators.required, Validators.email]), email: new FormControl(this.modelItemDetail.email, [Validators.required, Validators.email]),
eqName: new FormControl(this.modelItemDetail.equirment.eqName, [Validators.required]), eqName: new FormControl(this.modelItemDetail.equirments.eqName, [Validators.required]),
eqDesc: new FormControl(this.modelItemDetail.equirment.eqDesc, [Validators.required]), eqDesc: new FormControl(this.modelItemDetail.equirments.eqDesc, [Validators.required]),
eqType: new FormControl(this.modelItemDetail.equirment.eqType, [Validators.required]), eqType: new FormControl(this.modelItemDetail.equirments.eqType, [Validators.required]),
sDate: new FormControl(this.modelItemDetail.sDate, [Validators.required]), sDate: new FormControl(this.modelItemDetail.sDate, [Validators.required]),
eDate: new FormControl(this.modelItemDetail.eDate, [Validators.required]), eDate: new FormControl(this.modelItemDetail.eDate, [Validators.required]),
sTime: new FormControl(this.modelItemDetail.sTime, [Validators.required]), sTime: new FormControl(this.modelItemDetail.sTime, [Validators.required]),
eTime: new FormControl(this.modelItemDetail.eTime, [Validators.required]), eTime: new FormControl(this.modelItemDetail.eTime, [Validators.required]),
Quantity: new FormControl(this.modelItemDetail.Quantity, [Validators.required]), Quantity: new FormControl(this.modelItemDetail.quantity, [Validators.required]),
remark: new FormControl(this.modelItemDetail.remark), remark: new FormControl(this.modelItemDetail.remark),
eStatus: new FormControl(this.modelItemDetail.eStatus) eStatus: new FormControl(this.modelItemDetail.eStatus)
}) })
......
...@@ -15,13 +15,11 @@ export class ContactService { ...@@ -15,13 +15,11 @@ export class ContactService {
this.listContact.reverse this.listContact.reverse
} }
updateContact(row_obj: Contact) { updateContact(model: Contact) {
this.listContact = this.listContact.filter((value, key) => { this.http.put(this.url + "/contact/" +model.id, model).subscribe(response => {
if (value.id === row_obj.id) { console.log(response);
value = row_obj; alert("อัพเดทข้อมูลการติดต่อสำเร็จ")
} })
return true;
});
} }
getListContact(): Observable<Contact[]> { getListContact(): Observable<Contact[]> {
......
...@@ -19,10 +19,6 @@ export class EquirmentService { ...@@ -19,10 +19,6 @@ export class EquirmentService {
}) })
} }
// bookEquirment(models: ItemDetail){
// this.listEquirment.push(models);
// }
getListEquirment(): Observable<Equirment[]> { getListEquirment(): Observable<Equirment[]> {
return this.http.get<Equirment[]>(this.url + "/eqment/lists"); return this.http.get<Equirment[]>(this.url + "/eqment/lists");
} }
...@@ -37,46 +33,18 @@ export class EquirmentService { ...@@ -37,46 +33,18 @@ export class EquirmentService {
}) })
} }
// addEquirment(EquirmentModel: Equirment) { deleteEquirment(model: Equirment) {
// this.http.post(this.url, EquirmentModel).subscribe(response => { this.http.delete(this.url + "/eqment/" + model.eqId).subscribe(response => {
// console.log(response);
// })
// }
deleteEquirment(EquirmentModel: Equirment) {
this.http.delete(this.url + "/eqment/" + EquirmentModel.eqId).subscribe(response => {
console.log(response); console.log(response);
this.getListEquirment() this.getListEquirment()
alert("ลบข้อมูลอุปกรณ์สำเร็จ") alert("ลบข้อมูลอุปกรณ์สำเร็จ")
}) })
} }
updateEquirment(EquirmentModel: Equirment) { updateEquirment(model: Equirment) {
this.http.put(this.url + "/" + EquirmentModel.eqId, EquirmentModel).subscribe(response => { this.http.put(this.url + "/eqment/" + model.eqId, model).subscribe(response => {
console.log(response); console.log(response);
alert("อัพเดทข้อมูลอุปกรณ์สำเร็จ") alert("อัพเดทข้อมูลอุปกรณ์สำเร็จ")
}) })
} }
updateEquirProfile(model: Equirment) {
this.listEquirment = this.listEquirment.filter((value, key) => {
if (value.eqId === model.eqId) {
value = model;
}
return true;
});
}
deleteEquirProfile(row_obj: Equirment) {
this.listEquirment = this.listEquirment.filter((value, key) => {
return value.eqId !== row_obj.eqId;
});
}
EquirmentModel(eqId: string) {
}
} }
\ No newline at end of file
...@@ -16,22 +16,10 @@ export class ItemDetailService { ...@@ -16,22 +16,10 @@ export class ItemDetailService {
this.listItemDetail.reverse this.listItemDetail.reverse
} }
getListItemDetail(): Observable<ItemDetail[]> { getListItemDetail(): Observable<ItemDetail[]> {
return this.http.get<ItemDetail[]>(this.url + "/lend/lists"); return this.http.get<ItemDetail[]>(this.url + "/lend/lists");
} }
// getListItemDetail() {
// this.http.get(this.url).subscribe((response: any) => {
// console.log(response);
// this.listItemDetail = response.content;
// }, error => {
// console.log(error)
// // alert("ไม่สามารถดึงข้อมูลห้องประชุมได้ เนื่องจาก :\n" + error.message)
// })
// }
searchListItemDetail(searchModel: SearchItemDetailModel) { searchListItemDetail(searchModel: SearchItemDetailModel) {
this.http.get(this.url + '&startDate=' + searchModel.sDate.split("-")[2] + '-' + searchModel.sDate.split("-")[1] + '-' + searchModel.sDate.split("-")[0] + '&endDate=' + searchModel.eDate.split("-")[2] + '-' + searchModel.eDate.split("-")[1] + '-' + searchModel.eDate.split("-")[0] + '&startTime=' + searchModel.sTime + ':00' + '&endTime=' + searchModel.eTime + ':00').subscribe((response: any) => { this.http.get(this.url + '&startDate=' + searchModel.sDate.split("-")[2] + '-' + searchModel.sDate.split("-")[1] + '-' + searchModel.sDate.split("-")[0] + '&endDate=' + searchModel.eDate.split("-")[2] + '-' + searchModel.eDate.split("-")[1] + '-' + searchModel.eDate.split("-")[0] + '&startTime=' + searchModel.sTime + ':00' + '&endTime=' + searchModel.eTime + ':00').subscribe((response: any) => {
console.log(response); console.log(response);
...@@ -42,40 +30,19 @@ export class ItemDetailService { ...@@ -42,40 +30,19 @@ export class ItemDetailService {
}) })
} }
// addEquirment(EquirmentModel: Equirment) { deleteItemDetail(model: ItemDetail) {
// this.http.post(this.url, EquirmentModel).subscribe(response => { this.http.delete(this.url + "/" + model.id).subscribe(response => {
// console.log(response);
// })
// }
deleteItemDetail(ItemDetailModel: ItemDetail) {
this.http.delete(this.url + "/" + ItemDetailModel.id).subscribe(response => {
console.log(response); console.log(response);
this.getListItemDetail() this.getListItemDetail()
alert("ลบข้อมูลอุปกรณ์สำเร็จ") alert("ลบข้อมูลอุปกรณ์สำเร็จ")
}) })
} }
// updateItemDetail(ItemDetailModel: ItemDetail) { updateItemDetail(model: ItemDetail) {
// this.http.put(this.url + "/" +ItemDetailModel.id, ItemDetailModel).subscribe(response => { this.http.put(this.url + "/lend/" +model.id, model).subscribe(response => {
// console.log(response); console.log(response);
// alert("อัพเดทข้อมูลอุปกรณ์สำเร็จ") alert("อัพเดทข้อมูลอุปกรณ์สำเร็จ")
// }) })
// }
updateItemDetail(row_obj: ItemDetail) {
this.listItemDetail = this.listItemDetail.filter((value, key) => {
if (value.id === row_obj.id) {
value = row_obj;
}
return true;
});
}
ItemDetailModel(eqId: string) {
} }
} }
\ No newline at end of file
...@@ -19,71 +19,34 @@ export class RoomDetailService { ...@@ -19,71 +19,34 @@ export class RoomDetailService {
this.listRoomDetail.push(model); this.listRoomDetail.push(model);
} }
// updateRoomDetail(model: RoomDetail){
// let temp = this.listRoomDetail.filter( x =>
// x.Id == model.Id
// )
// console.log("temp",temp);
// }
updateRoomDetail(row_obj: RoomDetail) {
this.listRoomDetail = this.listRoomDetail.filter((value, key) => {
if (value.id === row_obj.id) {
value = row_obj;
}
return true;
});
}
getListRoomDetail() : Observable<RoomDetail[]> { getListRoomDetail() : Observable<RoomDetail[]> {
return this.http.get<RoomDetail[]>(this.url + "/book/lists"); return this.http.get<RoomDetail[]>(this.url + "/book/lists");
} }
// getListRoomDetail() {
// this.http.get(this.url).subscribe((response: any) => {
// console.log(response);
// this.listRoomDetail = response.content;
// }, error => {
// console.log(error)
// // alert("ไม่สามารถดึงข้อมูลห้องประชุมได้ เนื่องจาก :\n" + error.message)
// })
// }
searchListRoomDetail(searchModel: SearchRoomDetailModel) { searchListRoomDetail(searchModel: SearchRoomDetailModel) {
this.http.get(this.url + '&startDate=' + searchModel.sDate.split("-")[2] + '-' + searchModel.sDate.split("-")[1] + '-' + searchModel.sDate.split("-")[0] + '&endDate=' + searchModel.eDate.split("-")[2] + '-' + searchModel.eDate.split("-")[1] + '-' + searchModel.eDate.split("-")[0] + '&startTime=' + searchModel.sTime + ':00' + '&endTime=' + searchModel.eTime + ':00').subscribe((response: any) => { this.http.get(this.url + '&startDate=' + searchModel.sDate.split("-")[2] + '-' + searchModel.sDate.split("-")[1] + '-' + searchModel.sDate.split("-")[0] + '&endDate=' + searchModel.eDate.split("-")[2] + '-' + searchModel.eDate.split("-")[1] + '-' + searchModel.eDate.split("-")[0] + '&startTime=' + searchModel.sTime + ':00' + '&endTime=' + searchModel.eTime + ':00').subscribe((response: any) => {
console.log(response); console.log(response);
this.listRoomDetail = response; this.listRoomDetail = response;
}, error => { }, error => {
console.log(error) console.log(error)
alert("ไม่สามารถค้นหาอุปกรณ์ที่ว่างได้ เนื่องจาก :\n" + error.message) alert("ไม่สามารถค้นหาการจอง เนื่องจาก :\n" + error.message)
}) })
} }
// addEquirment(EquirmentModel: Equirment) { deleteRoomDetail(model: RoomDetail) {
// this.http.post(this.url, EquirmentModel).subscribe(response => { this.http.delete(this.url + "/book/" + model.id).subscribe(response => {
// console.log(response);
// })
// }
deleteRoomDetail(RoomDetailModel: RoomDetail) {
this.http.delete(this.url + "/" + RoomDetailModel.id).subscribe(response => {
console.log(response); console.log(response);
this.getListRoomDetail() this.getListRoomDetail()
alert("ลบข้อมูลอุปกรณ์สำเร็จ") alert("ลบข้อมูลการจองสำเร็จ")
}) })
} }
// updateRoomDetail(RoomDetailModel: RoomDetail) { updateRoomDetail(model: RoomDetail) {
// this.http.put(this.url + "/" + RoomDetailModel.Id, RoomDetailModel).subscribe(response => { this.http.put(this.url + "/book/" + model.id, model).subscribe(response => {
// console.log(response); console.log(response);
// alert("อัพเดทข้อมูลอุปกรณ์สำเร็จ") alert("อัพเดทข้อมูลการจองสำเร็จ")
// }) })
// } }
} }
\ No newline at end of file
...@@ -45,39 +45,34 @@ export class RoomService { ...@@ -45,39 +45,34 @@ export class RoomService {
// } // }
deleteRoom(roomModel: Room) { deleteRoom(model: Room) {
this.http.delete(this.url + "/" + roomModel.rId).subscribe(response => { this.http.delete(this.url + "/room/" + model.rId).subscribe(response => {
console.log(response); console.log(response);
this.getListRoom() this.getListRoom()
alert("ลบข้อมูลห้องสำเร็จ") alert("ลบข้อมูลห้องสำเร็จ")
}) })
} }
updateRoom(roomModel: Room) { updateRoom(model: Room) {
this.http.put(this.url + "/" + roomModel.rId, roomModel).subscribe(response => { this.http.put(this.url + "/room/" + model.rId, model).subscribe(response => {
console.log(response); console.log(response);
alert("อัพเดทข้อมูลห้องสำเร็จ") alert("อัพเดทข้อมูลห้องสำเร็จ")
}) })
} }
updateRoomProfile(model : Room) { // updateRoomProfile(model : Room) {
this.listRoomModel = this.listRoomModel.filter((value, key) => { // this.listRoomModel = this.listRoomModel.filter((value, key) => {
if (value.rId === model.rId) { // if (value.rId === model.rId) {
value = model; // value = model;
} // }
return true; // return true;
}); // });
} // }
deleteRoomProfile(row_obj: Room) {
this.listRoomModel = this.listRoomModel.filter((value, key) => {
return value.rId !== row_obj.rId;
});
}
roomModel(rId: string) {
}
// deleteRoomProfile(row_obj: Room) {
// this.listRoomModel = this.listRoomModel.filter((value, key) => {
// return value.rId !== row_obj.rId;
// });
// }
} }
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