Skip to content
This repository was archived by the owner on Jan 5, 2019. It is now read-only.

Commit 7ab0db4

Browse files
author
Mario Basic
committed
Small fix for upcoming month.
1 parent c15ef86 commit 7ab0db4

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

app/Http/Controllers/HomeController.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ public function index()
2828
})->with(['service.client'])->get();
2929

3030
if($currentMonth + 1 <= 12){
31+
$upcomingMonth = ++$currentMonth;
32+
if($upcomingMonth < 10) {
33+
$upcomingMonth = '0' . $upcomingMonth;
34+
}
3135
$upcomingOccurrences = Occurrence::orderBy('occurs_at')
32-
// Where occurs_at month and year is the same as current month and year
33-
->where(function($query) use($currentMonth, $currentYear) {
34-
$query->where('occurs_at', 'like', $currentYear . '-' . ++$currentMonth . '-%');
36+
// Where occurs_at month and year is the same as upcoming month and current year
37+
->where(function($query) use($upcomingMonth, $currentYear) {
38+
$query->where('occurs_at', 'like', $currentYear . '-' . $upcomingMonth . '-%');
3539
})
3640
// Return only occurrences that belong to services that are active
3741
->whereHas('service', function($query) {

resources/views/home.blade.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,21 @@
103103
<td>{{ $occurrence->service->title }}</td>
104104
<td>{{ $occurrence->service->client->name }}</td>
105105
<td>{{ $occurrence->service->formatted_cost }}</td>
106-
<td>{{ $occurrence->offer_sent }}</td>
107-
<td>{{ $occurrence->payment_received }}</td>
108-
<td>{{ $occurrence->receipt_sent }}</td>
106+
<td class="kyle-change-boolean"
107+
data-url="/api/v1/occurrences/{{ $occurrence->id }}/offer"
108+
data-state="{{ $occurrence->getFutureOfferState() }}">
109+
{{ $occurrence->offer_sent }}
110+
</td>
111+
<td class="kyle-change-boolean"
112+
data-url="/api/v1/occurrences/{{ $occurrence->id }}/payment"
113+
data-state="{{ $occurrence->getFuturePaymentState() }}">
114+
{{ $occurrence->payment_received }}
115+
</td>
116+
<td class="kyle-change-boolean"
117+
data-url="/api/v1/occurrences/{{ $occurrence->id }}/receipt"
118+
data-state="{{ $occurrence->getFutureReceiptState() }}">
119+
{{ $occurrence->receipt_sent }}
120+
</td>
109121
</tr>
110122
@endforeach
111123
</table>

0 commit comments

Comments
 (0)