Purchase orders

This commit is contained in:
Hillel Coren 2022-06-24 16:56:12 +03:00
parent f4f6aee5d9
commit 755e2f07ce
3 changed files with 12 additions and 4 deletions

View File

@ -456,6 +456,9 @@ abstract class VendorEntity extends Object
bool get hasUser => assignedUserId != null && assignedUserId.isNotEmpty;
bool get hasEmailAddress =>
contacts.where((contact) => contact.email?.isNotEmpty).isNotEmpty;
static Serializer<VendorEntity> get serializer => _$vendorEntitySerializer;
bool get hasNameSet {

View File

@ -549,17 +549,17 @@ void handlePurchaseOrderAction(BuildContext context,
case EntityAction.bulkSendEmail:
bool emailValid = true;
purchaseOrders.forEach((purchaseOrder) {
final client = state.clientState.get(
(purchaseOrder as InvoiceEntity).clientId,
final vendor = state.vendorState.get(
(purchaseOrder as InvoiceEntity).vendorId,
);
if (!client.hasEmailAddress) {
if (!vendor.hasEmailAddress) {
emailValid = false;
}
});
if (!emailValid) {
showMessageDialog(
context: context,
message: localization.clientEmailNotSet,
message: localization.vendorEmailNotSet,
secondaryActions: [
TextButton(
onPressed: () {

View File

@ -16,6 +16,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
// STARTER: lang key - do not remove comment
'vendor_email_not_set': 'Vendor does not have an email address set',
'bulk_send_email': 'Send Email',
'marked_purchase_order_as_sent':
'Successfully marked purchase order as sent',
@ -70805,6 +70806,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]['cancelled_purchase_orders'] ??
_localizedValues['en']['cancelled_purchase_orders'];
String get vendorEmailNotSet =>
_localizedValues[localeCode]['vendor_email_not_set'] ??
_localizedValues['en']['vendor_email_not_set'];
// STARTER: lang field - do not remove comment
String lookup(String key) {