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
0c71bd4b
Commit
0c71bd4b
authored
Feb 06, 2023
by
TTS Kieu Tuan Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add dialog delete
parent
35e6fea4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
325 deletions
+26
-325
index.vue
pages/categories/index.vue
+24
-34
index.vue
pages/posts/index.vue
+1
-1
index.vue
pages/products/index.vue
+1
-290
No files found.
pages/categories/index.vue
View file @
0c71bd4b
...
@@ -273,7 +273,7 @@
...
@@ -273,7 +273,7 @@
<v-btn
color=
"blue darken-1"
text
@
click=
"closeDelete"
>
<v-btn
color=
"blue darken-1"
text
@
click=
"closeDelete"
>
Cancel
Cancel
</v-btn>
</v-btn>
<v-btn
color=
"blue darken-1"
text
@
click=
"delete
ItemConfirm
"
>
<v-btn
color=
"blue darken-1"
text
@
click=
"delete
Category(); dialogDelete = false
"
>
OK
OK
</v-btn>
</v-btn>
<v-spacer
/>
<v-spacer
/>
...
@@ -292,7 +292,7 @@
...
@@ -292,7 +292,7 @@
<v-icon
:id=
"item.id"
small
@
click=
"dialog2 = true; editCategory(item)"
>
<v-icon
:id=
"item.id"
small
@
click=
"dialog2 = true; editCategory(item)"
>
mdi-pencil
mdi-pencil
</v-icon>
</v-icon>
<v-icon
:id=
"item.id"
small
@
click=
"d
eleteCategory(item.id,
item)"
>
<v-icon
:id=
"item.id"
small
@
click=
"d
ialogDelete = true;getID(
item)"
>
mdi-delete
mdi-delete
</v-icon>
</v-icon>
<v-icon
:id=
"item.id"
small
@
click=
"dialog3 = true; showCategory(item)"
>
<v-icon
:id=
"item.id"
small
@
click=
"dialog3 = true; showCategory(item)"
>
...
@@ -486,13 +486,12 @@ export default {
...
@@ -486,13 +486,12 @@ export default {
})
})
})
})
},
},
deleteCategory
(
ID
,
index
)
{
deleteCategory
()
{
const
self
=
this
const
self
=
this
this
.
editedIndex
=
this
.
categories
.
indexOf
(
index
)
const
currentPostIndex
=
this
.
editedIndex
if
(
confirm
(
'
Do you really want to delete?
'
))
{
try
{
try
{
this
.
$axios
this
.
$axios
.
delete
(
`/categories/
${
ID
}
`
,
.
delete
(
`/categories/
${
this
.
e
ID
}
`
,
{
{
headers
:
{
headers
:
{
'
Content-Type
'
:
'
multipart/form-data
'
,
'
Content-Type
'
:
'
multipart/form-data
'
,
...
@@ -500,7 +499,7 @@ export default {
...
@@ -500,7 +499,7 @@ export default {
}
}
})
})
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
this
.
categories
.
splice
(
this
.
edited
Index
,
1
)
this
.
categories
.
splice
(
currentPost
Index
,
1
)
self
.
$toast
.
success
(
'
Category deleted successfully!
'
,
{
self
.
$toast
.
success
(
'
Category deleted successfully!
'
,
{
duration
:
3000
duration
:
3000
})
})
...
@@ -508,10 +507,12 @@ export default {
...
@@ -508,10 +507,12 @@ export default {
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
}
}
}
},
},
getID
(
item
)
{
getID
(
item
)
{
console
.
log
(
this
.
categories
.
indexOf
(
item
))
console
.
log
(
item
.
id
)
console
.
log
(
this
.
editedIndex
)
this
.
eID
=
item
.
id
this
.
editedIndex
=
this
.
categories
.
indexOf
(
item
)
},
},
editCategory
(
item
)
{
editCategory
(
item
)
{
this
.
eID
=
item
.
id
this
.
eID
=
item
.
id
...
@@ -564,17 +565,6 @@ export default {
...
@@ -564,17 +565,6 @@ export default {
console.log(error)
console.log(error)
}
}
}
}
// formatDate (date) {
// const d = new Date(date)
// let month = '' + (d.getMonth() + 1)
// let day = '' + d.getDate()
// const year = d.getFullYear()
// if (month.length < 2) { month = '0' + month }
// if (day.length < 2) { day = '0' + day }
// return [year, month, day].join('-')
// }
}
}
}
}
</
script
>
</
script
>
...
...
pages/posts/index.vue
View file @
0c71bd4b
...
@@ -83,8 +83,8 @@
...
@@ -83,8 +83,8 @@
small-chips
small-chips
dense
dense
accept=
"image/*"
accept=
"image/*"
@
change=
"fileSelected"
prepend-icon=
"mdi-camera"
prepend-icon=
"mdi-camera"
@
change=
"fileSelected"
/>
/>
</v-col>
</v-col>
</v-row>
</v-row>
...
...
pages/products/index.vue
View file @
0c71bd4b
...
@@ -73,7 +73,6 @@
...
@@ -73,7 +73,6 @@
label=
"File input"
label=
"File input"
small-chips
small-chips
dense
dense
accept=
"image/*"
multiple
multiple
/>
/>
</v-col>
</v-col>
...
@@ -417,294 +416,6 @@
...
@@ -417,294 +416,6 @@
</v-card-actions>
</v-card-actions>
</v-card>
</v-card>
</v-dialog>
</v-dialog>
<!-- <b-modal id="modal-create" title="create Product" class="modal fade">
<div class="w-full mt-4 p-10">
<form>
<label for="input-live">Name :</label>
<b-form-input
id="input-live"
v-model="name"
type="text"
class="form-control mb-2"
placeholder="name"
aria-describedby="input-live-help input-live-feedback"
max="255"
min="1"
trim
/>
<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">
{{ item.name }}
</option>
</b-form-select>
<label>Price :</label>
<input
v-model="price"
type="text"
class="form-control mb-2"
placeholder="Ordering"
size="sm"
required
>
<label>Description :</label>
<input
v-model="description"
type="text"
class="form-control mb-2"
placeholder="Description"
size="sm"
required
>
<label>Stock :</label>
<input
v-model="stock"
type="text"
class="form-control mb-2"
placeholder="Stock"
size="sm"
required
>
<label>Image :</label>
<b-form-file
v-model="images"
multiple
:state="Boolean(images)"
placeholder="Choose a image or drop it here..."
drop-placeholder="Drop file here..."
/>
<button
type="button"
class="btn-primary flex justify-start ml-2 mt-2 rounded-md border px-3 py-2 bg-pink-600 text-white"
@click="addMore()"
>
Variant (+)
</button>
<div v-for="(variant, index) in variants" :key=" 'B' +index">
<div class="flex justify-start ml-2 mt-4">
<input
v-model="variant.color"
placeholder="Color"
class="w-full py-2 border border-indigo-500 rounded"
>
<input
v-model="variant.size"
placeholder="Size"
class="w-full py-2 border border-indigo-500 rounded"
>
<input
v-model="variant.quantity"
placeholder="Quantity"
class="w-full py-2 border border-indigo-500 rounded"
>
<button
v-show="index != 0"
type="button"
class="ml-2 rounded-md mt-2 "
@click="remove(index)"
>
<b-icon icon="dash-circle-fill" class="h5" variant="danger" />
</button>
</div>
</div>
</form>
</div>
<template #modal-footer>
<button v-b-modal.modal-close_visit class="btn btn-danger btn-sm m-1" @click="$bvModal.hide('modal-create')">
Close
</button>
<button v-b-modal.modal-close_visit class="btn btn-success btn-sm m-1" @click="createProduct()">
Submit
</button>
</template>
</b-modal> -->
<!-- modal-show -->
<!-- <b-modal id="modal-show" title="PRODUCT" class="modal fade">
<div class="w-full mt-4 p-10">
<form>
<label>Name :</label>
<input
v-model="sName"
type="text"
class="form-control mb-2"
size="sm"
disabled
>
<label>Category ID :</label>
<input
v-model="sCategoryId"
type="text"
class="form-control mb-2"
size="sm"
disabled
>
<label>Price :</label>
<input
v-model="sPrice"
type="text"
class="form-control mb-2"
size="sm"
disabled
>
<label>Description :</label>
<input
v-model="sDescription"
type="text"
class="form-control mb-2"
placeholder="Description"
size="sm"
disabled
>
<label>Stock :</label>
<input
v-model="sStock"
type="text"
class="form-control mb-2"
placeholder="Stock"
size="sm"
disabled
>
<label>Image :</label>
<div v-for="(image, index) in sImages" :key="index">
<b-img :src="image" fluid alt="Fluid image" />
</div>
<label>Variant :</label>
<div v-for="(variant, index) in sVariants" :key="'A' +index">
<div class="flex justify-start ml-2 mt-4">
<input
v-model="variant.color"
placeholder="Color"
class="w-full py-2 border border-indigo-500 rounded"
disabled
>
<input
v-model="variant.size"
placeholder="Size"
class="w-full py-2 border border-indigo-500 rounded"
disabled
>
<input
v-model="variant.quantity"
placeholder="Quantity"
class="w-full py-2 border border-indigo-500 rounded"
disabled
>
</div>
</div>
</form>
</div>
<template #modal-footer>
<button v-b-modal.modal-close_visit class="btn btn-danger btn-sm m-1" @click="$bvModal.hide('modal-show')">
Close
</button>
</template>
</b-modal> -->
<!-- modal-edit -->
<!-- <b-modal id="modal-edit" title="Edit Product" class="modal fade">
<div class="w-full mt-4 p-10">
<form>
<label>Name :</label>
<input
v-model="eName"
type="text"
class="form-control mb-2"
placeholder="name"
max="255"
min="1"
size="sm"
required
>
<label>Category ID :</label>
<b-form-select v-model="eCategoryId">
<option v-for="item in categories" :value="item.id">
{{ item.name }}
</option>
</b-form-select>
<label>Price :</label>
<input
v-model="ePrice"
type="text"
class="form-control mb-2"
placeholder="Ordering"
size="sm"
required
>
<label>Description :</label>
<input
v-model="eDescription"
type="text"
class="form-control mb-2"
placeholder="Description"
size="sm"
required
>
<label>Stock :</label>
<input
v-model="eStock"
type="text"
class="form-control mb-2"
placeholder="Stock"
size="sm"
required
>
<label>Image :</label>
<b-form-file
v-model="eImages"
multiple
:state="Boolean(eImages)"
placeholder="Choose a image or drop it here..."
drop-placeholder="Drop file here..."
/>
<button
type="button"
class="btn-primary flex justify-start ml-2 mt-2 rounded-md border px-3 py-2 bg-pink-600 text-white"
@click="addMoreVariant()"
>
Variant (+)
</button>
<div v-for="(variant, index) in eVariants" :key="index">
<div class="flex justify-start ml-2 mt-4">
<input
v-model="variant.color"
placeholder="Color"
class="w-full py-2 border border-indigo-500 rounded"
>
<input
v-model="variant.size"
placeholder="Size"
class="w-full py-2 border border-indigo-500 rounded"
>
<input
v-model="variant.quantity"
placeholder="Quantity"
class="w-full py-2 border border-indigo-500 rounded"
>
<button
v-show="index != 0"
type="button"
class="ml-2 rounded-md mt-2 "
@click="removeVariant(index)"
>
<b-icon icon="dash-circle-fill" class="h5" variant="danger" />
</button>
</div>
</div>
</form>
</div>
<template #modal-footer>
<button v-b-modal.modal-close_visit class="btn btn-danger btn-sm m-1" @click="$bvModal.hide('modal-edit')">
Close
</button>
<button v-b-modal.modal-close_visit class="btn btn-success btn-sm m-1" @click="updateProduct()">
Submit
</button>
</template>
</b-modal> -->
<!-- table -->
<!-- table -->
<div>
<div>
<v-data-table
<v-data-table
...
@@ -972,7 +683,7 @@ export default {
...
@@ -972,7 +683,7 @@ export default {
,
,
{
{
headers
:
{
headers
:
{
'
Content-Type
'
:
'
application/json;
multipart/form-data
'
,
'
Content-Type
'
:
'
multipart/form-data
'
,
Authorization
:
`Bearer
${
this
.
$auth
.
$storage
.
getUniversal
(
'
token
'
)}
`
,
Authorization
:
`Bearer
${
this
.
$auth
.
$storage
.
getUniversal
(
'
token
'
)}
`
,
Accept
:
'
application/json; multipart/form-data
'
Accept
:
'
application/json; multipart/form-data
'
}
}
...
...
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