partner programm completed

This commit is contained in:
salam committed 2026-01-29 20:20:31 +01:00
1 parent 84bfa248cd
commit a883ccf0ea
22 files changed
+722 -28

No files matched your search

@@ -346,6 +346,9 @@ class EventsTable
)->when(
$data['starttime_period'],
function (Builder $query, $starttime_period) {
// dd($starttime_period);
if (isset($starttime_period['start']) && isset($starttime_period['end'])) {
$from = Carbon::createFromDate($starttime_period['start']);
$end = Carbon::createFromDate($starttime_period['end']);
@@ -462,17 +465,17 @@ class EventsTable
if ($data['filter_alarm_green'] ?? null) {
$title = OddsTable::where('name', $data['filter_alarm_green'])->value('title');
$indicators[] = Indicator::make('Alarm: '.$title)->removeField('filter_alarm_green')->color('success');
$indicators[] = Indicator::make('Alarms: '.$title)->removeField('filter_alarm_green')->color('success');
}
if ($data['filter_alarm_yellow'] ?? null) {
$title = OddsTable::where('name', $data['filter_alarm_yellow'])->value('title');
$indicators[] = Indicator::make('Alarm: '.$title)->removeField('filter_alarm_yellow')->color('warning');
$indicators[] = Indicator::make('Alarms: '.$title)->removeField('filter_alarm_yellow')->color('warning');
}
if ($data['filter_alarm_red'] ?? null) {
$title = OddsTable::where('name', $data['filter_alarm_red'])->value('title');
$indicators[] = Indicator::make('Alarm: '.$title)->removeField('filter_alarm_red')->color('danger');
$indicators[] = Indicator::make('Alarms: '.$title)->removeField('filter_alarm_red')->color('danger');
}
if ($data['starttime_period'] ?? null) {
@@ -526,10 +529,18 @@ class EventsTable
->deferFilters(false)
->hiddenFilterIndicators(false)
->persistFiltersInSession()
->emptyStateHeading('No events')
->emptyStateDescription('Modify the filter')
->recordActions([
Action::make('star')
->iconButton()
->color('gray')
->color(function ($record) {
if (isset($record->event_user_star->id)) {
return 'info';
} else {
return 'gray';
}
})
->icon(function ($record) {
if (isset($record->event_user_star->id)) {
return 'phosphor-star-fill';
@@ -0,0 +1,41 @@
<?php
namespace App\Filament\Resources\Events\Tables\Tools;
use App\Filament\Resources\Events\Tables\EventsTable;
use App\Models\OddsTable;
use Illuminate\Support\Facades\DB;
class LoadPartnerDifferences
{
public static function load()
{
$fields = OddsTable::fields();
$event_ids = [];
foreach (EventsTable::$bettype_settings as $table) {
$books = DB::table($table)
->where('bookmaker_id', auth()->user()->bookmaker_id)
->get();
$partners = DB::table($table)
->where('bookmaker_id', auth()->user()->partner_bookmaker_id)
->get();
foreach ($books as $book) {
$row1 = get_object_vars($book);
foreach ($partners as $partner) {
$row2 = get_object_vars($partner);
if ($row1['event_id'] == $row2['event_id']) {
foreach ($fields[$table] as $field) {
if ($row1[$field] != $row2[$field]) {
$event_ids[] = $row1['event_id'];
}
}
}
}
}
}
return array_unique($event_ids);
}
}