diff --git a/.gitignore b/.gitignore
index c2658d7..04c01ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
node_modules/
+dist/
\ No newline at end of file
diff --git a/components.d.ts b/components.d.ts
index b9e7102..481fb46 100644
--- a/components.d.ts
+++ b/components.d.ts
@@ -7,20 +7,19 @@ export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
+ AddFaq: typeof import('./src/components/AddFaq.vue')['default']
AddVideo: typeof import('./src/components/AddVideo.vue')['default']
Avatar: typeof import('primevue/avatar')['default']
- Badge: typeof import('primevue/badge')['default']
Button: typeof import('primevue/button')['default']
Card: typeof import('primevue/card')['default']
CategoryForm: typeof import('./src/components/CategoryForm.vue')['default']
- Checkbox: typeof import('primevue/checkbox')['default']
Column: typeof import('primevue/column')['default']
- copy: typeof import('./src/components/ProductDetails copy.vue')['default']
CouponDetails: typeof import('./src/components/CouponDetails.vue')['default']
DataTable: typeof import('primevue/datatable')['default']
Dropdown: typeof import('primevue/dropdown')['default']
Editor: typeof import('primevue/editor')['default']
- Fieldset: typeof import('primevue/fieldset')['default']
+ EditVideo: typeof import('./src/components/EditVideo.vue')['default']
+ FaqDetails: typeof import('./src/components/FaqDetails.vue')['default']
FileUpload: typeof import('primevue/fileupload')['default']
FirstStep: typeof import('./src/components/ProductFormSteps/FirstStep.vue')['default']
FloatLabel: typeof import('primevue/floatlabel')['default']
@@ -36,26 +35,25 @@ declare module 'vue' {
InputText: typeof import('primevue/inputtext')['default']
Listbox: typeof import('primevue/listbox')['default']
Menu: typeof import('primevue/menu')['default']
+ Message: typeof import('primevue/message')['default']
OverlayPanel: typeof import('primevue/overlaypanel')['default']
Pagination: typeof import('./src/components/Pagination.vue')['default']
Paginator: typeof import('primevue/paginator')['default']
Panel: typeof import('primevue/panel')['default']
PanelMenu: typeof import('primevue/panelmenu')['default']
- Password: typeof import('primevue/password')['default']
ProductDetails: typeof import('./src/components/ProductDetails.vue')['default']
ProductForm: typeof import('./src/components/ProductForm.vue')['default']
- ProgressBar: typeof import('primevue/progressbar')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
SecondStep: typeof import('./src/components/ProductFormSteps/SecondStep.vue')['default']
Sidebar: typeof import('primevue/sidebar')['default']
+ Stepper: typeof import('primevue/stepper')['default']
+ StepperPanel: typeof import('primevue/stepperpanel')['default']
Tag: typeof import('primevue/tag')['default']
Textarea: typeof import('primevue/textarea')['default']
TheWelcome: typeof import('./src/components/TheWelcome.vue')['default']
ThirdStep: typeof import('./src/components/ProductFormSteps/ThirdStep.vue')['default']
- ToggleButton: typeof import('primevue/togglebutton')['default']
Toolbar: typeof import('primevue/toolbar')['default']
- TreeTable: typeof import('primevue/treetable')['default']
UserDetails: typeof import('./src/components/UserDetails.vue')['default']
WelcomeItem: typeof import('./src/components/WelcomeItem.vue')['default']
}
diff --git a/src/assets/alt.png b/src/assets/alt.png
new file mode 100644
index 0000000..4e47c08
Binary files /dev/null and b/src/assets/alt.png differ
diff --git a/src/components/AddFaq.vue b/src/components/AddFaq.vue
new file mode 100644
index 0000000..f7fd2e1
--- /dev/null
+++ b/src/components/AddFaq.vue
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/AddVideo.vue b/src/components/AddVideo.vue
index 3333db5..ac25821 100644
--- a/src/components/AddVideo.vue
+++ b/src/components/AddVideo.vue
@@ -5,15 +5,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
- {{ totalSize }}B / 1Mb
-
-
-
-
-
-
-
Pending
-
-
-
-
![]()
-
-
{{ file.name }}
-
{{ formatSize(file.size) }}
-
-
-
+
+
+
+
{{ $t('بارگذاری ویدیو') }}
+
-
+
+
+
+
درحال بارگذاری ویدیو
+
ویدیو آپلود شد
+
+
-
-
Completed
-
-
-
-
![]()
-
-
{{ file.name }}
-
{{ formatSize(file.size) }}
-
-
-
+
+
+
+
+
+
{{ $t('جهت آپلود ویدیو را اینجا رها کنید') }}
-
-
-
-
-
-
-
ویدیو را اینجا رها کنید
-
-
+
-
-
@@ -218,56 +85,61 @@ import { inject, reactive, ref } from "vue";
import { usePrimeVue } from "primevue/config";
import { useToast } from "primevue/usetoast";
import { useHeadlinesStore } from "@/stores/Headlines"
+import { useUploaderStore } from "@/stores/uploader";
+const loading = ref(false)
+const uploadStore = useUploaderStore();
+
+
const store = useHeadlinesStore()
const dialog = inject("dialogRef");
const type = ref();
-const produc = reactive(Object.assign({}, dialog.value.data));
-const sabt = () => {
- console.log(produc);
-};
+const produc = reactive(dialog.value.data);
+const saving = ref(false)
const videoStatus = ref(null);
const setType = () => {
if (type.value === "غیرفعال") {
- videoStatus.value = "DeActivate";
+ newEpisode.status = "DeActivate";
}
if (type.value === "تکمیل شده") {
- videoStatus.value = "Completed";
+ newEpisode.status = "Completed";
}
if (type.value === "درحال ضبط") {
- videoStatus.value = "Recording";
+ newEpisode.status = "Recording";
}
if (type.value === "به زودی...") {
- videoStatus.value = "Soon";
+ newEpisode.status = "Soon";
}
- console.log("type:", videoStatus.value, produc.produc);
- console.log(type.value);
-};
-const headline = ref('');
-const description = ref('');
-const videoUrl = ref('');
-const $primevue = usePrimeVue();
-const toast = useToast();
-const totalSize = ref(0);
-const totalSizePercent = ref(0);
-const files = ref([]);
-const course = ref(produc.produc)
+};
+const newEpisode = reactive({
+ headline: "",
+ description: "",
+ course: produc.produc,
+ videoUrl: "",
+ status: ""
+})
+
+const chooseImages = async(files) => {
+loading.value = true
+const uploader = await uploadStore.uploader(files.files[0]);
+newEpisode.videoUrl = uploader.data.key
+loading.value = false
+
+}
+
const save = async() =>{
- const send = await store.create({
- headline: headline.value,
- description: description.value,
- course: produc.produc,
- videoUrl: 'https://dlearn.storage.iran.liara.space/test/1cb985c8-26a0-4120-824c-f496349e45bfmatt_devir--one_minute_drive_preview.webm',
- status: videoStatus.value
- })
- console.log('send', send);
+ saving.value = true;
+ const send = await store.create(newEpisode)
+ saving.value = false;
+dialog.value.close()
}
const onRemoveTemplatingFile = (file, removeFileCallback, index) => {
removeFileCallback(index);
totalSize.value -= parseInt(formatSize(file.size));
totalSizePercent.value = totalSize.value / 10;
+
};
const onClearTemplatingUpload = (clear) => {
diff --git a/src/components/CategoryForm.vue b/src/components/CategoryForm.vue
index de1f414..59dc581 100644
--- a/src/components/CategoryForm.vue
+++ b/src/components/CategoryForm.vue
@@ -50,8 +50,8 @@
const save = async () => {
saving.value = true
const { status, data } = await store.create(name)
- console.log('status',status);
- save.value = false
+
+ saving.value = false
if (status === 201 || status === 200)
toast.add({
diff --git a/src/components/CouponDetails.vue b/src/components/CouponDetails.vue
index 712905a..22ab76f 100644
--- a/src/components/CouponDetails.vue
+++ b/src/components/CouponDetails.vue
@@ -37,8 +37,11 @@
{{ $t('تغییر وضعیت') }}
-
+
+
+
+
@@ -51,13 +54,57 @@ import { numberFormat } from '@/utils/numberFormat';
import {useDiscountStore} from '../stores/discounts'
const store = useDiscountStore()
import { ref } from 'vue';
+import { useRouter } from 'vue-router';
const checked = ref(false);
-const changeStatus = async() => {
+const { confirm, toast, t } = inject("service");
+const router = useRouter()
+const saving = ref(false)
+const changeToDeActive = async() =>{
+ const change = await store.changeStatus({
+ id: coupon.coupon.id,
+ status: 'DeActivate'
+ })
+ if (change === true) {
+ toast.add({
+ life: 2000,
+ severity: "success",
+ summary: t("successful"),
+ detail: t("وضعیت ویرایش شد"),
+ });
+ store.index()
+ dialog.value.close()
+ }else{
+ return toast.add({
+ life: 2000,
+ severity: "error",
+ summary: t("error"),
+ detail: t("خطا، محدد تلاش کنید"),
+ });
+ }
+
+}
+const changeToActive = async() => {
const change = await store.changeStatus({
id: coupon.coupon.id,
status: 'Active'
})
- console.log(change);
+ if (change === true) {
+ toast.add({
+ life: 2000,
+ severity: "success",
+ summary: t("successful"),
+ detail: t("وضعیت ویرایش شد"),
+ });
+ store.index()
+ dialog.value.close()
+ }else{
+ return toast.add({
+ life: 2000,
+ severity: "error",
+ summary: t("error"),
+ detail: t("خطا، محدد تلاش کنید"),
+ });
+ }
};
const tabs = ref([
@@ -68,7 +115,7 @@ const changeStatus = async() => {
const dialog = inject('dialogRef')
const coupon = reactive(Object.assign({}, dialog.value.data))
-console.log('der', coupon.coupon);
+
const confirmToSales = (value) => {
dialog.value.data.confirm(user, value)
}
diff --git a/src/components/EditVideo.vue b/src/components/EditVideo.vue
new file mode 100644
index 0000000..6be6daa
--- /dev/null
+++ b/src/components/EditVideo.vue
@@ -0,0 +1,203 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ $t('بارگذاری ویدیو') }}
+
+
+
+
+
+
درحال بارگذاری ویدیو
+
ویدیو آپلود شد
+
+
+
+
+
+
+
+
+
{{ $t('جهت تغییر ویدیو، ویدیو جدید را اینجا رها کنید') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/FaqDetails.vue b/src/components/FaqDetails.vue
new file mode 100644
index 0000000..0add387
--- /dev/null
+++ b/src/components/FaqDetails.vue
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/HeadlineDetail.vue b/src/components/HeadlineDetail.vue
index 77d68ed..a2b0ec7 100644
--- a/src/components/HeadlineDetail.vue
+++ b/src/components/HeadlineDetail.vue
@@ -3,7 +3,7 @@
-
-
+
-
{{ $t('عنوان') }}
@@ -63,20 +63,26 @@
diff --git a/src/components/UserDetails.vue b/src/components/UserDetails.vue
index 0675e90..f311b3d 100644
--- a/src/components/UserDetails.vue
+++ b/src/components/UserDetails.vue
@@ -24,7 +24,12 @@
{{ $t('status') }}
{{ user.statusText }}
-
+ -
+ {{ $t('تغییر وضعیت') }}
+
+
+
+
@@ -35,12 +40,64 @@ import { jDate } from '@/utils/jDate';
import { inject, reactive } from 'vue';
const dialog = inject('dialogRef')
-
+import { useUsersStore } from '@/stores/users';
+const store = useUsersStore()
const user = reactive(Object.assign({}, dialog.value.data.user))
-
+const { confirm, toast, t } = inject("service");
const confirmToSales = (value) => {
dialog.value.data.confirm(user, value)
}
+
+const changeToDeActive = async() =>{
+ const change = await store.changeStatus({
+ userId: user.id,
+ status: 'DeActivate'
+ })
+ if (change === true) {
+ toast.add({
+ life: 2000,
+ severity: "success",
+ summary: t("successful"),
+ detail: t("وضعیت ویرایش شد"),
+ });
+ store.index()
+ dialog.value.close()
+ }else{
+ return toast.add({
+ life: 2000,
+ severity: "error",
+ summary: t("error"),
+ detail: t("خطا، محدد تلاش کنید"),
+ });
+ }
+
+}
+const changeToActive = async() => {
+ const change = await store.changeStatus({
+ userId: user.id,
+ status: 'Active'
+ })
+ if (change === true) {
+ toast.add({
+ life: 2000,
+ severity: "success",
+ summary: t("successful"),
+ detail: t("وضعیت ویرایش شد"),
+ });
+ store.index()
+ dialog.value.close()
+ }else{
+ return toast.add({
+ life: 2000,
+ severity: "error",
+ summary: t("error"),
+ detail: t("خطا، محدد تلاش کنید"),
+ });
+ }
+
+};
+
+
\ No newline at end of file
diff --git a/src/layouts/Main.vue b/src/layouts/Main.vue
index 53e4860..098366a 100644
--- a/src/layouts/Main.vue
+++ b/src/layouts/Main.vue
@@ -128,7 +128,7 @@ const items = ref([
{
label: t('تاریخچه ی تخفیف ها'),
icon: 'pi pi-history',
- command: () => router.push('/Coupons')
+ command: () => router.push('/couponsHistory')
},
],
diff --git a/src/plugins/axios.js b/src/plugins/axios.js
index 19c3dcd..5ef31e0 100644
--- a/src/plugins/axios.js
+++ b/src/plugins/axios.js
@@ -1,7 +1,7 @@
import { useAdminsStore } from '@/stores/admins'
import axioss from 'axios'
-const baseURL = 'https://dlearn.iran.liara.run'
+const baseURL = 'https://dlearn.liara.run'
const axios = axioss.create({ baseURL })
diff --git a/src/router/index.js b/src/router/index.js
index 8b31aaa..505cdc0 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -14,9 +14,9 @@ const router = createRouter({
},
{
path: '/',
- name: 'Main',
- //redirect: '/products',
- component: Main,
+ // name: 'Main',
+ redirect: '/courses',
+ component: Main,
children: [
{
path: '/categories',
@@ -108,6 +108,11 @@ const router = createRouter({
name: 'AddVideos',
component: () => import('@/views/AddVideos.vue'),
},
+ {
+ path: '/couponsHistory',
+ name: 'couponsHistory',
+ component: () => import('@/views/couponsHistory.vue'),
+ },
// {
// path: '/videos/create',
// name: 'createVideo',
diff --git a/src/stores/Headlines.js b/src/stores/Headlines.js
index 5e2b5a0..c7b5750 100644
--- a/src/stores/Headlines.js
+++ b/src/stores/Headlines.js
@@ -30,10 +30,9 @@ export const useHeadlinesStore = defineStore('headlines', {
// },
- async edit(id) {
- const { status, data } = await axios.get(`/course/${id}`)
+ async edit(id, body) {
+ const { status, data } = await axios.put(`/courseHeadline/${id}`, body)
return data
-
},
async create(form){
const {status, data} = await axios.post('/courseHeadline', form)
diff --git a/src/stores/admins.js b/src/stores/admins.js
index 18801ef..50b4d1e 100644
--- a/src/stores/admins.js
+++ b/src/stores/admins.js
@@ -19,12 +19,9 @@ export const useAdminsStore = defineStore('admins', {
phone: number.value,
type: 1
})
- console.log('state',data);
+
if (status == 200) {
- // this.token = data.accessToken
- // this.permissions = data.permissions
- // console.log(data);
-
+
return { status, data, error }
}
@@ -33,13 +30,15 @@ export const useAdminsStore = defineStore('admins', {
phone: number.value,
code: code.value
})
-
- console.log(data);
+console.log('data server', data);
if (status == 200) {
- console.log('first', this.token);
- this.token = data.token
- // this.permissions = data.permissions
- console.log('two', this.token);
+ if (data.roles[0] === "Admin") {
+ this.token = data.token
+ }
+ else{
+ this.token = ''
+ }
+
return { status, data, error }
}
diff --git a/src/stores/categoreis.js b/src/stores/categoreis.js
index 2c7fe16..63b76c2 100644
--- a/src/stores/categoreis.js
+++ b/src/stores/categoreis.js
@@ -46,12 +46,11 @@ export const useCategoriesStore = defineStore('categories', {
}
},
actions: {
- async index(page, rows) {
+ async index() {
this.fetching = true
- const params = { page, rows }
- const { status, data } = await axios.get('/courseCategory', { params })
+ const {data} = await axios.get('/courseCategory')
this.fetching = false
- return data
+ return data
if (status === 200) {
const map = (items, parent = null) => {
return items.map((item) => {
@@ -81,7 +80,7 @@ export const useCategoriesStore = defineStore('categories', {
name: id.value
})
- //console.log('result', result);
+
return result;
},
diff --git a/src/stores/courseComments.js b/src/stores/courseComments.js
index cf39547..db59fe3 100644
--- a/src/stores/courseComments.js
+++ b/src/stores/courseComments.js
@@ -50,7 +50,7 @@ export const useCommentStore = defineStore('comments', {
this.fetching = true
const data = await axios.post(`/course/${id}/comment`, body)
this.fetching = false
- console.log(id, 'id');
+
return data
@@ -142,7 +142,7 @@ export const useCommentStore = defineStore('comments', {
name: id.value
})
- //console.log('result', result);
+
return result;
},
diff --git a/src/stores/discounts.js b/src/stores/discounts.js
index 90cdff8..32352a3 100644
--- a/src/stores/discounts.js
+++ b/src/stores/discounts.js
@@ -10,6 +10,32 @@ export const useDiscountStore = defineStore('discounts', {
total: 0
}),
actions: {
+ async add(form) {
+ this.fetching = true
+ const { status, data } = await axios.post('/admins/discount', form)
+ this.fetching = false
+ return data
+ },
+ async history() {
+ this.fetching = true
+ const { status, data } = await axios.get('/admins/discountHistory')
+ this.fetching = false
+ return data
+ },
+
+
+
+
+
+
+
+
+
+
+
+
+
+
async index() {
this.items = [];
this.fetching = true
@@ -18,12 +44,7 @@ export const useDiscountStore = defineStore('discounts', {
return this.items = data
},
- async add(form) {
- this.fetching = true
- const { status, data } = await axios.post('/admins/discount', form)
- this.fetching = false
- return data
- },
+
async getDiscount(id) {
this.items = [];
this.fetching = true
diff --git a/src/stores/faq.js b/src/stores/faq.js
index d45ec5b..83c3e7a 100644
--- a/src/stores/faq.js
+++ b/src/stores/faq.js
@@ -8,18 +8,28 @@ export const useFaqStore = defineStore('faq', {
total: 0
}),
actions: {
- async index(page, pageSize) {
+ async index() {
this.items = [];
this.fetching = true
-
- const params = { page, pageSize }
- const { status, data } = await axios.get('/admin/user/list', { params })
-
+ const { status, data } = await axios.get('/admins/faq/category')
this.fetching = false
- this.total = 30
this.items = data;
},
+ async remove(id) {
+ const data = await axios.delete(`/admins/faq/category/${id}`)
+ return data
+ },
+ async create(form) {
+ const data = await axios.post('/admins/faq/category', form)
+ return data
+ },
+
+
+
+
+
+
async confirm(item, value) {
item.confirming = true
const result = await axios.put(`/admin/users/seller/${item.id}`, { confirmToSales: value })
diff --git a/src/stores/products.js b/src/stores/products.js
index 4cff794..acb10bd 100644
--- a/src/stores/products.js
+++ b/src/stores/products.js
@@ -29,6 +29,11 @@ export const useProductsStore = defineStore('products', {
return data
+ },
+ async update(course) {
+ const { status, data } = await axios.put('/course', course)
+ return data
+
},
async delete(id) {
const { status, data } = await axios.delete(`/course/${id}`, id)
diff --git a/src/stores/statics.js b/src/stores/statics.js
index 83c875b..9fc9727 100644
--- a/src/stores/statics.js
+++ b/src/stores/statics.js
@@ -8,43 +8,6 @@ export const useStaticsStore = defineStore('statics', {
fetching: true,
total: 0
}),
- getters: {
- // treeSelect: (state) => (id = null) => {
- // if (id) {
- // const foreach = (items) => {
- // return items.filter((item) => {
- // if (item.key != id) {
- // if (item.children)
- // item.children = foreach(item.children)
- // return true
- // } else return false
- // })
- // }
- // return foreach(state.items)
- // }
- // return state.items
- // },
- find: (state) => (id) => {
- if (id) {
- const foreach = (items) => {
- const item = items.find(({ key }) => key == id)
- if (item) return item
-
- for (let i = 0; i < items.length; i++) {
- const item = items[i];
-
- if (item.children) {
- const temp = foreach(item.children)
- if (temp) return temp
- }
- }
- }
-
- return foreach(state.items)
- }
- return '';
- }
- },
actions: {
async index() {
this.fetching = true
@@ -70,7 +33,7 @@ export const useStaticsStore = defineStore('statics', {
name: id.value
})
-//console.log('result', result);
+
return result;
},
diff --git a/src/stores/tickets.js b/src/stores/tickets.js
index 0345898..38c9ea2 100644
--- a/src/stores/tickets.js
+++ b/src/stores/tickets.js
@@ -171,7 +171,7 @@ export const useTicketsStore = defineStore('tickets', {
name: id.value
})
- //console.log('result', result);
+
return result;
},
diff --git a/src/stores/uploader.js b/src/stores/uploader.js
index 60a3827..ea40b1c 100644
--- a/src/stores/uploader.js
+++ b/src/stores/uploader.js
@@ -14,9 +14,7 @@ export const useUploaderStore = defineStore('uploader', {
form.append('directoryName', 'directoryName')
form.append('file', file)
- // for (var pair of form.entries()) {
- // console.log('pairs :',pair[0]+ ', ' + pair[1]);
- // }
+
let config = {
headers: {
"Content-Type": "multipart/form-data",
@@ -28,49 +26,18 @@ export const useUploaderStore = defineStore('uploader', {
form,
config
);
- console.log('result', result);
+
return result;
} catch (error) {
- console.log('err', error);
+
return error;
}
-
-
- // const result = await axios.post('/uploader', form,
- // {
- // headers: { "Content-Type": "multipart/form-data" }
- // }
- // )
- // console.log(result);
- // return result
- // const result = await axios({
- // method: "post",
- // url: "/uploader",
- // data: form,
- // headers: { "Content-Type": "multipart/form-data" },
- // })
-
-
-
-
-
-
-
-
-
- // .then(function (response) {
-
- // console.log(response);
- // })
- // .catch(function (response) {
-
- // console.log(response);
- // });
- // console.log('result', result);
- // return result;
},
-
+async getUrl(fileName){
+ const data = await axios.get(`/uploader/file?fileName=${fileName}`)
+ return data
+},
async bulk(files) {
diff --git a/src/stores/users.js b/src/stores/users.js
index 4ca6306..f6d6044 100644
--- a/src/stores/users.js
+++ b/src/stores/users.js
@@ -20,6 +20,10 @@ export const useUsersStore = defineStore('users', {
this.items = data;
},
+ async changeStatus(form) {
+ const { status, data } = await axios.patch('/admin/user/status', form)
+ return data
+ },
async confirm(item, value) {
item.confirming = true
const result = await axios.put(`/admin/users/seller/${item.id}`, { confirmToSales: value })
diff --git a/src/utils/tree-toggler-rtl.js b/src/utils/tree-toggler-rtl.js
index e1b6987..8808f3a 100644
--- a/src/utils/tree-toggler-rtl.js
+++ b/src/utils/tree-toggler-rtl.js
@@ -5,6 +5,6 @@ export const treeTogglerRTL = (selector) => {
element.style['margin-left'] = null
});
} catch (error) {
- console.log(error);
+
}
}
\ No newline at end of file
diff --git a/src/views/About.vue b/src/views/About.vue
index dbb5d0d..16f4792 100644
--- a/src/views/About.vue
+++ b/src/views/About.vue
@@ -4,13 +4,13 @@
-
-
+
+
-
+
@@ -18,7 +18,7 @@
-
+
@@ -62,8 +62,31 @@
title: 0,
hours: 0,
});
+ const saving = ref(false);
const save = async (data) => {
+ saving.value = true;
const result = await store.edit(data);
+
+ if (result.data === true){
+
+toast.add({
+ life: 2000,
+ severity: "success",
+ summary: t("successful"),
+ detail: t("اطلاعات با موفقیت ویرایش شد"),
+});
+
+}
+else
+return toast.add({
+ life: 2000,
+ severity: "error",
+ summary: t("error"),
+ detail: data.msg,
+});
+
+saving.value = false;
+
};
const expandedKeys = ref({});
diff --git a/src/views/AddVideos.vue b/src/views/AddVideos.vue
index ff2170d..9f4dc35 100644
--- a/src/views/AddVideos.vue
+++ b/src/views/AddVideos.vue
@@ -9,7 +9,7 @@
@click="create()"
/>
-
+
@@ -73,9 +73,9 @@
{{ store.fetching ? $t("loading") : $t("emptyTable") }}
-
+
-
-
-
+
\ No newline at end of file
diff --git a/src/views/AnswerComment.vue b/src/views/AnswerComment.vue
index b6d3e42..a6f547b 100644
--- a/src/views/AnswerComment.vue
+++ b/src/views/AnswerComment.vue
@@ -1,13 +1,16 @@
+
-
-
{{item.createdBy.name}}
-
+
+
+ {{item.createdBy.name}}
+ کاربر بدون نام
+
@@ -80,17 +83,17 @@ const reply = (id) =>{
}
const sendReply = async() =>{
if (replyTarget.value === null || replyTarget.value === '') {
- return console.log('کامنت مورد نظر را انتخاب کنید');
+
}
if (value.value === null || value.value === '') {
- return console.log('متن پیام را وارد کنید');
+
}
- // console.log(value.value);
+
const rep = await commentStore.reply(route.params.id, {
text: value.value,
parent: replyTarget.value
})
- console.log('rep', rep);
+
}
const items = ref([
{
@@ -120,6 +123,6 @@ const save = () => {
watchEffect(async() => {
data.value = await store.edit(route.params.id)
-console.log('store', data.value.comments);
+
})
\ No newline at end of file
diff --git a/src/views/Categories.vue b/src/views/Categories.vue
index c89e899..2e08f49 100644
--- a/src/views/Categories.vue
+++ b/src/views/Categories.vue
@@ -1,117 +1,118 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ store.fetching ? $t('loading') : $t('emptyTable') }}
-
-
-
-
-
-
+
+
+
diff --git a/src/views/Comments.vue b/src/views/Comments.vue
index 55bd24b..a6fa3d7 100644
--- a/src/views/Comments.vue
+++ b/src/views/Comments.vue
@@ -38,44 +38,13 @@
-
+
{{ store.fetching ? $t("loading") : $t("emptyTable") }}
-
+
{
-console.log(data);
router.push(`/comments/${data._id}`)
}
const UserDetails = defineAsyncComponent(() => import('../components/UserDetails.vue'));
@@ -144,7 +112,7 @@ console.log(data);
const remove = (data) => {
- console.log('done', data._id)
+
confirm.require({
message: t('Are you sure you want to proceed?'),
header: t('Danger Zone'),
@@ -156,25 +124,10 @@ console.log(data);
defaultFocus: 'reject',
accept: async () => {
const deleted = await store.delete(data._id)
- console.log(deleted);
+
await store.index()
}
- // product.removing = true
-
- // const { status, data } = await store.remove(product._id);
-
- // product.removing = false
-
- // if (status === 200)
- // toast.add({
- // severity: 'success', summary: t('successful'), detail: t('destroySuccessfully'), life: 3000
- // });
- // else
- // toast.add({
- // severity: 'error', summary: t('error'), detail: data.msg, life: 3000
- // });
-
- // },
+
});
}
@@ -185,11 +138,7 @@ console.log(data);
watchEffect(async() => {
const { page = 1, pageSize = 10 } = route.query
await store.index(page, pageSize)
- console.log(store.items[2].image);
- console.log(String.fromCharCode(store.items[2].image)).join('');
- // store.items.forEach((product) => {
- // product.status = { value: t('active'), severity: 'success' };
- // })
+
})
diff --git a/src/views/Coupons.vue b/src/views/Coupons.vue
index d1fcd10..e847dfd 100644
--- a/src/views/Coupons.vue
+++ b/src/views/Coupons.vue
@@ -1,6 +1,6 @@
-
+
@@ -8,7 +8,7 @@
-
+
@@ -34,14 +34,11 @@
{{ store.fetching ? $t("loading") : $t("emptyTable") }}
-
+
-
+
-
+ -->
@@ -68,11 +65,10 @@ const show = (coupon) => {
}
const router = useRouter()
const edit = (data) =>{
- console.log(data.id);
+
router.push(`/coupon/${data.id}`)
}
watchEffect( async() =>{
await store.index()
-console.log('data', data);
})
\ No newline at end of file
diff --git a/src/views/Courses.vue b/src/views/Courses.vue
index 43ef7c4..398af3b 100644
--- a/src/views/Courses.vue
+++ b/src/views/Courses.vue
@@ -3,7 +3,7 @@
@@ -97,9 +97,9 @@
{{ store.fetching ? $t("loading") : $t("emptyTable") }}
-
-
-
+
{
}
});
}
+
const UserDetails = defineAsyncComponent(() => import('../components/UserDetails.vue'));
const store = useProductsStore()
@@ -172,7 +173,7 @@ const edit = (data) =>{
const remove = (data) => {
- console.log('done', data._id)
+
confirm.require({
message: t('Are you sure you want to proceed?'),
header: t('Danger Zone'),
@@ -184,7 +185,7 @@ const remove = (data) => {
defaultFocus: 'reject',
accept: async () => {
const deleted = await store.delete(data._id)
- console.log(deleted);
+
await store.index()
}
// product.removing = true
@@ -206,18 +207,13 @@ const remove = (data) => {
});
}
-
+const create = () => router.push('/create')
watchEffect(async() => {
const { page = 1, pageSize = 10 } = route.query
await store.index(page, pageSize)
-console.log(store.items[2].image);
-console.log(String.fromCharCode(store.items[2].image)).join('');
- // store.items.forEach((product) => {
- // product.status = { value: t('active'), severity: 'success' };
- // })
})
diff --git a/src/views/Create.vue b/src/views/Create.vue
index fe56fc4..2748913 100644
--- a/src/views/Create.vue
+++ b/src/views/Create.vue
@@ -1,124 +1,141 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
+
+
+
+
@@ -144,11 +161,19 @@
:label="$t('create')"
icon="pi pi-save"
severity="success"
- :loading="saving"
+ :loading="creating"
@click="create(newCourse)"
/>
+
+
درحال آپلود تصویر...
@@ -171,88 +196,142 @@ import { useStaticsStore } from "@/stores/statics";
import { useUploaderStore } from "@/stores/uploader";
import { useProductsStore } from "@/stores/products";
import { useCategoriesStore } from "@/stores/categoreis";
+import { useUsersStore } from "../stores/users";
const categoriesStore = useCategoriesStore();
const courseStore = useProductsStore();
const uploadStore = useUploaderStore();
-import { useRoute } from "vue-router";
+const userStore = useUsersStore();
+import { useRoute, useRouter } from "vue-router";
const route = useRoute();
-const level = ref(null)
+const level = ref(null);
+const selectedCategory = ref();
+const selectedteacher = ref();
+const language = ref("");
+const saving = ref(false);
+const creating = ref(false);
+const selectCategory = () => {
+ newCourse.categories = selectedCategory.value.id;
+};
+const selectTeacher = () => {
+ newCourse.teacher = selectedteacher.value.id;
+};
watchEffect(async () => {
const { page = 1, rows = 10 } = route.query;
const categoriess = await categoriesStore.index(page, rows);
- console.log("cat", categoriess);
cities.value = categoriess;
});
+watchEffect(async () => {
+ await userStore.index();
+ teachers.value = userStore.items.user;
+});
+
+const selectLevel = () => {
+ newCourse.level = level.value;
+};
+const selectLanguage = () => {
+ newCourse.language = language.value;
+};
const selectedCity = ref();
const cities = ref();
+const teachers = ref();
const levels = reactive(["آسان", "متوسط", "سخت"]);
const newCourse = reactive({
name: "",
description: "",
- slug: "",
+ slug: "تست",
duration: "",
image: "",
categories: "",
- price: 0,
+ price: null,
teacher: "",
- completionPercentage: 0,
+ completionPercentage: null,
level: "",
language: "",
- countOfVideos: 0,
+ countOfVideos: null,
totalFileSize: "",
});
-const chooseImage = async (val) => {
- console.log(val.target.files[0]);
- const uploader = await uploadStore.uploader(val.target.files[0]);
- console.log('uploader', uploader.data.url);
- newCourse.image = uploader.data.url;
- console.log("تصویر آپلود شد");
- console.log("upldr", uploader);
+const setSlug = () => {
+ newCourse.slug = newCourse.name;
};
-const create = async (data) => {
- if (newCourse.image === "") {
- return console.log("تصویر دوره وارد نشده است");
+const chooseImage = async (val) => {
+ saving.value = true;
+ const uploader = await uploadStore.uploader(val.target.files[0]);
+ newCourse.image = uploader.data.url;
+ saving.value = false;
+ if (uploader.status === 200 || uploader.status === 201) {
+ toast.add({
+ life: 2000,
+ severity: "success",
+ summary: t("successful"),
+ detail: t("تصویر آپلود شد"),
+ });
+ } else {
+ return toast.add({
+ life: 2000,
+ severity: "error",
+ summary: t("error"),
+ detail: t("خطا در بارگذاری تصویر، مجدد تلاش کنید"),
+ });
}
+
+};
+const router = useRouter();
+const create = async (newCourse) => {
+ creating.value = true;
if (
newCourse.name === "" ||
newCourse.description === "" ||
- // newCourse.slug === "" ||
newCourse.duration === "" ||
- // newCourse.categories === "" ||
- // newCourse.teacher === "" ||
- newCourse.completionPercentage === 0 ||
- // newCourse.level === "" ||
- // newCourse.language === "" ||
- newCourse.countOfVideos === "" ||
+ newCourse.categories === "" ||
+ newCourse.price === null ||
+ newCourse.teacher === "" ||
+ newCourse.completionPercentage === null ||
+ newCourse.level === "" ||
+ newCourse.language === "" ||
+ newCourse.countOfVideos === null ||
newCourse.totalFileSize === ""
) {
- return console.log("تمام مقادیر را وارد کنید");
+ creating.value = false;
+ return toast.add({
+ life: 2000,
+ severity: "error",
+ summary: t("error"),
+ detail: t("تمام فیلد ها را وارد کنید"),
+ });
+ }
+ if (newCourse.image === "" || newCourse.image === null) {
+ creating.value = false;
+ return toast.add({
+ life: 2000,
+ severity: "error",
+ summary: t("error"),
+ detail: t("تصویر دوره را وارد کنید"),
+ });
}
- newCourse.name = data.name;
- newCourse.description = data.description;
- newCourse.slug = data.name;
- newCourse.duration = data.duration;
- // newCourse.categories = data.categories;
- newCourse.categories = "66587ae698d0a0db14693a5e";
- // newCourse.teacher = data.teacher;
- newCourse.teacher = "66530b0480ef484e2bd19220";
- // newCourse.completionPercentage = data.completionPercentage;
- newCourse.completionPercentage = 20;
- // newCourse.level = data.level;
- newCourse.level = "متوسط";
- // newCourse.language = data.language;
- newCourse.language = "فارسی";
- newCourse.countOfVideos = data.countOfVideos;
- newCourse.totalFileSize = data.totalFileSize;
- // console.log("newCourse: ", newCourse);
const creat = await courseStore.create(newCourse);
- console.log("created", creat);
+
+
+ if (creat.message === "دوره با موفقیت ثبت شد") {
+ toast.add({
+ life: 2000,
+ severity: "success",
+ summary: t("successful"),
+ detail: t("دوره جدید با موفقیت ایجاد شد"),
+ });
+ router.push('/courses')
+ creating.value = false;
+ } else {
+ creating.value = false;
+ toast.add({
+ life: 2000,
+ severity: "error",
+ summary: t("error"),
+ detail: t("مشکل در ایجاد دوره، مجدد تلاش کنید"),
+ });
+ }
+
};
-// console.log("form", data);
-// console.log("json", JSON.stringify(data));
-// const { result } = await store.edit(data);
-// console.log("res", result);
-// };
+
const expandedKeys = ref({});
const CategoryForm = defineAsyncComponent(() =>
@@ -265,9 +344,7 @@ const store = useStaticsStore();
watchEffect(async () => {
await store.index();
- // console.log(store.items);
- //data.videosCount = store.items.hours;
});
@@ -300,7 +377,7 @@ const uploader = useUploaderStore();
const save = async () => {
saving.value = true;
- console.log(form);
+
//Upload File
if (typeof form.coverImage === "object") {
diff --git a/src/views/CreateCoupon.vue b/src/views/CreateCoupon.vue
index b7b5f16..e0e3933 100644
--- a/src/views/CreateCoupon.vue
+++ b/src/views/CreateCoupon.vue
@@ -8,11 +8,11 @@
{{ $t("تاریخ پایان") }}
+ type="datetime"
+ format="YYYY-MM-DD HH:mm"
+ display-format="jYYYY-jMM-jDD HH:mm"
+ :timezone="true"
+ color="dimgray"
+ v-model="coupon.endDate"
+ simple
+ custom-input=".custom-input2"
+ >
@@ -45,8 +45,8 @@
{{ $t("نوع تخفیف") }}
-
+
-
+
-
+
-
+
@@ -92,23 +92,29 @@