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

@ -12,11 +12,20 @@
<script>
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 {
name: "App",
data: () => ({
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>

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

@ -15,10 +15,11 @@ export const getJson = (data) => ({
cell_number: data.cell_number,
is_admin: data.is_admin,
is_trainer: data.is_trainer,
country: data.country,
country_id: data.country.id,
country: data?.country,
country_id: data.country?.id,
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) => {
let formData = {

@ -1,6 +1,7 @@
import { SetPagination, SetQueriesObject } from "@/utils/setQueriesObject";
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 roles = data.roles.map(x => x.name);
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,
type: type,
role: data.roles,
role_ids: role_ids,
role_id: role_id,
created_courses_count: data.created_courses_count,
joined_courses_count: data.joined_courses_count
})

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

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

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

@ -20,6 +20,7 @@
<v-tab class="bookmarks__tab">workouts</v-tab>
</v-tabs>
<v-tabs-items v-model="tab">
<!-- program tab -->
<v-tab-item>
<v-row class="mt-4">
<v-col
@ -38,6 +39,8 @@
/>
</div>
</v-tab-item>
<!-- /program tab -->
<!-- workout tab -->
<v-tab-item>
<v-row class="mt-4">
<v-col
@ -55,6 +58,7 @@
/>
</div>
</v-tab-item>
<!-- /workout tab -->
</v-tabs-items>
</v-col>
</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>",
},
files: { default: () => [] },
collection: { default: "image" },
collection: { default: "images" },
modelName: { default: "model" },
batchId: {
type: String,

@ -7,7 +7,7 @@
<div class="product__image">
<div
class="product__img"
:style="{ backgroundImage: `url(${product.src})` }"
:style="{ backgroundImage: `url('${product.thumbnail}')` }"
></div>
</div>
<div class="product__name">

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

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

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

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

@ -25,13 +25,13 @@
<div class="d-flex align-center justify-center h-100">
<div v-if="user.type == 'trainer'" class="d-flex align-center">
<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 class="user__program__text">program created</div>
</div>
<div v-else-if="user.type == 'trainee'" class="d-flex align-center">
<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 class="user__program__text">program attended</div>
</div>
@ -84,7 +84,9 @@ export default {
chageRole() {
this.$emit("userId", this.user.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() {
@ -97,7 +99,6 @@ export default {
height: 64px;
border-top: 1px solid var(--color-bg-black);
border-bottom: 1px solid var(--color-bg-black);
/* padding: 12px 0; */
display: flex;
align-items: center;
}

@ -7,38 +7,22 @@
</template>
<template #default>
<div>
<SectionTitle
title="change role"
subTitle="make it our side"
:is-modal="true"
/>
<SectionTitle title="change role" subTitle="make it our side" :is-modal="true" />
</div>
<v-item-group
class="mt-10 mb-16"
:mandatory="mandatory"
:multiple="multiple"
v-model="form.roles_id"
@change="change"
>
<v-item-group class="mt-10 mb-16" mandatory v-model="role_id" @change="change">
<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-list-item :disabled="role.disabled" class="d-block">
<main-back :social="true">
<v-card
:class="[
'd-flex',
'align-center',
{ 'item--active': active },
]"
dark
height="45"
@click="toggle"
>
<v-card-text class="role">{{ role.name }}</v-card-text>
</v-card>
</main-back>
</v-list-item>
<main-back :social="true">
<v-card
:class="['d-flex', 'align-center', { 'item--active': active }]"
dark
height="45"
@click="toggle"
>
<v-card-text class="role">{{ role.name }}</v-card-text>
</v-card>
</main-back>
</v-item>
</v-col>
</v-row>
@ -70,6 +54,7 @@
<script>
import { mapActions, mapGetters } from "vuex";
import SectionTitle from "../../Global/Section/SectionTitle.vue";
import toast from "@/utils/toast";
export default {
name: "modal_changeRole",
components: { SectionTitle },
@ -77,9 +62,9 @@ export default {
userId: {},
},
data: () => ({
roles_id: [],
multiple: true,
mandatory: true,
allRoles: [],
role_id: null,
currectRoleId: null,
}),
computed: {
...mapGetters("users", ["getRoles"]),
@ -89,42 +74,39 @@ export default {
},
methods: {
...mapActions("users", ["laodRoles", "updateRole"]),
openModal({ role }) {
this.currectRoleId = role ? role : 0;
this.role_id = role ? role : 0;
console.log("this.form", this.form);
},
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);
if (this.form.roles_id.includes(1) || this.form.roles_id.includes(2)) {
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);
console.log(this.role_id);
},
changeRole() {
if (this.roles_id !== this.form.roles_id) {
this.updateRole(this.form);
this.roles_id = this.form.roles_id;
async changeRole() {
if (this.form.roles_id) {
if (
!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() {
await this.laodRoles();
this.getRoles.push({ id: 0, name: "trainee", disabled: false });
console.log("this.getRoles", this.getRoles);
console.log(this.userId);
this.allRoles = this.getRoles;
this.allRoles.push({ id: 0, name: "trainee" });
},
};
</script>

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

@ -4,7 +4,7 @@
<v-col cols="4" class="pr-0">
<div
class="workout__img"
:style="{ backgroundImage: `url(${workout.thumbnail})` }"
:style="{ backgroundImage: `url('${workout.thumbnail}')` }"
></div
></v-col>
<v-col cols="8">

@ -29,16 +29,6 @@
></v-text-field>
</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>
<DateInput
@ -93,10 +83,6 @@ const defaultFilter = {
type: "like",
val: null,
},
first_name: {
type: "like",
val: null,
},
created_at: {
type: "between",
val1: null,

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

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

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

@ -1,18 +1,27 @@
import { mapActions } from "vuex";
// import $_color from "@Global/utils/module-color";
import Vue from 'vue';
// import { mapActions } from "vuex";
// // import $_color from "@Global/utils/module-color";
// import backHome from "./backHome";
const modal = {
...mapActions("modal", [
"__openModal",
"$_closeModal"
]),
$_openModal(name, data = {}) {
this.__openModal({ ...data, ...{ name } })
},
};
// import Vue from 'vue';
// const modal = {
// ...mapActions("modal", [
// "__openModal",
// "$_closeModal"
// ]),
// $_openModal(name, data = {}) {
// this.__openModal({ ...data, ...{ name } })
// },
// };
Vue.mixin({
methods: { ...modal }
});
// Vue.mixin({
// 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 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) {
router.push({ name: 'login', query: { redirect: to.fullPath } });
}

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

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

@ -16,10 +16,14 @@ export default {
},
DELETE_BOOKMARKS_WORKOUT(state, 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) {
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) {
pagination = { ...state.pagination, ...pagination };
Vue.set(state, "pagination", pagination);
console.log('state.pagination', state.pagination);
},
SET_FILTER_PROGRAMS(state, payload) {
Vue.set(state, "filters", payload);
@ -23,7 +24,9 @@ export default {
},
DELETE_PROGRAM(state, 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) {
const index = state.programs.find(x => x.id === payload);

@ -21,7 +21,8 @@ export default {
},
DELETE_USER(state, 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) {
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