Registration.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import { User } from 'src/models/User.js'
  2. // import { Package } from 'src/models/Package.js'
  3. // import { Service } from 'src/models/Service.js'
  4. import { Collection, Model } from 'js-abstract-model'
  5. class Registration extends Model {
  6. constructor (data) {
  7. super(data, [
  8. { key: 'id' },
  9. { key: 'product_info' },
  10. { key: 'classroom' },
  11. { key: 'classroom_info' },
  12. { key: 'item' },
  13. { key: 'item_info' },
  14. { key: 'basket' },
  15. { key: 'count' },
  16. { key: 'user' },
  17. {
  18. key: 'user_info',
  19. relatedModel: User
  20. },
  21. { key: 'status' },
  22. { key: 'time_status' },
  23. { key: 'termination_datetime' },
  24. { key: 'creation_time' },
  25. { key: 'last_modification_time' }
  26. ], {
  27. status: {
  28. infoKey: 'status_info',
  29. enums: [
  30. {
  31. label: 'پیش ثبت نام',
  32. value: 'ENROLLED'
  33. },
  34. {
  35. label: 'ثبت نام',
  36. value: 'REGISTERED'
  37. },
  38. {
  39. label: 'حذف توسط شما',
  40. value: 'DROPPED_BY_ITSELF'
  41. },
  42. {
  43. label: 'حذف توسط ادمین',
  44. value: 'DROPPED_BY_ADMIN'
  45. }
  46. ]
  47. },
  48. time_status: {
  49. infoKey: 'time_status_info',
  50. enums: [
  51. {
  52. label: 'فعال',
  53. value: 'ONGOING',
  54. color: '#2FA84A'
  55. }
  56. ]
  57. }
  58. })
  59. // this.timeStatusEnums = [
  60. // {
  61. // label: 'فعال',
  62. // value: 'ONGOING',
  63. // color: '#2FA84A'
  64. // }
  65. // ]
  66. // this.loadTimeStatusInfo()
  67. }
  68. loadTimeStatusInfo () {
  69. const target = this.timeStatusEnums.find(type => type.value === this.time_status)
  70. if (!target) {
  71. this.time_status_info = {
  72. label: null,
  73. value: null,
  74. color: ''
  75. }
  76. } else {
  77. this.time_status_info = target
  78. }
  79. }
  80. loadProductData () {
  81. // if (this.product_info.product_type === 'package') {
  82. // this.product_data = new Package(this.product_info)
  83. // } else if (this.product_info.product_type === 'service') {
  84. // this.product_data = new Service(this.product_info)
  85. // }
  86. }
  87. }
  88. class RegistrationList extends Collection {
  89. model () {
  90. return Registration
  91. }
  92. }
  93. export { Registration, RegistrationList }