주석화 진행상황 정리하고 핵심 모듈에 한글 주석 추가
This commit is contained in:
@@ -8,8 +8,10 @@ import '../../../uom/domain/repositories/uom_repository.dart';
|
||||
import '../../domain/entities/product.dart';
|
||||
import '../../domain/repositories/product_repository.dart';
|
||||
|
||||
/// 제품 사용 여부 필터.
|
||||
enum ProductStatusFilter { all, activeOnly, inactiveOnly }
|
||||
|
||||
/// 제품 마스터 화면 상태를 관리하는 컨트롤러.
|
||||
class ProductController extends ChangeNotifier {
|
||||
static const int defaultPageSize = 20;
|
||||
|
||||
@@ -52,6 +54,7 @@ class ProductController extends ChangeNotifier {
|
||||
List<Vendor> get vendorOptions => _vendorOptions;
|
||||
List<Uom> get uomOptions => _uomOptions;
|
||||
|
||||
/// 제품 목록을 조회한다.
|
||||
Future<void> fetch({int page = 1}) async {
|
||||
_isLoading = true;
|
||||
_errorMessage = null;
|
||||
@@ -82,6 +85,7 @@ class ProductController extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
/// 필터/폼에서 사용할 공급업체와 단위 목록을 로드한다.
|
||||
Future<void> loadLookups() async {
|
||||
_isLoadingLookups = true;
|
||||
notifyListeners();
|
||||
@@ -98,6 +102,7 @@ class ProductController extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
/// 검색어를 변경한다.
|
||||
void updateQuery(String value) {
|
||||
if (_query == value) {
|
||||
return;
|
||||
@@ -106,6 +111,7 @@ class ProductController extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 공급업체 필터를 변경한다.
|
||||
void updateVendorFilter(int? vendorId) {
|
||||
if (_vendorFilter == vendorId) {
|
||||
return;
|
||||
@@ -114,6 +120,7 @@ class ProductController extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 단위(UOM) 필터를 변경한다.
|
||||
void updateUomFilter(int? uomId) {
|
||||
if (_uomFilter == uomId) {
|
||||
return;
|
||||
@@ -122,6 +129,7 @@ class ProductController extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 사용 여부 필터를 변경한다.
|
||||
void updateStatusFilter(ProductStatusFilter filter) {
|
||||
if (_statusFilter == filter) {
|
||||
return;
|
||||
@@ -130,6 +138,7 @@ class ProductController extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 페이지 크기를 변경한다.
|
||||
void updatePageSize(int size) {
|
||||
if (size <= 0 || _pageSize == size) {
|
||||
return;
|
||||
@@ -138,6 +147,7 @@ class ProductController extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 제품을 생성한다.
|
||||
Future<Product?> create(ProductInput input) async {
|
||||
_setSubmitting(true);
|
||||
try {
|
||||
@@ -153,6 +163,7 @@ class ProductController extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
/// 제품 정보를 수정한다.
|
||||
Future<Product?> update(int id, ProductInput input) async {
|
||||
_setSubmitting(true);
|
||||
try {
|
||||
@@ -168,6 +179,7 @@ class ProductController extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
/// 제품을 삭제한다.
|
||||
Future<bool> delete(int id) async {
|
||||
_setSubmitting(true);
|
||||
try {
|
||||
@@ -183,6 +195,7 @@ class ProductController extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
/// 삭제된 제품을 복구한다.
|
||||
Future<Product?> restore(int id) async {
|
||||
_setSubmitting(true);
|
||||
try {
|
||||
@@ -198,11 +211,13 @@ class ProductController extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
/// 에러 메시지를 초기화한다.
|
||||
void clearError() {
|
||||
_errorMessage = null;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 제출 상태 플래그를 갱신하고 리스너에 알린다.
|
||||
void _setSubmitting(bool value) {
|
||||
_isSubmitting = value;
|
||||
notifyListeners();
|
||||
|
||||
@@ -19,6 +19,7 @@ import '../../domain/entities/product.dart';
|
||||
import '../../domain/repositories/product_repository.dart';
|
||||
import '../controllers/product_controller.dart';
|
||||
|
||||
/// 제품 관리 페이지. 기능 플래그에 따라 사양/실제 화면을 전환한다.
|
||||
class ProductPage extends StatelessWidget {
|
||||
const ProductPage({super.key, required this.routeUri});
|
||||
|
||||
@@ -74,6 +75,7 @@ class ProductPage extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// 제품 기능이 활성화된 경우 사용하는 실제 화면 위젯.
|
||||
class _ProductEnabledPage extends StatefulWidget {
|
||||
const _ProductEnabledPage({required this.routeUri});
|
||||
|
||||
@@ -83,6 +85,7 @@ class _ProductEnabledPage extends StatefulWidget {
|
||||
State<_ProductEnabledPage> createState() => _ProductEnabledPageState();
|
||||
}
|
||||
|
||||
/// 제품 목록과 필터/폼 상태를 관리하는 상태 클래스.
|
||||
class _ProductEnabledPageState extends State<_ProductEnabledPage> {
|
||||
late final ProductController _controller;
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
|
||||
Reference in New Issue
Block a user