Commit 3993eda7 by Chanachai

Update Validators หน้า admin

parent bcdb8048
...@@ -179,12 +179,12 @@ ...@@ -179,12 +179,12 @@
</div> </div>
</div> </div>
<label for="exampleFormControlFile">แนบไฟล์รูปภาพ</label> <label for="exampleFormControlFile">แนบไฟล์รูปภาพ</label>
<input type="file" class="form-control-file" id="exampleFormControlFile" formControlName="eqPic"> <input type="file" class="form-control-file" id="exampleFormControlFile" >
</form> </form>
</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" [disabled]="myFormEquir.invalid" type="submit" (click)="saveEquirment()">Save</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')">Cancel</button>
</div> </div>
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</form> </form>
</div> </div>
<div class=" card-footer"> <div class=" card-footer">
<button class=" btn btn-fill btn-danger" type="submit" (click)="saveRoom()">Save</button> <button class=" btn btn-fill btn-danger" [disabled]="myFormRoom.invalid" type="submit" (click)="saveRoom()">Save</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')">Cancel</button>
</div> </div>
......
...@@ -65,34 +65,7 @@ export class AdminEquirmentComponent implements OnInit { ...@@ -65,34 +65,7 @@ export class AdminEquirmentComponent implements OnInit {
this.collectionSizeListRoom = this.listRoomModel.length this.collectionSizeListRoom = this.listRoomModel.length
this.collectionSize = this.listEquirmentModel.length this.collectionSize = this.listEquirmentModel.length
console.log("listRoom", this.listRoomModel) console.log("listRoom", this.listRoomModel)
this.myFormRoom = new FormGroup({
userNameForm : new FormControl('',[Validators.required]),
rTelephone : new FormControl('',[Validators.required]),
email : new FormControl('',[Validators.required, Validators.email]),
rName : new FormControl('',[Validators.required]),
rDesc : new FormControl('',[Validators.required]),
rType : new FormControl('',[Validators.required]),
sDate : new FormControl('',[Validators.required]),
eDate : new FormControl('',[Validators.required]),
sTime : new FormControl('',[Validators.required]),
eTime : new FormControl('',[Validators.required]),
remark : new FormControl()
});
this.myFormEquir = new FormGroup({
userNameForm : new FormControl('',[Validators.required]),
eTelephone : new FormControl('',[Validators.required]),
email : new FormControl('',[Validators.required, Validators.email]),
eqName : new FormControl('',[Validators.required]),
eqDesc : new FormControl('',[Validators.required]),
eqType : new FormControl('',[Validators.required]),
eqPic : new FormControl('',[Validators.required]),
sDate : new FormControl('',[Validators.required]),
eDate : new FormControl('',[Validators.required]),
sTime : new FormControl('',[Validators.required]),
eTime : new FormControl('',[Validators.required]),
Quantity : new FormControl('',[Validators.required]),
remark : new FormControl('',[Validators.required]),
})
} }
bookEquir(editLend, item: Equirment) { bookEquir(editLend, item: Equirment) {
...@@ -195,6 +168,11 @@ export class AdminEquirmentComponent implements OnInit { ...@@ -195,6 +168,11 @@ export class AdminEquirmentComponent implements OnInit {
openItemDetail(contentequirment) { openItemDetail(contentequirment) {
this.modelEquirment = new Equirment(); this.modelEquirment = new Equirment();
this.myFormEquir = new FormGroup({
eqName : new FormControl(this.modelEquirment.eqName,[Validators.required]),
eqType : new FormControl(this.modelEquirment.eqType,[Validators.required]),
eqDesc : new FormControl(this.modelEquirment.eqDesc,[Validators.required]),
})
this.modalService.open(contentequirment, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(contentequirment, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
}, (reason) => { }, (reason) => {
...@@ -204,6 +182,11 @@ export class AdminEquirmentComponent implements OnInit { ...@@ -204,6 +182,11 @@ export class AdminEquirmentComponent implements OnInit {
openRoomDetail(contentroom) { openRoomDetail(contentroom) {
this.modelRoom = new MyRoom(); this.modelRoom = new MyRoom();
this.myFormRoom = new FormGroup({
rName : new FormControl(this.modelRoom.rName,[Validators.required]),
rType : new FormControl(this.modelRoom.rType,[Validators.required]),
rDesc : new FormControl(this.modelRoom.rDesc,[Validators.required]),
})
this.modalService.open(contentroom, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => { this.modalService.open(contentroom, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
}, (reason) => { }, (reason) => {
......
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