From 865bb1f30a0c4567522525fb0be9fd99bd796ecf Mon Sep 17 00:00:00 2001
From: Mateja <mail@matejamaric.com>
Date: Sat, 13 Mar 2021 17:56:37 +0100
Subject: Adding boilerplate code.

---
 resources/js/components/call-sign-description.vue | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 resources/js/components/call-sign-description.vue

(limited to 'resources/js/components/call-sign-description.vue')

diff --git a/resources/js/components/call-sign-description.vue b/resources/js/components/call-sign-description.vue
new file mode 100644
index 0000000..48e54f5
--- /dev/null
+++ b/resources/js/components/call-sign-description.vue
@@ -0,0 +1,9 @@
+<template>
+  
+</template>
+
+<script>
+export default {
+  
+}
+</script>
-- 
cgit v1.2.3


From cc323d95fa3cad2d3ba437c37c4f29f8dff854eb Mon Sep 17 00:00:00 2001
From: Mateja <mail@matejamaric.com>
Date: Sun, 14 Mar 2021 18:22:56 +0100
Subject: Finished call-sign-description component.

---
 resources/js/components/call-sign-description.vue | 45 ++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 2 deletions(-)

(limited to 'resources/js/components/call-sign-description.vue')

diff --git a/resources/js/components/call-sign-description.vue b/resources/js/components/call-sign-description.vue
index 48e54f5..b0dca4d 100644
--- a/resources/js/components/call-sign-description.vue
+++ b/resources/js/components/call-sign-description.vue
@@ -1,9 +1,50 @@
 <template>
-  
+  <div>
+    <div class="form-group">
+        <label for="special-call">Special Callsign:</label>
+        <select class="form-control" id="special-call" v-model="selected" name="scall" required>
+          <option v-for="option in options" :value="option.sign" v-text="option.sign"></option>
+        </select> 
+    </div>
+
+    <div class="card mb-3">
+      <div class="card-body pb-1">
+        <div class="card-text" v-html="description"></div>
+      </div>
+    </div>
+  </div>
 </template>
 
 <script>
 export default {
-  
+  mounted() {
+    this.$store.dispatch('fillSigns').then(() => {
+      try {
+        this.$store.dispatch('setSelectedSign', this.$store.getters.getSigns[0].sign);
+      }
+      catch {
+        console.log('No call signs!');
+      }
+    });
+  },
+  computed: {
+    options() {
+      return this.$store.getters.getSigns;
+    },
+    selected: {
+      get() {
+        return this.$store.getters.getSelectedSign;
+      },
+      set(value) {
+        this.$store.dispatch('setSelectedSign', value);
+      }
+    },
+    description() {
+      for (let i = 0; i < this.options.length; i++)
+        if (this.options[i].sign === this.selected)
+          return this.options[i].description;
+      return '';
+    }
+  }
 }
 </script>
-- 
cgit v1.2.3


From 002399d427f11646847904b11b1373204644aee2 Mon Sep 17 00:00:00 2001
From: Mateja <mail@matejamaric.com>
Date: Mon, 15 Mar 2021 22:30:19 +0100
Subject: Use v-bind:key in v-for.

---
 resources/js/components/call-sign-description.vue | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'resources/js/components/call-sign-description.vue')

diff --git a/resources/js/components/call-sign-description.vue b/resources/js/components/call-sign-description.vue
index b0dca4d..e930176 100644
--- a/resources/js/components/call-sign-description.vue
+++ b/resources/js/components/call-sign-description.vue
@@ -3,7 +3,7 @@
     <div class="form-group">
         <label for="special-call">Special Callsign:</label>
         <select class="form-control" id="special-call" v-model="selected" name="scall" required>
-          <option v-for="option in options" :value="option.sign" v-text="option.sign"></option>
+          <option v-for="option in options" :key="option.id" :value="option.sign" v-text="option.sign"></option>
         </select> 
     </div>
 
-- 
cgit v1.2.3


From 2f5e8adb8d310690db54aca55382f4733e337a85 Mon Sep 17 00:00:00 2001
From: Mateja <mail@matejamaric.com>
Date: Sat, 20 Mar 2021 19:42:18 +0100
Subject: Better names for Vuex actions and mutations.

---
 resources/js/components/call-sign-description.vue | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'resources/js/components/call-sign-description.vue')

diff --git a/resources/js/components/call-sign-description.vue b/resources/js/components/call-sign-description.vue
index e930176..30cd37d 100644
--- a/resources/js/components/call-sign-description.vue
+++ b/resources/js/components/call-sign-description.vue
@@ -18,7 +18,7 @@
 <script>
 export default {
   mounted() {
-    this.$store.dispatch('fillSigns').then(() => {
+    this.$store.dispatch('pullSigns').then(() => {
       try {
         this.$store.dispatch('setSelectedSign', this.$store.getters.getSigns[0].sign);
       }
-- 
cgit v1.2.3


From 4826b8d444db4f95baeead504fb816e7322ff026 Mon Sep 17 00:00:00 2001
From: Mateja <mail@matejamaric.com>
Date: Sun, 21 Mar 2021 23:11:56 +0100
Subject: Add error handling to `call-sign-description.vue` component.

---
 resources/js/components/call-sign-description.vue | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'resources/js/components/call-sign-description.vue')

diff --git a/resources/js/components/call-sign-description.vue b/resources/js/components/call-sign-description.vue
index 30cd37d..7ab8b64 100644
--- a/resources/js/components/call-sign-description.vue
+++ b/resources/js/components/call-sign-description.vue
@@ -2,7 +2,7 @@
   <div>
     <div class="form-group">
         <label for="special-call">Special Callsign:</label>
-        <select class="form-control" id="special-call" v-model="selected" name="scall" required>
+        <select class="form-control" :class="{ 'is-invalid': isInvalid }" id="special-call" v-model="selected" :name="name" required>
           <option v-for="option in options" :key="option.id" :value="option.sign" v-text="option.sign"></option>
         </select> 
     </div>
@@ -17,10 +17,16 @@
 
 <script>
 export default {
+  props: [ 'name', 'old', 'isInvalid' ],
   mounted() {
     this.$store.dispatch('pullSigns').then(() => {
       try {
-        this.$store.dispatch('setSelectedSign', this.$store.getters.getSigns[0].sign);
+        if (this.old) {
+          this.$store.dispatch('setSelectedSign', this.old);
+        }
+        else {
+          this.$store.dispatch('setSelectedSign', this.$store.getters.getSigns[0].sign);
+        }
       }
       catch {
         console.log('No call signs!');
-- 
cgit v1.2.3

