Skip to content

Commit 6f7b508

Browse files
committed
feat(Component):Initialize comments filter form
1 parent 058a793 commit 6f7b508

File tree

4 files changed

+102
-35
lines changed

4 files changed

+102
-35
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<script>
2+
import { useModelRef } from '@/composables/model.composable';
3+
import VForm from '../form/VForm.vue';
4+
import VInput from '../form/VInput.vue';
5+
import { t } from '@/services/language.service';
6+
export default {
7+
name: 'CommentsFilterForm',
8+
setup() {
9+
10+
11+
const filters = useModelRef('modelValue');
12+
13+
const statusItems = [
14+
{
15+
key:'PENDING',
16+
text:t('Pending')
17+
},
18+
{
19+
key:'REJECTED',
20+
text:t('Rejected')
21+
},
22+
{
23+
key:'CONFIRMED',
24+
text:t('Confirmed')
25+
}
26+
]
27+
28+
return {
29+
filters,
30+
statusItems
31+
}
32+
},
33+
components: {
34+
VForm,
35+
VInput
36+
},
37+
emits: ['update:modelValue'],
38+
39+
}
40+
</script>
41+
42+
<template>
43+
<VForm class="flex">
44+
<div class="col-3">
45+
<VInput v-model="filters.searchQuery" :placeholder="$t('SearchInputPlaceholder')" id="searchQuery" />
46+
</div>
47+
</VForm>
48+
</template>

src/locales/en/messages.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export default {
2020
"Email": "Email",
2121
"Loading": "Loading",
2222
"Previous": "Previous",
23+
"SearchInputPlaceholder":'Search...',
24+
"Text":"Text",
2325
"Next": "Next",
2426
"From": "From",
2527
"Size": "Size",
@@ -38,4 +40,6 @@ export default {
3840
"Dark": "Dark",
3941
"System": "System",
4042
"Settings": "Settings",
43+
"Actions":"Actions",
44+
"EmailPlaceholder":"Email"
4145
};

src/locales/fa/messages.js

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,46 @@
11
export default {
2-
"Login": "ورود",
3-
"Username": "نام کاریری",
4-
"Password": "رمز عبور",
5-
"Submit": "ارسال",
6-
"Cancel": "انصراف",
7-
"Dashboard": "داشبورد",
8-
"Users": "کاربران",
9-
"Comments": "نظرات",
10-
"Confirm":"تایید شده",
11-
"Rejected":"رد شده",
12-
"Pending":"در انتظار تایید",
2+
Login: "ورود",
3+
Username: "نام کاریری",
4+
Password: "رمز عبور",
5+
Submit: "ارسال",
6+
Cancel: "انصراف",
7+
Dashboard: "داشبورد",
8+
Users: "کاربران",
9+
Comments: "نظرات",
10+
Confirm: "تایید شده",
11+
Rejected: "رد شده",
12+
Pending: "در انتظار تایید",
1313
"Authorization Error": "خطای دسترسی",
1414
"No data available": "داده\u200Cای موجود نیست",
1515
"You are successfully logged in": "شما با موفقیت وارد سیستم شدید",
1616
"Incorrect username or password": "نام کاربری یا گذرواژه اشتباه است",
1717
"System error": "خطای سیستم",
18-
"Id": "شناسه",
19-
"Name": "نام",
20-
"Email": "یارانامه",
21-
"Loading": "درحال بارگذاری",
22-
"Previous": "قبلی",
23-
"Next": "بعدی",
24-
"From": "از",
25-
"Size": "اندازه",
26-
"Todos": "کارها",
27-
"Title": "عنوان",
28-
"User": "کاربر",
29-
"Status": "وضعیت",
30-
"Completed": "تکمیل شده",
18+
Id: "شناسه",
19+
Post: "پست",
20+
Name: "نام",
21+
Email: "یارانامه",
22+
Loading: "درحال بارگذاری",
23+
Previous: "قبلی",
24+
Next: "بعدی",
25+
From: "از",
26+
Size: "اندازه",
27+
SearchInputPlaceholder: "جست و جو...",
28+
Text: "متن",
29+
Todos: "کارها",
30+
Title: "عنوان",
31+
User: "کاربر",
32+
Status: "وضعیت",
33+
Completed: "تکمیل شده",
3134
"Not completed": "تکمیل نشده",
3235
"Filter by title": "فیلتر بر اساس عنوان",
3336
"Filter by user": "فیلتر بر اساس کاربر",
3437
"Filter by status": "فیلتر بر اساس وضعیت",
35-
"Language": "زبان",
36-
"Theme": "زمینه",
37-
"Light": "روشن",
38-
"Dark": "تیره",
39-
"System": "سیستم",
40-
"Settings": "تنظیمات",
38+
Language: "زبان",
39+
Theme: "زمینه",
40+
Light: "روشن",
41+
Dark: "تیره",
42+
System: "سیستم",
43+
Settings: "تنظیمات",
44+
Actions: "عملیات",
45+
EmailPlaceholder: "Email",
4146
};

src/views/CommentsView.vue

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<div>
32
<div class="h3 mb-4">{{ $t('Comments') }}</div>
3+
<CommentsFilterForm class="mb-4" v-model="filters"/>
44
<VTableServer :items="comments" :itemsLength="comments.length" :is-loading="commentsIsLoading">
55
<VColumn :header="$t('Id')" field="id" />
66
<VColumn :header="$t('Name')" field="name" />
@@ -12,7 +12,7 @@
1212
</button>
1313
</template>
1414
</VColumn>
15-
<VColumn :header="$t('Body')" field="body" />
15+
<VColumn :header="$t('Text')" field="body" />
1616
<VColumn :header="$t('Status')" field="id">
1717
<template #body="{ item }">
1818
<span v-if="item.status==='PENDING'">
@@ -40,20 +40,28 @@
4040
</template>
4141
</VColumn>
4242
</VTableServer>
43-
</div>
4443
</template>
4544

4645
<script>
46+
import CommentsFilterForm from '@/components/comments/CommentsFilterForm.vue';
4747
import VColumn from '@/components/data-table/VColumn.vue';
4848
import VTableServer from '@/components/data-table/VTableServer.vue';
4949
import { useFetchComments } from '@/composables/comments.composable';
50+
import { useApplyFilters } from '@/composables/filter.composable';
5051
import { watch } from 'vue';
5152
5253
export default {
5354
name: 'CommentsView',
5455
setup() {
5556
const { comments, commentsIsLoading, fetchComments } = useFetchComments()
5657
58+
const filters = useApplyFilters({
59+
querySearch: undefined,
60+
status: undefined,
61+
email: undefined
62+
});
63+
64+
5765
function fetch() {
5866
const config = {}
5967
return fetchComments(config)
@@ -64,12 +72,14 @@ export default {
6472
6573
return {
6674
comments,
67-
commentsIsLoading
75+
commentsIsLoading,
76+
filters
6877
}
6978
},
7079
components: {
7180
VTableServer,
72-
VColumn
81+
VColumn,
82+
CommentsFilterForm
7383
}
7484
}
7585
</script>

0 commit comments

Comments
 (0)