Commit 9c97989f by Your Name

update search admin=pending

parent e9fc6aa2
......@@ -23,23 +23,4 @@ export class MyRoom implements Room{
this.roomLimit = 0;
this.rDesc = '';
}
}
export interface SearchRoomModel {
sdate: string;
edate: string;
stime: string;
etime: string;
roomlimit: number;
}
export class SearchRoomModel {
constructor(init?: SearchRoomModel) {
Object.assign(this, init);
this.sdate = '',
this.edate = '',
this.stime = '',
this.etime = '',
this.roomlimit = 0;
}
}
\ No newline at end of file
export class Search {
sType : number;
sDate : string;
eDate : string;
sStasus: number;
constructor(init? : Search){
Object.assign(this, init);
this.sType = 0;
this.sDate = '';
this.eDate = '';
this.sStasus = 0;
}
}
\ No newline at end of file
export class SearchEqModel {
seqType : number;
sDate : Date;
eDate : string;
seqStasus: number;
constructor(init? : SearchEqModel){
Object.assign(this, init);
this.seqType = 0;
this.sDate = new Date();
this.eDate = '';
this.seqStasus = 0;
}
}
\ No newline at end of file
export class SearchRoomModel {
sroomType : number;
sDate : Date;
eDate : Date;
sroomStasus: number;
constructor(init?: SearchRoomModel) {
Object.assign(this, init);
this.sroomType = 0;
this.sDate = new Date;
this.eDate = new Date;
this.sroomStasus = 0;
}
}
\ No newline at end of file
......@@ -184,7 +184,7 @@
<div class=" card-footer">
<button class=" btn btn-fill btn-danger" [disabled]="myFormEquir.invalid" type="submit"
(click)="saveEquirment()">Save</button>
(click)="saveEquirment();modal.dismiss()">Save</button>
<button class=" btn btn-fill btn-danger" type="cancel"
(click)="modal.dismiss('Cross click')">Cancel</button>
</div>
......@@ -244,7 +244,7 @@
</div>
<div class=" card-footer">
<button class=" btn btn-fill btn-danger" [disabled]="myFormRoom.invalid" type="submit"
(click)="saveType()">Save</button>
(click)="saveType();modal.dismiss()">Save</button>
<button class=" btn btn-fill btn-danger" type="cancel"
(click)="modal.dismiss('Cross click')">Cancel</button>
</div>
......
......@@ -103,7 +103,7 @@ export class AdminEquirmentComponent implements OnInit {
})
this.myFormType = new FormGroup({
Type : new FormControl('',[Validators.required]),
typeName : new FormControl('',[Validators.required]),
})
}
......@@ -286,7 +286,7 @@ export class AdminEquirmentComponent implements OnInit {
}
saveType(){
// this.typeService.addType(this.modelType);
this.typeService.addType(this.modelType);
this.modalService.dismissAll();
this.ngOnInit();
}
......
......@@ -12,10 +12,11 @@
<div class="form-group hidden">
<div class="input-group">
<input name="datepicker" class="form-control" ngbDatepicker
#datepicker="ngbDatepicker" [autoClose]="'outside'"
(dateSelect)="onDateSelection($event)" [displayMonths]="2"
[dayTemplate]="t" outsideDays="hidden" [startDate]="fromDate!"
tabindex="-1">
[(ngModel)]="searchroomModel.sDate" [(ngModel)]="searchroomModel.eDate"
#datepicker="ngbDatepicker"
[autoClose]="'outside'" (dateSelect)="onDateSelection($event)"
[displayMonths]="2" [dayTemplate]="t" outsideDays="hidden"
[startDate]="fromDate!" tabindex="-1">
<ng-template #t let-date let-focused="focused">
<span class="custom-day" [class.focused]="focused"
[class.range]="isRange(date)"
......@@ -60,26 +61,13 @@
<button ngbDropdownItem>ยกเลิก</button>
<button ngbDropdownItem>สำเร็จแล้ว</button>
</div>
<button class="btn btn-sm btn-outline-success"
type="submit">Search</button>
<button class="btn btn-sm btn-outline-success" type="submit"
(click)="openSearchRoom()">Search</button>
</div>
</div>
</div>
</form>
</div>
<!-- <div class="col-sm-4">
<div ngbDropdown class="d-inline-block">
<button class="btn btn-sm btn-outline-primary" id="dropdownBasic1"
ngbDropdownToggle>ประเภทการค้นหา</button>
<div ngbDropdownMenu aria-labelledby="dropdownBasic1">
<button ngbDropdownItem>รอดำเนินการ</button>
<button ngbDropdownItem>อนุมัติ</button>
<button ngbDropdownItem>ยกเลิก</button>
<button ngbDropdownItem>สำเร็จแล้ว</button>
</div>
<button class="btn btn-sm btn-outline-success" type="submit">Search</button>
</div>
</div> -->
</div>
<div class="card-body">
<table class="table table-striped">
......@@ -150,10 +138,10 @@
<div class="form-group hidden">
<div class="input-group">
<input name="datepicker" class="form-control" ngbDatepicker
#datepicker="ngbDatepicker" [autoClose]="'outside'"
(dateSelect)="onDateSelection($event)" [displayMonths]="2"
[dayTemplate]="t" outsideDays="hidden" [startDate]="fromDate!"
tabindex="-1">
[(ngModel)]="searcheqModel.sDate" #datepicker="ngbDatepicker"
[autoClose]="'outside'" (dateSelect)="onDateSelection($event)"
[displayMonths]="2" [dayTemplate]="t" outsideDays="hidden"
[startDate]="fromDate!" tabindex="-1">
<ng-template #t let-date let-focused="focused">
<span class="custom-day" [class.focused]="focused"
[class.range]="isRange(date)"
......@@ -198,26 +186,13 @@
<button ngbDropdownItem>ยกเลิก</button>
<button ngbDropdownItem>สำเร็จแล้ว</button>
</div>
<button class="btn btn-sm btn-outline-success"
type="submit">Search</button>
<button class="btn btn-sm btn-outline-success" type="submit"
(click)="openSearchEq()">Search</button>
</div>
</div>
</div>
</form>
</div>
<!-- <div class="col-4">
<div ngbDropdown class="d-inline-block">
<button class="btn btn-sm btn-outline-primary" id="dropdownBasic1"
ngbDropdownToggle>ประเภทการค้นหา</button>
<div ngbDropdownMenu aria-labelledby="dropdownBasic1">
<button ngbDropdownItem>รอดำเนินการ</button>
<button ngbDropdownItem>อนุมัติ</button>
<button ngbDropdownItem>ยกเลิก</button>
<button ngbDropdownItem>สำเร็จแล้ว</button>
</div>
<button class="btn btn-sm btn-outline-success" type="submit">Search</button>
</div>
</div> -->
</div>
<div class="card-body">
<table class="table table-striped">
......@@ -242,7 +217,7 @@
<td>{{ item.equirments.eqDesc }}</td>
<td>{{ item.userName }}</td>
<td>{{ item.sDate | date : 'dd/MM/yyyy' }} {{ item.sTime }}</td>
<td>{{ item.Quantity }}</td>
<td>{{ item.quantity }}</td>
<td *ngIf="item.eStatus==0">รอดำเนินการ</td>
<td *ngIf="item.eStatus==1">อนุมัติ</td>
<td *ngIf="item.eStatus==2">ยกเลิก</td>
......@@ -397,13 +372,15 @@
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">ชื่ออุปกรณ์</label>
<input readonly class="form-control" type="text" [(ngModel)]="modelItemDetail.equirment.eqName">
<input readonly class="form-control" type="text"
[(ngModel)]="modelItemDetail.equirments.eqName">
</div>
</div>
<div class="row">
<div class="col-sm-12 mb-1">
<label for="exampleFormControlSelect1">รายละเอียดอุปกรณ์</label>
<input readonly class="form-control" type="text" [(ngModel)]="modelItemDetail.equirment.eqDesc">
<input readonly class="form-control" type="text"
[(ngModel)]="modelItemDetail.equirments.eqDesc">
</div>
</div>
<div class="row">
......@@ -426,7 +403,7 @@
<div class=" col-sm-6 mb-1">
<label for="changequantity">จำนวน</label>
<input readonly id="changequantity" type="number" class="form-control form-control-sm"
[(ngModel)]="modelItemDetail.Quantity" />
[(ngModel)]="modelItemDetail.quantity" />
</div>
</div>
<div class=" row">
......
......@@ -6,8 +6,12 @@ import { ItemDetailService } from 'src/app/service/item-detail.service';
import { RoomDetail } from 'src/app/models/RoomDetail.model';
import { RoomDetailService } from 'src/app/service/room-detail.service';
import { Equirment } from 'src/app/models/equirment.model';
import { MyRoom, Room } from 'src/app/models/rooms.model';
import { MyRoom } from 'src/app/models/rooms.model';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { SearchService } from 'src/app/service/search.service';
import { SearchEqModel } from 'src/app/models/searcheq.model';
import { SearchRoomModel } from 'src/app/models/searchroom.model';
@Component({
selector: 'app-pending',
......@@ -69,7 +73,10 @@ export class PendingComponent implements OnInit {
myFormRoom: FormGroup;
myFormEquir: FormGroup;
constructor(private calendar: NgbCalendar, public formatter: NgbDateParserFormatter, private modalService: NgbModal, private ItemDetailService: ItemDetailService, private RoomDetailService: RoomDetailService) {
searcheqModel : SearchEqModel = new SearchEqModel();
searchroomModel : SearchRoomModel = new SearchRoomModel();
constructor(private calendar: NgbCalendar, public formatter: NgbDateParserFormatter, private modalService: NgbModal, private ItemDetailService: ItemDetailService, private RoomDetailService: RoomDetailService, private searchService: SearchService) {
this.fromDate = calendar.getToday();
this.toDate = calendar.getNext(calendar.getToday(), 'd', 10);
this.refreshItemDetail();
......@@ -218,6 +225,24 @@ export class PendingComponent implements OnInit {
this.collectionSizeListRoom = this.listRoomDetail.length;
}
openSearchEq() {
console.log(this.searcheqModel)
// this.searchService.getSearchEq();
// this.modalService.dismissAll();
// this.ngOnInit();
}
openSearchRoom() {
console.log(this.searchroomModel)
// this.searchService.getSearchRoom();
// this.modalService.dismissAll();
// this.ngOnInit();
}
}
export class NgbdDropdownBasic {
......
......@@ -3,6 +3,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Equirment, SearchEquirmentModel } from '../models/equirment.model';
import { ItemDetail } from '../models/itemDetail.model';
import { Observable } from 'rxjs';
import { Type } from '../models/type.model';
@Injectable({ providedIn: 'root' })
export class EquirmentService {
......@@ -19,6 +20,12 @@ export class EquirmentService {
})
}
addType(model : Type) {
this.http.post(this.url + "/type/", model).subscribe(response => {
console.log(response);
})
}
getListEquirment(): Observable<Equirment[]> {
return this.http.get<Equirment[]>(this.url + "/eqment/lists");
}
......
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Room, SearchRoomModel } from '../models/rooms.model';
import { Room } from '../models/rooms.model';
import { RoomDetail } from '../models/RoomDetail.model';
import { SearchRoomModel } from '../models/searchroom.model';
@Injectable({ providedIn: 'root' })
export class RoomService {
......@@ -27,8 +28,8 @@ export class RoomService {
return this.http.get<Room[]>(this.url + "/room/lists");
}
searchListRoom(searchModel: SearchRoomModel) {
this.http.get(this.url + '/limits?roomlimit=' + searchModel.roomlimit + '&startDate=' + searchModel.sdate.split("-")[2] + '-' + searchModel.sdate.split("-")[1] + '-' + searchModel.sdate.split("-")[0] + '&endDate=' + searchModel.edate.split("-")[2] + '-' + searchModel.edate.split("-")[1] + '-' + searchModel.edate.split("-")[0] + '&startTime=' + searchModel.stime + ':00' + '&endTime=' + searchModel.etime + ':00').subscribe((response: any) => {
searchListRoom(searchroomModel: SearchRoomModel) {
this.http.get(this.url + '/status?sroomStasus=' + searchroomModel.sroomStasus + '&startDate=' + searchroomModel.sDate + '&endDate=' + searchroomModel.eDate).subscribe((response: any) => {
console.log(response);
this.listRoomSearch = response;
}, error => {
......
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Search } from '../models/search.model';
import { SearchRoomModel } from '../models/searchroom.model';
import { SearchEqModel } from '../models/searcheq.model';
@Injectable({ providedIn: 'root'})
export class SearchService {
constructor(private http: HttpClient) {}
url: string = "http://5fa9-110-169-221-194.ngrok.io";
listSearch: Search[] = []
listSearchEq: SearchEqModel[] = []
getListSearch(){
return this.http.get<Search[]>(this.url + "/search");
getSearchEq(model: SearchEqModel){
return this.http.get<SearchEqModel[]>(this.url + "/search");
}
getSearchRoom(model: SearchRoomModel) {
return this.http.get<SearchRoomModel[]>(this.url + "/search");
}
}
\ No newline at end of file
......@@ -14,8 +14,11 @@ export class TypeService {
listType: Type[] = []
addType(model: Type) {
this.listType.push(model);
this.listType.reverse
console.log("type", model)
this.http.post(this.url + "/type/", model).subscribe(response => {
console.log(response);
})
}
getListType(): Observable<Type[]> {
......
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