From bca39a475dfd3aab0b31709b2c4873398901b00c Mon Sep 17 00:00:00 2001
From: Andrew <saintruler@gmail.com>
Date: Fri, 19 Jul 2019 00:11:33 +0400
Subject: =?UTF-8?q?=D0=9A=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20=D1=83=D0=B4?=
 =?UTF-8?q?=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=80=D1=8F=D0=B4=D0=B0?=
 =?UTF-8?q?=20=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=B4=D0=B5=D0=B9?=
 =?UTF-8?q?=D1=81=D1=82=D0=B2=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=20?=
 =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 day9/task5_vue/src/App.vue | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

(limited to 'day9/task5_vue/src/App.vue')

diff --git a/day9/task5_vue/src/App.vue b/day9/task5_vue/src/App.vue
index 3ce2035..2af8b20 100644
--- a/day9/task5_vue/src/App.vue
+++ b/day9/task5_vue/src/App.vue
@@ -1,12 +1,19 @@
 <template>
     <div>
-        <Table v-bind:table-data="tableData"/>
-        <UploadFileButton/>
-        <AddNewEntryButton/>
+        <EditFormBox
+                v-bind:form-type="formType"
+                v-bind:cancel-callback="hideForm"
+                v-bind:table-row="formData"
+                v-if="isFormShown"
+        />
+        <Table v-bind:table-data="tableData" v-bind:show-form-callback="showForm"/>
+        <UploadFileButton v-if="!isFormShown"/>
+        <AddNewEntryButton v-if="!isFormShown" v-bind:show-form-callback="showForm"/>
     </div>
 </template>
 
 <script>
+    import EditFormBox from "./components/EditFormBox.vue";
     import Table from "./components/Table.vue";
     import UploadFileButton from "./components/UploadFileButton.vue";
     import AddNewEntryButton from './components/AddNewEntryButton.vue';
@@ -14,11 +21,14 @@
 
     export default {
         name: "App",
-        components: {Table, UploadFileButton, AddNewEntryButton},
+        components: {EditFormBox, Table, UploadFileButton, AddNewEntryButton},
 
         data() {
             return {
-                tableData: []
+                tableData: [],
+                formType: null,
+                formData: null,
+                isFormShown: false
             }
         },
 
@@ -33,6 +43,20 @@
                 .then(response => {
                     this.tableData = response.data;
                 })
+        },
+
+        methods: {
+            showForm(formType, formData) {
+                this.formType = formType;
+                this.formData = formData;
+                this.isFormShown = true;
+            },
+
+            hideForm() {
+                this.formType = null;
+                this.formData = null;
+                this.isFormShown = false;
+            }
         }
     }
 </script>
-- 
cgit v1.2.3

