Skip to content

Commit

Permalink
Merge branch 'develop' into selenium/grievance_tickets_happy_path
Browse files Browse the repository at this point in the history
  • Loading branch information
szymon-kellton authored May 8, 2024
2 parents ca9eedd + db83e10 commit e0d1f93
Show file tree
Hide file tree
Showing 12 changed files with 331 additions and 116 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.25 on 2024-05-07 09:12

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('cash_assist_datahub', '0018_migration'),
]

operations = [
migrations.AlterField(
model_name='paymentrecord',
name='delivery_type',
field=models.CharField(choices=[('Cardless cash withdrawal', 'Cardless cash withdrawal'), ('Cash', 'Cash'), ('Cash by FSP', 'Cash by FSP'), ('Cheque', 'Cheque'), ('Deposit to Card', 'Deposit to Card'), ('Mobile Money', 'Mobile Money'), ('Pre-paid card', 'Pre-paid card'), ('Referral', 'Referral'), ('Transfer', 'Transfer'), ('Transfer to Account', 'Transfer to Account'), ('Voucher', 'Voucher'), ('Cash over the counter', 'Cash over the counter'), ('ATM Card', 'ATM Card')], default='Cash', max_length=24, null=True),
),
]
49 changes: 49 additions & 0 deletions backend/hct_mis_api/apps/payment/migrations/0126_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Generated by Django 3.2.25 on 2024-05-07 09:12

from django.db import migrations, models
import hct_mis_api.apps.account.models


class Migration(migrations.Migration):

dependencies = [
('payment', '0125_migration'),
]

operations = [
migrations.AlterField(
model_name='cashplan',
name='delivery_type',
field=models.CharField(choices=[('Cardless cash withdrawal', 'Cardless cash withdrawal'), ('Cash', 'Cash'), ('Cash by FSP', 'Cash by FSP'), ('Cheque', 'Cheque'), ('Deposit to Card', 'Deposit to Card'), ('Mobile Money', 'Mobile Money'), ('Pre-paid card', 'Pre-paid card'), ('Referral', 'Referral'), ('Transfer', 'Transfer'), ('Transfer to Account', 'Transfer to Account'), ('Voucher', 'Voucher'), ('Cash over the counter', 'Cash over the counter'), ('ATM Card', 'ATM Card')], db_index=True, max_length=24, null=True),
),
migrations.AlterField(
model_name='deliverymechanismperpaymentplan',
name='delivery_mechanism',
field=models.CharField(choices=[('Cardless cash withdrawal', 'Cardless cash withdrawal'), ('Cash', 'Cash'), ('Cash by FSP', 'Cash by FSP'), ('Cheque', 'Cheque'), ('Deposit to Card', 'Deposit to Card'), ('Mobile Money', 'Mobile Money'), ('Pre-paid card', 'Pre-paid card'), ('Referral', 'Referral'), ('Transfer', 'Transfer'), ('Transfer to Account', 'Transfer to Account'), ('Voucher', 'Voucher'), ('Cash over the counter', 'Cash over the counter'), ('ATM Card', 'ATM Card')], db_index=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='financialserviceprovider',
name='delivery_mechanisms',
field=hct_mis_api.apps.account.models.HorizontalChoiceArrayField(base_field=models.CharField(choices=[('Cardless cash withdrawal', 'Cardless cash withdrawal'), ('Cash', 'Cash'), ('Cash by FSP', 'Cash by FSP'), ('Cheque', 'Cheque'), ('Deposit to Card', 'Deposit to Card'), ('Mobile Money', 'Mobile Money'), ('Pre-paid card', 'Pre-paid card'), ('Referral', 'Referral'), ('Transfer', 'Transfer'), ('Transfer to Account', 'Transfer to Account'), ('Voucher', 'Voucher'), ('Cash over the counter', 'Cash over the counter'), ('ATM Card', 'ATM Card')], max_length=24), size=None),
),
migrations.AlterField(
model_name='financialserviceproviderxlsxtemplate',
name='core_fields',
field=hct_mis_api.apps.account.models.HorizontalChoiceArrayField(base_field=models.CharField(blank=True, choices=[('age', 'Age (calculated)'), ('residence_status', 'Residence status'), ('consent', 'Do you consent?'), ('consent_sign', 'Do you consent?'), ('country_origin', 'Country of Origin'), ('country', 'Country of registration'), ('address', 'Address'), ('zip_code', 'Zip code'), ('admin1', 'Household resides in which admin1?'), ('admin2', 'Household resides in which admin2?'), ('admin3', 'Household resides in which admin3?'), ('admin4', 'Household resides in which admin4?'), ('geopoint', 'Geolocation'), ('unhcr_id', 'UNHCR Case ID'), ('returnee', 'Is this a returnee Household?'), ('size', 'What is the Household size?'), ('fchild_hoh', 'Child is female and Head of Household'), ('child_hoh', 'Child is Head of Household'), ('relationship', 'Relationship to Head of Household'), ('full_name', 'Full name'), ('given_name', 'Given name'), ('middle_name', 'Middle name(s)'), ('family_name', 'Family name'), ('sex', 'Gender'), ('birth_date', 'Birth date'), ('estimated_birth_date', 'Estimated birth date?'), ('photo', "Individual's photo"), ('marital_status', 'Marital status'), ('phone_no', 'Phone number'), ('who_answers_phone', 'Who answers this phone?'), ('phone_no_alternative', 'Alternative phone number'), ('who_answers_alt_phone', 'Who answers this (alt) phone?'), ('registration_method', 'Method of collection (e.g. HH survey, Community, etc.)'), ('collect_individual_data', 'Will you be collecting all member Individual data?'), ('currency', 'Which currency will be used for financial questions?'), ('birth_certificate_no', 'Birth certificate number'), ('birth_certificate_issuer', 'Issuing country of birth certificate'), ('birth_certificate_photo', 'Birth certificate photo'), ('tax_id_no', 'Tax identification number'), ('tax_id_issuer', 'Issuing country of tax identification'), ('tax_id_photo', 'Tax identification photo'), ('drivers_license_no', "Driver's license number"), ('drivers_license_issuer', "Issuing country of driver's license"), ('drivers_license_photo', "Driver's license photo"), ('electoral_card_no', 'Electoral card number'), ('electoral_card_issuer', 'Issuing country of electoral card'), ('electoral_card_photo', 'Electoral card photo'), ('unhcr_id_no', 'UNHCR ID number'), ('unhcr_id_issuer', 'Issuing entity of UNHCR ID'), ('unhcr_id_photo', 'UNHCR ID photo'), ('national_passport', 'National passport number'), ('national_passport_issuer', 'Issuing country of national passport'), ('national_passport_photo', 'National passport photo'), ('national_id_no', 'National ID number'), ('national_id_issuer', 'Issuing country of national ID'), ('national_id_photo', 'National ID photo'), ('scope_id_no', 'WFP Scope ID number'), ('scope_id_issuer', 'Issuing entity of SCOPE ID'), ('scope_id_photo', 'WFP Scope ID photo'), ('other_id_type', 'If other type of ID, specify the type'), ('other_id_no', 'Other ID number'), ('other_id_issuer', 'Issuing country of other ID'), ('other_id_photo', 'ID photo'), ('female_age_group_0_5_count', 'Females Age 0 - 5'), ('female_age_group_6_11_count', 'Females Age 6 - 11'), ('female_age_group_12_17_count', 'Females Age 12 - 17'), ('female_age_group_18_59_count', 'Females Age 18 - 59'), ('female_age_group_60_count', 'Females Age 60 +'), ('pregnant_count', 'Pregnant count'), ('male_age_group_0_5_count', 'Males Age 0 - 5'), ('male_age_group_6_11_count', 'Males Age 6 - 11'), ('male_age_group_12_17_count', 'Males Age 12 - 17'), ('male_age_group_18_59_count', 'Males Age 18 - 59'), ('male_age_group_60_count', 'Males Age 60 +'), ('female_age_group_0_5_disabled_count', 'Females age 0 - 5 with disability'), ('female_age_group_6_11_disabled_count', 'Females age 6 - 11 with disability'), ('female_age_group_12_17_disabled_count', 'Females age 12 - 17 with disability'), ('female_age_group_18_59_disabled_count', 'Females Age 18 - 59 with disability'), ('female_age_group_60_disabled_count', 'Female members with Disability age 60 +'), ('male_age_group_0_5_disabled_count', 'Males age 0 - 5 with disability'), ('male_age_group_6_11_disabled_count', 'Males age 6 - 11 with disability'), ('male_age_group_12_17_disabled_count', 'Males age 12 - 17 with disability'), ('male_age_group_18_59_disabled_count', 'Males Age 18 - 59 with disability'), ('male_age_group_60_disabled_count', 'Male members with Disability age 60 +'), ('pregnant', 'Is the Individual pregnant?'), ('work_status', 'Does the Individual have paid employment in the current month?'), ('observed_disability', 'Does the Individual have disability?'), ('seeing_disability', 'If the Individual has difficulty seeing, what is the severity?'), ('hearing_disability', 'If the Individual has difficulty hearing, what is the severity?'), ('physical_disability', 'If the Individual has difficulty walking or climbing steps, what is the severity?'), ('memory_disability', 'If the Individual has difficulty remembering or concentrating, what is the severity?'), ('selfcare_disability', 'Do you have difficulty (with self-care such as) washing all over or dressing'), ('comms_disability', 'If the Individual has difficulty communicating, what is the severity?'), ('fchild_hoh', 'Female child headed Household'), ('child_hoh', 'Child headed Household'), ('village', 'Village'), ('deviceid', 'Device ID'), ('name_enumerator', 'Name of the enumerator'), ('org_enumerator', 'Organization of the enumerator'), ('consent_sharing', 'Which organizations may we share your information with?'), ('org_name_enumerator', 'Name of partner organization'), ('disability', 'Individual is disabled?'), ('first_registration_date', 'First Individual registration date'), ('first_registration_date', 'First Household registration date'), ('number_of_children', 'What is the number of children in the Household?'), ('has_phone_number', 'Has phone number?'), ('has_tax_id_number', 'Has tax ID number?'), ('has_the_bank_account_number', 'Has the bank account number?'), ('role', 'Role'), ('registration_data_import', 'Registration Data Import'), ('registration_data_import', 'Registration Data Import'), ('unicef_id', 'Household unicef id'), ('unicef_id', 'Individual unicef id'), ('admin_area_title', 'Household resides in which admin area?'), ('start', 'Data collection start date'), ('end', 'Data collection end date'), ('primary_collector_id', 'List of primary collectors ids, separated by a semicolon'), ('alternate_collector_id', 'List of alternate collectors ids, separated by a semicolon'), ('household_id', 'Household ID'), ('household_id', 'Household ID'), ('email', 'Individual email'), ('preferred_language', 'Preferred language'), ('age_at_registration', 'Age at registration'), ('account_holder_name', 'Account holder name'), ('bank_branch_name', 'Bank branch name'), ('index_id', 'Index ID'), ('registration_id', 'Program registration id'), ('bank_name', 'Bank name'), ('bank_account_number', 'Bank account number'), ('debit_card_issuer', 'Debit Card Issuer'), ('debit_card_number', 'Debit card number'), ('payment_delivery_phone_no', 'Payment delivery phone number')], max_length=255), blank=True, default=list, size=None),
),
migrations.AlterField(
model_name='fspxlsxtemplateperdeliverymechanism',
name='delivery_mechanism',
field=models.CharField(choices=[('Cardless cash withdrawal', 'Cardless cash withdrawal'), ('Cash', 'Cash'), ('Cash by FSP', 'Cash by FSP'), ('Cheque', 'Cheque'), ('Deposit to Card', 'Deposit to Card'), ('Mobile Money', 'Mobile Money'), ('Pre-paid card', 'Pre-paid card'), ('Referral', 'Referral'), ('Transfer', 'Transfer'), ('Transfer to Account', 'Transfer to Account'), ('Voucher', 'Voucher'), ('Cash over the counter', 'Cash over the counter'), ('ATM Card', 'ATM Card')], max_length=255, verbose_name='Delivery Mechanism'),
),
migrations.AlterField(
model_name='payment',
name='delivery_type',
field=models.CharField(choices=[('Cardless cash withdrawal', 'Cardless cash withdrawal'), ('Cash', 'Cash'), ('Cash by FSP', 'Cash by FSP'), ('Cheque', 'Cheque'), ('Deposit to Card', 'Deposit to Card'), ('Mobile Money', 'Mobile Money'), ('Pre-paid card', 'Pre-paid card'), ('Referral', 'Referral'), ('Transfer', 'Transfer'), ('Transfer to Account', 'Transfer to Account'), ('Voucher', 'Voucher'), ('Cash over the counter', 'Cash over the counter'), ('ATM Card', 'ATM Card')], max_length=24, null=True),
),
migrations.AlterField(
model_name='paymentrecord',
name='delivery_type',
field=models.CharField(choices=[('Cardless cash withdrawal', 'Cardless cash withdrawal'), ('Cash', 'Cash'), ('Cash by FSP', 'Cash by FSP'), ('Cheque', 'Cheque'), ('Deposit to Card', 'Deposit to Card'), ('Mobile Money', 'Mobile Money'), ('Pre-paid card', 'Pre-paid card'), ('Referral', 'Referral'), ('Transfer', 'Transfer'), ('Transfer to Account', 'Transfer to Account'), ('Voucher', 'Voucher'), ('Cash over the counter', 'Cash over the counter'), ('ATM Card', 'ATM Card')], max_length=24, null=True),
),
]
3 changes: 3 additions & 0 deletions backend/hct_mis_api/apps/payment/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ class GenericPayment(TimeStampedUUIDModel):
DELIVERY_TYPE_TRANSFER_TO_ACCOUNT = "Transfer to Account"
DELIVERY_TYPE_VOUCHER = "Voucher"
DELIVERY_TYPE_CASH_OVER_THE_COUNTER = "Cash over the counter"
DELIVERY_TYPE_ATM_CARD = "ATM Card"

DELIVERY_TYPES_IN_CASH = (
DELIVERY_TYPE_CARDLESS_CASH_WITHDRAWAL,
Expand All @@ -285,6 +286,7 @@ class GenericPayment(TimeStampedUUIDModel):
DELIVERY_TYPE_TRANSFER,
DELIVERY_TYPE_TRANSFER_TO_ACCOUNT,
DELIVERY_TYPE_CASH_OVER_THE_COUNTER,
DELIVERY_TYPE_ATM_CARD,
)
DELIVERY_TYPES_IN_VOUCHER = (DELIVERY_TYPE_VOUCHER,)

Expand All @@ -301,6 +303,7 @@ class GenericPayment(TimeStampedUUIDModel):
(DELIVERY_TYPE_TRANSFER_TO_ACCOUNT, _("Transfer to Account")),
(DELIVERY_TYPE_VOUCHER, _("Voucher")),
(DELIVERY_TYPE_CASH_OVER_THE_COUNTER, _("Cash over the counter")),
(DELIVERY_TYPE_ATM_CARD, _("ATM Card")),
)

business_area = models.ForeignKey("core.BusinessArea", on_delete=models.CASCADE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export const fakeApolloAllHouseholdsForPopulationTable = [
businessArea: 'afghanistan',
familySize: '{"min":"","max":""}',
search: '',
searchType: 'household_id',
documentType: 'national_id',
documentNumber: '',
admin2: '',
residenceStatus: '',
first: 10,
Expand All @@ -30,23 +31,20 @@ export const fakeApolloAllHouseholdsForPopulationTable = [
{
cursor: 'YXJyYXljb25uZWN0aW9uOjA=',
node: {
id:
'SG91c2Vob2xkTm9kZTowOWI4YWE2ZC1hOTViLTQ5NWEtYTM0ZS1kMGM0YmQyNWE4Njc=',
id: 'SG91c2Vob2xkTm9kZTowOWI4YWE2ZC1hOTViLTQ5NWEtYTM0ZS1kMGM0YmQyNWE4Njc=',
status: 'ACTIVE',
unicefId: 'HH-20-0000.0001',
hasDuplicates: false,
sanctionListPossibleMatch: false,
sanctionListConfirmedMatch: false,
headOfHousehold: {
id:
'SW5kaXZpZHVhbE5vZGU6N2JhZjlhMGItODQ4My00MDA0LTg2NzAtMGU4YTUwZjI1YTMw',
id: 'SW5kaXZpZHVhbE5vZGU6N2JhZjlhMGItODQ4My00MDA0LTg2NzAtMGU4YTUwZjI1YTMw',
fullName: 'Agata Kowalska',
__typename: 'IndividualNode',
},
size: 4,
admin2: {
id:
'QXJlYU5vZGU6NzYxZjhkODQtOTljZi00MWExLTk1MmYtMTQ5ZWFhNjJkZDJh',
id: 'QXJlYU5vZGU6NzYxZjhkODQtOTljZi00MWExLTk1MmYtMTQ5ZWFhNjJkZDJh',
name: 'Achin',
__typename: 'AreaNode',
},
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/components/core/DocumentSearchField.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { render } from '../../testUtils/testUtils';
import { DocumentSearchField } from '@core/DocumentSearchField';

describe('components/core/DocumentSearchField', () => {
it('should render', () => {
const onChangeHandler = () => {};
const choices = [
{ value: 'Document 1', name: 'Document 1' },
{ value: 'Document 2', name: 'Document 2' },
{ value: 'Document 3', name: 'Document 3' },
{ value: 'Document 4', name: 'Document 4' },
];

const { container } = render(
<DocumentSearchField
onChange={onChangeHandler}
type="Document 1"
number="123123123"
choices={choices}
/>,
);
expect(container).toMatchSnapshot();
});
});
53 changes: 53 additions & 0 deletions frontend/src/components/core/DocumentSearchField.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { Grid, MenuItem } from '@mui/material';
import { SelectFilter } from '@core/SelectFilter';
import { SearchTextField } from '@core/SearchTextField';
import { ChoiceObject } from '@generated/graphql';
import { useTranslation } from 'react-i18next';

interface DocumentSearchFieldProps {
onChange: (key: string, value: string) => void;
type: string;
number: string;
choices: ChoiceObject[];
}

export const DocumentSearchField = ({
onChange,
type,
number,
choices = [],
}: DocumentSearchFieldProps) => {
const { t } = useTranslation();

return (
<Grid container item xs={6} spacing={0}>
<Grid item xs={4}>
<SelectFilter
onChange={(e) => onChange('documentType', e.target.value)}
label={t('Document Type')}
value={type}
borderRadius="0px 4px 4px 0px"
data-cy="filters-document-type"
fullWidth
disableClearable
>
{choices.map(({ name, value }) => (
<MenuItem key={value} value={value}>
{name}
</MenuItem>
))}
</SelectFilter>
</Grid>
<Grid item xs={8}>
<SearchTextField
value={number}
label={t('Document Number')}
placeholder="Document Number"
onChange={(e) => onChange('documentNumber', e.target.value)}
data-cy="filters-document-number"
borderRadius="4px 0px 0px 4px"
/>
</Grid>
</Grid>
);
};
9 changes: 5 additions & 4 deletions frontend/src/components/core/SearchTextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import styled from 'styled-components';
import * as React from 'react';

interface StyledTextFieldProps extends OutlinedTextFieldProps {
borderRadius?: string;
$borderRadius?: string;
}

const StyledTextField = styled(TextField)<StyledTextFieldProps>`
Expand All @@ -17,24 +17,25 @@ const StyledTextField = styled(TextField)<StyledTextFieldProps>`
min-width: 150px;
}
.MuiOutlinedInput-root {
border-radius: ${(props) => props.borderRadius};
border-radius: ${(props) => props.$borderRadius};
}
`;

export function SearchTextField({
icon = null,
borderRadius = '4px',
fullWidth = true,
placeholder = 'Search',
...props
}): React.ReactElement {
return (
<StyledTextField
{...props}
size="small"
fullWidth={fullWidth}
borderRadius={borderRadius}
$borderRadius={borderRadius}
variant="outlined"
placeholder="Search"
placeholder={placeholder}
inputProps={{ maxLength: 200 }}
// https://github.com/mui-org/material-ui/issues/12805
// eslint-disable-next-line react/jsx-no-duplicate-props
Expand Down
Loading

0 comments on commit e0d1f93

Please sign in to comment.