| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- import { User } from 'src/models/User.js'
- // import { Package } from 'src/models/Package.js'
- // import { Service } from 'src/models/Service.js'
- import { Collection, Model } from 'js-abstract-model'
- class Registration extends Model {
- constructor (data) {
- super(data, [
- { key: 'id' },
- { key: 'product_info' },
- { key: 'classroom' },
- { key: 'classroom_info' },
- { key: 'item' },
- { key: 'item_info' },
- { key: 'basket' },
- { key: 'count' },
- { key: 'user' },
- {
- key: 'user_info',
- relatedModel: User
- },
- { key: 'status' },
- { key: 'time_status' },
- { key: 'termination_datetime' },
- { key: 'creation_time' },
- { key: 'last_modification_time' }
- ], {
- status: {
- infoKey: 'status_info',
- enums: [
- {
- label: 'پیش ثبت نام',
- value: 'ENROLLED'
- },
- {
- label: 'ثبت نام',
- value: 'REGISTERED'
- },
- {
- label: 'حذف توسط شما',
- value: 'DROPPED_BY_ITSELF'
- },
- {
- label: 'حذف توسط ادمین',
- value: 'DROPPED_BY_ADMIN'
- }
- ]
- },
- time_status: {
- infoKey: 'time_status_info',
- enums: [
- {
- label: 'فعال',
- value: 'ONGOING',
- color: '#2FA84A'
- }
- ]
- }
- })
- // this.timeStatusEnums = [
- // {
- // label: 'فعال',
- // value: 'ONGOING',
- // color: '#2FA84A'
- // }
- // ]
- // this.loadTimeStatusInfo()
- }
- loadTimeStatusInfo () {
- const target = this.timeStatusEnums.find(type => type.value === this.time_status)
- if (!target) {
- this.time_status_info = {
- label: null,
- value: null,
- color: ''
- }
- } else {
- this.time_status_info = target
- }
- }
- loadProductData () {
- // if (this.product_info.product_type === 'package') {
- // this.product_data = new Package(this.product_info)
- // } else if (this.product_info.product_type === 'service') {
- // this.product_data = new Service(this.product_info)
- // }
- }
- }
- class RegistrationList extends Collection {
- model () {
- return Registration
- }
- }
- export { Registration, RegistrationList }
|