Skip to content

Commit

Permalink
fix(AdminSendBulkSms.vue): refactor phone number appending method (#1300
Browse files Browse the repository at this point in the history
)

- Append each valid number individually to formData

fix(AdminSendBulkEmail.vue): refactor email appending method
- Append each valid email individually to formData

fix(OtherOrganizations.vue): update table URL and height styling
- Set table URL to '/other_organizations'
- Adjust table body height to '40rem'

feat(OtherOrganizations.vue): add overdue_count column with navigation
- Implement button to navigate to incidents for overdue counts

refactor(OtherOrganizations.vue): re-enable columns for organization metrics
- Reactivate columns for incidents, cases_reported, cases_claimed, cases_closed, cases_overdue, and last_login
```
  • Loading branch information
tabiodun authored Nov 17, 2024
1 parent 3fc0824 commit 4f87967
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 70 deletions.
149 changes: 83 additions & 66 deletions src/pages/OtherOrganizations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
ref="table"
:columns="columns"
:url="tableUrl"
:body-style="{ height: '' }"
:body-style="{ height: '40rem' }"
data-testid="testOrganizationsDataTable"
class="bg-white border"
:query="{
Expand All @@ -49,6 +49,23 @@
fields: 'id,name,url,facebook,twitter,type_t',
}"
>
<template #overdue_count="slotProps">
<base-button
class="text-primary-dark underline"
:action="
() => {
$router.push(
`/incident/${currentIncidentId}/work?showTable=true&work_type__claimed_by=${
slotProps.item.id
}&work_type__status__in=${getOpenStatuses()}&created_at__lte=${getCreatedAtLteFilter()}`,
);
}
"
>
{{ slotProps.item.overdue_count || 0 }}
</base-button>
</template>

<template #url="slotProps">
<base-button
class="text-primary-dark underline sm:ml-0 ml-1"
Expand Down Expand Up @@ -142,7 +159,7 @@ export default defineComponent({
const store = useStore();
const ccuApi = useApi();
const { t, locale } = useI18n();
const tableUrl = import.meta.env.VITE_APP_API_BASE_URL + '/organizations';
const tableUrl = '/other_organizations';
const loading = ref(false);
const table = ref(null);
Expand Down Expand Up @@ -200,70 +217,70 @@ export default defineComponent({
sortable: false,
width: '1fr',
},
// {
// title: t('otherOrganizations.incidents'),
// dataIndex: 'incident_count',
// key: 'incident_count',
// sortable: true,
// transformer(item: number) {
// return item || 0;
// },
// class: 'justify-center',
// headerClass: 'justify-center',
// },
// {
// title: t('otherOrganizations.cases_reported'),
// dataIndex: 'reported_count',
// key: 'reported_count',
// sortable: true,
// transformer(item: number) {
// return item || 0;
// },
// class: 'justify-center',
// headerClass: 'justify-center',
// },
// {
// title: t('otherOrganizations.cases_claimed'),
// dataIndex: 'claimed_count',
// key: 'claimed_count',
// sortable: true,
// transformer(item: number) {
// return item || 0;
// },
// class: 'justify-center',
// headerClass: 'justify-center',
// },
// {
// title: t('otherOrganizations.cases_closed'),
// dataIndex: 'closed_count',
// key: 'closed_count',
// sortable: true,
// transformer(item: number) {
// return item || 0;
// },
// class: 'justify-center',
// headerClass: 'justify-center',
// },
// {
// title: t('otherOrganizations.cases_overdue'),
// dataIndex: 'overdue_count',
// key: 'overdue_count',
// sortable: true,
// class: 'justify-center',
// headerClass: 'justify-center',
// },
// {
// title: t('otherOrganizations.last_login'),
// dataIndex: 'last_login',
// key: 'last_login',
// sortable: true,
// class: 'justify-center',
// headerClass: 'justify-center',
// width: '150px',
// transformer(item: Date) {
// return moment(item).fromNow();
// },
// },
{
title: t('otherOrganizations.incidents'),
dataIndex: 'incident_count',
key: 'incident_count',
// sortable: true,
transformer(item: number) {
return item || 0;
},
class: 'justify-center',
headerClass: 'justify-center',
},
{
title: t('otherOrganizations.cases_reported'),
dataIndex: 'reported_count',
key: 'reported_count',
sortable: true,
transformer(item: number) {
return item || 0;
},
class: 'justify-center',
headerClass: 'justify-center',
},
{
title: t('otherOrganizations.cases_claimed'),
dataIndex: 'claimed_count',
key: 'claimed_count',
// sortable: true,
transformer(item: number) {
return item || 0;
},
class: 'justify-center',
headerClass: 'justify-center',
},
{
title: t('otherOrganizations.cases_closed'),
dataIndex: 'closed_count',
key: 'closed_count',
// sortable: true,
transformer(item: number) {
return item || 0;
},
class: 'justify-center',
headerClass: 'justify-center',
},
{
title: t('otherOrganizations.cases_overdue'),
dataIndex: 'overdue_count',
key: 'overdue_count',
// sortable: true,
class: 'justify-center',
headerClass: 'justify-center',
},
{
title: t('otherOrganizations.last_login'),
dataIndex: 'last_login',
key: 'last_login',
// sortable: true,
class: 'justify-center',
headerClass: 'justify-center',
width: '150px',
transformer(item: Date) {
return moment(item).fromNow();
},
},
]);
onMounted(async () => {
Expand Down
5 changes: 3 additions & 2 deletions src/pages/admin/AdminSendBulkEmail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,9 @@ const sendEmails = async () => {
return;
}

// Append emails to formData
formData.append('emails', JSON.stringify(validEmails));
validEmails.forEach((email: string) => {
formData.append('emails', email);
});
} else if (inputMethod.value === 'csvFile') {
if (!csvFile.value) {
$toasted.error(t('Please upload a CSV file.'));
Expand Down
5 changes: 3 additions & 2 deletions src/pages/admin/AdminSendBulkSms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,9 @@ const sendSMS = async () => {
return;
}

// Append phone numbers to formData
formData.append('phone_numbers', JSON.stringify(validNumbers));
validNumbers.forEach((number: string) => {
formData.append('phone_numbers', number);
});
} else if (inputMethod.value === 'csvFile') {
if (!csvFile.value) {
$toasted.error(t('Please upload a CSV file.'));
Expand Down

0 comments on commit 4f87967

Please sign in to comment.