(fix) felhős projekthez csak bejelentkezés után lehet csatlakozni, név megjelenítése a kapcsolatok mellett a terepbejárás nézetben.
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6s
This commit is contained in:
@@ -24,7 +24,8 @@ class ContactEditView extends StatefulWidget {
|
||||
|
||||
class _ContactEditViewState extends State<ContactEditView> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
late final Contact? _original;
|
||||
Contact? _original;
|
||||
String? _originalLocalUuid;
|
||||
|
||||
late final TextEditingController _name;
|
||||
late final TextEditingController _address;
|
||||
@@ -41,7 +42,13 @@ class _ContactEditViewState extends State<ContactEditView> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_original = Get.arguments is Contact ? Get.arguments as Contact : null;
|
||||
final args = Get.arguments;
|
||||
if (args is ContactWithState) {
|
||||
_original = args.contact;
|
||||
_originalLocalUuid = args.isPending ? args.localUuid : null;
|
||||
} else if (args is Contact) {
|
||||
_original = args;
|
||||
}
|
||||
_name = TextEditingController(text: _original?.name ?? '');
|
||||
_address = TextEditingController(text: _original?.address ?? '');
|
||||
_phone = TextEditingController(text: _original?.phone ?? '');
|
||||
@@ -84,7 +91,8 @@ class _ContactEditViewState extends State<ContactEditView> {
|
||||
clearLocation: _lat == null,
|
||||
);
|
||||
|
||||
final queued = await ContactService.to.save(contact);
|
||||
final queued = await ContactService.to
|
||||
.save(contact, existingLocalUuid: _originalLocalUuid);
|
||||
Get.back(result: queued); // a lista frissítéshez visszakapja
|
||||
if (Get.isRegistered<ContactsController>()) {
|
||||
Get.find<ContactsController>().load(silent: true);
|
||||
|
||||
@@ -127,7 +127,7 @@ class ContactsView extends StatelessWidget {
|
||||
item: rows[i],
|
||||
onEdit: () async {
|
||||
final saved = await Get.to(() => const ContactEditView(),
|
||||
arguments: rows[i].contact);
|
||||
arguments: rows[i]);
|
||||
if (saved != null) c.load();
|
||||
},
|
||||
onDelete: () => _confirmDelete(c, rows[i]),
|
||||
|
||||
@@ -1241,6 +1241,11 @@ class MapSurveyController extends GetxController implements StyleEditable {
|
||||
|
||||
final contactMarkers = <Marker>[].obs;
|
||||
|
||||
/// Nyers lista a feliratozáshoz (a contactMarkers már kész Marker-eket
|
||||
/// tartalmaz, abból nem érhető el a név) — ugyanaz a szűrt kör, csak
|
||||
/// Contact-objektumként, hogy a felirat-réteg is el tudja olvasni.
|
||||
final contactsWithLocation = <ContactWithState>[].obs;
|
||||
|
||||
Future<void> saveContactAtPoint(LatLng point) async {
|
||||
activeEditTool.value = MapEditTool.none;
|
||||
if (!PermissionService.to.canContacts) return;
|
||||
@@ -1272,20 +1277,21 @@ class MapSurveyController extends GetxController implements StyleEditable {
|
||||
Future<void> _loadContactMarkers() async {
|
||||
if (!PermissionService.to.canContacts) {
|
||||
contactMarkers.clear();
|
||||
contactsWithLocation.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
final projectId = ProjectService.to.activeProject.value?.uuid;
|
||||
if (projectId == null) {
|
||||
contactMarkers.clear();
|
||||
contactsWithLocation.clear();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
final all = await ContactService.to.listMerged(projectId);
|
||||
contactMarkers.value = all
|
||||
.where((c) => c.contact.hasLocation)
|
||||
.map(_markerFromContact)
|
||||
.toList();
|
||||
final located = all.where((c) => c.contact.hasLocation).toList();
|
||||
contactsWithLocation.value = located;
|
||||
contactMarkers.value = located.map(_markerFromContact).toList();
|
||||
} catch (_) {
|
||||
// Offline/hiba: a meglévő jelölők maradnak, nem törli ki csendben.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user