Skip to content

Commit

Permalink
Merge pull request #3136 from glific/enhancement/hsm-filters
Browse files Browse the repository at this point in the history
Added failed status for HSM filters
  • Loading branch information
kurund authored Nov 25, 2024
2 parents ec8a274 + b0bfa94 commit 78d8b55
Showing 1 changed file with 9 additions and 28 deletions.
37 changes: 9 additions & 28 deletions src/containers/Template/List/Template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,8 @@ import { List } from 'containers/List/List';
import { WhatsAppToJsx } from 'common/RichEditor';
import { STANDARD_DATE_TIME_FORMAT, GUPSHUP_ENTERPRISE_SHORTCODE } from 'common/constants';
import { capitalizeFirstLetter } from 'common/utils';
import {
GET_TEMPLATES_COUNT,
FILTER_TEMPLATES,
FILTER_SESSION_TEMPLATES,
} from 'graphql/queries/Template';
import {
BULK_APPLY_TEMPLATES,
DELETE_TEMPLATE,
IMPORT_TEMPLATES,
} from 'graphql/mutations/Template';
import { GET_TEMPLATES_COUNT, FILTER_TEMPLATES, FILTER_SESSION_TEMPLATES } from 'graphql/queries/Template';
import { BULK_APPLY_TEMPLATES, DELETE_TEMPLATE, IMPORT_TEMPLATES } from 'graphql/mutations/Template';
import { GET_TAGS } from 'graphql/queries/Tags';
import { ImportButton } from 'components/UI/ImportButton/ImportButton';
import DownArrow from 'assets/images/icons/DownArrow.svg?react';
Expand All @@ -41,11 +33,7 @@ import { RaiseToGupShup } from './RaiseToGupshupDialog/RaiseToGupShup';
const getLabel = (label: string, quality?: string, isHsm?: boolean) => (
<div className={styles.LabelContainer}>
<div className={styles.LabelText}>{label}</div>
{isHsm && (
<div className={styles.Quality}>
{quality && quality !== 'UNKNOWN' ? quality : 'Not Rated'}
</div>
)}
{isHsm && <div className={styles.Quality}>{quality && quality !== 'UNKNOWN' ? quality : 'Not Rated'}</div>}
</div>
);

Expand Down Expand Up @@ -133,9 +121,7 @@ export const Template = ({
setImporting(false);
if (data && data.bulkApplyTemplates) {
exportCsvFile(data.bulkApplyTemplates.csv_rows, 'result');
setNotification(
t('Templates applied successfully. Please check the csv file for the results')
);
setNotification(t('Templates applied successfully. Please check the csv file for the results'));
}
},
onError: () => {
Expand Down Expand Up @@ -194,7 +180,7 @@ export const Template = ({
if (isHSM) {
columnNames.push({ name: 'category', label: t('Category') });
columnNames.push({ name: 'status', label: t('Status') });
if (filters.REJECTED) {
if (filters.REJECTED || filters.FAILED) {
columnNames.push({ label: t('Reason') });
}
} else {
Expand All @@ -210,7 +196,7 @@ export const Template = ({
...columnStyles,
styles.Category,
styles.Status,
...(filters.REJECTED ? [styles.Reason] : []),
...(filters.REJECTED || filters.FAILED ? [styles.Reason] : []),
styles.Actions,
]
: [...columnStyles, styles.LastModified, styles.Actions];
Expand All @@ -236,7 +222,7 @@ export const Template = ({
if (isHSM) {
columns.category = getCategory(category);
columns.status = getStatus(status);
if (filters.REJECTED) {
if (filters.REJECTED || filters.FAILED) {
columns.reason = getReason(reason);
}
} else {
Expand Down Expand Up @@ -308,7 +294,7 @@ export const Template = ({
const dialogMessage = t('It will stop showing when you draft a customized message');

let filterValue: any = '';
const statusList = ['Approved', 'Pending', 'Rejected'];
const statusList = ['Approved', 'Pending', 'Rejected', 'Failed'];

const handleCheckedBox = (event: any) => {
setFilters({ ...statusFilter, [event.target.value.toUpperCase()]: true });
Expand Down Expand Up @@ -401,12 +387,7 @@ export const Template = ({
if (isHSM) {
secondaryButton = (
<div className={styles.ImportButton}>
<a
href={BULK_APPLY_SAMPLE_LINK}
target="_blank"
rel="noreferrer"
className={styles.HelperText}
>
<a href={BULK_APPLY_SAMPLE_LINK} target="_blank" rel="noreferrer" className={styles.HelperText}>
View Sample
</a>
<ImportButton
Expand Down

0 comments on commit 78d8b55

Please sign in to comment.