|
| 1 | +<template> |
| 2 | + <crud |
| 3 | + :prefix="prefix" |
| 4 | + :path="path" |
| 5 | + :paths="paths" |
| 6 | + :page-title="pageTitle" |
| 7 | + :fields-info="fieldsInfo" |
| 8 | + :details-title="$t('detailsTitle')" |
| 9 | + deleteMode="both" |
| 10 | + > |
| 11 | + </crud> |
| 12 | +</template> |
| 13 | + |
| 14 | +<script> |
| 15 | +import Crud from '@/utils/crud/components/Crud.vue' |
| 16 | +
|
| 17 | +export default { |
| 18 | + data () { |
| 19 | + return { |
| 20 | + prefix: 'crud/store', |
| 21 | + path: 'products', |
| 22 | + paths: { |
| 23 | + i: 'store/products', |
| 24 | + st: 'store/products', |
| 25 | + u: 'store/products' |
| 26 | + }, |
| 27 | + pageTitle: 'store.products' |
| 28 | + } |
| 29 | + }, |
| 30 | + computed: { |
| 31 | + fieldsInfo () { |
| 32 | + return [ |
| 33 | + { |
| 34 | + text: this.$t('fields.id'), |
| 35 | + name: 'id', |
| 36 | + details: false |
| 37 | + }, |
| 38 | + { |
| 39 | + type: 'input', |
| 40 | + column: 'name', |
| 41 | + text: this.$t('fields.name'), |
| 42 | + name: 'name', |
| 43 | + multiedit: false |
| 44 | + }, |
| 45 | + { |
| 46 | + type: 'input', |
| 47 | + column: 'slug', |
| 48 | + text: this.$t('fields.slugWithDescription'), |
| 49 | + name: 'slug', |
| 50 | + multiedit: false, |
| 51 | + required: false, |
| 52 | + table: false |
| 53 | + }, |
| 54 | + { |
| 55 | + text: this.$t('fields.slug'), |
| 56 | + name: 'slug', |
| 57 | + details: false |
| 58 | + }, |
| 59 | + { |
| 60 | + type: 'select', |
| 61 | + url: 'crud/store/sections', |
| 62 | + list: { |
| 63 | + value: 'id', |
| 64 | + text: 'name', |
| 65 | + data: [] |
| 66 | + }, |
| 67 | + column: 'section_id', |
| 68 | + text: this.$t('fields.section'), |
| 69 | + name: 'section_id', |
| 70 | + apiObject: { |
| 71 | + name: 'section.name' |
| 72 | + } |
| 73 | + }, |
| 74 | + { |
| 75 | + type: 'textarea', |
| 76 | + column: 'description', |
| 77 | + text: this.$t('fields.description'), |
| 78 | + name: 'description', |
| 79 | + multiedit: false |
| 80 | + }, |
| 81 | + { |
| 82 | + type: 'file', |
| 83 | + column: 'image', |
| 84 | + text: this.$t('fields.image'), |
| 85 | + name: 'image', |
| 86 | + multiedit: false, |
| 87 | + required: false, |
| 88 | + textMode: 'file' |
| 89 | + }, |
| 90 | + { |
| 91 | + type: 'file', |
| 92 | + column: 'thumbnail', |
| 93 | + text: this.$t('fields.thumbnail'), |
| 94 | + name: 'thumbnail', |
| 95 | + multiedit: false, |
| 96 | + textMode: 'file' |
| 97 | + }, |
| 98 | + { |
| 99 | + type: 'decimal', |
| 100 | + column: 'price', |
| 101 | + text: this.$t('fields.price'), |
| 102 | + name: 'price' |
| 103 | + }, |
| 104 | + { |
| 105 | + type: 'number', |
| 106 | + column: 'quantity', |
| 107 | + text: this.$t('fields.quantity'), |
| 108 | + name: 'quantity', |
| 109 | + multiedit: false |
| 110 | + } |
| 111 | + ] |
| 112 | + } |
| 113 | + }, |
| 114 | + components: { |
| 115 | + Crud |
| 116 | + }, |
| 117 | + i18n: { |
| 118 | + messages: { |
| 119 | + pl: { |
| 120 | + detailsTitle: 'Produkt', |
| 121 | + fields: { |
| 122 | + id: 'Id', |
| 123 | + name: 'Nazwa', |
| 124 | + slug: 'Slug', |
| 125 | + slugWithDescription: 'Slug (zostaw puste, jeżeli ma się utworzyć na podstawie nazwy)', |
| 126 | + description: 'Opis', |
| 127 | + section: 'Kategoria', |
| 128 | + image: 'Obraz', |
| 129 | + thumbnail: 'Miniatura', |
| 130 | + price: 'Cena', |
| 131 | + quantity: 'Ilość' |
| 132 | + } |
| 133 | + }, |
| 134 | + en: { |
| 135 | + detailsTitle: 'Product', |
| 136 | + fields: { |
| 137 | + id: 'Id', |
| 138 | + name: 'Name', |
| 139 | + slug: 'Slug', |
| 140 | + slugWithDescription: 'Slug (leave if it must be created from name)', |
| 141 | + description: 'Description', |
| 142 | + section: 'section', |
| 143 | + image: 'Image', |
| 144 | + thumbnail: 'Thumbnail', |
| 145 | + price: 'Price', |
| 146 | + quantity: 'Quantity' |
| 147 | + } |
| 148 | + } |
| 149 | + } |
| 150 | + } |
| 151 | +} |
| 152 | +
|
| 153 | +</script> |
0 commit comments