사용하지 않는 파일 정리 전 백업 (Phase 10 완료 후 상태)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:superport/models/warehouse_location_model.dart';
|
||||
import 'package:superport/models/address_model.dart';
|
||||
import 'package:superport/services/warehouse_service.dart';
|
||||
|
||||
/// 입고지 폼 상태 및 저장/수정 로직을 담당하는 컨트롤러
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:superport/models/warehouse_location_model.dart';
|
||||
import 'package:superport/services/warehouse_service.dart';
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import 'package:superport/screens/common/widgets/remark_input.dart';
|
||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||
import 'package:superport/screens/common/templates/form_layout_template.dart';
|
||||
import 'controllers/warehouse_location_form_controller.dart';
|
||||
import 'package:superport/utils/formatters/korean_phone_formatter.dart';
|
||||
|
||||
/// 입고지 추가/수정 폼 화면 (SRP 적용, 상태/로직 분리)
|
||||
class WarehouseLocationFormScreen extends StatefulWidget {
|
||||
final int? id; // 수정 모드 지원을 위한 id 파라미터
|
||||
const WarehouseLocationFormScreen({Key? key, this.id}) : super(key: key);
|
||||
const WarehouseLocationFormScreen({super.key, this.id});
|
||||
|
||||
@override
|
||||
State<WarehouseLocationFormScreen> createState() =>
|
||||
@@ -46,10 +47,10 @@ class _WarehouseLocationFormScreenState
|
||||
if (success) {
|
||||
// 성공 메시지 표시
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(_controller.isEditMode ? '입고지가 수정되었습니다' : '입고지가 추가되었습니다'),
|
||||
backgroundColor: ShadcnTheme.success,
|
||||
ShadToaster.of(context).show(
|
||||
ShadToast(
|
||||
title: const Text('성공'),
|
||||
description: Text(_controller.isEditMode ? '입고지가 수정되었습니다' : '입고지가 추가되었습니다'),
|
||||
),
|
||||
);
|
||||
// 리스트 화면으로 돌아가기
|
||||
@@ -58,10 +59,10 @@ class _WarehouseLocationFormScreenState
|
||||
} else {
|
||||
// 실패 메시지 표시
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(_controller.error ?? '저장에 실패했습니다'),
|
||||
backgroundColor: ShadcnTheme.error,
|
||||
ShadToaster.of(context).show(
|
||||
ShadToast.destructive(
|
||||
title: const Text('오류'),
|
||||
description: Text(_controller.error ?? '저장에 실패했습니다'),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -87,14 +88,11 @@ class _WarehouseLocationFormScreenState
|
||||
FormFieldWrapper(
|
||||
label: '창고명',
|
||||
required: true,
|
||||
child: TextFormField(
|
||||
child: ShadInputFormField(
|
||||
controller: _controller.nameController,
|
||||
decoration: const InputDecoration(
|
||||
hintText: '창고명을 입력하세요',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
placeholder: const Text('창고명을 입력하세요'),
|
||||
validator: (value) {
|
||||
if (value == null || value.trim().isEmpty) {
|
||||
if (value.trim().isEmpty) {
|
||||
return '창고명을 입력하세요';
|
||||
}
|
||||
return null;
|
||||
@@ -104,49 +102,39 @@ class _WarehouseLocationFormScreenState
|
||||
// 주소 입력 (단일 필드)
|
||||
FormFieldWrapper(
|
||||
label: '주소',
|
||||
child: TextFormField(
|
||||
child: ShadInputFormField(
|
||||
controller: _controller.addressController,
|
||||
decoration: const InputDecoration(
|
||||
hintText: '주소를 입력하세요 (예: 경기도 용인시 기흥구 동백로 123)',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
placeholder: const Text('주소를 입력하세요 (예: 경기도 용인시 기흥구 동백로 123)'),
|
||||
maxLines: 3,
|
||||
),
|
||||
),
|
||||
// 담당자명 입력
|
||||
FormFieldWrapper(
|
||||
label: '담당자명',
|
||||
child: TextFormField(
|
||||
child: ShadInputFormField(
|
||||
controller: _controller.managerNameController,
|
||||
decoration: const InputDecoration(
|
||||
hintText: '담당자명을 입력하세요',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
placeholder: const Text('담당자명을 입력하세요'),
|
||||
),
|
||||
),
|
||||
// 담당자 연락처 입력
|
||||
FormFieldWrapper(
|
||||
label: '담당자 연락처',
|
||||
child: TextFormField(
|
||||
child: ShadInputFormField(
|
||||
controller: _controller.managerPhoneController,
|
||||
decoration: const InputDecoration(
|
||||
hintText: '연락처를 입력하세요 (예: 02-1234-5678)',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
placeholder: const Text('010-1234-5678'),
|
||||
keyboardType: TextInputType.phone,
|
||||
validator: _controller.validatePhoneNumber,
|
||||
inputFormatters: [
|
||||
KoreanPhoneFormatter(), // 한국식 전화번호 자동 포맷팅
|
||||
],
|
||||
validator: (value) => PhoneValidator.validate(value),
|
||||
),
|
||||
),
|
||||
// 수용량 입력
|
||||
FormFieldWrapper(
|
||||
label: '수용량',
|
||||
child: TextFormField(
|
||||
child: ShadInputFormField(
|
||||
controller: _controller.capacityController,
|
||||
decoration: const InputDecoration(
|
||||
hintText: '수용량을 입력하세요 (개)',
|
||||
border: OutlineInputBorder(),
|
||||
suffixText: '개',
|
||||
),
|
||||
placeholder: const Text('수용량을 입력하세요 (개)'),
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import 'package:superport/models/warehouse_location_model.dart';
|
||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||
import 'package:superport/screens/common/components/shadcn_components.dart';
|
||||
import 'package:superport/screens/common/widgets/pagination.dart';
|
||||
import 'package:superport/screens/common/widgets/unified_search_bar.dart';
|
||||
import 'package:superport/screens/common/widgets/standard_data_table.dart' as std_table;
|
||||
import 'package:superport/screens/common/widgets/standard_action_bar.dart';
|
||||
import 'package:superport/screens/common/widgets/standard_states.dart';
|
||||
import 'package:superport/screens/common/layouts/base_list_screen.dart';
|
||||
@@ -17,7 +17,7 @@ import 'package:superport/core/widgets/auth_guard.dart';
|
||||
|
||||
/// shadcn/ui 스타일로 재설계된 창고 관리 화면
|
||||
class WarehouseLocationList extends StatefulWidget {
|
||||
const WarehouseLocationList({Key? key}) : super(key: key);
|
||||
const WarehouseLocationList({super.key});
|
||||
|
||||
@override
|
||||
State<WarehouseLocationList> createState() =>
|
||||
@@ -87,18 +87,18 @@ class _WarehouseLocationListState
|
||||
|
||||
/// 삭제 다이얼로그
|
||||
void _showDeleteDialog(int id) {
|
||||
showDialog(
|
||||
showShadDialog(
|
||||
context: context,
|
||||
builder:
|
||||
(context) => AlertDialog(
|
||||
(context) => ShadDialog(
|
||||
title: const Text('창고 삭제'),
|
||||
content: const Text('정말로 삭제하시겠습니까?'),
|
||||
description: const Text('정말로 삭제하시겠습니까?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
ShadButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('취소'),
|
||||
),
|
||||
TextButton(
|
||||
ShadButton.destructive(
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
await _controller.deleteWarehouseLocation(id);
|
||||
@@ -166,12 +166,13 @@ class _WarehouseLocationListState
|
||||
if (_isAdmin)
|
||||
Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
ShadCheckbox(
|
||||
value: controller.includeInactive,
|
||||
onChanged: (_) => setState(() {
|
||||
controller.toggleIncludeInactive();
|
||||
}),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Text('비활성 포함'),
|
||||
],
|
||||
),
|
||||
@@ -363,13 +364,13 @@ class _WarehouseLocationListState
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: location.isActive
|
||||
? ShadcnTheme.success.withOpacity(0.1)
|
||||
: ShadcnTheme.muted.withOpacity(0.1),
|
||||
? ShadcnTheme.success.withValues(alpha: 0.1)
|
||||
: ShadcnTheme.muted.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: location.isActive
|
||||
? ShadcnTheme.success.withOpacity(0.3)
|
||||
: ShadcnTheme.muted.withOpacity(0.3)
|
||||
? ShadcnTheme.success.withValues(alpha: 0.3)
|
||||
: ShadcnTheme.muted.withValues(alpha: 0.3)
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
@@ -439,7 +440,7 @@ class _WarehouseLocationListState
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user