Forráskód Böngészése

Patient > Simple SMS Reminders UI - de/re-activate

Vijayakrishnan 4 éve
szülő
commit
32e525fb4b

+ 0 - 1
app/Models/Client.php

@@ -495,7 +495,6 @@ class Client extends Model
     public function smsReminders()
     {
         return $this->hasMany(SimpleSMSReminder::class, 'client_id', 'id')
-            ->where('is_active', true)
             ->orderBy('created_at', 'asc');
     }
 

+ 84 - 57
resources/views/app/patient/sms-reminders.blade.php

@@ -70,9 +70,9 @@
             </h6>
         </div>
 
-        <table class="table table-sm table-striped table-bordered mb-0 mt-2 notes-list">
+        <table class="table table-sm table-bordered mb-0 mt-2 notes-list">
             <thead>
-            <tr>
+            <tr class="bg-light">
                 <th class="px-2 text-secondary border-bottom-0">#</th>
                 <th class="px-2 text-secondary border-bottom-0">To Number</th>
                 <th class="px-2 text-secondary border-bottom-0">Message</th>
@@ -84,7 +84,7 @@
             <?php $index = 0; ?>
             @foreach ($patient->smsReminders as $smsReminder)
                 <?php $index++; ?>
-                <tr>
+                <tr class="{{$smsReminder->is_active ? '' : 'bg-light text-secondary'}}">
                     <td class="px-2">{{$index}}</td>
                     <td class="px-2">{{$smsReminder->sms_number}}</td>
                     <td class="px-2">{{$smsReminder->message}}</td>
@@ -133,65 +133,92 @@
                         @endif
                     </td>
                     <td class="px-2">
-                        <div moe relative="">
-                            <a start show class="py-0 mb-3">Edit</a>
-                            <form url="/api/simpleSmsReminder/update" class="mcp-theme-1" right="">
-                                <input type="hidden" name="uid" value="{{$smsReminder->uid}}">
-                                <div class="row mb-2">
-                                    <div class="col-5 pr-0">
-                                        <label class="text-sm text-secondary mb-1">To Number</label>
-                                        <input type="text" name="smsNumber" class="form-control form-control-sm" value="{{$smsReminder->sms_number}}">
+                        <div class="d-flex align-items-center">
+                            <div moe relative="">
+                                <a start show class="py-0 mb-3">Edit</a>
+                                <form url="/api/simpleSmsReminder/update" class="mcp-theme-1" right="">
+                                    <input type="hidden" name="uid" value="{{$smsReminder->uid}}">
+                                    <div class="row mb-2">
+                                        <div class="col-5 pr-0">
+                                            <label class="text-sm text-secondary mb-1">To Number</label>
+                                            <input type="text" name="smsNumber" class="form-control form-control-sm" value="{{$smsReminder->sms_number}}">
+                                        </div>
                                     </div>
-                                </div>
-                                <div class="row mb-2">
-                                    <div class="col-12">
-                                        <label class="text-sm text-secondary mb-1">Message</label>
-                                        <textarea name="message" class="form-control form-control-sm">{{$smsReminder->message}}</textarea>
+                                    <div class="row mb-2">
+                                        <div class="col-12">
+                                            <label class="text-sm text-secondary mb-1">Message</label>
+                                            <textarea name="message" class="form-control form-control-sm">{{$smsReminder->message}}</textarea>
+                                        </div>
                                     </div>
-                                </div>
-                                <div class="row mb-2">
-                                    <div class="col-12">
-                                        <label class="text-sm text-secondary mb-1">Schedule</label>
-                                        <table class="table table-sm table-bordered mb-0">
-                                            <thead>
-                                            <tr class="bg-light">
-                                                <th class="border-bottom-0 text-center">Sun</th>
-                                                <th class="border-bottom-0 text-center">Mon</th>
-                                                <th class="border-bottom-0 text-center">Tue</th>
-                                                <th class="border-bottom-0 text-center">Wed</th>
-                                                <th class="border-bottom-0 text-center">Thu</th>
-                                                <th class="border-bottom-0 text-center">Fri</th>
-                                                <th class="border-bottom-0 text-center">Sat</th>
-                                            </tr>
-                                            </thead>
-                                            <tbody>
-                                            <tr>
-                                                <td class="text-center"><input type="checkbox" data-day="sun" {{$smsReminder->time_of_day_sunday ? 'checked' : ''}}></td>
-                                                <td class="text-center"><input type="checkbox" data-day="mon" {{$smsReminder->time_of_day_monday ? 'checked' : ''}}></td>
-                                                <td class="text-center"><input type="checkbox" data-day="tue" {{$smsReminder->time_of_day_tuesday ? 'checked' : ''}}></td>
-                                                <td class="text-center"><input type="checkbox" data-day="wed" {{$smsReminder->time_of_day_wednesday ? 'checked' : ''}}></td>
-                                                <td class="text-center"><input type="checkbox" data-day="thu" {{$smsReminder->time_of_day_thursday ? 'checked' : ''}}></td>
-                                                <td class="text-center"><input type="checkbox" data-day="fri" {{$smsReminder->time_of_day_friday ? 'checked' : ''}}></td>
-                                                <td class="text-center"><input type="checkbox" data-day="sat" {{$smsReminder->time_of_day_saturday ? 'checked' : ''}}></td>
-                                            </tr>
-                                            <tr>
-                                                <td><input type="time" class="form-control form-control-sm" data-day="sun" name="timeOfDaySunday" {{$smsReminder->time_of_day_sunday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_sunday ? substr($smsReminder->time_of_day_sunday, 0, 5) : ''}}"></td>
-                                                <td><input type="time" class="form-control form-control-sm" data-day="mon" name="timeOfDayMonday" {{$smsReminder->time_of_day_monday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_monday ? substr($smsReminder->time_of_day_monday, 0, 5) : ''}}"></td>
-                                                <td><input type="time" class="form-control form-control-sm" data-day="tue" name="timeOfDayTuesday" {{$smsReminder->time_of_day_tuesday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_tuesday ? substr($smsReminder->time_of_day_tuesday, 0, 5) : ''}}"></td>
-                                                <td><input type="time" class="form-control form-control-sm" data-day="wed" name="timeOfDayWednesday" {{$smsReminder->time_of_day_wednesday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_wednesday ? substr($smsReminder->time_of_day_wednesday, 0, 5) : ''}}"></td>
-                                                <td><input type="time" class="form-control form-control-sm" data-day="thu" name="timeOfDayThursday" {{$smsReminder->time_of_day_thursday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_thursday ? substr($smsReminder->time_of_day_thursday, 0, 5) : ''}}"></td>
-                                                <td><input type="time" class="form-control form-control-sm" data-day="fri" name="timeOfDayFriday" {{$smsReminder->time_of_day_friday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_friday ? substr($smsReminder->time_of_day_friday, 0, 5) : ''}}"></td>
-                                                <td><input type="time" class="form-control form-control-sm" data-day="sat" name="timeOfDaySaturday" {{$smsReminder->time_of_day_saturday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_saturday ? substr($smsReminder->time_of_day_saturday, 0, 5) : ''}}"></td>
-                                            </tr>
-                                            </tbody>
-                                        </table>
+                                    <div class="row mb-2">
+                                        <div class="col-12">
+                                            <label class="text-sm text-secondary mb-1">Schedule</label>
+                                            <table class="table table-sm table-bordered mb-0">
+                                                <thead>
+                                                <tr class="bg-light">
+                                                    <th class="border-bottom-0 text-center">Sun</th>
+                                                    <th class="border-bottom-0 text-center">Mon</th>
+                                                    <th class="border-bottom-0 text-center">Tue</th>
+                                                    <th class="border-bottom-0 text-center">Wed</th>
+                                                    <th class="border-bottom-0 text-center">Thu</th>
+                                                    <th class="border-bottom-0 text-center">Fri</th>
+                                                    <th class="border-bottom-0 text-center">Sat</th>
+                                                </tr>
+                                                </thead>
+                                                <tbody>
+                                                <tr>
+                                                    <td class="text-center"><input type="checkbox" data-day="sun" {{$smsReminder->time_of_day_sunday ? 'checked' : ''}}></td>
+                                                    <td class="text-center"><input type="checkbox" data-day="mon" {{$smsReminder->time_of_day_monday ? 'checked' : ''}}></td>
+                                                    <td class="text-center"><input type="checkbox" data-day="tue" {{$smsReminder->time_of_day_tuesday ? 'checked' : ''}}></td>
+                                                    <td class="text-center"><input type="checkbox" data-day="wed" {{$smsReminder->time_of_day_wednesday ? 'checked' : ''}}></td>
+                                                    <td class="text-center"><input type="checkbox" data-day="thu" {{$smsReminder->time_of_day_thursday ? 'checked' : ''}}></td>
+                                                    <td class="text-center"><input type="checkbox" data-day="fri" {{$smsReminder->time_of_day_friday ? 'checked' : ''}}></td>
+                                                    <td class="text-center"><input type="checkbox" data-day="sat" {{$smsReminder->time_of_day_saturday ? 'checked' : ''}}></td>
+                                                </tr>
+                                                <tr>
+                                                    <td><input type="time" class="form-control form-control-sm" data-day="sun" name="timeOfDaySunday" {{$smsReminder->time_of_day_sunday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_sunday ? substr($smsReminder->time_of_day_sunday, 0, 5) : ''}}"></td>
+                                                    <td><input type="time" class="form-control form-control-sm" data-day="mon" name="timeOfDayMonday" {{$smsReminder->time_of_day_monday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_monday ? substr($smsReminder->time_of_day_monday, 0, 5) : ''}}"></td>
+                                                    <td><input type="time" class="form-control form-control-sm" data-day="tue" name="timeOfDayTuesday" {{$smsReminder->time_of_day_tuesday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_tuesday ? substr($smsReminder->time_of_day_tuesday, 0, 5) : ''}}"></td>
+                                                    <td><input type="time" class="form-control form-control-sm" data-day="wed" name="timeOfDayWednesday" {{$smsReminder->time_of_day_wednesday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_wednesday ? substr($smsReminder->time_of_day_wednesday, 0, 5) : ''}}"></td>
+                                                    <td><input type="time" class="form-control form-control-sm" data-day="thu" name="timeOfDayThursday" {{$smsReminder->time_of_day_thursday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_thursday ? substr($smsReminder->time_of_day_thursday, 0, 5) : ''}}"></td>
+                                                    <td><input type="time" class="form-control form-control-sm" data-day="fri" name="timeOfDayFriday" {{$smsReminder->time_of_day_friday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_friday ? substr($smsReminder->time_of_day_friday, 0, 5) : ''}}"></td>
+                                                    <td><input type="time" class="form-control form-control-sm" data-day="sat" name="timeOfDaySaturday" {{$smsReminder->time_of_day_saturday ? '' : 'readonly'}} value="{{$smsReminder->time_of_day_saturday ? substr($smsReminder->time_of_day_saturday, 0, 5) : ''}}"></td>
+                                                </tr>
+                                                </tbody>
+                                            </table>
+                                        </div>
                                     </div>
+                                    <div>
+                                        <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+                                        <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                            @if($smsReminder->is_active)
+                                <div moe relative="" class="ml-2">
+                                    <a start show class="py-0 mb-3">Deactivate</a>
+                                    <form url="/api/simpleSmsReminder/deactivate" class="mcp-theme-1" right="">
+                                        <input type="hidden" name="uid" value="{{$smsReminder->uid}}">
+                                        <p>Deactivate this SMS reminder?</p>
+                                        <div>
+                                            <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+                                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                        </div>
+                                    </form>
                                 </div>
-                                <div>
-                                    <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                            @else
+                                <div moe relative="" class="ml-2">
+                                    <a start show class="py-0 mb-3">Reactivate</a>
+                                    <form url="/api/simpleSmsReminder/reactivate" class="mcp-theme-1" right="">
+                                        <input type="hidden" name="uid" value="{{$smsReminder->uid}}">
+                                        <p>Reactivate this SMS reminder?</p>
+                                        <div>
+                                            <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+                                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                        </div>
+                                    </form>
                                 </div>
-                            </form>
+                            @endif
                         </div>
                     </td>
                 </tr>