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 {
...
@@ -16,6 +16,7 @@ export default {
"customerList"
,
"customerList"
,
"filteredCustomerList"
,
"filteredCustomerList"
,
"dialog"
,
"dialog"
,
"loading"
,
"dialogHeaders"
,
"dialogHeaders"
,
"editedItem"
,
"editedItem"
,
"editedIndex"
,
"editedIndex"
,
...
@@ -53,6 +54,7 @@ export default {
...
@@ -53,6 +54,7 @@ export default {
v-model=
"selected"
v-model=
"selected"
:headers=
"headers"
:headers=
"headers"
:items=
"customerList"
:items=
"customerList"
:loading=
"loading"
show-select
show-select
class=
"evation-1"
class=
"evation-1"
>
>
...
@@ -170,7 +172,7 @@ export default {
...
@@ -170,7 +172,7 @@ export default {
</template>
</template>
<
template
v-slot:
[`
item
.
image
`]="{
item
}"
>
<
template
v-slot:
[`
item
.
image
`]="{
item
}"
>
<img
width=
"75"
:src=
"`$
{item.image}`" />
<img
width=
"75"
:src=
"`$
{item.image}`"
v-if="item.image"
/>
</
template
>
</
template
>
<
template
v-slot:
[`
item
.
actions
`]="{
item
}"
>
<
template
v-slot:
[`
item
.
actions
`]="{
item
}"
>
...
...
client/src/modules/customers/store/actions.js
View file @
6cc35af0
...
@@ -8,13 +8,14 @@ export default {
...
@@ -8,13 +8,14 @@ export default {
}
else
if
(
data
.
filterColumn
)
{
}
else
if
(
data
.
filterColumn
)
{
query
=
data
.
filterColumn
+
"_like="
+
data
.
searchInput
;
query
=
data
.
filterColumn
+
"_like="
+
data
.
searchInput
;
}
}
commit
(
"setLoading"
,
true
);
axios
axios
.
get
(
`http://localhost:3000/customers?
${
query
}
`
)
.
get
(
`http://localhost:3000/customers?
${
query
}
`
)
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
commit
(
"setCustomerList"
,
response
.
data
);
commit
(
"setCustomerList"
,
response
.
data
);
dispatch
(
"filterCustomer"
,
{
searchInput
:
""
});
dispatch
(
"filterCustomer"
,
{
searchInput
:
""
});
commit
(
"setLoading"
,
false
);
})
})
.
catch
((
e
)
=>
{
.
catch
((
e
)
=>
{
console
.
log
(
e
);
console
.
log
(
e
);
...
@@ -28,13 +29,15 @@ export default {
...
@@ -28,13 +29,15 @@ export default {
closeDialog
({
commit
})
{
closeDialog
({
commit
})
{
commit
(
"setDialog"
,
false
);
commit
(
"setDialog"
,
false
);
},
},
deleteCustomer
({
dispatch
},
idList
)
{
deleteCustomer
({
dispatch
,
commit
},
idList
)
{
confirm
(
"Are you sure you want to delete this item?"
)
&&
confirm
(
"Are you sure you want to delete this item?"
)
&&
idList
.
forEach
((
id
)
=>
{
idList
.
forEach
((
id
)
=>
{
commit
(
"setLoading"
,
true
);
axios
axios
.
delete
(
`http://localhost:3000/customers/
${
id
}
`
)
.
delete
(
`http://localhost:3000/customers/
${
id
}
`
)
.
then
(()
=>
{
.
then
(()
=>
{
dispatch
(
"fetchCustomerData"
);
dispatch
(
"fetchCustomerData"
);
commit
(
"setLoading"
,
false
);
})
})
.
catch
((
e
)
=>
{
.
catch
((
e
)
=>
{
console
.
log
(
e
);
console
.
log
(
e
);
...
@@ -49,7 +52,7 @@ export default {
...
@@ -49,7 +52,7 @@ export default {
dispatch
(
"deleteCustomer"
,
itemList
);
dispatch
(
"deleteCustomer"
,
itemList
);
},
},
saveCustomer
({
getters
,
dispatch
})
{
saveCustomer
({
getters
,
dispatch
,
commit
})
{
const
postConfig
=
{
const
postConfig
=
{
method
:
"post"
,
method
:
"post"
,
url
:
`http://localhost:3000/customers/`
,
url
:
`http://localhost:3000/customers/`
,
...
@@ -61,9 +64,10 @@ export default {
...
@@ -61,9 +64,10 @@ export default {
url
:
`http://localhost:3000/customers/
${
getters
.
editedItem
.
id
}
`
,
url
:
`http://localhost:3000/customers/
${
getters
.
editedItem
.
id
}
`
,
data
:
getters
.
editedItem
,
data
:
getters
.
editedItem
,
};
};
commit
(
"setLoading"
,
true
);
axios
(
!
getters
.
editedItem
.
id
?
postConfig
:
putConfig
).
then
(()
=>
{
axios
(
!
getters
.
editedItem
.
id
?
postConfig
:
putConfig
).
then
(()
=>
{
dispatch
(
"fetchCustomerData"
);
dispatch
(
"fetchCustomerData"
);
commit
(
"setLoading"
,
false
);
});
});
dispatch
(
"closeDialog"
);
dispatch
(
"closeDialog"
);
},
},
...
...
client/src/modules/customers/store/getters.js
View file @
6cc35af0
...
@@ -43,6 +43,9 @@ export default {
...
@@ -43,6 +43,9 @@ export default {
dialog
(
state
)
{
dialog
(
state
)
{
return
state
.
dialog
;
return
state
.
dialog
;
},
},
loading
(
state
)
{
return
state
.
loading
;
},
filteredCustomerList
(
state
)
{
filteredCustomerList
(
state
)
{
return
state
.
filteredCustomerList
;
return
state
.
filteredCustomerList
;
},
},
...
...
client/src/modules/customers/store/mutations.js
View file @
6cc35af0
...
@@ -11,6 +11,10 @@ export default {
...
@@ -11,6 +11,10 @@ export default {
setDialog
(
state
,
value
)
{
setDialog
(
state
,
value
)
{
state
.
dialog
=
value
;
state
.
dialog
=
value
;
},
},
setLoading
(
state
,
value
)
{
state
.
loading
=
value
;
console
.
log
(
value
);
},
setfilteredCustomerList
(
state
,
data
)
{
setfilteredCustomerList
(
state
,
data
)
{
state
.
filteredCustomerList
=
data
;
state
.
filteredCustomerList
=
data
;
},
},
...
...
client/src/modules/customers/store/state.js
View file @
6cc35af0
...
@@ -4,4 +4,5 @@ export default () => ({
...
@@ -4,4 +4,5 @@ export default () => ({
editedIndex
:
-
1
,
editedIndex
:
-
1
,
editedItem
:
{},
editedItem
:
{},
dialog
:
false
,
dialog
:
false
,
loading
:
false
,
});
});
client/src/modules/products/index.vue
View file @
6cc35af0
...
@@ -19,6 +19,7 @@ export default {
...
@@ -19,6 +19,7 @@ export default {
"singleExpand"
,
"singleExpand"
,
"expanded"
,
"expanded"
,
"dialog"
,
"dialog"
,
"loading"
,
"editedItem"
,
"editedItem"
,
"editedIndex"
,
"editedIndex"
,
]),
]),
...
@@ -55,6 +56,7 @@ export default {
...
@@ -55,6 +56,7 @@ export default {
v-model=
"selected"
v-model=
"selected"
:headers=
"headers"
:headers=
"headers"
:items=
"productList"
:items=
"productList"
:loading=
"loading"
:single-expand=
"singleExpand"
:single-expand=
"singleExpand"
:expanded
.
sync=
"expanded"
:expanded
.
sync=
"expanded"
show-select
show-select
...
...
client/src/modules/products/store/actions.js
View file @
6cc35af0
...
@@ -8,12 +8,13 @@ export default {
...
@@ -8,12 +8,13 @@ export default {
}
else
if
(
data
.
filterColumn
)
{
}
else
if
(
data
.
filterColumn
)
{
query
=
data
.
filterColumn
+
"_like="
+
data
.
searchInput
;
query
=
data
.
filterColumn
+
"_like="
+
data
.
searchInput
;
}
}
commit
(
"setLoading"
,
true
);
axios
axios
.
get
(
`http://localhost:3000/products?
${
query
}
`
)
.
get
(
`http://localhost:3000/products?
${
query
}
`
)
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
commit
(
"setProductList"
,
response
.
data
);
commit
(
"setProductList"
,
response
.
data
);
dispatch
(
"filterProduct"
,
{
searchInput
:
""
});
dispatch
(
"filterProduct"
,
{
searchInput
:
""
});
commit
(
"setLoading"
,
false
);
})
})
.
catch
((
e
)
=>
{
.
catch
((
e
)
=>
{
console
.
log
(
e
);
console
.
log
(
e
);
...
@@ -28,13 +29,16 @@ export default {
...
@@ -28,13 +29,16 @@ export default {
commit
(
"setDialog"
,
false
);
commit
(
"setDialog"
,
false
);
},
},
deleteProduct
({
dispatch
},
idList
)
{
deleteProduct
({
dispatch
,
commit
},
idList
)
{
confirm
(
"Are you sure you want to delete this item?"
)
&&
confirm
(
"Are you sure you want to delete this item?"
)
&&
idList
.
forEach
((
id
)
=>
{
idList
.
forEach
((
id
)
=>
{
commit
(
"setLoading"
,
true
);
axios
axios
.
delete
(
`http://localhost:3000/products/
${
id
}
`
)
.
delete
(
`http://localhost:3000/products/
${
id
}
`
)
.
then
(()
=>
{
.
then
(()
=>
{
dispatch
(
"fetchProductData"
);
dispatch
(
"fetchProductData"
);
commit
(
"setLoading"
,
false
);
})
})
.
catch
((
e
)
=>
{
.
catch
((
e
)
=>
{
console
.
log
(
e
);
console
.
log
(
e
);
...
@@ -51,7 +55,7 @@ export default {
...
@@ -51,7 +55,7 @@ export default {
dispatch
(
"deleteProduct"
,
itemList
);
dispatch
(
"deleteProduct"
,
itemList
);
},
},
saveProduct
({
getters
,
dispatch
})
{
saveProduct
({
getters
,
dispatch
,
commit
})
{
const
postConfig
=
{
const
postConfig
=
{
method
:
"post"
,
method
:
"post"
,
url
:
`http://localhost:3000/products/`
,
url
:
`http://localhost:3000/products/`
,
...
@@ -63,9 +67,11 @@ export default {
...
@@ -63,9 +67,11 @@ export default {
url
:
`http://localhost:3000/products/
${
getters
.
editedItem
.
id
}
`
,
url
:
`http://localhost:3000/products/
${
getters
.
editedItem
.
id
}
`
,
data
:
getters
.
editedItem
,
data
:
getters
.
editedItem
,
};
};
commit
(
"setLoading"
,
true
);
axios
(
!
getters
.
editedItem
.
id
?
postConfig
:
putConfig
).
then
(()
=>
{
axios
(
!
getters
.
editedItem
.
id
?
postConfig
:
putConfig
).
then
(()
=>
{
dispatch
(
"fetchProductData"
);
dispatch
(
"fetchProductData"
);
commit
(
"setLoading"
,
false
);
});
});
dispatch
(
"closeDialog"
);
dispatch
(
"closeDialog"
);
},
},
...
...
client/src/modules/products/store/getters.js
View file @
6cc35af0
...
@@ -53,6 +53,9 @@ export default {
...
@@ -53,6 +53,9 @@ export default {
dialog
(
state
)
{
dialog
(
state
)
{
return
state
.
dialog
;
return
state
.
dialog
;
},
},
loading
(
state
)
{
return
state
.
loading
;
},
filteredProductList
(
state
)
{
filteredProductList
(
state
)
{
return
state
.
filteredProductList
;
return
state
.
filteredProductList
;
},
},
...
...
client/src/modules/products/store/mutations.js
View file @
6cc35af0
...
@@ -8,6 +8,10 @@ export default {
...
@@ -8,6 +8,10 @@ export default {
setDialog
(
state
,
value
)
{
setDialog
(
state
,
value
)
{
state
.
dialog
=
value
;
state
.
dialog
=
value
;
},
},
setLoading
(
state
,
value
)
{
state
.
loading
=
value
;
console
.
log
(
value
);
},
setEditedIndex
(
state
,
index
)
{
setEditedIndex
(
state
,
index
)
{
state
.
editedIndex
=
index
;
state
.
editedIndex
=
index
;
},
},
...
...
client/src/modules/products/store/state.js
View file @
6cc35af0
...
@@ -6,4 +6,5 @@ export default () => ({
...
@@ -6,4 +6,5 @@ export default () => ({
editedIndex
:
-
1
,
editedIndex
:
-
1
,
editedItem
:
{},
editedItem
:
{},
dialog
:
false
,
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