|
1 | 1 | <script> |
2 | | - import { _ } from 'svelte-i18n' |
| 2 | + import { onMount } from 'svelte'; |
| 3 | + import { _ } from 'svelte-i18n'; |
| 4 | + import Swal from 'sweetalert2'; |
| 5 | + import lodash from "lodash"; |
3 | 6 | import { |
4 | 7 | Button, |
5 | 8 | Card, |
|
13 | 16 | import HeadTitle from '$lib/common/HeadTitle.svelte'; |
14 | 17 | import TablePagination from '$lib/common/TablePagination.svelte'; |
15 | 18 | import LoadingToComplete from '$lib/common/LoadingToComplete.svelte'; |
16 | | - import { onMount } from 'svelte'; |
17 | 19 | import { getAgents } from '$lib/services/agent-service'; |
18 | | - import { getConversations, deleteConversation, getConversationStateKey } from '$lib/services/conversation-service.js'; |
| 20 | + import { getConversations, deleteConversation, getConversationStateSearchKeys } from '$lib/services/conversation-service.js'; |
19 | 21 | import { utcToLocal } from '$lib/helpers/datetime'; |
20 | | - import Swal from 'sweetalert2'; |
21 | | - import lodash from "lodash"; |
22 | | - import { ConversationChannel, ConversationTag } from '$lib/helpers/enums'; |
| 22 | + import { ConversationChannel } from '$lib/helpers/enums'; |
23 | 23 | import RemoteSearchInput from '$lib/common/RemoteSearchInput.svelte'; |
24 | 24 |
|
25 | 25 | let isLoading = false; |
|
219 | 219 | * @param {any} e |
220 | 220 | */ |
221 | 221 | function handleConfirmStateModal(e) { |
222 | | - if (stateKey && stateValue) { |
| 222 | + if (stateKey) { |
223 | 223 | searchOption.states = [ |
224 | 224 | { |
225 | 225 | key: { data: stateKey, isValid: true }, |
226 | | - value: {data: stateValue, isValid: true }, |
| 226 | + value: { data: stateValue || '', isValid: true }, |
227 | 227 | active_rounds: {data: -1, isValid: true}, |
228 | 228 | } |
229 | 229 | ]; |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 |
|
341 | | - /** |
342 | | - * @param {any} query |
343 | | - */ |
344 | | - async function handleStateSearch(query) { |
345 | | - const response = await getConversationStateKey(query); |
346 | | - return response || []; |
347 | | - } |
| 341 | + /** @param {string} query */ |
| 342 | + function handleStateSearch(query) { |
| 343 | + return new Promise((resolve) => { |
| 344 | + getConversationStateSearchKeys({ |
| 345 | + query: query |
| 346 | + }).then(res => { |
| 347 | + resolve(res || []); |
| 348 | + }).catch(() => resolve([])); |
| 349 | + }); |
| 350 | + } |
348 | 351 | </script> |
349 | 352 |
|
350 | 353 | <HeadTitle title="{$_('Conversation List')}" /> |
|
355 | 358 | <Col lg="12"> |
356 | 359 | <Card> |
357 | 360 | <CardBody class="border-bottom"> |
358 | | - <div class="d-flex align-items-center"> |
359 | | - <h5 class="mb-0 card-title flex-grow-0" style="width: 100%;">{$_('Conversation List')}</h5> |
360 | | - <div style="width: 100%;"> |
| 361 | + <div class="d-flex align-items-center" style="flex-wrap: wrap; justify-content: space-between;"> |
| 362 | + <div class="mb-0 card-title flex-grow-0"> |
| 363 | + <h5 class="mb-0">{$_('Conversation List')}</h5> |
| 364 | + </div> |
| 365 | + <div> |
361 | 366 | <div class="state-search-container"> |
362 | 367 | <div> |
363 | 368 | <RemoteSearchInput |
364 | 369 | bind:value={stateKey} |
365 | | - onSearch={handleStateSearch} |
| 370 | + onSearch={e => handleStateSearch(e)} |
366 | 371 | placeholder="Search States" |
367 | 372 | /> |
368 | 373 | </div> |
|
435 | 440 | </CardBody> |
436 | 441 | <CardBody> |
437 | 442 | <div class="table-responsive thin-scrollbar"> |
438 | | - <Table class="align-middle nowrap" bordered> |
| 443 | + <Table class="align-middle nowrap" style="table-layout: fixed;" bordered> |
439 | 444 | <thead> |
440 | 445 | <tr> |
441 | 446 | <th scope="col" class="list-title">{$_('Title')}</th> |
|
0 commit comments