diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index cd626ac..93b08af 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -784,5 +784,12 @@ "blockThisClientOnly": "Block for this client only", "unblockThisClientOnly": "Unblock for this client only", "domainBlockedThisClient": "{domain} blocked for this client", - "domainUnblockedThisClient": "{domain} unblocked for this client" + "domainUnblockedThisClient": "{domain} unblocked for this client", + "disallowThisClient": "Disallow this client", + "allowThisClient": "Allow this client", + "clientAllowedSuccessfully": "Client allowed successfully", + "clientDisallowedSuccessfully": "Client disallowed successfully", + "changesNotSaved": "Changes could not be saved", + "allowingClient": "Allowing client...", + "disallowingClient": "Disallowing client..." } \ No newline at end of file diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index 1faf2c7..e777f48 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -784,5 +784,12 @@ "blockThisClientOnly": "Bloquear sólo para este cliente", "unblockThisClientOnly": "Desbloquear sólo para este cliente", "domainBlockedThisClient": "{domain} bloqueado para este cliente", - "domainUnblockedThisClient": "{domain} desbloqueado para este cliente" + "domainUnblockedThisClient": "{domain} desbloqueado para este cliente", + "disallowThisClient": "No permitir este cliente", + "allowThisClient": "Permitir este cliente", + "clientAllowedSuccessfully": "Cliente permitido correctamente", + "clientDisallowedSuccessfully": "Cliente no permitido correctamente", + "changesNotSaved": "Los cambios no han podido ser guardados", + "allowingClient": "Permitiendo cliente...", + "disallowingClient": "No permitiendo cliente..." } \ No newline at end of file diff --git a/lib/screens/logs/log_tile.dart b/lib/screens/logs/log_tile.dart index bd44f95..f077c31 100644 --- a/lib/screens/logs/log_tile.dart +++ b/lib/screens/logs/log_tile.dart @@ -180,6 +180,47 @@ class LogTile extends StatelessWidget { } } + void allowDisallowClient() async { + ProcessModal processModal = ProcessModal(); + processModal.open( + log.clientInfo!.disallowed == true + ? AppLocalizations.of(context)!.allowingClient + : AppLocalizations.of(context)!.disallowingClient + ); + + final result = await clientsProvider.addClientList( + log.client, + log.clientInfo!.disallowed == true + ? AccessSettingsList.allowed + : AccessSettingsList.disallowed + ); + + processModal.close(); + + if (!context.mounted) return; + if (result.successful == true) { + showSnacbkar( + appConfigProvider: appConfigProvider, + label: AppLocalizations.of(context)!.clientAddedSuccessfully, + color: Colors.green + ); + } + else if (result.successful == false && result.content == 'client_another_list') { + showSnacbkar( + appConfigProvider: appConfigProvider, + label: AppLocalizations.of(context)!.clientAnotherList, + color: Colors.red + ); + } + else { + showSnacbkar( + appConfigProvider: appConfigProvider, + label: AppLocalizations.of(context)!.changesNotSaved, + color: Colors.red + ); + } + } + void openAddClient() { Future.delayed( const Duration(milliseconds: 0), @@ -229,6 +270,15 @@ class LogTile extends StatelessWidget { icon: Icons.add_rounded, action: openAddClient ), + MenuOption( + title: log.clientInfo!.disallowed == true + ? AppLocalizations.of(context)!.allowThisClient + : AppLocalizations.of(context)!.disallowThisClient, + icon: log.clientInfo!.disallowed == true + ? Icons.check_rounded + : Icons.block_rounded, + action: allowDisallowClient + ), if (log.question.name != null) MenuOption( title: AppLocalizations.of(context)!.copyClipboard, icon: Icons.copy_rounded, @@ -421,6 +471,15 @@ class LogTile extends StatelessWidget { icon: Icons.add_rounded, action: openAddClient ), + MenuOption( + title: log.clientInfo!.disallowed == true + ? AppLocalizations.of(context)!.allowThisClient + : AppLocalizations.of(context)!.disallowThisClient, + icon: log.clientInfo!.disallowed == true + ? Icons.check_rounded + : Icons.block_rounded, + action: allowDisallowClient + ), if (log.question.name != null) MenuOption( title: AppLocalizations.of(context)!.copyClipboard, icon: Icons.copy_rounded,