Skip to content

Commit

Permalink
lmb-181: do not show the required toggle for adres types
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasVanHoof committed Jan 16, 2025
1 parent ec0777b commit 9943abd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/components/rdf-input-fields/crud-custom-field-modal.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@
{{selected.label}}
</PowerSelect>
</AuFormRow>
<AuFormRow>
<AuToggleSwitch
@disabled={{@show}}
@checked={{this.isFieldRequired}}
@onChange={{this.toggleIsRequired}}
>Maak veld verplicht</AuToggleSwitch>
</AuFormRow>
{{#if this.canShowRequiredToggle}}
<AuFormRow>
<AuToggleSwitch
@disabled={{@show}}
@checked={{this.isFieldRequired}}
@onChange={{this.toggleIsRequired}}
>Maak veld verplicht</AuToggleSwitch>
</AuFormRow>
{{/if}}
</form>
</:body>
<:footer>
Expand Down
5 changes: 5 additions & 0 deletions app/components/rdf-input-fields/crud-custom-field-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { JSON_API_TYPE, SOURCE_GRAPH } from 'frontend-lmb/utils/constants';
import { PROV } from 'frontend-lmb/rdf/namespaces';
import { showErrorToast } from 'frontend-lmb/utils/toasts';
import {
ADRES_CUSTOM_DISPLAY_TYPE,
LIBRARY_ENTREES,
TEXT_CUSTOM_DISPLAY_TYPE,
} from 'frontend-lmb/utils/well-known-uris';
Expand Down Expand Up @@ -255,4 +256,8 @@ export default class RdfInputFieldCrudCustomFieldModalComponent extends Componen

return 'Pas een veld aan';
}

get canShowRequiredToggle() {
return this.displayType.uri !== ADRES_CUSTOM_DISPLAY_TYPE;
}
}
2 changes: 2 additions & 0 deletions app/utils/well-known-uris.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ export const KANDIDATENLIJST_KAMER_VOLKSVERTEGENWOORDIGING =

export const TEXT_CUSTOM_DISPLAY_TYPE =
'http://lblod.data.gift/display-types/lmb/custom-string-input';
export const ADRES_CUSTOM_DISPLAY_TYPE =
'http://lblod.data.gift/display-types/lmb/custom-address-input';

export const LIBRARY_ENTREES = [
'http://data.lblod.info/id/lmb/form-library-entries/095d1329-a9fa-4d72-8c49-eb52aaf893de', // Verblijfsplaats
Expand Down

0 comments on commit 9943abd

Please sign in to comment.