chore: run pint
This commit is contained in:
parent
79b217798a
commit
fb424c4192
@ -69,22 +69,22 @@ public function columns(): array
|
|||||||
->hideIf(! auth()->user()->hasRole(['Developer', 'Owner'])),
|
->hideIf(! auth()->user()->hasRole(['Developer', 'Owner'])),
|
||||||
|
|
||||||
Column::make('Harga Jual', 'sale_price')
|
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()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
|
||||||
ImageColumn::make('Gambar')
|
ImageColumn::make('Gambar')
|
||||||
->location(fn($row) => optional($row->getMedia('image')->first())->getUrl() ?? asset('assets/images/logo.png'))
|
->location(fn ($row) => optional($row->getMedia('image')->first())->getUrl() ?? asset('assets/images/logo.png'))
|
||||||
->attributes(fn($row) => [
|
->attributes(fn ($row) => [
|
||||||
'style' => 'width: 50px; height: 50px;',
|
'style' => 'width: 50px; height: 50px;',
|
||||||
'alt' => $row->name,
|
'alt' => $row->name,
|
||||||
]),
|
]),
|
||||||
|
|
||||||
ArrayColumn::make('Outlet')
|
ArrayColumn::make('Outlet')
|
||||||
->data(
|
->data(
|
||||||
fn($value, $row) => $row->outlets
|
fn ($value, $row) => $row->outlets
|
||||||
->filter(fn($outlet) => auth()->user()->outlets->pluck('id')->contains($outlet->id))
|
->filter(fn ($outlet) => auth()->user()->outlets->pluck('id')->contains($outlet->id))
|
||||||
->map(fn($outlet) => [
|
->map(fn ($outlet) => [
|
||||||
'id' => $outlet->hash,
|
'id' => $outlet->hash,
|
||||||
'bottle_id' => $row->hash,
|
'bottle_id' => $row->hash,
|
||||||
'name' => $outlet->name,
|
'name' => $outlet->name,
|
||||||
@ -96,7 +96,7 @@ public function columns(): array
|
|||||||
$canAudit = auth()->user()->can('audit bottle');
|
$canAudit = auth()->user()->can('audit bottle');
|
||||||
|
|
||||||
$tag = $canAudit ? 'div' : 'a';
|
$tag = $canAudit ? 'div' : 'a';
|
||||||
$attrs = $canAudit ? '' : 'href="' . $route . '" wire:navigate';
|
$attrs = $canAudit ? '' : 'href="'.$route.'" wire:navigate';
|
||||||
|
|
||||||
return Blade::render("
|
return Blade::render("
|
||||||
<{$tag} {$attrs}
|
<{$tag} {$attrs}
|
||||||
@ -142,7 +142,7 @@ public function builder(): Builder
|
|||||||
->with('outlets')
|
->with('outlets')
|
||||||
->whereHas(
|
->whereHas(
|
||||||
'outlets',
|
'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'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,14 +47,14 @@ public function columns(): array
|
|||||||
->html(),
|
->html(),
|
||||||
|
|
||||||
ArrayColumn::make('Kategori')
|
ArrayColumn::make('Kategori')
|
||||||
->data(fn($value, $row) => $row->categories->pluck('name')->toArray())
|
->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>'))
|
->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']),
|
->flexRow(['class' => 'gap-2 flex-wrap']),
|
||||||
|
|
||||||
Column::make('Merek', 'brand.name')->searchable()->sortable(),
|
Column::make('Merek', 'brand.name')->searchable()->sortable(),
|
||||||
|
|
||||||
Column::make('Concentration', 'concentration')
|
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(),
|
->html(),
|
||||||
|
|
||||||
Column::make('Harga Beli', 'cost_price')
|
Column::make('Harga Beli', 'cost_price')
|
||||||
@ -79,15 +79,15 @@ public function columns(): array
|
|||||||
->hideIf(! auth()->user()->hasRole(['Developer', 'Owner'])),
|
->hideIf(! auth()->user()->hasRole(['Developer', 'Owner'])),
|
||||||
|
|
||||||
Column::make('Harga Jual', 'sale_price')
|
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()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
|
||||||
ArrayColumn::make('Outlet')
|
ArrayColumn::make('Outlet')
|
||||||
->data(
|
->data(
|
||||||
fn($value, $row) => $row->outlets
|
fn ($value, $row) => $row->outlets
|
||||||
->filter(fn($outlet) => auth()->user()->outlets->pluck('id')->contains($outlet->id))
|
->filter(fn ($outlet) => auth()->user()->outlets->pluck('id')->contains($outlet->id))
|
||||||
->map(fn($outlet) => [
|
->map(fn ($outlet) => [
|
||||||
'id' => $outlet->hash,
|
'id' => $outlet->hash,
|
||||||
'perfume_id' => $row->hash,
|
'perfume_id' => $row->hash,
|
||||||
'name' => $outlet->name,
|
'name' => $outlet->name,
|
||||||
@ -99,7 +99,7 @@ public function columns(): array
|
|||||||
$canAudit = auth()->user()->can('audit perfume');
|
$canAudit = auth()->user()->can('audit perfume');
|
||||||
|
|
||||||
$tag = $canAudit ? 'div' : 'a';
|
$tag = $canAudit ? 'div' : 'a';
|
||||||
$attrs = $canAudit ? '' : 'href="' . $route . '" wire:navigate';
|
$attrs = $canAudit ? '' : 'href="'.$route.'" wire:navigate';
|
||||||
|
|
||||||
return Blade::render("
|
return Blade::render("
|
||||||
<{$tag} {$attrs}
|
<{$tag} {$attrs}
|
||||||
@ -159,7 +159,7 @@ public function builder(): Builder
|
|||||||
])
|
])
|
||||||
->whereHas(
|
->whereHas(
|
||||||
'outlets',
|
'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'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,15 +68,15 @@ public function columns(): array
|
|||||||
->hideIf(! auth()->user()->hasRole(['Developer', 'Owner'])),
|
->hideIf(! auth()->user()->hasRole(['Developer', 'Owner'])),
|
||||||
|
|
||||||
Column::make('Harga Jual', 'sale_price')
|
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()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
|
||||||
ArrayColumn::make('Outlet')
|
ArrayColumn::make('Outlet')
|
||||||
->data(
|
->data(
|
||||||
fn($value, $row) => $row->outlets
|
fn ($value, $row) => $row->outlets
|
||||||
->filter(fn($outlet) => auth()->user()->outlets->pluck('id')->contains($outlet->id))
|
->filter(fn ($outlet) => auth()->user()->outlets->pluck('id')->contains($outlet->id))
|
||||||
->map(fn($outlet) => [
|
->map(fn ($outlet) => [
|
||||||
'id' => $outlet->hash,
|
'id' => $outlet->hash,
|
||||||
'product_id' => $row->hash,
|
'product_id' => $row->hash,
|
||||||
'name' => $outlet->name,
|
'name' => $outlet->name,
|
||||||
@ -88,7 +88,7 @@ public function columns(): array
|
|||||||
$canAudit = auth()->user()->can('audit product');
|
$canAudit = auth()->user()->can('audit product');
|
||||||
|
|
||||||
$tag = $canAudit ? 'div' : 'a';
|
$tag = $canAudit ? 'div' : 'a';
|
||||||
$attrs = $canAudit ? '' : 'href="' . $route . '" wire:navigate';
|
$attrs = $canAudit ? '' : 'href="'.$route.'" wire:navigate';
|
||||||
|
|
||||||
return Blade::render("
|
return Blade::render("
|
||||||
<{$tag} {$attrs}
|
<{$tag} {$attrs}
|
||||||
@ -134,7 +134,7 @@ public function builder(): Builder
|
|||||||
->with('outlets')
|
->with('outlets')
|
||||||
->whereHas(
|
->whereHas(
|
||||||
'outlets',
|
'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'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
class PriceRequestsTable extends DataTableComponent
|
class PriceRequestsTable extends DataTableComponent
|
||||||
{
|
{
|
||||||
use WithConfiguration, WithPrependColumn, WithAppendColumn;
|
use WithAppendColumn, WithConfiguration, WithPrependColumn;
|
||||||
|
|
||||||
protected $model = PriceRequest::class;
|
protected $model = PriceRequest::class;
|
||||||
|
|
||||||
@ -24,11 +24,11 @@ public function columns(): array
|
|||||||
Column::make('Pemohon', 'user.employee.full_name')->searchable(),
|
Column::make('Pemohon', 'user.employee.full_name')->searchable(),
|
||||||
|
|
||||||
Column::make('module', 'module')
|
Column::make('module', 'module')
|
||||||
->format(fn($row) => ucfirst($row))
|
->format(fn ($row) => ucfirst($row))
|
||||||
->searchable(),
|
->searchable(),
|
||||||
|
|
||||||
Column::make('Status', 'status')
|
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(),
|
->html(),
|
||||||
|
|
||||||
Column::make('Tanggal')
|
Column::make('Tanggal')
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
use App\Enums\PriceRequestStatus;
|
use App\Enums\PriceRequestStatus;
|
||||||
use App\Jobs\StorePushNotification;
|
use App\Jobs\StorePushNotification;
|
||||||
use App\Livewire\Datatable\Studio\Catalog\PerfumesTable;
|
|
||||||
use App\Models\PriceRequest as PriceRequestModel;
|
use App\Models\PriceRequest as PriceRequestModel;
|
||||||
use App\Models\PushNotification;
|
use App\Models\PushNotification;
|
||||||
use App\Traits\Notification\WithSubscribeNotification;
|
use App\Traits\Notification\WithSubscribeNotification;
|
||||||
@ -26,14 +25,14 @@ public function approve(PriceRequestModel $priceRequest)
|
|||||||
|
|
||||||
$priceRequest->update([
|
$priceRequest->update([
|
||||||
'status' => PriceRequestStatus::APPROVED->value,
|
'status' => PriceRequestStatus::APPROVED->value,
|
||||||
'finalized_at' => now()
|
'finalized_at' => now(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
StorePushNotification::dispatch(
|
StorePushNotification::dispatch(
|
||||||
PushNotification::where('user_id', $priceRequest->user_id)->get(),
|
PushNotification::where('user_id', $priceRequest->user_id)->get(),
|
||||||
[
|
[
|
||||||
'title' => 'Permintaan Harga Disetujui ✅',
|
'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([
|
$priceRequest->update([
|
||||||
'status' => PriceRequestStatus::REJECTED->value,
|
'status' => PriceRequestStatus::REJECTED->value,
|
||||||
'finalized_at' => now()
|
'finalized_at' => now(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
StorePushNotification::dispatch(
|
StorePushNotification::dispatch(
|
||||||
PushNotification::where('user_id', $priceRequest->user_id)->get(),
|
PushNotification::where('user_id', $priceRequest->user_id)->get(),
|
||||||
[
|
[
|
||||||
'title' => 'Permintaan Harga Ditolak ❌',
|
'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 🙏",
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user