style: refine layout and formatting in Index.vue for improved readability and consistency
This commit is contained in:
parent
7d39f85da7
commit
21adde11fd
15
BEST_PRACTICE.md
Normal file
15
BEST_PRACTICE.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Best Practices
|
||||
|
||||
## PHP
|
||||
|
||||
### Traits
|
||||
- Gabungkan multiple `use` trait menjadi satu baris dengan koma.
|
||||
- **Hindari:**
|
||||
```php
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
```
|
||||
- **Gunakan:**
|
||||
```php
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
```
|
||||
@ -17,8 +17,7 @@
|
||||
|
||||
class CashController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly CashService $cashService,
|
||||
|
||||
@ -17,8 +17,7 @@
|
||||
|
||||
class EmployeeAdvanceController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly EmployeeAdvanceService $employeeAdvanceService,
|
||||
|
||||
@ -15,8 +15,7 @@
|
||||
|
||||
class ExpenseController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly ExpenseService $expenseService,
|
||||
|
||||
@ -13,8 +13,7 @@
|
||||
|
||||
class PayrollPeriodController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly PayrollService $payrollService,
|
||||
|
||||
@ -18,8 +18,7 @@
|
||||
|
||||
class EmployeeController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly EmployeeService $employeeService,
|
||||
|
||||
@ -18,8 +18,7 @@
|
||||
|
||||
class LeaveRequestController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly LeaveRequestService $leaveRequestService,
|
||||
|
||||
@ -17,8 +17,7 @@
|
||||
|
||||
class CuttingController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly CuttingService $cuttingService,
|
||||
|
||||
@ -19,8 +19,7 @@
|
||||
|
||||
class OrderController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly OrderService $orderService,
|
||||
|
||||
@ -15,8 +15,7 @@
|
||||
|
||||
class PurchaseController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly PurchaseService $purchaseService,
|
||||
|
||||
@ -15,8 +15,7 @@
|
||||
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage,ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly CategoryService $categoryService,
|
||||
|
||||
@ -16,8 +16,7 @@
|
||||
|
||||
class CustomerController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly CustomerService $customerService,
|
||||
|
||||
@ -21,8 +21,7 @@
|
||||
|
||||
class ProductController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly CuttingService $cuttingService,
|
||||
|
||||
@ -18,8 +18,7 @@
|
||||
|
||||
class RawMaterialController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly RawMaterialService $rawMaterialService,
|
||||
|
||||
@ -15,8 +15,7 @@
|
||||
|
||||
class SupplierController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly SupplierService $supplierService,
|
||||
|
||||
@ -17,8 +17,7 @@
|
||||
|
||||
class RoleController extends Controller
|
||||
{
|
||||
use FlashesEntityMessage;
|
||||
use ParsesDataTableQuery;
|
||||
use FlashesEntityMessage, ParsesDataTableQuery;
|
||||
|
||||
public function __construct(
|
||||
private readonly RoleService $roleService,
|
||||
|
||||
@ -26,9 +26,7 @@
|
||||
])]
|
||||
class Attendance extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory;
|
||||
use HasModuleMedia;
|
||||
use InteractsWithActivityLog;
|
||||
use HasFactory, HasModuleMedia, InteractsWithActivityLog;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -14,8 +14,7 @@
|
||||
#[Appends(['balance_formatted'])]
|
||||
class CashAccount extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use HasFactory, InteractsWithActivityLog;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -26,10 +26,7 @@
|
||||
])]
|
||||
class CashTransaction extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory;
|
||||
use HasModuleMedia;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, HasModuleMedia, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -14,9 +14,7 @@
|
||||
#[Sluggable(from: 'name', to: 'slug')]
|
||||
class Category extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
public function products(): BelongsToMany
|
||||
{
|
||||
|
||||
@ -12,9 +12,7 @@
|
||||
#[Guarded(['id'])]
|
||||
class Customer extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
public function orders(): HasMany
|
||||
{
|
||||
|
||||
@ -21,10 +21,7 @@
|
||||
])]
|
||||
class Cutting extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasRejection;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, HasRejection, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -26,9 +26,7 @@
|
||||
])]
|
||||
class CuttingMaterial extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -12,9 +12,7 @@
|
||||
#[Guarded(['id'])]
|
||||
class CuttingResult extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -15,8 +15,7 @@
|
||||
#[Appends(['price_formatted', 'cost_per_unit_formatted', 'type_label'])]
|
||||
class CuttingResultPrice extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use HasFactory, InteractsWithActivityLog;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -20,9 +20,7 @@
|
||||
#[Appends(['base_salary_formatted', 'join_date_formatted', 'resign_date_formatted', 'join_date_input', 'employment_status_label'])]
|
||||
class Employee extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -27,9 +27,7 @@
|
||||
])]
|
||||
class EmployeeAdvance extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasRejection;
|
||||
use InteractsWithActivityLog;
|
||||
use HasFactory, HasRejection, InteractsWithActivityLog;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -17,10 +17,7 @@
|
||||
#[Appends(['amount_formatted', 'created_at_formatted', 'created_by_name'])]
|
||||
class Expense extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory;
|
||||
use HasModuleMedia;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, HasModuleMedia, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -12,9 +12,7 @@
|
||||
#[Guarded(['id'])]
|
||||
class HomepageConfiguration extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory;
|
||||
use HasModuleMedia;
|
||||
use InteractsWithActivityLog;
|
||||
use HasFactory, HasModuleMedia, InteractsWithActivityLog;
|
||||
|
||||
public static function mediaModuleName(): string
|
||||
{
|
||||
|
||||
@ -27,9 +27,7 @@
|
||||
])]
|
||||
class LeaveRequest extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasRejection;
|
||||
use InteractsWithActivityLog;
|
||||
use HasFactory, HasRejection, InteractsWithActivityLog;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -30,9 +30,7 @@
|
||||
])]
|
||||
class Order extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -21,9 +21,7 @@
|
||||
])]
|
||||
class OrderItem extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -27,8 +27,7 @@
|
||||
])]
|
||||
class Payroll extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use HasFactory, InteractsWithActivityLog;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -15,8 +15,7 @@
|
||||
#[Appends(['amount_formatted', 'type_label', 'created_at_formatted', 'created_by_name'])]
|
||||
class PayrollAdjustment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use HasFactory, InteractsWithActivityLog;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
@ -17,8 +17,7 @@
|
||||
#[Appends(['period_label', 'status_label', 'closed_at_formatted'])]
|
||||
class PayrollPeriod extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use HasFactory, InteractsWithActivityLog;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -28,10 +28,7 @@
|
||||
])]
|
||||
class Product extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasRejection;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, HasRejection, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -15,10 +15,7 @@
|
||||
#[Guarded(['id'])]
|
||||
class ProductVariant extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory;
|
||||
use HasModuleMedia;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, HasModuleMedia, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
private const MIN_STOCK = 5;
|
||||
|
||||
|
||||
@ -24,10 +24,7 @@
|
||||
])]
|
||||
class Purchase extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory;
|
||||
use HasModuleMedia;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, HasModuleMedia, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -21,9 +21,7 @@
|
||||
])]
|
||||
class PurchaseItem extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -18,9 +18,7 @@
|
||||
#[Appends(['unit_label', 'unit_abbreviation'])]
|
||||
class RawMaterial extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -18,10 +18,7 @@
|
||||
#[Appends(['price_formatted', 'stock_formatted', 'price_input', 'stock_input'])]
|
||||
class RawMaterialPrice extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory;
|
||||
use HasModuleMedia;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, HasModuleMedia, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -12,8 +12,7 @@
|
||||
#[Guarded(['id'])]
|
||||
class Rejection extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use HasFactory, InteractsWithActivityLog;
|
||||
|
||||
public function rejectable(): MorphTo
|
||||
{
|
||||
|
||||
@ -12,9 +12,7 @@
|
||||
#[Guarded(['id'])]
|
||||
class Supplier extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
public function purchases(): HasMany
|
||||
{
|
||||
|
||||
@ -12,9 +12,7 @@
|
||||
#[Guarded(['id'])]
|
||||
class SystemConfiguration extends Model implements HasMedia
|
||||
{
|
||||
use HasFactory;
|
||||
use HasModuleMedia;
|
||||
use InteractsWithActivityLog;
|
||||
use HasFactory, HasModuleMedia, InteractsWithActivityLog;
|
||||
|
||||
public static function mediaModuleName(): string
|
||||
{
|
||||
|
||||
@ -24,12 +24,7 @@
|
||||
#[Appends(['role_label'])]
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use CausesActivity;
|
||||
use HasFactory;
|
||||
use HasRoles;
|
||||
use InteractsWithActivityLog;
|
||||
use Notifiable;
|
||||
use SoftDeletes;
|
||||
use CausesActivity, HasFactory, HasRoles, InteractsWithActivityLog, Notifiable, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -17,9 +17,7 @@
|
||||
#[Appends(['birth_date_formatted', 'birth_date_input', 'gender_label'])]
|
||||
class UserProfile extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use InteractsWithActivityLog;
|
||||
use SoftDeletes;
|
||||
use HasFactory, InteractsWithActivityLog, SoftDeletes;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
|
||||
@ -66,7 +66,7 @@ const tablePagination = computed(() => ({
|
||||
const firstItem = computed(() =>
|
||||
props.rawMaterials.data.length > 0
|
||||
? (props.rawMaterials.current_page - 1) * props.rawMaterials.per_page +
|
||||
1
|
||||
1
|
||||
: 0,
|
||||
);
|
||||
|
||||
@ -83,21 +83,16 @@ watch(
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<Head title="Bahan Baku" />
|
||||
|
||||
<AdminLayout>
|
||||
<div
|
||||
class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between"
|
||||
>
|
||||
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div class="space-y-1">
|
||||
<h2 class="text-2xl font-bold tracking-tight">Bahan Baku</h2>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
v-if="can('raw-materials.create')"
|
||||
as-child
|
||||
class="shrink-0 self-start sm:self-center"
|
||||
>
|
||||
<Button v-if="can('raw-materials.create')" as-child class="shrink-0 self-start sm:self-center">
|
||||
<Link href="/admin/master/raw-materials/create">
|
||||
<Plus class="size-4" />
|
||||
Tambah
|
||||
@ -105,34 +100,17 @@ watch(
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<MasterOutOfStockCatalogSection
|
||||
severity="warning"
|
||||
title="Bahan Baku Stok Menipis"
|
||||
description="Stok masih ada, tapi di bawah batas minimum satuan · Klik kartu untuk melihat data."
|
||||
empty-title="Tidak ada peringatan stok"
|
||||
empty-description="Semua varian masih berada di atas batas stok minimum."
|
||||
:groups="stockWarningGroups"
|
||||
/>
|
||||
<MasterOutOfStockCatalogSection severity="warning" title="Stok Menipis" empty-title="Tidak ada peringatan stok"
|
||||
empty-description="Stok bahan baku dibawah 5 pcs." :groups="stockWarningGroups" />
|
||||
|
||||
<MasterOutOfStockCatalogSection
|
||||
title="Bahan Baku Stok Habis"
|
||||
description="Klik kartu untuk melihat data."
|
||||
:groups="outOfStockGroups"
|
||||
/>
|
||||
<MasterOutOfStockCatalogSection title="Stok Habis" empty-title="Tidak ada stok habis"
|
||||
empty-description="Stok bahan baku dibawah 0 pcs." :groups="outOfStockGroups" />
|
||||
|
||||
<Card class="min-w-0">
|
||||
<CardContent class="min-w-0">
|
||||
<RawMaterialGroupedTable
|
||||
v-model:search="search"
|
||||
:materials="rawMaterials.data"
|
||||
:first-item="firstItem"
|
||||
:pagination="tablePagination"
|
||||
:pagination-links="rawMaterials.links"
|
||||
:filter-defs="filterDefs"
|
||||
:filter-values="filterValues"
|
||||
@filter-change="setFilter"
|
||||
@filters-reset="resetFilters"
|
||||
/>
|
||||
<RawMaterialGroupedTable v-model:search="search" :materials="rawMaterials.data" :first-item="firstItem"
|
||||
:pagination="tablePagination" :pagination-links="rawMaterials.links" :filter-defs="filterDefs"
|
||||
:filter-values="filterValues" @filter-change="setFilter" @filters-reset="resetFilters" />
|
||||
</CardContent>
|
||||
</Card>
|
||||
</AdminLayout>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user