Commit f25fa6ac by Chanachai

Update กดบันทึกแล้วข้อมูลขึ้น

parent 352a8acf
...@@ -17,3 +17,14 @@ export class Contact { ...@@ -17,3 +17,14 @@ export class Contact {
this.sDate = ''; this.sDate = '';
} }
} }
export interface SearchContactModel {
sDate: string;
}
export class SearchContactModel {
constructor(init?: SearchContactModel) {
Object.assign(this, init);
this.sDate = ''
}
}
\ No newline at end of file
...@@ -2,20 +2,26 @@ ...@@ -2,20 +2,26 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
<div class="col-4 md-1"> <div class="col-6 md-1">
<label>ชื่อผู้แจ้ง Bug:</label> <label>ชื่อผู้แจ้ง Bug:</label>
<input input class=" form-control" placeholder="" type="text" /> <input input class=" form-control" placeholder="" type="text" [(ngModel)]="modelContact.ctName"/>
</div> </div>
<div class="col-4 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" /> <input input class=" form-control" placeholder="" type="text" [(ngModel)]="modelContact.ctHead"/>
</div> </div>
<div class="col-4 md-1"> </div>
<div class="row">
<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)]="model" <input id="typeahead-focus" type="text" class="form-control" [(ngModel)]="modelContact.ctTab"
[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">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input type="date" class="form-control" value="" [(ngModel)]="modelContact.sDate">
</div>
</div> </div>
<div class=" row"> <div class=" row">
<div class=" col-md-12"> <div class=" col-md-12">
...@@ -28,8 +34,10 @@ ...@@ -28,8 +34,10 @@
</div> </div>
<div class="card-footer"> <div class="card-footer">
<div class="d-grid gap-2 d-md-flex justify-content-md-center"> <div class="d-grid gap-2 d-md-flex justify-content-md-center">
<button class="btn btn-primary btn-sm" type="submit" [disabled]="" (click)="saveContact()">บันทึก</button> <button class="btn btn-primary btn-sm" [disabled]="" type="submit"
<button class="btn btn-primary btn-sm" type="cancel" (click)="model.dismiss('Cross click')">ยกเลิก</button> (click)="saveContact()">บันทึก</button>
<button class="btn btn-primary btn-sm" type="cancel"
(click)="model.dismiss('Cross click')">ยกเลิก</button>
</div> </div>
</div> </div>
</div> </div>
...@@ -102,7 +110,6 @@ ...@@ -102,7 +110,6 @@
[(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">
...@@ -130,4 +137,5 @@ ...@@ -130,4 +137,5 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</ng-template> </ng-template>
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Contact } from "../models/contact.model"; import { Contact, SearchContactModel } from "../models/contact.model";
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class ContactService { export class ContactService {
...@@ -25,5 +25,15 @@ export class ContactService { ...@@ -25,5 +25,15 @@ export class ContactService {
getListContact() { getListContact() {
return this.listContact; return this.listContact;
} }
searchListContact(searchModel: SearchContactModel) {
this.http.get(this.url + '&startDate=' + searchModel.sDate.split("-")[2] + '-' + searchModel.sDate.split("-")[1] + '-' + searchModel.sDate.split("-")[0] ).subscribe((response: any) => {
console.log(response);
this.listContact = response;
}, error => {
console.log(error)
alert("ไม่สามารถค้นหาได้ เนื่องจาก :\n" + error.message)
})
}
} }
...@@ -220,7 +220,7 @@ export class RoomService { ...@@ -220,7 +220,7 @@ export class RoomService {
this.listRoomSearch = response; this.listRoomSearch = response;
}, error => { }, error => {
console.log(error) console.log(error)
alert("ไม่สามารถค้นหาห้องประุมที่ว่างได้ เนื่องจาก :\n" + error.message) alert("ไม่สามารถค้นหาห้องประุมที่ว่างได้ เนื่องจาก :\n" + error.message)
}) })
} }
......
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