Registration.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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: 'item' },
  11. { key: 'item_info' },
  12. { key: 'basket' },
  13. { key: 'count' },
  14. { key: 'user' },
  15. {
  16. key: 'user_info',
  17. relatedModel: User
  18. },
  19. { key: 'time_status' },
  20. { key: 'termination_datetime' },
  21. { key: 'creation_time' },
  22. { key: 'last_modification_time' }
  23. ])
  24. this.timeStatusEnums = [
  25. {
  26. label: 'فعال',
  27. value: 'ONGOING',
  28. color: '#2FA84A'
  29. }
  30. ]
  31. this.loadTimeStatusInfo()
  32. }
  33. loadTimeStatusInfo () {
  34. const target = this.timeStatusEnums.find(type => type.value === this.time_status)
  35. if (!target) {
  36. this.time_status_info = {
  37. label: null,
  38. value: null,
  39. color: ''
  40. }
  41. } else {
  42. this.time_status_info = target
  43. }
  44. }
  45. loadProductData () {
  46. // if (this.product_info.product_type === 'package') {
  47. // this.product_data = new Package(this.product_info)
  48. // } else if (this.product_info.product_type === 'service') {
  49. // this.product_data = new Service(this.product_info)
  50. // }
  51. }
  52. }
  53. class RegistrationList extends Collection {
  54. model () {
  55. return Registration
  56. }
  57. }
  58. export { Registration, RegistrationList }