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',
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(
key: 'FRE-HUB-VEHICLES',
icon: Icons.directions_car,

View File

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

View File

@ -107,7 +107,7 @@ class VehicleModel extends FlutterFlowModel<VehiclePage> {
Future<void> initAsync() async {}
Map<String, Color> generateStatusColorMap(dynamic uItem) {
Map<String, Color>? generateStatusColorMap(dynamic uItem) {
final statusMap = {
"ATI": {
"text": FFLocalizations.of(context).getVariableText(
@ -162,7 +162,7 @@ class VehicleModel extends FlutterFlowModel<VehiclePage> {
return {};
}
List<FFButtonWidget> generateActionButtons(dynamic item) {
List<FFButtonWidget>? generateActionButtons(dynamic item) {
final Color iconButtonColor = FlutterFlowTheme.of(context).primaryText;
final FFButtonOptions buttonOptions = FFButtonOptions(
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/templates_components/card_item_template_component/card_item_template_component_widget.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_theme.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/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/limited_text_size.dart';
@ -21,7 +23,6 @@ part 'vehicle_register_screen.dart';
part 'vehicle_update_screen.dart';
/// [VehiclePage] is a StatefulWidget that displays the vehicle screens.
class VehiclePage extends StatefulWidget {
const VehiclePage({super.key});
@ -65,18 +66,55 @@ class _VehiclePageState extends State<VehiclePage> with TickerProviderStateMixin
return Scaffold(
backgroundColor: backgroundColor,
appBar: _buildAppBar(context),
body: _buildBody(context),
body: buildBody(context),
);
}
/// [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) {
setState(() {
_model.handleEditingChanged(value);
});
}
Widget _buildBody(BuildContext context) {
Widget _buildVehicleHistory(BuildContext context) {
return VehicleHistoryScreen(_model);
}
Widget _buildVehicleManager(BuildContext context) {
final vehicleHistoryScreenLabel =
FFLocalizations.of(context).getVariableText(ptText: 'Consultar', enText: 'History');
final vehicleRegisterScreenLabel =