diff --git a/components.d.ts b/components.d.ts index f3f71a3..ff341c9 100644 --- a/components.d.ts +++ b/components.d.ts @@ -15,15 +15,19 @@ declare module 'vue' { 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'] FirstStep: typeof import('./src/components/ProductFormSteps/FirstStep.vue')['default'] FloatLabel: typeof import('primevue/floatlabel')['default'] + Galleria: typeof import('primevue/galleria')['default'] HelloWorld: typeof import('./src/components/HelloWorld.vue')['default'] IconCommunity: typeof import('./src/components/icons/IconCommunity.vue')['default'] IconDocumentation: typeof import('./src/components/icons/IconDocumentation.vue')['default'] IconEcosystem: typeof import('./src/components/icons/IconEcosystem.vue')['default'] IconSupport: typeof import('./src/components/icons/IconSupport.vue')['default'] IconTooling: typeof import('./src/components/icons/IconTooling.vue')['default'] + InputGroup: typeof import('primevue/inputgroup')['default'] InputText: typeof import('primevue/inputtext')['default'] + Listbox: typeof import('primevue/listbox')['default'] Menu: typeof import('primevue/menu')['default'] OverlayPanel: typeof import('primevue/overlaypanel')['default'] Pagination: typeof import('./src/components/Pagination.vue')['default'] @@ -36,9 +40,12 @@ declare module 'vue' { RouterView: typeof import('vue-router')['RouterView'] SecondStep: typeof import('./src/components/ProductFormSteps/SecondStep.vue')['default'] Sidebar: typeof import('primevue/sidebar')['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/components/CouponDetails.vue b/src/components/CouponDetails.vue index b18a2a1..712905a 100644 --- a/src/components/CouponDetails.vue +++ b/src/components/CouponDetails.vue @@ -37,7 +37,7 @@
  • {{ $t('تغییر وضعیت') }} - +
  • @@ -48,8 +48,18 @@ import { inject, reactive } from 'vue'; import { jDate } from '@/utils/jDate'; import { numberFormat } from '@/utils/numberFormat'; +import {useDiscountStore} from '../stores/discounts' +const store = useDiscountStore() import { ref } from 'vue'; const checked = ref(false); +const changeStatus = async() => { + const change = await store.changeStatus({ + id: coupon.coupon.id, + status: 'Active' + }) + console.log(change); + +}; const tabs = ref([ { title: 'Tab 1', content: 'Tab 1 Content', value: '0' }, { title: 'Tab 2', content: 'Tab 2 Content', value: '1' }, diff --git a/src/layouts/Main.vue b/src/layouts/Main.vue index bf7d562..b8b69ec 100644 --- a/src/layouts/Main.vue +++ b/src/layouts/Main.vue @@ -77,6 +77,11 @@ const items = ref([ icon: 'pi pi-exclamation-circle', command: () => router.push('/pages/about-us') }, + { + label: t('سوالات متداول'), + icon: 'pi pi-exclamation-circle', + command: () => router.push('/pages/Faq') + }, // { // label: t('contactUs'), // icon: 'pi pi-sitemap', @@ -107,57 +112,62 @@ const items = ref([ ] }, { - label: t('users'), - icon: 'pi pi-users', - command: () => router.push('/users') + label: t('coupons'), + icon: 'pi pi-barcode', + items: [ + { + label: t('همه ی تخفیف ها'), + icon: 'pi pi-angle-double-down', + command: () => router.push('/Coupons') + }, + { + label: t('ایجاد تخفیف جدید'), + icon: 'pi pi-plus-circle', + command: () => router.push('/createCoupon') + }, + { + label: t('تاریخچه ی تخفیف ها'), + icon: 'pi pi-history', + command: () => router.push('/Coupons') + }, + + ], }, { label: t('categories'), icon: 'pi pi-th-large', command: () => router.push('/categories') }, - { - label: t('coupons'), - icon: 'pi pi-barcode', - items: [ - { - label: t('ایجاد تخفیف'), - icon: 'pi pi-barcode', - command: () => router.push('/createCoupon') - }, - { - label: t('همه ی تخفیف ها'), - icon: 'pi pi-barcode', - command: () => router.push('/Coupons') - }, - { - label: t('تاریخچه ی تخفیف ها'), - icon: 'pi pi-barcode', - command: () => router.push('/Coupons') - }, - - ], - }, { label: t('admins'), icon: 'pi pi-sitemap', command: () => router.push('/admins') }, + { + label: t('users'), + icon: 'pi pi-users', + command: () => router.push('/users') + }, + { + label: t('تیکت ها'), + icon: 'pi pi-envelope', + command: () => router.push('/tickets') + }, { label: t('comments'), icon: 'pi pi-sitemap', command: () => router.push('/comments') }, - { - label: t('orders'), - icon: 'pi pi-sitemap', - command: () => router.push('/orders') - }, - { - label: t('products'), - icon: 'pi pi-sitemap', - command: () => router.push('/products') - }, + // { + // label: t('orders'), + // icon: 'pi pi-sitemap', + // command: () => router.push('/orders') + // }, + // { + // label: t('products'), + // icon: 'pi pi-sitemap', + // command: () => router.push('/products') + // }, // { // label: t('brands'), // icon: 'pi pi-apple', diff --git a/src/router/index.js b/src/router/index.js index 75b7077..60a83a2 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -83,6 +83,11 @@ const router = createRouter({ name: 'EditCoupon', component: () => import('@/views/EditCoupon.vue'), }, + { + path: '/tickets', + name: 'Tickets', + component: () => import('@/views/Tickets.vue'), + }, { path: '/pages', children: [ @@ -95,7 +100,12 @@ const router = createRouter({ path: 'about-us', name: 'about-us', component: () => import('@/views/About.vue') - } + }, + { + path: 'faq', + name: 'Faq', + component: () => import('@/views/Faq.vue') + }, ] diff --git a/src/stores/discounts.js b/src/stores/discounts.js index f21e428..90cdff8 100644 --- a/src/stores/discounts.js +++ b/src/stores/discounts.js @@ -18,6 +18,12 @@ 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 @@ -26,6 +32,16 @@ export const useDiscountStore = defineStore('discounts', { return this.items = data }, + async update(form) { + const { status, data } = await axios.put('/admins/discount', form) + this.fetching = false + return data + }, + async changeStatus(form) { + const { status, data } = await axios.patch('/admins/discount/status', form) + this.fetching = false + return data + } // async create(newCourse) { // const { status, data } = await axios.post('/course', newCourse) diff --git a/src/stores/faq.js b/src/stores/faq.js new file mode 100644 index 0000000..d45ec5b --- /dev/null +++ b/src/stores/faq.js @@ -0,0 +1,39 @@ +import axios from '../plugins/axios' +import { defineStore } from 'pinia' + +export const useFaqStore = defineStore('faq', { + state: () => ({ + items: [], + fetching: true, + total: 0 + }), + actions: { + async index(page, pageSize) { + this.items = []; + this.fetching = true + + const params = { page, pageSize } + const { status, data } = await axios.get('/admin/user/list', { params }) + + this.fetching = false + this.total = 30 + this.items = data; + + }, + async confirm(item, value) { + item.confirming = true + const result = await axios.put(`/admin/users/seller/${item.id}`, { confirmToSales: value }) + item.confirming = false + + if (result.status === 200) { + const index = this.items.findIndex(({ _id }) => _id == item.id) + if (index >= 0) + this.items.splice(index, 1) + else + this.items.unshift(item) + } + + return result; + }, + } +}) \ No newline at end of file diff --git a/src/views/About.vue b/src/views/About.vue index c5f7d56..76f2faf 100644 --- a/src/views/About.vue +++ b/src/views/About.vue @@ -1,56 +1,33 @@