Browse code

Show slots that are published yet not have reached the booking start date

Benjamin Roth authored on28/08/2025 14:17:11
Showing3 changed files
... ...
@@ -57,7 +57,7 @@
57 57
                         <div class="slots">
58 58
                             {% for slot in slots %}
59 59
                                 <div class="row py-2 u-flex-nowrap-md u-items-center{{ not slot.buchbar ? ' error' : '' }}{{ slot.gebucht ? ' booked' : '' }}">
60
-                                    <div class="col-12">
60
+                                    <div class="col-10">
61 61
                                         <div class="grid-md u-gap-1">
62 62
                                             <div class="grid-c-3 time bg-white p-1">
63 63
                                                 <div class="u-flex u-flex-wrap u-gap-1">
... ...
@@ -114,9 +114,16 @@
114 114
                                             {% endif %}
115 115
                                         </div>
116 116
                                     </div>
117
-                                    <div class="col u-text-right action mt-2 mt-0-md">
118
-                                        <a hx-get="/_ajax/vr_wa/v1/slot?do=details&id={{ slot.id }}" hx-target="body" hx-swap="beforeend" href="javascript:;" class="btn btn--sm btn-info m-0">Buchen</a>
119
-                                    </div>
117
+                                    {% if 'now'|date('U') < slot.buchbar_ab|date('U') %}
118
+                                        <div class="col-2 my-1 u-text-right">
119
+                                            <span class="t-label">Buchbar ab</span>
120
+                                            <span class="u-text-nowrap">{{ slot.buchbar_ab|date('d.m.Y H:i') }}</span>
121
+                                        </div>
122
+                                    {% else %}
123
+                                        <div class="col-2 u-text-right action mt-2 mt-0-md">
124
+                                            <a hx-get="/_ajax/vr_wa/v1/slot?do=details&id={{ slot.id }}" hx-target="body" hx-swap="beforeend" href="javascript:;" class="btn btn--sm btn-info m-0">Buchen</a>
125
+                                        </div>
126
+                                    {% endif %}
120 127
                                 </div>
121 128
                             {% endfor %}
122 129
                         </div>
... ...
@@ -62,6 +62,9 @@ article, blockquote, p {
62 62
 .align-self-center {
63 63
   align-self: center;
64 64
 }
65
+.align-self-stretch {
66
+  align-self: stretch;
67
+}
65 68
 
66 69
 dl {
67 70
   margin: 0;
... ...
@@ -37,7 +37,7 @@ class WeinanlieferungSlotsModel extends Model
37 37
         $arrColumns[] = "$t.tstamp!=0";
38 38
         $arrColumns[] = "$t.published='1'";
39 39
 
40
-        $arrColumns[] = "($t.buchbar_ab<=$time OR $t.buchbar_ab = 0 OR $t.buchbar_ab IS NULL) AND $t.buchbar_bis>$time";
40
+        $arrColumns[] = "$t.buchbar_bis>$time";
41 41
 
42 42
         if (!isset($arrOptions['order']))
43 43
         {
... ...
@@ -57,7 +57,7 @@ class WeinanlieferungSlotsModel extends Model
57 57
         $arrColumns[] = "$t.tstamp!=0";
58 58
         $arrColumns[] = "$t.published='1'";
59 59
 
60
-        $arrColumns[] = "($t.buchbar_ab<=$time OR $t.buchbar_ab = 0 OR $t.buchbar_ab IS NULL) AND $t.buchbar_bis>$time";
60
+        $arrColumns[] = "$t.buchbar_bis>$time";
61 61
 
62 62
         if (!isset($arrOptions['order']))
63 63
         {
... ...
@@ -91,7 +91,7 @@ class WeinanlieferungSlotsModel extends Model
91 91
         $arrColumns[] = "$t.tstamp!=0";
92 92
         $arrColumns[] = "$t.published='1'";
93 93
 
94
-        $arrColumns[] = "($t.buchbar_ab<=$time OR $t.buchbar_ab = 0 OR $t.buchbar_ab IS NULL) AND $t.buchbar_bis>$time";
94
+        $arrColumns[] = "$t.buchbar_bis>$time";
95 95
 
96 96
         if (!isset($arrOptions['order']))
97 97
         {
... ...
@@ -117,7 +117,7 @@ class WeinanlieferungSlotsModel extends Model
117 117
             $arrOptions['order'] = "$t.time ASC";
118 118
         }
119 119
 
120
-        return static::findBy(array("$t.time >= ?","$t.tstamp!=0","$t.published='1' AND ($t.buchbar_ab<=$time OR $t.buchbar_ab = 0 OR $t.buchbar_ab IS NULL) AND $t.buchbar_bis > ?"), [$time,$time,$time], $arrOptions);
120
+        return static::findBy(array("$t.time >= ?","$t.tstamp!=0","$t.published='1' AND $t.buchbar_bis > ?"), [$time,$time,$time], $arrOptions);
121 121
     }
122 122
 
123 123
     public function getAvailableBehaelter(?int $intOffset=null)