Sfoglia il codice sorgente

Updated SMS reminders

Samson Mutunga 3 anni fa
parent
commit
ef1d649737

+ 2 - 1
public/css/style.css

@@ -1983,8 +1983,9 @@ th.only-screen, td.only-screen {
     display: none;
 }
 #simpleSMSReminderComponent input[type="time"] {
-    max-width: 90px;
+    /* max-width: 90px; */
     min-width: unset !important;
+    margin-top: 5px;
 }
 form.non-interactive .form-content {
     opacity: 0.5;

+ 190 - 0
resources/views/app/patient/sms-reminders-form.blade.php

@@ -0,0 +1,190 @@
+<div <?= $smsReminder ?'relative':'' ?> moe>
+	<a start show class="py-0 mb-3">{{ $smsReminder ? 'Edit' : 'Add' }}</a>
+	<form url="/api/simpleSmsReminder/create" class="mcp-theme-1" <?= $smsReminder ? 'right':'' ?>>
+		<input type="hidden" name="clientUid" value="{{$patient->uid}}">
+		@if($smsReminder)
+		<input type="hidden" name="uid" value="{{$smsReminder->uid}}">
+		@endif
+		<div id="smsReminderForm{{ $smsReminder ? $smsReminder->uid : 'Create' }}" v-cloak>
+			<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" v-model="form.smsNumber" required>
+				</div>
+			</div>
+			<div class="row mb-2">
+				<div class="col-5 pr-0">
+					<label class="text-sm text-secondary mb-1">Time Zone</label>
+					<select name="timeZone" class="form-control form-control-sm" v-model="form.timeZone">
+						<option value="EASTERN">Eastern</option>
+						<option value="CENTRAL">Central</option>
+						<option value="MOUNTAIN">Mountain</option>
+						<option value="PACIFIC">Pacific</option>
+						<option value="ALASKA">Alaska</option>
+						<option value="HAWAII">Hawaii</option>
+						<option value="PUERTO_RICO">Puerto Rico</option>
+					</select>
+				</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" v-model="form.message"></textarea>
+				</div>
+			</div>
+			<div class="row">
+				<div class="col-12 my-3 text-nowrap">
+					<div class="form-check form-check-inline">
+						<input class="form-check-input" type="radio" name="sameTimeOrDifferentTimes" id="sameTimeOrDifferentTimes__Daily" value="SAME_TIME_DAILY" v-model="form.sameTimeOrDifferentTimes" required>
+						<label class="form-check-label" for="sameTimeOrDifferentTimes__Daily">Same Time Daily</label>
+					</div>
+					<div class="form-check form-check-inline">
+						<input class="form-check-input" type="radio" name="sameTimeOrDifferentTimes" id="sameTimeOrDifferentTimes__SpecificDays" value="SAME_TIME_SPECIFIC_DAYS" v-model="form.sameTimeOrDifferentTimes" required>
+						<label class="form-check-label" for="sameTimeOrDifferentTimes__SpecificDays">Same Time on Specific Days</label>
+					</div>
+					<div class="form-check form-check-inline">
+						<input class="form-check-input" type="radio" name="sameTimeOrDifferentTimes" id="sameTimeOrDifferentTimes__Custom" value="CUSTOM" v-model="form.sameTimeOrDifferentTimes" required>
+						<label class="form-check-label" for="sameTimeOrDifferentTimes__Custom">Custom</label>
+					</div>
+				</div>
+			</div>
+
+			<div v-if="form.sameTimeOrDifferentTimes == 'SAME_TIME_DAILY' || form.sameTimeOrDifferentTimes == 'SAME_TIME_SPECIFIC_DAYS'" class="row">
+				<div class="col-12">
+					<div class="form-group">
+						<label class="text-sm text-secondary mb-1">Time<sup class="text-danger">*</sup></label>
+						<input type="time" class="form-control" name="sameTimeOfDay" v-model="form.sameTimeOfDay" required />
+					</div>
+				</div>
+			</div>
+
+			<div v-if="form.sameTimeOrDifferentTimes == 'SAME_TIME_SPECIFIC_DAYS' || form.sameTimeOrDifferentTimes == 'CUSTOM'" class="row">
+				<div class="col-12">
+					<table class="table table-sm table-bordered">
+						<tbody>
+							<tr>
+								<td>
+									<div class="d-flex align-items-center mb-0">
+										<input type="checkbox" class="mr-1" style="margin-top:-1px;" name="isSameTimeOnMonday" v-model="form.isSameTimeOnMonday" />
+										<span class="font-weight-bold">Mon</span>
+									</div>
+									<input v-if="form.sameTimeOrDifferentTimes == 'CUSTOM'" :disabled="!form.isSameTimeOnMonday" type="time" class="form-control" name="timeOfDayMonday" v-model="form.timeOfDayMonday" :required="form.isSameTimeOnMonday" />
+								</td>
+								<td>
+									<div class="d-flex align-items-center mb-0">
+										<input type="checkbox" class="mr-1" style="margin-top:-1px;" name="isSameTimeOnTuesday" v-model="form.isSameTimeOnTuesday" />
+										<span class="font-weight-bold">Tue</span>
+									</div>
+									<input v-if="form.sameTimeOrDifferentTimes == 'CUSTOM'" :disabled="!form.isSameTimeOnTuesday" type="time" class="form-control" name="timeOfDayTuesday" v-model="form.timeOfDayTuesday" :required="form.isSameTimeOnTuesday" />
+								</td>
+								<td>
+									<div class="d-flex align-items-center mb-0">
+										<input type="checkbox" class="mr-1" style="margin-top:-1px;" name="isSameTimeOnWednesday" v-model="form.isSameTimeOnWednesday" />
+										<span class="font-weight-bold">Wed</span>
+									</div>
+									<input v-if="form.sameTimeOrDifferentTimes == 'CUSTOM'" :disabled="!form.isSameTimeOnWednesday" type="time" class="form-control" name="timeOfDayWednesday" v-model="form.timeOfDayWednesday" :required="form.isSameTimeOnWednesday" />
+								</td>
+								<td>
+									<div class="d-flex align-items-center mb-0">
+										<input type="checkbox" class="mr-1" style="margin-top:-1px;" name="isSameTimeOnThursday" v-model="form.isSameTimeOnThursday" />
+										<span class="font-weight-bold">Thu</span>
+									</div>
+									<input v-if="form.sameTimeOrDifferentTimes == 'CUSTOM'" :disabled="!form.isSameTimeOnThursday" type="time" class="form-control" name="timeOfDayThursday" v-model="form.timeOfDayThursday" :required="form.isSameTimeOnThursday" />
+								</td>
+								<td>
+									<div class="d-flex align-items-center mb-0">
+										<input type="checkbox" class="mr-1" style="margin-top:-1px;" name="isSameTimeOnFriday" v-model="form.isSameTimeOnFriday" />
+										<span class="font-weight-bold">Fri</span>
+									</div>
+									<input v-if="form.sameTimeOrDifferentTimes == 'CUSTOM'" :disabled="!form.isSameTimeOnFriday" type="time" class="form-control" name="timeOfDayFriday" v-model="form.timeOfDayFriday" :required="form.isSameTimeOnFriday" />
+								</td>
+								<td>
+									<div class="d-flex align-items-center mb-0">
+										<input type="checkbox" class="mr-1" style="margin-top:-1px;" name="isSameTimeOnSaturday" v-model="form.isSameTimeOnSaturday" />
+										<span class="font-weight-bold">Sat</span>
+									</div>
+									<input v-if="form.sameTimeOrDifferentTimes == 'CUSTOM'" :disabled="!form.isSameTimeOnSaturday" type="time" class="form-control" name="timeOfDaySaturday" v-model="form.timeOfDaySaturday" :required="form.isSameTimeOnSaturday" />
+								</td>
+								<td>
+									<div class="d-flex align-items-center mb-0">
+										<input type="checkbox" class="mr-1" style="margin-top:-1px;" name="isSameTimeOnSunday" v-model="form.isSameTimeOnSunday" />
+										<span class="font-weight-bold">Sun</span>
+									</div>
+									<input v-if="form.sameTimeOrDifferentTimes == 'CUSTOM'" :disabled="!form.isSameTimeOnSunday" type="time" class="form-control" name="timeOfDaySunday" v-model="form.timeOfDaySunday" :required="form.isSameTimeOnSunday" />
+								</td>
+							</tr>
+						</tbody>
+					</table>
+				</div>
+			</div>
+		</div>
+		<div class="mt-3">
+			<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>
+
+<script>
+	var smsReminderForm = new Vue({
+		el: '#smsReminderForm{{ $smsReminder ? $smsReminder->uid : "Create" }}',
+		data: {
+			form: {
+				smsNumber: "",
+				timeZone: "EASTERN",
+				message: "",
+				sameTimeOrDifferentTimes: "",
+				sameTimeOfDay: "",
+				isSameTimeOnMonday: null,
+				isSameTimeOnTuesday: null,
+				isSameTimeOnWednesday: null,
+				isSameTimeOnThursday: null,
+				isSameTimeOnFriday: null,
+				isSameTimeOnSaturday: null,
+				isSameTimeOnSunday: null,
+
+				timeOfDayMonday: null,
+				timeOfDayTuesday: null,
+				timeOfDayWednesday: null,
+				timeOfDayThursday: null,
+				timeOfDayFriday: null,
+				timeOfDaySaturday: null,
+				timeOfDaySunday: null,
+
+			},
+			smsReminder:<?= json_encode($smsReminder) ?>
+		},
+		methods: {
+			initDefaultData: function(){
+				if(!this.smsReminder) return;
+				this.form.smsNumber = this.smsReminder.sms_number;
+				this.form.timeZone = this.smsReminder.time_zone;
+				this.form.message = this.smsReminder.message;
+				this.form.sameTimeOrDifferentTimes = this.smsReminder.same_time_or_different_times;
+				this.form.sameTimeOfDay = this.smsReminder.same_time_of_day ? this.smsReminder.same_time_of_day.substring(0,5) : null;
+				this.form.isSameTimeOnMonday = this.smsReminder.is_same_time_on_monday;
+				this.form.isSameTimeOnTuesday = this.smsReminder.is_same_time_on_tuesday;
+				this.form.isSameTimeOnWednesday = this.smsReminder.is_same_time_on_wednesday;
+				this.form.isSameTimeOnThursday = this.smsReminder.is_same_time_on_thursday;
+				this.form.isSameTimeOnFriday = this.smsReminder.is_same_time_on_friday;
+				this.form.isSameTimeOnSaturday = this.smsReminder.is_same_time_on_saturday;
+				this.form.isSameTimeOnSunday = this.smsReminder.is_same_time_on_sunday;
+				this.form.timeOfDayMonday = this.smsReminder.time_of_day_monday ? this.smsReminder.time_of_day_monday.substring(0,5) : null;
+				this.form.timeOfDayTuesday = this.smsReminder.time_of_day_tuesday ? this.smsReminder.time_of_day_tuesday.substring(0,5) : null;
+				this.form.timeOfDayWednesday = this.smsReminder.time_of_day_wednesday ? this.smsReminder.time_of_day_wednesday.substring(0,5) : null;
+				this.form.timeOfDayThursday = this.smsReminder.time_of_day_thursday ? this.smsReminder.time_of_day_thursday.substring(0,5) : null;
+				this.form.timeOfDayFriday = this.smsReminder.time_of_day_friday ? this.smsReminder.time_of_day_friday.substring(0,5) : null;
+				this.form.timeOfDaySaturday = this.smsReminder.time_of_day_saturday ? this.smsReminder.time_of_day_saturday.substring(0,5) : null;
+				this.form.timeOfDaySunday = this.smsReminder.time_of_day_sunday ? this.smsReminder.time_of_day_sunday.substring(0,5) : null;
+
+				console.log(this.smsReminder);
+			},
+			init: function() {
+				this.initDefaultData();
+			}
+		},
+		mounted: function() {
+			this.init();
+		}
+	});
+</script>

+ 144 - 255
resources/views/app/patient/sms-reminders.blade.php

@@ -2,90 +2,17 @@
 
 @section('inner-content')
 
-    <div id="simpleSMSReminderComponent">
-        <div class="pt-2 d-flex align-items-start">
-            <h6 class="my-0 d-flex align-items-center w-100">
-                <span class="font-weight-bold">SMS Reminders</span>
-                <span class="mx-2 text-secondary">|</span>
-                <div moe>
-                    <a start show class="py-0 mb-3">Add</a>
-                    <form url="/api/simpleSmsReminder/create" class="mcp-theme-1">
-                        <input type="hidden" name="clientUid" value="{{$patient->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">
-                            </div>
-                        </div>
-                        <div class="row mb-2">
-                            <div class="col-5 pr-0">
-                                <label class="text-sm text-secondary mb-1">Time Zone</label>
-                                <select name="timeZone" class="form-control form-control-sm">
-                                    <option value="EASTERN">Eastern</option>
-	                                <option value="CENTRAL">Central</option>
-	                                <option value="MOUNTAIN">Mountain</option>
-	                                <option value="PACIFIC">Pacific</option>
-	                                <option value="ALASKA">Alaska</option>
-	                                <option value="HAWAII">Hawaii</option>
-	                                <option value="PUERTO_RICO">Puerto Rico</option>
-                                </select>
-                            </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"></textarea>
-                            </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"></td>
-                                        <td class="text-center"><input type="checkbox" data-day="mon"></td>
-                                        <td class="text-center"><input type="checkbox" data-day="tue"></td>
-                                        <td class="text-center"><input type="checkbox" data-day="wed"></td>
-                                        <td class="text-center"><input type="checkbox" data-day="thu"></td>
-                                        <td class="text-center"><input type="checkbox" data-day="fri"></td>
-                                        <td class="text-center"><input type="checkbox" data-day="sat"></td>
-                                    </tr>
-                                    <tr>
-                                        <td><input type="time" class="form-control form-control-sm" data-day="sun" name="timeOfDaySunday" readonly></td>
-                                        <td><input type="time" class="form-control form-control-sm" data-day="mon" name="timeOfDayMonday" readonly></td>
-                                        <td><input type="time" class="form-control form-control-sm" data-day="tue" name="timeOfDayTuesday" readonly></td>
-                                        <td><input type="time" class="form-control form-control-sm" data-day="wed" name="timeOfDayWednesday" readonly></td>
-                                        <td><input type="time" class="form-control form-control-sm" data-day="thu" name="timeOfDayThursday" readonly></td>
-                                        <td><input type="time" class="form-control form-control-sm" data-day="fri" name="timeOfDayFriday" readonly></td>
-                                        <td><input type="time" class="form-control form-control-sm" data-day="sat" name="timeOfDaySaturday" readonly></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>
-            </h6>
-        </div>
+<div id="simpleSMSReminderComponent">
+    <div class="pt-2 d-flex align-items-start">
+        <h6 class="my-0 d-flex align-items-center w-100">
+            <span class="font-weight-bold">SMS Reminders</span>
+            <span class="mx-2 text-secondary">|</span>
+            @include('app.patient.sms-reminders-form', ['smsReminder' => null])
+        </h6>
+    </div>
 
-        <table class="table table-sm table-striped table-bordered mb-0 mt-2 notes-list">
-            <thead>
+    <table class="table table-sm table-striped table-bordered mb-0 mt-2 notes-list">
+        <thead>
             <tr class="bg-light">
                 <th class="text-secondary border-0">#</th>
                 <th class="text-secondary border-0">To Number</th>
@@ -93,192 +20,154 @@
                 <th class="text-secondary border-0">Schedule</th>
                 <th class="text-secondary border-0">Actions</th>
             </tr>
-            </thead>
-            <tbody>
+        </thead>
+        <tbody>
             <?php $index = 0; ?>
             @foreach ($patient->smsReminders as $smsReminder)
-                <?php $index++; ?>
-                <tr class="{{$smsReminder->is_active ? '' : 'bg-light text-secondary'}}">
-                    <td>{{$index}}</td>
-                    <td>{{$smsReminder->sms_number}}</td>
-                    <td>{{$smsReminder->message}}</td>
-                    <td>
-                        <div class="my-1">
-                            Time Zone: {{friendly_timezone($smsReminder->time_zone)}}
-                        </div>
-                        @if($smsReminder->time_of_day_sunday)
-                            <div>
-                                <span class="text-secondary width-40px d-inline-block">Sun:</span>
-                                <b>{{friendly_time($smsReminder->time_of_day_sunday)}}</b>
-                            </div>
+            <?php $index++; ?>
+            <tr class="{{$smsReminder->is_active ? '' : 'bg-light text-secondary'}}">
+                <td>{{$index}}</td>
+                <td>{{$smsReminder->sms_number}}</td>
+                <td>{{$smsReminder->message}}</td>
+                <td>
+                    <div class="my-1">
+                        Time Zone: {{friendly_timezone($smsReminder->time_zone)}}
+                    </div>
+                                          
+                        @if($smsReminder->same_time_or_different_times == 'SAME_TIME_DAILY' && $smsReminder->same_time_of_day)
+                        <span><b>Daily</b> at: <b>{{ friendly_time($smsReminder->same_time_of_day) }}</b></span>
                         @endif
-                        @if($smsReminder->time_of_day_monday)
-                            <div>
-                                <span class="text-secondary width-40px d-inline-block">Mon:</span>
-                                <b>{{friendly_time($smsReminder->time_of_day_monday)}}</b>
+                        
+                        @if($smsReminder->same_time_or_different_times == 'SAME_TIME_SPECIFIC_DAYS' || $smsReminder->same_time_or_different_times == 'CUSTOM')
+
+                            <div>                            
+                                @if($smsReminder->is_same_time_on_sunday || $smsReminder->time_of_day_sunday)
+                                <span class="text-secondary">Sun</span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'SAME_TIME_SPECIFIC_DAYS' && $smsReminder->is_same_time_on_sunday)
+                                    <span> : <b>{{ friendly_time($smsReminder->same_time_of_day) }}</b></span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'CUSTOM' && $smsReminder->time_of_day_sunday)
+                                    <span> : <b>{{friendly_time($smsReminder->time_of_day_sunday)}}</b></span>
+                                @endif
                             </div>
-                        @endif
-                        @if($smsReminder->time_of_day_tuesday)
-                            <div>
-                                <span class="text-secondary width-40px d-inline-block">Tue:</span>
-                                <b>{{friendly_time($smsReminder->time_of_day_tuesday)}}</b>
+                            <div>                            
+                                @if($smsReminder->is_same_time_on_monday || $smsReminder->time_of_day_monday)
+                                <span class="text-secondary">Mon</span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'SAME_TIME_SPECIFIC_DAYS' && $smsReminder->is_same_time_on_monday)
+                                    <span> : <b>{{ friendly_time($smsReminder->same_time_of_day) }}</b></span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'CUSTOM' && $smsReminder->time_of_day_monday)
+                                    <span> : <b>{{friendly_time($smsReminder->time_of_day_monday)}}</b></span>
+                                @endif
                             </div>
-                        @endif
-                        @if($smsReminder->time_of_day_wednesday)
-                            <div>
-                                <span class="text-secondary width-40px d-inline-block">Wed:</span>
-                                <b>{{friendly_time($smsReminder->time_of_day_wednesday)}}</b>
+                            <div>                            
+                                @if($smsReminder->is_same_time_on_tuesday || $smsReminder->time_of_day_tuesday)
+                                <span class="text-secondary">Tue</span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'SAME_TIME_SPECIFIC_DAYS' && $smsReminder->is_same_time_on_tuesday)
+                                    <span> : <b>{{ friendly_time($smsReminder->same_time_of_day) }}</b></span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'CUSTOM' && $smsReminder->time_of_day_tuesday)
+                                    <span> : <b>{{friendly_time($smsReminder->time_of_day_tuesday)}}</b></span>
+                                @endif
                             </div>
-                        @endif
-                        @if($smsReminder->time_of_day_thursday)
-                            <div>
-                                <span class="text-secondary width-40px d-inline-block">Thu:</span>
-                                <b>{{friendly_time($smsReminder->time_of_day_thursday)}}</b>
+                            <div>                            
+                                @if($smsReminder->is_same_time_on_wednesday || $smsReminder->time_of_day_wednesday)
+                                <span class="text-secondary">Wed</span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'SAME_TIME_SPECIFIC_DAYS' && $smsReminder->is_same_time_on_wednesday)
+                                    <span> : <b>{{ friendly_time($smsReminder->same_time_of_day) }}</b></span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'CUSTOM' && $smsReminder->time_of_day_wednesday)
+                                    <span> : <b>{{friendly_time($smsReminder->time_of_day_wednesday)}}</b></span>
+                                @endif
                             </div>
-                        @endif
-                        @if($smsReminder->time_of_day_friday)
-                            <div>
-                                <span class="text-secondary width-40px d-inline-block">Fri:</span>
-                                <b>{{friendly_time($smsReminder->time_of_day_friday)}}</b>
+                            <div>                            
+                                @if($smsReminder->is_same_time_on_thursday || $smsReminder->time_of_day_thursday)
+                                <span class="text-secondary">Thu</span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'SAME_TIME_SPECIFIC_DAYS' && $smsReminder->is_same_time_on_thursday)
+                                    <span> : <b>{{ friendly_time($smsReminder->same_time_of_day) }}</b></span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'CUSTOM' && $smsReminder->time_of_day_thursday)
+                                    <span> : <b>{{friendly_time($smsReminder->time_of_day_thursday)}}</b></span>
+                                @endif
                             </div>
-                        @endif
-                        @if($smsReminder->time_of_day_saturday)
-                            <div>
-                                <span class="text-secondary width-40px d-inline-block">Sat:</span>
-                                <b>{{friendly_time($smsReminder->time_of_day_saturday)}}</b>
+                            <div>                            
+                                @if($smsReminder->is_same_time_on_friday || $smsReminder->time_of_day_friday)
+                                <span class="text-secondary">Fri</span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'SAME_TIME_SPECIFIC_DAYS' && $smsReminder->is_same_time_on_friday)
+                                    <span> : <b>{{ friendly_time($smsReminder->same_time_of_day) }}</b></span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'CUSTOM' && $smsReminder->time_of_day_friday)
+                                    <span> : <b>{{friendly_time($smsReminder->time_of_day_friday)}}</b></span>
+                                @endif
                             </div>
-                        @endif
-                    </td>
-                    <td>
-                        <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 class="row mb-2">
-                                        <div class="col-5 pr-0">
-                                            <label class="text-sm text-secondary mb-1">Time Zone</label>
-                                            <select name="timeZone" class="form-control form-control-sm">
-                                                <option value="EASTERN" {{$smsReminder->time_zone == 'EASTERN'? 'selected' : ''}} >Eastern</option>
-                                                <option value="CENTRAL" {{$smsReminder->time_zone == 'CENTRAL'? 'selected' : ''}} >Central</option>
-                                                <option value="MOUNTAIN" {{$smsReminder->time_zone == 'MOUNTAIN'? 'selected' : ''}} >Mountain</option>
-                                                <option value="PACIFIC" {{$smsReminder->time_zone == 'PACIFIC'? 'selected' : ''}} >Pacific</option>
-                                                <option value="ALASKA" {{$smsReminder->time_zone == 'ALASKA'? 'selected' : ''}} >Alaska</option>
-                                                <option value="HAWAII" {{$smsReminder->time_zone == 'HAWAII'? 'selected' : ''}} >Hawaii</option>
-                                                <option value="PUERTO_RICO" {{$smsReminder->time_zone == 'PUERTO_RICO'? 'selected' : ''}} >Puerto Rico</option>
-                                            </select>
-                                        </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>
-                                    </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>
-                                    </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_same_time_on_saturday || $smsReminder->time_of_day_saturday)
+                                <span class="text-secondary">Sat</span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'SAME_TIME_SPECIFIC_DAYS' && $smsReminder->is_same_time_on_saturday)
+                                    <span> : <b>{{ friendly_time($smsReminder->same_time_of_day) }}</b></span>
+                                @endif
+                                @if($smsReminder->same_time_or_different_times == 'CUSTOM' && $smsReminder->time_of_day_saturday)
+                                    <span> : <b>{{friendly_time($smsReminder->time_of_day_saturday)}}</b></span>
+                                @endif
                             </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>
+                            
+
+                        @endif
+                </td>
+                <td>
+                    <div class="d-flex align-items-center">
+                        @include('app.patient.sms-reminders-form', ['smsReminder' => $smsReminder])
+                        @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>
-                            @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>
+                            </form>
+                        </div>
+                        @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>
-                            @endif
+                            </form>
                         </div>
-                    </td>
-                </tr>
+                        @endif
+                    </div>
+                </td>
+            </tr>
             @endforeach
             @if(!count($patient->smsReminders))
-                <tr>
-                    <td colspan="5">No records found.</td>
-                </tr>
+            <tr>
+                <td colspan="5">No records found.</td>
+            </tr>
             @endif
-            </tbody>
-        </table>
-    </div>
+        </tbody>
+    </table>
+</div>
+
+<script>
+    (function() {
+        function init() {
 
-    <script>
-        (function () {
-            function init() {
-                $('input[type="checkbox"][data-day]').change(function() {
-                    let input = $(this).closest('form')
-                        .find('input[type="time"][data-day="' + $(this).attr('data-day') + '"]');
-                    input.prop('readonly', !this.checked);
-                    if(this.checked) {
-                        input.focus();
-                    }
-                    else {
-                        input.val('');
-                    }
-                });
-            }
-            addMCInitializer('simpleSMSReminderComponent', init, '#simpleSMSReminderComponent');
-        }).call(window);
-    </script>
-@endsection
+        }
+        addMCInitializer('simpleSMSReminderComponent', init, '#simpleSMSReminderComponent');
+    }).call(window);
+</script>
+@endsection

+ 201 - 0
resources/views/app/patient/sms-reminders_depricated.bladephp

@@ -0,0 +1,201 @@
+@extends ('layouts.patient')
+
+@section('inner-content')
+
+    <div id="simpleSMSReminderComponent">
+        <div class="pt-2 d-flex align-items-start">
+            <h6 class="my-0 d-flex align-items-center w-100">
+                <span class="font-weight-bold">SMS Reminders</span>
+                <span class="mx-2 text-secondary">|</span>
+                @include('app.patient.sms-reminders-form')
+            </h6>
+        </div>
+
+        <table class="table table-sm table-striped table-bordered mb-0 mt-2 notes-list">
+            <thead>
+            <tr class="bg-light">
+                <th class="text-secondary border-0">#</th>
+                <th class="text-secondary border-0">To Number</th>
+                <th class="text-secondary border-0">Message</th>
+                <th class="text-secondary border-0">Schedule</th>
+                <th class="text-secondary border-0">Actions</th>
+            </tr>
+            </thead>
+            <tbody>
+            <?php $index = 0; ?>
+            @foreach ($patient->smsReminders as $smsReminder)
+                <?php $index++; ?>
+                <tr class="{{$smsReminder->is_active ? '' : 'bg-light text-secondary'}}">
+                    <td>{{$index}}</td>
+                    <td>{{$smsReminder->sms_number}}</td>
+                    <td>{{$smsReminder->message}}</td>
+                    <td>
+                        <div class="my-1">
+                            Time Zone: {{friendly_timezone($smsReminder->time_zone)}}
+                        </div>
+                        @if($smsReminder->time_of_day_sunday)
+                            <div>
+                                <span class="text-secondary width-40px d-inline-block">Sun:</span>
+                                <b>{{friendly_time($smsReminder->time_of_day_sunday)}}</b>
+                            </div>
+                        @endif
+                        @if($smsReminder->time_of_day_monday)
+                            <div>
+                                <span class="text-secondary width-40px d-inline-block">Mon:</span>
+                                <b>{{friendly_time($smsReminder->time_of_day_monday)}}</b>
+                            </div>
+                        @endif
+                        @if($smsReminder->time_of_day_tuesday)
+                            <div>
+                                <span class="text-secondary width-40px d-inline-block">Tue:</span>
+                                <b>{{friendly_time($smsReminder->time_of_day_tuesday)}}</b>
+                            </div>
+                        @endif
+                        @if($smsReminder->time_of_day_wednesday)
+                            <div>
+                                <span class="text-secondary width-40px d-inline-block">Wed:</span>
+                                <b>{{friendly_time($smsReminder->time_of_day_wednesday)}}</b>
+                            </div>
+                        @endif
+                        @if($smsReminder->time_of_day_thursday)
+                            <div>
+                                <span class="text-secondary width-40px d-inline-block">Thu:</span>
+                                <b>{{friendly_time($smsReminder->time_of_day_thursday)}}</b>
+                            </div>
+                        @endif
+                        @if($smsReminder->time_of_day_friday)
+                            <div>
+                                <span class="text-secondary width-40px d-inline-block">Fri:</span>
+                                <b>{{friendly_time($smsReminder->time_of_day_friday)}}</b>
+                            </div>
+                        @endif
+                        @if($smsReminder->time_of_day_saturday)
+                            <div>
+                                <span class="text-secondary width-40px d-inline-block">Sat:</span>
+                                <b>{{friendly_time($smsReminder->time_of_day_saturday)}}</b>
+                            </div>
+                        @endif
+                    </td>
+                    <td>
+                        <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 class="row mb-2">
+                                        <div class="col-5 pr-0">
+                                            <label class="text-sm text-secondary mb-1">Time Zone</label>
+                                            <select name="timeZone" class="form-control form-control-sm">
+                                                <option value="EASTERN" {{$smsReminder->time_zone == 'EASTERN'? 'selected' : ''}} >Eastern</option>
+                                                <option value="CENTRAL" {{$smsReminder->time_zone == 'CENTRAL'? 'selected' : ''}} >Central</option>
+                                                <option value="MOUNTAIN" {{$smsReminder->time_zone == 'MOUNTAIN'? 'selected' : ''}} >Mountain</option>
+                                                <option value="PACIFIC" {{$smsReminder->time_zone == 'PACIFIC'? 'selected' : ''}} >Pacific</option>
+                                                <option value="ALASKA" {{$smsReminder->time_zone == 'ALASKA'? 'selected' : ''}} >Alaska</option>
+                                                <option value="HAWAII" {{$smsReminder->time_zone == 'HAWAII'? 'selected' : ''}} >Hawaii</option>
+                                                <option value="PUERTO_RICO" {{$smsReminder->time_zone == 'PUERTO_RICO'? 'selected' : ''}} >Puerto Rico</option>
+                                            </select>
+                                        </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>
+                                    </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>
+                                    </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>
+                            @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>
+                            @endif
+                        </div>
+                    </td>
+                </tr>
+            @endforeach
+            @if(!count($patient->smsReminders))
+                <tr>
+                    <td colspan="5">No records found.</td>
+                </tr>
+            @endif
+            </tbody>
+        </table>
+    </div>
+
+    <script>
+        (function () {
+            function init() {
+               
+            }
+            addMCInitializer('simpleSMSReminderComponent', init, '#simpleSMSReminderComponent');
+        }).call(window);
+    </script>
+@endsection