Commit 5b5cd234 by Your Name

update show detail api

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