Fix DB schema mismatches from backup import

- purpose/concern/region/district tables use uz/ru/cr instead of name
- auto_orders/estate_orders use purpose_id not purpose
- Add ownerName/owner computed fields from owner_first/last_name
- Fix appraiserChart to use order_members instead of appraiser_id
- Fix DebitController to join appraiser and order relations
- Fix role queries to be case-insensitive (DB has mixed case)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-06 06:05:09 +05:00
parent b5b58987fb
commit 6c985c1b29
11 changed files with 139 additions and 63 deletions

View File

@@ -38,11 +38,10 @@ class HomeController extends Controller
$actions = DB::table('tracking_actions')->latest()->limit(20)->get();
$appraiserChart = [[], []];
$appraisers = DB::table('users')->where('role', 'appraiser')->get();
$appraisers = DB::table('users')->whereRaw('LOWER(role) = ?', ['appraiser'])->get();
foreach ($appraisers as $appraiser) {
$appraiserChart[0][] = $appraiser->name;
$count = DB::table('auto_orders')->where('appraiser_id', $appraiser->id)->count()
+ DB::table('estate_orders')->where('appraiser_id', $appraiser->id)->count();
$count = DB::table('order_members')->where('user_id', $appraiser->id)->count();
$appraiserChart[1][] = $count;
}