Skip to content

Commit

Permalink
fixing bug edit action on comment menu and set date submit fit in dat…
Browse files Browse the repository at this point in the history
…etime
  • Loading branch information
miftahurrahmi committed Aug 9, 2024
1 parent cb53082 commit 6322807
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
38 changes: 30 additions & 8 deletions src/resources/js/pages/comment/browse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,37 @@
:description-body="$t('comment.footer.descriptionBody')"
>
<template slot="thead">
<vs-th sort-key="title"> {{ $t("comment.header.user") }} </vs-th>
<vs-th sort-key="slug"> {{ $t("comment.header.comment") }} </vs-th>
<vs-th sort-key="metaTitle"> {{ $t("comment.header.post") }} </vs-th>
<vs-th sort-key="approved"> {{ $t("comment.header.approved") }} </vs-th>
<vs-th sort-key="metaTitle"> {{ $t("comment.header.submit") }} </vs-th>
<vs-th sort-key="title">
{{ $t("comment.header.user") }}
</vs-th>
<vs-th sort-key="slug">
{{ $t("comment.header.comment") }}
</vs-th>
<vs-th sort-key="metaTitle">
{{ $t("comment.header.post") }}
</vs-th>
<vs-th sort-key="approved">
{{ $t("comment.header.approved") }}
</vs-th>
<vs-th sort-key="metaTitle">
{{ $t("comment.header.submit") }}
</vs-th>
<vs-th> {{ $t("comment.header.action") }} </vs-th>
</template>

<template slot-scope="{ data }">
<vs-tr :data="tr" :key="indextr" v-for="(tr, indextr) in data">
<vs-td :data="tr.user">
{{ tr.user !== null ? tr.user.name : tr.guestName }}
{{ tr.user !== null ? tr.user.name : tr.guestName }}
</vs-td>
<vs-td :data="tr.content">
{{ tr.content }}
</vs-td>
<vs-td :data="tr.post">
{{ tr.post !== null ? tr.post.title : null }}
</vs-td>
<vs-td :data="tr.approved">
{{ tr.approved == 1 ? 'Yes' : 'No' }}
<vs-td :data="tr.approved">
{{ tr.approved == 1 ? "Yes" : "No" }}
</vs-td>
<vs-td :data="tr.createdAt">
{{ tr.createdAt }}
Expand Down Expand Up @@ -109,6 +119,7 @@
</template>

<script>
import moment from "moment";
export default {
name: "CommentBrowse",
components: {},
Expand Down Expand Up @@ -157,6 +168,17 @@ export default {
this.$closeLoader();
this.selected = [];
this.comments = response.data.comments;
this.comments.map((tr) => {
if (tr.createdAt || tr.updatedAt) {
tr.createdAt = moment(tr.createdAt).format(
"YYYY-MM-DD hh:mm:ss"
);
tr.updatedAt = moment(tr.updatedAt).format(
"YYYY-MM-DD hh:mm:ss"
);
}
return tr;
});
})
.catch((error) => {
this.$closeLoader();
Expand Down
2 changes: 1 addition & 1 deletion src/resources/js/pages/comment/edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default {
this.$closeLoader();
this.selected = [];
if (response.data.posts) {
this.posts = response.data.posts.map((post, index) => {
this.posts = response.data.posts.data.map((post, index) => {
return {
label: post.title,
value: post.id
Expand Down

0 comments on commit 6322807

Please sign in to comment.