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

Revert "Add question if user has BE rijbewijs" #951

Merged
merged 1 commit into from
Mar 3, 2025
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
4 changes: 0 additions & 4 deletions app/components/cards/privacy-preference.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,5 @@
<td>Gegevens (naam, afbeelding, studie) mogen gedeeld worden in de almanak</td>
<td data-test-info-in-almanak>{{boolean-tag @model.infoInAlmanak}}</td>
</tr>
<tr>
<td>Bezit BE rijbewijs</td>
<td data-test-trailer-drivers-license>{{boolean-tag @model.trailerDriversLicense}}</td>
</tr>
</tbody>
</table>
23 changes: 0 additions & 23 deletions app/components/privacy-modal.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -125,29 +125,6 @@
</div>
{{/each}}
</div>
{{else if (eq this.step 7)}}
<b>Heb je een BE-rijbewijs?</b>
<br />
<small>
Binnen Alpha hebben we een keet om ervoor te zorgen dat
het vervoer soepel verloopt, houdt de Keetcie een lijst bij
van leden met een BE-rijbewijs.
</small>
<br />
<br />

<div
class='btn btn-primary'
{{on 'click' (fn this.select 'trailerDriversLicense' true)}}
>
Ja
</div>
<div
class='btn btn-danger'
{{on 'click' (fn this.select 'trailerDriversLicense' false)}}
>
Nee
</div>
{{/if}}

{{#if this.errorMessage}}
Expand Down
89 changes: 79 additions & 10 deletions app/components/privacy-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class PrivacyModal extends Component {

@tracked isOpen = false;
@tracked step = 1;
maxSteps = 7;
maxSteps = 6;
@tracked errorMessage = null;
get userDetailsPreferenceTypes() {
return Object.entries(UserDetailsPreferenceTypes).map(([value, label]) => ({
Expand All @@ -42,16 +42,9 @@ export default class PrivacyModal extends Component {
}
}

@action async nextPage() {
@action nextPage() {
this.errorMessage = null;
if (this.step >= this.maxSteps) {
this.model.set('setupComplete', true);
try {
await this.model.save();
} catch (error) {
this.errorMessage = error.errors.map((e) => e.detail).join(', ');
return;
}
this.isOpen = false;
return;
}
Expand All @@ -68,6 +61,82 @@ export default class PrivacyModal extends Component {

constructor() {
super(...arguments);
this.isOpen = !this.model?.setupComplete;
if (
this.model?.userDetailsSharingPreference === null ||
this.model?.allowTomatoSharing === null
) {
this.isOpen = true;
} else {
this.isOpen = false;
}
}
}
//
// export default Component.extend({
// session: service(),
// store: service(),
// fetch: service(),
// model: alias('session.currentUser'),
// isOpen: false,
// step: 1,
// maxSteps: 6,
// errorMessage: null,
// userDetailsPreferenceTypes: computed(function () {
// return Object.entries(UserDetailsPreferenceTypes).map(([value, label]) => ({
// value,
// label,
// }));
// }),
// picturePublicationPreferenceTypes: computed(function () {
// return Object.entries(PicturePublicationPreferenceTypes).map(
// ([value, label]) => ({ value, label })
// );
// }),
// actions: {
// select(attribute, value) {
// this.model.set(attribute, value);
// this.model
// .save()
// .then(() => {
// this.send('nextPage');
// })
// .catch((error) => {
// this.set(
// 'errorMessage',
// error.errors
// .map((e) => {
// return e.detail;
// })
// .join(', ')
// );
// });
// },
// nextPage() {
// this.set('errorMessage', null);
// if (this.step >= this.maxSteps) {
// this.set('isOpen', false);
// } else {
// this.set('step', this.step + 1);
// }
// },
// allowWebdav() {
// return this.fetch
// .fetch(`/users/${this.model.id}/activate_webdav`, { method: 'POST' })
// .then(() => {
// this.model.reload();
// this.send('nextPage');
// });
// },
// },
// init() {
// this._super(...arguments);
// if (
// this.model?.userDetailsSharingPreference === null ||
// this.model?.allowTomatoSharing === null
// ) {
// this.set('isOpen', true);
// } else {
// this.set('isOpen', false);
// }
// },
// });
15 changes: 0 additions & 15 deletions app/components/users/privacy-settings.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,6 @@
</div>
</div>

<div class='mb-3 row align-items-center'>
<label class='col-10 col-sm-6 col-form-label form-label' for="trailer-drivers-license-check">
Bezit BE rijbewijs
</label>
<div class='col-2 col-sm-6'>
{{input
data-test-trailerDriversLicense=true
type='checkbox'
[email protected]
class='form-check-input'
id="trailer-drivers-license-check"
}}
</div>
</div>

{{#if formActionsVisible}}
<ModelForm::FormActions
@errors={{@model.errors}}
Expand Down
4 changes: 1 addition & 3 deletions app/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ export default class User extends Model {
@attr picturePublicationPreference;

@attr ifesDataSharingPreference;
@attr allowTomatoSharing;
@attr({ allowNull: true }) allowTomatoSharing;
@attr infoInAlmanak;
@attr userDetailsSharingPreference;
@attr trailerDriversLicense;
@attr setupComplete;
// Security properties
@attr otpRequired;
@attr icalSecretKey;
Expand Down
Loading