Merge branch 'dev' into 538-be-assign-a-hub-manager-to-an-order
This commit is contained in:
3
apps/mobile/devtools_options.yaml
Normal file
3
apps/mobile/devtools_options.yaml
Normal file
@@ -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:
|
||||
@@ -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: <Widget>[
|
||||
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<ClientHubsBloc>(
|
||||
context,
|
||||
).add(const ClientHubsFetched());
|
||||
}
|
||||
},
|
||||
text: t.client_hubs.add_hub,
|
||||
leadingIcon: UiIcons.add,
|
||||
size: UiButtonSize.small,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
_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: <Widget>[
|
||||
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: <Widget>[
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
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<ClientHubsBloc>(
|
||||
context,
|
||||
).add(const ClientHubsFetched());
|
||||
}
|
||||
},
|
||||
text: t.client_hubs.add_hub,
|
||||
leadingIcon: UiIcons.add,
|
||||
size: UiButtonSize.small,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,10 +44,7 @@ class ClientSettingsPage extends StatelessWidget {
|
||||
child: const Scaffold(
|
||||
backgroundColor: UiColors.bgMenu,
|
||||
body: CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
SettingsProfileHeader(),
|
||||
SettingsActions(),
|
||||
],
|
||||
slivers: <Widget>[SettingsProfileHeader(), SettingsActions()],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -24,36 +24,6 @@ class SettingsActions extends StatelessWidget {
|
||||
delegate: SliverChildListDelegate(<Widget>[
|
||||
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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user