From 6fdfea944bd9cdcb41f1cec2e59f1044f2b22ba9 Mon Sep 17 00:00:00 2001
From: Ricky Kenendy <13516105@std.stei.itb.ac.id>
Date: Fri, 19 Apr 2019 11:21:12 +0700
Subject: [PATCH] add admin selection card

---
 src/components/partials/TableBudget.vue | 53 +++++++++++++++++++------
 1 file changed, 41 insertions(+), 12 deletions(-)

diff --git a/src/components/partials/TableBudget.vue b/src/components/partials/TableBudget.vue
index 7f7aa2f..4783fce 100644
--- a/src/components/partials/TableBudget.vue
+++ b/src/components/partials/TableBudget.vue
@@ -8,13 +8,38 @@
           {{"Admin : " + data.current_item.admin_name}}
         </h3>
       </b-row>
+      <b-row v-if="showCard">
+        <b-card >
+          <small><b>Mohon pilih Admin dari daftar di bawah ini:</b></small>
+            <b-form-select
+              v-model="selected"
+              :options="options"
+              size="sm"
+            />
+            <b-button
+              @click="assignAdmin(row)"
+              variant="primary"
+              size="sm"
+              class="float-right mt-2 ml-2"
+            >
+              Pilih Admin
+            </b-button>
+            <b-button
+              v-on:click="changeShowCardState()"
+              size="sm"
+              class="float-right mt-2"
+            >
+              Batalkan
+            </b-button>
+        </b-card>
+      </b-row>
       <b-row class="my-2" align-h="end">
         <b-col 
           v-if="data.current_item.admin_name === '--'" 
           cols="auto"
         >
           <b-button
-            v-on:click="switchToggleDetails(row)"
+            v-on:click="changeShowCardState()"
             variant="success"
             size="sm"
           >
@@ -26,14 +51,14 @@
           cols="auto"
         >
             <b-button
-              @click="switchToggleDetails(row)"
+              v-on:click="changeShowCardState()"
               variant="primary"
               size="sm"
             >
               Ubah Admin
             </b-button>
             <b-button
-              @click="clearButtonHandler(row)"
+              v-on:click="clearButtonHandler(row)"
               variant="danger"
               size="sm"
             >
@@ -51,6 +76,7 @@
           </b-button>
         </b-col>
       </b-row>
+      
       <b-row align-h='center' v-if="seen" class=" justify-content-center overflow-auto">
           <b-table
             hover
@@ -131,6 +157,13 @@ export default {
     return {
       seen : false,
       isBusy : false,
+      showCard : false,
+      options: [
+        { value: '0', text: 'Rifo Ahmad Genadi' },
+        { value: '1', text: 'David Timothy Panjaitan' },
+        { value: '2', text: 'William Rukmansa' },
+        { value: '3', text: 'Ricky Kennedy' }
+      ],
     }
   },
   computed: {
@@ -166,15 +199,8 @@ export default {
         return 'table-success'
     },
 
-    switchToggleDetails : function(newRow) {
-      if (this.currentRow) {
-        this.currentRow.toggleDetails()
-      }
-      if (newRow) {
-        newRow.toggleDetails()
-      }
-      this.currentRow = newRow
-      this.selected = null
+    changeShowCardState : function() {
+      this.showCard = !this.showCard;
     }
       
   },
@@ -201,5 +227,8 @@ export default {
   padding : 0px 5px;
 }
 
+.card {
+  width: 100%;
+}
 
 </style>
\ No newline at end of file
-- 
GitLab