From 3cf791ddbf3c2a517775df30c8f0f20baad78c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Salazar?= <73718835+joshrs23@users.noreply.github.com> Date: Thu, 26 Feb 2026 11:17:01 -0500 Subject: [PATCH 1/3] merge with dev --- apps/mobile/devtools_options.yaml | 3 ++ .../connector/costCenter/mutations.gql | 26 ++++------- .../connector/costCenter/queries.gql | 45 ++++++------------- .../connector/teamHub/mutations.gql | 27 ++++++++++- .../dataconnect/connector/teamHub/queries.gql | 24 ++++++++++ backend/dataconnect/schema/costCenter.gql | 2 + backend/dataconnect/schema/hub.gql | 13 ------ backend/dataconnect/schema/teamHub.gql | 3 ++ 8 files changed, 81 insertions(+), 62 deletions(-) create mode 100644 apps/mobile/devtools_options.yaml delete mode 100644 backend/dataconnect/schema/hub.gql diff --git a/apps/mobile/devtools_options.yaml b/apps/mobile/devtools_options.yaml new file mode 100644 index 00000000..fa0b357c --- /dev/null +++ b/apps/mobile/devtools_options.yaml @@ -0,0 +1,3 @@ +description: This file stores settings for Dart & Flutter DevTools. +documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states +extensions: diff --git a/backend/dataconnect/connector/costCenter/mutations.gql b/backend/dataconnect/connector/costCenter/mutations.gql index d671a6d1..a85e9ea8 100644 --- a/backend/dataconnect/connector/costCenter/mutations.gql +++ b/backend/dataconnect/connector/costCenter/mutations.gql @@ -1,37 +1,29 @@ - -# ---------------------------------------------------------- -# CREATE COST CENTER -# ---------------------------------------------------------- mutation createCostCenter( $name: String! - $createdBy: String -) @auth(level: USER) { + $businessId: UUID! + ) @auth(level: USER) { costCenter_insert( - data: { + data: { name: $name - createdBy: $createdBy + businessId: $businessId } ) } -# ---------------------------------------------------------- -# UPDATE COST CENTER -# ---------------------------------------------------------- mutation updateCostCenter( $id: UUID! $name: String -) @auth(level: USER) { + $businessId: UUID + ) @auth(level: USER) { costCenter_update( - id: $id - data: { + id: $id, + data: { name: $name + businessId: $businessId } ) } -# ---------------------------------------------------------- -# DELETE COST CENTER -# ---------------------------------------------------------- mutation deleteCostCenter($id: UUID!) @auth(level: USER) { costCenter_delete(id: $id) } diff --git a/backend/dataconnect/connector/costCenter/queries.gql b/backend/dataconnect/connector/costCenter/queries.gql index 678afbe0..374b4617 100644 --- a/backend/dataconnect/connector/costCenter/queries.gql +++ b/backend/dataconnect/connector/costCenter/queries.gql @@ -1,47 +1,30 @@ - -# ---------------------------------------------------------- -# LIST ALL COST CENTERS -# ---------------------------------------------------------- -query listCostCenters( - $offset: Int - $limit: Int -) @auth(level: USER) { - costCenters(offset: $offset, limit: $limit) { +query listCostCenters @auth(level: USER) { + costCenters { id name - createdAt - updatedAt - createdBy + businessId } } -# ---------------------------------------------------------- -# GET BY ID -# ---------------------------------------------------------- query getCostCenterById($id: UUID!) @auth(level: USER) { costCenter(id: $id) { id name - createdAt - updatedAt - createdBy + businessId } } -# ---------------------------------------------------------- -# GET COST CENTER LINKED TO A SPECIFIC HUB -# ---------------------------------------------------------- -query getCostCenterByHubId($hubId: UUID!) @auth(level: USER) { - hubs(where: { id: { eq: $hubId } }) { +query filterCostCenters( + $name: String, + $businessId: UUID + ) @auth(level: USER) { + costCenters( + where: { + name: { eq: $name }, + businessId: { eq: $businessId } + }) { id name - costCenterId - costCenter { - id - name - createdAt - updatedAt - createdBy - } + businessId } } diff --git a/backend/dataconnect/connector/teamHub/mutations.gql b/backend/dataconnect/connector/teamHub/mutations.gql index adf57c42..2609c460 100644 --- a/backend/dataconnect/connector/teamHub/mutations.gql +++ b/backend/dataconnect/connector/teamHub/mutations.gql @@ -1,5 +1,6 @@ mutation createTeamHub( $teamId: UUID! + $costCenterId: UUID $hubName: String! $address: String! @@ -20,6 +21,7 @@ mutation createTeamHub( teamHub_insert( data: { teamId: $teamId + costCenterId: $costCenterId hubName: $hubName address: $address @@ -45,6 +47,7 @@ mutation updateTeamHub( $id: UUID! $teamId: UUID + $costCenterId: UUID $hubName: String $address: String @@ -67,6 +70,7 @@ mutation updateTeamHub( id: $id data: { teamId: $teamId + costCenterId: $costCenterId hubName: $hubName address: $address @@ -90,4 +94,25 @@ mutation updateTeamHub( mutation deleteTeamHub($id: UUID!) @auth(level: USER) { teamHub_delete(id: $id) -} \ No newline at end of file +} + +mutation assignCostCenterToTeamHub( + $id: UUID! + $costCenterId: UUID! +) @auth(level: USER) { + teamHub_update( + id: $id + data: { + costCenterId: $costCenterId + } + ) +} + +mutation removeCostCenterFromTeamHub($id: UUID!) @auth(level: USER) { + teamHub_update( + id: $id + data: { + costCenterId: null + } + ) +} diff --git a/backend/dataconnect/connector/teamHub/queries.gql b/backend/dataconnect/connector/teamHub/queries.gql index 19619802..b0fa2721 100644 --- a/backend/dataconnect/connector/teamHub/queries.gql +++ b/backend/dataconnect/connector/teamHub/queries.gql @@ -8,6 +8,7 @@ query listTeamHubs($offset: Int, $limit: Int) @auth(level: USER) { teamHubs(offset: $offset, limit: $limit, orderBy: { createdAt: DESC }) { id teamId + costCenterId hubName address @@ -24,6 +25,11 @@ query listTeamHubs($offset: Int, $limit: Int) @auth(level: USER) { managerName isActive departments + costCenter { + id + name + businessId + } } } @@ -32,6 +38,7 @@ query getTeamHubById($id: UUID!) @auth(level: USER) { teamHub(id: $id) { id teamId + costCenterId hubName address @@ -48,6 +55,11 @@ query getTeamHubById($id: UUID!) @auth(level: USER) { managerName isActive departments + costCenter { + id + name + businessId + } } } @@ -65,6 +77,7 @@ query getTeamHubsByTeamId( ) { id teamId + costCenterId hubName address @@ -81,6 +94,11 @@ query getTeamHubsByTeamId( managerName isActive departments + costCenter { + id + name + businessId + } } } @@ -105,6 +123,7 @@ query listTeamHubsByOwnerId( ) { id teamId + costCenterId hubName address @@ -121,6 +140,11 @@ query listTeamHubsByOwnerId( managerName isActive departments + costCenter { + id + name + businessId + } } } diff --git a/backend/dataconnect/schema/costCenter.gql b/backend/dataconnect/schema/costCenter.gql index 2001dd28..11537e6d 100644 --- a/backend/dataconnect/schema/costCenter.gql +++ b/backend/dataconnect/schema/costCenter.gql @@ -1,6 +1,8 @@ type CostCenter @table(name: "cost_centers") { id: UUID! @default(expr: "uuidV4()") name: String! + businessId: UUID! + createdAt: Timestamp @default(expr: "request.time") updatedAt: Timestamp @default(expr: "request.time") createdBy: String diff --git a/backend/dataconnect/schema/hub.gql b/backend/dataconnect/schema/hub.gql deleted file mode 100644 index 7f4c234d..00000000 --- a/backend/dataconnect/schema/hub.gql +++ /dev/null @@ -1,13 +0,0 @@ -type Hub @table(name: "hubs") { - id: UUID! @default(expr: "uuidV4()") - name: String! - locationName: String - address: String - nfcTagId: String - ownerId: UUID! - costCenterId: UUID - costCenter: CostCenter @ref(fields: "costCenterId", references: "id") - createdAt: Timestamp @default(expr: "request.time") - updatedAt: Timestamp @default(expr: "request.time") - createdBy: String -} diff --git a/backend/dataconnect/schema/teamHub.gql b/backend/dataconnect/schema/teamHub.gql index faece738..e522e64f 100644 --- a/backend/dataconnect/schema/teamHub.gql +++ b/backend/dataconnect/schema/teamHub.gql @@ -3,6 +3,9 @@ type TeamHub @table(name: "team_hubs") { teamId: UUID! team: Team! @ref(fields: "teamId", references: "id") + + costCenterId: UUID + costCenter: CostCenter @ref(fields: "costCenterId", references: "id") hubName: String! From 4b7b655ee8d7e525c0c8b03473fb1e803f0472c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Salazar?= <73718835+joshrs23@users.noreply.github.com> Date: Thu, 26 Feb 2026 11:18:56 -0500 Subject: [PATCH 2/3] teamhub is hub --- .../dataconnect/connector/hub/mutations.gql | 62 -------------- backend/dataconnect/connector/hub/queries.gql | 82 ------------------- 2 files changed, 144 deletions(-) delete mode 100644 backend/dataconnect/connector/hub/mutations.gql delete mode 100644 backend/dataconnect/connector/hub/queries.gql diff --git a/backend/dataconnect/connector/hub/mutations.gql b/backend/dataconnect/connector/hub/mutations.gql deleted file mode 100644 index 52bd8024..00000000 --- a/backend/dataconnect/connector/hub/mutations.gql +++ /dev/null @@ -1,62 +0,0 @@ -mutation createHub( - $name: String! - $locationName: String - $address: String - $nfcTagId: String - $ownerId: UUID! -) @auth(level: USER) { - hub_insert( - data: { - name: $name - locationName: $locationName - address: $address - nfcTagId: $nfcTagId - ownerId: $ownerId - } - ) -} - -mutation updateHub( - $id: UUID! - $name: String - $locationName: String - $address: String - $nfcTagId: String - $ownerId: UUID -) @auth(level: USER) { - hub_update( - id: $id - data: { - name: $name - locationName: $locationName - address: $address - nfcTagId: $nfcTagId - ownerId: $ownerId - } - ) -} - -mutation deleteHub($id: UUID!) @auth(level: USER) { - hub_delete(id: $id) -} - -mutation assignCostCenterToHub( - $hubId: UUID! - $costCenterId: UUID! -) @auth(level: USER) { - hub_update( - id: $hubId - data: { - costCenterId: $costCenterId - } - ) -} - -mutation removeCostCenterFromHub($hubId: UUID!) @auth(level: USER) { - hub_update( - id: $hubId - data: { - costCenterId: null - } - ) -} diff --git a/backend/dataconnect/connector/hub/queries.gql b/backend/dataconnect/connector/hub/queries.gql deleted file mode 100644 index c29cd99a..00000000 --- a/backend/dataconnect/connector/hub/queries.gql +++ /dev/null @@ -1,82 +0,0 @@ -query listHubs @auth(level: USER) { - hubs { - id - name - locationName - address - nfcTagId - ownerId - costCenterId - costCenter { - id - name - } - createdAt - updatedAt - createdBy - } -} - -query getHubById($id: UUID!) @auth(level: USER) { - hub(id: $id) { - id - name - locationName - address - nfcTagId - ownerId - costCenterId - costCenter { - id - name - } - createdAt - updatedAt - createdBy - } -} - -query getHubsByOwnerId($ownerId: UUID!) @auth(level: USER) { - hubs(where: { ownerId: { eq: $ownerId } }) { - id - name - locationName - address - nfcTagId - ownerId - costCenterId - costCenter { - id - name - } - createdAt - updatedAt - createdBy - } -} - -query filterHubs( - $ownerId: UUID - $name: String - $nfcTagId: String -) @auth(level: USER) { - hubs( - where: { - ownerId: { eq: $ownerId } - name: { eq: $name } - nfcTagId: { eq: $nfcTagId } - } - ) { - id - name - locationName - address - nfcTagId - ownerId - costCenterId - costCenter { - id - name - } - } -} From d8d3c3c79b66d3b94448e468f92dbc5e34c5f35e Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Thu, 26 Feb 2026 11:57:12 -0500 Subject: [PATCH 3/3] refactor: Remove 'Edit Profile' and 'Hubs' buttons from settings actions and migrate client hubs page to use UiAppBar. --- .../presentation/pages/client_hubs_page.dart | 102 ++++-------------- .../pages/client_settings_page.dart | 5 +- .../settings_actions.dart | 34 +----- 3 files changed, 27 insertions(+), 114 deletions(-) diff --git a/apps/mobile/packages/features/client/hubs/lib/src/presentation/pages/client_hubs_page.dart b/apps/mobile/packages/features/client/hubs/lib/src/presentation/pages/client_hubs_page.dart index 25772bc2..d120664b 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/presentation/pages/client_hubs_page.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/presentation/pages/client_hubs_page.dart @@ -56,10 +56,31 @@ class ClientHubsPage extends StatelessWidget { }, builder: (BuildContext context, ClientHubsState state) { return Scaffold( - backgroundColor: UiColors.bgMenu, + appBar: UiAppBar( + title: t.client_hubs.title, + subtitle: t.client_hubs.subtitle, + showBackButton: true, + actions: [ + Padding( + padding: const EdgeInsets.only(right: UiConstants.space5), + child: UiButton.primary( + onPressed: () async { + final bool? success = await Modular.to.toEditHub(); + if (success == true && context.mounted) { + BlocProvider.of( + context, + ).add(const ClientHubsFetched()); + } + }, + text: t.client_hubs.add_hub, + leadingIcon: UiIcons.add, + size: UiButtonSize.small, + ), + ), + ], + ), body: CustomScrollView( slivers: [ - _buildAppBar(context), SliverPadding( padding: const EdgeInsets.symmetric( horizontal: UiConstants.space5, @@ -112,81 +133,4 @@ class ClientHubsPage extends StatelessWidget { ), ); } - - Widget _buildAppBar(BuildContext context) { - return SliverAppBar( - backgroundColor: UiColors.foreground, - automaticallyImplyLeading: false, - expandedHeight: 140, - pinned: true, - flexibleSpace: FlexibleSpaceBar( - background: Container( - color: UiColors.foreground, - padding: const EdgeInsets.fromLTRB( - UiConstants.space5, - UiConstants.space12, - UiConstants.space5, - 0, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureDetector( - onTap: () => Modular.to.toClientHome(), - child: Container( - width: 40, - height: 40, - decoration: BoxDecoration( - color: UiColors.white.withValues(alpha: 0.2), - shape: BoxShape.circle, - ), - child: const Icon( - UiIcons.arrowLeft, - color: UiColors.white, - size: 20, - ), - ), - ), - const SizedBox(height: UiConstants.space4), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - t.client_hubs.title, - style: UiTypography.headline1m.white, - ), - Text( - t.client_hubs.subtitle, - style: UiTypography.body2r.copyWith( - color: UiColors.switchInactive, - ), - ), - ], - ), - ), - UiButton.primary( - onPressed: () async { - final bool? success = await Modular.to.toEditHub(); - if (success == true && context.mounted) { - BlocProvider.of( - context, - ).add(const ClientHubsFetched()); - } - }, - text: t.client_hubs.add_hub, - leadingIcon: UiIcons.add, - size: UiButtonSize.small, - ), - ], - ), - ], - ), - ), - ), - ); - } } diff --git a/apps/mobile/packages/features/client/settings/lib/src/presentation/pages/client_settings_page.dart b/apps/mobile/packages/features/client/settings/lib/src/presentation/pages/client_settings_page.dart index 508b5396..3d40f1e5 100644 --- a/apps/mobile/packages/features/client/settings/lib/src/presentation/pages/client_settings_page.dart +++ b/apps/mobile/packages/features/client/settings/lib/src/presentation/pages/client_settings_page.dart @@ -44,10 +44,7 @@ class ClientSettingsPage extends StatelessWidget { child: const Scaffold( backgroundColor: UiColors.bgMenu, body: CustomScrollView( - slivers: [ - SettingsProfileHeader(), - SettingsActions(), - ], + slivers: [SettingsProfileHeader(), SettingsActions()], ), ), ), diff --git a/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_actions.dart b/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_actions.dart index 0950c573..5332fc57 100644 --- a/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_actions.dart +++ b/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_actions.dart @@ -24,36 +24,6 @@ class SettingsActions extends StatelessWidget { delegate: SliverChildListDelegate([ const SizedBox(height: UiConstants.space5), - // Edit Profile button (Yellow) - UiButton.primary( - text: labels.edit_profile, - fullWidth: true, - style: ElevatedButton.styleFrom( - backgroundColor: UiColors.accent, - foregroundColor: UiColors.accentForeground, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(UiConstants.radiusBase * 2), - ), - ), - onPressed: () => Modular.to.toClientEditProfile(), - ), - const SizedBox(height: UiConstants.space4), - - // Hubs button (Yellow) - UiButton.primary( - text: labels.hubs, - fullWidth: true, - style: ElevatedButton.styleFrom( - backgroundColor: UiColors.accent, - foregroundColor: UiColors.accentForeground, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(UiConstants.radiusBase * 2), - ), - ), - onPressed: () => Modular.to.toClientHubs(), - ), - const SizedBox(height: UiConstants.space5), - // Quick Links card _QuickLinksCard(labels: labels), const SizedBox(height: UiConstants.space5), @@ -67,7 +37,9 @@ class SettingsActions extends StatelessWidget { style: OutlinedButton.styleFrom( side: const BorderSide(color: UiColors.black), shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(UiConstants.radiusBase * 2), + borderRadius: BorderRadius.circular( + UiConstants.radiusBase * 2, + ), ), ), onPressed: state is ClientSettingsLoading