Commit c77efee4 by Your Name

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

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