notification messages wip
This commit is contained in:
1 parent
98d92b2ee3
commit
3ad02457f1
9 files changed
+150
-23
No files matched your search
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Actions;
|
namespace App\Actions;
|
||||||
|
|
||||||
|
use App\Models\Event;
|
||||||
use App\Models\EventBookmaker;
|
use App\Models\EventBookmaker;
|
||||||
use App\Models\OddsTable;
|
use App\Models\OddsTable;
|
||||||
|
|
||||||
@@ -15,10 +16,11 @@ class AlarmStatistic
|
|||||||
$fields[$value->name] = explode(',', $value->fieldnames);
|
$fields[$value->name] = explode(',', $value->fieldnames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$event_ids = Event::where('sport_id', auth()->user()->sport_id)->where('starttime', '>=', now())->pluck('id')->toArray();
|
||||||
|
|
||||||
$res = EventBookmaker::select('alarm_2w_h2w', 'alarm_2w_a2w', 'alarm_2ws1_h2w', 'alarm_2ws1_a2w', 'alarm_3w_h3w', 'alarm_3w_d3w', 'alarm_3w_a3w', 'alarm_3wht_h3w', 'alarm_3wht_d3w', 'alarm_3wht_a3w', 'alarm_dc_dc1x', 'alarm_dc_dc12', 'alarm_dc_dcx2', 'alarm_dbn_dnb1', 'alarm_dbn_dnb2', 'alarm_ggng_gg', 'alarm_ggng_ng', 'alarm_po_home', 'alarm_po_away', 'alarm_poht_home', 'alarm_poht_away', 'alarm_poq1_home', 'alarm_poq1_away', 'alarm_to_over', 'alarm_to_under', 'alarm_toht_over', 'alarm_toht_under', 'alarm_toq1_over', 'alarm_toq1_under', 'alarm_tq_htq', 'alarm_tq_atq')
|
$res = EventBookmaker::select('alarm_2w_h2w', 'alarm_2w_a2w', 'alarm_2ws1_h2w', 'alarm_2ws1_a2w', 'alarm_3w_h3w', 'alarm_3w_d3w', 'alarm_3w_a3w', 'alarm_3wht_h3w', 'alarm_3wht_d3w', 'alarm_3wht_a3w', 'alarm_dc_dc1x', 'alarm_dc_dc12', 'alarm_dc_dcx2', 'alarm_dbn_dnb1', 'alarm_dbn_dnb2', 'alarm_ggng_gg', 'alarm_ggng_ng', 'alarm_po_home', 'alarm_po_away', 'alarm_poht_home', 'alarm_poht_away', 'alarm_poq1_home', 'alarm_poq1_away', 'alarm_to_over', 'alarm_to_under', 'alarm_toht_over', 'alarm_toht_under', 'alarm_toq1_over', 'alarm_toq1_under', 'alarm_tq_htq', 'alarm_tq_atq')
|
||||||
->where('starttime', '>=', now())
|
->whereIn('event_id', $event_ids)
|
||||||
->where('bookmaker_id', auth()->user()->bookmaker_id)
|
->where('bookmaker_id', auth()->user()->bookmaker_id)
|
||||||
->where('sport_id', auth()->user()->sport_id)
|
|
||||||
->get()
|
->get()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
|
|||||||
@@ -87,10 +87,6 @@ class EventsTable
|
|||||||
|
|
||||||
EventColumn::make('event'),
|
EventColumn::make('event'),
|
||||||
|
|
||||||
IconColumn::make('alarm')->icon('phosphor-sirene'),
|
|
||||||
|
|
||||||
IconColumn::make('note')->icon('phosphor-note'),
|
|
||||||
|
|
||||||
TooltipOdds::make('ml')->bettype('odds_2ways')->label('')->visible(fn () => in_array('odds_2ways', self::$bettype_settings)),
|
TooltipOdds::make('ml')->bettype('odds_2ways')->label('')->visible(fn () => in_array('odds_2ways', self::$bettype_settings)),
|
||||||
ColumnOdds::make('odds_2ways')->bettype('odds_2ways')
|
ColumnOdds::make('odds_2ways')->bettype('odds_2ways')
|
||||||
->visible(fn () => in_array('odds_2ways', self::$bettype_settings))
|
->visible(fn () => in_array('odds_2ways', self::$bettype_settings))
|
||||||
@@ -513,6 +509,8 @@ class EventsTable
|
|||||||
->emptyStateHeading('No events')
|
->emptyStateHeading('No events')
|
||||||
->emptyStateDescription('Modify the filter')
|
->emptyStateDescription('Modify the filter')
|
||||||
->recordActions([
|
->recordActions([
|
||||||
|
Action::make('note')->iconButton()->icon('phosphor-note')->color('gray')->tooltip('Add a message'),
|
||||||
|
Action::make('notify')->iconButton()->icon('phosphor-bell')->color('gray')->tooltip('Add a notifications'),
|
||||||
Action::make('star')
|
Action::make('star')
|
||||||
->iconButton()
|
->iconButton()
|
||||||
->color(function ($record) {
|
->color(function ($record) {
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Message extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'event_id',
|
||||||
|
'bookmaker_id',
|
||||||
|
'user_id',
|
||||||
|
'message',
|
||||||
|
'deleted',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bookmaker()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Bookmaker::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class UserNotification extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'event_id',
|
||||||
|
'bookmaker_id',
|
||||||
|
'user_id',
|
||||||
|
'message',
|
||||||
|
'deleted',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bookmaker()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Bookmaker::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function odds_table()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(OddsTable::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,10 @@ return new class extends Migration
|
|||||||
$table->boolean(column: 'has_active_spread')->default(0);
|
$table->boolean(column: 'has_active_spread')->default(0);
|
||||||
$table->string('oddnames');
|
$table->string('oddnames');
|
||||||
$table->string('fieldnames');
|
$table->string('fieldnames');
|
||||||
|
$table->boolean('soccer')->default(false);
|
||||||
|
$table->boolean('icehockey')->default(false);
|
||||||
|
$table->boolean('basketball')->default(false);
|
||||||
|
$table->boolean('tennis')->default(false);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('messages', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events');
|
||||||
|
$table->integer('bookmaker_id')->default(0);
|
||||||
|
$table->integer('user_id')->index()->references('id')->on('users');
|
||||||
|
$table->string('message');
|
||||||
|
$table->integer('deleted')->default(0);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('messages');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('user_notifications', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events');
|
||||||
|
$table->integer('bookmaker_id')->default(0);
|
||||||
|
$table->integer('user_id')->index()->references('id')->on('users');
|
||||||
|
$table->integer('odds_table_id')->index()->references('id')->on('odds_tables');
|
||||||
|
$table->integer('alarm_level_id')->default(0);
|
||||||
|
$table->string('message');
|
||||||
|
$table->integer('deleted')->default(0);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('user_notifications');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -12,22 +12,22 @@ class OddsTableSeeder extends Seeder
|
|||||||
/**
|
/**
|
||||||
* Provoider
|
* Provoider
|
||||||
*/
|
*/
|
||||||
$sql = "INSERT INTO `odds_tables` (`id`, `name`, `title`, `oddnames`, `fieldnames`, `has_active_spread`, `created_at`, `updated_at`)
|
$sql = "INSERT INTO `odds_tables` (`id`, `name`, `title`, `oddnames`, `fieldnames`, `has_active_spread`, `soccer`, `icehockey`, `basketball`, `tennis`, `created_at`, `updated_at`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'odds_2ways', 'ML', 'h2w,a2w', 'alarm_2w_h2w,alarm_2w_a2w', 0, NULL, NULL),
|
(1, 'odds_2ways', 'ML', 'h2w,a2w', 'alarm_2w_h2w,alarm_2w_a2w', 0, 0, 1, 1, 1, NULL, NULL),
|
||||||
(2, 'odds_2ways_s1', 'ML S1', 'h2w,a2w', 'alarm_2ws1_h2w,alarm_2ws1_a2w', 0, NULL, NULL),
|
(2, 'odds_2ways_s1', 'ML S1', 'h2w,a2w', 'alarm_2ws1_h2w,alarm_2ws1_a2w', 0, 0, 0, 0, 1, NULL, NULL),
|
||||||
(3, 'odds_3ways', '1X2', 'h3w,d3w,a3w', 'alarm_3w_h3w,alarm_3w_d3w,alarm_3w_a3w', 0, NULL, NULL),
|
(3, 'odds_3ways', '1X2', 'h3w,d3w,a3w', 'alarm_3w_h3w,alarm_3w_d3w,alarm_3w_a3w', 0, 1, 1, 0, 0, NULL, NULL),
|
||||||
(4, 'odds_3ways_ht', '1X2 HT', 'h3w,d3w,a3w', 'alarm_3wht_h3w,alarm_3wht_d3w,alarm_3wht_a3w', 0, NULL, NULL),
|
(4, 'odds_3ways_ht', '1X2 HT', 'h3w,d3w,a3w', 'alarm_3wht_h3w,alarm_3wht_d3w,alarm_3wht_a3w', 0, 1, 0, 0, 0, NULL, NULL),
|
||||||
(5, 'odds_dc', 'DC', 'dc1x,dc12,dcx2', 'alarm_dc_dc1x,alarm_dc_dc12,alarm_dc_dcx2', 0, NULL, NULL),
|
(5, 'odds_dc', 'DC', 'dc1x,dc12,dcx2', 'alarm_dc_dc1x,alarm_dc_dc12,alarm_dc_dcx2', 0, 1, 0, 0, 0, NULL, NULL),
|
||||||
(6, 'odds_dnb', 'DNB', 'dnb1,dnb2', 'alarm_dbn_dnb1,alarm_dbn_dnb2', 0, NULL, NULL),
|
(6, 'odds_dnb', 'DNB', 'dnb1,dnb2', 'alarm_dbn_dnb1,alarm_dbn_dnb2', 0, 1, 0, 0, 0, NULL, NULL),
|
||||||
(7, 'odds_ggng', 'GGNG', 'gg,ng', 'alarm_ggng_gg,alarm_ggng_ng', 0, NULL, NULL),
|
(7, 'odds_ggng', 'GGNG', 'gg,ng', 'alarm_ggng_gg,alarm_ggng_ng', 0, 1, 0, 0, 0, NULL, NULL),
|
||||||
(8, 'odds_points', 'PO', 'home,away', 'alarm_po_home,alarm_po_away', 1, NULL, NULL),
|
(8, 'odds_points', 'PO', 'home,away', 'alarm_po_home,alarm_po_away', 1, 0, 1, 1, 1, NULL, NULL),
|
||||||
(9, 'odds_points_ht', 'PO HT', 'home,away', 'alarm_poht_home,alarm_poht_away', 1, NULL, NULL),
|
(9, 'odds_points_ht', 'PO HT', 'home,away', 'alarm_poht_home,alarm_poht_away', 1, 0, 0, 1, 0, NULL, NULL),
|
||||||
(10, 'odds_points_q1', 'PO Q1', 'home,away', 'alarm_poq1_home,alarm_poq1_away', 1, NULL, NULL),
|
(10, 'odds_points_q1', 'PO Q1', 'home,away', 'alarm_poq1_home,alarm_poq1_away', 1, 0, 1, 1, 0, NULL, NULL),
|
||||||
(11, 'odds_totals', 'TO', 'over,under', 'alarm_to_over,alarm_to_under', 1, NULL, NULL),
|
(11, 'odds_totals', 'TO', 'over,under', 'alarm_to_over,alarm_to_under', 1, 1, 1, 1, 1, NULL, NULL),
|
||||||
(12, 'odds_totals_ht', 'TO HT', 'over,under', 'alarm_toht_over,alarm_toht_under', 1, NULL, NULL),
|
(12, 'odds_totals_ht', 'TO HT', 'over,under', 'alarm_toht_over,alarm_toht_under', 1, 1, 0, 1, 0, NULL, NULL),
|
||||||
(13, 'odds_totals_q1', 'TO Q1', 'over,under', 'alarm_toq1_over,alarm_toq1_under', 1, NULL, NULL),
|
(13, 'odds_totals_q1', 'TO Q1', 'over,under', 'alarm_toq1_over,alarm_toq1_under', 1, 0, 1, 1, 0, NULL, NULL),
|
||||||
(14, 'odds_tq', 'TQ', 'htq,atq', 'alarm_tq_htq,alarm_tq_atq', 1, NULL, NULL);
|
(14, 'odds_tq', 'TQ', 'htq,atq', 'alarm_tq_htq,alarm_tq_atq', 1, 1, 0, 0, 0, NULL, NULL);
|
||||||
";
|
";
|
||||||
DB::unprepared($sql);
|
DB::unprepared($sql);
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
$str = $getPop();
|
$str = $getPop();
|
||||||
@endphp
|
@endphp
|
||||||
@if ($getSize())
|
@if ($getSize())
|
||||||
<div class="my-auto">
|
<div class="my-auto flex flex-col gap-4">
|
||||||
<div x-data="{ pop: '{{ $str }}' }">
|
<div x-data="{ pop: '{{ $str }}' }">
|
||||||
<template x-ref="template">
|
<template x-ref="template">
|
||||||
<p x-html="pop" class="z-1000"></p>
|
<p x-html="pop" class="z-1000"></p>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<x-filament::icon-button icon="phosphor-chat-centered-text" color="gray"
|
<x-filament::icon-button icon="phosphor-chat-centered-text" color="gray" size="sm"
|
||||||
x-tooltip.html="{ content: () =>
|
x-tooltip.html="{ content: () =>
|
||||||
$refs.template.innerHTML,
|
$refs.template.innerHTML,
|
||||||
placement: 'auto',
|
placement: 'auto',
|
||||||
|
|||||||
Reference in new issue
Block a user