Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
reybex-educational-app
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
M. Esat Akpunar
reybex-educational-app
Commits
6cc35af0
Commit
6cc35af0
authored
Aug 31, 2022
by
esatakpunar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
datatable setLoading added
parent
32f09e5c
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
38 additions
and
8 deletions
+38
-8
index.vue
client/src/modules/customers/index.vue
+3
-1
actions.js
client/src/modules/customers/store/actions.js
+8
-4
getters.js
client/src/modules/customers/store/getters.js
+3
-0
mutations.js
client/src/modules/customers/store/mutations.js
+4
-0
state.js
client/src/modules/customers/store/state.js
+1
-0
index.vue
client/src/modules/products/index.vue
+2
-0
actions.js
client/src/modules/products/store/actions.js
+9
-3
getters.js
client/src/modules/products/store/getters.js
+3
-0
mutations.js
client/src/modules/products/store/mutations.js
+4
-0
state.js
client/src/modules/products/store/state.js
+1
-0
No files found.
client/src/modules/customers/index.vue
View file @
6cc35af0
...
...
@@ -16,6 +16,7 @@ export default {
"customerList"
,
"filteredCustomerList"
,
"dialog"
,
"loading"
,
"dialogHeaders"
,
"editedItem"
,
"editedIndex"
,
...
...
@@ -53,6 +54,7 @@ export default {
v-model=
"selected"
:headers=
"headers"
:items=
"customerList"
:loading=
"loading"
show-select
class=
"evation-1"
>
...
...
@@ -170,7 +172,7 @@ export default {
</template>
<
template
v-slot:
[`
item
.
image
`]="{
item
}"
>
<img
width=
"75"
:src=
"`$
{item.image}`" />
<img
width=
"75"
:src=
"`$
{item.image}`"
v-if="item.image"
/>
</
template
>
<
template
v-slot:
[`
item
.
actions
`]="{
item
}"
>
...
...
client/src/modules/customers/store/actions.js
View file @
6cc35af0
...
...
@@ -8,13 +8,14 @@ export default {
}
else
if
(
data
.
filterColumn
)
{
query
=
data
.
filterColumn
+
"_like="
+
data
.
searchInput
;
}
commit
(
"setLoading"
,
true
);
axios
.
get
(
`http://localhost:3000/customers?
${
query
}
`
)
.
then
((
response
)
=>
{
commit
(
"setCustomerList"
,
response
.
data
);
dispatch
(
"filterCustomer"
,
{
searchInput
:
""
});
commit
(
"setLoading"
,
false
);
})
.
catch
((
e
)
=>
{
console
.
log
(
e
);
...
...
@@ -28,13 +29,15 @@ export default {
closeDialog
({
commit
})
{
commit
(
"setDialog"
,
false
);
},
deleteCustomer
({
dispatch
},
idList
)
{
deleteCustomer
({
dispatch
,
commit
},
idList
)
{
confirm
(
"Are you sure you want to delete this item?"
)
&&
idList
.
forEach
((
id
)
=>
{
commit
(
"setLoading"
,
true
);
axios
.
delete
(
`http://localhost:3000/customers/
${
id
}
`
)
.
then
(()
=>
{
dispatch
(
"fetchCustomerData"
);
commit
(
"setLoading"
,
false
);
})
.
catch
((
e
)
=>
{
console
.
log
(
e
);
...
...
@@ -49,7 +52,7 @@ export default {
dispatch
(
"deleteCustomer"
,
itemList
);
},
saveCustomer
({
getters
,
dispatch
})
{
saveCustomer
({
getters
,
dispatch
,
commit
})
{
const
postConfig
=
{
method
:
"post"
,
url
:
`http://localhost:3000/customers/`
,
...
...
@@ -61,9 +64,10 @@ export default {
url
:
`http://localhost:3000/customers/
${
getters
.
editedItem
.
id
}
`
,
data
:
getters
.
editedItem
,
};
commit
(
"setLoading"
,
true
);
axios
(
!
getters
.
editedItem
.
id
?
postConfig
:
putConfig
).
then
(()
=>
{
dispatch
(
"fetchCustomerData"
);
commit
(
"setLoading"
,
false
);
});
dispatch
(
"closeDialog"
);
},
...
...
client/src/modules/customers/store/getters.js
View file @
6cc35af0
...
...
@@ -43,6 +43,9 @@ export default {
dialog
(
state
)
{
return
state
.
dialog
;
},
loading
(
state
)
{
return
state
.
loading
;
},
filteredCustomerList
(
state
)
{
return
state
.
filteredCustomerList
;
},
...
...
client/src/modules/customers/store/mutations.js
View file @
6cc35af0
...
...
@@ -11,6 +11,10 @@ export default {
setDialog
(
state
,
value
)
{
state
.
dialog
=
value
;
},
setLoading
(
state
,
value
)
{
state
.
loading
=
value
;
console
.
log
(
value
);
},
setfilteredCustomerList
(
state
,
data
)
{
state
.
filteredCustomerList
=
data
;
},
...
...
client/src/modules/customers/store/state.js
View file @
6cc35af0
...
...
@@ -4,4 +4,5 @@ export default () => ({
editedIndex
:
-
1
,
editedItem
:
{},
dialog
:
false
,
loading
:
false
,
});
client/src/modules/products/index.vue
View file @
6cc35af0
...
...
@@ -19,6 +19,7 @@ export default {
"singleExpand"
,
"expanded"
,
"dialog"
,
"loading"
,
"editedItem"
,
"editedIndex"
,
]),
...
...
@@ -55,6 +56,7 @@ export default {
v-model=
"selected"
:headers=
"headers"
:items=
"productList"
:loading=
"loading"
:single-expand=
"singleExpand"
:expanded
.
sync=
"expanded"
show-select
...
...
client/src/modules/products/store/actions.js
View file @
6cc35af0
...
...
@@ -8,12 +8,13 @@ export default {
}
else
if
(
data
.
filterColumn
)
{
query
=
data
.
filterColumn
+
"_like="
+
data
.
searchInput
;
}
commit
(
"setLoading"
,
true
);
axios
.
get
(
`http://localhost:3000/products?
${
query
}
`
)
.
then
((
response
)
=>
{
commit
(
"setProductList"
,
response
.
data
);
dispatch
(
"filterProduct"
,
{
searchInput
:
""
});
commit
(
"setLoading"
,
false
);
})
.
catch
((
e
)
=>
{
console
.
log
(
e
);
...
...
@@ -28,13 +29,16 @@ export default {
commit
(
"setDialog"
,
false
);
},
deleteProduct
({
dispatch
},
idList
)
{
deleteProduct
({
dispatch
,
commit
},
idList
)
{
confirm
(
"Are you sure you want to delete this item?"
)
&&
idList
.
forEach
((
id
)
=>
{
commit
(
"setLoading"
,
true
);
axios
.
delete
(
`http://localhost:3000/products/
${
id
}
`
)
.
then
(()
=>
{
dispatch
(
"fetchProductData"
);
commit
(
"setLoading"
,
false
);
})
.
catch
((
e
)
=>
{
console
.
log
(
e
);
...
...
@@ -51,7 +55,7 @@ export default {
dispatch
(
"deleteProduct"
,
itemList
);
},
saveProduct
({
getters
,
dispatch
})
{
saveProduct
({
getters
,
dispatch
,
commit
})
{
const
postConfig
=
{
method
:
"post"
,
url
:
`http://localhost:3000/products/`
,
...
...
@@ -63,9 +67,11 @@ export default {
url
:
`http://localhost:3000/products/
${
getters
.
editedItem
.
id
}
`
,
data
:
getters
.
editedItem
,
};
commit
(
"setLoading"
,
true
);
axios
(
!
getters
.
editedItem
.
id
?
postConfig
:
putConfig
).
then
(()
=>
{
dispatch
(
"fetchProductData"
);
commit
(
"setLoading"
,
false
);
});
dispatch
(
"closeDialog"
);
},
...
...
client/src/modules/products/store/getters.js
View file @
6cc35af0
...
...
@@ -53,6 +53,9 @@ export default {
dialog
(
state
)
{
return
state
.
dialog
;
},
loading
(
state
)
{
return
state
.
loading
;
},
filteredProductList
(
state
)
{
return
state
.
filteredProductList
;
},
...
...
client/src/modules/products/store/mutations.js
View file @
6cc35af0
...
...
@@ -8,6 +8,10 @@ export default {
setDialog
(
state
,
value
)
{
state
.
dialog
=
value
;
},
setLoading
(
state
,
value
)
{
state
.
loading
=
value
;
console
.
log
(
value
);
},
setEditedIndex
(
state
,
index
)
{
state
.
editedIndex
=
index
;
},
...
...
client/src/modules/products/store/state.js
View file @
6cc35af0
...
...
@@ -6,4 +6,5 @@ export default () => ({
editedIndex
:
-
1
,
editedItem
:
{},
dialog
:
false
,
loading
:
false
,
});
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