AdminProjectAttendanceSheetShow.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <div class="flex justify-end">
  3. <q-btn flat
  4. color="grey"
  5. @click="$router.go(-1)">
  6. بازگشت
  7. >
  8. </q-btn>
  9. </div>
  10. <entity-show v-if="mounted"
  11. ref="entityShow"
  12. v-model:value="inputs"
  13. title="جزییات پروژه"
  14. :api="api"
  15. :show-close-button="false"
  16. :show-edit-button="false"
  17. :show-expand-button="false"
  18. :show-save-button="false"
  19. :show-index-button="false"
  20. :show-reload-button="false"
  21. :after-load-input-data="afterLoadInputData">
  22. <template #after-form-builder>
  23. <div class="flex justify-end q-mt-md">
  24. <q-btn color="red"
  25. outline
  26. label="انجام نشده"
  27. :loading="loading"
  28. class="q-mr-md"
  29. @click="notVerify" />
  30. <q-btn color="primary"
  31. label="انجام شده"
  32. :loading="loading"
  33. @click="verify" />
  34. </div>
  35. </template>
  36. </entity-show>
  37. </template>
  38. <script>
  39. import { shallowRef } from 'vue'
  40. import { EntityShow } from 'quasar-crud'
  41. import { Project } from 'src/models/Project.js'
  42. import { APIGateway } from 'src/api/APIGateway.js'
  43. import { ProjectAttendanceSheets } from 'src/models/ProjectAttendanceSheets.js'
  44. import ContentsSelector from 'src/components/FormBuilderCustumComponents/ContentsSelector/ContentsSelector.vue'
  45. const ContentsSelectorComp = shallowRef(ContentsSelector)
  46. export default {
  47. name: 'AdminProjectAttendanceSheetShow',
  48. components: {
  49. EntityShow
  50. },
  51. data () {
  52. // const projectId = this.$route.params.project_id
  53. const projectAttendanceSheetsId = this.$route.params.project_attendance_sheets_id
  54. return {
  55. mounted: false,
  56. loading: false,
  57. projectAttendanceSheet: new ProjectAttendanceSheets(),
  58. api: APIGateway.projectAttendanceSheets.APIAdresses.byId(projectAttendanceSheetsId),
  59. inputs: [
  60. { type: 'separator', name: 'space', label: 'مشخصات اندیشه جو', className: 'custom-separator', col: 'col-12' },
  61. { type: 'input', name: 'owner_info.firstname', responseKey: 'owner_info.firstname', label: 'نام', placeholder: ' ', col: 'col-md-6 col-12' },
  62. { type: 'input', name: 'owner_info.lastname', responseKey: 'owner_info.lastname', label: 'نام خانوادگی', placeholder: ' ', col: 'col-md-6 col-12' },
  63. { type: 'separator', name: 'space', label: 'مشخصات پروژه', className: 'custom-separator', col: 'col-12' },
  64. { type: 'input', name: 'project_info.title', responseKey: 'project_info.title', label: 'عنوان پروژه', placeholder: ' ', col: 'col-md-9 col-12' },
  65. {
  66. type: 'select',
  67. name: 'project_info.type',
  68. responseKey: 'project_info.type',
  69. label: 'نوع پروژه',
  70. options: (new Project()).typeEnums,
  71. placeholder: ' ',
  72. col: 'col-md-3 col-12'
  73. },
  74. { type: 'inputEditor', name: 'project_info.description', responseKey: 'project_info.description', label: 'توضیحات پروژه', placeholder: ' ', col: 'col-12' },
  75. { type: 'separator', name: 'space', label: 'پاسخ اندیشه چو', className: 'custom-separator', col: 'col-12' },
  76. { type: 'inputEditor', name: 'answer_text', responseKey: 'answer_text', label: 'پاسخ کاربر', placeholder: ' ', col: 'col-12' },
  77. { type: 'file', name: 'answer_attachment', responseKey: 'answer_attachment', label: 'فایل ضمیمه کاربر', placeholder: ' ', col: 'col-md-3 col-12' },
  78. {
  79. type: 'select',
  80. name: 'answer_status',
  81. responseKey: 'answer_status',
  82. label: 'وضعیت',
  83. options: (new ProjectAttendanceSheets()).answer_statusEnums,
  84. placeholder: ' ',
  85. col: 'col-md-3 col-12'
  86. },
  87. {
  88. type: 'select',
  89. name: 'is_answer_verified',
  90. responseKey: 'is_answer_verified',
  91. label: 'نتیجه',
  92. options: (new ProjectAttendanceSheets()).is_answer_verifiedEnums,
  93. placeholder: ' ',
  94. col: 'col-md-3 col-12'
  95. },
  96. { type: 'separator', name: 'space', size: '0', col: 'col-md-12' },
  97. { type: ContentsSelectorComp, name: 'project_info.contents_info', responseKey: 'project_info.contents_info', col: 'col-12' },
  98. { type: 'inputEditor', name: 'project_info.correct_answer', responseKey: 'project_info.correct_answer', label: 'پاسخ صحیح', placeholder: ' ', col: 'col-12' }
  99. // { type: 'dateTime', name: 'beginning_doing_period', responseKey: 'beginning_doing_period', label: 'زمان شروع', placeholder: ' ', col: 'col-md-6 col-12' },
  100. // { type: 'dateTime', name: 'ending_doing_period', responseKey: 'ending_doing_period', label: 'زمان پایان', placeholder: ' ', col: 'col-md-6 col-12' },
  101. // { type: 'hidden', name: 'id', responseKey: 'id' },
  102. // { type: 'hidden', name: 'classroom', responseKey: 'classroom' }
  103. ]
  104. }
  105. },
  106. mounted () {
  107. this.mounted = true
  108. },
  109. methods: {
  110. afterLoadInputData (data) {
  111. this.projectAttendanceSheet = new ProjectAttendanceSheets(data)
  112. },
  113. reloadData () {
  114. this.$refs.entityShow.getData()
  115. },
  116. verify () {
  117. this.loading = true
  118. APIGateway.projectAttendanceSheets.verify(this.$route.params.project_attendance_sheets_id)
  119. .then(() => {
  120. this.loading = false
  121. // this.reloadData()
  122. this.$router.go(-1)
  123. })
  124. .catch(() => {
  125. this.loading = false
  126. this.reloadData()
  127. })
  128. },
  129. notVerify () {
  130. this.loading = true
  131. APIGateway.projectAttendanceSheets.notVerify(this.$route.params.project_attendance_sheets_id)
  132. .then(() => {
  133. this.loading = false
  134. // this.reloadData()
  135. this.$router.go(-1)
  136. })
  137. .catch(() => {
  138. this.loading = false
  139. this.reloadData()
  140. })
  141. }
  142. }
  143. }
  144. </script>