sajjad 3 years ago
parent ceb07bf033
commit 839d650845

5858
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -10,8 +10,8 @@
"dependencies": { "dependencies": {
"@riophae/vue-treeselect": "^0.4.0", "@riophae/vue-treeselect": "^0.4.0",
"axios": "^0.21.4", "axios": "^0.21.4",
"bootstrap": "^4.6.0", "bootstrap": "^4.6.1",
"core-js": "^3.6.5", "core-js": "^3.19.1",
"izitoast": "^1.4.0", "izitoast": "^1.4.0",
"jquery": "^3.6.0", "jquery": "^3.6.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
@ -19,24 +19,24 @@
"module-alias": "^2.2.2", "module-alias": "^2.2.2",
"popper.js": "^1.16.1", "popper.js": "^1.16.1",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-advanced-cropper": "^1.8.2", "vue-advanced-cropper": "^1.9.0",
"vue-meta": "^2.4.0", "vue-meta": "^2.4.0",
"vue-router": "^3.5.2", "vue-router": "^3.5.3",
"vue2-dropzone": "^3.6.0", "vue2-dropzone": "^3.6.0",
"vuetify": "^2.4.0", "vuetify": "^2.6.0",
"vuex": "^3.6.2", "vuex": "^3.6.2",
"willatoast": "^1.1.1" "willatoast": "^1.1.2"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-babel": "^4.5.15",
"@vue/cli-plugin-eslint": "~4.5.0", "@vue/cli-plugin-eslint": "^4.5.15",
"@vue/cli-service": "~4.5.0", "@vue/cli-service": "^4.5.15",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"eslint": "^6.7.2", "eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2", "eslint-plugin-vue": "^6.2.2",
"sass": "~1.32.0", "sass": "~1.32.0",
"sass-loader": "^10.0.0", "sass-loader": "^10.0.0",
"vue-cli-plugin-vuetify": "~2.4.2", "vue-cli-plugin-vuetify": "^2.4.4",
"vue-template-compiler": "^2.6.11", "vue-template-compiler": "^2.6.11",
"vuetify-loader": "^1.7.0" "vuetify-loader": "^1.7.0"
}, },

@ -8,15 +8,24 @@
<router-view></router-view> <router-view></router-view>
</v-main> </v-main>
</v-app> </v-app>
</template> </template>
<script> <script>
import BgImage from "./assets/Untitled-1.jpg"; import BgImage from "./assets/Untitled-1.jpg";
import { UserStorage } from "@/utils/storage";
import ProfileRepository from "./abstraction/repository/profileRepository";
import { getJson } from "./abstraction/resources/userResource";
export default { export default {
name: "App", name: "App",
data: () => ({ data: () => ({
bgImage: BgImage, bgImage: BgImage,
//
}), }),
async created() {
let repository = new ProfileRepository();
let resource = await repository.show();
console.log("resource", resource);
let res = getJson(resource);
UserStorage.save(res);
},
}; };
</script> </script>

@ -7,7 +7,6 @@ export default class AuthRepository {
let json = setData(data); let json = setData(data);
let response = await axios.post(url("login"), json); let response = await axios.post(url("login"), json);
if (response.status === 200) { if (response.status === 200) {
response.data.data.user.roles.map(x => console.log(x.name));
return getJson(response.data.data); return getJson(response.data.data);
} }
} }

@ -15,10 +15,11 @@ export const getJson = (data) => ({
cell_number: data.cell_number, cell_number: data.cell_number,
is_admin: data.is_admin, is_admin: data.is_admin,
is_trainer: data.is_trainer, is_trainer: data.is_trainer,
country: data.country, country: data?.country,
country_id: data.country.id, country_id: data.country?.id,
created_courses_count: data.created_courses_count, created_courses_count: data.created_courses_count,
joined_courses_count: data.joined_courses_count joined_courses_count: data.joined_courses_count,
roles: data.roles
}); });
export const setData = (data, isUpdate = false) => { export const setData = (data, isUpdate = false) => {
let formData = { let formData = {

@ -1,6 +1,7 @@
import { SetPagination, SetQueriesObject } from "@/utils/setQueriesObject"; import { SetPagination, SetQueriesObject } from "@/utils/setQueriesObject";
export const getJson = (data) => { export const getJson = (data) => {
let role_ids = data.roles.map(x => x.id); let role_id = null;
data.roles.map(x => role_id = x.id);
let type = ''; let type = '';
let roles = data.roles.map(x => x.name); let roles = data.roles.map(x => x.name);
roles.includes('manager') ? type = "admin" : roles.includes("trainer") && !roles.includes('manager') ? type = 'trainer' : "trainee" roles.includes('manager') ? type = "admin" : roles.includes("trainer") && !roles.includes('manager') ? type = 'trainer' : "trainee"
@ -23,7 +24,7 @@ export const getJson = (data) => {
is_trainer: data.is_trainer, is_trainer: data.is_trainer,
type: type, type: type,
role: data.roles, role: data.roles,
role_ids: role_ids, role_id: role_id,
created_courses_count: data.created_courses_count, created_courses_count: data.created_courses_count,
joined_courses_count: data.joined_courses_count joined_courses_count: data.joined_courses_count
}) })

@ -184,7 +184,7 @@
<v-col cols="12"> <v-col cols="12">
<div class="upload"> <div class="upload">
<div class="add__product dark w-100 h-100"> <div class="add__product dark w-100 h-100">
<Dropzone :batchId="random_token" /> <Dropzone :files="form.images" :batchId="random_token" />
</div> </div>
</div> </div>
</v-col> </v-col>
@ -281,10 +281,12 @@ export default {
if (this.fileForm.media.file) { if (this.fileForm.media.file) {
await repository.store(this.fileForm); await repository.store(this.fileForm);
} }
this.updateProduct(this.form); await this.updateProduct(this.form);
this.$router.push({ name: "products" });
} else { } else {
await repository.store(this.fileForm); await repository.store(this.fileForm);
this.addProduct(this.form); await this.addProduct(this.form);
this.$router.push({ name: "products" });
} }
} else { } else {
toast.error("The information entered is incorrect", "Error"); toast.error("The information entered is incorrect", "Error");
@ -311,7 +313,7 @@ export default {
}, },
}; };
</script> </script>
<style scoped> <style scoped>
.add__workout, .add__workout,
.upload { .upload {
border: 1px dotted var(--color-gray) !important; border: 1px dotted var(--color-gray) !important;

@ -11,118 +11,120 @@
subTitle="what we perpared for people" subTitle="what we perpared for people"
/> />
</div> </div>
<v-row class="mt-4"> <v-form @submit.prevent="submit">
<v-col cols="3"> <v-row class="mt-4">
<div class="h-100"> <v-col cols="3">
<div class="add__program dark w-100 h-100"> <div class="h-100">
<ImageCropper <div class="add__program dark w-100 h-100">
label="manager image" <ImageCropper
:url.sync="form.thumbnail" label="manager image"
v-model="fileForm.media" :url.sync="form.thumbnail"
/> v-model="fileForm.media"
/>
</div>
</div> </div>
</div> </v-col>
</v-col> <v-col cols="9">
<v-col cols="9"> <v-row>
<v-row> <v-col cols="4"
<v-col cols="4" ><v-autocomplete
><v-autocomplete dark
dark class="mt-0 pt-0"
class="mt-0 pt-0" item-text="name"
item-text="name" item-value="id"
item-value="id" label="program category"
label="program category" :items="getSportCategories"
:items="getSportCategories" v-model="form.sport_category_id"
v-model="form.sport_category_id" ></v-autocomplete>
></v-autocomplete> </v-col>
</v-col> <v-col cols="8"
<v-col cols="8" ><v-text-field
><v-text-field v-model="form.period"
v-model="form.period" placeholder="period"
placeholder="period" label="period"
label="period" class="no-error-msg pt-0 mt-0"
class="no-error-msg pt-0 mt-0" dark
dark ></v-text-field
></v-text-field ></v-col>
></v-col> </v-row>
</v-row> <v-row>
<v-row> <v-col cols="12"
<v-col cols="12" ><v-text-field
><v-text-field v-model="form.title"
v-model="form.title" placeholder="a short quote"
placeholder="a short quote" label="a short quote"
label="a short quote" class="no-error-msg pt-0 mt-0"
class="no-error-msg pt-0 mt-0" dark
dark ></v-text-field
></v-text-field ></v-col>
></v-col> </v-row>
</v-row> <v-row>
<v-row> <v-col cols="12">
<v-col cols="12"> <v-textarea
<v-textarea v-model="form.description"
v-model="form.description" rows="5"
rows="5" label="description"
label="description" placeholder="description"
placeholder="description" dark
dark ></v-textarea>
></v-textarea> </v-col>
</v-col> </v-row>
</v-row> </v-col>
</v-col> </v-row>
</v-row> <v-divider dark></v-divider>
<v-divider dark></v-divider> <v-row>
<v-row> <v-col cols="12">
<v-col cols="12"> <v-row>
<v-row> <v-col cols="12">
<v-col cols="12"> <v-combobox
<v-combobox v-model="form.tags"
v-model="form.tags" clearable
clearable :append-icon="null"
:append-icon="null" hide-selected
hide-selected class="multiple"
class="multiple" label="program tags - useful for better search"
label="program tags - useful for better search" placeholder="program tags - useful for better search"
placeholder="program tags - useful for better search" multiple
multiple persistent-hint
persistent-hint small-chips
small-chips dark
dark >
> <template #selection="{ item }">
<template #selection="{ item }"> <Chip
<Chip label
label color="white"
color="white" text-color="black"
text-color="black" sm
sm @close="removeTags(item)"
@close="removeTags(item)" :text="item"
:text="item" close
close />
/> </template>
</template> </v-combobox>
</v-combobox> </v-col>
</v-col> </v-row>
</v-row> </v-col>
</v-col> </v-row>
</v-row> <div class="mt-2">
<div class="mt-2"> <v-divider dark class="mb-2"></v-divider>
<v-divider dark class="mb-2"></v-divider> <div class="d-flex justify-space-between">
<div class="d-flex justify-space-between"> <router-link :to="{ name: 'programs' }">
<router-link :to="{ name: 'programs' }"> <RectangleButton
text="IVE CHANGED MY MIND"
icon="WMi-cancel"
class="px-0"
height="19"
/>
</router-link>
<RectangleButton <RectangleButton
text="IVE CHANGED MY MIND" :text="(programId ? 'update' : 'add') + ' the program'"
icon="WMi-cancel" class="custom-btn add-btn"
class="px-0" height="25"
height="19" type="submit"
/> />
</router-link> </div>
<RectangleButton
:text="(programId ? 'update' : 'add') + ' the program'"
class="custom-btn add-btn"
height="25"
@click.native="submit"
/>
</div> </div>
</div> </v-form>
</div> </div>
</main-back> </main-back>
</div> </div>
@ -171,10 +173,12 @@ export default {
if (this.fileForm.media.file) { if (this.fileForm.media.file) {
await repository.store(this.fileForm); await repository.store(this.fileForm);
} }
this.updateProgram(this.form); await this.updateProgram(this.form);
this.$router.push({ name: "programs" });
} else { } else {
await repository.store(this.fileForm); await repository.store(this.fileForm);
this.addProgram(this.form); await this.addProgram(this.form);
this.$router.push({ name: "programs" });
} }
} catch (e) { } catch (e) {
return e; return e;
@ -183,6 +187,7 @@ export default {
async load() { async load() {
await this.loadProgram(this.programId); await this.loadProgram(this.programId);
this.form = this.getProgram; this.form = this.getProgram;
this.form["batch_id"] = RANDOM_TOKEN;
}, },
removeTags(item) { removeTags(item) {
this.form.tags.splice(this.form.tags.indexOf(item), 1); this.form.tags.splice(this.form.tags.indexOf(item), 1);
@ -197,7 +202,7 @@ export default {
}, },
}; };
</script> </script>
<style scoped> <style scoped>
.add__program, .add__program,
.upload { .upload {
border: 1px dotted var(--color-gray) !important; border: 1px dotted var(--color-gray) !important;
@ -226,4 +231,4 @@ export default {
.upload { .upload {
height: 148px; height: 148px;
} }
</style> </style>

@ -11,165 +11,167 @@
subTitle="let us know you better, it comes handy." subTitle="let us know you better, it comes handy."
/> />
</div> </div>
<v-row class="mt-4"> <v-form @submit.prevent="submit">
<v-col cols="3"> <v-row class="mt-4">
<div class="pb-14 h-100"> <v-col cols="3">
<div class="add__workout dark w-100 h-100"> <div class="pb-14 h-100">
<ImageCropper <div class="add__workout dark w-100 h-100">
label="manager image" <ImageCropper
:url.sync="form.thumbnail" label="manager image"
v-model="fileForm.media" :url.sync="form.thumbnail"
/> v-model="fileForm.media"
/>
</div>
</div> </div>
</div> </v-col>
</v-col> <v-col cols="9">
<v-col cols="9"> <v-row>
<v-row> <v-col cols="4">
<v-col cols="4"> <v-autocomplete
<v-autocomplete dark
dark item-text="name"
item-text="name" item-value="id"
item-value="id" label="workout category"
label="workout category" :items="getSportCategories"
:items="getSportCategories" v-model="form.sport_category_id"
v-model="form.sport_category_id" @change="changeSportCategories"
@change="changeSportCategories" ></v-autocomplete>
></v-autocomplete> </v-col>
</v-col> <v-col cols="4">
<v-col cols="4"> <v-autocomplete
<v-autocomplete dark
dark item-text="name"
item-text="name" item-value="id"
item-value="id" label="workout subcategory"
label="workout subcategory" :items="getWorkoutCategories"
:items="getWorkoutCategories" v-model="form.workout_category_id"
v-model="form.workout_category_id" ></v-autocomplete>
></v-autocomplete> </v-col>
</v-col> <v-col cols="4"></v-col>
<v-col cols="4"></v-col> </v-row>
</v-row> <v-row>
<v-row> <v-col cols="4"
<v-col cols="4" ><v-text-field
><v-text-field dark
dark placeholder="workout name"
placeholder="workout name" label="workout name"
label="workout name" class="no-error-msg pt-0 mt-0"
class="no-error-msg pt-0 mt-0" v-model="form.name"
v-model="form.name" ></v-text-field>
></v-text-field> </v-col>
</v-col> <v-col cols="8"
<v-col cols="8" ><v-text-field
><v-text-field dark
dark placeholder="a short quote"
placeholder="a short quote" label="a short quote"
label="a short quote" class="no-error-msg pt-0 mt-0"
class="no-error-msg pt-0 mt-0" v-model="form.title"
v-model="form.title" ></v-text-field
></v-text-field ></v-col>
></v-col> </v-row>
</v-row> <v-row>
<v-row> <v-col cols="12">
<v-col cols="12"> <v-textarea
<v-textarea dark
dark rows="3"
rows="3" label="description"
label="description" placeholder="description"
placeholder="description" v-model="form.description"
v-model="form.description" ></v-textarea>
></v-textarea> </v-col>
</v-col> </v-row>
</v-row> </v-col>
</v-col> </v-row>
</v-row> <v-divider dark></v-divider>
<v-divider dark></v-divider> <v-row>
<v-row> <v-col cols="12">
<v-col cols="12"> <v-row>
<v-row> <v-col cols="2"
<v-col cols="2" ><v-text-field
><v-text-field dark
dark placeholder="suggested course time?"
placeholder="suggested course time?" label="suggested course time?"
label="suggested course time?" class="no-error-msg pt-0 mt-0"
class="no-error-msg pt-0 mt-0" v-model="form.suggested_set"
v-model="form.suggested_set" ></v-text-field
></v-text-field ></v-col>
></v-col> <v-col cols="2"
<v-col cols="2" ><v-text-field
><v-text-field dark
dark placeholder="suggested times each course?"
placeholder="suggested times each course?" label="suggested times each course?"
label="suggested times each course?" class="no-error-msg pt-0 mt-0"
class="no-error-msg pt-0 mt-0" v-model="form.suggested_per_set"
v-model="form.suggested_per_set" ></v-text-field
></v-text-field ></v-col>
></v-col> <v-col cols="2">
<v-col cols="2"> <TimeInput
<TimeInput v-model="form.suggested_time"
v-model="form.suggested_time" class="no-error-msg pt-0 mt-0"
class="no-error-msg pt-0 mt-0" placeholder="suggested ESTIMATED TIME"
placeholder="suggested ESTIMATED TIME" label="suggested ESTIMATED TIME"
label="suggested ESTIMATED TIME" /></v-col>
/></v-col> <v-col cols="6"
<v-col cols="6" ><v-text-field
><v-text-field dark
dark placeholder="video link"
placeholder="video link" label="video link"
label="video link" class="no-error-msg pt-0 mt-0"
class="no-error-msg pt-0 mt-0" v-model="form.video"
v-model="form.video" ></v-text-field
></v-text-field ></v-col>
></v-col> </v-row>
</v-row> <v-row>
<v-row> <v-col cols="12">
<v-col cols="12"> <v-combobox
<v-combobox v-model="form.tags"
v-model="form.tags" clearable
clearable :append-icon="null"
:append-icon="null" hide-selected
hide-selected class="multiple"
class="multiple" label="Add some tags"
label="Add some tags" placeholder="Add some tags"
placeholder="Add some tags" multiple
multiple persistent-hint
persistent-hint small-chips
small-chips dark
dark >
> <template #selection="{ item }">
<template #selection="{ item }"> <Chip
<Chip label
label color="white"
color="white" text-color="black"
text-color="black" sm
sm @close="removeTags(item)"
@close="removeTags(item)" :text="item"
:text="item" close
close />
/> </template>
</template> </v-combobox>
</v-combobox> </v-col>
</v-col> </v-row>
</v-row> </v-col>
</v-col> </v-row>
</v-row> <div class="mt-2">
<div class="mt-2"> <v-divider dark class="mb-2"></v-divider>
<v-divider dark class="mb-2"></v-divider> <div class="d-flex justify-space-between">
<div class="d-flex justify-space-between"> <router-link :to="{ name: 'workouts' }">
<router-link :to="{ name: 'workouts' }"> <RectangleButton
text="IVE CHANGED MY MIND"
icon="WMi-cancel"
class="px-0"
height="19"
/>
</router-link>
<RectangleButton <RectangleButton
text="IVE CHANGED MY MIND" :text="(workoutId ? 'update' : 'add') + ' the workout'"
icon="WMi-cancel" type="submit"
class="px-0" class="custom-btn add-btn"
height="19" height="25"
/> />
</router-link> </div>
<RectangleButton
:text="(workoutId ? 'update' : 'add') + ' the workout'"
@click.native="submit"
class="custom-btn add-btn"
height="25"
/>
</div> </div>
</div> </v-form>
</div> </div>
</main-back> </main-back>
</div> </div>
@ -223,10 +225,12 @@ export default {
if (this.fileForm.media.file) { if (this.fileForm.media.file) {
await repository.store(this.fileForm); await repository.store(this.fileForm);
} }
this.updateWorkout(this.form); await this.updateWorkout(this.form);
this.$router.push({ name: "workouts" });
} else { } else {
await repository.store(this.fileForm); await repository.store(this.fileForm);
this.addWorkout(this.form); await this.addWorkout(this.form);
this.$router.push({ name: "workouts" });
} }
} catch (e) { } catch (e) {
return e; return e;
@ -235,6 +239,7 @@ export default {
async load() { async load() {
await this.loadWorkout(this.workoutId); await this.loadWorkout(this.workoutId);
this.form = this.getWorkout; this.form = this.getWorkout;
this.form["batch_id"] = RANDOM_TOKEN;
this.loadWorkoutCategories(this.form.sport_category_id); this.loadWorkoutCategories(this.form.sport_category_id);
}, },
changeSportCategories() { changeSportCategories() {

@ -20,6 +20,7 @@
<v-tab class="bookmarks__tab">workouts</v-tab> <v-tab class="bookmarks__tab">workouts</v-tab>
</v-tabs> </v-tabs>
<v-tabs-items v-model="tab"> <v-tabs-items v-model="tab">
<!-- program tab -->
<v-tab-item> <v-tab-item>
<v-row class="mt-4"> <v-row class="mt-4">
<v-col <v-col
@ -38,6 +39,8 @@
/> />
</div> </div>
</v-tab-item> </v-tab-item>
<!-- /program tab -->
<!-- workout tab -->
<v-tab-item> <v-tab-item>
<v-row class="mt-4"> <v-row class="mt-4">
<v-col <v-col
@ -55,6 +58,7 @@
/> />
</div> </div>
</v-tab-item> </v-tab-item>
<!-- /workout tab -->
</v-tabs-items> </v-tabs-items>
</v-col> </v-col>
</v-row> </v-row>

@ -26,7 +26,7 @@ export default {
"<div class='add__workout__picture d-flex align-center'> <i class='WMi-picture add__workout__picture--icon'></i> <div class='add__workout__picture--text'> please upload or drag & Drop <br /> product images here</div></div>", "<div class='add__workout__picture d-flex align-center'> <i class='WMi-picture add__workout__picture--icon'></i> <div class='add__workout__picture--text'> please upload or drag & Drop <br /> product images here</div></div>",
}, },
files: { default: () => [] }, files: { default: () => [] },
collection: { default: "image" }, collection: { default: "images" },
modelName: { default: "model" }, modelName: { default: "model" },
batchId: { batchId: {
type: String, type: String,

@ -7,7 +7,7 @@
<div class="product__image"> <div class="product__image">
<div <div
class="product__img" class="product__img"
:style="{ backgroundImage: `url(${product.src})` }" :style="{ backgroundImage: `url('${product.thumbnail}')` }"
></div> ></div>
</div> </div>
<div class="product__name"> <div class="product__name">
@ -59,4 +59,4 @@ export default {
font-size: 36px; font-size: 36px;
color: var(--color-social-yellow); color: var(--color-social-yellow);
} }
</style> </style>

@ -11,147 +11,150 @@
subTitle="let us know you better, it comes handy." subTitle="let us know you better, it comes handy."
/> />
</div> </div>
<v-row class="mt-4"> <v-form @submit.prevent="submit">
<v-col class="12" sm="3"> <v-row class="mt-4">
<v-text-field <v-col class="12" sm="3">
placeholder="your email address" <v-text-field
label="your email address" placeholder="your email address"
class="no-error-msg pt-0" label="your email address"
dark class="no-error-msg pt-0"
v-model="form.email" dark
></v-text-field> v-model="form.email"
</v-col> ></v-text-field>
<v-col class="12" sm="3"> </v-col>
<v-text-field <v-col class="12" sm="3">
placeholder="your name" <v-text-field
label="your name" placeholder="your name"
class="no-error-msg pt-0" label="your name"
dark class="no-error-msg pt-0"
v-model="form.first_name" dark
></v-text-field> v-model="form.first_name"
</v-col> ></v-text-field>
<v-col class="12" sm="3"> </v-col>
<v-text-field <v-col class="12" sm="3">
placeholder="your family name" <v-text-field
label="your family name" placeholder="your family name"
class="no-error-msg pt-0" label="your family name"
dark class="no-error-msg pt-0"
v-model="form.last_name" dark
></v-text-field> v-model="form.last_name"
</v-col> ></v-text-field>
<v-col class="12" sm="3"> </v-col>
<v-text-field <v-col class="12" sm="3">
placeholder="your cell number" <v-text-field
label="your cell number" placeholder="your cell number"
class="no-error-msg pt-0" label="your cell number"
dark class="no-error-msg pt-0"
v-model="form.cell_number" dark
></v-text-field> v-model="form.cell_number"
</v-col> ></v-text-field>
</v-row> </v-col>
<v-row> </v-row>
<v-col cols="3"> <v-row>
<v-autocomplete <v-col cols="3">
placeholder="your country" <v-autocomplete
label="your country" placeholder="your country"
class="no-error-msg pt-0" label="your country"
dark class="no-error-msg pt-0"
item-value="id" dark
item-text="name" item-value="id"
:items="getCountries" item-text="name"
v-model="form.country_id" :items="getCountries"
></v-autocomplete> v-model="form.country_id"
</v-col> ></v-autocomplete>
<v-col cols="3"> </v-col>
<v-text-field <v-col cols="3">
placeholder="address" <v-text-field
label="address" placeholder="address"
class="no-error-msg pt-0" label="address"
dark class="no-error-msg pt-0"
v-model="form.address" dark
></v-text-field> v-model="form.address"
</v-col> ></v-text-field>
<v-col cols="3" </v-col>
><DateInput <v-col cols="3"
class="no-error-msg" ><DateInput
label="Birthday" class="no-error-msg"
dark label="Birthday"
v-model="form.birthday" dark
/></v-col> v-model="form.birthday"
<v-col cols="3"></v-col> /></v-col>
</v-row> <v-col cols="3"></v-col>
<v-divider dark></v-divider> </v-row>
<v-row class="w-75"> <v-divider dark></v-divider>
<v-col cols="3" <v-row class="w-75">
><v-text-field <v-col cols="3"
placeholder="weight" ><v-text-field
label="weight" placeholder="weight"
class="no-error-msg pt-0" label="weight"
suffix="kg" class="no-error-msg pt-0"
dark suffix="kg"
v-model="form.weight" dark
></v-text-field v-model="form.weight"
></v-col> ></v-text-field
<v-col cols="3" ></v-col>
><v-text-field <v-col cols="3"
placeholder="height" ><v-text-field
label="height" placeholder="height"
class="no-error-msg pt-0" label="height"
suffix="cm" class="no-error-msg pt-0"
dark suffix="cm"
v-model="form.height" dark
></v-text-field v-model="form.height"
></v-col> ></v-text-field
<v-col cols="3" ></v-col>
><v-text-field <v-col cols="3"
placeholder="arm diameter" ><v-text-field
label="arm diameter" placeholder="arm diameter"
class="no-error-msg pt-0" label="arm diameter"
suffix="cm" class="no-error-msg pt-0"
dark suffix="cm"
v-model="form.arm_diameter" dark
></v-text-field v-model="form.arm_diameter"
></v-col> ></v-text-field
<v-col cols="3" ></v-col>
><v-text-field <v-col cols="3"
placeholder="lge diameter" ><v-text-field
label="lge diameter" placeholder="lge diameter"
class="no-error-msg pt-0" label="lge diameter"
suffix="cm" class="no-error-msg pt-0"
dark suffix="cm"
v-model="form.leg_diameter" dark
></v-text-field v-model="form.leg_diameter"
></v-col> ></v-text-field
</v-row> ></v-col>
<v-row class="mb-16"> </v-row>
<v-col cols="12"> <v-row class="mb-16">
<v-textarea <v-col cols="12">
placeholder="about you" <v-textarea
label="about you" placeholder="about you"
class="no-error-msg" label="about you"
rows="4" class="no-error-msg"
dark rows="4"
v-model="form.details" dark
></v-textarea> v-model="form.details"
</v-col> ></v-textarea>
</v-row> </v-col>
<div class="mt-16"> </v-row>
<v-divider dark class="mb-2"></v-divider> <div class="mt-16">
<div class="d-flex justify-space-between"> <v-divider dark class="mb-2"></v-divider>
<RectangleButton <div class="d-flex justify-space-between">
text="IVE CHANGED MY MIND" <router-link :to="{ name: 'dashboard' }">
icon="WMi-cancel" <RectangleButton
class="px-0" text="IVE CHANGED MY MIND"
height="19" icon="WMi-cancel"
/> class="px-0"
<RectangleButton height="19"
text="SAVE THE INFO" /></router-link>
class="custom-btn save-btn" <RectangleButton
height="25" text="SAVE THE INFO"
@click.native="updateProfile(form)" class="custom-btn save-btn"
/> height="25"
type="submit"
/>
</div>
</div> </div>
</div> </v-form>
</div> </div>
</main-back> </main-back>
</div> </div>
@ -177,6 +180,10 @@ export default {
await this.loadProfile(); await this.loadProfile();
this.form = this.getProfile; this.form = this.getProfile;
}, },
async submit() {
await this.updateProfile(this.form);
this.$router.push({ name: "dashboard" });
},
}, },
async created() { async created() {
await this.loadCountries(); await this.loadCountries();
@ -184,9 +191,9 @@ export default {
}, },
}; };
</script> </script>
<style scoped> <style scoped>
.save-btn { .save-btn {
padding-right: 100px !important; padding-right: 100px !important;
padding-left: 100px !important; padding-left: 100px !important;
} }
</style> </style>

@ -57,7 +57,7 @@
width="48" width="48"
class="ml-1 custom-btn custom-icon" class="ml-1 custom-btn custom-icon"
icon=" WMi-trash" icon=" WMi-trash"
@click.native.prevent="deleteSerieFromProgram(series.id)" @click.native.prevent="deleteSeriesFromProgram(series.id)"
/> />
<i class="WMi-right-open ml-3"></i> <i class="WMi-right-open ml-3"></i>
</v-col> </v-col>

@ -3,7 +3,11 @@
<div class="wa__program__images"> <div class="wa__program__images">
<div <div
class="wa__program__image" class="wa__program__image"
:style="{ backgroundImage: `url(${program.thumbnail})` }" :style="{
backgroundImage: `url('${
program.thumbnail ? program.thumbnail : `http://via.placeholder.com/200`
}')`,
}"
></div> ></div>
<div class="wa__program__image__button"> <div class="wa__program__image__button">
<div class="wa__program__image__button--icon"> <div class="wa__program__image__button--icon">
@ -81,6 +85,9 @@ export default {
methods: { methods: {
...mapActions("programs", ["verifyProgram", "deleteProgram"]), ...mapActions("programs", ["verifyProgram", "deleteProgram"]),
}, },
created() {
console.log(this.program);
},
}; };
</script> </script>
<style scoped> <style scoped>
@ -127,4 +134,4 @@ export default {
.wa__program__image__button--icon { .wa__program__image__button--icon {
width: max-content; width: max-content;
} }
</style> </style>

@ -84,6 +84,7 @@ export default {
}, },
async load() { async load() {
await this.loadPrograms(); await this.loadPrograms();
console.log(this.getPrograms);
}, },
}, },
created() { created() {

@ -25,13 +25,13 @@
<div class="d-flex align-center justify-center h-100"> <div class="d-flex align-center justify-center h-100">
<div v-if="user.type == 'trainer'" class="d-flex align-center"> <div v-if="user.type == 'trainer'" class="d-flex align-center">
<div class="user__program--quantity wa__f__m__eb mr-2"> <div class="user__program--quantity wa__f__m__eb mr-2">
{{ user.created_courses_count }} {{ user.created_courses_count ? user.created_courses_count : "0" }}
</div> </div>
<div class="user__program__text">program created</div> <div class="user__program__text">program created</div>
</div> </div>
<div v-else-if="user.type == 'trainee'" class="d-flex align-center"> <div v-else-if="user.type == 'trainee'" class="d-flex align-center">
<div class="user__program--quantity wa__f__m__eb mr-2"> <div class="user__program--quantity wa__f__m__eb mr-2">
{{ user.joined_courses_count }} {{ user.joined_courses_count ? user.joined_courses_count : "0" }}
</div> </div>
<div class="user__program__text">program attended</div> <div class="user__program__text">program attended</div>
</div> </div>
@ -84,7 +84,9 @@ export default {
chageRole() { chageRole() {
this.$emit("userId", this.user.id); this.$emit("userId", this.user.id);
// let role = this.user.userRoles.map((role) => role.id); // let role = this.user.userRoles.map((role) => role.id);
this.$_openModal("changeRole", { role: this.user.role_ids }); this.$_openModal("changeRole", {
role: this.user.role_id ? this.user.role_id : null,
});
}, },
}, },
created() { created() {
@ -97,7 +99,6 @@ export default {
height: 64px; height: 64px;
border-top: 1px solid var(--color-bg-black); border-top: 1px solid var(--color-bg-black);
border-bottom: 1px solid var(--color-bg-black); border-bottom: 1px solid var(--color-bg-black);
/* padding: 12px 0; */
display: flex; display: flex;
align-items: center; align-items: center;
} }
@ -129,4 +130,4 @@ export default {
top: -0.6rem; */ top: -0.6rem; */
line-height: 15px; line-height: 15px;
} }
</style> </style>

@ -7,38 +7,22 @@
</template> </template>
<template #default> <template #default>
<div> <div>
<SectionTitle <SectionTitle title="change role" subTitle="make it our side" :is-modal="true" />
title="change role"
subTitle="make it our side"
:is-modal="true"
/>
</div> </div>
<v-item-group <v-item-group class="mt-10 mb-16" mandatory v-model="role_id" @change="change">
class="mt-10 mb-16"
:mandatory="mandatory"
:multiple="multiple"
v-model="form.roles_id"
@change="change"
>
<v-row> <v-row>
<v-col cols="12" v-for="(role, i) in getRoles" :key="i" class="py-1"> <v-col cols="12" v-for="(role, i) in allRoles" :key="i" class="py-1">
<v-item v-slot="{ active, toggle }" :value="role.id"> <v-item v-slot="{ active, toggle }" :value="role.id">
<v-list-item :disabled="role.disabled" class="d-block"> <main-back :social="true">
<main-back :social="true"> <v-card
<v-card :class="['d-flex', 'align-center', { 'item--active': active }]"
:class="[ dark
'd-flex', height="45"
'align-center', @click="toggle"
{ 'item--active': active }, >
]" <v-card-text class="role">{{ role.name }}</v-card-text>
dark </v-card>
height="45" </main-back>
@click="toggle"
>
<v-card-text class="role">{{ role.name }}</v-card-text>
</v-card>
</main-back>
</v-list-item>
</v-item> </v-item>
</v-col> </v-col>
</v-row> </v-row>
@ -70,6 +54,7 @@
<script> <script>
import { mapActions, mapGetters } from "vuex"; import { mapActions, mapGetters } from "vuex";
import SectionTitle from "../../Global/Section/SectionTitle.vue"; import SectionTitle from "../../Global/Section/SectionTitle.vue";
import toast from "@/utils/toast";
export default { export default {
name: "modal_changeRole", name: "modal_changeRole",
components: { SectionTitle }, components: { SectionTitle },
@ -77,9 +62,9 @@ export default {
userId: {}, userId: {},
}, },
data: () => ({ data: () => ({
roles_id: [], allRoles: [],
multiple: true, role_id: null,
mandatory: true, currectRoleId: null,
}), }),
computed: { computed: {
...mapGetters("users", ["getRoles"]), ...mapGetters("users", ["getRoles"]),
@ -89,42 +74,39 @@ export default {
}, },
methods: { methods: {
...mapActions("users", ["laodRoles", "updateRole"]), ...mapActions("users", ["laodRoles", "updateRole"]),
openModal({ role }) {
this.currectRoleId = role ? role : 0;
this.role_id = role ? role : 0;
console.log("this.form", this.form);
},
change() { change() {
let traineeRole = this.getRoles.find((x) => x.id == 0); this.form.roles_id = [];
this.form.roles_id.push(this.role_id);
console.log(this.form.roles_id); console.log(this.form.roles_id);
if (this.form.roles_id.includes(1) || this.form.roles_id.includes(2)) { console.log(this.role_id);
this.mandatory = false;
traineeRole.disabled = true;
}
if (this.form.roles_id.includes(0)) {
this.mandatory = false;
this.form.roles_id.splice(1, traineeRole);
}
},
openModal({ role }) {
this.roles_id = role;
!role.length ? (this.form.roles_id = [0]) : (this.form.roles_id = role);
}, },
changeRole() { async changeRole() {
if (this.roles_id !== this.form.roles_id) { if (this.form.roles_id) {
this.updateRole(this.form); if (
this.roles_id = this.form.roles_id; !this.form.roles_id.includes(this.currectRoleId) &&
this.role_id !== this.currectRoleId
) {
if (this.form.roles_id.includes(0)) {
this.form.roles_id = [];
}
await this.updateRole(this.form);
this.currectRoleId = this.role_id ? this.role_id : 0;
this.$_closeModal();
} else {
toast.error("Change the roll first", "Error");
}
} }
}, },
}, },
watch: {
form: {
handler(newVal) {
console.log(newVal);
},
},
deep: true,
},
async created() { async created() {
await this.laodRoles(); await this.laodRoles();
this.getRoles.push({ id: 0, name: "trainee", disabled: false }); this.allRoles = this.getRoles;
console.log("this.getRoles", this.getRoles); this.allRoles.push({ id: 0, name: "trainee" });
console.log(this.userId);
}, },
}; };
</script> </script>
@ -140,4 +122,4 @@ export default {
.v-card.v-card--link.v-sheet.theme--dark.d-flex.align-center.item--active { .v-card.v-card--link.v-sheet.theme--dark.d-flex.align-center.item--active {
background-color: transparent !important; background-color: transparent !important;
} }
</style> </style>

@ -35,6 +35,10 @@
class="no-error-msg pt-0" class="no-error-msg pt-0"
placeholder="role" placeholder="role"
label="role" label="role"
:items="allRoles"
item-text="name"
item-value="name"
v-model="filter.role_name.val"
></v-autocomplete> ></v-autocomplete>
</div> </div>
</div> </div>
@ -60,7 +64,7 @@
</template> </template>
<template #footer> <template #footer>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<div class="d-flex justify-space-between align-items-center w-100 px-4"> <div class="d-flex justify-space-between align-items-center w-100">
<RectangleButton <RectangleButton
class="btn__modal--cancel pl-0" class="btn__modal--cancel pl-0"
text="clear" text="clear"
@ -84,13 +88,17 @@
</template> </template>
<script> <script>
import SectionTitle from "../../Global/Section/SectionTitle.vue"; import SectionTitle from "../../Global/Section/SectionTitle.vue";
import { mapMutations } from "vuex"; import { mapActions, mapGetters, mapMutations } from "vuex";
import { cloneDeep } from "lodash"; import { cloneDeep } from "lodash";
const defaultFilter = { const defaultFilter = {
first_name: { first_name: {
type: "like", type: "like",
val: null, val: null,
}, },
role_name: {
type: "in",
val: null,
},
created_at: { created_at: {
type: "between", type: "between",
val1: null, val1: null,
@ -102,9 +110,14 @@ export default {
components: { SectionTitle }, components: { SectionTitle },
data: () => ({ data: () => ({
filter: cloneDeep(defaultFilter), filter: cloneDeep(defaultFilter),
allRoles: null,
}), }),
computed: {
...mapGetters("users", ["getRoles"]),
},
methods: { methods: {
...mapMutations("users", ["SET_FILTER_USER"]), ...mapMutations("users", ["SET_FILTER_USER"]),
...mapActions("users", ["laodRoles"]),
filterUser() { filterUser() {
this.SET_FILTER_USER(this.filter); this.SET_FILTER_USER(this.filter);
this.$emit("filter"); this.$emit("filter");
@ -117,5 +130,10 @@ export default {
this.$_closeModal(); this.$_closeModal();
}, },
}, },
async created() {
await this.laodRoles();
this.allRoles = this.getRoles;
this.allRoles.push({ id: 0, name: "trainee" });
},
}; };
</script> </script>

@ -4,7 +4,7 @@
<v-col cols="4" class="pr-0"> <v-col cols="4" class="pr-0">
<div <div
class="workout__img" class="workout__img"
:style="{ backgroundImage: `url(${workout.thumbnail})` }" :style="{ backgroundImage: `url('${workout.thumbnail}')` }"
></div ></div
></v-col> ></v-col>
<v-col cols="8"> <v-col cols="8">
@ -96,4 +96,4 @@ export default {
height: 100%; height: 100%;
justify-content: space-between; justify-content: space-between;
} }
</style> </style>

@ -29,16 +29,6 @@
></v-text-field> ></v-text-field>
</div> </div>
</div> </div>
<div class="my-6">
<div>
<v-text-field
class="no-error-msg pt-0"
placeholder="mentor name"
label="mentor name"
v-model="filter.first_name.val"
></v-text-field>
</div>
</div>
<div class="my-6"> <div class="my-6">
<div> <div>
<DateInput <DateInput
@ -93,10 +83,6 @@ const defaultFilter = {
type: "like", type: "like",
val: null, val: null,
}, },
first_name: {
type: "like",
val: null,
},
created_at: { created_at: {
type: "between", type: "between",
val1: null, val1: null,
@ -125,4 +111,4 @@ export default {
}, },
}, },
}; };
</script> </script>

@ -93,6 +93,9 @@ export default {
}); });
}, },
}, },
created() {
console.log(this.seriesWorkout);
}
}; };
</script> </script>
<style scoped> <style scoped>

@ -52,9 +52,7 @@
</v-row> </v-row>
</template> </template>
<div class="mt-6"> <div class="mt-6">
<v-row <v-row :class="{ 'mt-9': Object.keys(getWorkoutToSeries).length === 0 }">
:class="{ 'mt-9': Object.keys(getWorkoutToSeries).length === 0 }"
>
<v-col cols="4"> <v-col cols="4">
<v-text-field <v-text-field
dark dark
@ -125,6 +123,7 @@ import SectionTitle from "../../Global/Section/SectionTitle.vue";
import AddWorkoutsItem from "../Item.vue"; import AddWorkoutsItem from "../Item.vue";
import { mapActions, mapGetters, mapMutations } from "vuex"; import { mapActions, mapGetters, mapMutations } from "vuex";
import { cloneDeep } from "lodash"; import { cloneDeep } from "lodash";
import toast from "@/utils/toast";
let cancelId; let cancelId;
const defaultFilter = { const defaultFilter = {
title: { title: {
@ -144,10 +143,7 @@ export default {
workoutId: null, workoutId: null,
}), }),
computed: { computed: {
...mapGetters("workoutToSeries", [ ...mapGetters("workoutToSeries", ["getWorkoutsToSeries", "getWorkoutToSeries"]),
"getWorkoutsToSeries",
"getWorkoutToSeries",
]),
...mapGetters("programSeries", ["getCurrentSeriesId"]), ...mapGetters("programSeries", ["getCurrentSeriesId"]),
}, },
watch: { watch: {
@ -180,14 +176,16 @@ export default {
await this.loadWorkoutToSeries(this.workoutId); await this.loadWorkoutToSeries(this.workoutId);
}, },
async WorkoutToSeries() { async WorkoutToSeries() {
let response = await this.addWorkoutToSeries({ if (this.workoutId) {
data: this.form, await this.addWorkoutToSeries({
seriesId: Number(this.getCurrentSeriesId), data: this.form,
workoutId: this.workoutId, seriesId: Number(this.getCurrentSeriesId),
}); workoutId: this.workoutId,
if (response) { });
this.$_closeModal(); this.$_closeModal();
return;
} }
return toast.error("Please select a workout firstt", "Error");
}, },
}, },
async created() { async created() {
@ -199,4 +197,4 @@ export default {
.theme--light.v-list { .theme--light.v-list {
background-color: rgb(46, 45, 45) !important; background-color: rgb(46, 45, 45) !important;
} }
</style> </style>

@ -5,10 +5,13 @@ import vuetify from './plugins/vuetify';
import router from './router'; import router from './router';
import './utils/GlobalComponents'; import './utils/GlobalComponents';
import "./styles/global.scss"; import "./styles/global.scss";
import './mixins/Global.js';
import ApiService from '@/utils/axios/api'; import ApiService from '@/utils/axios/api';
ApiService.init('https://app.champya-dev.ir'); ApiService.init('https://app.champya-dev.ir');
import '@/utils/axios/errorHandler'; import '@/utils/axios/errorHandler';
/* mixins */
import $_mixin from "./mixins/global";
Vue.mixin($_mixin);
Vue.config.productionTip = false Vue.config.productionTip = false
new Vue({ new Vue({

@ -1,18 +1,27 @@
import { mapActions } from "vuex"; // import { mapActions } from "vuex";
// import $_color from "@Global/utils/module-color"; // // import $_color from "@Global/utils/module-color";
import Vue from 'vue'; // import backHome from "./backHome";
const modal = { // import Vue from 'vue';
...mapActions("modal", [
"__openModal", // const modal = {
"$_closeModal" // ...mapActions("modal", [
]), // "__openModal",
$_openModal(name, data = {}) { // "$_closeModal"
this.__openModal({ ...data, ...{ name } }) // ]),
}, // $_openModal(name, data = {}) {
}; // this.__openModal({ ...data, ...{ name } })
// },
// };
Vue.mixin({ // Vue.mixin({
methods: { ...modal } // methods: { ...modal, ...backHome }
}); // });
import { $_closeModal, $_openModal } from './modal';
export default {
methods: {
$_openModal,
$_closeModal,
},
}

@ -0,0 +1,20 @@
function $_openModal(name, data = {}) {
this.$store.dispatch('modal/__openModal', { ...data, ...{ name } });
// this.$store.dispatch('modal/$_closeModal');
// const modal = {
// ...mapActions("modal", [
// "__openModal",
// "$_closeModal"
// ]),
// $_openModal(name, data = {}) {
// this.__openModal({ ...data, ...{ name } })
// },
// };
}
function $_closeModal() {
this.$store.dispatch('modal/$_closeModal');
}
export {
$_openModal,
$_closeModal
}

@ -64,7 +64,8 @@ function beforeLoad() {
const auth = to.meta && to.meta.auth ? to.meta.auth : false; const auth = to.meta && to.meta.auth ? to.meta.auth : false;
const roles = to.meta && to.meta.roles ? to.meta.roles : false; const roles = to.meta && to.meta.roles ? to.meta.roles : false;
const loggedIn = !!TokenStorage.getToken(); const loggedIn = TokenStorage.hasToken();
console.log(auth, loggedIn);
if (auth && !loggedIn) { if (auth && !loggedIn) {
router.push({ name: 'login', query: { redirect: to.fullPath } }); router.push({ name: 'login', query: { redirect: to.fullPath } });
} }

@ -18,7 +18,7 @@ export default [
path: '/', path: '/',
view: 'Dashboard', view: 'Dashboard',
name: 'dashboard', name: 'dashboard',
// meta: { auth: true } meta: { auth: true }
}, },
{ {
path: '/users', path: '/users',

@ -22,6 +22,7 @@ export default {
let repository = new BookmarkRepository(); let repository = new BookmarkRepository();
await repository.deleteBookmark(workoutId); await repository.deleteBookmark(workoutId);
commit('DELETE_BOOKMARKS_WORKOUT', workoutId); commit('DELETE_BOOKMARKS_WORKOUT', workoutId);
}, },
async deleteBookmarksProgram({ commit }, courseId) { async deleteBookmarksProgram({ commit }, courseId) {
let repository = new BookmarkRepository(); let repository = new BookmarkRepository();

@ -16,10 +16,14 @@ export default {
}, },
DELETE_BOOKMARKS_WORKOUT(state, payload) { DELETE_BOOKMARKS_WORKOUT(state, payload) {
const index = state.workouts.findIndex((x) => x.id === payload); const index = state.workouts.findIndex((x) => x.id === payload);
Vue.delete(state.workouts, index) Vue.delete(state.workouts, index);
Vue.set(state.workoutsPagination, 'itemsLength', state.workoutsPagination.itemsLength - 1);
Vue.set(state.workoutsPagination, 'pageStop', state.workoutsPagination.pageStop - 1);
}, },
DELETE_BOOKMARKS_PROGRAM(state, payload) { DELETE_BOOKMARKS_PROGRAM(state, payload) {
const index = state.programs.findIndex((x) => x.id === payload); const index = state.programs.findIndex((x) => x.id === payload);
Vue.delete(state.programs, index) Vue.delete(state.programs, index);
Vue.set(state.programsPagination, 'itemsLength', state.programsPagination.itemsLength - 1);
Vue.set(state.programsPagination, 'pageStop', state.programsPagination.pageStop - 1);
}, },
}; };

@ -9,6 +9,7 @@ export default {
SET_PAGINATION(state, pagination) { SET_PAGINATION(state, pagination) {
pagination = { ...state.pagination, ...pagination }; pagination = { ...state.pagination, ...pagination };
Vue.set(state, "pagination", pagination); Vue.set(state, "pagination", pagination);
console.log('state.pagination', state.pagination);
}, },
SET_FILTER_PROGRAMS(state, payload) { SET_FILTER_PROGRAMS(state, payload) {
Vue.set(state, "filters", payload); Vue.set(state, "filters", payload);
@ -23,7 +24,9 @@ export default {
}, },
DELETE_PROGRAM(state, payload) { DELETE_PROGRAM(state, payload) {
const index = state.programs.findIndex((x) => x.id === payload); const index = state.programs.findIndex((x) => x.id === payload);
Vue.delete(state.programs, index) Vue.delete(state.programs, index);
Vue.set(state.pagination, 'itemsLength', state.pagination.itemsLength - 1);
Vue.set(state.pagination, 'pageStop', state.pagination.pageStop - 1);
}, },
VERIFY_PROGRAM(state, payload) { VERIFY_PROGRAM(state, payload) {
const index = state.programs.find(x => x.id === payload); const index = state.programs.find(x => x.id === payload);

@ -21,7 +21,8 @@ export default {
}, },
DELETE_USER(state, userId) { DELETE_USER(state, userId) {
const index = state.users.findIndex((x) => x.id === userId); const index = state.users.findIndex((x) => x.id === userId);
// state.users.splice(index, 1); Vue.delete(state.users, index);
Vue.delete(state.users, index) Vue.set(state.pagination, 'itemsLength', state.pagination.itemsLength - 1);
Vue.set(state.pagination, 'pageStop', state.pagination.pageStop - 1);
}, },
}; };

@ -23,6 +23,8 @@ export default {
}, },
DELETE_WORKOUT(state, workoutId) { DELETE_WORKOUT(state, workoutId) {
const index = state.workouts.findIndex((x) => x.id === workoutId); const index = state.workouts.findIndex((x) => x.id === workoutId);
Vue.delete(state.workouts, index) Vue.delete(state.workouts, index);
Vue.set(state.pagination, 'itemsLength', state.pagination.itemsLength - 1);
Vue.set(state.pagination, 'pageStop', state.pagination.pageStop - 1);
}, },
}; };

Loading…
Cancel
Save