Commit c77efee4 by Your Name

update หมวดหมู่ api eq , ad eq

parent 749dd2e3
......@@ -2,14 +2,14 @@ export class Equirment {
eqId: number;
eqName: string;
eqDesc: string;
eqType: string;
eqType: number;
eqPic: string;
constructor(init?: Equirment){
Object.assign(this, init);
this.eqId = 0;
this.eqName = '';
this.eqDesc = '';
this.eqType = '';
this.eqType = 0;
this.eqPic = 'assets/img/nopic.jpg';
}
}
......
......@@ -2,7 +2,7 @@ import { RoomDetail } from "./RoomDetail.model"
export interface Room {
rId: number;
rName: string;
rType : string;
rType : number;
rPic: string;
roomLimit: number;
rDesc: string;
......@@ -10,7 +10,7 @@ export interface Room {
export class MyRoom implements Room{
rId: number;
rName: string;
rType : string;
rType : number;
rPic: string;
roomLimit: number;
rDesc: string;
......@@ -22,7 +22,7 @@ export class MyRoom implements Room{
this.rPic = 'assets/img/nopic.jpg';
this.roomLimit = 0;
this.rDesc = '';
this.rType = 0;
}
}
......
......@@ -33,6 +33,7 @@
<br>
<p class="text-left">ชื่อ : {{item.rName}}</p>
<p class="text-left">รายละเอียด : {{item.rDesc}}</p>
<p class="text-left">หมวดหมู่ : <td *ngIf="item.rType==1">ห้อง</td><td *ngIf="item.rType==2">รถ</td></p>
</div>
<div class="text-center">
......@@ -88,7 +89,7 @@
<br>
<p class="text-left">ชื่อ : {{item.eqName}}</p>
<p class="text-left">รายละเอียด : {{item.eqDesc}}</p>
<p class="text-left">ประเภท : {{item.eqType}}</p>
<p class="text-left">หมวดหมู่ : <td *ngIf="item.eqType==4">IT</td><td *ngIf="item.eqType==5">Company</td></p>
</div>
<div class="text-center">
......
......@@ -88,7 +88,8 @@
<tbody>
<tr *ngFor="let item of listRoomDetail">
<th scope="row" style="color: rgb(255, 255, 255);">{{ item.id }}</th>
<td>{{ item.room.rType }}</td>
<td *ngIf="item.rStatus==1">ห้อง</td>
<td *ngIf="item.rStatus==2">รถ</td>
<td>{{ item.room.rName }}</td>
<td>{{ item.room.rDesc }}</td>
<td>{{ item.userName }}</td>
......@@ -149,7 +150,8 @@
<tbody>
<tr *ngFor="let item of listItemDetail">
<th scope="row" style="color: rgb(255, 255, 255);">{{ item.id }}</th>
<td>{{ item.equirment.eqType }}</td>
<td *ngIf="item.equirment.eqType==4">IT</td>
<td *ngIf="item.equirment.eqType==5">Company</td>
<td>{{ item.equirment.eqName }}</td>
<td>{{ item.equirment.eqDesc }}</td>
<td>{{ item.userName }}</td>
......@@ -224,7 +226,8 @@
<div class=" col-md-12">
<div class=" form-group">
<label> เบอร์โทร </label>
<input class=" form-control" placeholder="" type="text" formControlName="rTelephone" maxlength="10" />
<input class=" form-control" placeholder="" type="text" formControlName="rTelephone"
maxlength="10" />
<div style="color: red;" *ngIf="myFormRoom.controls.rTelephone.status=='INVALID'">
กรุณากรอกหมายเลขโทรศัพท์.</div>
</div>
......@@ -246,21 +249,23 @@
กรุณากรอกรายละเอียดการจอง.</div>
</div>
</div>
<div class="row" >
<div class="row">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input type="date" class="form-control" [(ngModel)]="modelRoomDetail.sDate" formControlName="sDate" />
<input type="date" class="form-control" [(ngModel)]="modelRoomDetail.sDate"
formControlName="sDate" />
<div style="color: red;" *ngIf="myFormRoom.controls.sDate.status=='INVALID'">
กรุณากรอกวันที่เริ่มต้นการจอง.</div>
</div>
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input type="date" class="form-control" [(ngModel)]="modelRoomDetail.eDate" formControlName="eDate" />
<input type="date" class="form-control" [(ngModel)]="modelRoomDetail.eDate"
formControlName="eDate" />
<div style="color: red;" *ngIf="myFormRoom.controls.eDate.status=='INVALID'">
กรุณากรอกวันที่สิ้นสุดการจอง.</div>
</div>
</div>
<div class="row"*ngIf="!modelRoomDetail.allDay">
<div class="row" *ngIf="!modelRoomDetail.allDay">
<div class="col-6 mb-1">
<label for="exampleFormControlSelect1">เวลาที่เริ่มต้น</label>
<input class="form-control" type="time" formControlName="sTime" />
......@@ -338,7 +343,8 @@
<div class=" col-md-12">
<div class=" form-group">
<label> เบอร์โทร </label>
<input class=" form-control" placeholder="" type="text" formControlName="eTelephone" maxlength="10" />
<input class=" form-control" placeholder="" type="text" formControlName="eTelephone"
maxlength="10" />
<div style="color: red;" *ngIf="myFormEquir.controls.eTelephone.status=='INVALID'">
กรุณากรอกหมายเลขโทรศัพท์</div>
</div>
......@@ -363,7 +369,8 @@
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">วันที่เริ่มต้น</label>
<input type="date" class="form-control" [(ngModel)]="modelItemDetail.sDate" formControlName="sDate" />
<input type="date" class="form-control" [(ngModel)]="modelItemDetail.sDate"
formControlName="sDate" />
<div style="color: red;" *ngIf="myFormEquir.controls.sDate.status=='INVALID'">
กรุณากรอกวันที่เริ่มต้นการเบิก</div>
</div>
......@@ -418,7 +425,8 @@
<div class="row" *ngIf="modelItemDetail.returnItem">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">วันที่สิ้นสุด</label>
<input type="date" class="form-control" [value]="modelItemDetail.eDate" formControlName="eDate" />
<input type="date" class="form-control" [value]="modelItemDetail.eDate"
formControlName="eDate" />
</div>
</div>
</form>
......
......@@ -209,12 +209,8 @@ export class AdminPendingComponent implements OnInit {
myFormEquir: FormGroup;
ngOnInit(): void {
this.ItemDetailService.getListItemDetail().subscribe( result => {
this.listItemDetail = result;
});;
this.RoomDetailService.getListRoomDetail().subscribe( result => {
this.listRoomDetail = result;
});;
this.listItemDetail = this.ItemDetailService.getListItemDetail();
this.listRoomDetail = this.RoomDetailService.getListRoomDetail();
this.collectionSizeListRoom = this.listItemDetail.length;
}
......
......@@ -24,11 +24,12 @@
<div class="card" style="
padding: 10px;">
<div class="card-body">
<img style="object-fit: cover;" [src]="item.rPic" class="nav justify-content-center"
alt="...">
<img style="object-fit: cover;" [src]="item.rPic"
class="nav justify-content-center" alt="...">
<br>
<p class="text-left">ชื่อ : {{item.rName}}</p>
<p class="text-left">รายละเอียด : {{item.rDesc}}</p>
<p class="text-left">หมวดหมู่ : <td *ngIf="item.rStatus==1">ห้อง</td><td *ngIf="item.rStatus==2">รถ</td></p>
</div>
<div class="text-center">
......@@ -73,12 +74,12 @@
<div class="card" style="
padding: 10px;">
<div class="card-body">
<img style="object-fit: cover;" [src]="item.eqPic" class="nav justify-content-center"
alt="...">
<img style="object-fit: cover;" [src]="item.eqPic"
class="nav justify-content-center" alt="...">
<br>
<p class="text-left">ชื่อ : {{item.eqName}}</p>
<p class="text-left">รายละเอียด : {{item.eqDesc}}</p>
<p class="text-left">ประเภท : {{item.eqType}}</p>
<p class="text-left">หมวดหมู่ : <td *ngIf="item.eqType==4">IT</td><td *ngIf="item.eqType==5">Company</td></p>
</div>
<div class="text-center">
......@@ -269,7 +270,8 @@
<div class=" form-group">
<label> เบอร์โทร </label>
<input class=" form-control" placeholder="" type="text" value=""
[(ngModel)]="modelRoomDetail.rTelephone" formControlName="rTelephone" maxlength="10" />
[(ngModel)]="modelRoomDetail.rTelephone" formControlName="rTelephone"
maxlength="10" />
<div style="color: red;" *ngIf="myFormRoom.controls.rTelephone.status=='INVALID'">
กรุณากรอกหมายเลขโทรศัพท์.</div>
</div>
......@@ -398,7 +400,8 @@
<div class=" form-group">
<label> เบอร์โทร </label>
<input class=" form-control" placeholder="" type="text" value=""
[(ngModel)]="modelItemDetail.eTelephone" formControlName="eTelephone" maxlength="10" />
[(ngModel)]="modelItemDetail.eTelephone" formControlName="eTelephone"
maxlength="10" />
<div style="color: red;" *ngIf="myFormEquir.controls.eTelephone.status=='INVALID'">
กรุณากรอกหมายเลขโทรศัพท์.
</div>
......
......@@ -204,12 +204,8 @@ export class HomePageComponent implements OnInit {
setTimeout(function () {
window.dispatchEvent(new Event('resize'))
}, 1)
this.ItemDetailService.getListItemDetail().subscribe( result => {
this.listItemDetail = result;
});;
this.RoomDetailService.getListRoomDetail().subscribe( result => {
this.listRoomDetail = result;
});;
this.listItemDetail = this.ItemDetailService.getListItemDetail();
this.listRoomDetail = this.RoomDetailService.getListRoomDetail();
for (let i = 0; i < this.listRoomDetail.length; i++) {
if (this.listRoomDetail[i].rStatus == 0) {
this.eventRoom.push({
......
......@@ -209,12 +209,8 @@ export class PendingComponent implements OnInit {
}
ngOnInit() {
this.ItemDetailService.getListItemDetail() .subscribe( result => {
this.listItemDetail = result;
});;
this.RoomDetailService.getListRoomDetail() .subscribe( result => {
this.listRoomDetail = result;
});;
this.listItemDetail = this.ItemDetailService.getListItemDetail();
this.listRoomDetail = this.RoomDetailService.getListRoomDetail();
this.collectionSizeListRoom = this.listRoomDetail.length;
}
......
......@@ -8,7 +8,7 @@ import { Observable } from 'rxjs';
export class EquirmentService {
constructor(private http: HttpClient) { }
url: string = "http://11f3-49-0-64-28.ngrok.io";
url: string = "http://2475-49-0-64-28.ngrok.io";
listEquirment: Equirment[] = []
addEquirment(model: Equirment) {
......
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { ItemDetail, SearchItemDetailModel } from '../models/itemDetail.model';
import { Observable } from 'rxjs';
@Injectable({ providedIn: 'root' })
export class ItemDetailService {
constructor(private http: HttpClient) { }
url: string = "http://11f3-49-0-64-28.ngrok.io";
url: string = "http://2475-49-0-64-28.ngrok.io";
listItemDetail: ItemDetail[] = []
addItemDetail(model: ItemDetail) {
......@@ -18,9 +17,10 @@ export class ItemDetailService {
getListItemDetail() : Observable<ItemDetail[]> {
return this.http.get<ItemDetail[]>(this.url + "/lend/lists");
getListItemDetail() {
return this.listItemDetail;
}
// getListItemDetail() {
// this.http.get(this.url).subscribe((response: any) => {
// console.log(response);
......
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { RoomDetail, SearchRoomDetailModel } from '../models/RoomDetail.model';
import { Observable } from 'rxjs';
import { Equirment } from '../models/equirment.model';
@Injectable({ providedIn: 'root' })
export class RoomDetailService {
constructor(private http: HttpClient) { }
url: string = " http://11f3-49-0-64-28.ngrok.io";
url: string = "http://2475-49-0-64-28.ngrok.io";
listRoomDetail: RoomDetail[] = []
editRoomDetail(model: RoomDetail) {
......@@ -37,9 +35,9 @@ export class RoomDetailService {
}
getListRoomDetail() : Observable<RoomDetail[]> {
return this.http.get<RoomDetail[]>(this.url + "/book/lists");
}
getListRoomDetail() {
return this.listRoomDetail;
}
......
......@@ -7,7 +7,7 @@ import { RoomDetail } from '../models/RoomDetail.model';
export class RoomService {
constructor(private http: HttpClient) { }
url: string = 'http://11f3-49-0-64-28.ngrok.io';
url: string = 'http://2475-49-0-64-28.ngrok.io';
listRoomModel: Room[] = []
listRoomSearch: Room[] = [];
......
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