licenes -> vehicle manager module

This commit is contained in:
J. A. Messias 2025-01-28 11:29:42 -03:00
parent e5bd18dec6
commit 3b7a33801f
4 changed files with 69 additions and 29 deletions

View File

@ -72,6 +72,16 @@ class MenuEntry implements BaseModule {
route: '/residentsOnThePropertyPage', route: '/residentsOnThePropertyPage',
types: [MenuEntryType.Property], types: [MenuEntryType.Property],
), ),
// MenuEntry(
// key: 'FRE-HUB-VEHICLES-MANAGER',
// icon: Icons.directions_car,
// name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(
// ptText: 'Veículos',
// enText: 'Vehicles',
// ),
// route: '/vehiclesOnThePropertyPage',
// types: [MenuEntryType.Property],
// ),
MenuEntry( MenuEntry(
key: 'FRE-HUB-VEHICLES', key: 'FRE-HUB-VEHICLES',
icon: Icons.directions_car, icon: Icons.directions_car,

View File

@ -10,6 +10,7 @@ enum LicenseKeys {
access('FRE-HUB-ACCESS'), access('FRE-HUB-ACCESS'),
openedVisits('FRE-HUB-OPENED-VISITS'), openedVisits('FRE-HUB-OPENED-VISITS'),
vehicles('FRE-HUB-VEHICLES'), vehicles('FRE-HUB-VEHICLES'),
vehiclesManager('FRE-HUB-VEHICLES-MANAGER'),
residents('FRE-HUB-RESIDENTS'), residents('FRE-HUB-RESIDENTS'),
about('FRE-HUB-ABOUT-SYSTEM'), about('FRE-HUB-ABOUT-SYSTEM'),
pets('FRE-HUB-PETS'), pets('FRE-HUB-PETS'),
@ -60,9 +61,7 @@ class License {
} }
static Future<String> _precessWpp() async { static Future<String> _precessWpp() async {
final bool whatsapp = await StorageHelper() final bool whatsapp = await StorageHelper().get(LocalsStorageKey.whatsapp.key).then((v) => v.toBoolean());
.get(LocalsStorageKey.whatsapp.key)
.then((v) => v.toBoolean());
if (whatsapp) if (whatsapp)
return ModuleStatus.active.key; return ModuleStatus.active.key;
else else
@ -70,9 +69,7 @@ class License {
} }
static Future<String> _processProvisional() async { static Future<String> _processProvisional() async {
final bool provisional = await StorageHelper() final bool provisional = await StorageHelper().get(LocalsStorageKey.provisional.key).then((v) => v.toBoolean());
.get(LocalsStorageKey.provisional.key)
.then((v) => v.toBoolean());
if (provisional) if (provisional)
return ModuleStatus.active.key; return ModuleStatus.active.key;
else else
@ -80,9 +77,7 @@ class License {
} }
static Future<String> _processPets() async { static Future<String> _processPets() async {
final bool pets = await StorageHelper() final bool pets = await StorageHelper().get(LocalsStorageKey.pets.key).then((v) => v.toBoolean());
.get(LocalsStorageKey.pets.key)
.then((v) => v.toBoolean());
if (pets) if (pets)
return ModuleStatus.active.key; return ModuleStatus.active.key;
else else
@ -139,27 +134,28 @@ class License {
), ),
Module( Module(
key: LicenseKeys.openedVisits.value, key: LicenseKeys.openedVisits.value,
display: isNewVersionWithModule display: isNewVersionWithModule ? ModuleStatus.active.key : ModuleStatus.inactive.key,
? ModuleStatus.active.key
: ModuleStatus.inactive.key,
expirationDate: '', expirationDate: '',
startDate: '', startDate: '',
quantity: 0, quantity: 0,
), ),
Module( Module(
key: LicenseKeys.vehicles.value, key: LicenseKeys.vehicles.value,
display: isNewVersionWithModule display: isNewVersionWithModule ? ModuleStatus.active.key : ModuleStatus.inactive.key,
? ModuleStatus.active.key expirationDate: '',
: ModuleStatus.inactive.key, startDate: '',
quantity: 0,
),
Module(
key: LicenseKeys.vehicles.value,
display: ModuleStatus.inactive.key,
expirationDate: '', expirationDate: '',
startDate: '', startDate: '',
quantity: 0, quantity: 0,
), ),
Module( Module(
key: LicenseKeys.residents.value, key: LicenseKeys.residents.value,
display: isNewVersionWithModule display: isNewVersionWithModule ? ModuleStatus.active.key : ModuleStatus.inactive.key,
? ModuleStatus.active.key
: ModuleStatus.inactive.key,
expirationDate: '', expirationDate: '',
startDate: '', startDate: '',
quantity: 0, quantity: 0,
@ -222,18 +218,14 @@ class License {
), ),
Module( Module(
key: LicenseKeys.property.value, key: LicenseKeys.property.value,
display: isNewVersionWithModule display: isNewVersionWithModule ? ModuleStatus.active.key : ModuleStatus.inactive.key,
? ModuleStatus.active.key
: ModuleStatus.inactive.key,
expirationDate: '', expirationDate: '',
startDate: '', startDate: '',
quantity: 0, quantity: 0,
), ),
Module( Module(
key: LicenseKeys.people.value, key: LicenseKeys.people.value,
display: isNewVersionWithModule display: isNewVersionWithModule ? ModuleStatus.inactive.key : ModuleStatus.active.key,
? ModuleStatus.inactive.key
: ModuleStatus.active.key,
expirationDate: '', expirationDate: '',
startDate: '', startDate: '',
quantity: 0, quantity: 0,

View File

@ -107,7 +107,7 @@ class VehicleModel extends FlutterFlowModel<VehiclePage> {
Future<void> initAsync() async {} Future<void> initAsync() async {}
Map<String, Color> generateStatusColorMap(dynamic uItem) { Map<String, Color>? generateStatusColorMap(dynamic uItem) {
final statusMap = { final statusMap = {
"ATI": { "ATI": {
"text": FFLocalizations.of(context).getVariableText( "text": FFLocalizations.of(context).getVariableText(
@ -162,7 +162,7 @@ class VehicleModel extends FlutterFlowModel<VehiclePage> {
return {}; return {};
} }
List<FFButtonWidget> generateActionButtons(dynamic item) { List<FFButtonWidget>? generateActionButtons(dynamic item) {
final Color iconButtonColor = FlutterFlowTheme.of(context).primaryText; final Color iconButtonColor = FlutterFlowTheme.of(context).primaryText;
final FFButtonOptions buttonOptions = FFButtonOptions( final FFButtonOptions buttonOptions = FFButtonOptions(
height: 40, height: 40,

View File

@ -7,9 +7,11 @@ import 'package:hub/components/atomic_components/shared_components_atoms/submit_
import 'package:hub/components/atomic_components/shared_components_atoms/tabview.dart'; import 'package:hub/components/atomic_components/shared_components_atoms/tabview.dart';
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart'; import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
import 'package:hub/features/backend/index.dart'; import 'package:hub/features/backend/index.dart';
import 'package:hub/features/module/index.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/index.dart';
import 'package:hub/pages/vehicles_on_the_property/vehicle_model.dart'; import 'package:hub/pages/vehicles_on_the_property/vehicle_model.dart';
import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/limited_text_size.dart'; import 'package:hub/shared/utils/limited_text_size.dart';
@ -21,7 +23,6 @@ part 'vehicle_register_screen.dart';
part 'vehicle_update_screen.dart'; part 'vehicle_update_screen.dart';
/// [VehiclePage] is a StatefulWidget that displays the vehicle screens. /// [VehiclePage] is a StatefulWidget that displays the vehicle screens.
class VehiclePage extends StatefulWidget { class VehiclePage extends StatefulWidget {
const VehiclePage({super.key}); const VehiclePage({super.key});
@ -65,18 +66,55 @@ class _VehiclePageState extends State<VehiclePage> with TickerProviderStateMixin
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: _buildAppBar(context), appBar: _buildAppBar(context),
body: _buildBody(context), body: buildBody(context),
); );
} }
/// [Body] of the page. /// [Body] of the page.
Widget buildBody(BuildContext context) {
Widget progressEvent() {
return CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(
FlutterFlowTheme.of(context).primary,
),
);
}
Widget errorEvent() {
WidgetsBinding.instance.addPostFrameCallback((_) async {
context.pop();
await DialogUtil.errorDefault(navigatorKey.currentContext!);
});
return progressEvent();
}
return FutureBuilder<String?>(
future: LicenseRepositoryImpl().getModule('FRE-HUB-VEHICLES-MANAGER'),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return progressEvent();
} else if (snapshot.hasError) {
return errorEvent();
} else if (snapshot.hasData && snapshot.data!.isNotEmpty) {
return _buildVehicleManager(context);
} else {
return _buildVehicleHistory(context);
}
},
);
}
void onEditingChanged(bool value) { void onEditingChanged(bool value) {
setState(() { setState(() {
_model.handleEditingChanged(value); _model.handleEditingChanged(value);
}); });
} }
Widget _buildBody(BuildContext context) { Widget _buildVehicleHistory(BuildContext context) {
return VehicleHistoryScreen(_model);
}
Widget _buildVehicleManager(BuildContext context) {
final vehicleHistoryScreenLabel = final vehicleHistoryScreenLabel =
FFLocalizations.of(context).getVariableText(ptText: 'Consultar', enText: 'History'); FFLocalizations.of(context).getVariableText(ptText: 'Consultar', enText: 'History');
final vehicleRegisterScreenLabel = final vehicleRegisterScreenLabel =