فهرست منبع

Update rates page - for admins only

Vijayakrishnan 4 سال پیش
والد
کامیت
202cb3009c

+ 10 - 4
app/Http/Controllers/PracticeManagementController.php

@@ -25,11 +25,17 @@ class PracticeManagementController extends Controller
         return view('app.practice-management.dashboard');
     }
 
-    public function rates(Request $request)
+    public function rates(Request $request, $selectedProUid = 'all')
     {
-        $proID = $this->performer()->pro->id;
-        $rates = ProRate::where('pro_id', $proID)->where('is_active', true)->orderBy('created_at', 'desc')->get();
-        return view('app.practice-management.rates', compact('rates'));
+        $proUid = $selectedProUid ? $selectedProUid : 'all';
+        $rates = ProRate::where('is_active', true);
+        if($proUid !== 'all') {
+            $selectedPro = Pro::where('uid', $proUid)->first();
+            $rates = $rates->where('pro_id', $selectedPro->id);
+        }
+        $rates = $rates->orderBy('pro_id', 'asc')->get();
+        $pros = Pro::all();
+        return view('app.practice-management.rates', compact('rates', 'pros', 'selectedProUid'));
     }
 
     public function previousBills(Request $request)

+ 5 - 0
app/Models/ProRate.php

@@ -7,4 +7,9 @@ namespace App\Models;
 class ProRate extends Model
 {
     protected $table = 'pro_rate';
+
+    public function pro()
+    {
+        return $this->hasOne(Pro::class, 'id', 'pro_id');
+    }
 }

+ 3 - 0
public/css/style.css

@@ -221,6 +221,9 @@ body>nav.navbar {
     min-width: unset;
     max-width: 100%;
 }
+.mcp-theme-1 .width-200px {
+    width: 200px !important;
+}
 .mcp-theme-1 .min-width-200px {
     min-width: 200px !important;
 }

+ 17 - 5
resources/views/app/practice-management/rates.blade.php

@@ -5,25 +5,37 @@
     <div class="p-3 mcp-theme-1">
         <div class="card">
 
-            <div class="card-header p-3 d-flex align-items-center">
-                <strong class="mr-4">
+            <div class="card-header px-3 py-2 d-flex align-items-center">
+                <strong class="text-nowrap">
                     <i class="fas fa-user-injured"></i>
                     Payment Rates
                 </strong>
+                <span class="mx-2">for</span>
+                <select name="proUid" class="form-control form-control-sm mr-auto width-200px"
+                        onchange="fastLoad('/practice-management/rates/' + this.value)">
+                    <option value="all" {{$selectedProUid === 'all' ? 'selected' : ''}}>All Pros</option>
+                    @foreach($pros as $apro)
+                        <option value="{{$apro->uid}}" {{$selectedProUid === $apro->uid ? 'selected' : ''}}>{{$apro->name_first}} {{$apro->name_last}}</option>
+                    @endforeach
+                </select>
             </div>
             <div class="card-body p-0">
 
                 <table class="table table-sm table-condensed p-0 m-0">
                     <thead class="bg-light">
                     <tr>
-                        <th class="px-3 border-0">Responsibility</th>
-                        <th class="border-0">Code</th>
-                        <th class="border-0">Amount</th>
+                        <th class="w-25 px-3 border-0">Pro</th>
+                        <th class="w-25 border-0">Responsibility</th>
+                        <th class="w-25 border-0">Code</th>
+                        <th class="w-25 border-0">Amount</th>
                     </tr>
                     </thead>
                     <tbody>
                     @foreach ($rates as $rate)
                         <tr>
+                            <td class="px-3">
+                                {{ $rate->pro->displayName() }}
+                            </td>
                             <td class="px-3">
                                 {{ $rate->responsibility }}
                             </td>

+ 3 - 1
resources/views/layouts/template.blade.php

@@ -72,7 +72,9 @@
                     <a class="nav-link dropdown-toggle" href="#" id="practice-management" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="mr-1 fas fa-tasks"></i> Practice</a>
                     <div class="dropdown-menu" aria-labelledby="practice-management">
                         {{--<a class="dropdown-item" href="{{ route('practice-management.dashboard') }}">Dashboard</a>--}}
-                        <a class="dropdown-item" href="{{ route('practice-management.rates') }}">Payment Rates</a>
+                        @if($pro && $pro->pro_type == 'ADMIN')
+                            <a class="dropdown-item" href="/practice-management/rates/all">Payment Rates</a>
+                        @endif
                         {{--<a class="dropdown-item" href="{{ route('practice-management.previousBills') }}">Previous Bills</a>--}}
                         <a class="dropdown-item" href="{{ route('practice-management.financialTransactions') }}">Financial Transactions</a>
                         <a class="dropdown-item" href="/practice-management/bills/not-yet-signed">Pending Bills to Sign</a>

+ 1 - 1
routes/web.php

@@ -65,7 +65,7 @@ Route::middleware('pro.auth')->group(function () {
     Route::get('/unmapped-sms/{filter?}', 'HomeController@unmappedSMS')->name('unmapped-sms');
 
     Route::name('practice-management.')->prefix('practice-management')->group(function () {
-        Route::get('rates', 'PracticeManagementController@rates')->name('rates');
+        Route::get('rates/{selectedProUid?}', 'PracticeManagementController@rates')->name('rates');
         Route::get('dashboard', 'PracticeManagementController@dashboard')->name('dashboard');
         Route::get('previous-bills', 'PracticeManagementController@previousBills')->name('previousBills');
         Route::get('financial-transactions', 'PracticeManagementController@financialTransactions')->name('financialTransactions');