2022-05-25 19:03:29 -03:00
|
|
|
<template>
|
|
|
|
<div v-show="visible" class="block">
|
|
|
|
<div class="field">
|
2022-06-08 20:32:50 -03:00
|
|
|
<label class="label" :class="isAdmin ? 'has-text-white' : ''">Seleccioná tu barrio o grupo de compra</label>
|
2022-05-25 19:03:29 -03:00
|
|
|
<div class="control">
|
|
|
|
<div class="select">
|
|
|
|
<select @change="onGDCSelected" v-model="gdc" name="name">
|
|
|
|
<option :disabled="isDefaultDisabled==1" value=null>Seleccionar</option>
|
2022-06-08 20:32:50 -03:00
|
|
|
<option v-for="gdc in gdcs" v-text="gdc.nombre + (isAdmin ? '_admin' : '')"
|
|
|
|
:name="gdc.nombre + (isAdmin ? '_admin' : '')">
|
|
|
|
</option>
|
2022-05-25 19:03:29 -03:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
visible: false,
|
|
|
|
region: null,
|
|
|
|
gdcs: [],
|
|
|
|
isDefaultDisabled: 0,
|
2022-06-08 15:18:14 -03:00
|
|
|
gdc: null,
|
2022-06-08 20:32:50 -03:00
|
|
|
isAdmin: this.admin == null ? false : this.admin
|
2022-05-25 19:03:29 -03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
Event.$on('region-seleccionada', (region)=> {
|
|
|
|
this.region = region;
|
|
|
|
this.fillGDC(region);
|
|
|
|
this.visible = true;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
methods : {
|
|
|
|
fillGDC(region) {
|
|
|
|
axios.get("/api/grupos-de-compra").then(response => {
|
|
|
|
this.gdcs = response.data[this.region];
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onGDCSelected() {
|
|
|
|
this.isDefaultDisabled = 1;
|
|
|
|
Event.$emit("gdc-seleccionado",this.gdc);
|
|
|
|
}
|
2022-06-08 15:18:14 -03:00
|
|
|
},
|
|
|
|
props: {'admin': Boolean}
|
2022-05-25 19:03:29 -03:00
|
|
|
}
|
2022-06-08 15:18:14 -03:00
|
|
|
</script>
|