Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hide same address checkbox in readonly mode + display '-' when n… #570

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions frontend/src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ const Select = (props: {
</Listbox.Label>
{props.readonly && (
<span className="font-normal text-gray-900 sm:text-sm lg:text-base text-xs">
{props.selected &&
(props.config.displayedAttribute
{props.selected
? props.config.displayedAttribute
? props.selected[props.config.displayedAttribute]
: props.selected)}
: props.selected
: '-'}
</span>
)}
{!props.readonly && (
Expand All @@ -45,10 +46,10 @@ const Select = (props: {
{(props.config.displayedAttribute && props.selected
? props.selected[props.config.displayedAttribute]
: props.selected) || (
<span className="text-gray-700 font-normal sm:text-sm lg:text-base text-xs">
{props.config.label}
</span>
)}
<span className="text-gray-700 font-normal sm:text-sm lg:text-base text-xs">
{props.config.label}
</span>
)}
</span>
<span className="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
<ChevronUpDownIcon className="h-5 w-5 text-gray-400" aria-hidden="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,24 +564,27 @@ const OrganizationGeneral = () => {
);
}}
/>
<Controller
key={OrganizationGeneralConfig.hasSameAddress.key}
name={OrganizationGeneralConfig.hasSameAddress.key}
control={control}
render={({ field: { onChange, value } }) => {
return (
<InputField
config={{
...OrganizationGeneralConfig.hasSameAddress.config,
defaultValue: value,
onChange: onChange,
id: 'create-organization-general__same-address-checkbox',
}}
disabled={readonly}
/>
);
}}
/>
{!readonly && (
<Controller
key={OrganizationGeneralConfig.hasSameAddress.key}
name={OrganizationGeneralConfig.hasSameAddress.key}
control={control}
render={({ field: { onChange, value } }) => {
console.log(value);
return (
<InputField
config={{
...OrganizationGeneralConfig.hasSameAddress.config,
defaultValue: value,
onChange: onChange,
id: 'create-organization-general__same-address-checkbox',
}}
disabled={readonly}
/>
);
}}
/>
)}

<Controller
key={OrganizationGeneralConfig.organizationAddress.key}
Expand Down