feat(barang): menambahakan kondisi untuk audit dan button, leader tidak bisa audit
This commit is contained in:
parent
b629dee366
commit
878644c30d
@ -90,13 +90,18 @@ public function columns(): array
|
|||||||
)
|
)
|
||||||
->outputFormat(function ($index, $value) {
|
->outputFormat(function ($index, $value) {
|
||||||
$route = route('studio.catalog.bottle.audit', [$value['id'], $value['bottle_id']]);
|
$route = route('studio.catalog.bottle.audit', [$value['id'], $value['bottle_id']]);
|
||||||
|
$canAudit = auth()->user()->can('audit bottle');
|
||||||
|
|
||||||
return Blade::render('
|
$tag = $canAudit ? 'div' : 'a';
|
||||||
<a href="{{ $route }}" wire:navigate
|
$attrs = $canAudit ? '' : 'href="'.$route.'" wire:navigate';
|
||||||
class="flex items-center space-x-2 bg-gray-50 border border-gray-200 rounded-lg px-2 py-1 text-xs hover:bg-gray-100 transition">
|
|
||||||
<span class="font-medium text-gray-700">{{ $value["name"] }}</span>
|
return Blade::render("
|
||||||
<span class="text-[10px] text-white bg-emerald-500 rounded px-1.5 py-0.5">{{ $value["stock"] }}</span>
|
<{$tag} {$attrs}
|
||||||
</a>', [
|
class='flex items-center space-x-2 bg-gray-50 border border-gray-200 rounded-lg px-2 py-1 text-xs hover:bg-gray-100 transition'>
|
||||||
|
<span class='font-medium text-gray-700'>{{ \$value['name'] }}</span>
|
||||||
|
<span class='text-[10px] text-white bg-emerald-500 rounded px-1.5 py-0.5'>{{ \$value['stock'] }}</span>
|
||||||
|
</{$tag}>
|
||||||
|
", [
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'route' => $route,
|
'route' => $route,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -93,13 +93,18 @@ public function columns(): array
|
|||||||
)
|
)
|
||||||
->outputFormat(function ($index, $value) {
|
->outputFormat(function ($index, $value) {
|
||||||
$route = route('studio.catalog.perfume.audit', [$value['id'], $value['perfume_id']]);
|
$route = route('studio.catalog.perfume.audit', [$value['id'], $value['perfume_id']]);
|
||||||
|
$canAudit = auth()->user()->can('audit perfume');
|
||||||
|
|
||||||
return Blade::render('
|
$tag = $canAudit ? 'div' : 'a';
|
||||||
<a href="{{ $route }}" wire:navigate
|
$attrs = $canAudit ? '' : 'href="'.$route.'" wire:navigate';
|
||||||
class="flex items-center space-x-2 bg-gray-50 border border-gray-200 rounded-lg px-2 py-1 text-xs hover:bg-gray-100 transition">
|
|
||||||
<span class="font-medium text-gray-700">{{ $value["name"] }}</span>
|
return Blade::render("
|
||||||
<span class="text-[10px] text-white bg-emerald-500 rounded px-1.5 py-0.5">{{ $value["stock"] }}</span>
|
<{$tag} {$attrs}
|
||||||
</a>', [
|
class='flex items-center space-x-2 bg-gray-50 border border-gray-200 rounded-lg px-2 py-1 text-xs hover:bg-gray-100 transition'>
|
||||||
|
<span class='font-medium text-gray-700'>{{ \$value['name'] }}</span>
|
||||||
|
<span class='text-[10px] text-white bg-emerald-500 rounded px-1.5 py-0.5'>{{ \$value['stock'] }}</span>
|
||||||
|
</{$tag}>
|
||||||
|
", [
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'route' => $route,
|
'route' => $route,
|
||||||
]);
|
]);
|
||||||
@ -126,7 +131,8 @@ class="flex items-center space-x-2 bg-gray-50 border border-gray-200 rounded-lg
|
|||||||
|
|
||||||
return $actions;
|
return $actions;
|
||||||
})
|
})
|
||||||
->html(),
|
->html()
|
||||||
|
->hideIf(auth()->user()->cannot('update perfume', 'delete perfume')),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -82,13 +82,18 @@ public function columns(): array
|
|||||||
)
|
)
|
||||||
->outputFormat(function ($index, $value) {
|
->outputFormat(function ($index, $value) {
|
||||||
$route = route('studio.catalog.product.audit', [$value['id'], $value['product_id']]);
|
$route = route('studio.catalog.product.audit', [$value['id'], $value['product_id']]);
|
||||||
|
$canAudit = auth()->user()->can('audit product');
|
||||||
|
|
||||||
return Blade::render('
|
$tag = $canAudit ? 'div' : 'a';
|
||||||
<a href="{{ $route }}" wire:navigate
|
$attrs = $canAudit ? '' : 'href="'.$route.'" wire:navigate';
|
||||||
class="flex items-center space-x-2 bg-gray-50 border border-gray-200 rounded-lg px-2 py-1 text-xs hover:bg-gray-100 transition">
|
|
||||||
<span class="font-medium text-gray-700">{{ $value["name"] }}</span>
|
return Blade::render("
|
||||||
<span class="text-[10px] text-white bg-emerald-500 rounded px-1.5 py-0.5">{{ $value["stock"] }}</span>
|
<{$tag} {$attrs}
|
||||||
</a>', [
|
class='flex items-center space-x-2 bg-gray-50 border border-gray-200 rounded-lg px-2 py-1 text-xs hover:bg-gray-100 transition'>
|
||||||
|
<span class='font-medium text-gray-700'>{{ \$value['name'] }}</span>
|
||||||
|
<span class='text-[10px] text-white bg-emerald-500 rounded px-1.5 py-0.5'>{{ \$value['stock'] }}</span>
|
||||||
|
</{$tag}>
|
||||||
|
", [
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'route' => $route,
|
'route' => $route,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -215,14 +215,17 @@ public function run(): void
|
|||||||
'create perfume',
|
'create perfume',
|
||||||
'update perfume',
|
'update perfume',
|
||||||
'delete perfume',
|
'delete perfume',
|
||||||
|
'audit perfume',
|
||||||
|
|
||||||
'create product',
|
'create product',
|
||||||
'update product',
|
'update product',
|
||||||
'delete product',
|
'delete product',
|
||||||
|
'audit product',
|
||||||
|
|
||||||
'create bottle',
|
'create bottle',
|
||||||
'update bottle',
|
'update bottle',
|
||||||
'delete bottle',
|
'delete bottle',
|
||||||
|
'audit bottle',
|
||||||
|
|
||||||
'view payroll',
|
'view payroll',
|
||||||
'manage adjustment',
|
'manage adjustment',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user