| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
- <div class="AdminContentList"
- :style="localOptions.style">
- <div class="more-action">
- <q-btn label="محتوای جدید"
- color="primary"
- :to="{name: 'Admin.Content.Create'}" />
- </div>
- <entity-index v-if="mounted"
- v-model:value="inputs"
- title="لیست محتواها"
- :api="api"
- :table="table"
- :table-keys="tableKeys"
- :create-route-name="createRouteName"
- :show-search-button="false"
- :show-expand-button="false"
- :show-reload-button="false">
- <template #entity-index-table-cell="{inputData}">
- <template v-if="inputData.col.name === 'number'">
- {{ inputData.rowNumber }}
- </template>
- <template v-else-if="inputData.col.name === 'thumbnail'">
- <q-img :src="inputData.col.value"
- width="100px" />
- </template>
- <template v-else-if="inputData.col.name === 'action'">
- <q-btn color="primary"
- :to="{name: 'Admin.Content.Show', params: {id: inputData.props.row.id}}">
- مشاهده جزییات
- </q-btn>
- </template>
- <template v-else>
- {{ inputData.col.value }}
- </template>
- </template>
- </entity-index>
- </div>
- </template>
- <script>
- import { EntityIndex } from 'quasar-crud'
- import { mixinWidget } from 'src/mixin/Mixins.js'
- import { APIGateway } from 'src/api/APIGateway.js'
- export default {
- name: 'AdminContentList',
- components: { EntityIndex },
- mixins: [mixinWidget],
- data: () => {
- return {
- api: APIGateway.content.APIAdresses.base,
- tableKeys: {
- data: 'results',
- total: 'count',
- currentPage: 'current',
- perPage: 'per_page',
- pageKey: 'page'
- },
- inputs: [],
- table: {
- columns: [
- {
- name: 'number',
- required: true,
- label: 'شماره',
- align: 'left',
- field: () => ''
- },
- {
- name: 'thumbnail',
- required: true,
- label: 'تصویر',
- align: 'left',
- field: row => row.thumbnail
- },
- {
- name: 'title',
- required: true,
- label: 'عنوان',
- align: 'left',
- field: row => row.title
- },
- {
- name: 'category_info',
- required: true,
- label: 'دسته',
- align: 'left',
- field: row => row.category_info?.title
- },
- {
- name: 'action',
- required: true,
- label: 'جزییات',
- align: 'left',
- field: row => ''
- }
- ]
- },
- mounted: false,
- createRouteName: ''
- }
- },
- mounted() {
- this.mounted = true
- }
- }
- </script>
- <style scoped lang="scss">
- .AdminContentList {
- .more-action {
- display: flex;
- flex-flow: row;
- justify-content: flex-end;
- margin-bottom: 10px;
- }
- }
- </style>
|