diff --git a/src/contactsearch/ContactSearch.ts b/src/contactsearch/ContactSearch.ts index c50f0633..51603eb9 100644 --- a/src/contactsearch/ContactSearch.ts +++ b/src/contactsearch/ContactSearch.ts @@ -199,6 +199,32 @@ export class ContactSearch extends FormElement { margin-bottom: 1em; display: block; } + + .activity-select { + display: flex; + align-items: center; + padding: var(--checkbox-padding, 10px); + border-radius: var(--curvature); + cursor: pointer; + } + + .activity-select:hover { + background: #f9f9f9; + } + + .small-select { + --temba-select-selected-padding: 0px 0.5em; + --temba-select-selected-line-height: 1em; + --temba-select-selected-font-size: 1em; + --search-input-height: 0px !important; + min-width: 100px; + } + + .filters { + padding: 1em; + border: 1px solid var(--color-borders); + border-radius: var(--curvature); + } `; } @@ -376,19 +402,42 @@ export class ContactSearch extends FormElement { private handleActivityLevelChanged(evt: any) { const select = evt.target as Select; - if (select.value && select.value !== 'all') { - this.exclusions['not_seen_since_days'] = parseInt(select.value); - } else { - delete this.exclusions['not_seen_since_days']; + const option = select.values[0]; + if (option) { + if (this.exclusions['not_seen_since_days']) { + this.exclusions['not_seen_since_days'] = parseInt(option.value); + this.refresh(); + } + } + } + + private handleActivityLabelClicked(evt: any) { + if ( + evt.target && + evt.target.tagName !== 'TEMBA-CHECKBOX' && + evt.target.tagName !== 'TEMBA-SELECT' && + !evt.target.disabled + ) { + const checkbox = evt.currentTarget.querySelector('temba-checkbox'); + checkbox.checked = !checkbox.checked; } - this.refresh(); } private handleExclusionChanged(evt: any) { if (evt.target.tagName === 'TEMBA-CHECKBOX') { const ex = JSON.stringify(this.exclusions); const checkbox = evt.target as Checkbox; - const value = checkbox.checked as any; + let value = checkbox.checked as any; + + // if we check the activity box, look inside the select for the value + if (checkbox.name === 'not_seen_since_days' && value) { + const select = checkbox.parentElement.querySelector( + 'temba-select' + ) as Select; + if (select.values[0]) { + value = parseInt(select.values[0].value); + } + } if (!value) { delete this.exclusions[checkbox.name]; @@ -459,95 +508,106 @@ export class ContactSearch extends FormElement { } return html` - ${this.advanced - ? html`
- - -
` - : html` - - - ${this.not_seen_since_days - ? html` - - - - - ` - : null} - ${this.in_a_flow - ? html`` - : null} - ${this.started_previously - ? html`` - : null}`} + ${ + this.advanced + ? html`
+ + +
` + : html` + + +
+
+ +
+ Only include contacts who... +
+
+ + ${this.not_seen_since_days + ? html` +
+ + + +
+ ${msg('Have sent a message in the last')} +
+ + + + + + +
+
+ ` + : null} + ${this.in_a_flow + ? html`` + : null} + ${this.started_previously + ? html`` + : null} +
` + } +
${summary}
- ${this.summary && this.summary.warnings - ? this.summary.warnings.map( - (warning) => - html`${unsafeHTML(warning)}` - ) - : ``} + ${ + this.summary && this.summary.warnings + ? this.summary.warnings.map( + (warning) => + html`${unsafeHTML(warning)}` + ) + : `` + } `; } } diff --git a/src/locales/es.ts b/src/locales/es.ts index c770c8ed..eddc2302 100644 --- a/src/locales/es.ts +++ b/src/locales/es.ts @@ -6,9 +6,7 @@ export const templates = { scf1453991c986b25: `Tab para completar, enter para seleccionar`, - sd4af861b95e8ba4a: `Only include contacts who have sent a message in the last 90 days.`, - sd149dff460c8dc41: `Skip contacts currently in a flow`, - sc85010c81b71421e: `Avoid interrupting a contact who is already in a flow.`, - s3e3fa53e834f4fda: `Skip repeat contacts`, - s95e715d82602bced: `Avoid restarting a contact who has been in this flow in the last 90 days.` + s638236250662c6b3: `Have sent a message in the last`, + s8f02e3a18ffc083a: `Are not currently in a flow`, + s4788ee206c4570c7: `Have not started this flow in the last 90 days` }; diff --git a/src/locales/fr.ts b/src/locales/fr.ts index 9075a26e..b0e65381 100644 --- a/src/locales/fr.ts +++ b/src/locales/fr.ts @@ -6,9 +6,7 @@ export const templates = { scf1453991c986b25: `Tab to complete, enter to select`, - sd4af861b95e8ba4a: `Only include contacts who have sent a message in the last 90 days.`, - sd149dff460c8dc41: `Skip contacts currently in a flow`, - sc85010c81b71421e: `Avoid interrupting a contact who is already in a flow.`, - s3e3fa53e834f4fda: `Skip repeat contacts`, - s95e715d82602bced: `Avoid restarting a contact who has been in this flow in the last 90 days.` + s638236250662c6b3: `Have sent a message in the last`, + s8f02e3a18ffc083a: `Are not currently in a flow`, + s4788ee206c4570c7: `Have not started this flow in the last 90 days` }; diff --git a/src/locales/pt.ts b/src/locales/pt.ts index 9075a26e..b0e65381 100644 --- a/src/locales/pt.ts +++ b/src/locales/pt.ts @@ -6,9 +6,7 @@ export const templates = { scf1453991c986b25: `Tab to complete, enter to select`, - sd4af861b95e8ba4a: `Only include contacts who have sent a message in the last 90 days.`, - sd149dff460c8dc41: `Skip contacts currently in a flow`, - sc85010c81b71421e: `Avoid interrupting a contact who is already in a flow.`, - s3e3fa53e834f4fda: `Skip repeat contacts`, - s95e715d82602bced: `Avoid restarting a contact who has been in this flow in the last 90 days.` + s638236250662c6b3: `Have sent a message in the last`, + s8f02e3a18ffc083a: `Are not currently in a flow`, + s4788ee206c4570c7: `Have not started this flow in the last 90 days` }; diff --git a/xliff/es.xlf b/xliff/es.xlf index 429e67c2..4fa7d84b 100644 --- a/xliff/es.xlf +++ b/xliff/es.xlf @@ -6,20 +6,14 @@ Tab to complete, enter to select Tab para completar, enter para seleccionar - - Only include contacts who have sent a message in the last 90 days. + + Have sent a message in the last - - Skip contacts currently in a flow + + Are not currently in a flow - - Avoid interrupting a contact who is already in a flow. - - - Skip repeat contacts - - - Avoid restarting a contact who has been in this flow in the last 90 days. + + Have not started this flow in the last 90 days diff --git a/xliff/fr.xlf b/xliff/fr.xlf index 9fb751d0..ae137b93 100644 --- a/xliff/fr.xlf +++ b/xliff/fr.xlf @@ -5,20 +5,14 @@ Tab to complete, enter to select - - Only include contacts who have sent a message in the last 90 days. + + Have sent a message in the last - - Skip contacts currently in a flow + + Are not currently in a flow - - Avoid interrupting a contact who is already in a flow. - - - Skip repeat contacts - - - Avoid restarting a contact who has been in this flow in the last 90 days. + + Have not started this flow in the last 90 days diff --git a/xliff/pt.xlf b/xliff/pt.xlf index 0f654320..a54338a4 100644 --- a/xliff/pt.xlf +++ b/xliff/pt.xlf @@ -5,20 +5,14 @@ Tab to complete, enter to select - - Only include contacts who have sent a message in the last 90 days. + + Have sent a message in the last - - Skip contacts currently in a flow + + Are not currently in a flow - - Avoid interrupting a contact who is already in a flow. - - - Skip repeat contacts - - - Avoid restarting a contact who has been in this flow in the last 90 days. + + Have not started this flow in the last 90 days