Commit 6fcec8df by DESKTOP-HF0LVOG\myhr

update หน้ารายการอนุมัติ admin เหลือสถานะ

parent 716d2d9e
...@@ -12,7 +12,7 @@ export class Equirment { ...@@ -12,7 +12,7 @@ export class Equirment {
this.eqName = ''; this.eqName = '';
this.eqDesc = ''; this.eqDesc = '';
this.eqType = ''; this.eqType = '';
this.eqPic = ''; this.eqPic = 'assets/img/nopic.jpg';
} }
} }
......
...@@ -19,10 +19,10 @@ export class MyRoom implements Room{ ...@@ -19,10 +19,10 @@ export class MyRoom implements Room{
// Object.assign(this, init); // Object.assign(this, init);
this.rId = init?.rId!; this.rId = init?.rId!;
this.rName = init?.rName!; this.rName = init?.rName!;
this.rPic = ''; this.rPic = 'assets/img/nopic.jpg';
this.roomLimit = 0; this.roomLimit = 0;
this.rDesc = ''; this.rDesc = '';
console.log("sssssssssssss",init)
} }
} }
......
...@@ -90,11 +90,11 @@ ...@@ -90,11 +90,11 @@
<td>{{ item.room.rName }}</td> <td>{{ item.room.rName }}</td>
<td>{{ item.room.rDesc }}</td> <td>{{ item.room.rDesc }}</td>
<td>{{ item.userName }}</td> <td>{{ item.userName }}</td>
<td>{{ item.sDate.replaceAll("/","-") }} {{ item.sTime.hour }}:{{ <td>{{ item.sDate | date : 'dd/MM/yyyy' }} {{ item.sTime.hour }}:{{
item.sTime.minute }}</td> item.sTime.minute }}</td>
<td>{{ item.eDate.replaceAll("/","-") }} {{ item.eTime.hour }}:{{ <td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime.hour }}:{{
item.eTime.minute }}</td> item.eTime.minute }}</td>
<td>{{ item.rStatus }}</td> <td>{{ item.rStatus==0 ? "รอดำเนินการ" : "อนุมัติ" }}</td>
<div class="text-center"> <div class="text-center">
<button type="button" class="btn btn-info btn-sm btn-circle " <button type="button" class="btn btn-info btn-sm btn-circle "
style="line-height: 0px" (click)="openRoomDetail(Room,item)"><i style="line-height: 0px" (click)="openRoomDetail(Room,item)"><i
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
<td>{{ item.eDate.replaceAll("/","-")}} {{ item.eTime.hour }}:{{ <td>{{ item.eDate.replaceAll("/","-")}} {{ item.eTime.hour }}:{{
item.eTime.minute }}</td> item.eTime.minute }}</td>
<td>{{ item.Quantity }}</td> <td>{{ item.Quantity }}</td>
<td>{{ item.eStatus }}</td> <td>{{ item.eStatus==0 ? "รอดำเนินการ" : "อนุมัติ" }}</td>
<div class="text-center"> <div class="text-center">
<button type="button" class="btn btn-info btn-sm btn-circle " <button type="button" class="btn btn-info btn-sm btn-circle "
style="line-height: 0px" (click)="openItemDetail(lend,item)"><i style="line-height: 0px" (click)="openItemDetail(lend,item)"><i
...@@ -282,21 +282,23 @@ ...@@ -282,21 +282,23 @@
</div> </div>
</div> </div>
</div> </div>
<div class=" row">
<div class=" col-md-6 mb-2">
<label> สถานะ </label>
<select class="form-select form-control" aria-label="Default select example"
[(ngModel)]="modelRoomDetail.rStatus" formControlName="rStatus">
<option value="0" style="color: black;">รอดำเนินการ</option>
<option value="1" style="color: black;">อนุมัติ</option>
<option value="2" style="color: black;">ยกเลิก</option>
<option value="3" style="color: black;">สำเร็จแล้ว</option>
</select>
</div>
</div>
</form> </form>
<div class=" card-footer"> <div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit" (click)="saveRoom()">อนุมัติ</button> <button class=" btn btn-fill btn-danger" type="submit" (click)="saveStatus()">บันทึก</button>
<button class=" btn btn-fill btn-danger" type="cancel" <button class=" btn btn-fill btn-danger" type="cancel"
(click)="modal.dismiss('Cross click')">ยกเลิก</button> (click)="modal.dismiss('Cross click')">ยกเลิก</button>
<div ngbDropdown class="d-inline-block">
<button class="btn btn-sm btn-outline-primary" id="dropdownBasic1"
ngbDropdownToggle>สถานะ</button>
<div ngbDropdownMenu aria-labelledby="dropdownBasic1">
<button ngbDropdownItem>รอดำเนินการ</button>
<button ngbDropdownItem>อนุมัติ</button>
<button ngbDropdownItem>ยกเลิก</button>
<button ngbDropdownItem>สำเร็จแล้ว</button>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -400,21 +402,26 @@ ...@@ -400,21 +402,26 @@
</div> </div>
</div> </div>
</div> </div>
<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"
[(ngModel)]="modelItemDetail.eStatus" formControlName="eStatus">
<option value="0" style="color: black;">รอดำเนินการ</option>
<option value="1" style="color: black;">อนุมัติ</option>
<option value="2" style="color: black;">ยกเลิก</option>
<option value="3" style="color: black;">สำเร็จแล้ว</option>
</select>
</div>
</div>
</div>
</form> </form>
<div class=" card-footer"> <div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit" (click)="saveEquirment()">อนุมัติ</button> <button class=" btn btn-fill btn-danger" type="submit" (click)="saveEquirment()">อนุมัติ</button>
<button class=" btn btn-fill btn-danger" type="cancel" <button class=" btn btn-fill btn-danger" type="cancel"
(click)="modal.dismiss('Cross click')">ยกเลิก</button> (click)="modal.dismiss('Cross click')">ยกเลิก</button>
<div ngbDropdown class="d-inline-block">
<button class="btn btn-sm btn-outline-primary" id="dropdownBasic1"
ngbDropdownToggle>สถานะ</button>
<div ngbDropdownMenu aria-labelledby="dropdownBasic1">
<button ngbDropdownItem>รอดำเนินการ</button>
<button ngbDropdownItem>อนุมัติ</button>
<button ngbDropdownItem>ยกเลิก</button>
<button ngbDropdownItem>สำเร็จแล้ว</button>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -56,8 +56,8 @@ export class AdminPendingComponent implements OnInit { ...@@ -56,8 +56,8 @@ export class AdminPendingComponent implements OnInit {
closeResult = ''; closeResult = '';
listitemDetail : ItemDetail[] = []; listitemDetail: ItemDetail[] = [];
listroomDetail : RoomDetail[] = []; listroomDetail: RoomDetail[] = [];
modelEquirment = new Equirment(); modelEquirment = new Equirment();
modelRoom = new MyRoom(); modelRoom = new MyRoom();
...@@ -71,11 +71,10 @@ export class AdminPendingComponent implements OnInit { ...@@ -71,11 +71,10 @@ export class AdminPendingComponent implements OnInit {
thStime: string; thStime: string;
thEtime: string; thEtime: string;
thtimeChange (time:string,item:any){ thtimeChange(time: string, item: any) {
let timeSplit = time.split(":") let timeSplit = time.split(":")
item.hour = parseInt(timeSplit[0]) item.hour = parseInt(timeSplit[0])
item.minute = parseInt(timeSplit[1]) item.minute = parseInt(timeSplit[1])
console.log(this.modelRoomDetail)
} }
...@@ -110,20 +109,18 @@ export class AdminPendingComponent implements OnInit { ...@@ -110,20 +109,18 @@ export class AdminPendingComponent implements OnInit {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
}); });
} }
date='10-12-2561' date = '10-12-2561'
show(a:string){
console.log(a)
}
sDate = "" sDate = ""
eDate = "" eDate = ""
openItemDetail(content : string ,item : ItemDetail) { openItemDetail(content: string, item: ItemDetail) {
this.modelItemDetail = item ; this.modelItemDetail = item;
this.thStime= this.modelItemDetail.sTime.hour + ':' + this.modelItemDetail.sTime.minute this.thStime = this.modelItemDetail.sTime.hour + ':' + this.modelItemDetail.sTime.minute
this.thEtime= this.modelItemDetail.eTime.hour + ':' + this.modelItemDetail.eTime.minute this.thEtime = this.modelItemDetail.eTime.hour + ':' + this.modelItemDetail.eTime.minute
let SDate = this.modelItemDetail.sDate.split('/') let sDate = this.modelItemDetail.sDate.split('/')
this.sDate = SDate[2]+"-"+SDate[1]+"-"+SDate[0] this.sDate = sDate[0] + "-" + sDate[1] + "-" + sDate[2]
let EDate = this.modelItemDetail.eDate.split('/') let eDate = this.modelItemDetail.eDate.split('/')
this.eDate = EDate[2]+"-"+EDate[1]+"-"+EDate[0] this.eDate = eDate[0] + "-" + eDate[1] + "-" + eDate[2]
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
}, (reason) => { }, (reason) => {
...@@ -131,27 +128,26 @@ export class AdminPendingComponent implements OnInit { ...@@ -131,27 +128,26 @@ export class AdminPendingComponent implements OnInit {
}); });
} }
rDate(item: string, item2: string){ rDate(item: string, item2: string) {
let Dates = item.split("-") let Dates = item.split("-")
let dates = Dates[2]+"/"+Dates[1]+"/"+Dates[0] let dates = Dates[0] + "/" + Dates[1] + "/" + Dates[2]
if(item2=="sdate"){ if (item2 == "sdate") {
this.modelItemDetail.sDate = dates this.modelItemDetail.sDate = dates
} }
if(item2=="edate"){ if (item2 == "edate") {
this.modelItemDetail.eDate = dates this.modelItemDetail.eDate = dates
} }
console.log(this.sDate) }
}
openRoomDetail(content : string ,item : RoomDetail) { openRoomDetail(content: string, item: RoomDetail) {
this.modelRoomDetail = item ; this.modelRoomDetail = item;
this.thStime= this.modelRoomDetail.sTime.hour + ':' + this.modelRoomDetail.sTime.minute this.thStime = this.modelRoomDetail.sTime.hour + ':' + this.modelRoomDetail.sTime.minute
this.thEtime= this.modelRoomDetail.eTime.hour + ':' + this.modelRoomDetail.eTime.minute this.thEtime = this.modelRoomDetail.eTime.hour + ':' + this.modelRoomDetail.eTime.minute
let SDate = this.modelRoomDetail.sDate.split('/') let SDate = this.modelRoomDetail.sDate.split('/')
this.sDate = SDate[2]+"-"+SDate[1]+"-"+SDate[0] this.sDate = SDate[0] + "-" + SDate[1] + "-" + SDate[2]
let EDate = this.modelRoomDetail.eDate.split('/') let EDate = this.modelRoomDetail.eDate.split('/')
this.eDate = EDate[2]+"-"+EDate[1]+"-"+EDate[0] this.eDate = EDate[0] + "-" + EDate[1] + "-" + EDate[2]
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
}, (reason) => { }, (reason) => {
...@@ -193,34 +189,35 @@ export class AdminPendingComponent implements OnInit { ...@@ -193,34 +189,35 @@ export class AdminPendingComponent implements OnInit {
this.listitemDetail = this.ItemDetailService.getListItemDetail(); this.listitemDetail = this.ItemDetailService.getListItemDetail();
this.listroomDetail = this.RoomDetailService.getListRoomDetail(); this.listroomDetail = this.RoomDetailService.getListRoomDetail();
this.collectionSizeListRoom = this.listitemDetail.length; this.collectionSizeListRoom = this.listitemDetail.length;
console.log(this.listitemDetail);
this.myFormRoom = new FormGroup({ this.myFormRoom = new FormGroup({
userNameForm : new FormControl('',[Validators.required]), userNameForm: new FormControl('', [Validators.required]),
rTelephone : new FormControl('',[Validators.required]), rTelephone: new FormControl('', [Validators.required]),
email : new FormControl('',[Validators.required, Validators.email]), email: new FormControl('', [Validators.required, Validators.email]),
rName : new FormControl('',[Validators.required]), rName: new FormControl('', [Validators.required]),
rDesc : new FormControl('',[Validators.required]), rDesc: new FormControl('', [Validators.required]),
rType : new FormControl('',[Validators.required]), rType: new FormControl('', [Validators.required]),
sDate : new FormControl('',[Validators.required]), sDate: new FormControl('', [Validators.required]),
eDate : new FormControl('',[Validators.required]), eDate: new FormControl('', [Validators.required]),
sTime : new FormControl('',[Validators.required]), sTime: new FormControl('', [Validators.required]),
eTime : new FormControl('',[Validators.required]), eTime: new FormControl('', [Validators.required]),
Remark : new FormControl() Remark: new FormControl(),
rStatus: new FormControl()
}); });
this.myFormEquir = new FormGroup({ this.myFormEquir = new FormGroup({
userNameForm : new FormControl('',[Validators.required]), userNameForm: new FormControl('', [Validators.required]),
eTelephone : new FormControl('',[Validators.required]), eTelephone: new FormControl('', [Validators.required]),
email : new FormControl('',[Validators.required, Validators.email]), email: new FormControl('', [Validators.required, Validators.email]),
eqName : new FormControl('',[Validators.required]), eqName: new FormControl('', [Validators.required]),
eqDesc : new FormControl('',[Validators.required]), eqDesc: new FormControl('', [Validators.required]),
eqType : new FormControl('',[Validators.required]), eqType: new FormControl('', [Validators.required]),
eqPic : new FormControl('',[Validators.required]), eqPic: new FormControl('', [Validators.required]),
sDate : new FormControl('',[Validators.required]), sDate: new FormControl('', [Validators.required]),
eDate : new FormControl('',[Validators.required]), eDate: new FormControl('', [Validators.required]),
sTime : new FormControl('',[Validators.required]), sTime: new FormControl('', [Validators.required]),
eTime : new FormControl('',[Validators.required]), eTime: new FormControl('', [Validators.required]),
Quantity : new FormControl('',[Validators.required]), Quantity: new FormControl('', [Validators.required]),
Remark : new FormControl('',[Validators.required]), Remark: new FormControl(),
eStatus: new FormControl()
}) })
} }
...@@ -235,6 +232,13 @@ export class AdminPendingComponent implements OnInit { ...@@ -235,6 +232,13 @@ export class AdminPendingComponent implements OnInit {
this.modalService.dismissAll(); this.modalService.dismissAll();
this.ngOnInit(); this.ngOnInit();
} }
saveStatus() {
this.RoomDetailService.addRoomDetail(this.modelRoomDetail)
this.modalService.dismissAll();
this.ngOnInit();
console.log(this.modelRoomDetail)
}
} }
export class NgbdDropdownBasic { export class NgbdDropdownBasic {
......
...@@ -151,9 +151,8 @@ ...@@ -151,9 +151,8 @@
<br> <br>
<select class="form-select" aria-label="Default select example" <select class="form-select" aria-label="Default select example"
[(ngModel)]="modelEquirment.eqType" formControlName="eqType"> [(ngModel)]="modelEquirment.eqType" formControlName="eqType">
<option selected>เลือกหมวดหมู่</option> <option value="4" style="color: black;">IT</option>
<option value="4">IT</option> <option value="5" style="color: black;">Company</option>
<option value="5">Company</option>
</select> </select>
<div style="color: red;" *ngIf="myFormEquir.controls.eqType.status=='INVALID'"> <div style="color: red;" *ngIf="myFormEquir.controls.eqType.status=='INVALID'">
กรุณากรอกประเภทอุปกรณ์.</div> กรุณากรอกประเภทอุปกรณ์.</div>
...@@ -210,10 +209,10 @@ ...@@ -210,10 +209,10 @@
<div class=" form-group"> <div class=" form-group">
<label> ประเภท </label> <label> ประเภท </label>
<br> <br>
<select class="form-select" aria-label="Default select example" <select class="form-select form-control" aria-label="Default select example"
[(ngModel)]="modelRoom.rType" formControlName="rType"> [(ngModel)]="modelRoom.rType" formControlName="rType">
<option value="1">ห้อง</option> <option value="1" style="color: black;">ห้อง</option>
<option value="2">รถ</option> <option value="2" style="color: black;">รถ</option>
</select> </select>
<div style="color: red;" *ngIf="myFormRoom.controls.rType.status=='INVALID'"> <div style="color: red;" *ngIf="myFormRoom.controls.rType.status=='INVALID'">
กรุณากรอกประเภท.</div> กรุณากรอกประเภท.</div>
......
...@@ -18,8 +18,8 @@ export class ItemDetailService { ...@@ -18,8 +18,8 @@ export class ItemDetailService {
eqPic: "assets/img/mou.jpg" eqPic: "assets/img/mou.jpg"
}, },
userName: 'เกม', userName: 'เกม',
sDate: '09/12/2021', sDate: '2021/12/09',
eDate: '09/12/2021', eDate: '2021/12/15',
sTime: { sTime: {
hour: 22, hour: 22,
minute: 30, minute: 30,
...@@ -46,8 +46,8 @@ export class ItemDetailService { ...@@ -46,8 +46,8 @@ export class ItemDetailService {
eqPic: "assets/img/notebook.jpg" eqPic: "assets/img/notebook.jpg"
}, },
userName: 'แป๊ะ', userName: 'แป๊ะ',
sDate: '09/12/2021', sDate: '2021/12/09',
eDate: '09/12/2021', eDate: '2021/12/13',
sTime: { sTime: {
hour: 22, hour: 22,
minute: 30, minute: 30,
......
...@@ -31,7 +31,7 @@ export class RoomDetailService { ...@@ -31,7 +31,7 @@ export class RoomDetailService {
minute: 30, minute: 30,
second: 0 second: 0
}, },
rStatus: 1, rStatus: 0,
rTelephone: '0123456789', rTelephone: '0123456789',
email: 'qwerty@qwerty', email: 'qwerty@qwerty',
Remark: 'test', Remark: 'test',
...@@ -46,7 +46,7 @@ export class RoomDetailService { ...@@ -46,7 +46,7 @@ export class RoomDetailService {
roomLimit: 50, roomLimit: 50,
rDesc: "จำนวนคน 50 คน", rDesc: "จำนวนคน 50 คน",
}, },
userName: 'เกม', userName: 'แป๊ะ',
sDate: '2021/12/15', sDate: '2021/12/15',
eDate: '2021/12/15', eDate: '2021/12/15',
sTime: { sTime: {
...@@ -72,9 +72,7 @@ export class RoomDetailService { ...@@ -72,9 +72,7 @@ export class RoomDetailService {
} }
addRoomDetail(model: RoomDetail) { addRoomDetail(model: RoomDetail) {
this.listRoomDetail.push(model); this.listRoomDetail.push(model);
console.log(this.listRoomDetail);
} }
getListRoomDetail() { getListRoomDetail() {
......
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