Restructure omni services and add Chatwoot research snapshot

This commit is contained in:
Ruslan Bakiev
2026-02-21 11:11:27 +07:00
parent edea7a0034
commit b73babbbf6
7732 changed files with 978203 additions and 32 deletions

View File

@@ -0,0 +1,33 @@
<script setup>
import Button from 'dashboard/components-next/button/Button.vue';
defineProps({
buttonText: {
type: String,
default: '',
},
trailingIcon: {
type: Boolean,
default: false,
},
icon: {
type: String,
default: '',
},
});
</script>
<template>
<Button
ghost
slate
sm
class="relative"
no-animation
:icon="icon"
:trailing-icon="trailingIcon"
>
<span class="min-w-0 truncate">{{ buttonText }}</span>
<slot name="dropdown" />
</Button>
</template>

View File

@@ -0,0 +1,14 @@
<script setup>
defineProps({
message: {
type: String,
default: '',
},
});
</script>
<template>
<div class="flex items-center justify-center h-10 text-sm text-n-slate-11">
{{ message }}
</div>
</template>

View File

@@ -0,0 +1,114 @@
<script setup>
import { ref, computed } from 'vue';
import { debounce } from '@chatwoot/utils';
import { picoSearch } from '@scmmishra/pico-search';
import ListItemButton from './DropdownListItemButton.vue';
import DropdownSearch from './DropdownSearch.vue';
import DropdownEmptyState from './DropdownEmptyState.vue';
import DropdownLoadingState from './DropdownLoadingState.vue';
const props = defineProps({
listItems: {
type: Array,
default: () => [],
},
enableSearch: {
type: Boolean,
default: false,
},
inputPlaceholder: {
type: String,
default: '',
},
activeFilterId: {
type: [String, Number],
default: null,
},
showClearFilter: {
type: Boolean,
default: false,
},
isLoading: {
type: Boolean,
default: false,
},
loadingPlaceholder: {
type: String,
default: '',
},
});
const emit = defineEmits(['onSearch', 'select', 'removeFilter']);
const searchTerm = ref('');
const debouncedEmit = debounce(value => {
emit('onSearch', value);
}, 300);
const onSearch = value => {
searchTerm.value = value;
debouncedEmit(value);
};
const filteredListItems = computed(() => {
if (!searchTerm.value) return props.listItems;
return picoSearch(props.listItems, searchTerm.value, ['name']);
});
const isDropdownListEmpty = computed(() => {
return !filteredListItems.value.length;
});
const isFilterActive = id => {
if (!props.activeFilterId) return false;
return id === props.activeFilterId;
};
const shouldShowLoadingState = computed(() => {
return (
props.isLoading && isDropdownListEmpty.value && props.loadingPlaceholder
);
});
const shouldShowEmptyState = computed(() => {
return !props.isLoading && isDropdownListEmpty.value;
});
</script>
<template>
<div
class="absolute z-20 w-40 bg-n-solid-2 border-0 outline outline-1 outline-n-weak shadow rounded-xl max-h-[400px]"
@click.stop
>
<slot name="search">
<DropdownSearch
v-if="enableSearch"
v-model="searchTerm"
:input-placeholder="inputPlaceholder"
:show-clear-filter="showClearFilter"
@update:model-value="onSearch"
@remove="$emit('removeFilter')"
/>
</slot>
<slot name="listItem">
<DropdownLoadingState
v-if="shouldShowLoadingState"
:message="loadingPlaceholder"
/>
<DropdownEmptyState
v-else-if="shouldShowEmptyState"
:message="$t('REPORT.FILTER_ACTIONS.EMPTY_LIST')"
/>
<ListItemButton
v-for="item in filteredListItems"
:key="item.id"
:is-active="isFilterActive(item.id)"
:button-text="item.name"
:icon="item.icon"
:icon-color="item.iconColor"
@click.stop.prevent="emit('select', item)"
/>
</slot>
</div>
</template>

View File

@@ -0,0 +1,45 @@
<script setup>
defineProps({
buttonText: {
type: String,
default: '',
},
isActive: {
type: Boolean,
default: false,
},
icon: {
type: String,
default: '',
},
iconColor: {
type: String,
default: '',
},
});
</script>
<template>
<button
class="relative inline-flex items-center justify-start w-full p-3 border-0 rounded-none first:rounded-t-xl last:rounded-b-xl h-11 hover:enabled:bg-n-alpha-2"
>
<div class="inline-flex items-center gap-3 overflow-hidden">
<fluent-icon
v-if="icon"
:icon="icon"
size="18"
:style="{ color: iconColor }"
/>
<span class="text-sm font-medium truncate text-n-slate-12">
{{ buttonText }}
</span>
<fluent-icon
v-if="isActive"
icon="checkmark"
size="18"
class="flex-shrink-0 text-n-slate-12"
/>
</div>
<slot name="dropdown" />
</button>
</template>

View File

@@ -0,0 +1,14 @@
<script setup>
defineProps({
message: {
type: String,
default: '',
},
});
</script>
<template>
<div class="flex items-center justify-center h-10 text-sm text-n-slate-11">
{{ message }}
</div>
</template>

View File

@@ -0,0 +1,51 @@
<script setup>
import { defineEmits, defineModel } from 'vue';
import NextButton from 'dashboard/components-next/button/Button.vue';
defineProps({
inputPlaceholder: {
type: String,
default: '',
},
showClearFilter: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(['remove']);
const value = defineModel({
type: String,
default: '',
});
</script>
<template>
<div
class="flex items-center justify-between h-10 min-h-[40px] sticky top-0 bg-n-solid-2 dark:bg-n-solid-2 z-10 gap-2 px-3 border-b rounded-t-xl border-n-weak"
>
<div class="flex items-center w-full gap-2" @keyup.space.prevent>
<fluent-icon
icon="search"
size="16"
class="text-n-slate-11 flex-shrink-0"
/>
<input
v-model="value"
:placeholder="inputPlaceholder"
type="search"
class="w-full mb-0 text-sm !outline-0 !outline-none bg-transparent text-n-slate-12 placeholder:text-n-slate-10 reset-base"
/>
</div>
<!-- Clear filter button -->
<NextButton
v-if="!modelValue && showClearFilter"
faded
xs
class="flex-shrink-0"
:label="$t('REPORT.FILTER_ACTIONS.CLEAR_FILTER')"
@click="emit('remove')"
/>
</div>
</template>