tabbing on finished entrie in view cams now leads to add cam window with normal save options
This commit is contained in:
3
Todo.txt
3
Todo.txt
@@ -1,5 +1,4 @@
|
||||
todo:
|
||||
möglichkeit einfügen um nicht gesendete einträge zu senden
|
||||
im englischen abändern
|
||||
redesign datenansicht
|
||||
ausvon und ausbis fixen (falsches datum übergeben (20000-01-01))
|
||||
@@ -12,13 +11,13 @@ sandorte ansehen in karte (extra tab)
|
||||
Platzierung garnix als standart aber pflichtfeld
|
||||
|
||||
|
||||
|
||||
keine ahnung obs funktioniert:
|
||||
TEST SEND FILE TO SERVER FUNCTION
|
||||
eintrg in db wenn http response (in sent column)
|
||||
|
||||
|
||||
not to do:
|
||||
möglichkeit einfügen um nicht gesendete einträge zu senden
|
||||
save option einfügen nur zum speichern
|
||||
maybe auch vorschläge aus templates in dropdown menüs anzeigen
|
||||
fehler beim speichern anzeigen
|
||||
|
||||
@@ -15,9 +15,10 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class AddCamMain extends StatefulWidget {
|
||||
final bool isTemplate;
|
||||
final Map<String, dynamic>? templateData;
|
||||
final bool isFinished;
|
||||
final Map<String, dynamic>? existingData;
|
||||
|
||||
const AddCamMain({super.key, this.isTemplate = false, this.templateData});
|
||||
const AddCamMain({super.key, this.isTemplate = false, this.existingData, this.isFinished = false});
|
||||
|
||||
@override
|
||||
State<AddCamMain> createState() => _AddCamMainState();
|
||||
@@ -26,7 +27,7 @@ class AddCamMain extends StatefulWidget {
|
||||
class _AddCamMainState extends State<AddCamMain> {
|
||||
// var declaration
|
||||
int currentStep = 0;
|
||||
bool isTemplate = false;
|
||||
// bool isTemplate = false;
|
||||
|
||||
TextEditingController id = TextEditingController();
|
||||
TextEditingController rudelC = TextEditingController();
|
||||
@@ -171,39 +172,39 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
});
|
||||
|
||||
// If a template is edited this fills in the existing values
|
||||
if (widget.isTemplate && widget.templateData != null) {
|
||||
id.text = widget.templateData!['CID'];
|
||||
rudelC.text = widget.templateData!['Rudel'];
|
||||
adresse1C.text = widget.templateData!['Adresse1'];
|
||||
adresse2C.text = widget.templateData!['Adresse2'];
|
||||
adresse3C.text = widget.templateData!['Adresse3'];
|
||||
bLandC.text = widget.templateData!['BLand'];
|
||||
lkrC.text = widget.templateData!['Lkr'];
|
||||
beiOrtC.text = widget.templateData!['BeiOrt'];
|
||||
ortInfoC.text = widget.templateData!['OrtInfo'];
|
||||
selectedStatus = widget.templateData!['Status'];
|
||||
selectedSTTyp = widget.templateData!['STTyp'];
|
||||
ffTypC.text = widget.templateData!['FFTyp'];
|
||||
selectedFotoFilm = widget.templateData!['FotoFilm'];
|
||||
selectedMEZ = widget.templateData!['MEZ'];
|
||||
selectedPlatzung = widget.templateData!['Platzung'];
|
||||
kSchloNrC.text = widget.templateData!['KSchloNr'];
|
||||
selectedBearsafe = widget.templateData!['Bearsafe'];
|
||||
datumS = widget.templateData!['Datum'];
|
||||
kontDatS = widget.templateData!['KontDat'];
|
||||
abbauDatS = widget.templateData!['AbbauDat'];
|
||||
auftragC.text = widget.templateData!['Auftrag'];
|
||||
kontAbspC.text = widget.templateData!['KontAbsp'];
|
||||
sonstBemC.text = widget.templateData!['SonstBem'];
|
||||
fKontakt1C.text = widget.templateData!['FKontakt1'];
|
||||
fKontakt2C.text = widget.templateData!['FKontakt2'];
|
||||
fKontakt3C.text = widget.templateData!['FKontakt3'];
|
||||
standortC.text = widget.templateData!['Standort'];
|
||||
kTage1C.text = widget.templateData!['KTage1'].toString();
|
||||
kTage2C.text = widget.templateData!['KTage2'].toString();
|
||||
protoAmS = widget.templateData!['ProtoAm'];
|
||||
intKommC.text = widget.templateData!['IntKomm'];
|
||||
betreuungC.text = widget.templateData!['Betreuung'];
|
||||
if (widget.isTemplate || widget.isFinished && widget.existingData != null) {
|
||||
id.text = widget.existingData!['CID'];
|
||||
rudelC.text = widget.existingData!['Rudel'];
|
||||
adresse1C.text = widget.existingData!['Adresse1'];
|
||||
adresse2C.text = widget.existingData!['Adresse2'];
|
||||
adresse3C.text = widget.existingData!['Adresse3'];
|
||||
bLandC.text = widget.existingData!['BLand'];
|
||||
lkrC.text = widget.existingData!['Lkr'];
|
||||
beiOrtC.text = widget.existingData!['BeiOrt'];
|
||||
ortInfoC.text = widget.existingData!['OrtInfo'];
|
||||
selectedStatus = widget.existingData!['Status'];
|
||||
selectedSTTyp = widget.existingData!['STTyp'];
|
||||
ffTypC.text = widget.existingData!['FFTyp'];
|
||||
selectedFotoFilm = widget.existingData!['FotoFilm'];
|
||||
selectedMEZ = widget.existingData!['MEZ'];
|
||||
selectedPlatzung = widget.existingData!['Platzung'];
|
||||
kSchloNrC.text = widget.existingData!['KSchloNr'];
|
||||
selectedBearsafe = widget.existingData!['Bearsafe'];
|
||||
datumS = widget.existingData!['Datum'];
|
||||
kontDatS = widget.existingData!['KontDat'];
|
||||
abbauDatS = widget.existingData!['AbbauDat'];
|
||||
auftragC.text = widget.existingData!['Auftrag'];
|
||||
kontAbspC.text = widget.existingData!['KontAbsp'];
|
||||
sonstBemC.text = widget.existingData!['SonstBem'];
|
||||
fKontakt1C.text = widget.existingData!['FKontakt1'];
|
||||
fKontakt2C.text = widget.existingData!['FKontakt2'];
|
||||
fKontakt3C.text = widget.existingData!['FKontakt3'];
|
||||
standortC.text = widget.existingData!['Standort'];
|
||||
kTage1C.text = widget.existingData!['KTage1'].toString();
|
||||
kTage2C.text = widget.existingData!['KTage2'].toString();
|
||||
protoAmS = widget.existingData!['ProtoAm'];
|
||||
intKommC.text = widget.existingData!['IntKomm'];
|
||||
betreuungC.text = widget.existingData!['Betreuung'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +241,6 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
var dialogContext = context;
|
||||
return AlertDialog(
|
||||
title: Text(AppLocalizations.of(context)!.savemethod),
|
||||
actions: [
|
||||
@@ -283,7 +283,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
}, child: Text(AppLocalizations.of(context)!.justsave)),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(dialogContext);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.cancel)),
|
||||
],
|
||||
@@ -291,6 +291,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void _httpRequest() async {
|
||||
Map<String, dynamic> place = getPlace();
|
||||
|
||||
@@ -393,7 +394,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
}
|
||||
}
|
||||
|
||||
if (emptyFields.isEmpty) empty = true;
|
||||
if (emptyFields.isNotEmpty) empty = true;
|
||||
|
||||
return emptyFields;
|
||||
}
|
||||
@@ -826,7 +827,6 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
empty = false;
|
||||
if (empty == true) {
|
||||
showTemplateDialog(emptyFields);
|
||||
();
|
||||
return;
|
||||
} else if (empty == false) {
|
||||
await showSaveOptionsDialog();
|
||||
|
||||
@@ -91,5 +91,6 @@
|
||||
"sent": "Gesendet",
|
||||
"savefilefailed": "Fehler. Bitte nochmal versuchen",
|
||||
"justplace": "Standort",
|
||||
"justsave": "Nur speichern"
|
||||
"justsave": "Nur speichern",
|
||||
"finishedentrie": "Bereits fertiger Eintrag"
|
||||
}
|
||||
@@ -442,6 +442,11 @@
|
||||
"justsave": "Just save",
|
||||
"@justsave": {
|
||||
"description": "Just save in the database save options dialog"
|
||||
},
|
||||
|
||||
"finishedentrie": "Already finished entrie",
|
||||
"@finishedentrie": {
|
||||
"description": "already finished entrie options dialog header"
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,7 +48,7 @@ class DBHelper {
|
||||
|
||||
// checks if the camid var from before is empty to avoid double entries
|
||||
if (existingCID.isNotEmpty) {
|
||||
//throw Exception("Eintrag existiert schon");
|
||||
updatePlace(place);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -62,6 +62,17 @@ class DBHelper {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> updatePlace(Map<String, dynamic> place) async {
|
||||
var placeDBClient = await placeDB;
|
||||
|
||||
await placeDBClient.update(
|
||||
'place',
|
||||
place,
|
||||
where: "CID = ?",
|
||||
whereArgs: [place['CID']]
|
||||
);
|
||||
}
|
||||
|
||||
// function to update the sent value
|
||||
Future<void> updateSent() async {
|
||||
var placeDBClient = await placeDB;
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'package:fforte/addCam/add_cam_main.dart';
|
||||
import 'package:fforte/other/db_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:flutter_popup_card/flutter_popup_card.dart';
|
||||
// * Site that shows all entries in the databases
|
||||
|
||||
class ViewCams extends StatefulWidget {
|
||||
@@ -160,7 +159,18 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
onChanged: null,
|
||||
),
|
||||
onTap: () async {
|
||||
showPopupCard(
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) =>
|
||||
AddCamMain(
|
||||
isFinished: true,
|
||||
existingData: place,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/* showPopupCard(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return PopupCard(
|
||||
@@ -257,7 +267,7 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}); */
|
||||
},
|
||||
);
|
||||
},
|
||||
@@ -299,7 +309,8 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
builder: (context) =>
|
||||
AddCamMain(
|
||||
isTemplate: true,
|
||||
templateData: templates,
|
||||
isFinished: false,
|
||||
existingData: templates,
|
||||
)));
|
||||
},
|
||||
title: Text('Place ${index + 1}'),
|
||||
|
||||
Reference in New Issue
Block a user