sajjad 3 years ago
parent b76325016b
commit 6fe72d9add

210
package-lock.json generated

@ -1166,6 +1166,21 @@
"integrity": "sha1-K1o6s/kYzKSKjHVMCBaOPwPrphs=",
"dev": true
},
"@riophae/vue-treeselect": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/@riophae/vue-treeselect/-/vue-treeselect-0.4.0.tgz",
"integrity": "sha512-J4atYmBqXQmiPFK/0B5sXKjtnGc21mBJEiyKIDZwk0Q9XuynVFX6IJ4EpaLmUgL5Tve7HAS7wkiGGSti6Uaxcg==",
"requires": {
"@babel/runtime": "^7.3.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"easings-css": "^1.0.0",
"fuzzysearch": "^1.0.3",
"is-promise": "^2.1.0",
"lodash": "^4.0.0",
"material-colors": "^1.2.6",
"watch-size": "^2.0.0"
}
},
"@soda/friendly-errors-webpack-plugin": {
"version": "1.8.0",
"resolved": "https://registry.nlark.com/@soda/friendly-errors-webpack-plugin/download/@soda/friendly-errors-webpack-plugin-1.8.0.tgz",
@ -1753,6 +1768,63 @@
"integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=",
"dev": true
},
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"ssri": {
"version": "8.0.1",
"resolved": "https://registry.nlark.com/ssri/download/ssri-8.0.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fssri%2Fdownload%2Fssri-8.0.1.tgz",
@ -1761,6 +1833,28 @@
"requires": {
"minipass": "^3.1.1"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.1",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.1.tgz",
"integrity": "sha512-V53TJbHmzjBhCG5OYI2JWy/aYDspz4oVHKxS43Iy212GjGIG1T3EsB3+GWXFm/1z5VwjdjLmdZUFYM70y77vtQ==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
}
}
}
},
@ -2375,6 +2469,11 @@
"resolve": "^1.12.0"
}
},
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg=="
},
"babel-loader": {
"version": "8.2.2",
"resolved": "https://registry.npm.taobao.org/babel-loader/download/babel-loader-8.2.2.tgz?cache=0&sync_timestamp=1606424688085&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbabel-loader%2Fdownload%2Fbabel-loader-8.2.2.tgz",
@ -4552,6 +4651,11 @@
"stream-shift": "^1.0.0"
}
},
"easings-css": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/easings-css/-/easings-css-1.0.0.tgz",
"integrity": "sha512-7Uq7NdazNfVtr0RNmPAys8it0zKCuaqxJStYKEl72D3j4gbvXhhaM7iWNbqhA4C94ygCye6VuyhzBRQC4szeBg=="
},
"easy-bem": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/easy-bem/-/easy-bem-1.1.1.tgz",
@ -5583,6 +5687,11 @@
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"dev": true
},
"fuzzysearch": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/fuzzysearch/-/fuzzysearch-1.0.3.tgz",
"integrity": "sha1-3/yA9tawQiPyImqnndGUIxCW0Ag="
},
"gensync": {
"version": "1.0.0-beta.2",
"resolved": "https://registry.npm.taobao.org/gensync/download/gensync-1.0.0-beta.2.tgz?cache=0&sync_timestamp=1603829621482&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fgensync%2Fdownload%2Fgensync-1.0.0-beta.2.tgz",
@ -6757,6 +6866,11 @@
"isobject": "^3.0.1"
}
},
"is-promise": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz",
"integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ=="
},
"is-regex": {
"version": "1.1.4",
"resolved": "https://registry.nlark.com/is-regex/download/is-regex-1.1.4.tgz?cache=0&sync_timestamp=1628221905423&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-regex%2Fdownload%2Fis-regex-1.1.4.tgz",
@ -7115,9 +7229,8 @@
},
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.nlark.com/lodash/download/lodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw=",
"dev": true
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"lodash.debounce": {
"version": "4.0.8",
@ -7215,6 +7328,11 @@
"object-visit": "^1.0.0"
}
},
"material-colors": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/material-colors/-/material-colors-1.2.6.tgz",
"integrity": "sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg=="
},
"md5.js": {
"version": "1.3.5",
"resolved": "https://registry.npm.taobao.org/md5.js/download/md5.js-1.3.5.tgz",
@ -11374,87 +11492,6 @@
}
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.1",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.1.tgz",
"integrity": "sha512-V53TJbHmzjBhCG5OYI2JWy/aYDspz4oVHKxS43Iy212GjGIG1T3EsB3+GWXFm/1z5VwjdjLmdZUFYM70y77vtQ==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-meta": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/vue-meta/-/vue-meta-2.4.0.tgz",
@ -11564,6 +11601,11 @@
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz",
"integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw=="
},
"watch-size": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/watch-size/-/watch-size-2.0.0.tgz",
"integrity": "sha512-M92R89dNoTPWyCD+HuUEDdhaDnh9jxPGOwlDc0u51jAgmjUvzqaEMynXSr3BaWs+QdHYk4KzibPy1TFtjLmOZQ=="
},
"watchpack": {
"version": "1.7.5",
"resolved": "https://registry.nlark.com/watchpack/download/watchpack-1.7.5.tgz?cache=0&sync_timestamp=1621437900992&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fwatchpack%2Fdownload%2Fwatchpack-1.7.5.tgz",

@ -8,11 +8,13 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"@riophae/vue-treeselect": "^0.4.0",
"axios": "^0.21.4",
"bootstrap": "^4.6.0",
"core-js": "^3.6.5",
"izitoast": "^1.4.0",
"jquery": "^3.6.0",
"lodash": "^4.17.21",
"meta-router": "^4.0.1",
"module-alias": "^2.2.2",
"popper.js": "^1.16.1",

@ -0,0 +1,18 @@
import axios from "axios";
import url from '@/router/url';
import { getArray } from "../resources/bookmarksResource";
export default class BookmarsRepository {
async indexCourses() {
let response = await axios.get(url('indexCoursesBookmarks'));
if (response.status === 200) {
return getArray(response.data);
}
}
async indexWorkouts() {
let response = await axios.get(url('indexWorkoutsBookmarks'));
if (response.status === 200) {
return getArray(response.data);
}
}
}

@ -0,0 +1,12 @@
import axios from "axios";
import url from '@/router/url';
import { getJson } from "../resources/countriesResource";
export default class CountriesRepository {
async index() {
let response = await axios.get(url("indexCountries"));
if (response.status === 200) {
return getJson(response.data)
}
}
}

@ -0,0 +1,11 @@
import axios from "axios";
import url from "@/router/url";
import { getArray } from "../resources/productCategoriesResource";
export default class ProductCategoriesRepository {
async index() {
let response = await axios.get(url("indexProductCategories"));
if (response.status === 200) {
return getArray(response.data);
}
}
}

@ -0,0 +1,25 @@
import axios from "axios";
import url from "@/router/url";
import { getJson, setData, getArray, setQuery } from "../resources/productResource";
export default class ProductRepository {
async index(data) {
let params = setQuery(data);
let response = await axios.get(url("indexProduct"), { params });
if (response.status === 200) {
return getArray(response.data);
}
}
async show(productId) {
let response = await axios.get(url("showProduct", { product: productId }));
if (response.status === 200) {
return getJson(response.data.data);
}
}
async store(data) {
let json = setData(data);
let response = await axios.post(url("storeProduct"), json);
if (response.status === 201) {
return getJson(response.data);
}
}
}

@ -0,0 +1,18 @@
import axios from "axios";
import url from '@/router/url'
import { setData, getJson } from '../resources/profileResource';
export default class ProfileRepository {
async show() {
let response = await axios.get(url("showProfile"));
if (response.status === 200) {
return getJson(response.data.data);
}
}
async update(data) {
let json = setData(data, true);
let response = await axios.post(url("updateProfile"), json);
if (response.status === 200) {
return getJson(response.data.data);
}
}
}

@ -15,7 +15,6 @@ export default class ProgramRepository {
// data.pagination['itemsPerPage'] = 2
// }
let params = setQuery(data);
// console.log('params', params);
let response = await axios.get(url("indexProgram"), {
headers: { 'accept-language': 'en' },
params

@ -0,0 +1,21 @@
import axios from "axios";
import url from "@/router/url";
import { getJson, setData } from "../resources/programSerieResource";
export default class ProgramSerieRepository {
async show(courseId) {
let response = await axios.get(url("showProgram", { course: courseId }));
if (response.status === 200) {
return getJson(response.data.data);
}
}
async store(data, courseId) {
let json = setData(data);
let response = await axios.post(url("storeSerie", { course: courseId }), json);
if (response.status === 201 || response.status === 200) {
return getJson(response.data);
}
}
async delete(data) {
await axios.delete(url("destroySerie", { serie: data }));
}
}

@ -0,0 +1,16 @@
import axios from "axios";
import url from "@/router/url";
import { getArray, setQuery } from "../resources/usersResource";
export default class UsersRepository {
async index(data) {
let params = setQuery(data)
let response = await axios.get(url('indexUsers'), { params })
if (response.status === 200) {
return getArray(response.data)
}
}
async delete(userId) {
await axios.delete(url("destroyUser", { user: userId }));
}
}

@ -0,0 +1,28 @@
import axios from "axios";
import url from "@/router/url";
import { getJson, getArray, setQuery, setData } from "../resources/workoutResource.js";
export default class WorkoutToSerieRepository {
async index(data) {
let params = setQuery(data);
let response = await axios.get(url("indexClientWorkout"), { params });
if (response.status === 200) {
return getArray(response.data);
}
}
async show(workoutId) {
let response = await axios.get(url("showClientWorkout", { workout: workoutId }));
if (response.status === 200) {
return getJson(response.data.data);
}
}
async store(data, serieId, workoutId) {
let json = setData(data);
let response = await axios.post(url("joinWorkoutToSerie", { serie: serieId, workout: workoutId }), json);
if (response.status === 201 || response.status === 200) {
return response.data;
}
}
async delete(data) {
await axios.delete(url("destroyWorkoutFromSerie", { serie: data.serieId, workout: data.workoutId }));
}
}

@ -0,0 +1,16 @@
import { getJson as getJsonProgram } from './programResource'
import { getJson as getJsonWorkout } from './workoutResource'
export const getJson = (data) => ({
id: data.id,
bookmarkable_type: data.bookmarkable_type,
bookmarkable_id: data.bookmarkable_id,
user_id: data.user_id,
bookmark_data: data.courses ? getJsonProgram(data.courses) : getJsonWorkout(data.workouts),
});
export const getArray = ({ data }) => {
// const pagination = SetPagination(meta);
console.log(data);
data = data.map(bookmark => getJson(bookmark));
return { data };
};

@ -0,0 +1,9 @@
export const getJson = (data) => ({
id: data.id,
name: data.name,
code: data.code
});
export const getArray = ({ data }) => {
data = data.map(country => getJson(country))
return { data }
};

@ -0,0 +1,11 @@
export const getJson = (data) => ({
id: data.id,
local_name: data.local_name,
name: data.name,
label: data.name,
children: data.children
});
export const getArray = ({ data }) => {
data = data.map((productCategory) => getJson(productCategory));
return { data };
}

@ -0,0 +1,48 @@
import { objectToFormData } from "@/utils/objectToFormData";
import { SetPagination, SetQueriesObject } from "@/utils/setQueriesObject";
export const getJson = (data) => ({
id: data.id,
thumbnail: data.thumbnail,
title: data.title,
tags: data.tags,
description: data.description,
images: data.images,
name: data.name,
video_link: data.video_link,
purchase_link: data.purchase_link,
price: data.price,
weight: data.weight,
dimensions: data.dimensions,
product_category: data.product_category,
product_categories_id: data.product_category?.id,
product_category_id: data.product_category?.parent?.id
});
export const setData = (data, isUpdate = false) => {
let formData = {
product_category_id: data.product_category_id,
title: data.title,
description: data.description,
purchase_link: data.purchase_link,
price: `${data.price}$`,
video_link: data.video_link,
name: data.name,
dimensions: `${data.dimensions}cm`,
weight: `${data.weight}kg`,
tags: data.tags,
batch_id: data.batch_id
};
if (isUpdate) {
formData["_method"] = "put";
}
return objectToFormData(formData);
};
export const getArray = ({ data, meta }) => {
const pagination = SetPagination(meta);
data = data.map(product => getJson(product));
return { data, pagination };
};
export const setQuery = (data) => {
return SetQueriesObject(data);
};

@ -0,0 +1,11 @@
export const getJsonProductSubCategory = (data) => ({
id: data.id,
name: data.name,
label: data.name,
local_name: data.local_name,
children: data.children ? getArrayProductSubCategory(data.children) : [],
});
export const getArrayProductSubCategory = (data) => {
data = data.map((productCategory) => getJsonProductSubCategory(productCategory));
return data;
}

@ -0,0 +1,42 @@
import { objectToFormData } from "@/utils/objectToFormData";
export const getJson = (data) => ({
id: data.id,
first_name: data.first_name,
last_name: data.last_name,
birthday: data.birthday,
weight: data.weight,
height: data.height,
arm_diameter: data.arm_diameter,
leg_diameter: data.leg_diameter,
details: data.details,
profile: data.profile,
address: data.address,
email: data.email,
cell_number: data.cell_number,
is_admin: data.is_admin,
is_trainer: data.is_trainer,
country: data.country,
country_id: data.country.id,
created_courses_count: data.created_courses_count,
joined_courses_count: data.joined_courses_count
});
export const setData = (data, isUpdate = false) => {
let formData = {
first_name: data.first_name,
last_name: data.last_name,
birthday: data.birthday,
weight: data.weight,
height: data.height,
arm_diameter: data.arm_diameter,
leg_diameter: data.leg_diameter,
details: data.details,
address: data.address,
email: data.email,
cell_number: data.cell_number,
country_id: data.country_id,
};
if (isUpdate) {
formData["_method"] = "put";
}
return objectToFormData(formData);
}

@ -5,6 +5,7 @@ import { objectToFormData } from "@/utils/objectToFormData";
export const getJson = (data) => ({
id: data.id,
trainer: data.trainer ? getJsonTrainer(data.trainer) : {},
trainer_id: data.trainer_id,
sport_category: data.trainer ? getJsonSportCategory(data.trainer) : {},
sport_category_id: data.sport_category_id,
thumbnail: data.thumbnail,
@ -15,6 +16,9 @@ export const getJson = (data) => ({
description: data.description,
series_count: data.series_count,
workouts_count: data.workouts_count,
language_id: data.language_id,
type: data.type,
period: data.period
});
export const setData = (data, isUpdate = false) => {
let formData = {

@ -0,0 +1,28 @@
import { getJsonTrainer } from './trainerProgramResource';
import { objectToFormData } from "@/utils/objectToFormData";
export const getJson = (data) => ({
id: data.id,
trainer: data.trainer ? getJsonTrainer(data.trainer) : {},
sport_category_id: data.sport_category_id,
verified: data.verified,
title: data.title,
description: data.description,
thumbnail: data.thumbnail,
course_type: data.course_type,
tags: data.tags,
series_count: data.series_count,
workouts_count: data.workouts_count,
series: data.series,
course_series_id: data.course_series_id,
estimate_time: data.estimate_time,
repeat: data.repeat,
name: data.name
});
export const setData = (data) => {
let formData = {
name: data.name,
estimate_time: data.estimate_time,
repeat: data.repeat
};
return objectToFormData(formData);
};

@ -7,5 +7,11 @@ export const getJsonTrainer = (data) => ({
height: data.height,
arm_diameter: data.arm_diameter,
leg_diameter: data.leg_diameter,
details: data.details
})
details: data.details,
profile: data.profile,
address: data.address,
email: data.email,
cell_number: data.cell_number,
is_admin: data.is_admin,
is_trainer: data.is_trainer,
});

@ -0,0 +1,28 @@
import { SetPagination, SetQueriesObject } from "@/utils/setQueriesObject";
export const getJson = (data) => ({
id: data.id,
first_name: data.first_name,
last_name: data.last_name,
birthday: data.birthday,
weight: data.weight,
height: data.height,
arm_diameter: data.arm_diameter,
leg_diameter: data.leg_diameter,
details: data.details,
profile: data.profile,
address: data.address,
email: data.email,
cell_number: data.cell_number,
is_admin: data.is_admin,
is_trainer: data.is_trainer,
created_courses_count: data.created_courses_count,
joined_courses_count: data.joined_courses_count
});
export const getArray = ({ data, meta }) => {
const pagination = SetPagination(meta);
data = data.map((user) => getJson(user));
return { data, pagination };
};
export const setQuery = (data) => {
return SetQueriesObject(data);
};

@ -1,11 +1,11 @@
import { objectToFormData } from "@/utils/objectToFormData";
import { SetQueriesObject } from "@/utils/setQueriesObject";
import { SetPagination, SetQueriesObject } from "@/utils/setQueriesObject";
export const getJson = (data) => ({
id: data.id,
local_name: data.local_name,
name: data.name,
workout_category_id: data.workout_category.id,
sport_category_id: data.workout_category.sport_category ? data.workout_category.sport_category.id : null,
workout_category_id: data.workout_category?.id,
sport_category_id: data.workout_category?.sport_category ? data.workout_category.sport_category.id : null,
description: data.description,
suggested_per_set: data.suggested_per_set,
suggested_set: data.suggested_set,
@ -29,16 +29,19 @@ export const setData = (data, isUpdate = false) => {
suggested_time: data.suggested_time,
batch_id: data.batch_id,
tags: data.tags,
set: data.set,
per_set: data.per_set,
estimate_time: data.estimate_time
};
if (isUpdate) {
formData["_method"] = "put";
}
return objectToFormData(formData);
};
export const getArray = ({ data }) => {
export const getArray = ({ data, meta }) => {
const pagination = SetPagination(meta);
data = data.map((workout) => getJson(workout));
return { data };
return { data, pagination };
};
export const setQuery = (data) => {

@ -15,12 +15,11 @@
<v-col cols="3">
<div class="pb-14 h-100">
<div class="add__workout dark w-100 h-100">
<div class="add__workout__picture d-flex align-center">
<i class="WMi-picture add__workout__picture--icon"></i>
<div class="add__workout__picture--text">
select a workout image
</div>
</div>
<ImageCropper
label="manager image"
:url.sync="form.thumbnail"
v-model="fileForm.media"
/>
</div>
</div>
</v-col>
@ -28,16 +27,37 @@
<v-row>
<v-col cols="4">
<v-autocomplete
dark
item-text="name"
item-value="id"
label="product category"
:items="getProductCategories"
@change="changeProductCategories"
v-model="form.product_categories_id"
></v-autocomplete>
</v-col>
<v-col cols="4">
<!-- <template>
<v-treeview
activatable
dark
:items="child.children"
></v-treeview>
<TreeSelect
:options="child"
:noChildrenText="noChildrenText"
:placeholder="placeholder"
:noResultsText="noResultsText"
v-model="form.product_category_id"
/>
</template> -->
<v-autocomplete
dark
item-text="name"
item-value="id"
label="product subcategory"
label="workout subcategory"
:items="child"
v-model="form.product_category_id"
></v-autocomplete>
</v-col>
<v-col cols="4"></v-col>
@ -48,6 +68,8 @@
placeholder="product name"
label="product name"
class="no-error-msg pt-0 mt-0"
dark
v-model="form.name"
></v-text-field>
</v-col>
<v-col cols="8"
@ -55,6 +77,8 @@
placeholder="a short quote"
label="a short quote"
class="no-error-msg pt-0 mt-0"
dark
v-model="form.title"
></v-text-field
></v-col>
</v-row>
@ -64,6 +88,8 @@
rows="3"
label="description"
placeholder="description"
dark
v-model="form.description"
></v-textarea>
</v-col>
</v-row>
@ -78,6 +104,9 @@
placeholder="price"
label="price"
class="no-error-msg pt-0 mt-0"
prefix="$"
dark
v-model="form.price"
></v-text-field
></v-col>
<v-col cols="2"
@ -85,6 +114,9 @@
placeholder="package weight"
label="package weight"
class="no-error-msg pt-0 mt-0"
suffix="kg"
dark
v-model="form.weight"
></v-text-field
></v-col>
<v-col cols="2"
@ -92,6 +124,9 @@
placeholder="package dimensions"
label="package dimensions"
class="no-error-msg pt-0 mt-0"
suffix="cm"
dark
v-model="form.dimensions"
></v-text-field
></v-col>
<v-col cols="6"
@ -99,6 +134,8 @@
placeholder="vintroduction video link"
label="vintroduction video link"
class="no-error-msg pt-0 mt-0"
dark
v-model="form.video_link"
></v-text-field
></v-col>
</v-row>
@ -107,22 +144,39 @@
<v-text-field
placeholder="shopping link - amazon mainly"
label="shopping link - amazon mainly"
dark
v-model="form.purchase_link"
></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<v-autocomplete
class="pt-0 multiple"
:items="items"
item-value="id"
item-text="name"
attach
chips
<v-combobox
v-model="form.tags"
clearable
:append-icon="null"
hide-selected
class="multiple"
label="product tags - useful for better search"
placeholder="product tags - useful for better search"
multiple
></v-autocomplete>
persistent-hint
small-chips
dark
>
<template #selection="{ item, select }">
<v-chip
label
small
color="white"
text-color="black"
close
@click="select"
@click:close="removeTags(item)"
>{{ item }}</v-chip
>
</template>
</v-combobox>
</v-col>
</v-row>
<v-row class="mb-4">
@ -155,6 +209,7 @@
text="add the product"
class="custom-btn add-btn"
height="25"
@click.native="submit"
/>
</div>
</div>
@ -163,19 +218,88 @@
</div>
</template>
<script>
import { mapActions, mapGetters } from "vuex";
import SectionTitle from "../Global/Section/SectionTitle.vue";
import FileRepository from "../../abstraction/repository/FileRepository";
import ImageCropper from "../Global/Input/ImageCropper.vue";
import { makeid } from "@/utils/math";
const RANDOM_TOKEN = makeid(50);
//
export default {
components: {
SectionTitle,
ImageCropper,
},
data: () => ({
items: [
{
id: 1,
name: "fkskad",
},
],
form: {
batch_id: RANDOM_TOKEN,
price: "",
},
fileForm: {
batch_id: RANDOM_TOKEN,
collection: "thumbnail",
},
noResultsText: "No results found.",
noChildrenText: "It does not have a subset",
placeholder: "product subcategory",
child: [],
}),
computed: {
...mapGetters("productCategories", ["getProductCategories"]),
...mapGetters("products", ["getProduct"]),
ProductId() {
return this.$route.params.id;
},
},
methods: {
...mapActions("productCategories", ["loadProductCategories"]),
...mapActions("products", ["addProduct", "updateProduct", "loadProduct"]),
symbol() {},
changeProductCategories() {
this.child = [];
console.log(this.getProductCategories);
let index = this.getProductCategories.find((x) => {
return x.id === this.form.product_categories_id;
// x.children.map((y) => console.log("y.name", y.name));
});
index.children.map((x) => this.child.push(x));
console.log(this.child);
},
async submit() {
try {
if (this.fileForm.media) {
let repository = new FileRepository();
await repository.store(this.fileForm);
}
if (this.ProductId) {
this.updateProduct(this.form);
} else {
this.addProduct(this.form);
}
} catch (e) {
return e;
}
},
async load() {
await this.loadProduct(this.ProductId);
this.form = this.getProduct;
console.log("this.form", this.form);
},
removeTags(item) {
// {
// course: data.filter(x => x.type === 'course'),
// workout: data.filter(x => x.type === 'workout')
// }
this.form.tags.splice(this.form.tags.indexOf(item), 1);
this.form.tags = [...this.form.tags];
},
},
async created() {
await this.loadProductCategories();
if (this.ProductId) {
this.load();
}
},
};
</script>
<style scoped>
@ -206,4 +330,35 @@ export default {
.upload {
height: 148px;
}
</style>
<style>
.vue-treeselect {
margin-top: 7px;
}
.vue-treeselect__menu-container {
color: var(--color-black) !important;
}
.vue-treeselect__control {
padding-left: 5 px;
padding-right: 5 px;
display: table;
table-layout: fixed;
width: 100%;
height: 36 px;
border-color: rgb(255, 255, 255);
border-style: solid;
border-width: 0 0 1px 0;
border-radius: 0;
background: transparent;
transition-duration: 200ms;
transition-property: border-color, box-shadow, width, height, background-color,
opacity;
transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
.vue-treeselect__single-value {
color: var(--color-white);
}
.vue-treeselect__placeholder {
text-transform: uppercase;
}
</style>

@ -5,7 +5,7 @@
<ul class="pl-0 ml-0">
<MenuItem :active="true" text="Home" link="dashboard" />
<MenuItem text="my profile" link="profile" />
<MenuItem text="my bookmarks" link="dashboard" />
<MenuItem text="my bookmarks" link="bookmarks" />
<MenuItem text="programs" link="programs" />
<MenuItem text="users" link="users" />
<MenuItem text="products" link="products" />

@ -25,7 +25,7 @@
<v-col
cols="4"
class="mb-2"
v-for="(program, i) in bookmarksPrograms"
v-for="(program, i) in getBookmarksPrograms"
:key="i"
>
<BookmarksPrograms :program="program" />
@ -36,7 +36,7 @@
<v-row class="mt-4">
<v-col
cols="6"
v-for="(workout, i) in bookmarksWorkouts"
v-for="(workout, i) in getBookmarksWorkouts"
:key="i"
class="mb-2"
><BookmarksWorkouts :workout="workout"
@ -57,6 +57,7 @@ import BookmarksPrograms from "./Programs/Programs";
import FirstImage from "../../assets/28-284379_photo-wallpaper-man-workout-gym-working-gym-workout.jpg";
import SecondImage from "../../assets/a-bodybuilder-exhibits-his-muscular-physique-1024-768-0.jpg";
import ThirdImage from "../../assets/5595849.jpg";
import { mapActions, mapGetters } from "vuex";
export default {
components: {
SectionTitle,
@ -137,6 +138,24 @@ export default {
},
],
}),
computed: {
...mapGetters("bookmarks", [
"getBookmarksPrograms",
"getBookmarksWorkouts",
]),
},
methods: {
...mapActions("bookmarks", [
"loadBookmarksPrograms",
"loadBookmarksWorkouts",
]),
},
async created() {
await this.loadBookmarksPrograms();
await this.loadBookmarksWorkouts();
console.log("this.getBookmarksPrograms", this.getBookmarksPrograms);
console.log("this.getBookmarksWorkouts", this.getBookmarksWorkouts);
},
};
</script>
<style >

@ -3,7 +3,7 @@
<div class="wa__program__images">
<div
class="wa__program__image"
:style="{ backgroundImage: `url(${program.src})` }"
:style="{ backgroundImage: `url(${program.bookmark_data.thumbnail})` }"
></div>
<div class="wa__program__image__button">
<div class="wa__program__image__button--icon">
@ -16,8 +16,10 @@
</div>
</div>
</div>
<div class="program__title">{{ program.title }}</div>
<div class="program__sub-title">{{ program.subTitle }}</div>
<div class="program__title">{{ program.bookmark_data.title }}</div>
<div class="program__sub-title">
{{ program.bookmark_data.description }}
</div>
<div>
<v-chip
label
@ -26,7 +28,7 @@
class="mr-1 text-uppercase"
x-small
>
{{ program.sets }} sets
{{ program.bookmark_data.series_count }} series
</v-chip>
<v-chip
label
@ -35,7 +37,7 @@
class="mr-1 text-uppercase"
x-small
>
{{ program.workout }} workout
{{ program.bookmark_data.workouts_count }} workout
</v-chip>
</div>
</div>
@ -47,6 +49,9 @@ export default {
type: Object,
},
},
created() {
console.log(this.program);
},
};
</script>
<style scoped>

@ -4,16 +4,18 @@
<v-col cols="4" class="pr-0">
<div
class="workout__img"
:style="{ backgroundImage: `url(${workout.src})` }"
:style="{
backgroundImage: `url(${workout.bookmark_data.thumbnail})`,
}"
></div
></v-col>
<v-col cols="8">
<div class="details__card">
<div>
<div class="workout__title wa__f__m__eb text-uppercase">
{{ workout.title }}
{{ workout.bookmark_data.title }}
</div>
<div class="workout__description">{{ workout.description }}</div>
<div class="workout__description">{{ workout.bookmark_data.description }}</div>
</div>
<div>
<div class="d-flex justify-space-between align-center">
@ -24,7 +26,7 @@
text-color="black"
class="mr-1 text-uppercase"
x-small
v-for="(item, i) in workout.items"
v-for="(item, i) in workout.tags"
:key="i"
>
{{ item.text }}

@ -23,6 +23,7 @@
/>
</template>
<v-date-picker
:dark="dark"
:color="color"
v-model="date"
:type="type"
@ -41,6 +42,10 @@ export default {
type: {
default: "date",
},
dark: {
type: Boolean,
default: false,
},
},
data: () => ({
menu: false,

@ -10,7 +10,7 @@
>
<template v-slot:activator="{ on, attrs }">
<v-text-field
class="pt-0"
class="pt-0 mt-0"
v-model="time"
:label="label"
:placeholder="placeholder || label"

@ -1,6 +1,6 @@
<template>
<div class="wa__back wa__link">
<router-link :to="{ name: link }">
<router-link :to="{ name: link, params: { id: params } }">
<i :class="icon"></i>
<p>{{ backText }}</p>
</router-link>
@ -8,7 +8,7 @@
</template>
<script>
export default {
props: ["icon", "backText", "link"],
props: ["icon", "backText", "link", "params"],
};
</script>
<style scoped>

@ -1,6 +1,12 @@
<template>
<div>
<Back v-if="link" :back-text="backText" :link="link" :icon="icon" />
<Back
v-if="link"
:back-text="backText"
:link="link"
:params="params"
:icon="icon"
/>
<div :class="{ section: !isModal, modal__section: isModal }">
<div
:class="[
@ -28,6 +34,7 @@ export default {
props: {
backText: {},
link: {},
params: {},
icon: {},
title: {},
subTitle: {},