95 lines
4.2 KiB
Dart
95 lines
4.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:friendly_map/modules/app/app.dart';
|
|
|
|
import '../app_scope.dart';
|
|
import '../theme.dart';
|
|
import 'async_view.dart';
|
|
import 'common.dart';
|
|
import '../screens/career_history_screen.dart';
|
|
|
|
/// 프로필의 "이직 이력" 한 줄: 지금 회사와 다닌 회사 수. 이력이 없으면 아무것도 그리지 않는다.
|
|
class CareerHistoryTile extends StatelessWidget {
|
|
const CareerHistoryTile({super.key, required this.personId});
|
|
|
|
final String personId;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AsyncView<List<StintView>>(
|
|
load: (a) => a.career.history(personId),
|
|
builder: (context, h) {
|
|
if (h.isEmpty) return const SizedBox.shrink();
|
|
final now = h.where((s) => s.stint.current).firstOrNull;
|
|
return Panel(
|
|
onTap: () => pushPage(context, CareerHistoryScreen(personId: personId)),
|
|
child: Row(children: [
|
|
const Icon(Icons.timeline, color: Pal.company),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
const Text('이직 이력', style: TextStyle(fontSize: 13, color: Pal.muted)),
|
|
Text(now == null ? '지금은 다니는 곳 없음' : '${now.stint.company} · ${now.stint.period}', style: const TextStyle(fontWeight: FontWeight.w600)),
|
|
if (h.length > 1) Text('이전 회사 ${h.length - 1}곳', style: const TextStyle(fontSize: 12, color: Pal.muted)),
|
|
]),
|
|
),
|
|
const Icon(Icons.chevron_right, color: Pal.muted),
|
|
]),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
class _Item {
|
|
const _Item(this.notice, this.text);
|
|
final CareerNotice notice;
|
|
final String text;
|
|
}
|
|
|
|
/// 이직 알림 칸들: "김민수님이 한빛전자에서 누리소프트로 옮겼어요" + 옮기기 / 이전 회사에서 지우기 / 무시.
|
|
/// [personId] 를 주면 그 사람 것만 보인다. 알림이 없으면 아무것도 그리지 않는다.
|
|
class CareerNoticesPanel extends StatelessWidget {
|
|
const CareerNoticesPanel({super.key, this.personId});
|
|
|
|
final String? personId;
|
|
|
|
Future<void> _accept(BuildContext context, CareerNotice n, bool keepOld) async {
|
|
final placed = await AppScope.of(context).app.career.accept(n.id, keepOld: keepOld);
|
|
if (!context.mounted) return;
|
|
final old = n.from.isEmpty ? '' : (keepOld ? '${n.from}에서는 이전 구성원으로 흐리게 남겼어요. ' : '${n.from}에서 뺐어요. ');
|
|
showNote(context, '$old${placed == null ? '' : '$placed에 넣었어요.'}'.trim());
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final app = AppScope.of(context).app;
|
|
return AsyncView<List<_Item>>(
|
|
load: (a) async => [for (final n in await a.career.notices(personId: personId)) _Item(n, await a.career.describe(n))],
|
|
builder: (context, items) => Column(children: [
|
|
for (final it in items)
|
|
Panel(
|
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
Row(children: [
|
|
const Icon(Icons.swap_horiz, color: Pal.company),
|
|
const SizedBox(width: 10),
|
|
Expanded(child: Text(it.text, style: const TextStyle(fontWeight: FontWeight.w600))),
|
|
]),
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
it.notice.left ? '확인하면 이전 회사 그룹에서 흐리게 남겨요.' : '확인하면 이전 회사 그룹에서는 흐리게 남기고 새 회사 그룹으로 옮겨요.',
|
|
style: const TextStyle(fontSize: 12, color: Pal.muted),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Wrap(spacing: 8, runSpacing: 4, children: [
|
|
FilledButton(onPressed: () => _accept(context, it.notice, true), child: Text(it.notice.left ? '확인' : '확인 · 옮기기')),
|
|
if (it.notice.from.isNotEmpty)
|
|
OutlinedButton(onPressed: () => _accept(context, it.notice, false), child: const Text('이전 회사에서 지우기')),
|
|
TextButton(onPressed: () => app.career.dismiss(it.notice.id), child: const Text('무시')),
|
|
]),
|
|
]),
|
|
),
|
|
]),
|
|
);
|
|
}
|
|
}
|