Service worker update {{}} - menu working ! + clean code
This commit is contained in:
parent
4ea07c2bd5
commit
7263303b7e
@ -67,7 +67,6 @@ class _AudioPlayerFloatingContainerState extends State<AudioPlayerFloatingContai
|
||||
setState(() {
|
||||
//refresh the UI
|
||||
if(currentpos > player.duration!.inMilliseconds) {
|
||||
print("RESET ALL");
|
||||
player.stop();
|
||||
player.seek(const Duration(seconds: 0));
|
||||
isplaying = false;
|
||||
|
||||
@ -23,12 +23,10 @@ class _TranslationInputAndResourceContainerState extends State<TranslationInputA
|
||||
currentLanguage = ValueNotifier<String>(widget.newValues.first.language!);
|
||||
|
||||
controllerQuill.onEditorLoaded(() {
|
||||
print("onEditorLoaded");
|
||||
isInit = true;
|
||||
});
|
||||
|
||||
Future.delayed(Duration(milliseconds: 500), () {
|
||||
print("Future.delayed");
|
||||
controllerQuill.clear();
|
||||
controllerQuill.insertText(widget.newValues[_tabController!.index].value!);
|
||||
isInit = true;
|
||||
@ -38,7 +36,6 @@ class _TranslationInputAndResourceContainerState extends State<TranslationInputA
|
||||
var plainText = await controllerQuill.getPlainText();
|
||||
if(widget.isTitle) {
|
||||
if(plainText.length > kTitleMaxLength) {
|
||||
print("to much text au dessus");
|
||||
controllerQuill.undo();
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -24,12 +24,10 @@ class _TranslationInputContainerState extends State<TranslationInputContainer> w
|
||||
currentLanguage = ValueNotifier<String>(widget.newValues.first.language!);
|
||||
|
||||
controllerQuill.onEditorLoaded(() {
|
||||
print("onEditorLoaded");
|
||||
isInit = true;
|
||||
});
|
||||
|
||||
Future.delayed(Duration(milliseconds: 500), () {
|
||||
print("Future.delayed");
|
||||
controllerQuill.clear();
|
||||
controllerQuill.insertText(widget.newValues[_tabController!.index].value!);
|
||||
isInit = true;
|
||||
@ -39,12 +37,10 @@ class _TranslationInputContainerState extends State<TranslationInputContainer> w
|
||||
var plainText = await controllerQuill.getPlainText();
|
||||
if(widget.isTitle) {
|
||||
if(plainText.length > kTitleMaxLength) {
|
||||
print("to much text au dessus");
|
||||
controllerQuill.undo();
|
||||
}
|
||||
} else {
|
||||
if(plainText.length > kDescriptionMaxLength) {
|
||||
print("to much text description au dessus");
|
||||
controllerQuill.undo();
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,8 +64,6 @@ getContent(List<TranslationDTO> translations, int maxLines) {
|
||||
maxLines: maxLines,
|
||||
initialValue: translation.value,
|
||||
onChanged: (String value) {
|
||||
//print("onChanged value in tranbslationTAB");
|
||||
//print(value);
|
||||
translation.value = value;
|
||||
},
|
||||
cursorColor: kPrimaryColor,
|
||||
|
||||
@ -27,7 +27,6 @@ class _UploadOnlineResourceContainerState extends State<UploadOnlineResourceCont
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Size size = MediaQuery.of(context).size;
|
||||
//print(size.width);
|
||||
return displayElement(size);
|
||||
}
|
||||
|
||||
|
||||
@ -84,7 +84,6 @@ class FileHelper {
|
||||
if (e.toString().contains("cannot find the file")) {
|
||||
final path = await _localPath;
|
||||
new File('$path/session.json').createSync(recursive: true);
|
||||
//print("file created");
|
||||
await writeSession(new Session(rememberMe: false));
|
||||
}
|
||||
// If encountering an error, return 0
|
||||
|
||||
@ -101,7 +101,6 @@ class _ArticleConfigState extends State<ArticleConfig> {
|
||||
isChecked: articleDTO.isContentTop,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
//print(value);
|
||||
articleDTO.isContentTop = value;
|
||||
widget.onChanged(articleDTO);
|
||||
});
|
||||
@ -135,7 +134,6 @@ class _ArticleConfigState extends State<ArticleConfig> {
|
||||
isChecked: articleDTO.isReadAudioAuto,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
//print(value);
|
||||
articleDTO.isReadAudioAuto = value;
|
||||
widget.onChanged(articleDTO);
|
||||
});
|
||||
|
||||
@ -28,7 +28,6 @@ class _CategoryInputContainerState extends State<CategoryInputContainer> {
|
||||
@override
|
||||
void initState() {
|
||||
middleCategories = widget.initialValue;
|
||||
print("initStateinitStateinitState");
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@ -50,13 +49,7 @@ class _CategoryInputContainerState extends State<CategoryInputContainer> {
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
List<CategorieDTO> newValues = <CategorieDTO>[];
|
||||
|
||||
print("HERE COMES THE FUCKKKERS");
|
||||
print(middleCategories);
|
||||
|
||||
showCreateOrUpdateCategories("Catégories", middleCategories, newValues, (value) {
|
||||
print("RESULT HERERERER");
|
||||
print(value);
|
||||
setState(() {
|
||||
widget.onChanged(value);
|
||||
middleCategories = value;
|
||||
@ -107,7 +100,6 @@ showCreateOrUpdateCategories(String modalLabel, List<CategorieDTO> initials, Lis
|
||||
height: size.height * 0.7,
|
||||
width: size.width * 0.65,
|
||||
child: CategoryList(categories: initials, onChanged: (result) {
|
||||
print("ON CHANGZED HERE");
|
||||
newValues = result;
|
||||
//onGetResult(result);
|
||||
}),
|
||||
@ -126,8 +118,6 @@ showCreateOrUpdateCategories(String modalLabel, List<CategorieDTO> initials, Lis
|
||||
color: kSecond,
|
||||
press: () {
|
||||
onGetResult(initials);
|
||||
print("INITALASSS");
|
||||
print(initials);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
fontSize: 20,
|
||||
|
||||
@ -26,15 +26,12 @@ class _CategoryListState extends State<CategoryList> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
print("INISTASTETETTETET CATEGORY LIIST");
|
||||
super.initState();
|
||||
categoriesMiddle = new List<CategorieDTO>.from(widget.categories);
|
||||
categoriesMiddle.sort((a, b) => a.order!.compareTo(b.order!));
|
||||
|
||||
currentIndex = getNextAvailableIndex(categoriesMiddle);
|
||||
assignIdsToNull(categoriesMiddle);
|
||||
print(currentIndex);
|
||||
print(categoriesMiddle);
|
||||
}
|
||||
|
||||
int getNextAvailableIndex(List<CategorieDTO> categoriesMiddle) {
|
||||
@ -210,7 +207,6 @@ class _CategoryListState extends State<CategoryList> {
|
||||
if (result != null)
|
||||
{
|
||||
setState(() {
|
||||
print("RESUUULT MODIFYY ");
|
||||
category = result;
|
||||
categoriesMiddle[category.order!] = category;
|
||||
widget.onChanged(categoriesMiddle);
|
||||
|
||||
@ -106,13 +106,6 @@ class _MapConfigState extends State<MapConfig> {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*print("MAPDTO");
|
||||
print(mapDTO);
|
||||
print(mapDTO.mapType.toString());
|
||||
if (mapDTO.mapType == null) {
|
||||
mapDTO.mapType = MapTypeApp.hybrid;
|
||||
}*/
|
||||
}
|
||||
|
||||
@override
|
||||
@ -245,8 +238,6 @@ class _MapConfigState extends State<MapConfig> {
|
||||
color: kPrimaryColor,
|
||||
onChanged: (List<CategorieDTO>? value) {
|
||||
if(value != null) {
|
||||
//print("COUCOU CategoryInputContainerCategoryInputContainerCategoryInputContainer");
|
||||
//print(value);
|
||||
mapDTO.categories = value;
|
||||
|
||||
//update point's category
|
||||
@ -255,34 +246,10 @@ class _MapConfigState extends State<MapConfig> {
|
||||
// Check if category still exist - Delete
|
||||
if(p.categorieId != null && !mapDTO.categories!.map((c) => c.id).any((e) => e != null && e == p.categorieId))
|
||||
{
|
||||
print("DELETE CAT REF");
|
||||
print(p.categorieId);
|
||||
//print(p.categorie);
|
||||
// delete cat ref from point
|
||||
p.categorieId = null;
|
||||
//p.categorie = null;
|
||||
}
|
||||
// update point category - Update
|
||||
if(p.categorieId != null && mapDTO.categories!.map((c) => c.id).any((e) => e != null && e == p.categorieId))
|
||||
{
|
||||
var categorie = mapDTO.categories!.firstWhere((c) => c.id == p.categorieId);
|
||||
//p.categorie = categorie;
|
||||
print("UPDATE CAT REF");
|
||||
}
|
||||
|
||||
print(p);
|
||||
/*if(p.categorieId == null && p.categorie != null && p.categorie!.label != null)
|
||||
{
|
||||
// need to update with label
|
||||
var categorie = mapDTO.categories!.firstWhere((c) => c.label![0].value == p.categorie!.label![0].value);
|
||||
//p.categorie = categorie;
|
||||
p.categorieId = categorie.id;
|
||||
}*/
|
||||
});
|
||||
}
|
||||
/*print("mapDTO.points");
|
||||
print(mapDTO.points);*/
|
||||
//widget.onChanged(jsonEncode(mapDTO).toString());
|
||||
widget.onChanged(mapDTO);
|
||||
}
|
||||
},
|
||||
|
||||
@ -85,16 +85,8 @@ Future<CategorieDTO?> showNewOrUpdateCategory(CategorieDTO? inputCategorieDTO, A
|
||||
onChanged: (ResourceDTO resource) {
|
||||
if(resource.id == null) {
|
||||
categorieDTO.resourceDTO = null;
|
||||
/*categorieDTO.resourceDTO?.id = null;
|
||||
categorieDTO.resourceDTO?.url = null;
|
||||
categorieDTO.resourceDTO?.label = null;*/
|
||||
} else {
|
||||
categorieDTO.resourceDTO = resource;
|
||||
/*categorieDTO.resourceDTO?.id = resource.id;
|
||||
categorieDTO.resourceDTO?.url = resource.url;
|
||||
categorieDTO.resourceDTO?.label = resource.label;*/
|
||||
print("Icône catégorie Icône catégorie");
|
||||
print(categorieDTO);
|
||||
}
|
||||
},
|
||||
isSmall: true
|
||||
|
||||
@ -78,18 +78,15 @@ void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Funct
|
||||
onError: (e) => print(e),
|
||||
selectLocationButtonLeadingIcon: const Icon(Icons.check, color: kPrimaryColor),
|
||||
onPicked: (pickedData) {
|
||||
print("onPicked");
|
||||
geoPointDTO.latitude = pickedData.latLong.latitude.toString();
|
||||
geoPointDTO.longitude = pickedData.latLong.longitude.toString();
|
||||
print(geoPointDTO.latitude);
|
||||
print(geoPointDTO.longitude);
|
||||
},
|
||||
onChanged: (pickedData) {
|
||||
print("onChanged");
|
||||
/*print("onChanged");
|
||||
print(pickedData.latLong.latitude);
|
||||
print(pickedData.latLong.longitude);
|
||||
print(pickedData.address);
|
||||
print(pickedData.addressData);
|
||||
print(pickedData.addressData);*/
|
||||
},
|
||||
showContributorBadgeForOSM: false,
|
||||
),
|
||||
|
||||
@ -188,213 +188,61 @@ class _ListViewCardSubSection extends State<ListViewCardSubSection> {
|
||||
);
|
||||
}
|
||||
|
||||
updateSectionDetail(SectionDTO sectionDTO, Object sectionDetailDTO) {
|
||||
switch(sectionDTO.type)
|
||||
{
|
||||
dynamic updateSectionDetail(SectionDTO sectionDTO, Object sectionDetailDTO) {
|
||||
dynamic castedDetail;
|
||||
|
||||
switch (sectionDTO.type) {
|
||||
case SectionType.Map:
|
||||
(sectionDetailDTO as MapDTO).id = sectionDTO.id;
|
||||
(sectionDetailDTO as MapDTO).order = sectionDTO.order;
|
||||
(sectionDetailDTO as MapDTO).dateCreation = sectionDTO.dateCreation;
|
||||
(sectionDetailDTO as MapDTO).type = sectionDTO.type;
|
||||
(sectionDetailDTO as MapDTO).instanceId = sectionDTO.instanceId;
|
||||
(sectionDetailDTO as MapDTO).configurationId = sectionDTO.configurationId;
|
||||
(sectionDetailDTO as MapDTO).isSubSection = sectionDTO.isSubSection;
|
||||
(sectionDetailDTO as MapDTO).parentId = sectionDTO.parentId;
|
||||
(sectionDetailDTO as MapDTO).label = sectionDTO.label;
|
||||
(sectionDetailDTO as MapDTO).title = sectionDTO.title;
|
||||
(sectionDetailDTO as MapDTO).description = sectionDTO.description;
|
||||
(sectionDetailDTO as MapDTO).imageId = sectionDTO.imageId;
|
||||
(sectionDetailDTO as MapDTO).imageSource = sectionDTO.imageSource;
|
||||
(sectionDetailDTO as MapDTO).isBeacon = sectionDTO.isBeacon;
|
||||
(sectionDetailDTO as MapDTO).beaconId = sectionDTO.beaconId;
|
||||
(sectionDetailDTO as MapDTO).latitude = sectionDTO.latitude;
|
||||
(sectionDetailDTO as MapDTO).longitude = sectionDTO.longitude;
|
||||
(sectionDetailDTO as MapDTO).meterZoneGPS = sectionDTO.meterZoneGPS;
|
||||
castedDetail = sectionDetailDTO is MapDTO ? sectionDetailDTO : MapDTO.fromJson(sectionDetailDTO)!;
|
||||
break;
|
||||
case SectionType.Slider:
|
||||
(sectionDetailDTO as SliderDTO).id = sectionDTO.id;
|
||||
(sectionDetailDTO as SliderDTO).order = sectionDTO.order;
|
||||
(sectionDetailDTO as SliderDTO).dateCreation = sectionDTO.dateCreation;
|
||||
(sectionDetailDTO as SliderDTO).type = sectionDTO.type;
|
||||
(sectionDetailDTO as SliderDTO).instanceId = sectionDTO.instanceId;
|
||||
(sectionDetailDTO as SliderDTO).configurationId = sectionDTO.configurationId;
|
||||
(sectionDetailDTO as SliderDTO).isSubSection = sectionDTO.isSubSection;
|
||||
(sectionDetailDTO as SliderDTO).parentId = sectionDTO.parentId;
|
||||
(sectionDetailDTO as SliderDTO).label = sectionDTO.label;
|
||||
(sectionDetailDTO as SliderDTO).title = sectionDTO.title;
|
||||
(sectionDetailDTO as SliderDTO).description = sectionDTO.description;
|
||||
(sectionDetailDTO as SliderDTO).imageId = sectionDTO.imageId;
|
||||
(sectionDetailDTO as SliderDTO).imageSource = sectionDTO.imageSource;
|
||||
(sectionDetailDTO as SliderDTO).isBeacon = sectionDTO.isBeacon;
|
||||
(sectionDetailDTO as SliderDTO).beaconId = sectionDTO.beaconId;
|
||||
(sectionDetailDTO as SliderDTO).latitude = sectionDTO.latitude;
|
||||
(sectionDetailDTO as SliderDTO).longitude = sectionDTO.longitude;
|
||||
(sectionDetailDTO as SliderDTO).meterZoneGPS = sectionDTO.meterZoneGPS;
|
||||
castedDetail = sectionDetailDTO is SliderDTO ? sectionDetailDTO : SliderDTO.fromJson(sectionDetailDTO)!;
|
||||
break;
|
||||
case SectionType.Video:
|
||||
(sectionDetailDTO as VideoDTO).id = sectionDTO.id;
|
||||
(sectionDetailDTO as VideoDTO).order = sectionDTO.order;
|
||||
(sectionDetailDTO as VideoDTO).dateCreation = sectionDTO.dateCreation;
|
||||
(sectionDetailDTO as VideoDTO).type = sectionDTO.type;
|
||||
(sectionDetailDTO as VideoDTO).instanceId = sectionDTO.instanceId;
|
||||
(sectionDetailDTO as VideoDTO).configurationId = sectionDTO.configurationId;
|
||||
(sectionDetailDTO as VideoDTO).isSubSection = sectionDTO.isSubSection;
|
||||
(sectionDetailDTO as VideoDTO).parentId = sectionDTO.parentId;
|
||||
(sectionDetailDTO as VideoDTO).label = sectionDTO.label;
|
||||
(sectionDetailDTO as VideoDTO).title = sectionDTO.title;
|
||||
(sectionDetailDTO as VideoDTO).description = sectionDTO.description;
|
||||
(sectionDetailDTO as VideoDTO).imageId = sectionDTO.imageId;
|
||||
(sectionDetailDTO as VideoDTO).imageSource = sectionDTO.imageSource;
|
||||
(sectionDetailDTO as VideoDTO).isBeacon = sectionDTO.isBeacon;
|
||||
(sectionDetailDTO as VideoDTO).beaconId = sectionDTO.beaconId;
|
||||
(sectionDetailDTO as VideoDTO).latitude = sectionDTO.latitude;
|
||||
(sectionDetailDTO as VideoDTO).longitude = sectionDTO.longitude;
|
||||
(sectionDetailDTO as VideoDTO).meterZoneGPS = sectionDTO.meterZoneGPS;
|
||||
castedDetail = sectionDetailDTO is VideoDTO ? sectionDetailDTO : VideoDTO.fromJson(sectionDetailDTO)!;
|
||||
break;
|
||||
case SectionType.Web:
|
||||
(sectionDetailDTO as WebDTO).id = sectionDTO.id;
|
||||
(sectionDetailDTO as WebDTO).order = sectionDTO.order;
|
||||
(sectionDetailDTO as WebDTO).dateCreation = sectionDTO.dateCreation;
|
||||
(sectionDetailDTO as WebDTO).type = sectionDTO.type;
|
||||
(sectionDetailDTO as WebDTO).instanceId = sectionDTO.instanceId;
|
||||
(sectionDetailDTO as WebDTO).configurationId = sectionDTO.configurationId;
|
||||
(sectionDetailDTO as WebDTO).isSubSection = sectionDTO.isSubSection;
|
||||
(sectionDetailDTO as WebDTO).parentId = sectionDTO.parentId;
|
||||
(sectionDetailDTO as WebDTO).label = sectionDTO.label;
|
||||
(sectionDetailDTO as WebDTO).title = sectionDTO.title;
|
||||
(sectionDetailDTO as WebDTO).description = sectionDTO.description;
|
||||
(sectionDetailDTO as WebDTO).imageId = sectionDTO.imageId;
|
||||
(sectionDetailDTO as WebDTO).imageSource = sectionDTO.imageSource;
|
||||
(sectionDetailDTO as WebDTO).isBeacon = sectionDTO.isBeacon;
|
||||
(sectionDetailDTO as WebDTO).beaconId = sectionDTO.beaconId;
|
||||
(sectionDetailDTO as WebDTO).latitude = sectionDTO.latitude;
|
||||
(sectionDetailDTO as WebDTO).longitude = sectionDTO.longitude;
|
||||
(sectionDetailDTO as WebDTO).meterZoneGPS = sectionDTO.meterZoneGPS;
|
||||
break;
|
||||
case SectionType.Menu:
|
||||
(sectionDetailDTO as MenuDTO).id = sectionDTO.id;
|
||||
(sectionDetailDTO as MenuDTO).order = sectionDTO.order;
|
||||
(sectionDetailDTO as MenuDTO).dateCreation = sectionDTO.dateCreation;
|
||||
(sectionDetailDTO as MenuDTO).type = sectionDTO.type;
|
||||
(sectionDetailDTO as MenuDTO).instanceId = sectionDTO.instanceId;
|
||||
(sectionDetailDTO as MenuDTO).configurationId = sectionDTO.configurationId;
|
||||
(sectionDetailDTO as MenuDTO).isSubSection = sectionDTO.isSubSection;
|
||||
(sectionDetailDTO as MenuDTO).parentId = sectionDTO.parentId;
|
||||
(sectionDetailDTO as MenuDTO).label = sectionDTO.label;
|
||||
(sectionDetailDTO as MenuDTO).title = sectionDTO.title;
|
||||
(sectionDetailDTO as MenuDTO).description = sectionDTO.description;
|
||||
(sectionDetailDTO as MenuDTO).imageId = sectionDTO.imageId;
|
||||
(sectionDetailDTO as MenuDTO).imageSource = sectionDTO.imageSource;
|
||||
(sectionDetailDTO as MenuDTO).isBeacon = sectionDTO.isBeacon;
|
||||
(sectionDetailDTO as MenuDTO).beaconId = sectionDTO.beaconId;
|
||||
(sectionDetailDTO as MenuDTO).latitude = sectionDTO.latitude;
|
||||
(sectionDetailDTO as MenuDTO).longitude = sectionDTO.longitude;
|
||||
(sectionDetailDTO as MenuDTO).meterZoneGPS = sectionDTO.meterZoneGPS;
|
||||
castedDetail = sectionDetailDTO is WebDTO ? sectionDetailDTO : WebDTO.fromJson(sectionDetailDTO)!;
|
||||
break;
|
||||
case SectionType.Quiz:
|
||||
(sectionDetailDTO as QuizDTO).id = sectionDTO.id;
|
||||
(sectionDetailDTO as QuizDTO).order = sectionDTO.order;
|
||||
(sectionDetailDTO as QuizDTO).dateCreation = sectionDTO.dateCreation;
|
||||
(sectionDetailDTO as QuizDTO).type = sectionDTO.type;
|
||||
(sectionDetailDTO as QuizDTO).instanceId = sectionDTO.instanceId;
|
||||
(sectionDetailDTO as QuizDTO).configurationId = sectionDTO.configurationId;
|
||||
(sectionDetailDTO as QuizDTO).isSubSection = sectionDTO.isSubSection;
|
||||
(sectionDetailDTO as QuizDTO).parentId = sectionDTO.parentId;
|
||||
(sectionDetailDTO as QuizDTO).label = sectionDTO.label;
|
||||
(sectionDetailDTO as QuizDTO).title = sectionDTO.title;
|
||||
(sectionDetailDTO as QuizDTO).description = sectionDTO.description;
|
||||
(sectionDetailDTO as QuizDTO).imageId = sectionDTO.imageId;
|
||||
(sectionDetailDTO as QuizDTO).imageSource = sectionDTO.imageSource;
|
||||
(sectionDetailDTO as QuizDTO).isBeacon = sectionDTO.isBeacon;
|
||||
(sectionDetailDTO as QuizDTO).beaconId = sectionDTO.beaconId;
|
||||
(sectionDetailDTO as QuizDTO).latitude = sectionDTO.latitude;
|
||||
(sectionDetailDTO as QuizDTO).longitude = sectionDTO.longitude;
|
||||
(sectionDetailDTO as QuizDTO).meterZoneGPS = sectionDTO.meterZoneGPS;
|
||||
castedDetail = sectionDetailDTO is QuizDTO ? sectionDetailDTO : QuizDTO.fromJson(sectionDetailDTO)!;
|
||||
break;
|
||||
case SectionType.Pdf:
|
||||
(sectionDetailDTO as PdfDTO).id = sectionDTO.id;
|
||||
(sectionDetailDTO as PdfDTO).order = sectionDTO.order;
|
||||
(sectionDetailDTO as PdfDTO).dateCreation = sectionDTO.dateCreation;
|
||||
(sectionDetailDTO as PdfDTO).type = sectionDTO.type;
|
||||
(sectionDetailDTO as PdfDTO).instanceId = sectionDTO.instanceId;
|
||||
(sectionDetailDTO as PdfDTO).configurationId = sectionDTO.configurationId;
|
||||
(sectionDetailDTO as PdfDTO).isSubSection = sectionDTO.isSubSection;
|
||||
(sectionDetailDTO as PdfDTO).parentId = sectionDTO.parentId;
|
||||
(sectionDetailDTO as PdfDTO).label = sectionDTO.label;
|
||||
(sectionDetailDTO as PdfDTO).title = sectionDTO.title;
|
||||
(sectionDetailDTO as PdfDTO).description = sectionDTO.description;
|
||||
(sectionDetailDTO as PdfDTO).imageId = sectionDTO.imageId;
|
||||
(sectionDetailDTO as PdfDTO).imageSource = sectionDTO.imageSource;
|
||||
(sectionDetailDTO as PdfDTO).isBeacon = sectionDTO.isBeacon;
|
||||
(sectionDetailDTO as PdfDTO).beaconId = sectionDTO.beaconId;
|
||||
(sectionDetailDTO as PdfDTO).latitude = sectionDTO.latitude;
|
||||
(sectionDetailDTO as PdfDTO).longitude = sectionDTO.longitude;
|
||||
(sectionDetailDTO as PdfDTO).meterZoneGPS = sectionDTO.meterZoneGPS;
|
||||
castedDetail = sectionDetailDTO is PdfDTO ? sectionDetailDTO : PdfDTO.fromJson(sectionDetailDTO)!;
|
||||
break;
|
||||
case SectionType.Puzzle:
|
||||
(sectionDetailDTO as PuzzleDTO).id = sectionDTO.id;
|
||||
(sectionDetailDTO as PuzzleDTO).order = sectionDTO.order;
|
||||
(sectionDetailDTO as PuzzleDTO).dateCreation = sectionDTO.dateCreation;
|
||||
(sectionDetailDTO as PuzzleDTO).type = sectionDTO.type;
|
||||
(sectionDetailDTO as PuzzleDTO).instanceId = sectionDTO.instanceId;
|
||||
(sectionDetailDTO as PuzzleDTO).configurationId = sectionDTO.configurationId;
|
||||
(sectionDetailDTO as PuzzleDTO).isSubSection = sectionDTO.isSubSection;
|
||||
(sectionDetailDTO as PuzzleDTO).parentId = sectionDTO.parentId;
|
||||
(sectionDetailDTO as PuzzleDTO).label = sectionDTO.label;
|
||||
(sectionDetailDTO as PuzzleDTO).title = sectionDTO.title;
|
||||
(sectionDetailDTO as PuzzleDTO).description = sectionDTO.description;
|
||||
(sectionDetailDTO as PuzzleDTO).imageId = sectionDTO.imageId;
|
||||
(sectionDetailDTO as PuzzleDTO).imageSource = sectionDTO.imageSource;
|
||||
(sectionDetailDTO as PuzzleDTO).isBeacon = sectionDTO.isBeacon;
|
||||
(sectionDetailDTO as PuzzleDTO).beaconId = sectionDTO.beaconId;
|
||||
(sectionDetailDTO as PuzzleDTO).latitude = sectionDTO.latitude;
|
||||
(sectionDetailDTO as PuzzleDTO).longitude = sectionDTO.longitude;
|
||||
(sectionDetailDTO as PuzzleDTO).meterZoneGPS = sectionDTO.meterZoneGPS;
|
||||
castedDetail = sectionDetailDTO is PuzzleDTO ? sectionDetailDTO : PuzzleDTO.fromJson(sectionDetailDTO)!;
|
||||
break;
|
||||
case SectionType.Agenda:
|
||||
(sectionDetailDTO as AgendaDTO).id = sectionDTO.id;
|
||||
(sectionDetailDTO as AgendaDTO).order = sectionDTO.order;
|
||||
(sectionDetailDTO as AgendaDTO).dateCreation = sectionDTO.dateCreation;
|
||||
(sectionDetailDTO as AgendaDTO).type = sectionDTO.type;
|
||||
(sectionDetailDTO as AgendaDTO).instanceId = sectionDTO.instanceId;
|
||||
(sectionDetailDTO as AgendaDTO).configurationId = sectionDTO.configurationId;
|
||||
(sectionDetailDTO as AgendaDTO).isSubSection = sectionDTO.isSubSection;
|
||||
(sectionDetailDTO as AgendaDTO).parentId = sectionDTO.parentId;
|
||||
(sectionDetailDTO as AgendaDTO).label = sectionDTO.label;
|
||||
(sectionDetailDTO as AgendaDTO).title = sectionDTO.title;
|
||||
(sectionDetailDTO as AgendaDTO).description = sectionDTO.description;
|
||||
(sectionDetailDTO as AgendaDTO).imageId = sectionDTO.imageId;
|
||||
(sectionDetailDTO as AgendaDTO).imageSource = sectionDTO.imageSource;
|
||||
(sectionDetailDTO as AgendaDTO).isBeacon = sectionDTO.isBeacon;
|
||||
(sectionDetailDTO as AgendaDTO).beaconId = sectionDTO.beaconId;
|
||||
(sectionDetailDTO as AgendaDTO).latitude = sectionDTO.latitude;
|
||||
(sectionDetailDTO as AgendaDTO).longitude = sectionDTO.longitude;
|
||||
(sectionDetailDTO as AgendaDTO).meterZoneGPS = sectionDTO.meterZoneGPS;
|
||||
castedDetail = sectionDetailDTO is AgendaDTO ? sectionDetailDTO : AgendaDTO.fromJson(sectionDetailDTO)!;
|
||||
break;
|
||||
case SectionType.Weather:
|
||||
(sectionDetailDTO as WeatherDTO).id = sectionDTO.id;
|
||||
(sectionDetailDTO as WeatherDTO).order = sectionDTO.order;
|
||||
(sectionDetailDTO as WeatherDTO).dateCreation = sectionDTO.dateCreation;
|
||||
(sectionDetailDTO as WeatherDTO).type = sectionDTO.type;
|
||||
(sectionDetailDTO as WeatherDTO).instanceId = sectionDTO.instanceId;
|
||||
(sectionDetailDTO as WeatherDTO).configurationId = sectionDTO.configurationId;
|
||||
(sectionDetailDTO as WeatherDTO).isSubSection = sectionDTO.isSubSection;
|
||||
(sectionDetailDTO as WeatherDTO).parentId = sectionDTO.parentId;
|
||||
(sectionDetailDTO as WeatherDTO).label = sectionDTO.label;
|
||||
(sectionDetailDTO as WeatherDTO).title = sectionDTO.title;
|
||||
(sectionDetailDTO as WeatherDTO).description = sectionDTO.description;
|
||||
(sectionDetailDTO as WeatherDTO).imageId = sectionDTO.imageId;
|
||||
(sectionDetailDTO as WeatherDTO).imageSource = sectionDTO.imageSource;
|
||||
(sectionDetailDTO as WeatherDTO).isBeacon = sectionDTO.isBeacon;
|
||||
(sectionDetailDTO as WeatherDTO).beaconId = sectionDTO.beaconId;
|
||||
(sectionDetailDTO as WeatherDTO).latitude = sectionDTO.latitude;
|
||||
(sectionDetailDTO as WeatherDTO).longitude = sectionDTO.longitude;
|
||||
(sectionDetailDTO as WeatherDTO).meterZoneGPS = sectionDTO.meterZoneGPS;
|
||||
castedDetail = sectionDetailDTO is WeatherDTO ? sectionDetailDTO : WeatherDTO.fromJson(sectionDetailDTO)!;
|
||||
break;
|
||||
}
|
||||
|
||||
return sectionDetailDTO;
|
||||
// Mise à jour générique des champs communs
|
||||
castedDetail.id = sectionDTO.id;
|
||||
castedDetail.order = sectionDTO.order;
|
||||
castedDetail.dateCreation = sectionDTO.dateCreation;
|
||||
castedDetail.type = sectionDTO.type;
|
||||
castedDetail.instanceId = sectionDTO.instanceId;
|
||||
castedDetail.configurationId = sectionDTO.configurationId;
|
||||
castedDetail.isSubSection = sectionDTO.isSubSection;
|
||||
castedDetail.parentId = sectionDTO.parentId;
|
||||
castedDetail.label = sectionDTO.label;
|
||||
castedDetail.title = sectionDTO.title;
|
||||
castedDetail.description = sectionDTO.description;
|
||||
castedDetail.imageId = sectionDTO.imageId;
|
||||
castedDetail.imageSource = sectionDTO.imageSource;
|
||||
castedDetail.isBeacon = sectionDTO.isBeacon;
|
||||
castedDetail.beaconId = sectionDTO.beaconId;
|
||||
castedDetail.latitude = sectionDTO.latitude;
|
||||
castedDetail.longitude = sectionDTO.longitude;
|
||||
castedDetail.meterZoneGPS = sectionDTO.meterZoneGPS;
|
||||
return castedDetail;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
boxDecoration(SectionDTO sectionDTO, appContext) {
|
||||
|
||||
@ -36,6 +36,7 @@ class MenuConfig extends StatefulWidget {
|
||||
|
||||
class _MenuConfigState extends State<MenuConfig> {
|
||||
late MenuDTO menuDTO;
|
||||
late List<dynamic> rawSubsections;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -56,11 +57,28 @@ class _MenuConfigState extends State<MenuConfig> {
|
||||
|
||||
Widget bodyGrid(Size size, AppContext appContext) {
|
||||
|
||||
void _onReorder(int oldIndex, int newIndex) {
|
||||
void _onReorder(int oldIndex, int newIndex) async {
|
||||
|
||||
// TODO Edit order (copy quiz question order lofic)
|
||||
// TODO Edit order (copy quiz question order logic)
|
||||
if (newIndex > oldIndex) {
|
||||
newIndex -= 1;
|
||||
}
|
||||
try {
|
||||
final SectionDTO item = menuDTO.sections![oldIndex];
|
||||
//quizzDTO.questions!.insert(newIndex, item);
|
||||
|
||||
setState(
|
||||
item.order = newIndex;
|
||||
await (appContext.getContext() as ManagerAppContext).clientAPI!.sectionApi!.sectionUpdate(item);
|
||||
showNotification(kSuccess, kWhite, "L'ordre des sous sections a été mis à jour avec succès", context, null);
|
||||
setState(() {
|
||||
// refresh ui
|
||||
print("Refresh UI");
|
||||
});
|
||||
} catch(e) {
|
||||
showNotification(kError, kWhite, "Une erreur est survenue lors de la mise à jour de l'ordre des sous sections", context, null);
|
||||
}
|
||||
|
||||
/*setState(
|
||||
() {
|
||||
if (newIndex > oldIndex) {
|
||||
newIndex -= 1;
|
||||
@ -76,7 +94,9 @@ class _MenuConfigState extends State<MenuConfig> {
|
||||
|
||||
widget.onChanged(jsonEncode(menuDTO).toString());
|
||||
},
|
||||
);
|
||||
);*/
|
||||
|
||||
|
||||
}
|
||||
return SingleChildScrollView(
|
||||
child: Stack(
|
||||
@ -94,9 +114,9 @@ class _MenuConfigState extends State<MenuConfig> {
|
||||
} else {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
var rawList = snapshot.data;
|
||||
var rawSectionDTOList = jsonDecode(jsonEncode(snapshot.data));
|
||||
rawSectionDTOList = rawSectionDTOList.map((json) => SectionDTO.fromJson(json)).toList();
|
||||
List<SectionDTO> sectionList = rawSectionDTOList.whereType<SectionDTO>().toList();
|
||||
rawSubsections = jsonDecode(jsonEncode(snapshot.data));
|
||||
rawSubsections = rawSubsections.map((json) => SectionDTO.fromJson(json)).toList();
|
||||
List<SectionDTO> sectionList = rawSubsections.whereType<SectionDTO>().toList();
|
||||
|
||||
menuDTO.sections = sectionList;
|
||||
menuDTO.sections!.sort((a, b) => a.order!.compareTo(b.order!));
|
||||
|
||||
@ -70,8 +70,6 @@ Future<OrderedTranslationAndResourceDTO?> showNewOrUpdatePDFFile(OrderedTranslat
|
||||
resourceTypes: [ResourceType.Pdf],
|
||||
onGetResult: (value) {
|
||||
if (pdfFileDTO.translationAndResourceDTOs != value) {
|
||||
print("get resut hereeee");
|
||||
print(value);
|
||||
pdfFileDTO.translationAndResourceDTOs = value;
|
||||
}
|
||||
},
|
||||
|
||||
@ -167,7 +167,6 @@ class _PDFListState extends State<PDFList> {
|
||||
if (result != null)
|
||||
{
|
||||
setState(() {
|
||||
print("RESUUULT MODIFYY ");
|
||||
pdfFileDTO = result;
|
||||
pdfsMiddle[pdfFileDTO.order!] = pdfFileDTO;
|
||||
widget.onChanged(pdfsMiddle);
|
||||
|
||||
@ -77,11 +77,8 @@ class _PuzzleConfigState extends State<PuzzleConfig> {
|
||||
initialValue: puzzleDTO.messageDebut != null ? puzzleDTO.messageDebut! : [],
|
||||
resourceTypes: [ResourceType.Image, ResourceType.ImageUrl],
|
||||
onGetResult: (value) {
|
||||
print("Mess depart test");
|
||||
print(value);
|
||||
if (puzzleDTO.messageDebut != value) {
|
||||
setState(() {
|
||||
print(puzzleDTO.messageDebut);
|
||||
puzzleDTO.messageDebut = value;
|
||||
widget.onChanged(puzzleDTO);
|
||||
});
|
||||
@ -131,7 +128,6 @@ class _PuzzleConfigState extends State<PuzzleConfig> {
|
||||
widget.onChanged(puzzleDTO);
|
||||
});
|
||||
} catch (e) {
|
||||
print('Puzzle rows not a number');
|
||||
showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null);
|
||||
}
|
||||
},
|
||||
@ -151,7 +147,6 @@ class _PuzzleConfigState extends State<PuzzleConfig> {
|
||||
widget.onChanged(puzzleDTO);
|
||||
});
|
||||
} catch (e) {
|
||||
print('Puzzle rows not a number');
|
||||
showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null);
|
||||
}
|
||||
},
|
||||
|
||||
@ -42,12 +42,8 @@ Future<List<TranslationAndResourceDTO>?> showNewOrUpdateScoreQuizz(List<Translat
|
||||
});
|
||||
|
||||
showMultiStringInputAndResourceHTML("Message pour un mauvais score", "Message pour un mauvais score", true, initials, newValues, (value) {
|
||||
print("RTESULTYTYT ");
|
||||
print(value);
|
||||
if(value != null && value.isNotEmpty) {
|
||||
levelDTO = value;
|
||||
print("RETURN VALUE");
|
||||
print(levelDTO);
|
||||
return levelDTO;
|
||||
}
|
||||
}, 1, [], context);
|
||||
|
||||
@ -70,20 +70,6 @@ class _QuizzConfigState extends State<QuizzConfig> {
|
||||
} catch(e) {
|
||||
showNotification(kError, kWhite, "Une erreur est survenue lors de la mise à jour de l'ordre des questions", context, null);
|
||||
}
|
||||
|
||||
/*var i = 0;
|
||||
quizzDTO.questions!.forEach((question) {
|
||||
question.order = i;
|
||||
i++;
|
||||
});*/
|
||||
|
||||
/*setState(
|
||||
() async {
|
||||
|
||||
|
||||
widget.onChanged(quizzDTO);
|
||||
},
|
||||
);*/
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
@ -41,6 +41,7 @@ class _VideoConfigState extends State<VideoConfig> {
|
||||
widget.onChanged(resourceSource);
|
||||
},
|
||||
isUrl: true,
|
||||
maxLength: 100,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@ class _WebConfigState extends State<WebConfig> {
|
||||
widget.onChanged(resourceSource);
|
||||
},
|
||||
isUrl: true,
|
||||
maxLength: 100
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,19 +145,12 @@ Future<List<ResourceDTO>?> getResources(Function? onGetResult, bool isImage, App
|
||||
|
||||
Future<List<ResourceDTO?>?> create(ResourceDTO resourceDTO, List<File>? files, List<PlatformFile>? filesWeb, AppContext appContext, context) async {
|
||||
List<ResourceDTO?> createdResources = [];
|
||||
print("Coucou create");
|
||||
print(resourceDTO);
|
||||
|
||||
ManagerAppContext managerAppContext = appContext.getContext();
|
||||
int index = 0;
|
||||
|
||||
if(filesWeb != null) {
|
||||
for (PlatformFile platformFile in filesWeb) {
|
||||
var mimeType = "";
|
||||
print("Coucou platformFile");
|
||||
print(platformFile);
|
||||
print(platformFile.name);
|
||||
print(platformFile.extension);
|
||||
ResourceDTO resourceDTO = new ResourceDTO(label: platformFile.name);
|
||||
switch(platformFile.extension) {
|
||||
case 'jpg':
|
||||
|
||||
@ -19,7 +19,7 @@ Future<void> main() async {
|
||||
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
initialRoute = '/welcome';
|
||||
initialRoute = '/login';
|
||||
|
||||
var session = await loadJsonSessionFile();
|
||||
|
||||
@ -94,7 +94,7 @@ class _MyAppState extends State<MyApp> {
|
||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||
),
|
||||
routes: {
|
||||
'/welcome': (context) => LoginScreen(session: widget.session),
|
||||
'/login': (context) => LoginScreen(session: widget.session),
|
||||
'/main': (context) => MainScreen(),
|
||||
'/policy': (context) => PolicyScreen(),
|
||||
'/policy/mdlf': (context) => PolicyScreen(param: "mdlf"),
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
application. For more information, see:
|
||||
https://developers.google.com/web/fundamentals/primers/service-workers -->
|
||||
<script>
|
||||
var serviceWorkerVersion = null;
|
||||
var serviceWorkerVersion = {{flutter_service_worker_version}};
|
||||
var scriptLoaded = false;
|
||||
function loadMainDartJs() {
|
||||
if (scriptLoaded) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user