Commit bcdb8048 by Your Name

Update Validator หน้า equirment

parent a7c3cead
...@@ -48,8 +48,6 @@ export class ContactAdminComponent implements OnInit { ...@@ -48,8 +48,6 @@ export class ContactAdminComponent implements OnInit {
this.collectionSizeListRoom = this.listContact.length; this.collectionSizeListRoom = this.listContact.length;
this.collectionSize = this.listContact.length this.collectionSize = this.listContact.length
this.myFormAddContact = new FormGroup({ this.myFormAddContact = new FormGroup({
ctName: new FormControl('', [Validators.required]), ctName: new FormControl('', [Validators.required]),
ctDesc: new FormControl(''), ctDesc: new FormControl(''),
......
...@@ -172,9 +172,9 @@ ...@@ -172,9 +172,9 @@
</div> </div>
<div class=" card-footer"> <div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit" (click)="saveEquirment()">Save</button> <button class=" btn btn-fill btn-danger" type="submit" (click)="saveEquirment()">บันทึก</button>
<button class=" btn btn-fill btn-danger" type="cancel" <button class=" btn btn-fill btn-danger" type="cancel"
(click)="modal.dismiss('Cross click')">Cancel</button> (click)="modal.dismiss('Cross click')">ยกเลิก</button>
</div> </div>
</div> </div>
</div> </div>
...@@ -339,7 +339,6 @@ ...@@ -339,7 +339,6 @@
<label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label> <label for="exampleFormControlSelect1">เวลาที่สิ้นสุด</label>
<input class="form-control" type="time" [(ngModel)]="modelRoomDetail.eTime" <input class="form-control" type="time" [(ngModel)]="modelRoomDetail.eTime"
formControlName="eTime" /> formControlName="eTime" />
<div style="color: red;" *ngIf="myFormRoom.controls.eTime.status=='INVALID'"> <div style="color: red;" *ngIf="myFormRoom.controls.eTime.status=='INVALID'">
กรุณากรอกเวลาที่สิ้นสุดการจอง. กรุณากรอกเวลาที่สิ้นสุดการจอง.
</div> </div>
...@@ -350,16 +349,16 @@ ...@@ -350,16 +349,16 @@
<div class=" form-group"> <div class=" form-group">
<label> หมายเหตุ </label> <label> หมายเหตุ </label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3" <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" [(ngModel)]="modelRoomDetail.Remark" placeholder="......" [(ngModel)]="modelRoomDetail.remark"
formControlName="Remark"></textarea> formControlName="remark"></textarea>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<div class=" card-footer"> <div class=" card-footer">
<button class=" btn btn-fill btn-danger" [disabled]="" type="button" (click)="saveBook()">Save</button> <button class=" btn btn-fill btn-danger" [disabled]="myFormRoom.invalid" type="button" (click)="saveBook()">บันทึก</button>
<button class=" btn btn-fill btn-danger" type="cancel" (click)="modal.dismiss('Cross click')">Cancel</button> <button class=" btn btn-fill btn-danger" type="cancel" (click)="modal.dismiss('Cross click')">ยกเลิก</button>
</div> </div>
</div> </div>
</div> </div>
...@@ -448,15 +447,15 @@ ...@@ -448,15 +447,15 @@
<div class=" form-group"> <div class=" form-group">
<label> หมายเหตุ </label> <label> หมายเหตุ </label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3" <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"
placeholder="......" [(ngModel)]="modelItemDetail.Remark" placeholder="......" [(ngModel)]="modelItemDetail.remark"
formControlName="Remark"></textarea> formControlName="remark"></textarea>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<div class=" card-footer"> <div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit" (click)="saveLend()">Save</button> <button class=" btn btn-fill btn-danger" [disabled]="myFormEquir.invalid" type="submit" (click)="saveLend()">Save</button>
<button class=" btn btn-fill btn-danger" type="cancel" (click)="modal.dismiss('Cross click')">Cancel</button> <button class=" btn btn-fill btn-danger" type="cancel" (click)="modal.dismiss('Cross click')">Cancel</button>
</div> </div>
</div> </div>
......
...@@ -79,23 +79,22 @@ export class EquipmentComponent implements OnInit { ...@@ -79,23 +79,22 @@ export class EquipmentComponent implements OnInit {
eDate : new FormControl('',[Validators.required]), eDate : new FormControl('',[Validators.required]),
sTime : new FormControl('',[Validators.required]), sTime : new FormControl('',[Validators.required]),
eTime : new FormControl('',[Validators.required]), eTime : new FormControl('',[Validators.required]),
Remark : new FormControl(), remark : new FormControl(''),
allDay: new FormControl() allDay: new FormControl('')
}); });
this.myFormEquir = new FormGroup({ this.myFormEquir = new FormGroup({
userNameForm : new FormControl('',[Validators.required]), userNameForm : new FormControl('',[Validators.required]),
eTelephone : new FormControl('',[Validators.required]), eTelephone : new FormControl('',[Validators.required]),
email : new FormControl('',[Validators.required, Validators.email]), email : new FormControl('',[Validators.required, Validators.email]),
eqName : new FormControl('',[Validators.required]), eqName : new FormControl('',[Validators.required]),
eqDesc : new FormControl('',[Validators.required]), eqDesc : new FormControl('',[Validators.required]),
eqType : new FormControl('',[Validators.required]),
eqPic : new FormControl('',[Validators.required]),
sDate : new FormControl('',[Validators.required]), sDate : new FormControl('',[Validators.required]),
eDate : new FormControl('',[Validators.required]), eDate : new FormControl(''),
sTime : new FormControl('',[Validators.required]), sTime : new FormControl(''),
eTime : new FormControl('',[Validators.required]), eTime : new FormControl(''),
Quantity : new FormControl('',[Validators.required]), Quantity : new FormControl('',[Validators.required]),
Remark : new FormControl('',[Validators.required]), remark : new FormControl(''),
}) })
} }
...@@ -114,6 +113,21 @@ export class EquipmentComponent implements OnInit { ...@@ -114,6 +113,21 @@ export class EquipmentComponent implements OnInit {
this.modelItemDetail = new ItemDetail(); this.modelItemDetail = new ItemDetail();
this.modelItemDetail.equirment = item ; this.modelItemDetail.equirment = item ;
this.myFormEquir = new FormGroup({
userNameForm : new FormControl(this.modelItemDetail.userName,[Validators.required]),
eTelephone : new FormControl(this.modelItemDetail.eTelephone,[Validators.required]),
email : new FormControl(this.modelItemDetail.email,[Validators.required, Validators.email]),
eqName : new FormControl(this.modelItemDetail.equirment.eqName,[Validators.required]),
eqDesc : new FormControl(this.modelItemDetail.equirment.eqDesc,[Validators.required]),
sDate : new FormControl(this.modelItemDetail.sDate,[Validators.required]),
eDate : new FormControl(''),
sTime : new FormControl(''),
eTime : new FormControl(''),
Quantity : new FormControl('',[Validators.required]),
remark : new FormControl(''),
})
console.log("item",this.modelItemDetail); console.log("item",this.modelItemDetail);
this.modalService.open(Lend, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(Lend, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
...@@ -127,6 +141,22 @@ export class EquipmentComponent implements OnInit { ...@@ -127,6 +141,22 @@ export class EquipmentComponent implements OnInit {
this.modelRoomDetail = new RoomDetail(); this.modelRoomDetail = new RoomDetail();
this.modelRoomDetail.room = item ; this.modelRoomDetail.room = item ;
this.myFormRoom = new FormGroup({
userNameForm : new FormControl(this.modelRoomDetail.userName,[Validators.required]),
rTelephone : new FormControl(this.modelRoomDetail.rTelephone,[Validators.required]),
email : new FormControl(this.modelRoomDetail.email,[Validators.required, Validators.email]),
rName : new FormControl(this.modelRoomDetail.room.rName,[Validators.required]),
rDesc : new FormControl(this.modelRoomDetail.room.rDesc,[Validators.required]),
rType : new FormControl(this.modelRoomDetail.room.rType,[Validators.required]),
sDate : new FormControl(this.modelRoomDetail.sDate,[Validators.required]),
eDate : new FormControl(this.modelRoomDetail.eDate,[Validators.required]),
sTime : new FormControl(this.modelRoomDetail.sTime,[Validators.required]),
eTime : new FormControl(this.modelRoomDetail.eTime,[Validators.required]),
remark : new FormControl(''),
allDay: new FormControl('')
});
console.log("room",this.modelRoomDetail); console.log("room",this.modelRoomDetail);
this.modalService.open(Room, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(Room, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
......
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