ali преди 3 години
родител
ревизия
baffbfd457
променени са 5 файла, в които са добавени 53 реда и са изтрити 40 реда
  1. 1 1
      package.json
  2. 1 23
      src/models/Invoice.js
  3. 42 9
      src/models/Registration.js
  4. 3 1
      src/pages/User/Profile/classrooms.vue
  5. 6 6
      yarn.lock

+ 1 - 1
package.json

@@ -42,7 +42,7 @@
     "firebase": "^9.23.0",
     "fs": "^0.0.1-security",
     "fslightbox-vue": "^2.0.2",
-    "js-abstract-model": "^0.1.32",
+    "js-abstract-model": "^0.1.34",
     "leaflet": "^1.9.3",
     "moment": "^2.29.4",
     "moment-jalaali": "^0.9.6",

+ 1 - 23
src/models/Invoice.js

@@ -36,9 +36,7 @@ class Invoice extends Model {
         key: 'owner_info',
         relatedModel: User
       }
-    ])
-
-    this.enumKeysForLoad = {
+    ], {
       status: {
         infoKey: 'status_info',
         enums: [
@@ -85,28 +83,8 @@ class Invoice extends Model {
           }
         ]
       }
-    }
-
-    this.loadEnums()
-  }
-
-  loadEnums () {
-    Object.keys(this.enumKeysForLoad).forEach(enumKey => {
-      this.loadEnum(enumKey, this.enumKeysForLoad[enumKey])
     })
   }
-
-  loadEnum (enumKey, enumItem) {
-    const target = enumItem.enums.find(type => type.value === this[enumKey])
-    if (!target) {
-      this[enumItem.infoKey] = {
-        label: null,
-        value: null
-      }
-    } else {
-      this[enumItem.infoKey] = target
-    }
-  }
 }
 
 class InvoiceList extends Collection {

+ 42 - 9
src/models/Registration.js

@@ -17,21 +17,54 @@ class Registration extends Model {
         key: 'user_info',
         relatedModel: User
       },
+      { key: 'status' },
       { key: 'time_status' },
       { key: 'termination_datetime' },
       { key: 'creation_time' },
       { key: 'last_modification_time' }
-    ])
-
-    this.timeStatusEnums = [
-      {
-        label: 'فعال',
-        value: 'ONGOING',
-        color: '#2FA84A'
+    ], {
+      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()
+    // this.loadTimeStatusInfo()
   }
 
   loadTimeStatusInfo () {

+ 3 - 1
src/pages/User/Profile/classrooms.vue

@@ -54,6 +54,7 @@ import { FormBuilderAssist } from 'quasar-form-builder'
 import BtnControl from 'src/components/Control/btn.vue'
 import EntityIndexGridItem from 'src/components/EntityIndexGridItem.vue'
 import Breadcrumbs from 'src/components/Widgets/Breadcrumbs/Breadcrumbs.vue'
+import { Registration } from 'src/models/Registration.js'
 
 const BtnControlComp = shallowRef(BtnControl)
 
@@ -189,7 +190,8 @@ export default {
             required: true,
             label: 'وضعیت',
             align: 'left',
-            field: row => this.getClassroomStatusTitle(row.classroom_info.status)
+            field: row => (new Registration(row)).status_info.label
+            // field: row => this.getClassroomStatusTitle(row.classroom_info.status)
           },
           {
             name: 'title',

+ 6 - 6
yarn.lock

@@ -2325,7 +2325,7 @@ available-typed-arrays@^1.0.5:
   resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7"
   integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==
 
-axios@^1.2.1, axios@^1.4.0:
+axios@^1.4.0:
   version "1.4.0"
   resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f"
   integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==
@@ -4454,12 +4454,12 @@ jest-worker@^26.2.1:
     merge-stream "^2.0.0"
     supports-color "^7.0.0"
 
-js-abstract-model@^0.1.32:
-  version "0.1.32"
-  resolved "https://registry.yarnpkg.com/js-abstract-model/-/js-abstract-model-0.1.32.tgz#3fb5a2e0d84eaf56903938381a843795671a2677"
-  integrity sha512-vpyQgrx/APxSjqYPo079BqyUBRT7yvnYRODvyj5RZM1uyN7dSTiM1CE2jdOnQ6d9gPWo1kM6ehmFtZlaY4FffA==
+js-abstract-model@^0.1.34:
+  version "0.1.34"
+  resolved "https://registry.yarnpkg.com/js-abstract-model/-/js-abstract-model-0.1.34.tgz#05493625f2a35716bbc1ed2bb76ccdde1c7a1564"
+  integrity sha512-P3yD4qDu4VG4SxEM+aW6OBCQkRY1YiojOnyrJQCPflia2SzvUOpsa9FMDWK0lTll3msMad7X0h6tsxrX/EOvrw==
   dependencies:
-    axios "^1.2.1"
+    axios "^1.4.0"
     moment "^2.29.4"
     persian-date "^1.1.0"