Ver Fonte

user current user api

ali há 3 anos atrás
pai
commit
8a04bef3b5
47 ficheiros alterados com 501 adições e 4406 exclusões
  1. 2 68
      src/api/APIGateway.js
  2. 0 65
      src/api/models/Abrisham.js
  3. 0 31
      src/api/models/Channel.js
  4. 0 45
      src/api/models/ContentTimepoint.js
  5. 0 136
      src/api/models/Events.js
  6. 0 476
      src/api/models/Forrest.js
  7. 0 76
      src/api/models/LiveDescription.js
  8. 0 26
      src/api/models/Map.js
  9. 0 18
      src/api/models/Plan.js
  10. 0 224
      src/api/models/ReferralCode.js
  11. 107 0
      src/api/models/User.js
  12. 0 33
      src/api/models/Vast.js
  13. 0 30
      src/api/models/Version.js
  14. 0 43
      src/api/models/Wallet.js
  15. 0 52
      src/api/models/attribute.js
  16. 0 24
      src/api/models/block.js
  17. 0 232
      src/api/models/cart.js
  18. 0 39
      src/api/models/comment.js
  19. 0 546
      src/api/models/content.js
  20. 0 50
      src/api/models/coupon.js
  21. 0 24
      src/api/models/gateway.js
  22. 0 94
      src/api/models/order.js
  23. 0 49
      src/api/models/pages.js
  24. 0 14
      src/api/models/permission.js
  25. 0 323
      src/api/models/product.js
  26. 0 0
      src/api/models/profile.js
  27. 0 24
      src/api/models/section.js
  28. 0 111
      src/api/models/set.js
  29. 0 24
      src/api/models/slideShow.js
  30. 0 24
      src/api/models/sms.js
  31. 0 24
      src/api/models/source.js
  32. 0 49
      src/api/models/studyPlan.js
  33. 0 14
      src/api/models/tag.js
  34. 0 14
      src/api/models/teleMarketing.js
  35. 0 197
      src/api/models/ticket.js
  36. 0 138
      src/api/models/tree.js
  37. 0 499
      src/api/models/user.js
  38. 0 24
      src/api/models/voucher.js
  39. 1 1
      src/components/Template/Header/AdminPanelHeader.vue
  40. 4 10
      src/components/Template/Header/TemplateHeader.vue
  41. 0 179
      src/components/Template/Header/TripleTitleSetPanel.vue
  42. 0 157
      src/components/Template/Header/UserAbrishamPanel.vue
  43. 0 178
      src/components/Template/Header/UserGiftCardPanel.vue
  44. 335 0
      src/components/Template/Header/UserPanelHeader.vue
  45. 36 14
      src/models/User.js
  46. 15 7
      src/pages/User/Profile/profile.vue
  47. 1 0
      src/router/routes.js

+ 2 - 68
src/api/APIGateway.js

@@ -1,78 +1,12 @@
-import MapAPI from 'src/api/models/Map.js'
-import SmsAPI from 'src/api/models/sms.js'
-import TagAPI from 'src/api/models/tag.js'
-import SetAPI from 'src/api/models/set.js'
 import SeoAPI from 'src/api/models/Seo.js'
-import CartAPI from 'src/api/models/cart.js'
 import AuthAPI from 'src/api/models/Auth.js'
-import UserAPI from 'src/api/models/user.js'
-import TreeAPI from 'src/api/models/tree.js'
-import PlanAPI from 'src/api/models/Plan.js'
-import VastAPI from 'src/api/models/Vast.js'
-import BlockAPI from 'src/api/models/block.js'
-import OrderAPI from 'src/api/models/order.js'
-import PagesAPI from 'src/api/models/pages.js'
-import TicketAPI from 'src/api/models/ticket.js'
-import CouponAPI from 'src/api/models/coupon.js'
-import EventsAPI from 'src/api/models/Events.js'
-import SourceAPI from 'src/api/models/source.js'
-import ContentAPI from 'src/api/models/content.js'
-import ProductAPI from 'src/api/models/product.js'
-import ForrestAPI from 'src/api/models/Forrest.js'
-import CommentAPI from 'src/api/models/comment.js'
-import ChannelAPI from 'src/api/models/Channel.js'
-import VoucherAPI from 'src/api/models/voucher.js'
-import SectionAPI from 'src/api/models/section.js'
-import GatewayAPI from 'src/api/models/gateway.js'
-import VersionAPI from 'src/api/models/Version.js'
-import AbrishamAPI from 'src/api/models/Abrisham.js'
-import AttributeAPI from 'src/api/models/attribute.js'
-import StudyPlanAPI from 'src/api/models/studyPlan.js'
-import SlideShowAPI from 'src/api/models/slideShow.js'
-import PermissionAPI from 'src/api/models/permission.js'
+import UserAPI from 'src/api/models/User.js'
 import PageSettingAPI from 'src/api/models/PageSetting.js'
-import ReferralCodeAPI from 'src/api/models/ReferralCode.js'
-import TeleMarketingAPI from 'src/api/models/teleMarketing.js'
-import LiveDescriptionAPI from 'src/api/models/LiveDescription.js'
-import ContentTimepointAPI from 'src/api/models/ContentTimepoint.js'
 
 /* Exporting the APIGateway object. */
 export const APIGateway = {
-  tag: new TagAPI(),
-  set: new SetAPI(),
   seo: new SeoAPI(),
-  map: new MapAPI(),
-  sms: new SmsAPI(),
   auth: new AuthAPI(),
   user: new UserAPI(),
-  cart: new CartAPI(),
-  tree: new TreeAPI(),
-  plan: new PlanAPI(),
-  vast: new VastAPI(),
-  block: new BlockAPI(),
-  pages: new PagesAPI(),
-  order: new OrderAPI(),
-  events: new EventsAPI(),
-  source: new SourceAPI(),
-  coupon: new CouponAPI(),
-  ticket: new TicketAPI(),
-  forrest: new ForrestAPI(),
-  comment: new CommentAPI(),
-  voucher: new VoucherAPI(),
-  section: new SectionAPI(),
-  gateway: new GatewayAPI(),
-  content: new ContentAPI(),
-  channel: new ChannelAPI(),
-  product: new ProductAPI(),
-  version: new VersionAPI(),
-  abrisham: new AbrishamAPI(),
-  slideShow: new SlideShowAPI(),
-  attribute: new AttributeAPI(),
-  studyPlan: new StudyPlanAPI(),
-  permission: new PermissionAPI(),
-  pageSetting: new PageSettingAPI(),
-  referralCode: new ReferralCodeAPI(),
-  teleMarketing: new TeleMarketingAPI(),
-  liveDescription: new LiveDescriptionAPI(),
-  contentTimepoint: new ContentTimepointAPI()
+  pageSetting: new PageSettingAPI()
 }

+ 0 - 65
src/api/models/Abrisham.js

@@ -1,65 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-import { Content } from 'src/models/Content'
-import { AbrishamMajorList } from 'src/models/AbrishamMajor'
-
-export default class AbrishamAPI extends APIRepository {
-  constructor() {
-    super('abrisham', appApi)
-    this.APIAdresses = {
-      lesson: '/abrisham/lessons',
-      majors: '/abrisham/majors',
-      karvan: '/abrisham/whereIsKarvan'
-    }
-
-    this.restUrl = (id) => this.url + '/' + id
-  }
-
-  whereIsKarvan(data) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.karvan,
-      resolveCallback: (response) => {
-        return new Content(response.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  getLessons(isPro) {
-    const data = {}
-    if (isPro) {
-      data.isPro = 1
-    }
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.lesson,
-      data,
-      resolveCallback: (response) => {
-        return new AbrishamMajorList(response.data.data).list
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  requestToGetMajors() {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.majors,
-      resolveCallback: (response) => {
-        return new AbrishamMajorList(response.data.data).list
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 31
src/api/models/Channel.js

@@ -1,31 +0,0 @@
-import APIRepository from '../classes/APIRepository'
-import { appApi } from 'src/boot/axios'
-import { Channel } from 'src/models/Channel'
-
-export default class ChannelAPI extends APIRepository {
-  constructor() {
-    super('channel', appApi, '/ch', new Channel())
-    this.APIAdresses = {
-      base: (channelId) => '/ch/' + channelId
-    }
-    this.CacheList = {
-      base: (channelId) => this.name + this.APIAdresses.base(channelId)
-    }
-  }
-
-  getChannel(data = {}, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.base(data.id),
-      cacheKey: this.CacheList.base(data.id),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new Channel(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 45
src/api/models/ContentTimepoint.js

@@ -1,45 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-import { ContentTimePoint } from 'src/models/ContentTimePoint.js'
-
-const APIAdresses = {
-  favored: (id) => '/c/timepoint/' + id + '/favored',
-  unfavored: (id) => '/c/timepoint/' + id + '/unfavored'
-}
-export default class ContentTimepointAPI extends APIRepository {
-  constructor() {
-    super('ContentTimepoint', appApi, '/c/', new ContentTimePoint(), APIAdresses)
-    this.CacheList = {
-      favored: id => this.name + this.APIAdresses.favored(id),
-      unfavored: id => this.name + this.APIAdresses.unfavored(id)
-    }
-  }
-
-  favored(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.favored(data),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  unfavored(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.unfavored(data),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 136
src/api/models/Events.js

@@ -1,136 +0,0 @@
-import { Set } from 'src/models/Set.js'
-import { appApi } from 'src/boot/axios.js'
-import { ProductList } from 'src/models/Product.js'
-import APIRepository from '../classes/APIRepository.js'
-
-const APIAdresses = {
-  base: 'events',
-  formBuilder: '/admin/form-builder',
-  eventsProducts: (eventId) => `/events/${eventId}/products`,
-  eventAdvisor: (eventId) => `/events/${eventId}/advisor`
-}
-export default class EventsAPI extends APIRepository {
-  constructor() {
-    super('Chatr', appApi, 'chatr', {}, APIAdresses)
-    this.CacheList = {
-      base: this.name + this.APIAdresses.base,
-      formBuilder: this.name + this.APIAdresses.formBuilder,
-      eventsProducts: (eventId) => this.name + this.APIAdresses.eventsProducts(eventId),
-      eventAdvisor: (eventId) => this.name + this.APIAdresses.eventAdvisor(eventId)
-    }
-  }
-
-  getEventInfoByName(eventName) {
-    const events = [
-      {
-        id: 10,
-        name: 'chatre-nejat',
-        logo: 'https://nodes.alaatv.com/upload/landing/chatr/chatr%20logo.png'
-      },
-      {
-        id: 11,
-        name: 'emtahan-nahaee',
-        logo: 'https://nodes.alaatv.com/upload/landing/chatr/emtahan-nahaee-logo.png'
-      },
-      {
-        id: 12,
-        name: 'emtahan-nahaee-9',
-        logo: 'https://nodes.alaatv.com/upload/landing/41/emtehan-nahayi-nohom-logo.png'
-      }
-    ]
-    return new Promise((resolve, reject) => {
-      const event = events.find(eventItem => eventItem.name === eventName)
-      if (!event) {
-        reject()
-      }
-
-      resolve(event)
-    })
-  }
-
-  getEventsProducts(data, cache) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.eventsProducts(data.eventId),
-      cacheKey: this.CacheList.eventsProducts(data.eventId),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new ProductList(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data: data.data
-    })
-    // const products = new Promise((resolve, reject) => {
-    //   const productList = fake.fakeData(product, 5)
-    //   resolve(productList)
-    // })
-    // return products
-  }
-
-  formBuilder(data = {}, cache = { TTL: 1000 }) {
-    const routeWithParams = function (defaultRoute, payload) {
-      if (!Array.isArray(payload.types)) {
-        const types = []
-        payload.types.forEach(type => {
-          types.push(type)
-        })
-        return defaultRoute.concat('?types[]=', types)
-      }
-      return defaultRoute.concat('?types[]=', payload.types)
-    }
-    const requestRoute = routeWithParams(this.APIAdresses.formBuilder, {
-      types: data.params // array or number
-    })
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: requestRoute,
-      cacheKey: this.CacheList.formBuilder,
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return response.data.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getEventsAdvisor(data, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.eventAdvisor(data.eventId),
-      cacheKey: this.CacheList.eventAdvisor(data.eventId),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new Set(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-    // const products = new Promise((resolve, reject) => {
-    //   const productList = fake.fakeData(product, 5)
-    //   resolve(productList)
-    // })
-    // return products
-  }
-}
-
-// const product = {
-//   title: null,
-//   description: null,
-//   teacher: null,
-//   photo: null,
-//   url: null,
-//   lastSeen: {
-//     title: null,
-//     section: null,
-//     url: null
-//   }
-// }
-// const fake = new Fake()

+ 0 - 476
src/api/models/Forrest.js

@@ -1,476 +0,0 @@
-import APIRepository from '../classes/APIRepository'
-import { appApi } from 'src/boot/axios'
-import { TreeNode, TreeNodeList } from 'src/models/TreeNode.js'
-
-const APIAdresses = {
-  base: '/forrest/tree',
-  bulkIndex: '/forrest/tree/bulk',
-  tags: '/forrest/tags',
-  grid: (grid) => '/forrest/tree/' + grid,
-  getMultiType: (types) => {
-    let treeAddress = '/forrest/tree?'
-    types.forEach(element => {
-      treeAddress = treeAddress + `multi-type[]=${element}&`
-    })
-    return treeAddress
-  },
-  getGradesList: '/forrest/tree?type=test',
-  getNodeById(nodeId) {
-    return '/forrest/tree/' + nodeId
-  },
-  getNodeByType(nodeType) {
-    return '/forrest/tree?type=' + nodeType
-  },
-  getNodeByTitle(nodeType) {
-    return '/forrest/tree?title=' + nodeType
-  },
-  editNode(id) {
-    return '/forrest/tree/' + id
-  },
-  getLessonList(lessonId) {
-    return '/forrest/tree/' + lessonId
-  }
-}
-
-export default class ForrestAPI extends APIRepository {
-  constructor() {
-    super('tree', appApi, '', '', APIAdresses)
-    this.CacheList = {
-      base: this.name + this.APIAdresses.base,
-      bulkIndex: this.name + this.APIAdresses.bulkIndex,
-      tags: this.name + this.APIAdresses.tags,
-      grid: (grid) => this.name + this.APIAdresses.grid(grid),
-      getMultiType: (grid) => this.name + this.APIAdresses.getMultiType(grid),
-      getGradesList: this.name + this.APIAdresses.getGradesList,
-      getNodeById: nodeId => this.name + this.APIAdresses.getNodeById(nodeId),
-      getNodeByType: nodeType => this.name + this.APIAdresses.getNodeByType(nodeType),
-      getNodeByTitle: nodeTitle => this.name + this.APIAdresses.getNodeByTitle(nodeTitle),
-      editNode: id => this.name + this.APIAdresses.editNode(id),
-      getLessonList: id => this.name + this.APIAdresses.getLessonList(id)
-    }
-  }
-
-  index(data) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.base,
-      data: this.getNormalizedSendData({
-        page: 1 // Number
-      }, data),
-      resolveCallback: (response) => {
-        return {
-          treeNodeList: new TreeNodeList(response.data.data),
-          paginate: response.data.meta
-          // {
-          //   current_page: 1,
-          //   from: 1,
-          //   last_page: 1,
-          //   path: '...',
-          //   per_page: 15,
-          //   to: 10,
-          //   total: 10
-          // }
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  base(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.base,
-      cacheKey: this.CacheList.base,
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return new TreeNode(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  createNode(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.base,
-      cacheKey: this.CacheList.base,
-      data: data.data,
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return new TreeNode(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getNodeBy(value, data) {
-    const methodName = 'getNodeBy' + value
-    let param = data.data.nodeType
-    if (value === 'Id') {
-      param = data.data.id
-    }
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses[methodName](param),
-      cacheKey: this.CacheList[methodName](param),
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return new TreeNode(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getNodeById(data) {
-    return this.getNodeBy('Id', data)
-  }
-
-  getNodeByType(data) {
-    return this.getNodeBy('Type', data)
-  }
-
-  getNodeByTitle(data) {
-    return this.getNodeBy('Title', data)
-  }
-
-  editNode(nodeId, data) {
-    return this.sendRequest({
-      apiMethod: 'put',
-      api: this.api,
-      request: this.APIAdresses.editNode(nodeId),
-      cacheKey: this.CacheList.editNode(nodeId),
-      ...(data?.cache && { cache: data.cache }),
-      data: data.data,
-      resolveCallback: (response) => {
-        return new TreeNode(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getGradesList(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getGradesList,
-      cacheKey: this.CacheList.getGradesList,
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response.data.data.children
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getLessonList(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getLessonList(data.data.id),
-      cacheKey: this.CacheList.getLessonList(data.data.id),
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response.data.data.children
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getTags(data = {}, cache) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getMultiType(data),
-      cacheKey: this.CacheList.getMultiType(data),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return response.data.data
-        // return fillFakeData()
-      },
-      rejectCallback: (error) => {
-        return error
-        // return fillFakeData()
-      }
-    })
-  }
-}
-
-// function fillFakeData() {
-//   const treeNodes = [
-//     {
-//       children: [
-//         {
-//           id: '6281fbeb2f1bafe99f050336',
-//           title: 'پایه دوازدهم',
-//           parent: {
-//             id: '6281fb9e2f1bafe99f050334',
-//             title: 'درخت دانش'
-//           },
-//           ancestors: [
-//             {
-//               id: '6281fb9e2f1bafe99f050334',
-//               title: 'درخت دانش'
-//             }
-//           ],
-//           order: 1,
-//           type: null,
-//           number_of_children: 20,
-//           updated_at: '2022-06-06 12:54:01',
-//           created_at: '2022-05-16 11:53:23'
-//         },
-//         {
-//           id: '628204312f1bafe99f050346',
-//           title: 'پایه یازدهم',
-//           parent: {
-//             id: '6281fb9e2f1bafe99f050334',
-//             title: 'درخت دانش'
-//           },
-//           ancestors: [
-//             {
-//               id: '6281fb9e2f1bafe99f050334',
-//               title: 'درخت دانش'
-//             }
-//           ],
-//           order: '1',
-//           type: null,
-//           number_of_children: 22,
-//           updated_at: '2022-06-06 12:55:19',
-//           created_at: '2022-05-16 12:28:41'
-//         },
-//         {
-//           id: '62947d2624d62d858d09a4d2',
-//           title: 'پایه دهم',
-//           parent: {
-//             id: '6281fb9e2f1bafe99f050334',
-//             title: 'درخت دانش'
-//           },
-//           ancestors: [
-//             {
-//               id: '6281fb9e2f1bafe99f050334',
-//               title: 'درخت دانش'
-//             }
-//           ],
-//           order: 1,
-//           type: null,
-//           number_of_children: 19,
-//           updated_at: '2022-06-06 12:58:16',
-//           created_at: '2022-05-30 12:45:34'
-//         },
-//         {
-//           id: '628204c52f1bafe99f05034a',
-//           title: 'پایه نهم',
-//           parent: {
-//             id: '6281fb9e2f1bafe99f050334',
-//             title: 'درخت دانش'
-//           },
-//           ancestors: [
-//             {
-//               id: '6281fb9e2f1bafe99f050334',
-//               title: 'درخت دانش'
-//             }
-//           ],
-//           order: '3',
-//           type: null,
-//           number_of_children: 8,
-//           updated_at: '2022-06-06 12:56:52',
-//           created_at: '2022-05-16 12:31:09'
-//         },
-//         {
-//           id: '6284c10647a54520840442a2',
-//           title: 'پایه هشتم',
-//           parent: {
-//             id: '6281fb9e2f1bafe99f050334',
-//             title: 'درخت دانش'
-//           },
-//           ancestors: [
-//             {
-//               id: '6281fb9e2f1bafe99f050334',
-//               title: 'درخت دانش'
-//             }
-//           ],
-//           order: '4',
-//           type: null,
-//           number_of_children: 7,
-//           updated_at: '2022-06-06 12:56:59',
-//           created_at: '2022-05-18 14:18:54'
-//         },
-//         {
-//           id: '629dba608c4d7e26720cece3',
-//           title: 'پایه هفتم',
-//           parent: {
-//             id: '6281fb9e2f1bafe99f050334',
-//             title: 'درخت دانش'
-//           },
-//           ancestors: [
-//             {
-//               id: '6281fb9e2f1bafe99f050334',
-//               title: 'درخت دانش'
-//             }
-//           ],
-//           order: '4',
-//           type: null,
-//           number_of_children: 7,
-//           updated_at: '2022-06-06 12:57:12',
-//           created_at: '2022-06-06 12:57:12'
-//         },
-//         {
-//           id: '629dba888c4d7e26720cece5',
-//           title: 'پایه ششم',
-//           parent: {
-//             id: '6281fb9e2f1bafe99f050334',
-//             title: 'درخت دانش'
-//           },
-//           ancestors: [
-//             {
-//               id: '6281fb9e2f1bafe99f050334',
-//               title: 'درخت دانش'
-//             }
-//           ],
-//           order: '7',
-//           type: null,
-//           number_of_children: 6,
-//           updated_at: '2022-06-06 12:57:52',
-//           created_at: '2022-06-06 12:57:52'
-//         },
-//         {
-//           id: '629dc3b58c4d7e26720ced28',
-//           title: 'پایه پنجم',
-//           parent: {
-//             id: '6281fb9e2f1bafe99f050334',
-//             title: 'درخت دانش'
-//           },
-//           ancestors: [
-//             {
-//               id: '6281fb9e2f1bafe99f050334',
-//               title: 'درخت دانش'
-//             }
-//           ],
-//           order: '8',
-//           type: null,
-//           number_of_children: 5,
-//           updated_at: '2022-06-06 13:37:01',
-//           created_at: '2022-06-06 13:37:01'
-//         },
-//         {
-//           id: '62f8eb444dcdcce15d084e62',
-//           title: 'پایه چهارم',
-//           parent: {
-//             id: '6281fb9e2f1bafe99f050334',
-//             title: 'درخت دانش'
-//           },
-//           ancestors: [
-//             {
-//               id: '6281fb9e2f1bafe99f050334',
-//               title: 'درخت دانش'
-//             }
-//           ],
-//           order: '9',
-//           type: null,
-//           number_of_children: 0,
-//           updated_at: '2022-08-23 17:26:06',
-//           created_at: '2022-08-14 17:02:04'
-//         }
-//       ]
-//     },
-//     {
-//       children: [
-//         {
-//           id: '63ff427566344faf860f0f9f',
-//           title: 'دبیر 1',
-//           parent: {
-//             id: '63f37272c590054efc012d12',
-//             title: 'دبیر'
-//           },
-//           ancestors: [
-//             {
-//               id: '63f37272c590054efc012d12',
-//               title: 'دبیر'
-//             }
-//           ],
-//           order: '0',
-//           type: null,
-//           number_of_children: 0,
-//           updated_at: '2023-03-01 15:49:18',
-//           created_at: '2023-03-01 15:47:57'
-//         },
-//         {
-//           id: '63ff427c66344faf860f0fa0',
-//           title: 'دبیر 2',
-//           parent: {
-//             id: '63f37272c590054efc012d12',
-//             title: 'دبیر'
-//           },
-//           ancestors: [
-//             {
-//               id: '63f37272c590054efc012d12',
-//               title: 'دبیر'
-//             }
-//           ],
-//           order: '2',
-//           type: null,
-//           number_of_children: 1,
-//           updated_at: '2023-03-01 15:49:18',
-//           created_at: '2023-03-01 15:48:04'
-//         },
-//         {
-//           id: '63ff429866344faf860f0fa2',
-//           title: 'دبیر 3',
-//           parent: {
-//             id: '63f37272c590054efc012d12',
-//             title: 'دبیر'
-//           },
-//           ancestors: [
-//             {
-//               id: '63f37272c590054efc012d12',
-//               title: 'دبیر'
-//             }
-//           ],
-//           order: '3',
-//           type: null,
-//           number_of_children: 0,
-//           updated_at: '2023-03-01 15:49:18',
-//           created_at: '2023-03-01 15:48:32'
-//         },
-//         {
-//           id: '63ff42b466344faf860f0fa3',
-//           title: 'دبیر 4',
-//           parent: {
-//             id: '63f37272c590054efc012d12',
-//             title: 'دبیر'
-//           },
-//           ancestors: [
-//             {
-//               id: '63f37272c590054efc012d12',
-//               title: 'دبیر'
-//             }
-//           ],
-//           order: '4',
-//           type: null,
-//           number_of_children: 0,
-//           updated_at: '2023-03-01 15:49:18',
-//           created_at: '2023-03-01 15:49:00'
-//         }
-//       ]
-//     }
-//   ]
-
-//   return treeNodes
-// }

+ 0 - 76
src/api/models/LiveDescription.js

@@ -1,76 +0,0 @@
-import APIRepository from '../classes/APIRepository.js'
-import { appApi } from 'src/boot/axios'
-import { LiveDescription, LiveDescriptionList } from 'src/models/LiveDescription.js'
-
-export default class LiveDescriptionAPI extends APIRepository {
-  constructor() {
-    super('liveDescription', appApi, '/liveDescription', new LiveDescription())
-    this.APIAdresses = {
-      create: '/admin/user',
-      edit: '/admin/user',
-      index: '/admin/user',
-      show: '/admin/user',
-      liveDescription: '/livedescription',
-      pinedNews: '/livedescription/getPined',
-      observedLiveDescription: (id) => '/livedescription/' + id + '/seen'
-    }
-    this.CacheList = {
-      liveDescription: this.name + this.APIAdresses.liveDescription,
-      pinedNews: this.name + this.APIAdresses.pinedNews,
-      observedLiveDescription: (id) => this.name + this.APIAdresses.observedLiveDescription(id)
-    }
-  }
-
-  getNewsList(data, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.liveDescription,
-      ...(cache && { cache }),
-      data,
-      resolveCallback: (response) => {
-        return {
-          data: new LiveDescriptionList(response.data.data),
-          meta: response.data.meta
-        }
-      },
-      rejectCallback: (er) => {
-        return er
-      }
-    })
-  }
-
-  getPinedNews(cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.pinedNews,
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return {
-          data: new LiveDescriptionList(response.data.data),
-          meta: response.data.meta
-        }
-      },
-      rejectCallback: (er) => {
-        return er
-      }
-    })
-  }
-
-  getNewsHasBeenSeen(id, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.observedLiveDescription(id),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        // todo : response.data is unknown due to no available responses
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 26
src/api/models/Map.js

@@ -1,26 +0,0 @@
-import APIRepository from '../classes/APIRepository'
-import { appApi } from 'src/boot/axios'
-
-export default class MapAPI extends APIRepository {
-  constructor() {
-    super('map', appApi)
-    this.APIAdresses = {
-      items: '/mapDetail'
-    }
-  }
-
-  saveMapItem(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.items,
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-}

+ 0 - 18
src/api/models/Plan.js

@@ -1,18 +0,0 @@
-import APIRepository from '../classes/APIRepository'
-import { appApi } from 'src/boot/axios'
-
-export default class PlanAPI extends APIRepository {
-  constructor() {
-    super('plan', appApi, '/plan')
-    this.APIAdresses = {
-      plan: '/plan'
-    }
-    /* Setting the callback functions for the CRUD operations. */
-    // this.setCrudCallbacks({
-    //   get: (response) => { return new User(response.data.data)},
-    //   post: (response) => { return new User(response.data.data)},
-    //   put: (response) => { return new User(response.data.data)},
-    //   delete: (response) => { return new User(response.data.data)}
-    // })
-  }
-}

+ 0 - 224
src/api/models/ReferralCode.js

@@ -1,224 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-import { ReferralCodeList } from 'src/models/ReferralCode'
-
-export default class ReferralCodeAPI extends APIRepository {
-  constructor() {
-    super('gift-card', appApi)
-    this.APIAdresses = {
-      base: '/referral-code',
-      orderProducts: '/referral-code/orderproducts',
-      batchStore: '/referral-code/batch-store',
-      orderReferralCode: '/order-referral-code',
-      sales_man: '/sales-man',
-      contract: '/sales-man/contract',
-      walletWithdraw: '/wallet/withdraw',
-      walletWithdrawRequests: '/wallet/withdraw-requests',
-      assign: (referralCode) => '/referral-code/' + referralCode + '/assign'
-    }
-    this.CacheList = {
-      base: this.name + this.APIAdresses.base,
-      sales_man: this.name + this.APIAdresses.sales_man,
-      walletWithdrawRequests: this.name + this.APIAdresses.walletWithdrawRequests,
-      orderProducts: this.name + this.APIAdresses.orderProducts
-    }
-    this.restUrl = (id) => this.APIAdresses.base + '/' + id
-  }
-
-  // rest
-  // has get
-
-  index(data, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.base,
-      cacheKey: this.CacheList.base,
-      ...(cache !== undefined && { cache }),
-      data: this.getNormalizedSendData({
-        page: 1 // Number
-      }, data.data),
-      resolveCallback: (response) => {
-        return {
-          referralCodeList: new ReferralCodeList(response.data.data),
-          paginate: response.data.meta
-          // {
-          //   current_page: 1,
-          //   from: 1,
-          //   last_page: 1,
-          //   path: '...',
-          //   per_page: 15,
-          //   to: 10,
-          //   total: 10
-          // }
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getOrderProducts(data, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.orderProducts,
-      cacheKey: this.CacheList.orderProducts,
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return response.data.data // Transactions Table Row: Array of Objects
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      ...(data && { data })
-    })
-  }
-
-  batchStore(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.batchStore,
-      data: this.getNormalizedSendData({
-        discounttype_id: 2, // Number -- optional
-        number_of_codes: 0, // Number
-        commission: 0, // Number
-        mobile: '', // String
-        nationalCode: '', // String
-        firstName: '', // String
-        lastName: '' // String
-      }, data.data),
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  submitReferralCodeOnOrder(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.orderReferralCode,
-      data: this.getNormalizedSendData({
-        referral_code: null // String
-        // order_id: 0 // Number
-      }, data.data),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  DeleteReferralCodeFromOrder(data) {
-    return this.sendRequest({
-      apiMethod: 'delete',
-      api: this.api,
-      request: this.APIAdresses.orderReferralCode,
-      data: this.getNormalizedSendData({
-        order_id: null // Number
-      }, data.data),
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  setShared(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.assign(data.data.referralCode),
-      data: this.getNormalizedSendData({
-        assign: true // Boolean -- optional
-      }, data.data),
-      resolveCallback: (response) => {
-        return response.data.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getSalesManData(cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.sales_man,
-      cacheKey: this.CacheList.sales_man,
-      ...(cache !== undefined && { cache }),
-      resolveCallback: (response) => {
-        return {
-          wallet_type: response.data.wallet_type ? String(response.data.wallet_type) : null, // type: String,  Example: main_account
-          wallet_balance: response.data.wallet_balance ? Number(response.data.wallet_balance) : 0, // type: Number,  Example: 10000
-          total_commission: response.data.total_commission ? Number(response.data.total_commission) : 0, // type: Number,  Example: 10000
-          has_signed_contract: response.data.has_signed_contract ? response.data.has_signed_contract : null, // type: Boolean(true/false)
-          minAmount_until_settlement: response.data.minAmount_until_settlement ? Number(response.data.minAmount_until_settlement) : 0, // type: Number,  Example: 10000
-          count_of_total_gift_cards: response.data.count_of_total_gift_cards ? Number(response.data.count_of_total_gift_cards) : 0, // type: Number,  Example: 11
-          count_of_used_gift_cards: response.data.count_of_used_gift_cards ? Number(response.data.count_of_used_gift_cards) : 0, // type: Number,  Example: 3
-          count_of_remain_gift_cards: response.data.count_of_remain_gift_cards ? Number(response.data.count_of_remain_gift_cards) : 0, // type: Number,  Example: 8
-          income_being_settle: response.data.income_being_settle ? Number(response.data.income_being_settle) : 0 // type: Number,  Example: 90000
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getWithdrawWallet() {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.walletWithdraw,
-      cacheKey: this.CacheList.walletWithdraw,
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getWithdrawHistory(cache) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.walletWithdrawRequests,
-      cacheKey: this.CacheList.walletWithdrawRequests,
-      ...(cache !== undefined && { cache }),
-      resolveCallback: (response) => {
-        return response.data.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  submitContract() {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.contract,
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 107 - 0
src/api/models/User.js

@@ -0,0 +1,107 @@
+import { User } from 'src/models/User.js'
+import { appApi } from 'src/boot/axios.js'
+import APIRepository from '../classes/APIRepository.js'
+
+export default class UserAPI extends APIRepository {
+  constructor() {
+    super('user', appApi, '/user', User)
+    this.APIAdresses = {
+      base: '/uma/users',
+      verify: '/uma/users/verify',
+      current: '/uma/users/current',
+      byId: (id) => '/uma/users/' + id,
+      changeRole: (id) => '/uma/users/' + id + '/change_role'
+    }
+    this.CacheList = {
+      base: this.name + this.APIAdresses.base,
+      current: this.name + this.APIAdresses.current,
+      verify: this.name + this.APIAdresses.verify,
+      byId: (id) => this.name + this.APIAdresses.byId(id),
+      changeRole: (id) => this.name + this.APIAdresses.changeRole(id)
+    }
+  }
+
+  updateCurrent(data = {}) {
+    return this.sendRequest({
+      apiMethod: 'put',
+      api: this.api,
+      request: this.APIAdresses.current,
+      data: this.getNormalizedSendData({
+        firstname: '', // String
+        lastname: '', // String
+        gender: 'MALE', // String
+        marital_status: 'UNKNOWN', // String
+        birthdate: null, // String
+        national_code: '', // String
+        has_seminary_education: false, // Boolean
+        last_academic_degree: 'UNDER_DIPLOMA', // String
+        last_academic_degree_field: null, // String
+        last_academy_name: null, // String
+        educational_status: null, // String
+        phone_number: null, // String
+        on_social_network_mobile_number: null, // String
+        on_call_mobile_number: null, // String
+        email: '', // String
+        is_abroad_birth_address: 'False', // String
+        is_abroad_living_address: 'False', // String
+        birth_country: 'ایران', // String
+        living_country: 'ایران', // String
+        birth_province: null, // String
+        living_province: null, // String
+        birth_city: null, // String
+        living_city: null, // String
+        living_address: null, // String
+        living_postal_code: null, // String
+        living_address_additional_info: null // String
+      }, data),
+      resolveCallback: (response) => {
+        return new User(response.data)
+      },
+      rejectCallback: (error) => {
+        return error
+      }
+    })
+  }
+
+  updateByAdmin(data = {}) {
+    return this.sendRequest({
+      apiMethod: 'put',
+      api: this.api,
+      request: this.APIAdresses.byId(data.id),
+      data: this.getNormalizedSendData({
+        firstname: '', // String
+        lastname: '', // String
+        gender: 'MALE', // String
+        marital_status: 'UNKNOWN', // String
+        birthdate: null, // String
+        national_code: '', // String
+        has_seminary_education: false, // Boolean
+        last_academic_degree: 'UNDER_DIPLOMA', // String
+        last_academic_degree_field: null, // String
+        last_academy_name: null, // String
+        educational_status: null, // String
+        phone_number: null, // String
+        on_social_network_mobile_number: null, // String
+        on_call_mobile_number: null, // String
+        email: '', // String
+        is_abroad_birth_address: 'False', // String
+        is_abroad_living_address: 'False', // String
+        birth_country: 'ایران', // String
+        living_country: 'ایران', // String
+        birth_province: null, // String
+        living_province: null, // String
+        birth_city: null, // String
+        living_city: null, // String
+        living_address: null, // String
+        living_postal_code: null, // String
+        living_address_additional_info: null // String
+      }, data),
+      resolveCallback: (response) => {
+        return new User(response.data)
+      },
+      rejectCallback: (error) => {
+        return error
+      }
+    })
+  }
+}

+ 0 - 33
src/api/models/Vast.js

@@ -1,33 +0,0 @@
-import axios from 'axios'
-// import { xml2json } from 'xml-js'
-import APIRepository from '../classes/APIRepository'
-
-export default class VastAPI extends APIRepository {
-  constructor() {
-    super('vast', axios)
-    this.APIAdresses = {
-      base: 'https://nodes.alaatv.com/upload/vast/xml/vast_20220316102600100059.xml'
-    }
-    this.CacheList = {
-      base: this.name + this.APIAdresses.base
-    }
-  }
-
-  getXml (cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: axios,
-      request: this.APIAdresses.base,
-      cacheKey: this.CacheList.base,
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return response.data // vastXml
-        // return Assist.parseXmlToJson(response.data)
-        // return xml2json(response.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 30
src/api/models/Version.js

@@ -1,30 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class CartAPI extends APIRepository {
-  constructor() {
-    super('lastVersion', appApi)
-    this.APIAdresses = {
-      lastVersion: '/lastVersion'
-    }
-    this.CacheList = {
-      lastVersion: this.name + this.APIAdresses.lastVersion
-    }
-  }
-
-  getLastVersion(cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.lastVersion,
-      cacheKey: this.CacheList.lastVersion,
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 43
src/api/models/Wallet.js

@@ -1,43 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class GiftCardAPI extends APIRepository {
-  constructor() {
-    super('gift-card', appApi)
-    this.APIAdresses = {
-      withdraw: '/wallet/withdraw', // POST
-      withdrawRequests: '/wallet/withdraw-requests' // GET
-    }
-    this.restUrl = (id) => this.url + '/' + id
-  }
-
-  withdrawTotalWallet (data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.withdraw,
-      data: data.date,
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getWithdrawRequests (data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.withdrawRequests,
-      data: data.date,
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 52
src/api/models/attribute.js

@@ -1,52 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class AttributeAPI extends APIRepository {
-  constructor() {
-    super('attributes', appApi)
-    this.APIAdresses = {
-      attributeSetManagement: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      },
-      attributeManagement: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      },
-      attributeValue: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      }
-    }
-  }
-}

+ 0 - 24
src/api/models/block.js

@@ -1,24 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class BlockAPI extends APIRepository {
-  constructor() {
-    super('block', appApi)
-    this.APIAdresses = {
-      blockManagement: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      }
-    }
-  }
-}

+ 0 - 232
src/api/models/cart.js

@@ -1,232 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import { Cart } from 'src/models/Cart.js'
-import { Order } from 'src/models/Order.js'
-import { GatewayList } from 'src/models/Gateway.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class CartAPI extends APIRepository {
-  constructor() {
-    super('cart', appApi, '/orderproduct', new Cart())
-    this.seller = 1 // 1: Alaa - 2: Soala
-    this.APIAdresses = {
-      addToCart: '/orderproduct',
-      gateways: '/gateways',
-      discountSubmit: '/order/submitCoupon',
-      discountRemove: '/order/RemoveCoupon',
-      reviewCart: '/checkout/review',
-      getPaymentRedirectEncryptedLink: (device, paymentMethod) => '/getPaymentRedirectEncryptedLink?seller=' + this.seller + '&device=' + device + '&paymentMethod=' + paymentMethod,
-      // getPaymentRedirectEncryptedLink: '/getPaymentRedirectEncryptedLink?seller=' + this.seller + '&device=web',
-      removeFromCart: (id) => '/orderproduct/' + id,
-      removeFromCartByProductId: (id) => 'remove-order-product/' + id,
-      orderWithTransaction: (orderId) => '/orderWithTransaction/' + orderId
-    }
-    this.CacheList = {
-      addToCart: this.name + this.APIAdresses.addToCart,
-      gateways: this.name + this.APIAdresses.gateways,
-      discountSubmit: this.name + this.APIAdresses.discountSubmit,
-      discountRemove: this.name + this.APIAdresses.discountRemove,
-      getPaymentRedirectEncryptedLink: (device, paymentMethod) => this.name + this.APIAdresses.getPaymentRedirectEncryptedLink(device, paymentMethod),
-      reviewCart: this.name + this.APIAdresses.reviewCart,
-      removeFromCart: id => this.name + this.APIAdresses.removeFromCart(id),
-      removeFromCartByProductId: id => this.name + this.APIAdresses.removeFromCartByProductId(id),
-      orderWithTransaction: orderId => this.name + this.APIAdresses.orderWithTransaction(orderId)
-    }
-  }
-
-  addToCart(data = {}, cache) {
-    const payload = {
-      product_id: data.product_id, // Number or String
-      products: data.products, // Number or String (List ofProduct's ID)
-      attribute: data.attribute, // Number or String
-      seller: this.seller
-    }
-    if (!payload.products || (Array.isArray(payload.products) && payload.products.length === 0)) {
-      delete payload.products
-    }
-    if (!payload.attribute || (Array.isArray(payload.attribute) && payload.attribute.length === 0)) {
-      delete payload.attribute
-    }
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.addToCart,
-      cacheKey: this.CacheList.addToCart,
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data: payload
-    })
-  }
-
-  discountSubmit(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.discountSubmit,
-      cacheKey: this.CacheList.discountSubmit,
-      ...(data.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      params: data.params
-    })
-  }
-
-  discountRemove(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.discountRemove,
-      cacheKey: this.CacheList.discountRemove,
-      ...(!!data.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  reviewCart(cartItems = [], cache = { TTL: 1000 }) {
-    const queryParams = {}
-    queryParams.seller = this.seller
-
-    const setCartItemParam = function (cartItemIndex, paramsKey, value) {
-      queryParams['cartItems' + '[' + cartItemIndex + ']' + paramsKey] = value
-    }
-    const setProductsParams = function (cartItemIndex, products) {
-      if (!Array.isArray(products)) {
-        return
-      }
-      const cartItemProductsLength = products.length
-      for (let productItemIndex = 0; productItemIndex < cartItemProductsLength; productItemIndex++) {
-        const productItem = products[productItemIndex]
-        setCartItemParam(cartItemIndex, '[products]' + '[' + productItemIndex + ']', productItem)
-      }
-    }
-    const setAttributesParams = function (cartItemIndex, attributes) {
-      if (!Array.isArray(attributes)) {
-        return
-      }
-      const cartItemAttributesLength = attributes.length
-      for (let attributeItemIndex = 0; attributeItemIndex < cartItemAttributesLength; attributeItemIndex++) {
-        const attributeItem = attributes[attributeItemIndex]
-        setCartItemParam(cartItemIndex, '[products]' + '[' + attributeItemIndex + ']', attributeItem)
-      }
-    }
-
-    const cartItemLength = cartItems.length
-    let cartItemIndex = 0
-    for (let i = 0; i < cartItemLength; i++) {
-      const cartItem = cartItems[i]
-      if (!cartItem.product_id) {
-        continue
-      }
-      setCartItemParam(cartItemIndex, '[product_id]', cartItem.product_id)
-      setProductsParams(cartItemIndex, cartItem.products)
-      setAttributesParams(cartItemIndex, cartItem.attribute)
-      cartItemIndex++
-    }
-
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.reviewCart,
-      cacheKey: this.CacheList.reviewCart,
-      ...(cache !== undefined && { cache }),
-      resolveCallback: (response) => {
-        return new Cart(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data: queryParams
-    })
-  }
-
-  getGateways(cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.gateways,
-      cacheKey: this.CacheList.gateways,
-      ...(cache !== undefined && { cache }),
-      resolveCallback: (response) => {
-        return new GatewayList(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getPaymentRedirectEncryptedLink(data = { device: 'web', paymentMethod: null }, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getPaymentRedirectEncryptedLink(data.device, data.paymentMethod),
-      cacheKey: this.CacheList.getPaymentRedirectEncryptedLink(data.device, data.paymentMethod),
-      ...(cache !== undefined && { cache }),
-      resolveCallback: (response) => {
-        return response.data.data.url
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  removeFromCart(orderProductId) {
-    return this.sendRequest({
-      apiMethod: 'delete',
-      api: this.api,
-      request: this.APIAdresses.removeFromCart(orderProductId),
-      cacheKey: this.CacheList.removeFromCart(orderProductId),
-      resolveCallback: (response) => {
-        return new Cart(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  removeFromCartByProductId(productId) {
-    return this.sendRequest({
-      apiMethod: 'delete',
-      api: this.api,
-      request: this.APIAdresses.removeFromCartByProductId(productId),
-      cacheKey: this.CacheList.removeFromCartByProductId(productId),
-      resolveCallback: (response) => {
-        return new Cart(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getorderWithTransaction(orderId, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.orderWithTransaction(orderId),
-      cacheKey: this.CacheList.orderWithTransaction(orderId),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new Order(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 39
src/api/models/comment.js

@@ -1,39 +0,0 @@
-import { appApi } from 'src/boot/axios'
-import APIRepository from '../classes/APIRepository.js'
-import { Comment } from 'src/models/Comment.js'
-export default class CommentAPI extends APIRepository {
-  constructor() {
-    super('comment', appApi, '/comment', Comment)
-    this.APIAdresses = {
-      base: '/comment',
-      getComment: (commentId) => `/product/${commentId}/content-comments`
-    }
-    this.CacheList = {
-      getComment: (commentId) => this.name + this.APIAdresses.getComment(commentId)
-    }
-    this.restUrl = (id) => this.APIAdresses.base + '/' + id
-    /* Setting the callback functions for the CRUD operations. */
-    this.setCrudCallbacks({
-      get: (response) => { return new Comment(response.data.data) },
-      post: (response) => { return new Comment(response.data.data) },
-      put: (response) => { return new Comment(response.data.data) },
-      delete: (response) => { return response.data.data }
-    })
-  }
-
-  getComment(data, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getComment(data.commentId),
-      cacheKey: this.CacheList.getComment(data.commentId),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new Comment(response.data.data[0])
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 546
src/api/models/content.js

@@ -1,546 +0,0 @@
-import APIRepository from '../classes/APIRepository'
-import { appApi } from 'src/boot/axios'
-import { Content } from 'src/models/Content'
-import { ProductList } from 'src/models/Product'
-import { Comment } from 'src/models/Comment'
-import { APIGateway } from 'src/api/APIGateway'
-const APIAdresses = {
-  base: '/c',
-  search: '/search',
-  admin: '/admin/contents',
-  timestampSet: '/timepoint',
-  show: (id) => '/c/' + id,
-  delete: '/admin/contents/destroy',
-  bulkUpdate: '/admin/contents/bulk-update',
-  presigned: '/admin/upload/presigned-request',
-  bulkEditText: '/admin/contents/bulk-edit-text',
-  bulkEditTags: '/admin/contents/bulk-edit-tags',
-  favored: (id) => '/c/' + id + '/favored',
-  update: (id) => `/admin/contents/${id}/`,
-  getTimestamp: (id) => `/timepoint/${id}`,
-  showAdmin: (id) => '/admin/contents/' + id,
-  deleteTimestamp: (id) => `/timepoint/${id}`,
-  updateTimestamp: (id) => `/timepoint/${id}`,
-  unfavored: (id) => '/c/' + id + '/unfavored',
-  relatedProducts: (id) => '/c/' + id + '/products',
-  timestampBookmarkStatus: (id, status) => '/c/timepoint/' + id + '/' + status,
-  saveComment: '/comment',
-  updateComment: (id) => '/comment/' + id,
-  watchedVideo: '/watched',
-  unWatchedVideo: '/unwatched',
-  adminContent: {
-    create: {
-      base: '/admin/user'
-    },
-    edit: {
-      base: '/admin/user/'
-    },
-    index: {
-      base: '/admin/user'
-    },
-    show: {
-      base: '/admin/user/'
-    }
-  },
-  scheduleManagement: {
-    create: {
-      base: '/admin/user'
-    },
-    edit: {
-      base: '/admin/user/'
-    },
-    index: {
-      base: '/admin/user'
-    },
-    show: {
-      base: '/admin/user/'
-    }
-  }
-
-}
-export default class ContentAPI extends APIRepository {
-  constructor() {
-    super('content', appApi, '/c/', new Content(), APIAdresses)
-    this.CacheList = {
-      admin: this.name + this.APIAdresses.admin,
-      show: id => this.name + this.APIAdresses.show(id),
-      favored: id => this.name + this.APIAdresses.favored(id),
-      unfavored: id => this.name + this.APIAdresses.unfavored(id),
-      showAdmin: id => this.name + this.APIAdresses.showAdmin(id),
-      update: id => this.name + this.APIAdresses.update(id),
-      relatedProducts: id => this.name + this.APIAdresses.relatedProducts(id),
-      search: this.name + this.APIAdresses.search,
-      delete: this.name + this.APIAdresses.delete,
-      timestampSet: this.name + this.APIAdresses.timestampSet,
-      bulkEditText: this.name + this.APIAdresses.bulkEditText,
-      bulkUpdate: this.name + this.APIAdresses.bulkUpdate,
-      bulkEditTags: this.name + this.APIAdresses.bulkEditTags,
-      getTimestamp: id => this.name + this.APIAdresses.getTimestamp(id),
-      updateTimestamp: id => this.name + this.APIAdresses.updateTimestamp(id),
-      deleteTimestamp: id => this.name + this.APIAdresses.deleteTimestamp(id),
-      presigned: this.name + this.APIAdresses.presigned
-    }
-  }
-
-  show(data, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.show(data),
-      cacheKey: this.CacheList.show(data),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new Content(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  favored(data = {}, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.favored(data),
-      cacheKey: this.CacheList.favored(data),
-      ...(cache !== undefined && { cache }),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  unfavored(data = {}, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.unfavored(data),
-      cacheKey: this.CacheList.unfavored(data),
-      ...(cache !== undefined && { cache }),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  showAdmin(contentId, cache) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.showAdmin(contentId),
-      cacheKey: this.CacheList.showAdmin(contentId),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        const content = new Content(response.data.data)
-        // fillFakeData(content)
-        return content
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  update(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'put',
-      api: this.api,
-      request: this.APIAdresses.update(data.id),
-      cacheKey: this.CacheList.update(data.id),
-      resolveCallback: (response) => {
-        return new Content(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data: {
-        display: 1,
-        ...data
-      }
-      // data: this.getNormalizedSendData({
-      //   contentset_id: null, // contentSet Id
-      //   isFree: null, // contentSet Id
-      //   name: null, // Title for content,
-      //   description: null, // Description for content
-      //   thumbnail: null, // thumbnail for contentfd
-      //   validSinceDate: null, // time for publish content
-      //   forrest_tree: null, // tree for content
-      //   order: null, // order of content
-      //   enable: null, // content status
-      //   display: 1 // content display status
-      // }, data)
-    })
-  }
-
-  relatedProducts(contentId, cache) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.relatedProducts(contentId),
-      cacheKey: this.CacheList.relatedProducts(contentId),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new ProductList(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  bulkEditText(data) {
-    return this.sendRequest({
-      apiMethod: 'put',
-      api: this.api,
-      request: this.APIAdresses.bulkEditText,
-      cacheKey: this.CacheList.bulkEditText,
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  bulkUpdate(data) {
-    return this.sendRequest({
-      apiMethod: 'put',
-      api: this.api,
-      request: this.APIAdresses.bulkUpdate,
-      cacheKey: this.CacheList.bulkUpdate,
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  bulkEditTags(data) {
-    return this.sendRequest({
-      apiMethod: 'put',
-      api: this.api,
-      request: this.APIAdresses.bulkEditTags,
-      cacheKey: this.CacheList.bulkEditTags,
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  deleteContents(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.delete,
-      cacheKey: this.CacheList.delete,
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  search(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.search,
-      cacheKey: this.CacheList.search,
-      ...(data.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return {
-          sets: response.data.data.sets,
-          products: response.data.data.products,
-          videos: response.data.data.videos
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  SetTimestamp(data = {}, cache) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.timestampSet,
-      cacheKey: this.CacheList.timestampSet,
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return {
-          timestamp: response.data
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data: this.getNormalizedSendData({
-        content_id: null, // content Id
-        title: null, // Title for Timestamp
-        time: null // time of Video for timestamp in seconds
-      }, data.data)
-    })
-  }
-
-  UpdateTimestamp(data = {}, cache) {
-    return this.sendRequest({
-      apiMethod: 'put',
-      api: this.api,
-      request: this.APIAdresses.updateTimestamp(data.id),
-      cacheKey: this.CacheList.updateTimestamp(data.id),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return {
-          timestamp: response.data
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data: this.getNormalizedSendData({
-        content_id: null, // content Id
-        title: null, // Title for Timestamp
-        time: null // time of Video for timestamp in seconds
-      }, data)
-    })
-  }
-
-  GetTimestamp(data = {}, cache) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getTimestamp(data.id),
-      cacheKey: this.CacheList.getTimestamp(data.id),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return {
-          timestamp: response.data
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  DeleteTimestamp(data = {}, cache) {
-    return this.sendRequest({
-      apiMethod: 'delete',
-      api: this.api,
-      request: this.APIAdresses.deleteTimestamp(data.id),
-      cacheKey: this.CacheList.deleteTimestamp(data.id),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return {
-          timestamp: response.data
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getPresigned(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.presigned,
-      cacheKey: this.CacheList.presigned,
-      ...(data.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response.data.data
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data: this.getNormalizedSendData({
-        bucket: null, // file name(test)
-        key: null // file with type(type.mp4)
-      }, data.data)
-    })
-  }
-
-  setBookmarkTimepointFavoredStatus(data = {}) {
-    const mergedData = this.getNormalizedSendData({
-      id: '',
-      status: 'favored'
-    }, data)
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.timestampBookmarkStatus(mergedData.id, mergedData.status),
-      resolveCallback: (response) => {
-        const defaultMessageObject = {
-          message: '' // String
-        }
-        return this.getNormalizedSendData(defaultMessageObject, response.data).message
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getConsultingContentList(isPro) {
-    const setId = isPro ? 1597 : 1213
-    return APIGateway.set.getContents(setId)
-  }
-
-  saveComment(data = {}) {
-    const mergedData = this.getNormalizedSendData({
-      commentable_id: '',
-      commentable_type: 'content',
-      comment: ''
-    }, data)
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.saveComment,
-      resolveCallback: (response) => {
-        return new Comment(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data: mergedData
-    })
-  }
-
-  updateComment(data = {}) {
-    const mergedData = this.getNormalizedSendData({
-      id: '',
-      data: {}
-    }, data)
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.updateComment(mergedData.id),
-      resolveCallback: (response) => {
-        return new Comment(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data: mergedData.data
-    })
-  }
-
-  setVideoWatched(data = {}) {
-    const mergedData = this.getNormalizedSendData({
-      watchable_id: '',
-      watchable_type: 'content'
-    }, data)
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.watchedVideo,
-      resolveCallback: (response) => {
-        const defaultResponseObject = {
-          id: '',
-          watchable_id: '',
-          watchable_type: 'content',
-          watchable: new Content(),
-          seconds_watched: null
-        }
-        return this.getNormalizedSendData(defaultResponseObject, response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data: mergedData
-    })
-  }
-
-  setVideoUnWatched(data = {}) {
-    const mergedData = this.getNormalizedSendData({
-      watchable_id: '',
-      watchable_type: 'content'
-    }, data)
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.unWatchedVideo,
-      resolveCallback: (response) => {
-        const defaultResponseObject = {
-          message: '' // String
-        }
-        return this.getNormalizedSendData(defaultResponseObject, response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data: mergedData
-    })
-  }
-}
-
-// const fillFakeData = (content) => {
-//   content.forrest_tree_tags = forrestTreeTags
-//   content.hls = 'https://alaatv.com/hls/input.m3u8'
-// }
-
-// const forrestTreeTags = [
-//   {
-//     id: '63ff427566344faf860f0f9f',
-//     title: 'دبیر 1',
-//     parent: {
-//       id: '63f37272c590054efc012d12',
-//       title: 'دبیر'
-//     },
-//     ancestors: [
-//       {
-//         id: '63f37272c590054efc012d12',
-//         title: 'دبیر'
-//       }
-//     ],
-//     order: '0',
-//     type: null,
-//     number_of_children: 0,
-//     updated_at: '2023-03-01 15:49:18',
-//     created_at: '2023-03-01 15:47:57'
-//   },
-//   {
-//     id: '63ff427c66344faf860f0fa0',
-//     title: 'دبیر 2',
-//     parent: {
-//       id: '63f37272c590054efc012d12',
-//       title: 'دبیر'
-//     },
-//     ancestors: [
-//       {
-//         id: '63f37272c590054efc012d12',
-//         title: 'دبیر'
-//       }
-//     ],
-//     order: '2',
-//     type: null,
-//     number_of_children: 1,
-//     updated_at: '2023-03-01 15:49:18',
-//     created_at: '2023-03-01 15:48:04'
-//   }
-// ]

+ 0 - 50
src/api/models/coupon.js

@@ -1,50 +0,0 @@
-import APIRepository from '../classes/APIRepository'
-import { appApi } from 'src/boot/axios'
-
-export default class CouponAPI extends APIRepository {
-  constructor() {
-    super('coupon', appApi)
-    this.APIAddresses = {
-      base: '/orderCoupon',
-      // delete: '/orderCoupon',
-      create: '/v2/admin/coupon',
-      edit: '',
-      index: '/admin/coupon',
-      show: '/v2/admin/coupon/10'
-    }
-    this.CacheList = {
-      base: this.name + this.APIAddresses.base
-    }
-  }
-
-  base(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAddresses.base,
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  deleteCoupon(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'delete',
-      api: this.api,
-      request: this.APIAddresses.base,
-      cacheKey: this.CacheList.base,
-      ...(data.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 24
src/api/models/gateway.js

@@ -1,24 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class GatewayAPI extends APIRepository {
-  constructor() {
-    super('gateway', appApi)
-    this.APIAdresses = {
-      gateway: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      }
-    }
-  }
-}

+ 0 - 94
src/api/models/order.js

@@ -1,94 +0,0 @@
-import APIRepository from '../classes/APIRepository'
-import { appApi } from 'src/boot/axios'
-
-export default class OrderAPI extends APIRepository {
-  constructor() {
-    super('order', appApi)
-    this.APIAdresses = {
-      orderCoupon: '/orderCoupon',
-      create: '/reqres/api/users',
-      edit: '/admin/order',
-      index: '/admin/order',
-      show: '/admin/order',
-      status: '/admin/form-builder?types[]=paymentStatuses',
-      ordersById: (id) => '/user/' + id + '/orders',
-      transaction: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      },
-      userBon: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      }
-    }
-  }
-
-  getPaymentStatus() {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.status,
-      resolveCallback: (response) => {
-        return response.data.data.paymentStatuses
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  SubmitCouponOnOrder (data = {}) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.orderCoupon,
-      data: this.getNormalizedSendData({
-        code: '', // String
-        order_id: '' // Number
-      }, data.data),
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  DeleteCouponFromOrder (data = {}) {
-    return this.sendRequest({
-      apiMethod: 'delete',
-      api: this.api,
-      request: this.APIAdresses.orderCoupon,
-      data: this.getNormalizedSendData({
-        order_id: '' // Number
-      }, data.data),
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 49
src/api/models/pages.js

@@ -1,49 +0,0 @@
-import APIRepository from '../classes/APIRepository'
-import { appApi } from 'src/boot/axios'
-import { BlockList } from 'src/models/Block'
-
-export default class PagesAPI extends APIRepository {
-  constructor() {
-    super('pages', appApi)
-    this.APIAdresses = {
-      home: '/home',
-      shop: '/shop'
-    }
-    this.CacheList = {
-      home: this.name + this.APIAdresses.home,
-      shop: this.name + this.APIAdresses.shop
-    }
-  }
-
-  home(cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.home,
-      cacheKey: this.CacheList.home,
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new BlockList(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  shop(cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.shop,
-      cacheKey: this.CacheList.shop,
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new BlockList(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 14
src/api/models/permission.js

@@ -1,14 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class PermissionAPI extends APIRepository {
-  constructor() {
-    super('permission', appApi)
-    this.APIAdresses = {
-      create: '/admin/user',
-      edit: '/admin/user',
-      index: '/admin/user',
-      show: '/admin/user'
-    }
-  }
-}

+ 0 - 323
src/api/models/product.js

@@ -1,323 +0,0 @@
-import Price from 'src/models/Price.js'
-import { appApi } from 'src/boot/axios.js'
-import { SetList } from 'src/models/Set.js'
-import APIRepository from '../classes/APIRepository.js'
-import { Content, ContentList } from 'src/models/Content.js'
-import { Product, ProductList } from 'src/models/Product.js'
-import { ProductCategoryList } from 'src/models/ProductCategory'
-
-export default class ProductAPI extends APIRepository {
-  constructor() {
-    super('product', appApi)
-    this.APIAdresses = {
-      base: '/product',
-      bulk: (productIds) => {
-        const idParams = []
-        productIds.forEach((productId, productIndex) => {
-          idParams.push('ids' + '[' + productIndex + ']=' + productId)
-        })
-        const queryParams = idParams.join('&')
-        // display=2 for show all products
-        const queryParamsWithDisplay = queryParams + (queryParams.length > 0 ? '&' : '') + 'display=2'
-        return '/product?' + queryParamsWithDisplay
-      },
-      liveProducts: '/product/lives',
-      admin: {
-        create: '/reqres/api/users',
-        edit: '/admin/product',
-        index: '/admin/product',
-        show: '/admin/product'
-      },
-      getSets: id => `/product/${id}/sets`,
-      liveLink: id => `/product/${id}/liveInfo`,
-      getComments: id => `/product/${id}/content-comments`,
-      getContents: id => `/product/${id}/contents`,
-      favored: (id) => '/product/' + id + '/favored',
-      unfavored: (id) => '/product/' + id + '/unfavored',
-      show: (id) => '/product/' + id,
-      gifts: (id) => '/gift-products/' + id,
-      getPrice: (productId) => '/getPricgroupIndexe/' + productId,
-      sampleContent: (id) => '/product/' + id + '/sample',
-      categories: '/product-categories',
-      liveConductors: '/live-conductors',
-      userLastState: (id) => '/product/' + id + '/toWatch'
-    }
-    this.CacheList = {
-      base: this.name + this.APIAdresses.base,
-      bulk: (productIds) => this.name + this.APIAdresses.bulk(productIds),
-      liveProducts: this.name + this.APIAdresses.liveProducts,
-      liveLink: (id) => this.name + this.APIAdresses.liveLink(id),
-      create: this.name + this.APIAdresses.create,
-      favored: id => this.name + this.APIAdresses.favored(id),
-      getSets: id => this.name + this.APIAdresses.getSets(id),
-      getContents: id => this.name + this.APIAdresses.getContents(id),
-      unfavored: id => this.name + this.APIAdresses.unfavored(id),
-      show: (id) => this.name + this.APIAdresses.show(id),
-      gifts: (id) => this.name + this.APIAdresses.gifts(id),
-      sampleContent: (id) => this.name + this.APIAdresses.sampleContent(id),
-      categories: this.name + this.APIAdresses.categories,
-      edit: this.name + this.APIAdresses.edit
-    }
-    this.restUrl = (id) => this.APIAdresses.base + '/' + id
-    /* Setting the callback functions for the CRUD operations. */
-    this.setCrudCallbacks({
-      get: (response) => { return new Product(response.data.data) },
-      post: (response) => { return new Product(response.data.data) },
-      put: (response) => { return new Product(response.data.data) },
-      delete: (response) => { return new Product(response.data.data) }
-    })
-  }
-
-  show(productId, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.show(productId),
-      cacheKey: this.CacheList.show(productId),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new Product(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  liveConductors(cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.liveConductors,
-      cacheKey: this.CacheList.liveConductors,
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new ProductList(response.data.data.map(item => {
-          item.product.live_link = item.live_link
-          return item.product
-        }))
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  gifts(productId, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.gifts(productId),
-      cacheKey: this.CacheList.gifts(productId),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new ProductList(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  sampleContent(productId, cache) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.sampleContent(productId),
-      cacheKey: this.CacheList.sampleContent(productId),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new ContentList(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  favored(productId) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.favored(productId),
-      cacheKey: this.CacheList.favored(productId),
-      resolveCallback: (response) => {
-        const defaultMessageObject = {
-          message: '' // String
-        }
-        return this.getNormalizedSendData(defaultMessageObject, response.data).message
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  unfavored(productId) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.unfavored(productId),
-      cacheKey: this.CacheList.unfavored(productId),
-      resolveCallback: (response) => {
-        const defaultMessageObject = {
-          message: '' // String
-        }
-        return this.getNormalizedSendData(defaultMessageObject, response.data).message
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getPrice(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.getPrice(data.product_id),
-      data: this.getNormalizedSendData({
-        mainAttributeValues: [], // Array
-        extraAttributeValues: [], // Array
-        products: [] // Array
-      }, data),
-      resolveCallback: (response) => {
-        return new Price(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getProductList(data, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.bulk(data.productIds),
-      cacheKey: this.CacheList.bulk(data.productIds),
-      ...(cache !== undefined && { cache }),
-      resolveCallback: (response) => {
-        return new ProductList(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data: data.params
-    })
-  }
-
-  getLiveProducts(cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.liveProducts,
-      cacheKey: this.CacheList.liveProducts,
-      ...(cache !== undefined && { cache }),
-      resolveCallback: (response) => {
-        return new ProductList(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getLiveLink(productId, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.liveLink(productId),
-      cacheKey: this.CacheList.liveLink(productId),
-      ...(cache !== undefined && { cache }),
-      resolveCallback: (response) => {
-        return response.data.data.live_link // String
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getSets(productId, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getSets(productId),
-      cacheKey: this.CacheList.getSets(productId),
-      ...(cache !== undefined && { cache }),
-      resolveCallback: (response) => {
-        return new SetList(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getContents(data = {}, cache) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getContents(data.id),
-      cacheKey: this.CacheList.getContents(data.id),
-      ...(cache !== undefined && { cache }),
-      ...(cache !== data && { data: data.data }),
-      resolveCallback: (response) => {
-        return new ContentList(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      params: data.params
-    })
-  }
-
-  getCategories(cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.categories,
-      cacheKey: this.CacheList.categories,
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new ProductCategoryList(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getUserLastState(id, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.userLastState(id),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new Content(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}
-
-// function loadFakeSets(sets) {
-//   let categoryCounter = 1
-//   return sets.map((set, setIndex) => {
-//     if ((setIndex % 4) > 2) {
-//       categoryCounter++
-//     }
-//     const lessonName = 'درس شماره ' + categoryCounter
-//     const setCategoryName = 'سرفصل شماره ' + categoryCounter
-//     const setName = set.short_title
-//     return {
-//       id: set.id,
-//       sections: set.sections,
-//       short_title: lessonName + '-' + setCategoryName + '-' + setName
-//     }
-//   })
-// }

+ 0 - 0
src/api/models/profile.js


+ 0 - 24
src/api/models/section.js

@@ -1,24 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class SectionAPI extends APIRepository {
-  constructor() {
-    super('section', appApi)
-    this.APIAdresses = {
-      section: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      }
-    }
-  }
-}

+ 0 - 111
src/api/models/set.js

@@ -1,111 +0,0 @@
-import APIRepository from '../classes/APIRepository'
-import { appApi } from 'src/boot/axios'
-import { Set } from 'src/models/Set'
-import { ContentList } from 'src/models/Content'
-
-const urlAddress = {
-  base: '/set',
-  adminBase: '/admin/set',
-  adminShow: (id) => '/admin/set/' + id,
-  attachContents: (setId) => '/admin/set/' + setId + '/c/attach',
-  favored: (id) => '/set/' + id + '/favored',
-  unfavored: (id) => '/set/' + id + '/unfavored',
-  create: '/admin/set/',
-  show: (id) => '/set/' + id,
-  getContents: (id) => '/set/' + id + '/contents'
-}
-export default class SetAPI extends APIRepository {
-  constructor() {
-    super('set', appApi, '/set', new Set(), urlAddress)
-    this.CacheList = {
-      base: this.name + this.APIAdresses.base,
-      show: (id) => this.name + this.APIAdresses.show(id),
-      getContents: (id) => this.name + this.APIAdresses.getContents(id),
-      attachContents: (setId) => this.name + this.APIAdresses.attachContents(setId)
-    }
-    this.restUrl = (id) => this.APIAdresses.base + '/' + id
-    /* Setting the callback functions for the CRUD operations. */
-    this.setCrudCallbacks({
-      get: (response) => {
-        return new Set(response.data.data)
-      }
-    })
-  }
-
-  show(setId, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.show(setId),
-      cacheKey: this.CacheList.show(setId),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new Set(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getContents(setId, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getContents(setId),
-      cacheKey: this.CacheList.getContents(setId),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new ContentList(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  attachContents(setId, data = {}) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.attachContents(setId),
-      cacheKey: this.CacheList.attachContents(setId),
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  favored(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.favored(data),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  unfavored(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.unfavored(data),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 24
src/api/models/slideShow.js

@@ -1,24 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class SlideShowAPI extends APIRepository {
-  constructor() {
-    super('slideShow', appApi)
-    this.APIAdresses = {
-      slideShowManagement: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      }
-    }
-  }
-}

+ 0 - 24
src/api/models/sms.js

@@ -1,24 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class SmsAPI extends APIRepository {
-  constructor() {
-    super('sms', appApi)
-    this.APIAdresses = {
-      smsAdmin: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      }
-    }
-  }
-}

+ 0 - 24
src/api/models/source.js

@@ -1,24 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class SourceAPI extends APIRepository {
-  constructor() {
-    super('source', appApi)
-    this.APIAdresses = {
-      sourceManagement: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      }
-    }
-  }
-}

+ 0 - 49
src/api/models/studyPlan.js

@@ -1,49 +0,0 @@
-import APIRepository from '../classes/APIRepository'
-import { appApi } from 'src/boot/axios'
-import { StudyPlan, StudyPlanList } from 'src/models/StudyPlan'
-
-export default class StudyPlanAPI extends APIRepository {
-  constructor() {
-    super('studyPlan', appApi, '/plan', new StudyPlan())
-    this.APIAdresses = {
-      plan: '/plan',
-      studyEvent: (id) => '/studyEvent/' + id + '/studyPlans',
-      getPlans: (id) => '/studyPlan/' + id + '/plans'
-
-    }
-    this.CacheList = {
-      studyEvent: (id) => this.name + this.APIAdresses.studyEvent(id),
-      getPlans: (id) => this.name + this.APIAdresses.getPlans(id)
-    }
-  }
-
-  getStudyEvents(id, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.studyEvent(id),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new StudyPlanList(response.data.data)
-      },
-      rejectCallback: () => {
-        return new StudyPlanList()
-      }
-    })
-  }
-
-  getPlans(id, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getPlans(id),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return new StudyPlanList(response.data.data)
-      },
-      rejectCallback: () => {
-        return new StudyPlanList()
-      }
-    })
-  }
-}

+ 0 - 14
src/api/models/tag.js

@@ -1,14 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class TagAPI extends APIRepository {
-  constructor() {
-    super('tag', appApi)
-    this.APIAdresses = {
-      create: '/admin/user',
-      edit: '/admin/user',
-      index: '/admin/user',
-      show: '/admin/user'
-    }
-  }
-}

+ 0 - 14
src/api/models/teleMarketing.js

@@ -1,14 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class TeleMarketingAPI extends APIRepository {
-  constructor() {
-    super('teleMarketing', appApi)
-    this.APIAdresses = {
-      create: '/admin/user',
-      edit: '/admin/user',
-      index: '/admin/user',
-      show: '/admin/user'
-    }
-  }
-}

+ 0 - 197
src/api/models/ticket.js

@@ -1,197 +0,0 @@
-import APIRepository from '../classes/APIRepository'
-import { appApi } from 'src/boot/axios'
-import { User } from 'src/models/User'
-import { TicketDepartmentList } from 'src/models/TicketDepartment'
-
-export default class TicketAPI extends APIRepository {
-  constructor() {
-    super('ticket', appApi, '/ticket')
-    this.APIAdresses = {
-      base: '/ticket',
-      create: '/ticket/create',
-      updateTicketApi: (ticketId) => '/ticket/' + ticketId,
-      getInfo: '/user/getInfo',
-      ticketMessage: '/ticketMessage',
-      batchExtend: '/orderproduct/batchExtend',
-      statusNotice: (ticketId) => '/ticket/' + ticketId + '/sendTicketStatusNotice',
-      editAssign: (ticketId) => '/ticket/' + ticketId + '/assign',
-      reportMessage: (ticketId) => 'ticket/' + ticketId + '/report',
-      ticketRate: (ticketId) => 'ticket/' + ticketId + '/rate',
-      ticketDepartment: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      }
-    }
-    this.CacheList = {
-      create: '/ticket/create'
-    }
-    this.restUrl = (id) => this.url + '/' + id
-  }
-
-  batchExtend(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.batchExtend,
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  sendTicketRate(ticketId, data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.ticketRate(ticketId),
-      resolveCallback: (response) => {
-        return response.data.message
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  sendReport(ticketId, data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.reportMessage(ticketId),
-      resolveCallback: (response) => {
-        return response.data.message
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  creatTicket(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.base,
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  updateTicket(ticketId, data) {
-    return this.sendRequest({
-      apiMethod: 'put',
-      api: this.api,
-      request: this.APIAdresses.updateTicketApi(ticketId),
-      data,
-      resolveCallback: (response) => {
-        return {
-          code: response
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getUserData(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.getInfo,
-      resolveCallback: (response) => {
-        return new User(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  sendTicketMessage(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.ticketMessage,
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  sendTicketStatusNotice(ticketId, data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.statusNotice(ticketId),
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  editTicketAssignedSupporters(id, data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.editAssign(id),
-      resolveCallback: (response) => {
-        return new User(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data
-    })
-  }
-
-  getNeededDataToCreateTicket(cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.create,
-      resolveCallback: (response) => {
-        const ticketData = response.data
-        return {
-          departments: new TicketDepartmentList(ticketData.departments),
-          statuses: ticketData.statuses,
-          priorities: ticketData.priorities
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      ...(cache && { cache })
-    })
-  }
-}

+ 0 - 138
src/api/models/tree.js

@@ -1,138 +0,0 @@
-import APIRepository from '../classes/APIRepository'
-import { appApi } from 'src/boot/axios'
-import { TreeNode } from 'src/models/TreeNode.js'
-const APIAdresses = {
-  base: '/forrest/tree',
-  getMultiType: (types) => {
-    let treeAddress = '/forrest/tree?'
-    types.forEach(element => {
-      treeAddress = treeAddress + `multi-type[]=${element}&`
-    })
-    return treeAddress
-  },
-  getGradesList: '/forrest/tree?type=test',
-  getNodeById(nodeId) {
-    return '/forrest/tree/' + nodeId
-  },
-  getNodeByType(nodeType) {
-    return '/forrest/tree?type=' + nodeType
-  },
-  getNodeByTitle(nodeType) {
-    return '/forrest/tree?title=' + nodeType
-  },
-  editNode(id) {
-    return '/forrest/tree/' + id
-  },
-  getLessonList(lessonId) {
-    return '/forrest/tree/' + lessonId
-  }
-}
-
-export default class TreeAPI extends APIRepository {
-  constructor() {
-    super('tree', appApi, '', '', APIAdresses)
-    this.CacheList = {
-      base: this.name + this.APIAdresses.base,
-      getGradesList: this.name + this.APIAdresses.getGradesList,
-      getNodeById: nodeId => this.name + this.APIAdresses.getNodeById(nodeId),
-      getNodeByType: nodeType => this.name + this.APIAdresses.getNodeByType(nodeType),
-      getNodeByTitle: nodeTitle => this.name + this.APIAdresses.getNodeByTitle(nodeTitle),
-      editNode: id => this.name + this.APIAdresses.editNode(id),
-      getLessonList: id => this.name + this.APIAdresses.getLessonList(id)
-    }
-  }
-
-  base(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.base,
-      cacheKey: this.CacheList.base,
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return new TreeNode(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  createNode(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.base,
-      cacheKey: this.CacheList.base,
-      data: data.data,
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return new TreeNode(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getNodeById(data) {
-    return this.getNodeBy('Id', data)
-  }
-
-  getNodeByType(data) {
-    return this.getNodeBy('Type', data)
-  }
-
-  getNodeByTitle(data) {
-    return this.getNodeBy('Title', data)
-  }
-
-  editNode(nodeId, data) {
-    return this.sendRequest({
-      apiMethod: 'put',
-      api: this.api,
-      request: this.APIAdresses.editNode(nodeId),
-      cacheKey: this.CacheList.editNode(nodeId),
-      ...(data?.cache && { cache: data.cache }),
-      data: data.data,
-      resolveCallback: (response) => {
-        return new TreeNode(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getGradesList(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getGradesList,
-      cacheKey: this.CacheList.getGradesList,
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response.data.data.children
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getLessonList(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getLessonList(data.data.id),
-      cacheKey: this.CacheList.getLessonList(data.data.id),
-      ...(data?.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response.data.data.children
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 499
src/api/models/user.js

@@ -1,499 +0,0 @@
-import { User } from 'src/models/User.js'
-import { appApi } from 'src/boot/axios.js'
-import { ProductList } from 'src/models/Product.js'
-import { FavoredList } from 'src/models/Favored.js'
-import { CartItemList } from 'src/models/CartItem.js'
-import { EventResult } from 'src/models/EventResult.js'
-import APIRepository from '../classes/APIRepository.js'
-import { BankAccountsList } from 'src/models/BankAccounts.js'
-
-export default class UserAPI extends APIRepository {
-  constructor() {
-    super('user', appApi, '/user', User)
-    this.APIAdresses = {
-      create: '/admin/user',
-      base: '/user',
-      byId: (id) => '/user/' + id,
-      favored: '/user/favored',
-      purchasedProducts: '/user/products',
-      bankAccounts: '/bank-accounts',
-      mobileResend: '/mobile/resend',
-      mobileVerify: '/mobile/verify',
-      ordersById: (id) => '/user/' + id + '/orders',
-      getOrders: '/orders',
-      orderStatus: '/payment/status',
-      formData: '/megaroute/getUserFormData',
-      showUser: '/getUserFor3a',
-      eventResult: '/event-result',
-      createEventResult: '/event-result/create',
-      baseAdmin: '/admin/user',
-      nationalCard: '/national-card-photo',
-      resendGuest: '/mobile/resendGuest',
-      getUserRoleAndPermission: '/getUserRoleAndPermission',
-      verifyMoshavereh: '/mobile/verifyMoshavereh',
-      newsletter: '/newsletter',
-      admin: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      },
-      fixUnknownUsersCity: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      }
-    }
-    this.CacheList = {
-      base: this.name + this.APIAdresses.base,
-      purchasedProducts: this.name + this.APIAdresses.purchasedProducts,
-      favored: this.name + this.APIAdresses.favored,
-      mobileResend: this.name + this.APIAdresses.base,
-      mobileVerify: this.name + this.APIAdresses.base,
-      bankAccounts: this.name + this.APIAdresses.bankAccounts,
-      byId: (id) => this.name + this.APIAdresses.byId(id),
-      ordersById: (id) => this.name + this.APIAdresses.ordersById(id),
-      getOrders: this.name + this.APIAdresses.base,
-      orderStatus: this.name + this.APIAdresses.base,
-      formData: this.name + this.APIAdresses.base,
-      showUser: this.name + this.APIAdresses.base,
-      eventResult: this.name + this.APIAdresses.base,
-      createEventResult: this.name + this.APIAdresses.createEventResult,
-      baseAdmin: this.name + this.APIAdresses.baseAdmin,
-      nationalCard: this.name + this.APIAdresses.nationalCard,
-      getUserRoleAndPermission: this.name + this.APIAdresses.getUserRoleAndPermission
-    }
-    this.restUrl = (id) => this.APIAdresses.base + '/' + id
-    /* Setting the callback functions for the CRUD operations. */
-    this.setCrudCallbacks({
-      get: (response) => { return new User(response.data.data) },
-      post: (response) => { return new User(response.data.data) },
-      put: (response) => { return new User(response.data.data) },
-      delete: (response) => { return new User(response.data.data) }
-    })
-  }
-
-  nationalCard(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.nationalCard,
-      cacheKey: this.CacheList.nationalCard,
-      data,
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  storeBankAccounts(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.bankAccounts,
-      cacheKey: this.CacheList.bankAccounts,
-      data: this.getNormalizedSendData({
-        preShabaNumber: 'IR', // String
-        shabaNumber: '' // String
-      }, data),
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  updateProfile(data = {}) {
-    delete data.photo
-    return this.sendRequest({
-      apiMethod: 'put',
-      api: this.api,
-      request: this.APIAdresses.byId(data.id),
-      data,
-      resolveCallback: (response) => {
-        return new User(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getBankAccounts() {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.bankAccounts,
-      cacheKey: this.CacheList.bankAccounts,
-      resolveCallback: (response) => {
-        return new BankAccountsList(response.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  mobileResend(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.mobileResend,
-      cacheKey: this.CacheList.mobileResend,
-      ...(data.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return {
-          code: response
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  mobileVerify(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.mobileVerify,
-      cacheKey: this.CacheList.mobileVerify,
-      ...(data.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return {
-          status: response
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      },
-      data: this.getNormalizedSendData({
-        code: null // number - string
-      }, data)
-    })
-  }
-
-  ordersById(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.ordersById(data.data.userId),
-      cacheKey: this.CacheList.ordersById(data.data.userId),
-      ...(data.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return {
-          cartItemList: new CartItemList(response.data.data)
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getOrders(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getOrders,
-      cacheKey: this.CacheList.getOrders,
-      ...(data.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  orderStatus(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.orderStatus,
-      cacheKey: this.CacheList.orderStatus,
-      ...(data.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  formData(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.formData,
-      cacheKey: this.CacheList.formData,
-      ...(data.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return {
-          genders: response.data.data.genders,
-          grades: response.data.data.grades,
-          majors: response.data.data.majors,
-          provinces: response.data.data.provinces,
-          cities: response.data.data.cities
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  showUser(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.showUser,
-      cacheKey: this.CacheList.showUser,
-      ...(data.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return response.data.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  eventResult(data = {}) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.eventResult,
-      cacheKey: this.CacheList.eventResult,
-      ...(data.cache && { cache: data.cache }),
-      resolveCallback: (response) => {
-        return new EventResult(response.data.data)
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  createEventResult(data = {}, cache = 100) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.createEventResult,
-      cacheKey: this.CacheList.createEventResult,
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return {
-          events: response.data.data.events,
-          majors: response.data.data.majors,
-          eventResultStatuses: response.data.data.eventResultStatuses,
-          regions: response.data.data.regions
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  adminIndex(data = {}) {
-    const routeWithParams = function (defaultRoute, payload) {
-      if (typeof payload.rollId === 'object') {
-        const hasRoll = []
-        payload.rollId.forEach(rollId => {
-          hasRoll.push(rollId)
-        })
-        return defaultRoute.concat('?hasRole[]=', hasRoll)
-      }
-      return defaultRoute.concat('?hasRole[]=', payload.rollId)
-    }
-    const requestRoute = routeWithParams(this.APIAdresses.baseAdmin, {
-      rollId: data.data.rollId // array or number
-    })
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: requestRoute,
-      cacheKey: this.CacheList.baseAdmin,
-      ...(data.cache && { cache: data.cache }),
-      // paramSerializer: '/?hasRoll[]=10',
-      // params: this.getPayload({
-      //   hasRoll: [] // array
-      // }, data.data),
-      resolveCallback: (response) => {
-        return {
-          list: response.data.data,
-          links: response.data.links,
-          meta: response.data.meta
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getPurchasedProducts(data = {}, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.purchasedProducts,
-      cacheKey: this.CacheList.purchasedProducts,
-      data: this.getNormalizedSendData({
-        page: 1 // Number
-      }, data),
-      ...(cache && { cache }),
-      resolveCallback: (response) => {
-        return {
-          referralCodeList: new ProductList(response.data.data),
-          paginate: response.data.meta
-          // {
-          //   current_page: 1,
-          //   from: 1,
-          //   last_page: 1,
-          //   path: '...',
-          //   per_page: 15,
-          //   to: 10,
-          //   total: 10
-          // }
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getUserRoleAndPermission(data = {}, cache = { TTL: 1000 }) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.getUserRoleAndPermission,
-      cacheKey: this.CacheList.getUserRoleAndPermission,
-      ...(cache !== undefined && { cache }),
-      resolveCallback: (response) => {
-        const permissions = response.data.data.permissions // Array of string
-        return permissions
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  getFavored(data = {}, cache) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.favored,
-      cacheKey: this.CacheList.favored + JSON.stringify(data),
-      ...(cache !== undefined && { cache }),
-      data: this.getNormalizedSendData({
-        page: 1 // Number
-      }, data),
-      resolveCallback: (response) => {
-        return {
-          favoredList: new FavoredList(response.data.data),
-          paginate: response.data.meta
-          // {
-          //   current_page: 1,
-          //   from: 1,
-          //   last_page: 1,
-          //   path: '...',
-          //   per_page: 15,
-          //   to: 10,
-          //   total: 10
-          // }
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  resendGuest(data) {
-    return this.sendRequest({
-      apiMethod: 'get',
-      api: this.api,
-      request: this.APIAdresses.resendGuest,
-      data: this.getNormalizedSendData({
-        mobile: '' // String
-      }, data),
-      resolveCallback: (response) => {
-        return response.data
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  verifyMoshavereh(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.verifyMoshavereh,
-      data: this.getNormalizedSendData({
-        code: '' // String
-      }, data),
-      resolveCallback: (response) => {
-        return response.data.message
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-
-  newsletter(data) {
-    return this.sendRequest({
-      apiMethod: 'post',
-      api: this.api,
-      request: this.APIAdresses.newsletter,
-      data: this.getNormalizedSendData({
-        mobile: '', // String
-        code: '', // String
-        first_name: '', // String
-        last_name: '', // String
-        major_id: '', // String
-        event_id: '', // String
-        grade_id: '' // String
-      }, data),
-      resolveCallback: (response) => {
-        if (response.data.length > 0) {
-          return response.data[0].message
-        } else {
-          return ''
-        }
-      },
-      rejectCallback: (error) => {
-        return error
-      }
-    })
-  }
-}

+ 0 - 24
src/api/models/voucher.js

@@ -1,24 +0,0 @@
-import { appApi } from 'src/boot/axios.js'
-import APIRepository from '../classes/APIRepository.js'
-
-export default class VoucherAPI extends APIRepository {
-  constructor() {
-    super('voucher', appApi)
-    this.APIAdresses = {
-      Vouchers: {
-        create: {
-          base: '/admin/user'
-        },
-        edit: {
-          base: '/admin/user/'
-        },
-        index: {
-          base: '/admin/user'
-        },
-        show: {
-          base: '/admin/user/'
-        }
-      }
-    }
-  }
-}

+ 1 - 1
src/components/Template/Header/AdminPanelHeader.vue

@@ -78,7 +78,7 @@ import { mapMutations } from 'vuex'
 import { User } from 'src/models/User.js'
 
 export default {
-  name: 'templateHeader',
+  name: 'AdminPanelHeader',
   data () {
     return {
       user: new User(),

+ 4 - 10
src/components/Template/Header/TemplateHeader.vue

@@ -1,27 +1,21 @@
 <template>
   <main-header v-if="type === 'main'" />
   <admin-panel-header v-if="type === 'admin'" />
-  <user-abrisham-panel v-if="type === 'abrisham'" />
-  <user-gift-card-panel v-if="type === 'gift-card'" />
-  <triple-title-set-panel v-if="type === 'triple-title-set'" />
+  <user-panel-header v-if="type === 'user-panel'" />
 </template>
 
 <script>
 import MainHeader from 'src/components/Template/Header/MainHeader.vue'
 // import MainHeaderTemplate from 'src/components/Template/Header/Main.vue'
 import AdminPanelHeader from 'src/components/Template/Header/AdminPanelHeader.vue'
-import UserAbrishamPanel from 'src/components/Template/Header/UserAbrishamPanel.vue'
-import UserGiftCardPanel from 'src/components/Template/Header/UserGiftCardPanel.vue'
-import TripleTitleSetPanel from 'src/components/Template/Header/TripleTitleSetPanel.vue'
+import UserPanelHeader from 'src/components/Template/Header/UserPanelHeader.vue'
 
 export default {
   name: 'templateHeader',
   components: {
     MainHeader,
-    AdminPanelHeader,
-    UserGiftCardPanel,
-    UserAbrishamPanel,
-    TripleTitleSetPanel
+    UserPanelHeader,
+    AdminPanelHeader
   },
   props: {
     type: [String, Boolean, null],

+ 0 - 179
src/components/Template/Header/TripleTitleSetPanel.vue

@@ -1,179 +0,0 @@
-<template>
-  <div class="chatre-nejat-header">
-    <div class="logo-box">
-      <q-img src="https://nodes.alaatv.com/upload/landing/chatr/alaa%20logo.png"
-             class="logo-image" />
-    </div>
-    <div class="header-box full-height flex justify-center items-center">
-      <q-img :src="event.logo"
-             class="header-logo-img" />
-    </div>
-    <div class="profile-box flex items-center">
-      <q-avatar class="avatar">
-        <img :src="user.photo"
-             alt="profile-photo">
-        <q-menu>
-          <q-list class="menu-item">
-            <q-item>
-              <q-avatar class="profile-photo">
-                <img alt="profile-photo"
-                     class="img"
-                     :src="user.photo">
-              </q-avatar>
-              <q-item-section>
-                <div class="name">
-                  {{user.first_name || ' '}}
-                  {{user.last_name || ' '}}
-                </div>
-                <div class="phone-number">
-                  {{user.mobile}}
-                </div>
-              </q-item-section>
-            </q-item>
-            <q-item :to="{name : 'Public.Home'}">
-              <q-item-section>
-                <q-separator class="separator q-mb-md" />
-                رفتن به صفحه اصلی
-              </q-item-section>
-            </q-item>
-            <q-item class="cursor-pointer">
-              <span @click="logOut">
-                خروج
-              </span>
-            </q-item>
-          </q-list>
-        </q-menu>
-      </q-avatar>
-    </div>
-  </div>
-</template>
-
-<script>
-import { User } from 'src/models/User.js'
-import { mixinTripleTitleSet } from 'src/mixin/Mixins.js'
-
-export default {
-  name: 'TripleTitleSetPanel',
-  mixins: [mixinTripleTitleSet],
-  data: () => ({
-    user: new User(),
-    activePage: null
-  }),
-  mounted () {
-    this.loadAuthData()
-    if (window.innerWidth < 1024) {
-      this.$store.commit('AppLayout/updateLayoutLeftDrawerVisible', false)
-    }
-  },
-  methods: {
-    loadAuthData () { // prevent Hydration node mismatch
-      this.user = this.$store.getters['Auth/user']
-    },
-    logOut() {
-      this.$store.dispatch('Auth/logOut')
-    }
-  }
-}
-</script>
-
-<style scoped lang="scss">
-.menu-item{
-  font-stretch: normal;
-  font-style: normal;
-  line-height: normal;
-  letter-spacing: normal;
-  color: var(--abrishamGray);
-  .profile-photo{
-    margin-right:15px;
-    .img{
-      width: 36px;
-      height: 36px;
-    }
-
-  }
-  .name{
-    font-size: 16px;
-    font-weight: 500;
-    color: var(--abrishamMain);
-    margin-bottom: 3px;
-  }
-  .phone-number{
-    font-size: 14px;
-  }
-  .separator{
-    width: 90%;
-  }
-}
-.chatre-nejat-header{
-  height: 64px;
-  background: #fff;
-  position: relative;
-  display: grid;
-  grid-template-columns: auto 1fr auto;
-  @media screen and (max-width: 1023px) {
-
-  }
-
-  .logo-box {
-    width: 44px;
-    height: 44px;
-    align-self: center;
-    margin-left: 25px;
-    visibility: hidden;
-    @media screen and (max-width: 990px) {
-      visibility: visible;
-    }
-  }
-
-  .profile-box{
-
-  }
-
-  .header-box {
-    .header-logo-img {
-      width: 142px;
-      @media screen and (max-width: 990px) {
-        width: 126px;
-      }
-      @media screen and (max-width: 768px) {
-        width: 86px;
-      }
-    }
-  }
-  .profile-box {
-    height: 100%;
-    @media screen and (max-width: 1904px) {
-
-    }
-
-    .icon {
-      display: flex;
-      align-items: center;
-      font-size: 24px;
-      color: #3e5480;
-      font-weight: 500;
-      vertical-align: middle;
-      margin-right: 25px;
-      @media screen and (max-width: 1904px) {
-        margin-left: 15px;
-      }
-      @media screen and (max-width: 768px) {
-        font-size: 19px;
-        margin-left: 11px;
-      }
-    }
-
-    .avatar{
-      margin-right: 25px;
-      width: 36px;
-      height: 36px;
-    }
-
-  }
-  .expanded-panel{
-    margin: 0 30px;
-    box-shadow: 0 3px 5px 0 rgba(0, 0, 0, 0.1);
-  }
-}
-
-</style>

+ 0 - 157
src/components/Template/Header/UserAbrishamPanel.vue

@@ -1,157 +0,0 @@
-<template>
-  <div class="abrisham-header">
-    <div class="header-box full-height flex justify-center items-center">
-      <q-img src="https://nodes.alaatv.com/upload/abrisham-panel-logotype.png"
-             class="header-logo-img" />
-      <!--      <div class="text-primary">راه ابریشم</div>-->
-    </div>
-    <div class="profile-box flex items-center">
-      <i class="fi fi-rr-bell icon" />
-      <q-avatar class="avatar">
-        <img :src="user.photo"
-             alt="profile-photo">
-        <q-menu>
-          <q-list class="menu-item">
-            <q-item>
-              <q-avatar class="profile-photo">
-                <img alt="profile-photo"
-                     class="img"
-                     :src="user.photo">
-              </q-avatar>
-              <q-item-section>
-                <div class="name">
-                  {{user.first_name || ' '}}
-                  {{user.last_name || ' '}}
-                </div>
-                <div class="phone-number">
-                  {{user.mobile}}
-                </div>
-              </q-item-section>
-            </q-item>
-            <q-item :to="{name : 'Public.Home'}">
-              <q-item-section>
-                <q-separator class="separator q-mb-md" />
-                رفتن به صفحه اصلی
-              </q-item-section>
-            </q-item>
-            <q-item class="cursor-pointer">
-              <span @click="logOut">
-                خروج
-              </span>
-            </q-item>
-          </q-list>
-        </q-menu>
-      </q-avatar>
-    </div>
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'abrishamTemplateHeader',
-  data: () => ({
-    activePage: null
-  }),
-  computed: {
-    user() {
-      return this.$store.getters['Auth/user']
-    }
-  },
-  methods: {
-    logOut() {
-      this.$store.dispatch('Auth/logOut')
-    }
-  }
-}
-</script>
-
-<style scoped lang="scss">
-.menu-item{
-  font-stretch: normal;
-  font-style: normal;
-  line-height: normal;
-  letter-spacing: normal;
-  color: var(--abrishamGray);
-  .profile-photo{
-    margin-right:15px;
-    .img{
-      width: 36px;
-      height: 36px;
-    }
-
-  }
-  .name{
-    font-size: 16px;
-    font-weight: 500;
-    color: var(--abrishamMain);
-    margin-bottom: 3px;
-  }
-  .phone-number{
-    font-size: 14px;
-  }
-  .separator{
-    width: 90%;
-  }
-}
-.abrisham-header{
-  height: 64px;
-  background: #fff;
-  position: relative;
-  @media screen and (max-width: 1023px) {
-
-  }
-  .profile-box{
-
-  }
-
-  .header-box {
-    .header-logo-img {
-      width: 142px;
-      @media screen and (max-width: 990px) {
-        width: 126px;
-      }
-      @media screen and (max-width: 768px) {
-        width: 86px;
-      }
-    }
-  }
-  .profile-box {
-    position: absolute;
-    right: 0;
-    top: 0;
-    height: 100%;
-    @media screen and (max-width: 1904px) {
-      margin-left: 20px;
-    }
-
-    .icon {
-      display: flex;
-      align-items: center;
-      font-size: 24px;
-      color: #3e5480;
-      font-weight: 500;
-      vertical-align: middle;
-      margin-right: 25px;
-      @media screen and (max-width: 1904px) {
-        margin-left: 15px;
-      }
-      @media screen and (max-width: 768px) {
-        font-size: 19px;
-        margin-left: 11px;
-      }
-    }
-
-    .avatar{
-      margin-right: 25px;
-      width: 36px;
-      height: 36px;
-    }
-
-  }
-  .expanded-panel{
-    margin: 0 30px;
-    box-shadow: 0 3px 5px 0 rgba(0, 0, 0, 0.1);
-  }
-}
-
-</style>

+ 0 - 178
src/components/Template/Header/UserGiftCardPanel.vue

@@ -1,178 +0,0 @@
-<template>
-  <div class="header">
-    <div class="title">
-      کارت هدیه آلاء
-    </div>
-    <div class="dropdown-menu">
-      <q-btn flat
-             class="btn-user-profile">
-        <lazy-img :src="user.photo"
-                  :alt="'user photo'"
-                  class="user-photo" />
-        <q-menu class="user-profile-dropdown"
-                :offset="[170, 10]">
-          <div class="dropdown-box">
-            <div class="header">
-              <div class="profile-box">
-                <div class="profile-detail">
-                  <div class="profile-photo-box">
-                    <div class="profile-photo-img">
-                      <lazy-img :src="user.photo"
-                                :alt="'user photo'"
-                                class="user-photo" />
-                    </div>
-                  </div>
-                  <div v-if="isUserLogin"
-                       class="profile-detail-info">
-                    <div class="info-name">{{user.full_name}}</div>
-                    <div class="info-phoneNumber">{{user.mobile}}</div>
-                  </div>
-                </div>
-              </div>
-            </div>
-            <div class="body">
-              <div class="user-panel-base-menu">
-                <q-list class="side-menu-list"
-                        padding
-                        dark>
-                  <div v-for="(item , index) in profileTitlesList"
-                       :key="index">
-                    <div>
-                      <q-item class="item-list"
-                              :class="{ 'alone-item': !item.children.length }"
-                              :to="{ name: item.routeName, params: item.params }">
-                        <div class="section-title">
-                          <q-item-section class="list-section title-icon"
-                                          avatar>
-                            <q-avatar :icon="item.icon"
-                                      size="30" />
-                          </q-item-section>
-                          <q-item-section class="list-section">
-                            {{ item.title }}
-                          </q-item-section>
-                          <span class="indicator" />
-                        </div>
-                      </q-item>
-                    </div>
-                  </div>
-                </q-list>
-                <div class="log-out"
-                     @click="logOut">
-                  <span>
-                    <q-avatar icon="isax:logout"
-                              size="30"
-                              dir="rtl" />
-                  </span>
-                  <span class="logout-text">خروج </span>
-                </div>
-              </div>
-            </div>
-          </div>
-        </q-menu>
-      </q-btn>
-    </div>
-  </div>
-</template>
-
-<script>
-import { User } from 'src/models/User.js'
-import LazyImg from 'src/components/lazyImg.vue'
-
-export default {
-  name: 'UserGiftCardPanel',
-  components: { LazyImg },
-  data() {
-    return {
-      user: new User(),
-      profileTitlesList: [
-        {
-          title: 'پروفایل',
-          icon: 'isax:user',
-          routeName: 'UserPanel.Profile',
-          permission: 'all',
-          active: false,
-          children: []
-        },
-        {
-          title: 'فیلم ها و جزوه های من',
-          icon: 'isax:task-square',
-          routeName: 'UserPanel.MyPurchases',
-          params: null,
-          permission: 'all',
-          active: false,
-          children: []
-        },
-        {
-          title: 'علاقه مندی های من',
-          icon: 'isax:heart',
-          routeName: 'UserPanel.MyFavorites',
-          params: null,
-          permission: 'all',
-          active: false,
-          children: []
-        },
-        {
-          title: 'سفارش‌ ها',
-          icon: 'isax:clipboard-text',
-          routeName: 'UserPanel.MyOrders',
-          permission: 'all',
-          active: false,
-          children: []
-        }
-      ]
-    }
-  },
-  mounted () {
-    this.loadAuthData()
-  },
-  methods: {
-    loadAuthData () { // prevent Hydration node mismatch
-      this.user = this.$store.getters['Auth/user']
-    },
-    logOut() {
-      return this.$store.dispatch('Auth/logOut')
-    }
-  }
-}
-</script>
-
-<style lang="scss" scoped>
-.header {
-  background: #F5F7FA;
-  height: 90px;
-  display: flex;
-  flex-flow: row;
-  justify-content: space-between;
-  .title {
-    font-weight: 700;
-    font-size: 24px;
-    line-height: 37px;
-    letter-spacing: -0.03em;
-    color: #697D9A;
-    margin-top: 24px;
-    margin-left: 30px;
-  }
-  .dropdown-menu {
-    margin-top: 24px;
-    margin-right: 30px;
-    .btn-user-profile {
-      margin-left: 18px;
-      width: 48px;
-      height: 48px;
-      border-radius: 16px;
-      :deep(.q-btn__content) {
-        margin: 0;
-        .user-photo {
-          img {
-            border: 2px solid #FFB74D;
-            border-radius: 16px;
-            max-width: 100%;
-            width: 100%;
-          }
-        }
-      }
-    }
-  }
-}
-
-</style>

+ 335 - 0
src/components/Template/Header/UserPanelHeader.vue

@@ -0,0 +1,335 @@
+<template>
+  <div class="header-inside col">
+    <div class="admin-top-menu">
+      <div class="logo">
+        <router-link :to="{name: 'Public.Home'}">
+          <q-img class="logo-image"
+                 src="/assets/images/admin/layout/admin-logo.png" />
+        </router-link>
+      </div>
+      <div class="top-menu-items">
+        <div class="right-side">
+          <q-btn flat
+                 :to="{name: 'Public.Home'}">
+            <svg xmlns="http://www.w3.org/2000/svg"
+                 width="20.5"
+                 height="21.505"
+                 viewBox="0 0 20.5 21.505">
+              <g id="Home"
+                 transform="translate(0 0)">
+                <path id="Fill_1"
+                      data-name="Fill 1"
+                      d="M16.277,21.506H14.353A1.973,1.973,0,0,1,12.4,19.536V16.46a.677.677,0,0,0-.684-.669H8.831a.675.675,0,0,0-.674.669v3.066a.742.742,0,0,1-.031.215,1.983,1.983,0,0,1-1.979,1.764H4.223A4.211,4.211,0,0,1,0,17.317V8.6A3.158,3.158,0,0,1,1.259,6.1L7.794.855a3.913,3.913,0,0,1,4.88,0L19.256,6.1A3.154,3.154,0,0,1,20.5,8.582v8.734A4.211,4.211,0,0,1,16.277,21.506ZM8.826,14.291h2.891A2.179,2.179,0,0,1,13.9,16.46v3.076a.472.472,0,0,0,.47.469h1.906A2.709,2.709,0,0,0,19,17.317V8.593a1.672,1.672,0,0,0-.667-1.309L11.74,2.026a2.416,2.416,0,0,0-3.01,0L2.181,7.282A1.684,1.684,0,0,0,1.5,8.61v8.707a2.709,2.709,0,0,0,2.723,2.688H6.147a.486.486,0,0,0,.491-.479.766.766,0,0,1,.019-.171v-2.9A2.182,2.182,0,0,1,8.826,14.291Z"
+                      transform="translate(0 0)"
+                      fill="#aaa095" />
+              </g>
+            </svg>
+            صفحه اصلی
+          </q-btn>
+        </div>
+        <div class="left-side">
+          <q-btn flat>
+            <svg id="_000000ff"
+                 data-name="#000000ff"
+                 xmlns="http://www.w3.org/2000/svg"
+                 width="30"
+                 height="30"
+                 viewBox="0 0 30 30">
+              <path id="Path_29101"
+                    data-name="Path 29101"
+                    d="M8.807,0H21.19a9.015,9.015,0,0,1,8.266,5.926A9.2,9.2,0,0,1,30,8.811V21.135a9.019,9.019,0,0,1-6.97,8.631A9.442,9.442,0,0,1,21.19,30H8.811A9.013,9.013,0,0,1,0,21.133V8.81A9.021,9.021,0,0,1,8.807,0M8.291,2.034A7.012,7.012,0,0,0,2,9.025q0,6.006,0,12.011A7.016,7.016,0,0,0,9.026,28q6,0,12.007,0A7.014,7.014,0,0,0,28,21.035Q28,15,28,8.961a7.012,7.012,0,0,0-5.962-6.885A12.06,12.06,0,0,0,20.154,2H9.434A10.63,10.63,0,0,0,8.291,2.034Z"
+                    fill="#aaa095" />
+              <path id="Path_29102"
+                    data-name="Path 29102"
+                    d="M159.237,85.32A6,6,0,1,1,155.26,87.2a6.006,6.006,0,0,1,3.977-1.876m-.343,2.06a4,4,0,1,0,2.664.429A4.011,4.011,0,0,0,158.895,87.38Z"
+                    transform="translate(-144.628 -80.308)"
+                    fill="#aaa095" />
+              <path id="Path_29103"
+                    data-name="Path 29103"
+                    d="M124.8,324.32c1.223-.023,2.446-.006,3.669-.01a8.967,8.967,0,0,1,6.065,2.409,1,1,0,0,1,.218,1.1.976.976,0,0,1-1.124.578,1.694,1.694,0,0,1-.749-.488,6.993,6.993,0,0,0-4.412-1.622q-1.64,0-3.281,0a6.992,6.992,0,0,0-4.654,1.845,1.041,1.041,0,0,1-.792.32,1,1,0,0,1-.685-1.682A8.994,8.994,0,0,1,124.8,324.32Z"
+                    transform="translate(-111.831 -305.305)"
+                    fill="#aaa095" />
+            </svg>
+            {{ user.fullname() }}
+            <q-menu>
+              <q-list style="min-width: 100px">
+                <q-item v-if="user.canSeeUserProfilePanel()"
+                        v-close-popup
+                        clickable
+                        :to="{name: 'UserPanel.Profile.UserInfo'}">
+                  <q-item-section>پروفایل</q-item-section>
+                </q-item>
+                <q-item v-close-popup
+                        clickable
+                        @click="logOut">
+                  <q-item-section>خروج</q-item-section>
+                </q-item>
+              </q-list>
+            </q-menu>
+          </q-btn>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import { mapMutations } from 'vuex'
+import { User } from 'src/models/User.js'
+
+export default {
+  name: 'UserPanelHeader',
+  data () {
+    return {
+      user: new User(),
+      topMenuItems: [
+        // {
+        //   title: 'معرفی پروژه',
+        //   scrollTo: '#introSection',
+        //   routeName: 'aaaaaaaaaaaa'
+        // },
+        // {
+        //   title: 'مجامع',
+        //   scrollTo: '#majameSection',
+        //   routeName: 'aaaaaaaaaaaa'
+        // },
+        // {
+        //   title: 'مشاورین حقوقی',
+        //   scrollTo: '#moshaverinSection',
+        //   routeName: 'aaaaaaaaaaaa'
+        // },
+        // {
+        //   title: 'تصاویر',
+        //   scrollTo: '#gallerySection',
+        //   routeName: 'aaaaaaaaaaaa'
+        // },
+        // {
+        //   title: 'اخبار و رویدادها',
+        //   scrollTo: '#newsSection',
+        //   routeName: 'aaaaaaaaaaaa'
+        // },
+        // {
+        //   title: 'ارتباط با ما',
+        //   scrollTo: '#feedback',
+        //   routeName: 'aaaaaaaaaaaa'
+        // }
+      ]
+    }
+  },
+  computed: {
+    isAdminPage () {
+      return this.$route.name && this.$route.name.includes('Admin.')
+    },
+    isProfilePage () {
+      return this.$route.name && this.$route.name.includes('UserPanel.Profile.')
+    },
+    isHomePage () {
+      return this.$route.name && this.$route.name === 'Public.Home'
+    }
+  },
+  mounted () {
+    this.loadAuthData()
+  },
+  methods: {
+    loadAuthData () {
+      this.user = this.$store.getters['Auth/user']
+    },
+    ...mapMutations('AppLayout', [
+      'updateLayoutLeftDrawerVisible'
+    ]),
+    goToHome () {
+      this.$router.push({ name: 'Public.Home' })
+    },
+    goToAdminDashboard () {
+      this.$router.push({ name: 'Admin.Content.Index' })
+    },
+    logOut () {
+      this.$store.dispatch('Auth/logOut')
+    },
+    toggleLeftDrawer () {
+      this.updateLayoutLeftDrawerVisible(true)
+    },
+    hasRoute (route) {
+      if (!route) {
+        return
+      }
+      return !!(route.name || route.path)
+    },
+    getRoute (route) {
+      if (!this.hasRoute(route)) {
+        return { name: null }
+      }
+      if (route.name) {
+        return { name: route.name }
+      } else if (route.path) {
+        return { path: route.path }
+      } else {
+        return { name: null }
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+.drawer-btn {
+  display: none;
+  @media screen and (max-width: 1439px) {
+    display: block;
+  }
+  @media screen and (max-width: 599px) {
+    margin-bottom: 10px;
+  }
+}
+
+.right-side {
+  display: flex;
+  align-items: center;
+  @media screen and (max-width: 1439px) {
+    margin-left: 78px;
+  }
+  @media screen and (max-width: 1023px) {
+    margin-left: 42px;
+  }
+  @media screen and (max-width: 599px) {
+    margin-left: 0;
+  }
+
+  .breadcrumbs {
+    &:deep(> *) {
+      font-style: normal;
+      font-weight: bold;
+      font-size: 16px;
+      line-height: 31px;
+      text-align: right;
+      color: #23263B;
+
+      div:first-child {
+        font-size: 18px;
+      }
+    }
+  }
+}
+
+.left-side {
+  display: flex;
+  justify-content: flex-end;
+  @media screen and (max-width: 1439px) {
+    position: absolute;
+    right: 30px;
+  }
+  @media screen and (max-width: 599px) {
+    right: 16px;
+    margin-bottom: 10px;
+  }
+}
+</style>
+<style lang="scss">
+.header-inside {
+  .admin-top-menu {
+    display: flex;
+    flex-flow: row;
+    height: 100%;
+    .top-menu-items {
+      width: calc( 100% - 240px );
+      display: flex;
+      flex-flow: row;
+      justify-content: space-between;
+      .q-btn {
+        height: 40px;
+        svg {
+          margin-right: 10px;
+        }
+      }
+      .right-side {
+        display: flex;
+        flex-flow: row;
+        align-items: center;
+        padding-left: 50px;
+      }
+      .left-side {
+        display: flex;
+        flex-flow: row;
+        align-items: center;
+        padding-right: 50px;
+      }
+    }
+    .logo {
+      width: 240px;
+      height: 100%;
+      background: #FBF4EA;
+      border-right: solid 1px #DFE1EC;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      .logo-image {
+        width: 106px;
+        height: auto;
+      }
+    }
+  }
+}
+
+.top-menu-items {
+  border-radius: 10px;
+  @media only screen and (max-width: 1439px) {
+    & {
+      display: none !important;
+    }
+  }
+  @media only screen and (max-width: 500px) {
+    .q-btn__content {
+      margin: 4px;
+      font-size: 0.7rem;
+    }
+  }
+  @media only screen and (max-width: 400px) {
+    .q-btn__content {
+      margin: 3px;
+      font-size: 0.6rem;
+    }
+  }
+}
+
+.breadcrumbs {
+  .q-breadcrumbs__separator {
+    .q-icon {
+      font-size: 22px;
+    }
+  }
+}
+
+.drawer-btn {
+  .q-btn {
+    flex-direction: row !important;
+
+    &.toolbar-button {
+      margin-left: 0 !important;
+    }
+  }
+}
+
+.q-btn {
+  &.toolbar-button {
+    margin-left: 12px;
+    height: 48px;
+    width: 48px;
+    box-shadow: -2px -4px 10px rgba(255, 255, 255, 0.6), 2px 4px 10px rgba(112, 108, 162, 0.05);
+    border-radius: 16px;
+    border: solid 1px #c5c5c5;
+  }
+}
+
+.left-side {
+  .q-btn {
+    &.toolbar-button {
+      .q-btn__content {
+        .q-btn-dropdown__arrow {
+          display: none !important;
+        }
+      }
+    }
+  }
+}
+</style>

+ 36 - 14
src/models/User.js

@@ -10,33 +10,55 @@ class User extends Model {
       //   default: API_ADDRESS.user.base
       // },
       { key: 'id' },
-      { key: 'user_id' },
-      { key: 'creation_time' },
+      { key: 'firstname' },
+      { key: 'lastname' },
+      { key: 'gender' },
+      { key: 'marital_status' },
+      { key: 'birthdate' },
+      { key: 'national_code' },
+      { key: 'picture' },
+      { key: 'has_seminary_education' },
+      { key: 'last_academic_degree' },
+      { key: 'last_academic_degree_field' },
+      { key: 'last_academy_name' },
+      { key: 'educational_status' },
+      { key: 'phone_number' },
+      { key: 'phone_number_verified' },
+      { key: 'on_social_network_mobile_number' },
+      { key: 'on_call_mobile_number' },
       { key: 'email' },
       { key: 'email_verified' },
+      { key: 'is_abroad_birth_address' },
+      { key: 'birth_country' },
+      { key: 'birth_province' },
+      { key: 'birth_city' },
+      { key: 'is_abroad_living_address' },
+      { key: 'living_country' },
+      { key: 'living_province' },
+      { key: 'living_city' },
+      { key: 'living_address' },
+      { key: 'living_postal_code' },
+      { key: 'living_address_additional_info' },
+      { key: 'is_locked_out' },
       { key: 'failed_login_attempts' },
-      { key: 'groups' },
+      { key: 'lockout_end_date' },
+      { key: 'creation_time' },
+      { key: 'last_modification_time' },
       { key: 'is_active' },
+      { key: 'is_deleted' },
+      { key: 'roles' },
+
+      { key: 'user_id' },
+      { key: 'groups' },
       { key: 'is_delete' },
-      { key: 'is_locked_out' },
       { key: 'is_superuser' },
       { key: 'last_login' },
-      { key: 'last_modification_time' },
-      { key: 'lockout_end_date' },
       { key: 'mobile_number' },
       { key: 'mobile_number_verified' },
-      { key: 'national_code' },
       { key: 'nickname' },
-      { key: 'firstname' },
-      { key: 'lastname' },
       { key: 'father_name' },
       { key: 'password' },
-      { key: 'phone_number' },
-      { key: 'phone_number_verified' },
       { key: 'potential_dates' },
-      { key: 'roles' },
-      { key: 'gender' },
-      { key: 'marital_status' },
       { key: 'address' },
       { key: 'moballegh_info' },
       { key: 'user_permissions' }

+ 15 - 7
src/pages/User/Profile/profile.vue

@@ -1,5 +1,6 @@
 <template>
-  <entity-edit ref="entityEdit"
+  <entity-edit v-if="mounted"
+               ref="entityEdit"
                v-model:value="inputs"
                title="اطلاعات کاربری"
                :api="api"
@@ -20,30 +21,34 @@
       </div>
     </template>
   </entity-edit>
+  <template v-else>
+    کمی صبر کنید...
+  </template>
 </template>
 
 <script>
 import { shallowRef } from 'vue'
 import { EntityEdit } from 'quasar-crud'
 import Enums from 'src/assets/Enums/Enums.js'
-import API_ADDRESS from 'src/api/Addresses.js'
+import { APIGateway } from 'src/api/APIGateway.js'
 import Warning from 'src/components/other/Warning.vue'
 import VerifyEmail from 'src/components/other/VerifyEmail.vue'
 import NationalCode from 'src/components/other/NationalCode.vue'
 import VerifyMobileNumber from 'src/components/other/VerifyMobileNumber.vue'
 
-const VerifyMobileNumberComp = shallowRef(VerifyMobileNumber)
+const WarningComp = shallowRef(Warning)
 const VerifyEmailComp = shallowRef(VerifyEmail)
 const NationalCodeComp = shallowRef(NationalCode)
-const WarningComp = shallowRef(Warning)
+const VerifyMobileNumberComp = shallowRef(VerifyMobileNumber)
 
 export default {
   name: 'UserPanel.Profile.UserInfo',
   components: { EntityEdit },
   data () {
     return {
+      mounted: false,
       tab: 'userInfo',
-      api: API_ADDRESS.user.current,
+      api: APIGateway.user.APIAdresses.current,
       entityIdKey: 'id',
       entityParamKey: 'id',
       showRouteName: 'UserPanel.Profile.UserInfo',
@@ -55,8 +60,8 @@ export default {
         // { type: 'input', name: 'on_call_mobile_number', label: 'تلفن همراه', responseKey: 'on_call_mobile_number', col: 'col-md-3' },
         { type: VerifyMobileNumberComp, name: 'on_call_mobile_number', label: 'تلفن همراه', responseKey: 'on_call_mobile_number', col: 'col-md-3' },
         { type: 'separator', name: 'space', label: 'اطلاعات پروفایل', col: 'col-md-12' },
-        { type: 'file', name: 'avatar', label: 'عکس پروفایل', responseKey: 'data.avatar', col: 'col-md-3' },
-        { type: 'separator', name: 'space', size: 0, col: 'col-md-12' },
+        { type: 'file', name: 'picture', label: 'عکس پروفایل', responseKey: 'picture', col: 'col-md-3' },
+        { type: 'separator', name: 'space', size: '0', col: 'col-md-12' },
         { type: 'input', name: 'firstname', label: 'نام', responseKey: 'firstname', col: 'col-md-3' },
         { type: 'input', name: 'lastname', label: 'نام خانوادگی', responseKey: 'lastname', col: 'col-md-3' },
         {
@@ -113,6 +118,9 @@ export default {
       ]
     }
   },
+  mounted() {
+    this.mounted = true
+  },
   methods: {
     afterLoadInputData (responseData, setNewInputData) {
       this.updateGender(responseData, setNewInputData)

+ 1 - 0
src/router/routes.js

@@ -93,6 +93,7 @@ const routes = [
         name: 'UserPanel',
         layoutConfig: {
           showHamburgerBtn: false,
+          layoutHeaderType: 'user-panel',
           layoutLeftSideBarType: 'user-panel'
         },
         meta: { middlewares: [Authenticated, canSeeUserProfilePanel] },