diff --git a/lib/Components/color_picker_input_container.dart b/lib/Components/color_picker_input_container.dart index d8593fe..eab75e4 100644 --- a/lib/Components/color_picker_input_container.dart +++ b/lib/Components/color_picker_input_container.dart @@ -7,6 +7,7 @@ class ColorPickerInputContainer extends StatefulWidget { final String label; final double fontSize; final ValueChanged onChanged; + final bool showHex; const ColorPickerInputContainer({ Key? key, @@ -14,6 +15,7 @@ class ColorPickerInputContainer extends StatefulWidget { required this.label, this.fontSize = 18, required this.onChanged, + this.showHex = false, }) : super(key: key); @override @@ -70,14 +72,31 @@ class _ColorPickerInputContainerState extends State { widget.onChanged(colorToString(color)); }, context); }, - child: Container( - width: 50, - height: 50, - decoration: BoxDecoration( - color: colorVar, - borderRadius: BorderRadius.circular(10), - border: Border.all(color: Colors.black26), - ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 50, + height: 50, + decoration: BoxDecoration( + color: colorVar, + borderRadius: BorderRadius.circular(10), + border: Border.all(color: Colors.black26), + ), + ), + if (widget.showHex) + Padding( + padding: const EdgeInsets.only(left: 10), + child: Text( + '#${colorVar.toARGB32().toRadixString(16).substring(2).toUpperCase()}', + style: const TextStyle( + fontSize: 13, + fontFamily: 'monospace', + color: Colors.black54, + ), + ), + ), + ], ), ), ), diff --git a/lib/Components/geometry_input_container.dart b/lib/Components/geometry_input_container.dart index ad774a1..e53f7b7 100644 --- a/lib/Components/geometry_input_container.dart +++ b/lib/Components/geometry_input_container.dart @@ -10,6 +10,7 @@ class GeometryInputContainer extends StatelessWidget { final Function(GeometryDTO, String) onSave; final Color color; final bool isSmall; + final bool showColorButton; GeometryInputContainer({ required this.label, @@ -18,6 +19,7 @@ class GeometryInputContainer extends StatelessWidget { required this.onSave, this.color = kPrimaryColor, this.isSmall = false, + this.showColorButton = true, }); @override @@ -58,6 +60,7 @@ class GeometryInputContainer extends StatelessWidget { initialGeometry: initialGeometry, initialColor: initialColor, onSave: onSave, + showColorButton: showColorButton, ), ); }, diff --git a/lib/Components/map_geometry_picker.dart b/lib/Components/map_geometry_picker.dart index a0fc204..0db6c43 100644 --- a/lib/Components/map_geometry_picker.dart +++ b/lib/Components/map_geometry_picker.dart @@ -11,11 +11,13 @@ class MapGeometryPicker extends StatefulWidget { final GeometryDTO? initialGeometry; final String? initialColor; final Function(GeometryDTO, String) onSave; + final bool showColorButton; MapGeometryPicker({ this.initialGeometry, this.initialColor, required this.onSave, + this.showColorButton = true, }); @override @@ -143,14 +145,18 @@ class _MapGeometryPickerState extends State { fontWeight: FontWeight.bold)), Row( children: [ - IconButton( - icon: Icon(Icons.palette, color: Colors.white), - onPressed: () { - showColorPicker(selectedColor, (Color color) { - setState(() => selectedColor = color); - }, context); - }, - ), + // Couleur non stockée pour toutes les entités (ex. GuidedStepDTO n'a pas + // de champ color) : masqué via showColorButton plutôt que supprimé, pour + // ne pas casser les cas où elle l'est (ex. MapAnnotationDTO.polyColor). + if (widget.showColorButton) + IconButton( + icon: Icon(Icons.palette, color: Colors.white), + onPressed: () { + showColorPicker(selectedColor, (Color color) { + setState(() => selectedColor = color); + }, context); + }, + ), IconButton( icon: Icon(Icons.delete, color: Colors.white), onPressed: () => setState(() => points.clear()), diff --git a/lib/Components/quota_bars_widget.dart b/lib/Components/quota_bars_widget.dart index 7b3e66f..1902d7c 100644 --- a/lib/Components/quota_bars_widget.dart +++ b/lib/Components/quota_bars_widget.dart @@ -60,6 +60,12 @@ class _QuotaBarsWidgetState extends State { return '${(bytes / (1024 * 1024 * 1024)).toStringAsFixed(2)} GB'; } + String _formatTokens(int tokens) { + if (tokens < 1000) return '$tokens'; + if (tokens < 1000000) return '${(tokens / 1000).toStringAsFixed(0)}K'; + return '${(tokens / 1000000).toStringAsFixed(1)}M'; + } + @override Widget build(BuildContext context) { final managerContext = Provider.of(context).getContext() as ManagerAppContext; @@ -77,8 +83,8 @@ class _QuotaBarsWidgetState extends State { final storageUsed = _quota!.storageUsedBytes ?? 0; final storageQuota = _quota!.storageQuotaBytes ?? 0; - final aiUsed = _quota!.aiRequestsUsed ?? 0; - final aiQuota = _quota!.aiRequestsPerMonth ?? 0; + final aiUsed = _quota!.aiTokensUsed ?? 0; + final aiQuota = _quota!.aiTokensPerMonth ?? 0; return Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0), @@ -102,8 +108,8 @@ class _QuotaBarsWidgetState extends State { value: _barValue(aiUsed, aiQuota), color: _barColor(aiUsed, aiQuota), subtitle: aiQuota == 0 - ? '$aiUsed ${l10n.requestsAbbr} · ${l10n.unlimited}' - : '$aiUsed / $aiQuota ${l10n.requestsAbbr}.', + ? '${_formatTokens(aiUsed)} ${l10n.tokensAbbr} · ${l10n.unlimited}' + : '${_formatTokens(aiUsed)} / ${_formatTokens(aiQuota)} ${l10n.tokensAbbr}', ), ], ], diff --git a/lib/Components/switch_input_container.dart b/lib/Components/switch_input_container.dart new file mode 100644 index 0000000..2a80c74 --- /dev/null +++ b/lib/Components/switch_input_container.dart @@ -0,0 +1,93 @@ +import 'package:flutter/material.dart'; + +import '../constants.dart'; + +class SwitchInputContainer extends StatefulWidget { + final bool? isChecked; + final IconData? icon; + final String label; + final String? subtitle; + final ValueChanged onChanged; + final double fontSize; + const SwitchInputContainer({ + Key? key, + this.isChecked, + this.icon, + required this.label, + this.subtitle, + required this.onChanged, + this.fontSize = 18 + }) : super(key: key); + + @override + _SwitchInputContainerState createState() => _SwitchInputContainerState(); +} + +class _SwitchInputContainerState extends State { + bool? isChecked; + + @override + void initState() { + setState(() { + isChecked = widget.isChecked; + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + child: Row( + children: [ + Align( + alignment: AlignmentDirectional.centerStart, + child: Row( + children: [ + if (widget.icon != null) + Padding( + padding: const EdgeInsets.only(right: 8.0), + child: Icon( + widget.icon, + color: kPrimaryColor, + size: 25.0, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + widget.label, + style: TextStyle(fontSize: widget.fontSize, fontWeight: FontWeight.w300) + ), + if (widget.subtitle != null) + Padding( + padding: const EdgeInsets.only(top: 2), + child: Text( + widget.subtitle!, + style: TextStyle(fontSize: 12, color: Colors.grey[600]), + ), + ), + ], + ), + ], + ) + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Switch( + value: isChecked ?? false, + activeThumbColor: kPrimaryColor, + onChanged: (bool value) { + setState(() { + isChecked = value; + }); + widget.onChanged(value); + }, + ), + ), + ], + ), + ); + } +} diff --git a/lib/Screens/Configurations/Section/SubSection/Parcours/showNewOrUpdateGuidedStep.dart b/lib/Screens/Configurations/Section/SubSection/Parcours/showNewOrUpdateGuidedStep.dart index 28b86fb..b26e588 100644 --- a/lib/Screens/Configurations/Section/SubSection/Parcours/showNewOrUpdateGuidedStep.dart +++ b/lib/Screens/Configurations/Section/SubSection/Parcours/showNewOrUpdateGuidedStep.dart @@ -127,6 +127,10 @@ void showNewOrUpdateGuidedStep( label: AppLocalizations.of(context)!.stepLocationLabel, initialGeometry: workingStep.geometry, initialColor: null, + // GuidedStepDTO n'a pas de champ color (contrairement à + // MapAnnotationDTO.polyColor) : bouton masqué plutôt que + // supprimé, ne pas retirer comme du code mort. + showColorButton: false, onSave: (geometry, color) { setState(() { workingStep.geometry = geometry; diff --git a/lib/Screens/Kiosk_devices/change_device_info_modal.dart b/lib/Screens/Kiosk_devices/change_device_info_modal.dart index b346e5b..6b2c7df 100644 --- a/lib/Screens/Kiosk_devices/change_device_info_modal.dart +++ b/lib/Screens/Kiosk_devices/change_device_info_modal.dart @@ -1,11 +1,9 @@ import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:manager_app/Components/check_input_container.dart'; import 'package:manager_app/Components/color_picker_input_container.dart'; -import 'package:manager_app/Components/message_notification.dart'; -import 'package:manager_app/Components/number_input_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; +import 'package:manager_app/Components/slider_input_container.dart'; import 'package:manager_app/Components/string_input_container.dart'; +import 'package:manager_app/Components/switch_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; @@ -38,7 +36,7 @@ showChangeInfo(String text, DeviceDTO inputDevice, AppConfigurationLinkDTO appCo mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - // Nom + Configuration + _sectionTitle("Identité"), Wrap( spacing: 16, runSpacing: 12, @@ -85,8 +83,8 @@ showChangeInfo(String text, DeviceDTO inputDevice, AppConfigurationLinkDTO appCo ), ], ), - const SizedBox(height: 12), - // Couleurs + Loader + const Divider(height: 32), + _sectionTitle("Apparence"), Wrap( spacing: 16, runSpacing: 12, @@ -95,12 +93,14 @@ showChangeInfo(String text, DeviceDTO inputDevice, AppConfigurationLinkDTO appCo label: "Couleur principale :", fontSize: 16, color: appConfiguration.primaryColor, + showHex: true, onChanged: (value) => appConfiguration.primaryColor = value, ), ColorPickerInputContainer( label: AppLocalizations.of(context)!.backgroundColorLabel, fontSize: 16, color: appConfiguration.secondaryColor, + showHex: true, onChanged: (value) => appConfiguration.secondaryColor = value, ), ResourceInputContainer( @@ -120,67 +120,47 @@ showChangeInfo(String text, DeviceDTO inputDevice, AppConfigurationLinkDTO appCo ), ], ), - const SizedBox(height: 12), - // Pourcentages - Wrap( - spacing: 16, - runSpacing: 12, - children: [ - SizedBox( - height: 90, - child: NumberInputContainer( - label: "Place des sections (%) :", - initialValue: appConfiguration.screenPercentageSectionsMainPage ?? 0, - isSmall: true, - maxLength: 3, - onChanged: (value) { - try { - appConfiguration.screenPercentageSectionsMainPage = int.parse(value); - } catch (e) { - showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null); - } - }, - ), - ), - SizedBox( - height: 90, - child: NumberInputContainer( - label: "Pourcentage des arrondis (0-50) :", - initialValue: appConfiguration.roundedValue ?? 0, - isSmall: true, - maxLength: 2, - onChanged: (value) { - try { - appConfiguration.roundedValue = int.parse(value); - } catch (e) { - showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null); - } - }, - ), - ), - ], + const Divider(height: 32), + _sectionTitle("Mise en page"), + SliderInputContainer( + label: "Place des sections (%) :", + fontSize: 16, + initialValue: (appConfiguration.screenPercentageSectionsMainPage ?? 0).toDouble(), + min: 0, + max: 100, + color: kPrimaryColor, + onChanged: (value) => appConfiguration.screenPercentageSectionsMainPage = value.round(), ), - const SizedBox(height: 12), - // Toggles + SliderInputContainer( + label: "Pourcentage des arrondis (0-50) :", + fontSize: 16, + initialValue: (appConfiguration.roundedValue ?? 0).toDouble(), + min: 0, + max: 50, + color: kPrimaryColor, + onChanged: (value) => appConfiguration.roundedValue = value.round(), + ), + const Divider(height: 32), + _sectionTitle("Options"), Wrap( spacing: 16, runSpacing: 8, children: [ - CheckInputContainer( + SwitchInputContainer( icon: Icons.image, label: "Fond pour les images des sections :", fontSize: 16, isChecked: appConfiguration.isSectionImageBackground, onChanged: (value) => appConfiguration.isSectionImageBackground = value, ), - CheckInputContainer( + SwitchInputContainer( icon: Icons.watch_later_outlined, label: "Heure :", fontSize: 16, isChecked: appConfiguration.isHour, onChanged: (value) => appConfiguration.isHour = value, ), - CheckInputContainer( + SwitchInputContainer( icon: Icons.date_range, label: "Date :", fontSize: 16, @@ -227,6 +207,13 @@ showChangeInfo(String text, DeviceDTO inputDevice, AppConfigurationLinkDTO appCo ); } +Widget _sectionTitle(String title) { + return Padding( + padding: const EdgeInsets.only(bottom: 12), + child: Text(title, style: kSectionLabelStyle), + ); +} + getConfigurationsElement(DeviceDTO inputDevice, data, Function onGetResult) { List widgets = []; for (var configuration in data as List) { diff --git a/lib/Screens/Main/main_screen.dart b/lib/Screens/Main/main_screen.dart index 9b3742b..6c78637 100644 --- a/lib/Screens/Main/main_screen.dart +++ b/lib/Screens/Main/main_screen.dart @@ -118,7 +118,7 @@ class _MainScreenState extends State { ...planList.map((plan) => RadioListTile( title: Text(plan.name), subtitle: Text( - '${_formatQuotaBytes(plan.storageQuotaBytes, unlimitedLabel: AppLocalizations.of(dialogContext)!.unlimitedStorage)} · ${plan.aiRequestsPerMonth == 0 ? AppLocalizations.of(dialogContext)!.unlimitedAI : AppLocalizations.of(dialogContext)!.aiRequestsPerMonth(plan.aiRequestsPerMonth ?? 0)}', + '${_formatQuotaBytes(plan.storageQuotaBytes, unlimitedLabel: AppLocalizations.of(dialogContext)!.unlimitedStorage)} · ${plan.aiTokensPerMonth == 0 ? AppLocalizations.of(dialogContext)!.unlimitedAI : AppLocalizations.of(dialogContext)!.aiTokensPerMonth(_formatTokens(plan.aiTokensPerMonth))}', style: const TextStyle(fontSize: 11), ), value: plan.id, @@ -150,7 +150,7 @@ class _MainScreenState extends State { isWeb: instanceDetail?.isWeb, isVR: instanceDetail?.isVR, isAssistant: instanceDetail?.isAssistant, - aiRequestsThisMonth: instanceDetail?.aiRequestsThisMonth, + aiTokensThisMonth: instanceDetail?.aiTokensThisMonth, aiUsageMonthKey: instanceDetail?.aiUsageMonthKey, subscriptionPlanId: selectedPlanId ?? '', ), @@ -179,6 +179,13 @@ class _MainScreenState extends State { return '${(bytes / (1024 * 1024 * 1024)).toStringAsFixed(1)} GB'; } + static String _formatTokens(int? tokens) { + if (tokens == null || tokens == 0) return '0'; + if (tokens < 1000) return '$tokens'; + if (tokens < 1000000) return '${(tokens / 1000).toStringAsFixed(0)}K'; + return '${(tokens / 1000000).toStringAsFixed(1)}M'; + } + Future _showSwitchInstanceDialog(BuildContext context, ManagerAppContext managerCtx) async { List? instances; try { diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 344bf7a..1361c34 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -31,16 +31,17 @@ "noPlan": "No plan (unlimited)", "unlimitedStorage": "Unlimited storage", "unlimitedAI": "Unlimited AI", - "aiRequestsPerMonth": "{count} AI req/month", - "@aiRequestsPerMonth": { + "aiTokensPerMonth": "{amount} AI tokens/month", + "@aiTokensPerMonth": { "placeholders": { - "count": { "type": "int" } + "amount": { "type": "String" } } }, "storageLabel": "Storage", "aiThisMonthLabel": "AI this month", "unlimited": "Unlimited", "requestsAbbr": "req", + "tokensAbbr": "tokens", "planUpdated": "Plan updated", "errorMessage": "Error: {error}", "@errorMessage": { diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index 9bb9dd3..cd21fb1 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -31,16 +31,17 @@ "noPlan": "Aucun plan (illimité)", "unlimitedStorage": "Stockage illimité", "unlimitedAI": "IA illimitée", - "aiRequestsPerMonth": "{count} req IA/mois", - "@aiRequestsPerMonth": { + "aiTokensPerMonth": "{amount} tokens IA/mois", + "@aiTokensPerMonth": { "placeholders": { - "count": { "type": "int" } + "amount": { "type": "String" } } }, "storageLabel": "Stockage", "aiThisMonthLabel": "IA ce mois", "unlimited": "Illimité", "requestsAbbr": "req", + "tokensAbbr": "tokens", "planUpdated": "Plan mis à jour", "errorMessage": "Erreur : {error}", "@errorMessage": { diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 2558db5..f5efb4e 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -262,11 +262,11 @@ abstract class AppLocalizations { /// **'IA illimitée'** String get unlimitedAI; - /// No description provided for @aiRequestsPerMonth. + /// No description provided for @aiTokensPerMonth. /// /// In fr, this message translates to: - /// **'{count} req IA/mois'** - String aiRequestsPerMonth(int count); + /// **'{amount} tokens IA/mois'** + String aiTokensPerMonth(String amount); /// No description provided for @storageLabel. /// @@ -292,6 +292,12 @@ abstract class AppLocalizations { /// **'req'** String get requestsAbbr; + /// No description provided for @tokensAbbr. + /// + /// In fr, this message translates to: + /// **'tokens'** + String get tokensAbbr; + /// No description provided for @planUpdated. /// /// In fr, this message translates to: diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 2e94fbc..a3b27f6 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -90,8 +90,8 @@ class AppLocalizationsEn extends AppLocalizations { String get unlimitedAI => 'Unlimited AI'; @override - String aiRequestsPerMonth(int count) { - return '$count AI req/month'; + String aiTokensPerMonth(String amount) { + return '$amount AI tokens/month'; } @override @@ -106,6 +106,9 @@ class AppLocalizationsEn extends AppLocalizations { @override String get requestsAbbr => 'req'; + @override + String get tokensAbbr => 'tokens'; + @override String get planUpdated => 'Plan updated'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index e0d6e96..a98f15b 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -91,8 +91,8 @@ class AppLocalizationsFr extends AppLocalizations { String get unlimitedAI => 'IA illimitée'; @override - String aiRequestsPerMonth(int count) { - return '$count req IA/mois'; + String aiTokensPerMonth(String amount) { + return '$amount tokens IA/mois'; } @override @@ -107,6 +107,9 @@ class AppLocalizationsFr extends AppLocalizations { @override String get requestsAbbr => 'req'; + @override + String get tokensAbbr => 'tokens'; + @override String get planUpdated => 'Plan mis à jour'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index a7f9e26..5dbcdc9 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -91,8 +91,8 @@ class AppLocalizationsNl extends AppLocalizations { String get unlimitedAI => 'Onbeperkte AI'; @override - String aiRequestsPerMonth(int count) { - return '$count AI-verz./maand'; + String aiTokensPerMonth(String amount) { + return '$amount AI-tokens/maand'; } @override @@ -107,6 +107,9 @@ class AppLocalizationsNl extends AppLocalizations { @override String get requestsAbbr => 'verz.'; + @override + String get tokensAbbr => 'tokens'; + @override String get planUpdated => 'Plan bijgewerkt'; diff --git a/lib/l10n/app_nl.arb b/lib/l10n/app_nl.arb index 0176081..d407044 100644 --- a/lib/l10n/app_nl.arb +++ b/lib/l10n/app_nl.arb @@ -31,16 +31,17 @@ "noPlan": "Geen plan (onbeperkt)", "unlimitedStorage": "Onbeperkte opslag", "unlimitedAI": "Onbeperkte AI", - "aiRequestsPerMonth": "{count} AI-verz./maand", - "@aiRequestsPerMonth": { + "aiTokensPerMonth": "{amount} AI-tokens/maand", + "@aiTokensPerMonth": { "placeholders": { - "count": { "type": "int" } + "amount": { "type": "String" } } }, "storageLabel": "Opslag", "aiThisMonthLabel": "AI deze maand", "unlimited": "Onbeperkt", "requestsAbbr": "verz.", + "tokensAbbr": "tokens", "planUpdated": "Plan bijgewerkt", "errorMessage": "Fout: {error}", "@errorMessage": { diff --git a/manager_api_new/lib/model/instance_dto.dart b/manager_api_new/lib/model/instance_dto.dart index 6ce5230..3c4f500 100644 --- a/manager_api_new/lib/model/instance_dto.dart +++ b/manager_api_new/lib/model/instance_dto.dart @@ -25,10 +25,10 @@ class InstanceDTO { this.isAssistant, this.subscriptionPlanId, this.subscriptionPlan, - this.aiRequestsThisMonth, + this.aiTokensThisMonth, this.aiUsageMonthKey, this.storageQuotaBytes, - this.aiRequestsPerMonth, + this.aiTokensPerMonth, this.hasStats, this.statsHistoryDays, this.hasAdvancedStats, @@ -98,13 +98,13 @@ class InstanceDTO { SubscriptionPlanDTO? subscriptionPlan; - int? aiRequestsThisMonth; + int? aiTokensThisMonth; String? aiUsageMonthKey; int? storageQuotaBytes; - int? aiRequestsPerMonth; + int? aiTokensPerMonth; bool? hasStats; @@ -134,10 +134,10 @@ class InstanceDTO { other.isAssistant == isAssistant && other.subscriptionPlanId == subscriptionPlanId && other.subscriptionPlan == subscriptionPlan && - other.aiRequestsThisMonth == aiRequestsThisMonth && + other.aiTokensThisMonth == aiTokensThisMonth && other.aiUsageMonthKey == aiUsageMonthKey && other.storageQuotaBytes == storageQuotaBytes && - other.aiRequestsPerMonth == aiRequestsPerMonth && + other.aiTokensPerMonth == aiTokensPerMonth && other.hasStats == hasStats && other.statsHistoryDays == statsHistoryDays && other.hasAdvancedStats == hasAdvancedStats && @@ -159,13 +159,13 @@ class InstanceDTO { (isAssistant == null ? 0 : isAssistant!.hashCode) + (subscriptionPlanId == null ? 0 : subscriptionPlanId!.hashCode) + (subscriptionPlan == null ? 0 : subscriptionPlan!.hashCode) + - (aiRequestsThisMonth == null ? 0 : aiRequestsThisMonth!.hashCode) + + (aiTokensThisMonth == null ? 0 : aiTokensThisMonth!.hashCode) + (aiUsageMonthKey == null ? 0 : aiUsageMonthKey!.hashCode) + (applicationInstanceDTOs == null ? 0 : applicationInstanceDTOs!.hashCode); @override String toString() => - 'InstanceDTO[id=$id, name=$name, dateCreation=$dateCreation, pinCode=$pinCode, isPushNotification=$isPushNotification, isMobile=$isMobile, isTablet=$isTablet, isWeb=$isWeb, isVR=$isVR, isAssistant=$isAssistant, subscriptionPlanId=$subscriptionPlanId, subscriptionPlan=$subscriptionPlan, aiRequestsThisMonth=$aiRequestsThisMonth, aiUsageMonthKey=$aiUsageMonthKey, applicationInstanceDTOs=$applicationInstanceDTOs]'; + 'InstanceDTO[id=$id, name=$name, dateCreation=$dateCreation, pinCode=$pinCode, isPushNotification=$isPushNotification, isMobile=$isMobile, isTablet=$isTablet, isWeb=$isWeb, isVR=$isVR, isAssistant=$isAssistant, subscriptionPlanId=$subscriptionPlanId, subscriptionPlan=$subscriptionPlan, aiTokensThisMonth=$aiTokensThisMonth, aiUsageMonthKey=$aiUsageMonthKey, applicationInstanceDTOs=$applicationInstanceDTOs]'; Map toJson() { final json = {}; @@ -229,10 +229,10 @@ class InstanceDTO { } else { json[r'subscriptionPlan'] = null; } - if (this.aiRequestsThisMonth != null) { - json[r'aiRequestsThisMonth'] = this.aiRequestsThisMonth; + if (this.aiTokensThisMonth != null) { + json[r'aiTokensThisMonth'] = this.aiTokensThisMonth; } else { - json[r'aiRequestsThisMonth'] = null; + json[r'aiTokensThisMonth'] = null; } if (this.aiUsageMonthKey != null) { json[r'aiUsageMonthKey'] = this.aiUsageMonthKey; @@ -244,10 +244,10 @@ class InstanceDTO { } else { json[r'storageQuotaBytes'] = null; } - if (this.aiRequestsPerMonth != null) { - json[r'aiRequestsPerMonth'] = this.aiRequestsPerMonth; + if (this.aiTokensPerMonth != null) { + json[r'aiTokensPerMonth'] = this.aiTokensPerMonth; } else { - json[r'aiRequestsPerMonth'] = null; + json[r'aiTokensPerMonth'] = null; } if (this.hasStats != null) { json[r'hasStats'] = this.hasStats; @@ -315,10 +315,10 @@ class InstanceDTO { isAssistant: mapValueOfType(json, r'isAssistant'), subscriptionPlanId: mapValueOfType(json, r'subscriptionPlanId'), subscriptionPlan: SubscriptionPlanDTO.fromJson(json[r'subscriptionPlan']), - aiRequestsThisMonth: mapValueOfType(json, r'aiRequestsThisMonth'), + aiTokensThisMonth: mapValueOfType(json, r'aiTokensThisMonth'), aiUsageMonthKey: mapValueOfType(json, r'aiUsageMonthKey'), storageQuotaBytes: mapValueOfType(json, r'storageQuotaBytes'), - aiRequestsPerMonth: mapValueOfType(json, r'aiRequestsPerMonth'), + aiTokensPerMonth: mapValueOfType(json, r'aiTokensPerMonth'), hasStats: mapValueOfType(json, r'hasStats'), statsHistoryDays: mapValueOfType(json, r'statsHistoryDays'), hasAdvancedStats: mapValueOfType(json, r'hasAdvancedStats'), diff --git a/manager_api_new/lib/model/instance_quota_dto.dart b/manager_api_new/lib/model/instance_quota_dto.dart index ce64620..1c3885f 100644 --- a/manager_api_new/lib/model/instance_quota_dto.dart +++ b/manager_api_new/lib/model/instance_quota_dto.dart @@ -15,17 +15,17 @@ class InstanceQuotaDTO { InstanceQuotaDTO({ this.storageUsedBytes, this.storageQuotaBytes, - this.aiRequestsUsed, - this.aiRequestsPerMonth, + this.aiTokensUsed, + this.aiTokensPerMonth, }); int? storageUsedBytes; int? storageQuotaBytes; - int? aiRequestsUsed; + int? aiTokensUsed; - int? aiRequestsPerMonth; + int? aiTokensPerMonth; @override bool operator ==(Object other) => @@ -33,19 +33,19 @@ class InstanceQuotaDTO { other is InstanceQuotaDTO && other.storageUsedBytes == storageUsedBytes && other.storageQuotaBytes == storageQuotaBytes && - other.aiRequestsUsed == aiRequestsUsed && - other.aiRequestsPerMonth == aiRequestsPerMonth; + other.aiTokensUsed == aiTokensUsed && + other.aiTokensPerMonth == aiTokensPerMonth; @override int get hashCode => (storageUsedBytes == null ? 0 : storageUsedBytes!.hashCode) + (storageQuotaBytes == null ? 0 : storageQuotaBytes!.hashCode) + - (aiRequestsUsed == null ? 0 : aiRequestsUsed!.hashCode) + - (aiRequestsPerMonth == null ? 0 : aiRequestsPerMonth!.hashCode); + (aiTokensUsed == null ? 0 : aiTokensUsed!.hashCode) + + (aiTokensPerMonth == null ? 0 : aiTokensPerMonth!.hashCode); @override String toString() => - 'InstanceQuotaDTO[storageUsedBytes=$storageUsedBytes, storageQuotaBytes=$storageQuotaBytes, aiRequestsUsed=$aiRequestsUsed, aiRequestsPerMonth=$aiRequestsPerMonth]'; + 'InstanceQuotaDTO[storageUsedBytes=$storageUsedBytes, storageQuotaBytes=$storageQuotaBytes, aiTokensUsed=$aiTokensUsed, aiTokensPerMonth=$aiTokensPerMonth]'; Map toJson() { final json = {}; @@ -59,15 +59,15 @@ class InstanceQuotaDTO { } else { json[r'storageQuotaBytes'] = null; } - if (this.aiRequestsUsed != null) { - json[r'aiRequestsUsed'] = this.aiRequestsUsed; + if (this.aiTokensUsed != null) { + json[r'aiTokensUsed'] = this.aiTokensUsed; } else { - json[r'aiRequestsUsed'] = null; + json[r'aiTokensUsed'] = null; } - if (this.aiRequestsPerMonth != null) { - json[r'aiRequestsPerMonth'] = this.aiRequestsPerMonth; + if (this.aiTokensPerMonth != null) { + json[r'aiTokensPerMonth'] = this.aiTokensPerMonth; } else { - json[r'aiRequestsPerMonth'] = null; + json[r'aiTokensPerMonth'] = null; } return json; } @@ -79,8 +79,8 @@ class InstanceQuotaDTO { return InstanceQuotaDTO( storageUsedBytes: mapValueOfType(json, r'storageUsedBytes'), storageQuotaBytes: mapValueOfType(json, r'storageQuotaBytes'), - aiRequestsUsed: mapValueOfType(json, r'aiRequestsUsed'), - aiRequestsPerMonth: mapValueOfType(json, r'aiRequestsPerMonth'), + aiTokensUsed: mapValueOfType(json, r'aiTokensUsed'), + aiTokensPerMonth: mapValueOfType(json, r'aiTokensPerMonth'), ); } return null; diff --git a/manager_api_new/lib/model/subscription_plan_dto.dart b/manager_api_new/lib/model/subscription_plan_dto.dart index d7ccefb..c65a8a4 100644 --- a/manager_api_new/lib/model/subscription_plan_dto.dart +++ b/manager_api_new/lib/model/subscription_plan_dto.dart @@ -16,7 +16,7 @@ class SubscriptionPlanDTO { this.id, required this.name, this.storageQuotaBytes, - this.aiRequestsPerMonth, + this.aiTokensPerMonth, this.statsHistoryDays, this.hasAdvancedStats, }); @@ -27,7 +27,7 @@ class SubscriptionPlanDTO { int? storageQuotaBytes; - int? aiRequestsPerMonth; + int? aiTokensPerMonth; int? statsHistoryDays; @@ -40,7 +40,7 @@ class SubscriptionPlanDTO { other.id == id && other.name == name && other.storageQuotaBytes == storageQuotaBytes && - other.aiRequestsPerMonth == aiRequestsPerMonth && + other.aiTokensPerMonth == aiTokensPerMonth && other.statsHistoryDays == statsHistoryDays && other.hasAdvancedStats == hasAdvancedStats; @@ -49,13 +49,13 @@ class SubscriptionPlanDTO { (id == null ? 0 : id!.hashCode) + (name.hashCode) + (storageQuotaBytes == null ? 0 : storageQuotaBytes!.hashCode) + - (aiRequestsPerMonth == null ? 0 : aiRequestsPerMonth!.hashCode) + + (aiTokensPerMonth == null ? 0 : aiTokensPerMonth!.hashCode) + (statsHistoryDays == null ? 0 : statsHistoryDays!.hashCode) + (hasAdvancedStats == null ? 0 : hasAdvancedStats!.hashCode); @override String toString() => - 'SubscriptionPlanDTO[id=$id, name=$name, storageQuotaBytes=$storageQuotaBytes, aiRequestsPerMonth=$aiRequestsPerMonth, statsHistoryDays=$statsHistoryDays, hasAdvancedStats=$hasAdvancedStats]'; + 'SubscriptionPlanDTO[id=$id, name=$name, storageQuotaBytes=$storageQuotaBytes, aiTokensPerMonth=$aiTokensPerMonth, statsHistoryDays=$statsHistoryDays, hasAdvancedStats=$hasAdvancedStats]'; Map toJson() { final json = {}; @@ -70,10 +70,10 @@ class SubscriptionPlanDTO { } else { json[r'storageQuotaBytes'] = null; } - if (this.aiRequestsPerMonth != null) { - json[r'aiRequestsPerMonth'] = this.aiRequestsPerMonth; + if (this.aiTokensPerMonth != null) { + json[r'aiTokensPerMonth'] = this.aiTokensPerMonth; } else { - json[r'aiRequestsPerMonth'] = null; + json[r'aiTokensPerMonth'] = null; } if (this.statsHistoryDays != null) { json[r'statsHistoryDays'] = this.statsHistoryDays; @@ -96,7 +96,7 @@ class SubscriptionPlanDTO { id: mapValueOfType(json, r'id'), name: mapValueOfType(json, r'name') ?? '', storageQuotaBytes: mapValueOfType(json, r'storageQuotaBytes'), - aiRequestsPerMonth: mapValueOfType(json, r'aiRequestsPerMonth'), + aiTokensPerMonth: mapValueOfType(json, r'aiTokensPerMonth'), statsHistoryDays: mapValueOfType(json, r'statsHistoryDays'), hasAdvancedStats: mapValueOfType(json, r'hasAdvancedStats'), );