wip
parent
054da6633e
commit
e9a696dcaa
|
|
@ -7,7 +7,7 @@
|
|||
<div class="flex">
|
||||
<div class="exerciseList">
|
||||
<ul class="exerciseItem" v-for="exercise in filterExercises()" :key="exercise.name">
|
||||
<button @click="exerciseClick(exercise)" class="btn bg-secondary-button hover:bg-accent text-white font-bold py-2 px-2 rounded" >{{ exercise.name }}</button>
|
||||
<button @click="exerciseClick(exercise); addSets()" class="btn bg-secondary-button hover:bg-accent text-white font-bold py-2 px-2 rounded" >{{ exercise.name }}</button>
|
||||
</ul>
|
||||
</div>
|
||||
<div v-if="selectedExercise">
|
||||
|
|
@ -21,12 +21,14 @@
|
|||
import { useExerciseStore } from '@/stores/storeExercise.js';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import WeightsInput from "@/views/weight/WeightsInput.vue";
|
||||
import { useWeightInputStore } from '@/stores/storeInput';
|
||||
|
||||
const muscle = defineProps({
|
||||
muscle: String,
|
||||
})
|
||||
|
||||
const json = useExerciseStore()
|
||||
const weightInput = useWeightInputStore()
|
||||
const exercises = ref([])
|
||||
const selectedExercise = ref(null)
|
||||
|
||||
|
|
@ -67,6 +69,10 @@
|
|||
selectedExercise.value = exercise;
|
||||
};
|
||||
|
||||
const addSets = () => {
|
||||
weightInput.initInputs(selectedExercise.value);
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import { reactive } from 'vue'
|
||||
|
||||
export const useWeightInputStore = defineStore(('weightInput'),{
|
||||
export const useWeightInputStore = defineStore(('weightInput'), {
|
||||
state: () => reactive ({
|
||||
workingSets: [
|
||||
{
|
||||
selectedExercise: '',
|
||||
workingReps: [],
|
||||
workingSetsWeight: [],
|
||||
workingSetCount: 0,
|
||||
/*
|
||||
selectedExercise: '',
|
||||
workingSet: [
|
||||
{
|
||||
|
|
@ -12,19 +17,29 @@ export const useWeightInputStore = defineStore(('weightInput'),{
|
|||
workingSetsWeight: []
|
||||
}
|
||||
],
|
||||
workingSetReps: [],
|
||||
workingSetWeight: [],
|
||||
workingSetCount: 0,
|
||||
*/
|
||||
}
|
||||
],
|
||||
warmUpSets: [
|
||||
{
|
||||
selectedExercise: '',
|
||||
warmUpReps: [],
|
||||
warmUpSetsWeight: [],
|
||||
warmUpSetCount: 0,
|
||||
/*
|
||||
selectedExercise: '',
|
||||
warmUpSet: [
|
||||
{
|
||||
warmUpReps: [],
|
||||
warmUpSetsWeight: [],
|
||||
warmUpReps: [0,],
|
||||
warmUpSetsWeight: [0,],
|
||||
}
|
||||
],
|
||||
warmUpSetCount: 0,
|
||||
warmUpSetReps: [],
|
||||
warmUpSetWeight: [],
|
||||
warmUpSetCount: 0,*/
|
||||
}
|
||||
],
|
||||
}),
|
||||
|
|
@ -35,18 +50,42 @@ export const useWeightInputStore = defineStore(('weightInput'),{
|
|||
removeWorkingSet(selectedExercise) {
|
||||
this.sets = this.sets.filter(e => {return e.selectedExercise !== selectedExercise})
|
||||
},
|
||||
addWorkingSet(selectedExercise, workingSetCount, workingReps, workingSetsWeight){
|
||||
const neWworkingSet = {
|
||||
}
|
||||
addWorkingSet(selectedExercise) {
|
||||
const targetExercise = this.state.find(set => set.selectedExercise.name === selectedExercise);
|
||||
if(targetExercise) {
|
||||
targetExercise.warmUpReps.push([]);
|
||||
targetExercise.warmUpSetsWeight.push([]);
|
||||
targetExercise.warmUpSetCount++;
|
||||
} else {
|
||||
this.workingSets.push({
|
||||
selectedExercise,
|
||||
workingReps: [],
|
||||
workingSetsWeight: [],
|
||||
workingSetCount: 1,
|
||||
})
|
||||
}
|
||||
},
|
||||
addWarmUpSet(selectedExercise) {
|
||||
this.warmUpSets.push({
|
||||
selectedExercise: selectedExercise,
|
||||
warmUpSets: [],
|
||||
warmUpReps: [],
|
||||
warmUpSetsWeight: [],
|
||||
warmUpSetCount: warmUpSetCount++,
|
||||
})
|
||||
},
|
||||
initInputs(selectedExercise) {
|
||||
this.workingSets.push({
|
||||
selectedExercise: selectedExercise,
|
||||
workingSetReps: [],
|
||||
workingSetsWeight: [],
|
||||
workingSetCount: 1,
|
||||
})
|
||||
this.warmUpSets.push({
|
||||
selectedExercise: selectedExercise,
|
||||
warmUpReps: [],
|
||||
warmUpSetsWeight: [],
|
||||
warmUpSetCount: 1,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
<div class="working-set mt-5">
|
||||
<label>Working Sets</label>
|
||||
<button @click="workingAddSet()"
|
||||
<button @click="addWorkingSet()"
|
||||
class="bg-accent hover:bg-primary-button text-white font-bold py-2 px-2 rounded ml-7">
|
||||
Add
|
||||
</button>
|
||||
|
|
@ -47,11 +47,11 @@
|
|||
</button>
|
||||
|
||||
<div>
|
||||
<div v-for="(workingset, workingSetCount) in weightInput.workingSets.workingSets" :key="workingSetCount" class="item flex justify-smart mt-1">
|
||||
{{ workingset }}
|
||||
<div v-for="(workingset, workingSetCount) in weightInput.workingSets" :key="workingSetCount" class="item flex justify-smart mt-1">
|
||||
{{ workingset.content }}
|
||||
<div class="ml-3">
|
||||
<input
|
||||
v-model="weightInput.workingSets.workingSetsWeight.workingSetsWeight[workingSetCount]"
|
||||
v-model="weightInput.workingSets.workingSetsWeight[workingSetCount]"
|
||||
type="number"
|
||||
class="mt-1 px-3 py-2 bg-black border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none block rounded-md sm:text-sm "
|
||||
placeholder="Weight (Kg)"
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
</div>
|
||||
<label class="ml-3 mt-2">Reps</label>
|
||||
<div class="ml-3">
|
||||
<input v-model="weightInput.workingSets.workingSets.workingReps[workingSetCount]"
|
||||
<input v-model="weightInput.workingSets.workingReps[workingSetCount]"
|
||||
type="number"
|
||||
class="mt-1 px-3 py-2 bg-black border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none block rounded-md sm:text-sm "
|
||||
placeholder="Reps"
|
||||
|
|
@ -82,7 +82,10 @@ const selectedExercise = defineProps({
|
|||
|
||||
const weightInput = useWeightInputStore();
|
||||
weightInput.selectedExercise = ref(selectedExercise.selectedExercise);
|
||||
let workingSetCount = ref(0);
|
||||
|
||||
const addWorkingSet = () => {
|
||||
weightInput.addWorkingSet(selectedExercise.selectedExercise);
|
||||
}
|
||||
|
||||
const warmUpAddSet = () => {
|
||||
const newWarmUpSet = {
|
||||
|
|
@ -90,11 +93,7 @@ const warmUpAddSet = () => {
|
|||
content:weightInput.warmUpSets.warmUpSetCount.toString().concat('. Set'),
|
||||
|
||||
};
|
||||
weightInput.warmUpSets.push(newWarmUpSet.content);
|
||||
};
|
||||
|
||||
const workingAddSet = () => {
|
||||
weightInput.workingSets.workingSetCount = ++workingSetCount;
|
||||
weightInput.workingSetCount;
|
||||
};
|
||||
|
||||
const removeWarmUpSet = () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue