From 323df8012eff9e79c1d638fdb35736f264d8e4df Mon Sep 17 00:00:00 2001 From: hillelcoren Date: Thu, 9 Dec 2021 15:02:40 +0000 Subject: [PATCH] Admin Portal - Profile --- public/main.profile.dart.js | 233 ++++++++++++++++++++++++------------ 1 file changed, 158 insertions(+), 75 deletions(-) diff --git a/public/main.profile.dart.js b/public/main.profile.dart.js index 44ee463e0ad0..9ab76069ea92 100644 --- a/public/main.profile.dart.js +++ b/public/main.profile.dart.js @@ -280570,7 +280570,11 @@ return false; if (this.entityType === B.EntityType_invoice) { var t1 = this.statusId; - if (t1 === "5" || t1 === "6") + if (t1 !== "5") + t1 = t1 === "6"; + else + t1 = true; + if (t1) return false; } return true; @@ -280789,8 +280793,15 @@ actions.push(B.EntityAction_download); } if (userCompany.canEditEntity$1(_this)) { - t3 = _this.statusId; - t3 = !(t3 === "5" || t3 === "6"); + if (_this.entityType === B.EntityType_invoice) { + t3 = _this.statusId; + if (t3 !== "5") + t3 = t3 === "6"; + else + t3 = true; + } else + t3 = false; + t3 = !t3; } else t3 = false; if (t3) { @@ -280871,8 +280882,15 @@ } if (userCompany.canEditEntity$1(_this)) if (t1) { - t1 = _this.statusId; - t1 = !(t1 === "5" || t1 === "6"); + if (_this.entityType === B.EntityType_invoice) { + t1 = _this.statusId; + if (t1 !== "5") + t1 = t1 === "6"; + else + t1 = true; + } else + t1 = false; + t1 = !t1; } else t1 = false; else @@ -280880,7 +280898,7 @@ if (t1) { t1 = _this.entityType; if (t1 !== B.EntityType_quote && t1 !== B.EntityType_credit && t1 !== B.EntityType_recurringInvoice && _this.statusId !== "1") - if (_this.statusId !== "4") + if (!(t1 === B.EntityType_invoice && _this.statusId === "4")) actions.push(B.EntityAction_cancel); } B.JSArray_methods.addAll$1(actions, _this.super$BaseEntity$getActions(null, false, false, userCompany)); @@ -280923,25 +280941,32 @@ return J.compareTo$1$ns(startDate, t1) <= 0 && J.compareTo$1$ns(endDate, t1) >= 0; }, get$isUnpaid() { - var t1 = this.statusId; - if (this.entityType === B.EntityType_quote) - return !B.JSArray_methods.contains$1(A._setArrayType(["3", "4"], type$.JSArray_legacy_String), t1); + var t1 = this.entityType; + if (t1 === B.EntityType_quote) + return !B.JSArray_methods.contains$1(A._setArrayType(["3", "4"], type$.JSArray_legacy_String), this.statusId); else - return t1 !== "4"; + return !(t1 === B.EntityType_invoice && this.statusId === "4"); }, get$isPayable() { - var t2, - t1 = this.statusId; - if (t1 !== "4") { - t2 = this.entityType; - if (t2 !== B.EntityType_quote) - if (t2 !== B.EntityType_recurringInvoice) - t1 = !(t1 === "5" || t1 === "6"); - else + var t1 = this.entityType, + t2 = t1 === B.EntityType_invoice; + if (!(t2 && this.statusId === "4")) + if (t1 !== B.EntityType_quote) + if (t1 !== B.EntityType_recurringInvoice) { + if (t2) { + t1 = this.statusId; + if (t1 !== "5") + t1 = t1 === "6"; + else + t1 = true; + } else + t1 = false; + t1 = !t1; + } else t1 = false; else t1 = false; - } else + else t1 = false; return t1; }, @@ -280950,10 +280975,9 @@ }, get$isUpcoming() { var t1, _this = this; - if (!_this.get$isArchived() && !_this.isDeleted) { - t1 = _this.statusId; - t1 = t1 !== "4" && !_this.get$isPastDue() && t1 !== "1"; - } else + if (!_this.get$isArchived() && !_this.isDeleted) + t1 = !(_this.entityType === B.EntityType_invoice && _this.statusId === "4") && !_this.get$isPastDue() && _this.statusId !== "1"; + else t1 = false; return t1; }, @@ -280973,13 +280997,27 @@ return "-1"; } else { if (_this.get$isPastDue()) { - t1 = _this.statusId; - t1 = !(t1 === "5" || t1 === "6"); + if (t2 === B.EntityType_invoice) { + t1 = _this.statusId; + if (t1 !== "5") + t1 = t1 === "6"; + else + t1 = true; + } else + t1 = false; + t1 = !t1; } else t1 = false; if (t1) return "-1"; - if (_this.get$isViewed() && _this.get$isUnpaid()) + if (_this.get$isViewed()) + if (_this.get$isUnpaid()) + t1 = !(t2 === B.EntityType_invoice && _this.statusId === "3"); + else + t1 = false; + else + t1 = false; + if (t1) return t2 === B.EntityType_invoice ? "-3" : "-2"; } return _this.statusId; @@ -308479,7 +308517,7 @@ t2 = t1.userCompanyStates; t3 = t1.uiState.selectedCompanyIndex; t1 = A.getClientSettings(t1, t2._list[t3].clientState.$get$1(0, invoice.clientId)).lockInvoices; - if (t1 === "when_paid" && invoice.statusId === "4") { + if (t1 === "when_paid" && invoice.entityType === B.EntityType_invoice && invoice.statusId === "4") { t1 = J.$index$asx($.LocalizationsProvider__localizedValues.$index(0, _this.localization.localeCode), "paid_invoices_are_locked"); if (t1 == null) t1 = ""; @@ -318440,9 +318478,16 @@ client = A.ClientEntity_ClientEntity(null, t1, null, null); t1 = invoice.statusId; if (t1 !== "1") - if (!invoice.isDeleted) - t1 = t1 === "5" || t1 === "6" || client.isDeleted; - else + if (!invoice.isDeleted) { + if (invoice.entityType === B.EntityType_invoice) + if (t1 !== "5") + t1 = t1 === "6"; + else + t1 = true; + else + t1 = false; + t1 = t1 || client.isDeleted; + } else t1 = true; else t1 = true; @@ -318698,7 +318743,11 @@ if (t1.matchesCurrency$1(client.settings.currencyId)) { B.JSArray_methods.forEach$1(task.getTaskTimes$0(), new A.chartTasks__closure(_this.totals, _this.loggedData, _this.invoicedData, _this.paidData, t5, project, client, task, group, t1, invoice, _this.currencyMap, t2)); if (t3.length !== 0) { - t1 = t4.containsKey$1(0, t3) && t4.$index(0, t3).statusId === "4"; + if (t4.containsKey$1(0, t3)) { + t1 = t4.$index(0, t3); + t1 = t1.entityType === B.EntityType_invoice && t1.statusId === "4"; + } else + t1 = false; t2 = _this.counts; if (t1) t2.$indexSet(0, "paid", t2.$index(0, "paid") + 1); @@ -318758,7 +318807,11 @@ t2 = t4.invoiceId; if (t2.length !== 0) { t3 = _this.invoiceMap._map$_map; - t2 = t3.containsKey$1(0, t2) && t3.$index(0, t2).statusId === "4"; + if (t3.containsKey$1(0, t2)) { + t2 = t3.$index(0, t2); + t2 = t2.entityType === B.EntityType_invoice && t2.statusId === "4"; + } else + t2 = false; t4 = t4.id; if (t2) { t1 = t1.$index(0, "paid"); @@ -318833,18 +318886,19 @@ invoice = _this.invoiceMap._map$_map.$index(0, t1); if (invoice == null) invoice = A.InvoiceEntity_InvoiceEntity(_null, _null, _null, _null, _null); - t1 = _this.counts; - t2 = expense.id; - if (invoice.statusId === "4") { - t3 = t3.$index(0, _s4_); - t3.$indexSet(0, date, t3.$index(0, date) + amount); - t1.$indexSet(0, _s4_, t1.$index(0, _s4_) + 1); - J.add$1$ax(_this.paidData.entityMap.$index(0, date), t2); + t1 = invoice.entityType === B.EntityType_invoice && invoice.statusId === "4"; + t2 = _this.counts; + t4 = expense.id; + if (t1) { + t1 = t3.$index(0, _s4_); + t1.$indexSet(0, date, t1.$index(0, date) + amount); + t2.$indexSet(0, _s4_, t2.$index(0, _s4_) + 1); + J.add$1$ax(_this.paidData.entityMap.$index(0, date), t4); } else { - t3 = t3.$index(0, _s8_); - t3.$indexSet(0, date, t3.$index(0, date) + amount); - t1.$indexSet(0, _s8_, t1.$index(0, _s8_) + 1); - J.add$1$ax(_this.invoicedData.entityMap.$index(0, date), t2); + t1 = t3.$index(0, _s8_); + t1.$indexSet(0, date, t1.$index(0, date) + amount); + t2.$indexSet(0, _s8_, t2.$index(0, _s8_) + 1); + J.add$1$ax(_this.invoicedData.entityMap.$index(0, date), t4); } } else { t1 = expense.get$isPending(); @@ -318892,8 +318946,15 @@ if (client == null) client = A.ClientEntity_ClientEntity(null, t1, null, null); if (!(invoice.get$isArchived() || invoice.isDeleted)) { - t1 = invoice.statusId; - t1 = t1 === "5" || t1 === "6" || client.get$isArchived() || client.isDeleted; + if (invoice.entityType === B.EntityType_invoice) { + t1 = invoice.statusId; + if (t1 !== "5") + t1 = t1 === "6"; + else + t1 = true; + } else + t1 = false; + t1 = t1 || client.get$isArchived() || client.isDeleted; } else t1 = true; if (!t1) @@ -318921,8 +318982,15 @@ if (client == null) client = A.ClientEntity_ClientEntity(null, t1, null, null); if (!(invoice.get$isArchived() || invoice.isDeleted)) { - t1 = invoice.statusId; - t1 = t1 === "5" || t1 === "6" || client.get$isArchived() || client.isDeleted; + if (invoice.entityType === B.EntityType_invoice) { + t1 = invoice.statusId; + if (t1 !== "5") + t1 = t1 === "6"; + else + t1 = true; + } else + t1 = false; + t1 = t1 || client.get$isArchived() || client.isDeleted; } else t1 = true; if (!t1) @@ -326295,7 +326363,8 @@ }; A.handleInvoiceAction__closure.prototype = { call$1(invoice) { - return type$.legacy_InvoiceEntity._as(invoice).statusId !== "4"; + type$.legacy_InvoiceEntity._as(invoice); + return !(invoice.entityType === B.EntityType_invoice && invoice.statusId === "4"); }, $signature: 179 }; @@ -327724,8 +327793,15 @@ return false; if (!invoice.get$isArchived() && !invoice.isDeleted) if (invoice.get$isUnpaid()) { - t1 = invoice.statusId; - t1 = !(t1 === "5" || t1 === "6"); + if (invoice.entityType === B.EntityType_invoice) { + t1 = invoice.statusId; + if (t1 !== "5") + t1 = t1 === "6"; + else + t1 = true; + } else + t1 = false; + t1 = !t1; } else t1 = false; else @@ -358927,15 +359003,20 @@ }; A._EntityDropdownState_build_closure1.prototype = { call$4(context, textEditingController, focusNode, onFieldSubmitted) { - var t4, t5, _null = null, + var t4, t5, t6, _null = null, t1 = this.$this, t2 = t1._widget, t3 = t2.validator; t2 = t2.allowClearing && t1.get$hasValue(); t4 = t1._widget; t5 = t4.labelText; - t4 = t4.autofocus; - return A.DecoratedFormField$(false, _null, t4 === true, false, textEditingController, _null, true, focusNode, _null, _null, _null, false, false, _null, B.TextInputType_0_null_null, t5, _null, _null, false, new A._EntityDropdownState_build__closure3(t1), new A._EntityDropdownState_build__closure4(onFieldSubmitted), _null, t2, _null, this.iconButton, B.TextAlign_4, t3); + t6 = t4.autofocus; + if (t6 === true) { + t4 = t4.entityId; + t4 = (t4 == null ? "" : t4).length === 0; + } else + t4 = false; + return A.DecoratedFormField$(false, _null, t4, false, textEditingController, _null, true, focusNode, _null, _null, _null, false, false, _null, B.TextInputType_0_null_null, t5, _null, _null, false, new A._EntityDropdownState_build__closure3(t1), new A._EntityDropdownState_build__closure4(onFieldSubmitted), _null, t2, _null, this.iconButton, B.TextAlign_4, t3); }, $signature: 377 }; @@ -380264,7 +380345,7 @@ return this._invoice_edit$_onSavePressed$2(context, null); }, build$1(_, context) { - var t2, t3, t4, t5, t6, t7, t8, t9, _this = this, _null = null, + var t2, t3, t4, t5, t6, t7, t8, t9, t10, _this = this, _null = null, t1 = A.Localizations_of(context, B.Type_AppLocalization_KyD, type$.legacy_AppLocalization), viewModel = _this._widget.viewModel, invoice = viewModel.invoice, @@ -380277,27 +380358,28 @@ t2 = ""; } t3 = A._setArrayType([B.EntityAction_viewPdf, B.EntityAction_emailInvoice], type$.JSArray_legacy_EntityAction); - t4 = invoice.statusId; - t5 = t4 !== "4"; - if (t5) + t4 = invoice.entityType; + t5 = t4 === B.EntityType_invoice; + if (!(t5 && invoice.statusId === "4")) t3.push(B.EntityAction_newPayment); - if (t4 === "1") + t6 = invoice.statusId; + if (t6 === "1") t3.push(B.EntityAction_markSent); - if (t5) + if (!(t5 && t6 === "4")) t3.push(B.EntityAction_markPaid); - t4 = type$.JSArray_legacy_Widget; - t5 = A.TabBar$(_this._invoice_edit$_controller, _null, true, _null, _null, A._setArrayType([A.Tab$(_null, t1.get$details(t1)), A.Tab$(_null, t1.get$contacts()), A.Tab$(_null, t1.get$items(t1)), A.Tab$(_null, t1.get$notes()), A.Tab$(_null, t1.get$pdf())], t4)); - t6 = $.$get$_InvoiceEditState__formKey(); + t5 = type$.JSArray_legacy_Widget; + t6 = A.TabBar$(_this._invoice_edit$_controller, _null, true, _null, _null, A._setArrayType([A.Tab$(_null, t1.get$details(t1)), A.Tab$(_null, t1.get$contacts()), A.Tab$(_null, t1.get$items(t1)), A.Tab$(_null, t1.get$notes()), A.Tab$(_null, t1.get$pdf())], t5)); + t7 = $.$get$_InvoiceEditState__formKey(); if (isFullscreen) t4 = new A.InvoiceEditDetailsScreen(_this._widget.viewModel, _null); else { - t7 = "__invoice_" + invoice.id + "_" + invoice.updatedAt + "__"; - t8 = _this._invoice_edit$_controller; - t9 = _this._widget.viewModel; - t7 = A.TabBarView$(A._setArrayType([new A.InvoiceEditDetailsScreen(t9, _null), new A.InvoiceEditContactsScreen(invoice.entityType, _null), new A.InvoiceEditItemsScreen(t9, false, _null), new A.InvoiceEditNotesScreen(_null), new A.InvoiceEditPDFScreen(_null)], t4), t8, new A.ValueKey(t7, type$.ValueKey_legacy_String)); - t4 = t7; + t8 = "__invoice_" + invoice.id + "_" + invoice.updatedAt + "__"; + t9 = _this._invoice_edit$_controller; + t10 = _this._widget.viewModel; + t8 = A.TabBarView$(A._setArrayType([new A.InvoiceEditDetailsScreen(t10, _null), new A.InvoiceEditContactsScreen(t4, _null), new A.InvoiceEditItemsScreen(t10, false, _null), new A.InvoiceEditNotesScreen(_null), new A.InvoiceEditPDFScreen(_null)], t5), t9, new A.ValueKey(t8, type$.ValueKey_legacy_String)); + t4 = t8; } - return A.EditScaffold$(t3, t5, A.Form$(false, t4, t6), new A.InvoiceEditFooter(invoice, _null), invoice, A.FloatingActionButton$(A.Theme_of(context).primaryColorDark, B.Icon_yXb, "invoice_edit_fab", false, new A._InvoiceEditState_build_closure(_this, context, invoice, viewModel, isFullscreen), t1.get$addItem()), isFullscreen, new A._InvoiceEditState_build_closure0(_this), new A._InvoiceEditState_build_closure1(viewModel), new A._InvoiceEditState_build_closure2(_this), _null, t2); + return A.EditScaffold$(t3, t6, A.Form$(false, t4, t7), new A.InvoiceEditFooter(invoice, _null), invoice, A.FloatingActionButton$(A.Theme_of(context).primaryColorDark, B.Icon_yXb, "invoice_edit_fab", false, new A._InvoiceEditState_build_closure(_this, context, invoice, viewModel, isFullscreen), t1.get$addItem()), isFullscreen, new A._InvoiceEditState_build_closure0(_this), new A._InvoiceEditState_build_closure1(viewModel), new A._InvoiceEditState_build_closure2(_this), _null, t2); } }; A._InvoiceEditState__onSavePressed_closure.prototype = { @@ -385953,7 +386035,7 @@ viewModel.onChanged.call$1(t1); }, build$1(_, context) { - var t5, creditPaymentables, amountPlaceholder, t6, t7, t8, t9, t10, t11, t12, index, t13, body, _this = this, _null = null, + var t5, creditPaymentables, amountPlaceholder, t6, t7, t8, t9, t10, t11, t12, t13, index, body, _this = this, _null = null, _s17_ = "__payment_amount_", _box_0 = {}, viewModel = _this._widget.viewModel, @@ -386001,14 +386083,15 @@ t7 = type$.JSArray_legacy_Widget; t8 = A._setArrayType([], t7); if (payment.get$isNew()) { + t9 = payment.clientId; t1 = A.Localizations_of(context, B.Type_AppLocalization_KyD, t1); t1 = t1.get$client(t1); - t9 = _this.autoValidate; - t10 = $.$get$memoizedDropdownClientList(); - t11 = state.uiState.selectedCompanyIndex; - t11 = state.userCompanyStates._list[t11]; - t12 = t11.clientState; - t1 = A._setArrayType([A.EntityDropdown$(true, t9, true, payment.clientId, t10.call$4(t12.map, t12.list, t11.userState.map, state.staticState), _null, B.EntityType_client, t1, _null, new A._PaymentEditState_build_closure3(viewModel, payment), _null, _null, new A._PaymentEditState_build_closure4(context))], t7); + t10 = _this.autoValidate; + t11 = $.$get$memoizedDropdownClientList(); + t12 = state.uiState.selectedCompanyIndex; + t12 = state.userCompanyStates._list[t12]; + t13 = t12.clientState; + t1 = A._setArrayType([A.EntityDropdown$(true, t10, t9.length === 0, t9, t11.call$4(t13.map, t13.list, t12.userState.map, state.staticState), _null, B.EntityType_client, t1, _null, new A._PaymentEditState_build_closure3(viewModel, payment), _null, _null, new A._PaymentEditState_build_closure4(context))], t7); if (!t3 && payment.isForCredit !== true) { t9 = _box_0.paymentTotal === 0 ? t2.get$amount() : amountPlaceholder; t1.push(A.DecoratedFormField$(false, _null, false, false, _this._payment_edit$_amountController, _null, true, _null, _null, _null, _null, false, false, _null, new A.TextInputType(2, true, true), t9, _null, _null, false, _null, _null, viewModel.onSavePressed, true, _null, _null, B.TextAlign_4, _null));