Update labels

This commit is contained in:
Hillel Coren 2018-09-27 19:11:40 +03:00
parent b39b9aeafe
commit d9e390508d
19 changed files with 49 additions and 49 deletions

View File

@ -359,7 +359,7 @@ abstract class ClientEntity extends Object
final actions = <EntityAction>[];
if (includeCreate && user.canCreate(EntityType.client) && isActive) {
actions.add(EntityAction.invoice);
actions.add(EntityAction.newInvoice);
}
if (actions.isNotEmpty) {

View File

@ -390,14 +390,14 @@ abstract class InvoiceEntity extends Object
}
if (user.canEditEntity(this) && client.hasEmailAddress) {
actions.add(EntityAction.email);
actions.add(EntityAction.sendEmail);
}
if (user.canEditEntity(this) &&
user.canCreate(EntityType.payment) &&
isUnpaid &&
!isQuote) {
actions.add(EntityAction.payment);
actions.add(EntityAction.enterPayment);
}
if (isQuote && quoteInvoiceId > 0) {

View File

@ -43,11 +43,11 @@ class EntityAction extends EnumClass {
static const EntityAction cloneToQuote = _$cloneToQuote;
static const EntityAction convert = _$convert;
static const EntityAction download = _$download;
static const EntityAction email = _$email;
static const EntityAction sendEmail = _$sendEmail;
static const EntityAction markSent = _$markSent;
static const EntityAction invoice = _$invoice;
static const EntityAction newInvoice = _$newInvoice;
static const EntityAction viewInvoice = _$viewInvoice;
static const EntityAction payment = _$payment;
static const EntityAction enterPayment = _$enterPayment;
static const EntityAction pdf = _$pdf;
static const EntityAction more = _$more;

View File

@ -27,11 +27,11 @@ const EntityAction _$cloneToInvoice = const EntityAction._('cloneToInvoice');
const EntityAction _$cloneToQuote = const EntityAction._('cloneToQuote');
const EntityAction _$convert = const EntityAction._('convert');
const EntityAction _$download = const EntityAction._('download');
const EntityAction _$email = const EntityAction._('email');
const EntityAction _$sendEmail = const EntityAction._('sendEmail');
const EntityAction _$markSent = const EntityAction._('markSent');
const EntityAction _$invoice = const EntityAction._('invoice');
const EntityAction _$newInvoice = const EntityAction._('newInvoice');
const EntityAction _$viewInvoice = const EntityAction._('viewInvoice');
const EntityAction _$payment = const EntityAction._('payment');
const EntityAction _$enterPayment = const EntityAction._('enterPayment');
const EntityAction _$pdf = const EntityAction._('pdf');
const EntityAction _$more = const EntityAction._('more');
@ -53,16 +53,16 @@ EntityAction _$valueOf(String name) {
return _$convert;
case 'download':
return _$download;
case 'email':
return _$email;
case 'sendEmail':
return _$sendEmail;
case 'markSent':
return _$markSent;
case 'invoice':
return _$invoice;
case 'newInvoice':
return _$newInvoice;
case 'viewInvoice':
return _$viewInvoice;
case 'payment':
return _$payment;
case 'enterPayment':
return _$enterPayment;
case 'pdf':
return _$pdf;
case 'more':
@ -82,11 +82,11 @@ final BuiltSet<EntityAction> _$values =
_$cloneToQuote,
_$convert,
_$download,
_$email,
_$sendEmail,
_$markSent,
_$invoice,
_$newInvoice,
_$viewInvoice,
_$payment,
_$enterPayment,
_$pdf,
_$more,
]);

View File

@ -179,7 +179,7 @@ abstract class PaymentEntity extends Object
final actions = <EntityAction>[];
if (user.canEditEntity(this) && client.hasEmailAddress) {
actions.add(EntityAction.email);
actions.add(EntityAction.sendEmail);
}
if (actions.isNotEmpty) {

View File

@ -28,7 +28,7 @@ List<Middleware<AppState>> createStoreAuthMiddleware([
}
void _saveAuthLocal(dynamic action) async {
await FlutterKeychain.put(key: kKeychainEmail, value: action.email);
await FlutterKeychain.put(key: kKeychainEmail, value: action.sendEmail);
if (formatApiUrlReadable(action.url) != kAppUrl) {
await FlutterKeychain.put(
@ -70,7 +70,7 @@ Middleware<AppState> _createLoginRequest(AuthRepository repository) {
return (Store<AppState> store, dynamic action, NextDispatcher next) {
repository
.login(
email: action.email,
email: action.sendEmail,
password: action.password,
url: action.url,
secret: action.secret,

View File

@ -213,9 +213,9 @@ Middleware<AppState> _saveInvoice(InvoiceRepository repository) {
return (Store<AppState> store, dynamic action, NextDispatcher next) {
repository
.saveData(
store.state.selectedCompany, store.state.authState, action.invoice)
store.state.selectedCompany, store.state.authState, action.newInvoice)
.then((InvoiceEntity invoice) {
if (action.invoice.isNew) {
if (action.newInvoice.isNew) {
store.dispatch(AddInvoiceSuccess(invoice));
} else {
store.dispatch(SaveInvoiceSuccess(invoice));

View File

@ -38,9 +38,9 @@ Reducer<int> selectedIdReducer = combineReducers([
TypedReducer<int, ViewInvoice>(
(int selectedId, dynamic action) => action.invoiceId),
TypedReducer<int, AddInvoiceSuccess>(
(int selectedId, dynamic action) => action.invoice.id),
(int selectedId, dynamic action) => action.newInvoice.id),
TypedReducer<int, ShowEmailInvoice>(
(int selectedId, dynamic action) => action.invoice.id),
(int selectedId, dynamic action) => action.newInvoice.id),
]);
final editingReducer = combineReducers<InvoiceEntity>([
@ -63,7 +63,7 @@ InvoiceEntity _clearEditing(InvoiceEntity client, dynamic action) {
}
InvoiceEntity _updateEditing(InvoiceEntity invoice, dynamic action) {
return action.invoice;
return action.newInvoice;
}
InvoiceEntity _addInvoiceItem(InvoiceEntity invoice, AddInvoiceItem action) {
@ -254,7 +254,7 @@ InvoiceState _convertQuoteSuccess(
InvoiceState _updateInvoice(InvoiceState invoiceState, dynamic action) {
return invoiceState
.rebuild((b) => b..map[action.invoice.id] = action.invoice);
.rebuild((b) => b..map[action.newInvoice.id] = action.newInvoice);
}
InvoiceState _setLoadedInvoices(

View File

@ -148,13 +148,13 @@ Middleware<AppState> _restorePayment(PaymentRepository repository) {
Middleware<AppState> _savePayment(PaymentRepository repository) {
return (Store<AppState> store, dynamic action, NextDispatcher next) {
final PaymentEntity payment = action.payment;
final PaymentEntity payment = action.enterPayment;
final bool sendEmail = payment.isNew ? store.state.uiState.emailPayment : false;
repository
.saveData(
store.state.selectedCompany, store.state.authState, action.payment, sendEmail: sendEmail)
store.state.selectedCompany, store.state.authState, action.enterPayment, sendEmail: sendEmail)
.then((PaymentEntity payment) {
if (action.payment.isNew) {
if (action.enterPayment.isNew) {
store.dispatch(AddPaymentSuccess(payment));
} else {
store.dispatch(SavePaymentSuccess(payment));
@ -175,7 +175,7 @@ Middleware<AppState> _emailPayment(PaymentRepository repository) {
return (Store<AppState> store, dynamic action, NextDispatcher next) {
repository
.saveData(
store.state.selectedCompany, store.state.authState, action.payment, sendEmail: true)
store.state.selectedCompany, store.state.authState, action.enterPayment, sendEmail: true)
.then((PaymentEntity payment) {
store.dispatch(SavePaymentSuccess(payment));
action.completer.complete(null);

View File

@ -17,7 +17,7 @@ Reducer<int> selectedIdReducer = combineReducers([
TypedReducer<int, ViewPayment>(
(int selectedId, dynamic action) => action.paymentId),
TypedReducer<int, AddPaymentSuccess>(
(int selectedId, dynamic action) => action.payment.id),
(int selectedId, dynamic action) => action.enterPayment.id),
]);
final editingReducer = combineReducers<PaymentEntity>([
@ -36,7 +36,7 @@ PaymentEntity _clearEditing(PaymentEntity payment, SelectCompany action) {
}
PaymentEntity _updateEditing(PaymentEntity payment, dynamic action) {
return action.payment;
return action.enterPayment;
}
final paymentListReducer = combineReducers<ListUIState>([

View File

@ -50,7 +50,7 @@ class ClientList extends StatelessWidget {
if (user.canCreate(EntityType.invoice)) {
actions.add(EntityActionListTile(
client: client,
entityAction: EntityAction.invoice,
entityAction: EntityAction.newInvoice,
mainContext: context,
viewModel: viewModel,
));
@ -58,7 +58,7 @@ class ClientList extends StatelessWidget {
if (user.canCreate(EntityType.payment)) {
actions.add(EntityActionListTile(
client: client,
entityAction: EntityAction.payment,
entityAction: EntityAction.enterPayment,
mainContext: context,
viewModel: viewModel,
));

View File

@ -82,12 +82,12 @@ class ClientListVM {
onEntityAction: (context, client, action) {
final localization = AppLocalization.of(context);
switch (action) {
case EntityAction.invoice:
case EntityAction.newInvoice:
store.dispatch(EditInvoice(
invoice: InvoiceEntity().rebuild((b) => b.clientId = client.id),
context: context));
break;
case EntityAction.payment:
case EntityAction.enterPayment:
store.dispatch(EditPayment(
payment: PaymentEntity(company: state.selectedCompany)
.rebuild((b) => b.clientId = client.id),

View File

@ -146,7 +146,7 @@ class InvoiceListVM extends EntityListVM {
snackBarCompleter(context, localization.markedInvoiceAsSent),
invoice.id));
break;
case EntityAction.email:
case EntityAction.sendEmail:
store.dispatch(ShowEmailInvoice(
completer:
snackBarCompleter(context, localization.emailedInvoice),
@ -161,7 +161,7 @@ class InvoiceListVM extends EntityListVM {
store.dispatch(
EditQuote(context: context, quote: invoice.cloneToQuote));
break;
case EntityAction.payment:
case EntityAction.enterPayment:
store.dispatch(EditPayment(
context: context,
payment: invoice.createPayment(state.selectedCompany)));

View File

@ -71,7 +71,7 @@ class EntityViewVM {
bool operator ==(dynamic other) =>
client == other.client &&
company == other.company &&
invoice == other.invoice &&
invoice == other.newInvoice &&
isSaving == other.isSaving &&
isDirty == other.isDirty;
@ -170,7 +170,7 @@ class InvoiceViewVM extends EntityViewVM {
snackBarCompleter(context, localization.markedInvoiceAsSent),
invoice.id));
break;
case EntityAction.email:
case EntityAction.sendEmail:
store.dispatch(ShowEmailInvoice(
completer:
snackBarCompleter(context, localization.emailedInvoice),
@ -202,7 +202,7 @@ class InvoiceViewVM extends EntityViewVM {
store.dispatch(
EditQuote(context: context, quote: invoice.cloneToQuote));
break;
case EntityAction.payment:
case EntityAction.enterPayment:
store.dispatch(EditPayment(
context: context,
payment: invoice.createPayment(state.selectedCompany)));

View File

@ -95,7 +95,7 @@ class PaymentListVM {
onEntityAction: (context, payment, action) {
final localization = AppLocalization.of(context);
switch (action) {
case EntityAction.email:
case EntityAction.sendEmail:
store.dispatch(EmailPaymentRequest(
snackBarCompleter(context, localization.emailedPayment),
payment));

View File

@ -77,7 +77,7 @@ class PaymentViewVM {
onActionSelected: (BuildContext context, EntityAction action) {
final localization = AppLocalization.of(context);
switch (action) {
case EntityAction.email:
case EntityAction.sendEmail:
store.dispatch(EmailPaymentRequest(
popCompleter(
context, localization.emailedPayment),

View File

@ -119,7 +119,7 @@ class QuoteListVM extends EntityListVM {
snackBarCompleter(context, localization.markedQuoteAsSent),
quote.id));
break;
case EntityAction.email:
case EntityAction.sendEmail:
store.dispatch(ShowEmailQuote(
completer: snackBarCompleter(context, localization.emailedQuote),
quote: quote,

View File

@ -130,7 +130,7 @@ class QuoteViewVM extends EntityViewVM {
snackBarCompleter(context, localization.markedQuoteAsSent),
quote.id));
break;
case EntityAction.email:
case EntityAction.sendEmail:
store.dispatch(ShowEmailQuote(
completer:
snackBarCompleter(context, localization.emailedQuote),

View File

@ -12,7 +12,7 @@ IconData getEntityActionIcon(EntityAction entityAction) {
return Icons.control_point_duplicate;
case EntityAction.markSent:
return Icons.publish;
case EntityAction.email:
case EntityAction.sendEmail:
return Icons.send;
case EntityAction.archive:
return Icons.archive;
@ -24,8 +24,8 @@ IconData getEntityActionIcon(EntityAction entityAction) {
return Icons.check_box;
case EntityAction.viewInvoice:
return Icons.insert_drive_file;
case EntityAction.invoice:
case EntityAction.payment:
case EntityAction.newInvoice:
case EntityAction.enterPayment:
return Icons.add_circle_outline;
default:
return null;