Skip to content

Commit 4acfb18

Browse files
committed
add total view
1 parent 709d2bc commit 4acfb18

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

app/Http/Controllers/RabController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function index(Request $request)
3434
$view = $request->ajax() ? 'list' : 'index';
3535
$disable = ($parent && $parent->month !== date('F') and $parent->month !== now()->addMonth('1')->format('F')) ? true : false;
3636

37-
return view('pages.rab.' . $view, compact('rab', 'disable'));
37+
return view('pages.rab.' . $view, compact('rab', 'disable', 'parent'));
3838
}
3939

4040
/**

public/js/pages/rab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function addRow() {
4343
}
4444

4545
if (typeof $('#listitem > tr.add-row, #listitem > tr.edit-row, #listitem > tr.disabled-row').html() === 'undefined') {
46-
$('tbody#listitem').append(row)
46+
$('tbody#listitem > tr:last').before(row)
4747
$('#listitem #for').focus()
4848
$('#listitem #price').autoNumeric({
4949
anDefault: 0,

resources/views/pages/rab/index.blade.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@
8181
</td>
8282
</tr>
8383
@endforeach
84+
<tr>
85+
<td colspan="4" align="center">
86+
<b>TOTAL</b>
87+
</td>
88+
<td align="right"><b>{!! !empty($parent->total) ? HelperView::currency($parent->total) : HelperView::currency(0) !!}</b></td>
89+
<td></td>
90+
</tr>
8491
</tbody>
8592
</table>
8693
</div>

resources/views/pages/rab/list.blade.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,11 @@
1616
@endif
1717
</td>
1818
</tr>
19-
@endforeach
19+
@endforeach
20+
<tr>
21+
<td colspan="4" align="center">
22+
<b>TOTAL</b>
23+
</td>
24+
<td align="right"><b>{!! !empty($parent->total) ? HelperView::currency($parent->total) : HelperView::currency(0) !!}</b></td>
25+
<td></td>
26+
</tr>

0 commit comments

Comments
 (0)