Skip to content

Commit

Permalink
Schedule: show week cycle only if cycle_type defined
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Aug 4, 2023
1 parent e36c93d commit 69eaa01
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% set previousWeekIndex = -1 %}
{% set weekCycle = ["A", "B", "C", "D"] %}

{% for bucketsByjob in bucketsByDay %}
{% set date = false %}
Expand All @@ -9,10 +8,7 @@

{# New week --------- #}
{% if not date and previousWeekIndex != weekIndex %}
<h5>
Semaine {{ weekCycle[((buckets|first).start | date('W') - 1) % 4] }}
<small title="Numéro de semaine">(#{{ (buckets|first).start | date('W') }})</small>
</h5>
{% include "booking/_partial/week_title.html.twig" with { first_shift: buckets|first } %}
{% set previousWeekIndex = weekIndex %}
{% endif %}

Expand Down
6 changes: 1 addition & 5 deletions app/Resources/views/booking/_partial/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
{% set beneficiary = null %}
{% endif %}
{% set previousWeekIndex = -1 %}
{% set weekCycle = ["A", "B", "C", "D"] %}
{% set current_cycle = 0 %}

</div> <!-- end div.section -->
Expand All @@ -16,10 +15,7 @@

{% if previousWeekIndex != weekIndex %}
{% if previousWeekIndex != -1 %}</ul>{% endif %}
<h5>
Semaine {{ weekCycle[((bucketsByjob|first|first).start | date('W') - 1) % 4] }}
<small title="Numéro de semaine">(#{{ (bucketsByjob|first|first).start | date('W') }})</small>
</h5>
{% include "booking/_partial/week_title.html.twig" with { first_shift: bucketsByjob|first|first } %}
{% set previousWeekIndex = weekIndex %}
<ul class="collapsible collapsible-expandable">
{% endif %}
Expand Down
6 changes: 6 additions & 0 deletions app/Resources/views/booking/_partial/week_title.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<h5>
Semaine #{{ first_shift.start | date('W') }}
{% if cycle_type == 'abcd' %}
({{ period_service.getWeekCycleArray()[(first_shift.start | date('W') - 1) % 4] }})
{% endif %}
</h5>
2 changes: 2 additions & 0 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ twig:
project_url_display: "%project_url_display%"
helloasso_registration_campaign_url: "%helloasso_registration_campaign_url%"
due_duration_by_cycle: '%due_duration_by_cycle%'
cycle_type: '%cycle_type%'
registration_duration: '%registration_duration%'
support_email: '%transactional_mailer_user%'
images_tmp_dir: '%images_tmp_dir%'
Expand Down Expand Up @@ -119,6 +120,7 @@ twig:
beneficiary_service: "@beneficiary_service"
membership_service: "@membership_service"
shift_service: "@shift_service"
period_service: "@period_service"
time_log_service: "@time_log_service"

# Doctrine Configuration
Expand Down
87 changes: 44 additions & 43 deletions app/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,62 +197,63 @@ services:

# services
shift_service:
class: AppBundle\Service\ShiftService
public: true
arguments:
- "@doctrine.orm.entity_manager"
- '@beneficiary_service'
- '@membership_service'
- "%due_duration_by_cycle%"
- "%min_shift_duration%"
- "%new_users_start_as_beginner%"
- "%allow_extra_shifts%"
- "%max_time_in_advance_to_book_extra_shifts%"
- "%forbid_shift_overlap_time%"
- "%use_fly_and_fixed%"
- "%fly_and_fixed_allow_fixed_shift_free%"
- "%use_time_log_saving%"
- "%time_log_saving_shift_free_min_time_in_advance_days%"
class: AppBundle\Service\ShiftService
public: true
arguments:
- "@doctrine.orm.entity_manager"
- '@beneficiary_service'
- '@membership_service'
- "%due_duration_by_cycle%"
- "%min_shift_duration%"
- "%new_users_start_as_beginner%"
- "%allow_extra_shifts%"
- "%max_time_in_advance_to_book_extra_shifts%"
- "%forbid_shift_overlap_time%"
- "%use_fly_and_fixed%"
- "%fly_and_fixed_allow_fixed_shift_free%"
- "%use_time_log_saving%"
- "%time_log_saving_shift_free_min_time_in_advance_days%"
shift_free_log_service:
class: AppBundle\Service\ShiftFreeLogService
public: true
arguments:
$tokenStorage: '@security.token_storage'
class: AppBundle\Service\ShiftFreeLogService
public: true
arguments:
$tokenStorage: '@security.token_storage'
period_service:
class: AppBundle\Service\PeriodService
public: true
period_position_free_log_service:
class: AppBundle\Service\PeriodPositionFreeLogService
public: true
arguments:
$tokenStorage: '@security.token_storage'

class: AppBundle\Service\PeriodPositionFreeLogService
public: true
arguments:
$tokenStorage: '@security.token_storage'
time_log_service:
class: AppBundle\Service\TimeLogService
public: true
arguments:
$em: "@doctrine.orm.entity_manager"
$membershipService: '@membership_service'
$due_duration_by_cycle: "%due_duration_by_cycle%"

beneficiary_service:
class: AppBundle\Service\BeneficiaryService
public: true
class: AppBundle\Service\BeneficiaryService
public: true
mailer_service:
class: AppBundle\Service\MailerService
public: true
arguments:
$mailer: "@mailer"
$baseDomain: '%emails.base_domain%'
$memberEmail: "%emails.member%"
$project_name: "%project_name%"
$sendableEmails: '%emails.sendable%'
$entity_manager: "@doctrine.orm.entity_manager"
$router: "@router"
$templating: "@templating"
class: AppBundle\Service\MailerService
public: true
arguments:
$mailer: "@mailer"
$baseDomain: '%emails.base_domain%'
$memberEmail: "%emails.member%"
$project_name: "%project_name%"
$sendableEmails: '%emails.sendable%'
$entity_manager: "@doctrine.orm.entity_manager"
$router: "@router"
$templating: "@templating"
membership_service:
class: AppBundle\Service\MembershipService
public: true
class: AppBundle\Service\MembershipService
public: true
event_service:
class: AppBundle\Service\EventService
public: true
class: AppBundle\Service\EventService
public: true

search_user_form_helper:
class: AppBundle\Service\SearchUserFormHelper
Expand Down
15 changes: 15 additions & 0 deletions src/AppBundle/Service/PeriodService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace AppBundle\Service;

class PeriodService
{
public function __construct()
{
}

public function getWeekCycleArray()
{
return ["A", "B", "C", "D"];
}
}

0 comments on commit 69eaa01

Please sign in to comment.