|
@@ -1,10 +1,12 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="filters">
|
|
<div class="filters">
|
|
|
<div class="main-filters">
|
|
<div class="main-filters">
|
|
|
- <div class="unitCategories">
|
|
|
|
|
|
|
+ <div class="unit-category-chips">
|
|
|
<q-btn v-if="unitCategories?.list?.length > 0"
|
|
<q-btn v-if="unitCategories?.list?.length > 0"
|
|
|
flat
|
|
flat
|
|
|
- class="filter-btn unitCategory filter-btn__selected">
|
|
|
|
|
|
|
+ class="filter-btn unitCategory "
|
|
|
|
|
+ :class="{ 'filter-btn__selected': selectedUnitCategoryId===null}"
|
|
|
|
|
+ @click="onUnitCategoriesFilterChanged(null)">
|
|
|
<div class="filter-btn-title">
|
|
<div class="filter-btn-title">
|
|
|
همه
|
|
همه
|
|
|
</div>
|
|
</div>
|
|
@@ -12,17 +14,20 @@
|
|
|
<q-btn v-for="(unitCategory, unitCategoryIndex) in unitCategories.list"
|
|
<q-btn v-for="(unitCategory, unitCategoryIndex) in unitCategories.list"
|
|
|
:key="unitCategoryIndex"
|
|
:key="unitCategoryIndex"
|
|
|
flat
|
|
flat
|
|
|
- :to="{name: showCategoryRouteName, params: {category_id: unitCategory.id}}"
|
|
|
|
|
- class="filter-btn unitCategory">
|
|
|
|
|
|
|
+ class="filter-btn unitCategory"
|
|
|
|
|
+ :class="{ 'filter-btn__selected': selectedUnitCategoryId===unitCategory.id}"
|
|
|
|
|
+ @click="onUnitCategoriesFilterChanged(unitCategory.id)">
|
|
|
<div class="filter-btn-title">
|
|
<div class="filter-btn-title">
|
|
|
{{ unitCategory.title }}
|
|
{{ unitCategory.title }}
|
|
|
</div>
|
|
</div>
|
|
|
</q-btn>
|
|
</q-btn>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="unitCategories">
|
|
|
|
|
- <q-btn v-if="units?.list?.length > 0"
|
|
|
|
|
- flat
|
|
|
|
|
- class="filter-btn unitCategory filter-btn__selected">
|
|
|
|
|
|
|
+ <div v-if="units?.list?.length > 0"
|
|
|
|
|
+ class="unit-chips">
|
|
|
|
|
+ <q-btn flat
|
|
|
|
|
+ class="filter-btn unitCategory"
|
|
|
|
|
+ :class="{ 'filter-btn__selected': selectedUnitId===null}"
|
|
|
|
|
+ @click="onUnitsFilterChanged(null)">
|
|
|
<div class="filter-btn-title">
|
|
<div class="filter-btn-title">
|
|
|
همه
|
|
همه
|
|
|
</div>
|
|
</div>
|
|
@@ -30,41 +35,14 @@
|
|
|
<q-btn v-for="(unit, unitIndex) in units.list"
|
|
<q-btn v-for="(unit, unitIndex) in units.list"
|
|
|
:key="unitIndex"
|
|
:key="unitIndex"
|
|
|
flat
|
|
flat
|
|
|
- :to="{name: showCategoryRouteName, params: {category_id: unit.id}}"
|
|
|
|
|
- class="filter-btn unitCategory">
|
|
|
|
|
|
|
+ class="filter-btn unitCategory"
|
|
|
|
|
+ :class="{ 'filter-btn__selected': selectedUnitId===unit.id}"
|
|
|
|
|
+ @click="onUnitsFilterChanged(unit.id)">
|
|
|
<div class="filter-btn-title">
|
|
<div class="filter-btn-title">
|
|
|
{{ unit.title }}
|
|
{{ unit.title }}
|
|
|
</div>
|
|
</div>
|
|
|
</q-btn>
|
|
</q-btn>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="content-type-filters" />
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="sub-filters">
|
|
|
|
|
- <q-expansion-item v-model="subFilterExpanded"
|
|
|
|
|
- :header-style="'display: none;'">
|
|
|
|
|
- <q-card class="sub-filters-card">
|
|
|
|
|
- <div class="media-types">
|
|
|
|
|
- <q-btn v-for="(mediaType, mediaTypeIndex) in mediaTypes"
|
|
|
|
|
- :key="mediaTypeIndex"
|
|
|
|
|
- flat
|
|
|
|
|
- class="filter-btn unitCategory"
|
|
|
|
|
- :class="{'filter-btn__selected': selectedMediaType === mediaType.value}"
|
|
|
|
|
- @click="filterMediaType(mediaType.value)">
|
|
|
|
|
- <div class="filter-btn-title">
|
|
|
|
|
- {{ mediaType.label }}
|
|
|
|
|
- </div>
|
|
|
|
|
- </q-btn>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="search-input">
|
|
|
|
|
- <q-input v-model="searchText"
|
|
|
|
|
- debounce="500">
|
|
|
|
|
- <template #prepend>
|
|
|
|
|
- <q-icon name="search" />
|
|
|
|
|
- </template>
|
|
|
|
|
- </q-input>
|
|
|
|
|
- </div>
|
|
|
|
|
- </q-card>
|
|
|
|
|
- </q-expansion-item>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -98,12 +76,13 @@ export default {
|
|
|
default: 'category_parent_parent'
|
|
default: 'category_parent_parent'
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- emits: ['filter'],
|
|
|
|
|
|
|
+ emits: ['onUnitCategoriesFilterChanged', 'onUnitsFilterChanged'],
|
|
|
data () {
|
|
data () {
|
|
|
return {
|
|
return {
|
|
|
media: new Media(),
|
|
media: new Media(),
|
|
|
searchText: null,
|
|
searchText: null,
|
|
|
- selectedMediaType: null,
|
|
|
|
|
|
|
+ selectedUnitCategoryId: null,
|
|
|
|
|
+ selectedUnitId: null,
|
|
|
subFilterExpanded: false
|
|
subFilterExpanded: false
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -141,6 +120,14 @@ export default {
|
|
|
this.selectedMediaType = mediaType
|
|
this.selectedMediaType = mediaType
|
|
|
this.emitFilters()
|
|
this.emitFilters()
|
|
|
},
|
|
},
|
|
|
|
|
+ onUnitsFilterChanged (selectedId) {
|
|
|
|
|
+ this.selectedUnitId = selectedId
|
|
|
|
|
+ this.$emit('onUnitsFilterChanged', selectedId)
|
|
|
|
|
+ },
|
|
|
|
|
+ onUnitCategoriesFilterChanged (selectedId) {
|
|
|
|
|
+ this.selectedUnitCategoryId = selectedId
|
|
|
|
|
+ this.$emit('onUnitCategoriesFilterChanged', selectedId)
|
|
|
|
|
+ },
|
|
|
emitFilters () {
|
|
emitFilters () {
|
|
|
this.$emit('filter', this.getFilterObject())
|
|
this.$emit('filter', this.getFilterObject())
|
|
|
},
|
|
},
|
|
@@ -162,8 +149,9 @@ export default {
|
|
|
gap: 8px;
|
|
gap: 8px;
|
|
|
flex-wrap: wrap;
|
|
flex-wrap: wrap;
|
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
|
|
|
+ margin-bottom: 12px;
|
|
|
|
|
|
|
|
- .unitCategories {
|
|
|
|
|
|
|
+ .unit-category-chips {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
gap: 8px;
|
|
gap: 8px;
|
|
|
flex-wrap: nowrap;
|
|
flex-wrap: nowrap;
|
|
@@ -173,25 +161,15 @@ export default {
|
|
|
scrollbar-width: none; // فایرفاکس
|
|
scrollbar-width: none; // فایرفاکس
|
|
|
-ms-overflow-style: none; // IE و Edge قدیمی
|
|
-ms-overflow-style: none; // IE و Edge قدیمی
|
|
|
}
|
|
}
|
|
|
- .content-type-filters {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- .sub-filters {
|
|
|
|
|
- .sub-filters-card {
|
|
|
|
|
|
|
+ .unit-chips {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
gap: 8px;
|
|
gap: 8px;
|
|
|
- flex-wrap: wrap;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- justify-content: space-between;
|
|
|
|
|
- padding-top: 12px;
|
|
|
|
|
- .media-types {
|
|
|
|
|
- display: flex;
|
|
|
|
|
- gap: 8px;
|
|
|
|
|
- flex-wrap: wrap;
|
|
|
|
|
- justify-content: flex-start;
|
|
|
|
|
- height: 42.63px;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ flex-wrap: nowrap;
|
|
|
|
|
+ max-width: 100%;
|
|
|
|
|
+ overflow-x: auto;
|
|
|
|
|
+ justify-content: flex-start;
|
|
|
|
|
+ scrollbar-width: none; // فایرفاکس
|
|
|
|
|
+ -ms-overflow-style: none; // IE و Edge قدیمی
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.filter-btn {
|
|
.filter-btn {
|
|
@@ -201,7 +179,7 @@ export default {
|
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
background: #FFFFFF;
|
|
background: #FFFFFF;
|
|
|
- height: 43px;
|
|
|
|
|
|
|
+ height: 40px;
|
|
|
padding: 0 8px;
|
|
padding: 0 8px;
|
|
|
white-space: nowrap;
|
|
white-space: nowrap;
|
|
|
.filter-btn-title {
|
|
.filter-btn-title {
|