| ... | ... |
@@ -10,7 +10,7 @@ |
| 10 | 10 |
<div class="tl_panel"> |
| 11 | 11 |
<div id="vr-daily-schedule-zoom" class="tl_submit_panel"> |
| 12 | 12 |
<label for="daily-zoom-slider">Zoom</label> |
| 13 |
- <input type="range" id="daily-zoom-slider" min="1.5" max="9" step="1.5" value="3"> |
|
| 13 |
+ <input type="range" id="daily-zoom-slider" min="4.5" max="12" step="1.5" value="6"> |
|
| 14 | 14 |
<button id="daily-zoom-in" class="tl_submit">+</button> |
| 15 | 15 |
<button id="daily-zoom-out" class="tl_submit">-</button> |
| 16 | 16 |
<button id="daily-zoom-reset" class="tl_submit" data-default="3">Reset</button> |
| ... | ... |
@@ -27,10 +27,10 @@ |
| 27 | 27 |
let split = currentVal.match(/^([-.\d]+(?:\.\d+)?)(.*)$/); |
| 28 | 28 |
[value,unit] = [parseFloat(split[1]),split[2] ? split[2] : '']; |
| 29 | 29 |
|
| 30 |
- if (element.id == 'daily-zoom-in' && value < 9) |
|
| 30 |
+ if (element.id == 'daily-zoom-in' && value < 12) |
|
| 31 | 31 |
{
|
| 32 | 32 |
root.style.setProperty('--slot-height',(value + 1.5) + unit);
|
| 33 |
- } else if (element.id == 'daily-zoom-out' && value >= 3) |
|
| 33 |
+ } else if (element.id == 'daily-zoom-out' && value >= 4.5) |
|
| 34 | 34 |
{
|
| 35 | 35 |
root.style.setProperty('--slot-height',(value - 1.5) + unit);
|
| 36 | 36 |
} else if (element.id == 'daily-zoom-reset') |
| ... | ... |
@@ -69,12 +69,22 @@ |
| 69 | 69 |
</div> |
| 70 | 70 |
<div class="daily-grid-cells-container"> |
| 71 | 71 |
<div class="daily-grid-cells"> |
| 72 |
- {% for line in [4,14,15,38] %}
|
|
| 73 |
- <div class="event-cell" style="grid-row: {{ line }} / {{ line+2 }}">
|
|
| 72 |
+ {% for row, event in events %}
|
|
| 73 |
+ {% if event is not null %}
|
|
| 74 |
+ <div class="event-cell" style="grid-row: {{ event.rowStart }} / {{ event.rowEnd }}">
|
|
| 75 |
+ <div class="event-title">{{ event.location.title }}</div>
|
|
| 76 |
+ <div class="event-time">{{ event.slot.time|date("H:i") }} - {{ (event.slot.time + event.slot.duration*60)|date("H:i") }}</div>
|
|
| 77 |
+ </div> |
|
| 78 |
+ {% else %}
|
|
| 79 |
+ <div class="cell-placeholder" style="grid-row: {{ row }} / {{ row }}">+ Neuer Slot</div>
|
|
| 80 |
+ {% endif %}
|
|
| 81 |
+ {% endfor %}{#
|
|
| 82 |
+ {% for line in [8,28,30,76] %}
|
|
| 83 |
+ <div class="event-cell" style="grid-row: {{ line }} / {{ line+4 }}">
|
|
| 74 | 84 |
<div class="event-title">Standort 1</div> |
| 75 | 85 |
<div class="event-time">XX:XX - XX:XX</div> |
| 76 | 86 |
</div> |
| 77 |
- {% endfor %}
|
|
| 87 |
+ {% endfor %} #}
|
|
| 78 | 88 |
</div> |
| 79 | 89 |
</div> |
| 80 | 90 |
</div> |
| ... | ... |
@@ -8,12 +8,12 @@ $hour-line-color: #999; |
| 8 | 8 |
$time-color: #666; |
| 9 | 9 |
$text-color: #333; |
| 10 | 10 |
$header-bg-color: #f2f2f2; |
| 11 |
-$slot-height: 3rem; |
|
| 12 |
-$slot-animation-duration: .25s; |
|
| 13 |
-$cell-amount: 48; |
|
| 11 |
+$slot-height: 6rem; |
|
| 12 |
+$animation-duration: .25s; |
|
| 13 |
+$row-amount: 96; |
|
| 14 | 14 |
|
| 15 |
-@mixin animate-slot {
|
|
| 16 |
- transition: height $slot-animation-duration ease-in-out, line-height $slot-animation-duration ease-in-out, grid-template-rows $slot-animation-duration ease-in-out; |
|
| 15 |
+@mixin animate-zoom {
|
|
| 16 |
+ transition: height $animation-duration ease-in-out, line-height $animation-duration ease-in-out, grid-template-rows $animation-duration ease-in-out; |
|
| 17 | 17 |
} |
| 18 | 18 |
|
| 19 | 19 |
:root {
|
| ... | ... |
@@ -48,7 +48,7 @@ $cell-amount: 48; |
| 48 | 48 |
position: relative; |
| 49 | 49 |
padding-inline-end: 8px; |
| 50 | 50 |
text-align: right; |
| 51 |
- @include animate-slot; |
|
| 51 |
+ @include animate-zoom; |
|
| 52 | 52 |
|
| 53 | 53 |
&:first-child {
|
| 54 | 54 |
.daily-timeline-label {
|
| ... | ... |
@@ -83,7 +83,7 @@ $cell-amount: 48; |
| 83 | 83 |
|
| 84 | 84 |
.line {
|
| 85 | 85 |
height: var(--slot-height); |
| 86 |
- @include animate-slot; |
|
| 86 |
+ @include animate-zoom; |
|
| 87 | 87 |
|
| 88 | 88 |
&:after {
|
| 89 | 89 |
content: ""; |
| ... | ... |
@@ -115,12 +115,34 @@ $cell-amount: 48; |
| 115 | 115 |
height: 100%; |
| 116 | 116 |
width: 100%; |
| 117 | 117 |
display: grid; |
| 118 |
- grid-template-rows: repeat($cell-amount, calc(var(--slot-height) / (#{$cell-amount} / 24)));
|
|
| 119 |
- @include animate-slot; |
|
| 118 |
+ grid-template-rows: repeat($row-amount, calc(var(--slot-height) / (#{$row-amount} / 24)));
|
|
| 119 |
+ @include animate-zoom; |
|
| 120 |
+ |
|
| 121 |
+ .cell-placeholder {
|
|
| 122 |
+ line-height: calc(var(--slot-height) / 4); |
|
| 123 |
+ @include animate-zoom; |
|
| 124 |
+ z-index: 1; |
|
| 125 |
+ box-sizing: border-box; |
|
| 126 |
+ border-radius: 5px; |
|
| 127 |
+ background-color: #f0f0f0; |
|
| 128 |
+ border: #e0e0e0 $event-border-width solid; |
|
| 129 |
+ padding: 3px; |
|
| 130 |
+ color: #555; |
|
| 131 |
+ font-size: 12px; |
|
| 132 |
+ display: flex; |
|
| 133 |
+ align-items: center; |
|
| 134 |
+ justify-content: center; |
|
| 135 |
+ opacity: 0; |
|
| 136 |
+ cursor: pointer; |
|
| 137 |
+ |
|
| 138 |
+ &:hover {
|
|
| 139 |
+ opacity: .8; |
|
| 140 |
+ } |
|
| 141 |
+ } |
|
| 120 | 142 |
|
| 121 | 143 |
.event-cell {
|
| 122 | 144 |
line-height: calc(var(--slot-height) / 4); |
| 123 |
- @include animate-slot; |
|
| 145 |
+ @include animate-zoom; |
|
| 124 | 146 |
z-index: 2; |
| 125 | 147 |
box-sizing: border-box; |
| 126 | 148 |
border-radius: 5px; |
| ... | ... |
@@ -106,6 +106,46 @@ class WeinanlieferungDailyScheduleController extends AbstractController |
| 106 | 106 |
$this->objAjax->executePostActions($dc); |
| 107 | 107 |
} |
| 108 | 108 |
|
| 109 |
+ // Get events |
|
| 110 |
+ $Tag = new Date(mktime(0,0,0,12,24,2024)); |
|
| 111 |
+ $scheduleRows = 96; |
|
| 112 |
+ $scheduleRowSeconds = ($Tag->dayEnd - $Tag->dayBegin) / $scheduleRows; |
|
| 113 |
+ $arrOptions = []; |
|
| 114 |
+ $arrOptions['column'][] = 'tl_vr_wa_slot.time BETWEEN ? and ?'; |
|
| 115 |
+ $arrOptions['value'][] = $Tag->dayBegin; |
|
| 116 |
+ $arrOptions['value'][] = $Tag->dayEnd; |
|
| 117 |
+ |
|
| 118 |
+ $arrSlots = []; |
|
| 119 |
+ $arrRows = array_flip(range(1,$scheduleRows)); |
|
| 120 |
+ array_walk($arrRows,function(&$val) {
|
|
| 121 |
+ $val = null; |
|
| 122 |
+ }); |
|
| 123 |
+ if (($slots = WeinanlieferungSlotsModel::findMultiplePublishedByPids([1],$arrOptions)) !== null) |
|
| 124 |
+ {
|
|
| 125 |
+ foreach ($slots as $slot) |
|
| 126 |
+ {
|
|
| 127 |
+ $Slottime = new Date($slot->time); |
|
| 128 |
+ $startOffset = $slot->time - $Slottime->dayBegin; |
|
| 129 |
+ $endOffset = $slot->time + ($slot->duration * 60) - $Slottime->dayBegin; |
|
| 130 |
+ $rowStart = ceil($startOffset / $scheduleRowSeconds); |
|
| 131 |
+ $rowEnd = ceil($endOffset / $scheduleRowSeconds); |
|
| 132 |
+ |
|
| 133 |
+ $arrSlots[$rowStart] = [ |
|
| 134 |
+ 'rowStart' => $rowStart, |
|
| 135 |
+ 'rowEnd' => $rowEnd, |
|
| 136 |
+ 'slot' => $slot->row(), |
|
| 137 |
+ 'location' => $slot->getRelated('pid')->row()
|
|
| 138 |
+ ]; |
|
| 139 |
+ |
|
| 140 |
+ for ($i=$rowStart; $i < $rowEnd; $i++) |
|
| 141 |
+ {
|
|
| 142 |
+ $arrRows = array_diff_key($arrRows, [$i=>null]); |
|
| 143 |
+ } |
|
| 144 |
+ } |
|
| 145 |
+ } |
|
| 146 |
+ $arrRows = array_replace($arrRows,$arrSlots); |
|
| 147 |
+ ksort($arrRows); |
|
| 148 |
+ |
|
| 109 | 149 |
$events = [ |
| 110 | 150 |
[ |
| 111 | 151 |
'title' => 'Morning Meeting', |
| ... | ... |
@@ -133,7 +173,7 @@ class WeinanlieferungDailyScheduleController extends AbstractController |
| 133 | 173 |
$this->twig->render( |
| 134 | 174 |
'@Contao_VonrotenbergWeinanlieferungBundle/be_wa_daily_schedule.html.twig', |
| 135 | 175 |
[ |
| 136 |
- 'events' => $events, |
|
| 176 |
+ 'events' => $arrRows, |
|
| 137 | 177 |
'date' => new \DateTime() |
| 138 | 178 |
] |
| 139 | 179 |
) |