사용하지 않는 파일 정리 전 백업 (Phase 10 완료 후 상태)

This commit is contained in:
JiWoong Sul
2025-08-29 15:11:59 +09:00
parent a740ff10c8
commit d916b281a7
333 changed files with 53617 additions and 22574 deletions

View File

@@ -0,0 +1,310 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import '../../../screens/equipment/controllers/equipment_history_controller.dart';
class InventoryFilterBar extends StatefulWidget {
const InventoryFilterBar({super.key});
@override
State<InventoryFilterBar> createState() => _InventoryFilterBarState();
}
class _InventoryFilterBarState extends State<InventoryFilterBar> {
String? _transactionType;
int? _warehouseId;
int? _equipmentId;
DateTime? _startDate;
DateTime? _endDate;
void _applyFilters() {
final controller = context.read<EquipmentHistoryController>();
controller.setFilters(
transactionType: _transactionType,
warehouseId: _warehouseId,
equipmentId: _equipmentId,
startDate: _startDate,
endDate: _endDate,
);
controller.loadHistory();
}
void _clearFilters() {
setState(() {
_transactionType = null;
_warehouseId = null;
_equipmentId = null;
_startDate = null;
_endDate = null;
});
final controller = context.read<EquipmentHistoryController>();
controller.clearFilters();
controller.loadHistory();
}
@override
Widget build(BuildContext context) {
final theme = ShadTheme.of(context);
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: theme.colorScheme.card,
border: Border(
bottom: BorderSide(
color: theme.colorScheme.border,
width: 1,
),
),
),
child: Column(
children: [
Row(
children: [
// 거래 유형 필터
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'거래 유형',
style: theme.textTheme.small.copyWith(
color: theme.colorScheme.mutedForeground,
),
),
const SizedBox(height: 4),
ShadSelect<String>(
placeholder: const Text('전체'),
options: const [
ShadOption(value: 'IN', child: Text('입고')),
ShadOption(value: 'OUT', child: Text('출고')),
ShadOption(value: 'TRANSFER', child: Text('이동')),
ShadOption(value: 'ADJUSTMENT', child: Text('조정')),
],
selectedOptionBuilder: (context, value) {
switch (value) {
case 'IN':
return const Text('입고');
case 'OUT':
return const Text('출고');
case 'TRANSFER':
return const Text('이동');
case 'ADJUSTMENT':
return const Text('조정');
default:
return const Text('');
}
},
onChanged: (value) {
setState(() {
_transactionType = value;
});
},
),
],
),
),
const SizedBox(width: 16),
// 창고 필터
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'창고',
style: theme.textTheme.small.copyWith(
color: theme.colorScheme.mutedForeground,
),
),
const SizedBox(height: 4),
ShadSelect<int>(
placeholder: const Text('전체'),
options: const [
ShadOption(value: 1, child: Text('본사 창고')),
ShadOption(value: 2, child: Text('지사 창고')),
ShadOption(value: 3, child: Text('외부 창고')),
],
selectedOptionBuilder: (context, value) {
switch (value) {
case 1:
return const Text('본사 창고');
case 2:
return const Text('지사 창고');
case 3:
return const Text('외부 창고');
default:
return const Text('');
}
},
onChanged: (value) {
setState(() {
_warehouseId = value;
});
},
),
],
),
),
const SizedBox(width: 16),
// 시작일
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'시작일',
style: theme.textTheme.small.copyWith(
color: theme.colorScheme.mutedForeground,
),
),
const SizedBox(height: 4),
InkWell(
onTap: () async {
final picked = await showDatePicker(
context: context,
initialDate: _startDate ?? DateTime.now(),
firstDate: DateTime(2020),
lastDate: DateTime.now(),
);
if (picked != null) {
setState(() {
_startDate = picked;
});
}
},
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: BoxDecoration(
border: Border.all(color: theme.colorScheme.border),
borderRadius: BorderRadius.circular(6),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
_startDate != null
? '${_startDate!.year}-${_startDate!.month.toString().padLeft(2, '0')}-${_startDate!.day.toString().padLeft(2, '0')}'
: '선택',
style: theme.textTheme.small,
),
Icon(
Icons.calendar_today,
size: 14,
color: theme.colorScheme.mutedForeground,
),
],
),
),
),
],
),
),
const SizedBox(width: 16),
// 종료일
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'종료일',
style: theme.textTheme.small.copyWith(
color: theme.colorScheme.mutedForeground,
),
),
const SizedBox(height: 4),
InkWell(
onTap: () async {
final picked = await showDatePicker(
context: context,
initialDate: _endDate ?? DateTime.now(),
firstDate: DateTime(2020),
lastDate: DateTime.now(),
);
if (picked != null) {
setState(() {
_endDate = picked;
});
}
},
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: BoxDecoration(
border: Border.all(color: theme.colorScheme.border),
borderRadius: BorderRadius.circular(6),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
_endDate != null
? '${_endDate!.year}-${_endDate!.month.toString().padLeft(2, '0')}-${_endDate!.day.toString().padLeft(2, '0')}'
: '선택',
style: theme.textTheme.small,
),
Icon(
Icons.calendar_today,
size: 14,
color: theme.colorScheme.mutedForeground,
),
],
),
),
),
],
),
),
const SizedBox(width: 16),
// 버튼
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'',
style: theme.textTheme.small,
),
const SizedBox(height: 4),
Row(
children: [
ShadButton(
size: ShadButtonSize.sm,
onPressed: _applyFilters,
child: const Text('적용'),
),
const SizedBox(width: 8),
ShadButton.outline(
size: ShadButtonSize.sm,
onPressed: _clearFilters,
child: const Text('초기화'),
),
],
),
],
),
],
),
// 검색창
const SizedBox(height: 16),
Consumer<EquipmentHistoryController>(
builder: (context, controller, _) {
return ShadInput(
placeholder: const Text('장비명, 시리얼 번호로 검색'),
onChanged: (value) {
controller.setSearchQuery(value);
if (value.isEmpty || value.length >= 2) {
controller.loadHistory();
}
},
);
},
),
],
),
);
}
}

View File

@@ -0,0 +1,140 @@
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
class StockLevelIndicator extends StatelessWidget {
final int current;
final int maximum;
final int? minimum;
final bool showLabels;
const StockLevelIndicator({
super.key,
required this.current,
required this.maximum,
this.minimum,
this.showLabels = false,
});
Color _getColor(double percentage) {
if (percentage <= 0.2) {
return Colors.red;
} else if (percentage <= 0.4) {
return Colors.orange;
} else if (percentage <= 0.6) {
return Colors.yellow[700]!;
} else if (percentage <= 0.8) {
return Colors.blue;
} else {
return Colors.green;
}
}
String _getLabel(double percentage) {
if (percentage <= 0.2) {
return '매우 낮음';
} else if (percentage <= 0.4) {
return '낮음';
} else if (percentage <= 0.6) {
return '보통';
} else if (percentage <= 0.8) {
return '충분';
} else {
return '매우 충분';
}
}
@override
Widget build(BuildContext context) {
final theme = ShadTheme.of(context);
final percentage = maximum > 0 ? (current / maximum).clamp(0.0, 1.0) : 0.0;
final color = _getColor(percentage);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (showLabels)
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
_getLabel(percentage),
style: theme.textTheme.small.copyWith(
color: color,
fontWeight: FontWeight.w600,
),
),
Text(
'${(percentage * 100).toStringAsFixed(0)}%',
style: theme.textTheme.small.copyWith(
color: theme.colorScheme.mutedForeground,
),
),
],
),
if (showLabels) const SizedBox(height: 4),
Container(
height: 8,
decoration: BoxDecoration(
color: theme.colorScheme.muted,
borderRadius: BorderRadius.circular(4),
),
child: Stack(
children: [
// 최소 재고 표시
if (minimum != null && maximum > 0)
Positioned(
left: (minimum! / maximum * MediaQuery.of(context).size.width).clamp(0.0, double.infinity),
top: 0,
bottom: 0,
child: Container(
width: 2,
color: Colors.grey[600],
),
),
// 현재 재고 표시
AnimatedContainer(
duration: const Duration(milliseconds: 300),
width: percentage * MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(4),
),
),
],
),
),
if (showLabels && minimum != null) ...[
const SizedBox(height: 4),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'최소: $minimum',
style: theme.textTheme.small.copyWith(
color: theme.colorScheme.mutedForeground,
fontSize: 10,
),
),
Text(
'현재: $current',
style: theme.textTheme.small.copyWith(
color: theme.colorScheme.foreground,
fontSize: 10,
fontWeight: FontWeight.w600,
),
),
Text(
'최대: $maximum',
style: theme.textTheme.small.copyWith(
color: theme.colorScheme.mutedForeground,
fontSize: 10,
),
),
],
),
],
],
);
}
}

View File

@@ -0,0 +1,147 @@
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
class TransactionTypeBadge extends StatelessWidget {
final String type;
const TransactionTypeBadge({
super.key,
required this.type,
});
@override
Widget build(BuildContext context) {
switch (type.toUpperCase()) {
case 'IN':
return ShadBadge(
backgroundColor: Colors.green.withValues(alpha: 0.1),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.arrow_downward,
size: 12,
color: Colors.green[700],
),
const SizedBox(width: 4),
Text(
'입고',
style: TextStyle(
color: Colors.green[700],
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
],
),
);
case 'OUT':
return ShadBadge(
backgroundColor: Colors.red.withValues(alpha: 0.1),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.arrow_upward,
size: 12,
color: Colors.red[700],
),
const SizedBox(width: 4),
Text(
'출고',
style: TextStyle(
color: Colors.red[700],
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
],
),
);
case 'TRANSFER':
return ShadBadge(
backgroundColor: Colors.blue.withValues(alpha: 0.1),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.swap_horiz,
size: 12,
color: Colors.blue[700],
),
const SizedBox(width: 4),
Text(
'이동',
style: TextStyle(
color: Colors.blue[700],
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
],
),
);
case 'ADJUSTMENT':
return ShadBadge(
backgroundColor: Colors.orange.withValues(alpha: 0.1),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.tune,
size: 12,
color: Colors.orange[700],
),
const SizedBox(width: 4),
Text(
'조정',
style: TextStyle(
color: Colors.orange[700],
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
],
),
);
case 'RETURN':
return ShadBadge(
backgroundColor: Colors.purple.withValues(alpha: 0.1),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.undo,
size: 12,
color: Colors.purple[700],
),
const SizedBox(width: 4),
Text(
'반품',
style: TextStyle(
color: Colors.purple[700],
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
],
),
);
default:
return ShadBadge.secondary(
child: Text(
type,
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
);
}
}
}