AdminSessionAttendanceSheetList.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <div class="AdminContentList"
  3. :style="localOptions.style">
  4. <breadcrumbs class="q-mb-xl"
  5. style="margin-top: 29px; margin-bottom: 19px;" />
  6. <div class="flex justify-end">
  7. <q-btn flat
  8. color="grey"
  9. @click="$router.go(-1)">
  10. بازگشت
  11. >
  12. </q-btn>
  13. </div>
  14. <entity-index v-if="mounted"
  15. v-model:value="inputs"
  16. title="لیست حضور و غیاب"
  17. :api="api"
  18. :table="table"
  19. :table-keys="tableKeys"
  20. :create-route-name="createRouteName"
  21. :show-search-button="false"
  22. :show-expand-button="false"
  23. :show-reload-button="false">
  24. <template #entity-index-table-cell="{inputData}">
  25. <template v-if="inputData.col.name === 'number'">
  26. {{ inputData.rowNumber }}
  27. </template>
  28. <template v-else-if="inputData.col.name === 'action'">
  29. <q-btn color="primary"
  30. outline
  31. class="q-mr-md"
  32. :to="{name: 'Admin.Classroom.Session.AttendanceSheet.Attendance', params: {classroom_id: $route.params.classroom_id, session_id: $route.params.session_id, session_attendance_sheet_id: inputData.props.row.id}}">
  33. حضور و غیاب
  34. </q-btn>
  35. <q-btn color="primary"
  36. :outline="inputData.props.row.assignment_status !== null"
  37. :to="{name: 'Admin.Classroom.Session.AttendanceSheet.Assignment', params: {classroom_id: $route.params.classroom_id, session_id: $route.params.session_id, session_attendance_sheet_id: inputData.props.row.id}}">
  38. <template v-if="inputData.props.row.assignment_status !== null">
  39. ویرایش تصحیح
  40. </template>
  41. <template v-else>
  42. بررسی تکلیف
  43. </template>
  44. </q-btn>
  45. </template>
  46. <template v-else>
  47. {{ inputData.col.value }}
  48. </template>
  49. </template>
  50. </entity-index>
  51. </div>
  52. </template>
  53. <script>
  54. import { EntityIndex } from 'quasar-crud'
  55. import { mixinWidget } from 'src/mixin/Mixins.js'
  56. import { APIGateway } from 'src/api/APIGateway.js'
  57. import { Classroom } from 'src/models/Classroom.js'
  58. import Breadcrumbs from 'src/components/Widgets/Breadcrumbs/Breadcrumbs.vue'
  59. import { SessionAttendanceSheets } from 'src/models/SessionAttendanceSheets'
  60. export default {
  61. name: 'AdminSessionAttendanceSheetList',
  62. components: { EntityIndex, Breadcrumbs },
  63. mixins: [mixinWidget],
  64. data () {
  65. const sessionId = this.$route.params.session_id
  66. return {
  67. classroom: new Classroom(),
  68. api: APIGateway.sessionAttendanceSheets.APIAdresses.base,
  69. tableKeys: {
  70. data: 'results',
  71. total: 'count',
  72. currentPage: 'current',
  73. perPage: 'per_page',
  74. pageKey: 'page'
  75. },
  76. inputs: [
  77. { type: 'hidden', name: 'session', value: sessionId }
  78. ],
  79. table: {
  80. columns: [
  81. {
  82. name: 'number',
  83. required: true,
  84. label: 'شماره',
  85. align: 'left',
  86. field: () => ''
  87. },
  88. {
  89. name: 'id',
  90. required: true,
  91. label: 'شناسه',
  92. align: 'left',
  93. field: row => row.id
  94. },
  95. {
  96. name: 'sender',
  97. required: true,
  98. label: 'نام و نام خانوادگی',
  99. align: 'left',
  100. field: row => row.owner.firstname + ' ' + row.owner.lastname
  101. },
  102. {
  103. name: 'sender',
  104. required: true,
  105. label: 'کد ملی',
  106. align: 'left',
  107. field: row => row.owner.national_code
  108. },
  109. {
  110. name: 'assignment_status',
  111. required: true,
  112. label: 'وضعیت تکلیف',
  113. align: 'left',
  114. field: row => (new SessionAttendanceSheets(row)).assignment_status_info.label
  115. },
  116. {
  117. name: 'attendance_status',
  118. required: true,
  119. label: 'وضعیت حضور و غیاب',
  120. align: 'left',
  121. field: row => (new SessionAttendanceSheets(row)).attendance_status_info.label
  122. },
  123. {
  124. name: 'action',
  125. required: true,
  126. label: 'عملیات',
  127. align: 'left',
  128. field: row => ''
  129. }
  130. ]
  131. },
  132. mounted: false,
  133. createRouteName: ''
  134. }
  135. },
  136. mounted() {
  137. this.mounted = true
  138. this.getClassroom()
  139. .then(classroom => {
  140. this.classroom = new Classroom(classroom)
  141. this.$store.commit('AppLayout/updateBreadcrumbs', {
  142. visible: true,
  143. loading: false,
  144. path: [
  145. {
  146. label: 'دوره های آموزشی',
  147. to: { name: 'Admin.Classroom.Index' }
  148. },
  149. {
  150. label: this.classroom.title,
  151. to: { name: 'Admin.Classroom.Show', params: { id: this.$route.params.classroom_id } }
  152. },
  153. {
  154. label: 'لیست حضور و غیاب',
  155. to: { name: 'Admin.Classroom.Session.AttendanceSheetList', params: { classroom_id: this.$route.params.classroom_id, session_id: this.$route.params.session_id } }
  156. }
  157. ]
  158. })
  159. })
  160. },
  161. methods: {
  162. getClassroom () {
  163. return APIGateway.classroom.get(this.$route.params.classroom_id)
  164. }
  165. }
  166. }
  167. </script>
  168. <style scoped lang="scss">
  169. .AdminContentList {
  170. .more-action {
  171. display: flex;
  172. flex-flow: row;
  173. justify-content: flex-end;
  174. margin-bottom: 10px;
  175. }
  176. }
  177. </style>