Commit e9fc6aa2 by Your Name

Update work

parent 862fec6f
export class Search {
type : string;
sType : number;
sDate : string;
eDate : string;
sStasus: number;
constructor(init? : Search){
Object.assign(this, init);
this.type = '';
this.sType = 0;
this.sDate = '';
this.eDate = '';
this.sStasus = 0;
}
}
\ No newline at end of file
export class Type {
typeId: number;
typeName : String;
constructor(init?: Type){
Object.assign(this, init);
this.typeId = 0;
this.typeName = '';
}
}
......@@ -22,6 +22,8 @@
<button class="btn btn-lg btn-outline-primary"
(click)="openRoomDetail(contentroom)">เพิ่มรายการ</button>
<button class="btn btn-lg btn-outline-primary" (click)="openType(contenttype)">เพิ่มประเภท</button>
<div class="row">
<div class="col-sm-3"
*ngFor="let item of listRoomModel|slice: (pageListRoom-1) * pageSizeListRoom :(pageListRoom-1) * pageSizeListRoom + pageSizeListRoom ;let i = index">
......@@ -77,6 +79,8 @@
<div class="card-body">
<button class="btn btn-lg btn-outline-primary"
(click)="openItemDetail(contentequirment)">เพิ่มรายการ</button>
<button class="btn btn-lg btn-outline-primary" (click)="openType(contenttype)">เพิ่มประเภท</button>
<div class="row">
<div class="col-sm-3"
......@@ -240,7 +244,7 @@
</div>
<div class=" card-footer">
<button class=" btn btn-fill btn-danger" [disabled]="myFormRoom.invalid" type="submit"
(click)="saveRoom()">Save</button>
(click)="saveType()">Save</button>
<button class=" btn btn-fill btn-danger" type="cancel"
(click)="modal.dismiss('Cross click')">Cancel</button>
</div>
......@@ -365,4 +369,35 @@
</div>
</div>
</div>
</ng-template>
<ng-template #contenttype let-model>
<div class=" col-md-12" style="padding: 0; ">
<div class="card" style="margin: 0; ">
<div class=" card-header">
<h5 class=" title">เพิ่มประเภท</h5>
</div>
<div class=" card-body">
<form [formGroup]="myFormType" class="needs-validation">
<div class=" row">
<div class=" col-md-12">
<div class=" form-group">
<label> ชื่อประเภท </label>
<input class=" form-control" placeholder="" type="text" [(ngModel)]="modelType.typeName"
formControlName="typeName">
<div style="color: red;" *ngIf="myFormType.controls.typeName.status=='INVALID'">
กรุณากรอกชื่อประเภท.</div>
</div>
</div>
</div>
</form>
</div>
<div class=" card-footer">
<button class=" btn btn-fill btn-danger" [disabled]="myFormType.invalid" type="submit"
(click)="saveType()">Save</button>
<button class=" btn btn-fill btn-danger" type="cancel"
(click)="modal.dismiss('Cross click')">Cancel</button>
</div>
</div>
</div>
</ng-template>
\ No newline at end of file
......@@ -3,11 +3,13 @@ import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap';
import { Equirment } from 'src/app/models/equirment.model';
import { ItemDetail } from 'src/app/models/itemDetail.model';
import { RoomDetail } from 'src/app/models/RoomDetail.model';
import { Type } from 'src/app/models/type.model';
import { MyRoom, Room } from 'src/app/models/rooms.model';
import { EquirmentService } from 'src/app/service/equirment.service';
import { RoomService } from 'src/app/service/room.service';
import { RoomDetailService } from 'src/app/service/room-detail.service';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { TypeService } from 'src/app/service/type.service';
@Component({
selector: 'app-admin-equirment',
......@@ -42,6 +44,7 @@ export class AdminEquirmentComponent implements OnInit {
modelRoom: Room
modelItemDetail = new ItemDetail();
modelRoomDetail = new RoomDetail();
modelType = new Type();
RoomForm = new FormGroup({
rId: new FormControl(''),
......@@ -54,9 +57,10 @@ export class AdminEquirmentComponent implements OnInit {
myFormRoom: FormGroup;
myFormEquir: FormGroup;
myFormType: FormGroup;
constructor(private modalService: NgbModal, private equirmentService: EquirmentService, private roomService: RoomService, private RoomDetailService: RoomDetailService
, private fb: FormBuilder) {
, private fb: FormBuilder,private typeService: TypeService) {
}
ngOnInit() {
......@@ -97,6 +101,10 @@ export class AdminEquirmentComponent implements OnInit {
Quantity : new FormControl('',[Validators.required]),
remark : new FormControl(''),
})
this.myFormType = new FormGroup({
Type : new FormControl('',[Validators.required]),
})
}
......@@ -228,6 +236,18 @@ export class AdminEquirmentComponent implements OnInit {
});
}
openType(contenttype) {
this.modelType = new Type ();
this.myFormType = new FormGroup({
typeId : new FormControl(this.modelType.typeId,[Validators.required]),
typeName : new FormControl(this.modelType.typeName,[Validators.required]),
})
this.modalService.open(contenttype, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
});
}
private getDismissReason(reason: any): string {
if (reason === ModalDismissReasons.ESC) {
......@@ -265,6 +285,12 @@ export class AdminEquirmentComponent implements OnInit {
}
saveType(){
// this.typeService.addType(this.modelType);
this.modalService.dismissAll();
this.ngOnInit();
}
editRoom() {
this.roomService.editroom(this.modelRoom);
this.modalService.dismissAll();
......
......@@ -7,7 +7,7 @@ import { Contact } from "../models/contact.model";
export class ContactService {
constructor(private http: HttpClient) { }
url: string = "http://915e-49-0-64-28.ngrok.io";
url: string = "http://5fa9-110-169-221-194.ngrok.io";
listContact: Contact[] = []
addContact(model: Contact) {
......
......@@ -8,7 +8,7 @@ import { Observable } from 'rxjs';
export class EquirmentService {
constructor(private http: HttpClient) { }
url: string = "http://915e-49-0-64-28.ngrok.io";
url: string = "http://5fa9-110-169-221-194.ngrok.io";
listEquirment: Equirment[] = []
addEquirment(model: Equirment) {
......
......@@ -7,7 +7,7 @@ import { Observable } from 'rxjs';
export class ItemDetailService {
constructor(private http: HttpClient) { }
url: string = "http://915e-49-0-64-28.ngrok.io";
url: string = "http://5fa9-110-169-221-194.ngrok.io";
listItemDetail: ItemDetail[] = []
addItemDetail(model: ItemDetail) {
......
......@@ -6,9 +6,12 @@ import { Observable } from 'rxjs';
@Injectable({ providedIn: 'root' })
export class RoomDetailService {
open(contenttype: any, arg1: { ariaLabelledBy: string; }) {
throw new Error('Method not implemented.');
}
constructor(private http: HttpClient) { }
url: string = "http://915e-49-0-64-28.ngrok.io";
url: string = "http://5fa9-110-169-221-194.ngrok.io";
listRoomDetail: RoomDetail[] = []
editRoomDetail(model: RoomDetail) {
......
......@@ -7,7 +7,7 @@ import { RoomDetail } from '../models/RoomDetail.model';
export class RoomService {
constructor(private http: HttpClient) { }
url: string = "http://915e-49-0-64-28.ngrok.io";
url: string = "http://5fa9-110-169-221-194.ngrok.io";
listRoomModel: Room[] = []
listRoomSearch: Room[] = [];
......
......@@ -6,7 +6,7 @@ import { Search } from '../models/search.model';
export class SearchService {
constructor(private http: HttpClient) {}
url: string = "http://915e-49-0-64-28.ngrok.io";
url: string = "http://5fa9-110-169-221-194.ngrok.io";
listSearch: Search[] = []
getListSearch(){
......
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Type } from '../models/type.model';
@Injectable({ providedIn: 'root' })
export class TypeService {
// addType(modelType: Function) {
// throw new Error('Method not implemented.');
// }
constructor(private http: HttpClient) { }
url: string = "http://5fa9-110-169-221-194.ngrok.io";
listType: Type[] = []
addType(model: Type) {
this.listType.push(model);
this.listType.reverse
}
getListType(): Observable<Type[]> {
return this.http.get<Type[]>(this.url + "/Type/lists");
}
}
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