Browse Source

Move /notes and /bills to practice-management controller

Vijayakrishnan Krishnan 4 years ago
parent
commit
e264b84451

+ 0 - 48
app/Http/Controllers/HomeController.php

@@ -133,54 +133,6 @@ class HomeController extends Controller
         return view('app/patients', compact('patients', 'filter'));
         return view('app/patients', compact('patients', 'filter'));
     }
     }
 
 
-    public function notes(Request $request, $filter = '')
-    {
-        $proID = $this->performer()->pro->id;
-        $query = Note::where('hcp_pro_id', $proID);
-        switch ($filter) {
-            case 'not-yet-signed':
-                $query = $query->where('is_signed_by_hcp', false);
-                break;
-
-            // more cases can be added as needed
-            default:
-                break;
-        }
-        $notes = $query->orderBy('created_at', 'desc')->get();
-        return view('app/notes', compact('notes', 'filter'));
-    }
-
-    public function bills(Request $request, $filter = '')
-    {
-        $proID = $this->performer()->pro->id;
-        $query = Bill::where('is_cancelled', false)->orWhere('is_cancelled', null);
-        switch ($filter) {
-            case 'not-yet-signed':
-                $query = $query
-                    ->where(function ($q) use($proID) {
-                        $q->where(function ($q2) use ($proID) {
-                                $q2->where('hcp_pro_id', $proID)->where('is_signed_by_hcp', false);
-                            })
-                            ->orWhere(function ($q2) use ($proID) {
-                                $q2->where('cm_pro_id', $proID)->where('is_signed_by_cm', false);
-                            })
-                            ->orWhere(function ($q2) use ($proID) {
-                                $q2->where('rme_pro_id', $proID)->where('is_signed_by_rme', false);
-                            })
-                            ->orWhere(function ($q2) use ($proID) {
-                                $q2->where('rmm_pro_id', $proID)->where('is_signed_by_rmm', false);
-                            });
-                    });
-                break;
-
-            // more cases can be added as needed
-            default:
-                break;
-        }
-        $bills = $query->orderBy('created_at', 'desc')->get();
-        return view('app/bills', compact('bills', 'filter'));
-    }
-
     public function newPatient(Request $request)
     public function newPatient(Request $request)
     {
     {
         return view('app/new-patient');
         return view('app/new-patient');

+ 51 - 0
app/Http/Controllers/PracticeManagementController.php

@@ -3,7 +3,9 @@
 namespace App\Http\Controllers;
 namespace App\Http\Controllers;
 
 
 use App\Models\AppSession;
 use App\Models\AppSession;
+use App\Models\Bill;
 use App\Models\Client;
 use App\Models\Client;
+use App\Models\Note;
 use App\Models\ProTransaction;
 use App\Models\ProTransaction;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
 
 
@@ -55,6 +57,55 @@ class PracticeManagementController extends Controller
         return view('app.practice-management.contract');
         return view('app.practice-management.contract');
     }
     }
 
 
+    public function notes(Request $request, $filter = '')
+    {
+        $proID = $this->performer()->pro->id;
+        $query = Note::where('hcp_pro_id', $proID);
+        switch ($filter) {
+            case 'not-yet-signed':
+                $query = $query->where('is_signed_by_hcp', false);
+                break;
+
+            // more cases can be added as needed
+            default:
+                break;
+        }
+        $notes = $query->orderBy('created_at', 'desc')->get();
+        return view('app.practice-management.notes', compact('notes', 'filter'));
+    }
+
+    public function bills(Request $request, $filter = '')
+    {
+        $proID = $this->performer()->pro->id;
+        $query = Bill::where('is_cancelled', false);
+        switch ($filter) {
+            case 'not-yet-signed':
+                $query = $query
+                    ->where(function ($q) use($proID) {
+                        $q->where(function ($q2) use ($proID) {
+                            $q2->where('hcp_pro_id', $proID)->where('is_signed_by_hcp', false);
+                        })
+                            ->orWhere(function ($q2) use ($proID) {
+                                $q2->where('cm_pro_id', $proID)->where('is_signed_by_cm', false);
+                            })
+                            ->orWhere(function ($q2) use ($proID) {
+                                $q2->where('rme_pro_id', $proID)->where('is_signed_by_rme', false);
+                            })
+                            ->orWhere(function ($q2) use ($proID) {
+                                $q2->where('rmm_pro_id', $proID)->where('is_signed_by_rmm', false);
+                            });
+                    });
+                break;
+
+            // more cases can be added as needed
+            default:
+                break;
+        }
+        $bills = $query->orderBy('created_at', 'desc')->get();
+        return view('app.practice-management.bills', compact('bills', 'filter'));
+    }
+
+
     // video call page (RHS)
     // video call page (RHS)
     // generic call handle (no uid)
     // generic call handle (no uid)
     // specific call handle (uid of client)
     // specific call handle (uid of client)

+ 2 - 2
resources/views/app/dashboard.blade.php

@@ -25,11 +25,11 @@
                                 </tr>
                                 </tr>
                                 <tr>
                                 <tr>
                                     <th>{{$keyNumbers['pendingBillsToSign']}}</th>
                                     <th>{{$keyNumbers['pendingBillsToSign']}}</th>
-                                    <th><a href="/bills/not-yet-signed">Pending bills to sign</a></th>
+                                    <th><a href="/practice-management/bills/not-yet-signed">Pending bills to sign</a></th>
                                 </tr>
                                 </tr>
                                 <tr>
                                 <tr>
                                     <th>{{$keyNumbers['pendingNotesToSign']}}</th>
                                     <th>{{$keyNumbers['pendingNotesToSign']}}</th>
-                                    <th><a href="/notes/not-yet-signed">Pending notes to sign</a></th>
+                                    <th><a href="/practice-management/notes/not-yet-signed">Pending notes to sign</a></th>
                                 </tr>
                                 </tr>
                             </tbody>
                             </tbody>
                         </table>
                         </table>

+ 1 - 1
resources/views/app/bills.blade.php → resources/views/app/practice-management/bills.blade.php

@@ -10,7 +10,7 @@
                 <i class="fas fa-user-injured"></i>
                 <i class="fas fa-user-injured"></i>
                 Bills
                 Bills
             </strong>
             </strong>
-            <select class="ml-auto max-width-300px form-control form-control-sm" onchange="fastLoad('/bills/' + this.value, true, false, false)">
+            <select class="ml-auto max-width-300px form-control form-control-sm" onchange="fastLoad('/practice-management/bills/' + this.value, true, false, false)">
                 <option value="" {{ $filter === '' ? 'selected' : '' }}>All bills</option>
                 <option value="" {{ $filter === '' ? 'selected' : '' }}>All bills</option>
                 <option value="not-yet-signed" {{ $filter === 'not-yet-signed' ? 'selected' : '' }}>Bills not yet signed</option>
                 <option value="not-yet-signed" {{ $filter === 'not-yet-signed' ? 'selected' : '' }}>Bills not yet signed</option>
             </select>
             </select>

+ 1 - 1
resources/views/app/notes.blade.php → resources/views/app/practice-management/notes.blade.php

@@ -10,7 +10,7 @@
                 <i class="fas fa-user-injured"></i>
                 <i class="fas fa-user-injured"></i>
                 Notes
                 Notes
             </strong>
             </strong>
-            <select class="ml-auto max-width-300px form-control form-control-sm" onchange="fastLoad('/notes/' + this.value, true, false, false)">
+            <select class="ml-auto max-width-300px form-control form-control-sm" onchange="fastLoad('/practice-management/notes/' + this.value, true, false, false)">
                 <option value="" {{ $filter === '' ? 'selected' : '' }}>All notes</option>
                 <option value="" {{ $filter === '' ? 'selected' : '' }}>All notes</option>
                 <option value="not-yet-signed" {{ $filter === 'not-yet-signed' ? 'selected' : '' }}>Notes not yet signed</option>
                 <option value="not-yet-signed" {{ $filter === 'not-yet-signed' ? 'selected' : '' }}>Notes not yet signed</option>
             </select>
             </select>

+ 2 - 4
routes/web.php

@@ -35,10 +35,6 @@ Route::middleware('pro.auth')->group(function () {
 
 
     Route::get('/patients/{filter?}', 'HomeController@patients')->name('patients');
     Route::get('/patients/{filter?}', 'HomeController@patients')->name('patients');
 
 
-    Route::get('/notes/{filter?}', 'HomeController@notes')->name('notes');
-
-    Route::get('/bills/{filter?}', 'HomeController@bills')->name('bills');
-
     Route::name('practice-management.')->prefix('practice-management')->group(function () {
     Route::name('practice-management.')->prefix('practice-management')->group(function () {
         Route::get('rates', 'PracticeManagementController@rates')->name('rates');
         Route::get('rates', 'PracticeManagementController@rates')->name('rates');
         Route::get('dashboard', 'PracticeManagementController@dashboard')->name('dashboard');
         Route::get('dashboard', 'PracticeManagementController@dashboard')->name('dashboard');
@@ -49,6 +45,8 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('direct-deposit-settings', 'PracticeManagementController@directDepositSettings')->name('directDepositSettings');
         Route::get('direct-deposit-settings', 'PracticeManagementController@directDepositSettings')->name('directDepositSettings');
         Route::get('w9', 'PracticeManagementController@w9')->name('w9');
         Route::get('w9', 'PracticeManagementController@w9')->name('w9');
         Route::get('contract', 'PracticeManagementController@contract')->name('contract');
         Route::get('contract', 'PracticeManagementController@contract')->name('contract');
+        Route::get('notes/{filter?}', 'PracticeManagementController@notes')->name('notes');
+        Route::get('bills/{filter?}', 'PracticeManagementController@bills')->name('bills');
     });
     });
 
 
     Route::name('patients.view.')->prefix('patients/view/{patient}')->group(function () {
     Route::name('patients.view.')->prefix('patients/view/{patient}')->group(function () {