사용하지 않는 파일 정리 전 백업 (Phase 10 완료 후 상태)
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import 'package:superport/models/equipment_unified_model.dart';
|
||||
import 'package:superport/models/company_model.dart';
|
||||
import 'package:superport/models/company_branch_info.dart';
|
||||
import 'package:superport/models/address_model.dart';
|
||||
import 'package:superport/screens/common/custom_widgets.dart';
|
||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||
import 'package:superport/screens/equipment/controllers/equipment_out_form_controller.dart';
|
||||
import 'package:superport/screens/equipment/widgets/equipment_summary_card.dart';
|
||||
import 'package:superport/screens/equipment/widgets/equipment_summary_row.dart';
|
||||
import 'package:superport/screens/common/widgets/remark_input.dart';
|
||||
|
||||
class EquipmentOutFormScreen extends StatefulWidget {
|
||||
@@ -19,12 +17,12 @@ class EquipmentOutFormScreen extends StatefulWidget {
|
||||
final List<Map<String, dynamic>>? selectedEquipments;
|
||||
|
||||
const EquipmentOutFormScreen({
|
||||
Key? key,
|
||||
super.key,
|
||||
this.equipmentOutId,
|
||||
this.selectedEquipment,
|
||||
this.selectedEquipmentInId,
|
||||
this.selectedEquipments,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
State<EquipmentOutFormScreen> createState() => _EquipmentOutFormScreenState();
|
||||
@@ -68,11 +66,9 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
}
|
||||
|
||||
// 각 장비별로 전체 폭을 사용하는 리스트로 구현
|
||||
return Container(
|
||||
return SizedBox(
|
||||
width: double.infinity, // 전체 폭 사용
|
||||
child: Card(
|
||||
elevation: 2,
|
||||
margin: EdgeInsets.zero, // margin 제거
|
||||
child: ShadCard(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -157,7 +153,7 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
);
|
||||
if (picked != null) {
|
||||
equipment.warrantyStartDate = picked;
|
||||
controller.notifyListeners();
|
||||
// controller.notifyListeners() 호출 불필요 - 데이터 변경 시 자동 알림
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
@@ -192,7 +188,7 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
);
|
||||
if (picked != null) {
|
||||
equipment.warrantyEndDate = picked;
|
||||
controller.notifyListeners();
|
||||
// controller.notifyListeners() 호출 불필요 - 데이터 변경 시 자동 알림
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
@@ -254,7 +250,7 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
title: const Text('장비 출고'),
|
||||
),
|
||||
body: const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
child: ShadProgress(),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -286,7 +282,7 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
ElevatedButton(
|
||||
ShadButton(
|
||||
onPressed: () {
|
||||
controller.clearError();
|
||||
controller.loadDropdownData();
|
||||
@@ -305,7 +301,7 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
controller.isEditMode
|
||||
? '장비 출고 수정'
|
||||
: totalSelectedEquipments > 0
|
||||
? '장비 출고 등록 (${totalSelectedEquipments}개)'
|
||||
? '장비 출고 등록 ($totalSelectedEquipments개)'
|
||||
: '장비 출고 등록',
|
||||
),
|
||||
),
|
||||
@@ -323,7 +319,7 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
_buildSummaryTable(controller)
|
||||
else if (controller.selectedEquipment != null)
|
||||
// 단일 장비 요약 카드도 전체 폭으로 맞춤
|
||||
Container(
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: EquipmentSingleSummaryCard(
|
||||
equipment: controller.selectedEquipment!,
|
||||
@@ -334,7 +330,7 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
// 요약 카드 아래 라디오 버튼 추가
|
||||
const SizedBox(height: 12),
|
||||
// 전체 폭을 사용하는 라디오 버튼
|
||||
Container(width: double.infinity, child: _buildOutTypeRadio(controller)),
|
||||
SizedBox(width: double.infinity, child: _buildOutTypeRadio(controller)),
|
||||
const SizedBox(height: 16),
|
||||
// 출고 정보 입력 섹션 (수정/등록)
|
||||
_buildOutgoingInfoSection(context, controller),
|
||||
@@ -380,7 +376,7 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
// 저장 버튼
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
child: ShadButton(
|
||||
onPressed:
|
||||
canSubmit
|
||||
? () {
|
||||
@@ -408,10 +404,10 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
|
||||
controller.saveEquipmentOut(context).then((success) {
|
||||
if (success) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('출고가 완료되었습니다.'),
|
||||
duration: Duration(seconds: 2),
|
||||
ShadToaster.of(context).show(
|
||||
ShadToast(
|
||||
title: const Text('출고 완료'),
|
||||
description: const Text('출고가 완료되었습니다.'),
|
||||
),
|
||||
);
|
||||
Navigator.pop(context, true);
|
||||
@@ -419,22 +415,8 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
});
|
||||
}
|
||||
: null,
|
||||
style:
|
||||
canSubmit
|
||||
? ElevatedButton.styleFrom(
|
||||
backgroundColor: ShadcnTheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
)
|
||||
: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.grey.shade300,
|
||||
foregroundColor: Colors.grey.shade700,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Text(
|
||||
controller.isEditMode ? '수정하기' : '등록하기',
|
||||
style: const TextStyle(fontSize: 16),
|
||||
),
|
||||
child: Text(
|
||||
controller.isEditMode ? '수정하기' : '등록하기',
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -470,25 +452,19 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
// 장비 상태 변경 (출고 시 'inuse'로 자동 설정)
|
||||
const Text('장비 상태 설정', style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 4),
|
||||
DropdownButtonFormField<String>(
|
||||
value: 'inuse', // 출고 시 기본값
|
||||
decoration: const InputDecoration(
|
||||
hintText: '출고 후 장비 상태',
|
||||
labelText: '출고 후 상태 *',
|
||||
ShadSelect<String>(
|
||||
initialValue: 'inuse', // 출고 시 기본값
|
||||
placeholder: const Text('출고 후 장비 상태'),
|
||||
selectedOptionBuilder: (context, value) => Text(
|
||||
value == 'inuse' ? '사용 중' : '유지보수',
|
||||
),
|
||||
items: const [
|
||||
DropdownMenuItem(value: 'inuse', child: Text('사용 중')),
|
||||
DropdownMenuItem(value: 'maintenance', child: Text('유지보수')),
|
||||
options: const [
|
||||
ShadOption(value: 'inuse', child: Text('사용 중')),
|
||||
ShadOption(value: 'maintenance', child: Text('유지보수')),
|
||||
],
|
||||
onChanged: (value) {
|
||||
// controller.equipmentStatus = value; // TODO: 컨트롤러에 추가 필요
|
||||
},
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return '출고 후 상태를 선택해주세요';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
@@ -517,30 +493,23 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
...List.generate(controller.selectedCompanies.length, (index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12.0),
|
||||
child: DropdownButtonFormField<String>(
|
||||
value: controller.selectedCompanies[index],
|
||||
decoration: InputDecoration(
|
||||
hintText: index == 0 ? '출고할 회사를 선택하세요' : '추가된 출고할 회사를 선택하세요',
|
||||
// 이전 드롭다운에 값이 선택되지 않았으면 비활성화
|
||||
enabled:
|
||||
index == 0 ||
|
||||
controller.selectedCompanies[index - 1] != null,
|
||||
),
|
||||
items:
|
||||
child: ShadSelect<String>(
|
||||
initialValue: controller.selectedCompanies[index],
|
||||
placeholder: Text(index == 0 ? '출고할 회사를 선택하세요' : '추가된 출고할 회사를 선택하세요'),
|
||||
enabled:
|
||||
index == 0 ||
|
||||
controller.selectedCompanies[index - 1] != null,
|
||||
selectedOptionBuilder: (context, value) =>
|
||||
_buildCompanyDropdownItem(value ?? '', controller),
|
||||
options:
|
||||
controller.availableCompaniesPerDropdown[index]
|
||||
.map(
|
||||
(item) => DropdownMenuItem<String>(
|
||||
(item) => ShadOption(
|
||||
value: item.name,
|
||||
child: _buildCompanyDropdownItem(item.name, controller),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
validator: (value) {
|
||||
if (index == 0 && (value == null || value.isEmpty)) {
|
||||
return '출고 회사를 선택해주세요';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onChanged:
|
||||
(index == 0 ||
|
||||
controller.selectedCompanies[index - 1] != null)
|
||||
@@ -740,19 +709,19 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
children: [
|
||||
Text(label, style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 4),
|
||||
DropdownButtonFormField<String>(
|
||||
value: value,
|
||||
decoration: InputDecoration(hintText: hint),
|
||||
items:
|
||||
ShadSelect<String>(
|
||||
initialValue: value,
|
||||
placeholder: Text(hint),
|
||||
selectedOptionBuilder: (context, value) => Text(value ?? ''),
|
||||
options:
|
||||
items
|
||||
.map(
|
||||
(item) => DropdownMenuItem<String>(
|
||||
(item) => ShadOption(
|
||||
value: item,
|
||||
child: Text(item),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
validator: validator,
|
||||
onChanged: onChanged,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
@@ -835,23 +804,6 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
// 회사 ID에 따른 담당자 정보를 가져와 표시하는 위젯 목록 생성
|
||||
List<Widget> _getUsersForCompany(CompanyBranchInfo companyInfo) {
|
||||
final List<Widget> userWidgets = [];
|
||||
|
||||
// 판교지점 특별 처리
|
||||
if (companyInfo.originalName == "판교지점" &&
|
||||
companyInfo.parentCompanyName == "LG전자") {
|
||||
userWidgets.add(
|
||||
Text(
|
||||
'정수진 사원 010-4567-8901 jung.soojin@lg.com',
|
||||
style: ShadcnTheme.bodyMedium,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return userWidgets;
|
||||
}
|
||||
|
||||
// 출고/대여/폐기 라디오 버튼 위젯
|
||||
Widget _buildOutTypeRadio(EquipmentOutFormController controller) {
|
||||
|
||||
Reference in New Issue
Block a user