Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
K
kiaisoft_tuananh_nuxt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TTS Tran Viet Anh
kiaisoft_tuananh_nuxt
Commits
7ae0989e
Commit
7ae0989e
authored
Feb 15, 2023
by
TTS Kieu Tuan Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add search
parent
6cc1f845
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
107 deletions
+126
-107
Navbar.vue
components/Navbar.vue
+4
-4
index.vue
pages/categories/index.vue
+62
-77
index.vue
pages/products/index.vue
+60
-26
No files found.
components/Navbar.vue
View file @
7ae0989e
...
...
@@ -9,28 +9,28 @@
<v-app-bar-nav-icon
/>
<v-toolbar-title>
<v-btn
href
=
"/users"
>
<v-btn
to
=
"/users"
>
<span>
USER
</span>
<v-icon
dense
>
mdi-account
</v-icon>
</v-btn>
<v-btn
href
=
"/categories"
>
<v-btn
to
=
"/categories"
>
<span>
CATEGORY
</span>
<v-icon
dense
>
mdi-heart
</v-icon>
</v-btn>
<v-btn
href
=
"/products"
>
<v-btn
to
=
"/products"
>
<span>
PRODUCT
</span>
<v-icon
dense
>
mdi-briefcase
</v-icon>
</v-btn>
<v-btn
href
=
"/posts"
>
<v-btn
to
=
"/posts"
>
<span>
POST
</span>
<v-icon
dense
>
mdi-newspaper
...
...
pages/categories/index.vue
View file @
7ae0989e
...
...
@@ -37,16 +37,16 @@
/>
</v-col>
<v-col
cols=
"12"
>
<
!-- <v-select
v-model="eParentId"
:items="
categories.filter((category) => category.id !== eID)
"
item-text="name"
item-value="id"
label="Parent"
/> --
>
<v-card
class=
"mx-auto"
max-width=
"500"
dark
>
<
v-autocomplete
v-model=
"eParentId"
:items=
"
categories.filter((category) => category.id !== eID)
"
item-text=
"name"
item-value=
"id"
label=
"Parent"
/
>
<
!-- <
v-card class="mx-auto" max-width="500" dark>
<v-sheet>
<v-text-field
v-model="search"
...
...
@@ -76,30 +76,31 @@
/>
</v-card-text>
</v-card>
</v-col>
<v-col
cols=
"12"
>
<v-file-input
v-model=
"eImage"
accept=
"image/*"
label=
"Image"
prepend-icon=
"mdi-camera"
@
change=
"fileSelected"
/>
</v-col>
<v-col
cols=
"12"
>
<img
v-if=
"file"
:src=
"file"
>
</v-col>
<v-col
cols=
"12"
text-align=
" left"
>
<v-img
v-if=
"typeof eImage === 'string'"
contain
height=
"100px"
width=
"150px"
:src=
"eImage"
/>
</v-col> -->
<v-col
cols=
"12"
>
<v-file-input
v-model=
"eImage"
accept=
"image/*"
label=
"Image"
prepend-icon=
"mdi-camera"
@
change=
"fileSelected"
/>
</v-col>
<v-col
cols=
"12"
>
<img
v-if=
"file"
:src=
"file"
>
</v-col>
<v-col
cols=
"12"
text-align=
" left"
>
<v-img
v-if=
"typeof eImage === 'string'"
contain
height=
"100px"
width=
"150px"
:src=
"eImage"
/>
</v-col>
</v-col>
</v-row>
</v-form>
...
...
@@ -180,17 +181,19 @@
required
/>
</v-col>
<
!-- <
v-col cols="12">
<v-
select
<v-col
cols=
"12"
>
<v-
autocomplete
v-model=
"parent_id"
:items=
"categories"
:search=
"search"
:filter=
"filter"
item-text=
"name"
item-value=
"id"
label=
"Parent*"
:rules=
"requiredRules"
/>
</v-col>
-->
<v-col
cols=
"12"
>
</v-col>
<
!-- <
v-col cols="12">
<v-card class="mx-auto" max-width="500" dark>
<v-sheet>
<v-text-field
...
...
@@ -220,7 +223,7 @@
/>
</v-card-text>
</v-card>
</v-col>
</v-col>
-->
<v-col
cols=
"12"
>
<v-file-input
v-model=
"image"
...
...
@@ -384,7 +387,7 @@ export default {
open
:
[
1
,
2
],
search
:
null
,
file
:
null
,
parent_id
:
[]
,
parent_id
:
''
,
name
:
''
,
ordering
:
''
,
image
:
null
,
...
...
@@ -417,7 +420,7 @@ export default {
eID
:
''
,
eName
:
''
,
eOrdering
:
''
,
eParentId
:
[]
,
eParentId
:
''
,
eImage
:
null
,
message
:
[],
editedIndex
:
-
1
,
...
...
@@ -458,10 +461,6 @@ export default {
numberRules
:
[
v
=>
!!
v
||
'
This field is required
'
,
v
=>
v
>
0
||
'
value must be a positive integer
'
],
singleRules
:
[
v
=>
!!
v
||
'
This field is required
'
,
v
=>
v
.
length
<
2
||
'
Chose 1 pls -____-
'
]
}
},
...
...
@@ -481,20 +480,6 @@ export default {
},
dialogDelete
(
val
)
{
val
||
this
.
closeDelete
()
},
eParentId
:
function
()
{
if
(
this
.
eParentId
.
length
>
1
)
{
this
.
$toast
.
error
(
'
please chose 1 -___-!
'
,
{
duration
:
3000
})
}
},
parent_id
:
function
()
{
if
(
this
.
parent_id
.
length
>
1
)
{
this
.
$toast
.
error
(
'
please chose 1 -___-!
'
,
{
duration
:
3000
})
}
}
},
created
()
{
...
...
@@ -644,7 +629,7 @@ export default {
this
.
eID
=
item
.
id
this
.
eName
=
item
.
name
this
.
eOrdering
=
item
.
ordering
this
.
eParentId
.
push
(
item
.
parent_id
)
this
.
eParentId
=
item
.
parent_id
this
.
eImage
=
item
.
image
this
.
editedIndex
=
this
.
categories
.
indexOf
(
item
)
console
.
log
(
this
.
eID
)
...
...
@@ -685,13 +670,13 @@ export default {
}
},
clearData () {
this.parent_id
.length = 0
this.parent_id
= ''
this.name = ''
this.ordering = ''
this.image = null
},
clearEditData () {
this.eParentId
.length = 0
this.eParentId
= ''
this.eName = ''
this.eOrdering = ''
this.eImage = null
...
...
@@ -706,22 +691,22 @@ export default {
},
clearFile () {
this.file = null
},
onOpen (e) {
if (!this.__initial) {
this.__initial = true
return
}
// this.eParentId.length = 0
console.log('toggle arrow clicked', e)
},
selectCategory (e) {
console.log(e[0])
console.log(this.eParentId)
// this.eParentId.length = 0
// this.eParentId.push(e[0])
}
// onOpen (e) {
// if (!this.__initial) {
// this.__initial = true
// return
// }
// // this.eParentId.length = 0
// console.log('toggle arrow clicked', e)
// },
// selectCategory (e) {
// console.log(e[0])
// console.log(this.eParentId)
// // this.eParentId.length = 0
// // this.eParentId.push(e[0])
// }
}
}
</
script
>
...
...
pages/products/index.vue
View file @
7ae0989e
...
...
@@ -174,13 +174,20 @@
@
click:clear=
"clearImage"
/>
</v-col>
<v-col
v-if=
"files"
cols=
"12"
>
<v-col
v-for=
"(image, index) in files"
:key=
"index"
cols=
"12"
>
<v-img
:src=
"image"
contain
height=
"100px"
width=
"150px"
display:flex
/>
</v-col>
<v-col
v-if=
"files"
cols=
"12"
style=
"display:flex; text-align:left"
>
<v-img
v-for=
"(image, index) in files"
:key=
"index"
:src=
"image"
contain
height=
"100px"
width=
"150px"
/>
</v-col>
<v-col
v-for=
"(imageEdit, index) in eImages"
:key=
"index"
cols=
"12"
text-align=
" left"
style=
"display:flex"
>
<v-col
cols=
"12"
style=
"display:flex; text-align:left"
>
<v-img
v-for=
"(imageEdit, index) in eImages"
:key=
"index"
contain
height=
"100px"
width=
"150px"
...
...
@@ -400,10 +407,15 @@
@
click:clear=
"clearImage"
/>
</v-col>
<v-col
v-if=
"files"
cols=
"12"
>
<v-col
v-for=
"(image, index) in files"
:key=
"index"
cols=
"12"
>
<v-img
:src=
"image"
contain
/>
</v-col>
<v-col
v-if=
"files"
cols=
"12"
style=
"display:flex; text-align:left"
>
<v-img
v-for=
"(image, index) in files"
:key=
"index"
:src=
"image"
contain
height=
"100px"
width=
"150px"
/>
</v-col>
<v-col
cols=
"12"
>
<v-btn
...
...
@@ -596,6 +608,7 @@ export default {
products
:
[],
product
:
[],
categories
:
[],
categoryTrees
:
[],
sName
:
''
,
sCategoryId
:
''
,
sPrice
:
''
,
...
...
@@ -632,7 +645,8 @@ export default {
category_id
:
''
,
price
:
''
,
description
:
''
,
stock
:
''
stock
:
''
,
variants_count
:
''
},
defaultItem
:
{
name
:
''
,
...
...
@@ -675,6 +689,7 @@ export default {
this
.
initialize
()
this
.
getProducts
()
this
.
getCategories
()
this
.
getCategoryTrees
()
},
methods
:
{
initialize
()
{
...
...
@@ -732,6 +747,22 @@ export default {
}
this
.
close
()
},
getCategoryTrees
()
{
this
.
$axios
.
get
(
'
/categories-tree/
'
,
{
headers
:
{
Authorization
:
`Bearer
${
this
.
$auth
.
$storage
.
getUniversal
(
'
token
'
)}
`
}
})
.
then
((
response
)
=>
{
this
.
categoryTrees
=
response
.
data
.
data
})
.
catch
(
function
(
error
)
{
console
.
log
(
error
)
})
},
getCategories
()
{
this
.
$axios
.
get
(
'
/categories/
'
,
{
...
...
@@ -785,6 +816,7 @@ export default {
duration
:
3000
})
this
.
editedItem
=
response
.
data
.
data
this
.
editedItem
.
variants_count
=
response
.
data
.
data
.
variants
.
length
console
.
log
(
this
.
editedItem
)
this
.
products
.
push
(
this
.
editedItem
)
this
.
clearData
()
...
...
@@ -973,24 +1005,26 @@ export default {
const self = this
const fd = new FormData()
fd.append('status', status)
try {
this.$axios
.post(`
/
products
/
update
-
status
/
$
{
item
.
id
}
`,
fd, {
headers: {
Authorization: `
Bearer
$
{
this
.
$auth
.
$storage
.
getUniversal
(
'
token
'
)}
`
}
this.$axios
.post(`
/
products
/
update
-
status
/
$
{
item
.
id
}
`,
fd, {
headers: {
Authorization: `
Bearer
$
{
this
.
$auth
.
$storage
.
getUniversal
(
'
token
'
)}
`
}
)
.then((response) => {
console.log(response)
self.$toast.success('Updated status successfully!', {
duration: 3000
})
}
)
.then((response) => {
console.log(response)
self.$toast.success('Updated status successfully!', {
duration: 3000
})
} catch (error) {
console.log(error)
}
})
.catch((error) => {
console.log(error)
self.$toast.error('ERR!', {
duration: 3000
})
})
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment