Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Jun 20, 2024
2 parents 2b2a0fd + a4a66ed commit dc39038
Show file tree
Hide file tree
Showing 19 changed files with 91 additions and 28 deletions.
4 changes: 2 additions & 2 deletions lib/data/models/project_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ abstract class ProjectEntity extends Object
return response;
}

bool matchesName(String filter) =>
name.toLowerCase().contains(filter.toLowerCase());
bool matchesName(String? filter) =>
name.toLowerCase().contains((filter ?? '').toLowerCase());

@override
bool matchesFilter(String? filter) {
Expand Down
9 changes: 9 additions & 0 deletions lib/data/models/task_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,15 @@ abstract class TaskEntity extends Object
.toLowerCase()
.compareTo(userB.fullName.toLowerCase());
break;
case TaskFields.isInvoiced:
response = taskB.isInvoiced ? 1 : -1;
break;
case TaskFields.isDeleted:
response = taskB.isDeleted == true ? 1 : -1;
break;
case TaskFields.isRunning:
response = taskB.isRunning ? 1 : -1;
break;
case TaskFields.status:
final taskAStatus = taskA.isRunning
? -1
Expand Down
5 changes: 4 additions & 1 deletion lib/redux/client/client_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -562,14 +562,17 @@ void handleClientAction(BuildContext? context, List<BaseEntity> clients,
);
break;
case EntityAction.addComment:
showDialog<void>(
final addedComment = await showDialog<bool>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.client,
entityId: client.id,
),
);
if (addedComment == true) {
store.dispatch(LoadClient(clientId: client.id));
}
break;
default:
print('## Error: action $action not handled in client_actions');
Expand Down
5 changes: 4 additions & 1 deletion lib/redux/credit/credit_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -756,14 +756,17 @@ Future handleCreditAction(BuildContext context, List<BaseEntity> credits,
}
break;
case EntityAction.addComment:
showDialog<void>(
final addedComment = await showDialog<bool>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.credit,
entityId: credit.id,
),
);
if (addedComment == true) {
store.dispatch(LoadCredit(creditId: credit.id));
}
break;
default:
print('## ERROR: unhandled action $action in credit_actions');
Expand Down
9 changes: 6 additions & 3 deletions lib/redux/expense/expense_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ class FilterExpensesByCustom4 implements PersistUI {
final String value;
}

void handleExpenseAction(
BuildContext context, List<BaseEntity> expenses, EntityAction? action) {
void handleExpenseAction(BuildContext context, List<BaseEntity> expenses,
EntityAction? action) async {
final store = StoreProvider.of<AppState>(context);
final state = store.state;
final localization = AppLocalization.of(context);
Expand Down Expand Up @@ -398,14 +398,17 @@ void handleExpenseAction(
}
break;
case EntityAction.addComment:
showDialog<void>(
final addedComment = await showDialog<bool>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.expense,
entityId: expense.id,
),
);
if (addedComment == true) {
store.dispatch(LoadExpense(expenseId: expense.id));
}
break;
default:
print('## ERROR: unhandled action $action in expense_actions');
Expand Down
5 changes: 4 additions & 1 deletion lib/redux/invoice/invoice_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -884,14 +884,17 @@ void handleInvoiceAction(BuildContext? context, List<BaseEntity> invoices,
);
break;
case EntityAction.addComment:
showDialog<void>(
final addedComment = await showDialog<bool>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.invoice,
entityId: invoice.id,
),
);
if (addedComment == true) {
store.dispatch(LoadInvoice(invoiceId: invoice.id));
}
break;
case EntityAction.more:
showEntityActionsDialog(
Expand Down
10 changes: 8 additions & 2 deletions lib/redux/invoice/invoice_selectors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,13 @@ List<String> dropdownInvoiceSelector(
return list;
}

var memoizedFilteredInvoiceList = memo9((SelectionState selectionState,
var memoizedFilteredInvoiceList = memo10((SelectionState selectionState,
BuiltMap<String, InvoiceEntity> invoiceMap,
BuiltList<String> invoiceList,
BuiltMap<String, ClientEntity> clientMap,
BuiltMap<String, VendorEntity> vendorMap,
BuiltMap<String, PaymentEntity> paymentMap,
BuiltMap<String, ProjectEntity> projectMap,
ListUIState invoiceListState,
BuiltMap<String, UserEntity> userMap,
String? recurringPrefix) =>
Expand All @@ -135,6 +136,7 @@ var memoizedFilteredInvoiceList = memo9((SelectionState selectionState,
clientMap,
vendorMap,
paymentMap,
projectMap,
invoiceListState,
userMap,
recurringPrefix,
Expand All @@ -147,6 +149,7 @@ List<String> filteredInvoicesSelector(
BuiltMap<String, ClientEntity> clientMap,
BuiltMap<String, VendorEntity> vendorMap,
BuiltMap<String, PaymentEntity> paymentMap,
BuiltMap<String, ProjectEntity> projectMap,
ListUIState invoiceListState,
BuiltMap<String, UserEntity> userMap,
String? recurringPrefix,
Expand All @@ -170,6 +173,8 @@ List<String> filteredInvoicesSelector(
final invoice = invoiceMap[invoiceId]!;
final client =
clientMap[invoice.clientId] ?? ClientEntity(id: invoice.clientId);
final project =
projectMap[invoice.projectId] ?? ProjectEntity(id: invoice.projectId);

if (invoice.id == selectionState.selectedId) {
return true;
Expand Down Expand Up @@ -223,7 +228,8 @@ List<String> filteredInvoicesSelector(
return false;
}
if (!invoice.matchesFilter(invoiceListState.filter) &&
!client.matchesNameOrEmail(invoiceListState.filter)) {
!client.matchesNameOrEmail(invoiceListState.filter) &&
!project.matchesName(invoiceListState.filter)) {
return false;
}
if (invoiceListState.custom1Filters.isNotEmpty &&
Expand Down
9 changes: 6 additions & 3 deletions lib/redux/payment/payment_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ class UpdatePaymentTab implements PersistUI {
final int? tabIndex;
}

void handlePaymentAction(
BuildContext? context, List<BaseEntity> payments, EntityAction? action) {
void handlePaymentAction(BuildContext? context, List<BaseEntity> payments,
EntityAction? action) async {
if (payments.isEmpty) {
return;
}
Expand Down Expand Up @@ -471,14 +471,17 @@ void handlePaymentAction(
);
break;
case EntityAction.addComment:
showDialog<void>(
final addedComment = await showDialog<bool>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.payment,
entityId: payment.id,
),
);
if (addedComment == true) {
store.dispatch(LoadPayment(paymentId: payment.id));
}
break;
default:
print('## Error: action $action not handled in client_actions');
Expand Down
9 changes: 6 additions & 3 deletions lib/redux/project/project_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ class FilterProjectsByCustom4 implements PersistUI {
final String value;
}

void handleProjectAction(
BuildContext? context, List<BaseEntity> projects, EntityAction? action) {
void handleProjectAction(BuildContext? context, List<BaseEntity> projects,
EntityAction? action) async {
if (projects.isEmpty) {
return;
}
Expand Down Expand Up @@ -401,14 +401,17 @@ void handleProjectAction(
);
break;
case EntityAction.addComment:
showDialog<void>(
final addedComment = await showDialog<bool>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.project,
entityId: project.id,
),
);
if (addedComment == true) {
store.dispatch(LoadProject(projectId: project.id));
}
break;
default:
print('## Error: action $action not handled in project_actions');
Expand Down
5 changes: 4 additions & 1 deletion lib/redux/purchase_order/purchase_order_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -880,14 +880,17 @@ void handlePurchaseOrderAction(BuildContext? context,
);
break;
case EntityAction.addComment:
showDialog<void>(
final addedComment = await showDialog<bool>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.purchaseOrder,
entityId: purchaseOrder.id,
),
);
if (addedComment == true) {
store.dispatch(LoadPurchaseOrder(purchaseOrderId: purchaseOrder.id));
}
break;
default:
print('## ERROR: unhandled action $action in purchase_order_actions');
Expand Down
6 changes: 5 additions & 1 deletion lib/redux/quote/quote_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -810,14 +810,18 @@ Future handleQuoteAction(
}
break;
case EntityAction.addComment:
showDialog<void>(
final addedComment = await showDialog<bool>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.quote,
entityId: quote.id,
),
);
if (addedComment == true) {
store.dispatch(LoadQuote(quoteId: quote.id));
}

break;
default:
print('## ERROR: unhandled action $action in quote_actions');
Expand Down
9 changes: 7 additions & 2 deletions lib/redux/recurring_expense/recurring_expense_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class SaveRecurringExpenseDocumentFailure implements StopSaving {
}

void handleRecurringExpenseAction(BuildContext? context,
List<BaseEntity> recurringExpenses, EntityAction? action) {
List<BaseEntity> recurringExpenses, EntityAction? action) async {
if (recurringExpenses.isEmpty) {
return;
}
Expand Down Expand Up @@ -461,14 +461,19 @@ void handleRecurringExpenseAction(BuildContext? context,
}
break;
case EntityAction.addComment:
showDialog<void>(
final addedComment = await showDialog<bool>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.recurringExpense,
entityId: recurringExpense.id,
),
);
if (addedComment == true) {
store.dispatch(
LoadRecurringExpense(recurringExpenseId: recurringExpense.id));
}

break;
default:
print('## ERROR: unhandled action $action in recurring_expense_actions');
Expand Down
6 changes: 5 additions & 1 deletion lib/redux/recurring_invoice/recurring_invoice_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -728,14 +728,18 @@ void handleRecurringInvoiceAction(BuildContext? context,
));
break;
case EntityAction.addComment:
showDialog<void>(
final addedComment = await showDialog<bool>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.recurringInvoice,
entityId: recurringInvoice.id,
),
);
if (addedComment == true) {
store.dispatch(
LoadRecurringInvoice(recurringInvoiceId: recurringInvoice.id));
}
break;
default:
print(
Expand Down
7 changes: 5 additions & 2 deletions lib/redux/task/task_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ class FilterTasksByCustom4 implements PersistUI {
class UpdateKanban {}

void handleTaskAction(
BuildContext? context, List<BaseEntity> tasks, EntityAction? action) {
BuildContext? context, List<BaseEntity> tasks, EntityAction? action) async {
if (tasks.isEmpty) {
return;
}
Expand Down Expand Up @@ -555,14 +555,17 @@ void handleTaskAction(
);
break;
case EntityAction.addComment:
showDialog<void>(
final addedComment = await showDialog<bool>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.task,
entityId: task.id,
),
);
if (addedComment == true) {
store.dispatch(LoadTask(taskId: task.id));
}
break;
default:
print('## ERROR: unhandled action $action in task_actions');
Expand Down
9 changes: 6 additions & 3 deletions lib/redux/vendor/vendor_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ class FilterVendorsByCustom4 implements PersistUI {
final String value;
}

void handleVendorAction(
BuildContext? context, List<BaseEntity> vendors, EntityAction? action) {
void handleVendorAction(BuildContext? context, List<BaseEntity> vendors,
EntityAction? action) async {
if (vendors.isEmpty) {
return;
}
Expand Down Expand Up @@ -397,14 +397,17 @@ void handleVendorAction(
}
break;
case EntityAction.addComment:
showDialog<void>(
final addedComment = await showDialog<bool>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.vendor,
entityId: vendor.id,
),
);
if (addedComment == true) {
store.dispatch(LoadVendor(vendorId: vendor.id));
}
break;
default:
print('## ERROR: unhandled action $action in vendor_actions');
Expand Down
6 changes: 6 additions & 0 deletions lib/ui/client/client_presenter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class ClientPresenter extends EntityPresenter {
return [
...getDefaultTableFields(userCompany),
...EntityPresenter.getBaseFields(),
ClientFields.city,
ClientFields.postalCode,
ClientFields.address1,
ClientFields.address2,
ClientFields.country,
Expand Down Expand Up @@ -93,6 +95,10 @@ class ClientPresenter extends EntityPresenter {
return Text(client!.number);
case ClientFields.idNumber:
return Text(client!.idNumber);
case ClientFields.city:
return Text(client!.city);
case ClientFields.postalCode:
return Text(client!.postalCode);
case ClientFields.lastLoginAt:
return Text(client!.lastLogin == 0
? ''
Expand Down
1 change: 1 addition & 0 deletions lib/ui/invoice/invoice_list_vm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class InvoiceListVM extends EntityListVM {
state.clientState.map,
state.vendorState.map,
state.paymentState.map,
state.projectState.map,
state.invoiceListState,
state.userState.map,
state.company.settings.recurringNumberPrefix,
Expand Down
Loading

0 comments on commit dc39038

Please sign in to comment.