Просмотр исходного кода

Disallow other month days in new time entries

Vijayakrishnan Krishnan 5 лет назад
Родитель
Сommit
548a47959a
1 измененных файлов с 26 добавлено и 4 удалено
  1. 26 4
      resources/views/app/patient/care-month/dashboard.blade.php

+ 26 - 4
resources/views/app/patient/care-month/dashboard.blade.php

@@ -113,7 +113,18 @@
                                     </select>
                                 </div>
                                 <div class="mb-2">
-                                    <input type="date" max="{{ date('Y-m-d') }}" class="form-control form-control-sm" name="effectiveDate"
+                                    <?php
+                                    $sD = strtotime($careMonth->start_date);
+                                    $y = date('Y', $sD);
+                                    $m = date('m', $sD);
+                                    $d = date('t', $sD);
+                                    $yCurrent = date('Y');
+                                    $mCurrent = date('m');
+                                    if($y === $yCurrent && $m === $mCurrent) {
+                                        $d = date('d');
+                                    }
+                                    ?>
+                                    <input type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}" class="form-control form-control-sm" name="effectiveDate"
                                            value="" placeholder="Effective Date">
                                 </div>
                                 <div class="mb-2">
@@ -212,7 +223,18 @@
                                     </select>
                                 </div>
                                 <div class="mb-2">
-                                    <input type="date" max="{{ date('Y-m-d') }}" class="form-control form-control-sm" name="effectiveDate"
+                                    <?php
+                                    $sD = strtotime($careMonth->start_date);
+                                    $y = date('Y', $sD);
+                                    $m = date('m', $sD);
+                                    $d = date('t', $sD);
+                                    $yCurrent = date('Y');
+                                    $mCurrent = date('m');
+                                    if($y === $yCurrent && $m === $mCurrent) {
+                                        $d = date('d');
+                                    }
+                                    ?>
+                                    <input type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}" class="form-control form-control-sm" name="effectiveDate"
                                            value="" placeholder="Effective Date">
                                 </div>
                                 <div class="mb-2">
@@ -299,7 +321,7 @@
 
         <div class="row">
 
-            {{-- active cm bill --}}
+            {{-- cm bills --}}
             <div class="col-6">
                 <div class="d-flex align-items-center">
                     <h6 class="my-0 text-secondary font-weight-bold text-dark">CM Bill
@@ -480,7 +502,7 @@
                 @endif
             </div>
 
-            {{-- active rm bill --}}
+            {{-- rm bills --}}
             <div class="col-6">
                 <div class="d-flex align-items-center">
                     <h6 class="my-0 text-secondary font-weight-bold text-dark">RM Bill