chore: run pint

This commit is contained in:
Yoga Pangestu 2025-11-21 15:30:50 +07:00
parent 79b217798a
commit fb424c4192
5 changed files with 30 additions and 31 deletions

View File

@ -69,22 +69,22 @@ public function columns(): array
->hideIf(! auth()->user()->hasRole(['Developer', 'Owner'])),
Column::make('Harga Jual', 'sale_price')
->label(fn($row, $column) => currency($row->sale_price, 'Rp'))
->label(fn ($row, $column) => currency($row->sale_price, 'Rp'))
->searchable()
->sortable(),
ImageColumn::make('Gambar')
->location(fn($row) => optional($row->getMedia('image')->first())->getUrl() ?? asset('assets/images/logo.png'))
->attributes(fn($row) => [
->location(fn ($row) => optional($row->getMedia('image')->first())->getUrl() ?? asset('assets/images/logo.png'))
->attributes(fn ($row) => [
'style' => 'width: 50px; height: 50px;',
'alt' => $row->name,
]),
ArrayColumn::make('Outlet')
->data(
fn($value, $row) => $row->outlets
->filter(fn($outlet) => auth()->user()->outlets->pluck('id')->contains($outlet->id))
->map(fn($outlet) => [
fn ($value, $row) => $row->outlets
->filter(fn ($outlet) => auth()->user()->outlets->pluck('id')->contains($outlet->id))
->map(fn ($outlet) => [
'id' => $outlet->hash,
'bottle_id' => $row->hash,
'name' => $outlet->name,
@ -96,7 +96,7 @@ public function columns(): array
$canAudit = auth()->user()->can('audit bottle');
$tag = $canAudit ? 'div' : 'a';
$attrs = $canAudit ? '' : 'href="' . $route . '" wire:navigate';
$attrs = $canAudit ? '' : 'href="'.$route.'" wire:navigate';
return Blade::render("
<{$tag} {$attrs}
@ -142,7 +142,7 @@ public function builder(): Builder
->with('outlets')
->whereHas(
'outlets',
fn($q) => $q->whereIn('outlets.id', auth()->user()->outlets()->pluck('outlets.id'))
fn ($q) => $q->whereIn('outlets.id', auth()->user()->outlets()->pluck('outlets.id'))
);
}
}

View File

@ -47,14 +47,14 @@ public function columns(): array
->html(),
ArrayColumn::make('Kategori')
->data(fn($value, $row) => $row->categories->pluck('name')->toArray())
->outputFormat(fn($index, $value) => Blade::render('<span class="text-xs text-gray-400 border border-gray-400 rounded px-1">' . $value . '</span>'))
->data(fn ($value, $row) => $row->categories->pluck('name')->toArray())
->outputFormat(fn ($index, $value) => Blade::render('<span class="text-xs text-gray-400 border border-gray-400 rounded px-1">'.$value.'</span>'))
->flexRow(['class' => 'gap-2 flex-wrap']),
Column::make('Merek', 'brand.name')->searchable()->sortable(),
Column::make('Concentration', 'concentration')
->label(fn($row, $column) => Blade::render('<flux:badge color="' . $row->concentration->color() . '">' . $row->concentration->label() . '</flux:badge>'))
->label(fn ($row, $column) => Blade::render('<flux:badge color="'.$row->concentration->color().'">'.$row->concentration->label().'</flux:badge>'))
->html(),
Column::make('Harga Beli', 'cost_price')
@ -79,15 +79,15 @@ public function columns(): array
->hideIf(! auth()->user()->hasRole(['Developer', 'Owner'])),
Column::make('Harga Jual', 'sale_price')
->label(fn($row, $column) => currency($row->sale_price, 'Rp'))
->label(fn ($row, $column) => currency($row->sale_price, 'Rp'))
->searchable()
->sortable(),
ArrayColumn::make('Outlet')
->data(
fn($value, $row) => $row->outlets
->filter(fn($outlet) => auth()->user()->outlets->pluck('id')->contains($outlet->id))
->map(fn($outlet) => [
fn ($value, $row) => $row->outlets
->filter(fn ($outlet) => auth()->user()->outlets->pluck('id')->contains($outlet->id))
->map(fn ($outlet) => [
'id' => $outlet->hash,
'perfume_id' => $row->hash,
'name' => $outlet->name,
@ -99,7 +99,7 @@ public function columns(): array
$canAudit = auth()->user()->can('audit perfume');
$tag = $canAudit ? 'div' : 'a';
$attrs = $canAudit ? '' : 'href="' . $route . '" wire:navigate';
$attrs = $canAudit ? '' : 'href="'.$route.'" wire:navigate';
return Blade::render("
<{$tag} {$attrs}
@ -159,7 +159,7 @@ public function builder(): Builder
])
->whereHas(
'outlets',
fn($q) => $q->whereIn('outlets.id', auth()->user()->outlets()->pluck('outlets.id'))
fn ($q) => $q->whereIn('outlets.id', auth()->user()->outlets()->pluck('outlets.id'))
);
}
}

View File

@ -68,15 +68,15 @@ public function columns(): array
->hideIf(! auth()->user()->hasRole(['Developer', 'Owner'])),
Column::make('Harga Jual', 'sale_price')
->label(fn($row, $column) => currency($row->sale_price, 'Rp'))
->label(fn ($row, $column) => currency($row->sale_price, 'Rp'))
->searchable()
->sortable(),
ArrayColumn::make('Outlet')
->data(
fn($value, $row) => $row->outlets
->filter(fn($outlet) => auth()->user()->outlets->pluck('id')->contains($outlet->id))
->map(fn($outlet) => [
fn ($value, $row) => $row->outlets
->filter(fn ($outlet) => auth()->user()->outlets->pluck('id')->contains($outlet->id))
->map(fn ($outlet) => [
'id' => $outlet->hash,
'product_id' => $row->hash,
'name' => $outlet->name,
@ -88,7 +88,7 @@ public function columns(): array
$canAudit = auth()->user()->can('audit product');
$tag = $canAudit ? 'div' : 'a';
$attrs = $canAudit ? '' : 'href="' . $route . '" wire:navigate';
$attrs = $canAudit ? '' : 'href="'.$route.'" wire:navigate';
return Blade::render("
<{$tag} {$attrs}
@ -134,7 +134,7 @@ public function builder(): Builder
->with('outlets')
->whereHas(
'outlets',
fn($q) => $q->whereIn('outlets.id', auth()->user()->outlets()->pluck('outlets.id'))
fn ($q) => $q->whereIn('outlets.id', auth()->user()->outlets()->pluck('outlets.id'))
);
}
}

View File

@ -14,7 +14,7 @@
class PriceRequestsTable extends DataTableComponent
{
use WithConfiguration, WithPrependColumn, WithAppendColumn;
use WithAppendColumn, WithConfiguration, WithPrependColumn;
protected $model = PriceRequest::class;
@ -24,11 +24,11 @@ public function columns(): array
Column::make('Pemohon', 'user.employee.full_name')->searchable(),
Column::make('module', 'module')
->format(fn($row) => ucfirst($row))
->format(fn ($row) => ucfirst($row))
->searchable(),
Column::make('Status', 'status')
->label(fn($row, $column) => Blade::render('<flux:badge color="' . $row->status->color() . '">' . $row->status->label() . '</flux:badge>'))
->label(fn ($row, $column) => Blade::render('<flux:badge color="'.$row->status->color().'">'.$row->status->label().'</flux:badge>'))
->html(),
Column::make('Tanggal')

View File

@ -4,7 +4,6 @@
use App\Enums\PriceRequestStatus;
use App\Jobs\StorePushNotification;
use App\Livewire\Datatable\Studio\Catalog\PerfumesTable;
use App\Models\PriceRequest as PriceRequestModel;
use App\Models\PushNotification;
use App\Traits\Notification\WithSubscribeNotification;
@ -26,14 +25,14 @@ public function approve(PriceRequestModel $priceRequest)
$priceRequest->update([
'status' => PriceRequestStatus::APPROVED->value,
'finalized_at' => now()
'finalized_at' => now(),
]);
StorePushNotification::dispatch(
PushNotification::where('user_id', $priceRequest->user_id)->get(),
[
'title' => 'Permintaan Harga Disetujui ✅',
'body' => "Selamat! Permintaan untuk melihat harga beli {$priceRequest->module} sudah disetujui 🎉",
'body' => "Selamat! Permintaan untuk melihat harga beli {$priceRequest->module} sudah disetujui 🎉",
],
);
@ -50,14 +49,14 @@ public function reject(PriceRequestModel $priceRequest)
$priceRequest->update([
'status' => PriceRequestStatus::REJECTED->value,
'finalized_at' => now()
'finalized_at' => now(),
]);
StorePushNotification::dispatch(
PushNotification::where('user_id', $priceRequest->user_id)->get(),
[
'title' => 'Permintaan Harga Ditolak ❌',
'body' => "Maaf, permintaan untuk melihat harga beli {$priceRequest->module} tidak dapat dipenuhi 🙏",
'body' => "Maaf, permintaan untuk melihat harga beli {$priceRequest->module} tidak dapat dipenuhi 🙏",
],
);