Skip to content

Commit ca9d48a

Browse files
committed
add store module to cms example
1 parent 86a3c5f commit ca9d48a

File tree

7 files changed

+700
-1
lines changed

7 files changed

+700
-1
lines changed

examples/cms/routes/app/routes/cms/routes/settings/Index.vue

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ export default {
6363
{
6464
type: 'dynamic',
6565
typeField: 'type',
66+
textModes: {
67+
file: 'file'
68+
},
6669
column: 'value',
6770
text: this.$t('fields.value'),
6871
name: 'value'
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
1+
import Sections from './routes/sections/Index.vue'
2+
import Products from './routes/products/Index.vue'
3+
import TransactionProducts from './routes/transaction-products/Index.vue'
4+
import Transactions from './routes/transactions/Index.vue'
5+
import Customers from './routes/customers/Index.vue'
16

27
let storeRoutes = [
3-
8+
{
9+
path: 'sections',
10+
name: 'store-sections',
11+
component: Sections
12+
},
13+
{
14+
path: 'products',
15+
name: 'store-products',
16+
component: Products
17+
},
18+
{
19+
path: 'transaction-products',
20+
name: 'store-transaction-products',
21+
component: TransactionProducts
22+
},
23+
{
24+
path: 'transactions',
25+
name: 'store-transactions',
26+
component: Transactions
27+
},
28+
{
29+
path: 'customers',
30+
name: 'store-customers',
31+
component: Customers
32+
}
433
]
534

635
export default storeRoutes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
<template>
2+
<crud
3+
:prefix="prefix"
4+
:path="path"
5+
:page-title="pageTitle"
6+
:fields-info="fieldsInfo"
7+
:details-title="$t('detailsTitle')"
8+
deleteMode="hard"
9+
>
10+
</crud>
11+
</template>
12+
13+
<script>
14+
import Crud from '@/utils/crud/components/Crud.vue'
15+
16+
export default {
17+
data () {
18+
return {
19+
prefix: 'crud/store',
20+
path: 'customers',
21+
pageTitle: 'store.customers'
22+
}
23+
},
24+
computed: {
25+
fieldsInfo () {
26+
return [
27+
{
28+
text: this.$t('fields.id'),
29+
name: 'id',
30+
details: false
31+
},
32+
{
33+
type: 'input',
34+
column: 'firstname',
35+
text: this.$t('fields.firstname'),
36+
name: 'firstname',
37+
multiedit: false
38+
},
39+
{
40+
type: 'input',
41+
column: 'lastname',
42+
text: this.$t('fields.lastname'),
43+
name: 'lastname',
44+
multiedit: false
45+
},
46+
{
47+
type: 'checkbox',
48+
column: 'company',
49+
text: this.$t('fields.company'),
50+
name: 'company',
51+
apiObject: {
52+
name: 'company',
53+
functions: ['boolean']
54+
},
55+
textMode: 'html',
56+
required: false
57+
},
58+
{
59+
type: 'input',
60+
column: 'registration_number',
61+
text: this.$t('fields.registration_number'),
62+
name: 'registration_number',
63+
multiedit: false,
64+
required: false
65+
},
66+
{
67+
type: 'input',
68+
column: 'phone',
69+
text: this.$t('fields.phone'),
70+
name: 'phone',
71+
multiedit: false,
72+
required: false
73+
},
74+
{
75+
type: 'input',
76+
column: 'email',
77+
text: this.$t('fields.email'),
78+
name: 'email',
79+
multiedit: false
80+
},
81+
{
82+
type: 'input',
83+
column: 'street',
84+
text: this.$t('fields.street'),
85+
name: 'street',
86+
multiedit: false
87+
},
88+
{
89+
type: 'input',
90+
column: 'zip_code',
91+
text: this.$t('fields.zip_code'),
92+
name: 'zip_code',
93+
multiedit: false
94+
},
95+
{
96+
type: 'input',
97+
column: 'city',
98+
text: this.$t('fields.city'),
99+
name: 'city'
100+
},
101+
{
102+
type: 'input',
103+
column: 'comments',
104+
text: this.$t('fields.comments'),
105+
name: 'comments',
106+
required: false
107+
}
108+
]
109+
}
110+
},
111+
components: {
112+
Crud
113+
},
114+
i18n: {
115+
messages: {
116+
pl: {
117+
detailsTitle: 'Post',
118+
fields: {
119+
id: 'Id',
120+
firstname: 'Imię',
121+
lastname: 'Nazwisko',
122+
company: 'Firma',
123+
registration_number: 'Nr ident.',
124+
phone: 'Tel.',
125+
email: 'E-mail',
126+
street: 'Ulica',
127+
zip_code: 'Kod pocztowy',
128+
city: 'Miejscowość',
129+
comments: 'Komentarze'
130+
}
131+
},
132+
en: {
133+
detailsTitle: 'Post',
134+
fields: {
135+
id: 'Id',
136+
firstname: 'Firstname',
137+
lastname: 'Lastname',
138+
company: 'Company',
139+
registration_number: 'Registr. no',
140+
phone: 'Phone',
141+
email: 'E-mail',
142+
street: 'Street',
143+
zip_code: 'Zip code',
144+
city: 'City',
145+
comments: 'Comments'
146+
}
147+
}
148+
}
149+
}
150+
}
151+
152+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
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

Comments
 (0)