From e31a1e11ba944d4e700d5b1bd0a09212ebf6191f Mon Sep 17 00:00:00 2001
From: DESKTOP-HF0LVOG\myhr <teetacg@csc.co.th>
Date: Wed, 15 Dec 2021 16:33:19 +0700
Subject: [PATCH] Update ลบอุปกรณ์

---
 src/app/pages/admin-equirment/admin-equirment.component.html | 19 ++++++++++++++++++-
 src/app/pages/admin-equirment/admin-equirment.component.ts   | 17 ++++++++++++++++-
 src/app/pages/admin-pending/admin-pending.component.html     | 10 ++++------
 src/app/pages/pending/pending.component.html                 |  5 ++---
 src/app/service/equirment.service.ts                         |  6 ++++++
 5 files changed, 46 insertions(+), 11 deletions(-)

diff --git a/src/app/pages/admin-equirment/admin-equirment.component.html b/src/app/pages/admin-equirment/admin-equirment.component.html
index f8b4f49..26a6701 100644
--- a/src/app/pages/admin-equirment/admin-equirment.component.html
+++ b/src/app/pages/admin-equirment/admin-equirment.component.html
@@ -100,7 +100,7 @@
                                                     <button class="btn btn-sm btn-outline-primary"
                                                         (click)="Eopen(editLend,((page-1) * pageSize)+i)">แก้ไข</button>
                                                     <button class="btn btn-sm btn-danger"
-                                                        type="button.dispose">ลบ</button>
+                                                        (click)="openDeleteEquirment(deleteEquirPopup,item)">ลบ</button>
                                                 </div>
                                             </div>
                                         </div>
@@ -350,4 +350,21 @@
             </div>
         </div>
     </div>
+</ng-template>
+
+<ng-template #deleteEquirPopup let-modal>
+    <div class=" col-md-12" style="padding: 0; ">
+        <div class="card" style="margin: 0; ">
+            <div class=" card-header">
+                <h5 class=" title">ลบข้อมูล</h5>
+            </div>
+            <div class="card-body">
+                <h4 class="text">คุณต้องการลบข้อมูลจริงหรือไม่</h4>
+            </div>
+            <div class=" card-footer">
+                <button class=" btn btn-fill btn-danger" type="submit" (click)="deleteEquirProfile()">ยืนยัน</button>
+                <button class=" btn btn-fill btn-danger" type="cancel" (click)="modal.dismiss()">ยกเลิก</button>
+            </div>
+        </div>
+    </div>
 </ng-template>
\ No newline at end of file
diff --git a/src/app/pages/admin-equirment/admin-equirment.component.ts b/src/app/pages/admin-equirment/admin-equirment.component.ts
index 3526680..053feaf 100644
--- a/src/app/pages/admin-equirment/admin-equirment.component.ts
+++ b/src/app/pages/admin-equirment/admin-equirment.component.ts
@@ -282,8 +282,14 @@ export class AdminEquirmentComponent implements OnInit {
     this.modalService.dismissAll();
     this.ngOnInit();
   }
+  
+  deleteEquirProfile() {
+    this.equirmentService.deleteEquirProfile(this.modelEquirment)
+    this.modalService.dismissAll();
+    this.ngOnInit();
+  }
 
-  openDelete(deleteRoom , item) {
+  openDeleteRoom(deleteRoom , item) {
     this.modelRoom = item ;
     this.modalService.open(deleteRoom, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
       this.closeResult = `Closed with: ${result}`;
@@ -292,4 +298,13 @@ export class AdminEquirmentComponent implements OnInit {
     });
   }
 
+  openDeleteEquirment(deleteEquirment , item) {
+    this.modelEquirment = item ;
+    this.modalService.open(deleteEquirment, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
+      this.closeResult = `Closed with: ${result}`;
+    }, (reason) => {
+      this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
+    });
+  }
+
 }
diff --git a/src/app/pages/admin-pending/admin-pending.component.html b/src/app/pages/admin-pending/admin-pending.component.html
index f6b5ea1..40cb84f 100644
--- a/src/app/pages/admin-pending/admin-pending.component.html
+++ b/src/app/pages/admin-pending/admin-pending.component.html
@@ -94,10 +94,9 @@
                                             <td>{{ item.userName }}</td>
                                             <td>{{ item.sDate | date : 'dd/MM/yyyy' }} {{ item.sTime }}</td>
                                             <td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime }}</td>
-                                            <td *ngIf="item.rStatus==0">รอดำเนินการ</td>
-                                            <td *ngIf="item.rStatus==1">อนุมัติ</td>
+                                            <td *ngIf="item.rStatus==0">จอง</td>
+                                            <td *ngIf="item.rStatus==1">ไม่อนุมัติ</td>
                                             <td *ngIf="item.rStatus==2">ยกเลิก</td>
-                                            <td *ngIf="item.rStatus==3">สำเร็จแล้ว</td>
                                             <div class="col-auto align-self-sm-center">
                                                 <button type="button" class="btn btn-info btn-sm btn-circle "
                                                     style="line-height: 0px" (click)="openRoomDetail(Room,item)"><i
@@ -295,10 +294,9 @@
                             <label> สถานะ </label>
                             <select class="custom-select form-control" aria-label="Default select example"
                             formControlName="rStatus">
-                                <option value="0" selected style="color: black;">รอดำเนินการ</option>
-                                <option value="1" style="color: black;">อนุมัติ</option>
+                                <option value="0" selected style="color: black;">จอง</option>
+                                <option value="1" style="color: black;">ไม่อนุมัติ</option>
                                 <option value="2" style="color: black;">ยกเลิก</option>
-                                <option value="3" style="color: black;">สำเร็จแล้ว</option>
                             </select>
                         </div>
                     </div>
diff --git a/src/app/pages/pending/pending.component.html b/src/app/pages/pending/pending.component.html
index d38bf83..9bc962c 100644
--- a/src/app/pages/pending/pending.component.html
+++ b/src/app/pages/pending/pending.component.html
@@ -94,10 +94,9 @@
                                             <td>{{ item.userName }}</td>
                                             <td>{{ item.sDate | date : 'dd/MM/yyyy' }} {{ item.sTime }}</td>
                                             <td>{{ item.eDate | date : 'dd/MM/yyyy' }} {{ item.eTime }}</td>
-                                            <td *ngIf="item.rStatus==0">รอดำเนินการ</td>
-                                            <td *ngIf="item.rStatus==1">อนุมัติ</td>
+                                            <td *ngIf="item.rStatus==0">จอง</td>
+                                            <td *ngIf="item.rStatus==1">ไม่อนุมัติ</td>
                                             <td *ngIf="item.rStatus==2">ยกเลิก</td>
-                                            <td *ngIf="item.rStatus==3">สำเร็จแล้ว</td>
                                             <div class="col-auto align-self-sm-center">
                                                 <button type="button" class="btn btn-info btn-sm btn-circle "
                                                     style="line-height: 0px" (click)="openRoomDetail(Room,item)"><i
diff --git a/src/app/service/equirment.service.ts b/src/app/service/equirment.service.ts
index 95b1a12..80f944d 100644
--- a/src/app/service/equirment.service.ts
+++ b/src/app/service/equirment.service.ts
@@ -215,6 +215,12 @@ export class EquirmentService {
   });
   }
 
+  deleteEquirProfile(row_obj: Equirment) {
+    this.listEquirment = this.listEquirment.filter((value, key) => {
+      return value.eqId !== row_obj.eqId;
+    });
+  }
+
   EquirmentModel(eqId: string) {
 
   }
--
libgit2 0.26.0