Registration.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. enumListKey: 'statusEnums',
  30. enums: [
  31. {
  32. label: 'پیش ثبت نام',
  33. value: 'ENROLLED'
  34. },
  35. {
  36. label: 'ثبت نام',
  37. value: 'REGISTERED'
  38. },
  39. {
  40. label: 'حذف توسط کاربر',
  41. value: 'DROPPED_BY_ITSELF'
  42. },
  43. {
  44. label: 'حذف توسط ادمین',
  45. value: 'DROPPED_BY_ADMIN'
  46. },
  47. {
  48. label: 'حذف سیستمی (شرایط غیر مجاز)',
  49. value: 'DROPPED_FOR_CONDITION'
  50. },
  51. {
  52. label: 'حذف سیستمی (نهایی نشده)',
  53. value: 'DROPPED_FOR_NOT_FINALIZING'
  54. }
  55. ]
  56. },
  57. time_status: {
  58. infoKey: 'time_status_info',
  59. enumListKey: 'time_statusEnums',
  60. enums: [
  61. {
  62. label: 'فعال',
  63. value: 'ONGOING',
  64. color: '#2FA84A'
  65. }
  66. ]
  67. }
  68. })
  69. // this.timeStatusEnums = [
  70. // {
  71. // label: 'فعال',
  72. // value: 'ONGOING',
  73. // color: '#2FA84A'
  74. // }
  75. // ]
  76. // this.loadTimeStatusInfo()
  77. }
  78. loadTimeStatusInfo () {
  79. const target = this.timeStatusEnums.find(type => type.value === this.time_status)
  80. if (!target) {
  81. this.time_status_info = {
  82. label: null,
  83. value: null,
  84. color: ''
  85. }
  86. } else {
  87. this.time_status_info = target
  88. }
  89. }
  90. loadProductData () {
  91. // if (this.product_info.product_type === 'package') {
  92. // this.product_data = new Package(this.product_info)
  93. // } else if (this.product_info.product_type === 'service') {
  94. // this.product_data = new Service(this.product_info)
  95. // }
  96. }
  97. }
  98. class RegistrationList extends Collection {
  99. model () {
  100. return Registration
  101. }
  102. }
  103. export { Registration, RegistrationList }