Commit 6fcec8df by DESKTOP-HF0LVOG\myhr

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

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