removed challan in invoice data dashboard
This commit is contained in:
@@ -53,6 +53,34 @@ class InvoiceDataDashboard extends Page
|
||||
}),
|
||||
Select::make('distribution_channel')
|
||||
->label('Distribution Channel')
|
||||
// ->options(function (callable $get) {
|
||||
// $plant = $get('plant');
|
||||
|
||||
// if (!$plant) {
|
||||
// return [];
|
||||
// }
|
||||
|
||||
// $options = InvoiceDataValidation::where('plant_id', $plant)
|
||||
// ->whereNotNull('distribution_channel_desc')
|
||||
// ->where('distribution_channel_desc', '!=', '')
|
||||
// ->select('distribution_channel_desc')
|
||||
// ->distinct()
|
||||
// ->pluck('distribution_channel_desc', 'distribution_channel_desc')
|
||||
// ->toArray();
|
||||
|
||||
// $hasEmpty = InvoiceDataValidation::where('plant_id', $plant)
|
||||
// ->where(function ($q) {
|
||||
// $q->whereNull('distribution_channel_desc')
|
||||
// ->orWhere('distribution_channel_desc', '');
|
||||
// })
|
||||
// ->exists();
|
||||
|
||||
// if ($hasEmpty) {
|
||||
// $options['Challan'] = 'Challan';
|
||||
// }
|
||||
|
||||
// return $options;
|
||||
// })
|
||||
->options(function (callable $get) {
|
||||
$plant = $get('plant');
|
||||
|
||||
@@ -60,26 +88,13 @@ class InvoiceDataDashboard extends Page
|
||||
return [];
|
||||
}
|
||||
|
||||
$options = InvoiceDataValidation::where('plant_id', $plant)
|
||||
// Fetch unique, non-empty distribution_channel_desc values
|
||||
return InvoiceDataValidation::where('plant_id', $plant)
|
||||
->whereNotNull('distribution_channel_desc')
|
||||
->where('distribution_channel_desc', '!=', '')
|
||||
->select('distribution_channel_desc')
|
||||
->distinct()
|
||||
->pluck('distribution_channel_desc', 'distribution_channel_desc')
|
||||
->toArray();
|
||||
|
||||
$hasEmpty = InvoiceDataValidation::where('plant_id', $plant)
|
||||
->where(function ($q) {
|
||||
$q->whereNull('distribution_channel_desc')
|
||||
->orWhere('distribution_channel_desc', '');
|
||||
})
|
||||
->exists();
|
||||
|
||||
if ($hasEmpty) {
|
||||
$options['Challan'] = 'Challan';
|
||||
}
|
||||
|
||||
return $options;
|
||||
})
|
||||
->afterStateUpdated(callback: function ($state,callable $set) {
|
||||
session(['dist_channel' => $state]);
|
||||
@@ -106,6 +121,4 @@ class InvoiceDataDashboard extends Page
|
||||
return Auth::check() && Auth::user()->can('view invoice data dashboard');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user