@mixd-id/web-scaffold 0.1.230406089 → 0.1.230406091

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406089",
4
+ "version": "0.1.230406091",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -171,6 +171,10 @@ export default {
171
171
  @apply appearance-none outline-none p-2 bg-transparent cursor-pointer w-full;
172
172
  }
173
173
 
174
+ .dropdown option[disabled]{
175
+ @apply text-text-300;
176
+ }
177
+
174
178
  .arrow{
175
179
  @apply absolute right-0 pointer-events-none px-2;
176
180
  top: 50%;
@@ -44,7 +44,8 @@
44
44
  </Dropdown>
45
45
 
46
46
  <Dropdown v-else-if="field.type === 'provinceName'" v-model="form[field.type]" class="text-xl">
47
- <option v-for="item in field.items" :value="item.text">{{ item.text }}</option>
47
+ <option disabled selected value="">Propinsi</option>
48
+ <option v-for="item in field.provinces" :value="item.alias">{{ item.alias }}</option>
48
49
  </Dropdown>
49
50
 
50
51
  <Dropdown v-else-if="field.type === 'education'" v-model="form[field.type]" class="text-xl">
@@ -62,7 +63,7 @@
62
63
  </div>
63
64
  </div>
64
65
 
65
- <CitySelector ref="citySelector" @change="(city) => form['birthPlace'] = city.alias"/>
66
+ <CitySelector ref="citySelector" @change="setCity"/>
66
67
 
67
68
  <Button ref="submitBtn" class="w-full" @click="submitForm" :state="!canSubmit ? -1 : 1">
68
69
  <h5>{{ completed ? 'Form berhasil dikirim' : 'Kirim' }}</h5>
@@ -73,11 +74,10 @@
73
74
  <script>
74
75
 
75
76
  import {componentMixin} from "../mixin/component";
76
- import axios from "axios";
77
77
 
78
78
  export default{
79
79
 
80
- inject: [ 'alert' ],
80
+ inject: [ 'alert', 'axios' ],
81
81
 
82
82
  mixins: [ componentMixin ],
83
83
 
@@ -111,7 +111,7 @@ export default{
111
111
  if(!this.submitUrl) return
112
112
 
113
113
  this.$refs.submitBtn.setState(2)
114
- axios({
114
+ this.axios({
115
115
  method: this.submitMethod ?? 'post',
116
116
  url: import.meta.env.VITE_API_HOST + this.submitUrl,
117
117
  data: {
@@ -124,6 +124,16 @@ export default{
124
124
  .then(_ => this.completed = true)
125
125
  .catch(err => this.alert(err))
126
126
  .finally(_ => this.$refs.submitBtn.resetState(2))
127
+ },
128
+
129
+ setCity(city){
130
+ const provinceIdx = this.fields.findIndex((_) => _.type === 'birthDate')
131
+ if(provinceIdx >= 0){
132
+ this.form['birthPlace'] = city.alias;
133
+ if(city.longitude && city.latitude){
134
+ this.form['birthPlaceCoord'] = `https://www.google.com/maps?q=${city.latitude},${city.longitude}`;
135
+ }
136
+ }
127
137
  }
128
138
 
129
139
  },