CitySettings.vue
1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<template>
<div>
<h2 class="mt-12 font-bold text-2xl">Cities</h2>
<div class="mt-4 flex flex-wrap">
<div v-if="all_cities" class="flex flex-wrap">
<select-input v-model="city" class="px-6">
<option v-for="city in all_cities" :value="city.id">
{{ city.name }}
</option>
</select-input>
<button class="btn-indigo hover:underline"
tabindex="-1"
type="button"
@click="cityAdd"
>
Add
</button>
</div>
</div>
<div class="mt-6 bg-white rounded shadow">
<table class="w-full whitespace-nowrap">
<tr class="text-left font-bold">
<th class="px-6 pt-6 pb-4">Name</th>
</tr>
<tr v-for="city in cities" :key="city.id"
class="hover:bg-gray-100 focus-within:bg-gray-100">
<td class="border-t">
<span class="px-6 py-4 flex items-center focus:text-indigo-500"> {{ city.name }} </span>
</td>
</tr>
<tr v-if="cities.length === 0">
<td class="border-t px-6 py-4" colspan="4">No City found.</td>
</tr>
</table>
</div>
</div>
</template>
<script>
import SelectInput from "../../Shared/SelectInput";
export default {
components: {SelectInput},
props: {
cities: Array,
all_cities: Array,
},
data() {
return {
city: false
}
},
watch: {
},
mounted() {
},
methods: {
cityAdd(){
this.$emit('add', this.city)
}
}
}
</script>