Add pricing entry flow and platform admin foundations
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../core/providers/auth_provider.dart';
|
||||
import '../../core/theme/app_theme.dart';
|
||||
import '../shared/location_picker_sheet.dart';
|
||||
import '../shared/tenant_location_data.dart';
|
||||
import 'onboarding_repository.dart';
|
||||
|
||||
class OnboardingScreen extends ConsumerStatefulWidget {
|
||||
@@ -15,6 +18,7 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen>
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
final _nameCtrl = TextEditingController();
|
||||
String _selectedKind = 'clinic';
|
||||
TenantLocationData? _location;
|
||||
bool _loading = false;
|
||||
String? _error;
|
||||
late AnimationController _animCtrl;
|
||||
@@ -53,6 +57,11 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen>
|
||||
final result = await OnboardingRepository.instance.createTenantAndJoin(
|
||||
kind: _selectedKind,
|
||||
companyName: _nameCtrl.text.trim(),
|
||||
companyAddress: _location?.address,
|
||||
city: _location?.city,
|
||||
district: _location?.district,
|
||||
latitude: _location?.latitude,
|
||||
longitude: _location?.longitude,
|
||||
);
|
||||
if (!mounted) return;
|
||||
ref.read(authProvider.notifier).setActiveTenant(result.tenants.first);
|
||||
@@ -249,6 +258,70 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen>
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
Text(
|
||||
'Konum',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium
|
||||
?.copyWith(fontWeight: FontWeight.w600),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: cs.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_location?.fullLabel.isNotEmpty == true
|
||||
? _location!.fullLabel
|
||||
: 'Konumu haritadan seçin. Laboratuvar aramalarında bu veri kullanılacak.',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: _location == null
|
||||
? cs.onSurfaceVariant
|
||||
: cs.onSurface,
|
||||
),
|
||||
),
|
||||
if (_location?.hasCoordinates == true) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'${_location!.latitude!.toStringAsFixed(6)}, ${_location!.longitude!.toStringAsFixed(6)}',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColors.textMuted,
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () async {
|
||||
final picked =
|
||||
await showLocationPickerSheet(
|
||||
context,
|
||||
initialLocation: _location,
|
||||
title: _selectedKind == 'lab'
|
||||
? 'Laboratuvar Konumu'
|
||||
: 'Klinik Konumu',
|
||||
);
|
||||
if (picked != null) {
|
||||
setState(() => _location = picked);
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.map_outlined),
|
||||
label: Text(_location == null
|
||||
? 'Haritadan Seç'
|
||||
: 'Konumu Güncelle'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Company name
|
||||
Text(
|
||||
'Kurum Adı',
|
||||
@@ -287,8 +360,8 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen>
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(
|
||||
color: cs.error, width: 1.5),
|
||||
borderSide:
|
||||
BorderSide(color: cs.error, width: 1.5),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
@@ -340,7 +413,9 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen>
|
||||
const SizedBox(height: 28),
|
||||
|
||||
FilledButton(
|
||||
onPressed: _loading ? null : _create,
|
||||
onPressed: _loading || _location == null
|
||||
? null
|
||||
: _create,
|
||||
style: FilledButton.styleFrom(
|
||||
minimumSize: const Size.fromHeight(52),
|
||||
shape: RoundedRectangleBorder(
|
||||
@@ -431,9 +506,7 @@ class _KindCard extends StatelessWidget {
|
||||
child: Icon(
|
||||
icon,
|
||||
size: 26,
|
||||
color: selected
|
||||
? const Color(0xFF4F46E5)
|
||||
: cs.onSurfaceVariant,
|
||||
color: selected ? const Color(0xFF4F46E5) : cs.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
|
||||
Reference in New Issue
Block a user