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
e9fccad2
Commit
e9fccad2
authored
Jan 18, 2023
by
TTS Kieu Tuan Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove ;
parent
5b7e2bf2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
32 deletions
+39
-32
products.vue
pages/home/products.vue
+39
-32
No files found.
pages/home/products.vue
View file @
e9fccad2
...
@@ -12,17 +12,23 @@
...
@@ -12,17 +12,23 @@
<b-modal
id=
"modal-create"
title=
"create Product"
class=
"modal fade"
>
<b-modal
id=
"modal-create"
title=
"create Product"
class=
"modal fade"
>
<div
class=
"w-full mt-4 p-10"
>
<div
class=
"w-full mt-4 p-10"
>
<form
>
<form
>
<label>
Name :
</label>
<label
for=
"input-live"
>
Name :
</label>
<input
<b-form-input
id=
"input-live"
type=
"text"
type=
"text"
class=
"form-control mb-2"
class=
"form-control mb-2"
placeholder=
"name"
placeholder=
"name"
aria-describedby=
"input-live-help input-live-feedback"
v-model=
"name"
v-model=
"name"
max=
"255"
max=
"255"
min=
"1"
min=
"1"
size=
"sm"
:state=
"nameState"
required
trim
/>
>
</b-form-input>
<b-form-invalid-feedback
id=
"input-live-feedback"
>
Enter at least 3 letters
</b-form-invalid-feedback>
<label>
Category ID :
</label>
<label>
Category ID :
</label>
<b-form-select
v-model=
"category_id"
>
<b-form-select
v-model=
"category_id"
>
<option
v-for=
"item in categories"
:value=
"item.id"
>
<option
v-for=
"item in categories"
:value=
"item.id"
>
...
@@ -388,8 +394,7 @@ export default {
...
@@ -388,8 +394,7 @@ export default {
{
{
color
:
""
,
color
:
""
,
size
:
""
,
size
:
""
,
quantity
:
""
,
quantity
:
""
,
},
},
],
],
message
:
[],
message
:
[],
...
@@ -416,6 +421,9 @@ export default {
...
@@ -416,6 +421,9 @@ export default {
formTitle
()
{
formTitle
()
{
return
this
.
editedIndex
===
-
1
?
"
New Item
"
:
"
Edit Item
"
;
return
this
.
editedIndex
===
-
1
?
"
New Item
"
:
"
Edit Item
"
;
},
},
nameState
()
{
return
this
.
name
.
length
>
2
?
true
:
false
}
},
},
watch
:
{
watch
:
{
dialog
(
val
)
{
dialog
(
val
)
{
...
@@ -491,7 +499,7 @@ export default {
...
@@ -491,7 +499,7 @@ export default {
.
get
(
"
http://127.0.0.1:8000/api/categories/
"
)
.
get
(
"
http://127.0.0.1:8000/api/categories/
"
)
.
then
((
response
)
=>
(
this
.
categories
=
response
.
data
.
data
))
.
then
((
response
)
=>
(
this
.
categories
=
response
.
data
.
data
))
.
catch
(
function
(
error
)
{
.
catch
(
function
(
error
)
{
console
.
log
(
error
)
;
console
.
log
(
error
)
});
});
},
},
getProducts
()
{
getProducts
()
{
...
@@ -499,7 +507,7 @@ export default {
...
@@ -499,7 +507,7 @@ export default {
.
get
(
"
http://127.0.0.1:8000/api/products/
"
)
.
get
(
"
http://127.0.0.1:8000/api/products/
"
)
.
then
((
response
)
=>
(
this
.
products
=
response
.
data
.
data
))
.
then
((
response
)
=>
(
this
.
products
=
response
.
data
.
data
))
.
catch
(
function
(
error
)
{
.
catch
(
function
(
error
)
{
console
.
log
(
error
)
;
console
.
log
(
error
)
});
});
},
},
createProduct
()
{
createProduct
()
{
...
@@ -522,13 +530,13 @@ export default {
...
@@ -522,13 +530,13 @@ export default {
})
})
.
then
(
response
=>
{
.
then
(
response
=>
{
this
.
$bvModal
.
hide
(
'
modal-create
'
)
this
.
$bvModal
.
hide
(
'
modal-create
'
)
self
.
$toast
.
success
(
'
Category
created successfully!
'
,
{
self
.
$toast
.
success
(
'
Product
created successfully!
'
,
{
duration
:
3000
duration
:
3000
})
})
})
})
.
catch
(
errors
=>
{
.
catch
(
errors
=>
{
this
.
$bvModal
.
hide
(
'
modal-create
'
)
this
.
$bvModal
.
hide
(
'
modal-create
'
)
console
.
log
(
errors
.
response
.
data
.
message
)
;
console
.
log
(
errors
.
response
.
data
.
message
)
this
.
message
=
errors
.
response
.
data
.
message
;
this
.
message
=
errors
.
response
.
data
.
message
;
self
.
$toast
.
error
(
'
something went wrong while trying create!
'
,{
self
.
$toast
.
error
(
'
something went wrong while trying create!
'
,{
duration
:
3000
duration
:
3000
...
@@ -563,31 +571,31 @@ export default {
...
@@ -563,31 +571,31 @@ export default {
"
Authorization
"
:
this
.
$auth
.
$storage
.
getUniversal
(
"
token
"
)
"
Authorization
"
:
this
.
$auth
.
$storage
.
getUniversal
(
"
token
"
)
}
}
}).
then
((
response
)
=>
{
}).
then
((
response
)
=>
{
return
response
.
json
()
;
return
response
.
json
()
});
});
this
.
sName
=
resp
.
data
.
name
;
this
.
sName
=
resp
.
data
.
name
this
.
sPrice
=
resp
.
data
.
price
;
this
.
sPrice
=
resp
.
data
.
price
this
.
sCategoryId
=
resp
.
data
.
category_id
;
this
.
sCategoryId
=
resp
.
data
.
category_id
this
.
sDescription
=
resp
.
data
.
description
;
this
.
sDescription
=
resp
.
data
.
description
this
.
sStock
=
resp
.
data
.
stock
;
this
.
sStock
=
resp
.
data
.
stock
this
.
sVariants
=
resp
.
data
.
variants
;
this
.
sVariants
=
resp
.
data
.
variants
this
.
sImages
=
resp
.
data
.
images
;
this
.
sImages
=
resp
.
data
.
images
console
.
log
(
this
.
sVariants
)
;
console
.
log
(
this
.
sVariants
)
console
.
log
(
this
.
sImages
)
;
console
.
log
(
this
.
sImages
)
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
}
}
this
.
$bvModal
.
show
(
'
modal-show
'
)
this
.
$bvModal
.
show
(
'
modal-show
'
)
},
},
editProduct
(
item
)
{
editProduct
(
item
)
{
this
.
$bvModal
.
show
(
'
modal-edit
'
)
;
this
.
$bvModal
.
show
(
'
modal-edit
'
)
this
.
eId
=
item
.
id
;
this
.
eId
=
item
.
id
this
.
eName
=
item
.
name
;
this
.
eName
=
item
.
name
this
.
eCategoryId
=
item
.
category_id
;
this
.
eCategoryId
=
item
.
category_id
this
.
ePrice
=
item
.
price
;
this
.
ePrice
=
item
.
price
this
.
eStock
=
item
.
stock
;
this
.
eStock
=
item
.
stock
this
.
eDescription
=
item
.
description
;
this
.
eDescription
=
item
.
description
this
.
eVariants
=
item
.
variants
;
this
.
eVariants
=
item
.
variants
},
},
updateProduct
(
ID
)
{
updateProduct
(
ID
)
{
const
self
=
this
;
const
self
=
this
;
...
@@ -610,7 +618,7 @@ export default {
...
@@ -610,7 +618,7 @@ export default {
self.$toast.success('User updated successfully!',{
self.$toast.success('User updated successfully!',{
duration: 3000
duration: 3000
});
});
console.log(response)
;
console.log(response)
})
})
} catch(error){
} catch(error){
console.log(error)
console.log(error)
...
@@ -642,7 +650,6 @@ export default {
...
@@ -642,7 +650,6 @@ export default {
console.log(this.category_id)
console.log(this.category_id)
console.log(this.stock)
console.log(this.stock)
console.log(this.images)
console.log(this.images)
console.log(this.variants)
console.log(this.variants)
}
}
},
},
...
...
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