AdminSessionTemplateShow.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div class="AdminSessionTemplateShow"
  3. :style="localOptions.style">
  4. <entity-edit v-if="mounted"
  5. ref="entityEdit"
  6. v-model:value="inputs"
  7. title="اطلاعات کاربری"
  8. :api="api"
  9. :entity-id-key="entityIdKey"
  10. :entity-param-key="entityParamKey"
  11. :show-route-name="showRouteName"
  12. :show-close-button="false"
  13. :show-edit-button="false"
  14. :show-expand-button="false"
  15. :show-save-button="false"
  16. :show-reload-button="false"
  17. :redirect-after-edit="false"
  18. :after-load-input-data="afterLoadInputData" />
  19. </div>
  20. </template>
  21. <script>
  22. import { EntityEdit } from 'quasar-crud'
  23. import { mixinWidget } from 'src/mixin/Mixins.js'
  24. import { APIGateway } from 'src/api/APIGateway.js'
  25. export default {
  26. name: 'AdminSessionTemplateShow',
  27. components: {
  28. EntityEdit
  29. },
  30. mixins: [mixinWidget],
  31. data: () => {
  32. return {
  33. mounted: false,
  34. entityLoading: true,
  35. api: null,
  36. entityIdKey: 'id',
  37. entityParamKey: 'id',
  38. showRouteName: 'Admin.Content.Show',
  39. indexRouteName: 'Admin.Content.List',
  40. inputs: [
  41. { type: 'input', name: 'title', responseKey: 'title', label: 'نام جلسه', placeholder: ' ', col: 'col-md-9 col-12' },
  42. { type: 'separator', name: 'space', size: '0', col: 'col-12' },
  43. { type: 'dateTime', name: 'ending_enrollment_period', responseKey: 'ending_enrollment_period', label: 'زمان شروع جلسه', placeholder: ' ', col: 'col-md-6 col-12' },
  44. { type: 'dateTime', name: 'ending_enrollment_period', responseKey: 'ending_enrollment_period', label: 'زمان پایان جلسه', placeholder: ' ', col: 'col-md-6 col-12' },
  45. { type: 'inputEditor', name: 'description', responseKey: 'description', label: 'توضیحات', placeholder: ' ', col: 'col-md-6 col-12' },
  46. { type: 'inputEditor', name: 'syllabus', responseKey: 'syllabus', label: 'مقرری', placeholder: ' ', col: 'col-md-6 col-12' },
  47. { type: 'inputEditor', name: 'assignment_description', responseKey: 'assignment_description', label: 'تکلیف جلسه', placeholder: ' ', col: 'col-12' },
  48. { type: 'hidden', name: 'id', responseKey: 'id', label: 'id', col: 'col-12' }
  49. ]
  50. }
  51. },
  52. created() {
  53. this.api = APIGateway.sessionTemplate.APIAdresses.byId(this.$route.params.id)
  54. },
  55. mounted() {
  56. this.setActionBtn()
  57. this.mounted = true
  58. },
  59. methods: {
  60. setActionBtn () {
  61. this.inputs.forEach((item, index) => {
  62. if (item.name === 'btn') {
  63. this.inputs[index].atClick = this.edit
  64. }
  65. })
  66. },
  67. afterLoadInputData () {
  68. this.entityLoading = false
  69. },
  70. edit() {
  71. this.entityLoading = true
  72. this.$refs.entityEdit.editEntity(false)
  73. .then(() => {
  74. this.$refs.entityEdit.getData()
  75. this.entityLoading = false
  76. })
  77. .catch(() => {
  78. this.$refs.entityEdit.getData()
  79. this.entityLoading = false
  80. })
  81. }
  82. }
  83. }
  84. </script>
  85. <style scoped lang="scss">
  86. .AdminSessionTemplateShow {
  87. .title {
  88. font-style: normal;
  89. font-weight: 700;
  90. font-size: 24px;
  91. line-height: 140%;
  92. color: #424242;
  93. margin-bottom: 27px;
  94. display: flex;
  95. flex-flow: row;
  96. position: relative;
  97. .static-title {
  98. }
  99. .dynamic-title {
  100. }
  101. .back-action {
  102. position: absolute;
  103. right: 0;
  104. top: 0;
  105. }
  106. }
  107. :deep(.form) {
  108. padding: 24px;
  109. }
  110. }
  111. </style>