create.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. <div class="ddd">
  11. <entity-create v-if="mounted"
  12. ref="classroomEntityCreate"
  13. v-model:value="inputs"
  14. title="مشخصات دسته بندی"
  15. :api="api"
  16. :entity-id-key="entityIdKey"
  17. :entity-param-key="entityParamKey"
  18. :show-route-name="showRouteName"
  19. :show-close-button="false"
  20. :show-edit-button="false"
  21. :show-expand-button="false"
  22. :show-save-button="false"
  23. :show-reload-button="false"
  24. @onInputClick="onInputClick">
  25. <template #after-form-builder>
  26. <div class="row q-col-gutter-md q-mb-md">
  27. <div class="col-md-3">
  28. <q-input v-model="newUnitName"
  29. label="درس ها"
  30. :disable="true" />
  31. </div>
  32. <div class="col-md-3">
  33. <q-input v-model="newUnitSessionCount"
  34. label="تعداد جلسات"
  35. type="number"
  36. :disable="true" />
  37. </div>
  38. <div class="col-md-3">
  39. <q-btn color="primary"
  40. label="افزودن"
  41. :disable="true" />
  42. </div>
  43. </div>
  44. </template>
  45. </entity-create>
  46. </div>
  47. </template>
  48. <script>
  49. import { shallowRef } from 'vue'
  50. import { EntityCreate } from 'quasar-crud'
  51. import { APIGateway } from 'src/api/APIGateway.js'
  52. import BtnControl from 'src/components/Control/btn.vue'
  53. const BtnControlComp = shallowRef(BtnControl)
  54. export default {
  55. name: 'Admin.Classroom.Create',
  56. components: {
  57. EntityCreate
  58. },
  59. data () {
  60. return {
  61. mounted: false,
  62. newUnitLoading: false,
  63. newUnitName: null,
  64. newUnitSessionCount: null,
  65. api: APIGateway.unitCategory.APIAdresses.base,
  66. entityIdKey: 'id',
  67. entityParamKey: 'id',
  68. showRouteName: 'Admin.Category.Show',
  69. inputs: [
  70. { type: 'input', name: 'title', responseKey: 'title', label: 'نام دسته بندی', col: 'col-md-6' },
  71. { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'تایید', col: 'col-md-6' }
  72. ]
  73. }
  74. },
  75. mounted() {
  76. this.mounted = true
  77. },
  78. methods: {
  79. onInputClick (data) {
  80. if (data.input.name !== 'btn') {
  81. return
  82. }
  83. this.$refs.classroomEntityCreate.createEntity()
  84. }
  85. }
  86. }
  87. </script>