AdminProjectAttendanceSheetShow.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. <entity-edit v-if="mounted"
  38. ref="entityEdit"
  39. v-model:value="editInputs"
  40. title="توضیحات تصحیح"
  41. :api="api"
  42. :show-close-button="false"
  43. :show-edit-button="false"
  44. :show-expand-button="false"
  45. :show-save-button="false"
  46. :show-index-button="false"
  47. :show-reload-button="false"
  48. :after-load-input-data="afterLoadInputData">
  49. <template #after-form-builder>
  50. <div class="flex justify-end q-mt-md">
  51. <q-btn color="primary"
  52. label="ثبت توضیحات"
  53. :loading="loading"
  54. @click="saveNotation" />
  55. </div>
  56. </template>
  57. </entity-edit>
  58. </template>
  59. <script>
  60. import { shallowRef } from 'vue'
  61. import { EntityShow, EntityEdit } from 'quasar-crud'
  62. import { Project } from 'src/models/Project.js'
  63. import { APIGateway } from 'src/api/APIGateway.js'
  64. import { ProjectAttendanceSheets } from 'src/models/ProjectAttendanceSheets.js'
  65. import ContentsSelector from 'src/components/FormBuilderCustumComponents/ContentsSelector/ContentsSelector.vue'
  66. const ContentsSelectorComp = shallowRef(ContentsSelector)
  67. export default {
  68. name: 'AdminProjectAttendanceSheetShow',
  69. components: {
  70. EntityShow,
  71. EntityEdit
  72. },
  73. data () {
  74. // const projectId = this.$route.params.project_id
  75. const projectAttendanceSheetsId = this.$route.params.project_attendance_sheets_id
  76. return {
  77. mounted: false,
  78. loading: false,
  79. projectAttendanceSheet: new ProjectAttendanceSheets(),
  80. api: APIGateway.projectAttendanceSheets.APIAdresses.byId(projectAttendanceSheetsId),
  81. inputs: [
  82. { type: 'separator', name: 'space', label: 'مشخصات اندیشه جو', className: 'custom-separator', col: 'col-12' },
  83. { type: 'input', name: 'owner_info.firstname', responseKey: 'owner_info.firstname', label: 'نام', placeholder: ' ', col: 'col-md-6 col-12' },
  84. { type: 'input', name: 'owner_info.lastname', responseKey: 'owner_info.lastname', label: 'نام خانوادگی', placeholder: ' ', col: 'col-md-6 col-12' },
  85. { type: 'separator', name: 'space', label: 'مشخصات پروژه', className: 'custom-separator', col: 'col-12' },
  86. { type: 'input', name: 'project_info.title', responseKey: 'project_info.title', label: 'عنوان پروژه', placeholder: ' ', col: 'col-md-9 col-12' },
  87. {
  88. type: 'select',
  89. name: 'project_info.type',
  90. responseKey: 'project_info.type',
  91. label: 'نوع پروژه',
  92. options: (new Project()).typeEnums,
  93. placeholder: ' ',
  94. col: 'col-md-3 col-12'
  95. },
  96. { type: 'inputEditor', name: 'project_info.description', responseKey: 'project_info.description', label: 'توضیحات پروژه', placeholder: ' ', col: 'col-12' },
  97. { type: 'separator', name: 'space', label: 'پاسخ اندیشه چو', className: 'custom-separator', col: 'col-12' },
  98. { type: 'inputEditor', name: 'answer_text', responseKey: 'answer_text', label: 'پاسخ کاربر', placeholder: ' ', col: 'col-12' },
  99. { type: 'file', name: 'answer_attachment', responseKey: 'answer_attachment', label: 'فایل ضمیمه کاربر', placeholder: ' ', col: 'col-md-3 col-12' },
  100. {
  101. type: 'select',
  102. name: 'answer_status',
  103. responseKey: 'answer_status',
  104. label: 'وضعیت',
  105. options: (new ProjectAttendanceSheets()).answer_statusEnums,
  106. placeholder: ' ',
  107. col: 'col-md-3 col-12'
  108. },
  109. {
  110. type: 'select',
  111. name: 'is_answer_verified',
  112. responseKey: 'is_answer_verified',
  113. label: 'نتیجه',
  114. options: (new ProjectAttendanceSheets()).is_answer_verifiedEnums,
  115. placeholder: ' ',
  116. col: 'col-md-3 col-12'
  117. },
  118. { type: 'separator', name: 'space', size: '0', col: 'col-md-12' },
  119. { type: ContentsSelectorComp, name: 'project_info.contents_info', responseKey: 'project_info.contents_info', col: 'col-12' },
  120. { type: 'inputEditor', name: 'project_info.correct_answer', responseKey: 'project_info.correct_answer', label: 'پاسخ صحیح', placeholder: ' ', col: 'col-12' },
  121. { type: 'inputEditor', name: 'notation', responseKey: 'notation', label: 'توضیحات تصحیح کننده', placeholder: ' ', col: 'col-12' }
  122. ],
  123. editInputs: [
  124. { type: 'inputEditor', name: 'notation', responseKey: 'notation', label: 'توضیحات تصحیح کننده', placeholder: ' ', col: 'col-12' }
  125. ]
  126. }
  127. },
  128. mounted () {
  129. this.mounted = true
  130. },
  131. methods: {
  132. afterLoadInputData (data) {
  133. this.projectAttendanceSheet = new ProjectAttendanceSheets(data)
  134. },
  135. reloadData () {
  136. this.$refs.entityShow.getData()
  137. },
  138. verify () {
  139. this.loading = true
  140. APIGateway.projectAttendanceSheets.verify(this.$route.params.project_attendance_sheets_id)
  141. .then(() => {
  142. this.loading = false
  143. // this.reloadData()
  144. this.$router.go(-1)
  145. })
  146. .catch(() => {
  147. this.loading = false
  148. this.reloadData()
  149. })
  150. },
  151. notVerify () {
  152. this.loading = true
  153. APIGateway.projectAttendanceSheets.notVerify(this.$route.params.project_attendance_sheets_id)
  154. .then(() => {
  155. this.loading = false
  156. // this.reloadData()
  157. this.$router.go(-1)
  158. })
  159. .catch(() => {
  160. this.loading = false
  161. this.reloadData()
  162. })
  163. }
  164. }
  165. }
  166. </script>