Skip to content
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
9 changes: 9 additions & 0 deletions public/themes/custom/asuntotuotanto/asuntotuotanto.theme
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,14 @@ function asuntotuotanto_preprocess_node(&$variables) {
}
}

$userHasReservedOrSoldApartment = FALSE;
if (\Drupal::currentUser()->isAuthenticated()) {
// Check if user has offered, offer_accepted or sold reservations.
$userHasReservedOrSoldApartment = $project->getUserHasReservedOrSoldApartments(
\Drupal::currentUser()->id()
);
}

$street_address = $project->get('field_street_address')->value ?? NULL;
$postal_code = $project->get('field_postal_code')->value ?? NULL;
$city = $project->get('field_city')->value ?? NULL;
Expand Down Expand Up @@ -842,6 +850,7 @@ function asuntotuotanto_preprocess_node(&$variables) {
$variables['field_parking_fee'] = $apartment->get('field_parking_fee')->getValue()[0]['value'] ?? NULL;
$variables['field_parking_fee_explanation'] = $apartment->get('field_parking_fee_explanation')->getValue()[0]['value'] ?? NULL;
$variables['field_other_fees'] = $apartment->get('field_other_fees')->getValue()[0]['value'] ?? NULL;
$variables['current_user_has_reserved_or_sold_apartment'] = $userHasReservedOrSoldApartment;
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,25 @@
</div>

<div class="apartment__header-section apartment__header-section--actions {{ is_application_period_active or can_apply_afterwards ? 'is-application-period-active' }}">
{% if current_user_has_reserved_or_sold_apartment == FALSE %}
{% if is_application_period_active %}
{% include '@asuntotuotanto/button/button.html.twig' with {
type: 'primary',
disabled: false,
label: 'Create an application'|t,
href: application_url
}
%}
{% elseif can_apply_afterwards == 1 %}
{% include '@asuntotuotanto/button/button.html.twig' with {
type: 'primary',
disabled: false,
label: 'Create an after-application'|t,
href: application_url
}
%}
{% endif %}
%}
{% elseif can_apply_afterwards == 1 %}
{% include '@asuntotuotanto/button/button.html.twig' with {
type: 'primary',
disabled: false,
label: 'Create an after-application'|t,
href: application_url
}
%}
{% endif %}
{% endif %}
<p class="apartment__application-information">
{% if (is_application_period_in_the_past is same as(false)) and (application_start_time != null and application_end_time != null) %}
{% trans %}
Expand Down