Files
superport/lib/screens/company/widgets/duplicate_company_dialog.dart
2025-07-02 17:45:44 +09:00

68 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:superport/models/company_model.dart';
/// 중복된 회사명을 확인하는 대화상자
class DuplicateCompanyDialog extends StatelessWidget {
final Company company;
const DuplicateCompanyDialog({Key? key, required this.company})
: super(key: key);
static void show(BuildContext context, Company company) {
showDialog(
context: context,
builder: (context) => DuplicateCompanyDialog(company: company),
);
}
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text('중복된 회사'),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text('동일한 이름의 회사가 이미 등록되어 있습니다.'),
const SizedBox(height: 16),
Text('회사명: ${company.name}'),
Text('주소: ${company.address ?? ''}'),
Text('담당자: ${company.contactName ?? ''}'),
Text('직책: ${company.contactPosition ?? ''}'),
Text('연락처: ${company.contactPhone ?? ''}'),
Text('이메일: ${company.contactEmail ?? ''}'),
const SizedBox(height: 8),
if (company.branches != null && company.branches!.isNotEmpty)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'지점 정보:',
style: TextStyle(fontWeight: FontWeight.bold),
),
...company.branches!.map(
(branch) => Padding(
padding: const EdgeInsets.only(left: 8.0, top: 4.0),
child: Text(
'${branch.name}: ${branch.address ?? ''} (담당자: ${branch.contactName ?? ''}, 직책: ${branch.contactPosition ?? ''}, 연락처: ${branch.contactPhone ?? ''})',
),
),
),
],
),
],
),
),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('확인'),
),
],
);
}
}