Commit b7b3a066 authored by K9260's avatar K9260 🎅🏼

Suosikkien poisto sekä fixi

parent 647ec419
......@@ -2726,24 +2726,6 @@ __webpack_require__.r(__webpack_exports__);
props: {
favorites: Array
},
methods: {
removeFavorite: function removeFavorite() {
for (var i = 0; i < this.favorites.length; i++) {
if (this.favorite != this.favorites[i]) {
this.favorites_temp.push(this.favorites[i]);
}
}
console.log(this.favorites_temp);
this.favorites_temp;
this.$store.commit("mutateFavorites", this.favorites_temp);
}
},
computed: {
favorites2: function favorites2() {
return this.$store.getters.favorites;
}
},
watch: {
favorite: function favorite() {
this.$emit('pushFavorite', this.favorite);
......@@ -2857,8 +2839,6 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
name: 'AutocompleteBox',
......@@ -2878,7 +2858,8 @@ __webpack_require__.r(__webpack_exports__);
hour: 0,
values: [],
labels: [],
loading: false
loading: false,
favorites_temp: []
};
},
components: {
......@@ -2960,6 +2941,26 @@ __webpack_require__.r(__webpack_exports__);
},
pullFavorite: function pullFavorite(favorite) {
this.selectedKunta = favorite;
},
removeFavorite: function removeFavorite() {
this.favorites_temp = [];
for (var i = 0; i < this.favorites.length; i++) {
if (this.selectedKunta != this.favorites[i]) {
this.favorites_temp.push(this.favorites[i]);
}
}
this.favorites_temp;
this.$store.commit("mutateFavorites", this.favorites_temp);
this.favorites = this.favorites_temp;
},
kuntaIsFavorite: function kuntaIsFavorite() {
for (var i = 0; i < this.favorites.length; i++) {
if (this.selectedKunta == this.favorites[i]) return true;
}
return false;
}
},
mounted: function mounted() {
......@@ -3185,8 +3186,6 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
components: {
......@@ -3236,10 +3235,9 @@ __webpack_require__.r(__webpack_exports__);
if (this.ticks < 2) this.ticks = 2;
}
while (this.max % this.interval != 0) {
while (this.max % this.interval != 0 || this.max < this.interval) {
this.max++;
} // if (this.max < this.interval) this.max = this.interval;
}
this.icon = '/images/icons/';
this.temperatures = [];
......@@ -46067,7 +46065,7 @@ var render = function() {
items: _vm.favorites,
label: "Suosikit",
"prepend-icon": "star",
color: "light-green accent-4",
color: "yellow darken-1",
solo: ""
},
model: {
......@@ -46228,15 +46226,19 @@ var render = function() {
},
on: { click: _vm.addFavorite }
},
[
_vm._v(
"\n Lisää suosikiksi\n "
),
_c("v-icon", { attrs: { right: "" } }, [
_vm._v("mdi-close-circle")
])
],
1
[_vm._v("Lisää suosikiksi")]
),
_vm._v(" "),
_c(
"v-btn",
{
attrs: {
disabled: !_vm.kuntaIsFavorite(),
color: "yellow darken-1"
},
on: { click: _vm.removeFavorite }
},
[_vm._v("Poista")]
)
],
1
<template>
<v-flex xs12 md6 pa-2>
<ClothSlider :cloth="hats" />
<ClothSlider :cloth="upperBody" />
<ClothSlider :cloth="lowerBody" />
<ClothSlider :cloth="shoes" />
<ClothSlider :cloth="hats"/>
<ClothSlider :cloth="upperBody"/>
<ClothSlider :cloth="lowerBody"/>
<ClothSlider :cloth="shoes"/>
</v-flex>
</template>
......@@ -41,9 +41,7 @@
clothesToArrays() {
// 0 is empty
var j = this.getTemperatureIndex();
// console.table(this.clothes[j]);
this.resetVariables();
for (var i = 0; i < this.clothes[j].length; i++) {
if (this.clothes[j][i].tyyppi == 'hattu') {
......
......@@ -4,7 +4,7 @@
:items="favorites"
label="Suosikit"
prepend-icon="star"
color="light-green accent-4"
color="yellow darken-1"
solo
></v-select>
</template>
......@@ -19,23 +19,7 @@
props: {
favorites: Array,
},
methods:{
removeFavorite() {
for(var i = 0; i < this.favorites.length; i++){
if(this.favorite != this.favorites[i]){
this.favorites_temp.push(this.favorites[i]);
}
}
console.log(this.favorites_temp);
this.favorites_temp;
this.$store.commit("mutateFavorites", this.favorites_temp);
}
},
computed: {
favorites2() {
return this.$store.getters.favorites
}
},
watch: {
favorite: function(){
this.$emit('pushFavorite', this.favorite);
......
......@@ -2,16 +2,14 @@
<v-flex xs12 md12 pa-2>
<v-card color="transparent" flat>
<v-card-text>
<v-autocomplete color="light-green accent-4" v-model="selectedKunta" :items="kunnat" hide-no-data hide-selected item-text="Description" item-value="API" label="Paikkakunta" placeholder="" prepend-icon="mdi-database-search" clearable return-object></v-autocomplete>
<v-autocomplete color="light-green accent-4" v-model="selectedKunta" :items="kunnat" hide-no-data hide-selected item-text="Description" item-value="API" label="Paikkakunta" placeholder="" prepend-icon="mdi-database-search" clearable return-object></v-autocomplete>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<Loading v-if="loading"/>
<v-btn :disabled="!selectedKunta" color="white darken-3" @click="addFavorite">
Lisää suosikiksi
<v-icon right>mdi-close-circle</v-icon>
</v-btn>
</v-card-actions>
<v-spacer></v-spacer>
<Loading v-if="loading"/>
<v-btn :disabled="!selectedKunta" color="white darken-3" @click="addFavorite">Lisää suosikiksi</v-btn>
<v-btn :disabled="!kuntaIsFavorite()" @click="removeFavorite" color="yellow darken-1">Poista</v-btn>
</v-card-actions>
<favorites @pushFavorite="pullFavorite" :favorites="favorites"></favorites>
</v-card>
</v-flex>
......@@ -37,6 +35,7 @@
values: [],
labels: [],
loading: false,
favorites_temp: [],
}),
components: {
Loading
......@@ -91,6 +90,7 @@
this.favorites.push(this.selectedKunta);
else
console.log("Please");
this.$store.commit("mutateFavorites", this.favorites);
},
createGraph() {
......@@ -109,6 +109,24 @@
pullFavorite(favorite) {
this.selectedKunta = favorite;
},
removeFavorite() {
this.favorites_temp = [];
for(var i = 0; i < this.favorites.length; i++){
if(this.selectedKunta != this.favorites[i]){
this.favorites_temp.push(this.favorites[i]);
}
}
this.favorites_temp;
this.$store.commit("mutateFavorites", this.favorites_temp);
this.favorites = this.favorites_temp;
},
kuntaIsFavorite(){
for(var i = 0; i < this.favorites.length; i++){
if(this.selectedKunta == this.favorites[i])
return true;
}
return false;
}
},
mounted: function() {
this.getLocations();
......
......@@ -27,10 +27,8 @@
</v-card-text>
</v-layout>
</v-card>
</v-flex>
</template>
<script>
import WeatherChart from './WeatherChart'
export default {
......@@ -70,7 +68,7 @@
var d = new Date();
var today = d.getDate();
var month = d.getMonth() + 1;
this.time = d.getHours();
this.time = d.getHours();
if (this.date > 0) {
this.ticks = 24 / this.interval;
......@@ -80,9 +78,7 @@
this.ticks = (24 - this.time) / this.interval;
if (this.ticks < 2) this.ticks = 2;
}
while (this.max % this.interval != 0) this.max++;
// if (this.max < this.interval) this.max = this.interval;
while (this.max % this.interval != 0 || this.max < this.interval) this.max++;
this.icon = '/images/icons/';
this.temperatures = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment