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
Show 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 @@
<b-modal
id=
"modal-create"
title=
"create Product"
class=
"modal fade"
>
<div
class=
"w-full mt-4 p-10"
>
<form
>
<label>
Name :
</label>
<input
<label
for=
"input-live"
>
Name :
</label>
<b-form-input
id=
"input-live"
type=
"text"
class=
"form-control mb-2"
placeholder=
"name"
aria-describedby=
"input-live-help input-live-feedback"
v-model=
"name"
max=
"255"
min=
"1"
size=
"sm"
required
/>
:state=
"nameState"
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>
<b-form-select
v-model=
"category_id"
>
<option
v-for=
"item in categories"
:value=
"item.id"
>
...
...
@@ -389,7 +395,6 @@ export default {
color
:
""
,
size
:
""
,
quantity
:
""
,
},
],
message
:
[],
...
...
@@ -416,6 +421,9 @@ export default {
formTitle
()
{
return
this
.
editedIndex
===
-
1
?
"
New Item
"
:
"
Edit Item
"
;
},
nameState
()
{
return
this
.
name
.
length
>
2
?
true
:
false
}
},
watch
:
{
dialog
(
val
)
{
...
...
@@ -491,7 +499,7 @@ export default {
.
get
(
"
http://127.0.0.1:8000/api/categories/
"
)
.
then
((
response
)
=>
(
this
.
categories
=
response
.
data
.
data
))
.
catch
(
function
(
error
)
{
console
.
log
(
error
)
;
console
.
log
(
error
)
});
},
getProducts
()
{
...
...
@@ -499,7 +507,7 @@ export default {
.
get
(
"
http://127.0.0.1:8000/api/products/
"
)
.
then
((
response
)
=>
(
this
.
products
=
response
.
data
.
data
))
.
catch
(
function
(
error
)
{
console
.
log
(
error
)
;
console
.
log
(
error
)
});
},
createProduct
()
{
...
...
@@ -522,13 +530,13 @@ export default {
})
.
then
(
response
=>
{
this
.
$bvModal
.
hide
(
'
modal-create
'
)
self
.
$toast
.
success
(
'
Category
created successfully!
'
,
{
self
.
$toast
.
success
(
'
Product
created successfully!
'
,
{
duration
:
3000
})
})
.
catch
(
errors
=>
{
this
.
$bvModal
.
hide
(
'
modal-create
'
)
console
.
log
(
errors
.
response
.
data
.
message
)
;
console
.
log
(
errors
.
response
.
data
.
message
)
this
.
message
=
errors
.
response
.
data
.
message
;
self
.
$toast
.
error
(
'
something went wrong while trying create!
'
,{
duration
:
3000
...
...
@@ -563,31 +571,31 @@ export default {
"
Authorization
"
:
this
.
$auth
.
$storage
.
getUniversal
(
"
token
"
)
}
}).
then
((
response
)
=>
{
return
response
.
json
()
;
return
response
.
json
()
});
this
.
sName
=
resp
.
data
.
name
;
this
.
sPrice
=
resp
.
data
.
price
;
this
.
sCategoryId
=
resp
.
data
.
category_id
;
this
.
sDescription
=
resp
.
data
.
description
;
this
.
sStock
=
resp
.
data
.
stock
;
this
.
sVariants
=
resp
.
data
.
variants
;
this
.
sImages
=
resp
.
data
.
images
;
console
.
log
(
this
.
sVariants
)
;
console
.
log
(
this
.
sImages
)
;
this
.
sName
=
resp
.
data
.
name
this
.
sPrice
=
resp
.
data
.
price
this
.
sCategoryId
=
resp
.
data
.
category_id
this
.
sDescription
=
resp
.
data
.
description
this
.
sStock
=
resp
.
data
.
stock
this
.
sVariants
=
resp
.
data
.
variants
this
.
sImages
=
resp
.
data
.
images
console
.
log
(
this
.
sVariants
)
console
.
log
(
this
.
sImages
)
}
catch
(
error
)
{
console
.
log
(
error
)
}
this
.
$bvModal
.
show
(
'
modal-show
'
)
},
editProduct
(
item
)
{
this
.
$bvModal
.
show
(
'
modal-edit
'
)
;
this
.
eId
=
item
.
id
;
this
.
eName
=
item
.
name
;
this
.
eCategoryId
=
item
.
category_id
;
this
.
ePrice
=
item
.
price
;
this
.
eStock
=
item
.
stock
;
this
.
eDescription
=
item
.
description
;
this
.
eVariants
=
item
.
variants
;
this
.
$bvModal
.
show
(
'
modal-edit
'
)
this
.
eId
=
item
.
id
this
.
eName
=
item
.
name
this
.
eCategoryId
=
item
.
category_id
this
.
ePrice
=
item
.
price
this
.
eStock
=
item
.
stock
this
.
eDescription
=
item
.
description
this
.
eVariants
=
item
.
variants
},
updateProduct
(
ID
)
{
const
self
=
this
;
...
...
@@ -610,7 +618,7 @@ export default {
self.$toast.success('User updated successfully!',{
duration: 3000
});
console.log(response)
;
console.log(response)
})
} catch(error){
console.log(error)
...
...
@@ -642,7 +650,6 @@ export default {
console.log(this.category_id)
console.log(this.stock)
console.log(this.images)
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