diff --git a/app/Models/StockLog.php b/app/Models/StockLog.php index cf38307..f2c88fe 100644 --- a/app/Models/StockLog.php +++ b/app/Models/StockLog.php @@ -26,4 +26,14 @@ class StockLog extends Model { return $this->belongsTo(Product::class); } + + public function getChangeTypeLabelAttribute(): string + { + return $this->change_type === 'in' ? '입고' : '출고'; + } + + public function getSignedAmountAttribute(): int + { + return $this->change_type === 'in' ? (int) $this->change_amount : -(int) $this->change_amount; + } } diff --git a/resources/views/product/list.blade.php b/resources/views/product/list.blade.php index 4e9ab21..1a133aa 100644 --- a/resources/views/product/list.blade.php +++ b/resources/views/product/list.blade.php @@ -51,7 +51,7 @@ {{ $product->id }} {{ $product->name }} {{ $product->sku }} - {{ number_format($product->quantity) }} 개 + {{ number_format($product->quantity) }} {{ number_format($product->price) }} 원
diff --git a/resources/views/stock_log/list.blade.php b/resources/views/stock_log/list.blade.php index 5af0f18..4d785be 100644 --- a/resources/views/stock_log/list.blade.php +++ b/resources/views/stock_log/list.blade.php @@ -22,8 +22,8 @@ {{ $log->created_at->format('Y-m-d H:i') }} {{ ($log->product?->name ?? '삭제된 상품') }} ({{ $log->product?->sku ?? '-'}}) - {{ $log->change_type }} - {{ $log->change_amount }} 개 + {{ $log->change_type_label }} + {{ $log->signed_amount }} @endforeach