create.vue 2.3 KB

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