Pārlūkot izejas kodu

feat: fixed #235

ali 2 gadi atpakaļ
vecāks
revīzija
1d3525a8b8

+ 15 - 0
src/api/models/Registration.js

@@ -9,6 +9,7 @@ export default class RegistrationAPI extends APIRepository {
       base: '/lma/registrations',
       exportReport: '/lma/registrations/export_report',
       classroomDetail: (registrationId) => '/lma/registrations/' + registrationId + '/classroom_detail',
+      revertDroppedForCondition: (registrationId) => '/lma/registrations/' + registrationId + '/revert_dropped_for_condition',
       byId: (id) => '/lma/registrations/' + id
     }
     this.CacheList = {
@@ -71,4 +72,18 @@ export default class RegistrationAPI extends APIRepository {
       }
     })
   }
+
+  revertDroppedForCondition(id) {
+    return this.sendRequest({
+      apiMethod: 'put',
+      api: this.api,
+      request: this.APIAdresses.revertDroppedForCondition(id),
+      resolveCallback: () => {
+        return null
+      },
+      rejectCallback: (error) => {
+        return error
+      }
+    })
+  }
 }

+ 26 - 2
src/components/Widgets/Classroom/AdminClassroomShow/components/MembersList.vue

@@ -20,6 +20,16 @@
       <template v-if="inputData.col.name === 'number'">
         {{ inputData.rowNumber }}
       </template>
+      <template v-if="inputData.col.name === 'UserRegisterStatus'">
+        <q-btn v-if="inputData.col.value === 'DROPPED_FOR_CONDITION'"
+               color="primary"
+               class="q-mr-md"
+               :loading="revertDroppedForConditionLoading"
+               @click="revertDroppedForCondition(inputData.props.row.id)">
+          بازگرداندن ثبت نام
+        </q-btn>
+        {{ inputData.col.value }}
+      </template>
       <template v-else-if="inputData.col.name === 'action'">
         <div class="action-column-entity-index">
           <q-btn v-if="inputData.props.row.status !== 'DROPPED_BY_ADMIN' && inputData.props.row.status !== 'DROPPED_BY_ITSELF'"
@@ -136,7 +146,7 @@ export default {
             field: row => row.owner_info.email
           },
           {
-            name: 'owner_info.email',
+            name: 'UserRegisterStatus',
             required: true,
             label: 'وضعیت',
             align: 'left',
@@ -158,7 +168,9 @@ export default {
         currentPage: 'current',
         perPage: 'per_page',
         pageKey: 'page'
-      }
+      },
+
+      revertDroppedForConditionLoading: false
     }
   },
   mounted () {
@@ -166,6 +178,18 @@ export default {
     this.mounted = true
   },
   methods: {
+    revertDroppedForCondition (id) {
+      this.revertDroppedForConditionLoading = true
+      APIGateway.registration.revertDroppedForCondition(id)
+        .then(() => {
+          this.revertDroppedForConditionLoading = false
+          this.searchMembersList()
+        })
+        .catch(() => {
+          this.revertDroppedForConditionLoading = false
+          this.searchMembersList()
+        })
+    },
     setMembersListActionBtn () {
       FormBuilderAssist.setAttributeByName(this.membersListInputs, 'btn', 'atClick', this.searchMembersList)
     },