Commit e1ee90d0 by Chanachai

Edit code

parent bea3aec6
...@@ -6,6 +6,7 @@ export class Contact { ...@@ -6,6 +6,7 @@ export class Contact {
ctHead: string; ctHead: string;
ctStatus: number; ctStatus: number;
sDate: string; sDate: string;
remark: string;
constructor(init?: Contact){ constructor(init?: Contact){
Object.assign(this, init); Object.assign(this, init);
this.id = 1; this.id = 1;
...@@ -15,5 +16,6 @@ export class Contact { ...@@ -15,5 +16,6 @@ export class Contact {
this.ctHead = ''; this.ctHead = '';
this.ctStatus = 0; this.ctStatus = 0;
this.sDate = ''; this.sDate = '';
this.remark = '';
} }
} }
\ No newline at end of file
...@@ -4,23 +4,23 @@ ...@@ -4,23 +4,23 @@
<div class="row"> <div class="row">
<div class="col-6 md-1"> <div class="col-6 md-1">
<label>ชื่อผู้แจ้ง Bug:</label> <label>ชื่อผู้แจ้ง Bug:</label>
<input input class=" form-control" placeholder="" type="text" [(ngModel)]="modelContact.ctName"/> <input input class=" form-control" placeholder="" type="text" />
</div> </div>
<div class="col-6 md-1"> <div class="col-6 md-1">
<label for="typeahead-focus">หัวข้อการแจ้ง Bug:</label> <label for="typeahead-focus">หัวข้อการแจ้ง Bug:</label>
<input input class=" form-control" placeholder="" type="text" [(ngModel)]="modelContact.ctHead"/> <input input class=" form-control" placeholder="" type="text" />
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-6 md-1"> <div class="col-6 md-1">
<label for="typeahead-focus">หน้าต่างที่ต้องการแจ้ง Bug:</label> <label for="typeahead-focus">หน้าต่างที่ต้องการแจ้ง Bug:</label>
<input id="typeahead-focus" type="text" class="form-control" [(ngModel)]="modelContact.ctTab" <input id="typeahead-focus" type="text" class="form-control" [(ngModel)]="model"
[ngbTypeahead]="search" (focus)="focus$.next($any($event).target.value)" [ngbTypeahead]="search" (focus)="focus$.next($any($event).target.value)"
(click)="click$.next($any($event).target.value)" #instance="ngbTypeahead" /> (click)="click$.next($any($event).target.value)" #instance="ngbTypeahead" />
</div> </div>
<div class="col-6 mb-1"> <div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label> <label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input type="date" class="form-control" value="" [(ngModel)]="modelContact.sDate"> <input type="date" class="form-control" value="" >
</div> </div>
</div> </div>
<div class=" row"> <div class=" row">
...@@ -110,6 +110,7 @@ ...@@ -110,6 +110,7 @@
[(ngModel)]="modelContact.ctHead" /> [(ngModel)]="modelContact.ctHead" />
</div> </div>
</div> </div>
</div>
<div class=" row"> <div class=" row">
<div class=" col-md-12"> <div class=" col-md-12">
<div class=" form-group"> <div class=" form-group">
...@@ -131,9 +132,32 @@ ...@@ -131,9 +132,32 @@
<div class="row"> <div class="row">
<div class="col-sm-12 mb-1"> <div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">วันที่แจ้ง</label> <label for="exampleFormControlSelect1">วันที่แจ้ง</label>
<input readonly type="date" class="form-control" [(ngModel)]="sDate"> <input readonly type="date" class="form-control" [(ngModel)]="modelContact.sDate" />
</div>
</div>
<div class=" row">
<div class=" col-md-12">
<div class=" form-group">
<label> หมายเหตุ </label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" [(ngModel)]="modelContact.Remark"></textarea>
</div>
</div>
</div>
<div class=" row">
<div class=" col-md-6 mb-2">
<label> สถานะ </label>
<select class="custom-select form-control" aria-label="Default select example"
formControlName="ctStatus">
<option value="0" selected style="color: black;">รอดำเนินการ</option>
<option value="1" style="color: black;">สำเร็จแล้ว</option>
<option value="2" style="color: black;">ยกเลิก</option>
</select>
</div> </div>
</div> </div>
<div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit" (click)="saveStatusContact()">บันทึก</button>
<button class=" btn btn-fill btn-danger" type="cancel" (click)="modal.dismiss('Cross click')">ยกเลิก</button>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -79,6 +79,7 @@ export class ContactAdminComponent implements OnInit { ...@@ -79,6 +79,7 @@ export class ContactAdminComponent implements OnInit {
ctTab: new FormControl(this.modelContact.ctTab, [Validators.required]), ctTab: new FormControl(this.modelContact.ctTab, [Validators.required]),
ctHead: new FormControl(this.modelContact.ctHead, [Validators.required]), ctHead: new FormControl(this.modelContact.ctHead, [Validators.required]),
sDate: new FormControl(this.modelContact.sDate, [Validators.required]), sDate: new FormControl(this.modelContact.sDate, [Validators.required]),
Remark: new FormControl(this.modelContact.remark),
ctStatus: new FormControl(this.modelContact.ctStatus) ctStatus: new FormControl(this.modelContact.ctStatus)
}); });
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
...@@ -97,4 +98,20 @@ export class ContactAdminComponent implements OnInit { ...@@ -97,4 +98,20 @@ export class ContactAdminComponent implements OnInit {
this.modalService.dismissAll(); this.modalService.dismissAll();
this.ngOnInit(); this.ngOnInit();
} }
saveStatusContact() {
console.log("this.modelContact", this.modelContact)
console.log("form", this.myFromContact)
this.modelContact.ctName = this.myFromContact.value.ctName
this.modelContact.ctDesc = this.myFromContact.value.ctDesc
this.modelContact.ctTab = this.myFromContact.value.ctTab
this.modelContact.ctHead = this.myFromContact.value.ctHead
this.modelContact.ctStatus = this.myFromContact.value.ctStatus
this.modelContact.sDate = this.myFromContact.value.sDate
console.log("this.modelRoomDetail", this.modelContact)
this.ContactService.updateContact(this.modelContact)
this.modalService.dismissAll();
this.ngOnInit();
}
} }
...@@ -15,6 +15,7 @@ export class ContactService { ...@@ -15,6 +15,7 @@ export class ContactService {
ctTab: 'รายการอุปกรณ์', ctTab: 'รายการอุปกรณ์',
ctHead: 'กดจองไม่ได้', ctHead: 'กดจองไม่ได้',
ctStatus: 0, ctStatus: 0,
remark : 'test',
sDate: '2021/12/17' sDate: '2021/12/17'
}, },
] ]
...@@ -22,6 +23,15 @@ export class ContactService { ...@@ -22,6 +23,15 @@ export class ContactService {
this.listContact.push(model); this.listContact.push(model);
} }
updateContact(row_obj: Contact) {
this.listContact = this.listContact.filter((value, key) => {
if (value.id === row_obj.id) {
value = row_obj;
}
return true;
});
}
getListContact() { getListContact() {
return this.listContact; return this.listContact;
} }
......
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