{"version":3,"sources":["app/HandlebarHelpers.js","app/InstancedOneUI.js","app/StickyTableHeaders.js","app/app-router.js","app/app.js","app/aside/template.hbs","app/aside/view.js","app/aside/widget.js","app/checkbook/appayment/appayment.js","app/checkbook/appayment/create-appayment.hbs","app/checkbook/check/check.js","app/checkbook/check/create-check-view.js","app/checkbook/check/create-check-widget.js","app/checkbook/check/create-check.hbs","app/checkbook/checkbook-entry-tabs-view.js","app/checkbook/checkbook-entry-tabs-widget.js","app/checkbook/checkbook-entry-tabs.hbs","app/checkbook/checkbook-line-item.js","app/checkbook/checkbook-router.js","app/checkbook/checkbook-service.js","app/checkbook/checkbook-unprinted-line-item.js","app/checkbook/checkbook-view.js","app/checkbook/checkbook-widget.js","app/checkbook/checkbook.js","app/checkbook/create-checkbook-view.js","app/checkbook/create-checkbook-widget.js","app/checkbook/create-checkbook.hbs","app/checkbook/create-entry-view.js","app/checkbook/deposit/create-deposit-view.js","app/checkbook/deposit/create-deposit-widget.js","app/checkbook/deposit/create-deposit.hbs","app/checkbook/deposit/deposit.js","app/checkbook/details/check-details-view.js","app/checkbook/details/check-details-widget.js","app/checkbook/details/check-details.hbs","app/checkbook/distribution-line.hbs","app/checkbook/distribution.js","app/checkbook/edit-check/edit-check-view.js","app/checkbook/edit-check/edit-check-widget.js","app/checkbook/edit-check/edit-check.hbs","app/checkbook/eft-deposit/create-eft-deposit-view.js","app/checkbook/eft-deposit/create-eft-deposit-widget.js","app/checkbook/eft-deposit/create-eft-deposit.hbs","app/checkbook/eft-deposit/eft-deposit.js","app/checkbook/eft-payment/create-eft-payment-view.js","app/checkbook/eft-payment/create-eft-payment-widget.js","app/checkbook/eft-payment/create-eft-payment.hbs","app/checkbook/eft-payment/eft-payment.js","app/checkbook/history/checkbook-histories.js","app/checkbook/history/checkbook-history-actions.hbs","app/checkbook/history/checkbook-history-view.js","app/checkbook/history/checkbook-history-widget.js","app/checkbook/history/checkbook-history.hbs","app/checkbook/print-review/template.hbs","app/checkbook/print-review/view.js","app/checkbook/print-review/widget.js","app/checkbook/printing-indicator/template.hbs","app/checkbook/printing-indicator/view.js","app/checkbook/printing-indicator/widget.js","app/checkbook/reconciliation/checkbook-reconciliation.js","app/checkbook/reconciliation/entries/template.hbs","app/checkbook/reconciliation/entries/view.js","app/checkbook/reconciliation/entries/widget.js","app/checkbook/reconciliation/info/balanced-status.hbs","app/checkbook/reconciliation/info/template.hbs","app/checkbook/reconciliation/info/unreconciled-status.hbs","app/checkbook/reconciliation/info/view.js","app/checkbook/reconciliation/info/widget.js","app/checkbook/reconciliation/reconciliation-entry.js","app/checkbook/reconciliation/service.js","app/checkbook/reconciliation/summary/template.hbs","app/checkbook/reconciliation/summary/view.js","app/checkbook/reconciliation/summary/widget.js","app/checkbook/reconciliation/template.hbs","app/checkbook/reconciliation/view.js","app/checkbook/reconciliation/widget.js","app/checkbook/unprinted-history/checkbook-histories.js","app/checkbook/unprinted-history/checkbook-unprinted-history-view.js","app/checkbook/unprinted-history/checkbook-unprinted-history-widget.js","app/checkbook/unprinted-history/checkbook-unprinted-history.hbs","app/checkbook/unprinted-history/printing-checkbox.hbs","app/checkbook/view-checkbooks.hbs","app/company/address.js","app/company/company-router.js","app/company/company-service.js","app/company/company.js","app/company/create/template.hbs","app/company/create/view.js","app/company/create/widget.js","app/company/manage-company.hbs","app/company/profile/template.hbs","app/company/profile/view.js","app/company/profile/widget.js","app/company/read/template.hbs","app/company/read/view.js","app/company/read/widget.js","app/company/update/view.js","app/company/update/widget.js","app/company/wizard/template.hbs","app/company/wizard/view.js","app/company/wizard/widget.js","app/config/config.jsenv","app/dashboard/account-balance/template.hbs","app/dashboard/accounts-payable-report/view.js","app/dashboard/accounts-payable-report/widget.js","app/dashboard/accounts-receivable-report/view.js","app/dashboard/accounts-receivable-report/widget.js","app/dashboard/checkbook-status/template.hbs","app/dashboard/checkbook-status/view.js","app/dashboard/checkbook-status/widget.js","app/dashboard/financial-status/template.hbs","app/dashboard/financial-status/view.js","app/dashboard/financial-status/widget.js","app/dashboard/income-expense-status/template.hbs","app/dashboard/income-expense-status/view.js","app/dashboard/income-expense-status/widget.js","app/dashboard/router.js","app/dashboard/template.hbs","app/dashboard/view.js","app/dashboard/widget.js","app/datepicker/datepicker-params.js","app/footer/footer-view.js","app/footer/footer-widget.js","app/footer/footer.hbs","app/forms/action-cell/view.js","app/forms/bullets.hbs","app/forms/checkbox.hbs","app/forms/confirm/confirm.hbs","app/forms/confirm/view.js","app/forms/confirm/widget.js","app/forms/date-input.hbs","app/forms/floating-input-tax-rate.hbs","app/forms/floating-input.hbs","app/forms/ribbon.hbs","app/forms/state-selection.hbs","app/forms/textarea.hbs","app/frame-view.js","app/frame-widget.js","app/frame.hbs","app/generalledgeraccounts/account.js","app/generalledgeraccounts/create/template.hbs","app/generalledgeraccounts/create/view.js","app/generalledgeraccounts/create/widget.js","app/generalledgeraccounts/import/error-template.hbs","app/generalledgeraccounts/import/import-accounts-button.hbs","app/generalledgeraccounts/import/initial-setup-template.hbs","app/generalledgeraccounts/import/view.js","app/generalledgeraccounts/import/widget.js","app/generalledgeraccounts/list/template.hbs","app/generalledgeraccounts/list/view.js","app/generalledgeraccounts/list/widget.js","app/generalledgeraccounts/router.js","app/generalledgeraccounts/service.js","app/generalledgeraccounts/update/template.hbs","app/generalledgeraccounts/update/view.js","app/generalledgeraccounts/update/widget.js","app/generalledgeraccounts/view.js","app/generalledgeraccounts/widget.js","app/header/template.hbs","app/header/view.js","app/header/widget.js","app/journal/create/template.hbs","app/journal/create/view.js","app/journal/create/widget.js","app/journal/entry-detail-input/template.hbs","app/journal/entry-detail-input/view.js","app/journal/entry-status-balanced.hbs","app/journal/entry-status-discrepancy.hbs","app/journal/import/error-template.hbs","app/journal/import/has-journal-entries.hbs","app/journal/import/template.hbs","app/journal/import/view.js","app/journal/import/widget.js","app/journal/journal-entry/detail.js","app/journal/journal-entry/entry.js","app/journal/journal-router.js","app/journal/journal-service.js","app/journal/list/item-template.hbs","app/journal/list/item-view.js","app/journal/list/journal-entry-actions.hbs","app/journal/list/journal-entry-list.js","app/journal/list/template.hbs","app/journal/list/view.js","app/journal/list/widget.js","app/journal/read/template.hbs","app/journal/read/view.js","app/journal/update/template.hbs","app/journal/update/view.js","app/journal/update/widget.js","app/journal/view.js","app/journal/widget.js","app/lists/contacts/common/line-item.hbs","app/lists/contacts/contacts.js","app/lists/contacts/create/template.hbs","app/lists/contacts/create/view.js","app/lists/contacts/import/error-template.hbs","app/lists/contacts/import/has-contacts.hbs","app/lists/contacts/import/template.hbs","app/lists/contacts/import/view.js","app/lists/contacts/import/widget.js","app/lists/contacts/item/contact.js","app/lists/contacts/item/template.hbs","app/lists/contacts/item/view.js","app/lists/contacts/list/template.hbs","app/lists/contacts/list/view.js","app/lists/contacts/read/template.hbs","app/lists/contacts/read/view.js","app/lists/contacts/service.js","app/lists/contacts/update/template.hbs","app/lists/contacts/update/view.js","app/lists/contacts/view.js","app/lists/contacts/widget.js","app/lists/customers/create/template.hbs","app/lists/customers/create/view.js","app/lists/customers/customers.js","app/lists/customers/import/error-template.hbs","app/lists/customers/import/has-customers.hbs","app/lists/customers/import/template.hbs","app/lists/customers/import/view.js","app/lists/customers/import/widget.js","app/lists/customers/item/customer.js","app/lists/customers/item/template.hbs","app/lists/customers/item/view.js","app/lists/customers/list/template.hbs","app/lists/customers/list/view.js","app/lists/customers/read/template.hbs","app/lists/customers/read/view.js","app/lists/customers/service.js","app/lists/customers/update/template.hbs","app/lists/customers/update/view.js","app/lists/customers/view.js","app/lists/customers/widget.js","app/lists/departments/service.js","app/lists/fixed-asset/create/template.hbs","app/lists/fixed-asset/create/view.js","app/lists/fixed-asset/fixed-assets.js","app/lists/fixed-asset/import/error-template.hbs","app/lists/fixed-asset/import/has-fixedAssets.hbs","app/lists/fixed-asset/import/template.hbs","app/lists/fixed-asset/import/view.js","app/lists/fixed-asset/import/widget.js","app/lists/fixed-asset/item/fixed-asset.js","app/lists/fixed-asset/item/template.hbs","app/lists/fixed-asset/item/view.js","app/lists/fixed-asset/list/template.hbs","app/lists/fixed-asset/list/view.js","app/lists/fixed-asset/read/view.js","app/lists/fixed-asset/service.js","app/lists/fixed-asset/update/view.js","app/lists/fixed-asset/view.js","app/lists/fixed-asset/widget.js","app/lists/list/create/view.js","app/lists/list/item/entry.js","app/lists/list/item/view.js","app/lists/list/list.js","app/lists/list/list/view.js","app/lists/list/service.js","app/lists/list/view.js","app/lists/list/widget.js","app/lists/router.js","app/lists/sales-entry/create/template.hbs","app/lists/sales-entry/create/view.js","app/lists/sales-entry/import/error-template.hbs","app/lists/sales-entry/import/has-salesEntries.hbs","app/lists/sales-entry/import/template.hbs","app/lists/sales-entry/import/view.js","app/lists/sales-entry/import/widget.js","app/lists/sales-entry/item/sale-entry.js","app/lists/sales-entry/item/template.hbs","app/lists/sales-entry/item/view.js","app/lists/sales-entry/list/template.hbs","app/lists/sales-entry/list/view.js","app/lists/sales-entry/read/template.hbs","app/lists/sales-entry/read/view.js","app/lists/sales-entry/sale-entries.js","app/lists/sales-entry/service.js","app/lists/sales-entry/update/template.hbs","app/lists/sales-entry/update/view.js","app/lists/sales-entry/view.js","app/lists/sales-entry/widget.js","app/lists/sales-taxes/create/template.hbs","app/lists/sales-taxes/create/view.js","app/lists/sales-taxes/item/sales-tax.js","app/lists/sales-taxes/item/template.hbs","app/lists/sales-taxes/item/view.js","app/lists/sales-taxes/list/template.hbs","app/lists/sales-taxes/list/view.js","app/lists/sales-taxes/read/template.hbs","app/lists/sales-taxes/read/view.js","app/lists/sales-taxes/sales-taxes.js","app/lists/sales-taxes/service.js","app/lists/sales-taxes/update/template.hbs","app/lists/sales-taxes/update/view.js","app/lists/sales-taxes/view.js","app/lists/sales-taxes/widget.js","app/lists/vendors/common/line-item.hbs","app/lists/vendors/create/template.hbs","app/lists/vendors/create/view.js","app/lists/vendors/expense-distribution-line-item.hbs","app/lists/vendors/import/error-template.hbs","app/lists/vendors/import/has-vendors.hbs","app/lists/vendors/import/template.hbs","app/lists/vendors/import/view.js","app/lists/vendors/import/widget.js","app/lists/vendors/item/template.hbs","app/lists/vendors/item/vendor.js","app/lists/vendors/item/view.js","app/lists/vendors/list/template.hbs","app/lists/vendors/list/view.js","app/lists/vendors/read/template.hbs","app/lists/vendors/read/view.js","app/lists/vendors/service.js","app/lists/vendors/update/template.hbs","app/lists/vendors/update/view.js","app/lists/vendors/vendors.js","app/lists/vendors/view.js","app/lists/vendors/widget.js","app/login/forgot-password/request-sent-template.hbs","app/login/forgot-password/template.hbs","app/login/forgot-password/view.js","app/login/forgot-password/widget.js","app/login/reset-password/template.hbs","app/login/reset-password/view.js","app/login/reset-password/widget.js","app/login/router.js","app/login/service.js","app/login/template.hbs","app/login/view.js","app/login/widget.js","app/memorization/invoices/service.js","app/memorization/journal-entries/service.js","app/memorization/payables/service.js","app/memorization/quotes/service.js","app/memorization/recurring/create/template.hbs","app/memorization/recurring/create/view.js","app/memorization/recurring/item/recurring.js","app/memorization/recurring/item/template.hbs","app/memorization/recurring/item/view.js","app/memorization/recurring/list/template.hbs","app/memorization/recurring/list/view.js","app/memorization/recurring/recurring-memorizations.js","app/memorization/recurring/service.js","app/memorization/recurring/template.hbs","app/memorization/recurring/view.js","app/memorization/recurring/widget.js","app/memorization/router.js","app/memorization/service.js","app/modals/MaterialButton.js","app/nav/template.hbs","app/nav/view.js","app/nav/widget.js","app/payables/apply-payment/filter/template.hbs","app/payables/apply-payment/filter/view.js","app/payables/apply-payment/listing/template.hbs","app/payables/apply-payment/listing/view.js","app/payables/apply-payment/summary/template.hbs","app/payables/apply-payment/summary/view.js","app/payables/apply-payment/template.hbs","app/payables/apply-payment/view.js","app/payables/apply-payment/widget.js","app/payables/payable/create/expense-distribution.hbs","app/payables/payable/create/template.hbs","app/payables/payable/create/view.js","app/payables/payable/item/payable.js","app/payables/payable/item/template.hbs","app/payables/payable/item/view.js","app/payables/payable/list/template.hbs","app/payables/payable/list/view.js","app/payables/payable/payables.js","app/payables/payable/read/payment-history-line-item.hbs","app/payables/payable/read/view.js","app/payables/payable/service.js","app/payables/payable/update/view.js","app/payables/payable/view.js","app/payables/payable/widget.js","app/payables/router.js","app/payment-link/router.js","app/payment-link/service.js","app/payment-link/template.hbs","app/payment-link/view.js","app/payment-link/widget.js","app/receivables/deposits/create/template.hbs","app/receivables/deposits/create/view.js","app/receivables/deposits/deposits.js","app/receivables/deposits/item/deposit.js","app/receivables/deposits/item/template.hbs","app/receivables/deposits/item/view.js","app/receivables/deposits/list/template.hbs","app/receivables/deposits/list/view.js","app/receivables/deposits/read/view.js","app/receivables/deposits/service.js","app/receivables/deposits/update/view.js","app/receivables/deposits/view.js","app/receivables/deposits/widget.js","app/receivables/invoices/apply-payment/template.hbs","app/receivables/invoices/apply-payment/view.js","app/receivables/invoices/create/template.hbs","app/receivables/invoices/create/view.js","app/receivables/invoices/invoices.js","app/receivables/invoices/item/invoice.js","app/receivables/invoices/item/template.hbs","app/receivables/invoices/item/view.js","app/receivables/invoices/list/template.hbs","app/receivables/invoices/list/view.js","app/receivables/invoices/read-payments/template.hbs","app/receivables/invoices/read-payments/view.js","app/receivables/invoices/read/view.js","app/receivables/invoices/service.js","app/receivables/invoices/update/view.js","app/receivables/invoices/view.js","app/receivables/invoices/widget.js","app/receivables/payments/create/line-item.hbs","app/receivables/payments/create/template.hbs","app/receivables/payments/create/view.js","app/receivables/payments/item/payment.js","app/receivables/payments/item/template.hbs","app/receivables/payments/item/view.js","app/receivables/payments/list/template.hbs","app/receivables/payments/list/view.js","app/receivables/payments/payments.js","app/receivables/payments/read/view.js","app/receivables/payments/service.js","app/receivables/payments/update/view.js","app/receivables/payments/view.js","app/receivables/payments/widget.js","app/receivables/quote/item/quote-entry.js","app/receivables/quote/item/template.hbs","app/receivables/quote/item/view.js","app/receivables/quote/list/template.hbs","app/receivables/quote/list/view.js","app/receivables/quote/update/view.js","app/receivables/quote/view.js","app/receivables/quote/widget.js","app/receivables/quotes/create/line-item.hbs","app/receivables/quotes/create/template.hbs","app/receivables/quotes/create/view.js","app/receivables/quotes/item/quote.js","app/receivables/quotes/item/template.hbs","app/receivables/quotes/item/view.js","app/receivables/quotes/list/template.hbs","app/receivables/quotes/list/view.js","app/receivables/quotes/quotes.js","app/receivables/quotes/service.js","app/receivables/quotes/view.js","app/receivables/quotes/widget.js","app/receivables/router.js","app/registration/registration-router.js","app/registration/registration-service.js","app/registration/registration-view.js","app/registration/registration-widget.js","app/registration/registration.hbs","app/reports/accounts-payable-aging/template.hbs","app/reports/accounts-payable-aging/view.js","app/reports/accounts-payable-aging/widget.js","app/reports/accounts-receivable-aging/template.hbs","app/reports/accounts-receivable-aging/view.js","app/reports/accounts-receivable-aging/widget.js","app/reports/balance-sheet/template.hbs","app/reports/balance-sheet/view.js","app/reports/balance-sheet/widget.js","app/reports/chart-of-accounts/report.hbs","app/reports/chart-of-accounts/view.js","app/reports/chart-of-accounts/widget.js","app/reports/checkbook-disbursements/template.hbs","app/reports/checkbook-disbursements/view.js","app/reports/checkbook-disbursements/widget.js","app/reports/checkbook-register/report.js","app/reports/checkbook-register/service.js","app/reports/checkbook-register/template.hbs","app/reports/checkbook-register/view.js","app/reports/checkbook-register/widget.js","app/reports/checkbook/reconciliation/list/template.hbs","app/reports/checkbook/reconciliation/list/view.js","app/reports/checkbook/reconciliation/list/widget.js","app/reports/checkbook/reconciliation/notes/template.hbs","app/reports/checkbook/reconciliation/notes/view.js","app/reports/checkbook/reconciliation/notes/widget.js","app/reports/checkbook/reconciliation/report.js","app/reports/checkbook/reconciliation/summary/template.hbs","app/reports/checkbook/reconciliation/summary/view.js","app/reports/checkbook/reconciliation/summary/widget.js","app/reports/checkbook/reconciliation/template.hbs","app/reports/checkbook/reconciliation/view.js","app/reports/checkbook/reconciliation/widget.js","app/reports/customer-list/report.hbs","app/reports/customer-list/view.js","app/reports/customer-list/widget.js","app/reports/customer-sales-journal/template.hbs","app/reports/customer-sales-journal/view.js","app/reports/customer-sales-journal/widget.js","app/reports/department/template.hbs","app/reports/department/view.js","app/reports/department/widget.js","app/reports/fixed-asset/template.hbs","app/reports/fixed-asset/view.js","app/reports/fixed-asset/widget.js","app/reports/general-ledger-report/general-ledger-report-service.js","app/reports/general-ledger-report/general-ledger-report.js","app/reports/general-ledger-report/ledger-entry.js","app/reports/general-ledger-report/view-general-ledger-report-view.js","app/reports/general-ledger-report/view-general-ledger-report-widget.js","app/reports/general-ledger-report/view-general-ledger-report.hbs","app/reports/income-statement/template.hbs","app/reports/income-statement/view.js","app/reports/income-statement/widget.js","app/reports/information-return-report/entry.js","app/reports/information-return-report/report.js","app/reports/information-return-report/service.js","app/reports/information-return-report/template.hbs","app/reports/information-return-report/view.js","app/reports/information-return-report/widget.js","app/reports/item-sales-journal/template.hbs","app/reports/item-sales-journal/view.js","app/reports/item-sales-journal/widget.js","app/reports/purchases-journal/template.hbs","app/reports/purchases-journal/view.js","app/reports/purchases-journal/widget.js","app/reports/report-router.js","app/reports/report-service.js","app/reports/sales-tax-rate/template.hbs","app/reports/sales-tax-rate/view.js","app/reports/sales-tax-rate/widget.js","app/reports/trial-balance/report-view.js","app/reports/trial-balance/report-widget.js","app/reports/trial-balance/report.hbs","app/reports/trial-balance/trial-balance-account.js","app/reports/trial-balance/trial-balance-report.js","app/reports/trial-balance/trial-balance-service.js","app/reports/vendor-list/report.hbs","app/reports/vendor-list/view.js","app/reports/vendor-list/widget.js","app/rest/client.js","app/router.js","app/session/session-service.js","app/settings/accounting-method/template.hbs","app/settings/accounting-method/view.js","app/settings/accounting-method/widget.js","app/settings/accounts/accounts.js","app/settings/accounts/template.hbs","app/settings/accounts/view.js","app/settings/accounts/widget.js","app/settings/business-settings/service.js","app/settings/business-settings/template.hbs","app/settings/business-settings/view.js","app/settings/business-settings/widget.js","app/settings/checkbook/transactions/template.hbs","app/settings/checkbook/transactions/view.js","app/settings/checkbook/transactions/widget.js","app/settings/checkbooks/checkbooks.js","app/settings/checkbooks/create/template.hbs","app/settings/checkbooks/create/view.js","app/settings/checkbooks/item/checkbook.js","app/settings/checkbooks/item/template.hbs","app/settings/checkbooks/item/view.js","app/settings/checkbooks/list/template.hbs","app/settings/checkbooks/list/view.js","app/settings/checkbooks/read/template.hbs","app/settings/checkbooks/read/view.js","app/settings/checkbooks/service.js","app/settings/checkbooks/update/template.hbs","app/settings/checkbooks/update/view.js","app/settings/checkbooks/view.js","app/settings/checkbooks/widget.js","app/settings/closing-entries/balance-mapping/service.js","app/settings/closing-entries/balance-sheet-distribution.hbs","app/settings/closing-entries/income-allocation/service.js","app/settings/closing-entries/income-statement-distribution.hbs","app/settings/closing-entries/template.hbs","app/settings/closing-entries/view.js","app/settings/closing-entries/widget.js","app/settings/invoices/logo/template.hbs","app/settings/invoices/logo/view.js","app/settings/invoices/logo/widget.js","app/settings/invoices/service.js","app/settings/invoices/template.hbs","app/settings/invoices/view.js","app/settings/invoices/widget.js","app/settings/memorizations/create/template.hbs","app/settings/memorizations/create/view.js","app/settings/memorizations/item/memorization.js","app/settings/memorizations/item/template.hbs","app/settings/memorizations/item/view.js","app/settings/memorizations/list/template.hbs","app/settings/memorizations/list/view.js","app/settings/memorizations/memorizations.js","app/settings/memorizations/view.js","app/settings/memorizations/widget.js","app/settings/profile/template.hbs","app/settings/profile/view.js","app/settings/profile/widget.js","app/settings/reconciliations/list/list.hbs","app/settings/reconciliations/list/view.js","app/settings/reconciliations/list/widget.js","app/settings/reconciliations/reconciliation.js","app/settings/router.js","app/settings/subscription/billing-info/template.hbs","app/settings/subscription/billing-info/view.js","app/settings/subscription/billing-info/widget.js","app/settings/subscription/plan-selection/list/template.hbs","app/settings/subscription/plan-selection/list/view.js","app/settings/subscription/plan-selection/template.hbs","app/settings/subscription/plan-selection/view.js","app/settings/subscription/plan-selection/widget.js","app/settings/subscription/receipt/template.hbs","app/settings/subscription/receipt/view.js","app/settings/subscription/receipt/widget.js","app/settings/subscription/service.js","app/settings/subscription/summary/confirm-modal/template.hbs","app/settings/subscription/summary/confirm-modal/view.js","app/settings/subscription/summary/confirm-modal/widget.js","app/settings/subscription/summary/template.hbs","app/settings/subscription/summary/view.js","app/settings/subscription/summary/widget.js","app/settings/subscription/update-billingInfo/view.js","app/settings/subscription/update-billingInfo/widget.js","app/settings/subscription/update-plan/confirm-modal/template.hbs","app/settings/subscription/update-plan/confirm-modal/view.js","app/settings/subscription/update-plan/confirm-modal/widget.js","app/settings/subscription/update-plan/list/template.hbs","app/settings/subscription/update-plan/list/view.js","app/settings/subscription/update-plan/view.js","app/settings/subscription/update-plan/widget.js","app/settings/subscription/view.js","app/settings/subscription/widget.js","app/settings/subscription/wizard/confirm-modal/template.hbs","app/settings/subscription/wizard/confirm-modal/view.js","app/settings/subscription/wizard/confirm-modal/widget.js","app/settings/subscription/wizard/template.hbs","app/settings/subscription/wizard/view.js","app/settings/subscription/wizard/widget.js","app/settings/users/create/template.hbs","app/settings/users/create/view.js","app/settings/users/item/template.hbs","app/settings/users/item/user.js","app/settings/users/item/view.js","app/settings/users/list/template.hbs","app/settings/users/list/view.js","app/settings/users/service.js","app/settings/users/update/template.hbs","app/settings/users/update/view.js","app/settings/users/users.js","app/settings/users/view.js","app/settings/users/widget.js","app/spinner/template.hbs","app/spinner/view.js","app/welcome/router.js","app/welcome/template.hbs","app/welcome/view.js","app/welcome/widget.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5LA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApzCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3NA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlGA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7GA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjZA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhIA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/GA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1TA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvLA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7PA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3kBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5PA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7GA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5HA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlCA;AAAA;ACAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApRA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtOA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7GA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxQA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhIA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1UA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArGA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjGA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3FA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5FA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAbA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3HA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhIA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvIA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7YA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArGA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnKA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1JA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/LA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtGA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtKA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AAAA;CCAA;AAAA;AAAA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/IA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3HA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAbA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/MA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhKA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1KA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1IA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnGA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxGA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhSA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzIA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5WA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvPA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1OA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhNA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5FA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1GA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxPA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhPA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxOA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxIA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApNA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlIA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlNA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnNA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7IA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvGA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnJA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnNA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxVA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtMA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtQA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhOA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnNA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApIA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3IA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlaA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApNA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9IA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9FA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9PA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/FA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAbA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzLA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzGA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3NA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3aA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1NA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvJA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3QA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlMA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxJA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArOA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3LA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAbA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxLA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/KA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5QA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/PA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9FA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtMA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArNA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7NA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/kBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9QA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1OA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/FA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/FA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApKA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArJA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzLA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5JA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlGA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlIA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5HA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3HA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1HA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjIA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9HA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApKA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7ZA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1HA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApGA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApIA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1FA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7HA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxPA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhLA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhIA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3JA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnGA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjYA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhRA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/KA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9NA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/HA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7FA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnKA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3GA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxKA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3MA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzMA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApFA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjQA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxHA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/CA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjNA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3DA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AArBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlCA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhDA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvEA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA/EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApBA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA9EA;AAAA;CCAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7CA;AAAA","file":"public\\js\\app.js","sourcesContent":["var numbro = require('numbro')\r\n\r\nmodule.exports = {\r\n initialize: function () {\r\n window.Handlebars.registerPartial('floatingInput', require('forms/floating-input'))\r\n window.Handlebars.registerPartial('floatingInputTaxRate', require('forms/floating-input-tax-rate'))\r\n window.Handlebars.registerPartial('stateSelect', require('forms/state-selection'))\r\n window.Handlebars.registerPartial('checkbox', require('forms/checkbox'))\r\n window.Handlebars.registerPartial('textarea', require('forms/textarea'))\r\n window.Handlebars.registerPartial('ribbon', require('forms/ribbon'))\r\n window.Handlebars.registerPartial('dateInput', require('forms/date-input'))\r\n window.Handlebars.registerHelper('numbro-nozero', function (text) {\r\n if (text === '0' || text === 0) {\r\n return ''\r\n }\r\n return numbro(text).formatCurrency('($0,0.00)')\r\n })\r\n window.Handlebars.registerHelper('hasUniqueId', function (options) {\r\n if (options.data) {\r\n this.uniqueId = Date.now().toString() + Math.random().toString().substr(2)\r\n }\r\n return options.fn(this)\r\n })\r\n window.Handlebars.registerHelper('add', function (a, b) {\r\n return Number(a) + Number(b)\r\n })\r\n window.Handlebars.registerHelper('numbro-negative-nozero', function (text) {\r\n if (text === '0' || text === 0) {\r\n return ''\r\n }\r\n return numbro(-Number(text)).formatCurrency('($0,0.00)')\r\n })\r\n window.Handlebars.registerHelper('numbro', function (text) {\r\n return numbro(text).formatCurrency('($0,0.00)')\r\n })\r\n\r\n window.Handlebars.registerHelper('numbro-report', function (text) {\r\n if (text === '0' || text === 0) {\r\n return ''\r\n }\r\n return numbro(text).format('(0,0.00)')\r\n })\r\n\r\n window.Handlebars.registerHelper('numbro-report-negative', function (text) {\r\n if (text === '0' || text === 0) {\r\n return ''\r\n }\r\n return numbro(-Number(text)).format('(0,0.00)')\r\n })\r\n\r\n window.Handlebars.registerHelper('numbro-report-showzero', function (text) {\r\n return numbro(text).format('(0,0.00)')\r\n })\r\n\r\n window.Handlebars.registerHelper('numbro-report-showzero-negative', function (text) {\r\n return numbro(-Number(text)).format('(0,0.00)')\r\n })\r\n\r\n window.Handlebars.registerHelper('if_gt_1', function (num, options) {\r\n if (Number(num) > 1) {\r\n return options.fn(this)\r\n } else {\r\n return options.inverse(this)\r\n }\r\n })\r\n\r\n window.Handlebars.registerHelper('if_gt_0', function (num, options) {\r\n if (Number(num) > 0) {\r\n return options.fn(this)\r\n } else {\r\n return options.inverse(this)\r\n }\r\n })\r\n\r\n window.Handlebars.registerHelper('if_gt', function (value, num, options) {\r\n if (Number(num) < Number(value)) {\r\n return options.fn(this)\r\n } else {\r\n return options.inverse(this)\r\n }\r\n })\r\n\r\n window.Handlebars.registerHelper('if_gteq_lteq', function (num1, num2, value, options) {\r\n if ((Number(num1) <= Number(value)) && (Number(value) <= Number(num2))) {\r\n return options.fn(this)\r\n } else {\r\n return options.inverse(this)\r\n }\r\n })\r\n\r\n window.Handlebars.registerHelper('if_less_than', function (num1, num2, options) {\r\n if (Number(num1) < Number(num2)) {\r\n return options.fn(this)\r\n } else {\r\n return options.inverse(this)\r\n }\r\n })\r\n\r\n window.Handlebars.registerHelper('if_eq', function (a, b, options) {\r\n if (a === b) {\r\n return options.fn(this)\r\n } else {\r\n return options.inverse(this)\r\n }\r\n })\r\n\r\n window.Handlebars.registerHelper('if_not_null', function (a, options) {\r\n if (a !== undefined && a !== null) {\r\n return options.fn(this)\r\n } else {\r\n return options.inverse(this)\r\n }\r\n })\r\n\r\n window.Handlebars.registerHelper('if_not_eq_0', function (num, options) {\r\n if (Number(num) !== 0) {\r\n return options.fn(this)\r\n } else {\r\n return options.inverse(this)\r\n }\r\n })\r\n\r\n window.Handlebars.registerHelper('if_eq_or_3arg', function (a, v1, v2, v3, options) {\r\n if (a === v1 || a === v2 || a === v3) {\r\n return options.fn(this)\r\n } else {\r\n return options.inverse(this)\r\n }\r\n })\r\n\r\n window.Handlebars.registerHelper('if_eq_or_2arg', function (a, v1, v2, options) {\r\n if (a === v1 || a === v2) {\r\n return options.fn(this)\r\n } else {\r\n return options.inverse(this)\r\n }\r\n })\r\n\r\n window.Handlebars.registerHelper('limit', function (arr, limit) {\r\n return arr.slice(0, limit)\r\n })\r\n\r\n /*\r\n * ex. {{#if (or section1 section2)}} .. content {{/if}} *note: same as => if (section1 || section2)\r\n * ---------------------------------------------------------------------------------------------------\r\n * ex. {{#if (or (eq section1 \"foo\") (ne section2 \"bar\"))}} .. content {{/if}}\r\n * *note: same as => if ((section1 == \"foo\") || (section2 != \"bar\"))\r\n */\r\n window.Handlebars.registerHelper({\r\n eq_zero_or_one: function (v1) {\r\n return (v1 == 0 || v1 == 1)\r\n },\r\n eq_null: function (v1) {\r\n return v1 == null\r\n },\r\n equal: function (v1, v2) {\r\n return v1 == v2\r\n },\r\n eq: function (v1, v2) {\r\n return v1 === v2\r\n },\r\n notequal: function (v1, v2) {\r\n return v1 != v2\r\n },\r\n ne: function (v1, v2) {\r\n return v1 !== v2\r\n },\r\n lt: function (v1, v2) {\r\n return v1 < v2\r\n },\r\n gt: function (v1, v2) {\r\n return v1 > v2\r\n },\r\n lte: function (v1, v2) {\r\n return v1 <= v2\r\n },\r\n gte: function (v1, v2) {\r\n return v1 >= v2\r\n },\r\n and: function (v1, v2) {\r\n return v1 && v2\r\n },\r\n or: function (v1, v2) {\r\n return v1 || v2\r\n }\r\n })\r\n }\r\n}\r\n","/*\r\n * Document : app.js\r\n * Author : pixelcave\r\n * Description: UI Framework Custom Functionality (available to all pages)\r\n *\r\n */\r\n\r\nvar $lHtml, $lBody, $lPage, $lSidebar, $lSidebarScroll, $lSideOverlay, $lSideOverlayScroll, $lHeader, $lMain, $lFooter\r\n\r\nvar App = function ($instance) {\r\n // Helper variables - set in uiInit()\r\n\r\n /*\r\n ********************************************************************************************\r\n *\r\n * BASE UI FUNCTIONALITY\r\n *\r\n * Functions which handle vital UI functionality such as main navigation and layout\r\n * They are auto initialized in every page\r\n *\r\n *********************************************************************************************\r\n */\r\n\r\n // User Interface init\r\n var uiInit = function () {\r\n // Set variables\r\n if (!$lHtml || !$lHtml.length) {\r\n $lHtml = $instance('html')\r\n }\r\n if (!$lBody || !$lBody.length) {\r\n $lBody = $instance('body')\r\n }\r\n if (!$lPage || !$lPage.length) {\r\n $lPage = $instance('#page-container')\r\n }\r\n if (!$lSidebar || !$lSidebar.length) {\r\n $lSidebar = $instance('#sidebar')\r\n }\r\n if (!$lSidebarScroll || !$lSidebarScroll.length) {\r\n $lSidebarScroll = $instance('#sidebar-scroll')\r\n }\r\n if (!$lSideOverlay || !$lSideOverlay.length) {\r\n $lSideOverlay = $instance('#side-overlay')\r\n }\r\n if (!$lSideOverlayScroll || !$lSideOverlayScroll.length) {\r\n $lSideOverlayScroll = $instance('#side-overlay-scroll')\r\n }\r\n if (!$lHeader || !$lHeader.length) {\r\n $lHeader = $instance('#header-navbar')\r\n }\r\n if (!$lMain || !$lMain.length) {\r\n $lMain = $instance('#main-container')\r\n }\r\n if (!$lFooter || !$lFooter.length) {\r\n $lFooter = $instance('#page-footer')\r\n }\r\n\r\n // Initialize Tooltips\r\n $instance('[data-toggle=\"tooltip\"], .js-tooltip').tooltip({\r\n container: 'body',\r\n animation: false\r\n })\r\n\r\n // Initialize Popovers\r\n $instance('[data-toggle=\"popover\"], .js-popover').popover({\r\n container: 'body',\r\n animation: true,\r\n trigger: 'hover'\r\n })\r\n\r\n // Initialize Tabs\r\n $instance('[data-toggle=\"tabs\"] a, .js-tabs a').click(function (e) {\r\n e.preventDefault()\r\n $instance(this).tab('show')\r\n })\r\n\r\n // Init form placeholder (for IE9)\r\n $instance('.form-control').placeholder()\r\n }\r\n\r\n // Layout functionality\r\n var uiLayout = function () {\r\n // Resizes #main-container min height (push footer to the bottom)\r\n var $resizeTimeout\r\n\r\n if ($lMain.length) {\r\n uiHandleMain()\r\n\r\n $instance(window).on('resize orientationchange', function () {\r\n clearTimeout($resizeTimeout)\r\n\r\n $resizeTimeout = setTimeout(function () {\r\n uiHandleMain()\r\n }, 150)\r\n })\r\n }\r\n\r\n // Init sidebar and side overlay custom scrolling\r\n uiHandleScroll('init')\r\n\r\n // Init transparent header functionality (solid on scroll - used in frontend)\r\n if ($lPage.hasClass('header-navbar-fixed') && $lPage.hasClass('header-navbar-transparent')) {\r\n $instance(window).on('scroll', function () {\r\n if ($instance(this).scrollTop() > 20) {\r\n $lPage.addClass('header-navbar-scroll')\r\n } else {\r\n $lPage.removeClass('header-navbar-scroll')\r\n }\r\n })\r\n }\r\n\r\n // Call layout API on button click\r\n $instance('[data-toggle=\"layout\"]').on('click', function () {\r\n var $btn = $instance(this)\r\n\r\n uiLayoutApi($btn.data('action'))\r\n\r\n if ($lHtml.hasClass('no-focus')) {\r\n $btn.blur()\r\n }\r\n })\r\n }\r\n\r\n // Resizes #main-container to fill empty space if exists\r\n var uiHandleMain = function () {\r\n var $hWindow = $instance(window).height()\r\n var $hHeader = $lHeader.outerHeight()\r\n var $hFooter = $lFooter.outerHeight()\r\n\r\n if ($lPage.hasClass('header-navbar-fixed')) {\r\n $lMain.css('min-height', $hWindow - $hFooter)\r\n } else {\r\n $lMain.css('min-height', $hWindow - ($hHeader + $hFooter))\r\n }\r\n }\r\n\r\n // Handles sidebar and side overlay custom scrolling functionality\r\n var uiHandleScroll = function ($mode) {\r\n var $windowW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth\r\n\r\n // Init scrolling\r\n if ($mode === 'init') {\r\n // Init scrolling only if required the first time\r\n uiHandleScroll()\r\n\r\n // Handle scrolling on resize or orientation change\r\n var $sScrollTimeout\r\n\r\n $instance(window).on('resize orientationchange', function () {\r\n clearTimeout($sScrollTimeout)\r\n\r\n $sScrollTimeout = setTimeout(function () {\r\n uiHandleScroll()\r\n }, 150)\r\n })\r\n } else {\r\n // If screen width is greater than 991 pixels and .side-scroll is added to #page-container\r\n if ($windowW > 991 && $lPage.hasClass('side-scroll')) {\r\n // Turn scroll lock off (sidebar and side overlay - slimScroll will take care of it)\r\n $instance($lSidebar).scrollLock('off')\r\n $instance($lSideOverlay).scrollLock('off')\r\n\r\n // If sidebar scrolling does not exist init it..\r\n if ($lSidebarScroll.length && (!$lSidebarScroll.parent('.slimScrollDiv').length)) {\r\n $lSidebarScroll.slimScroll({\r\n height: $lSidebar.outerHeight(),\r\n color: '#fff',\r\n size: '5px',\r\n opacity: .35,\r\n wheelStep: 15,\r\n distance: '2px',\r\n railVisible: false,\r\n railOpacity: 1\r\n })\r\n } else { // ..else resize scrolling height\r\n $lSidebarScroll\r\n .add($lSidebarScroll.parent())\r\n .css('height', $lSidebar.outerHeight())\r\n }\r\n\r\n // If side overlay scrolling does not exist init it..\r\n if ($lSideOverlayScroll.length && (!$lSideOverlayScroll.parent('.slimScrollDiv').length)) {\r\n $lSideOverlayScroll.slimScroll({\r\n height: $lSideOverlay.outerHeight(),\r\n color: '#000',\r\n size: '5px',\r\n opacity: .35,\r\n wheelStep: 15,\r\n distance: '2px',\r\n railVisible: false,\r\n railOpacity: 1\r\n })\r\n } else { // ..else resize scrolling height\r\n $lSideOverlayScroll\r\n .add($lSideOverlayScroll.parent())\r\n .css('height', $lSideOverlay.outerHeight())\r\n }\r\n } else {\r\n // Turn scroll lock on (sidebar and side overlay)\r\n $instance($lSidebar).scrollLock()\r\n $instance($lSideOverlay).scrollLock()\r\n\r\n // If sidebar scrolling exists destroy it..\r\n if ($lSidebarScroll.length && $lSidebarScroll.parent('.slimScrollDiv').length) {\r\n $lSidebarScroll\r\n .slimScroll({destroy: true})\r\n $lSidebarScroll\r\n .attr('style', '')\r\n }\r\n\r\n // If side overlay scrolling exists destroy it..\r\n if ($lSideOverlayScroll.length && $lSideOverlayScroll.parent('.slimScrollDiv').length) {\r\n $lSideOverlayScroll\r\n .slimScroll({destroy: true})\r\n $lSideOverlayScroll\r\n .attr('style', '')\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Layout API\r\n var uiLayoutApi = function ($mode) {\r\n var $windowW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth\r\n\r\n // Mode selection\r\n switch ($mode) {\r\n case 'sidebar_pos_toggle':\r\n $lPage.toggleClass('sidebar-l sidebar-r')\r\n break\r\n case 'sidebar_pos_left':\r\n $lPage\r\n .removeClass('sidebar-r')\r\n .addClass('sidebar-l')\r\n break\r\n case 'sidebar_pos_right':\r\n $lPage\r\n .removeClass('sidebar-l')\r\n .addClass('sidebar-r')\r\n break\r\n case 'sidebar_toggle':\r\n if ($windowW > 991) {\r\n $lPage.toggleClass('sidebar-o')\r\n } else {\r\n $lPage.toggleClass('sidebar-o-xs')\r\n }\r\n break\r\n case 'sidebar_open':\r\n if ($windowW > 991) {\r\n $lPage.addClass('sidebar-o')\r\n } else {\r\n $lPage.addClass('sidebar-o-xs')\r\n }\r\n break\r\n case 'sidebar_close':\r\n if ($windowW > 991) {\r\n $lPage.removeClass('sidebar-o')\r\n } else {\r\n $lPage.removeClass('sidebar-o-xs')\r\n }\r\n break\r\n case 'sidebar_mini_toggle':\r\n if ($windowW > 991) {\r\n $lPage.toggleClass('sidebar-mini')\r\n }\r\n break\r\n case 'sidebar_mini_on':\r\n if ($windowW > 991) {\r\n $lPage.addClass('sidebar-mini')\r\n }\r\n break\r\n case 'sidebar_mini_off':\r\n if ($windowW > 991) {\r\n $lPage.removeClass('sidebar-mini')\r\n }\r\n break\r\n case 'side_overlay_toggle':\r\n $lPage.toggleClass('side-overlay-o')\r\n break\r\n case 'side_overlay_open':\r\n $lPage.addClass('side-overlay-o')\r\n break\r\n case 'side_overlay_close':\r\n $lPage.removeClass('side-overlay-o')\r\n break\r\n case 'side_overlay_hoverable_toggle':\r\n $lPage.toggleClass('side-overlay-hover')\r\n break\r\n case 'side_overlay_hoverable_on':\r\n $lPage.addClass('side-overlay-hover')\r\n break\r\n case 'side_overlay_hoverable_off':\r\n $lPage.removeClass('side-overlay-hover')\r\n break\r\n case 'header_fixed_toggle':\r\n $lPage.toggleClass('header-navbar-fixed')\r\n break\r\n case 'header_fixed_on':\r\n $lPage.addClass('header-navbar-fixed')\r\n break\r\n case 'header_fixed_off':\r\n $lPage.removeClass('header-navbar-fixed')\r\n break\r\n case 'side_scroll_toggle':\r\n $lPage.toggleClass('side-scroll')\r\n uiHandleScroll()\r\n break\r\n case 'side_scroll_on':\r\n $lPage.addClass('side-scroll')\r\n uiHandleScroll()\r\n break\r\n case 'side_scroll_off':\r\n $lPage.removeClass('side-scroll')\r\n uiHandleScroll()\r\n break\r\n default:\r\n return false\r\n }\r\n }\r\n\r\n // Main navigation functionality\r\n var uiNav = function () {\r\n // When a submenu link is clicked\r\n\r\n // Changed from OneUI source:\r\n // Added data-oneui-bound flag to declare that the elements have already been bound to.\r\n\r\n $instance('[data-toggle=\"nav-submenu\"]:not([data-onui-bound])').on('click', function (e) {\r\n // Get link\r\n var $link = $instance(this)\r\n\r\n // Get link's parent\r\n var $parentLi = $link.parent('li')\r\n\r\n if ($parentLi.hasClass('open')) { // If submenu is open, close it..\r\n $parentLi.removeClass('open')\r\n } else { // .. else if submenu is closed, close all other (same level) submenus first before open it\r\n $link\r\n .closest('ul')\r\n .find('> li')\r\n .removeClass('open')\r\n\r\n $parentLi\r\n .addClass('open')\r\n }\r\n\r\n // Remove focus from submenu link\r\n if ($lHtml.hasClass('no-focus')) {\r\n $link.blur()\r\n }\r\n\r\n return false\r\n }).attr('data-onui-bound', true)\r\n }\r\n\r\n // Blocks options functionality\r\n var uiBlocks = function () {\r\n // Init default icons fullscreen and content toggle buttons\r\n uiBlocksApi(false, 'init')\r\n\r\n // Call blocks API on option button click\r\n $instance('[data-toggle=\"block-option\"]').on('click', function () {\r\n uiBlocksApi($instance(this).closest('.block'), $instance(this).data('action'))\r\n })\r\n }\r\n\r\n // Blocks API\r\n var uiBlocksApi = function ($block, $mode) {\r\n // Set default icons for fullscreen and content toggle buttons\r\n var $iconFullscreen = 'si si-size-fullscreen'\r\n var $iconFullscreenActive = 'si si-size-actual'\r\n var $iconContent = 'si si-arrow-up'\r\n var $iconContentActive = 'si si-arrow-down'\r\n\r\n if ($mode === 'init') {\r\n // Auto add the default toggle icons to fullscreen and content toggle buttons\r\n $instance('[data-toggle=\"block-option\"][data-action=\"fullscreen_toggle\"]').each(function () {\r\n var $this = $instance(this)\r\n\r\n $this.html('<i class=\"' + ($instance(this).closest('.block').hasClass('block-opt-fullscreen') ? $iconFullscreenActive : $iconFullscreen) + '\"></i>')\r\n })\r\n\r\n $instance('[data-toggle=\"block-option\"][data-action=\"content_toggle\"]').each(function () {\r\n var $this = $instance(this)\r\n\r\n $this.html('<i class=\"' + ($this.closest('.block').hasClass('block-opt-hidden') ? $iconContentActive : $iconContent) + '\"></i>')\r\n })\r\n } else {\r\n // Get block element\r\n var $elBlock = ($block instanceof $instance) ? $block : $instance($block)\r\n\r\n // If element exists, procceed with blocks functionality\r\n if ($elBlock.length) {\r\n // Get block option buttons if exist (need them to update their icons)\r\n var $btnFullscreen = $instance('[data-toggle=\"block-option\"][data-action=\"fullscreen_toggle\"]', $elBlock)\r\n var $btnToggle = $instance('[data-toggle=\"block-option\"][data-action=\"content_toggle\"]', $elBlock)\r\n\r\n // Mode selection\r\n switch ($mode) {\r\n case 'fullscreen_toggle':\r\n $elBlock.toggleClass('block-opt-fullscreen')\r\n\r\n // Enable/disable scroll lock to block\r\n $elBlock.hasClass('block-opt-fullscreen') ? $instance($elBlock).scrollLock() : $instance($elBlock).scrollLock('off')\r\n\r\n // Update block option icon\r\n if ($btnFullscreen.length) {\r\n if ($elBlock.hasClass('block-opt-fullscreen')) {\r\n $instance('i', $btnFullscreen)\r\n .removeClass($iconFullscreen)\r\n .addClass($iconFullscreenActive)\r\n } else {\r\n $instance('i', $btnFullscreen)\r\n .removeClass($iconFullscreenActive)\r\n .addClass($iconFullscreen)\r\n }\r\n }\r\n break\r\n case 'fullscreen_on':\r\n $elBlock.addClass('block-opt-fullscreen')\r\n\r\n // Enable scroll lock to block\r\n $instance($elBlock).scrollLock()\r\n\r\n // Update block option icon\r\n if ($btnFullscreen.length) {\r\n $instance('i', $btnFullscreen)\r\n .removeClass($iconFullscreen)\r\n .addClass($iconFullscreenActive)\r\n }\r\n break\r\n case 'fullscreen_off':\r\n $elBlock.removeClass('block-opt-fullscreen')\r\n\r\n // Disable scroll lock to block\r\n $instance($elBlock).scrollLock('off')\r\n\r\n // Update block option icon\r\n if ($btnFullscreen.length) {\r\n $instance('i', $btnFullscreen)\r\n .removeClass($iconFullscreenActive)\r\n .addClass($iconFullscreen)\r\n }\r\n break\r\n case 'content_toggle':\r\n $elBlock.toggleClass('block-opt-hidden')\r\n\r\n // Update block option icon\r\n if ($btnToggle.length) {\r\n if ($elBlock.hasClass('block-opt-hidden')) {\r\n $instance('i', $btnToggle)\r\n .removeClass($iconContent)\r\n .addClass($iconContentActive)\r\n } else {\r\n $instance('i', $btnToggle)\r\n .removeClass($iconContentActive)\r\n .addClass($iconContent)\r\n }\r\n }\r\n break\r\n case 'content_hide':\r\n $elBlock.addClass('block-opt-hidden')\r\n\r\n // Update block option icon\r\n if ($btnToggle.length) {\r\n $instance('i', $btnToggle)\r\n .removeClass($iconContent)\r\n .addClass($iconContentActive)\r\n }\r\n break\r\n case 'content_show':\r\n $elBlock.removeClass('block-opt-hidden')\r\n\r\n // Update block option icon\r\n if ($btnToggle.length) {\r\n $instance('i', $btnToggle)\r\n .removeClass($iconContentActive)\r\n .addClass($iconContent)\r\n }\r\n break\r\n case 'refresh_toggle':\r\n $elBlock.toggleClass('block-opt-refresh')\r\n\r\n // Return block to normal state if the demostration mode is on in the refresh option button - data-action-mode=\"demo\"\r\n if ($instance('[data-toggle=\"block-option\"][data-action=\"refresh_toggle\"][data-action-mode=\"demo\"]', $elBlock).length) {\r\n setTimeout(function () {\r\n $elBlock.removeClass('block-opt-refresh')\r\n }, 2000)\r\n }\r\n break\r\n case 'state_loading':\r\n $elBlock.addClass('block-opt-refresh')\r\n break\r\n case 'state_normal':\r\n $elBlock.removeClass('block-opt-refresh')\r\n break\r\n case 'close':\r\n $elBlock.hide()\r\n break\r\n case 'open':\r\n $elBlock.show()\r\n break\r\n default:\r\n return false\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Material inputs helper\r\n var uiForms = function () {\r\n $instance('.form-material.floating > .form-control').each(function () {\r\n var $input = $instance(this)\r\n var $parent = $input.parent('.form-material')\r\n\r\n if ($input.val()) {\r\n $parent.addClass('open')\r\n }\r\n\r\n $input.on('change', function () {\r\n if ($input.val()) {\r\n $parent.addClass('open')\r\n } else {\r\n $parent.removeClass('open')\r\n }\r\n })\r\n })\r\n }\r\n\r\n // Set active color themes functionality\r\n var uiHandleTheme = function () {\r\n var $cssTheme = $instance('#css-theme')\r\n var $cookies = $lPage.hasClass('enable-cookies') ? true : false\r\n\r\n // If cookies are enabled\r\n if ($cookies) {\r\n var $theme = Cookies.get('colorTheme') ? Cookies.get('colorTheme') : false\r\n\r\n // Update color theme\r\n if ($theme) {\r\n if ($theme === 'default') {\r\n if ($cssTheme.length) {\r\n $cssTheme.remove()\r\n }\r\n } else {\r\n if ($cssTheme.length) {\r\n $cssTheme.attr('href', $theme)\r\n } else {\r\n $instance('#css-main')\r\n .after('<link rel=\"stylesheet\" id=\"css-theme\" href=\"' + $theme + '\">')\r\n }\r\n }\r\n }\r\n\r\n $cssTheme = $instance('#css-theme')\r\n }\r\n\r\n // Set the active color theme link as active\r\n $instance('[data-toggle=\"theme\"][data-theme=\"' + ($cssTheme.length ? $cssTheme.attr('href') : 'default') + '\"]')\r\n .parent('li')\r\n .addClass('active')\r\n\r\n // When a color theme link is clicked\r\n $instance('[data-toggle=\"theme\"]').on('click', function () {\r\n var $this = $instance(this)\r\n var $theme = $this.data('theme')\r\n\r\n // Set this color theme link as active\r\n $instance('[data-toggle=\"theme\"]')\r\n .parent('li')\r\n .removeClass('active')\r\n\r\n $instance('[data-toggle=\"theme\"][data-theme=\"' + $theme + '\"]')\r\n .parent('li')\r\n .addClass('active')\r\n\r\n // Update color theme\r\n if ($theme === 'default') {\r\n if ($cssTheme.length) {\r\n $cssTheme.remove()\r\n }\r\n } else {\r\n if ($cssTheme.length) {\r\n $cssTheme.attr('href', $theme)\r\n } else {\r\n $instance('#css-main')\r\n .after('<link rel=\"stylesheet\" id=\"css-theme\" href=\"' + $theme + '\">')\r\n }\r\n }\r\n\r\n $cssTheme = $instance('#css-theme')\r\n\r\n // If cookies are enabled, save the new active color theme\r\n if ($cookies) {\r\n Cookies.set('colorTheme', $theme, { expires: 7 })\r\n }\r\n })\r\n }\r\n\r\n // Scroll to element animation helper\r\n var uiScrollTo = function () {\r\n $instance('[data-toggle=\"scroll-to\"]').on('click', function () {\r\n var $this = $instance(this)\r\n var $target = $this.data('target')\r\n var $speed = $this.data('speed') ? $this.data('speed') : 1000\r\n\r\n $instance('html, body').animate({\r\n scrollTop: $instance($target).offset().top\r\n }, $speed)\r\n })\r\n }\r\n\r\n // Toggle class helper\r\n var uiToggleClass = function () {\r\n $instance('[data-toggle=\"class-toggle\"]').on('click', function () {\r\n var $el = $instance(this)\r\n\r\n $instance($el.data('target').toString()).toggleClass($el.data('class').toString())\r\n\r\n if ($lHtml.hasClass('no-focus')) {\r\n $el.blur()\r\n }\r\n })\r\n }\r\n\r\n // Add the correct copyright year\r\n var uiYearCopy = function () {\r\n var $date = new Date()\r\n var $yearCopy = $instance('.js-year-copy')\r\n\r\n if ($date.getFullYear() === 2015) {\r\n $yearCopy.html('2015')\r\n } else {\r\n $yearCopy.html('2015-' + $date.getFullYear().toString().substr(2, 2))\r\n }\r\n }\r\n\r\n /*\r\n ********************************************************************************************\r\n *\r\n * UI HELPERS (ON DEMAND)\r\n *\r\n * Third party plugin inits or various custom user interface helpers to extend functionality\r\n * They need to be called in a page to be initialized. They are included here to be easy to\r\n * init them on demand on multiple pages (usually repeated init code in common components)\r\n *\r\n ********************************************************************************************\r\n */\r\n\r\n /*\r\n * Print Page functionality\r\n *\r\n * App.initHelper('print-page')\r\n *\r\n */\r\n var uiHelperPrint = function () {\r\n // Store all #page-container classes\r\n var $pageCls = $lPage.prop('class')\r\n\r\n // Remove all classes from #page-container\r\n $lPage.prop('class', '')\r\n\r\n // Print the page\r\n window.print()\r\n\r\n // Restore all #page-container classes\r\n $lPage.prop('class', $pageCls)\r\n }\r\n\r\n /*\r\n * Custom Table functionality such as section toggling or checkable rows\r\n *\r\n * App.initHelper('table-tools')\r\n *\r\n */\r\n\r\n // Table sections functionality\r\n var uiHelperTableToolsSections = function () {\r\n var $table = $instance('.js-table-sections')\r\n var $tableRows = $instance('.js-table-sections-header > tr', $table)\r\n\r\n // When a row is clicked in tbody.js-table-sections-header\r\n $tableRows.click(function (e) {\r\n var $row = $instance(this)\r\n var $tbody = $row.parent('tbody')\r\n\r\n if (! $tbody.hasClass('open')) {\r\n $instance('tbody', $table).removeClass('open')\r\n }\r\n\r\n $tbody.toggleClass('open')\r\n })\r\n }\r\n\r\n // Checkable table functionality\r\n var uiHelperTableToolsCheckable = function () {\r\n var $table = $instance('.js-table-checkable')\r\n\r\n // When a checkbox is clicked in thead\r\n $instance('thead input:checkbox', $table).click(function () {\r\n var $checkedStatus = $instance(this).prop('checked')\r\n\r\n // Check or uncheck all checkboxes in tbody\r\n $instance('tbody input:checkbox', $table).each(function () {\r\n var $checkbox = $instance(this)\r\n\r\n $checkbox.prop('checked', $checkedStatus)\r\n uiHelperTableToolscheckRow($checkbox, $checkedStatus)\r\n })\r\n })\r\n\r\n // When a checkbox is clicked in tbody\r\n $instance('tbody input:checkbox', $table).click(function () {\r\n var $checkbox = $instance(this)\r\n\r\n uiHelperTableToolscheckRow($checkbox, $checkbox.prop('checked'))\r\n })\r\n\r\n // When a row is clicked in tbody\r\n $instance('tbody > tr', $table).click(function (e) {\r\n if (e.target.type !== 'checkbox'\r\n && e.target.type !== 'button'\r\n && e.target.tagName.toLowerCase() !== 'a'\r\n && !$instance(e.target).parent('label').length) {\r\n var $checkbox = $instance('input:checkbox', this)\r\n var $checkedStatus = $checkbox.prop('checked')\r\n\r\n $checkbox.prop('checked', ! $checkedStatus)\r\n uiHelperTableToolscheckRow($checkbox, ! $checkedStatus)\r\n }\r\n })\r\n }\r\n\r\n // Checkable table functionality helper - Checks or unchecks table row\r\n var uiHelperTableToolscheckRow = function ($checkbox, $checkedStatus) {\r\n if ($checkedStatus) {\r\n $checkbox\r\n .closest('tr')\r\n .addClass('active')\r\n } else {\r\n $checkbox\r\n .closest('tr')\r\n .removeClass('active')\r\n }\r\n }\r\n\r\n /*\r\n * $instance Appear, for more examples you can check out https://github.com/bas2k/$instance.appear\r\n *\r\n * App.initHelper('appear')\r\n *\r\n */\r\n var uiHelperAppear = function () {\r\n // Add a specific class on elements (when they become visible on scrolling)\r\n $instance('[data-toggle=\"appear\"]').each(function () {\r\n var $windowW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth\r\n var $this = $instance(this)\r\n var $class = $this.data('class') ? $this.data('class') : 'animated fadeIn'\r\n var $offset = $this.data('offset') ? $this.data('offset') : 0\r\n var $timeout = ($lHtml.hasClass('ie9') || $windowW < 992) ? 0 : ($this.data('timeout') ? $this.data('timeout') : 0)\r\n\r\n $this.appear(function () {\r\n setTimeout(function () {\r\n $this\r\n .removeClass('visibility-hidden')\r\n .addClass($class)\r\n }, $timeout)\r\n }, {accY: $offset})\r\n })\r\n }\r\n\r\n /*\r\n * $instance Appear + $instance countTo, for more examples you can check out https://github.com/bas2k/$instance.appear and https://github.com/mhuggins/$instance-countTo\r\n *\r\n * App.initHelper('appear-countTo')\r\n *\r\n */\r\n var uiHelperAppearCountTo = function () {\r\n // Init counter functionality\r\n $instance('[data-toggle=\"countTo\"]').each(function () {\r\n var $this = $instance(this)\r\n var $after = $this.data('after')\r\n var $speed = $this.data('speed') ? $this.data('speed') : 1500\r\n var $interval = $this.data('interval') ? $this.data('interval') : 15\r\n\r\n $this.appear(function () {\r\n $this.countTo({\r\n speed: $speed,\r\n refreshInterval: $interval,\r\n onComplete: function () {\r\n if ($after) {\r\n $this.html($this.html() + $after)\r\n }\r\n }\r\n })\r\n })\r\n })\r\n }\r\n\r\n /*\r\n * $instance SlimScroll, for more examples you can check out http://rocha.la/$instance-slimScroll\r\n *\r\n * App.initHelper('slimscroll')\r\n *\r\n */\r\n var uiHelperSlimscroll = function () {\r\n // Init slimScroll functionality\r\n $instance('[data-toggle=\"slimscroll\"]').each(function () {\r\n var $this = $instance(this)\r\n var $height = $this.data('height') ? $this.data('height') : '200px'\r\n var $size = $this.data('size') ? $this.data('size') : '5px'\r\n var $position = $this.data('position') ? $this.data('position') : 'right'\r\n var $color = $this.data('color') ? $this.data('color') : '#000'\r\n var $avisible = $this.data('always-visible') ? true : false\r\n var $rvisible = $this.data('rail-visible') ? true : false\r\n var $rcolor = $this.data('rail-color') ? $this.data('rail-color') : '#999'\r\n var $ropacity = $this.data('rail-opacity') ? $this.data('rail-opacity') : .3\r\n\r\n $this.slimScroll({\r\n height: $height,\r\n size: $size,\r\n position: $position,\r\n color: $color,\r\n alwaysVisible: $avisible,\r\n railVisible: $rvisible,\r\n railColor: $rcolor,\r\n railOpacity: $ropacity\r\n })\r\n })\r\n }\r\n\r\n /*\r\n ********************************************************************************************\r\n *\r\n * All the following helpers require each plugin's resources (JS, CSS) to be included in order to work\r\n *\r\n ********************************************************************************************\r\n */\r\n\r\n /*\r\n * Magnific Popup functionality, for more examples you can check out http://dimsemenov.com/plugins/magnific-popup/\r\n *\r\n * App.initHelper('magnific-popup')\r\n *\r\n */\r\n var uiHelperMagnific = function () {\r\n // Simple Gallery init\r\n $instance('.js-gallery').each(function () {\r\n $instance(this).magnificPopup({\r\n delegate: 'a.img-link',\r\n type: 'image',\r\n gallery: {\r\n enabled: true\r\n }\r\n })\r\n })\r\n\r\n // Advanced Gallery init\r\n $instance('.js-gallery-advanced').each(function () {\r\n $instance(this).magnificPopup({\r\n delegate: 'a.img-lightbox',\r\n type: 'image',\r\n gallery: {\r\n enabled: true\r\n }\r\n })\r\n })\r\n }\r\n\r\n /*\r\n * CKEditor init, for more examples you can check out http://ckeditor.com/\r\n *\r\n * App.initHelper('ckeditor')\r\n *\r\n */\r\n var uiHelperCkeditor = function () {\r\n // Disable auto init when contenteditable property is set to true\r\n CKEDITOR.disableAutoInline = true\r\n\r\n // Init inline text editor\r\n if ($instance('#js-ckeditor-inline').length) {\r\n CKEDITOR.inline('js-ckeditor-inline')\r\n }\r\n\r\n // Init full text editor\r\n if ($instance('#js-ckeditor').length) {\r\n CKEDITOR.replace('js-ckeditor')\r\n }\r\n }\r\n\r\n /*\r\n * Summernote init, for more examples you can check out http://summernote.org/\r\n *\r\n * App.initHelper('summernote')\r\n *\r\n */\r\n var uiHelperSummernote = function () {\r\n // Init text editor in air mode (inline)\r\n $instance('.js-summernote-air').summernote({\r\n airMode: true\r\n })\r\n\r\n // Init full text editor\r\n $instance('.js-summernote').summernote({\r\n height: 350,\r\n minHeight: null,\r\n maxHeight: null\r\n })\r\n }\r\n\r\n /*\r\n * Slick init, for more examples you can check out http://kenwheeler.github.io/slick/\r\n *\r\n * App.initHelper('slick')\r\n *\r\n */\r\n var uiHelperSlick = function () {\r\n // Get each slider element (with .js-slider class)\r\n $instance('.js-slider').each(function () {\r\n var $slider = $instance(this)\r\n\r\n // Get each slider's init data\r\n var $sliderArrows = $slider.data('slider-arrows') ? $slider.data('slider-arrows') : false\r\n var $sliderDots = $slider.data('slider-dots') ? $slider.data('slider-dots') : false\r\n var $sliderNum = $slider.data('slider-num') ? $slider.data('slider-num') : 1\r\n var $sliderAuto = $slider.data('slider-autoplay') ? $slider.data('slider-autoplay') : false\r\n var $sliderAutoSpeed = $slider.data('slider-autoplay-speed') ? $slider.data('slider-autoplay-speed') : 3000\r\n\r\n // Init slick slider\r\n $slider.slick({\r\n arrows: $sliderArrows,\r\n dots: $sliderDots,\r\n slidesToShow: $sliderNum,\r\n autoplay: $sliderAuto,\r\n autoplaySpeed: $sliderAutoSpeed\r\n })\r\n })\r\n }\r\n\r\n /*\r\n * Bootstrap Datepicker init, for more examples you can check out https://github.com/eternicode/bootstrap-datepicker\r\n *\r\n * App.initHelper('datepicker')\r\n *\r\n */\r\n var uiHelperDatepicker = function () {\r\n // Init datepicker (with .js-datepicker and .input-daterange class)\r\n $instance('.js-datepicker').add('.input-daterange').datepicker({\r\n weekStart: 1,\r\n autoclose: true,\r\n todayHighlight: true\r\n })\r\n }\r\n\r\n /*\r\n * Bootstrap Colorpicker init, for more examples you can check out http://mjolnic.com/bootstrap-colorpicker/\r\n *\r\n * App.initHelper('colorpicker')\r\n *\r\n */\r\n var uiHelperColorpicker = function () {\r\n // Get each colorpicker element (with .js-colorpicker class)\r\n $instance('.js-colorpicker').each(function () {\r\n var $colorpicker = $instance(this)\r\n\r\n // Get each colorpicker's init data\r\n var $colorpickerMode = $colorpicker.data('colorpicker-mode') ? $colorpicker.data('colorpicker-mode') : 'hex'\r\n var $colorpickerinline = $colorpicker.data('colorpicker-inline') ? true : false\r\n\r\n // Init colorpicker\r\n $colorpicker.colorpicker({\r\n 'format': $colorpickerMode,\r\n 'inline': $colorpickerinline\r\n })\r\n })\r\n }\r\n\r\n /*\r\n * Masked Inputs, for more examples you can check out http://digitalbush.com/projects/masked-input-plugin/\r\n *\r\n * App.initHelper('masked-inputs')\r\n *\r\n */\r\n var uiHelperMaskedInputs = function () {\r\n // Init Masked Inputs\r\n // a - Represents an alpha character (A-Z,a-z)\r\n // 9 - Represents a numeric character (0-9)\r\n // * - Represents an alphanumeric character (A-Z,a-z,0-9)\r\n $instance('.js-masked-date').mask('99/99/9999')\r\n $instance('.js-masked-date-dash').mask('99-99-9999')\r\n $instance('.js-masked-phone').mask('(999) 999-9999')\r\n $instance('.js-masked-phone-ext').mask('(999) 999-9999? x99999')\r\n $instance('.js-masked-taxid').mask('99-9999999')\r\n $instance('.js-masked-ssn').mask('999-99-9999')\r\n $instance('.js-masked-pkey').mask('a*-999-a999')\r\n $instance('.js-masked-time').mask('99:99')\r\n }\r\n\r\n /*\r\n * Tags Inputs, for more examples you can check out https://github.com/xoxco/$instance-Tags-Input\r\n *\r\n * App.initHelper('tags-inputs')\r\n *\r\n */\r\n var uiHelperTagsInputs = function () {\r\n // Init Tags Inputs (with .js-tags-input class)\r\n $instance('.js-tags-input').tagsInput({\r\n height: '36px',\r\n width: '100%',\r\n defaultText: 'Add tag',\r\n removeWithBackspace: true,\r\n delimiter: [',']\r\n })\r\n }\r\n\r\n /*\r\n * Select2, for more examples you can check out https://github.com/select2/select2\r\n *\r\n * App.initHelper('select2')\r\n *\r\n */\r\n var uiHelperSelect2 = function () {\r\n // Init Select2 (with .js-select2 class)\r\n $instance('.js-select2').select2()\r\n }\r\n\r\n /*\r\n * Highlight.js, for more examples you can check out https://highlightjs.org/usage/\r\n *\r\n * App.initHelper('highlightjs')\r\n *\r\n */\r\n var uiHelperHighlightjs = function () {\r\n // Init Highlight.js\r\n hljs.initHighlightingOnLoad()\r\n }\r\n\r\n /*\r\n * Bootstrap Notify, for more examples you can check out http://bootstrap-growl.remabledesigns.com/\r\n *\r\n * App.initHelper('notify')\r\n *\r\n */\r\n var uiHelperNotify = function () {\r\n // Init notifications (with .js-notify class)\r\n $instance('.js-notify').on('click', function () {\r\n var $notify = $instance(this)\r\n var $notifyMsg = $notify.data('notify-message')\r\n var $notifyType = $notify.data('notify-type') ? $notify.data('notify-type') : 'info'\r\n var $notifyFrom = $notify.data('notify-from') ? $notify.data('notify-from') : 'top'\r\n var $notifyAlign = $notify.data('notify-align') ? $notify.data('notify-align') : 'right'\r\n var $notifyIcon = $notify.data('notify-icon') ? $notify.data('notify-icon') : ''\r\n var $notifyUrl = $notify.data('notify-url') ? $notify.data('notify-url') : ''\r\n\r\n $instance.notify({\r\n icon: $notifyIcon,\r\n message: $notifyMsg,\r\n url: $notifyUrl\r\n },\r\n {\r\n element: 'body',\r\n type: $notifyType,\r\n allow_dismiss: true,\r\n newest_on_top: true,\r\n showProgressbar: false,\r\n placement: {\r\n from: $notifyFrom,\r\n align: $notifyAlign\r\n },\r\n offset: 20,\r\n spacing: 10,\r\n z_index: 1031,\r\n delay: 5000,\r\n timer: 1000,\r\n animate: {\r\n enter: 'animated fadeIn',\r\n exit: 'animated fadeOutDown'\r\n }\r\n })\r\n })\r\n }\r\n\r\n /*\r\n * Draggable items with $instance, for more examples you can check out https://$instanceui.com/sortable/\r\n *\r\n * App.initHelper('draggable-items')\r\n *\r\n */\r\n var uiHelperDraggableItems = function () {\r\n // Init draggable items functionality (with .js-draggable-items class)\r\n $instance('.js-draggable-items > .draggable-column').sortable({\r\n connectWith: '.draggable-column',\r\n items: '.draggable-item',\r\n dropOnEmpty: true,\r\n opacity: .75,\r\n handle: '.draggable-handler',\r\n placeholder: 'draggable-placeholder',\r\n tolerance: 'pointer',\r\n start: function (e, ui) {\r\n ui.placeholder.css({\r\n 'height': ui.item.outerHeight(),\r\n 'margin-bottom': ui.item.css('margin-bottom')\r\n })\r\n }\r\n })\r\n }\r\n\r\n /*\r\n * Easy Pie Chart, for more examples you can check out http://rendro.github.io/easy-pie-chart/\r\n *\r\n * App.initHelper('easy-pie-chart')\r\n *\r\n */\r\n var uiHelperEasyPieChart = function () {\r\n // Init Easy Pie Charts (with .js-pie-chart class)\r\n $instance('.js-pie-chart').easyPieChart({\r\n barColor: $instance(this).data('bar-color') ? $instance(this).data('bar-color') : '#777777',\r\n trackColor: $instance(this).data('track-color') ? $instance(this).data('track-color') : '#eeeeee',\r\n lineWidth: $instance(this).data('line-width') ? $instance(this).data('line-width') : 3,\r\n size: $instance(this).data('size') ? $instance(this).data('size') : '80',\r\n animate: 750,\r\n scaleColor: $instance(this).data('scale-color') ? $instance(this).data('scale-color') : false\r\n })\r\n }\r\n\r\n /*\r\n * Bootstrap Maxlength, for more examples you can check out https://github.com/mimo84/bootstrap-maxlength\r\n *\r\n * App.initHelper('maxlength')\r\n *\r\n */\r\n var uiHelperMaxlength = function () {\r\n // Init Bootstrap Maxlength (with .js-maxlength class)\r\n $instance('.js-maxlength').each(function () {\r\n var $input = $instance(this)\r\n\r\n $input.maxlength({\r\n alwaysShow: $input.data('always-show') ? true : false,\r\n threshold: $input.data('threshold') ? $input.data('threshold') : 10,\r\n warningClass: $input.data('warning-class') ? $input.data('warning-class') : 'label label-warning',\r\n limitReachedClass: $input.data('limit-reached-class') ? $input.data('limit-reached-class') : 'label label-danger',\r\n placement: $input.data('placement') ? $input.data('placement') : 'bottom',\r\n preText: $input.data('pre-text') ? $input.data('pre-text') : '',\r\n separator: $input.data('separator') ? $input.data('separator') : '/',\r\n postText: $input.data('post-text') ? $input.data('post-text') : ''\r\n })\r\n })\r\n }\r\n\r\n /*\r\n * Bootstrap Datetimepicker, for more examples you can check out https://github.com/Eonasdan/bootstrap-datetimepicker\r\n *\r\n * App.initHelper('datetimepicker')\r\n *\r\n */\r\n var uiHelperDatetimepicker = function () {\r\n // Init Bootstrap Datetimepicker (with .js-datetimepicker class)\r\n $instance('.js-datetimepicker').each(function () {\r\n var $input = $instance(this)\r\n\r\n $input.datetimepicker({\r\n format: $input.data('format') ? $input.data('format') : false,\r\n useCurrent: $input.data('use-current') ? $input.data('use-current') : false,\r\n locale: moment.locale('' + ($input.data('locale') ? $input.data('locale') : '') + ''),\r\n showTodayButton: $input.data('show-today-button') ? $input.data('show-today-button') : false,\r\n showClear: $input.data('show-clear') ? $input.data('show-clear') : false,\r\n showClose: $input.data('show-close') ? $input.data('show-close') : false,\r\n sideBySide: $input.data('side-by-side') ? $input.data('side-by-side') : false,\r\n inline: $input.data('inline') ? $input.data('inline') : false,\r\n icons: {\r\n time: 'si si-clock',\r\n date: 'si si-calendar',\r\n up: 'si si-arrow-up',\r\n down: 'si si-arrow-down',\r\n previous: 'si si-arrow-left',\r\n next: 'si si-arrow-right',\r\n today: 'si si-size-actual',\r\n clear: 'si si-trash',\r\n close: 'si si-close'\r\n }\r\n })\r\n })\r\n }\r\n\r\n /*\r\n * Ion Range Slider, for more examples you can check out https://github.com/IonDen/ion.rangeSlider\r\n *\r\n * App.initHelper('rangeslider')\r\n *\r\n */\r\n var uiHelperRangeslider = function () {\r\n // Init Ion Range Slider (with .js-rangeslider class)\r\n $instance('.js-rangeslider').each(function () {\r\n var $input = $instance(this)\r\n\r\n $input.ionRangeSlider()\r\n })\r\n }\r\n\r\n return {\r\n init: function ($func) {\r\n switch ($func) {\r\n case 'uiInit':\r\n uiInit()\r\n break\r\n case 'uiLayout':\r\n uiLayout()\r\n break\r\n case 'uiNav':\r\n uiNav()\r\n break\r\n case 'uiBlocks':\r\n uiBlocks()\r\n break\r\n case 'uiForms':\r\n uiForms()\r\n break\r\n case 'uiHandleTheme':\r\n uiHandleTheme()\r\n break\r\n case 'uiToggleClass':\r\n uiToggleClass()\r\n break\r\n case 'uiScrollTo':\r\n uiScrollTo()\r\n break\r\n case 'uiYearCopy':\r\n uiYearCopy()\r\n break\r\n default:\r\n // Init all vital functions\r\n uiInit()\r\n uiLayout()\r\n uiNav()\r\n uiBlocks()\r\n uiForms()\r\n uiHandleTheme()\r\n uiToggleClass()\r\n uiScrollTo()\r\n uiYearCopy()\r\n }\r\n },\r\n layout: function ($mode) {\r\n uiLayoutApi($mode)\r\n },\r\n blocks: function ($block, $mode) {\r\n uiBlocksApi($block, $mode)\r\n },\r\n initHelper: function ($helper) {\r\n switch ($helper) {\r\n case 'print-page':\r\n uiHelperPrint()\r\n break\r\n case 'table-tools':\r\n uiHelperTableToolsSections()\r\n uiHelperTableToolsCheckable()\r\n break\r\n case 'appear':\r\n uiHelperAppear()\r\n break\r\n case 'appear-countTo':\r\n uiHelperAppearCountTo()\r\n break\r\n case 'slimscroll':\r\n uiHelperSlimscroll()\r\n break\r\n case 'magnific-popup':\r\n uiHelperMagnific()\r\n break\r\n case 'ckeditor':\r\n uiHelperCkeditor()\r\n break\r\n case 'summernote':\r\n uiHelperSummernote()\r\n break\r\n case 'slick':\r\n uiHelperSlick()\r\n break\r\n case 'datepicker':\r\n uiHelperDatepicker()\r\n break\r\n case 'colorpicker':\r\n uiHelperColorpicker()\r\n break\r\n case 'tags-inputs':\r\n uiHelperTagsInputs()\r\n break\r\n case 'masked-inputs':\r\n uiHelperMaskedInputs()\r\n break\r\n case 'select2':\r\n uiHelperSelect2()\r\n break\r\n case 'highlightjs':\r\n uiHelperHighlightjs()\r\n break\r\n case 'notify':\r\n uiHelperNotify()\r\n break\r\n case 'draggable-items':\r\n uiHelperDraggableItems()\r\n break\r\n case 'easy-pie-chart':\r\n uiHelperEasyPieChart()\r\n break\r\n case 'maxlength':\r\n uiHelperMaxlength()\r\n break\r\n case 'datetimepicker':\r\n uiHelperDatetimepicker()\r\n break\r\n case 'rangeslider':\r\n uiHelperRangeslider()\r\n break\r\n default:\r\n return false\r\n }\r\n },\r\n initHelpers: function ($helpers) {\r\n if ($helpers instanceof Array) {\r\n for (var $index in $helpers) {\r\n App.initHelper($helpers[$index])\r\n }\r\n } else {\r\n App.initHelper($helpers)\r\n }\r\n }\r\n }\r\n}\r\n\r\n// Create an alias for App (you can use OneUI in your pages instead of App if you like)\r\nmodule.exports = App\r\n","var $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\nfunction StickyTableHeaders (container) {\r\n if (container.hasClass('.table')) return StickyTable($(container))\r\n\r\n _.each($(container).find('.table'), function (tableEl) { StickyTable($(tableEl)) })\r\n}\r\n\r\nfunction StickyTable ($el) {\r\n var $head = $el.find('.head')\r\n if ($head.find('p.invisible').length) return\r\n\r\n var $fakeHead = $('<div>').attr('class', $head.attr('class')).addClass('invisible').html(' ')\r\n $head.after($fakeHead)\r\n // This variable name plays on the 'Canary in a coal mine' expression. We check to make sure it's alive when we handle the scroll event.\r\n // We also use it to test if the table is already being handled by another scroll event so as to not duplicate cycles testing if the header should be fixed or not.\r\n var $canary = $('<p>').addClass('invisible').attr('id', 'invisible-canary-' + Date.now() + (' ' + Math.random()).substr(3))\r\n $head.append($canary)\r\n\r\n var scrollCallback = function (e) {\r\n if (document.getElementById($canary.attr('id')) === $canary[0]) {\r\n var $staticHead = $head.hasClass('fixed') ? $fakeHead : $head\r\n if (needsFixedPosition($staticHead, $el)) {\r\n $head.addClass('fixed slideInDown has-animation')\r\n $fakeHead.removeClass('invisible')\r\n } else {\r\n $head.removeClass('fixed slideInDown has-animation')\r\n $fakeHead.addClass('invisible')\r\n }\r\n } else {\r\n $(window).off('scroll', scrollCallback)\r\n }\r\n }\r\n\r\n $(window).on('scroll', scrollCallback)\r\n}\r\n\r\nfunction needsFixedPosition ($el, $container) {\r\n if (!$el.length) {\r\n return false\r\n }\r\n\r\n var headerHeight = 60\r\n var scrollTop = $(window).scrollTop()\r\n var viewportTop = headerHeight + scrollTop\r\n var elTop = $el.offset().top\r\n var containerBottom = $container.offset().top + $container.height()\r\n\r\n return elTop <= viewportTop && containerBottom >= viewportTop\r\n}\r\n\r\nmodule.exports = StickyTableHeaders\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\n\r\nvar DashboardRouter = require('dashboard/router')\r\nvar LoginRouter = require('login/router')\r\nvar RegistrationRouter = require('registration/registration-router')\r\nvar CompanyRouter = require('company/company-router')\r\nvar CheckbookRouter = require('checkbook/checkbook-router')\r\nvar JournalRouter = require('journal/journal-router')\r\nvar GeneralLedgerAccounts = require('generalledgeraccounts/router')\r\nvar ReportRouter = require('reports/report-router')\r\nvar SettingsRouter = require('settings/router')\r\nvar ListsRouter = require('lists/router')\r\nvar ReceivablesRouter = require('receivables/router')\r\nvar PayablesRouter = require('payables/router')\r\nvar MemorizationRouter = require('memorization/router')\r\nvar WelcomeRouter = require('welcome/router')\r\nvar PaymentLinkRouter = require('payment-link/router')\r\n\r\nvar AppRouter = Router.extend({\r\n initialize: function () {\r\n // Create child routers here\r\n new DashboardRouter()\r\n new LoginRouter()\r\n new RegistrationRouter()\r\n new CompanyRouter()\r\n new CheckbookRouter()\r\n new JournalRouter()\r\n new GeneralLedgerAccounts()\r\n new ReportRouter()\r\n new SettingsRouter()\r\n new ListsRouter()\r\n new ReceivablesRouter()\r\n new PayablesRouter()\r\n new MemorizationRouter()\r\n new WelcomeRouter()\r\n new PaymentLinkRouter()\r\n }\r\n})\r\n\r\nmodule.exports = AppRouter\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar autoNumeric = require('autoNumeric')\r\nvar Q = require('q')\r\nvar InstancedOneUI = require('InstancedOneUI')\r\nvar StickyHeaders = require('StickyTableHeaders')\r\nvar HandlebarHelpers = require('HandlebarHelpers')\r\nvar idle = require('jquery.idle')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar AppRouter = null\r\nvar FrameWidget = null\r\nvar SessionService = require('session/session-service')\r\n\r\nvar ScrollTo = require('jquery-scrollto')\r\nvar bootstrapSelect = require('bootstrap-select')\r\nvar Cropper = require('cropper')\r\nvar Croppie = require('croppie')\r\n\r\nvar minWindowWidth = 1200\r\nvar minWindowHeight = 300\r\nvar resolutionWarningDismissed = false\r\n\r\nvar HackDeferral = Q.defer()\r\n\r\n;(function () {\r\n var oldExtend = Backbone.View.extend\r\n Backbone.View.extend = function (protoProps, staticProps) {\r\n if (!protoProps.noHacks && protoProps.render) {\r\n var oldRender = protoProps.render\r\n protoProps.render = function () {\r\n var results = oldRender.apply(this, arguments)\r\n\r\n InstancedOneUI(results.$.bind(this)).init()\r\n StickyHeaders(results.$el)\r\n results.$('.currency-field').autoNumeric('init', { aSep: ',', aDec: '.', aSign: '$' })\r\n\r\n return results\r\n // OneUI hacks\r\n }\r\n }\r\n if (!protoProps.OneUI) {\r\n protoProps.OneUI = function ($element) {\r\n InstancedOneUI($element.find.bind($element)).init()\r\n $element.find('.currency-field').autoNumeric('init', { aSep: ',', aDec: '.', aSign: '$' })\r\n }\r\n }\r\n return oldExtend.apply(this, arguments)\r\n }\r\n\r\n FrameWidget = require('frame-widget')\r\n AppRouter = require('app-router')\r\n\r\n HackDeferral.fulfill('')\r\n})()\r\n\r\nvar Application = function () {}\r\n\r\nApplication.prototype.initialize = function () {\r\n jQuery.ScrollTo.config.offsetTop = 100\r\n $.fn.datepicker.defaults.enableOnReadonly = false\r\n HandlebarHelpers.initialize()\r\n\r\n Backbone.on('app:login', function (token, emailAddress) {\r\n SessionService.startSession(token, emailAddress)\r\n Backbone.trigger('app:navigate', '')\r\n })\r\n\r\n Backbone.on('app:logout', function () {\r\n $zopim(function () {\r\n $zopim.livechat.clearAll()\r\n $zopim.livechat.hideAll()\r\n })\r\n location.reload()\r\n SessionService.endSession()\r\n Backbone.trigger('app:navigate', 'login')\r\n })\r\n\r\n $(document).idle({\r\n idle: 1000 * 60 * 55, // 55 minutes\r\n onIdle: function () {\r\n if (SessionService.isSessionActive()) {\r\n sweetAlert({\r\n title: 'Inactivity Warning',\r\n text: 'You will be logged out in five minutes due to inactivity',\r\n type: 'warning',\r\n closeOnConfirm: true,\r\n showCancelButton: false,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Close',\r\n timer: 1000 * 60 * 5 // 5 Minutes\r\n })\r\n }\r\n }\r\n })\r\n\r\n $(document).idle({\r\n idle: 1000 * 60 * 60, // 1 Hour\r\n onIdle: function () {\r\n if (SessionService.isSessionActive()) {\r\n Backbone.trigger('app:logout')\r\n SessionService.setInactivityLogout(true)\r\n }\r\n }\r\n })\r\n\r\n $(window).resize(function () {\r\n if ($(window).width() < minWindowWidth || $(window).height() < minWindowHeight) {\r\n if (!sweetAlert.isVisible() && !resolutionWarningDismissed) {\r\n sweetAlert({\r\n title: 'Unsupported Resolution!',\r\n text: 'Please increase the size of the window or zoom out, as your current resolution may cause display issues.',\r\n type: 'info',\r\n closeOnConfirm: true,\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Ok',\r\n cancelButtonColor: '#d33',\r\n cancelButtonText: 'Ignore',\r\n timer: 1000 * 60 * 5 // 5 Minutes\r\n }).then(function () {\r\n }, function (cancel) {\r\n if (cancel === 'cancel') {\r\n resolutionWarningDismissed = true\r\n }\r\n })\r\n }\r\n } else {\r\n sweetAlert.close()\r\n resolutionWarningDismissed = false\r\n }\r\n })\r\n\r\n // Make it easy to programmatically trigger navigation between app routes\r\n Backbone.on('app:navigate', function (route, replace) {\r\n $zopim(function () {\r\n var isChatting = $zopim.livechat.isChatting()\r\n if (!isChatting || !SessionService.isSessionActive()) {\r\n $zopim.livechat.hideAll()\r\n }\r\n })\r\n Backbone.history.fragment = false\r\n Backbone.history.navigate(route, { trigger: true, replace: replace })\r\n Backbone.trigger('app:closeModal')\r\n }, this)\r\n\r\n Backbone.on('app:showInFrame', function (widget) {\r\n $(window).off('scroll')\r\n var $widget = $(widget.show())\r\n $widget.find('input.currency-field').autoNumeric('init')\r\n $('div.content.main').html($widget)\r\n\r\n if (widget.trigger) {\r\n widget.trigger('shown')\r\n }\r\n }, this)\r\n\r\n function detectClickOutsideModal (event) {\r\n if (!$(event.target).closest('.modal').length && !$(event.target).parents('.ui-autocomplete').length) {\r\n Backbone.trigger('app:closeModal')\r\n }\r\n }\r\n\r\n Backbone.on('app:showInModal', function (widget) {\r\n var wrapper = $(\"<div class='modal fadeInDown' style='display: block;'></div>\")\r\n $(wrapper).html(widget.show())\r\n $('#page-container').addClass('expanded')\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n })\r\n $('main').append(wrapper)\r\n setTimeout(function () {\r\n $(document).on('click', detectClickOutsideModal)\r\n }, 0)\r\n if (widget.trigger) widget.trigger('shown')\r\n })\r\n\r\n Backbone.on('app:closeModal', function () {\r\n $('#page-container').removeClass('expanded')\r\n $('main .modal').remove()\r\n $(document).off('click', detectClickOutsideModal)\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n })\r\n\r\n // Intercept link clicks, and if they're internal, trigger an event instead\r\n // Unless the user is trying to ctrl- or middle-click a link to open in a new window/tab\r\n $(document).on('click', \"a[href^='/']\", function (event) {\r\n var target = $(event.currentTarget).attr('href').replace(new RegExp('/'), '')\r\n\r\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\r\n return\r\n }\r\n\r\n event.preventDefault()\r\n Backbone.trigger('app:navigate', target)\r\n })\r\n\r\n HackDeferral.promise.then(function () {\r\n new AppRouter()\r\n\r\n $('body').append(new FrameWidget().show())\r\n\r\n InstancedOneUI($).init()\r\n\r\n Backbone.history.start({\r\n pushState: true,\r\n root: '/'\r\n })\r\n })\r\n}\r\n\r\nmodule.exports = Application\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"data-has-image\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <li>\\r\\n <i class=\\\"si si-wallet text-success\\\"></i>\\r\\n <div class=\\\"font-w600\\\">Queued transactions need your approval</div>\\r\\n <div><a href=\\\"/memorizations/recurring\\\">View transactions</a></div>\\r\\n </li>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\";\n\n return \"<div id=\\\"side-overlay-scroll\\\">\\r\\n <div class=\\\"side-header side-content\\\">\\r\\n <span>\\r\\n <label class=\\\"avatar\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.picture : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" style=\\\"background:url('\"\n + ((stack1 = ((helper = (helper = helpers.picture || (depth0 != null ? depth0.picture : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"picture\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"') no-repeat center center;\\\"></label>\\r\\n <span class=\\\"font-w600 push-10-l\\\">\"\n + container.escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>\\r\\n </span>\\r\\n <button class=\\\"btn\\\" type=\\\"button\\\" data-toggle=\\\"layout\\\" data-action=\\\"side_overlay_close\\\">\\r\\n <i class=\\\"fa fa-times\\\"></i>\\r\\n </button>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"side-content remove-padding-t\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"block pull-r-l\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <ul class=\\\"list list-activity\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.hasRecurring : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </ul>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar AsideTemplate = require('aside/template')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\nvar AsideView = Backbone.View.extend({\r\n tagName: 'aside',\r\n id: 'side-overlay',\r\n\r\n events: {\r\n 'click a': 'clicked'\r\n },\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change', this.render)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(AsideTemplate(this.createViewModel()))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n var hasRecurring = this.model.get('hasRecurring')\r\n\r\n var name = this.model.get('emailAddress') || 'Not logged in'\r\n var picture = ''\r\n\r\n if (this.model.get('profile')) {\r\n var profile = this.model.get('profile')\r\n if (profile.firstName || profile.lastName) {\r\n name = _.filter([profile.firstName, profile.lastName]).join(' ')\r\n }\r\n\r\n picture = profile.picture || picture\r\n }\r\n\r\n var data = {\r\n isLoggedIn: this.model.get('isLoggedIn'),\r\n hasRecurring: hasRecurring,\r\n name: name,\r\n picture: picture\r\n }\r\n\r\n return data\r\n },\r\n\r\n logOff: function (event) {\r\n event.preventDefault()\r\n\r\n this.trigger('logOff')\r\n },\r\n\r\n changeCompany: function (e) {\r\n e.preventDefault()\r\n\r\n this.trigger('changeCompany', $(e.currentTarget)\r\n .attr('data-id'))\r\n },\r\n\r\n clicked: function (e) {\r\n this.trigger('clicked')\r\n }\r\n})\r\n\r\nmodule.exports = AsideView\r\n","'use strict'\r\n\r\nvar AsideView = require('aside/view')\r\nvar SessionService = require('session/session-service')\r\nvar LoginService = require('login/service')\r\nvar MemorizationService = require('memorization/service')\r\nvar Backbone = require('backbone')\r\nvar sweetAlert = require('sweetalert2')\r\nvar _ = require('lodash')\r\n\r\nvar AsideWidget = function () {\r\n this.model = new Backbone.Model({\r\n isLoggedIn: SessionService.isSessionActive(),\r\n emailAddress: SessionService.getEmail(),\r\n profile: SessionService.getProfile()\r\n })\r\n\r\n this.memorizationService = new MemorizationService()\r\n this.loginService = new LoginService()\r\n\r\n this.view = new AsideView({\r\n model: this.model\r\n })\r\n\r\n Backbone.on('app:sessionStarted', function () {\r\n this.model.set('isLoggedIn', true)\r\n this.model.set('emailAddress', SessionService.getEmail())\r\n this.loadQueuedRecurring()\r\n }, this)\r\n\r\n Backbone.on('app:sessionEnded', function () {\r\n this.model.set('isLoggedIn', false)\r\n this.model.set('emailAddress', SessionService.getEmail())\r\n }, this)\r\n\r\n this.view.on('changeCompany', function (companyId) {\r\n this.companyService.updateActiveCompany(companyId)\r\n .then(function () {\r\n this.loadQueuedRecurring()\r\n Backbone.trigger('app:navigate', '')\r\n }.bind(this))\r\n }, this)\r\n\r\n Backbone.on('app:navigate app:reloadAside rightSideMenuClicked', function (route) {\r\n this.view.render()\r\n this.loadQueuedRecurring()\r\n\r\n this.model.set('profile', SessionService.getProfile())\r\n }, this)\r\n\r\n this.view.on('clicked', function () {\r\n this.trigger('clicked')\r\n }.bind(this))\r\n\r\n this.loadQueuedRecurring()\r\n}\r\n\r\nAsideWidget.prototype = _.clone(Backbone.Events)\r\n\r\nAsideWidget.prototype.loadQueuedRecurring = function () {\r\n if (this.model.get('isLoggedIn')) {\r\n return this.memorizationService.getRecurringCount()\r\n .then(function (response) {\r\n this.model.set('hasRecurring', !!response.count)\r\n }.bind(this))\r\n }\r\n}\r\n\r\nAsideWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = AsideWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Distribution = require('checkbook/distribution')\r\nvar moment = require('moment')\r\nvar numbro = require('numbro')\r\nvar _ = require('lodash')\r\n\r\nvar APPayment = Backbone.Model.extend({\r\n defaults: {\r\n amountType: 'credit'\r\n },\r\n toJSON: function () {\r\n var result = {\r\n id: this.id,\r\n readableJournalType: 'AP Payment',\r\n journalType: 'APPAYMENT',\r\n description: this.get('description'),\r\n postedDate: this.get('date'),\r\n notes: this.get('notes'),\r\n voidJournal: this.get('voidJournal'),\r\n is1099: this.get('is1099'),\r\n has1099: true,\r\n amount: numbro().unformat(this.get('amount') || this.getAmount() || this.get('amount')),\r\n shortDate: this.get('shortDate'),\r\n lineItems: _.map(this.get('lineItems'), function (detail) {\r\n if (detail.toJSON) {\r\n return detail.toJSON()\r\n } else {\r\n return detail\r\n }\r\n }),\r\n check: this.get('check') || {\r\n printedName: this.get('printedName'),\r\n handwritten: this.get('handwritten'),\r\n checkNumber: this.get('handwritten') ? this.get('checkNumber') : null,\r\n memo: this.get('memo'),\r\n address: {\r\n addressLine1: this.get('addressLine1'),\r\n addressLine2: this.get('addressLine2'),\r\n city: this.get('city'),\r\n state: this.get('state'),\r\n postalCode: this.get('postalCode')\r\n }\r\n },\r\n vendor: this.get('vendor')\r\n }\r\n\r\n if (this.get('addressId') && result.check && result.check.address) {\r\n result.check.address.id = this.get('addressId')\r\n }\r\n return result\r\n },\r\n\r\n getAmount: function () {\r\n var checkbookLineItem = _.find(this.get('lineItems'), function (detail) {\r\n return detail.get(this.get('amountType')) !== undefined && detail.get(this.get('amountType')) !== null\r\n }.bind(this))\r\n\r\n return checkbookLineItem ? checkbookLineItem.get('amount') : null\r\n }\r\n \r\n}, {\r\n parse: function (json) {\r\n return new APPayment({\r\n readableJournalType: 'AP Payment',\r\n id: json.id,\r\n journalType: 'APPAYMENT',\r\n description: json.description,\r\n date: moment(json.postedDate),\r\n notes: json.notes,\r\n voidJournal: json.voidJournal,\r\n is1099: json.is1099,\r\n has1099: true,\r\n lineItems: _.map(json.lineItems, Distribution.parse),\r\n checkbookId: (json.checkbook || {checkbookId: ''}).checkbookId,\r\n check: {\r\n printedName: json.check.printedName,\r\n handwritten: json.check.handwritten,\r\n checkNumber: json.check.checkNumber,\r\n memo: json.check.memo,\r\n address: json.check.address != null\r\n ? {\r\n id: json.check.address.id,\r\n addressLine1: json.check.address.addressLine1,\r\n addressLine2: json.check.address.addressLine2,\r\n city: json.check.address.city,\r\n state: json.check.address.state,\r\n postalCode: json.check.address.postalCode\r\n }\r\n : null\r\n },\r\n vendor: json.vendor\r\n \r\n })\r\n }\r\n})\r\n\r\nmodule.exports = APPayment","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurringFrequency\\\" size=\\\"1\\\">\\r\\n <option value=\\\"1\\\">Weekly</option>\\r\\n <option value=\\\"2\\\">Bi-Weekly</option>\\r\\n <option value=\\\"3\\\">Monthly</option>\\r\\n <option value=\\\"4\\\">Bi-Monthly</option>\\r\\n <option value=\\\"5\\\">Quarterly</option>\\r\\n <option value=\\\"6\\\">Semi-Annual</option>\\r\\n <option value=\\\"7\\\">Annual</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Frequency</label>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, buffer = \n \" <div class=\\\"form-group recurring-checkbook-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurring-checkbook\\\" size=\\\"1\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Checkbook</label>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \" <input type=\\\"hidden\\\" name=\\\"recurring-checkbook\\\" />\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, buffer = \n \" <form>\\r\\n <div class=\\\"check-meta meta\\\">\\r\\n <div class=\\\"col-xs-6 no-padding\\\">\\r\\n <div class=\\\"flex\\\" data-not-autocomplete-boundary>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Memorized Label\",\"inputName\":\"memorizationLabel\",\"inputId\":\"check-memorized-label\",\"wrapperClasses\":\"memorized-label\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Vendor ID\",\"inputName\":\"vendorId\",\"inputId\":\"check-vendor-id\",\"wrapperClasses\":\"vendor-id\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"idVendor\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizationId\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizedEntryDate\\\" />\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Printed Name\",\"inputName\":\"printedName\",\"inputId\":\"check-payee\",\"wrapperClasses\":\"payee col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address 1\",\"inputName\":\"AddressLine1\",\"inputId\":\"check-address1\",\"wrapperClasses\":\"address1 col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address 2\",\"inputName\":\"AddressLine2\",\"inputId\":\"check-address2\",\"wrapperClasses\":\"address2 col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"City\",\"inputName\":\"City\",\"inputId\":\"check-city\",\"wrapperClasses\":\"city col-xs-8 col-md-6 col-sm-6\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.stateSelect,depth0,{\"name\":\"stateSelect\",\"hash\":{\"inputId\":\"check-state\",\"wrapperClasses\":\"col-xs-2 col-md-3 col-sm-3\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Zip Code\",\"inputName\":\"postalCode\",\"inputId\":\"check-postalCode\",\"wrapperClasses\":\"postalCode col-xs-2 col-md-3 col-sm-3\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <div class=\\\"col-xs-6 no-padding\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Date\",\"inputName\":\"PostedDate\",\"inputId\":\"check-date\",\"wrapperClasses\":\"check-date col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputType\":\"number\",\"inputLabel\":\"Check #\",\"inputName\":\"CheckNumber\",\"inputId\":\"check-number\",\"wrapperClasses\":\"check-number col-xs-6\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"currency currency-field\",\"inputLabel\":\"Amount\",\"inputName\":\"Amount\",\"inputId\":\"check-amount\",\"wrapperClasses\":\"amount col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"check-notes-\\\" name=\\\"Description\\\" rows=\\\"4\\\"></textarea>\\r\\n <label for=\\\"check-notes-\\\">Memo</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"flex col-xs-12\\\">\\r\\n <div class=\\\"form-group is-1099\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>1099</span> <input type=\\\"checkbox\\\" name=\\\"Is1099\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n <div class=\\\"form-group is-recurring\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Recurring</span> <input type=\\\"checkbox\\\" name=\\\"IsRecurring\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"col-xs-12 distribution\\\">\\r\\n <h3>Payment Distribution</h3>\\r\\n <div class=\\\"line-item-container\\\">\\r\\n </div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Payment Distribution</button>\\r\\n <br />\\r\\n <div class=\\\"col-xs-12 recurring-meta-container no-padding\\\">\\r\\n <h3>Recurrence</h3>\\r\\n <div class=\\\"flex col-xs-12\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Start Date\",\"wrapperClasses\":\"recurring-start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group recurring-frequency-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(alias1,options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(7, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary memorize-button\\\">Memorize</button>\\r\\n <button class=\\\"btn btn-danger pull-right margin-left void-button\\\">Void Check</button>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Enter Check</button>\\r\\n <button class=\\\"btn btn-primary pull-right save update-button\\\">Update AP Payment</button>\\r\\n </div>\\r\\n <div class=\\\"col-xs-12 check-status status\\\"></div>\\r\\n </form>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Distribution = require('checkbook/distribution')\r\nvar moment = require('moment')\r\nvar numbro = require('numbro')\r\nvar _ = require('lodash')\r\n\r\nvar Check = Backbone.Model.extend({\r\n defaults: {\r\n amountType: 'credit'\r\n },\r\n toJSON: function () {\r\n var result = {\r\n id: this.id,\r\n memorizedEntryDate: this.get('memorizedEntryDate'),\r\n label: this.get('label'),\r\n readableJournalType: 'Check',\r\n journalType: 'CHECK',\r\n description: this.get('description'),\r\n postedDate: this.get('date'),\r\n notes: this.get('notes'),\r\n voidJournal: this.get('voidJournal'),\r\n is1099: this.get('is1099'),\r\n has1099: true,\r\n amount: numbro().unformat(this.get('amount') || this.getAmount() || this.get('amount')),\r\n shortDate: this.get('shortDate'),\r\n lineItems: _.map(this.get('lineItems'), function (detail) {\r\n if (detail.toJSON) {\r\n return detail.toJSON()\r\n } else {\r\n return detail\r\n }\r\n }),\r\n check: this.get('check') || {\r\n printedName: this.get('printedName'),\r\n handwritten: this.get('handwritten'),\r\n checkNumber: this.get('handwritten') ? this.get('checkNumber') : null,\r\n memo: this.get('memo'),\r\n address: {\r\n addressLine1: this.get('addressLine1'),\r\n addressLine2: this.get('addressLine2'),\r\n city: this.get('city'),\r\n state: this.get('state'),\r\n postalCode: this.get('postalCode')\r\n }\r\n },\r\n memorizationId: this.get('memorizationId'),\r\n memorizedEntryId: this.get('memorizationId'),\r\n vendor: this.get('vendor'),\r\n isRecurring: this.get('isRecurring'),\r\n recurringDate: this.get('recurringDate'),\r\n recurringFrequency: this.get('recurringFrequency'),\r\n checkbook: { checkbookId: this.get('checkbookId') }\r\n }\r\n\r\n if (this.get('addressId') && result.check && result.check.address) {\r\n result.check.address.id = this.get('addressId')\r\n }\r\n\r\n return result\r\n },\r\n\r\n getAmount: function () {\r\n var checkbookLineItem = _.find(this.get('lineItems'), function (detail) {\r\n return detail.get(this.get('amountType')) !== undefined && detail.get(this.get('amountType')) !== null\r\n }.bind(this))\r\n\r\n return checkbookLineItem ? checkbookLineItem.get('amount') : null\r\n }\r\n}, {\r\n parse: function (json) {\r\n return new Check({\r\n readableJournalType: 'Check',\r\n id: json.id,\r\n label: json.label,\r\n memorizationId: json.memorizationId,\r\n journalType: 'CHECK',\r\n description: json.description,\r\n date: moment(json.postedDate),\r\n notes: json.notes,\r\n voidJournal: json.voidJournal,\r\n is1099: json.is1099,\r\n has1099: true,\r\n lineItems: _.map(json.lineItems, Distribution.parse),\r\n memorizedEntryDate: json.memorizedEntryDate,\r\n checkbookId: (json.checkbook || {checkbookId: ''}).checkbookId,\r\n check: {\r\n printedName: json.check.printedName,\r\n handwritten: json.check.handwritten,\r\n checkNumber: json.check.checkNumber,\r\n memo: json.check.memo,\r\n address: json.check.address != null\r\n ? {\r\n id: json.check.address.id,\r\n addressLine1: json.check.address.addressLine1,\r\n addressLine2: json.check.address.addressLine2,\r\n city: json.check.address.city,\r\n state: json.check.address.state,\r\n postalCode: json.check.address.postalCode\r\n }\r\n : null\r\n },\r\n vendor: json.vendor\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = Check\r\n","'use strict'\r\n\r\nvar CreateCheckTemplate = require('checkbook/check/create-check')\r\nvar CreateEntryBaseView = require('checkbook/create-entry-view')\r\nvar CompanyService = require('company/company-service')\r\nvar SubscriptionService = require('settings/subscription/service')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar numbro = require('numbro')\r\nvar sweetAlert = require('sweetalert2')\r\nvar moment = require('moment')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar CreateCheckView = CreateEntryBaseView.extend({\r\n initialize: function () {\r\n this.subscriptionService = new SubscriptionService()\r\n this.companyService = new CompanyService()\r\n this.amountType = 'credit'\r\n\r\n this.on('bindAutocomplete', function () {\r\n this.bindVendorAutocomplete()\r\n this.bindMemorizationAutocomplete()\r\n }.bind(this))\r\n\r\n this.listenTo(this.model, 'change:accounts', this.render.bind(this))\r\n\r\n this.on('setMemorizationId', this.setMemorizationId.bind(this))\r\n\r\n this.listenTo(this.model.get('checkbook'), 'change:checkbooks', this.render.bind(this))\r\n },\r\n\r\n events: {\r\n 'submit form': 'submitForm',\r\n 'click .add-more-line-items': 'addLineItem',\r\n \"keyup [type='currency']\": 'checkDistributions',\r\n 'click .save': 'create',\r\n \"change [name='Handwritten']\": 'toggleNumber',\r\n \"keypress [name='Description']\": 'limitMemoLines',\r\n 'change input': 'validateExtras',\r\n 'keyup input': 'validateExtras',\r\n 'click .memorize-button': 'memorize',\r\n 'click .void-button': 'confirmVoid'\r\n },\r\n\r\n render: function () {\r\n $('.tooltip').remove()\r\n\r\n this.$el.html(CreateCheckTemplate({\r\n checkbooks: this.model.get('checkbook').get('checkbooks')\r\n }))\r\n\r\n this.$('.date')\r\n .datepicker(dateParams.options)\r\n .datepicker('setDate', moment().format(dateParams.format))\r\n .datepicker('defaultDate', moment().format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.journal-balance-discrepency').hide()\r\n this.$('.journal-balance-balanced').show()\r\n\r\n this.renderHandwrittenOption()\r\n this.addLineItem()\r\n this.checkDistributions()\r\n this.toggleNumber()\r\n this.validateExtras()\r\n\r\n return this\r\n },\r\n\r\n renderHandwrittenOption: function () {\r\n var activeCompanyInfo = this.companyService.getActiveCompanyInfo()\r\n var hasActiveSubscription = activeCompanyInfo.activeSubscription\r\n var activeSubscriptionInfo = this.subscriptionService.getActiveSubscriptionInfo()\r\n\r\n if (!hasActiveSubscription || activeSubscriptionInfo.planLevel.name === 'Free' || activeSubscriptionInfo.planLevel.price === 0) {\r\n this.$('.handwritten input').prop('disabled', true)\r\n this.$('.handwritten input').prop('checked', true)\r\n this.$('.handwritten .css-checkbox').attr('data-toggle', 'tooltip')\r\n this.$('.handwritten .css-checkbox').attr('data-placement', 'top')\r\n this.$('.handwritten .css-checkbox').attr('data-original-title', 'Users on a free subscription can only post handwritten checks')\r\n }\r\n },\r\n\r\n bindVendorAutocomplete: function () {\r\n this.autoComplete(\r\n _.filter(this.model.get('vendorList'), 'vendorId'),\r\n 'vendorId',\r\n this.$('input[name=vendorId]'),\r\n this.vendorSelected.bind(this)\r\n )\r\n },\r\n\r\n bindMemorizationAutocomplete: function () {\r\n this.autoComplete(\r\n this.model.get('memorizationList'),\r\n 'label',\r\n this.$('input[name=memorizationLabel]'),\r\n this.memorizationSelected.bind(this),\r\n 'CREATENEW'\r\n )\r\n },\r\n\r\n memorizationSelected: function (memorization) {\r\n if (typeof memorization === 'string') {\r\n memorization = _.find(this.model.get('memorizationList'), { id: memorization })\r\n }\r\n\r\n this.$('input[name=memorizationLabel]').val(memorization.label).closest('.floating').addClass('open')\r\n\r\n this.$('input[name=memorizationId]')\r\n .val(memorization.id)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n if (memorization.id === 'CREATENEW') {\r\n return\r\n }\r\n\r\n var checkbookAccountId = this.model.get('checkbook').get('account')\r\n var checkbookDetailLine = _.find(memorization.lineItems, { ledgerAccountId: checkbookAccountId })\r\n var lineItems = _.without(memorization.lineItems, checkbookDetailLine)\r\n\r\n this.$('input[name=memorizationId]')\r\n .val(memorization.id)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n if (memorization.vendor) {\r\n var vendor = _.find(this.model.get('vendorList'), { id: memorization.vendor.vendorId })\r\n if (vendor) {\r\n this.vendorSelected(vendor)\r\n }\r\n }\r\n\r\n // Clear out any existing lines\r\n this.$('.line-item-container').html('')\r\n _.each(lineItems, function (lineItem, index) {\r\n var account = _.find(this.model.get('accounts'), { 'id': lineItem.ledgerAccountId })\r\n\r\n if (!account) {\r\n console.error(\"Couldn't find account with id\", lineItem.ledgerAccountId, 'is this an invalid link to a checkbook account?')\r\n return\r\n }\r\n\r\n var $lineItem = this.addLineItem()\r\n\r\n $lineItem.find('input[name=AccountNumber]').val(account.get('accountNumber')).closest('.floating').addClass('open')\r\n $lineItem.find('input[name=Description]').val(account.get('accountName')).closest('.floating').addClass('open')\r\n $lineItem.find('input[name=Amount]').val(numbro(lineItem.debit || lineItem.credit).formatCurrency('$0,0.00')).closest('.floating').addClass('open')\r\n }.bind(this))\r\n\r\n this.$('.is-recurring input').prop('checked', memorization.isRecurring)\r\n this.$('select[name=recurringFrequency]').val(memorization.recurringFrequency)\r\n if (memorization.checkbook) {\r\n this.$('select[name=recurring-checkbook], input[name=recurring-checkbook]').val(memorization.checkbook.checkbookId)\r\n }\r\n\r\n this.$('.recurring-start-date .date')\r\n .datepicker('setDate', moment(memorization.recurringDate)._d)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.meta input[name=Amount]').val(numbro(_.sumBy(lineItems, 'debit')).formatCurrency('$0,0.00')).closest('.floating').addClass('open')\r\n this.$('.meta textarea[name=Description]').val(memorization.description).closest('.floating').addClass('open')\r\n this.$('.meta input[name=Reference]').val(memorization.referenceNumber).closest('.floating').addClass('open')\r\n\r\n if (memorization.check) {\r\n this.$('.meta [name=printedName]').val(memorization.check.printedName).closest('.floating').addClass('open')\r\n this.$(\".meta [name='Handwritten']\").prop('checked', memorization.check.handwritten).closest('.floating').addClass('open')\r\n this.$(\".meta [name='Is1099']\").prop('checked', memorization.is1099).closest('.floating').addClass('open')\r\n this.$('.meta [name=CheckNumber]').val(memorization.check.checkNumber).closest('.floating').addClass('open')\r\n\r\n if (memorization.check.address) {\r\n this.$('.meta [name=AddressLine1]').val(memorization.check.address.addressLine1).closest('.floating').addClass('open')\r\n this.$('.meta [name=AddressLine2]').val(memorization.check.address.addressLine2).closest('.floating').addClass('open')\r\n this.$('.meta [name=City]').val(memorization.check.address.city).closest('.floating').addClass('open')\r\n this.$('.meta [name=state]').val(memorization.check.address.state).closest('.floating').addClass('open')\r\n this.$('.meta [name=postalCode]').val(memorization.check.address.postalCode).closest('.floating').addClass('open')\r\n }\r\n }\r\n this.toggleNumber()\r\n this.validateExtras()\r\n\r\n return memorization\r\n },\r\n\r\n vendorSelected: function (vendor) {\r\n this.$('input[name=vendorId]')\r\n .val(vendor.vendorId)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=printedName]')\r\n .val(vendor.printedName)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=AddressLine1]')\r\n .val(vendor.addressLine1)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=AddressLine2]')\r\n .val(vendor.addressLine2)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=City]')\r\n .val(vendor.city)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('select[name=state]')\r\n .val(vendor.state)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=postalCode]')\r\n .val(vendor.postalCode)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=idVendor]')\r\n .val(vendor.id)\r\n\r\n // Clear out any existing lines\r\n this.$('.line-item-container').html('')\r\n _.each(vendor.expenseDistributions, function (lineItem, index) {\r\n var $lineItem = this.addLineItem()\r\n\r\n var account = _.find(this.model.get('accounts'), { 'id': lineItem.ledgerAccountId })\r\n\r\n if (!account) {\r\n console.error(\"Couldn't find account with id\", lineItem.get('account'), 'is this an invalid link to a checkbook account?')\r\n }\r\n\r\n $lineItem.find('input[name=AccountNumber]').val(account.get('accountNumber')).closest('.floating').addClass('open')\r\n $lineItem.find('input[name=Description]').val(account.get('accountName')).closest('.floating').addClass('open')\r\n }.bind(this))\r\n this.validateExtras()\r\n },\r\n\r\n reset: function () {\r\n this.render()\r\n },\r\n\r\n toggleNumber: function () {\r\n var handwritten = this.$(\"[name='Handwritten']\").is(':checked')\r\n this.$('.check-number').toggle(handwritten)\r\n this.$('.check-date').toggleClass('col-xs-12', !handwritten).toggleClass('col-xs-6', handwritten)\r\n this.$('.void-button').toggle(handwritten)\r\n },\r\n\r\n limitMemoLines: function (e) {\r\n var textInput = this.$('#check-notes-').val()\r\n var lines = textInput.split('\\n')\r\n var lineCount = lines.length\r\n var maxLength = 65\r\n\r\n if (lines[lineCount - 1].length === maxLength && lineCount < 7) {\r\n var lastSpace = textInput.lastIndexOf(' ')\r\n\r\n if (lastSpace <= 0) {\r\n lastSpace = textInput.length\r\n }\r\n var leadingString = textInput.substr(0, lastSpace)\r\n var remainder = textInput.substr(lastSpace, textInput.length - 1)\r\n \r\n if (remainder.length < maxLength) {\r\n this.$('#check-notes-').val(leadingString + '\\n' + remainder.substr(1, remainder.length - 1))\r\n } else {\r\n this.$('#check-notes-').val(textInput + '\\n')\r\n } \r\n }\r\n\r\n if (lineCount === 7 && ((e.keyCode === 10 || e.keyCode === 13) || lines[lineCount - 1].length === maxLength)) {\r\n e.preventDefault()\r\n }\r\n\r\n return lineCount <= 7\r\n },\r\n\r\n create: function (event) {\r\n event.preventDefault()\r\n this.save(false)\r\n },\r\n\r\n confirmVoid: function (event) {\r\n event.preventDefault()\r\n\r\n if (!(this.isCheckNumberValid() && this.isPrintedNameValid() && this.isAmountValid())) {\r\n return\r\n }\r\n\r\n if (Math.abs(this.calculateDiscrepancy()).toFixed(2) >= 0.01) {\r\n return\r\n }\r\n\r\n sweetAlert({\r\n title: 'Confirm Void',\r\n text: 'Are you sure you want to void this check?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.$('.void-button').prop('disabled', true)\r\n this.save(true)\r\n }.bind(this))\r\n },\r\n\r\n btnEnable: function () {\r\n $('.void-button').prop('disabled', false)\r\n $('.save').prop('disabled', false)\r\n },\r\n\r\n save: function (isVoided) {\r\n if (!(this.isCheckNumberValid() && this.isPrintedNameValid() && this.isAmountValid())) {\r\n return\r\n }\r\n\r\n if (Math.abs(this.calculateDiscrepancy()).toFixed(2) >= 0.01) {\r\n return\r\n }\r\n\r\n if (!this.validateDistributionAccounts()) {\r\n return\r\n }\r\n\r\n this.$('.save').prop('disabled', true)\r\n this.trigger('create', this.getCheck(isVoided))\r\n },\r\n\r\n memorize: function () {\r\n if (!(this.isPrintedNameValid() && this.isAmountValid())) {\r\n return\r\n }\r\n\r\n if (Math.abs(this.calculateDiscrepancy()).toFixed(2) >= 0.01) {\r\n return\r\n }\r\n\r\n var check = this.getCheck()\r\n\r\n check.set('lineItems', _.filter(check.get('lineItems'), function (distribution) {\r\n return distribution.get('account') !== this.model.get('checkbook').get('account')\r\n }.bind(this)))\r\n\r\n if (check.get('memorizationId')) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'You will be overwriting any previously memorized information.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize', check)\r\n }.bind(this))\r\n } else {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize', check)\r\n }\r\n },\r\n\r\n submitForm: function (event) {\r\n event.preventDefault()\r\n },\r\n\r\n validateExtras: function () {\r\n this.validateExtrasAs('CHECK')\r\n },\r\n\r\n setMemorizationId: function (memorizationId) {\r\n this.$('input[name=memorizationId]').val(memorizationId)\r\n },\r\n\r\n showSuccessMessage: function () {\r\n return this.showSuccessMessageAs('CHECK')\r\n },\r\n\r\n memBtnEnable: function () {\r\n this.$('.memorize-button').prop('disabled', false)\r\n }\r\n})\r\n\r\nmodule.exports = CreateCheckView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar CreateCheckView = require('checkbook/check/create-check-view')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar MemorizationService = require('memorization/journal-entries/service')\r\nvar VendorsService = require('lists/vendors/service')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar CreateCheckWidget = function (checkbook) {\r\n this.model = new Backbone.Model({\r\n checkbook: checkbook,\r\n accounts: []\r\n })\r\n this.view = new CreateCheckView({\r\n model: this.model\r\n })\r\n this.accountService = new AccountService()\r\n this.checkbookService = new CheckbookService()\r\n this.memorizationService = new MemorizationService()\r\n this.vendorsService = new VendorsService()\r\n this.view.on('create', this.createCheck, this)\r\n this.view.on('memorize', this.memorizeCheck, this)\r\n}\r\n\r\nCreateCheckWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCreateCheckWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n Q.all([\r\n this.vendorsService.getList(),\r\n this.accountService.fetchAccounts(false),\r\n this.loadMemorizations()\r\n ]).spread(function (vendors, accounts) {\r\n this.model.set({\r\n vendorList: _.map(vendors, function (vendor) {\r\n vendor['fullName'] = vendor.firstName + ' ' + vendor.lastName\r\n return vendor\r\n }),\r\n accounts: _.filter(accounts, function (account) {\r\n return account.id !== this.model.get('checkbook').get('account')\r\n }.bind(this))\r\n })\r\n\r\n this.view.trigger('bindAutocomplete')\r\n\r\n return vendors\r\n }.bind(this))\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nCreateCheckWidget.prototype.loadMemorizations = function () {\r\n return this.memorizationService.getList('Check').then(function (memorizations) {\r\n this.model.set('memorizationList', memorizations)\r\n this.view.trigger('bindAutocomplete')\r\n }.bind(this))\r\n}\r\n\r\nCreateCheckWidget.prototype.createCheck = function (check) {\r\n if (this.creating) {\r\n return\r\n }\r\n\r\n this.creating = true\r\n this.checkbookService.createCheck(this.model.get('checkbook').get('id'), check).then(function () {\r\n this.view.reset()\r\n this.creating = false\r\n this.trigger('checkCreated')\r\n this.loadMemorizations()\r\n }.bind(this), function () {\r\n this.creating = false\r\n this.view.btnEnable()\r\n }.bind(this))\r\n}\r\n\r\nCreateCheckWidget.prototype.memorizeCheck = function (check) {\r\n var deferral\r\n\r\n if (!check.get('label')) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Please enter in a memorization label for this transaction',\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n this.view.memBtnEnable()\r\n return\r\n }\r\n\r\n if (check.get('memorizationId')) {\r\n deferral = this.memorizationService.update(check.get('memorizationId'), check).then(function () {\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your check has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationUpdated')\r\n }.bind(this))\r\n } else {\r\n deferral = this.memorizationService.create(check).then(function (response) {\r\n this.view.trigger('setMemorizationId', response.message)\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your check has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationCreated')\r\n }.bind(this))\r\n }\r\n\r\n deferral.fail(function (err) {\r\n this.view.showError(err.message)\r\n }.bind(this))\r\n \r\n this.view.memBtnEnable()\r\n deferral.then(this.loadMemorizations.bind(this))\r\n}\r\n\r\nmodule.exports = CreateCheckWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurringFrequency\\\" size=\\\"1\\\">\\r\\n <option value=\\\"1\\\">Weekly</option>\\r\\n <option value=\\\"2\\\">Bi-Weekly</option>\\r\\n <option value=\\\"3\\\">Monthly</option>\\r\\n <option value=\\\"4\\\">Bi-Monthly</option>\\r\\n <option value=\\\"5\\\">Quarterly</option>\\r\\n <option value=\\\"6\\\">Semi-Annual</option>\\r\\n <option value=\\\"7\\\">Annual</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Frequency</label>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, buffer = \n \" <div class=\\\"form-group recurring-checkbook-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurring-checkbook\\\" size=\\\"1\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Checkbook</label>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \" <input type=\\\"hidden\\\" name=\\\"recurring-checkbook\\\" />\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, buffer = \n \"<form>\\r\\n <div class=\\\"check-meta meta\\\">\\r\\n <div class=\\\"col-xs-6 no-padding\\\">\\r\\n <div class=\\\"flex\\\" data-not-autocomplete-boundary>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Memorized Label\",\"inputName\":\"memorizationLabel\",\"inputId\":\"check-memorized-label\",\"wrapperClasses\":\"memorized-label\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Vendor ID\",\"inputName\":\"vendorId\",\"inputId\":\"check-vendor-id\",\"wrapperClasses\":\"vendor-id\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group handwritten\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Handwritten</span> <input type=\\\"checkbox\\\" name=\\\"Handwritten\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n <input type=\\\"hidden\\\" name=\\\"idVendor\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizationId\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizedEntryDate\\\" />\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Printed Name\",\"inputName\":\"printedName\",\"inputId\":\"check-payee\",\"wrapperClasses\":\"payee col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address 1\",\"inputName\":\"AddressLine1\",\"inputId\":\"check-address1\",\"wrapperClasses\":\"address1 col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address 2\",\"inputName\":\"AddressLine2\",\"inputId\":\"check-address2\",\"wrapperClasses\":\"address2 col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"City\",\"inputName\":\"City\",\"inputId\":\"check-city\",\"wrapperClasses\":\"city col-xs-8 col-md-6 col-sm-6\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.stateSelect,depth0,{\"name\":\"stateSelect\",\"hash\":{\"inputId\":\"check-state\",\"wrapperClasses\":\"col-xs-2 col-md-3 col-sm-3\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Zip Code\",\"inputName\":\"postalCode\",\"inputId\":\"check-postalCode\",\"wrapperClasses\":\"postalCode col-xs-2 col-md-3 col-sm-3\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <div class=\\\"col-xs-6 no-padding\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Date\",\"inputName\":\"PostedDate\",\"inputId\":\"check-date\",\"wrapperClasses\":\"check-date col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputType\":\"number\",\"inputLabel\":\"Check #\",\"inputName\":\"CheckNumber\",\"inputId\":\"check-number\",\"wrapperClasses\":\"check-number col-xs-6\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"currency currency-field\",\"inputLabel\":\"Amount\",\"inputName\":\"Amount\",\"inputId\":\"check-amount\",\"wrapperClasses\":\"amount col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"check-notes-\\\" name=\\\"Description\\\" rows=\\\"4\\\" maxlength=\\\"566\\\"></textarea>\\r\\n <label for=\\\"check-notes-\\\">Memo</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"flex col-xs-12\\\">\\r\\n <div class=\\\"form-group is-1099\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>1099</span> <input type=\\\"checkbox\\\" name=\\\"Is1099\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n <div class=\\\"form-group is-recurring\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Recurring</span> <input type=\\\"checkbox\\\" name=\\\"IsRecurring\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"col-xs-12 distribution\\\">\\r\\n <h3>Payment Distribution</h3>\\r\\n <div class=\\\"line-item-container\\\">\\r\\n </div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Payment Distribution</button>\\r\\n <br />\\r\\n <div class=\\\"col-xs-12 recurring-meta-container no-padding\\\">\\r\\n <h3>Recurrence</h3>\\r\\n <div class=\\\"flex col-xs-12\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Start Date\",\"wrapperClasses\":\"recurring-start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group recurring-frequency-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(alias1,options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(7, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary memorize-button\\\">Memorize</button>\\r\\n <button class=\\\"btn btn-danger pull-right margin-left void-button\\\">Void Check</button>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Enter Check</button>\\r\\n <button class=\\\"btn btn-primary pull-right save update-button\\\">Update Check</button>\\r\\n </div>\\r\\n <div class=\\\"col-xs-12 check-status status\\\"></div>\\r\\n</form>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar CheckbookEntryTabsTemplate = require('checkbook/checkbook-entry-tabs')\r\nvar CreateCheckWidget = require('checkbook/check/create-check-widget')\r\nvar CreateDepositWidget = require('checkbook/deposit/create-deposit-widget')\r\nvar CreateEftPaymentWidget = require('checkbook/eft-payment/create-eft-payment-widget')\r\nvar CreateEftDepositWidget = require('checkbook/eft-deposit/create-eft-deposit-widget')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar CheckbookEntryTabsView = Backbone.View.extend({\r\n className: 'block no-padding tabbed collapsed',\r\n\r\n events: {\r\n 'click .cancel': 'close'\r\n },\r\n\r\n initialize: function () {\r\n this.on('itemCreated', this.close, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CheckbookEntryTabsTemplate())\r\n\r\n var eftDeposit = new CreateEftDepositWidget(this.model.get('checkbook'))\r\n var eftPayment = new CreateEftPaymentWidget(this.model.get('checkbook'))\r\n var deposit = new CreateDepositWidget(this.model.get('checkbook'))\r\n var check = new CreateCheckWidget(this.model.get('checkbook'))\r\n eftPayment.on('eftPaymentCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n eftDeposit.on('eftDepositCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n deposit.on('depositCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n check.on('checkCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n\r\n this.$('#new-checks').html(check.show())\r\n this.$('#new-deposits').html(deposit.show())\r\n this.$('#new-eft-payments').html(eftPayment.show())\r\n this.$('#new-eft-deposits').html(eftDeposit.show())\r\n\r\n if (window.location.hash) {\r\n this.$(\"a[href='\" + window.location.hash + \"']\").tab('show')\r\n }\r\n\r\n this.$el.on('click', this.handleClick.bind(this))\r\n\r\n return this\r\n },\r\n\r\n handleClick: function (e) {\r\n this.activeTab = $(e.currentTarget).find('ul li.active a').attr('href')\r\n switch (this.activeTab) {\r\n case '#new-checks':\r\n this.activeTab = 'check'\r\n break\r\n case '#new-deposits':\r\n this.activeTab = 'deposit'\r\n break\r\n case '#new-eft-payments':\r\n this.activeTab = 'EFT payment'\r\n break\r\n case '#new-eft-deposits':\r\n this.activeTab = 'EFT deposit'\r\n break\r\n default:\r\n this.activeTab = 'check'\r\n }\r\n\r\n if (!this.active) {\r\n if (!this.model.get('checkbook').get('isDisabled')) {\r\n this.$el.removeClass('collapsed')\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.close.bind(this))\r\n this.active = true\r\n } else {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'This checkbook is disabled. It must be enabled to create a new ' + this.activeTab + '.',\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n }\r\n }\r\n },\r\n\r\n close: function (e) {\r\n this.$el.addClass('collapsed')\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n this.active = false\r\n\r\n $('.ui-autocomplete.ui-front.ui-menu.ui-widget.ui-widget-content').css('display', 'none')\r\n\r\n if (e && e.stopImmediatePropagation) {\r\n e.stopImmediatePropagation()\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = CheckbookEntryTabsView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar $ = require('jquery')\r\nvar CheckbookEntryTabsView = require('checkbook/checkbook-entry-tabs-view')\r\n\r\nvar CheckbookEntryTabsWidget = function (checkbook) {\r\n this.model = new Backbone.Model({\r\n checkbook: checkbook\r\n })\r\n this.view = new CheckbookEntryTabsView({\r\n model: this.model\r\n })\r\n this.view.on('itemCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n}\r\n\r\nCheckbookEntryTabsWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCheckbookEntryTabsWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n var $el = this.view.render().$el\r\n\r\n return $el\r\n}\r\n\r\nmodule.exports = CheckbookEntryTabsWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<ul class=\\\"nav nav-tabs nav-tabs-alt\\\" id=\\\"tabs\\\" data-toggle=\\\"tabs\\\">\\r\\n <li class=\\\"active\\\">\\r\\n <a href=\\\"#new-checks\\\">Checks</a>\\r\\n </li>\\r\\n <li class=\\\"\\\">\\r\\n <a href=\\\"#new-deposits\\\">Deposits</a>\\r\\n </li>\\r\\n <li class=\\\"\\\">\\r\\n <a href=\\\"#new-eft-payments\\\">EFT Payments</a>\\r\\n </li>\\r\\n <li class=\\\"\\\">\\r\\n <a href=\\\"#new-eft-deposits\\\">EFT Deposits</a>\\r\\n </li>\\r\\n <li class=\\\"pull-right\\\">\\r\\n <i class=\\\"fa fa-close expanding-group-close cancel\\\"></i>\\r\\n </li>\\r\\n</ul>\\r\\n<div class=\\\"block-content tab-content\\\">\\r\\n <div class=\\\"tab-pane active check\\\" id=\\\"new-checks\\\">\\r\\n CHECK\\r\\n </div>\\r\\n <div class=\\\"tab-pane deposit\\\" id=\\\"new-deposits\\\">\\r\\n\\r\\n </div>\\r\\n <div class=\\\"tab-pane eft-payment\\\" id=\\\"new-eft-payments\\\">\\r\\n\\r\\n </div>\\r\\n <div class=\\\"tab-pane eft-deposit\\\" id=\\\"new-eft-deposits\\\">\\r\\n\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar numbro = require('numbro')\r\n\r\nvar Type = Object.freeze({\r\n CHECK: 'Check',\r\n DEPOSIT: 'Deposit',\r\n EFTPAYMENT: 'EFT Payment',\r\n EFTDEPOSIT: 'EFT Deposit',\r\n AR: 'AR',\r\n ARPAYMENT: 'AR Payment',\r\n ARDEPOSIT: 'AR Deposit',\r\n APPAYMENT: 'AP Payment'\r\n})\r\n\r\nvar CheckbookLineItem = Backbone.Model.extend({\r\n\r\n}, {\r\n Type: Type,\r\n\r\n parse: function (json) {\r\n return new CheckbookLineItem({\r\n id: json.id,\r\n postedOn: moment(json.postedDate),\r\n createdOn: moment(json.createDate),\r\n isVoided: json.voidJournal,\r\n description: json.description,\r\n memo: json.memo !== undefined ? json.memo : '',\r\n credit: json.credit === 0 ? '' : numbro(json.credit).formatCurrency('$0,0.00'),\r\n debit: json.debit === 0 ? '' : numbro(json.debit).formatCurrency('$0,0.00'),\r\n balance: numbro(json.accountBalance).formatCurrency('($0,0.00)'),\r\n checkNumber: json.checkNumber,\r\n status: json.status,\r\n type: Type[json.journalType.toUpperCase()]\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = CheckbookLineItem\r\n","'use strict'\r\n\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar CheckbookWidget = require('checkbook/checkbook-widget')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar CheckbookReconciliationWidget = require('checkbook/reconciliation/widget')\r\n\r\nvar CheckbookRouter = Router.extend({\r\n routes: {\r\n 'checkbook': 'firstCheckbook',\r\n 'checkbook/reconcile': 'firstReconcileCheckbook',\r\n 'checkbook/:checkbookId': 'showCheckbook',\r\n 'checkbook/:checkbookId/reconcile': 'showReconciliation'\r\n },\r\n\r\n firstCheckbook: function () {\r\n var checkbookService = new CheckbookService()\r\n checkbookService.fetchCheckbookList().then(function (checkbooks) {\r\n var firstCheckbook = _.first(checkbooks)\r\n\r\n if (firstCheckbook) {\r\n Backbone.trigger('app:navigate', 'checkbook/' + firstCheckbook.id)\r\n return\r\n }\r\n\r\n Backbone.trigger('app:showInFrame', new CheckbookWidget())\r\n Backbone.trigger('app:updateTitle', 'Checkbook', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Company', href: '/company'}, {label: 'Checkbook'}])\r\n })\r\n },\r\n\r\n showCheckbook: function (checkbookId) {\r\n if (checkbookId == 'reconcile') {\r\n this.firstReconcileCheckbook()\r\n return\r\n }\r\n\r\n Backbone.trigger('app:showInFrame', new CheckbookWidget(checkbookId))\r\n Backbone.trigger('app:updateTitle', 'Checkbook', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Company', href: '/company'}, {label: 'Checkbook'}])\r\n },\r\n\r\n firstReconcileCheckbook: function () {\r\n var checkbookService = new CheckbookService()\r\n checkbookService.fetchCheckbookList().then(function (checkbooks) {\r\n var firstCheckbook = _.first(checkbooks)\r\n\r\n if (firstCheckbook) {\r\n Backbone.trigger('app:navigate', 'checkbook/' + firstCheckbook.id + '/reconcile')\r\n return\r\n }\r\n\r\n console.error('No checkbook to default to, sending to first checkbook page')\r\n\r\n this.firstCheckbook()\r\n }.bind(this))\r\n },\r\n\r\n showReconciliation: function (checkbookId) {\r\n Backbone.trigger('app:showInFrame', new CheckbookReconciliationWidget(checkbookId))\r\n Backbone.trigger('app:updateTitle', 'Reconcile', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Company', href: '/company'}, {label: 'Checkbook'}, {label: 'Reconcile'}])\r\n }\r\n})\r\n\r\nmodule.exports = CheckbookRouter\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Check = require('checkbook/check/check')\r\nvar EFTDeposit = require('checkbook/eft-deposit/eft-deposit')\r\nvar EFTPayment = require('checkbook/eft-payment/eft-payment')\r\nvar Deposit = require('checkbook/deposit/deposit')\r\nvar APPayment = require('checkbook/appayment/appayment')\r\nvar Checkbook = require('checkbook/checkbook')\r\nvar CheckbookLineItem = require('checkbook/checkbook-line-item')\r\nvar CheckbookUnprintedLineItem = require('checkbook/checkbook-unprinted-line-item')\r\nvar moment = require('moment')\r\nvar Config = require('config/config')\r\nvar RestClient = require('rest/client')\r\nvar CompanyService = require('company/company-service')\r\nvar SessionService = require('session/session-service')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\n\r\nvar Mapping = {\r\n Check: Check,\r\n EFTDeposit: EFTDeposit,\r\n EFTPayment: EFTPayment,\r\n Deposit: Deposit,\r\n APPayment: APPayment\r\n}\r\n\r\nvar CheckbookService = function () {\r\n this.restClient = new RestClient()\r\n this.companyService = new CompanyService()\r\n}\r\n\r\nCheckbookService.prototype.fetchCheckbookList = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/checkbooks/list').then(function (response) {\r\n return _.map(response, Checkbook.parse)\r\n })\r\n}\r\n\r\nCheckbookService.prototype.createCheckbook = function (checkbook) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.restClient.post(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/checkbooks', checkbook).then(function (response) {\r\n return response.message\r\n })\r\n}\r\n\r\nCheckbookService.prototype.getCheckCount = function (id) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/checkbooks/' + id + '/checks').then(function (response) {\r\n return response.totalRecords\r\n })\r\n}\r\n\r\nCheckbookService.prototype.fetchUnprintedHistoryForCheckbook = function (id, index) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionParams = {\r\n page: index\r\n }\r\n\r\n var action = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'checkbooks',\r\n id,\r\n 'checks',\r\n 'pending'\r\n ]\r\n\r\n action = action.join('/') + '?' + $.param(actionParams)\r\n\r\n return this.restClient.get(action).then(function (response) {\r\n return _.map(response, CheckbookUnprintedLineItem.parse)\r\n })\r\n}\r\n\r\nCheckbookService.prototype.fetchBalances = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/checkbooks/balances').then(function (accounts) {\r\n return accounts\r\n })\r\n}\r\n\r\nCheckbookService.prototype.fetchAccountBalance = function (checkbookId) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/checkbooks/' + checkbookId + '/account-balance').then(function (response) {\r\n return response.accountBalance\r\n })\r\n}\r\n\r\nCheckbookService.prototype.fetchAvailableAccountBalance = function (checkbookId) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/checkbooks/' + checkbookId + '/available-account-balance').then(function (response) {\r\n return response.accountBalance\r\n })\r\n}\r\n\r\nCheckbookService.prototype.fetchCheck = function (checkbookId, checkId) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/checkbooks/' + checkbookId + '/checks/' + checkId).then(function (response) {\r\n var mapTo = Mapping[response.journalType]\r\n return mapTo.parse(response)\r\n })\r\n}\r\n\r\nCheckbookService.prototype.updateCheck = function (checkbookId, checkId, checkData, adminMode) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPath = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'checkbooks',\r\n checkbookId,\r\n 'checks',\r\n checkId\r\n ]\r\n\r\n if (adminMode) actionPath.push('admin')\r\n\r\n if (!checkbookId && checkData.get('checkbookId')) {\r\n checkbookId = checkData.get('checkbookId')\r\n }\r\n\r\n return this.restClient.put(\r\n actionPath.join('/'),\r\n checkData.toJSON()\r\n )\r\n}\r\n\r\nCheckbookService.prototype.createJournalEntry = function (checkbookId, entry) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n if (!checkbookId && entry.get('checkbookId')) {\r\n checkbookId = entry.get('checkbookId')\r\n }\r\n return this.restClient.post(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/checkbooks/' + checkbookId + '/checks', entry)\r\n}\r\n\r\nCheckbookService.prototype.createEftDeposit = function (checkbookId, eftDeposit) {\r\n return this.createJournalEntry(checkbookId, eftDeposit)\r\n}\r\n\r\nCheckbookService.prototype.createEftPayment = function (checkbookId, eftPayment) {\r\n return this.createJournalEntry(checkbookId, eftPayment)\r\n}\r\n\r\nCheckbookService.prototype.createDeposit = function (checkbookId, deposit) {\r\n return this.createJournalEntry(checkbookId, deposit)\r\n}\r\n\r\nCheckbookService.prototype.createCheck = function (checkbookId, check) {\r\n return this.createJournalEntry(checkbookId, check)\r\n}\r\n\r\nCheckbookService.prototype.deleteCheck = function (checkbookId, checkId) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.restClient.del(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/checkbooks/' + checkbookId + '/checks/' + checkId)\r\n}\r\n\r\nCheckbookService.prototype.fetchStartingCheckNumber = function (checkbookId) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/checkbooks/' + checkbookId + '/starting-check-number')\r\n}\r\n\r\nCheckbookService.prototype.reviewPrintedChecks = function (checkbookId, checks) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.restClient.post(\r\n Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/checkbooks/' + checkbookId + '/print-review',\r\n { checks: checks }\r\n )\r\n}\r\n\r\nCheckbookService.prototype.printChecks = function (checkbookId, startingCheckNumber, checks) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var formDomElement = document.createElement('form')\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'checkbooks',\r\n checkbookId,\r\n 'print'\r\n ]\r\n\r\n var actionPath = actionPathElements.join('/') + '?' + $.param({\r\n accessToken: SessionService.getToken()\r\n })\r\n formDomElement.action = actionPath\r\n formDomElement.method = 'POST'\r\n\r\n var serializedCheckData = $(\"<input name='checksData[]'>\").val(JSON.stringify(checks))\r\n formDomElement.appendChild(serializedCheckData[0])\r\n \r\n var startingCheckNumberInput = $(\"<input name='startingCheckNumber'>\").val(startingCheckNumber)\r\n formDomElement.appendChild(startingCheckNumberInput[0])\r\n\r\n var $formElement = $(formDomElement)\r\n $formElement.css({\r\n display: 'none'\r\n })\r\n\r\n $('body').append($formElement)\r\n\r\n formDomElement.submit()\r\n\r\n $formElement.remove()\r\n}\r\n\r\nCheckbookService.prototype.fetchQueued = function (checkbookId, forPayables) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var apiPath = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'checkbooks',\r\n checkbookId,\r\n 'checks',\r\n 'queued'\r\n ].join('/')\r\n\r\n return this.restClient.get(apiPath + (forPayables ? '?payables=true' : '')).then(function (response) {\r\n return _.map(response, CheckbookUnprintedLineItem.parse)\r\n })\r\n}\r\n\r\nCheckbookService.prototype.fetchReconciliations = function (checkbookId) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'checkbooks',\r\n checkbookId,\r\n 'reconciliations'\r\n ]\r\n\r\n var apiPath = actionPathElements.join('/')\r\n\r\n return this.restClient.get(apiPath).then(function (reconciliations) {\r\n var collection = new Backbone.Collection()\r\n collection.reset(_.map(reconciliations, function (reconciliation) {\r\n reconciliation.shortEndDate = moment(reconciliation.endDate).format('MM/DD/YYYY')\r\n reconciliation.shortStartDate = moment(reconciliation.startDate).format('MM/DD/YYYY')\r\n reconciliation.shortClosedDate = moment(reconciliation.closedDate).format('MM/DD/YYYY')\r\n reconciliation.checkbookId = checkbookId\r\n return reconciliation\r\n }))\r\n return collection\r\n })\r\n}\r\n\r\nCheckbookService.prototype.reopenReconciliations = function (checkbookId, reconciliationId) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'checkbooks',\r\n checkbookId,\r\n 'reconciliations',\r\n reconciliationId,\r\n 'reopen'\r\n ]\r\n\r\n var apiPath = actionPathElements.join('/')\r\n\r\n return this.restClient.put(apiPath)\r\n}\r\n\r\nCheckbookService.prototype.fetchReconciliation = function (checkbookId, reconciliationId) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'checkbooks',\r\n checkbookId,\r\n 'reconciliations',\r\n reconciliationId\r\n ]\r\n\r\n var apiPath = actionPathElements.join('/')\r\n\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nCheckbookService.prototype.voidAndRecreate = function (checkbookId, checkId) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'checkbooks',\r\n checkbookId,\r\n 'checks',\r\n checkId,\r\n 'void-and-reverse'\r\n ]\r\n\r\n var apiPath = actionPathElements.join('/')\r\n\r\n return this.restClient.put(apiPath)\r\n}\r\n\r\nmodule.exports = CheckbookService\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar numbro = require('numbro')\r\nvar _ = require('lodash')\r\n\r\nvar CheckbookUnprintedLineItem = Backbone.Model.extend({\r\n\r\n}, {\r\n parse: function (json) {\r\n var credit = 0\r\n var debit = 0\r\n\r\n _.each(json.lineItems, function (lineItem) {\r\n credit = credit + lineItem.credit\r\n debit = debit + lineItem.debit\r\n })\r\n\r\n if (json.credit !== undefined) {\r\n credit = json.credit\r\n }\r\n\r\n if (json.debit !== undefined) {\r\n debit = json.debit\r\n }\r\n\r\n return new CheckbookUnprintedLineItem({\r\n postedOn: moment(json.postedDate),\r\n description: json.description,\r\n credit: credit === 0 ? '' : numbro(credit).formatCurrency('$0,0.00'),\r\n debit: debit === 0 ? '' : numbro(debit * -1).formatCurrency('$0,0.00'),\r\n amount: credit === 0 ? '' : numbro(credit).formatCurrency('$0,0.00'),\r\n id: json.id,\r\n checkNumber: json.check ? json.check.checkNumber : null,\r\n printedName: json.check ? json.check.printedName : null\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = CheckbookUnprintedLineItem\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('underscore')\r\nvar sweetAlert = require('sweetalert2')\r\nvar CheckbookTemplate = require('checkbook/view-checkbooks')\r\nvar CheckbookEntryTabsWidget = require('checkbook/checkbook-entry-tabs-widget')\r\nvar CheckbookHistoryWidget = require('checkbook/history/checkbook-history-widget')\r\nvar CheckbookUnprintedHistoryWidget = require('checkbook/unprinted-history/checkbook-unprinted-history-widget')\r\nvar CheckDetailsWidget = require('checkbook/details/check-details-widget')\r\nvar PrintCheckReviewWidget = require('checkbook/print-review/widget')\r\n\r\nvar CheckbookView = Backbone.View.extend({\r\n className: 'checkbooks',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:checkbooks change:dataLoaded', this.render)\r\n this.detailsWidget = new CheckDetailsWidget(this.model)\r\n this.on('noCheckbook', this.noCheckbookAlert, this)\r\n },\r\n\r\n events: {\r\n 'change .my-checkbooks': 'selectCheckbook',\r\n 'click #GoToReconcile': 'goToReconcile'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CheckbookTemplate(this.createViewModel()))\r\n\r\n var checkbookToLoad = this.model.get('checkbookId') || _.first(this.model.get('checkbooks') || [])\r\n this.$('select.my-checkbooks').val(checkbookToLoad)\r\n\r\n var checkbook = _.find(this.model.get('checkbooks'), function (item) {\r\n return item.get('id') === checkbookToLoad\r\n })\r\n\r\n if (!checkbook) {\r\n return this\r\n }\r\n\r\n this.tabs = new CheckbookEntryTabsWidget(checkbook)\r\n this.unprintedHistory = new CheckbookUnprintedHistoryWidget(checkbook)\r\n this.history = new CheckbookHistoryWidget(checkbook)\r\n var $unprintedHistory = $(this.unprintedHistory.show())\r\n var $history = $(this.history.show())\r\n\r\n this.tabs.on('itemCreated', function () {\r\n this.unprintedHistory.update()\r\n this.history.update()\r\n }.bind(this))\r\n\r\n this.unprintedHistory.on('checksPrinted', this.onChecksPrinted, this)\r\n\r\n _.each([\r\n {widget: this.unprintedHistory, view: $unprintedHistory},\r\n {widget: this.history, view: $history}\r\n ], function (container) {\r\n container.widget.on('openDetailView', function (model, element) {\r\n this.trigger('fetchCheck', checkbookToLoad, model, function (check) {\r\n var $details = $(this.detailsWidget.show(check, element))\r\n\r\n var $parentCheckbook = element.closest('.history-table')\r\n var parentCheckbookHeight = $parentCheckbook.height()\r\n var offsetInParent = $(element).addClass('active').position().top + 44\r\n\r\n $details.remove()\r\n $details.css({\r\n top: offsetInParent\r\n })\r\n\r\n container.view.find('.history-table').append($details)\r\n\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.closeDetails.bind(this))\r\n .one('click', function () {\r\n $parentCheckbook.css({\r\n 'padding-bottom': 0\r\n })\r\n })\r\n\r\n var heightNeeded = offsetInParent + $details.height() + 15\r\n\r\n if (heightNeeded > parentCheckbookHeight) {\r\n $parentCheckbook.css({\r\n 'padding-bottom': heightNeeded - parentCheckbookHeight\r\n })\r\n }\r\n }.bind(this))\r\n }, this)\r\n }.bind(this))\r\n\r\n this.$('#CheckbookDetails').empty()\r\n .append(this.tabs.show())\r\n .append($unprintedHistory)\r\n .append($history)\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n checkbooks: (this.model.get('checkbooks') || []).map(function (item) {\r\n return {\r\n id: item.get('id'),\r\n name: item.get('name')\r\n }\r\n }),\r\n dataLoaded: this.model.get('dataLoaded')\r\n }\r\n },\r\n\r\n selectCheckbook: function () {\r\n var id = this.$('select').val()\r\n if (id === 'null') {\r\n // Only the 'new' checkbook lacks a value\r\n this.trigger('createNew')\r\n this.$('select').val(this.model.get('checkbookId'))\r\n return\r\n }\r\n\r\n Backbone.trigger('app:navigate', 'checkbook/' + id)\r\n },\r\n\r\n closeDetails: function () {\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n this.$('.check-details').remove()\r\n this.$('tr.active').removeClass('active')\r\n },\r\n\r\n goToReconcile: function () {\r\n Backbone.trigger('app:navigate', 'checkbook/' + this.model.get('checkbookId') + '/reconcile')\r\n },\r\n\r\n onChecksPrinted: function (checks) {\r\n var confirmationWidget = new PrintCheckReviewWidget(this.model, checks)\r\n var $confirmationWidget = confirmationWidget.show()\r\n this.$('#CheckbookDetails').append($confirmationWidget)\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n })\r\n $('.finishReview').css({\r\n display: 'none'\r\n })\r\n setTimeout(function () {\r\n $('.review-message').css({\r\n display: 'none'\r\n })\r\n $('.finishReview').css({\r\n display: 'block'\r\n })\r\n }, 3000)\r\n confirmationWidget.on('reviewCompleted', function () {\r\n this.render()\r\n $confirmationWidget.remove()\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n }.bind(this))\r\n },\r\n\r\n noCheckbookAlert: function () {\r\n if (!!this.model.get('dataLoaded') && (!this.model.get('checkbooks') || (!!this.model.get('checkbooks') && this.model.get('checkbooks').length === 0))) {\r\n sweetAlert({\r\n title: 'Warning',\r\n text: 'You do not have a checkbook. Please create a checkbook.',\r\n confirmButtonColor: '#19aea6',\r\n type: 'warning'\r\n }).then(function () {\r\n Backbone.trigger('app:navigate', 'settings/checkbooks')\r\n })\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = CheckbookView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar CheckbookView = require('checkbook/checkbook-view')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar CreateCheckbookWidget = require('checkbook/create-checkbook-widget')\r\nvar q = require('q')\r\n\r\nvar CheckbookWidget = function (checkbookId) {\r\n this.model = new Backbone.Model({\r\n checkbookId: checkbookId\r\n })\r\n this.view = new CheckbookView({\r\n model: this.model\r\n })\r\n this.checkbookService = new CheckbookService()\r\n this.view.on('createNew', this.createCheckbook, this)\r\n this.view.on('fetchCheck', this.fetchCheck, this)\r\n}\r\n\r\nCheckbookWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n q.all([\r\n this.checkbookService.fetchCheckbookList(),\r\n this.checkbookService.fetchQueued(this.model.get('checkbookId'))\r\n ]).then(function (results) {\r\n var checkbooks = results[0]\r\n var queuedChecks = results[1]\r\n this.model.set('checkbooks', checkbooks)\r\n this.model.set('dataLoaded', true)\r\n\r\n if (queuedChecks.length) {\r\n this.view.onChecksPrinted(queuedChecks)\r\n }\r\n }.bind(this), function () {\r\n this.model.set('dataLoaded', true)\r\n this.view.trigger('noCheckbook')\r\n }.bind(this))\r\n\r\n return this.view.render().el\r\n}\r\n\r\nCheckbookWidget.prototype.createCheckbook = function () {\r\n var create = new CreateCheckbookWidget()\r\n Backbone.trigger('app:showInModal', create)\r\n create.on('close', function () {\r\n Backbone.trigger('app:closeModal')\r\n this.checkbookService.fetchCheckbookList().then(function (checkbooks) {\r\n this.model.set('checkbooks', checkbooks)\r\n }.bind(this))\r\n }.bind(this))\r\n}\r\n\r\nCheckbookWidget.prototype.fetchCheck = function (checkbookId, checkId, callback) {\r\n this.checkbookService.fetchCheck(checkbookId, checkId)\r\n .then(callback)\r\n}\r\n\r\nmodule.exports = CheckbookWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\n\r\nvar Checkbook = Backbone.Model.extend({\r\n toJSON: function () {\r\n return {\r\n id: this.get('id'),\r\n name: this.get('name'),\r\n ledgerAccount: this.get('account'),\r\n isSelected: this.get('isSelected'),\r\n startingBalance: this.get('startingBalance'),\r\n isDisabled: this.get('isDisabled')\r\n }\r\n },\r\n\r\n toViewModel: function () {\r\n return this.toJSON()\r\n }\r\n}, {\r\n parse: function (json) {\r\n return new Checkbook({\r\n id: json.id,\r\n name: json.name,\r\n startingBalance: json.startingBalance,\r\n isDisabled: json.isDisabled,\r\n account: json.ledgerAccount\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = Checkbook\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar numbro = require('numbro')\r\nvar CreateCheckbookTemplate = require('checkbook/create-checkbook')\r\nvar Checkbook = require('checkbook/checkbook')\r\nvar Account = require('generalledgeraccounts/account')\r\n\r\nvar CreateCheckbookView = Backbone.View.extend({\r\n className: 'new-checkbook checkbooks block',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:accounts', this.render)\r\n },\r\n\r\n events: {\r\n 'click .addNew': 'create',\r\n 'keyup input': 'detectValidation',\r\n 'click .cancel': 'close'\r\n },\r\n\r\n close: function () {\r\n Backbone.trigger('app:closeModal')\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CreateCheckbookTemplate(this.createViewModel()))\r\n\r\n this.$('.needs-more-data')\r\n this.$('.all-data-filled').hide()\r\n\r\n this.autocomplete('accountNumber', this.$('#AccountNumber'), this.$('#AccountNumber'), this.$('#Description'))\r\n this.autocomplete('accountName', this.$('#Description'), this.$('#AccountNumber'), this.$('#Description'))\r\n\r\n return this\r\n },\r\n\r\n autocomplete: function (name, $autocomplete, $accountNumber, $accountName) {\r\n var accounts = _.sortBy(_.filter(this.model.get('accounts'), {'attributes': {status: true}}), ['attributes' + name])\r\n var accountLookup = _.keyBy(accounts, 'attributes.id')\r\n\r\n var accountSelectedCallback = function (accountId) {\r\n var account = accountLookup[accountId]\r\n if (account) {\r\n $accountName\r\n .val(account.get('accountName'))\r\n .closest('.form-material')\r\n .addClass('open')\r\n $accountNumber\r\n .val(account.get('accountNumber'))\r\n .closest('.form-material')\r\n .addClass('open')\r\n .closest('.form-group')\r\n .removeClass('col-sm-4 col-xs-8')\r\n .addClass('col-sm-6 col-xs-12')\r\n this.$el.removeClass('new-account')\r\n\r\n this.creatingNewSource = false\r\n\r\n this.$('#new-checkbook-name').focus()\r\n } else {\r\n $accountName.closest('.form-group').addClass('col-sm-4 col-xs-8').removeClass('col-sm-6 col-xs-12')\r\n this.$(_.first(_.without([$accountNumber[0], $accountName[0]], $autocomplete[0]))).val('').closest('.form-group').removeClass('open')\r\n this.$el.addClass('new-account')\r\n this.$('#new-account-type').focus()\r\n\r\n this.creatingNewSource = name\r\n }\r\n }.bind(this)\r\n\r\n var getAccountId = function () {\r\n var selectedItem = null\r\n\r\n if (!$autocomplete.val()) {\r\n return null\r\n }\r\n\r\n _.each(autocomplete.menu.element.find('li'), function (el) {\r\n var isMatching = $(el).text() == $autocomplete.val()\r\n if (isMatching && !selectedItem) {\r\n selectedItem = $(el)\r\n }\r\n })\r\n if (!selectedItem) {\r\n selectedItem = autocomplete.menu.element.find('li:first-child')\r\n }\r\n\r\n return selectedItem.attr('data-id')\r\n }\r\n\r\n var autocomplete = $.extend($autocomplete.autocomplete({\r\n position: {\r\n my: 'left top', at: 'left bottom', of: $autocomplete.closest('.input-group')\r\n },\r\n delay: 100,\r\n minLength: 0,\r\n appendTo: $('#main-container'),\r\n source: function (request, response) {\r\n if (this.creatingNewSource && this.creatingNewSource !== name) {\r\n return\r\n }\r\n\r\n if (!request || !request.term) {\r\n response(_.map(accounts, function (account) {\r\n return {\r\n label: account.get(name),\r\n value: account.id\r\n }\r\n }))\r\n }\r\n\r\n // Programatically return a new source every query\r\n response(_.uniqBy(_.concat(_.map(_.filter(accounts, function (account) {\r\n // Filter out results that don't contain the requested data\r\n return account.get(name).indexOf(request.term) !== -1\r\n // Include a result for creating a new account entry\r\n }), function (account) {\r\n return {\r\n label: account.get(name),\r\n value: account.id\r\n }\r\n }), {\r\n label: \"Create '\" + request.term + \"'\",\r\n value: request.term\r\n }), 'value'))\r\n }.bind(this),\r\n select: function (event, ui) {\r\n var accountId = ui.item.value\r\n accountSelectedCallback(accountId)\r\n event.preventDefault()\r\n },\r\n change: function (event, ui) {\r\n if (this.creatingNewSource) {\r\n return\r\n }\r\n\r\n var accountId = getAccountId()\r\n if (!accountId) {\r\n $accountName.val('').closest('.floating').removeClass('open')\r\n $accountNumber.val('').closest('.floating').removeClass('open')\r\n return\r\n } else {\r\n accountSelectedCallback(accountId)\r\n event.preventDefault()\r\n }\r\n }.bind(this),\r\n focus: function (event, ui) {\r\n event.preventDefault()\r\n },\r\n open: function (event, ui) {\r\n autocomplete.menu.element.css({\r\n 'width': $autocomplete.parent().outerWidth(),\r\n 'top': Number(autocomplete.menu.element.css('top').replace('px', ''))\r\n })\r\n }\r\n }).on('focus', function () {\r\n $autocomplete.autocomplete('search', '')\r\n }).data('ui-autocomplete'),\r\n {\r\n _renderMenu: function (ul, items) {\r\n _.each(items, function (item) {\r\n var $listItem = this._renderItemData(ul, item)\r\n $listItem.attr('data-id', item.value)\r\n }.bind(this))\r\n },\r\n _resizeMenu: function () {\r\n this.menu.element.css({\r\n 'width': $autocomplete.outerWidth(),\r\n position: 'absolute'\r\n }).addClass('z-1')\r\n }\r\n }\r\n )\r\n\r\n $autocomplete.on('focus', function () {\r\n $autocomplete.autocomplete('search', '')\r\n })\r\n\r\n $autocomplete.siblings('span.input-group-addon').on('click', function () {\r\n $autocomplete.focus()\r\n })\r\n\r\n $autocomplete.on('keyup', function (e) {\r\n if (e.which == 13) {\r\n var accountId = getAccountId()\r\n if (!accountId) {\r\n $accountName.val('').closest('.floating').removeClass('open')\r\n $accountNumber.val('').closest('.floating').removeClass('open')\r\n return\r\n } else {\r\n $autocomplete.autocomplete('instance')._trigger('select', 'autocompleteselect', {item: {value: accountId}})\r\n $autocomplete.autocomplete('close')\r\n }\r\n }\r\n })\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n types: Account.Type\r\n }\r\n },\r\n\r\n detectValidation: function (e) {\r\n var accountNumber = this.$('#AccountNumber').val()\r\n var description = this.$('#Description').val()\r\n var checkbookName = this.$('#new-checkbook-name').val()\r\n\r\n if (!accountNumber || !description || !checkbookName) {\r\n this.$('.needs-more-data').show()\r\n this.$('.all-data-filled').hide()\r\n } else {\r\n this.$('.needs-more-data').hide()\r\n this.$('.all-data-filled').show()\r\n }\r\n },\r\n\r\n create: function (event) {\r\n event.preventDefault()\r\n\r\n var accountNumber = this.$('#AccountNumber').val()\r\n var description = this.$('#Description').val()\r\n var accountType = this.$('#new-account-type option:selected').text()\r\n var checkbookName = this.$('#new-checkbook-name').val()\r\n var startingBalance = this.$('#startingBalance').val()\r\n startingBalance = numbro().unformat(startingBalance)\r\n \r\n if (!accountNumber || !checkbookName) {\r\n return\r\n }\r\n\r\n var account = _.find(this.model.get('accounts'), function (item) {\r\n return item.get('accountNumber') === accountNumber\r\n })\r\n\r\n if (account) {\r\n account = account.id\r\n }\r\n\r\n this.trigger('create', new Checkbook({\r\n account: account,\r\n accountNumber: accountNumber,\r\n accountType: accountType,\r\n description: description,\r\n name: checkbookName,\r\n startingBalance: startingBalance\r\n }))\r\n }\r\n})\r\n\r\nmodule.exports = CreateCheckbookView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar CreateCheckbookView = require('checkbook/create-checkbook-view')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar AccountService = require('generalledgeraccounts/service')\r\n\r\nvar CreateCheckbookWidget = function () {\r\n this.model = new Backbone.Model({\r\n accounts: []\r\n })\r\n this.view = new CreateCheckbookView({\r\n model: this.model\r\n })\r\n this.accountService = new AccountService()\r\n this.checkbookService = new CheckbookService()\r\n this.view.on('create', this.createCheckbook, this)\r\n}\r\n\r\nCreateCheckbookWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCreateCheckbookWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.accountService.fetchAccounts(false).then(function (accounts) {\r\n this.model.set('accounts', accounts)\r\n }.bind(this))\r\n\r\n return this.view.render().el\r\n}\r\n\r\nCreateCheckbookWidget.prototype.createCheckbook = function (checkbook) {\r\n var servicePromise = null\r\n if (!checkbook.get('account')) {\r\n servicePromise = this.accountService.createAccountBatch({\r\n accountName: checkbook.get('description'),\r\n accountType: checkbook.get('accountType'),\r\n accountNumber: checkbook.get('accountNumber'),\r\n status: true,\r\n checkbook: {\r\n name: checkbook.get('name'),\r\n startingBalance: checkbook.get('startingBalance')\r\n }\r\n }).then(function (result) {\r\n return _.chain(result.children).find({ChildType: 'CHECKBOOK'}).value().ChildId\r\n })\r\n } else {\r\n servicePromise = this.checkbookService.createCheckbook(checkbook)\r\n }\r\n\r\n servicePromise.then(function (newCheckbookId) {\r\n this.trigger('close')\r\n Backbone.trigger('app:navigate', 'checkbook/' + newCheckbookId)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = CreateCheckbookWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias1(container.lambda(depth0, depth0))\n + \"\\\">\"\n + alias1(((helper = (helper = helpers.key || (data && data.key)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"key\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right expanding-group-close cancel\\\"></i>\\r\\n <h3>Create New Checkbook</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"add-new-checkbook col-xs-12 no-padding\\\">\\r\\n <div class=\\\"form-group col-sm-3 col-xs-12 autocomplete\\\">\\r\\n <div class=\\\"form-material floating input-group ledgeraccountnumber\\\">\\r\\n <input class=\\\"form-control LedgerAccountNumber\\\" type=\\\"text\\\" data-val=\\\"true\\\" data-val-required=\\\"The account field is required.\\\" id=\\\"AccountNumber\\\" name=\\\"LedgerAccountNumber\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"AccountNumber\\\">GL Account #</label>\\r\\n <span class=\\\"input-group-addon\\\" for=\\\"AccountNumber\\\"><label for=\\\"AccountNumber\\\"><i class=\\\"fa fa-sort\\\"></i></label></span>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"AccountNumber\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-sm-2 col-xs-4 accountType\\\">\\r\\n <div class=\\\"form-material\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"new-account-type\\\" name=\\\"new-account-type\\\" size=\\\"1\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.types : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label for=\\\"new-account-type\\\">Account Type</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group col-sm-6 col-xs-12 autocomplete\\\">\\r\\n <div class=\\\"form-material floating input-group Description\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" data-val=\\\"true\\\" data-val-required=\\\"The account field is required.\\\" id=\\\"Description\\\" name=\\\"Description\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"Description\\\">GL Account Description</label>\\r\\n <span class=\\\"input-group-addon\\\" for=\\\"Description\\\"><label for=\\\"Description\\\"><i class=\\\"fa fa-sort\\\"></i></label></span>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"Description\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-sm-3 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating input-group\\\">\\r\\n <input class=\\\"form-control currency currency-field startingBalance\\\" type=\\\"text\\\" data-val=\\\"true\\\" data-val-required=\\\"The starting balance field is required.\\\" id=\\\"startingBalance\\\" name=\\\"startingBalance\\\" value=\\\"0\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"startingBalance\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" data-original-title=\\\"Beginning balance amount will not be reflected in your ledger. This amount will only act as a starting point to calculate your current checkbook registers balance. If you are entering a beginning balance, be sure your ledger’s ending account balance and checkbooks beginning balance will match as you cannot post journal entries to accounts associated with a checkbook. If this is a new account with a zero balance, you may leave the amount at $0.00.\\\">\\r\\n <img src=\\\"/img/question-circle.svg\\\" class=\\\"unprinted-tooltip\\\" alt=\\\"?\\\" /> Starting Balance\\r\\n </label>\\r\\n <span class=\\\"input-group-addon\\\" for=\\\"startingBalance\\\"><label for=\\\"startingBalance\\\"></label></span>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"startingBalance\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div> \\r\\n\\r\\n <div class=\\\"form-group col-sm-12 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating new-checkbook-name\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" data-val=\\\"true\\\" data-val-required=\\\"The checkbook name field is required.\\\" id=\\\"new-checkbook-name\\\" name=\\\"Name\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"new-checkbook-name\\\">Checkbook Name</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"new-checkbook-name\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"col-sm-12 col-xs-12\\\">\\r\\n <button class=\\\"btn btn-primary pull-right save addNew\\\">Submit</button>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"col-lg-12 needs-more-data bg-danger-light\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i>All fields must completed. Please try again and click Submit to create account.</div>\\r\\n <div class=\\\"col-lg-12 bg-primary-lighter all-data-filled\\\"><i class=\\\"fa fa-check-circle fa-2x fa-inverse\\\"></i>All fields have been completed. Click Submit to create account.</div>\\r\\n </div>\\r\\n\\r\\n\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar moment = require('moment')\r\nvar numbro = require('numbro')\r\nvar Check = require('checkbook/check/check')\r\nvar Deposit = require('checkbook/deposit/deposit')\r\nvar EftPayment = require('checkbook/eft-payment/eft-payment')\r\nvar EftDeposit = require('checkbook/eft-deposit/eft-deposit')\r\nvar APPayment = require('checkbook/appayment/appayment')\r\nvar Distribution = require('checkbook/distribution')\r\nvar DistributionLine = require('checkbook/distribution-line')\r\nvar CreateView = require('lists/list/create/view')\r\n\r\nvar CreateEntryView = CreateView.extend({\r\n className: '',\r\n autoCompleteAccount: function (name, $autocomplete, $accountNumber, $accountName) {\r\n var accounts = _.map(this.model.get('accounts'), function (account) {\r\n return account.toJSON()\r\n })\r\n\r\n var accountSelectedCallback = function (account) {\r\n $accountNumber\r\n .val(account.accountNumber)\r\n .parent()\r\n .addClass('open')\r\n $accountName\r\n .val(account.accountName)\r\n .parent()\r\n .addClass('open')\r\n\r\n this.$el.find('input[name=Debit],input[name=Credit]').focus()\r\n }.bind(this)\r\n\r\n this.autoComplete(\r\n _.filter(accounts, {status: true, accountClass: 0}),\r\n name,\r\n $autocomplete,\r\n accountSelectedCallback\r\n )\r\n\r\n this.autoComplete(\r\n _.filter(accounts, {status: true, accountClass: 0}),\r\n name,\r\n $autocomplete,\r\n accountSelectedCallback\r\n )\r\n },\r\n\r\n checkDistributionStatus: function (e) {\r\n var hasValue = _.reduce(\r\n this.$('.line-item-container input').map(function (index, el) { return $(el).val() }),\r\n function (memo, value) {\r\n return memo || (!!value && value !== '$')\r\n },\r\n false\r\n )\r\n\r\n if (hasValue || e.type === 'focusin') {\r\n this.$('.line-item-container').addClass('forceLabelsOpen')\r\n } else {\r\n this.$('.line-item-container').removeClass('forceLabelsOpen')\r\n }\r\n },\r\n\r\n addLineItem: function (e) {\r\n var index = this.$('.line-item-container > div').length + 1\r\n var parentId = this.model.id\r\n var $lineItem = $(DistributionLine({ index: index + '-' + parentId }))\r\n $lineItem.find('input').on('focusout', this.checkDistributionStatus.bind(this)).on('focusin', this.checkDistributionStatus.bind(this))\r\n this.$('.line-item-container').append($lineItem)\r\n this.OneUI($lineItem)\r\n\r\n if (index > 1) {\r\n $lineItem.find('.remove').on('click', function (e) {\r\n $lineItem.remove()\r\n })\r\n }\r\n\r\n this.autoCompleteAccount(\r\n 'accountName',\r\n $lineItem.find('input[name=Description]'),\r\n $lineItem.find('input[name=AccountNumber]'),\r\n $lineItem.find('input[name=Description]')\r\n )\r\n\r\n this.autoCompleteAccount(\r\n 'accountNumber',\r\n $lineItem.find('input[name=AccountNumber]'),\r\n $lineItem.find('input[name=AccountNumber]'),\r\n $lineItem.find('input[name=Description]')\r\n )\r\n\r\n if (e) {\r\n $lineItem.find('input:first').focus()\r\n }\r\n this.trigger('lineItemAdded', $lineItem)\r\n return $lineItem\r\n },\r\n\r\n showError: function (message) {\r\n this.$('.status').html(this.getErrorStatusBar(message))\r\n setTimeout(this.validateExtras.bind(this), 3000)\r\n },\r\n\r\n checkDistributions: function (descrepencyMessage) {\r\n var diff = this.calculateDiscrepancy()\r\n\r\n if (Math.abs(diff).toFixed(2) < 0.01) {\r\n if (this.showSuccessMessage) {\r\n this.showSuccessMessage()\r\n }\r\n return true\r\n } else {\r\n this.showError(descrepencyMessage + numbro(diff).formatCurrency('$0,0.00'))\r\n return false\r\n }\r\n },\r\n\r\n calculateDiscrepancy: function () {\r\n var credit = numbro().unformat(this.$('.meta input[name=Amount]').val())\r\n\r\n if (credit !== 0 && !credit) return 0\r\n\r\n var debit = _.chain(this.$('.line-item-container .new-journal-entry-item')).map(function (row, index) {\r\n var val = this.$(row).find('input[name=Amount]').val()\r\n return val ? numbro().unformat(val) : 0\r\n }.bind(this)).reduce(function (sum, n) {\r\n return sum + n\r\n }, 0).value()\r\n\r\n if (this.amountType === 'credit') {\r\n return Math.abs(credit - debit)\r\n } else {\r\n return Math.abs(debit - credit)\r\n }\r\n },\r\n\r\n hasDistributions: function () {\r\n return !!_.filter(\r\n this.$('.line-item-container .new-journal-entry-item input'),\r\n function (el) { return !!$(el).val() && $(el).val() !== '$0.00' }\r\n ).length\r\n },\r\n\r\n isAmountValid: function () {\r\n var amount = this.$('.meta input[name=Amount]')\r\n return numbro().unformat(amount.val()) > 0\r\n },\r\n\r\n isDescriptionValid: function () {\r\n return !!this.$('.meta input[name=Description], .meta textarea[name=Description]').val()\r\n },\r\n\r\n isPrintedNameValid: function () {\r\n return !!this.$('.meta input[name=printedName]').val()\r\n },\r\n\r\n isCheckNumberValid: function () {\r\n return this.$(\"[name='Handwritten']\").is(':checked') ? !!this.$('.meta input[name=CheckNumber]').val() : true\r\n },\r\n\r\n getCheck: function (isVoided) {\r\n var memorizationId = this.$('.meta input[name=memorizationId]').val()\r\n var label = this.$('.meta input[name=memorizationLabel]').val()\r\n var description = this.$('.meta textarea[name=Description]').val()\r\n var postedDate = this.$('.meta input[name=PostedDate]').val()\r\n var credit = this.$('.meta input[name=Amount]').val()\r\n\r\n var addressId = null\r\n if (this.model && this.model.get('check') && this.model.get('check').address && this.model.get('check').address.id) {\r\n addressId = this.model.get('check').address.id\r\n }\r\n\r\n var vendorId = this.$('.meta input[name=idVendor]').val()\r\n var printedName = this.$('.meta input[name=printedName]').val()\r\n var handwritten = this.$(\".meta input[name='Handwritten']\").is(':checked')\r\n var is1099 = this.$(\".meta [name='Is1099']\").is(':checked')\r\n var checkNumber = this.$('.meta input[name=CheckNumber]').val()\r\n\r\n var addressLine1 = this.$('.meta input[name=AddressLine1]').val()\r\n var addressLine2 = this.$('.meta input[name=AddressLine2]').val()\r\n var city = this.$('.meta input[name=City]').val()\r\n var state = this.$('.meta select[name=state]').val()\r\n var postalCode = this.$('.meta input[name=postalCode]').val()\r\n\r\n // TODO Check-specific fields\r\n\r\n var debits = this.getDistributions('debit', isVoided)\r\n\r\n var memorizedEntryDate = this.$('input[name=memorizedEntryDate]').val()\r\n var isRecurring = this.$('.meta .is-recurring input').prop('checked')\r\n var recurringStart = this.$('.recurring-meta-container input[name=startDate]').val()\r\n var recurringFrequency = this.$('.recurring-meta-container select[name=recurringFrequency]').val()\r\n var recurringCheckbook = this.$('.recurring-meta-container [name=recurring-checkbook]').val()\r\n\r\n return new Check({\r\n label: label,\r\n memorizedEntryDate: memorizedEntryDate,\r\n memorizationId: memorizationId === 'CREATENEW' ? '' : memorizationId,\r\n description: description,\r\n date: moment(postedDate.replace('/', ' '), 'MM DD YYYY'),\r\n printedName: printedName,\r\n handwritten: handwritten,\r\n is1099: is1099,\r\n voidJournal: isVoided,\r\n checkNumber: checkNumber,\r\n memo: description,\r\n addressLine1: addressLine1,\r\n addressLine2: addressLine2,\r\n city: city,\r\n state: state,\r\n postalCode: postalCode,\r\n addressId: addressId,\r\n isRecurring: isRecurring,\r\n recurringDate: recurringStart,\r\n recurringFrequency: recurringFrequency,\r\n checkbookId: recurringCheckbook,\r\n lineItems: debits.concat(new Distribution({\r\n type: 'credit',\r\n credit: isVoided ? 0 : credit,\r\n amount: isVoided ? 0 : credit,\r\n account: this.model.get('checkbook').get('account')\r\n })),\r\n vendor: vendorId ? {\r\n vendorId: vendorId\r\n } : null\r\n })\r\n },\r\n\r\n getAPPayment: function (isVoided) {\r\n var description = this.$('.meta textarea[name=Description]').val()\r\n var postedDate = this.$('.meta input[name=PostedDate]').val()\r\n var credit = this.$('.meta input[name=Amount]').val()\r\n\r\n var addressId = null\r\n if (this.model && this.model.get('check') && this.model.get('check').address && this.model.get('check').address.id) {\r\n addressId = this.model.get('check').address.id\r\n }\r\n\r\n var vendorId = this.$('.meta input[name=idVendor]').val()\r\n var printedName = this.$('.meta input[name=printedName]').val()\r\n var handwritten = this.$(\".meta input[name='Handwritten']\").is(':checked')\r\n var is1099 = this.$(\".meta [name='Is1099']\").is(':checked')\r\n var checkNumber = this.$('.meta input[name=CheckNumber]').val()\r\n\r\n var addressLine1 = this.$('.meta input[name=AddressLine1]').val()\r\n var addressLine2 = this.$('.meta input[name=AddressLine2]').val()\r\n var city = this.$('.meta input[name=City]').val()\r\n var state = this.$('.meta select[name=state]').val()\r\n var postalCode = this.$('.meta input[name=postalCode]').val()\r\n\r\n // TODO Check-specific fields\r\n\r\n var debits = this.getDistributions('debit', isVoided)\r\n\r\n return new APPayment({\r\n description: description,\r\n date: moment(postedDate.replace('/', ' '), 'MM DD YYYY'),\r\n printedName: printedName,\r\n handwritten: handwritten,\r\n is1099: is1099,\r\n voidJournal: isVoided,\r\n checkNumber: checkNumber,\r\n memo: description,\r\n addressLine1: addressLine1,\r\n addressLine2: addressLine2,\r\n city: city,\r\n state: state,\r\n postalCode: postalCode,\r\n addressId: addressId,\r\n lineItems: debits.concat(new Distribution({\r\n type: 'credit',\r\n credit: isVoided ? 0 : credit,\r\n amount: isVoided ? 0 : credit,\r\n account: this.model.get('checkbook').get('account')\r\n })),\r\n vendor: vendorId ? {\r\n vendorId: vendorId\r\n } : null\r\n })\r\n },\r\n\r\n getDeposit: function () {\r\n var memorizationId = this.$('.meta input[name=memorizationId]').val()\r\n var label = this.$('.meta input[name=memorizationLabel]').val()\r\n var description = this.$('.meta input[name=Description], .meta textarea[name=Description]').val()\r\n var postedDate = this.$('.meta input[name=PostedDate]').val()\r\n var referenceNumber = this.$('.meta input[name=Reference]').val()\r\n var notes = this.$('.meta input[name=Notes], textarea[name=Notes]').val()\r\n var debit = this.$('.meta input[name=Amount]').val()\r\n\r\n var credits = this.getDistributions('credit', false)\r\n\r\n var memorizedEntryDate = this.$('input[name=memorizedEntryDate]').val()\r\n var isRecurring = this.$('.meta .is-recurring input').prop('checked')\r\n var recurringStart = this.$('.recurring-meta-container input[name=startDate]').val()\r\n var recurringFrequency = this.$('.recurring-meta-container select[name=recurringFrequency]').val()\r\n var recurringCheckbook = this.$('.recurring-meta-container [name=recurring-checkbook]').val()\r\n\r\n return new Deposit({\r\n label: label,\r\n memorizedEntryDate: memorizedEntryDate,\r\n memorizationId: memorizationId === 'CREATENEW' ? '' : memorizationId,\r\n description: description,\r\n date: moment(postedDate.replace('/', ' '), 'MM DD YYYY'),\r\n referenceNumber: referenceNumber,\r\n notes: notes,\r\n isRecurring: isRecurring,\r\n recurringDate: recurringStart,\r\n recurringFrequency: recurringFrequency,\r\n checkbookId: recurringCheckbook,\r\n lineItems: credits.concat(new Distribution({\r\n type: 'debit',\r\n debit: debit,\r\n amount: debit,\r\n account: this.model.get('checkbook').get('account')\r\n }))\r\n })\r\n },\r\n\r\n getEftDeposit: function () {\r\n var memorizationId = this.$('.meta input[name=memorizationId]').val()\r\n var label = this.$('.meta input[name=memorizationLabel]').val()\r\n var description = this.$('.meta input[name=Description], .meta textarea[name=Description]').val()\r\n var postedDate = this.$('.meta input[name=PostedDate]').val()\r\n var referenceNumber = this.$('.meta input[name=Reference]').val()\r\n var notes = this.$('.meta input[name=Notes], textarea[name=Notes]').val()\r\n var debit = this.$('.meta input[name=Amount]').val()\r\n\r\n var credits = this.getDistributions('credit', false)\r\n\r\n var memorizedEntryDate = this.$('input[name=memorizedEntryDate]').val()\r\n var isRecurring = this.$('.meta .is-recurring input').prop('checked')\r\n var recurringStart = this.$('.recurring-meta-container input[name=startDate]').val()\r\n var recurringFrequency = this.$('.recurring-meta-container select[name=recurringFrequency]').val()\r\n var recurringCheckbook = this.$('.recurring-meta-container [name=recurring-checkbook]').val()\r\n\r\n return new EftDeposit({\r\n label: label,\r\n memorizedEntryDate: memorizedEntryDate,\r\n memorizationId: memorizationId === 'CREATENEW' ? '' : memorizationId,\r\n description: description,\r\n date: moment(postedDate.replace('/', ' '), 'MM DD YYYY'),\r\n referenceNumber: referenceNumber,\r\n notes: notes,\r\n isRecurring: isRecurring,\r\n recurringDate: recurringStart,\r\n recurringFrequency: recurringFrequency,\r\n checkbookId: recurringCheckbook,\r\n lineItems: credits.concat(new Distribution({\r\n type: 'debit',\r\n debit: debit,\r\n amount: debit,\r\n account: this.model.get('checkbook').get('account')\r\n }))\r\n })\r\n },\r\n\r\n getEftPayment: function () {\r\n var label = this.$('.meta input[name=memorizationLabel]').val()\r\n var description = this.$('.meta input[name=Description], .meta textarea[name=Description]').val()\r\n var postedDate = this.$('.meta input[name=PostedDate]').val()\r\n var referenceNumber = this.$('.meta input[name=Reference]').val()\r\n var notes = this.$('.meta input[name=Notes], textarea[name=Notes]').val()\r\n var vendorId = this.$('.meta input[name=idVendor]').val()\r\n var memorizationId = this.$('.meta input[name=memorizationId]').val()\r\n var credit = this.$('.meta input[name=Amount]').val()\r\n var is1099 = this.$(\".meta [name='Is1099']\").is(':checked')\r\n\r\n var memorizedEntryDate = this.$('input[name=memorizedEntryDate]').val()\r\n var isRecurring = this.$('.meta .is-recurring input').prop('checked')\r\n var recurringStart = this.$('.recurring-meta-container input[name=startDate]').val()\r\n var recurringFrequency = this.$('.recurring-meta-container select[name=recurringFrequency]').val()\r\n var recurringCheckbook = this.$('.recurring-meta-container [name=recurring-checkbook]').val()\r\n\r\n var debits = this.getDistributions('debit', false)\r\n\r\n return new EftPayment({\r\n label: label,\r\n memorizedEntryDate: memorizedEntryDate,\r\n memorizationId: memorizationId === 'CREATENEW' ? '' : memorizationId,\r\n is1099: is1099,\r\n description: description,\r\n date: moment(postedDate.replace('/', ' '), 'MM DD YYYY'),\r\n referenceNumber: referenceNumber,\r\n notes: notes,\r\n isRecurring: isRecurring,\r\n recurringDate: recurringStart,\r\n recurringFrequency: recurringFrequency,\r\n checkbookId: recurringCheckbook,\r\n lineItems: debits.concat(new Distribution({\r\n type: 'credit',\r\n credit: credit,\r\n amount: credit,\r\n account: this.model.get('checkbook').get('account')\r\n })),\r\n vendor: vendorId ? {\r\n vendorId: vendorId\r\n } : null\r\n })\r\n },\r\n\r\n getAs: function (asType) {\r\n switch (asType.toUpperCase()) {\r\n case 'CHECK':\r\n return this.getCheck()\r\n case 'DEPOSIT':\r\n return this.getDeposit()\r\n case 'EFTDEPOSIT':\r\n return this.getEftDeposit()\r\n case 'EFTPAYMENT':\r\n return this.getEftPayment()\r\n case 'APPAYMENT':\r\n return this.getAPPayment()\r\n }\r\n },\r\n\r\n getDistributions: function (lineItemType, isVoided) {\r\n return _.map(this.$('.line-item-container .new-journal-entry-item'), function (row, index) {\r\n var parent = this.$(row)\r\n\r\n var accountNumber = parent.find('input[name=AccountNumber]').val()\r\n var account = _.find(this.model.get('accounts'), function (item) {\r\n return item.get('accountNumber') === accountNumber\r\n })\r\n var amount = numbro().unformat(parent.find('input[name=Amount]').val())\r\n return new Distribution({\r\n type: lineItemType,\r\n debit: isVoided ? 0 : (lineItemType === 'debit' ? amount : 0),\r\n amount: isVoided ? 0 : (lineItemType === 'credit' ? amount : 0),\r\n account: account.get('id')\r\n })\r\n }.bind(this))\r\n },\r\n\r\n validateDistributionAccounts: function () {\r\n var items = _.filter(_.map(this.$('.line-item-container .new-journal-entry-item'), function (row, index) {\r\n var accountNumber = this.$(row).find('input[name=AccountNumber]').val()\r\n var account = _.find(this.model.get('accounts'), function (item) {\r\n return item.get('accountNumber') === accountNumber\r\n })\r\n\r\n return new Distribution({\r\n account: account !== undefined ? account.get('id') : ''\r\n })\r\n }.bind(this)), function (item) {\r\n return item.get('account') === ''\r\n })\r\n\r\n return items.length === 0\r\n },\r\n\r\n validateCheck: function () {\r\n var checkbook = this.model.get('checkbook')\r\n var isMemorizationMode = checkbook.get('isMemorizationMode')\r\n if (!this.isPrintedNameValid()) {\r\n this.showError('Checks must have a printed name.')\r\n } else if (!this.hasDistributions()) {\r\n this.showError('A payment distribution is required.')\r\n } else if (!this.isCheckNumberValid() && !isMemorizationMode) {\r\n this.showError('Handwritten checks must have a check number.')\r\n } else if (!this.isAmountValid()) {\r\n this.showError('Checks must have a balance greater than 0.')\r\n } else if (!this.validateDistributionAccounts()) {\r\n this.showError('Payment distributions must have ledger accounts.')\r\n } else {\r\n return this.checkDistributions('Your payment distribution does not equal your check amount. It is off by ')\r\n }\r\n return false\r\n },\r\n\r\n validateDeposit: function () {\r\n if (!this.isDescriptionValid()) {\r\n this.showError('Deposits must have a description.')\r\n } else if (!this.hasDistributions()) {\r\n this.showError('A deposit distribution is required.')\r\n } else if (!this.isAmountValid()) {\r\n this.showError('Deposits must have a balance greater than 0.')\r\n } else if (!this.validateDistributionAccounts()) {\r\n this.showError('Payment distributions must have ledger accounts.')\r\n } else {\r\n return this.checkDistributions('Your deposit distribution does not equal your deposit amount. It is off by ')\r\n }\r\n return false\r\n },\r\n\r\n validateEftDeposit: function () {\r\n if (!this.isDescriptionValid()) {\r\n this.showError('EFT Deposits must have a description.')\r\n } else if (!this.hasDistributions()) {\r\n this.showError('An EFT Deposit distribution is required.')\r\n } else if (!this.isAmountValid()) {\r\n this.showError('EFT Deposits must have a balance greater than 0.')\r\n } else if (!this.validateDistributionAccounts()) {\r\n this.showError('Payment distributions must have ledger accounts.')\r\n } else {\r\n return this.checkDistributions('Your EFT Deposit distribution does not equal your EFT Deposit amount. It is off by ')\r\n }\r\n return false\r\n },\r\n\r\n validateEftPayment: function () {\r\n if (!this.isDescriptionValid()) {\r\n this.showError('EFT Payments must have a description.')\r\n } else if (!this.hasDistributions()) {\r\n this.showError('An EFT Payment distribution is required.')\r\n } else if (!this.isAmountValid()) {\r\n this.showError('EFT Payments must have a balance greater than 0.')\r\n } else if (!this.validateDistributionAccounts()) {\r\n this.showError('Payment distributions must have ledger accounts.')\r\n } else {\r\n return this.checkDistributions('Your EFT Payment distribution does not equal your EFT Payment amount. It is off by ')\r\n }\r\n return false\r\n },\r\n\r\n validateAPPayment: function () {\r\n if (!this.hasDistributions()) {\r\n this.showError('An AP Payment distribution is required.')\r\n } else if (!this.isAmountValid()) {\r\n this.showError('AP Payments must have a balance greater than 0.')\r\n } else if (!this.validateDistributionAccounts()) {\r\n this.showError('Payment distributions must have ledger accounts.')\r\n } else {\r\n return this.checkDistributions('Your AP Payment distribution does not equal your AP Payment amount. It is off by ')\r\n }\r\n return false\r\n },\r\n\r\n validateExtrasAs: function (asType) {\r\n switch (asType.toUpperCase()) {\r\n case 'CHECK':\r\n return this.validateCheck()\r\n case 'DEPOSIT':\r\n return this.validateDeposit()\r\n case 'EFTDEPOSIT':\r\n return this.validateEftDeposit()\r\n case 'EFTPAYMENT':\r\n return this.validateEftPayment()\r\n case 'APPAYMENT':\r\n return this.validateAPPayment()\r\n }\r\n },\r\n\r\n showSuccessMessageAs: function (asType) {\r\n switch (asType.toUpperCase()) {\r\n case 'CHECK':\r\n return this.showCheckSuccessMessage()\r\n case 'DEPOSIT':\r\n return this.showDepositSuccessMessage()\r\n case 'EFTDEPOSIT':\r\n return this.showEFTDepositSuccessMessage()\r\n case 'EFTPAYMENT':\r\n return this.showEFTPaymentSuccessMessage()\r\n case 'APPAYMENT':\r\n return this.showAPPaymentSuccessMessage()\r\n }\r\n },\r\n\r\n showCheckSuccessMessage: function () {\r\n this.$('.status').html(this.getSuccessStatusBar('Your check is balanced.'))\r\n },\r\n\r\n showDepositSuccessMessage: function () {\r\n this.$('.status').html(this.getSuccessStatusBar('Your Deposit is balanced.'))\r\n },\r\n\r\n showEFTDepositSuccessMessage: function () {\r\n this.$('.status').html(this.getSuccessStatusBar('Your EFT Deposit is balanced.'))\r\n },\r\n\r\n showEFTPaymentSuccessMessage: function () {\r\n this.$('.status').html(this.getSuccessStatusBar('Your EFT Payment is balanced.'))\r\n },\r\n\r\n showAPPaymentSuccessMessage: function() {\r\n this.$('.status').html(this.getSuccessStatusBar('Your AP Payment is balanced.'))\r\n },\r\n \r\n setMemorizedEntryDate: function (entryDate, checkbookAccountId) {\r\n this.$('input[name=memorizedEntryDate]').val(entryDate)\r\n\r\n this.model.get('checkbook').set('account', checkbookAccountId)\r\n }\r\n})\r\n\r\nmodule.exports = CreateEntryView\r\n","'use strict'\r\n\r\nvar CreateDepositTemplate = require('checkbook/deposit/create-deposit')\r\nvar CreateEntryBaseView = require('checkbook/create-entry-view')\r\nvar sweetAlert = require('sweetalert2')\r\nvar Backbone = require('backbone')\r\nvar numbro = require('numbro')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar CreateDepositView = CreateEntryBaseView.extend({\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:accounts', this.render)\r\n this.amountType = 'debit'\r\n\r\n this.on('bindAutocomplete', function () {\r\n this.bindMemorizationAutocomplete()\r\n }.bind(this))\r\n\r\n this.on('setMemorizationId', this.setMemorizationId.bind(this))\r\n\r\n this.listenTo(this.model.get('checkbook'), 'change:checkbooks', this.render.bind(this))\r\n },\r\n\r\n events: {\r\n 'click .add-more-line-items': 'addLineItem',\r\n 'keyup input': 'validateExtras',\r\n 'click .save-deposit': 'create',\r\n 'change .deposit-type': 'changeDepositType',\r\n 'click .memorize-button': 'memorize'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CreateDepositTemplate({\r\n checkbooks: this.model.get('checkbook').get('checkbooks')\r\n }))\r\n\r\n this.$('.date')\r\n .datepicker(dateParams.options)\r\n .datepicker('setDate', moment().format(dateParams.format))\r\n .datepicker('defaultDate', moment().format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.addLineItem()\r\n this.checkDistributions()\r\n this.validateExtras()\r\n\r\n return this\r\n },\r\n\r\n bindMemorizationAutocomplete: function () {\r\n this.autoComplete(\r\n this.model.get('memorizationList'),\r\n 'label',\r\n this.$('input[name=memorizationLabel]'),\r\n this.memorizationSelected.bind(this),\r\n 'CREATENEW'\r\n )\r\n },\r\n\r\n memorizationSelected: function (memorization) {\r\n if (typeof memorization === 'string') {\r\n memorization = _.find(this.model.get('memorizationList'), { id: memorization })\r\n }\r\n\r\n this.$('input[name=memorizationLabel]')\r\n .val(memorization.label)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=memorizationId]')\r\n .val(memorization.id)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n if (memorization.id === 'CREATENEW') {\r\n return\r\n }\r\n\r\n var checkbookAccountId = this.model.get('checkbook').get('account')\r\n var checkbookDetailLine = _.find(memorization.lineItems, { ledgerAccountId: checkbookAccountId })\r\n var lineItems = _.without(memorization.lineItems, checkbookDetailLine)\r\n\r\n this.$('.is-recurring input').prop('checked', memorization.isRecurring)\r\n this.$('.recurring-start-date .date')\r\n .datepicker('setDate', moment(memorization.recurringDate)._d)\r\n .closest('.floating')\r\n .addClass('open')\r\n this.$('select[name=recurringFrequency]').val(memorization.recurringFrequency)\r\n if (memorization.checkbook) {\r\n this.$('select[name=recurring-checkbook], input[name=recurring-checkbook]').val(memorization.checkbook.checkbookId)\r\n }\r\n\r\n if (memorization.vendor) {\r\n var vendor = _.find(this.model.get('vendorList'), { id: memorization.vendor.vendorId })\r\n if (vendor) {\r\n this.vendorSelected(vendor)\r\n }\r\n }\r\n\r\n this.$('textarea[name=Notes]')\r\n .val(memorization.notes)\r\n .closest('.floating')\r\n .addClass('open')\r\n this.$('input[name=Description]')\r\n .val(memorization.description)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n if (memorization.reference && memorization.reference.name) {\r\n this.$('input[name=Reference]')\r\n .val(memorization.reference.name)\r\n .closest('.floating')\r\n .addClass('open')\r\n }\r\n\r\n this.$('.meta input[name=Amount]')\r\n .val(numbro(_.sumBy(lineItems, 'credit')).formatCurrency('$0,0.00'))\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // Clear out any existing lines\r\n this.$('.line-item-container').html('')\r\n _.each(lineItems, function (lineItem) {\r\n var account = _.find(this.model.get('accounts'), { 'id': lineItem.ledgerAccountId })\r\n\r\n if (!account) {\r\n console.error(\"Couldn't find account with id\", lineItem.ledgerAccountId, 'is this an invalid link to a checkbook account?')\r\n return\r\n }\r\n\r\n var $lineItem = this.addLineItem()\r\n\r\n $lineItem.find('input[name=AccountNumber]')\r\n .val(account.get('accountNumber'))\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n $lineItem.find('input[name=Description]')\r\n .val(account.get('accountName'))\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n $lineItem.find('input[name=Amount]')\r\n .val(numbro(lineItem.debit || lineItem.credit).formatCurrency('$0,0.00'))\r\n .closest('.floating')\r\n .addClass('open')\r\n }.bind(this))\r\n\r\n this.validateExtras()\r\n\r\n return memorization\r\n },\r\n\r\n reset: function () {\r\n this.render()\r\n },\r\n\r\n create: function (event) {\r\n event.preventDefault()\r\n\r\n if (Math.abs(this.calculateDiscrepancy()).toFixed(2) >= 0.01 || !this.validateExtras()) {\r\n return\r\n }\r\n this.$('.save-deposit').prop('disabled', true)\r\n this.trigger('create', this.getDeposit())\r\n },\r\n \r\n btnEnable: function () {\r\n $('.save-deposit').prop('disabled', false)\r\n },\r\n\r\n memorize: function () {\r\n if (Math.abs(this.calculateDiscrepancy()).toFixed(2) >= 0.01) {\r\n return\r\n }\r\n\r\n var deposit = this.getDeposit()\r\n\r\n deposit.set('lineItems', _.filter(deposit.get('lineItems'), function (distribution) {\r\n return distribution.get('account') !== this.model.get('checkbook').get('account')\r\n }.bind(this)))\r\n\r\n if (deposit.get('memorizationId')) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'You will be overwriting any previously memorized information.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize', deposit)\r\n }.bind(this))\r\n } else {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize', deposit)\r\n }\r\n },\r\n\r\n validateExtras: function () {\r\n return this.validateExtrasAs('DEPOSIT')\r\n },\r\n\r\n changeDepositType: function (e) {\r\n var depositType = Number(this.$(e.currentTarget).val())\r\n if (depositType === 1) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'You will be navigated away to the receivables deposits area and will lose any unsaved data here.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Stay here'\r\n }).then(function () {\r\n Backbone.trigger('app:navigate', 'receivables/deposits')\r\n }, function () {\r\n this.$('select[name=depositType]').val(0)\r\n }.bind(this))\r\n }\r\n },\r\n\r\n setMemorizationId: function (memorizationId) {\r\n this.$('input[name=memorizationId]').val(memorizationId)\r\n },\r\n\r\n showSuccessMessage: function () {\r\n return this.showSuccessMessageAs('DEPOSIT')\r\n },\r\n \r\n memBtnEnable: function () {\r\n this.$('.memorize-button').prop('disabled', false)\r\n }\r\n})\r\n\r\nmodule.exports = CreateDepositView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar CreateDepositView = require('checkbook/deposit/create-deposit-view')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar MemorizationService = require('memorization/journal-entries/service')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar CreateDepositWidget = function (checkbook) {\r\n this.model = new Backbone.Model({\r\n checkbook: checkbook,\r\n accounts: []\r\n })\r\n this.view = new CreateDepositView({\r\n model: this.model\r\n })\r\n this.accountService = new AccountService()\r\n this.checkbookService = new CheckbookService()\r\n this.memorizationService = new MemorizationService()\r\n this.view.on('create', this.createDeposit, this)\r\n this.view.on('memorize', this.memorizeDeposit, this)\r\n}\r\n\r\nCreateDepositWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCreateDepositWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.accountService.fetchAccounts(false).then(function (accounts) {\r\n this.model.set('accounts', accounts)\r\n }.bind(this)).then(this.loadMemorizations.bind(this))\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nCreateDepositWidget.prototype.loadMemorizations = function () {\r\n return this.memorizationService.getList('Deposit').then(function (memorizations) {\r\n this.model.set('memorizationList', memorizations)\r\n this.view.trigger('bindAutocomplete')\r\n }.bind(this))\r\n}\r\n\r\nCreateDepositWidget.prototype.createDeposit = function (deposit) {\r\n if (this.creating) {\r\n return\r\n }\r\n\r\n this.creating = true\r\n this.checkbookService.createDeposit(this.model.get('checkbook').get('id'), deposit).then(function () {\r\n this.view.reset()\r\n this.creating = false\r\n this.trigger('depositCreated')\r\n this.loadMemorizations()\r\n }.bind(this), function () {\r\n this.creating = false\r\n this.view.btnEnable()\r\n }.bind(this))\r\n}\r\n\r\nCreateDepositWidget.prototype.memorizeDeposit = function (deposit) {\r\n var deferral\r\n\r\n if (!deposit.get('label')) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Please enter in a memorization label for this transaction',\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n this.view.memBtnEnable()\r\n return\r\n }\r\n\r\n if (deposit.get('memorizationId')) {\r\n deferral = this.memorizationService.update(deposit.get('memorizationId'), deposit).then(function () {\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your Deposit has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationUpdated')\r\n }.bind(this))\r\n } else {\r\n deferral = this.memorizationService.create(deposit).then(function (response) {\r\n this.view.trigger('setMemorizationId', response.message)\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your Deposit has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationCreated')\r\n }.bind(this))\r\n }\r\n\r\n deferral.fail(function (err) {\r\n this.view.showError(err.message)\r\n }.bind(this))\r\n\r\n this.view.memBtnEnable()\r\n deferral.then(this.loadMemorizations.bind(this))\r\n}\r\n\r\nmodule.exports = CreateDepositWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurringFrequency\\\" size=\\\"1\\\">\\r\\n <option value=\\\"1\\\">Weekly</option>\\r\\n <option value=\\\"2\\\">Bi-Weekly</option>\\r\\n <option value=\\\"3\\\">Monthly</option>\\r\\n <option value=\\\"4\\\">Bi-Monthly</option>\\r\\n <option value=\\\"5\\\">Quarterly</option>\\r\\n <option value=\\\"6\\\">Semi-Annual</option>\\r\\n <option value=\\\"7\\\">Annual</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Frequency</label>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, buffer = \n \" <div class=\\\"form-group recurring-checkbook-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurring-checkbook\\\" size=\\\"1\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Checkbook</label>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \" <input type=\\\"hidden\\\" name=\\\"recurring-checkbook\\\" />\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, buffer = \n \"<div class=\\\"deposit-meta meta\\\">\\r\\n <div class=\\\"col-xs-6 no-padding\\\" data-not-autocomplete-boundary>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Memorized Label\",\"inputName\":\"memorizationLabel\",\"inputId\":\"memorized-label\",\"wrapperClasses\":\"memorized-label col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group deposit-type-selection col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control deposit-type\\\" id=\\\"deposit-type\\\" name=\\\"depositType\\\" size=\\\"1\\\">\\r\\n <option value=\\\"0\\\">General</option>\\r\\n <option value=\\\"1\\\">AR Deposit</option>\\r\\n </select>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Description\",\"inputName\":\"Description\",\"inputId\":\"deposit-description\",\"wrapperClasses\":\"description col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"memorizationId\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizedEntryDate\\\" />\\r\\n </div>\\r\\n <div class=\\\"col-xs-6 no-padding new-deposit-data\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Date\",\"inputName\":\"PostedDate\",\"inputId\":\"deposit-date\",\"wrapperClasses\":\"deposit-date col-xs-6\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Reference #\",\"inputName\":\"Reference\",\"inputId\":\"deposit-reference\",\"wrapperClasses\":\"reference col-xs-6\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"currency currency-field\",\"inputLabel\":\"Amount\",\"inputName\":\"Amount\",\"inputId\":\"deposit-amount\",\"wrapperClasses\":\"amount col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"deposit-notes-\\\" name=\\\"Notes\\\" rows=\\\"4\\\"></textarea>\\r\\n <label for=\\\"deposit-notes-\\\">Notes</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group is-recurring col-xs-12\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Recurring</span> <input type=\\\"checkbox\\\" name=\\\"IsRecurring\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"col-xs-12 distribution\\\">\\r\\n <h3>Deposit Distribution</h3>\\r\\n <div class=\\\"line-item-container\\\">\\r\\n </div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\">+ Additional Deposit Distribution</button>\\r\\n <br />\\r\\n <div class=\\\"col-xs-12 recurring-meta-container no-padding\\\">\\r\\n <h3>Recurrence</h3>\\r\\n <div class=\\\"flex col-xs-12\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Start Date\",\"wrapperClasses\":\"recurring-start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group recurring-frequency-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(alias1,options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(7, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary memorize-button\\\">Memorize</button>\\r\\n <button class=\\\"btn btn-primary pull-right save-deposit save-button\\\">Post Deposit</button>\\r\\n <button class=\\\"btn btn-primary pull-right save-deposit update-button\\\">Update Deposit</button>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"col-xs-12 check-status status\\\"></div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Distribution = require('checkbook/distribution')\r\nvar moment = require('moment')\r\nvar _ = require('lodash')\r\n\r\nvar Deposit = Backbone.Model.extend({\r\n defaults: {\r\n amountType: 'debit'\r\n },\r\n toJSON: function () {\r\n return {\r\n label: this.get('label'),\r\n memorizedEntryDate: this.get('memorizedEntryDate'),\r\n memorizationId: this.get('memorizationId'),\r\n memorizedEntryId: this.get('memorizationId'),\r\n readableJournalType: 'Deposit',\r\n journalType: 'DEPOSIT',\r\n description: this.get('description'),\r\n postedDate: this.get('date'),\r\n reference: { name: this.get('referenceNumber') },\r\n notes: this.get('notes'),\r\n amount: this.get('amount') || this.getAmount(),\r\n shortDate: this.get('shortDate'),\r\n lineItems: _.map(this.get('lineItems'), function (detail) {\r\n if (detail.toJSON) return detail.toJSON()\r\n else return detail\r\n }),\r\n isRecurring: this.get('isRecurring'),\r\n recurringDate: this.get('recurringDate'),\r\n recurringFrequency: this.get('recurringFrequency'),\r\n checkbook: { checkbookId: this.get('checkbookId') }\r\n }\r\n },\r\n\r\n getAmount: function () {\r\n var checkbookLineItem = _.find(this.get('lineItems'), function (detail) {\r\n return detail.get(this.get('amountType')) !== undefined && detail.get(this.get('amountType')) !== null\r\n }.bind(this))\r\n\r\n return checkbookLineItem ? checkbookLineItem.get('amount') : null\r\n }\r\n}, {\r\n parse: function (json) {\r\n return new Deposit({\r\n readableJournalType: 'Deposit',\r\n id: json.id,\r\n memorizedEntryDate: json.memorizedEntryDate,\r\n checkbookId: (json.checkbook || {checkbookId: ''}).checkbookId,\r\n journalType: 'Deposit',\r\n description: json.description,\r\n date: moment(json.postedDate),\r\n notes: json.notes,\r\n voidJournal: json.voidJournal,\r\n lineItems: _.map(json.lineItems, Distribution.parse),\r\n referenceNumber: json.reference ? json.reference.name : null,\r\n label: json.label,\r\n memorizationId: json.memorizationId\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = Deposit\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar CheckDetailsTemplate = require('checkbook/details/check-details')\r\n\r\nvar CheckDetailsView = Backbone.View.extend({\r\n className: 'z-2 has-animation check-details',\r\n\r\n initialize: function () {},\r\n\r\n events: {\r\n\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CheckDetailsTemplate(this.model.toJSON()))\r\n\r\n if (this.isReopen) {\r\n this.$el.removeClass('fadeInDown')\r\n } else {\r\n this.$el.addClass('fadeInDown')\r\n }\r\n\r\n return this\r\n },\r\n\r\n setModel: function (model) {\r\n this.isReopen = this.model && this.model.id === model.id\r\n\r\n this.model = model\r\n\r\n $('.overlay').one('click', function () {\r\n this.model = null\r\n }.bind(this))\r\n }\r\n})\r\n\r\nmodule.exports = CheckDetailsView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar CheckDetailsView = require('checkbook/details/check-details-view')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar VendorsService = require('lists/vendors/service')\r\n\r\nvar CheckDetailsWidget = function (checkbook) {\r\n this.model = new Backbone.Model({\r\n checkbook: checkbook,\r\n accounts: []\r\n })\r\n this.view = new CheckDetailsView({\r\n model: this.model\r\n })\r\n this.accountService = new AccountService()\r\n this.checkbookService = new CheckbookService()\r\n this.vendorsService = new VendorsService()\r\n\r\n Q.all([this.accountService.fetchAccounts(true), this.vendorsService.getList()])\r\n .spread(function (accounts, vendors) {\r\n var vendorList = _.map(vendors, function (vendor) {\r\n vendor['fullName'] = vendor.firstName + ' ' + vendor.lastName\r\n return vendor\r\n })\r\n this.model.set({\r\n accounts: accounts,\r\n vendorList: vendorList,\r\n vendorLookup: _.keyBy(vendorList, 'id')\r\n })\r\n }.bind(this))\r\n}\r\n\r\nCheckDetailsWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCheckDetailsWidget.prototype.show = function (model, itemRow) {\r\n if (!this.model.get('accounts').length) {\r\n throw new Error('No accounts loaded, can not proceed.')\r\n }\r\n\r\n model.set('shortDate', model.get('date').format('MM/DD/YYYY'))\r\n\r\n model.set('accounts', this.model.get('accounts'))\r\n\r\n var currentCheckbook = _.find(this.model.get('checkbook').get('checkbooks'), {'id': this.model.get('checkbook').get('checkbookId')})\r\n\r\n var lineItems = model.get('lineItems')\r\n var parentLineItems = _.filter(lineItems, _.matches({'attributes': {'account': currentCheckbook.get('account')}}))\r\n lineItems = _.xor(lineItems, parentLineItems)\r\n\r\n model.set('amount', _.reduce(parentLineItems, function (memo, item) {\r\n return memo + item.get('amount')\r\n }, 0))\r\n\r\n model.set('lineItems', lineItems)\r\n\r\n _.each(lineItems, function (lineItem) {\r\n var account = _.find(\r\n this.model.get('accounts'),\r\n _.matchesProperty(\r\n 'attributes.id',\r\n lineItem.get('account')\r\n )\r\n )\r\n\r\n lineItem.set({\r\n accountNumber: account.get('accountNumber'),\r\n accountDescription: account.get('accountName')\r\n })\r\n }.bind(this))\r\n\r\n if (model.get('vendor') && model.get('vendor').vendorId) {\r\n model.set('vendor', this.model.get('vendorLookup')[model.get('vendor').vendorId])\r\n }\r\n\r\n this.view.setModel(model)\r\n\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nmodule.exports = CheckDetailsWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {}, alias2=container.lambda, alias3=container.escapeExpression;\n\n return \" <div class=\\\"flex\\\">\\r\\n <div class=\\\"vendorId col-xs-12 no-padding\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.vendor : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"is-hand-written\\\">\\r\\n <span>Handwritten</span>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.check : depth0)) != null ? stack1.handwritten : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.program(6, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <div class=\\\"printedName no-padding\\\">\\r\\n <b>Printed Name</b>\\r\\n <p>\"\n + alias3(alias2(((stack1 = (depth0 != null ? depth0.check : depth0)) != null ? stack1.printedName : stack1), depth0))\n + \"</p>\\r\\n </div>\\r\\n <div class=\\\"address\\\">\\r\\n <b>Address</b>\\r\\n <p>\"\n + alias3(alias2(((stack1 = ((stack1 = (depth0 != null ? depth0.check : depth0)) != null ? stack1.address : stack1)) != null ? stack1.addressLine1 : stack1), depth0))\n + \"</p>\\r\\n <p>\"\n + alias3(alias2(((stack1 = ((stack1 = (depth0 != null ? depth0.check : depth0)) != null ? stack1.address : stack1)) != null ? stack1.addressLine2 : stack1), depth0))\n + \"</p>\\r\\n <p>\"\n + alias3(alias2(((stack1 = ((stack1 = (depth0 != null ? depth0.check : depth0)) != null ? stack1.address : stack1)) != null ? stack1.city : stack1), depth0))\n + \", \"\n + alias3(alias2(((stack1 = ((stack1 = (depth0 != null ? depth0.check : depth0)) != null ? stack1.address : stack1)) != null ? stack1.state : stack1), depth0))\n + \" \"\n + alias3(alias2(((stack1 = ((stack1 = (depth0 != null ? depth0.check : depth0)) != null ? stack1.address : stack1)) != null ? stack1.postalCode : stack1), depth0))\n + \"</p>\\r\\n </div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <b>Vendor ID</b>\\r\\n <p>\"\n + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.vendor : depth0)) != null ? stack1.vendorId : stack1), depth0))\n + \"</p>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \" <i class=\\\"fa fa-check\\\"></i>\\r\\n\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n return \" <i class=\\\"fa fa-times\\\"></i>\\r\\n\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.reference : depth0)) != null ? stack1.name : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(9, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"9\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div>\\r\\n <b>Reference</b>\\r\\n <p>\"\n + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.reference : depth0)) != null ? stack1.name : stack1), depth0))\n + \"</p>\\r\\n </div>\\r\\n\";\n},\"11\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.description : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(12, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"12\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <div>\\r\\n <b>Description</b>\\r\\n <p>\"\n + container.escapeExpression(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\r\\n </div>\\r\\n\";\n},\"14\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <div>\\r\\n <b>Date</b>\\r\\n <p>\"\n + container.escapeExpression(((helper = (helper = helpers.shortDate || (depth0 != null ? depth0.shortDate : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"shortDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n\";\n},\"16\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div>\\r\\n <b>Check Number</b>\\r\\n <p>\"\n + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.check : depth0)) != null ? stack1.checkNumber : stack1), depth0))\n + \"</p>\\r\\n </div>\\r\\n\";\n},\"18\":function(container,depth0,helpers,partials,data) {\n return \" <div>\\r\\n <b>Amount</b>\\r\\n <p>\"\n + container.escapeExpression((helpers.numbro || (depth0 && depth0.numbro) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.amount : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</p>\\r\\n </div>\\r\\n\";\n},\"20\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div>\\r\\n <b>Memo</b>\\r\\n <p>\"\n + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.check : depth0)) != null ? stack1.memo : stack1), depth0))\n + \"\\r\\n </div>\\r\\n\";\n},\"22\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <div>\\r\\n <b>Notes</b>\\r\\n <p>\"\n + container.escapeExpression(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"notes\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\r\\n </div>\\r\\n\";\n},\"24\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div class=\\\"is-1099 col-xs-12 no-padding\\\">\\r\\n <span>1099</span>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.is1099 : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(25, data, 0),\"inverse\":container.program(27, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\";\n},\"25\":function(container,depth0,helpers,partials,data) {\n return \" <i class=\\\"fa fa-check\\\"></i>\\r\\n\";\n},\"27\":function(container,depth0,helpers,partials,data) {\n return \" <i class=\\\"fa fa-times\\\"></i>\\r\\n\";\n},\"29\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"distribution col-xs-12 no-padding\\\">\\r\\n <div class=\\\"col-xs-2\\\">\"\n + alias4(((helper = (helper = helpers.accountNumber || (depth0 != null ? depth0.accountNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-8\\\">\"\n + alias4(((helper = (helper = helpers.accountDescription || (depth0 != null ? depth0.accountDescription : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountDescription\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 currency\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.amount : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block\\\">\\r\\n<div class=\\\"check-meta block-content\\\">\\r\\n <div class=\\\"col-xs-6\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.check : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.reference : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.check : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(11, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"col-xs-6\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.shortDate : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(14, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.check : depth0)) != null ? stack1.checkNumber : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(16, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.amount : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(18, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.check : depth0)) != null ? stack1.memo : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(20, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.notes : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(22, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.has1099 : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(24, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n</div>\\r\\n<div class=\\\"col-xs-12 distribution\\\">\\r\\n <h3>Payment Distribution</h3>\\r\\n <div class=\\\"line-item-container col-xs-12 no-padding\\\">\\r\\n <div>\\r\\n <div class=\\\"col-xs-2\\\"><b>Account #</b></div>\\r\\n <div class=\\\"col-xs-8\\\"><b>Details</b></div>\\r\\n <div class=\\\"col-xs-2 currency\\\"><b>Amount</b></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.lineItems : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(29, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n</div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"new-journal-entry-item flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"AccountNumber\",\"inputId\":\"id\",\"wrapperClasses\":\"col-xs-3 no-padding autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Description\",\"inputName\":\"Description\",\"inputId\":\"description\",\"wrapperClasses\":\"col-xs-7 autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"currency-field\",\"inputLabel\":\"Amount\",\"inputName\":\"Amount\",\"inputId\":\"amount\",\"wrapperClasses\":\"col-xs-2 autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <i class=\\\"fa fa-close remove\\\"></i>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","\"use strict\";\r\n\r\nvar Backbone = require(\"backbone\");\r\n\r\nvar Distribution = Backbone.Model.extend({\r\n initialize: function(){\r\n this.on(\"change:debit change:credit\", this.RecalcAmount, this);\r\n },\r\n RecalcAmount: function(){\r\n this.set(\"amount\", this.get(\"debit\") - this.get(\"credit\"));\r\n },\r\n toJSON: function() {\r\n return {\r\n ledgerAccountId: this.get(\"account\"),\r\n credit: numbro().unformat(this.get(\"credit\") || (this.get(\"type\") == \"credit\" ? this.get(\"amount\") : 0)),\r\n debit: numbro().unformat(this.get(\"debit\") || (this.get(\"type\") == \"debit\" ? this.get(\"amount\") : 0)),\r\n accountNumber: this.get(\"accountNumber\"),\r\n accountDescription: this.get(\"accountDescription\"),\r\n amount: numbro().unformat(this.get(\"amount\")) || (this.get(\"debit\") - this.get(\"credit\")),\r\n id: this.get('id')\r\n };\r\n }\r\n}, {\r\n parse: function(json){\r\n return new Distribution({\r\n account: json.ledgerAccountId,\r\n credit: json.credit,\r\n debit: json.debit,\r\n amount: json.credit || json.debit,\r\n id: json.id\r\n });\r\n }\r\n});\r\n\r\nmodule.exports = Distribution;","'use strict'\r\n\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar numbro = require('numbro')\r\nvar EditCheckTemplate = require('checkbook/edit-check/edit-check')\r\nvar CreateEntryBaseView = require('checkbook/create-entry-view')\r\n\r\nvar CreateCheckTemplate = require('checkbook/check/create-check')\r\nvar CreateDepositTemplate = require('checkbook/deposit/create-deposit')\r\nvar CreateEFTPaymentTemplate = require('checkbook/eft-payment/create-eft-payment')\r\nvar CreateEFTDepositTemplate = require('checkbook/eft-deposit/create-eft-deposit')\r\nvar CreateAPPaymentTemplate = require('checkbook/appayment/create-appayment')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar Mapping = {\r\n CHECK: CreateCheckTemplate,\r\n EFTDEPOSIT: CreateEFTDepositTemplate,\r\n EFTPAYMENT: CreateEFTPaymentTemplate,\r\n DEPOSIT: CreateDepositTemplate,\r\n APPAYMENT: CreateAPPaymentTemplate\r\n}\r\n\r\nvar EditCheckView = CreateEntryBaseView.extend({\r\n initialize: function (dataContainer) {\r\n this.data = dataContainer.data\r\n this.title = dataContainer.title\r\n this.listenTo(this.data, 'change:accounts', this.render)\r\n this.on('bindAutocomplete', function () {\r\n this.render()\r\n this.bindVendorAutocomplete()\r\n }.bind(this))\r\n },\r\n\r\n className: 'z-2 fadeInDown has-animation edit-check',\r\n\r\n events: {\r\n 'click .add-more-line-items': 'addLineItem',\r\n \"keyup [type='currency']\": 'checkDistributions',\r\n 'click .update-button': 'update',\r\n \"change [name='Handwritten']\": 'toggleNumber',\r\n 'change input': 'validateExtras',\r\n 'keyup input': 'validateExtras',\r\n 'click .cancel': 'closeForm',\r\n 'click .memorize-button': 'memorize'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(EditCheckTemplate({\r\n title: this.model ? ('Edit ' + this.model.get('readableJournalType')) : this.title\r\n }))\r\n\r\n if (this.model) {\r\n this.$('.block').append(Mapping[this.model.get('journalType').toUpperCase()]({ id: this.model.get('id') }))\r\n\r\n this.getDisabledFields().attr('disabled', 'disabled').attr('readonly', 'readonly')\r\n\r\n this.$('.date input:disabled').closest('.date').addClass('readonly').attr('readonly', 'readonly')\r\n this.$('.date input').closest('.date').addClass('readonly')\r\n .datepicker(_.merge(dateParams.options, { enableOnReadonly: false }))\r\n .datepicker('setDate', this.model.get('date')._d)\r\n\r\n var checkbookAccountId = this.data.get('checkbook').get('account')\r\n var checkbookDetailLine = _.find(this.model.get('lineItems'), { 'attributes': { 'account': checkbookAccountId } })\r\n var lineItems = _.without(this.model.get('lineItems'), checkbookDetailLine)\r\n\r\n _.each(lineItems, function (lineItem, index) {\r\n var $lineItem = this.addLineItem()\r\n\r\n var account = _.find(this.data.get('allAccounts'), { 'id': lineItem.get('account') })\r\n\r\n if (!account) {\r\n console.error(\"Couldn't find account with id\", lineItem.get('account'), 'is this an invalid link to a checkbook account?')\r\n }\r\n\r\n $lineItem.find('input[name=AccountNumber]').val(account.get('accountNumber'))\r\n $lineItem.find('input[name=Description]').val(account.get('accountName'))\r\n $lineItem.find('input[name=Amount]').val(numbro(lineItem.get('amount')).formatCurrency('$0,0.00'))\r\n }.bind(this))\r\n\r\n this.$('.meta input[name=Amount]').val(numbro(checkbookDetailLine.get('amount')).formatCurrency('$0,0.00'))\r\n this.$('.meta input[name=Notes], textarea[name=Notes]').val(this.model.get('notes'))\r\n this.$('.meta input[name=Description], textarea[name=Description]').val(this.model.get('description'))\r\n this.$('.meta input[name=Reference]').val(this.model.get('referenceNumber'))\r\n this.$(\".meta [name='Is1099']\").prop('checked', this.model.get('is1099'))\r\n\r\n if (this.model.get('vendor')) {\r\n var vendor = this.model.get('vendor')\r\n this.$('input[name=vendorId]')\r\n .val(vendor.vendorId)\r\n .closest('.floating')\r\n .addClass('open')\r\n }\r\n\r\n if (this.model.get('check')) {\r\n this.$('.meta [name=printedName]').val(this.model.get('check').printedName)\r\n this.$(\".meta [name='Handwritten']\").prop('checked', this.model.get('check').handwritten)\r\n this.$('.meta [name=CheckNumber]').val(this.model.get('check').checkNumber)\r\n this.$('.meta [name=Description]').val(this.model.get('check').memo)\r\n\r\n if (this.model.get('check').address != null) {\r\n this.$('.meta [name=AddressLine1]').val(this.model.get('check').address.addressLine1)\r\n this.$('.meta [name=AddressLine2]').val(this.model.get('check').address.addressLine2)\r\n this.$('.meta [name=City]').val(this.model.get('check').address.city)\r\n this.$('.meta [name=state]').val(this.model.get('check').address.state)\r\n this.$('.meta [name=postalCode]').val(this.model.get('check').address.postalCode)\r\n }\r\n }\r\n }\r\n\r\n this.$('.journal-balance-discrepency').hide()\r\n this.$('.journal-balance-balanced').show()\r\n\r\n this.checkDistributions()\r\n this.toggleNumber()\r\n this.bindVendorAutocomplete()\r\n\r\n return this\r\n },\r\n\r\n bindVendorAutocomplete: function () {\r\n this.autoComplete(\r\n _.filter(this.data.get('vendorList'), 'vendorId'),\r\n 'vendorId',\r\n this.$('input[name=vendorId]'),\r\n this.vendorSelected.bind(this)\r\n )\r\n },\r\n\r\n vendorSelected: function (vendor) {\r\n this.$('input[name=vendorId]')\r\n .val(vendor.vendorId)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=Description]')\r\n .val(vendor.printedName)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=printedName]')\r\n .val(vendor.printedName)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=AddressLine1]')\r\n .val(vendor.addressLine1)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=AddressLine2]')\r\n .val(vendor.addressLine2)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=City]')\r\n .val(vendor.city)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('select[name=state]')\r\n .val(vendor.state)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=postalCode]')\r\n .val(vendor.postalCode)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=idVendor]')\r\n .val(vendor.id)\r\n\r\n // Clear out any existing lines\r\n this.$('.line-item-container').html('')\r\n _.each(vendor.expenseDistributions, function (lineItem, index) {\r\n var $lineItem = this.addLineItem()\r\n\r\n var account = _.find(this.model.get('accounts'), { 'id': lineItem.ledgerAccountId })\r\n\r\n if (!account) {\r\n console.error(\"Couldn't find account with id\", lineItem.get('account'), 'is this an invalid link to a checkbook account?')\r\n }\r\n\r\n $lineItem.find('input[name=AccountNumber]').val(account.get('accountNumber')).closest('.floating').addClass('open')\r\n $lineItem.find('input[name=Description]').val(account.get('accountName')).closest('.floating').addClass('open')\r\n }.bind(this))\r\n },\r\n\r\n getDisabledFields: function () {\r\n switch (this.model.get('journalType').toUpperCase()) {\r\n case 'CHECK':\r\n this.$('input[name=Handwritten]').closest('label').addClass('disabled')\r\n if (!this.model.get('check').handwritten || this.model.get('voidJournal')) {\r\n return this.$(\".meta *:input:not([name='Is1099']):not([name=PostedDate])\")\r\n }\r\n return this.$('input[name=Handwritten]')\r\n case 'DEPOSIT':\r\n case 'EFTDEPOSIT':\r\n case 'EFTPAYMENT':\r\n if (this.model.get('status') === 3) {\r\n return this.$('.meta *:input:not([name=printedName]):not([name=Description]):not([name=Notes]):not([name=Reference]):not([name=PostedDate])')\r\n }\r\n return $([])\r\n case 'APPAYMENT':\r\n this.$('input[name=Handwritten]').closest('label').addClass('disabled')\r\n if (!this.model.get('check').handwritten || this.model.get('voidJournal')) {\r\n return this.$(\".meta *:input:not([name='Is1099']):not([name=PostedDate])\")\r\n }\r\n return this.$('input[name=Handwritten]')\r\n default:\r\n return $([])\r\n }\r\n },\r\n\r\n setModel: function (model) {\r\n this.model = model\r\n this.amountType = model.get('amountType')\r\n this.model.set('checkbook', this.data.get('checkbook'))\r\n if (model.get('vendor') && model.get('vendor').vendorId) {\r\n model.set('vendor', this.data.get('vendorLookup')[model.get('vendor').vendorId])\r\n }\r\n },\r\n\r\n setPendingLineItem: function (pendingLineItemView) {\r\n this.$el.css({\r\n 'top': pendingLineItemView.position().top + pendingLineItemView.height()\r\n })\r\n this.parent = pendingLineItemView\r\n },\r\n\r\n reset: function () {\r\n this.render()\r\n },\r\n\r\n toggleNumber: function () {\r\n var handwritten = this.$(\"[name='Handwritten']\").is(':checked')\r\n this.$('.check-number').toggle(handwritten)\r\n this.$('.check-date').toggleClass('col-xs-12', !handwritten).toggleClass('col-xs-6', handwritten)\r\n },\r\n\r\n update: function (event) {\r\n event.preventDefault()\r\n\r\n if (!this.validateExtrasAs(this.model.get('journalType'))) {\r\n return\r\n }\r\n\r\n if (Math.abs(this.calculateDiscrepancy()).toFixed(2) >= 0.01) {\r\n return\r\n }\r\n this.$('.update-button').prop('disabled', true)\r\n this.trigger('update', this.model.id, this.getAs(this.model.get('journalType')))\r\n },\r\n\r\n btnEnable: function () {\r\n $('.update-button').prop('disabled', false)\r\n },\r\n\r\n validateExtras: function () {\r\n this.validateExtrasAs(this.model.get('journalType'))\r\n },\r\n\r\n closeForm: function (event) {\r\n this.trigger('closeForm')\r\n },\r\n\r\n showSuccessMessage: function () {\r\n if (this.model) {\r\n return this.showSuccessMessageAs(this.model.get('journalType'))\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = EditCheckView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar EditCheckView = require('checkbook/edit-check/edit-check-view')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar VendorsService = require('lists/vendors/service')\r\n\r\nvar EditCheckWidget = function (checkbook, adminMode) {\r\n this.model = new Backbone.Model({\r\n checkbook: checkbook,\r\n accounts: []\r\n })\r\n this.view = new EditCheckView({\r\n data: this.model,\r\n title: 'Edit Check'\r\n })\r\n\r\n this.accountService = new AccountService()\r\n this.checkbookService = new CheckbookService()\r\n this.vendorsService = new VendorsService()\r\n\r\n this.view.on('update', this.updateCheck, this)\r\n this.view.on('memorize', this.memorizeDeposit, this)\r\n this.view.on('closeForm', function () {\r\n this.trigger('close')\r\n }, this)\r\n this.view.on('lineItemAdded', function ($lineItem) {\r\n this.trigger('lineItemAdded', $lineItem)\r\n }, this)\r\n\r\n Q.all([this.accountService.fetchAccounts(false), this.accountService.fetchAccounts(true), this.vendorsService.getList()])\r\n .spread(function (noCheckbooks, checkbooks, vendors) {\r\n var vendorList = _.map(vendors, function (vendor) {\r\n vendor['fullName'] = vendor.firstName + ' ' + vendor.lastName\r\n return vendor\r\n })\r\n this.model.set({\r\n accounts: noCheckbooks,\r\n allAccounts: checkbooks,\r\n vendorList: vendorList,\r\n vendorLookup: _.keyBy(vendorList, 'id')\r\n })\r\n }.bind(this))\r\n this.view.on('memorize', this.memorizeDeposit, this)\r\n}\r\n\r\nEditCheckWidget.prototype = _.clone(Backbone.Events)\r\n\r\nEditCheckWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nEditCheckWidget.prototype.updateCheck = function (checkId, check) {\r\n this.checkbookService.updateCheck(this.model.get('checkbook').id, checkId, check, this.model.get('checkbook').get('adminMode')).then(function () {\r\n this.view.reset()\r\n this.trigger('close')\r\n this.trigger('updated')\r\n }.bind(this), function () {\r\n this.view.btnEnable()\r\n }.bind(this))\r\n}\r\n\r\nEditCheckWidget.prototype.startEditing = function (pendingCheckModel, pendingCheckRow) {\r\n this.focusedLineItem = pendingCheckRow\r\n this.view.setPendingLineItem(pendingCheckRow)\r\n\r\n console.log(pendingCheckModel)\r\n\r\n return this.checkbookService.fetchCheck(this.model.get('checkbook').id, pendingCheckModel.id).then(function (checkModel) {\r\n checkModel.set('accounts', this.model.get('accounts'))\r\n this.view.setModel(checkModel)\r\n this.view.trigger('bindMemorization')\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = EditCheckWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"<div class=\\\"block\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right expanding-group-close cancel\\\"></i>\\r\\n <h3>\"\n + container.escapeExpression(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"title\",\"hash\":{},\"data\":data}) : helper)))\n + \"</h3>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar CreateEftDepositTemplate = require('checkbook/eft-deposit/create-eft-deposit')\r\nvar CreateEntryBaseView = require('checkbook/create-entry-view')\r\nvar numbro = require('numbro')\r\nvar _ = require('lodash')\r\nvar sweetAlert = require('sweetalert2')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar CreateEftDepositView = CreateEntryBaseView.extend({\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:accounts', this.render)\r\n this.amountType = 'debit'\r\n\r\n this.on('bindAutocomplete', function () {\r\n this.bindMemorizationAutocomplete()\r\n }.bind(this))\r\n\r\n this.on('setMemorizationId', this.setMemorizationId.bind(this))\r\n\r\n this.listenTo(this.model.get('checkbook'), 'change:checkbooks', this.render.bind(this))\r\n },\r\n\r\n events: {\r\n 'click .add-more-line-items': 'addLineItem',\r\n 'click .save-eft-deposit': 'create',\r\n 'keyup input': 'validateExtras',\r\n 'click .memorize-button': 'memorize'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CreateEftDepositTemplate({\r\n checkbooks: this.model.get('checkbook').get('checkbooks')\r\n }))\r\n\r\n this.$('.date')\r\n .datepicker(dateParams.options)\r\n .datepicker('setDate', moment().format(dateParams.format))\r\n .datepicker('defaultDate', moment().format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.addLineItem()\r\n this.checkDistributions()\r\n this.validateExtras()\r\n\r\n return this\r\n },\r\n\r\n bindMemorizationAutocomplete: function () {\r\n this.autoComplete(\r\n this.model.get('memorizationList'),\r\n 'label',\r\n this.$('input[name=memorizationLabel]'),\r\n this.memorizationSelected.bind(this),\r\n 'CREATENEW'\r\n )\r\n },\r\n\r\n memorizationSelected: function (memorization) {\r\n if (typeof memorization === 'string') {\r\n memorization = _.find(this.model.get('memorizationList'), { id: memorization })\r\n }\r\n\r\n this.$('input[name=memorizationLabel]')\r\n .val(memorization.label)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=memorizationId]')\r\n .val(memorization.id)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n if (memorization.id === 'CREATENEW') {\r\n return\r\n }\r\n\r\n this.$('.is-recurring input').prop('checked', memorization.isRecurring)\r\n this.$('.recurring-start-date .date')\r\n .datepicker('setDate', moment(memorization.recurringDate)._d)\r\n .closest('.floating')\r\n .addClass('open')\r\n this.$('select[name=recurringFrequency]').val(memorization.recurringFrequency)\r\n if (memorization.checkbook) {\r\n this.$('select[name=recurring-checkbook], input[name=recurring-checkbook]').val(memorization.checkbook.checkbookId)\r\n }\r\n\r\n var checkbookAccountId = this.model.get('checkbook').get('account')\r\n var checkbookDetailLine = _.find(memorization.lineItems, { ledgerAccountId: checkbookAccountId })\r\n var lineItems = _.without(memorization.lineItems, checkbookDetailLine)\r\n\r\n if (memorization.vendor) {\r\n var vendor = _.find(this.model.get('vendorList'), { id: memorization.vendor.vendorId })\r\n if (vendor) {\r\n this.vendorSelected(vendor)\r\n }\r\n }\r\n\r\n this.$('textarea[name=Notes]')\r\n .val(memorization.notes)\r\n .closest('.floating')\r\n .addClass('open')\r\n this.$('input[name=Description]')\r\n .val(memorization.description)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n if (memorization.reference && memorization.reference.name) {\r\n this.$('input[name=Reference]')\r\n .val(memorization.reference.name)\r\n .closest('.floating')\r\n .addClass('open')\r\n }\r\n\r\n this.$('.meta input[name=Amount]')\r\n .val(numbro(_.sumBy(lineItems, 'credit')).formatCurrency('$0,0.00'))\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // Clear out any existing lines\r\n this.$('.line-item-container').html('')\r\n _.each(lineItems, function (lineItem) {\r\n var account = _.find(this.model.get('accounts'), { 'id': lineItem.ledgerAccountId })\r\n\r\n if (!account) {\r\n console.error(\"Couldn't find account with id\", lineItem.ledgerAccountId, 'is this an invalid link to a checkbook account?')\r\n return\r\n }\r\n\r\n var $lineItem = this.addLineItem()\r\n\r\n $lineItem.find('input[name=AccountNumber]')\r\n .val(account.get('accountNumber'))\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n $lineItem.find('input[name=Description]')\r\n .val(account.get('accountName'))\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n $lineItem.find('input[name=Amount]')\r\n .val(numbro(lineItem.debit || lineItem.credit).formatCurrency('$0,0.00'))\r\n .closest('.floating')\r\n .addClass('open')\r\n }.bind(this))\r\n\r\n this.validateExtras()\r\n\r\n return memorization\r\n },\r\n\r\n reset: function () {\r\n this.render() // Just rerender - no model state persisted\r\n },\r\n\r\n create: function (event) {\r\n event.preventDefault()\r\n\r\n if (Math.abs(this.calculateDiscrepancy()).toFixed(2) >= 0.01 || !this.validateExtras()) {\r\n return\r\n }\r\n this.$('.save-eft-deposit').prop('disabled', true)\r\n this.trigger('create', this.getEftDeposit())\r\n },\r\n \r\n btnEnable: function () {\r\n $('.save-eft-deposit').prop('disabled', false)\r\n },\r\n\r\n memorize: function () {\r\n if (Math.abs(this.calculateDiscrepancy()).toFixed(2) >= 0.01) {\r\n return\r\n }\r\n\r\n var eftDeposit = this.getEftDeposit()\r\n\r\n eftDeposit.set('lineItems', _.filter(eftDeposit.get('lineItems'), function (distribution) {\r\n return distribution.get('account') !== this.model.get('checkbook').get('account')\r\n }.bind(this)))\r\n\r\n if (eftDeposit.get('memorizationId')) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'You will be overwriting any previously memorized information.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize', eftDeposit)\r\n }.bind(this))\r\n } else {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize', eftDeposit)\r\n }\r\n },\r\n\r\n validateExtras: function () {\r\n return this.validateExtrasAs('EFTDEPOSIT')\r\n },\r\n\r\n setMemorizationId: function (memorizationId) {\r\n this.$('input[name=memorizationId]').val(memorizationId)\r\n },\r\n\r\n showSuccessMessage: function () {\r\n return this.showSuccessMessageAs('EFTDEPOSIT')\r\n },\r\n \r\n memBtnEnable: function () {\r\n this.$('.memorize-button').prop('disabled', false)\r\n }\r\n})\r\n\r\nmodule.exports = CreateEftDepositView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar CreateEftDepositView = require('checkbook/eft-deposit/create-eft-deposit-view')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar MemorizationService = require('memorization/journal-entries/service')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar CreateEftDepositWidget = function (checkbook) {\r\n this.model = new Backbone.Model({\r\n checkbook: checkbook,\r\n accounts: []\r\n })\r\n this.view = new CreateEftDepositView({\r\n model: this.model\r\n })\r\n this.accountService = new AccountService()\r\n this.checkbookService = new CheckbookService()\r\n this.memorizationService = new MemorizationService()\r\n this.view.on('create', this.createDeposit, this)\r\n this.view.on('memorize', this.memorizeDeposit, this)\r\n}\r\n\r\nCreateEftDepositWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCreateEftDepositWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.accountService.fetchAccounts(false).then(function (accounts) {\r\n this.model.set('accounts', accounts)\r\n }.bind(this)).then(this.loadMemorizations.bind(this))\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nCreateEftDepositWidget.prototype.loadMemorizations = function () {\r\n this.memorizationService.getList('EFTDeposit').then(function (memorizations) {\r\n this.model.set('memorizationList', memorizations)\r\n this.view.trigger('bindAutocomplete')\r\n }.bind(this))\r\n}\r\n\r\nCreateEftDepositWidget.prototype.createDeposit = function (eftDeposit) {\r\n if (this.creating) {\r\n return\r\n }\r\n\r\n this.creating = true\r\n this.checkbookService.createEftDeposit(this.model.get('checkbook').get('id'), eftDeposit).then(function () {\r\n this.view.reset()\r\n this.creating = false\r\n this.trigger('eftDepositCreated')\r\n this.loadMemorizations()\r\n }.bind(this), function () {\r\n this.creating = false\r\n this.view.btnEnable()\r\n }.bind(this))\r\n}\r\n\r\nCreateEftDepositWidget.prototype.memorizeDeposit = function (eftDeposit) {\r\n var deferral\r\n\r\n if (!eftDeposit.get('label')) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Please enter in a memorization label for this transaction',\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n this.view.memBtnEnable()\r\n return\r\n }\r\n\r\n if (eftDeposit.get('memorizationId')) {\r\n deferral = this.memorizationService.update(eftDeposit.get('memorizationId'), eftDeposit).then(function () {\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your EFT Deposit has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationUpdated')\r\n }.bind(this))\r\n } else {\r\n deferral = this.memorizationService.create(eftDeposit).then(function (response) {\r\n this.view.trigger('setMemorizationId', response.message)\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your EFT Deposit has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationCreated')\r\n }.bind(this))\r\n }\r\n\r\n deferral.fail(function (err) {\r\n this.view.showError(err.message)\r\n }.bind(this))\r\n\r\n this.view.memBtnEnable()\r\n deferral.then(this.loadMemorizations.bind(this))\r\n}\r\n\r\nmodule.exports = CreateEftDepositWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurringFrequency\\\" size=\\\"1\\\">\\r\\n <option value=\\\"1\\\">Weekly</option>\\r\\n <option value=\\\"2\\\">Bi-Weekly</option>\\r\\n <option value=\\\"3\\\">Monthly</option>\\r\\n <option value=\\\"4\\\">Bi-Monthly</option>\\r\\n <option value=\\\"5\\\">Quarterly</option>\\r\\n <option value=\\\"6\\\">Semi-Annual</option>\\r\\n <option value=\\\"7\\\">Annual</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Frequency</label>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, buffer = \n \" <div class=\\\"form-group recurring-checkbook-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurring-checkbook\\\" size=\\\"1\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Checkbook</label>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \" <input type=\\\"hidden\\\" name=\\\"recurring-checkbook\\\" />\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, buffer = \n \"<div class=\\\"eft-deposit-meta meta\\\">\\r\\n <div class=\\\"col-xs-6 no-padding\\\" data-not-autocomplete-boundary>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Memorized Label\",\"inputName\":\"memorizationLabel\",\"inputId\":\"memorized-label\",\"wrapperClasses\":\"memorized-label col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Description\",\"inputName\":\"Description\",\"inputId\":\"eft-deposit-description\",\"wrapperClasses\":\"description col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"memorizationId\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizedEntryDate\\\" />\\r\\n </div>\\r\\n <div class=\\\"col-xs-6 no-padding new-eft-deposit-data\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Date\",\"inputName\":\"PostedDate\",\"inputId\":\"eft-deposit-date\",\"wrapperClasses\":\"eftdeposit-date col-xs-6\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Reference #\",\"inputName\":\"Reference\",\"inputId\":\"eft-deposit-reference\",\"wrapperClasses\":\"reference col-xs-6\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"currency currency-field\",\"inputLabel\":\"Amount\",\"inputName\":\"Amount\",\"inputId\":\"eft-deposit-amount\",\"wrapperClasses\":\"amount col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"eft-deposit-notes-\\\" name=\\\"Notes\\\" rows=\\\"4\\\"></textarea>\\r\\n <label for=\\\"eft-deposit-notes-\\\">Notes</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group is-recurring col-xs-12\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Recurring</span> <input type=\\\"checkbox\\\" name=\\\"IsRecurring\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"col-xs-12 distribution\\\">\\r\\n <h3>EFT Deposit Distribution</h3>\\r\\n <div class=\\\"line-item-container\\\">\\r\\n </div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\">+ Additional EFT Deposit Distribution</button>\\r\\n <br />\\r\\n <div class=\\\"col-xs-12 recurring-meta-container no-padding\\\">\\r\\n <h3>Recurrence</h3>\\r\\n <div class=\\\"flex col-xs-12\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Start Date\",\"wrapperClasses\":\"recurring-start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group recurring-frequency-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(alias1,options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(7, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary memorize-button\\\">Memorize</button>\\r\\n <button class=\\\"btn btn-primary pull-right save-eft-deposit save-button\\\">Post EFT Deposit</button>\\r\\n <button class=\\\"btn btn-primary pull-right save-eft-deposit update-button\\\">Update EFT Deposit</button>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"col-xs-12 check-status status\\\"></div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Distribution = require('checkbook/distribution')\r\nvar moment = require('moment')\r\nvar _ = require('lodash')\r\n\r\nvar EftDeposit = Backbone.Model.extend({\r\n defaults: {\r\n amountType: 'debit'\r\n },\r\n toJSON: function () {\r\n return {\r\n label: this.get('label'),\r\n memorizedEntryDate: this.get('memorizedEntryDate'),\r\n memorizationId: this.get('memorizationId'),\r\n memorizedEntryId: this.get('memorizationId'),\r\n readableJournalType: 'EFT Deposit',\r\n journalType: 'EFTDEPOSIT',\r\n description: this.get('description'),\r\n postedDate: this.get('date'),\r\n reference: { name: this.get('referenceNumber') },\r\n notes: this.get('notes'),\r\n amount: this.get('amount') || this.getAmount(),\r\n shortDate: this.get('shortDate'),\r\n lineItems: _.map(this.get('lineItems'), function (detail) {\r\n if (detail.toJSON) return detail.toJSON()\r\n else return detail\r\n }),\r\n isRecurring: this.get('isRecurring'),\r\n recurringDate: this.get('recurringDate'),\r\n recurringFrequency: this.get('recurringFrequency'),\r\n checkbook: { checkbookId: this.get('checkbookId') }\r\n }\r\n },\r\n\r\n getAmount: function () {\r\n var checkbookLineItem = _.find(this.get('lineItems'), function (detail) {\r\n return detail.get(this.get('amountType')) !== undefined && detail.get(this.get('amountType')) !== null\r\n }.bind(this))\r\n\r\n return checkbookLineItem ? checkbookLineItem.get('amount') : null\r\n }\r\n}, {\r\n parse: function (json) {\r\n return new EftDeposit({\r\n readableJournalType: 'EFT Deposit',\r\n id: json.id,\r\n memorizedEntryDate: json.memorizedEntryDate,\r\n journalType: 'EFTDeposit',\r\n description: json.description,\r\n date: moment(json.postedDate),\r\n notes: json.notes,\r\n checkbookId: (json.checkbook || {checkbookId: ''}).checkbookId,\r\n voidJournal: json.voidJournal,\r\n lineItems: _.map(json.lineItems, Distribution.parse),\r\n referenceNumber: json.reference.name,\r\n label: json.label,\r\n memorizationId: json.memorizationId\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = EftDeposit\r\n","'use strict'\r\n\r\nvar CreateEftPaymentTemplate = require('checkbook/eft-payment/create-eft-payment')\r\nvar CreateEntryBaseView = require('checkbook/create-entry-view')\r\nvar _ = require('lodash')\r\nvar numbro = require('numbro')\r\nvar sweetAlert = require('sweetalert2')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar CreateEftPaymentView = CreateEntryBaseView.extend({\r\n initialize: function () {\r\n this.amountType = 'credit'\r\n\r\n this.on('bindAutocomplete', function () {\r\n this.bindVendorAutocomplete()\r\n this.bindMemorizationAutocomplete()\r\n }.bind(this))\r\n\r\n this.listenTo(this.model, 'change:accounts', this.render.bind(this))\r\n\r\n this.on('setMemorizationId', this.setMemorizationId.bind(this))\r\n\r\n this.listenTo(this.model.get('checkbook'), 'change:checkbooks', this.render.bind(this))\r\n },\r\n\r\n events: {\r\n 'click .add-more-line-items': 'addLineItem',\r\n 'click .save-eft-payment': 'create',\r\n 'keyup input': 'validateExtras',\r\n 'click .memorize-button': 'memorize'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CreateEftPaymentTemplate({\r\n checkbooks: this.model.get('checkbook').get('checkbooks')\r\n }))\r\n\r\n this.$('.date')\r\n .datepicker(dateParams.options)\r\n .datepicker('setDate', moment().format(dateParams.format))\r\n .datepicker('defaultDate', moment().format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.addLineItem()\r\n this.checkDistributions()\r\n this.validateExtras()\r\n\r\n return this\r\n },\r\n\r\n bindVendorAutocomplete: function () {\r\n this.autoComplete(\r\n _.filter(this.model.get('vendorList'), 'vendorId'),\r\n 'vendorId',\r\n this.$('input[name=vendorId]'),\r\n this.vendorSelected.bind(this)\r\n )\r\n },\r\n\r\n bindMemorizationAutocomplete: function () {\r\n this.autoComplete(\r\n this.model.get('memorizationList'),\r\n 'label',\r\n this.$('input[name=memorizationLabel]'),\r\n this.memorizationSelected.bind(this),\r\n 'CREATENEW'\r\n )\r\n },\r\n\r\n memorizationSelected: function (memorization) {\r\n if (typeof memorization === 'string') {\r\n memorization = _.find(this.model.get('memorizationList'), { id: memorization })\r\n }\r\n\r\n this.$('input[name=memorizationLabel]')\r\n .val(memorization.label)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=memorizationId]')\r\n .val(memorization.id)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n if (memorization.id === 'CREATENEW') {\r\n return\r\n }\r\n\r\n this.$(\".meta [name='Is1099']\").prop('checked', memorization.is1099).closest('.floating').addClass('open')\r\n this.$('.is-recurring input').prop('checked', memorization.isRecurring)\r\n this.$('.recurring-start-date .date')\r\n .datepicker('setDate', moment(memorization.recurringDate)._d)\r\n .closest('.floating')\r\n .addClass('open')\r\n this.$('select[name=recurringFrequency]').val(memorization.recurringFrequency)\r\n if (memorization.checkbook) {\r\n this.$('select[name=recurring-checkbook], input[name=recurring-checkbook]').val(memorization.checkbook.checkbookId)\r\n }\r\n\r\n var checkbookAccountId = this.model.get('checkbook').get('account')\r\n var checkbookDetailLine = _.find(memorization.lineItems, { ledgerAccountId: checkbookAccountId })\r\n var lineItems = _.without(memorization.lineItems, checkbookDetailLine)\r\n\r\n if (memorization.vendor) {\r\n var vendor = _.find(this.model.get('vendorList'), { id: memorization.vendor.vendorId })\r\n if (vendor) {\r\n this.vendorSelected(vendor)\r\n }\r\n }\r\n\r\n this.$('textarea[name=Notes]')\r\n .val(memorization.notes)\r\n .closest('.floating')\r\n .addClass('open')\r\n this.$('input[name=Description]')\r\n .val(memorization.description)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n if (memorization.reference && memorization.reference.name) {\r\n this.$('input[name=Reference]')\r\n .val(memorization.reference.name)\r\n .closest('.floating')\r\n .addClass('open')\r\n }\r\n\r\n this.$('.meta input[name=Amount]')\r\n .val(numbro(_.sumBy(lineItems, 'debit')).formatCurrency('$0,0.00'))\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // Clear out any existing lines\r\n this.$('.line-item-container').html('')\r\n _.each(lineItems, function (lineItem) {\r\n var account = _.find(this.model.get('accounts'), { 'id': lineItem.ledgerAccountId })\r\n\r\n if (!account) {\r\n console.error(\"Couldn't find account with id\", lineItem.ledgerAccountId, 'is this an invalid link to a checkbook account?')\r\n return\r\n }\r\n\r\n var $lineItem = this.addLineItem()\r\n\r\n $lineItem.find('input[name=AccountNumber]')\r\n .val(account.get('accountNumber'))\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n $lineItem.find('input[name=Description]')\r\n .val(account.get('accountName'))\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n $lineItem.find('input[name=Amount]')\r\n .val(numbro(lineItem.debit || lineItem.credit).formatCurrency('$0,0.00'))\r\n .closest('.floating')\r\n .addClass('open')\r\n }.bind(this))\r\n\r\n this.validateExtras()\r\n\r\n return memorization\r\n },\r\n\r\n vendorSelected: function (vendor) {\r\n this.$('input[name=idVendor]').val(vendor.id)\r\n this.$('input[name=vendorId]').val(vendor.vendorId).closest('.floating').addClass('open')\r\n this.$('input[name=Description]').val(vendor.printedName).closest('.floating').addClass('open')\r\n\r\n // Clear out any existing lines\r\n this.$('.line-item-container').html('')\r\n _.each(vendor.expenseDistributions, function (lineItem, index) {\r\n var $lineItem = this.addLineItem()\r\n\r\n var account = _.find(this.model.get('accounts'), { 'id': lineItem.ledgerAccountId })\r\n\r\n if (!account) {\r\n console.error(\"Couldn't find account with id\", lineItem.get('account'), 'is this an invalid link to a checkbook account?')\r\n }\r\n\r\n $lineItem.find('input[name=AccountNumber]').val(account.get('accountNumber')).closest('.floating').addClass('open')\r\n $lineItem.find('input[name=Description]').val(account.get('accountName')).closest('.floating').addClass('open')\r\n }.bind(this))\r\n this.validateExtras()\r\n },\r\n\r\n reset: function () {\r\n this.render()\r\n },\r\n\r\n create: function (event) {\r\n event.preventDefault()\r\n\r\n if (Math.abs(this.calculateDiscrepancy()).toFixed(2) >= 0.01 || !this.validateExtras()) {\r\n return\r\n }\r\n this.$('.save-eft-payment').prop('disabled', true)\r\n this.trigger('create', this.getEftPayment())\r\n },\r\n \r\n btnEnable: function () {\r\n $('.save-eft-payment').prop('disabled', false)\r\n },\r\n\r\n memorize: function () {\r\n if (Math.abs(this.calculateDiscrepancy()).toFixed(2) >= 0.01) {\r\n return\r\n }\r\n\r\n var eftPayment = this.getEftPayment()\r\n\r\n eftPayment.set('lineItems', _.filter(eftPayment.get('lineItems'), function (distribution) {\r\n return distribution.get('account') !== this.model.get('checkbook').get('account')\r\n }.bind(this)))\r\n\r\n if (eftPayment.get('memorizationId')) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'You will be overwriting any previously memorized information.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize', eftPayment)\r\n }.bind(this))\r\n } else {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize', eftPayment)\r\n }\r\n },\r\n\r\n validateExtras: function () {\r\n return this.validateExtrasAs('EFTPAYMENT')\r\n },\r\n\r\n setMemorizationId: function (memorizationId) {\r\n this.$('input[name=memorizationId]').val(memorizationId)\r\n },\r\n\r\n showSuccessMessage: function () {\r\n return this.showSuccessMessageAs('EFTPAYMENT')\r\n },\r\n \r\n memBtnEnable: function () {\r\n this.$('.memorize-button').prop('disabled', false)\r\n }\r\n})\r\n\r\nmodule.exports = CreateEftPaymentView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar Q = require('q')\r\nvar CreateEftPaymentView = require('checkbook/eft-payment/create-eft-payment-view')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar MemorizationService = require('memorization/journal-entries/service')\r\nvar VendorsService = require('lists/vendors/service')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar CreateEftPaymentWidget = function (checkbook) {\r\n this.model = new Backbone.Model({\r\n checkbook: checkbook,\r\n accounts: []\r\n })\r\n this.view = new CreateEftPaymentView({\r\n model: this.model\r\n })\r\n this.accountService = new AccountService()\r\n this.checkbookService = new CheckbookService()\r\n this.memorizationService = new MemorizationService()\r\n this.vendorsService = new VendorsService()\r\n this.view.on('create', this.createPayment, this)\r\n this.view.on('memorize', this.memorizePayment, this)\r\n}\r\n\r\nCreateEftPaymentWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCreateEftPaymentWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n Q.all([\r\n this.vendorsService.getList(),\r\n this.accountService.fetchAccounts(false),\r\n this.loadMemorizations()\r\n ]).spread(function (vendors, accounts) {\r\n this.model.set({\r\n vendorList: _.map(vendors, function (vendor) {\r\n vendor['fullName'] = vendor.firstName + ' ' + vendor.lastName\r\n return vendor\r\n }),\r\n accounts: _.filter(accounts, function (account) {\r\n return account.id !== this.model.get('checkbook').get('account')\r\n }.bind(this))\r\n })\r\n\r\n this.view.trigger('bindAutocomplete')\r\n\r\n return vendors\r\n }.bind(this))\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nCreateEftPaymentWidget.prototype.loadMemorizations = function () {\r\n this.memorizationService.getList('EFTPayment').then(function (memorizations) {\r\n this.model.set('memorizationList', memorizations)\r\n this.view.trigger('bindAutocomplete')\r\n }.bind(this))\r\n}\r\n\r\nCreateEftPaymentWidget.prototype.createPayment = function (eftPayment) {\r\n if (this.creating) {\r\n return\r\n }\r\n\r\n this.creating = true\r\n this.checkbookService.createEftPayment(this.model.get('checkbook').get('id'), eftPayment).then(function () {\r\n this.view.reset()\r\n this.creating = false\r\n this.trigger('eftPaymentCreated')\r\n this.loadMemorizations()\r\n }.bind(this), function () {\r\n this.creating = false\r\n this.view.btnEnable()\r\n }.bind(this))\r\n}\r\n\r\nCreateEftPaymentWidget.prototype.memorizePayment = function (eftPayment) {\r\n var deferral\r\n\r\n if (!eftPayment.get('label')) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Please enter in a memorization label for this transaction',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6'\r\n })\r\n this.view.memBtnEnable()\r\n return\r\n }\r\n\r\n if (eftPayment.get('memorizationId')) {\r\n deferral = this.memorizationService.update(eftPayment.get('memorizationId'), eftPayment).then(function () {\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your EFT Payment has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationUpdated')\r\n }.bind(this))\r\n } else {\r\n deferral = this.memorizationService.create(eftPayment).then(function (response) {\r\n this.view.trigger('setMemorizationId', response.message)\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your EFT Payment has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationCreated')\r\n }.bind(this))\r\n }\r\n\r\n deferral.fail(function (err) {\r\n this.view.showError(err.message)\r\n }.bind(this))\r\n\r\n this.view.memBtnEnable()\r\n deferral.then(this.loadMemorizations.bind(this))\r\n}\r\n\r\nmodule.exports = CreateEftPaymentWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurringFrequency\\\" size=\\\"1\\\">\\r\\n <option value=\\\"1\\\">Weekly</option>\\r\\n <option value=\\\"2\\\">Bi-Weekly</option>\\r\\n <option value=\\\"3\\\">Monthly</option>\\r\\n <option value=\\\"4\\\">Bi-Monthly</option>\\r\\n <option value=\\\"5\\\">Quarterly</option>\\r\\n <option value=\\\"6\\\">Semi-Annual</option>\\r\\n <option value=\\\"7\\\">Annual</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Frequency</label>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, buffer = \n \" <div class=\\\"form-group recurring-checkbook-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurring-checkbook\\\" size=\\\"1\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Checkbook</label>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \" <input type=\\\"hidden\\\" name=\\\"recurring-checkbook\\\" />\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, buffer = \n \"<div class=\\\"eft-payment-meta meta\\\">\\r\\n <div class=\\\"col-xs-6 no-padding\\\" data-not-autocomplete-boundary>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Memorized Label\",\"inputName\":\"memorizationLabel\",\"inputId\":\"memorized-label\",\"wrapperClasses\":\"memorized-label col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Vendor ID\",\"inputName\":\"vendorId\",\"inputId\":\"eft-payment-vendor-id\",\"wrapperClasses\":\"eftpayment-vendor-id col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Description\",\"inputName\":\"Description\",\"inputId\":\"eft-payment-description\",\"wrapperClasses\":\"description col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"idVendor\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizationId\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizedEntryDate\\\" />\\r\\n </div>\\r\\n <div class=\\\"col-xs-6 no-padding new-eft-payment-data\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Date\",\"inputName\":\"PostedDate\",\"inputId\":\"eft-payment-date\",\"wrapperClasses\":\"eftpayment-date col-xs-6\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Reference #\",\"inputName\":\"Reference\",\"inputId\":\"eft-payment-reference\",\"wrapperClasses\":\"reference col-xs-6\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"currency currency-field\",\"inputLabel\":\"Amount\",\"inputName\":\"Amount\",\"inputId\":\"eft-payment-amount\",\"wrapperClasses\":\"amount col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"eft-payment-notes-\\\" name=\\\"Notes\\\" rows=\\\"4\\\"></textarea>\\r\\n <label for=\\\"eft-payment-notes-\\\">Notes</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"flex col-xs-12\\\">\\r\\n <div class=\\\"form-group is-1099\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>1099</span> <input type=\\\"checkbox\\\" name=\\\"Is1099\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n <div class=\\\"form-group is-recurring col-xs-12\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Recurring</span> <input type=\\\"checkbox\\\" name=\\\"IsRecurring\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"col-xs-12 distribution\\\">\\r\\n <h3>EFT Payment Distribution</h3>\\r\\n <div class=\\\"line-item-container\\\">\\r\\n </div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\">+ Additional EFT Payment Distribution</button>\\r\\n <br />\\r\\n <div class=\\\"col-xs-12 recurring-meta-container no-padding\\\">\\r\\n <h3>Recurrence</h3>\\r\\n <div class=\\\"flex col-xs-12\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Start Date\",\"wrapperClasses\":\"recurring-start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group recurring-frequency-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(alias1,options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(7, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary memorize-button\\\">Memorize</button>\\r\\n <button class=\\\"btn btn-primary pull-right save-eft-payment save-button\\\">Post EFT Payment</button>\\r\\n <button class=\\\"btn btn-primary pull-right save-eft-payment update-button\\\">Update EFT Payment</button>\\r\\n</div>\\r\\n<div class=\\\"col-xs-12 check-status status\\\"></div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Distribution = require('checkbook/distribution')\r\nvar moment = require('moment')\r\n\r\nvar EftPayment = Backbone.Model.extend({\r\n defaults: {\r\n amountType: 'credit'\r\n },\r\n toJSON: function () {\r\n return {\r\n label: this.get('label'),\r\n memorizedEntryDate: this.get('memorizedEntryDate'),\r\n memorizationId: this.get('memorizationId'),\r\n memorizedEntryId: this.get('memorizationId'),\r\n readableJournalType: 'EFT Payment',\r\n journalType: 'EFTPAYMENT',\r\n description: this.get('description'),\r\n postedDate: this.get('date'),\r\n reference: { name: this.get('referenceNumber') },\r\n notes: this.get('notes'),\r\n is1099: this.get('is1099'),\r\n has1099: true,\r\n amount: this.get('amount') || this.getAmount(),\r\n shortDate: this.get('shortDate'),\r\n lineItems: _.map(this.get('lineItems'), function (detail) {\r\n if (detail.toJSON) return detail.toJSON()\r\n else return detail\r\n }),\r\n vendor: this.get('vendor'),\r\n isRecurring: this.get('isRecurring'),\r\n recurringDate: this.get('recurringDate'),\r\n recurringFrequency: this.get('recurringFrequency'),\r\n checkbook: { checkbookId: this.get('checkbookId') }\r\n }\r\n },\r\n\r\n getAmount: function () {\r\n var checkbookLineItem = _.find(this.get('lineItems'), function (detail) {\r\n return detail.get(this.get('amountType')) !== undefined && detail.get(this.get('amountType')) !== null\r\n }.bind(this))\r\n\r\n return checkbookLineItem ? checkbookLineItem.get('amount') : null\r\n }\r\n}, {\r\n parse: function (json) {\r\n return new EftPayment({\r\n readableJournalType: 'EFT Payment',\r\n id: json.id,\r\n memorizedEntryDate: json.memorizedEntryDate,\r\n journalType: 'EFTPayment',\r\n description: json.description,\r\n date: moment(json.postedDate),\r\n notes: json.notes,\r\n is1099: json.is1099,\r\n has1099: true,\r\n voidJournal: json.voidJournal,\r\n checkbookId: (json.checkbook || {checkbookId: ''}).checkbookId,\r\n lineItems: _.map(json.lineItems, Distribution.parse),\r\n referenceNumber: json.reference.name,\r\n label: json.label,\r\n memorizationId: json.memorizationId,\r\n vendor: json.vendor\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = EftPayment\r\n","var CheckbookLineItem = require('checkbook/checkbook-line-item')\r\nvar PageableCollection = require('backbone.paginator')\r\nvar Config = require('config/config')\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar SessionService = require('session/session-service')\r\n\r\nvar CheckbookHistories = PageableCollection.extend({\r\n initialize: function (companyId, checkbookId, pending, startDate, endDate) {\r\n this.companyId = companyId\r\n this.checkbookId = checkbookId\r\n this.pending = pending\r\n this.startDate = startDate\r\n this.endDate = endDate\r\n },\r\n model: CheckbookLineItem,\r\n url: function () {\r\n var url = Config['CRUNCHED_API_HOST'] + '/companies/' + this.companyId + '/checkbooks/' + this.checkbookId + '/checks'\r\n\r\n if (this.pending) {\r\n url += '/pending'\r\n }\r\n\r\n return url\r\n },\r\n sync: function (method, model, options) {\r\n return Backbone.sync(method, model, _.extend({}, options, {\r\n headers: {\r\n 'Authorization': 'Bearer ' + SessionService.getToken()\r\n }\r\n }))\r\n },\r\n state: {\r\n firstPage: 0,\r\n pageSize: 50,\r\n sortKey: 'postedOn',\r\n order: 'desc',\r\n startDate: this.startDate,\r\n endDate: this.endDate\r\n },\r\n queryParams: {\r\n pageSize: 'pageSize',\r\n sortKey: 'sortField',\r\n order: 'order',\r\n startDate: function () { return this.startDate },\r\n endDate: function () { return this.endDate }\r\n },\r\n parseState: function (resp, queryParams, state, options) {\r\n return {\r\n totalRecords: resp.totalRecords\r\n }\r\n },\r\n parseRecords: function (resp, options) {\r\n return _.map(resp.items, CheckbookLineItem.parse)\r\n }\r\n})\r\n\r\nmodule.exports = CheckbookHistories\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \" <div class=\\\"actions\\\" style=\\\"width: 105px;\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.showEdit : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.showVoid : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.showDelete : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-pencil edit\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-ban void-button\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-trash-o delete\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.id : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar numbro = require('numbro')\r\nvar $ = require('jquery')\r\nvar CheckbookHistoryTemplate = require('checkbook/history/checkbook-history')\r\nvar CheckbookHistoryActionsTemplate = require('checkbook/history/checkbook-history-actions')\r\nvar ActionCellView = require('forms/action-cell/view')\r\nvar Backgrid = require('backgrid')\r\nrequire('backgrid-paginator')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar CheckbookHistoryView = Backbone.View.extend({\r\n className: 'block col-sm-12 checkbook history-container',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change', this.render)\r\n this.on('closeConfirmModal', this.closeConfirmModal, this)\r\n },\r\n\r\n events: {\r\n 'click .edit': 'edit',\r\n 'click .void-button': 'promptVoid',\r\n 'click .delete': 'delete',\r\n 'click .backgrid tbody tr': 'openItem'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CheckbookHistoryTemplate(this.createViewModel()))\r\n this.generateGrid()\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n currentBalance: numbro(this.model.get('currentBalance')).formatCurrency('($0,0.00)'),\r\n sortAscending: this.model.get('sortAscending'),\r\n adminMode: this.model.get('adminMode')\r\n }\r\n },\r\n\r\n generateGrid: function () {\r\n var voidRow = Backgrid.Row.extend({\r\n render: function () {\r\n voidRow.__super__.render.apply(this, arguments)\r\n if (this.model.get('isVoided')) {\r\n this.el.classList.add('void')\r\n }\r\n return this\r\n }\r\n })\r\n\r\n var table = new Backgrid.Grid({\r\n row: voidRow,\r\n columns: this.getColumns(this.model.get('adminMode')),\r\n collection: this.model.get('histories')\r\n })\r\n\r\n var paginator = new Backgrid.Extension.Paginator({\r\n collection: this.model.get('histories')\r\n })\r\n\r\n this.$('.history-table').append(table.render().el)\r\n\r\n if (this.model.get('checkCount') > 0) {\r\n this.$('.history-table').append(paginator.render().el)\r\n } else {\r\n this.$('.history-table').append('<p class=\"center empty-grid\">Couldn\\'t find any checkbook transactions</p>')\r\n }\r\n },\r\n\r\n getColumns: function (adminMode) {\r\n return [{\r\n name: 'postedOn',\r\n label: 'Date',\r\n editable: false,\r\n sortable: true,\r\n direction: 'descending',\r\n cell: Backgrid.Cell.extend({\r\n render: function () {\r\n if (this.model.get('postedOn') !== undefined) {\r\n this.$el.append(this.model.get('postedOn').format('MM/DD/YYYY'))\r\n }\r\n return this\r\n }\r\n })\r\n },\r\n {\r\n name: 'check-status',\r\n label: '',\r\n editable: false,\r\n sortable: false,\r\n cell: Backgrid.Cell.extend({\r\n render: function () {\r\n if (this.model.get('status') !== undefined) {\r\n var status = ''\r\n var statusMessage = ''\r\n\r\n if (this.model.get('isVoided')) {\r\n status = 'V'\r\n statusMessage = 'Void'\r\n } else if (this.model.get('status').toLowerCase() === 'cleared') {\r\n status = 'C'\r\n statusMessage = 'Cleared'\r\n }\r\n\r\n this.$el.append('<span data-toggle=\"tooltip\" data-placement=\"right\" data-original-title=\"' + statusMessage + '\">' + status + '</span>')\r\n }\r\n return this\r\n }\r\n })\r\n },\r\n {\r\n name: 'type',\r\n label: '# / Type',\r\n editable: false,\r\n sortable: false,\r\n cell: Backgrid.Cell.extend({\r\n render: function () {\r\n var checkType = this.model.get('type')\r\n if (checkType === 'Check' || checkType === 'AP Payment') {\r\n this.$el.append(this.model.get('checkNumber'))\r\n } else {\r\n this.$el.append(this.model.get('type'))\r\n }\r\n return this\r\n }\r\n })\r\n },\r\n {\r\n name: 'description',\r\n label: 'Description',\r\n cell: 'string',\r\n sortable: false,\r\n editable: false\r\n },\r\n {\r\n name: 'debit',\r\n label: 'Deposit',\r\n cell: 'string',\r\n sortable: false,\r\n editable: false\r\n },\r\n {\r\n name: 'credit',\r\n label: 'Withdrawl',\r\n cell: 'string',\r\n sortable: false,\r\n editable: false\r\n },\r\n {\r\n name: 'balance',\r\n label: 'Balance',\r\n cell: 'string',\r\n sortable: false,\r\n editable: false\r\n },\r\n {\r\n name: 'actions',\r\n label: '',\r\n editable: false,\r\n cell: ActionCellView.extend({\r\n template: CheckbookHistoryActionsTemplate,\r\n createViewModel: function () {\r\n if (this.model.get('id') !== undefined) {\r\n var isEditable = (!this.model.get('isVoided') && this.model.get('status').toLowerCase() !== 'cleared') || adminMode\r\n var canDelete = (!this.model.get('isVoided') && this.model.get('status').toLowerCase() !== 'cleared') && this.model.get('type') !== 'AP Payment'\r\n\r\n return {\r\n id: this.model.get('id'),\r\n showEdit: isEditable,\r\n showVoid: !this.model.get('isVoided'),\r\n showDelete: canDelete\r\n }\r\n }\r\n }\r\n })\r\n },\r\n {\r\n name: 'id',\r\n label: 'Id',\r\n cell: 'string',\r\n sortable: false,\r\n editable: false,\r\n renderable: false\r\n }]\r\n },\r\n\r\n openItem: function (element, e) {\r\n var row = $(element.currentTarget)\r\n this.trigger('openDetailView', row.find('.id')[0].innerHTML, row)\r\n },\r\n\r\n edit: function (e) {\r\n var checkId = $(e.currentTarget).attr('data-id')\r\n var $itemRow = $(e.currentTarget).parent().parent().parent()\r\n\r\n if (this.model.get('isDisabled')) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'This checkbook is disabled. It must be enabled to edit the check.',\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n } else {\r\n this.trigger('startEditing', checkId, $itemRow)\r\n }\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n },\r\n\r\n delete: function (e) {\r\n if (this.model.get('isDisabled')) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'This checkbook is disabled. It must be enabled to delete the check.',\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n } else {\r\n var $currentTarget = $(e.currentTarget)\r\n var entryId = $currentTarget.attr('data-id')\r\n\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'Are you sure you want to delete this transaction?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'No'\r\n }).then(function () {\r\n this.trigger('deleteTransaction', entryId)\r\n }.bind(this))\r\n }\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n },\r\n\r\n closeConfirmModal: function () {\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n this.$('.history .check-details').remove()\r\n this.$('.active').removeClass('active')\r\n },\r\n\r\n startEditing: function (editWidget) {\r\n if (!this.model.get('isDisabled')) {\r\n this.closeConfirmModal()\r\n\r\n var $editView = $(editWidget.show())\r\n this.$editView = $editView\r\n\r\n this.$('.history-table').append($editView)\r\n editWidget.off('close')\r\n editWidget.once('close', this.doneEditing, this)\r\n\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.doneEditing.bind(this))\r\n\r\n var recalcNeededPadding = function ($lineItem) {\r\n var currentHeight = this.$('.history-table').height()\r\n var editHeight = $editView.find('.block').height() + Number($editView.css('top').replace('px', '')) - 44\r\n var heightDifference = editHeight - currentHeight\r\n\r\n if (heightDifference > 0) {\r\n this.$el.css({\r\n 'padding-bottom': heightDifference\r\n })\r\n }\r\n }.bind(this)\r\n\r\n setTimeout(function () {\r\n editWidget.focusedLineItem.ScrollTo()\r\n }, 100)\r\n recalcNeededPadding()\r\n\r\n editWidget.off('lineItemAdded')\r\n editWidget.on('lineItemAdded', recalcNeededPadding)\r\n\r\n Backbone.once('app:navigate', this.doneEditing, this)\r\n }\r\n },\r\n\r\n doneEditing: function () {\r\n this.$editView.remove()\r\n this.$el.attr('style', '')\r\n\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n },\r\n\r\n promptVoid: function (e) {\r\n if (this.model.get('isDisabled')) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'This checkbook is disabled. It must be enabled to void the check.',\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n } else {\r\n var $currentTarget = $(e.currentTarget)\r\n var entryId = $currentTarget.attr('data-id')\r\n\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'Are you sure you want to void this transaction?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'No'\r\n }).then(function () {\r\n this.trigger('voidAndReverse', entryId)\r\n }.bind(this))\r\n }\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n }\r\n})\r\n\r\nmodule.exports = CheckbookHistoryView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar CheckbookHistoryView = require('checkbook/history/checkbook-history-view')\r\nvar CheckbookHistories = require('checkbook/history/checkbook-histories')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar CompanyService = require('company/company-service')\r\nvar EditCheckWidget = require('checkbook/edit-check/edit-check-widget')\r\n\r\nvar CheckbookHistoryWidget = function (parentModel, adminMode, startDate, endDate) {\r\n this.checkbookService = new CheckbookService()\r\n this.companyService = new CompanyService()\r\n this.model = new Backbone.Model(_.extend({\r\n adminMode: !!adminMode,\r\n availableBalance: 0,\r\n hasData: false,\r\n histories: new CheckbookHistories(this.companyService.getActiveCompanyId(), parentModel.id, false, startDate, endDate),\r\n checkCount: 0\r\n }, parentModel.attributes))\r\n\r\n if (parentModel.get('account') !== undefined) {\r\n this.model.set('account', parentModel.get('account'))\r\n } else {\r\n this.model.set('account', parentModel.get('checkbookLookup')[parentModel.get('id')].ledgerAccount)\r\n }\r\n\r\n this.view = new CheckbookHistoryView({\r\n model: this.model\r\n })\r\n\r\n this.model.set('hasData', true)\r\n\r\n this.view.on('openDetailView', function () {\r\n this.trigger.apply(this, _.concat(['openDetailView'], arguments))\r\n }, this)\r\n\r\n this.view.on('startEditing', this.startEditing, this)\r\n this.view.on('voidAndReverse', this.voidAndReverse, this)\r\n this.view.on('deleteTransaction', this.deleteTransaction, this)\r\n\r\n this.editWidget = new EditCheckWidget(this.model, adminMode)\r\n this.editWidget.on('updated', function () {\r\n this.update()\r\n }, this)\r\n}\r\n\r\nCheckbookHistoryWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCheckbookHistoryWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n this.update()\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nCheckbookHistoryWidget.prototype.update = function () {\r\n this.loadHistory()\r\n Q.all([\r\n this.checkbookService.fetchAccountBalance(this.model.get('id')),\r\n this.checkbookService.getCheckCount(this.model.get('id'))\r\n ]).spread(function (balance, checkCount) {\r\n this.model.set({\r\n currentBalance: balance,\r\n checkCount: this.model.get('histories').models.length === 0 ? 0 : checkCount\r\n })\r\n }.bind(this))\r\n}\r\n\r\nCheckbookHistoryWidget.prototype.loadHistory = function () {\r\n this.model.get('histories').fetch({ reset: true })\r\n}\r\n\r\nCheckbookHistoryWidget.prototype.startEditing = function (checkId, itemRow) {\r\n this.checkbookService.fetchCheck(this.model.id, checkId).then(function (model) {\r\n return this.editWidget.startEditing(model, itemRow)\r\n }.bind(this)).then(function () {\r\n this.view.startEditing(this.editWidget)\r\n }.bind(this))\r\n}\r\n\r\nCheckbookHistoryWidget.prototype.remove = function () {\r\n return this.view.remove()\r\n}\r\n\r\nCheckbookHistoryWidget.prototype.voidAndReverse = function (checkId) {\r\n this.checkbookService.voidAndRecreate(this.model.id, checkId).then(function () {\r\n this.update()\r\n this.view.trigger('closeConfirmModal')\r\n }.bind(this))\r\n}\r\n\r\nCheckbookHistoryWidget.prototype.deleteTransaction = function (checkId) {\r\n this.checkbookService.deleteCheck(this.model.id, checkId).then(function () {\r\n this.update()\r\n this.view.trigger('closeConfirmModal')\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = CheckbookHistoryWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"<b class=\\\"pull-right\\\">Current Balance: \"\n + container.escapeExpression(((helper = (helper = helpers.currentBalance || (depth0 != null ? depth0.currentBalance : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"currentBalance\",\"hash\":{},\"data\":data}) : helper)))\n + \"</b>\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-content history\\\">\\r\\n <h3 class=\\\"pull-left\\\">Checkbook History</h3>\\r\\n \"\n + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.adminMode : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n <br />\\r\\n <div class=\\\"history-table backgrid-table\\\"></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow printedCheck col-xs-12 no-padding\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"col-xs-2\\\">\"\n + alias4(((helper = (helper = helpers.shortDate || (depth0 != null ? depth0.shortDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-2\\\">\"\n + alias4(((helper = (helper = helpers.checkNumber || (depth0 != null ? depth0.checkNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"checkNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-4\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.printedName : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"col-xs-2 currency\\\">\"\n + alias4(((helper = (helper = helpers.credit || (depth0 != null ? depth0.credit : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"credit\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-1\\\"><div class=\\\"has-error text-center\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-danger\\\">\\r\\n <input type=\\\"checkbox\\\" name=\\\"CheckHasError\\\"><span></span>\\r\\n </label></div></div>\\r\\n <div class=\\\"col-xs-1\\\">\\r\\n <div class=\\\"is-voiding text-center\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-warning\\\">\\r\\n <input type=\\\"checkbox\\\" name=\\\"CheckNeedsVoid\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.printedName || (depth0 != null ? depth0.printedName : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"printedName\",\"hash\":{},\"data\":data}) : helper)));\n},\"4\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3>Print Review</h3>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"block-content col-xs-12\\\">\\r\\n <p>Please select the checks that didn't print correctly. For any check that didn't print correctly, you can also apply a voided entry to your checkbook history.</p>\\r\\n\\r\\n <div class=\\\"head col-xs-12 no-padding\\\">\\r\\n <div class=\\\"col-xs-2\\\">Date</div>\\r\\n <div class=\\\"col-xs-2\\\">Check #</div>\\r\\n <div class=\\\"col-xs-4\\\">Payee</div>\\r\\n <div class=\\\"col-xs-2 currency\\\">Amount</div>\\r\\n <div class=\\\"col-xs-1 text-center\\\">Error</div>\\r\\n <div class=\\\"col-xs-1 text-center\\\">Void</div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"table table-striped table-hover\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.printed : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\\r\\n <div class=\\\"col-xs-12 no-padding\\\">\\r\\n <span class='review-message'>Please wait while your file downloads...</span>\\r\\n <button class=\\\"btn btn-primary pull-right finishReview\\\" type=\\\"button\\\">Complete Review</button>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\n\r\nvar UnprintedCheckConfirmationTemplate = require('checkbook/print-review/template')\r\n\r\nvar UnprintedConfirmation = Backbone.View.extend({\r\n initialize: function () {\r\n this.listenTo(this.collection, 'add remove change', this.render)\r\n },\r\n\r\n events: {\r\n 'click .finishReview': 'reviewChecks',\r\n 'change input[name=CheckHasError]': 'toggleHasError',\r\n 'change input[name=CheckNeedsVoid]': 'toggleNeedsVoid'\r\n },\r\n\r\n className: 'block print-confirmation-modal z-1',\r\n\r\n render: function () {\r\n this.$el.html(UnprintedCheckConfirmationTemplate(this.createViewModel()))\r\n\r\n this.$('.table-striped').slimScroll({\r\n height: this.calculatePrintReviewHeight(),\r\n railVisible: this.toggleRailScrollbarVisible(),\r\n alwaysVisible: this.toggleRailScrollbarVisible(),\r\n color: '#32404c'\r\n })\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n printed: _.map(this.collection.toJSON(), function (check) {\r\n check.shortDate = (check.postedOn || check.postedDate).format('MM/DD/YYYY')\r\n return check\r\n })\r\n }\r\n },\r\n\r\n calculatePrintReviewHeight: function () {\r\n // Number of printed checks\r\n var checkCount = this.collection.length\r\n\r\n var rowHeight = 45\r\n var maxHeight = 440\r\n\r\n if ((rowHeight * checkCount) <= maxHeight) {\r\n return rowHeight * checkCount\r\n }\r\n return maxHeight\r\n },\r\n\r\n toggleRailScrollbarVisible: function () {\r\n // default number of items to be displayed at once for the table\r\n var defaultNumOfItems = 10\r\n return this.collection.length > defaultNumOfItems\r\n },\r\n\r\n reviewChecks: function (e) {\r\n var checks = _.map(this.$('.printedCheck'), function (element) {\r\n var $printedCheck = $(element)\r\n\r\n return {\r\n Id: $printedCheck.attr('data-id'),\r\n NeedsReset: $printedCheck.find('input[name=CheckHasError]').prop('checked'),\r\n NeedsVoid: $printedCheck.find('input[name=CheckNeedsVoid]').prop('checked')\r\n }\r\n })\r\n\r\n this.trigger('reviewChecks', checks)\r\n },\r\n\r\n toggleHasError: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var isChecked = $currentTarget.prop('checked')\r\n var $needsVoid = $currentTarget.closest('.itemrow').find('input[name=CheckNeedsVoid]')\r\n\r\n if (!isChecked) {\r\n $needsVoid.prop('checked', false)\r\n }\r\n },\r\n\r\n toggleNeedsVoid: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var isChecked = $currentTarget.prop('checked')\r\n var $hasError = $currentTarget.closest('.itemrow').find('input[name=CheckHasError]')\r\n\r\n if (isChecked) {\r\n $hasError.prop('checked', true)\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = UnprintedConfirmation\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar UnprintedConfirmationIndicatorView = require('checkbook/print-review/view')\r\n\r\nvar UnprintedConfirmationWidget = function (checkbook, printedChecks) {\r\n this.unprintedChecks = {}\r\n this.loading = false\r\n this.collection = new Backbone.Collection()\r\n this.collection.add(printedChecks)\r\n this.model = checkbook\r\n\r\n this.view = new UnprintedConfirmationIndicatorView({\r\n collection: this.collection\r\n })\r\n this.checkbookService = new CheckbookService()\r\n\r\n this.view.on('reviewChecks', this.reviewChecks, this)\r\n}\r\n\r\nUnprintedConfirmationWidget.prototype = _.clone(Backbone.Events)\r\n\r\nUnprintedConfirmationWidget.prototype.show = function () {\r\n var $el = this.view.render().$el\r\n this.view.delegateEvents()\r\n\r\n return $el\r\n}\r\n\r\nUnprintedConfirmationWidget.prototype.reviewChecks = function (checks) {\r\n this.checkbookService.reviewPrintedChecks(this.model.get('checkbookId'), checks).then(function () {\r\n this.trigger('reviewCompleted')\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = UnprintedConfirmationWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"disabled-content\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \"s\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div class=\\\"col-xs-2\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputLabel\":\"Ending Check #\",\"inputName\":\"CheckNumberRange\",\"inputId\":\"printCheckNumberRange\",\"wrapperClasses\":\"printCheckNumberRange col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \"disabled\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing;\n\n return \"<div class=\\\"print-confirmation-indicator col-xs-12 \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.length : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isValidPrinting : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\\">\\r\\n <div class=\\\"check-length-label col-md-2 col-lg-2\\\">\"\n + container.escapeExpression(((helper = (helper = helpers.length || (depth0 != null ? depth0.length : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"length\",\"hash\":{},\"data\":data}) : helper)))\n + \" Check\"\n + ((stack1 = (helpers.if_gt_1 || (depth0 && depth0.if_gt_1) || alias2).call(alias1,(depth0 != null ? depth0.length : depth0),{\"name\":\"if_gt_1\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"col-xs-2\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":(depth0 != null ? depth0.disabled : depth0),\"inputLabel\":\"Check #\",\"inputName\":\"CheckNumber\",\"inputId\":\"printCheckNumber\",\"wrapperClasses\":\"printCheckNumber col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\"\n + ((stack1 = (helpers.if_gt_1 || (depth0 && depth0.if_gt_1) || alias2).call(alias1,(depth0 != null ? depth0.length : depth0),{\"name\":\"if_gt_1\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"print-button\\\">\\r\\n <button class=\\\"btn btn-primary print\\\" type=\\\"button\\\" \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.length : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isValidPrinting : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \">Print</button>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar sweetAlert = require('sweetalert2')\r\nvar SubscriptionService = require('settings/subscription/service')\r\nvar CompanyService = require('company/company-service')\r\nvar UnprintedCheckConfirmationTemplate = require('checkbook/printing-indicator/template')\r\n\r\nvar UnprintedConfirmationIndicatorView = Backbone.View.extend({\r\n initialize: function () {\r\n this.subscriptionService = new SubscriptionService()\r\n this.companyService = new CompanyService()\r\n\r\n this.listenTo(this.collection, 'add remove reset', this.render)\r\n this.listenTo(this.model, 'change:planLevels', this.render)\r\n },\r\n\r\n events: {\r\n 'click .print': 'printChecks',\r\n 'keyup input[name=CheckNumber]': 'updateStartingNumber'\r\n },\r\n\r\n className: '',\r\n\r\n render: function () {\r\n this.$el.html(UnprintedCheckConfirmationTemplate(this.createViewModel()))\r\n\r\n this.$('input[name=CheckNumber]')\r\n .val(this.model.get('startingNumber'))\r\n .closest('.floating')\r\n .addClass('open')\r\n this.$('input[name=CheckNumberRange]')\r\n .val(this.model.get('startingNumber') + this.collection.length - 1)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('planLevels')) {\r\n this.checkSubscription()\r\n return $.extend(this.collection.toJSON(), {\r\n disabled: !this.collection.length || !this.isValidPrinting,\r\n startingCheckNumber: this.model.get('startingNumber'),\r\n isValidPrinting: this.isValidPrinting\r\n })\r\n }\r\n },\r\n\r\n checkSubscription: function () {\r\n var activeCompanyInfo = this.companyService.getActiveCompanyInfo()\r\n var hasActiveSubscription = activeCompanyInfo.activeSubscription\r\n var activeSubscriptionInfo = this.subscriptionService.getActiveSubscriptionInfo()\r\n var currentSubscription = _.find(this.model.get('planLevels'), ['id', activeSubscriptionInfo.planLevelId])\r\n\r\n this.isValidPrinting = hasActiveSubscription && (currentSubscription.name !== 'Free' && currentSubscription.price !== 0)\r\n return this.isValidPrinting\r\n },\r\n\r\n updateStartingNumber: function () {\r\n this.model.set('startingNumber', Number(this.$('input[name=CheckNumber]').val()))\r\n this.$('input[name=CheckNumberRange]').val(Number(this.model.get('startingNumber')) + this.collection.length - 1)\r\n },\r\n\r\n printChecks: function () {\r\n var startingCheckNumber = this.$('input[name=CheckNumber]').val()\r\n if (this.model.get('isDisabled')) {\r\n console.log('This checkbook is disabled.')\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'This checkbook is disabled. It must be enabled to print the check.',\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n } else {\r\n if (this.checkSubscription()) {\r\n this.$('.print').prop('disabled', true)\r\n this.trigger('printChecks', startingCheckNumber)\r\n }\r\n }\r\n },\r\n\r\n btnEnable: function () {\r\n $('.print').prop('disabled', false)\r\n }\r\n})\r\n\r\nmodule.exports = UnprintedConfirmationIndicatorView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar UnprintedConfirmationIndicatorView = require('checkbook/printing-indicator/view')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\n\r\nvar UnprintedConfirmationIndicatorWidget = function (checkbook) {\r\n this.unprintedChecks = {}\r\n this.loading = false\r\n this.collection = new Backbone.Collection()\r\n this.model = checkbook\r\n\r\n this.view = new UnprintedConfirmationIndicatorView({\r\n model: this.model,\r\n collection: this.collection\r\n })\r\n this.checkbookService = new CheckbookService()\r\n\r\n this.view.on('printChecks', this.printChecks, this)\r\n}\r\n\r\nUnprintedConfirmationIndicatorWidget.prototype = _.clone(Backbone.Events)\r\n\r\nUnprintedConfirmationIndicatorWidget.prototype.reset = function () {\r\n this.collection.reset()\r\n}\r\n\r\nUnprintedConfirmationIndicatorWidget.prototype.addUnprinted = function (check) {\r\n this.collection.add(check)\r\n}\r\n\r\nUnprintedConfirmationIndicatorWidget.prototype.removeUnprinted = function (check) {\r\n this.collection.remove(check)\r\n}\r\n\r\nUnprintedConfirmationIndicatorWidget.prototype.show = function () {\r\n var $view = this.view.render().$el\r\n\r\n this.view.delegateEvents()\r\n\r\n return $view\r\n}\r\n\r\nUnprintedConfirmationIndicatorWidget.prototype.hasCheck = function (checkId) {\r\n return _.find(this.collection.models, function (item) { return item.id === checkId }) !== undefined\r\n}\r\n\r\nUnprintedConfirmationIndicatorWidget.prototype.countUnprinted = function () {\r\n return this.collection.length\r\n}\r\n\r\nUnprintedConfirmationIndicatorWidget.prototype.printChecks = function (startingCheckNumber) {\r\n var checks = this.collection.toArray()\r\n this.collection.reset()\r\n\r\n this.checkbookService.printChecks(this.model.id, startingCheckNumber || 1, _.map(checks, function (check, index) {\r\n check.set('checkNumber', Number(startingCheckNumber) + Number(index))\r\n return { checkId: check.id, postedDateString: check.attributes.postedOn.format('MM/DD/YYYY') }\r\n }))\r\n this.view.btnEnable()\r\n this.trigger('checksPrinted', checks)\r\n}\r\n\r\nmodule.exports = UnprintedConfirmationIndicatorWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar ReconciliationEntry = require('checkbook/reconciliation/reconciliation-entry')\r\n\r\nvar getLineItemAmount = function (journalEntry) {\r\n return _.reduce(journalEntry.lineItems, function (total, lineItem) {\r\n return total + (lineItem.debit - lineItem.credit)\r\n }, 0)\r\n}\r\n\r\nvar CheckbookReconciliation = Backbone.Model.extend({\r\n toJSON: function () {\r\n return {\r\n id: this.get('id'),\r\n startDate: this.get('startDate'),\r\n endDate: this.get('endDate'),\r\n isClosed: this.get('isClosed'),\r\n entries: _.map(this.get('entries'), function (entry) {\r\n return entry.toJSON()\r\n })\r\n }\r\n }\r\n}, {\r\n parse: function (json) {\r\n var reconciledBalance = 0\r\n\r\n var reconciliation = new CheckbookReconciliation({\r\n id: json.id,\r\n startDate: new Date(json.startDate),\r\n endDate: new Date(json.endDate),\r\n isClosed: json.isClosed,\r\n sortField: json.sortField,\r\n sort: json.sort,\r\n dateSort: json.dateSort,\r\n startingBalance: json.startingBalance,\r\n endingBalance: json.endingBalance,\r\n entries: json.entries ? _.map(json.entries, function (entry) {\r\n if (entry.isCleared) {\r\n reconciledBalance = reconciledBalance + getLineItemAmount(entry)\r\n }\r\n return ReconciliationEntry.parse(entry)\r\n }) : null,\r\n reconciledBalance: reconciledBalance,\r\n unreconciledBalance: json.startingBalance + reconciledBalance - json.endingBalance\r\n })\r\n\r\n return reconciliation\r\n }\r\n})\r\n\r\nmodule.exports = CheckbookReconciliation\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"date-sort\"] || (depth0 != null ? depth0[\"date-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"date-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"journalType-sort\"] || (depth0 != null ? depth0[\"journalType-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"journalType-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"description-sort\"] || (depth0 != null ? depth0[\"description-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"description-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"7\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"deposit-sort\"] || (depth0 != null ? depth0[\"deposit-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"deposit-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"9\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"withdrawal-sort\"] || (depth0 != null ? depth0[\"withdrawal-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"withdrawal-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"11\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"itemrow reconciliation-item col-xs-12 no-padding\\\" data-id='\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"' data-amount=\\\"\"\n + alias4(((helper = (helper = helpers.amount || (depth0 != null ? depth0.amount : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"amount\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"col-xs-1 is-cleared\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <input type=\\\"checkbox\\\" name=\\\"IsCleared\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isCleared : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(12, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n <div class=\\\"col-xs-1 posted-date\\\">\"\n + alias4(((helper = (helper = helpers.shortDate || (depth0 != null ? depth0.shortDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-1 type\\\">\"\n + ((stack1 = (helpers.if_eq || (depth0 && depth0.if_eq) || alias2).call(alias1,(depth0 != null ? depth0.journalType : depth0),\"APPayment\",{\"name\":\"if_eq\",\"hash\":{},\"fn\":container.program(14, data, 0),\"inverse\":container.program(17, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"col-xs-5 description\\\">\"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 debit currency\\\">\"\n + alias4((helpers[\"numbro-nozero\"] || (depth0 && depth0[\"numbro-nozero\"]) || alias2).call(alias1,(depth0 != null ? depth0.debitSummation : depth0),{\"name\":\"numbro-nozero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 credit currency\\\">\"\n + alias4((helpers[\"numbro-nozero\"] || (depth0 && depth0[\"numbro-nozero\"]) || alias2).call(alias1,(depth0 != null ? depth0.creditSummation : depth0),{\"name\":\"numbro-nozero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n</div>\\r\\n\";\n},\"12\":function(container,depth0,helpers,partials,data) {\n return \"checked\";\n},\"14\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || helpers.helperMissing).call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.check : depth0)) != null ? stack1.checkNumber : stack1),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(15, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"15\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.check : depth0)) != null ? stack1.checkNumber : stack1), depth0));\n},\"17\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.journalType || (depth0 != null ? depth0.journalType : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"journalType\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3>Unreconciled Transactions</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content col-xs-12\\\">\\r\\n<div class=\\\"table table-striped table-hover col-xs-12\\\">\\r\\n <div class=\\\"head reconciliation-item col-xs-12\\\">\\r\\n <div class=\\\"col-xs-1 is-cleared-global\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <input type=\\\"checkbox\\\" id=\\\"clearAll\\\" name=\\\"IsClearedGlobal\\\"><span></span>\\r\\n </label>\\r\\n CLR\\r\\n </div>\\r\\n <div class=\\\"col-xs-1 posted-date\\\">Date <i data-sort-field=\\\"date\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"date-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"col-xs-1 type\\\">#/Type <i data-sort-field=\\\"journalType\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"journalType-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"col-xs-5 description\\\">Description <i data-sort-field=\\\"description\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"description-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"col-xs-2 debit currency\\\">Deposit <i data-sort-field=\\\"deposit\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"deposit-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"col-xs-2 credit currency\\\">Withdrawal <i data-sort-field=\\\"withdrawal\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"withdrawal-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(9, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n </div>\\r\\n<div class=\\\"infinity col-xs-12\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.entries : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(11, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n</div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar EntriesTemplate = require('checkbook/reconciliation/entries/template')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\nvar EntriesView = Backbone.View.extend({\r\n className: 'block reconciliation-list',\r\n\r\n events: {\r\n 'click #clearAll': 'toggleAllCleared',\r\n 'click .sort-toggle': 'toggleSort',\r\n 'change input[name=IsCleared]': 'recalcBalance',\r\n 'change input[name=IsClearedGlobal]': 'recalcBalance'\r\n },\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:reconciliation change:startingBalance', this.render.bind(this))\r\n },\r\n\r\n render: function () {\r\n this.$el.html(EntriesTemplate(this.createViewModel()))\r\n\r\n this.recalcBalance()\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('reconciliation')) {\r\n var reconciliationData = this.model.get('reconciliation')\r\n var sortField = reconciliationData.get('sortField')\r\n var sortMode = reconciliationData.get('sort')\r\n return $.extend(reconciliationData.toJSON(), {\r\n 'date-sort': this.model.get('dateSort'),\r\n 'journalType-sort': sortField === 'journalType' ? sortMode : '',\r\n 'description-sort': sortField === 'description' ? sortMode : '',\r\n 'deposit-sort': sortField === 'deposit' ? sortMode : '',\r\n 'withdrawal-sort': sortField === 'withdrawal' ? sortMode : ''\r\n })\r\n } else {\r\n return {}\r\n }\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n if (sortField === 'date') {\r\n this.model.set('dateSort', sortMode)\r\n } else {\r\n this.model.set({\r\n fieldToSort: sortField,\r\n fieldSort: sortMode\r\n })\r\n }\r\n },\r\n\r\n toggleAllCleared: function (e) {\r\n var $toggleAll = $(e.currentTarget)\r\n var isChecked = $toggleAll.prop('checked')\r\n\r\n this.$('.itemrow input[type=checkbox]').prop('checked', isChecked)\r\n },\r\n\r\n getClearedItems: function () {\r\n return _.map($('input[type=checkbox]:checked').closest('div[data-id]'), function (f) {\r\n return $(f).attr('data-id')\r\n })\r\n },\r\n\r\n getClearedAmounts: function () {\r\n return _.reduce(_.map($('input[type=checkbox]:checked').closest('div[data-id]'), function (f) {\r\n // We have to multiply these numbers by 100 to remove the decimal from the equation\r\n // Otherwise we end up with rounding issues from using floats.\r\n return Number($(f).attr('data-amount')) * 100\r\n }), function (sum, n) { return sum + n }, 0) / 100\r\n },\r\n\r\n recalcBalance: function () {\r\n var anyNotChecked = this.$('.is-cleared input[type=checkbox]:not(:checked)').length\r\n this.$('#clearAll').prop('checked', !anyNotChecked)\r\n\r\n\r\n this.model.set('clearedItemBalance', this.getClearedAmounts())\r\n }\r\n})\r\n\r\nmodule.exports = EntriesView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar ReconciliationListView = require('checkbook/reconciliation/entries/view')\r\n\r\nvar EntriesWidget = function (model) {\r\n this.model = model\r\n this.view = new ReconciliationListView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('recalcBalance', function () {\r\n this.trigger('recalcBalance')\r\n }, this)\r\n}\r\n\r\nEntriesWidget.prototype = _.clone(Backbone.Events)\r\n\r\nEntriesWidget.prototype.show = function () {\r\n var $el = this.view.render().$el\r\n\r\n this.view.delegateEvents()\r\n\r\n return $el\r\n}\r\n\r\nEntriesWidget.prototype.getClearedItems = function () {\r\n return this.view.getClearedItems()\r\n}\r\n\r\nEntriesWidget.prototype.getClearedAmounts = function () {\r\n return this.view.getClearedAmounts()\r\n}\r\n\r\nmodule.exports = EntriesWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"col-lg-12 bg-primary-lighter\\\"><i class=\\\"fa fa-check-circle fa-2x fa-inverse\\\"></i>Your account is reconciled, you may save or close the reconciliation period.</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3>Reconciliation Info</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content reconcileForm\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"currency-field\",\"inputLabel\":\"Statement Beginning Balance\",\"inputName\":\"beginningBalance\",\"inputId\":\"beginningBalance\",\"wrapperClasses\":\"beginningBalance col-xs-4\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"currency-field\",\"inputLabel\":\"Statement Ending Balance\",\"inputName\":\"endingBalance\",\"inputId\":\"endingBalance\",\"wrapperClasses\":\"endingBalance col-xs-4\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Statement End Date\",\"inputName\":\"endDate\",\"inputId\":\"endDate\",\"wrapperClasses\":\"endDate col-xs-4\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"col-xs-12 form-group actions\\\">\\r\\n <div class=\\\"form-material\\\"><button class=\\\"btn btn-primary addItem\\\">Add Item</button></div>\\r\\n <div class=\\\"form-material\\\"><button class=\\\"btn btn-primary saveRec\\\">Save Rec.</button></div>\\r\\n <div class=\\\"form-material\\\"><button class=\\\"btn btn-primary closeRec\\\">Close Rec. Period</button></div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"status col-xs-12 no-padding\\\"> </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"col-lg-12 bg-danger-light\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">You are unreconciled by \"\n + container.escapeExpression((helpers.numbro || (depth0 && depth0.numbro) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.unreconciled : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \", you may save the reconciliation but cannot close the period.</span></div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar ReconcileTemplate = require('checkbook/reconciliation/info/template')\r\nvar numbro = require('numbro')\r\nvar moment = require('moment')\r\nvar sweetAlert = require('sweetalert2')\r\nvar UnreconciledBalanceStatus = require('checkbook/reconciliation/info/unreconciled-status')\r\nvar BalanceStatus = require('checkbook/reconciliation/info/balanced-status')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar InfoView = Backbone.View.extend({\r\n className: 'block reconcile col-xs-12 no-padding',\r\n\r\n events: {\r\n 'click .saveRec': 'saveReconciliation',\r\n 'click .closeRec': 'closeReconciliation',\r\n 'click .addItem': 'addItem',\r\n 'keyup input[name=endingBalance]': 'changeEndingBalance',\r\n 'keyup input[name=beginningBalance]': 'changeBeginningBalance'\r\n },\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:clearedItemBalance', this.recalcClearedBalance.bind(this))\r\n this.listenTo(this.model, 'change:unreconciledBalance', this.checkStatus.bind(this))\r\n this.listenTo(this.model, 'change:startingBalance', this.recalcClearedBalance.bind(this))\r\n },\r\n\r\n changeEndingBalance: function (e) {\r\n this.model.set('endingBalance', numbro().unformat(this.$('input[name=endingBalance]').val()))\r\n },\r\n\r\n changeBeginningBalance: function (e) {\r\n this.model.set('startingBalance', numbro().unformat(this.$('input[name=beginningBalance]').val()))\r\n },\r\n\r\n saveReconciliation: function (e) {\r\n this.trigger('saveRec', this.$('input[name=endDate]').datepicker('getDate'), this.model.get('startingBalance'), this.model.get('endingBalance'), false, function () {\r\n if (e) {\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your reconciliation has been saved.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n }\r\n })\r\n },\r\n\r\n closeReconciliation: function (e) {\r\n if (this.model.get('unreconciledBalance')) return\r\n this.trigger('saveRec', this.$('input[name=endDate]').datepicker('getDate'), this.model.get('startingBalance'), this.model.get('endingBalance'), true)\r\n },\r\n\r\n addItem: function (e) {\r\n this.trigger('addItem')\r\n },\r\n\r\n checkStatus: function () {\r\n if (this.model.get('unreconciledBalance')) {\r\n this.$('.status').html(UnreconciledBalanceStatus({unreconciled: this.model.get('unreconciledBalance')}))\r\n } else {\r\n this.$('.status').html(BalanceStatus())\r\n }\r\n },\r\n\r\n render: function () {\r\n this.$el.html(ReconcileTemplate(this.createViewModel()))\r\n\r\n if (this.model.get('reconciliation')) {\r\n this.$('input[name=beginningBalance]').val(numbro(this.model.get('reconciliation').get('startingBalance')).formatCurrency('$0,0.00') || 0)\r\n this.$('input[name=endingBalance]').val(numbro(this.model.get('reconciliation').get('endingBalance')).formatCurrency('$0,0.00') || 0)\r\n\r\n this.model.set({\r\n startingBalance: this.model.get('reconciliation').get('startingBalance'),\r\n endingBalance: this.model.get('reconciliation').get('endingBalance'),\r\n startDate: moment.utc(this.model.get('reconciliation').get('startDate')),\r\n endDate: moment(this.model.get('reconciliation').get('endDate'))\r\n }, { silent: true })\r\n\r\n this.$('.date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.date').datepicker('hide', null)\r\n } \r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n }\r\n\r\n this.recalcClearedBalance()\r\n this.checkStatus()\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('reconciliation')) {\r\n var reconcilationInfo = this.model.get('reconciliation')\r\n return {\r\n startDate: moment(reconcilationInfo.get('startDate')),\r\n endDate: moment(reconcilationInfo.get('endDate')),\r\n isClosed: reconcilationInfo.get('isClosed')\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n\r\n recalcClearedBalance: function (e) {\r\n this.model.set('clearedBalance', this.model.get('startingBalance') + this.model.get('clearedItemBalance'))\r\n this.checkStatus()\r\n }\r\n})\r\n\r\nmodule.exports = InfoView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar ReconciliationService = require('checkbook/reconciliation/service')\r\nvar ReconcileView = require('checkbook/reconciliation/info/view')\r\n\r\nvar InfoWidget = function (model) {\r\n\r\n this.view = new ReconcileView({\r\n model: model\r\n })\r\n\r\n this.view.on('saveRec', function (endDate, startingBalance, endingBalance, isClosing, callback) {\r\n this.trigger('saveRec', endDate, startingBalance, endingBalance, isClosing, callback)\r\n }, this)\r\n this.view.on('addItem', function () {\r\n this.trigger('addItem')\r\n }, this)\r\n\r\n this.checkbookService = new ReconciliationService()\r\n}\r\n\r\nInfoWidget.prototype = _.clone(Backbone.Events)\r\n\r\nInfoWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nInfoWidget.prototype.saveReconciliation = function () {\r\n this.view.saveReconciliation()\r\n}\r\n\r\nmodule.exports = InfoWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Distribution = require('checkbook/distribution')\r\nvar moment = require('moment')\r\nvar _ = require('lodash')\r\n\r\nvar ReconciliationEntry = Backbone.Model.extend({\r\n toJSON: function () {\r\n var cloned = _.clone(this.attributes)\r\n cloned.lineItems = _.map(this.get('lineItems'), function (detail) {\r\n if (detail.toJSON) {\r\n return detail.toJSON()\r\n } else {\r\n return detail\r\n }\r\n })\r\n\r\n return cloned\r\n }\r\n}, {\r\n parse: function (json) {\r\n var creditSummation = 0\r\n var debitSummation = 0\r\n\r\n var reconciliationEntry = new ReconciliationEntry({\r\n id: json.id,\r\n journalType: json.journalType,\r\n description: json.check ? json.check.printedName : json.description,\r\n date: moment(json.postedDate),\r\n notes: json.notes,\r\n voidJournal: json.voidJournal,\r\n is1099: json.is1099,\r\n lineItems: _.map(json.lineItems, function (lineItem) {\r\n var lineItemDistribution = Distribution.parse(lineItem)\r\n creditSummation = creditSummation + Number(lineItem.credit)\r\n debitSummation = debitSummation + Number(lineItem.debit)\r\n\r\n return lineItemDistribution\r\n }),\r\n shortDate: moment(json.postedDate).format('MM/DD/YYYY'),\r\n isCleared: json.isCleared,\r\n reference: json.reference || null,\r\n check: json.check ? {\r\n printedName: json.check.printedName,\r\n handwritten: json.check.handwritten,\r\n checkNumber: json.check.checkNumber,\r\n memo: json.check.memo,\r\n address: json.check.address ? {\r\n addressLine1: json.check.address.addressLine1,\r\n addressLine2: json.check.address.addressLine2,\r\n city: json.check.address.city,\r\n state: json.check.address.state,\r\n postalCode: json.check.address.postalCode\r\n } : null\r\n } : null,\r\n amount: debitSummation - creditSummation\r\n })\r\n\r\n reconciliationEntry.set('creditSummation', creditSummation)\r\n reconciliationEntry.set('debitSummation', debitSummation)\r\n\r\n return reconciliationEntry\r\n }\r\n})\r\n\r\nmodule.exports = ReconciliationEntry\r\n","var Config = require('config/config')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar RestClient = require('rest/client')\r\nvar CompanyService = require('company/company-service')\r\nvar _ = require('lodash')\r\nvar CheckbookReconciliation = require('checkbook/reconciliation/checkbook-reconciliation')\r\nvar $ = require('jquery')\r\n\r\nvar ReconciliationService = function () {\r\n this.restClient = new RestClient()\r\n this.companyService = new CompanyService()\r\n}\r\n\r\nReconciliationService.prototype = _.clone(CheckbookService.prototype)\r\n\r\nReconciliationService.prototype.getCurrentReconciliation = function (id, dateSort, fieldToSort, fieldSort) {\r\n var query = {}\r\n\r\n if (dateSort) {\r\n query.dateSort = dateSort\r\n } else {\r\n query.dateSort = 'desc'\r\n }\r\n\r\n if (fieldToSort) {\r\n query.sortField = fieldToSort\r\n }\r\n\r\n if (fieldSort) {\r\n query.sort = fieldSort\r\n }\r\n\r\n var urlQuery = $.param(query) || ''\r\n if (urlQuery) {\r\n urlQuery = '?' + urlQuery\r\n }\r\n\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/checkbooks/' + id + '/reconciliations/current' + urlQuery).then(function (response) {\r\n return CheckbookReconciliation.parse(response)\r\n })\r\n}\r\n\r\nReconciliationService.prototype.createReconciliation = function (checkbookId, checkbookReconciliation) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.post(\r\n [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'checkbooks',\r\n checkbookId,\r\n 'reconciliations'\r\n ].join('/'),\r\n checkbookReconciliation\r\n )\r\n}\r\n\r\nReconciliationService.prototype.updateReconciliation = function (checkbookId, reconciliationId, checkbookReconciliation) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.put(\r\n [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'checkbooks',\r\n checkbookId,\r\n 'reconciliations',\r\n reconciliationId\r\n ].join('/'),\r\n checkbookReconciliation\r\n )\r\n}\r\n\r\nmodule.exports = ReconciliationService\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block col-xs-12 col-lg-4 col-md-8 no-padding\\\">\\r\\n <div class=\\\"block-header col-xs-12 bg-primary\\\">\\r\\n <i class=\\\"fa fa-close pull-right close\\\"></i><h3>Summary</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content col-xs-12\\\">\\r\\n Your checkbook has been reconciled!\\r\\n <br />\\r\\n <br />\\r\\n <div class=\\\"col-xs-12\\\"><div class=\\\"form-material floating open\\\">\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.checkbookName || (depth0 != null ? depth0.checkbookName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"checkbookName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n <label class=\\\"control-label\\\">Checkbook</label>\\r\\n </div></div>\\r\\n <div class=\\\"col-xs-12\\\"><div class=\\\"form-material floating open\\\">\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.shortEndDate || (depth0 != null ? depth0.shortEndDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortEndDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n <label class=\\\"control-label\\\">Statement End Date</label>\\r\\n </div></div>\\r\\n <div class=\\\"col-xs-12\\\"><div class=\\\"form-material floating open\\\">\\r\\n <p>\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.clearedBalance : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</p>\\r\\n <label class=\\\"control-label\\\">Cleared Balance</label>\\r\\n </div></div>\\r\\n <div class=\\\"col-xs-12\\\">\\r\\n <div class=\\\"form-material pull-right\\\"><button class=\\\"btn btn-primary closeSummary\\\">Close</button></div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar ReconcileSummary = require('checkbook/reconciliation/summary/template')\r\n\r\nvar SummaryView = Backbone.View.extend({\r\n className: 'reconcile-summary',\r\n\r\n events: {\r\n 'click .close': 'closeModal',\r\n 'click .closeSummary': 'closeModal'\r\n },\r\n\r\n initialize: function () {},\r\n\r\n render: function () {\r\n this.$el.html(ReconcileSummary(this.createViewModel()))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n return this.model.toJSON()\r\n },\r\n\r\n closeModal: function () {\r\n this.trigger('closeModal')\r\n }\r\n})\r\n\r\nmodule.exports = SummaryView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar SummaryView = require('checkbook/reconciliation/summary/view')\r\n\r\nvar SummaryWidget = function (summaryData) {\r\n this.model = new Backbone.Model(summaryData)\r\n this.view = new SummaryView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('closeModal', function () {\r\n this.trigger('closeModal')\r\n }, this)\r\n}\r\n\r\nSummaryWidget.prototype = _.clone(Backbone.Events)\r\n\r\nSummaryWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = SummaryWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <option value=\\\"\\\">---</option>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \"<div class=\\\"col-xs-4 row\\\">\\r\\n <div class=\\\"form-group\\\" style=\\\"height: 54px;\\\">\\r\\n <div class=\\\"form-material floating input-group open\\\" style=\\\"width: 100%;\\\">\\r\\n <select class=\\\"form-control my-checkbooks\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label class=\\\"control-label\\\">Checkbook</label>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"col-xs-8\\\"> </div>\\r\\n\\r\\n<div class=\\\"reconcile-view col-xs-12 no-padding\\\"></div>\\r\\n<div class=\\\"reconcile-list-view col-xs-12 no-padding\\\"></div>\\r\\n<div class=\\\"reconcile-bottom-bar-space-holder col-xs-12 no-padding\\\"></div>\\r\\n<div class=\\\"reconcile-bottom-bar bg-primary-lighter\\\">\\r\\n <div class=\\\"col-xs-4\\\">Starting \"\n + alias3(((helper = (helper = helpers.shortStartDate || (depth0 != null ? depth0.shortStartDate : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"shortStartDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-4\\\"><div class=\\\"form-material floating open\\\">\\r\\n <p id=\\\"clearedBalance\\\">\"\n + alias3((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.clearedBalance : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</p>\\r\\n <label class=\\\"control-label\\\">Cleared Balance</label>\\r\\n </div></div>\\r\\n <div class=\\\"col-xs-4\\\"><div class=\\\"form-material floating open\\\">\\r\\n <p id=\\\"unreconciledBalance\\\">\"\n + alias3((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.unreconciledBalance : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</p>\\r\\n <label class=\\\"control-label\\\">Unreconciled Amount</label>\\r\\n </div></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Reconciliation = require('checkbook/reconciliation/template')\r\nvar EntriesWidget = require('checkbook/reconciliation/entries/widget')\r\nvar InfoWidget = require('checkbook/reconciliation/info/widget')\r\nvar $ = require('jquery')\r\nvar numbro = require('numbro')\r\nvar moment = require('moment')\r\nvar SummaryWidget = require('checkbook/reconciliation/summary/widget')\r\n\r\nvar ReconciliationView = Backbone.View.extend({\r\n className: 'checkbooks',\r\n\r\n events: {\r\n 'change .my-checkbooks': 'selectCheckbook'\r\n },\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:checkbooks change:reconciliation', this.render)\r\n this.listenTo(this.model, 'change:endingBalance change:clearedBalance', this.recalcUnreconciledBalance)\r\n this.entriesWidget = new EntriesWidget(this.model)\r\n this.infoWidget = new InfoWidget(this.model)\r\n\r\n this.infoWidget.on('saveRec', this.triggerSaveReconciliation, this)\r\n this.infoWidget.on('addItem', this.addItem, this)\r\n\r\n this.on('notifyCompleted', this.notifyCompleted, this)\r\n },\r\n\r\n saveReconciliation: function () {\r\n this.infoWidget.saveReconciliation()\r\n },\r\n\r\n triggerSaveReconciliation: function (endDate, startingBalance, endingBalance, isClosing, callback) {\r\n this.trigger('saveReconciliation', this.entriesWidget.getClearedItems(), endDate, startingBalance, endingBalance, isClosing, callback)\r\n },\r\n\r\n addItem: function () {\r\n Backbone.trigger('app:navigate', '/checkbook/' + this.model.get('checkbookId') + '#new-eft-payments')\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Reconciliation(this.createViewModel()))\r\n\r\n this.$('.my-checkbooks').val(this.model.get('checkbookId'))\r\n\r\n this.$('.reconcile-view').append(this.infoWidget.show())\r\n this.$('.reconcile-list-view').append(this.entriesWidget.show())\r\n\r\n return this\r\n },\r\n\r\n recalcUnreconciledBalance: function () {\r\n this.$('#clearedBalance').text(numbro(this.model.get('clearedBalance')).format('($0.00)'))\r\n this.$('#unreconciledBalance').text(numbro(this.model.get('clearedBalance') - this.model.get('endingBalance')).format('($0.00)'))\r\n this.model.set('unreconciledBalance', parseFloat(this.model.get('clearedBalance').toFixed(2)) - parseFloat(this.model.get('endingBalance').toFixed(2)))\r\n },\r\n\r\n selectCheckbook: function () {\r\n var id = this.$('select').val()\r\n if (id === 'null') {\r\n // Only the 'new' checkbook lacks a value\r\n this.trigger('createNew')\r\n return\r\n }\r\n\r\n Backbone.trigger('app:navigate', 'checkbook/' + id + '/reconcile')\r\n },\r\n\r\n createViewModel: function () {\r\n var reconciliationData = this.model.get('reconciliation')\r\n return $.extend({\r\n checkbooks: (this.model.get('checkbooks') || []).map(function (item) {\r\n return {\r\n id: item.get('id'),\r\n name: item.get('name')\r\n }\r\n }),\r\n shortStartDate: (reconciliationData ? moment(reconciliationData.get('startDate')).utc() : moment()).format('MM/DD/YYYY'),\r\n clearedBalance: this.model.get('clearedBalance'),\r\n unreconciledBalance: reconciliationData ? reconciliationData.get('unreconciledBalance') : 0\r\n })\r\n },\r\n\r\n notifyCompleted: function (summary) {\r\n var summaryWidget = new SummaryWidget(summary)\r\n var $summary = $(summaryWidget.show())\r\n\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).one('click', function () {\r\n this.closeSummary()\r\n $summary.remove()\r\n }.bind(this))\r\n\r\n // Because the modal is aligned to the center, the parent of the modal is full width.\r\n // If the user clicks on the modal and the only target is the modal background, close out.\r\n $summary.on('click', function (e) {\r\n var target = $(e.target)\r\n // Comparing against two jQuery objects of the same DOM doesn't work\r\n // Compare the actual DOM elements\r\n if (target[0] === $summary[0]) {\r\n this.closeSummary()\r\n $summary.remove()\r\n }\r\n }.bind(this))\r\n\r\n summaryWidget.on('closeModal', function () {\r\n this.closeSummary()\r\n $summary.remove()\r\n }, this)\r\n\r\n this.$el.append($summary)\r\n },\r\n\r\n closeSummary: function () {\r\n $('.overlay').css({\r\n opacity: 0,\r\n display: 'none'\r\n })\r\n\r\n this.trigger('summaryClosed')\r\n }\r\n})\r\n\r\nmodule.exports = ReconciliationView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar ReconciliationService = require('checkbook/reconciliation/service')\r\nvar ReconciliationView = require('checkbook/reconciliation/view')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar q = require('q')\r\nvar moment = require('moment')\r\n\r\nvar ReconciliationWidget = function (checkbookId) {\r\n this.model = new Backbone.Model({\r\n checkbookId: checkbookId,\r\n dateSort: 'desc',\r\n fieldToSort: '',\r\n fieldSort: '',\r\n startDate: moment().startOf('month'),\r\n endDate: moment(),\r\n startingBalance: 0,\r\n endingBalance: 0\r\n })\r\n\r\n this.view = new ReconciliationView({\r\n model: this.model\r\n })\r\n this.view.on('saveReconciliation', this.saveReconciliation, this)\r\n this.view.on('summaryClosed', this.summaryClosed, this)\r\n\r\n this.reconciliationService = new ReconciliationService()\r\n this.checkbookService = new CheckbookService()\r\n\r\n this.update()\r\n\r\n this.model.on('change:dateSort change:fieldToSort change:fieldSort', _.throttle(this.sort, 100, {'trailing': false, 'leading': true}), this)\r\n}\r\n\r\nReconciliationWidget.prototype = _.clone(Backbone.Events)\r\n\r\nReconciliationWidget.prototype.sort = function () {\r\n this.view.saveReconciliation()\r\n}\r\n\r\nReconciliationWidget.prototype.update = function () {\r\n console.log('Updating reconciliation data')\r\n\r\n q.all([\r\n this.reconciliationService.getCurrentReconciliation(\r\n this.model.get('checkbookId'),\r\n this.model.get('dateSort'),\r\n this.model.get('fieldToSort'),\r\n this.model.get('fieldSort')\r\n )\r\n ]).then(function (results) {\r\n this.gotReconciliation.apply(this, results)\r\n }.bind(this))\r\n}\r\n\r\nReconciliationWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.reconciliationService.fetchCheckbookList().then(function (checkbooks) {\r\n this.model.set('checkbooks', checkbooks)\r\n }.bind(this))\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nReconciliationWidget.prototype.gotReconciliation = function (reconciliationData) {\r\n console.log('Reconciliation data updated')\r\n this.model.set({\r\n 'reconciliation': reconciliationData\r\n })\r\n}\r\n\r\nReconciliationWidget.prototype.saveReconciliation = function (clearedIds, endDate, startingBalance, endingBalance, isClosing, callback) {\r\n var entries = _.keyBy(this.model.get('reconciliation').get('entries'), 'attributes.id')\r\n var currentCheckbookId = this.model.get('checkbookId')\r\n var currentCheckbook = _.find(this.model.get('checkbooks'), function (book) { return book.id === currentCheckbookId })\r\n\r\n var reconciliationData = {\r\n isClosed: isClosing,\r\n endingBalance: endingBalance,\r\n startingBalance: startingBalance,\r\n entries: _.map(clearedIds, function (clearedId) {\r\n return {\r\n isCleared: true,\r\n id: clearedId,\r\n lineItems: _.map(entries[clearedId].get('lineItems'), function (detail) {\r\n return detail.toJSON()\r\n })\r\n }\r\n }),\r\n startDate: this.model.get('reconciliation').get('startDate'),\r\n endDate: endDate\r\n }\r\n console.log(reconciliationData)\r\n\r\n var summaryData = {\r\n shortEndDate: moment(endDate).format('MM/DD/YYYY'),\r\n checkbookName: currentCheckbook.get('name'),\r\n reconciledBalance: this.model.get('checkbookBalance'),\r\n clearedBalance: this.model.get('clearedBalance')\r\n }\r\n\r\n var reconcilePromise = null\r\n if (this.model.get('reconciliation').id !== '00000000-0000-0000-0000-000000000000') {\r\n reconcilePromise = this.reconciliationService.updateReconciliation(this.model.get('checkbookId'), this.model.get('reconciliation').id, reconciliationData)\r\n } else {\r\n reconcilePromise = this.reconciliationService.createReconciliation(this.model.get('checkbookId'), reconciliationData)\r\n }\r\n\r\n if (reconcilePromise) {\r\n var promise = reconcilePromise.then(function () {\r\n if (isClosing) {\r\n this.view.trigger('notifyCompleted', summaryData)\r\n } else {\r\n this.update()\r\n }\r\n }.bind(this))\r\n\r\n if (callback) {\r\n promise.then(callback)\r\n }\r\n }\r\n\r\n console.log(reconciliationData)\r\n\r\n return reconcilePromise\r\n}\r\n\r\nReconciliationWidget.prototype.summaryClosed = function () {\r\n this.update()\r\n}\r\n\r\nmodule.exports = ReconciliationWidget\r\n","var CheckbookLineItem = require('checkbook/checkbook-line-item')\r\nvar PageableCollection = require('backbone.paginator')\r\nvar Config = require('config/config')\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar SessionService = require('session/session-service')\r\n\r\nvar CheckbookHistories = PageableCollection.extend({\r\n initialize: function (companyId, checkbookId, pending) {\r\n this.companyId = companyId\r\n this.checkbookId = checkbookId\r\n this.pending = pending\r\n },\r\n model: CheckbookLineItem,\r\n url: function () {\r\n return Config['CRUNCHED_API_HOST'] + '/companies/' + this.companyId + '/checkbooks/' + this.checkbookId + '/checks/pending'\r\n },\r\n sync: function (method, model, options) {\r\n return Backbone.sync(method, model, _.extend({}, options, {\r\n headers: {\r\n 'Authorization': 'Bearer ' + SessionService.getToken()\r\n }\r\n }))\r\n },\r\n state: {\r\n firstPage: 0,\r\n pageSize: 5,\r\n sortKey: 'postedOn',\r\n order: 'desc'\r\n },\r\n queryParams: {\r\n pageSize: 'pageSize',\r\n sortKey: 'sortField',\r\n order: 'order'\r\n },\r\n parseState: function (resp, queryParams, state, options) {\r\n return {\r\n totalRecords: resp.totalRecords\r\n }\r\n },\r\n parseRecords: function (resp, options) {\r\n return _.map(resp.items, CheckbookLineItem.parse)\r\n }\r\n})\r\n\r\nmodule.exports = CheckbookHistories\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar numbro = require('numbro')\r\nvar $ = require('jquery')\r\nvar _ = require('underscore')\r\nvar moment = require('moment')\r\n\r\nvar CheckbookUnprintedHistoryTemplate = require('checkbook/unprinted-history/checkbook-unprinted-history')\r\nvar UnprintedConfirmationIndicator = require('checkbook/printing-indicator/widget')\r\nvar CheckbookHistoryActionsTemplate = require('checkbook/history/checkbook-history-actions')\r\nvar PrintingCheckbox = require('checkbook/unprinted-history/printing-checkbox')\r\nvar ActionCellView = require('forms/action-cell/view')\r\nvar Backgrid = require('backgrid')\r\nrequire('backgrid-paginator')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar CheckbookUnprintedHistoryView = Backbone.View.extend({\r\n className: 'block checkbook unprinted-history-container',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:availableBalance change:planLevels', this.render)\r\n this.on('historiesUpdated', this.checkVisibility, this)\r\n this.unprintedIndicator = new UnprintedConfirmationIndicator(this.model)\r\n this.unprintedIndicator.on('checksPrinted', this.onChecksPrinted, this)\r\n },\r\n\r\n events: {\r\n 'click .edit': 'editPending',\r\n 'click .delete': 'deletePending',\r\n 'change input[name=IsPrintingAll]': 'togglePrintingAll',\r\n 'change input[name=IsPrinting]': 'togglePrintingCheck'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CheckbookUnprintedHistoryTemplate(this.createViewModel()))\r\n\r\n this.unprintedIndicator.reset()\r\n this.$('.print-confirmation-indicator-container').html(this.unprintedIndicator.show())\r\n\r\n this.$('[data-toggle=\"tooltip\"], .js-tooltip').tooltip({\r\n container: 'body',\r\n animation: false\r\n })\r\n\r\n // Initialize Popovers\r\n this.$('[data-toggle=\"popover\"], .js-popover').popover({\r\n container: 'body',\r\n animation: true,\r\n trigger: 'hover'\r\n })\r\n\r\n this.generateGrid()\r\n \r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n availableBalance: numbro(this.model.get('availableBalance')).formatCurrency('($0,0.00)')\r\n }\r\n },\r\n\r\n checkVisibility: function () {\r\n if (this.model.get('histories').length !== 0 && this.model.get('histories').models.length !== 0 && this.model.get('histories').models[0].id) {\r\n this.$el.addClass('done-loading')\r\n } else {\r\n this.$el.removeClass('done-loading')\r\n }\r\n\r\n this.initializeUnprintedDatepickers()\r\n },\r\n\r\n initializeUnprintedDatepickers: function () {\r\n $('.posted-date').datepicker({ format: 'mm/dd/yyyy', autoclose: true })\r\n .on('changeDate', function (e) {\r\n var queuedChecks = this.model.get('histories')\r\n var [updatedCheck] = _.filter(queuedChecks.models, function (check) {\r\n return check.attributes.id === e.currentTarget.dataset.checkId\r\n })\r\n\r\n queuedChecks.models = _.without(queuedChecks.models, updatedCheck)\r\n updatedCheck.attributes.postedOn = moment(e.date)\r\n queuedChecks.models.push(updatedCheck)\r\n\r\n this.model.set({ 'attributes.histories.models': queuedChecks })\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: 'MM/DD/YYYY' })\r\n .closest('.floating')\r\n .addClass('open')\r\n },\r\n\r\n generateGrid: function () {\r\n var table = new Backgrid.Grid({\r\n columns: this.getColumns(this),\r\n collection: this.model.get('histories')\r\n })\r\n\r\n this.model.paginator = new Backgrid.Extension.Paginator({\r\n collection: this.model.get('histories')\r\n })\r\n\r\n this.$('.unprinted-history-table')\r\n .append(table.render().el)\r\n .append(this.model.paginator.render().el)\r\n\r\n this.checkVisibility()\r\n },\r\n\r\n getColumns: function (parent) {\r\n return [{\r\n name: 'is-printing',\r\n label: '',\r\n editable: false,\r\n sortable: false,\r\n cell: ActionCellView.extend({\r\n template: PrintingCheckbox,\r\n createViewModel: function () {\r\n if (this.model.get('id') !== undefined) {\r\n return {\r\n id: this.model.get('id'),\r\n extraName: '',\r\n checked: parent.unprintedIndicator.hasCheck(this.model.get('id')) ? 'checked' : ''\r\n }\r\n }\r\n }\r\n }),\r\n headerCell: ActionCellView.extend({\r\n template: PrintingCheckbox,\r\n createViewModel: function () {\r\n return {\r\n id: '',\r\n extraName: 'All',\r\n checked: ''\r\n }\r\n }\r\n })\r\n },\r\n {\r\n name: 'postedOn',\r\n label: 'Date',\r\n editable: false,\r\n sortable: false,\r\n direction: 'ascending',\r\n cell: Backgrid.Cell.extend({\r\n render: function () {\r\n if (this.model.get('postedOn') !== undefined) {\r\n this.$el.append(`<div class=\"form-group\">\r\n <div id=\"checkPostedDate-${this.model.get('id')}\" \r\n data-check-id=\"${this.model.get('id')}\" \r\n class=\"form-material floating input-group date posted-date\">\r\n <input class=\"form-control\" \r\n type=\"text\" \r\n value=\"${moment(this.model.get('postedOn')).format('MM/DD/YYYY')}\"\r\n name=\"checkPostedDate\">\r\n <span class=\"input-group-addon\"><i class=\"fa fa-calendar\"></i></span>\r\n </div>\r\n </div>`)\r\n }\r\n return this\r\n }\r\n })\r\n },\r\n {\r\n name: 'description',\r\n label: 'Payee',\r\n cell: 'string',\r\n sortable: false,\r\n editable: false\r\n },\r\n {\r\n name: 'credit',\r\n label: 'Amount',\r\n cell: 'string',\r\n sortable: false,\r\n editable: false\r\n },\r\n {\r\n name: 'actions',\r\n label: '',\r\n editable: false,\r\n cell: ActionCellView.extend({\r\n template: CheckbookHistoryActionsTemplate,\r\n createViewModel: function () {\r\n if (this.model.get('id') !== undefined) {\r\n return {\r\n id: this.model.get('id'),\r\n showEdit: true,\r\n showVoid: false,\r\n showDelete: true\r\n }\r\n }\r\n }\r\n })\r\n },\r\n {\r\n name: 'id',\r\n label: 'Id',\r\n cell: 'string',\r\n sortable: false,\r\n editable: false,\r\n renderable: false\r\n }]\r\n },\r\n\r\n togglePrintingAll: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n if (this.model.get('isDisabled')) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'This checkbook is disabled. It must be enabled to print the check.',\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n $currentTarget.removeAttr('checked')\r\n var isChecked = $currentTarget.prop('checked')\r\n _.each(this.$('.itemrow'), function (element) {\r\n var $element = $(element)\r\n var $selected = $element.find('input[name=IsPrinting]')\r\n $selected.prop('checked', isChecked)\r\n })\r\n } else {\r\n isChecked = $currentTarget.prop('checked')\r\n _.each(this.$('.unprinted-history-table tbody tr'), function (element) {\r\n var $element = $(element)\r\n var $selected = $element.find('input[name=IsPrinting]')\r\n var itemId = $selected.attr('data-id')\r\n var itemModel = _.find(this.model.get('histories').models, function (item) { return item.id === itemId })\r\n\r\n $selected.prop('checked', isChecked)\r\n this.updatePrintingCheck(itemModel, {\r\n currentTarget: $selected\r\n })\r\n }.bind(this))\r\n }\r\n },\r\n\r\n togglePrintingCheck: function (e) {\r\n if (this.model.get('isDisabled')) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'This checkbook is disabled. It must be enabled to print the check.',\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n $(e.currentTarget).removeAttr('checked')\r\n } else {\r\n var checkId = $(e.currentTarget).attr('data-id')\r\n var itemModel = _.find(this.model.get('histories').models, function (item) { return item.id === checkId })\r\n\r\n this.updatePrintingCheck(itemModel, e)\r\n\r\n var anyNotChecked = this.$('input[name=IsPrinting]:not(:checked)').length\r\n this.$('input[name=IsPrintingAll]').prop('checked', !anyNotChecked)\r\n }\r\n },\r\n\r\n updatePrintingCheck: function (check, element) {\r\n if ($(element.currentTarget).prop('checked')) {\r\n this.unprintedIndicator.addUnprinted(check)\r\n } else {\r\n this.unprintedIndicator.removeUnprinted(check)\r\n }\r\n\r\n if (this.unprintedIndicator.countUnprinted()) {\r\n this.$el.addClass('z-1 modal-style')\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click')\r\n } else {\r\n this.$el.removeClass('z-1 modal-style')\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n }\r\n },\r\n\r\n editPending: function (event) {\r\n event.stopImmediatePropagation()\r\n var $currentTarget = $(event.currentTarget)\r\n var itemRow = $currentTarget.parent().parent().parent()\r\n var editingId = $currentTarget.attr('data-id')\r\n\r\n if (this.model.get('isDisabled')) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'This checkbook is disabled. It must be enabled to edit the check.',\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n } else {\r\n this.trigger('startEditing', editingId, itemRow)\r\n }\r\n },\r\n\r\n startEditing: function (editWidget) {\r\n var $editView = $(editWidget.show())\r\n this.$editView = $editView\r\n\r\n this.$('.unprinted-history-table').append($editView)\r\n editWidget.off('close')\r\n editWidget.once('close', this.doneEditing, this)\r\n\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.doneEditing.bind(this))\r\n\r\n var recalcNeededPadding = function ($lineItem) {\r\n var currentHeight = this.$('.unprinted-history-table').height()\r\n var editHeight = $editView.find('.block').height() + Number($editView.css('top').replace('px', '')) - 44\r\n var heightDifference = editHeight - currentHeight\r\n\r\n if (heightDifference > 0) {\r\n this.$el.css({\r\n 'padding-bottom': heightDifference\r\n })\r\n }\r\n }.bind(this)\r\n\r\n setTimeout(function () {\r\n editWidget.focusedLineItem.ScrollTo()\r\n }, 100)\r\n recalcNeededPadding()\r\n\r\n editWidget.off('lineItemAdded')\r\n editWidget.on('lineItemAdded', recalcNeededPadding)\r\n\r\n Backbone.once('app:navigate', this.doneEditing, this)\r\n },\r\n\r\n doneEditing: function () {\r\n this.$editView.remove()\r\n this.$el.attr('style', '')\r\n\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n },\r\n\r\n onChecksPrinted: function (checks) {\r\n this.$('input[type=checkbox]').prop('checked', false)\r\n this.render()\r\n if (this.model.get('isDisabled')) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'This checkbook is disabled. It must be enabled to delete the check.',\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n } else {\r\n this.$el.removeClass('z-1 modal-style')\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n\r\n this.trigger('checksPrinted', checks)\r\n }\r\n },\r\n\r\n deletePending: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var entryId = $currentTarget.attr('data-id')\r\n\r\n if (this.model.get('isDisabled')) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'This checkbook is disabled. It must be enabled to delete the check.',\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n } else {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'Are you sure you want to delete this transaction?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'No'\r\n }).then(function () {\r\n var itemRow = $currentTarget.closest('.itemrow')\r\n this.trigger('delete', entryId, itemRow)\r\n }.bind(this))\r\n\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = CheckbookUnprintedHistoryView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar q = require('q')\r\nvar CheckbookUnprintedHistoryView = require('checkbook/unprinted-history/checkbook-unprinted-history-view')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar CompanyService = require('company/company-service')\r\nvar SubscriptionService = require('settings/subscription/service')\r\nvar EditCheckWidget = require('checkbook/edit-check/edit-check-widget')\r\nvar CheckbookPendingHistories = require('checkbook/unprinted-history/checkbook-histories')\r\n\r\nvar CheckbookUnprintedHistoryWidget = function (checkbook) {\r\n this.checkbookService = new CheckbookService()\r\n this.subscriptionService = new SubscriptionService()\r\n this.companyService = new CompanyService()\r\n this.unprintedChecks = {}\r\n this.model = new Backbone.Model(_.extend({\r\n availableBalance: 0,\r\n histories: new CheckbookPendingHistories(this.companyService.getActiveCompanyId(), checkbook.id)\r\n }, checkbook.attributes))\r\n\r\n this.view = new CheckbookUnprintedHistoryView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('startEditing', this.startEditing, this)\r\n this.view.on('delete', this.deleteCheck, this)\r\n this.view.on('checksPrinted', this.onCheckPrinted, this)\r\n\r\n this.editWidget = new EditCheckWidget(this.model, 'Edit Unprinted Check')\r\n\r\n this.loadHistory()\r\n\r\n this.editWidget.on('updated', function () {\r\n this.update()\r\n }, this)\r\n}\r\n\r\nCheckbookUnprintedHistoryWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCheckbookUnprintedHistoryWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.update()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nCheckbookUnprintedHistoryWidget.prototype.update = function () {\r\n q.all([\r\n this.checkbookService.fetchAvailableAccountBalance(this.model.get('id')),\r\n this.checkbookService.fetchStartingCheckNumber(this.model.get('id'))\r\n ]).then(function (results) {\r\n this.model.set({\r\n 'availableBalance': results[0],\r\n 'startingNumber': results[1].startingNumber\r\n })\r\n this.unprintedChecks = {}\r\n this.getPlanLevels()\r\n this.loadHistory()\r\n }.bind(this))\r\n}\r\n\r\nCheckbookUnprintedHistoryWidget.prototype.loadHistory = function () {\r\n this.model.get('histories').fetch({reset: true}).done(function () {\r\n this.view.trigger('historiesUpdated')\r\n }.bind(this))\r\n}\r\n\r\nCheckbookUnprintedHistoryWidget.prototype.getPlanLevels = function () {\r\n this.subscriptionService.fetchPlanLevels().then(function (response) {\r\n this.model.set('planLevels', response)\r\n }.bind(this), function () {\r\n console.log('Fail to fetch plan lists.')\r\n })\r\n}\r\n\r\nCheckbookUnprintedHistoryWidget.prototype.startEditing = function (modelId, itemRow) {\r\n var model = _.find(this.model.get('histories').models, function (item) { return item.id === modelId })\r\n\r\n this.editWidget.startEditing(model, itemRow).then(function () {\r\n this.view.startEditing(this.editWidget)\r\n }.bind(this))\r\n}\r\n\r\nCheckbookUnprintedHistoryWidget.prototype.deleteCheck = function (modelId, itemRow) {\r\n var model = this.unprintedChecks[modelId]\r\n\r\n console.log('Deleting', model)\r\n\r\n this.checkbookService.deleteCheck(this.model.id, modelId).then(function () {\r\n this.update()\r\n }.bind(this))\r\n}\r\n\r\nCheckbookUnprintedHistoryWidget.prototype.onCheckPrinted = function (checks) {\r\n this.trigger('checksPrinted', checks)\r\n}\r\n\r\nmodule.exports = CheckbookUnprintedHistoryWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <div class=\\\"no-padding\\\">\\r\\n <h3 class=\\\"pull-left\\\">Unprinted Checks</h3>\\r\\n <b class=\\\"pull-right\\\" id=\\\"availableBalance\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"left\\\" data-original-title=\\\"Current Balance - Unprinted Checks = Available Balance\\\">\\r\\n <img src=\\\"/img/question-circle.svg\\\" class=\\\"unprinted-tooltip\\\" alt=\\\"?\\\" />\\r\\n Available Balance: \"\n + container.escapeExpression(((helper = (helper = helpers.availableBalance || (depth0 != null ? depth0.availableBalance : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"availableBalance\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\r\\n </b>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"print-confirmation-indicator-container col-xs-12 no-padding\\\"></div>\\r\\n <br />\\r\\n <div class=\\\"unprinted-history-table backgrid-table\\\"></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"is-printing\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <input type=\\\"checkbox\\\" name=\\\"IsPrinting\"\n + alias4(((helper = (helper = helpers.extraName || (depth0 != null ? depth0.extraName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"extraName\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" \"\n + alias4(((helper = (helper = helpers.checked || (depth0 != null ? depth0.checked : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"checked\",\"hash\":{},\"data\":data}) : helper)))\n + \"><span></span>\\r\\n </label>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <option value=\\\"\\\">---</option>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"6\":function(container,depth0,helpers,partials,data) {\n return \"<span style=\\\"font-style: italic; font-weight: normal;\\\"> - Please create a checkbook.</span>\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n return \"style=\\\"display: none;\\\"\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"col-xs-4 row\\\">\\r\\n <div class=\\\"form-group\\\" style=\\\"height: 54px;\\\">\\r\\n <div class=\\\"form-material floating input-group open\\\" style=\\\"width: 100%;\\\">\\r\\n <select class=\\\"form-control my-checkbooks\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" <option value=\\\"null\\\">Create New</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\">Checkbook \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.dataLoaded : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</label>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"col-lg-8 pull-right no-padding\\\">\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material\\\">\\r\\n <button class=\\\"btn btn-primary pull-right\\\" \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" type=\\\"button\\\" id=\\\"GoToReconcile\\\">Reconcile</button>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n<div id=\\\"CheckbookDetails\\\">\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\n\r\nvar Address = Backbone.Model.extend({\r\n\r\n})\r\n\r\nmodule.exports = Address\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar ViewCompanyWidget = require('company/read/widget')\r\nvar CreateCompanyWidget = require('company/wizard/widget')\r\n\r\nvar CompanyRouter = Router.extend({\r\n routes: {\r\n 'company': 'showCompany',\r\n 'business-creation': 'createCompany'\r\n },\r\n\r\n showCompany: function () {\r\n Backbone.trigger('app:showInFrame', new ViewCompanyWidget())\r\n Backbone.trigger('app:updateTitle', 'Company', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Company'}, {label: 'Details'}])\r\n },\r\n\r\n createCompany: function () {\r\n Backbone.trigger('app:showInFrame', new CreateCompanyWidget())\r\n Backbone.trigger('app:updateTitle', 'Company', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Company'}, {label: 'Create'}])\r\n }\r\n})\r\n\r\nmodule.exports = CompanyRouter\r\n","'use strict'\r\n\r\nvar RestClient = require('rest/client')\r\nvar Config = require('config/config')\r\nvar _ = require('underscore')\r\nvar Company = require('company/company')\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\n\r\nvar CompanyService = function () {\r\n this.client = new RestClient()\r\n}\r\n\r\nCompanyService.prototype.fetchCompanies = function () {\r\n return this.client.get(Config['CRUNCHED_API_HOST'] + '/companies').then(function (response) {\r\n return _.map(response, Company.parse)\r\n })\r\n}\r\n\r\nCompanyService.prototype.fetchCompany = function (companyId) {\r\n if (!companyId || (typeof companyId !== 'string')) {\r\n companyId = this.getActiveCompanyId()\r\n }\r\n\r\n if (companyId == null || companyId === undefined) {\r\n return this.client.get(Config['CRUNCHED_API_HOST'] + '/companies').then(function (response) {\r\n if (response.length > 0) {\r\n var defaultCompany = _.find(response, function (obj) {\r\n return obj.isDefault === true\r\n })\r\n\r\n if (defaultCompany != null || defaultCompany !== undefined) {\r\n return Company.parse(defaultCompany)\r\n }\r\n }\r\n\r\n return _.chain(response)\r\n .map(Company.parse)\r\n .first()\r\n .value()\r\n })\r\n } else {\r\n return this.client.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId).then(function (response) {\r\n return Company.parse(response)\r\n })\r\n }\r\n}\r\n\r\nCompanyService.prototype.updateActiveCompany = function (companyId) {\r\n return this.client.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId).then(function (response) {\r\n this.setActiveCompany(response)\r\n this.setActiveCompanyInfo(response)\r\n Backbone.trigger('activeCompanyChanged')\r\n }.bind(this))\r\n}\r\n\r\nCompanyService.prototype.setActiveCompanyInfo = function (company) {\r\n return this.fetchCompanies().then(function (companies) {\r\n var activeCompanyInfo = _.findWhere(companies, {id: company.id})\r\n\r\n if (activeCompanyInfo.toJson) {\r\n activeCompanyInfo = activeCompanyInfo.toJSON()\r\n }\r\n localStorage.setItem('crunchedActiveCompanyInfo', JSON.stringify(activeCompanyInfo))\r\n Backbone.trigger('activeCompanyChanged')\r\n })\r\n}\r\n\r\nCompanyService.prototype.getActiveCompanyInfo = function () {\r\n return JSON.parse(localStorage.getItem('crunchedActiveCompanyInfo'))\r\n}\r\n\r\nCompanyService.prototype.setActiveCompany = function (company) {\r\n if (company.toJSON) {\r\n company = company.toJSON()\r\n }\r\n\r\n localStorage.setItem('crunchedActiveCompany', company.id)\r\n localStorage.setItem('hasAccountsReceivableAccounts', company.hasAccountsReceivableAccounts ? 1 : 0)\r\n localStorage.setItem('hasAccountsPayableAccounts', company.hasAccountsPayableAccounts ? 1 : 0)\r\n this.setActiveCompanyInfo(company)\r\n}\r\n\r\nCompanyService.prototype.getActiveCompanyId = function (company) {\r\n return localStorage.getItem('crunchedActiveCompany')\r\n}\r\n\r\nCompanyService.prototype.getHasAccountsReceivableAccounts = function () {\r\n return !!Number(localStorage.getItem('hasAccountsReceivableAccounts'))\r\n}\r\n\r\nCompanyService.prototype.getHasAccountsPayableAccounts = function () {\r\n return !!Number(localStorage.getItem('hasAccountsPayableAccounts'))\r\n}\r\n\r\nCompanyService.prototype.createCompany = function (company) {\r\n return this.client.post(Config['CRUNCHED_API_HOST'] + '/companies', company).then(function (response) {\r\n return response.message\r\n })\r\n}\r\n\r\nCompanyService.prototype.updateCompany = function (company) {\r\n return this.client.put(Config['CRUNCHED_API_HOST'] + '/companies/' + company.get('id'), company).then(function (response) {\r\n return response.message\r\n })\r\n}\r\n\r\nCompanyService.prototype.setDefaultCompany = function (companyId) {\r\n return this.client.put(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/default').then(function (response) {\r\n return response.message\r\n })\r\n}\r\n\r\nCompanyService.prototype.getAllCompanyPaymentProcessor = function () {\r\n var companyId = this.getActiveCompanyId()\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'payment-processors'\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n var apiPath = actionPath\r\n return this.client.get(apiPath).then(function (response) {\r\n if (response.length === 0) {\r\n response.noData = true\r\n }\r\n return response\r\n })\r\n}\r\n\r\nCompanyService.prototype.createCompanyPaymentProcessor = function (payInfo) {\r\n var companyId = this.getActiveCompanyId()\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'payment-processors'\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n var apiPath = actionPath\r\n return this.client.post(apiPath, payInfo).then(function (response) {\r\n return response.message\r\n })\r\n}\r\n\r\nCompanyService.prototype.updateCompanyPaymentProcessor = function (payInfo, payId) {\r\n var companyId = this.getActiveCompanyId()\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'payment-processors',\r\n payId\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n var apiPath = actionPath\r\n return this.client.put(apiPath, payInfo).then(function (response) {\r\n return response.message\r\n })\r\n}\r\n\r\nmodule.exports = CompanyService\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Address = require('company/address')\r\n\r\nvar Company = Backbone.Model.extend({\r\n toJSON: function () {\r\n return {\r\n id: this.get('id'),\r\n name: this.get('name'),\r\n emailAddress: this.get('emailAddress'),\r\n phone: this.get('phone'),\r\n website: this.get('website'),\r\n addressLine1: this.get('address').get('addressLine1'),\r\n addressLine2: this.get('address').get('addressLine2'),\r\n city: this.get('address').get('city'),\r\n state: this.get('address').get('state'),\r\n postalCode: this.get('address').get('postalCode'),\r\n hasAccountsReceivableAccounts: this.get('hasAccountsReceivableAccounts'),\r\n hasAccountsPayableAccounts: this.get('hasAccountsPayableAccounts'),\r\n isAccrual: this.get('isAccrual'),\r\n isDefault: this.get('isDefault'),\r\n accountingPeriodDay: this.get('accountingPeriodDay'),\r\n accountingPeriodMonth: this.get('accountingPeriodMonth'),\r\n signatureFileUpload: this.get('signatureFileUpload'),\r\n signatureFile: this.get('signatureFile'),\r\n role: this.get('role'),\r\n paymentsEnabled: this.get('paymentsEnabled'),\r\n allowCreditCards: this.get('allowCreditCards'),\r\n activeSubscription: this.get('activeSubscription'),\r\n subscriptionProcessing: this.get('subscriptionProcessing'),\r\n planLevelId: this.get('planLevelId'),\r\n isTrial: this.get('isTrial'),\r\n allowInvoices: this.get('allowInvoices'),\r\n partnerType: this.get('partnerType')\r\n }\r\n }\r\n}, {\r\n parse: function (json) {\r\n return new Company({\r\n id: json.id,\r\n name: json.name,\r\n emailAddress: json.emailAddress,\r\n phone: json.phone,\r\n website: json.website,\r\n address: new Address({\r\n addressLine1: json.addressLine1,\r\n addressLine2: json.addressLine2,\r\n city: json.city,\r\n state: json.state,\r\n postalCode: json.postalCode\r\n }),\r\n hasAccountsReceivableAccounts: json.hasAccountsReceivableAccounts,\r\n hasAccountsPayableAccounts: json.hasAccountsPayableAccounts,\r\n isAccrual: json.isAccrual,\r\n isDefault: json.isDefault,\r\n accountingPeriodDay: json.accountingPeriodDay,\r\n accountingPeriodMonth: json.accountingPeriodMonth,\r\n signatureFile: json.signatureFile,\r\n role: json.role,\r\n paymentsEnabled: json.paymentsEnabled,\r\n allowCreditCards: json.allowCreditCards,\r\n activeSubscription: json.activeSubscription,\r\n subscriptionProcessing: json.subscriptionProcessing,\r\n planLevelId: json.planLevelId,\r\n isTrial: json.isTrial,\r\n allowInvoices: json.allowInvoices,\r\n partnerType: json.partner !== null ? json.partner.partnerType : 0\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = Company\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"screenTitle\\\">\"\n + alias4(((helper = (helper = helpers.screenTitle || (depth0 != null ? depth0.screenTitle : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"screenTitle\",\"hash\":{},\"data\":data}) : helper)))\n + \"</h3>\\r\\n <p class=\\\"titleHelpText\\\">Please enter your business information below. Only your business name is required to continue, however we highly recommend filling in all fields as this will appear on your invoices, check stubs, emails and more.</p>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"text-danger help-block animated fadeInDown validation-summary-errors\\\">\\r\\n <div class=\\\"errorMessage-wizard\\\"></div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"block-content company-details\\\">\\r\\n <div class=\\\"form-group col-xs-6\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-12\\\" type=\\\"text\\\" id=\\\"company-name\\\" name=\\\"Name\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-name\\\">Business Name</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-name\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-6\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-12\\\" type=\\\"text\\\" id=\\\"company-email-address\\\" name=\\\"EmailAddress\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.emailAddress || (depth0 != null ? depth0.emailAddress : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"emailAddress\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-email-address\\\">Email Address</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-name\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-12\\\" type=\\\"text\\\" id=\\\"company-address-1\\\" name=\\\"Address1\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.addressLine1 || (depth0 != null ? depth0.addressLine1 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine1\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-address-1\\\">Address 1</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-address-1\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-12\\\" type=\\\"text\\\" id=\\\"company-address-2\\\" name=\\\"Address2\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.addressLine2 || (depth0 != null ? depth0.addressLine2 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine2\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-address-2\\\">Address 2</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-address-2\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-7\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-8\\\" type=\\\"text\\\" id=\\\"company-address-city\\\" name=\\\"City\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.city || (depth0 != null ? depth0.city : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"city\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-address-city\\\">City</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-address-city\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-2 stateContainer\\\">\\r\\n <div class=\\\"form-material floating stateList\\\">\\r\\n <select class=\\\"form-control selectpicker\\\" id=\\\"company-address-state\\\" name=\\\"StateCode\\\" size=\\\"1\\\">\\r\\n <option></option>\\r\\n <option value=\\\"AL\\\">AL</option>\\r\\n <option value=\\\"AK\\\">AK</option>\\r\\n <option value=\\\"AZ\\\">AZ</option>\\r\\n <option value=\\\"AR\\\">AR</option>\\r\\n <option value=\\\"CA\\\">CA</option>\\r\\n <option value=\\\"CO\\\">CO</option>\\r\\n <option value=\\\"CT\\\">CT</option>\\r\\n <option value=\\\"DE\\\">DE</option>\\r\\n <option value=\\\"FL\\\">FL</option>\\r\\n <option value=\\\"GA\\\">GA</option>\\r\\n <option value=\\\"HI\\\">HI</option>\\r\\n <option value=\\\"ID\\\">ID</option>\\r\\n <option value=\\\"IL\\\">IL</option>\\r\\n <option value=\\\"IN\\\">IN</option>\\r\\n <option value=\\\"IA\\\">IA</option>\\r\\n <option value=\\\"KS\\\">KS</option>\\r\\n <option value=\\\"KY\\\">KY</option>\\r\\n <option value=\\\"LA\\\">LA</option>\\r\\n <option value=\\\"ME\\\">ME</option>\\r\\n <option value=\\\"MD\\\">MD</option>\\r\\n <option value=\\\"MA\\\">MA</option>\\r\\n <option value=\\\"MI\\\">MI</option>\\r\\n <option value=\\\"MN\\\">MN</option>\\r\\n <option value=\\\"MS\\\">MS</option>\\r\\n <option value=\\\"MO\\\">MO</option>\\r\\n <option value=\\\"MT\\\">MT</option>\\r\\n <option value=\\\"NE\\\">NE</option>\\r\\n <option value=\\\"NV\\\">NV</option>\\r\\n <option value=\\\"NH\\\">NH</option>\\r\\n <option value=\\\"NJ\\\">NJ</option>\\r\\n <option value=\\\"NM\\\">NM</option>\\r\\n <option value=\\\"NY\\\">NY</option>\\r\\n <option value=\\\"NC\\\">NC</option>\\r\\n <option value=\\\"ND\\\">ND</option>\\r\\n <option value=\\\"OH\\\">OH</option>\\r\\n <option value=\\\"OK\\\">OK</option>\\r\\n <option value=\\\"OR\\\">OR</option>\\r\\n <option value=\\\"PA\\\">PA</option>\\r\\n <option value=\\\"RI\\\">RI</option>\\r\\n <option value=\\\"SC\\\">SC</option>\\r\\n <option value=\\\"SD\\\">SD</option>\\r\\n <option value=\\\"TN\\\">TN</option>\\r\\n <option value=\\\"TX\\\">TX</option>\\r\\n <option value=\\\"UT\\\">UT</option>\\r\\n <option value=\\\"VT\\\">VT</option>\\r\\n <option value=\\\"VA\\\">VA</option>\\r\\n <option value=\\\"WA\\\">WA</option>\\r\\n <option value=\\\"WV\\\">WV</option>\\r\\n <option value=\\\"WI\\\">WI</option>\\r\\n <option value=\\\"WY\\\">WY</option>\\r\\n <option value=\\\"OTHER\\\">OTHER</option>\\r\\n </select>\\r\\n <label for=\\\"material-select2\\\" class=\\\"stateLabel\\\">State</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-3\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-2\\\" type=\\\"text\\\" id=\\\"company-address-zip\\\" name=\\\"Zip\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.postalCode || (depth0 != null ? depth0.postalCode : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"postalCode\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-address-zip\\\">Zip Code</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-address-zip\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-12 col-lg-6\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-12 col-lg-6\\\" type=\\\"text\\\" id=\\\"company-phone\\\" name=\\\"Phone\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.phone || (depth0 != null ? depth0.phone : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"phone\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-phone\\\">Phone Number</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-phone\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-12 col-lg-6\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-12 col-lg-6\\\" type=\\\"text\\\" id=\\\"company-website\\\" name=\\\"Website\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.website || (depth0 != null ? depth0.website : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"website\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-website\\\">Website</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-website\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary pull-right save push-15-r\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.postButtonText : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.program(9, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</button> \\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.hasProfilePage : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(11, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div class=\\\"col-xs-12\\\">\\r\\n <br />\\r\\n <p>Your company's method of accounting is <b>\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(5, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" basis</b>. If you need to change your accounting method, please refer to this <a href=\\\"http://get.crunched.help/hc/en-us/articles/229501127-How-to-change-my-accounting-method\\\" target=\\\"_blank\\\">help document</a>, or <a href=\\\"/business-creation\\\">create a new company</a>.</p>\\r\\n </div>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \"accrual\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \"cash\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.postButtonText || (depth0 != null ? depth0.postButtonText : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"postButtonText\",\"hash\":{},\"data\":data}) : helper)));\n},\"9\":function(container,depth0,helpers,partials,data) {\n return \"Save\";\n},\"11\":function(container,depth0,helpers,partials,data) {\n return \" <button class=\\\"btn btn-default cancel cancel-button pull-right\\\" style=\\\"margin-right: 15px;\\\">Back</button>\\r\\n\";\n},\"13\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"screenTitle\\\">Cannot create a new company.</h3>\\r\\n <p class=\\\"titleHelpText\\\">Educational users are unable to create new companies. <a href=\\\"/\\\">Return to Dashboard</a></p>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(13, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar CreateCompanyTemplate = require('company/create/template')\r\nvar Company = require('company/company')\r\nvar Address = require('company/address')\r\nvar CompanyService = require('company/company-service')\r\nvar Config = require('config/config')\r\n\r\nvar CreateCompanyView = Backbone.View.extend({\r\n className: '',\r\n\r\n events: {\r\n 'click .save': 'create',\r\n 'click .cancel': 'cancel',\r\n 'change input, select': 'validate',\r\n 'keyup input, select': 'validate',\r\n 'focusout input, select': 'validate'\r\n },\r\n\r\n initialize: function () {\r\n this.companyService = new CompanyService()\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CreateCompanyTemplate(this.createViewModel()))\r\n this.$('#company-phone').mask('(999) 999-9999', {placeholder: ' '})\r\n this.$('.selectpicker').selectpicker({\r\n size: 5,\r\n dropupAuto: false,\r\n noneSelectedText: ''\r\n })\r\n\r\n this.companyService.fetchCompany().then(function (company) {\r\n if (company) {\r\n $('#page-container, #sidebar, #header-navbar, #side-overlay, .content.bg-white.titlebar, ul.logoimage-without-menu').attr('style', null)\r\n $('.logoimage-without-menu').attr('style', 'display:none !important;')\r\n $('.wizard').attr('style', 'margin-top: 1% !important;')\r\n } else {\r\n $('#page-container').attr('style', 'padding: 0 !important;')\r\n $('.logoimage-without-menu').attr('style', 'display:block !important;')\r\n $('#sidebar, #side-overlay, .content.bg-white.titlebar').attr('style', 'display:none;')\r\n $('#header-navbar').attr('style', 'left: 0px !important; padding: 0px !important;')\r\n }\r\n })\r\n this.validate()\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n screenTitle: 'Create your company',\r\n postButtonText: 'Next',\r\n hasProfilePage: this.model.get('hasProfilePage'),\r\n isEducationalLicense: Config['IS_EDUCATIONAL_LICENSE']\r\n }\r\n },\r\n\r\n create: function (event) {\r\n event.preventDefault()\r\n\r\n var name = this.$('#company-name').val()\r\n var emailAddress = this.$('#company-email-address').val()\r\n var addressLine1 = this.$('#company-address-1').val()\r\n var addressLine2 = this.$('#company-address-2').val()\r\n var city = this.$('#company-address-city').val()\r\n var state = this.$('#company-address-state').val()\r\n var postalCode = this.$('#company-address-zip').val()\r\n var phone = this.$('#company-phone').val()\r\n var website = this.$('#company-website').val()\r\n\r\n var newCompany = new Company({\r\n name: name,\r\n emailAddress: emailAddress,\r\n phone: phone,\r\n website: website,\r\n address: new Address({\r\n addressLine1: addressLine1,\r\n addressLine2: addressLine2,\r\n city: city,\r\n state: state,\r\n postalCode: postalCode\r\n })\r\n })\r\n\r\n if (!this.validate(newCompany)) {\r\n return\r\n }\r\n\r\n this.trigger('create', newCompany)\r\n },\r\n\r\n cancel: function (e) {\r\n e.preventDefault()\r\n this.trigger('back')\r\n },\r\n\r\n validate: function (newCompany) {\r\n if (!newCompany || newCompany.preventDefault) {\r\n var name = this.$('#company-name').val()\r\n var emailAddress = this.$('#company-email-address').val()\r\n var addressLine1 = this.$('#company-address-1').val()\r\n var addressLine2 = this.$('#company-address-2').val()\r\n var city = this.$('#company-address-city').val()\r\n var state = this.$('#company-address-state').val()\r\n var postalCode = this.$('#company-address-zip').val()\r\n var phone = this.$('#company-phone').val()\r\n var website = this.$('#company-website').val()\r\n\r\n if (state) {\r\n this.$('.stateList').addClass('open')\r\n } else {\r\n this.$('.stateList').removeClass('open')\r\n }\r\n\r\n newCompany = new Company({\r\n name: name,\r\n emailAddress: emailAddress,\r\n phone: phone,\r\n website: website,\r\n address: new Address({\r\n addressLine1: addressLine1,\r\n addressLine2: addressLine2,\r\n city: city,\r\n state: state,\r\n postalCode: postalCode\r\n })\r\n })\r\n }\r\n var nameValid = !!newCompany.get('name')\r\n\r\n var feedbackSummary = this.$('.validation-summary-errors').find('.errorMessage-wizard')\r\n feedbackSummary.empty()\r\n this.$('.has-error').removeClass('has-error')\r\n\r\n if (!nameValid) {\r\n feedbackSummary.append('<div>Your business name is required.</div>')\r\n this.$('input#company-name').parent().parent().addClass('has-error')\r\n }\r\n\r\n return nameValid\r\n },\r\n\r\n getErrorStatusBar: function (error) {\r\n return $('<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">' + error + '</span></div>')\r\n },\r\n\r\n getSuccessStatusBar: function (message) {\r\n return $('<div class=\"bg-primary-lighter\" style=\"display: block;\"><i class=\"fa fa-check-circle fa-2x fa-inverse\"></i><span class=\"message\">' + message + '</span></div>')\r\n }\r\n})\r\n\r\nmodule.exports = CreateCompanyView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar CreateCompanyView = require('company/create/view')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar CreateCompanyWidget = function () {\r\n this.view = new CreateCompanyView()\r\n this.companyService = new CompanyService()\r\n this.view.on('create', this.trigger.bind(this, 'create'), this)\r\n}\r\n\r\nCreateCompanyWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCreateCompanyWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.companyService.fetchCompany().then(function (company) {\r\n if (company) {\r\n $('#page-container, #sidebar, #header-navbar, #side-overlay, .content.bg-white.titlebar, ul.logoimage-without-menu').attr('style', null)\r\n\r\n // Company already exists for this user - no need to create one\r\n Backbone.trigger('app:navigate', 'company', true)\r\n } else {\r\n $('#page-container').attr('style', 'padding: 0 !important;')\r\n $('.logoimage-without-menu').attr('style', 'display:block !important;')\r\n $('#sidebar, #side-overlay, .content.bg-white.titlebar').attr('style', 'display:none;')\r\n $('#header-navbar').attr('style', 'left: 0px !important; padding: 0px !important;')\r\n }\r\n })\r\n\r\n return this.view.render().el\r\n}\r\n\r\nCreateCompanyWidget.prototype.createCompany = function (company) {\r\n this.companyService.createCompany(company).then(function (companyId) {\r\n company.id = companyId\r\n this.companyService.setActiveCompany(company)\r\n Backbone.trigger('app:navigate', 'company', true)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = CreateCompanyWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"form-group col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <h3 style=\\\"padding-left:5px;\\\">MxMerchant Credentials</h3>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-4\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-2\\\" type=\\\"text\\\" id=\\\"usernameForPayment\\\" name=\\\"usernameForPayment\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.usernameForPayment || (depth0 != null ? depth0.usernameForPayment : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"usernameForPayment\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"usernameForPayment\\\">User Name</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"usernameForPayment\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-4\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-2\\\" type=\\\"password\\\" id=\\\"passwordForPayment\\\" name=\\\"passwordForPayment\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"passwordForPayment\\\">Password</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"passwordForPayment\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-4\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-2\\\" type=\\\"text\\\" id=\\\"merchantId\\\" name=\\\"merchantId\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.merchantId || (depth0 != null ? depth0.merchantId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"merchantId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"merchantId\\\">Merchant ID</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"merchantId\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div class=\\\"col-xs-12\\\">\\r\\n <br />\\r\\n <p>Your company's method of accounting is <b>\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.program(6, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" basis</b>. If you need to change your accounting method, please refer to this <a href=\\\"http://get.crunched.help/hc/en-us/articles/229501127-How-to-change-my-accounting-method\\\" target=\\\"_blank\\\">help document</a>, or <a href=\\\"/business-creation\\\">create a new company</a>.</p>\\r\\n </div>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"accrual\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n return \"cash\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.postButtonText || (depth0 != null ? depth0.postButtonText : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"postButtonText\",\"hash\":{},\"data\":data}) : helper)));\n},\"10\":function(container,depth0,helpers,partials,data) {\n return \"Save\";\n},\"12\":function(container,depth0,helpers,partials,data) {\n return \" <button class=\\\"btn btn-default cancel cancel-button pull-right\\\" style=\\\"margin-right: 15px;\\\">Back</button>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">\"\n + alias4(((helper = (helper = helpers.screenTitle || (depth0 != null ? depth0.screenTitle : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"screenTitle\",\"hash\":{},\"data\":data}) : helper)))\n + \"</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content company-details\\\">\\r\\n <div class=\\\"form-group col-xs-6\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-12\\\" type=\\\"text\\\" id=\\\"company-name\\\" name=\\\"Name\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-name\\\">Name</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-name\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-6\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-12\\\" type=\\\"text\\\" id=\\\"company-email-address\\\" name=\\\"EmailAddress\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.emailAddress || (depth0 != null ? depth0.emailAddress : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"emailAddress\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-email-address\\\">Email Address</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-name\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-12\\\" type=\\\"text\\\" id=\\\"company-address-1\\\" name=\\\"Address1\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.addressLine1 || (depth0 != null ? depth0.addressLine1 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine1\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-address-1\\\">Address 1</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-address-1\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-12\\\" type=\\\"text\\\" id=\\\"company-address-2\\\" name=\\\"Address2\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.addressLine2 || (depth0 != null ? depth0.addressLine2 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine2\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-address-2\\\">Address 2</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-address-2\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-7\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-8\\\" type=\\\"text\\\" id=\\\"company-address-city\\\" name=\\\"City\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.city || (depth0 != null ? depth0.city : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"city\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-address-city\\\">City</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-address-city\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-2 stateContainer\\\">\\r\\n <div class=\\\"form-material floating stateList\\\">\\r\\n <select class=\\\"form-control selectpicker\\\" id=\\\"company-address-state\\\" name=\\\"StateCode\\\" size=\\\"1\\\">\\r\\n <option></option>\\r\\n <option value=\\\"AL\\\">AL</option>\\r\\n <option value=\\\"AK\\\">AK</option>\\r\\n <option value=\\\"AZ\\\">AZ</option>\\r\\n <option value=\\\"AR\\\">AR</option>\\r\\n <option value=\\\"CA\\\">CA</option>\\r\\n <option value=\\\"CO\\\">CO</option>\\r\\n <option value=\\\"CT\\\">CT</option>\\r\\n <option value=\\\"DE\\\">DE</option>\\r\\n <option value=\\\"FL\\\">FL</option>\\r\\n <option value=\\\"GA\\\">GA</option>\\r\\n <option value=\\\"HI\\\">HI</option>\\r\\n <option value=\\\"ID\\\">ID</option>\\r\\n <option value=\\\"IL\\\">IL</option>\\r\\n <option value=\\\"IN\\\">IN</option>\\r\\n <option value=\\\"IA\\\">IA</option>\\r\\n <option value=\\\"KS\\\">KS</option>\\r\\n <option value=\\\"KY\\\">KY</option>\\r\\n <option value=\\\"LA\\\">LA</option>\\r\\n <option value=\\\"ME\\\">ME</option>\\r\\n <option value=\\\"MD\\\">MD</option>\\r\\n <option value=\\\"MA\\\">MA</option>\\r\\n <option value=\\\"MI\\\">MI</option>\\r\\n <option value=\\\"MN\\\">MN</option>\\r\\n <option value=\\\"MS\\\">MS</option>\\r\\n <option value=\\\"MO\\\">MO</option>\\r\\n <option value=\\\"MT\\\">MT</option>\\r\\n <option value=\\\"NE\\\">NE</option>\\r\\n <option value=\\\"NV\\\">NV</option>\\r\\n <option value=\\\"NH\\\">NH</option>\\r\\n <option value=\\\"NJ\\\">NJ</option>\\r\\n <option value=\\\"NM\\\">NM</option>\\r\\n <option value=\\\"NY\\\">NY</option>\\r\\n <option value=\\\"NC\\\">NC</option>\\r\\n <option value=\\\"ND\\\">ND</option>\\r\\n <option value=\\\"OH\\\">OH</option>\\r\\n <option value=\\\"OK\\\">OK</option>\\r\\n <option value=\\\"OR\\\">OR</option>\\r\\n <option value=\\\"PA\\\">PA</option>\\r\\n <option value=\\\"RI\\\">RI</option>\\r\\n <option value=\\\"SC\\\">SC</option>\\r\\n <option value=\\\"SD\\\">SD</option>\\r\\n <option value=\\\"TN\\\">TN</option>\\r\\n <option value=\\\"TX\\\">TX</option>\\r\\n <option value=\\\"UT\\\">UT</option>\\r\\n <option value=\\\"VT\\\">VT</option>\\r\\n <option value=\\\"VA\\\">VA</option>\\r\\n <option value=\\\"WA\\\">WA</option>\\r\\n <option value=\\\"WV\\\">WV</option>\\r\\n <option value=\\\"WI\\\">WI</option>\\r\\n <option value=\\\"WY\\\">WY</option>\\r\\n <option value=\\\"OTHER\\\">OTHER</option>\\r\\n </select>\\r\\n <label for=\\\"material-select2\\\" class=\\\"stateLabel\\\">State</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-3\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-2\\\" type=\\\"text\\\" id=\\\"company-address-zip\\\" name=\\\"Zip\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.postalCode || (depth0 != null ? depth0.postalCode : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"postalCode\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-address-zip\\\">Zip Code</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-address-zip\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-12 col-lg-6\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-12 col-lg-6\\\" type=\\\"text\\\" id=\\\"company-phone\\\" name=\\\"Phone\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.phone || (depth0 != null ? depth0.phone : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"phone\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-phone\\\">Phone Number</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-phone\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-12 col-lg-6\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control col-xs-12 col-lg-6\\\" type=\\\"text\\\" id=\\\"company-website\\\" name=\\\"Website\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.website || (depth0 != null ? depth0.website : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"website\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"company-website\\\">Website</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"company-website\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary pull-right save push-15-r\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.postButtonText : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.program(10, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</button> \\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.hasProfilePage : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(12, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n <div class=\\\"status col-xs-12 no-padding\\\"></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"data-has-image\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.postButtonText || (depth0 != null ? depth0.postButtonText : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"postButtonText\",\"hash\":{},\"data\":data}) : helper)));\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \"Save\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\";\n\n return \"<div class=\\\"static-accounts block\\\" style=\\\"margin-bottom: 0;\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">\"\n + container.escapeExpression(((helper = (helper = helpers.screenTitle || (depth0 != null ? depth0.screenTitle : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"screenTitle\",\"hash\":{},\"data\":data}) : helper)))\n + \"</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <form method=\\\"post\\\" autocomplete=\\\"on\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <div>\\r\\n <label class=\\\"avatar\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.picture : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" style=\\\"background:url('\"\n + ((stack1 = ((helper = (helper = helpers.picture || (depth0 != null ? depth0.picture : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"picture\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"') no-repeat center center;\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n <input type=\\\"file\\\" accept=\\\"image/*\\\" />\\r\\n </label>\\r\\n </div>\\r\\n <div class=\\\"profile-container\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"tags\":\"autocomplete='given-name'\",\"inputLabel\":\"First Name\",\"inputId\":\"firstName\",\"inputName\":\"firstName\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"tags\":\"autocomplete='family-name'\",\"inputLabel\":\"Last Name\",\"inputId\":\"lastName\",\"inputName\":\"lastName\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" \\r\\n </div>\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"tags\":\"autocomplete='phonenumber tel'\",\"inputType\":\"tel\",\"inputLabel\":\"Phone Number\",\"inputName\":\"phoneNumber\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"error-message text-danger\\\"></div>\\r\\n <div class=\\\"actions\\\">\\r\\n <button class=\\\"btn btn-primary save save-button\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.postButtonText : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(5, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\"></div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar Template = require('company/profile/template')\r\nvar _ = require('lodash')\r\n\r\nvar ProfileView = Backbone.View.extend({\r\n className: 'settings profile myProfile',\r\n\r\n events: {\r\n 'click .save': 'create',\r\n 'change input[type=file]': 'selectFile',\r\n 'keyup input': 'validate',\r\n 'focusout input': 'validate'\r\n },\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change', this.render.bind(this))\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.createViewModel()))\r\n this.validate()\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n screenTitle: 'My Profile',\r\n postButtonText: 'Next'\r\n }\r\n },\r\n\r\n create: function (event) {\r\n event.preventDefault()\r\n\r\n if (!this.validate()) {\r\n return\r\n }\r\n\r\n var profilePicture = this.cachedAvatar\r\n var model = {\r\n pictureUpload: profilePicture,\r\n firstName: this.$('input[name=firstName]').val(),\r\n lastName: this.$('input[name=lastName]').val(),\r\n phoneNumber: this.$('input[name=phoneNumber]').val()\r\n }\r\n\r\n this.$('.error-message').addClass('hidden')\r\n\r\n this.trigger('create', model)\r\n },\r\n\r\n validate: function () {\r\n var errorMessage\r\n if (!this.$('input[name=firstName]').val()) {\r\n errorMessage = 'Please enter your first name.'\r\n } else if (!this.$('input[name=lastName]').val()) {\r\n errorMessage = 'Please enter your last name.'\r\n }\r\n var isValid = false\r\n if (errorMessage) {\r\n this.$('.status').html(this.getErrorStatusBar(errorMessage))\r\n isValid = false\r\n } else {\r\n this.$('.status').html(this.getSuccessStatusBar('Your profile is ready to be updated.'))\r\n isValid = true\r\n }\r\n\r\n return isValid\r\n },\r\n\r\n getErrorStatusBar: function (error) {\r\n return $('<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">' + error + '</span></div>')\r\n },\r\n\r\n getSuccessStatusBar: function (message) {\r\n return $('<div class=\"bg-primary-lighter\" style=\"display: block;\"><i class=\"fa fa-check-circle fa-2x fa-inverse\"></i><span class=\"message\">' + message + '</span></div>')\r\n },\r\n\r\n // Take the file and update the avatar display to display the image\r\n selectFile: function (e) {\r\n var avatar = _.first(e.target.files)\r\n\r\n if (!avatar) return console.warn('No image selected, leaving unchanged')\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (avatarFile) {\r\n this.$('.avatar').attr('style', 'background:url(\"' + avatarFile.target.result + '\") no-repeat center center;').attr('data-has-image', 'true')\r\n this.cachedAvatar = avatarFile.target.result\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(avatar)\r\n },\r\n\r\n toJSON: function () {\r\n var profilePicture = this.cachedAvatar\r\n var model = {\r\n pictureUpload: profilePicture\r\n }\r\n\r\n _.each(this.$('input:not([type=file]), textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n this.$('.error-message').addClass('hidden')\r\n\r\n return model\r\n }\r\n})\r\n\r\nmodule.exports = ProfileView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar ProfileView = require('company/profile/view')\r\nvar CompanyService = require('company/company-service')\r\nvar UserService = require('login/service')\r\n\r\nvar ProfileWidget = function () {\r\n this.view = new ProfileView()\r\n this.companyService = new CompanyService()\r\n this.view.on('create', this.trigger.bind(this, 'create'), this)\r\n}\r\n\r\nProfileWidget.prototype = _.clone(Backbone.Events)\r\n\r\nProfileWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nmodule.exports = ProfileWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3>Your company</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"company\\\">\\r\\n <div class=\\\"col-xs-6\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-6\\\">\"\n + alias4(((helper = (helper = helpers.emailAddress || (depth0 != null ? depth0.emailAddress : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"emailAddress\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-12\\\">\"\n + alias4(((helper = (helper = helpers.addressLine1 || (depth0 != null ? depth0.addressLine1 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine1\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-12\\\">\"\n + alias4(((helper = (helper = helpers.addressLine2 || (depth0 != null ? depth0.addressLine2 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine2\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-8\\\">\"\n + alias4(((helper = (helper = helpers.city || (depth0 != null ? depth0.city : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"city\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-2\\\">\"\n + alias4(((helper = (helper = helpers.state || (depth0 != null ? depth0.state : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"state\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-2\\\">\"\n + alias4(((helper = (helper = helpers.postalCode || (depth0 != null ? depth0.postalCode : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"postalCode\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-12 col-lg-6\\\">\"\n + alias4(((helper = (helper = helpers.phone || (depth0 != null ? depth0.phone : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"phone\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-12 col-lg-6\\\">\"\n + alias4(((helper = (helper = helpers.website || (depth0 != null ? depth0.website : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"website\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar ViewCompanyTemplate = require('company/read/template')\r\n\r\nvar ViewCompanyView = Backbone.View.extend({\r\n className: 'block no-padding col-lg-8 col-md-8 col-xs-12 col-lg-offset-2 col-md-offset-2',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:company', this.render)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(ViewCompanyTemplate(this.createViewModel()))\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n var company = this.model.get('company')\r\n if (!company) {\r\n return {}\r\n }\r\n return {\r\n name: company.get('name'),\r\n emailAddress: company.get('emailAddress'),\r\n phone: company.get('phone'),\r\n website: company.get('website'),\r\n addressLine1: company.get('address').get('addressLine1'),\r\n addressLine2: company.get('address').get('addressLine2'),\r\n city: company.get('address').get('city'),\r\n state: company.get('address').get('state'),\r\n postalCode: company.get('address').get('postalCode')\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = ViewCompanyView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar ViewCompanyView = require('company/read/view')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar ViewCompanyWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.view = new ViewCompanyView({\r\n model: this.model\r\n })\r\n this.companyService = new CompanyService()\r\n}\r\n\r\nViewCompanyWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.companyService.fetchCompany().then(function (company) {\r\n if (!company) {\r\n // No companies exist for this user - they need to create one\r\n // Replace the URL so that we don't get stuck in a loop if the user goes back\r\n Backbone.trigger('app:navigate', 'company/new', true)\r\n return\r\n }\r\n\r\n this.model.set('company', company)\r\n }.bind(this))\r\n\r\n return this.view.render().el\r\n}\r\n\r\nmodule.exports = ViewCompanyWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar EditCompanyTemplate = require('company/manage-company')\r\nvar Company = require('company/company')\r\nvar Address = require('company/address')\r\nvar $ = require('jquery')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar EditCompanyView = Backbone.View.extend({\r\n className: 'editCompany block no-padding col-lg-8 col-md-8 col-xs-12 col-lg-offset-2 col-md-offset-2',\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:company change:paymentInfo', this.render.bind(this))\r\n this.on('widgetReady', this.render.bind(this))\r\n },\r\n\r\n events: {\r\n 'click .save': 'update',\r\n 'keyup input, select': 'validate',\r\n 'change input, select': 'validate',\r\n 'focusout input, select': 'validate'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(EditCompanyTemplate(this.createViewModel()))\r\n this.$('#company-phone').mask('(999) 999-9999', {placeholder: ' '})\r\n\r\n this.$('.selectpicker').selectpicker({\r\n size: 5,\r\n dropupAuto: false,\r\n noneSelectedText: ''\r\n })\r\n\r\n if (this.model.get('company') != null && this.model.get('company').get('address') != null) {\r\n $('#company-address-state').val(this.model.get('company').get('address').get('state'))\r\n $('.selectpicker').selectpicker('val', this.model.get('company').get('address').get('state'))\r\n }\r\n\r\n this.validate()\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n var company = this.model.get('company')\r\n var paymentInfo = this.model.get('paymentInfo') ? this.model.get('paymentInfo') : ''\r\n\r\n return {\r\n screenTitle: 'Edit Company Details',\r\n name: company.get('name'),\r\n emailAddress: company.get('emailAddress'),\r\n phone: company.get('phone'),\r\n website: company.get('website'),\r\n addressLine1: company.get('address').get('addressLine1'),\r\n addressLine2: company.get('address').get('addressLine2'),\r\n city: company.get('address').get('city'),\r\n state: company.get('address').get('state'),\r\n postalCode: company.get('address').get('postalCode'),\r\n isAccrual: company.get('isAccrual'),\r\n paymentsEnabled: company.get('paymentsEnabled'),\r\n usernameForPayment: paymentInfo[0] ? paymentInfo[0].username : '',\r\n merchantId: paymentInfo[0] ? paymentInfo[0].key : '',\r\n isEducationalLicense: this.model.get('isEducationalLicense')\r\n }\r\n },\r\n\r\n update: function (event) {\r\n event.preventDefault()\r\n var paymentInfo = this.model.get('paymentInfo')\r\n\r\n var name = this.$('#company-name').val()\r\n var emailAddress = this.$('#company-email-address').val()\r\n var addressLine1 = this.$('#company-address-1').val()\r\n var addressLine2 = this.$('#company-address-2').val()\r\n var city = this.$('#company-address-city').val()\r\n var state = this.$('#company-address-state').val()\r\n var postalCode = this.$('#company-address-zip').val()\r\n var phone = this.$('#company-phone').val()\r\n var website = this.$('#company-website').val()\r\n\r\n var username = this.$('#usernameForPayment').val()\r\n var secret = this.$('#passwordForPayment').val()\r\n var key = this.$('#merchantId').val()\r\n\r\n var payInfo = {\r\n username: username,\r\n secret: secret,\r\n key: key\r\n }\r\n\r\n var company = new Company({\r\n id: this.model.get('company').id,\r\n name: name,\r\n emailAddress: emailAddress,\r\n phone: phone,\r\n website: website,\r\n address: new Address({\r\n addressLine1: addressLine1,\r\n addressLine2: addressLine2,\r\n city: city,\r\n state: state,\r\n postalCode: postalCode\r\n }),\r\n isAccrual: this.model.get('company').get('isAccrual')\r\n })\r\n\r\n if (!this.validate(company)) {\r\n return\r\n }\r\n\r\n this.$('.save').prop('disabled', true)\r\n if (this.model.get('paymentInfo').length > 0 && !!paymentInfo[0] && !!username && !!secret && !!key) {\r\n // update payment info and company info\r\n this.trigger('updateCompanyAndUpdatePayInfo', company, payInfo, paymentInfo[0].id)\r\n } else if (this.model.get('paymentInfo').length === 0 && !!username && !!secret && !!key) {\r\n // save payment info for the first time and update company info\r\n this.trigger('updateCompanyAndCreatePayInfo', company, payInfo)\r\n } else {\r\n // update company info only\r\n this.trigger('update', company)\r\n }\r\n },\r\n\r\n btnEnable: function () {\r\n $('.save').prop('disabled', false)\r\n },\r\n\r\n validate: function (company) {\r\n if (!company || company.preventDefault) {\r\n var name = this.$('#company-name').val()\r\n var emailAddress = this.$('#company-email-address').val()\r\n var addressLine1 = this.$('#company-address-1').val()\r\n var addressLine2 = this.$('#company-address-2').val()\r\n var city = this.$('#company-address-city').val()\r\n var state = this.$('#company-address-state').val()\r\n var postalCode = this.$('#company-address-zip').val()\r\n var phone = this.$('#company-phone').val()\r\n var website = this.$('#company-website').val()\r\n\r\n if (state) {\r\n this.$('.stateList').addClass('open')\r\n } else {\r\n this.$('.stateList').removeClass('open')\r\n }\r\n\r\n company = new Company({\r\n id: this.model.get('company').id,\r\n name: name,\r\n emailAddress: emailAddress,\r\n phone: phone,\r\n website: website,\r\n address: new Address({\r\n addressLine1: addressLine1,\r\n addressLine2: addressLine2,\r\n city: city,\r\n state: state,\r\n postalCode: postalCode\r\n })\r\n })\r\n }\r\n\r\n var nameValid = company ? !!company.get('name') : false\r\n\r\n if (nameValid) {\r\n this.$('.status').html(this.getSuccessStatusBar('Your company is valid.'))\r\n } else {\r\n this.$('.status').html(this.getErrorStatusBar('Your company needs to have a name.'))\r\n }\r\n\r\n return nameValid\r\n },\r\n\r\n getErrorStatusBar: function (error) {\r\n return $('<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">' + error + '</span></div>')\r\n },\r\n\r\n getSuccessStatusBar: function (message) {\r\n return $('<div class=\"bg-primary-lighter\" style=\"display: block;\"><i class=\"fa fa-check-circle fa-2x fa-inverse\"></i><span class=\"message\">' + message + '</span></div>')\r\n },\r\n\r\n showErrorModal: function (error) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: error.message,\r\n type: 'error',\r\n confirmButtonColor: '#19aea6'\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = EditCompanyView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar EditCompanyView = require('company/update/view')\r\nvar CompanyService = require('company/company-service')\r\nvar Company = require('company/company')\r\nvar Address = require('company/address')\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar Config = require('config/config')\r\n\r\nvar EditCompanyWidget = function () {\r\n this.companyService = new CompanyService()\r\n this.model = new Backbone.Model({\r\n company: new Company({\r\n address: new Address()\r\n }),\r\n isEducationalLicense: Config['IS_EDUCATIONAL_LICENSE']\r\n })\r\n\r\n this.view = new EditCompanyView({\r\n model: this.model\r\n })\r\n\r\n this.loadDependencies()\r\n\r\n this.on('shown', function () {\r\n this.readyPromise.then(function () {\r\n this.preventLoad = false\r\n this.view.trigger('widgetReady')\r\n }.bind(this))\r\n }.bind(this))\r\n\r\n this.view.on('update', this.updateCompany, this)\r\n this.view.on('updateCompanyAndUpdatePayInfo', this.updateCompanyAndPayInfo, this)\r\n this.view.on('updateCompanyAndCreatePayInfo', this.updateCompanyAndCreatePayInfo, this)\r\n}\r\n\r\nEditCompanyWidget.prototype = _.clone(Backbone.Events)\r\n\r\nEditCompanyWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nEditCompanyWidget.prototype.loadDependencies = function () {\r\n this.readyPromise = Q.all([\r\n this.fetchCompany(),\r\n this.fetchCompanyPaymentInfo()\r\n ])\r\n}\r\n\r\nEditCompanyWidget.prototype.fetchCompanyPaymentInfo = function () {\r\n return this.companyService.getAllCompanyPaymentProcessor().then(function (paymentInfo) {\r\n this.model.set('paymentInfo', paymentInfo)\r\n }.bind(this))\r\n}\r\n\r\nEditCompanyWidget.prototype.fetchCompany = function () {\r\n return this.companyService.fetchCompany().then(function (company) {\r\n this.model.set('company', company)\r\n this.model.set('isAccrual', company.isAccrual)\r\n }.bind(this))\r\n}\r\n\r\nEditCompanyWidget.prototype.updateCompany = function (company) {\r\n this.companyService.updateCompany(company).then(function () {\r\n Backbone.trigger('app:navigate', 'company', true)\r\n Backbone.trigger('refreshDropdown')\r\n }, function () {\r\n this.view.btnEnable()\r\n }.bind(this))\r\n}\r\n\r\nEditCompanyWidget.prototype.updateCompanyAndPayInfo = function (company, payInfo, payId) {\r\n Q.all([\r\n this.companyService.updateCompany(company),\r\n this.companyService.updateCompanyPaymentProcessor(payInfo, payId)\r\n ]).spread(function (responseCompany, responsePayInfo) {\r\n Backbone.trigger('app:navigate', 'company', true)\r\n Backbone.trigger('refreshDropdown')\r\n }).fail(function (err) {\r\n this.view.btnEnable()\r\n this.view.showErrorModal(err)\r\n }.bind(this))\r\n}\r\n\r\nEditCompanyWidget.prototype.updateCompanyAndCreatePayInfo = function (company, payInfo) {\r\n Q.all([\r\n this.companyService.updateCompany(company),\r\n this.companyService.createCompanyPaymentProcessor(payInfo)\r\n ]).spread(function (responseCompany, responsePayInfo) {\r\n Backbone.trigger('app:navigate', 'company', true)\r\n Backbone.trigger('refreshDropdown')\r\n }).fail(function (err) {\r\n this.view.btnEnable()\r\n this.view.showErrorModal(err)\r\n }.bind(this))\r\n}\r\nmodule.exports = EditCompanyWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('company/wizard/template')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar sweetAlert = require('sweetalert2')\r\nvar Backbone = require('backbone')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar CreateCompanyView = require('company/create/view')\r\nvar ChooseAccountingMethodView = require('settings/accounting-method/view')\r\nvar BulletsTemplate = require('forms/bullets')\r\n\r\nvar CompanyWizardView = CreateView.extend({\r\n className: 'company wizard block',\r\n\r\n events: {\r\n 'click .bullet': 'clickBullet'\r\n },\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.companyService = new CompanyService()\r\n\r\n this.listenTo(this.model, 'change', this.render.bind(this))\r\n\r\n var createCompanyView = new CreateCompanyView({model: this.model})\r\n var chooseAccountingMethodView = new ChooseAccountingMethodView({model: this.model})\r\n\r\n this.views = [\r\n {\r\n name: 'createCompany',\r\n label: 'Create Company',\r\n view: createCompanyView,\r\n events: {'create': this.companyInfo.bind(this)},\r\n backOn: 'back',\r\n nextOn: 'create'\r\n },\r\n {\r\n name: 'accountingMethod',\r\n label: 'Choose Accounting Method',\r\n view: chooseAccountingMethodView,\r\n events: {\r\n 'create': this.createCompany.bind(this)\r\n },\r\n isReady: function () {\r\n return !!this.$('input#company-name').val()\r\n }.bind(this),\r\n backOn: 'back'\r\n }\r\n ]\r\n\r\n // Transform the events to trigger callbacks on the view's events.\r\n // If there is a nextOn entry, the view should transition to the next view upon\r\n // the nextOn trigger being executed.\r\n _.each(this.views, function (viewEntry) {\r\n _.each(viewEntry.events, function (callback, name) {\r\n viewEntry.view.on(name, callback)\r\n })\r\n\r\n var currentIndex = this.views.indexOf(viewEntry)\r\n\r\n if (viewEntry.nextOn) {\r\n viewEntry.view.on(viewEntry.nextOn, this.showChild.bind(this, this.views[currentIndex + 1]))\r\n }\r\n if (viewEntry.backOn) {\r\n viewEntry.view.on(viewEntry.backOn, this.showChild.bind(this, this.views[currentIndex - 1]))\r\n }\r\n }.bind(this))\r\n\r\n this.on('created', this.companyCreated.bind(this))\r\n },\r\n\r\n companyInfo: function (companyData) {\r\n this.companyData = companyData.toJSON()\r\n },\r\n\r\n createCompany: function (accountingMethodInfo) {\r\n this.companyData.isAccrual = accountingMethodInfo.accountingMethod === 'accrual'\r\n this.companyData.accountingPeriodDay = accountingMethodInfo.accountingPeriodDay\r\n this.companyData.accountingPeriodMonth = accountingMethodInfo.accountingPeriodMonth\r\n this.companyData.signatureFileUpload = accountingMethodInfo.signatureFileUpload\r\n\r\n this.trigger('createCompany', this.companyData, this)\r\n },\r\n\r\n companyCreated: function (response) {\r\n $('#page-container, #sidebar, #header-navbar, #side-overlay, .content.bg-white.titlebar, ul.logoimage-without-menu').attr('style', null)\r\n Backbone.trigger('app:navigate', 'generalledgeraccounts')\r\n },\r\n\r\n onRender: function () {\r\n this.$el.html('')\r\n // Render all of the views in a hidden container, that way\r\n // if the user goes back and forth, the data will still be there.\r\n _.each(this.views, function (viewEntry) {\r\n var $container = $('<div />')\r\n .addClass('hidden wizard-view-container')\r\n .html(viewEntry.view.render().$el)\r\n .attr('name', viewEntry.name)\r\n\r\n viewEntry.view.delegateEvents()\r\n\r\n this.$el.append($container)\r\n }.bind(this))\r\n\r\n this.showChild(this.views[0])\r\n },\r\n\r\n clickBullet: function (e) {\r\n var $currentTarget = this.$(e.currentTarget)\r\n var bulletName = $currentTarget.attr('name')\r\n var viewEntry = _.find(this.views, {name: bulletName})\r\n this.showChild(viewEntry)\r\n },\r\n\r\n showChild: function (viewEntry) {\r\n var view = viewEntry.view\r\n\r\n // Check if there's a callback to see if the view is ready\r\n // If there is a callback and it returns false, return out and don't do anything else.\r\n if (viewEntry.isReady && !viewEntry.isReady()) {\r\n return\r\n }\r\n\r\n this.$('.wizard-view-container').addClass('hidden')\r\n this.$('.wizard-view-container[name=\"' + viewEntry.name + '\"]').removeClass('hidden')\r\n\r\n this.$('.bullets').remove()\r\n this.$('.block-header').append(BulletsTemplate({\r\n classes: 'pull-right',\r\n bullets: this.getBullets(viewEntry)\r\n }))\r\n\r\n view.delegateEvents()\r\n },\r\n\r\n getBullets: function (currentView) {\r\n return _.map(this.views, function (entry) {\r\n return {\r\n label: entry.label,\r\n classes: currentView === entry ? 'current' : '',\r\n name: entry.name\r\n }\r\n })\r\n },\r\n\r\n toJSON: function () {\r\n var model = {}\r\n\r\n _.each(this.$('input:not([type=file]), textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n this.$('.error-message').addClass('hidden')\r\n this.$('input[type=password]').val('')\r\n\r\n return model\r\n }\r\n})\r\n\r\nmodule.exports = CompanyWizardView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\n\r\nvar Model = require('lists/list/item/entry')\r\nvar View = require('company/wizard/view')\r\n\r\nvar UserService = require('login/service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar CompanyWizardWidget = function () {\r\n this.model = new Model()\r\n this.userService = new UserService()\r\n this.view = new View({\r\n model: this.model\r\n })\r\n this.companyService = new CompanyService()\r\n\r\n this.view.on('createCompany', this.createCompany.bind(this))\r\n}\r\n\r\nCompanyWizardWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCompanyWizardWidget.prototype.show = function () {\r\n return this.view.render().$el\r\n}\r\n\r\nCompanyWizardWidget.prototype.createCompany = function (companyData) {\r\n return this.companyService.createCompany(companyData).done(function (response) {\r\n this.response = response\r\n this.companyService.updateActiveCompany(response).done(function () {\r\n this.view.trigger('created')\r\n Backbone.trigger('app:changeCompany', this.response, false)\r\n }.bind(this))\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = CompanyWizardWidget\r\n","module.exports = {\"CRUNCHED_API_HOST\":\"https://staging.crunched.io/api\",\"IS_EDUCATIONAL_LICENSE\":false}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3>\"\n + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"title\",\"hash\":{},\"data\":data}) : helper)))\n + \"</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"aging-total col-lg-12 col-md-12 col-sm-12\\\"><strong>Total Open \"\n + alias4(((helper = (helper = helpers.viewType || (depth0 != null ? depth0.viewType : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"viewType\",\"hash\":{},\"data\":data}) : helper)))\n + \" - \"\n + alias4(((helper = (helper = helpers.openBalance || (depth0 != null ? depth0.openBalance : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"openBalance\",\"hash\":{},\"data\":data}) : helper)))\n + \"</strong></div>\\r\\n <div class=\\\"legend-data col-lg-6 col-md-6 col-sm-12\\\">\\r\\n <div class=\\\"legend-data-row\\\">\\r\\n <div class=\\\"legend-data-circle legend-teal\\\"></div>\\r\\n <div class=\\\"legend-data-name\\\">Current</div>\\r\\n </div>\\r\\n <div class=\\\"legend-data-row\\\">\\r\\n <div class=\\\"legend-data-circle legend-orange\\\"></div>\\r\\n <div class=\\\"legend-data-name\\\">31 - 60 Days</div>\\r\\n </div>\\r\\n <div class=\\\"legend-data-row\\\">\\r\\n <div class=\\\"legend-data-circle legend-red\\\"></div>\\r\\n <div class=\\\"legend-data-name\\\">61+</div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"chart col-lg-6 col-md-6 col-sm-12\\\">\\r\\n <canvas id=\\\"\"\n + alias4(((helper = (helper = helpers.chartId || (depth0 != null ? depth0.chartId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"chartId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></canvas>\\r\\n </div>\\r\\n <div class=\\\"dashboard-action-link col-lg-12 col-md-12 col-sm-12\\\"><a href=\\\"\"\n + alias4(((helper = (helper = helpers.link || (depth0 != null ? depth0.link : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"link\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.linkText || (depth0 != null ? depth0.linkText : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"linkText\",\"hash\":{},\"data\":data}) : helper)))\n + \"</a></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Chart = require('Chart')\r\nvar AccountBalanceTemplate = require('dashboard/account-balance/template')\r\nvar numbro = require('numbro')\r\n\r\nvar AccountsPayableView = Backbone.View.extend({\r\n className: 'block no-padding col-lg-5 col-md-5 col-sm-12 col-lg-offset-1 col-md-offse-1 dashboard-aging',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:accountBalance', this.render)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(AccountBalanceTemplate(this.createViewModel()))\r\n this.generateChart()\r\n return this\r\n },\r\n\r\n generateChart: function () {\r\n var ctx = document.getElementById('payablesChart')\r\n var accountBalance = this.model.get('accountBalance')\r\n\r\n if (ctx != null && ctx !== undefined && accountBalance) {\r\n var myChart = new Chart(ctx, {\r\n type: 'doughnut',\r\n data: {\r\n labels: [\r\n 'Current',\r\n '31 - 60 Days',\r\n '90+'\r\n ],\r\n datasets: [\r\n {\r\n data: [accountBalance.current, accountBalance.thirtySixty, accountBalance.sixtyPlus],\r\n backgroundColor: [\r\n '#19aea6',\r\n '#f3b760',\r\n '#d2695b'\r\n ],\r\n hoverBackgroundColor: [\r\n '#19aea6',\r\n '#f3b760',\r\n '#d2695b'\r\n ]\r\n }]\r\n },\r\n options: {\r\n legend: {\r\n display: false\r\n },\r\n tooltips: {\r\n callbacks: {\r\n label: function (dataPoint, data) {\r\n return numbro(data.datasets[0].data[dataPoint.index]).formatCurrency('($0,0.00)')\r\n }\r\n }\r\n }\r\n }\r\n })\r\n }\r\n },\r\n\r\n createViewModel: function () {\r\n var accountBalance = this.model.get('accountBalance')\r\n\r\n if (!accountBalance) {\r\n return {\r\n title: 'Payables (Expenses)',\r\n viewType: 'Payables',\r\n chartId: 'payablesChart',\r\n link: '/payables/apply-payments',\r\n linkText: 'Post Expense Payment'\r\n }\r\n }\r\n\r\n return {\r\n openBalance: numbro(accountBalance.current + accountBalance.thirtySixty + accountBalance.sixtyPlus).formatCurrency('($0,0.00)'),\r\n title: 'Payables (Expenses)',\r\n viewType: 'Payables',\r\n chartId: 'payablesChart',\r\n link: '/payables/apply-payments',\r\n linkText: 'Post Expense Payment'\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = AccountsPayableView\r\n","'use strict'\r\n\r\nvar AccountsPayableView = require('dashboard/accounts-payable-report/view')\r\nvar PayableService = require('payables/payable/service')\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\n\r\nvar AccountsPayableWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.payableService = new PayableService()\r\n this.view = new AccountsPayableView({\r\n model: this.model\r\n })\r\n\r\n this.on('companyLoaded', function () {\r\n this.loadBalances()\r\n }.bind(this), this)\r\n\r\n this.loadBalances()\r\n}\r\n\r\nAccountsPayableWidget.prototype = _.clone(Backbone.Events)\r\n\r\nAccountsPayableWidget.prototype.loadBalances = function () {\r\n this.payableService.getAccountsPayableBalance().then(function (accountBalance) {\r\n this.model.set('accountBalance', accountBalance)\r\n }.bind(this))\r\n}\r\n\r\nAccountsPayableWidget.prototype.show = function () {\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = AccountsPayableWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Chart = require('Chart')\r\nvar AccountBalanceTemplate = require('dashboard/account-balance/template')\r\nvar numbro = require('numbro')\r\n\r\nvar AccountsReceivableView = Backbone.View.extend({\r\n className: 'block no-padding col-lg-5 col-md-5 col-sm-12 col-lg-offset-1 col-md-offset-1 dashboard-aging',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:accountBalance', this.render)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(AccountBalanceTemplate(this.createViewModel()))\r\n this.generateChart()\r\n return this\r\n },\r\n\r\n generateChart: function () {\r\n var ctx = document.getElementById('receivablesChart')\r\n var accountBalance = this.model.get('accountBalance')\r\n\r\n if (ctx != null && ctx !== undefined && accountBalance) {\r\n var myChart = new Chart(ctx, {\r\n type: 'doughnut',\r\n data: {\r\n labels: [\r\n 'Current',\r\n '31 - 60 Days',\r\n '90+'\r\n ],\r\n datasets: [\r\n {\r\n data: [accountBalance.current, accountBalance.thirtySixty, accountBalance.sixtyPlus],\r\n backgroundColor: [\r\n '#19aea6',\r\n '#f3b760',\r\n '#d2695b'\r\n ],\r\n hoverBackgroundColor: [\r\n '#19aea6',\r\n '#f3b760',\r\n '#d2695b'\r\n ]\r\n }]\r\n },\r\n options: {\r\n legend: {\r\n display: false\r\n },\r\n tooltips: {\r\n callbacks: {\r\n label: function (dataPoint, data) {\r\n return numbro(data.datasets[0].data[dataPoint.index]).formatCurrency('($0,0.00)')\r\n }\r\n }\r\n }\r\n }\r\n })\r\n }\r\n },\r\n\r\n createViewModel: function () {\r\n var accountBalance = this.model.get('accountBalance')\r\n\r\n if (!accountBalance) {\r\n return {\r\n title: 'Invoices (Income)',\r\n viewType: 'Invoices',\r\n chartId: 'receivablesChart',\r\n link: '/receivables/payments',\r\n linkText: 'Post Customer Payment'\r\n }\r\n }\r\n\r\n return {\r\n openBalance: numbro(accountBalance.current + accountBalance.thirtySixty + accountBalance.sixtyPlus).formatCurrency('($0,0.00)'),\r\n title: 'Invoices (Income)',\r\n viewType: 'Invoices',\r\n chartId: 'receivablesChart',\r\n link: '/receivables/payments',\r\n linkText: 'Post Customer Payment'\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = AccountsReceivableView\r\n","'use strict'\r\n\r\nvar AccountsReceivableView = require('dashboard/accounts-receivable-report/view')\r\nvar InvoiceService = require('receivables/invoices/service')\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\n\r\nvar AccountsReceivableWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.invoiceService = new InvoiceService()\r\n this.view = new AccountsReceivableView({\r\n model: this.model\r\n })\r\n\r\n this.on('companyLoaded', function () {\r\n this.loadBalances()\r\n }.bind(this), this)\r\n\r\n this.loadBalances()\r\n}\r\n\r\nAccountsReceivableWidget.prototype = _.clone(Backbone.Events)\r\n\r\nAccountsReceivableWidget.prototype.loadBalances = function () {\r\n this.invoiceService.getAccountsReceivableBalance().then(function (accountBalance) {\r\n this.model.set('accountBalance', accountBalance)\r\n }.bind(this))\r\n}\r\n\r\nAccountsReceivableWidget.prototype.show = function () {\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = AccountsReceivableWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow flex \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.selectedCheckbook : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\\" checkbookId=\\\"\"\n + alias4(((helper = (helper = helpers.checkbookId || (depth0 != null ? depth0.checkbookId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"checkbookId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"account-description\\\">\"\n + alias4(((helper = (helper = helpers.accountName || (depth0 != null ? depth0.accountName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"balance currency\\\">\"\n + alias4(((helper = (helper = helpers.balance || (depth0 != null ? depth0.balance : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"balance\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"selected\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \" <p class=\\\"center\\\">No cash accounts found</p>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block no-padding col-lg-11 col-md-11 col-xs-12 col-lg-offset-1 col-md-offset-1\\\">\\r\\n <div class=\\\"col-lg-5 col-md-5 col-xs-12 no-padding checkbook-selector\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Checkbook Balances</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-striped cash-available-table\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"account-description\\\">Account Description</div>\\r\\n <div class=\\\"balance currency no-padding\\\">Amount</div>\\r\\n </div>\\r\\n <div class=\\\"account-scroll\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.accounts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <div class=\\\"dashboard-action-link col-lg-12 col-md-12 col-sm-12\\\"><a href=\\\"/settings/checkbooks\\\">Create New Checkbook</a></div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"col-lg-7 col-md-7 col-xs-12 checkbook-chart\\\">\\r\\n <div class=\\\"form-group filter\\\">\\r\\n <div class=\\\"form-material\\\">\\r\\n <select class=\\\"form-control\\\" name=\\\"filterSelection\\\" id=\\\"filterSelection\\\">\\r\\n <option value=\\\"1\\\">Prior 6 Weeks</option>\\r\\n <option value=\\\"2\\\">Prior 12 Weeks</option>\\r\\n <option value=\\\"3\\\">Prior 6 Months</option>\\r\\n <option value=\\\"4\\\">Prior 12 Months</option>\\r\\n </select>\\r\\n </div>\\r\\n </div>\\r\\n <canvas id=\\\"checkbookChart\\\"></canvas>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar CheckbookStatusTemplate = require('dashboard/checkbook-status/template')\r\nvar numbro = require('numbro')\r\n\r\nvar CheckbookStatusView = Backbone.View.extend({\r\n className: 'checkbook-status',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:accounts', this.render)\r\n this.listenTo(this.model, 'change:selectedCheckbook', this.render)\r\n this.listenTo(this.model, 'change:datapoints', this.render)\r\n },\r\n\r\n events: {\r\n 'click .itemrow': 'selectCheckbook',\r\n 'change #filterSelection': 'selectFilter'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CheckbookStatusTemplate(this.createViewModel()))\r\n this.$el.find('#filterSelection').val(this.model.get('filterType'))\r\n this.generateChart()\r\n return this\r\n },\r\n\r\n generateChart: function () {\r\n var ctx = this.$el.find('#checkbookChart')[0]\r\n var dataPoints = this.model.get('datapoints')\r\n\r\n if (ctx && dataPoints) {\r\n var labels = new Array()\r\n var points = new Array()\r\n\r\n for (var i = 0; i < dataPoints.length; i++) {\r\n labels.push(dataPoints[i].x)\r\n points.push(dataPoints[i].y)\r\n }\r\n\r\n var myLineChart = new Chart(ctx, {\r\n type: 'line',\r\n data: {\r\n labels: labels,\r\n datasets: [{\r\n fill: true,\r\n lineTension: 0,\r\n backgroundColor: '#53c2bc',\r\n borderColor: '#138680',\r\n borderCapStyle: 'butt',\r\n borderDash: [],\r\n borderDashOffset: 0.0,\r\n borderJoinStyle: 'miter',\r\n pointBorderColor: '#fff',\r\n pointBackgroundColor: '#138680',\r\n pointBorderWidth: 2,\r\n pointHoverRadius: 6,\r\n pointHoverBackgroundColor: 'rgba(75,192,192,1)',\r\n pointHoverBorderColor: 'rgba(220,220,220,1)',\r\n pointHoverBorderWidth: 2,\r\n pointRadius: 6,\r\n pointHitRadius: 10,\r\n data: points,\r\n spanGaps: false\r\n }]\r\n },\r\n options: {\r\n legend: {\r\n display: false\r\n },\r\n tooltips: {\r\n callbacks: {\r\n label: function (dataPoint, data) {\r\n return numbro(data.datasets[0].data[dataPoint.index]).formatCurrency('($0,0.00)')\r\n }\r\n }\r\n },\r\n scales: {\r\n yAxes: [{\r\n ticks: {\r\n callback: function (value, index, values) {\r\n return numbro(value).formatCurrency('($0,0.00)')\r\n }\r\n },\r\n gridLines: {\r\n display: false\r\n }\r\n }],\r\n xAxes: [{\r\n ticks: {\r\n autoSkip: false,\r\n maxRotation: 40,\r\n minRotation: 40\r\n },\r\n gridLines: {\r\n display: true\r\n }\r\n }]\r\n }\r\n }\r\n })\r\n }\r\n },\r\n\r\n selectCheckbook: function (data) {\r\n this.model.set('selectedCheckbook', $(data.currentTarget).attr('checkbookId'))\r\n },\r\n\r\n selectFilter: function (data) {\r\n this.model.set('filterType', $(data.currentTarget).val())\r\n },\r\n\r\n createViewModel: function () {\r\n var accounts = this.model.get('accounts')\r\n\r\n if (!accounts) {\r\n return {\r\n }\r\n }\r\n\r\n var activeCheckbook = this.model.get('selectedCheckbook')\r\n\r\n if (activeCheckbook == null || activeCheckbook == undefined) {\r\n this.model.set('selectedCheckbook', accounts[0].checkbookId)\r\n activeCheckbook = accounts[0].checkbookId\r\n }\r\n\r\n return {\r\n filterType: this.model.get('filterType'),\r\n accounts: accounts.map(function (item) {\r\n return {\r\n checkbookId: item.checkbookId,\r\n selectedCheckbook: activeCheckbook === item.checkbookId,\r\n accountNumber: item.accountNumber,\r\n accountName: item.accountName,\r\n balance: numbro(item.balance).formatCurrency('($0,0.00)')\r\n }\r\n })\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = CheckbookStatusView\r\n","'use strict'\r\n\r\nvar CheckbookStatusView = require('dashboard/checkbook-status/view')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar ReportService = require('reports/report-service')\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\n\r\nvar CheckbookStatusWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.checkbookService = new CheckbookService()\r\n this.reportService = new ReportService()\r\n this.view = new CheckbookStatusView({\r\n model: this.model\r\n })\r\n\r\n this.model.set('filterType', '1')\r\n\r\n this.on('companyLoaded', function () {\r\n this.loadAccounts()\r\n }.bind(this), this)\r\n\r\n this.loadAccounts()\r\n \r\n this.model.on('change:selectedCheckbook', function() {\r\n this.loadCheckbookStatus(this.model.get('selectedCheckbook'), this.model.get('filterType'))\r\n }.bind(this))\r\n\r\n this.model.on('change:filterType', function() {\r\n this.loadCheckbookStatus(this.model.get('selectedCheckbook'), this.model.get('filterType'))\r\n }.bind(this))\r\n}\r\n\r\nCheckbookStatusWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCheckbookStatusWidget.prototype.loadAccounts = function () {\r\n this.checkbookService.fetchBalances().then(function (accounts) {\r\n this.model.set('accounts', accounts)\r\n }.bind(this))\r\n}\r\n\r\nCheckbookStatusWidget.prototype.loadCheckbookStatus = function (id, filterType) {\r\n this.reportService.fetchCheckbookStatus(id, filterType).then(function (response) {\r\n this.model.set('datapoints', response)\r\n }.bind(this))\r\n}\r\n\r\nCheckbookStatusWidget.prototype.show = function () {\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = CheckbookStatusWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"col-lg-3 col-md-3 col-xs-12\\\">\\r\\n <h4>Cash On Hand</h4>\\r\\n <span class=\\\"financial-status-amount\\\">\"\n + alias4(((helper = (helper = helpers.availableCash || (depth0 != null ? depth0.availableCash : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"availableCash\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>\\r\\n </div>\\r\\n <div class=\\\"col-lg-3 col-md-3 col-xs-12\\\">\\r\\n <h4>Open Invoices</h4>\\r\\n <span class=\\\"financial-status-amount\\\">\"\n + alias4(((helper = (helper = helpers.openInvoiceAmount || (depth0 != null ? depth0.openInvoiceAmount : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"openInvoiceAmount\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>\\r\\n </div>\\r\\n <div class=\\\"col-lg-3 col-md-3 col-xs-12\\\">\\r\\n <h4>Open Payables</h4>\\r\\n <span class=\\\"financial-status-amount\\\">\"\n + alias4(((helper = (helper = helpers.openPayableAmount || (depth0 != null ? depth0.openPayableAmount : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"openPayableAmount\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>\\r\\n </div>\\r\\n <div class=\\\"col-lg-3 col-md-3 col-xs-12\\\">\\r\\n <h4>Net Income YTD</h4>\\r\\n <span class=\\\"financial-status-amount\\\">\"\n + alias4(((helper = (helper = helpers.yearToDateIncome || (depth0 != null ? depth0.yearToDateIncome : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"yearToDateIncome\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar FinancialStatusTemplate = require('dashboard/financial-status/template')\r\nvar numbro = require('numbro')\r\n\r\nvar FinancialStatusView = Backbone.View.extend({\r\n className: 'financial-status',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:financialStatus', this.render)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(FinancialStatusTemplate(this.createViewModel()))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n var financialStatus = this.model.get('financialStatus')\r\n\r\n if (!financialStatus) {\r\n return {\r\n }\r\n }\r\n\r\n return {\r\n availableCash: numbro(financialStatus.availableCash).formatCurrency('($0,0.00)'),\r\n openInvoiceAmount: numbro(financialStatus.openInvoiceAmount).formatCurrency('($0,0.00)'),\r\n openPayableAmount: numbro(financialStatus.openPayableAmount).formatCurrency('($0,0.00)'),\r\n yearToDateIncome: numbro(financialStatus.yearToDateIncome).formatCurrency('($0,0.00)')\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = FinancialStatusView\r\n","'use strict'\r\n\r\nvar FinancialStatusView = require('dashboard/financial-status/view')\r\nvar ReportService = require('reports/report-service')\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\n\r\nvar FinancialStatusWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.reportService = new ReportService()\r\n this.view = new FinancialStatusView({\r\n model: this.model\r\n })\r\n\r\n this.on('companyLoaded', function () {\r\n this.loadFinancialStatus()\r\n }.bind(this), this)\r\n\r\n this.loadFinancialStatus()\r\n}\r\n\r\nFinancialStatusWidget.prototype = _.clone(Backbone.Events)\r\n\r\nFinancialStatusWidget.prototype.loadFinancialStatus = function () {\r\n this.reportService.fetchFinancialStatus().then(function (response) {\r\n this.model.set('financialStatus', response)\r\n }.bind(this))\r\n}\r\n\r\nFinancialStatusWidget.prototype.show = function () {\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = FinancialStatusWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block no-padding col-lg-11 col-md-11 col-xs-12 col-lg-offset-1 col-md-offset-1\\\">\\r\\n <div class=\\\"col-lg-12 col-md-12 col-xs-12 no-padding\\\">\\r\\n <div class=\\\"col-lg-8 col-md-8 col-xs-8 no-padding\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Income & Expense Analysis</h3>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"col-lg-4 col-md-4 col-xs-4\\\">\\r\\n <div class=\\\"form-group filter\\\">\\r\\n <div class=\\\"form-material\\\">\\r\\n <select class=\\\"form-control\\\" name=\\\"filterSelection\\\" id=\\\"filterSelection\\\">\\r\\n <option value=\\\"1\\\">Daily</option>\\r\\n <option value=\\\"2\\\">Past Year</option>\\r\\n </select>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"col-lg-3 col-md-3 col-xs-12 no-padding chart-left-pane\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"legend-data\\\">\\r\\n <div class=\\\"legend-data-row\\\">\\r\\n <div class=\\\"legend-data-circle legend-teal\\\"></div>\\r\\n <div class=\\\"legend-data-name\\\">Income</div>\\r\\n </div>\\r\\n <div class=\\\"legend-data-row\\\">\\r\\n <div class=\\\"legend-data-circle legend-red\\\"></div>\\r\\n <div class=\\\"legend-data-name\\\">Expenses</div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"col-lg-9 col-md-9 col-xs-12 income-expense-chart\\\"> \\r\\n <canvas id=\\\"incomeExpenseChart\\\"></canvas>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Chart = require('Chart')\r\nvar IncomeExpenseStatusTemplate = require('dashboard/income-expense-status/template')\r\nvar numbro = require('numbro')\r\n\r\nvar IncomeExpenseStatusView = Backbone.View.extend({\r\n className: 'income-expense-status',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:dataSets', this.render)\r\n },\r\n\r\n events: {\r\n 'change #filterSelection': 'selectFilter'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(IncomeExpenseStatusTemplate(this.createViewModel()))\r\n this.$el.find('#filterSelection').val(this.model.get('filterType'))\r\n this.generateChart()\r\n return this\r\n },\r\n\r\n generateChart: function () {\r\n var ctx = this.$el.find('#incomeExpenseChart')[0]\r\n var dataSets = this.model.get('dataSets')\r\n\r\n if (ctx && dataSets) {\r\n var labels = new Array()\r\n var incomePoints = new Array()\r\n var expensePoints = new Array()\r\n\r\n for (var i = 0; i < dataSets[0].length; i++) {\r\n labels.push(dataSets[0][i].x)\r\n incomePoints.push(dataSets[0][i].y)\r\n }\r\n\r\n for (var i = 0; i < dataSets[1].length; i++) {\r\n expensePoints.push(dataSets[1][i].y)\r\n }\r\n\r\n var myLineChart = new Chart(ctx, {\r\n type: 'bar',\r\n data: {\r\n labels: labels,\r\n datasets: [this.getDataSet(incomePoints, '#19aea6'), this.getDataSet(expensePoints, '#d2695b')]\r\n },\r\n options: {\r\n legend: {\r\n display: false\r\n },\r\n tooltips: {\r\n callbacks: {\r\n label: function (dataPoint, data) {\r\n return numbro(data.datasets[dataPoint.datasetIndex].data[dataPoint.index]).formatCurrency('($0,0.00)')\r\n }\r\n }\r\n },\r\n scales: {\r\n yAxes: [{\r\n ticks: {\r\n callback: function (value, index, values) {\r\n return numbro(value).formatCurrency('($0,0.00)')\r\n }\r\n },\r\n gridLines: {\r\n display: false\r\n }\r\n }],\r\n xAxes: [{\r\n ticks: {\r\n autoSkip: false,\r\n maxRotation: 40,\r\n minRotation: 40\r\n },\r\n gridLines: {\r\n display: true\r\n }\r\n }]\r\n }\r\n }\r\n })\r\n }\r\n },\r\n\r\n getDataSet: function (points, color) {\r\n return {\r\n fill: true,\r\n lineTension: 0,\r\n backgroundColor: color,\r\n borderColor: '#138680',\r\n borderCapStyle: 'butt',\r\n borderDash: [],\r\n borderDashOffset: 0.0,\r\n borderJoinStyle: 'miter',\r\n pointBorderColor: '#fff',\r\n pointBackgroundColor: '#138680',\r\n pointBorderWidth: 2,\r\n pointHoverRadius: 6,\r\n pointHoverBackgroundColor: 'rgba(75,192,192,1)',\r\n pointHoverBorderColor: 'rgba(220,220,220,1)',\r\n pointHoverBorderWidth: 2,\r\n pointRadius: 6,\r\n pointHitRadius: 10,\r\n data: points,\r\n spanGaps: false\r\n }\r\n },\r\n\r\n selectFilter: function (data) {\r\n this.model.set('filterType', $(data.currentTarget).val())\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n filterType: this.model.get('filterType')\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = IncomeExpenseStatusView\r\n","'use strict'\r\n\r\nvar IncomeExpenseStatusView = require('dashboard/income-expense-status/view')\r\nvar ReportService = require('reports/report-service')\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\n\r\nvar IncomeExpenseStatusWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.reportService = new ReportService()\r\n this.view = new IncomeExpenseStatusView({\r\n model: this.model\r\n })\r\n\r\n this.model.set('filterType', '1')\r\n\r\n this.on('companyLoaded', function () {\r\n this.loadIncomeExpenseStatuses()\r\n }.bind(this), this)\r\n\r\n this.model.on('change:filterType', function() {\r\n this.loadIncomeExpenseStatuses()\r\n }.bind(this))\r\n\r\n this.loadIncomeExpenseStatuses()\r\n}\r\n\r\nIncomeExpenseStatusWidget.prototype = _.clone(Backbone.Events)\r\n\r\nIncomeExpenseStatusWidget.prototype.loadIncomeExpenseStatuses = function () {\r\n this.reportService.getIncomeExpenseStatuses(this.model.get('filterType')).then(function (dataSets) {\r\n this.model.set('dataSets', dataSets)\r\n }.bind(this))\r\n}\r\n\r\nIncomeExpenseStatusWidget.prototype.show = function () {\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = IncomeExpenseStatusWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar DashboardWidget = require('dashboard/widget')\r\nvar SessionService = require('session/session-service')\r\nvar $ = require('jquery')\r\n\r\nvar DashboardRouter = Router.extend({\r\n routes: {\r\n '': 'showDashboard'\r\n },\r\n\r\n showDashboard: function () {\r\n var titleMessage = new Date().getHours() < 12 ? 'Good Morning' : 'Good Afternoon'\r\n var profile = SessionService.getProfile()\r\n\r\n if (profile && $.trim(profile.firstName) !== '') {\r\n titleMessage += ', ' + profile.firstName\r\n }\r\n\r\n Backbone.trigger('app:showInFrame', new DashboardWidget())\r\n Backbone.trigger('app:updateTitle', titleMessage, '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Dashboard'}])\r\n }\r\n})\r\n\r\nmodule.exports = DashboardRouter\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"col-lg-3 col-md-3 col-sm-12 no-padding\\\" id=\\\"dashboard-left\\\">\\r\\n <div class=\\\"quick-tasks block col-lg-12 col-md-12 col-sm-12 no-padding\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Quick Tasks</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <ul>\\r\\n <li><a href=\\\"/checkbook\\\">Create checkbook transaction</a></li>\\r\\n <li><a href=\\\"/checkbook/reconcile\\\">Reconcile my checkbook</a></li>\\r\\n <li><a href=\\\"/receivables/invoices\\\">Create an invoice</a></li>\\r\\n <li><a href=\\\"/receivables/payments\\\">Post customer payment</a></li>\\r\\n <li><a href=\\\"/payables\\\">Create a payable</a></li>\\r\\n <li><a href=\\\"/payables/apply-payments\\\">Apply payable payments</a></li>\\r\\n <li><a href=\\\"/lists/sales-tax-rates\\\">Setup sales tax rates</a></li>\\r\\n <li><a href=\\\"/lists/contacts\\\">Add or import contacts</a></li>\\r\\n <li><a href=\\\"/lists/customers\\\">Add or import customers</a></li>\\r\\n <li><a href=\\\"/lists/vendors\\\">Add or import vendors</a></li>\\r\\n <li><a href=\\\"/lists/sales-entries\\\">Add or import sales items</a></li>\\r\\n </ul>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"col-lg-9 col-md-9 col-sm-12 no-padding\\\" id=\\\"dashboard-right\\\"></div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar FinancialStatusWidget = require('dashboard/financial-status/widget')\r\nvar CheckbookStatusWidget = require('dashboard/checkbook-status/widget')\r\nvar AccountsReceivableWidget = require('dashboard/accounts-receivable-report/widget')\r\nvar AccountsPayableWidget = require('dashboard/accounts-payable-report/widget')\r\nvar IncomeExpenseStatusWidget = require('dashboard/income-expense-status/widget')\r\nvar DashboardTemplate = require('dashboard/template')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar DashboardView = Backbone.View.extend({\r\n className: 'dashboard',\r\n\r\n initialize: function () {\r\n this.financialStatusWidget = new FinancialStatusWidget()\r\n this.checkbookStatusWidget = new CheckbookStatusWidget()\r\n this.accountsReceivableWidget = new AccountsReceivableWidget()\r\n this.accountsPayableWidget = new AccountsPayableWidget()\r\n this.incomeExpenseStatusWidget = new IncomeExpenseStatusWidget()\r\n this.on('companyLoaded', this.triggerChildren, this)\r\n this.companyService = new CompanyService()\r\n },\r\n\r\n render: function () {\r\n this.hasCompany()\r\n\r\n this.$el.html(DashboardTemplate())\r\n .prepend(this.financialStatusWidget.show())\r\n\r\n this.$el.children('#dashboard-right')\r\n .append(this.checkbookStatusWidget.show())\r\n .append(this.accountsReceivableWidget.show())\r\n .append(this.accountsPayableWidget.show())\r\n .append(this.incomeExpenseStatusWidget.show())\r\n\r\n return this\r\n },\r\n\r\n triggerChildren: function () {\r\n this.financialStatusWidget.trigger('companyLoaded')\r\n this.checkbookStatusWidget.trigger('companyLoaded')\r\n this.accountsReceivableWidget.trigger('companyLoaded')\r\n this.accountsPayableWidget.trigger('companyLoaded')\r\n this.incomeExpenseStatusWidget.trigger('companyLoaded')\r\n },\r\n\r\n hasCompany: function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n if (companyId === null || companyId === undefined) {\r\n this.companyService.fetchCompany().then(function (company) {\r\n if (!company || company === null || company === undefined) {\r\n Backbone.trigger('app:navigate', 'welcome')\r\n } else {\r\n this.companyService.setActiveCompany(company)\r\n }\r\n }.bind(this))\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = DashboardView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar DashboardView = require('dashboard/view')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar DashboardWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.companyService = new CompanyService()\r\n this.view = new DashboardView({\r\n model: this.model\r\n })\r\n}\r\n\r\nDashboardWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n if (companyId === null || companyId === undefined) {\r\n this.companyService.fetchCompany().then(function (company) {\r\n if (!company) {\r\n Backbone.trigger('app:navigate', 'welcome')\r\n } else {\r\n this.companyService.setActiveCompany(company)\r\n this.view.trigger('companyLoaded')\r\n }\r\n }.bind(this))\r\n }\r\n this.view.hasCompany()\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = DashboardWidget\r\n","'use strict'\r\n\r\nvar DatePickerParameters = {\r\n regex: /^[0-9]{2}\\/[0-9]{2}\\/[0-9]{4}/,\r\n format: 'MM/DD/YYYY',\r\n options: {\r\n format: 'mm/dd/yyyy',\r\n autoclose: true,\r\n todayHighlight: true\r\n }\r\n}\r\n\r\nmodule.exports = DatePickerParameters\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar FooterTemplate = require('footer/footer')\r\n\r\nvar FooterView = Backbone.View.extend({\r\n tagName: 'footer',\r\n\r\n id: 'page-footer',\r\n\r\n className: 'content-mini content-mini-full font-s12 bg-gray-lightest clearfix',\r\n\r\n render: function () {\r\n this.$el.html(FooterTemplate())\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = FooterView\r\n","'use strict'\r\n\r\nvar FooterView = require('footer/footer-view')\r\n\r\nvar FooterWidget = function () {\r\n this.view = new FooterView()\r\n}\r\n\r\nFooterWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nmodule.exports = FooterWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"pull-left\\\">Crunched © 2016</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var Backbone = require('backbone')\r\n\r\nvar ActionCellView = Backbone.View.extend({\r\n tagName: 'td',\r\n className: 'renderable',\r\n render: function () {\r\n this.$el.html(this.template(this.createViewModel()))\r\n return this\r\n },\r\n createViewModel: function () {\r\n return this.model.attributes\r\n }\r\n})\r\n\r\nmodule.exports = ActionCellView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <li name=\\\"\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" class=\\\"bullet \"\n + alias4(((helper = (helper = helpers.classes || (depth0 != null ? depth0.classes : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"classes\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"><a>\"\n + alias4(((helper = (helper = helpers.label || (depth0 != null ? depth0.label : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"label\",\"hash\":{},\"data\":data}) : helper)))\n + \"</a></li>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<ul class=\\\"bullets \"\n + container.escapeExpression(((helper = (helper = helpers.classes || (depth0 != null ? depth0.classes : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"classes\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.bullets : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</ul>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"checked\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \"disabled\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.index || (depth0 != null ? depth0.index : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"index\",\"hash\":{},\"data\":data}) : helper)));\n},\"7\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.id : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"8\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"form-group is-active \"\n + alias4(((helper = (helper = helpers.wrapperClasses || (depth0 != null ? depth0.wrapperClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"wrapperClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary \"\n + alias4(((helper = (helper = helpers.labelClasses || (depth0 != null ? depth0.labelClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"labelClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <span>\"\n + alias4(((helper = (helper = helpers.inputLabel || (depth0 != null ? depth0.inputLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputLabel\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>\\r\\n <input type=\\\"checkbox\\\" name=\\\"\"\n + alias4(((helper = (helper = helpers.inputName || (depth0 != null ? depth0.inputName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputName\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isChecked : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isDisabled : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" id=\\\"\"\n + alias4(((helper = (helper = helpers.inputId || (depth0 != null ? depth0.inputId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputId\",\"hash\":{},\"data\":data}) : helper)))\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.program(7, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\\"><span></span>\\r\\n </label>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<button id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" data-triggers=\\\"\"\n + alias4(((helper = (helper = helpers.triggers || (depth0 != null ? depth0.triggers : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"triggers\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.text || (depth0 != null ? depth0.text : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"text\",\"hash\":{},\"data\":data}) : helper)))\n + \"</button>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.options : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"<i class=\\\"fa\\\"></i>\\r\\n<span>\"\n + container.escapeExpression(((helper = (helper = helpers.text || (depth0 != null ? depth0.text : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"text\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar $ = require('jquery')\r\nvar Backbone = require('backbone')\r\nvar ConfirmDisableTemplate = require('forms/confirm/confirm')\r\n\r\nvar ConfirmView = Backbone.View.extend({\r\n className: 'inline confirm item-confirmation has-animation fadeInDown z-1',\r\n\r\n initialize: function () {\r\n if (this.model.get('color')) {\r\n this.$el.addClass('bg-' + this.model.get('color'))\r\n }\r\n\r\n this.model.on('change:options', this.render, this)\r\n },\r\n\r\n events: {\r\n 'click button': 'emit'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(ConfirmDisableTemplate(this.model.toJSON()))\r\n return this\r\n },\r\n\r\n emit: function (e) {\r\n e.preventDefault()\r\n var $currentTarget = $(e.currentTarget)\r\n var trigger = $currentTarget.attr('data-triggers')\r\n this.trigger(trigger)\r\n }\r\n})\r\n\r\nmodule.exports = ConfirmView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar ConfirmDisableView = require('forms/confirm/view')\r\n\r\nvar ConfirmWidget = function (prompt, color, state) {\r\n this.model = new Backbone.Model({\r\n text: prompt,\r\n state: state,\r\n color: color,\r\n options: []\r\n })\r\n this.view = new ConfirmDisableView({\r\n model: this.model\r\n })\r\n}\r\n\r\nConfirmWidget.prototype = _.clone(Backbone.Events)\r\n\r\nConfirmWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nConfirmWidget.prototype.addChoice = function (text, triggers, id) {\r\n this.model.get('options').push({\r\n text: text,\r\n triggers: triggers,\r\n id: id\r\n })\r\n\r\n this.view.on(triggers, function () {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift(triggers)\r\n this.trigger.apply(this, args)\r\n }.bind(this))\r\n\r\n this.model.trigger('change:options')\r\n}\r\n\r\nmodule.exports = ConfirmWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.inputId || (depth0 != null ? depth0.inputId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputId\",\"hash\":{},\"data\":data}) : helper)))\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"\"\n + alias4(((helper = (helper = helpers.inputName || (depth0 != null ? depth0.inputName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputName\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" autocomplete=\\\"off\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.inputId || (depth0 != null ? depth0.inputId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputId\",\"hash\":{},\"data\":data}) : helper)))\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.inputLabel || (depth0 != null ? depth0.inputLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputLabel\",\"hash\":{},\"data\":data}) : helper)))\n + \"</label>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.index || (depth0 != null ? depth0.index : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"index\",\"hash\":{},\"data\":data}) : helper)));\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.id : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", buffer = \n \"<div class=\\\"form-group \"\n + container.escapeExpression(((helper = (helper = helpers.wrapperClasses || (depth0 != null ? depth0.wrapperClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"wrapperClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"form-material floating input-group date\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : alias2),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === alias3 ? helper.call(alias1,options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" <span class=\\\"input-group-addon\\\"><i class=\\\"fa fa-calendar\\\"></i></span>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <input class=\\\"form-control \"\n + alias4(((helper = (helper = helpers.inputClasses || (depth0 != null ? depth0.inputClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" type=\\\"\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.inputType : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.inputId || (depth0 != null ? depth0.inputId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputId\",\"hash\":{},\"data\":data}) : helper)))\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.program(8, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"\"\n + alias4(((helper = (helper = helpers.inputName || (depth0 != null ? depth0.inputName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputName\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"value\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" \"\n + ((stack1 = ((helper = (helper = helpers.tags || (depth0 != null ? depth0.tags : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"tags\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isDisabled : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(11, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.maxLength : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(13, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \">\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.inputId || (depth0 != null ? depth0.inputId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputId\",\"hash\":{},\"data\":data}) : helper)))\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.program(8, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.inputLabel || (depth0 != null ? depth0.inputLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputLabel\",\"hash\":{},\"data\":data}) : helper)))\n + \"</label>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.inputType || (depth0 != null ? depth0.inputType : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"inputType\",\"hash\":{},\"data\":data}) : helper)));\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"text\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.index || (depth0 != null ? depth0.index : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"index\",\"hash\":{},\"data\":data}) : helper)));\n},\"8\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.id : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(9, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"9\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)));\n},\"11\":function(container,depth0,helpers,partials,data) {\n return \"disabled\";\n},\"13\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"maxlength=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.maxLength || (depth0 != null ? depth0.maxLength : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"maxLength\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression, buffer = \n \"<div class=\\\"form-group \"\n + alias4(((helper = (helper = helpers.wrapperClasses || (depth0 != null ? depth0.wrapperClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"wrapperClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"form-material floating \"\n + alias4(((helper = (helper = helpers.floatingClasses || (depth0 != null ? depth0.floatingClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"floatingClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \" input-group\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : alias2),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === alias3 ? helper.call(alias1,options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" <span class=\\\"input-group-addon\\\"><i class=\\\"fa fa-close taxRateClose\\\" style=\\\"font-size:15px;\\\"></i></span>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\"></span>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <input class=\\\"form-control \"\n + alias4(((helper = (helper = helpers.inputClasses || (depth0 != null ? depth0.inputClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" type=\\\"\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.inputType : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.inputId || (depth0 != null ? depth0.inputId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputId\",\"hash\":{},\"data\":data}) : helper)))\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.program(8, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"\"\n + alias4(((helper = (helper = helpers.inputName || (depth0 != null ? depth0.inputName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputName\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"value\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" \"\n + ((stack1 = ((helper = (helper = helpers.tags || (depth0 != null ? depth0.tags : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"tags\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isDisabled : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(11, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.maxLength : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(13, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \">\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.inputId || (depth0 != null ? depth0.inputId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputId\",\"hash\":{},\"data\":data}) : helper)))\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.program(8, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.inputLabel || (depth0 != null ? depth0.inputLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputLabel\",\"hash\":{},\"data\":data}) : helper)))\n + \"</label>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.inputType || (depth0 != null ? depth0.inputType : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"inputType\",\"hash\":{},\"data\":data}) : helper)));\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"text\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.index || (depth0 != null ? depth0.index : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"index\",\"hash\":{},\"data\":data}) : helper)));\n},\"8\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.id : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(9, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"9\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)));\n},\"11\":function(container,depth0,helpers,partials,data) {\n return \"disabled\";\n},\"13\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"maxlength=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.maxLength || (depth0 != null ? depth0.maxLength : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"maxLength\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression, buffer = \n \"<div class=\\\"form-group \"\n + alias4(((helper = (helper = helpers.wrapperClasses || (depth0 != null ? depth0.wrapperClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"wrapperClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"form-material floating \"\n + alias4(((helper = (helper = helpers.floatingClasses || (depth0 != null ? depth0.floatingClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"floatingClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : alias2),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === alias3 ? helper.call(alias1,options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\"></span>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" bg-\"\n + container.escapeExpression(((helper = (helper = helpers.color || (depth0 != null ? depth0.color : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"color\",\"hash\":{},\"data\":data}) : helper)))\n + \" \";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" bg-primary \";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"ribbon-container\\\">\\r\\n <div class=\\\"edge \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.color : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\\"></div>\\r\\n <div class=\\\"ribbon-message\\\">\\r\\n \"\n + container.escapeExpression(((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"message\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control \"\n + alias4(((helper = (helper = helpers.inputClasses || (depth0 != null ? depth0.inputClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.inputId || (depth0 != null ? depth0.inputId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputId\",\"hash\":{},\"data\":data}) : helper)))\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.inputName : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.program(9, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\\" size=\\\"1\\\" \"\n + alias4(((helper = (helper = helpers.tags || (depth0 != null ? depth0.tags : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"tags\",\"hash\":{},\"data\":data}) : helper)))\n + \" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isDisabled : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(11, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \">\\r\\n <option></option>\\r\\n <option value=\\\"AL\\\">AL</option>\\r\\n <option value=\\\"AK\\\">AK</option>\\r\\n <option value=\\\"AZ\\\">AZ</option>\\r\\n <option value=\\\"AR\\\">AR</option>\\r\\n <option value=\\\"CA\\\">CA</option>\\r\\n <option value=\\\"CO\\\">CO</option>\\r\\n <option value=\\\"CT\\\">CT</option>\\r\\n <option value=\\\"DE\\\">DE</option>\\r\\n <option value=\\\"FL\\\">FL</option>\\r\\n <option value=\\\"GA\\\">GA</option>\\r\\n <option value=\\\"HI\\\">HI</option>\\r\\n <option value=\\\"ID\\\">ID</option>\\r\\n <option value=\\\"IL\\\">IL</option>\\r\\n <option value=\\\"IN\\\">IN</option>\\r\\n <option value=\\\"IA\\\">IA</option>\\r\\n <option value=\\\"KS\\\">KS</option>\\r\\n <option value=\\\"KY\\\">KY</option>\\r\\n <option value=\\\"LA\\\">LA</option>\\r\\n <option value=\\\"ME\\\">ME</option>\\r\\n <option value=\\\"MD\\\">MD</option>\\r\\n <option value=\\\"MA\\\">MA</option>\\r\\n <option value=\\\"MI\\\">MI</option>\\r\\n <option value=\\\"MN\\\">MN</option>\\r\\n <option value=\\\"MS\\\">MS</option>\\r\\n <option value=\\\"MO\\\">MO</option>\\r\\n <option value=\\\"MT\\\">MT</option>\\r\\n <option value=\\\"NE\\\">NE</option>\\r\\n <option value=\\\"NV\\\">NV</option>\\r\\n <option value=\\\"NH\\\">NH</option>\\r\\n <option value=\\\"NJ\\\">NJ</option>\\r\\n <option value=\\\"NM\\\">NM</option>\\r\\n <option value=\\\"NY\\\">NY</option>\\r\\n <option value=\\\"NC\\\">NC</option>\\r\\n <option value=\\\"ND\\\">ND</option>\\r\\n <option value=\\\"OH\\\">OH</option>\\r\\n <option value=\\\"OK\\\">OK</option>\\r\\n <option value=\\\"OR\\\">OR</option>\\r\\n <option value=\\\"PA\\\">PA</option>\\r\\n <option value=\\\"RI\\\">RI</option>\\r\\n <option value=\\\"SC\\\">SC</option>\\r\\n <option value=\\\"SD\\\">SD</option>\\r\\n <option value=\\\"TN\\\">TN</option>\\r\\n <option value=\\\"TX\\\">TX</option>\\r\\n <option value=\\\"UT\\\">UT</option>\\r\\n <option value=\\\"VT\\\">VT</option>\\r\\n <option value=\\\"VA\\\">VA</option>\\r\\n <option value=\\\"WA\\\">WA</option>\\r\\n <option value=\\\"WV\\\">WV</option>\\r\\n <option value=\\\"WI\\\">WI</option>\\r\\n <option value=\\\"WY\\\">WY</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.inputId || (depth0 != null ? depth0.inputId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputId\",\"hash\":{},\"data\":data}) : helper)))\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.inputLabel : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(13, data, 0),\"inverse\":container.program(15, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</label>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.index || (depth0 != null ? depth0.index : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"index\",\"hash\":{},\"data\":data}) : helper)));\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.id : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)));\n},\"7\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.inputName || (depth0 != null ? depth0.inputName : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"inputName\",\"hash\":{},\"data\":data}) : helper)));\n},\"9\":function(container,depth0,helpers,partials,data) {\n return \"state\";\n},\"11\":function(container,depth0,helpers,partials,data) {\n return \"disabled\";\n},\"13\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.inputLabel || (depth0 != null ? depth0.inputLabel : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"inputLabel\",\"hash\":{},\"data\":data}) : helper)));\n},\"15\":function(container,depth0,helpers,partials,data) {\n return \"State\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression, buffer = \n \"<div class=\\\"form-group state \"\n + alias4(((helper = (helper = helpers.wrapperClasses || (depth0 != null ? depth0.wrapperClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"wrapperClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"form-material floating \"\n + alias4(((helper = (helper = helpers.floatingClasses || (depth0 != null ? depth0.floatingClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"floatingClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : alias2),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === alias3 ? helper.call(alias1,options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <textarea class=\\\"form-control \"\n + alias4(((helper = (helper = helpers.inputClasses || (depth0 != null ? depth0.inputClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.inputId || (depth0 != null ? depth0.inputId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputId\",\"hash\":{},\"data\":data}) : helper)))\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"\"\n + alias4(((helper = (helper = helpers.inputName || (depth0 != null ? depth0.inputName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputName\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" rows=\\\"\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.inputRows : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.program(9, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\\" \"\n + alias4(((helper = (helper = helpers.tags || (depth0 != null ? depth0.tags : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"tags\",\"hash\":{},\"data\":data}) : helper)))\n + \" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isDisabled : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(11, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"></textarea>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.inputId || (depth0 != null ? depth0.inputId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputId\",\"hash\":{},\"data\":data}) : helper)))\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.inputLabel || (depth0 != null ? depth0.inputLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputLabel\",\"hash\":{},\"data\":data}) : helper)))\n + \"</label>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.index || (depth0 != null ? depth0.index : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"index\",\"hash\":{},\"data\":data}) : helper)));\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.id : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)));\n},\"7\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.inputRows || (depth0 != null ? depth0.inputRows : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"inputRows\",\"hash\":{},\"data\":data}) : helper)));\n},\"9\":function(container,depth0,helpers,partials,data) {\n return \"4\";\n},\"11\":function(container,depth0,helpers,partials,data) {\n return \"disabled\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression, buffer = \n \"<div class=\\\"form-group memo-container \"\n + alias4(((helper = (helper = helpers.wrapperClasses || (depth0 != null ? depth0.wrapperClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"wrapperClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"form-material floating \"\n + alias4(((helper = (helper = helpers.floatingClasses || (depth0 != null ? depth0.floatingClasses : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"floatingClasses\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : alias2),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === alias3 ? helper.call(alias1,options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar FrameTemplate = require('frame')\r\nvar NavWidget = require('nav/widget')\r\nvar HeaderWidget = require('header/widget')\r\nvar AsideWidget = require('aside/widget')\r\nvar $ = require('jquery')\r\nvar SessionService = require('session/session-service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar FrameView = Backbone.View.extend({\r\n className: 'sidebar-l sidebar-o side-scroll header-navbar-fixed',\r\n\r\n id: 'page-container',\r\n\r\n events: {\r\n 'keydown': 'tabModal'\r\n },\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:title', this.updateTitle)\r\n this.listenTo(this.model, 'change:subtitle', this.updateTitle)\r\n this.listenTo(this.model, 'change:paths', this.updateBreadcrumb)\r\n this.navWidget = new NavWidget()\r\n this.headerWidget = new HeaderWidget()\r\n this.asideWidget = new AsideWidget()\r\n\r\n this.asideWidget.on('clicked', function () {\r\n this.$el.removeClass('side-overlay-o')\r\n }.bind(this))\r\n\r\n Backbone.on('app:navigate', this.determineNavVisibility, this)\r\n\r\n this.determineNavVisibility()\r\n },\r\n\r\n render: function () {\r\n this.$el.html(FrameTemplate())\r\n // TODO Add header, nav, etc\r\n this.$('main')\r\n .before(this.navWidget.show())\r\n .before(this.headerWidget.show())\r\n .before(this.asideWidget.show())\r\n\r\n return this\r\n },\r\n\r\n tabModal: function (e) {\r\n // 9 is the keycode for the tab key\r\n if (e.which !== 9) {\r\n return\r\n }\r\n var $container = $(e.target)\r\n .closest('.block')\r\n // There is no parent with the block class\r\n if (!$container.length) {\r\n return\r\n }\r\n var $inputs = $container.find(':input:visible:enabled')\r\n .filter(function (index, el) {\r\n var $el = $(el)\r\n return $el.css('visibility') !== 'hidden'\r\n })\r\n var index = $inputs.index(e.target)\r\n var nextInput = $inputs[index + (e.shiftKey ? -1 : 1)]\r\n if (!nextInput) {\r\n nextInput = (e.shiftKey ? $inputs.last() : $inputs[0])\r\n }\r\n var $nextInput = $(nextInput)\r\n if ($nextInput.length) {\r\n e.preventDefault()\r\n $nextInput.focus()\r\n }\r\n },\r\n\r\n updateTitle: function () {\r\n this.$(\"[data-view='Title']\")\r\n .text(this.model.get('title'))\r\n this.$(\"[data-view='SubTitle']\")\r\n .text(this.model.get('subtitle'))\r\n },\r\n\r\n updateBreadcrumb: function () {\r\n var paths = this.model.get('paths')\r\n // Each path has a label and optional destination\r\n this.$('ol.breadcrumb')\r\n .empty()\r\n _.each(paths, function (segment) {\r\n this.$('ol.breadcrumb')\r\n .append('<li>' + (segment.href ? \"<a href='\" + segment.href + \"'>\" + segment.label + '</a>' : segment.label) + '</li>')\r\n }.bind(this))\r\n },\r\n\r\n determineNavVisibility: function (fragment) {\r\n var profileCheck = SessionService.getProfile()\r\n var numberOfCompanies = SessionService.getNumberOfCompany()\r\n this.companyService = new CompanyService()\r\n\r\n if (this.model.get('isLoggedIn')) {\r\n var activeCompany = this.companyService.getActiveCompanyId()\r\n }\r\n\r\n if (!!activeCompany || ((fragment || Backbone.history.getFragment(Backbone.history.location.pathname)) !== 'business-creation')) {\r\n this.$el.addClass('sidebar-o')\r\n } else if ((!!profileCheck && !!numberOfCompanies && ((profileCheck.firstName === '' || profileCheck.lastName === '') && numberOfCompanies < 1) && ((fragment || Backbone.history.getFragment(Backbone.history.location.pathname)) === 'company/wizard')) ||\r\n (!profileCheck && !numberOfCompanies && ((fragment || Backbone.history.getFragment(Backbone.history.location.pathname)) === 'business-creation'))) {\r\n this.$el.removeClass('sidebar-o')\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = FrameView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar FrameView = require('frame-view')\r\nvar SessionService = require('session/session-service')\r\n\r\nvar FrameWidget = function () {\r\n this.model = new Backbone.Model({\r\n title: '',\r\n subtitle: '',\r\n isLoggedIn: SessionService.isSessionActive()\r\n })\r\n this.view = new FrameView({\r\n model: this.model\r\n })\r\n\r\n Backbone.on('app:updateTitle', function (title, subtitle) {\r\n this.model.set({\r\n title: title,\r\n subtitle: subtitle\r\n })\r\n }, this)\r\n\r\n Backbone.on('app:updateBreadcrumb', function (paths) {\r\n this.model.set({\r\n paths: paths\r\n })\r\n }, this)\r\n\r\n Backbone.on('app:sessionStarted', function () {\r\n this.model.set('isLoggedIn', true)\r\n }, this)\r\n}\r\n\r\nFrameWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nmodule.exports = FrameWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<main id=\\\"main-container\\\">\\r\\n <div class=\\\"content bg-white titlebar\\\">\\r\\n <div class=\\\"row items-push\\\">\\r\\n <div class=\\\"col-sm-7\\\">\\r\\n <h1 class=\\\"page-heading\\\">\\r\\n <span data-view=\\\"Title\\\"></span><small data-view=\\\"SubTitle\\\"></small>\\r\\n </h1>\\r\\n </div>\\r\\n <div class=\\\"col-sm-5 text-right hidden-xs\\\">\\r\\n <ol class=\\\"breadcrumb push-10-t\\\" data-view=\\\"Route\\\">\\r\\n </ol>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"content main\\\">\\r\\n </div>\\r\\n <div class=\\\"overlay\\\"></div>\\r\\n</main>\\r\\n\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\n\r\nvar Type = Object.freeze({\r\n Asset: 0,\r\n Liability: 1,\r\n Equity: 2,\r\n Revenue: 3,\r\n Expense: 4\r\n})\r\n\r\nvar Category = Object.freeze({\r\n 0: ['Current Assets', 'Fixed Assets', 'Other Assets', 'Uncategorized'],\r\n 1: ['Current Liabilities', 'Other Liabilities', 'Uncategorized'],\r\n 2: ['Equity', 'Uncategorized'],\r\n 3: ['Revenue', 'Income Taxes', 'Other Income', 'Uncategorized'],\r\n 4: ['Operating Expenses', 'Cost of Goods Sold', 'Income Taxes', 'Other Expense', 'Uncategorized', 'Undistributed']\r\n})\r\n\r\nvar Account = Backbone.Model.extend({\r\n toJSON: function () {\r\n return {\r\n id: this.get('id'),\r\n accountType: _.invert(Type)[this.get('accountType')],\r\n accountName: this.get('accountName'),\r\n status: this.get('status'),\r\n accountNumber: this.get('accountNumber'),\r\n companyId: this.get('companyId'),\r\n accountClass: this.get('accountClass'),\r\n reportingCategory: this.get('reportingCategory')\r\n }\r\n }\r\n}, {\r\n Type: Type,\r\n Category: Category,\r\n parse: function (json) {\r\n return new Account({\r\n id: json.id,\r\n accountType: Type[json.accountType],\r\n accountName: json.accountName,\r\n status: json.status,\r\n accountNumber: json.accountNumber,\r\n companyId: json.companyId,\r\n canDelete: json.canDelete,\r\n hasCheckbook: json.hasCheckbook,\r\n statusMessage: json.status ? '' : 'Inactive',\r\n accountClass: json.accountClass,\r\n reportingCategory: json.reportingCategory\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = Account\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias1(container.lambda(depth0, depth0))\n + \"\\\">\"\n + alias1(((helper = (helper = helpers.key || (data && data.key)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"key\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"expandable-container\\\">\\r\\n <div class=\\\"block expandable add-new-account\\\" data-class=\\\"add-new-account\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right expanding-group-close cancel\\\"></i>\\r\\n <h3 style=\\\"text-align:left\\\">Add New Account</h3>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"form-group col-sm-6 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" data-val=\\\"true\\\" data-val-required=\\\"The account number field is required.\\\" id=\\\"new-account-number\\\" name=\\\"new-account-number\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"new-account-number\\\">Account Number</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"new-account-number\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"form-group col-sm-6 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"new-account-desc\\\" name=\\\"new-account-desc\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"new-account-desc\\\">Account Description</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"new-account-desc\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"form-group col-sm-6 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"new-account-type\\\" name=\\\"new-account-type\\\" size=\\\"1\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.types : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label for=\\\"new-account-type\\\">Account Type</label>\\r\\n </div>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"form-group col-sm-6 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"new-account-category\\\" name=\\\"new-account-category\\\" size=\\\"1\\\"></select>\\r\\n <label for=\\\"new-account-category\\\">Account Category</label>\\r\\n </div>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"block-content hidden-content col-lg-12 no-padding\\\">\\r\\n <div class=\\\"col-lg-12 form-group\\\">\\r\\n <button class=\\\"btn btn-primary pull-right save addNew\\\">Save</button>\\r\\n </div>\\r\\n <div class=\\\"status col-lg-12\\\">\\r\\n <div class=\\\"col-lg-12 bg-primary-lighter\\\"><i class=\\\"fa fa-check-circle fa-2x fa-inverse\\\"></i><span>Your ledger account is valid.</span></div>\\r\\n </div>\\r\\n </div>\\r\\n \\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar $ = require('jquery')\r\nvar Account = require('generalledgeraccounts/account')\r\nvar CreateAccountTemplate = require('generalledgeraccounts/create/template')\r\nvar MAGIC_HIDDEN_PADDING = -72\r\nvar MAGIC_CREATE_PADDING = 35\r\nvar MAGIC_ANIMATION_TIMEOUT = 200\r\nvar StatusBarInterval = null\r\n\r\nvar CreateAccountView = Backbone.View.extend({\r\n\r\n initialize: function () {\r\n this.expanded = false\r\n this.on('accountCreated', this.accountCreated, this)\r\n },\r\n\r\n events: {\r\n 'click .btn.save': 'createAccount',\r\n 'click .expandable': 'showForm',\r\n 'click .cancel': 'closeForm',\r\n 'change #new-account-number': 'validateForm',\r\n 'change #new-account-desc': 'validateForm'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CreateAccountTemplate(this.createViewModel()))\r\n \r\n var typeChanged = false\r\n this.$el.on('change', '#new-account-type', function () {\r\n typeChanged = true\r\n this.populateCategoryDropdown(typeChanged)\r\n }.bind(this))\r\n \r\n this.populateCategoryDropdown()\r\n \r\n return this\r\n },\r\n \r\n populateCategoryDropdown: function (typeChanged) {\r\n if (typeChanged) {\r\n for (var i = 0; i < this.$('#new-account-category option').length; i++) {\r\n this.$('#new-account-category option').remove(i)\r\n }\r\n }\r\n var selectedType = this.$('#new-account-type').val()\r\n var categoriesList = Account.Category\r\n \r\n var selectedCategory = _.find(categoriesList, function(value, index) {\r\n return index === selectedType\r\n }.bind(this)) \r\n \r\n _.each (selectedCategory, function (categoryItem) {\r\n this.$('#new-account-category ').append($('<option value=\"' + categoryItem + '\">' + categoryItem + '</option>'))\r\n }.bind(this))\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n types: Account.Type,\r\n categories: Account.Category\r\n }\r\n },\r\n\r\n closeForm: function (event) {\r\n if (event && event.stopImmediatePropagation) {\r\n event.stopImmediatePropagation()\r\n }\r\n this.$('.expanded')\r\n .parent()\r\n .attr('style', '')\r\n $('.overlay, .expanded')\r\n .attr('style', '')\r\n .removeClass('expanded')\r\n\r\n this.emptyForm()\r\n this.expanded = false\r\n },\r\n\r\n emptyForm: function () {\r\n if (!this.expanded) {\r\n return\r\n }\r\n this.expanded = false\r\n \r\n this.$('#new-account-number').val('')\r\n this.$('#new-account-type option:eq(0)').attr('selected', 'selected')\r\n this.$('#new-account-desc').val('')\r\n \r\n $('.save').prop('disabled', false)\r\n },\r\n\r\n createAccount: function (event) {\r\n event.preventDefault()\r\n\r\n var accountNumber = this.$('#new-account-number').val()\r\n var type = this.$('#new-account-type').val()\r\n var description = this.$('#new-account-desc').val()\r\n var category = this.$('#new-account-category').val()\r\n \r\n if (!this.validateForm()) {\r\n return\r\n }\r\n \r\n this.$('.save').prop('disabled', true)\r\n this.trigger('create', new Account({\r\n accountName: description,\r\n accountType: type,\r\n reportingCategory: category,\r\n accountNumber: accountNumber,\r\n status: true\r\n }))\r\n\r\n this.$('.add-new-account').addClass('expanded')\r\n },\r\n\r\n showForm: function (event) {\r\n if (this.expanded) {\r\n return\r\n }\r\n\r\n event.preventDefault()\r\n this.expanded = true\r\n\r\n var $expandable = this.$('.expandable')\r\n var expandableHeight = $expandable.height()\r\n\r\n $expandable\r\n .height(expandableHeight)\r\n .parent()\r\n .height(expandableHeight)\r\n\r\n var hiddenHeight = _.reduce($expandable.children(), function (sum, n) { \r\n return sum + $(n).outerHeight(true) }, 0) + (MAGIC_HIDDEN_PADDING * 2) - 2\r\n \r\n $expandable\r\n .addClass('expanded')\r\n .height(hiddenHeight)\r\n $expandable\r\n .parent()\r\n .height(hiddenHeight + MAGIC_CREATE_PADDING)\r\n $('.overlay')\r\n .show()\r\n .css('opacity', 1)\r\n .off('click')\r\n .one('click', this.closeForm.bind(this))\r\n\r\n // We have to wait for the animation to complete before we allow all content to always be visible.\r\n setTimeout(function () {\r\n if ($expandable.hasClass('expanded')) {\r\n $expandable.css('overflow', 'visible')\r\n }\r\n }, MAGIC_ANIMATION_TIMEOUT)\r\n\r\n this.validateForm()\r\n\r\n Backbone.once('app:navigate', this.closeForm, this)\r\n },\r\n\r\n updateStatus: function (message, isPositive) {\r\n $('.save').prop('disabled', false)\r\n \r\n this.$('.status span').html(message)\r\n this.$('.status div').removeClass(isPositive ? 'bg-danger-light' : 'bg-primary-lighter')\r\n this.$('.status div').addClass(isPositive ? 'bg-primary-lighter' : 'bg-danger-light')\r\n\r\n if (isPositive) {\r\n this.$('#new-account-number').focus()\r\n }\r\n\r\n StatusBarInterval = setInterval(function () {\r\n this.validateForm()\r\n }.bind(this), 3000)\r\n },\r\n\r\n validateForm: function () {\r\n if (StatusBarInterval != null) {\r\n clearInterval(StatusBarInterval)\r\n StatusBarInterval = null\r\n }\r\n\r\n var accountNumber = this.$('#new-account-number').val()\r\n var description = this.$('#new-account-desc').val()\r\n\r\n this.$('.status div').removeClass('bg-danger-light')\r\n this.$('.status div').removeClass('bg-primary-lighter')\r\n\r\n if (!accountNumber) {\r\n this.$('.status span').html('Account number is required.')\r\n this.$('.status div').addClass('bg-danger-light')\r\n return false\r\n } else if (!description) {\r\n this.$('.status span').html('Account description is required.')\r\n this.$('.status div').addClass('bg-danger-light')\r\n return false\r\n }\r\n\r\n this.$('.status span').html('Your ledger account is valid.')\r\n this.$('.status div').addClass('bg-primary-lighter')\r\n\r\n return true\r\n }\r\n})\r\n\r\nmodule.exports = CreateAccountView\r\n","'use strict'\r\n\r\nvar CreateAccountView = require('generalledgeraccounts/create/view')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\n\r\nvar CreateAccountWidget = function () {\r\n this.view = new CreateAccountView()\r\n this.accountService = new AccountService()\r\n\r\n this.view.on('create', this.create, this)\r\n}\r\n\r\nCreateAccountWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCreateAccountWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nCreateAccountWidget.prototype.create = function (account) {\r\n return this.accountService.createAccount(account).then(function (response) {\r\n if (response.success) {\r\n this.view.updateStatus('Your ledger account has been successfully created.', true)\r\n this.view.emptyForm()\r\n this.trigger('accountCreated')\r\n } else {\r\n this.view.updateStatus(response.message, false)\r\n }\r\n }.bind(this), function (error) {\r\n this.view.updateStatus(error.message, false)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = CreateAccountWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow flex error-row\\\">\\r\\n <div class=\\\"line-number\\\">\"\n + alias4(((helper = (helper = helpers.lineNumber || (depth0 != null ? depth0.lineNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lineNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"reason\\\">\"\n + alias4(((helper = (helper = helpers.reason || (depth0 != null ? depth0.reason : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reason\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block errors\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Accounts Import Errors</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"line-number\\\">Line #</div>\\r\\n <div class=\\\"reason\\\">Error</div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.errors : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15 push-15-r\\\" name=\\\"completeReview\\\">Complete Review</button>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"import-button\\\">\\r\\n <button class=\\\"btn btn-primary pull-right push-30\\\" name=\\\"openImport\\\">Import</button>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block no-padding tabbed collapsed\\\"> \\r\\n <ul class=\\\"nav nav-tabs nav-tabs-alt\\\" data-toggle=\\\"tabs\\\">\\r\\n <li class=\\\"active\\\"><a href=\\\"#crunchedTemplate\\\">Crunched account template (recommended)</a></li>\\r\\n <li class=\\\"\\\"><a href=\\\"#ownTemplate\\\">Use your own template</a></li>\\r\\n <li class=\\\"pull-right\\\"><i class=\\\"fa fa-close expanding-group-close cancel\\\"></i></li>\\r\\n </ul>\\r\\n <div class=\\\"block-content tab-content\\\">\\r\\n <div class=\\\"tab-pane active crunched-template\\\" id=\\\"crunchedTemplate\\\">\\r\\n <p>Upload the Crunched chart of accounts template for a quick setup. This list includes your standard assets, liability, equity, revenue, and expense accounts. You may always edit, delete, or create new accounts.</p>\\r\\n <button class=\\\"btn btn-primary pull-right push-15 setMeUpBtn\\\" name=\\\"useTemplate\\\">Set me up!</button>\\r\\n </div>\\r\\n <div class=\\\"tab-pane own-template\\\" id=\\\"ownTemplate\\\">\\r\\n <div class=\\\"steps\\\">\\r\\n <div class=\\\"step1\\\">\\r\\n <h3>Step 1: Download the account outline</h3>\\r\\n <p><a href=\\\"http://get.crunched.help/hc/en-us/articles/231550207-How-to-import-a-chart-of-accounts\\\" target=\\\"_blank\\\">Click here</a> to download an account outline. You can update this spreadsheet with your own account data.</p>\\r\\n </div>\\r\\n <div class=\\\"step2\\\">\\r\\n <h3>Step 2: Upload your account data</h3>\\r\\n <p>Once you've updated the outline and saved it, please upload it here to import your account data.</p>\\r\\n <label>\\r\\n <span class=\\\"file-name\\\"></span>\\r\\n <span class=\\\"floating\\\">Upload File</span>\\r\\n <input type=\\\"file\\\" name=\\\"outlineUpload\\\">\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15-r push-15 importUpload\\\" name=\\\"upload\\\">Upload</button>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"import-message\\\">\\r\\n <span class=\\\"import-templates\\\">Add accounts using templates</span>\\r\\n <span class=\\\"manually\\\">Add accounts manually</span>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar CreateView = require('lists/list/create/view')\r\nvar InitialSetupTemplate = require('generalledgeraccounts/import/initial-setup-template')\r\nvar ImportButtonTemplate = require('generalledgeraccounts/import/import-accounts-button')\r\nvar ErrorTemplate = require('generalledgeraccounts/import/error-template')\r\nvar sweetAlert = require('sweetalert2')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar ScrollTo = require('jquery-scrollto')\r\n\r\nvar ListView = CreateView.extend({\r\n className: 'import',\r\n\r\n events: {\r\n 'change input[type=file]': 'changeFile',\r\n 'click button[name=useTemplate]': 'uploadTemplate',\r\n 'click button[name=upload]': 'uploadOwn',\r\n 'click button[name=completeReview]': 'completeReview',\r\n 'click button[name=openImport]': 'openImport',\r\n 'click .cancel': 'close'\r\n },\r\n\r\n initialize: function () {\r\n this.Template = InitialSetupTemplate\r\n this.listenTo(this.model, 'change:accounts', this.render)\r\n this.on('uploadErrors', this.uploadErrors, this)\r\n this.on('uploadSuccess', this.uploadSuccess, this)\r\n },\r\n\r\n render: function () {\r\n var TemplateToRender = (this.model.get('accounts').length && !this.forceOpen) ? ImportButtonTemplate : InitialSetupTemplate\r\n\r\n this.$el.html(TemplateToRender(this.model.toViewModel()))\r\n\r\n if (this.onRender) {\r\n this.onRender()\r\n }\r\n\r\n return this\r\n },\r\n\r\n changeFile: function (e) {\r\n var accountSpreadsheet = _.first(e.target.files)\r\n\r\n if (!accountSpreadsheet) return console.warn('No image selected, leaving unchanged')\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (accountSpreadsheetFile) {\r\n this.cachedAccountSpreadsheet = accountSpreadsheetFile.target.result\r\n this.$('.file-name').text(accountSpreadsheet.name)\r\n this.fileNameLabelStyling()\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(accountSpreadsheet)\r\n },\r\n\r\n // For Edge browser, to prevent an overraping text issue of text:file-name and a label.\r\n fileNameLabelStyling: function () {\r\n this.$('.floating').css({\r\n 'top': '-29px',\r\n 'font-weight': 600,\r\n 'font-size': '13px'\r\n })\r\n },\r\n\r\n uploadTemplate: function () {\r\n this.upload(accountTemplate)\r\n },\r\n\r\n uploadOwn: function () {\r\n this.upload(this.cachedAccountSpreadsheet)\r\n },\r\n\r\n upload: function (spreadsheet) {\r\n this.$('.setMeUpBtn').prop('disabled', true)\r\n this.$('.importUpload').prop('disabled', true)\r\n this.trigger('upload', { import: spreadsheet })\r\n },\r\n\r\n btnEnable: function () {\r\n $('.setMeUpBtn').prop('disabled', false)\r\n $('.importUpload').prop('disabled', false)\r\n },\r\n\r\n completeReview: function () {\r\n this.$('.errors').remove()\r\n\r\n $('.block[hidden-during-review], .import-message[hidden-during-review], .import-button[hidden-during-review]')\r\n .removeClass('hidden')\r\n .attr('hidden-during-review', null)\r\n\r\n $('.page-heading').ScrollTo()\r\n },\r\n\r\n uploadErrors: function (errors, successCount) {\r\n this.close()\r\n\r\n $('.block, .import-message, .import-button')\r\n .addClass('hidden')\r\n .attr('hidden-during-review', '1')\r\n\r\n this.$el.append(ErrorTemplate({ errors: errors }))\r\n var totalCount = errors.length + successCount\r\n\r\n if (!successCount) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: successCount + ' of ' + totalCount + ' accounts have been imported, some information couldn\\'t be parsed.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n } else {\r\n sweetAlert({\r\n title: 'Warning',\r\n text: successCount + ' of ' + totalCount + ' accounts have been imported, some information couldn\\'t be parsed.',\r\n type: 'warning',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n }\r\n },\r\n\r\n uploadSuccess: function (successCount) {\r\n this.close()\r\n\r\n sweetAlert({\r\n title: 'Success',\r\n text: successCount + ' of ' + successCount + ' accounts have been imported. Please set up your account assignments to get the most out of Crunched.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n\r\n openImport: function () {\r\n this.forceOpen = true\r\n this.$el.addClass('forced-open')\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.close.bind(this))\r\n this.render()\r\n },\r\n\r\n close: function () {\r\n this.forceOpen = false\r\n this.$el.removeClass('forced-open')\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n this.render()\r\n }\r\n})\r\n\r\nvar accountTemplate = 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,UEsDBBQACAgIAGlFhkoAAAAAAAAAAAAAAAAYAAAAeGwvZHJhd2luZ3MvZHJhd2luZzEueG1sndBBTsMwEAXQE3CHaPatAwuEoqbdRJwADjDYk9jCY1szLm1vj0XJvsry62uevuZwunLsfkg05DTC876HjpLNLqRlhM+P990bdFoxOYw50Qg3Ujgdnw5XJ8NFJ+nafdKhxRF8rWUwRq0nRt3nQqm1cxbG2qIsxglemszRvPT9q9EihE49UZ3uDfx7uEFjDGm9f2hNnudgacr2zJTqHRGKWNsv1Ieiq2Y3rLEepa4APyQwyve57Gzm0jZ8hRjq7Q9bGbfwhiUu4CLIYI6/UEsHCB+aYCjMAAAA7gEAAFBLAwQUAAgICABpRYZKAAAAAAAAAAAAAAAAGAAAAHhsL3dvcmtzaGVldHMvc2hlZXQxLnhtbI2cW3MiyRFGf4H/g4L3EV19qYtC0oa9ig3vm8PhtZ9ZhEbECFAAkmb/vRGgysrML5vah53b6dKZhsoDontuf/m5erl6X2x3y836buKum8nVYj3fPC7X3+8mf/znt29xcrXbz9aPs5fNenE3+Wuxm/xy/7fbj832x+55sdhfHRZY7+4mz/v96810ups/L1az3fXmdbE+/MnTZrua7Q+/3H6f7l63i9nj8aDVy7RtGj9dzZbryWmFm23NGpunp+V88bCZv60W6/1pke3iZbY/6O+el6+7r9VWP9Vyq+V8u9ltnvbX883qvNLBYD5d/JwvjkKRCa3mNUar2fbH2+u3w5KvB4s/ly/L/V9Hr7zM+93kbbu+Oa/xLWt8HnNz+Po376uXL/in6+u81clM08TsDyvN9F+gfq3ZPK+0qlsmn8bz43p/e1zyv8vFx674+dXnU+fPzebH5y9+f7ybNJPp/e1Usb8dT/K/tlfzt91+s/rnYvn9eX94ik6uHhdPs7eX/a+bl/8tH/fPh9/rr/su//6/Nx8ZHq7D8Ln8fPOyO/7/vNrXgZOr1XJ9+nH28/jjx/lP/PUQzkfiY7rzMV0+ZhguHdOfj+nzMW1z3abjCTgpHv/qD7P97P52u/m42n4ee1jw8yd/P6yyO651+JvtDr/7ft/cTt8/Dz0T/9CE48Svmmg58aCJLhPTg1MWa7NYezykPX3BpmmupdcXQGv2wksTg/DShMdeXfbquNegvLqLXpoIwksThlefvXrm5fT56i96aSIKL00YXkP2GriXPl/DRS9NJOGlCcPLZy/PvFp9vvxFL004sciDRgyxkMVCKebAEz/oLyt3JEDkltSIYRazWeRm+qGMl80A0gkzjRhmKZslZgae/Onig6kJJ5AHjRhirqH52pRqLXg4M2G7AcTJUQYYy66Y/q6065Cdu2ynEeelnWYsO0qAYw3okd3lCADEyXGLmGjoUQlcx/X0fnCXWwAQJ6cbYiw9CoJjRejBpnCXkwCQVs44wJh61AU3cD1w9i6XASCtk3qaMfUoD471oQd9cJcDAZBWvTQCFbH0KBKOVWJAW0MPeKWnkVYOY8CYelQKx1LhkZ6e8kpPI60cyYgZDD3KhWO98GhrXA4GQFo19gBj6LXUjJY1I6DXvpebAZBWzj3EWHoUjfY0y7vzNEB6X0SxbpR+gJGDDzBdY/gV7xxa7qcnSybG/DTTydGCGMuPutF2pR96hZeJYt1W+gFGbl7EWH4UjrYv/dBLlkyM+QFG7l7EWH5UjnYo/dCLlkyM+QFGvT0EjOVH6Wh96YdetmRizA8wcrwgJhh+1I42lH6oHZkY8wOMfLuIGMuP4tHG0g/FIxNjfoBR8wUwlh/Vo02lHxzPqcJPM718ZYXWMfw6ykfXlH4R+GVixA8wvZx/aB3Lj/rRnaZ6f95PyO+LKL628gOMnH/j63A/6kfXln5oPmdizA8wcv6Nr8P9iu9AdaUfms+ZGPMDjJx/4+twP+pH15d+aD5nYswPMHL+ja/D/agf3VD6ofmciTE/wKhv442uw/2oH91pqg/nmYD8vohiXfn6BTFy/o2vw/2oH10o/eD+CGrdoZF+gFHzRTOmH/Wji6Uf3B+x4vxpZpDv3cbX4X7Ujy6Vfgn5pQo/zQxq/o2uw7+RTP3oT1Pdnx834JeJ4murbyYDRs4XxFjf6KZ+9K70Q8+/TIz5AUbuX8RYftSPvuV++v1HJop15eOLGLl/EWP5UT/6rvRD+yMTY+dPM16+fkHrWH7FJxk99wPnr6/w04yX8wWtY/lRP/qB+aGPWoYKP814OV/QOpYf9aP3pR/qbybG/DTj5XxB61h+1I8+lH5o/mVizE8zXr6+QutYftSPPhZ+Hs6/WOGnGa/mH2AsP+pHn7gf2B+pwk8zXs0/wFgf+FE/hob5gf0xVPQDMF6+v0SM5Uf9GBz3Ax9JVvQDMF59LAkYy4/6MbTMD3zreQBzX/lpJsj5DBjTj/oxdNwPnL+KfgAmyPkMGNOP+jGU/fDo9cFQ0Q/ABDmfAWP6FZ+ID9yv1X4V/QBMkPMZMKYf9WPw3K/XfhX9AEyQ8xkwph/1Ywjcz2u/in4AJsj5DBjTj/oxRO4XtV9FPwAT5PtfwJh+1I+B9QN9Wj5U9AMwQfYDMJafp374hvvp/eEr+gGYIPsBGNOP+uEd99P7w1f0AzBB9gMwph/1w7fcT+8PX9EPwER1dUt9Pzz1w3fcT+8PX9EPwETZD8CYftQPz/uBLg2q6AdgouwHYEw/6ofn/WjB/qjoB2Ci7AdgTL/iyirejxbsj4p+ACbKfgDG9KN+eN6PFuyPin4AJsp+AMb0o3543o8W7I+KfgAmyn4AxvSjfnjejw7sj4p+ACbKfgDG8gvUj8D70en9ESr6AZgo+wEY04/6EXg/Or0/QkU/ABNlPwBj+lE/Au9Hp/dHqOgHYJLsB2BMP+pH4P3o9P4IFf0ATJL9AIzpR/0IvB89uIKzoh+ASeoazvp+BOpH4P3owf6o6AdgkuwHYEw/6kfg/ejB/qjoB2CS7AdgTL/iAl3ejx7sj4p+ACbJfgDG9KN+BN6PHuyPin4AJsl+AMb0o34E3o8B7I+KfgAmyX4AxvKL1I/I+zHo/REr+gGYJPsBGNOP+hF5Pwa9P2JFPwCTZD8AY/pRPyLvx6D3R6zoB2BcIwMCIFOQAhJ5QAa9QWJFQADjGlkQAJmCVJDIC+L1DokVBTkzYewTJLCO6UcFibwgHuyQioKcmcBOoEwcWMgUpIREnhAPtkhFQgDjGnW3Qn1DIjUk8oZ4sEcqGgIY18jIAcgULO714BHxYI9URAQwrpGVA5ApSBWJvCIB7JGKigDGNTJzALIEE2Uk8YwEvUlSRUYA4xrZOQCZgtSRxDsS9CZJFR0BjGtk6ABkClJIEg9J0JskVYQEMK6RcxBApiCFJPGQBL1JUkVIAOPUjWQAMgUpJImHJIIbo0BI5KUIgHHyxq4HAJmCVJJ0Gu+na2EC+qw1E7SuuhYGME7d8AYh4zbURClJvjREnyZlYsxQM+pqHcDYgpSSVF6OFdDlHGn0MqqzoGacujPvAsQNqSWpbEmED3JFSwDj9C16CDJuaUjF/YNlTCJ8kCtiAhin7oSDkHXLSlPeSFj2JOI7CSuCgiCn74iDlKlZ3FHYlFWJ8JbCpiIrCHLgpsdxSmgWtxY2ZVsSek4SMqoJ6uJk/jCVLM2u0CwLk9ATk5BRTdAYfSMfomzN4lbDpuxMOvwHNCvesSDI6Rv6ICWvq50W/+rB43b2sVx/v9reLB/vJtvfH93xX0fI/97I/f8BUEsHCIBrzZe2CQAAs0QAAFBLAwQUAAgICABpRYZKAAAAAAAAAAAAAAAAIwAAAHhsL3dvcmtzaGVldHMvX3JlbHMvc2hlZXQxLnhtbC5yZWxzjc9LCsIwEAbgE3iHMHuT1oWINO1GhG6lHmBIpg9sHiTx0dubjaLgwuXMz3zDXzUPM7MbhTg5K6HkBTCyyunJDhLO3XG9AxYTWo2zsyRhoQhNvapONGPKN3GcfGQZsVHCmJLfCxHVSAYjd55sTnoXDKY8hkF4VBccSGyKYivCpwH1l8laLSG0ugTWLZ7+sV3fT4oOTl0N2fTjhdAB77lYJjEMlCRw/tq9w5JnFkRdia+K9RNQSwcIrajrTbMAAAAqAQAAUEsDBBQACAgIAGlFhkoAAAAAAAAAAAAAAAAUAAAAeGwvc2hhcmVkU3RyaW5ncy54bWyNV1tvGjkU/gX7H6x52JVWm5I00mqVBaoEQheJNBUX9dnMHBgLjz31hUB/fY+BYYFjk75EYc799p3j9qdNJdkajBVadbK7D7cZA5XrQqhlJ5tNBzf/ZMw6rgoutYJOtgWbfer+1rbWMRRVtpOVztUPrZbNS6i4/aBrUEhZaFNxhz/NsmVrA7ywJYCrZOvj7e3frYoLlbFce+U62f3dfca8Et899PZf7j7eZ922Fd226z7mOzb2xVdzMO2W67ZbgXJOnW5rSNH6YHMjaocxXrKModbGYbSsxx0stdkSJdaCu/zYKyFfBakb9lqD4UED4fHGAFrfKbBXNHzlW6OlJBwGCuHQL1MgUx8dtfhTKDY1XOG/hJ/bsrVT+0vsE75G88Svnbd/JjJp2RhyEGs+lyTZM1XsbULBet46XYEJoVWYA2pFSv3GVQ4M+4T1tZ+7hZesMXPJPlRr1BIpzlcDNRcFe95g11kgggNvlHDeAPudV/W/bCA24RflExt0O16p5+9e1CGKS8KTF7KI5tBj9HouJDU0Am6h1LJgw6o2eg3x9OS5r7zkIZdYSQO54LHuHSoczaXAaiR8f3UlViFOOzXyWIUp+BE1MoHcG+G2TU/RmATHWJEj3TbYB7GeaUak0SBowmaK17UUv9JURz9Il+wHjE35BpK+TDiWK7AknT2ZxwTLF+0gRduX4kqku9ZISWMmjYd0o59axvEfaUSWKZjqqpFrjKHraSZ7uqq0YhOn8xWFUoegHnzkOHSRsejxWjhOcW7/mfW0ckbMPfYjyd2bAvOHZX3D36hZxAafKGeCePhM+nUv1Bc2DkONToQQRYgvKAVScgXaWzbEJVoRu4fqJeENC/IES6FUbJ1oXLl6wT5rXVg2QQghbe5NXvJIcxzMknAbgXTEjdERnyNO37BvfEnVXzKdjdt7zM9VLfUWAANXsIigy3leg3h6PQR9qogkDyvHTWTmjss7OVjRiM8ifGCDYe/xPZbZ9D2WyfssOwwh0FDg/eaEjYR9Ddb/X1Js4IFM5Qn5BcfagQrrmqxAHhbUnJbkiasV65XcRLL3pPVqBVCHtE/ArEVE72G1XrPdk8DVFR2IVTWCiWETv9sgkVY8YcBEXdL7Wu0yZw/HwxGgwjfC7MH+xQYQ/u7ZR+gTuk2nsfB5tCLHURiD5FEjz5gLE1A2do4c7xSUVxGc/SwWtE7/AZeuRLiy3sSSnCSMYImYHeK9oIRnwYOteY6vBbxcLBYHsu4LNyvYDRqZb/SADj0EZMJQDrWNGTpHBjLZi0WQS9X+1TsrCmj00wlHnMHJp/emXoANj6V48IEBIQWPpSj4jSNlG4cL1jQ9dqXfmzuMfPfz4/OGWJyChLrEpxshGL6mUz9TIjzc6BXmEkfLN5iHkz8Nn+gx3OjFIgLa2MuAyyC+KvfnUpx2FE3s071sgnh6T6d4zndOgmkABS4PefAxFJz62VBoYiYOD+8rsvicEjZ1D81Uvn+tih+nxBa+yrs/AVBLBwjh9KsfZwQAANMPAABQSwMEFAAICAgAaUWGSgAAAAAAAAAAAAAAAA0AAAB4bC9zdHlsZXMueG1szZbNbqMwEMefYN8B+d44X+02FVBFSVjtZS9tpb0aMIm1/kC2U8E+/Y5jCIlCtdlt1JRDsGeG/29sxhPCx0rw4JVqw5SM0GgwRAGVmcqZXEfo5Tm5uUeBsUTmhCtJI1RTgx7jL6GxNadPG0ptAArSRGhjbfmAsck2VBAzUCWV4CmUFsTCVK+xKTUluXEPCY7Hw+EdFoRJ5BUeqtGUZCc6gmVaGVXYQaYEVkXBMnqqNMMzTLJWSZzK9KQjiP61LW9AtiSWpYwzW++yQnFYKGlNkKmttBGaNoY4NL+DV8Jhn4awUTgOM8WVDvQ6jVCSDHeXM0siqA+ca0a4M2Ev4H/TYwNu7W/INaG7m4FYxvk+t6/IG+IQFmGplglMgmb8XJfwyiS8OC+zi/tLNGfrjf2mSX3+I0Zxlrs81ovDBSyS1TiZOJn0LQc+0HwnbTlbjlezHlrnuCAtWaxuF8seWue46NpW82XfTnaOS65tuoCrb217Ry9td4P6TJXOoaG0FTpCrSkOOS1ctWtXY3C3qnQUZS0cbRBow5oBaGWU8yfXan4WR4JVEfiY73mEoGc5dDuEU9IM5VYkop2QsuT1HMpbCuplvClRfuYSOMR5+AH3/v+4VXFmAnFIWqfLpSrOwo0+ADfucON/xoHGu+CTa8Kn14TfXhN+90ngkwvWN25O9EFfOeoqe2tHcX/lEfrhPhs4CtIt45ZJ7ztqGKCZV12v8N7uIyn+A1BLBwissDPOJgIAAGkJAABQSwMEFAAICAgAaUWGSgAAAAAAAAAAAAAAAA8AAAB4bC93b3JrYm9vay54bWyNkkFugzAQRU/QOyDvEydtVaUokE1VKZuqUtoDOPYQrHhsyzaU3L4TAkhRNqzAxvPmefjbXYcmayFE7WzB1ssVy8BKp7Q9Fez353OxYVlMwiphnIWCXSCyXfm0/XPhfHTunFG9jQWrU/I551HWgCIunQdLXyoXUCRahhOPPoBQsQZIaPjzavXGUWjLboQ8zGG4qtISPpxsEGy6QQIYkcg+1trHkYbdAw61DC66Ki2lw4FEBpJDJ6EX2twJoZxjhCKcG78gpCeLozY6XXqvCdMWrAk2HxiLSeNak1P/vEUzHu7Wr/O8H4b5zt/v7IkkHi8wnyXkRMJ5mGmMw38tp4x8B15ue34cntdIJUpTq6M+GmCZFUjLQx+0oA6QGk+5ux7dK4oly0Ku6SXs1QsjGB9pCiptQX1ReaR9KYzsu/Gxd/kPUEsHCFJbsaxCAQAA4gIAAFBLAwQUAAgICABpRYZKAAAAAAAAAAAAAAAAGgAAAHhsL19yZWxzL3dvcmtib29rLnhtbC5yZWxzrZHPasMwDIefYO9gdF+cdDDGqNNLGfS6ZQ8gbCUOTWxjaX/y9vMY21IoY4eehGT0/T7k7e59ntQrZR5jMNBUNSgKNroxDAaeu4frO1AsGBxOMZCBhRh27dX2kSaUssN+TKwKJLABL5LutWbraUauYqJQXvqYZ5TS5kEntEccSG/q+lbnNQPaE6Y6OAP54BpQ3ZLoP+zY96OlfbQvMwU5E6FZlqn4qw7zQGLgq68KB/T5+M1F4z1mck+Sy3HXFuvxXzI3l5R5i/nInkh+RX5Gn6qlNN8y+uS32w9QSwcIC39pcdoAAAA1AgAAUEsDBBQACAgIAGlFhkoAAAAAAAAAAAAAAAALAAAAX3JlbHMvLnJlbHONz0EOgjAQBdATeIdm9lJwYYyhsDEmbA0eoLZDIUCnaavC7e1SjQuXk/nzfqasl3liD/RhICugyHJgaBXpwRoB1/a8PQALUVotJ7IoYMUAdbUpLzjJmG5CP7jAEmKDgD5Gd+Q8qB5nGTJyaNOmIz/LmEZvuJNqlAb5Ls/33L8bUH2YrNECfKMLYO3q8B+bum5QeCJ1n9HGHxVfiSRLbzAKWCb+JD/eiMYsocCrkn88WL0AUEsHCKRvoSCyAAAAKAEAAFBLAwQUAAgICABpRYZKAAAAAAAAAAAAAAAAEwAAAFtDb250ZW50X1R5cGVzXS54bWy1U8tOAzEM/AL+YZUratJyQAh12wOPIyBRPsAk3m7UvBS7r78nu22RqIoEUnuKk7Fnxk4ynm68q1aYycZQi5EcigqDjsaGeS0+Zs+DO1ERQzDgYsBabJHEdHI1nm0TUlWKA9WiZU73SpFu0QPJmDAUpInZA5dtnqsEegFzVDfD4a3SMTAGHnDHISbjR2xg6bh62J131LWAlJzVwMWXKmSietoUcGez26s/1K2COTIz2BuRGV2fQ61NdH0sUFDqFF7LZLI1+C+J2DRWo4l66UuJpJQRDLWI7J1cx7zo453mG2R+AV9I1capb5BUv4zkvtPz+6AWMpp3zuWi6ZSXHwnn9GEyrAvnKc09RIfgkv3z1uHpxnvkkpMvq/Rgw29P4DPGxUFf9R9t8gVQSwcI3nWToikBAACoAwAAUEsBAhQAFAAICAgAaUWGSh+aYCjMAAAA7gEAABgAAAAAAAAAAAAAAAAAAAAAAHhsL2RyYXdpbmdzL2RyYXdpbmcxLnhtbFBLAQIUABQACAgIAGlFhkqAa82XtgkAALNEAAAYAAAAAAAAAAAAAAAAABIBAAB4bC93b3Jrc2hlZXRzL3NoZWV0MS54bWxQSwECFAAUAAgICABpRYZKrajrTbMAAAAqAQAAIwAAAAAAAAAAAAAAAAAOCwAAeGwvd29ya3NoZWV0cy9fcmVscy9zaGVldDEueG1sLnJlbHNQSwECFAAUAAgICABpRYZK4fSrH2cEAADTDwAAFAAAAAAAAAAAAAAAAAASDAAAeGwvc2hhcmVkU3RyaW5ncy54bWxQSwECFAAUAAgICABpRYZKrLAzziYCAABpCQAADQAAAAAAAAAAAAAAAAC7EAAAeGwvc3R5bGVzLnhtbFBLAQIUABQACAgIAGlFhkpSW7GsQgEAAOICAAAPAAAAAAAAAAAAAAAAABwTAAB4bC93b3JrYm9vay54bWxQSwECFAAUAAgICABpRYZKC39pcdoAAAA1AgAAGgAAAAAAAAAAAAAAAACbFAAAeGwvX3JlbHMvd29ya2Jvb2sueG1sLnJlbHNQSwECFAAUAAgICABpRYZKpG+hILIAAAAoAQAACwAAAAAAAAAAAAAAAAC9FQAAX3JlbHMvLnJlbHNQSwECFAAUAAgICABpRYZK3nWToikBAACoAwAAEwAAAAAAAAAAAAAAAACoFgAAW0NvbnRlbnRfVHlwZXNdLnhtbFBLBQYAAAAACQAJAFkCAAASGAAAAAA='\r\n\r\nmodule.exports = ListView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar CompanyService = require('company/company-service')\r\nvar AccountImportView = require('generalledgeraccounts/import/view')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar AccountImportWidget = function () {\r\n this.accountService = new AccountService()\r\n this.companyService = new CompanyService()\r\n\r\n this.model = new Backbone.Model({\r\n accounts: []\r\n })\r\n\r\n this.model.toViewModel = this.model.toJSON.bind(this.model)\r\n\r\n this.view = new AccountImportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('upload', this.upload.bind(this))\r\n\r\n this.loadAccounts()\r\n}\r\n\r\nAccountImportWidget.prototype = _.clone(Backbone.Events)\r\n\r\nAccountImportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nAccountImportWidget.prototype.loadAccounts = function () {\r\n return this.accountService.fetchAccounts().then(function (results) {\r\n this.model.set('accounts', results)\r\n }.bind(this))\r\n}\r\n\r\nAccountImportWidget.prototype.upload = function (spreadsheet) {\r\n return this.accountService.importSpreadsheet(spreadsheet).then(function (results) {\r\n return this.loadAccounts().then(function () {\r\n var errors = results.parseErrors\r\n var successCount = results.successCount\r\n\r\n this.once('refreshed', function () {\r\n this.view.btnEnable()\r\n if (errors.length) {\r\n this.view.trigger('uploadErrors', errors, successCount)\r\n } else {\r\n this.view.trigger('uploadSuccess', successCount)\r\n }\r\n }.bind(this))\r\n\r\n this.trigger('refresh')\r\n }.bind(this))\r\n }.bind(this), function (error) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: error + '',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Ok'\r\n })\r\n this.view.btnEnable()\r\n }.bind(this)).then(function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.companyService.updateActiveCompany(companyId)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = AccountImportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"ledger-account col-xs-12 itemrow flex \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.status : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\\" data-id='\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"'>\\r\\n <div class=\\\"col-xs-3 account-number\\\">\"\n + alias4(((helper = (helper = helpers.accountNumber || (depth0 != null ? depth0.accountNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-3 account-type\\\">\"\n + alias4(((helper = (helper = helpers.accountType || (depth0 != null ? depth0.accountType : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountType\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-3 account-description\\\">\"\n + alias4(((helper = (helper = helpers.reportingCategory || (depth0 != null ? depth0.reportingCategory : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reportingCategory\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-3 account-description\\\">\"\n + alias4(((helper = (helper = helpers.accountName || (depth0 != null ? depth0.accountName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"account-status\\\">\"\n + alias4(((helper = (helper = helpers.statusMessage || (depth0 != null ? depth0.statusMessage : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"statusMessage\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"account-actions\\\">\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.statusMessage : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.program(9, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"disabled\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.canDelete : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.program(7, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-trash-o pull-right remove\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-unlock-alt pull-right disable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"9\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-lock pull-right enable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Accounts</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless col-sm-12 history\\\">\\r\\n <div class=\\\"col-xs-12 head flex\\\">\\r\\n <div class=\\\"col-xs-3\\\">Account #</div>\\r\\n <div class=\\\"col-xs-3\\\">Type</div>\\r\\n <div class=\\\"col-xs-3\\\">Category</div>\\r\\n <div class=\\\"col-xs-3\\\">Description</div>\\r\\n <div class=\\\"account-status\\\"></div>\\r\\n <div class=\\\"account-actions\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.accounts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar ListTemplate = require('generalledgeraccounts/list/template')\r\nvar ConfirmWidget = require('forms/confirm/widget')\r\nvar EditAccountWidget = require('generalledgeraccounts/update/widget')\r\nvar Account = require('generalledgeraccounts/account')\r\nvar ScrollTo = require('jquery-scrollto')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar ListView = Backbone.View.extend({\r\n className: 'generalledgeraccounts',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:accounts', this.render)\r\n this.on('error', this.error, this)\r\n },\r\n\r\n events: {\r\n 'click .remove': 'removeAccount',\r\n 'click .disable': 'disableAccount',\r\n 'click .enable': 'enableAccount',\r\n 'click .edit': 'editAccount'\r\n },\r\n\r\n render: function () {\r\n this.accountLookup = _.keyBy(this.model.get('accounts'), 'id')\r\n this.$el.html(ListTemplate(this.createViewModel()))\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n accounts: this.model.get('accounts').map(function (item) {\r\n return {\r\n accountNumber: item.get('accountNumber'),\r\n accountType: _.invert(Account.Type)[item.get('accountType')],\r\n accountName: item.get('accountName'),\r\n id: item.get('id'),\r\n canDelete: item.get('canDelete'),\r\n status: item.get('status'),\r\n statusMessage: item.get('statusMessage'),\r\n reportingCategory: item.get('reportingCategory')\r\n }\r\n })\r\n }\r\n },\r\n\r\n editAccount: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var id = $currentTarget.attr('data-id')\r\n var account = this.accountLookup[id]\r\n var rowPosition = $currentTarget.closest('.itemrow').position().top + 64\r\n this.trigger('editAccount', account)\r\n\r\n var edit = new EditAccountWidget(account, rowPosition)\r\n var $edit = $(edit.show())\r\n\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).on('click', function () {\r\n edit.trigger('cancel')\r\n })\r\n\r\n edit.on('cancel close', function () {\r\n $edit.remove()\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n this.$('.table').attr('style', '')\r\n }, this)\r\n\r\n edit.on('close', function () {\r\n this.trigger('refresh')\r\n }, this)\r\n\r\n this.$el.append($edit)\r\n var tableHeight = this.$('.table').outerHeight()\r\n var offset = rowPosition\r\n var outerHeight = $edit.outerHeight()\r\n var requiredHeight = outerHeight + offset\r\n if (tableHeight < requiredHeight) {\r\n this.$('.table').css({\r\n 'padding-bottom': requiredHeight - tableHeight\r\n })\r\n }\r\n\r\n setTimeout(function () {\r\n $edit.ScrollTo()\r\n }, 100)\r\n },\r\n\r\n removeAccount: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var generalLedgerAccountId = $currentTarget.attr('data-id')\r\n var account = this.accountLookup[generalLedgerAccountId]\r\n\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'Are you sure you want to delete this account?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#DD6B55',\r\n confirmButtonText: 'Yes',\r\n cancelButtonText: 'No'\r\n }).then(function () {\r\n this.trigger('deleteAccount', account)\r\n }.bind(this))\r\n },\r\n\r\n disableAccount: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var generalLedgerAccountId = $currentTarget.attr('data-id')\r\n var account = this.accountLookup[generalLedgerAccountId]\r\n\r\n if (account.get('status')) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'Are you sure you want to disable this account? You will not be able to use this account for future entries.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#DD6B55',\r\n confirmButtonText: 'Disable Account',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.trigger('disableAccount', account)\r\n }.bind(this))\r\n }\r\n },\r\n\r\n enableAccount: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var generalLedgerAccountId = $currentTarget.attr('data-id')\r\n var account = this.accountLookup[generalLedgerAccountId]\r\n\r\n if (!account.get('status')) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'Are you sure you want to enable this account?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#DD6B55',\r\n confirmButtonText: 'Enable Account',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.trigger('enableAccount', account)\r\n }.bind(this))\r\n }\r\n },\r\n\r\n closeConfirmModal: function () {\r\n this.$('.infinity .confirm').remove()\r\n this.$('.infinity .inlineModal').removeClass('inlineModal')\r\n },\r\n\r\n error: function (ex, relatedAccount) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: ex.message,\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = ListView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar AccountListView = require('generalledgeraccounts/list/view')\r\n\r\nvar AccountListWidget = function () {\r\n this.accountService = new AccountService()\r\n this.model = new Backbone.Model({\r\n accounts: []\r\n })\r\n this.view = new AccountListView({\r\n model: this.model\r\n })\r\n this.view.on('deleteAccount', this.deleteAccount, this)\r\n this.view.on('disableAccount', this.disableAccount, this)\r\n this.view.on('enableAccount', this.enableAccount, this)\r\n this.view.on('refresh', this.refresh, this)\r\n}\r\n\r\nAccountListWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.refresh()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nAccountListWidget.prototype.refresh = function () {\r\n return this.accountService.fetchAccounts().then(function (results) {\r\n this.model.set('accounts', results)\r\n }.bind(this))\r\n}\r\n\r\nAccountListWidget.prototype.deleteAccount = function (account) {\r\n this.accountService.deleteAccount(account.get('id')).then(function () {\r\n return this.accountService.fetchAccounts()\r\n }.bind(this)).then(function (results) {\r\n this.model.set('accounts', results)\r\n }.bind(this))\r\n}\r\n\r\nAccountListWidget.prototype.disableAccount = function (account) {\r\n return this.accountService.disableAccount(account.id).then(function () {\r\n this.refresh()\r\n }.bind(this),\r\n function (error) {\r\n this.view.trigger('error', error, account)\r\n }.bind(this))\r\n}\r\n\r\nAccountListWidget.prototype.enableAccount = function (account) {\r\n return this.accountService.enableAccount(account.id).then(function () {\r\n this.refresh()\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = AccountListWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar AccountWidget = require('generalledgeraccounts/widget')\r\n\r\nvar GeneralLedgerAccountsRouter = Router.extend({\r\n routes: {\r\n 'generalledgeraccounts': 'showGeneralLedgerAccounts'\r\n },\r\n\r\n showGeneralLedgerAccounts: function () {\r\n Backbone.trigger('app:showInFrame', new AccountWidget())\r\n Backbone.trigger('app:updateTitle', 'Chart of Accounts', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'General Ledger'}, {label: 'Accounts', href: 'generalledgeraccounts'}])\r\n }\r\n})\r\n\r\nmodule.exports = GeneralLedgerAccountsRouter\r\n","'use strict'\r\n\r\nvar RestClient = require('rest/client')\r\nvar Config = require('config/config')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\nvar Account = require('generalledgeraccounts/account')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar AccountService = function () {\r\n this.client = new RestClient()\r\n this.companyService = new CompanyService()\r\n this.companyId = this.companyService.getActiveCompanyId()\r\n}\r\n\r\nAccountService.prototype.GetQuery = function (queryObject) {\r\n queryObject = _.transform(queryObject, function (res, val, key) {\r\n if (val) {\r\n res[key] = val\r\n }\r\n })\r\n\r\n var query = $.param(queryObject)\r\n\r\n if (query) {\r\n return '?' + query\r\n } else {\r\n return false\r\n }\r\n}\r\n\r\nAccountService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'ledger-accounts'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nAccountService.prototype.fetchAccounts = function (includeCheckbookAccounts, systemAccountsOnly) {\r\n if (includeCheckbookAccounts == null || includeCheckbookAccounts === undefined) {\r\n includeCheckbookAccounts = true\r\n }\r\n\r\n var apiPath = this.GetPath()\r\n\r\n var query = {\r\n includeCheckbookAccounts: includeCheckbookAccounts,\r\n systemAccountsOnly: !!systemAccountsOnly\r\n }\r\n\r\n query = this.GetQuery(query)\r\n if (query) {\r\n apiPath = apiPath + query\r\n }\r\n\r\n return this.client.get(apiPath).then(function (response) {\r\n return _.map(response, Account.parse)\r\n })\r\n}\r\n\r\nAccountService.prototype.fetchAccount = function (accountId) {\r\n return this.client.get(Config['CRUNCHED_API_HOST'] + '/companies/' + this.companyId + '/ledger-accounts/' + accountId).then(function (response) {\r\n return _.chain(response)\r\n .map(Account.parse)\r\n .first()\r\n .value()\r\n })\r\n}\r\n\r\nAccountService.prototype.createAccount = function (account) {\r\n return this.client.post(\r\n Config['CRUNCHED_API_HOST'] + '/companies/' + this.companyId + '/ledger-accounts/',\r\n account\r\n )\r\n}\r\n\r\nAccountService.prototype.createAccountBatch = function (account) {\r\n return this.client.post(\r\n Config['CRUNCHED_API_HOST'] + '/companies/' + this.companyId + '/ledger-accounts/batch',\r\n account\r\n )\r\n}\r\n\r\nAccountService.prototype.deleteAccount = function (id) {\r\n return this.client.del(Config['CRUNCHED_API_HOST'] + '/companies/' + this.companyId + '/ledger-accounts/' + id)\r\n}\r\n\r\nAccountService.prototype.updateAccount = function (account) {\r\n return this.client.put(Config['CRUNCHED_API_HOST'] + '/companies/' + this.companyId + '/ledger-accounts/' + account.get('id'), account)\r\n}\r\n\r\nAccountService.prototype.setAccountStatus = function (accountId, status) {\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n this.companyId,\r\n 'ledger-accounts',\r\n accountId,\r\n 'disable'\r\n ]\r\n\r\n var actionPath = actionPathSegments.join('/')\r\n\r\n return this.client.put(actionPath, !!status)\r\n}\r\n\r\nAccountService.prototype.disableAccount = function (accountId) {\r\n return this.setAccountStatus(accountId, false)\r\n}\r\n\r\nAccountService.prototype.enableAccount = function (accountId) {\r\n return this.setAccountStatus(accountId, true)\r\n}\r\n\r\nAccountService.prototype.importSpreadsheet = function (spreadsheet) {\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n this.companyId,\r\n 'ledger-accounts',\r\n 'import'\r\n ]\r\n\r\n var actionPath = actionPathSegments.join('/')\r\n\r\n return this.client.post(actionPath, spreadsheet)\r\n}\r\n\r\nmodule.exports = AccountService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias1(container.lambda(depth0, depth0))\n + \"\\\">\"\n + alias1(((helper = (helper = helpers.key || (data && data.key)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"key\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"col-sm-11 col-xs-10 editModalTitle\\\">\\r\\n <h3>Edit Account: <span id=\\\"accountNumber\\\">\"\n + alias4(((helper = (helper = helpers.number || (depth0 != null ? depth0.number : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"number\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span></h3>\\r\\n</div>\\r\\n\\r\\n<i class=\\\"fa fa-close pull-right expanding-btn-group-close\\\"></i>\\r\\n\\r\\n<div class=\\\"form-group col-sm-6 col-xs-12\\\">\\r\\n <div class=\\\"form-material\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"account-type\\\" name=\\\"account-type\\\" size=\\\"1\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.types : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label for=\\\"account-type\\\">Account Type</label>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"form-group col-sm-6 col-xs-12\\\">\\r\\n <div class=\\\"form-material\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"account-category\\\" name=\\\"account-category\\\" size=\\\"1\\\"></select>\\r\\n <label for=\\\"account-category\\\">Account Category</label>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"form-group col-sm-12 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"edit-account-desc\\\" name=\\\"account-desc\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"edit-account-desc\\\">Account Description</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"new-account-desc\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"col-sm-12 col-xs-12\\\">\\r\\n <button class=\\\"btn btn-primary pull-right update\\\">Update</button>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar $ = require('jquery')\r\nvar Backbone = require('backbone')\r\nvar EditAccountTemplate = require('generalledgeraccounts/update/template')\r\nvar Account = require('generalledgeraccounts/account')\r\n\r\nvar EditAccountView = Backbone.View.extend({\r\n className: 'block edit-account z-1 fadeInDown has-animation',\r\n\r\n events: {\r\n 'click .expanding-btn-group-close': 'close',\r\n 'click .update': 'save'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(EditAccountTemplate(this.createViewModel()))\r\n \r\n var typeChanged = false\r\n this.$el.on('change', '#account-type', function () {\r\n typeChanged = true\r\n this.populateCategoryDropdown(typeChanged)\r\n }.bind(this))\r\n \r\n this.$('#account-type').find(\"[value='\" + this.model.get('account').get('accountType') + \"']\").attr('selected', 'selected')\r\n this.populateCategoryDropdown()\r\n this.$('#account-category').find(\"[value='\" + this.model.get('account').get('reportingCategory') + \"']\").attr('selected', 'selected')\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n types: Account.Type,\r\n categories: Account.Category,\r\n number: this.model.get('account').get('accountNumber'),\r\n description: this.model.get('account').get('accountName'),\r\n position: this.position\r\n }\r\n }, \r\n \r\n populateCategoryDropdown: function (typeChanged) {\r\n if (typeChanged) {\r\n for (var i = 0; i < this.$('#account-category option').length; i++) {\r\n this.$('#account-category option').remove(i)\r\n }\r\n }\r\n var selectedType = this.$('#account-type').val()\r\n var categoriesList = Account.Category\r\n \r\n var selectedCategory = _.find(categoriesList, function(value, index) {\r\n return index === selectedType\r\n }.bind(this)) \r\n \r\n _.each (selectedCategory, function (categoryItem) {\r\n this.$('#account-category ').append($('<option value=\"' + categoryItem + '\">' + categoryItem + '</option>'))\r\n }.bind(this))\r\n },\r\n\r\n setPosition: function (position) {\r\n this.$el.css({\r\n top: position\r\n })\r\n },\r\n\r\n close: function (event) {\r\n event.preventDefault()\r\n\r\n this.trigger('cancel')\r\n },\r\n\r\n save: function (event) {\r\n event.preventDefault()\r\n\r\n var description = this.$('#edit-account-desc').val()\r\n var type = this.$('#account-type').val() // TODO Use string value instead of enum indices\r\n var category = this.$('#account-category').val()\r\n \r\n // TODO Validation feedback\r\n if (!description) {\r\n return\r\n }\r\n\r\n var updated = new Account(this.model.get('account').attributes)\r\n updated.set({\r\n accountType: type,\r\n accountName: description,\r\n reportingCategory: category \r\n })\r\n\r\n this.$('.update').prop('disabled', true)\r\n this.trigger('update', updated)\r\n },\r\n \r\n btnEnable: function () {\r\n $('.update').prop('disabled', false)\r\n }\r\n})\r\n\r\nmodule.exports = EditAccountView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar EditAccountView = require('generalledgeraccounts/update/view')\r\nvar AccountService = require('generalledgeraccounts/service')\r\n\r\nvar EditAccountWidget = function (account, position) {\r\n this.model = new Backbone.Model({\r\n account: account\r\n })\r\n this.view = new EditAccountView({\r\n model: this.model\r\n })\r\n this.view.setPosition(position)\r\n this.accountService = new AccountService()\r\n this.view.on('cancel', this.cancelEditing, this)\r\n this.view.on('update', this.updateExisting, this)\r\n}\r\n\r\nEditAccountWidget.prototype = _.clone(Backbone.Events)\r\n\r\nEditAccountWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nEditAccountWidget.prototype.cancelEditing = function () {\r\n this.trigger('cancel')\r\n}\r\n\r\nEditAccountWidget.prototype.updateExisting = function (updated) {\r\n this.accountService.updateAccount(updated).then(function () {\r\n this.trigger('close')\r\n }.bind(this), function (error) {\r\n this.view.btnEnable()\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = EditAccountWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Config = require('config/config')\r\n\r\nvar ImportWidget = require('generalledgeraccounts/import/widget')\r\nvar CreateAccountWidget = require('generalledgeraccounts/create/widget')\r\nvar AccountListWidget = require('generalledgeraccounts/list/widget')\r\n\r\nvar AccountView = Backbone.View.extend({\r\n className: 'generalledgeraccounts index',\r\n\r\n render: function () {\r\n var createAccountWidget = new CreateAccountWidget()\r\n var accountListWidget = new AccountListWidget()\r\n\r\n this.$el.empty()\r\n // Only display Import Widget if user is not on an educational domain\r\n if (!Config['IS_EDUCATIONAL_LICENSE']) {\r\n var importWidget = new ImportWidget()\r\n\r\n importWidget.on('refresh', function () {\r\n accountListWidget.refresh().then(function () {\r\n importWidget.trigger('refreshed')\r\n })\r\n })\r\n\r\n this.$el.append(importWidget.show())\r\n }\r\n this.$el.append(createAccountWidget.show()).append(accountListWidget.show())\r\n\r\n createAccountWidget.on('accountCreated', function () {\r\n accountListWidget.refresh()\r\n })\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = AccountView\r\n","'use strict'\r\n\r\nvar AccountView = require('generalledgeraccounts/view')\r\n\r\nvar AccountWidget = function () {\r\n this.view = new AccountView()\r\n}\r\n\r\nAccountWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nmodule.exports = AccountWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.hasCompany : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"2\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <ul class=\\\"nav-header pull-right right-menu\\\" id=\\\"right-menu\\\">\\r\\n \\r\\n <li>\\r\\n <div class=\\\"btn-group\\\">\\r\\n <button class=\\\"btn btn-default dropdown-toggle rightMenuAvatar\\\" data-toggle=\\\"dropdown\\\" type=\\\"button\\\" aria-expanded=\\\"false\\\">\\r\\n <img id=\\\"rightMenuAvatar\\\" src=\\\"\"\n + alias4(((helper = (helper = helpers.profilePicture || (depth0 != null ? depth0.profilePicture : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"profilePicture\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" alt=\\\"Avatar\\\">\\r\\n <span class=\\\"caret\\\"></span>\\r\\n </button>\\r\\n <ul class=\\\"dropdown-menu dropdown-menu-right profil-dropdown\\\">\\r\\n <li class=\\\"dropdown-header\\\">PROFILE</li>\\r\\n <li>\\r\\n <button id=\\\"my-profile\\\" type=\\\"submit\\\" class=\\\"btn btn-link menu-link\\\">\\r\\n <i class=\\\"fa fa-user pull-right\\\"></i>\\r\\n My Profile\\r\\n </button>\\r\\n </li>\\r\\n <li class=\\\"divider\\\"></li>\\r\\n <li class=\\\"dropdown-header\\\">ACTION</li>\\r\\n <li>\\r\\n <button id=\\\"log-off\\\" type=\\\"submit\\\" class=\\\"btn btn-link menu-link\\\">\\r\\n <i class=\\\"fa fa-power-off pull-right\\\"></i>\\r\\n Log off\\r\\n </button>\\r\\n </li>\\r\\n \\r\\n <li class=\\\"divider\\\"></li>\\r\\n <li class=\\\"dropdown-header\\\">SUPPORT</li>\\r\\n <li>\\r\\n <button id=\\\"live-chat\\\" type=\\\"submit\\\" class=\\\"btn btn-link menu-link \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isCurrentFreePlan : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isCurrentFreePlan : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \">\\r\\n <i class=\\\"fa fa-comment pull-right\\\"></i>\\r\\n Live Chat\\r\\n </button>\\r\\n </li>\\r\\n \\r\\n </ul>\\r\\n </div>\\r\\n </li>\\r\\n \\r\\n <li>\\r\\n <div class=\\\"btn-group\\\">\\r\\n <button class=\\\"btn btn-default dropdown-toggle\\\" data-toggle=\\\"dropdown\\\" type=\\\"button\\\" aria-expanded=\\\"false\\\">\\r\\n \"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\r\\n <span class=\\\"caret\\\"></span>\\r\\n </button>\\r\\n <ul class=\\\"dropdown-menu dropdown-menu-right\\\">\\r\\n\\r\\n <div class=\\\"dropdownCompanyList\\\">\\r\\n <li class=\\\"dropdown-header\\\">My Default Company</li>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.companies : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(7, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(16, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </ul>\\r\\n </div>\\r\\n </li>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.name : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(18, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </ul>\\r\\n \\r\\n <ul class=\\\"nav-header pull-left\\\" id=\\\"left-menu\\\">\\r\\n <li class=\\\"hidden-xs hidden-sm\\\">\\r\\n <button class=\\\"btn btn-default\\\" data-toggle=\\\"layout\\\" data-action=\\\"sidebar_mini_toggle\\\" type=\\\"button\\\">\\r\\n <i class=\\\"fa fa-ellipsis-v\\\"></i>\\r\\n </button>\\r\\n </li>\\r\\n </ul>\\r\\n\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isTrial : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(23, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \"disabled\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \"disabled=\\\"true\\\"\";\n},\"7\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <li>\\r\\n <div type=\\\"submit\\\" class=\\\"btn btn-link menu-link\\\">\\r\\n <span class=\\\"change-company\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isDefault : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(8, data, 0, blockParams, depths),\"inverse\":container.program(11, data, 0, blockParams, depths),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </li>\\r\\n\"\n + ((stack1 = (helpers.if_gt_1 || (depth0 && depth0.if_gt_1) || alias2).call(alias1,(depths[1] != null ? depths[1].numOfCompanies : depths[1]),{\"name\":\"if_gt_1\",\"hash\":{},\"fn\":container.program(13, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"8\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1;\n\n return \" <i class=\\\"fa fa-star pull-right\\\" \"\n + ((stack1 = (helpers.if_less_than || (depth0 && depth0.if_less_than) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depths[1] != null ? depths[1].numOfCompanies : depths[1]),8,{\"name\":\"if_less_than\",\"hash\":{},\"fn\":container.program(9, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"></i>\\r\\n\";\n},\"9\":function(container,depth0,helpers,partials,data) {\n return \" style=\\\"margin-right: 10px;\\\"\";\n},\"11\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing;\n\n return \" <i class=\\\"fa fa-star-o pull-right\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" \"\n + ((stack1 = (helpers.if_less_than || (depth0 && depth0.if_less_than) || alias2).call(alias1,(depths[1] != null ? depths[1].numOfCompanies : depths[1]),8,{\"name\":\"if_less_than\",\"hash\":{},\"fn\":container.program(9, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"></i>\\r\\n\";\n},\"13\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isDefault : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(14, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"14\":function(container,depth0,helpers,partials,data) {\n return \" <li class=\\\"divider\\\" style=\\\"margin: 5px 0;\\\"></li>\\r\\n <li class=\\\"dropdown-header\\\">My Other Companies</li>\\r\\n\";\n},\"16\":function(container,depth0,helpers,partials,data) {\n return \" <li class=\\\"divider\\\" style=\\\"margin: 5px 0;\\\"></li>\\r\\n <li class=\\\"dropdown-header\\\">Add New Company</li>\\r\\n <li>\\r\\n <button id=\\\"add-new-company\\\" type=\\\"submit\\\" class=\\\"btn btn-link menu-link add-new-company\\\"><span>Create New Company</span></button>\\r\\n </li>\\r\\n\";\n},\"18\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <li>\\r\\n <button class=\\\"btn \"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.hasRecurring : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(19, data, 0),\"inverse\":container.program(21, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" side_overlay_toggle-btn\\\" data-toggle=\\\"layout\\\" data-action=\\\"side_overlay_toggle\\\" type=\\\"button\\\">\\r\\n <i class=\\\"fa fa-comment\\\"></i>\\r\\n </button>\\r\\n </li>\\r\\n\";\n},\"19\":function(container,depth0,helpers,partials,data) {\n return \"btn-danger\";\n},\"21\":function(container,depth0,helpers,partials,data) {\n return \"btn-default\";\n},\"23\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \" <ul class=\\\"float-header-center\\\">\\r\\n <div>\\r\\n <span class=\\\"days-left\\\"><b>\"\n + container.escapeExpression(((helper = (helper = helpers.daysLeft || (depth0 != null ? depth0.daysLeft : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"daysLeft\",\"hash\":{},\"data\":data}) : helper)))\n + \" </b></span>\\r\\n <span class=\\\"days-left\\\"> days</span>\\r\\n <span> remaining in your </span>\\r\\n <span>\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isTrial : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(24, data, 0),\"inverse\":container.program(26, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</span>\\r\\n <span class=\\\"upgradeTextContainer\\\"><span class=\\\"upgradeText\\\">Upgrade</span></span>\\r\\n </div>\\r\\n </ul>\\r\\n\";\n},\"24\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.planName || (depth0 != null ? depth0.planName : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"planName\",\"hash\":{},\"data\":data}) : helper)))\n + \" Plan\";\n},\"26\":function(container,depth0,helpers,partials,data) {\n return \"free trial\";\n},\"28\":function(container,depth0,helpers,partials,data) {\n return \" <ul class=\\\"logoimage-without-menu\\\" id=\\\"logoimage-without-menu\\\">\\r\\n <li>\\r\\n <span class=\\\"logo\\\" style=\\\"display:inline-block; margin: auto 0; padding-top: 15px;\\\"><img src=\\\"/img/crunched-logo.svg\\\" class=\\\"logoimage\\\" alt=\\\"/img/crunched-logo.svg\\\" style=\\\"padding-bottom:5px;\\\"/></span>\\r\\n </li>\\r\\n </ul>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isLoggedIn : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasCompany : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(28, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"useData\":true,\"useDepths\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar HeaderTemplate = require('header/template')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar sweetAlert = require('sweetalert2')\r\nvar CompanyService = require('company/company-service')\r\nvar SessionService = require('session/session-service')\r\nvar Config = require('config/config')\r\n\r\nvar HeaderView = Backbone.View.extend({\r\n tagName: 'header',\r\n id: 'header-navbar',\r\n className: 'content-mini content-mini-full',\r\n\r\n initialize: function () {\r\n this.companyService = new CompanyService()\r\n this.listenTo(this.model, 'change change:subscriptionInfo change:planLevels', this.render.bind(this))\r\n this.on('defaultCompanyChanged', this.defaultCompanyChanged, this)\r\n this.on('defaultCompanyChangingFailed', this.defaultCompanyChangingFailed, this)\r\n Backbone.on('activeCompanyChanged', function () {\r\n this.trigger('refresh')\r\n }.bind(this))\r\n Backbone.on('myProfileChanged', function () {\r\n this.trigger('refresh')\r\n }.bind(this))\r\n Backbone.on('refreshDropdown', function () {\r\n this.trigger('refresh')\r\n }.bind(this))\r\n },\r\n\r\n events: {\r\n 'click #log-off': 'logOff',\r\n 'click #my-profile': 'goToMyProfile',\r\n 'click .change-company': 'changeCompany',\r\n 'click .fa-star-o': 'changeDefaultCompany',\r\n 'click .side_overlay_toggle-btn': 'rightSideMenuClicked',\r\n 'click .upgradeTextContainer': 'upgradePlan',\r\n 'click #live-chat': 'showLiveChat',\r\n 'click .add-new-company': 'addNewCompany'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(HeaderTemplate(this.createViewModel()))\r\n\r\n this.$('.dropdownCompanyList').slimScroll({\r\n height: this.calculateDropdownHeight(),\r\n railVisible: this.toggleRailScrollbarVisible(),\r\n alwaysVisible: this.toggleRailScrollbarVisible(),\r\n color: '#32404c'\r\n })\r\n\r\n $zopim(function () {\r\n var isChatting = $zopim.livechat.isChatting()\r\n if (!isChatting || !SessionService.isSessionActive()) {\r\n $zopim.livechat.hideAll()\r\n }\r\n })\r\n return this\r\n },\r\n\r\n calculateDropdownHeight: function () {\r\n // Number of companies\r\n var companyCount = this.companiesSorted.length\r\n\r\n var rowHeight = 33\r\n var maxHeight = 275\r\n\r\n // jQuery slimScroll can either automatically calculate the height\r\n // Or we can limit to a max height\r\n if ((rowHeight * companyCount) <= maxHeight) {\r\n return 'auto'\r\n }\r\n return maxHeight\r\n },\r\n\r\n toggleRailScrollbarVisible: function () {\r\n // default number of items to be displayed per page. It will be (defaultNumOfItems + 1) as there is 'Add New Company' menu.\r\n var defaultNumOfItems = 7\r\n return this.companiesSorted.length > defaultNumOfItems\r\n },\r\n\r\n createViewModel: function () {\r\n var company = this.model.get('company')\r\n this.sortCompanies()\r\n this.getDefaultCompany()\r\n\r\n var companies = this.companiesSorted\r\n var hasRecurring = this.model.get('hasRecurring')\r\n var profileInfo = SessionService.getProfile()\r\n\r\n this.hasCompany = true\r\n var urlFirstIndex = Backbone.history.getFragment(Backbone.history.location.pathname).split('/')\r\n\r\n if (!company || !companies || (urlFirstIndex[0] === 'payment')) {\r\n this.hasCompany = false\r\n return {\r\n isLoggedIn: this.model.get('isLoggedIn'),\r\n hasCompany: this.hasCompany,\r\n profilePicture: !!profileInfo && !!profileInfo.picture ? profileInfo.picture : '/img/favicons/favicon-32x32.png'\r\n }\r\n }\r\n\r\n var modelData = {\r\n name: company.get('name'),\r\n companies: companies.map(function (item) {\r\n return {\r\n id: item.get('id'),\r\n name: item.get('name'),\r\n isDefault: item.get('isDefault')\r\n }\r\n }),\r\n isLoggedIn: this.model.get('isLoggedIn'),\r\n hasRecurring: hasRecurring,\r\n maxHeightDropdown: this.maxHeightDropdown,\r\n numOfCompanies: companies.length,\r\n hasCompany: this.hasCompany,\r\n profilePicture: !!profileInfo && !!profileInfo.picture ? profileInfo.picture : '/img/favicons/favicon-32x32.png'\r\n }\r\n\r\n if (!!this.model.get('subscriptionInfo') && !!this.model.get('planLevels')) {\r\n var subscriptionInfo = this.model.get('subscriptionInfo')\r\n var planLevels = this.model.get('planLevels')\r\n\r\n var currentPlanId = subscriptionInfo.planLevelId\r\n var currentPlanInfo = _.find(planLevels, ['id', currentPlanId])\r\n this.isCurrentFreePlan = !!((currentPlanInfo.name === 'Free' && currentPlanInfo.price === 0))\r\n\r\n var nextBillingDate = subscriptionInfo.nextBillingDate\r\n\r\n var todayDate = new Date()\r\n var todayDateUTC = new Date(todayDate.getTime() + todayDate.getTimezoneOffset() * 60000)\r\n todayDate = moment(todayDateUTC)\r\n nextBillingDate = moment(nextBillingDate)\r\n\r\n var daysLeft = nextBillingDate.diff(todayDate, 'days') > 0 ? nextBillingDate.diff(todayDate, 'days') : 0\r\n\r\n var data = {\r\n name: company.get('name'),\r\n companies: companies.map(function (item) {\r\n return {\r\n id: item.get('id'),\r\n name: item.get('name'),\r\n isDefault: item.get('isDefault')\r\n }\r\n }),\r\n isLoggedIn: this.model.get('isLoggedIn'),\r\n hasRecurring: hasRecurring,\r\n numOfCompanies: companies.length,\r\n hasCompany: this.hasCompany,\r\n daysLeft: daysLeft,\r\n planName: subscriptionInfo.planLevel.name,\r\n isTrial: company.get('isTrial'),\r\n isCurrentFreePlan: this.isCurrentFreePlan,\r\n profilePicture: !!profileInfo && !!profileInfo.picture ? profileInfo.picture : '/img/favicons/favicon-32x32.png',\r\n isEducationalLicense: Config['IS_EDUCATIONAL_LICENSE']\r\n }\r\n return data\r\n }\r\n\r\n return {\r\n name: company.get('name'),\r\n companies: companies.map(function (item) {\r\n return {\r\n id: item.get('id'),\r\n name: item.get('name'),\r\n isDefault: item.get('isDefault')\r\n }\r\n }),\r\n isLoggedIn: this.model.get('isLoggedIn'),\r\n hasRecurring: hasRecurring,\r\n numOfCompanies: companies.length,\r\n hasCompany: this.hasCompany,\r\n profilePicture: !!profileInfo && !!profileInfo.picture ? profileInfo.picture : '/img/favicons/favicon-32x32.png'\r\n }\r\n },\r\n\r\n getDefaultCompany: function () {\r\n this.defaultCompany = ''\r\n // check the list of companies to see if there is a default company selected by a user\r\n _.map(this.companiesSorted, function (company) {\r\n if (company.get('isDefault')) {\r\n this.defaultCompany = company\r\n }\r\n }.bind(this))\r\n\r\n // if none, select the first one in the sorted list as a default\r\n if (!this.defaultCompany) {\r\n this.defaultCompany = this.companiesSorted[0]\r\n _.map(this.companiesSorted, function (company) {\r\n if (company.get('id') === this.defaultCompany.get('id')) {\r\n company.set('isDefault', true)\r\n }\r\n }.bind(this))\r\n } else {\r\n // if exists, move it to the begining of the list to render the default at the top\r\n var currentIndexOfDefault = _.findIndex(this.companiesSorted, function (company) {\r\n return company.get('id') === this.defaultCompany.get('id')\r\n }.bind(this))\r\n if (currentIndexOfDefault !== 0) {\r\n _.remove(this.companiesSorted, function (company) {\r\n return company.get('id') === this.defaultCompany.get('id')\r\n }.bind(this))\r\n\r\n this.companiesSorted.unshift(this.defaultCompany)\r\n }\r\n }\r\n },\r\n\r\n sortCompanies: function () {\r\n this.companiesSorted = _.sortBy(this.model.get('companies'), ['attributes.name'])\r\n },\r\n\r\n logOff: function (event) {\r\n event.preventDefault()\r\n $zopim(function () {\r\n $zopim.livechat.clearAll()\r\n $zopim.livechat.hideAll()\r\n })\r\n location.reload()\r\n this.trigger('logOff')\r\n },\r\n\r\n changeCompany: function (e) {\r\n e.preventDefault()\r\n $zopim(function () {\r\n $zopim.livechat.endChat()\r\n $zopim.livechat.hideAll()\r\n })\r\n this.trigger('changeCompany', $(e.currentTarget).attr('data-id'))\r\n },\r\n\r\n changeDefaultCompany: function (e) {\r\n e.preventDefault()\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'Are you sure you want to update the default business? You can always change this later.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Update Default Business',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.trigger('changeDefaultCompany', $(e.currentTarget).attr('data-id'))\r\n return false\r\n }.bind(this))\r\n },\r\n\r\n rightSideMenuClicked: function () {\r\n Backbone.trigger('rightSideMenuClicked')\r\n },\r\n\r\n upgradePlan: function () {\r\n Backbone.trigger('app:navigate', 'settings/subscription')\r\n },\r\n\r\n defaultCompanyChanged: function () {\r\n console.log('The default company is changed successfully.')\r\n },\r\n\r\n defaultCompanyChangingFailed: function (errorMessage) {\r\n console.log('Failed to change the default company. ' + errorMessage)\r\n },\r\n\r\n showLiveChat: function () {\r\n if (!!this.model.get('subscriptionInfo') && !!this.model.get('planLevels')) {\r\n if (!this.isCurrentFreePlan) {\r\n $zopim(function () {\r\n $zopim.livechat.window.show()\r\n $zopim.livechat.window.setPosition('br')\r\n $zopim.livechat.button.setPosition('br')\r\n })\r\n }\r\n }\r\n },\r\n\r\n goToMyProfile: function () {\r\n Backbone.trigger('app:navigate', 'settings/profile')\r\n },\r\n\r\n addNewCompany: function () {\r\n Backbone.trigger('app:navigate', 'business-creation')\r\n }\r\n})\r\n\r\nmodule.exports = HeaderView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar q = require('q')\r\nvar HeaderView = require('header/view')\r\nvar SessionService = require('session/session-service')\r\nvar LoginService = require('login/service')\r\nvar CompanyService = require('company/company-service')\r\nvar MemorizationService = require('memorization/service')\r\nvar SubscriptionService = require('settings/subscription/service')\r\n\r\nvar HeaderWidget = function () {\r\n this.model = new Backbone.Model({\r\n isLoggedIn: SessionService.isSessionActive()\r\n })\r\n\r\n this.companyService = new CompanyService()\r\n this.memorizationService = new MemorizationService()\r\n this.loginService = new LoginService()\r\n this.subscriptionService = new SubscriptionService()\r\n\r\n this.view = new HeaderView({\r\n model: this.model\r\n })\r\n\r\n Backbone.on('app:sessionStarted', function () {\r\n this.model.set('isLoggedIn', true)\r\n this.loadCompanies()\r\n this.loadQueuedRecurring()\r\n }, this)\r\n\r\n Backbone.on('app:sessionEnded', function () {\r\n this.model.set('isLoggedIn', false)\r\n }, this)\r\n\r\n this.view.on('logOff', function () {\r\n this.loginService.deauthenticate()\r\n Backbone.trigger('app:logout')\r\n }, this)\r\n\r\n this.view.on('changeCompany', function (companyId) {\r\n Backbone.trigger('app:changeCompany', companyId, true)\r\n })\r\n\r\n this.view.on('changeDefaultCompany', function (companyId) {\r\n this.setDefaultCompany(companyId)\r\n }, this)\r\n\r\n Backbone.on('app:changeCompany', function (companyId, shouldNavigateToDashboard) {\r\n this.companyService.updateActiveCompany(companyId).then(function () {\r\n this.loadCompanies()\r\n this.loadQueuedRecurring()\r\n if (shouldNavigateToDashboard) {\r\n Backbone.trigger('app:navigate', '')\r\n }\r\n }.bind(this))\r\n }, this)\r\n\r\n Backbone.on('app:navigate app:reloadAside', function (route) {\r\n this.loadQueuedRecurring()\r\n }, this)\r\n \r\n this.view.on('refresh', this.refresh, this)\r\n \r\n this.loadCompanies()\r\n this.loadQueuedRecurring()\r\n this.fetchCompanySubscription()\r\n this.fetchPlanLevels()\r\n}\r\n\r\nHeaderWidget.prototype = _.clone(Backbone.Events)\r\n\r\nHeaderWidget.prototype.loadCompanies = function () {\r\n if (this.model.get('isLoggedIn')) {\r\n q.all([\r\n this.companyService.fetchCompany(),\r\n this.companyService.fetchCompanies()\r\n ]).then(function (results) {\r\n this.model.set({\r\n 'company': results[0],\r\n 'companies': results[1]\r\n })\r\n }.bind(this))\r\n }\r\n}\r\n\r\nHeaderWidget.prototype.loadQueuedRecurring = function () {\r\n if (this.model.get('isLoggedIn')) {\r\n return this.memorizationService.getRecurringCount().then(function (response) {\r\n this.model.set('hasRecurring', !!response.count)\r\n }.bind(this))\r\n }\r\n}\r\n\r\nHeaderWidget.prototype.setDefaultCompany = function (companyId) {\r\n this.companyService.setDefaultCompany(companyId).then(function () {\r\n this.loadCompanies()\r\n this.loadQueuedRecurring()\r\n this.view.trigger('defaultCompanyChanged')\r\n }.bind(this), function (error) {\r\n this.view.trigger('defaultCompanyChangingFailed', error.message)\r\n }.bind(this))\r\n}\r\n\r\nHeaderWidget.prototype.refresh = function () {\r\n this.loadCompanies()\r\n this.fetchCompanySubscription()\r\n this.fetchPlanLevels()\r\n}\r\n\r\nHeaderWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nHeaderWidget.prototype.fetchCompanySubscription = function () {\r\n if (this.model.get('isLoggedIn')) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.subscriptionService.fetchCompanySubscription(companyId).then(function (response) {\r\n this.model.set('subscriptionInfo', response)\r\n return response\r\n }.bind(this), function () {\r\n console.log('Fail to fetch subscription information.')\r\n }.bind(this))\r\n }\r\n}\r\n\r\nHeaderWidget.prototype.fetchPlanLevels = function () {\r\n this.subscriptionService.fetchPlanLevels().then(function (response) {\r\n this.model.set('planLevels', response)\r\n }.bind(this), function () { \r\n console.log('Fail to fetch plan lists.')\r\n }.bind(this)) \r\n}\r\n\r\nmodule.exports = HeaderWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.inputId || (depth0 != null ? depth0.inputId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputId\",\"hash\":{},\"data\":data}) : helper)))\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurringFrequency\\\" size=\\\"1\\\">\\r\\n <option value=\\\"1\\\">Weekly</option>\\r\\n <option value=\\\"2\\\">Bi-Weekly</option>\\r\\n <option value=\\\"3\\\">Monthly</option>\\r\\n <option value=\\\"4\\\">Bi-Monthly</option>\\r\\n <option value=\\\"5\\\">Quarterly</option>\\r\\n <option value=\\\"6\\\">Semi-Annual</option>\\r\\n <option value=\\\"7\\\">Annual</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.inputId || (depth0 != null ? depth0.inputId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"inputId\",\"hash\":{},\"data\":data}) : helper)))\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Frequency</label>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.index || (depth0 != null ? depth0.index : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"index\",\"hash\":{},\"data\":data}) : helper)));\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.id : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, buffer = \n \"<div class=\\\"block expandable add-journal-entry\\\" data-class=\\\"new-journal-entry\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right expanding-group-close cancel\\\"></i>\\r\\n <h3>Create Journal Entry</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content new-journal-data col-lg-12\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Memorized Label\",\"inputName\":\"memorizationLabel\",\"inputId\":\"check-memorized-label\",\"wrapperClasses\":\"memorized-label col-sm-3 col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group col-sm-3 col-xs-12 journal-entry-date-container\\\">\\r\\n <div class=\\\"form-material floating input-group date\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"new-journal-date\\\" name=\\\"PostedDate\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"new-journal-date\\\">Date</label>\\r\\n <span class=\\\"input-group-addon\\\"><i class=\\\"fa fa-calendar\\\"></i></span>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"new-journal-date\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-sm-6 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"new-journal-desc\\\" name=\\\"Description\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"new-journal-desc\\\">Description</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"new-journal-desc\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizationId\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizedEntryDate\\\" />\\r\\n <div class=\\\"form-group col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"new-journal-note\\\" name=\\\"Notes\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"new-journal-note\\\">Notes</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"new-journal-note\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group is-recurring col-xs-12\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Recurring</span> <input type=\\\"checkbox\\\" name=\\\"IsRecurring\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"block-content hidden-content col-lg-12 no-padding new-journal-entry-lineitem\\\">\\r\\n <h3>Journal Entry Details</h3>\\r\\n <div class=\\\"line-item-container col-lg-12\\\">\\r\\n </div>\\r\\n <div class=\\\"col-lg-12 add-more-line-items\\\"><button class=\\\"clickable-button\\\">+ Add More Details</button></div>\\r\\n <div class=\\\"col-xs-12 recurring-meta-container no-padding\\\">\\r\\n <h3>Recurrence</h3>\\r\\n <div class=\\\"col-xs-12\\\">\\r\\n <div class=\\\"col-xs-12 flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Start Date\",\"wrapperClasses\":\"recurring-start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group state recurring-frequency-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"col-lg-12 form-group\\\">\\r\\n <button class=\\\"btn btn-primary memorize-button\\\">Memorize</button>\\r\\n <button class=\\\"btn btn-primary pull-right save\\\">Post</button>\\r\\n </div>\\r\\n <div class=\\\"status col-lg-12\\\"></div>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar $ = require('jquery')\r\nvar CreateEntryTemplate = require('journal/create/template')\r\nvar GenericCreateView = require('lists/list/create/view')\r\nvar moment = require('moment')\r\n\r\nvar BalancedTemplate = require('journal/entry-status-balanced')\r\nvar DiscrepancyTemplate = require('journal/entry-status-discrepancy')\r\nvar MaskedInput = require('jquery.maskedinput')\r\nvar sweetAlert = require('sweetalert2')\r\nvar MAGIC_DETAIL_HEIGHT = 53\r\nvar MAGIC_CREATE_PADDING = 35\r\nvar MAGIC_ANIMATION_TIMEOUT = 200\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar CreateEntryView = GenericCreateView.extend({\r\n className: 'expandable-container',\r\n\r\n initialize: function (model) {\r\n this.model = model\r\n this.on('detailRemoved', function () {\r\n this.isValidToCreateNewJournalEntry()\r\n this.addHeight(-MAGIC_DETAIL_HEIGHT)\r\n }, this)\r\n this.model.on('change:memorizationList', this.bindMemorizationAutocomplete.bind(this))\r\n this.on('bindMemorization', this.bindMemorizationAutocomplete.bind(this))\r\n },\r\n\r\n events: {\r\n 'click .expandable': 'showForm',\r\n 'click .cancel': 'closeForm',\r\n 'click .add-more-line-items button': 'addNewDetail',\r\n 'click .save': 'save',\r\n 'keyup input': 'isValidToCreateNewJournalEntry',\r\n 'change input': 'isValidToCreateNewJournalEntry',\r\n 'focusout input': 'isValidToCreateNewJournalEntry',\r\n 'click .memorize-button': 'memorize'\r\n },\r\n\r\n render: function () {\r\n this.model.set('postedDate', moment(new Date()))\r\n this.$el.html(CreateEntryTemplate())\r\n this.isValidToCreateNewJournalEntry()\r\n\r\n this.$('.journal-entry-date-container .date').datepicker(dateParams.options)\r\n .datepicker('setDate', moment().format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('postedDate', moment(e.date))\r\n this.$('.date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.recurring-start-date .date').datepicker(dateParams.options)\r\n\r\n return this\r\n },\r\n\r\n bindMemorizationAutocomplete: function () {\r\n console.log('bind memorizations')\r\n this.autoComplete(\r\n this.model.get('memorizationList'),\r\n 'label',\r\n this.$('input[name=memorizationLabel]'),\r\n this.memorizationSelected.bind(this),\r\n 'CREATENEW'\r\n )\r\n },\r\n\r\n memorizationSelected: function (memorization) {\r\n if (typeof memorization === 'string') {\r\n memorization = _.find(this.model.get('memorizationList'), { id: memorization })\r\n }\r\n\r\n if (this.loadingMemorization || this.$('input[name=memorizationId]').val() === memorization.id) {\r\n return\r\n }\r\n\r\n this.loadingMemorization = true\r\n this.$('input[name=memorizationLabel]').val(memorization.label).closest('.floating').addClass('open')\r\n\r\n this.$('input[name=memorizationId]')\r\n .val(memorization.id)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n if (memorization.id === 'CREATENEW') {\r\n this.loadingMemorization = false\r\n return\r\n }\r\n\r\n this.$('.is-recurring input').prop('checked', memorization.isRecurring)\r\n this.$('select[name=recurringFrequency]').val(memorization.recurringFrequency)\r\n this.$('.recurring-start-date .date')\r\n .datepicker('setDate', moment(memorization.recurringDate)._d)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('#new-journal-desc').val(memorization.description).closest('.floating').addClass('open')\r\n this.$('#new-journal-note').val(memorization.notes).closest('.floating').addClass('open')\r\n this.trigger('resetDetails')\r\n\r\n _.each(memorization.lineItems, function (lineItem) {\r\n this.trigger('add:detail', lineItem)\r\n }.bind(this))\r\n this.loadingMemorization = false\r\n },\r\n\r\n showForm: function (event) {\r\n if (this.$('.block').hasClass('expanded')) {\r\n return\r\n }\r\n\r\n event.preventDefault()\r\n\r\n var $expandable = this.$('.expandable')\r\n var expandableHeight = $expandable.height()\r\n\r\n $expandable\r\n .height(expandableHeight)\r\n .parent()\r\n .height(expandableHeight)\r\n\r\n var hiddenHeight = _.reduce($expandable.children(), function (sum, n) { return sum + $(n).outerHeight(true) }, 0)\r\n $expandable\r\n .addClass('expanded')\r\n .height(hiddenHeight)\r\n $expandable\r\n .parent()\r\n .height(hiddenHeight + MAGIC_CREATE_PADDING)\r\n $('.overlay')\r\n .show()\r\n .css('opacity', 1)\r\n .off('click')\r\n .one('click', this.closeForm.bind(this))\r\n\r\n // We have to wait for the animation to complete before we allow all content to always be visible.\r\n setTimeout(function () {\r\n if ($expandable.hasClass('expanded')) {\r\n $expandable.css('overflow', 'visible')\r\n }\r\n }, MAGIC_ANIMATION_TIMEOUT)\r\n\r\n Backbone.once('app:navigate', this.closeForm, this)\r\n },\r\n\r\n addHeight: function (addition) {\r\n if (!this.$('.block').hasClass('expanded')) {\r\n return\r\n }\r\n\r\n var $expandable = this.$('.expandable')\r\n var newHeight = $expandable.height() + addition\r\n\r\n $expandable\r\n .height(newHeight)\r\n .parent()\r\n .height(newHeight + MAGIC_CREATE_PADDING)\r\n },\r\n\r\n closeForm: function (event) {\r\n if (event && event.stopImmediatePropagation) {\r\n event.stopImmediatePropagation()\r\n }\r\n this.$('.expanded')\r\n .parent()\r\n .attr('style', '')\r\n .removeClass('expanded')\r\n $('.overlay')\r\n .attr('style', '')\r\n .removeClass('expanded')\r\n this.$('.expanded')\r\n .attr('style', '')\r\n .removeClass('expanded')\r\n },\r\n\r\n addNewDetail: function (event) {\r\n this.isValidToCreateNewJournalEntry()\r\n this.trigger('add:detail')\r\n },\r\n\r\n showNewDetail: function (detailView) {\r\n var $newDetail = detailView.render().$el\r\n\r\n // Tweaks for styling and animations to display properly\r\n $newDetail.height(0).css('display, none')\r\n this.$('.line-item-container').append($newDetail)\r\n $newDetail.height(MAGIC_DETAIL_HEIGHT).css('display', 'flex')\r\n this.addHeight(MAGIC_DETAIL_HEIGHT)\r\n\r\n if (!detailView.hasAccount()) {\r\n $newDetail.find('input:first').focus()\r\n }\r\n\r\n detailView.on('focusin', this.lineFocusIn, this)\r\n detailView.on('focusout', this.linefocusOut, this)\r\n this.linefocusOut()\r\n },\r\n\r\n lineFocusIn: function () {\r\n this.$('.line-item-container').addClass('forceLabelsOpen')\r\n },\r\n\r\n linefocusOut: function (e) {\r\n var hasValue = _.reduce(\r\n this.$('.line-item-container input').map(function (index, el) { return $(el).val() }),\r\n function (memo, value) {\r\n return memo || (!!value && value !== '$')\r\n },\r\n false\r\n )\r\n\r\n if (hasValue) {\r\n this.$('.line-item-container').addClass('forceLabelsOpen')\r\n } else {\r\n this.$('.line-item-container').removeClass('forceLabelsOpen')\r\n }\r\n },\r\n\r\n balanced: function () {\r\n this.$('.status')\r\n .html(BalancedTemplate())\r\n },\r\n\r\n discrepancy: function (amount) {\r\n amount = amount.toFixed(2)\r\n this.$('.status')\r\n .html(DiscrepancyTemplate({ amount: amount }))\r\n },\r\n showError: function (errorMessage) {\r\n this.$('.status').html(this.getErrorStatusBar(errorMessage))\r\n },\r\n\r\n memorize: function () {\r\n var memorizationId = this.$('input[name=memorizationId]').val()\r\n if (memorizationId && memorizationId !== 'CREATENEW') {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'You will be overwriting any previously memorized information.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize',\r\n this.$('#new-journal-desc').val(),\r\n this.$('#new-journal-note').val(),\r\n this.$('input[name=memorizationLabel]').val(),\r\n memorizationId,\r\n this.$('.is-recurring input').prop('checked'),\r\n this.$('input[name=startDate]').val(),\r\n this.$('select[name=recurringFrequency]').val(),\r\n this.$('select[name=recurring-checkbook]').val()\r\n )\r\n }.bind(this))\r\n } else {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize',\r\n this.$('#new-journal-desc').val(),\r\n this.$('#new-journal-note').val(),\r\n this.$('input[name=memorizationLabel]').val(),\r\n memorizationId,\r\n this.$('.is-recurring input').prop('checked'),\r\n this.$('input[name=startDate]').val(),\r\n this.$('select[name=recurringFrequency]').val(),\r\n this.$('select[name=recurring-checkbook]').val()\r\n )\r\n }\r\n },\r\n\r\n isValidToCreateNewJournalEntry: function () {\r\n if (!this.isNumLineItemValid()) {\r\n this.showError('A journal entry must have at least two distributions.')\r\n } else if (!this.isBothSideNotZero()) {\r\n this.showError('A distribution must be greater than $0.00')\r\n } else if (!this.isNotNegativeValue()) {\r\n this.showError('Negative values are not allowed.')\r\n } else if (!this.isOnlyOneSideEntered()) {\r\n this.showError('A distribution cannot have both debit and credit.')\r\n } else if (!this.isAccumulatedBalanceZero()) {\r\n this.discrepancy(this.model.get('balance'))\r\n } else if (!this.isAllAcctNumAndDescFieldsFilled()) {\r\n this.showError('A ledger account must be selected.')\r\n } else {\r\n this.balanced()\r\n }\r\n },\r\n\r\n isNumLineItemValid: function () {\r\n return this.model.get('numLineItem') > 1\r\n },\r\n\r\n isBothSideNotZero: function () {\r\n return this.model.get('isNotZero')\r\n },\r\n\r\n isNotNegativeValue: function () {\r\n return this.model.get('isNotNegVal')\r\n },\r\n\r\n isOnlyOneSideEntered: function () {\r\n return this.model.get('isOnlyOneEntered')\r\n },\r\n\r\n isAccumulatedBalanceZero: function () {\r\n return Math.abs(this.model.get('balance')).toFixed(2) < 0.01\r\n },\r\n\r\n isAllAcctNumAndDescFieldsFilled: function () {\r\n var items = _.filter(this.$('.new-journal-entry-lineitem .line-item-container .new-journal-entry-item'), function (row, index) {\r\n return (!this.$(row).find('input[name=accountNumber]').val() && !this.$(row).find('input[name=accountName]').val())\r\n }.bind(this))\r\n return !items.length\r\n },\r\n\r\n save: function () {\r\n if (!this.isNumLineItemValid() || !this.isBothSideNotZero() || !this.isNotNegativeValue() || !this.isOnlyOneSideEntered() ||\r\n !this.isAccumulatedBalanceZero() || !this.isAllAcctNumAndDescFieldsFilled()) {\r\n return\r\n }\r\n $('.overlay')\r\n .css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n\r\n var memorizationId = this.$('input[name=memorizationId]').val()\r\n var memorizedEntryDate = this.$('input[name=memorizedEntryDate]').val()\r\n this.$('.save').prop('disabled', true)\r\n\r\n this.trigger(\r\n 'save',\r\n this.$('#new-journal-desc').val(),\r\n this.$('#new-journal-note').val(),\r\n memorizationId,\r\n memorizedEntryDate\r\n )\r\n },\r\n\r\n setMemorizedEntryDate: function (entryDate) {\r\n this.$('input[name=memorizedEntryDate]').val(entryDate)\r\n },\r\n\r\n memBtnEnable: function () {\r\n this.$('.memorize-button').prop('disabled', false)\r\n },\r\n\r\n btnEnable: function () {\r\n $('.save').prop('disabled', false)\r\n }\r\n\r\n})\r\n\r\nmodule.exports = CreateEntryView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar Backbone = require('backbone')\r\n\r\nvar JournalService = require('journal/journal-service')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar MemorizationService = require('memorization/journal-entries/service')\r\nvar CreateEntryView = require('journal/create/view')\r\nvar CreateEntryDetailView = require('journal/entry-detail-input/view')\r\n\r\nvar JournalEntry = require('journal/journal-entry/entry')\r\nvar JournalEntryDetail = require('journal/journal-entry/detail')\r\nvar numbro = require('numbro')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar CreateEntryWidget = function () {\r\n this.details = []\r\n this.accountService = new AccountService()\r\n this.journalService = new JournalService()\r\n this.memorizationService = new MemorizationService()\r\n this.entry = new JournalEntry()\r\n this.view = new CreateEntryView(this.entry)\r\n this.view.on('add:detail', this.addDetail, this)\r\n this.view.on('save', this.save, this)\r\n this.view.on('memorize', this.memorize, this)\r\n this.view.on('resetDetails', this.resetDetails, this)\r\n this.view.on('detailRemoved', this.recalcBalance, this)\r\n\r\n _.extend(this, Backbone.Events)\r\n}\r\n\r\nCreateEntryWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n var result = this.view.render().$el\r\n\r\n Q.all([this.accountService.fetchAccounts(false), this.loadMemorizations()]).spread(function (accounts) {\r\n this.entry.set('accounts', accounts)\r\n this.resetDetails()\r\n this.addDetail()\r\n this.addDetail()\r\n }.bind(this))\r\n\r\n return result\r\n}\r\n\r\nCreateEntryWidget.prototype.loadMemorizations = function () {\r\n return this.memorizationService.getList('General').then(function (memorizations) {\r\n this.entry.set('memorizationList', memorizations)\r\n this.view.trigger('bindMemorization')\r\n }.bind(this))\r\n}\r\n\r\nCreateEntryWidget.prototype.resetDetails = function () {\r\n var details = this.details\r\n _.each(details, function (detailPair) {\r\n detailPair[1].removeDetail()\r\n })\r\n}\r\n\r\nCreateEntryWidget.prototype.addDetail = function (lineItemDetails) {\r\n if (!this.entry.get('accounts')) {\r\n throw \"Accounts not loaded, can't add detail yet.\"\r\n }\r\n\r\n var detailModel = new JournalEntryDetail({\r\n accounts: this.entry.get('accounts'),\r\n index: this.details.length\r\n })\r\n detailModel.on('change:credit change:debit', this.recalcBalance, this)\r\n\r\n var detailView = new CreateEntryDetailView(detailModel)\r\n if (lineItemDetails) {\r\n detailView.loadDefaults(lineItemDetails)\r\n }\r\n\r\n var detailPair = [detailModel, detailView]\r\n this.details.push(detailPair)\r\n detailView.once('remove', function () {\r\n this.details = _.without(this.details, detailPair)\r\n this.view.trigger('detailRemoved')\r\n }.bind(this))\r\n\r\n this.view.showNewDetail(detailView)\r\n\r\n this.recalcBalance()\r\n}\r\n\r\nCreateEntryWidget.prototype.recalcBalance = function () {\r\n var totalDebit = 0\r\n var totalCredit = 0\r\n var isBothSideNotZero = true\r\n var isNotNegativeValue = true\r\n var isOnlyOneSideEntered = true\r\n\r\n _.each(this.details, function (detail, index) {\r\n var detailModel = detail[0]\r\n var credit = (numbro().unformat(detailModel.get('credit')) || 0)\r\n var debit = (numbro().unformat(detailModel.get('debit')) || 0)\r\n if ((credit === 0) && (debit === 0)) {\r\n isBothSideNotZero = false\r\n }\r\n if ((credit < 0) || (debit < 0)) {\r\n isNotNegativeValue = false\r\n }\r\n if ((credit > 0) && (debit > 0)) {\r\n isOnlyOneSideEntered = false\r\n }\r\n totalCredit = totalCredit + credit\r\n totalDebit = totalDebit + debit\r\n })\r\n\r\n this.balance = _.reduce(this.details, function (memo, detail, index) {\r\n var detailModel = detail[0]\r\n var detailView = detail[1]\r\n\r\n // multiply 100 for each value, and then divide the totoal by 100 to avoid decimals which causes a floating number calculation error.\r\n var credit = (numbro().unformat(detailModel.get('credit')) || 0) * 100\r\n var debit = (numbro().unformat(detailModel.get('debit')) || 0) * 100\r\n\r\n var newBalance = memo * 100 + credit - debit\r\n newBalance /= 100\r\n detailView.setBalance(totalDebit == 0 && totalCredit == 0 ? '' : numbro(newBalance).formatCurrency('$0,0.00'))\r\n\r\n return newBalance\r\n }, 0)\r\n\r\n this.view.model.set({\r\n balance: this.balance,\r\n numLineItem: this.details.length,\r\n isNotZero: isBothSideNotZero,\r\n isNotNegVal: isNotNegativeValue,\r\n isOnlyOneEntered: isOnlyOneSideEntered\r\n })\r\n}\r\n\r\nCreateEntryWidget.prototype.save = function (newJournalDesc, newJournalNote, memorizationId, memorizedEntryDate) {\r\n if (Math.abs(this.balance) > 0.1) {\r\n this.view.btnEnable()\r\n return\r\n }\r\n var model = this.entry\r\n\r\n model.set({\r\n 'description': newJournalDesc,\r\n 'notes': newJournalNote,\r\n 'journalType': 'GENERAL',\r\n 'memorizedEntryId': memorizationId,\r\n 'memorizedEntryDate': memorizedEntryDate,\r\n 'lineItems': _.map(this.details, function (detail) {\r\n return detail[0]\r\n })\r\n })\r\n\r\n this.journalService.createJournal(model).then(function (response) {\r\n if (response.success) {\r\n this.view.btnEnable()\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'The journal entry has been successfully created.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('reload')\r\n this.trigger('itemCreated')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.btnEnable()\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Failed to create the journal entry.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('reload')\r\n }.bind(this))\r\n}\r\n\r\nCreateEntryWidget.prototype.memorize = function (newJournalDesc, newJournalNote, memorizationLabel, memorizationId, isRecurring, startDate, frequency, checkbook) {\r\n var model = this.entry\r\n\r\n model.set({\r\n description: newJournalDesc,\r\n notes: newJournalNote,\r\n journalType: 'GENERAL',\r\n lineItems: _.map(this.details, function (detail) {\r\n return detail[0]\r\n }),\r\n label: memorizationLabel,\r\n memorizationId: memorizationId === 'CREATENEW' ? '' : memorizationId,\r\n isRecurring: isRecurring,\r\n recurringDate: startDate,\r\n recurringFrequency: frequency,\r\n memorizedCheckbook: checkbook\r\n })\r\n\r\n var deferral\r\n\r\n if (!model.get('label')) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Please enter in a memorization label for this transaction',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6'\r\n })\r\n this.view.memBtnEnable()\r\n return\r\n }\r\n\r\n if (model.get('memorizationId')) {\r\n deferral = this.memorizationService.update(model.get('memorizationId'), model).then(function () {\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your journal entry has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationUpdated')\r\n }.bind(this))\r\n } else {\r\n deferral = this.memorizationService.create(model).then(function (response) {\r\n this.view.trigger('setMemorizationId', response.message)\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your journal entry has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationCreated')\r\n }.bind(this))\r\n }\r\n\r\n deferral.fail(function (err) {\r\n this.view.showError(err.message)\r\n setTimeout(this.recalcBalance.bind(this), 3000)\r\n }.bind(this))\r\n\r\n this.view.memBtnEnable()\r\n deferral.then(this.loadMemorizations.bind(this))\r\n}\r\n\r\nmodule.exports = CreateEntryWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers.index || (depth0 != null ? depth0.index : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"index\",\"hash\":{},\"data\":data}) : helper)));\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"-\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.id : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"4\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"form-group account-number-container autocomplete\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"accountNumber\\\" id=\\\"accountNumber\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.accountNumber || (depth0 != null ? depth0.accountNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"accountNumber\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\\">Account Number</label>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"form-group account-name-container autocomplete\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"accountName\\\" id=\\\"accountName\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.accountName || (depth0 != null ? depth0.accountName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountName\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"accountName\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.index : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\\">Account Description</label>\\r\\n </div>\\r\\n</div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"value\":(depth0 != null ? depth0.debit : depth0),\"id\":(depth0 != null ? depth0.id : depth0),\"index\":(depth0 != null ? depth0.index : depth0),\"floatingClasses\":\"open\",\"inputId\":\"debit\",\"inputClasses\":\"currency-field\",\"inputLabel\":\"Debit\",\"inputName\":\"debit\",\"wrapperClasses\":\"price-container\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"value\":(depth0 != null ? depth0.credit : depth0),\"id\":(depth0 != null ? depth0.id : depth0),\"index\":(depth0 != null ? depth0.index : depth0),\"floatingClasses\":\"open\",\"inputId\":\"credit\",\"inputClasses\":\"currency-field\",\"inputLabel\":\"Credit\",\"inputName\":\"credit\",\"wrapperClasses\":\"price-container\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"id\":(depth0 != null ? depth0.id : depth0),\"index\":(depth0 != null ? depth0.index : depth0),\"isDisabled\":true,\"floatingClasses\":\"open\",\"inputClasses\":\"currency-field\",\"inputLabel\":\"Balance\",\"inputName\":\"balance\",\"wrapperClasses\":\"price-container\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"<i class=\\\"fa fa-close remove\\\"></i>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar $ = require('jquery')\r\nvar Backbone = require('backbone')\r\nvar numbro = require('numbro')\r\nvar _ = require('lodash')\r\nvar CreateDetailTemplate = require('journal/entry-detail-input/template')\r\nvar JournalEntryDetail = require('journal/journal-entry/detail')\r\nvar MAGIC_ANIMATION_TIMEOUT = 200\r\n\r\nvar CreateEntryView = Backbone.View.extend({\r\n className: 'new-journal-entry-item journal-entry-item animated fadeInDown flex no-padding',\r\n\r\n initialize: function (model) {\r\n this.model = model\r\n if (!this.model) {\r\n this.model = new JournalEntryDetail()\r\n }\r\n },\r\n\r\n events: {\r\n 'keyup input': 'update',\r\n 'click .remove': 'removeDetail',\r\n 'focusin input': 'inputFocusIn',\r\n 'focusout input': 'inputFocusOut',\r\n 'click .ui-autocomplete-input': 'clickAutocomplete'\r\n },\r\n\r\n render: function () {\r\n var modelView = this.model.toJSON()\r\n if (modelView.credit === 0) {\r\n modelView.credit = ''\r\n }\r\n if (modelView.debit === 0) {\r\n modelView.debit = ''\r\n }\r\n\r\n this.$el.html(CreateDetailTemplate(modelView))\r\n this.autocomplete('accountName')\r\n this.autocomplete('accountNumber')\r\n\r\n return this\r\n },\r\n\r\n inputFocusIn: function (e) {\r\n this.trigger('focusin')\r\n },\r\n\r\n inputFocusOut: function (e) {\r\n this.trigger('focusout')\r\n },\r\n\r\n clickAutocomplete: function (e) {\r\n if (e && e.currentTarget && e.currentTarget.setSelectionRange && e.currentTarget.selectionStart != undefined) {\r\n var textLength = $(e.currentTarget).val().length\r\n if (textLength === e.currentTarget.selectionStart) {\r\n e.currentTarget.setSelectionRange(0, textLength)\r\n }\r\n }\r\n },\r\n\r\n update: function (event) {\r\n var $input = $(event.currentTarget)\r\n var val = $input.val()\r\n if ($input.hasClass('currency-field')) {\r\n val = numbro().unformat(val)\r\n }\r\n this.model.set($input.attr('name'), val)\r\n },\r\n\r\n autocomplete: function (name) {\r\n var $autocomplete = this.$('input[name=' + name + ']')\r\n var accounts = name !== 'accountName'\r\n ? this.model.get('accounts')\r\n : _.sortBy(this.model.get('accounts'), ['attributes.accountName'])\r\n\r\n var currentAccountId = this.model.get('ledgerAccountId')\r\n\r\n accounts = _.filter(accounts, function (account) {\r\n return !account.get('hasCheckbook') || account.get('id') === currentAccountId\r\n })\r\n\r\n var accountLookup = _.keyBy(accounts, 'attributes.id')\r\n var $accountNumber = this.$('input[name=accountNumber]')\r\n var $accountName = this.$('input[name=accountName]')\r\n\r\n var accountSelectedCallback = function (accountId) {\r\n this.model.set({\r\n 'accountNumber': accountLookup[accountId].get('accountNumber'),\r\n 'accountName': accountLookup[accountId].get('accountName'),\r\n 'ledgerAccountId': accountId\r\n }, { silent: true })\r\n\r\n $accountNumber\r\n .val(this.model.get('accountNumber'))\r\n .parent()\r\n .addClass('open')\r\n $accountName\r\n .val(this.model.get('accountName'))\r\n .parent()\r\n .addClass('open')\r\n\r\n this.$el.find('input[name=debit]').focus()\r\n }.bind(this)\r\n\r\n var getAccountId = function () {\r\n var selectedItem = null\r\n\r\n if (!$autocomplete.val()) {\r\n return null\r\n }\r\n\r\n _.each(autocomplete.menu.element.find('li'), function (el) {\r\n var isMatching = $(el).text() == $autocomplete.val()\r\n if (isMatching && !selectedItem) {\r\n selectedItem = $(el)\r\n }\r\n })\r\n if (!selectedItem) {\r\n selectedItem = autocomplete.menu.element.find('li:first-child')\r\n }\r\n\r\n return selectedItem.attr('data-id')\r\n }\r\n\r\n var autocomplete = $.extend($autocomplete.autocomplete({\r\n source: _.map(_.filter(accounts, {'attributes': {status: true}}), function (account) {\r\n return {\r\n label: account.get(name),\r\n value: account.get('id')\r\n }\r\n }),\r\n delay: 100,\r\n minLength: 0,\r\n appendTo: $('#main-container'),\r\n select: function (event, ui) {\r\n var accountId = ui.item.value\r\n accountSelectedCallback(accountId)\r\n event.preventDefault()\r\n },\r\n change: function (event, ui) {\r\n var accountId = getAccountId()\r\n if (!accountId) {\r\n this.$el.find('input[name=accountNumber], input[name=accountName]').val('').closest('.floating').removeClass('open')\r\n this.model.set({\r\n 'accountNumber': '',\r\n 'accountName': '',\r\n 'ledgerAccountId': ''\r\n }, { silent: true })\r\n } else {\r\n accountSelectedCallback(accountId)\r\n event.preventDefault()\r\n }\r\n }.bind(this),\r\n focus: function (event, ui) {\r\n event.preventDefault()\r\n },\r\n open: function (event, ui) {\r\n autocomplete.menu.element.css({\r\n 'width': $autocomplete.outerWidth(),\r\n 'top': Number(autocomplete.menu.element.css('top').replace('px', '')) + 2\r\n })\r\n }\r\n }).on('focus', function () {\r\n $autocomplete.autocomplete('search', '')\r\n }).data('ui-autocomplete'), {\r\n _renderMenu: function (ul, items) {\r\n _.each(items, function (item) {\r\n var $listItem = this._renderItemData(ul, item)\r\n $listItem.attr('data-id', item.value)\r\n }.bind(this))\r\n },\r\n _resizeMenu: function () {\r\n this.menu.element.css({\r\n 'width': $autocomplete.outerWidth(),\r\n position: 'absolute'\r\n }).addClass('z-1')\r\n }\r\n })\r\n\r\n $autocomplete.on('keyup', function (e) {\r\n if (e.which == 13) {\r\n var accountId = getAccountId()\r\n if (!accountId) {\r\n $accountName.val('').closest('.floating').removeClass('open')\r\n $accountNumber.val('').closest('.floating').removeClass('open')\r\n return\r\n } else {\r\n $autocomplete.autocomplete('instance')._trigger('select', 'autocompleteselect', {item: {value: accountId}})\r\n $autocomplete.autocomplete('close')\r\n }\r\n }\r\n })\r\n },\r\n\r\n loadDefaults: function (lineItem) {\r\n var accounts = this.model.get('accounts')\r\n var account = _.find(accounts, {id: lineItem.ledgerAccountId})\r\n var accountName = account.get('accountName')\r\n var accountNumber = account.get('accountNumber')\r\n var debit = lineItem.debit\r\n var credit = lineItem.credit\r\n\r\n this.model.set({\r\n accountNumber: accountNumber,\r\n accountName: accountName,\r\n ledgerAccountId: account.id,\r\n debit: debit,\r\n credit: credit\r\n })\r\n\r\n this.$('input[name=accountNumber]').val(accountNumber)\r\n this.$('input[name=accountName]').val(accountNumber)\r\n this.$('input[name=debit]').val(accountNumber)\r\n this.$('input[name=credit]').val(accountNumber)\r\n },\r\n\r\n hasAccount: function () {\r\n return this.model.get('ledgerAccountId')\r\n },\r\n\r\n removeDetail: function () {\r\n setTimeout(function () {\r\n this.remove()\r\n this.trigger('remove')\r\n }.bind(this), MAGIC_ANIMATION_TIMEOUT)\r\n },\r\n\r\n setBalance: function (newBalance) {\r\n this.$('input[name=balance]').val(numbro(newBalance).format('($0,0.00)'))\r\n }\r\n})\r\n\r\nmodule.exports = CreateEntryView\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"col-lg-12 journal-balance-balanced bg-primary-lighter\\\"><i class=\\\"fa fa-check-circle fa-2x fa-inverse\\\"></i>Your journal entry is balanced.</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"<div class=\\\"col-lg-12 journal-balance-discrepency bg-danger-light\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i>Journal entry is out of balance by \"\n + container.escapeExpression(((helper = (helper = helpers.amount || (depth0 != null ? depth0.amount : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"amount\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow flex error-row\\\">\\r\\n <div class=\\\"line-number\\\">\"\n + alias4(((helper = (helper = helpers.lineNumber || (depth0 != null ? depth0.lineNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lineNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"reason\\\">\"\n + alias4(((helper = (helper = helpers.reason || (depth0 != null ? depth0.reason : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reason\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block errors\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Journal Entries Import Errors</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"line-number\\\">Line #</div>\\r\\n <div class=\\\"reason\\\">Error</div>\\r\\n </div>\\r\\n <div class=\\\"import-error-list\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.errors : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15 push-15-r\\\" name=\\\"completeReview\\\">Complete Review</button>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"import-button\\\">\\r\\n <button class=\\\"btn btn-primary pull-right push-30\\\" name=\\\"openImport\\\">Import</button>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block no-padding tabbed collapsed\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"own-template\\\" id=\\\"ownTemplate\\\">\\r\\n <div class=\\\"pull-right\\\"><i class=\\\"fa fa-close expanding-group-close cancel\\\"></i></div>\\r\\n <div class=\\\"steps\\\">\\r\\n <div class=\\\"step1\\\">\\r\\n <h3>Step 1: Download the template</h3>\\r\\n <p><a href=\\\"http://get.crunched.help/hc/en-us/articles/115001943267-How-to-import-journal-entries\\\" target=\\\"_blank\\\">Click here</a> to download an import template. You can update this spreadsheet with your own data.</p>\\r\\n </div>\\r\\n <div class=\\\"step2\\\">\\r\\n <h3>Step 2: Upload your data</h3>\\r\\n <p>Once you've updated the template and saved it, please upload it here to import your data.</p>\\r\\n <label>\\r\\n <span class=\\\"file-name\\\"></span>\\r\\n <span class=\\\"floating\\\">Upload File</span>\\r\\n <input type=\\\"file\\\" name=\\\"outlineUpload\\\">\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15-r push-15\\\" name=\\\"upload\\\">Upload</button>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"import-message\\\">\\r\\n <span class=\\\"import-templates\\\">Add using templates</span>\\r\\n <span class=\\\"manually\\\">Add manually</span>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar CreateView = require('lists/list/create/view')\r\nvar Template = require('journal/import/template')\r\nvar ErrorTemplate = require('journal/import/error-template')\r\nvar HasJournalEntriesTemplate = require('journal/import/has-journal-entries')\r\nvar sweetAlert = require('sweetalert2')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar ScrollTo = require('jquery-scrollto')\r\n\r\nvar ListView = CreateView.extend({\r\n className: 'import',\r\n events: {\r\n 'change input[type=file]': 'changeFile',\r\n 'click button[name=upload]': 'uploadOwn',\r\n 'click button[name=completeReview]': 'completeReview',\r\n 'click button[name=openImport]': 'openImport',\r\n 'click .cancel': 'close'\r\n },\r\n initialize: function () {\r\n this.Template = Template\r\n this.listenTo(this.model, 'change:entries', this.render)\r\n this.on('uploadErrors', this.uploadErrors, this)\r\n this.on('uploadSuccess', this.uploadSuccess, this)\r\n this.on('importFailed', this.importFailed, this)\r\n },\r\n render: function () {\r\n var TemplateToRender = ((this.model.get('entries') > 0) && !this.forceOpen) ? HasJournalEntriesTemplate : Template\r\n this.$el.html(TemplateToRender(this.model.toViewModel()))\r\n\r\n if (this.onRender) {\r\n this.onRender()\r\n }\r\n\r\n return this\r\n },\r\n changeFile: function (e) {\r\n var journalSpreadsheet = _.first(e.target.files)\r\n\r\n if (!journalSpreadsheet) {\r\n return console.warn('No image selected, leaving unchanged')\r\n }\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (journalSpreadsheetFile) {\r\n if (this.checkFileExtension(journalSpreadsheet)) {\r\n this.cachedJournalSpreadsheet = journalSpreadsheetFile.target.result\r\n this.$('.file-name').text(journalSpreadsheet.name)\r\n this.fileNameLabelStyling()\r\n }\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(journalSpreadsheet)\r\n\r\n this.isValidFileExtension = this.checkFileExtension(journalSpreadsheet)\r\n },\r\n // For Edge browser, to prevent an overlapping text issue of text:file-name and a label.\r\n fileNameLabelStyling: function () {\r\n this.$('.floating').css({\r\n 'top': '-29px',\r\n 'font-weight': 600,\r\n 'font-size': '13px'\r\n })\r\n },\r\n checkFileExtension: function (selectedFile) {\r\n var validExts = new Array('.xlsx')\r\n var fileExt = selectedFile.name\r\n fileExt = fileExt.substring(fileExt.lastIndexOf('.')).toLowerCase()\r\n if (validExts.indexOf(fileExt) < 0) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'You can only upload Excel(*.xlsx) file.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n\r\n this.$('.file-name').text('')\r\n this.$('.floating').css({\r\n 'top': '-5px',\r\n 'font-weight': 400,\r\n 'font-size': '15px'\r\n })\r\n this.isValidFileExtension = false\r\n return false\r\n } else {\r\n this.isValidFileExtension = true\r\n return true\r\n }\r\n },\r\n uploadOwn: function () {\r\n if (!!this.validateFileType()) {\r\n this.upload(this.cachedJournalSpreadsheet)\r\n // To prevent importing a previously uploaded or selected file while no file is selected for the second time\r\n this.cachedJournalSpreadsheet = ''\r\n this.isValidFileExtension = false\r\n }\r\n },\r\n validateFileType: function () {\r\n if (this.isValidFileExtension) {\r\n var fileType = this.cachedJournalSpreadsheet\r\n var xlsxMimeType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\r\n fileType = fileType.substring(fileType.lastIndexOf(':') + 1, fileType.lastIndexOf(';'))\r\n\r\n // if a selected file extension is correct by checking its name,\r\n // but if there is no reader or an application installed for the file type in the local machine,\r\n // OS will not recognize the file type. Hence, if the selected file type is valid, but the mime type is empty, we set the type manually.\r\n if (fileType === '' && this.isValidFileExtension || fileType !== xlsxMimeType && this.isValidFileExtension) {\r\n var index = this.cachedJournalSpreadsheet.lastIndexOf(':') + 1\r\n if (fileType !== '') {\r\n // When there is no reader for the file, FireFox passes: \"application/octet-stream\"\r\n this.cachedJournalSpreadsheet = this.cachedJournalSpreadsheet.replace(fileType, '')\r\n }\r\n this.cachedJournalSpreadsheet = this.insert(this.cachedJournalSpreadsheet, index, xlsxMimeType)\r\n }\r\n\r\n var insertedMimeType = this.cachedJournalSpreadsheet\r\n insertedMimeType = insertedMimeType.substring(insertedMimeType.lastIndexOf(':') + 1, insertedMimeType.lastIndexOf(';'))\r\n\r\n return (fileType === xlsxMimeType) || (fileType === '' && this.isValidFileExtension && insertedMimeType === xlsxMimeType) || (fileType !== xlsxMimeType && this.isValidFileExtension && insertedMimeType === xlsxMimeType)\r\n }\r\n },\r\n insert: function (str, index, value) {\r\n return str.substr(0, index) + value + str.substr(index)\r\n },\r\n upload: function (spreadsheet) {\r\n this.trigger('upload', {import: spreadsheet})\r\n },\r\n completeReview: function () {\r\n this.$('.errors').remove()\r\n\r\n $('.block[hidden-during-review], .import-message[hidden-during-review], .import-button[hidden-during-review]')\r\n .removeClass('hidden')\r\n .attr('hidden-during-review', null)\r\n\r\n $('.page-heading').ScrollTo()\r\n this.trigger('reload')\r\n },\r\n uploadErrors: function (errors, successCount) {\r\n this.close()\r\n\r\n $('.block, .import-message, .import-button')\r\n .addClass('hidden')\r\n .attr('hidden-during-review', '1')\r\n\r\n this.$el.append(ErrorTemplate({errors: errors}))\r\n var totalCount = errors.length + successCount\r\n\r\n if (!successCount) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: successCount + ' of ' + totalCount + ' journal entries have been imported, some information couldn\\'t be parsed.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n } else {\r\n sweetAlert({\r\n title: 'Warning',\r\n text: successCount + ' of ' + totalCount + ' journal entries have been imported, some information couldn\\'t be parsed.',\r\n type: 'warning',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n }\r\n },\r\n uploadSuccess: function (successCount) {\r\n this.close()\r\n sweetAlert({\r\n title: 'Success',\r\n text: successCount + ' of ' + successCount + ' journal entries have been imported. Please set up your journal entry assignments to get the most out of Crunched.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n importFailed: function (errorMessage) {\r\n this.close()\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Failed to import the journal entries. ' + errorMessage,\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n openImport: function () {\r\n this.forceOpen = true\r\n this.$el.addClass('forced-open')\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.close.bind(this))\r\n this.render()\r\n },\r\n close: function () {\r\n this.forceOpen = false\r\n this.$el.removeClass('forced-open')\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n this.render()\r\n }\r\n})\r\n\r\nmodule.exports = ListView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar JournalService = require('journal/journal-service')\r\nvar JournalImportView = require('journal/import/view')\r\n\r\nvar JournalImportWidget = function () {\r\n this.journalService = new JournalService()\r\n this.model = new Backbone.Model({\r\n entries: 0\r\n })\r\n\r\n this.model.toViewModel = this.model.toJSON.bind(this.model)\r\n\r\n this.view = new JournalImportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('upload', this.upload.bind(this))\r\n this.view.on('reload', function () {\r\n this.trigger('reload')\r\n }.bind(this))\r\n\r\n this.countEntries()\r\n}\r\n\r\nJournalImportWidget.prototype = _.clone(Backbone.Events)\r\n\r\nJournalImportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nJournalImportWidget.prototype.countEntries = function () {\r\n return this.journalService.fetchEntryCount().then(function (results) {\r\n this.model.set('entries', results)\r\n }.bind(this))\r\n}\r\n\r\nJournalImportWidget.prototype.upload = function (spreadsheet) {\r\n return this.journalService.importSpreadsheet(spreadsheet).then(function (results) {\r\n return this.countEntries().then(function () {\r\n var errors = results.parseErrors\r\n var successCount = results.successCount\r\n\r\n Backbone.once('refreshed-import', function () {\r\n if (errors.length) {\r\n this.view.trigger('uploadErrors', errors, successCount)\r\n } else {\r\n this.view.trigger('uploadSuccess', successCount)\r\n }\r\n }.bind(this))\r\n\r\n this.trigger('refresh')\r\n }.bind(this))\r\n }.bind(this), function (error){\r\n this.view.trigger('importFailed', error.message)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = JournalImportWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar numbro = require('numbro')\r\n\r\nvar JournalEntry = Backbone.Model.extend({\r\n defaults: {\r\n credit: 0,\r\n debit: 0\r\n },\r\n\r\n toJSON: function () {\r\n var cloned = _.omit(this.attributes, ['accounts', 'needsVoid', 'isCloned', 'account'])\r\n\r\n cloned.credit = parseFloat(numbro().unformat(cloned.credit))\r\n cloned.debit = parseFloat(numbro().unformat(cloned.debit))\r\n\r\n return cloned\r\n }\r\n}, {\r\n parse: function (json) {\r\n return new JournalEntry({\r\n id: json.id,\r\n credit: json.credit,\r\n debit: json.debit,\r\n ledgerAccountId: json.ledgerAccountId,\r\n journalEntryId: json.journalEntryId,\r\n account: json.account,\r\n accountNumber: json.accountNumber,\r\n accountName: json.description,\r\n description: json.description,\r\n balance: json.balance\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = JournalEntry\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar _ = require('lodash')\r\nvar JournalEntryLineItem = require('journal/journal-entry/detail')\r\n\r\nvar JournalEntry = Backbone.Model.extend({\r\n defaults: {\r\n lineItems: []\r\n },\r\n\r\n constructor: function () {\r\n this.on('change:postedDate', function () {\r\n this.set({\r\n shortPostedDate: this.get('postedDate').format('MM/DD/YYYY')\r\n })\r\n }.bind(this))\r\n\r\n this.on('change:lineItems', function () {\r\n this.set({\r\n amount: _.reduce(this.get('lineItems'), function (memo, lineItem) {\r\n return memo + Number(lineItem.get('debit'))\r\n }, 0)\r\n })\r\n })\r\n\r\n Backbone.Model.prototype.constructor.apply(this, arguments)\r\n },\r\n\r\n toJSON: function () {\r\n var cloned = _.omit(this.attributes, ['accounts', 'shortPostedDate', 'amount'])\r\n cloned.lineItems = _.map(cloned.lineItems, function (lineItem) {\r\n return lineItem.toJSON()\r\n })\r\n\r\n return cloned\r\n }\r\n}, {\r\n parse: function (json) {\r\n var balance = 0\r\n return new JournalEntry({\r\n id: json.id,\r\n createdDate: moment(json.createdDate),\r\n postedDate: moment(json.postedDate),\r\n description: json.description,\r\n notes: json.notes,\r\n isVoided: json.voidJournal,\r\n isAutomatic: json.isAutomatic,\r\n lineItems: _.map(json.lineItems, function (lineItem) {\r\n lineItem.description = lineItem.ledgerAccount.accountName\r\n lineItem.accountNumber = lineItem.ledgerAccount.accountNumber\r\n balance = balance - (lineItem.credit * 100) + (lineItem.debit * 100)\r\n lineItem.balance = balance / 100\r\n return JournalEntryLineItem.parse(lineItem)\r\n })\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = JournalEntry\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar GeneralLedgerJournalWidget = require('journal/widget')\r\n\r\nvar JournalRouter = Router.extend({\r\n routes: {\r\n 'journal': 'showJournal'\r\n },\r\n\r\n showJournal: function () {\r\n Backbone.trigger('app:showInFrame', new GeneralLedgerJournalWidget())\r\n Backbone.trigger('app:updateTitle', 'Journal Entries', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Company', href: '/company'}, {label: 'Journal Entries'}])\r\n }\r\n})\r\n\r\nmodule.exports = JournalRouter\r\n","'use strict'\r\n\r\nvar Q = require('q')\r\nvar _ = require('lodash')\r\nvar Config = require('config/config')\r\nvar CompanyService = require('company/company-service')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar RestClient = require('rest/client')\r\nvar JournalEntry = require('journal/journal-entry/entry')\r\n\r\nvar JournalService = function () {\r\n this.companyService = new CompanyService()\r\n this.accountService = new AccountService()\r\n this.restClient = new RestClient()\r\n}\r\n\r\nJournalService.prototype.fetchEntryCount = function (index) {\r\n // TODO API pagination?\r\n if (index >= 1) {\r\n return Q.reject('EOF')\r\n }\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.accountService.fetchAccounts(true).then(function (accounts) {\r\n var accountLookup = _.keyBy(accounts, 'attributes.id')\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/journal-entries').then(function (response) {\r\n return response.totalRecords\r\n })\r\n }.bind(this))\r\n}\r\n\r\nJournalService.prototype.editJournal = function (journal) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n if (!journal) {\r\n return Q.reject('NRE')\r\n }\r\n\r\n return this.restClient.put(\r\n Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/journal-entries/' + journal.id,\r\n journal.toJSON()\r\n )\r\n}\r\n\r\nJournalService.prototype.createJournal = function (journal) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n if (!journal) {\r\n return Q.reject('NRE')\r\n }\r\n\r\n var journalData = journal.toJSON()\r\n if (journalData.memorizationList) {\r\n console.warn('Removing extraneous memorizationList')\r\n delete journalData.memorizationList\r\n }\r\n\r\n return this.restClient.post(\r\n Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/journal-entries',\r\n journal.toJSON()\r\n )\r\n}\r\n\r\nJournalService.prototype.deleteItem = function (journalId) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n if (!journalId) {\r\n return Q.reject('NRE')\r\n }\r\n\r\n return this.restClient.del(\r\n Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/journal-entries/' + journalId\r\n )\r\n}\r\n\r\nJournalService.prototype.importSpreadsheet = function (spreadsheet) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'journal-entries',\r\n 'import'\r\n ]\r\n\r\n var actionPath = actionPathSegments.join('/')\r\n\r\n return this.restClient.post(actionPath, spreadsheet)\r\n}\r\n\r\nmodule.exports = JournalService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"voided\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <span class=\\\"pull-right\\\">Void</span>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = (helpers.if_not_eq_0 || (depth0 && depth0.if_not_eq_0) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.activeUserRole : depth0),{\"name\":\"if_not_eq_0\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <a class=\\\"fa fa-pencil edit\\\"></a>\\r\\n\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAutomatic : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \" <a class=\\\"fa fa-trash-o delete\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class='view ledger-journal itemrow flex \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isVoided : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"' style=\\\"height: 44px;\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"journal-date date\\\">\\r\\n \"\n + alias4(((helper = (helper = helpers.shortPostedDate || (depth0 != null ? depth0.shortPostedDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortPostedDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\r\\n </div>\\r\\n <div class=\\\"journal-description\\\">\\r\\n \"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\r\\n </div>\\r\\n <div class=\\\"journal-amount currency\\\">\\r\\n \"\n + alias4(((helper = (helper = helpers.amount || (depth0 != null ? depth0.amount : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"amount\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\r\\n </div>\\r\\n <div class=\\\"journal-notes\\\">\\r\\n \"\n + alias4(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"notes\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\r\\n </div>\\r\\n <div class=\\\"actions no-padding\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isVoided : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(5, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n</div>\\r\\n<div class=\\\"meta\\\"></div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar numbro = require('numbro')\r\nvar GeneralLedgerJournalHistoryItemTemplate = require('journal/list/item-template')\r\nvar GeneralLedgerJournalHistoryItemDetailView = require('journal/read/view')\r\nvar sweetAlert = require('sweetalert2')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar GeneralLedgerJournalHistoryView = Backbone.View.extend({\r\n className: 'ledger-journal-container',\r\n\r\n events: {\r\n 'click .view': 'showDetails',\r\n 'click .edit': 'showEdit',\r\n 'click .delete': 'showDelete'\r\n },\r\n\r\n initialize: function () {\r\n this.companyService = new CompanyService()\r\n this.model.on('closeForm', this.closeMeta, this)\r\n },\r\n\r\n render: function () {\r\n var activeCompanyInfo = this.companyService.getActiveCompanyInfo()\r\n this.model.set('activeUserRole', activeCompanyInfo.role)\r\n this.model.set('amount', numbro(this.model.get('amount')).formatCurrency('$0,0.00'))\r\n this.$el.html(GeneralLedgerJournalHistoryItemTemplate(this.model.attributes))\r\n\r\n return this\r\n },\r\n\r\n showDetails: function () {\r\n var detailsView = new GeneralLedgerJournalHistoryItemDetailView({\r\n model: this.model\r\n })\r\n\r\n this.closeMeta()\r\n\r\n this.$('.view').addClass('activeJournalEntry')\r\n this.$('.meta').append(detailsView.render().$el)\r\n\r\n this.setActiveView(detailsView)\r\n this.trigger('padDetails', this, detailsView.$('.modal'), this.$el.position().top + 66)\r\n\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.closeMeta.bind(this))\r\n },\r\n\r\n showEdit: function (event) {\r\n event.stopImmediatePropagation()\r\n\r\n this.closeMeta()\r\n this.trigger('showEdit')\r\n },\r\n\r\n showDelete: function (event) {\r\n event.stopImmediatePropagation()\r\n\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'Are you sure you want to delete this Journal Entry?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'No'\r\n }).then(function () {\r\n this.model.trigger('delete')\r\n this.trigger('confirmYes')\r\n }.bind(this))\r\n },\r\n\r\n closeMeta: function () {\r\n if (!this.activeChild) {\r\n return\r\n }\r\n\r\n this.activeChild.remove()\r\n this.activeChild = null\r\n\r\n this.$('.view').removeClass('activeJournalEntry')\r\n\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n\r\n this.trigger('closeMeta')\r\n },\r\n\r\n setActiveView: function (childView) {\r\n this.activeChild = childView\r\n setTimeout(function () {\r\n this.$el.ScrollTo()\r\n }.bind(this), 250)\r\n\r\n Backbone.once('app:navigate', this.closeMeta, this)\r\n }\r\n})\r\n\r\nmodule.exports = GeneralLedgerJournalHistoryView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \" <span class=\\\"pull-right\\\">Void</span>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing;\n\n return \" <a class=\\\"fa fa-pencil edit\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\"\n + ((stack1 = (helpers.if_not_eq_0 || (depth0 && depth0.if_not_eq_0) || alias2).call(alias1,(depth0 != null ? depth0.activeUserRole : depth0),{\"name\":\"if_not_eq_0\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAutomatic : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-trash-o delete\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"actions no-padding\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isVoided : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var _ = require('underscore')\r\nvar Config = require('config/config')\r\nvar Backbone = require('backbone')\r\nvar JournalEntry = require('journal/journal-entry/entry')\r\nvar SessionService = require('session/session-service')\r\n\r\nvar JournalEntryHistories = Backbone.PageableCollection.extend({\r\n model: JournalEntry,\r\n initialize: function (companyId) {\r\n this.companyId = companyId\r\n },\r\n url: function () {\r\n return Config['CRUNCHED_API_HOST'] + '/companies/' + this.companyId + '/journal-entries'\r\n },\r\n sync: function (method, model, options) {\r\n return Backbone.sync(method, model, _.extend({}, options, {\r\n headers: {\r\n 'Authorization': 'Bearer ' + SessionService.getToken()\r\n }\r\n }))\r\n },\r\n state: {\r\n firstPage: 0,\r\n pageSize: 25,\r\n sortKey: 'postedDate',\r\n order: 'desc'\r\n },\r\n queryParams: {\r\n pageSize: 'pageSize',\r\n sortKey: 'sortKey',\r\n order: 'order'\r\n },\r\n parseState: function (resp, queryParams, state, options) {\r\n return {\r\n totalRecords: resp.totalRecords\r\n }\r\n },\r\n parseRecords: function (resp, options) {\r\n return _.map(resp.items, JournalEntry.parse)\r\n }\r\n\r\n})\r\n\r\nmodule.exports = JournalEntryHistories\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Journal Entries</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content history\\\">\\r\\n <br />\\r\\n <div class=\\\"journal-entry-table backgrid-table\\\"></div>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"col-lg-12 item-template journal-voiding bg-warning-light item-confirmation\\\"><i class=\\\"fa fa-info-circle fa-2x fa-inverse\\\"></i>Are you sure you want to VOID this Journal Entry? You will not be able to change this Journal Entry later on: <button class=\\\"confirmNo\\\">No</button><button class=\\\"confirmYes\\\">Yes</button></div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar numbro = require('numbro')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar GeneralLedgerJournalHistoryTemplate = require('journal/list/template')\r\nvar GeneralLedgerJournalHistoryItemDetailView = require('journal/read/view')\r\nvar EditEntryWidget = require('journal/update/widget')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar ActionCellView = require('forms/action-cell/view')\r\nvar JournalEntryActionsTemplate = require('journal/list/journal-entry-actions')\r\nvar Backgrid = require('backgrid')\r\nrequire('backgrid-paginator')\r\n\r\nvar GeneralLedgerJournalHistoryView = Backbone.View.extend({\r\n className: 'journalList',\r\n\r\n initialize: function () {\r\n this.editWidget = new EditEntryWidget()\r\n this.detailsWidget = new GeneralLedgerJournalHistoryItemDetailView()\r\n\r\n this.editWidget.on('closeForm', this.closeMeta, this)\r\n this.editWidget.on('reload', function () {\r\n this.trigger('reload')\r\n }, this)\r\n\r\n this.detailsWidget.on('closeForm', this.closeMeta, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(GeneralLedgerJournalHistoryTemplate())\r\n this.generateGrid()\r\n return this\r\n },\r\n\r\n events: {\r\n 'click .edit': 'edit',\r\n 'click .delete': 'delete',\r\n 'click .backgrid tbody tr': 'showDetails'\r\n },\r\n\r\n generateGrid: function () {\r\n var gridRow = Backgrid.Row.extend({\r\n className: 'view'\r\n })\r\n var table = new Backgrid.Grid({\r\n row: gridRow,\r\n columns: this.getColumns(),\r\n collection: this.model.get('journalCollection')\r\n })\r\n var paginator = new Backgrid.Extension.Paginator({\r\n collection: this.model.get('journalCollection')\r\n })\r\n this.$('.journal-entry-table')\r\n .append(table.render().el)\r\n .append(paginator.render().el)\r\n },\r\n\r\n getColumns: function () {\r\n return [{\r\n name: 'postedDate',\r\n label: 'Date',\r\n editable: false,\r\n sortable: true,\r\n direction: 'descending',\r\n cell: Backgrid.Cell.extend({\r\n className: 'journal-date date',\r\n render: function () {\r\n if (this.model.get('postedDate') !== undefined) {\r\n this.$el.append(this.model.get('postedDate').format('MM/DD/YYYY'))\r\n }\r\n return this\r\n }\r\n })\r\n }, {\r\n name: 'description',\r\n label: 'Description',\r\n sortable: false,\r\n editable: false,\r\n cell: Backgrid.Cell.extend({\r\n className: 'journal-description'\r\n })\r\n }, {\r\n name: 'amount',\r\n label: 'Amount',\r\n sortable: false,\r\n editable: false,\r\n cell: Backgrid.Cell.extend({\r\n className: 'journal-amount currency',\r\n render: function () {\r\n this.$el.append(numbro(this.model.get('amount')).formatCurrency('($0,0.00)'))\r\n return this\r\n }\r\n })\r\n }, {\r\n name: 'notes',\r\n label: 'Notes',\r\n sortable: false,\r\n editable: false,\r\n cell: Backgrid.Cell.extend({\r\n className: 'journal-notes'\r\n })\r\n }, {\r\n name: 'actions',\r\n label: '',\r\n editable: false,\r\n cell: ActionCellView.extend({\r\n template: JournalEntryActionsTemplate,\r\n createViewModel: function () {\r\n if (this.model.get('id') !== undefined) {\r\n return {\r\n id: this.model.get('id')\r\n }\r\n }\r\n }\r\n })\r\n }, {\r\n name: 'id',\r\n label: 'Id',\r\n cell: 'string',\r\n sortable: false,\r\n editable: false,\r\n renderable: false\r\n }]\r\n },\r\n\r\n edit: function (item) {\r\n item.stopPropagation()\r\n this.closeMeta()\r\n var itemId = item.currentTarget.dataset.id\r\n var parentRow = $(item.currentTarget).parent().parent().parent()\r\n var collection = this.model.get('journalCollection')\r\n var itemView = _.find(collection.models, { id: itemId })\r\n\r\n // The distance between the top of the history container to the bottom of the top most item is ~92px.\r\n // For some reason, the top most item has a top position of 28, so adjust 92 to accomodate it.\r\n var editModalOffset = parentRow.position().top + 64\r\n this.editWidget.setModel(itemView, editModalOffset)\r\n var editModalContents = this.editWidget.show()\r\n\r\n this.$el.append(editModalContents)\r\n\r\n this.padElement(itemView, editModalContents, editModalOffset)\r\n\r\n this.editWidget.details.on('add', function () {\r\n this.padElement(itemView, editModalContents, editModalOffset)\r\n }, this)\r\n\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).one('click', this.closeMeta.bind(this))\r\n\r\n this.setActiveView(this.editWidget.view, true)\r\n },\r\n\r\n showDetails: function (item) {\r\n if (this.activeChild !== this.detailsWidget) {\r\n var itemId = item.currentTarget.children[5].innerHTML\r\n var collection = this.model.get('journalCollection')\r\n var selectedModel = _.find(collection.models, { id: itemId })\r\n\r\n this.detailsWidget.model = selectedModel\r\n var offsetPositionY = $(item.currentTarget).position().top + 50\r\n var detailsModalContents = this.detailsWidget.render().$el\r\n\r\n $(item.currentTarget).addClass('activeJournalEntry')\r\n this.$('.block').append(detailsModalContents)\r\n\r\n $('.modal').css({\r\n top: offsetPositionY\r\n })\r\n\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).one('click', this.closeMeta.bind(this))\r\n\r\n this.setActiveView(this.detailsWidget, false)\r\n }\r\n },\r\n\r\n delete: function (item) {\r\n item.stopPropagation()\r\n this.closeMeta()\r\n var journalId = $(item.currentTarget).attr('data-id')\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'Are you sure you want to delete this Journal Entry?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'No'\r\n }).then(function () {\r\n this.trigger('delete', journalId)\r\n this.trigger('confirmYes')\r\n }.bind(this))\r\n },\r\n\r\n closeMeta: function () {\r\n if (!this.activeChild) {\r\n return\r\n }\r\n\r\n this.activeChild.remove()\r\n this.activeChild = null\r\n\r\n this.$('.view').removeClass('activeJournalEntry')\r\n\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n },\r\n\r\n setActiveView: function (childView, scrollTarget) {\r\n this.activeChild = childView\r\n if (scrollTarget) {\r\n setTimeout(function () {\r\n childView.$el.ScrollTo()\r\n }, 250)\r\n }\r\n Backbone.once('app:navigate', this.closeMeta, this)\r\n },\r\n\r\n padElement: function (itemView, padFor, offset) {\r\n var historyHeight = this.$el.height()\r\n var padForHeight = $(padFor).height() + offset + 60\r\n var historyHeightNeeded = padForHeight - historyHeight\r\n\r\n if (historyHeightNeeded > 0) {\r\n this.$el.css({\r\n 'padding-bottom': historyHeightNeeded\r\n })\r\n itemView.once('closeMeta', function () {\r\n this.$el.css({\r\n 'padding-bottom': 0\r\n })\r\n }, this)\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = GeneralLedgerJournalHistoryView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar GeneralLedgerJournalHistoryView = require('journal/list/view')\r\nvar JournalService = require('journal/journal-service')\r\nvar JournalEntryHistories = require('journal/list/journal-entry-list')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar GeneralLedgerJournalHistoryWidget = function () {\r\n this.journalService = new JournalService()\r\n this.companyService = new CompanyService()\r\n this.model = new Backbone.Model({\r\n entries: new Backbone.Collection(),\r\n page: 0,\r\n journalCollection: new JournalEntryHistories(this.companyService.getActiveCompanyId())\r\n })\r\n\r\n this.view = new GeneralLedgerJournalHistoryView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('loadPage', this.loadPage, this)\r\n this.view.on('delete', this.deleteItem, this)\r\n this.view.on('reload', function () {\r\n this.trigger('reload')\r\n }, this)\r\n\r\n _.extend(this, Backbone.Events)\r\n}\r\n\r\nGeneralLedgerJournalHistoryWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.loadPage()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nGeneralLedgerJournalHistoryWidget.prototype.loadPage = function () {\r\n this.model.get('journalCollection').fetch({reset: true})\r\n}\r\n\r\nGeneralLedgerJournalHistoryWidget.prototype.deleteItem = function (item) {\r\n return this.journalService.deleteItem(item).then(function () {\r\n this.trigger('reload')\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = GeneralLedgerJournalHistoryWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"col-lg-12 itemrow journal-details no-table-hover flex\\\">\\r\\n <div class=\\\"journal-account-number\\\">\"\n + alias4(((helper = (helper = helpers.accountNumber || (depth0 != null ? depth0.accountNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"journal-account-description\\\">\"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"journal-line-debit currency currency-field\\\">\"\n + alias4(((helper = (helper = helpers.debit || (depth0 != null ? depth0.debit : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"debit\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"journal-line-credit currency currency-field\\\">\"\n + alias4(((helper = (helper = helpers.credit || (depth0 != null ? depth0.credit : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"credit\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"journal-line-balance line-item-balance currency\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.balance : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"modal has-animation fadeInDown z-1\\\" style=\\\"display: block;\\\">\\r\\n <div class=\\\"block\\\">\\r\\n <div class=\\\"block-content table\\\">\\r\\n <div class=\\\"col-lg-12 head flex\\\">\\r\\n <div class=\\\"journal-account-number\\\">Account #</div>\\r\\n <div class=\\\"journal-account-description\\\">Description</div>\\r\\n <div class=\\\"journal-line-debit currencyHeader\\\">Debit</div>\\r\\n <div class=\\\"journal-line-credit currencyHeader\\\">Credit</div>\\r\\n <div class=\\\"journal-line-balance currencyHeader\\\">Balance</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.lineItems : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar GeneralLedgerJournalHistoryItemDetailTemplate = require('journal/read/template')\r\n\r\nvar GeneralLedgerJournalHistoryView = Backbone.View.extend({\r\n render: function () {\r\n this.$el.html(GeneralLedgerJournalHistoryItemDetailTemplate(this.model.toJSON()))\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = GeneralLedgerJournalHistoryView\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right expanding-group-close cancel\\\"></i>\\r\\n <h3>Edit Journal Entry</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content edit-journal-data\\\">\\r\\n <div class=\\\"form-group col-sm-3 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating input-group date\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"edit-journal-date\\\" name=\\\"PostedDate\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"edit-journal-date\\\">Date</label>\\r\\n <span class=\\\"input-group-addon\\\"><i class=\\\"fa fa-calendar\\\"></i></span>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"edit-journal-date\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-sm-9 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"edit-journal-desc\\\" name=\\\"description\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"edit-journal-desc\\\">Description</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"edit-journal-desc\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"edit-journal-note\\\" name=\\\"Notes\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"notes\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"edit-journal-note\\\">Notes</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"edit-journal-note\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"block-content hidden-content no-padding edit-journal-entry-lineitem\\\">\\r\\n <h3>Journal Entry Details</h3>\\r\\n <div class=\\\"line-item-container col-lg-12\\\">\\r\\n </div>\\r\\n <div class=\\\"col-lg-12 add-more-line-items\\\"><button class=\\\"clickable-button\\\">+ Add More Details</button></div>\\r\\n <div class=\\\"col-lg-12 form-group\\\">\\r\\n <button class=\\\"btn btn-primary pull-right update\\\">Update</button>\\r\\n </div>\\r\\n <div class=\\\"status col-lg-12\\\"></div>\\r\\n <div class=\\\"col-lg-12 item-template journal-balance-balanced bg-primary-lighter\\\"><i class=\\\"fa fa-check-circle fa-2x fa-inverse\\\"></i>Your journal entry is balanced.</div>\\r\\n <div class=\\\"col-lg-12 item-template journal-balance-discrepency bg-danger-light\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i>Your final balance isn't zeroed out yet. There is a {0} discrepency.</div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar moment = require('moment')\r\nvar EditEntryTemplate = require('journal/update/template')\r\nvar _ = require('lodash')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar BalancedTemplate = require('journal/entry-status-balanced')\r\nvar DiscrepancyTemplate = require('journal/entry-status-discrepancy')\r\nvar MaskedInput = require('jquery.maskedinput')\r\nvar MAGIC_DETAIL_HEIGHT = 53\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar EditEntryView = Backbone.View.extend({\r\n className: 'edit-journal-entry z-2 fadeInDown has-animation',\r\n\r\n events: {\r\n 'click .cancel': 'closeForm',\r\n 'click .add-more-line-items button': 'addNewDetail',\r\n 'click .update': 'save',\r\n 'change input': 'isValidToUpdateJournalEntry',\r\n 'keyup input': 'isValidToUpdateJournalEntry',\r\n 'focusin input': 'isValidToUpdateJournalEntry',\r\n 'focusout input': 'isValidToUpdateJournalEntry'\r\n },\r\n\r\n initialize: function () {\r\n this.collection.on('add', this.showNewDetail, this)\r\n this.on('detailRemoved', function () {\r\n this.isValidToUpdateJournalEntry()\r\n }, this)\r\n },\r\n\r\n showNewDetail: function (detail) {\r\n var newDetail = detail.get('view').render().$el\r\n\r\n // Tweaks for styling and animations to display properly\r\n newDetail.height(0).css('display, none')\r\n detail.get('view').delegateEvents()\r\n this.$('.line-item-container').append(newDetail)\r\n newDetail.css('display', 'flex').height(MAGIC_DETAIL_HEIGHT)\r\n newDetail.find('input:first').focus()\r\n detail.get('view').on('focusin', this.lineFocusIn, this)\r\n detail.get('view').on('focusout', this.linefocusOut, this)\r\n },\r\n\r\n lineFocusIn: function () {\r\n this.$('.line-item-container').addClass('forceLabelsOpen')\r\n },\r\n\r\n linefocusOut: function (e) {\r\n var hasValue = _.reduce(\r\n this.$('.line-item-container input').map(function (index, el) { return $(el).val() }),\r\n function (memo, value) {\r\n return memo || (!!value && value != '$')\r\n },\r\n false\r\n )\r\n\r\n if (hasValue) {\r\n this.$('.line-item-container').addClass('forceLabelsOpen')\r\n } else {\r\n this.$('.line-item-container').removeClass('forceLabelsOpen')\r\n }\r\n },\r\n\r\n render: function () {\r\n var modelAttributes = {}\r\n\r\n if (this.model) {\r\n modelAttributes = this.model.toJSON()\r\n }\r\n\r\n this.$el.html(EditEntryTemplate(modelAttributes))\r\n\r\n this.collection.each(function (detail) {\r\n var newDetail = detail.get('view').render().$el\r\n\r\n // Tweaks for styling and animations to display properly\r\n newDetail.height(0).css('display, none')\r\n detail.get('view').delegateEvents()\r\n this.$('.line-item-container').append(newDetail)\r\n newDetail.css('display', 'flex').height(MAGIC_DETAIL_HEIGHT)\r\n\r\n detail.get('view').on('focusin', this.lineFocusIn, this)\r\n detail.get('view').on('focusout', this.linefocusOut, this)\r\n }.bind(this))\r\n\r\n this.$('.edit-journal-data input').on('keyup', this.update.bind(this))\r\n\r\n this.isValidToUpdateJournalEntry()\r\n\r\n this.$('.date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('postedDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('postedDate', moment(e.date))\r\n this.$('.date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n return this\r\n },\r\n\r\n setModel: function (model) {\r\n this.model = model\r\n this.render()\r\n },\r\n\r\n showForm: function (positionY) {\r\n this.$el.css({\r\n top: positionY\r\n })\r\n },\r\n\r\n closeForm: function (event) {\r\n this.trigger('closeForm')\r\n },\r\n\r\n update: function (event) {\r\n var $input = $(event.currentTarget)\r\n var val = $input.val()\r\n this.model.set($input.attr('name'), val)\r\n },\r\n\r\n addNewDetail: function (event) {\r\n this.trigger('add:detail')\r\n },\r\n\r\n addDetail: function (model) {\r\n this.trigger('add:detail', model)\r\n },\r\n\r\n balanced: function () {\r\n this.$('.status')\r\n .html(BalancedTemplate())\r\n },\r\n\r\n discrepancy: function (amount) {\r\n amount = amount.toFixed(2)\r\n this.$('.status')\r\n .html(DiscrepancyTemplate({amount: amount}))\r\n },\r\n\r\n showError: function (errorMessage) {\r\n this.$('.status')\r\n .html('<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">' + errorMessage + '</span></div>')\r\n },\r\n\r\n isValidToUpdateJournalEntry: function () {\r\n if (!this.isNumLineItemValid(this.numlineItem)) {\r\n this.showError('A journal entry must have at least two distributions.')\r\n } else if (!this.isBothSideNotZero(this.isNotZero)) {\r\n this.showError('A distribution must be greater than $0.00')\r\n } else if (!this.isNotNegativeValue(this.isNotNegVal)) {\r\n this.showError('Negative values are not allowed.')\r\n } else if (!this.isOnlyOneSideEntered(this.isOnlyOneEntered)) {\r\n this.showError('A distribution cannot have both debit and credit.')\r\n } else if (!this.isAccumulatedBalanceZero(this.balance)) {\r\n this.discrepancy(this.balance)\r\n } else if (!this.isAllAcctNumAndDescFieldsFilled()) {\r\n this.showError('A ledger account must be selected.')\r\n } else {\r\n this.balanced()\r\n }\r\n },\r\n\r\n isNumLineItemValid: function (lineItemLength) {\r\n return lineItemLength > 1\r\n },\r\n\r\n isBothSideNotZero: function (isBothSideNotZero) {\r\n return isBothSideNotZero\r\n },\r\n\r\n isNotNegativeValue: function (isNotNegVal) {\r\n return isNotNegVal\r\n },\r\n\r\n isOnlyOneSideEntered: function (isOnlyOneEntered) {\r\n return isOnlyOneEntered\r\n },\r\n\r\n isAccumulatedBalanceZero: function (balance) {\r\n return Math.abs(balance).toFixed(2) < 0.01\r\n },\r\n\r\n isAllAcctNumAndDescFieldsFilled: function () {\r\n var items = _.filter(this.$('.edit-journal-entry-lineitem .line-item-container .new-journal-entry-item'), function (row, index) {\r\n return (!this.$(row).find('input[name=accountNumber]').val() && !this.$(row).find('input[name=accountName]').val())\r\n }.bind(this))\r\n\r\n return !items.length\r\n },\r\n\r\n save: function () {\r\n if (!this.isNumLineItemValid(this.numlineItem) || !this.isBothSideNotZero(this.isNotZero) || !this.isNotNegativeValue(this.isNotNegVal) ||\r\n !this.isOnlyOneSideEntered(this.isOnlyOneEntered) || !this.isAccumulatedBalanceZero(this.balance) || !this.isAllAcctNumAndDescFieldsFilled()) {\r\n return\r\n }\r\n this.$('.update').prop('disabled', true)\r\n this.trigger(\r\n 'save',\r\n this.$('#edit-journal-desc').val(),\r\n this.$('#edit-journal-note').val()\r\n )\r\n },\r\n\r\n btnEnable: function () {\r\n $('.update').prop('disabled', false)\r\n },\r\n\r\n showSuccessAlert: function () {\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'The journal entry has been successfully updated.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n\r\n showErrorAlert: function () {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Failed to update the journal entry.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = EditEntryView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar Backbone = require('backbone')\r\nvar numbro = require('numbro')\r\n\r\nvar JournalService = require('journal/journal-service')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar EditEntryView = require('journal/update/view')\r\nvar CreateEntryDetailView = require('journal/entry-detail-input/view')\r\n\r\nvar JournalEntry = require('journal/journal-entry/entry')\r\nvar JournalEntryDetail = require('journal/journal-entry/detail')\r\n\r\nvar EditEntryWidget = function () {\r\n this.details = new Backbone.Collection()\r\n this.details.on('add remove', this.checkNeedsVoid, this)\r\n this.accountService = new AccountService()\r\n this.journalService = new JournalService()\r\n this.entry = new JournalEntry()\r\n this.view = new EditEntryView({\r\n collection: this.details,\r\n postedDate: moment()\r\n })\r\n this.view.on('add:detail', this.addDetail, this)\r\n this.view.on('save', this.save, this)\r\n this.view.on('save', function () {\r\n this.trigger('closeForm')\r\n }, this)\r\n this.view.on('closeForm', function () {\r\n this.trigger('closeForm')\r\n }, this)\r\n this.view.on('detailRemoved', this.recalcBalance, this)\r\n\r\n _.extend(this, Backbone.Events)\r\n\r\n this.accountService.fetchAccounts(true).then(function (accounts) {\r\n this.entry.set('accounts', accounts)\r\n }.bind(this))\r\n}\r\n\r\nEditEntryWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n var result = this.view.render().el\r\n\r\n return result\r\n}\r\n\r\nEditEntryWidget.prototype.checkNeedsVoid = function () {\r\n var lineItems = this.details.map(function (entry) {\r\n return entry.get('source')\r\n })\r\n var voidEmitters = _.concat(lineItems, [this.clonedModel])\r\n\r\n this.needsVoid = _.reduce(voidEmitters, function (memo, emitter) {\r\n return memo || emitter.get('needsVoid')\r\n }, false)\r\n\r\n this.view.needsVoid = this.needsVoid\r\n this.recalcBalance()\r\n}\r\n\r\nEditEntryWidget.prototype.setModel = function (model, positionY) {\r\n if (!this.entry.get('accounts')) {\r\n throw \"Accounts not loaded, can't edit journal entry yet.\"\r\n }\r\n\r\n this.model = model\r\n this.details.reset()\r\n\r\n console.log('Editing journal entry: ' + model.id)\r\n\r\n var clonedModel = model.clone()\r\n this.clonedModel = clonedModel\r\n\r\n clonedModel.on('change:postedDate', function () {\r\n var needsVoid = clonedModel.get('postedDate').format('x') != model.get('postedDate').format('x')\r\n clonedModel.set('needsVoid', needsVoid)\r\n this.view.needsVoid = this.needsVoid\r\n this.checkNeedsVoid()\r\n }.bind(this))\r\n\r\n clonedModel.set('lineItems', _.map(model.get('lineItems'), function (lineItem) {\r\n var clone = lineItem.clone()\r\n\r\n clone.set('isCloned', true)\r\n\r\n var importantAttributes = ['accountNumber', 'accountName', 'credit', 'debit']\r\n var changeDetectors = _.map(importantAttributes, function (attributeName) {\r\n return 'change:' + attributeName\r\n }).join(' ')\r\n clone.on(changeDetectors, function () {\r\n var needsVoid = _.reduce(importantAttributes, function (memo, attributeName) {\r\n return memo || (clone.get(attributeName) != lineItem.get(attributeName))\r\n }, false)\r\n\r\n clone.set('needsVoid', needsVoid)\r\n this.view.needsVoid = this.needsVoid\r\n this.checkNeedsVoid()\r\n }, this)\r\n\r\n return clone\r\n }.bind(this)))\r\n\r\n _.each(clonedModel.get('lineItems'), function (lineItem) {\r\n this.addDetail(lineItem, {silent: true})\r\n }.bind(this))\r\n\r\n this.originalModel = model\r\n this.view.setModel(clonedModel)\r\n this.view.showForm(positionY)\r\n}\r\n\r\nEditEntryWidget.prototype.closeModal = function () {\r\n this.details.reset()\r\n this.view.closeForm()\r\n}\r\n\r\nEditEntryWidget.prototype.addDetail = function (lineItem, options) {\r\n if (!this.entry.get('accounts')) {\r\n throw \"Accounts not loaded, can't add detail yet.\"\r\n }\r\n\r\n console.log('Adding detail line')\r\n\r\n var detailModel = lineItem\r\n if (!detailModel) {\r\n detailModel = new JournalEntryDetail({\r\n accounts: this.entry.get('accounts'),\r\n needsVoid: true\r\n })\r\n }\r\n\r\n detailModel.set('accounts', this.entry.get('accounts'))\r\n detailModel.on('change:credit change:debit', this.recalcBalance, this)\r\n\r\n var detailView = new CreateEntryDetailView(detailModel)\r\n\r\n var detailPair = new Backbone.Model({\r\n source: detailModel,\r\n view: detailView\r\n })\r\n this.details.add(detailPair, options)\r\n\r\n detailView.once('remove', function () {\r\n this.details.remove(detailPair)\r\n this.view.trigger('detailRemoved')\r\n }.bind(this))\r\n\r\n this.recalcBalance()\r\n}\r\n\r\nEditEntryWidget.prototype.recalcBalance = function (model) {\r\n var totalDebit = 0\r\n var totalCredit = 0\r\n var isBothSideNotZero = true\r\n var isNotNegativeValue = true\r\n var isOnlyOneSideEntered = true\r\n\r\n this.details.each(function (detail, index) {\r\n var detailModel = detail.get('source')\r\n var credit = (numbro().unformat(detailModel.get('credit')) || 0)\r\n var debit = (numbro().unformat(detailModel.get('debit')) || 0)\r\n if ((credit === 0) && (debit === 0)) {\r\n isBothSideNotZero = false\r\n }\r\n if ((credit < 0) || (debit < 0)) {\r\n isNotNegativeValue = false\r\n }\r\n if ((credit > 0) && (debit > 0)) {\r\n isOnlyOneSideEntered = false\r\n }\r\n totalCredit = totalCredit + credit\r\n totalDebit = totalDebit + debit\r\n })\r\n\r\n this.balance = this.details.reduce(function (memo, detail, index) {\r\n var detailModel = detail.get('source')\r\n var detailView = detail.get('view')\r\n\r\n // multiply 100 for each value, and then divide the totoal by 100 to avoid decimals which causes a floating number calculation error. \r\n var credit = (numbro().unformat(detailModel.get('credit')) || 0) * 100\r\n var debit = (numbro().unformat(detailModel.get('debit')) || 0) * 100\r\n var newBalance = memo * 100 + credit - debit\r\n newBalance /= 100\r\n detailView.setBalance(totalDebit == 0 && totalCredit == 0 ? '' : numbro(newBalance).formatCurrency('$0,0.00'))\r\n\r\n return newBalance\r\n }, 0)\r\n\r\n this.view.balance = this.balance\r\n this.view.numlineItem = this.details.length\r\n this.view.isNotZero = isBothSideNotZero\r\n this.view.isNotNegVal = isNotNegativeValue\r\n this.view.isOnlyOneEntered = isOnlyOneSideEntered\r\n}\r\n\r\nEditEntryWidget.prototype.save = function (editJournalDesc, editJournalNote) {\r\n if (this.balance != 0) {\r\n this.view.btnEnable()\r\n return\r\n }\r\n\r\n var model = this.clonedModel\r\n\r\n model.set({\r\n 'description': editJournalDesc,\r\n 'notes': editJournalNote,\r\n 'journalType': 'GENERAL',\r\n 'lineItems': this.details.map(function (detail) {\r\n return detail.get('source')\r\n })\r\n })\r\n\r\n this.originalModel.trigger('closeForm')\r\n this.journalService.editJournal(model).then(function (response) {\r\n if (response.success) {\r\n this.view.btnEnable()\r\n this.view.showSuccessAlert()\r\n this.trigger('reload')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.btnEnable()\r\n this.view.showErrorAlert()\r\n this.trigger('reload')\r\n }.bind(this))\r\n}\r\n\r\n_.extend(EditEntryWidget, Backbone.Events)\r\n\r\nmodule.exports = EditEntryWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar CreateEntryWidget = require('journal/create/widget')\r\nvar GeneralLedgerJournalHistoryWidget = require('journal/list/widget')\r\nvar ImportWidget = require('journal/import/widget')\r\nvar _ = require('lodash')\r\n\r\nvar GeneralLedgerJournalView = Backbone.View.extend({\r\n className: 'generalledgerjournals index',\r\n\r\n initialize: function () {\r\n this.history = new GeneralLedgerJournalHistoryWidget()\r\n this.create = new CreateEntryWidget()\r\n \r\n this.importWidget = new ImportWidget()\r\n \r\n this.importWidget.on('refresh', function () {\r\n this.reload()\r\n Backbone.trigger('refreshed-import')\r\n }.bind(this))\r\n \r\n this.create.on('reload', this.reload, this)\r\n this.history.on('reload', this.reload, this)\r\n this.importWidget.on('reload', this.reload, this)\r\n },\r\n\r\n reload: function () {\r\n this.history = new GeneralLedgerJournalHistoryWidget()\r\n this.create = new CreateEntryWidget()\r\n\r\n this.create.on('reload', this.reload, this)\r\n this.history.on('reload', this.reload, this)\r\n\r\n this.render()\r\n },\r\n\r\n render: function () {\r\n // TODO Append create/edit widget\r\n this.$el.empty()\r\n .append(this.importWidget.show())\r\n .append(this.create.show())\r\n .append(this.history.show())\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = GeneralLedgerJournalView\r\n","'use strict'\r\n\r\nvar GeneralLedgerJournalView = require('journal/view')\r\n\r\nvar GeneralLedgerJournalWidget = function () {\r\n this.view = new GeneralLedgerJournalView()\r\n}\r\n\r\nGeneralLedgerJournalWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nmodule.exports = GeneralLedgerJournalWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"contact-item flex\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"contactId\\\" class=\\\"contactId\\\" />\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"index\":(depth0 != null ? depth0.index : depth0),\"inputLabel\":\"Contact Name\",\"inputName\":\"ContactName\",\"inputId\":\"id\",\"wrapperClasses\":\"col-xs-3 no-padding autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"id\":(depth0 != null ? depth0.id : depth0),\"index\":(depth0 != null ? depth0.index : depth0),\"isDisabled\":true,\"inputClasses\":\"contactAddress\",\"inputLabel\":\"Address\",\"inputName\":\"address\",\"wrapperClasses\":\"col-xs-5\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"id\":(depth0 != null ? depth0.id : depth0),\"index\":(depth0 != null ? depth0.index : depth0),\"isDisabled\":true,\"inputClasses\":\"contactCity\",\"inputLabel\":\"City\",\"inputName\":\"city\",\"wrapperClasses\":\"col-xs-3\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"id\":(depth0 != null ? depth0.id : depth0),\"index\":(depth0 != null ? depth0.index : depth0),\"isDisabled\":true,\"inputClasses\":\"contactState\",\"inputLabel\":\"State\",\"inputName\":\"state\",\"wrapperClasses\":\"col-xs-1\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <i class=\\\"fa fa-close remove\\\"></i>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Contact = require('lists/contacts/item/contact')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar Contacts = ListWrapper.extend({\r\n childModel: Contact\r\n})\r\n\r\n\r\nmodule.exports = Contacts\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3>Add New Contact</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <label class=\\\"avatar\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n <input type=\\\"file\\\" accept=\\\"image/*\\\" />\\r\\n </label>\\r\\n <div class=\\\"primary-info\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"maxLength\":\"20\",\"inputLabel\":\"Contact ID\",\"inputName\":\"contactId\",\"inputId\":\"create-contact-id\",\"wrapperClasses\":\"contact-id-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"flex name-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"First Name\",\"inputName\":\"firstName\",\"inputId\":\"create-first-name\",\"wrapperClasses\":\"first-name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Last Name\",\"inputName\":\"lastName\",\"inputId\":\"create-last-name\",\"wrapperClasses\":\"last-name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Suffix\",\"inputName\":\"suffix\",\"inputId\":\"create-suffix\",\"wrapperClasses\":\"suffix\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"form-group notes-container\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"create-notes\\\" name=\\\"notes\\\" rows=\\\"4\\\"></textarea>\\r\\n <label for=\\\"create-notes\\\">Notes</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side address-info\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 1\",\"inputName\":\"addressLine1\",\"inputId\":\"create-address-line1\",\"wrapperClasses\":\"address-line1\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 2\",\"inputName\":\"addressLine2\",\"inputId\":\"create-address-line2\",\"wrapperClasses\":\"address-line2\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"city-state\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"City\",\"inputName\":\"city\",\"inputId\":\"create-city\",\"wrapperClasses\":\"city\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group state\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"create-state\\\" name=\\\"state\\\" size=\\\"1\\\" style=\\\"height: 35px;\\\">\\r\\n <option></option>\\r\\n <option value=\\\"AL\\\">AL</option>\\r\\n <option value=\\\"AK\\\">AK</option>\\r\\n <option value=\\\"AZ\\\">AZ</option>\\r\\n <option value=\\\"AR\\\">AR</option>\\r\\n <option value=\\\"CA\\\">CA</option>\\r\\n <option value=\\\"CO\\\">CO</option>\\r\\n <option value=\\\"CT\\\">CT</option>\\r\\n <option value=\\\"DE\\\">DE</option>\\r\\n <option value=\\\"FL\\\">FL</option>\\r\\n <option value=\\\"GA\\\">GA</option>\\r\\n <option value=\\\"HI\\\">HI</option>\\r\\n <option value=\\\"ID\\\">ID</option>\\r\\n <option value=\\\"IL\\\">IL</option>\\r\\n <option value=\\\"IN\\\">IN</option>\\r\\n <option value=\\\"IA\\\">IA</option>\\r\\n <option value=\\\"KS\\\">KS</option>\\r\\n <option value=\\\"KY\\\">KY</option>\\r\\n <option value=\\\"LA\\\">LA</option>\\r\\n <option value=\\\"ME\\\">ME</option>\\r\\n <option value=\\\"MD\\\">MD</option>\\r\\n <option value=\\\"MA\\\">MA</option>\\r\\n <option value=\\\"MI\\\">MI</option>\\r\\n <option value=\\\"MN\\\">MN</option>\\r\\n <option value=\\\"MS\\\">MS</option>\\r\\n <option value=\\\"MO\\\">MO</option>\\r\\n <option value=\\\"MT\\\">MT</option>\\r\\n <option value=\\\"NE\\\">NE</option>\\r\\n <option value=\\\"NV\\\">NV</option>\\r\\n <option value=\\\"NH\\\">NH</option>\\r\\n <option value=\\\"NJ\\\">NJ</option>\\r\\n <option value=\\\"NM\\\">NM</option>\\r\\n <option value=\\\"NY\\\">NY</option>\\r\\n <option value=\\\"NC\\\">NC</option>\\r\\n <option value=\\\"ND\\\">ND</option>\\r\\n <option value=\\\"OH\\\">OH</option>\\r\\n <option value=\\\"OK\\\">OK</option>\\r\\n <option value=\\\"OR\\\">OR</option>\\r\\n <option value=\\\"PA\\\">PA</option>\\r\\n <option value=\\\"RI\\\">RI</option>\\r\\n <option value=\\\"SC\\\">SC</option>\\r\\n <option value=\\\"SD\\\">SD</option>\\r\\n <option value=\\\"TN\\\">TN</option>\\r\\n <option value=\\\"TX\\\">TX</option>\\r\\n <option value=\\\"UT\\\">UT</option>\\r\\n <option value=\\\"VT\\\">VT</option>\\r\\n <option value=\\\"VA\\\">VA</option>\\r\\n <option value=\\\"WA\\\">WA</option>\\r\\n <option value=\\\"WV\\\">WV</option>\\r\\n <option value=\\\"WI\\\">WI</option>\\r\\n <option value=\\\"WY\\\">WY</option>\\r\\n <option value=\\\"OTHER\\\">OTHER</option>\\r\\n </select>\\r\\n <label for=\\\"create-state\\\">State</label>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Zip Code\",\"inputName\":\"postalCode\",\"inputId\":\"create-zipcode\",\"wrapperClasses\":\"zipcode\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"distribution\\\">\\r\\n <h3>Contact Methods</h3>\\r\\n <div class=\\\"line-item-container\\\">\\r\\n <div class=\\\"create-contact-method\\\">\\r\\n <div class=\\\"form-group method-type\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"create-methodType\\\" name=\\\"methodType\\\" size=\\\"1\\\">\\r\\n <option value=\\\"6\\\">Other</option>\\r\\n <option value=\\\"5\\\">Email Address</option>\\r\\n <option value=\\\"2\\\">Mobile Phone</option>\\r\\n <option value=\\\"1\\\">Work Phone</option>\\r\\n <option value=\\\"3\\\">Home Phone</option>\\r\\n <option value=\\\"4\\\">Fax</option>\\r\\n </select>\\r\\n <label for=\\\"create-methodType\\\">Type</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group autocomplete method-data\\\">\\r\\n <div class=\\\"form-material floating \\\">\\r\\n <input class=\\\"form-control ui-autocomplete-input\\\" type=\\\"text\\\" id=\\\"create-contactPoint\\\" name=\\\"Description\\\" value=\\\"\\\" autocomplete=\\\"off\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"create-contactPoint\\\">Contact Info</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\"></span>\\r\\n </div>\\r\\n <i class=\\\"fa fa-close remove\\\"></i>\\r\\n </div>\\r\\n </div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Contact Method</button>\\r\\n <br>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Save Contact</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Contacts must have a first name.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('lists/contacts/create/template')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\n\r\nvar valid = $('<div class=\"bg-primary-lighter\" style=\"display: block;\"><i class=\"fa fa-check-circle fa-2x fa-inverse\"></i><span class=\"message\">Contact is valid.</span></div>')\r\nvar invalid = $('<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">Contact may not be empty.</span></div>')\r\n\r\nvar ContactsView = CreateView.extend({\r\n className: 'block create',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'change input[type=file]': 'selectFile',\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'click': 'expand',\r\n 'click .add-more-line-items': 'addContactMethod'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) this.Template = Template\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n this.on('resetInputs', function () {\r\n this.cachedAvatar = null\r\n }, this)\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n this.baseContactMethod = this.$('.create-contact-method').remove()[0].outerHTML\r\n this.addContactMethod()\r\n this.determineStatus()\r\n },\r\n\r\n addContactMethod: function () {\r\n var $contactMethod = $(this.baseContactMethod)\r\n this.$('.line-item-container').append($contactMethod)\r\n this.trigger('heightChanged')\r\n\r\n $contactMethod.find('input').on('focusout', this.checkLineStatus.bind(this)).on('focusin', this.checkLineStatus.bind(this))\r\n\r\n $contactMethod.find('.remove').on('click', function () {\r\n $contactMethod.remove()\r\n this.trigger('heightChanged')\r\n }.bind(this))\r\n\r\n return $contactMethod\r\n },\r\n\r\n isValid: function () {\r\n return !!this.$('input[type=text]:not([name=contactId]), textarea').filter(function () { return this.value.length > 0 }).length\r\n },\r\n\r\n determineStatus: function () {\r\n if (this.isValid()) {\r\n this.$('.status').html(valid)\r\n } else {\r\n this.$('.status').html(invalid)\r\n }\r\n },\r\n\r\n // This is a method used by the base class when a form is submitted on this view\r\n toJSON: function () {\r\n var profilePicture = this.cachedAvatar\r\n var model = {\r\n profilePictureUpload: profilePicture\r\n }\r\n\r\n var hasValidInput = false\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n if (!isCheckbox && $el.attr('name') !== 'contactId') {\r\n hasValidInput = hasValidInput || !!elValue\r\n }\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n if (!hasValidInput) throw new Error('The contact may not be empty')\r\n\r\n model['communicationMethods'] = _.filter(_.map(this.$('.create-contact-method'), function (distributionLine) {\r\n var $distributionLine = this.$(distributionLine)\r\n var methodType = Number($distributionLine.find('select').val())\r\n var contactPoint = $distributionLine.find('input').val()\r\n return {\r\n methodType: methodType,\r\n data: contactPoint\r\n }\r\n }), function (item) {\r\n return item.methodType && item.data\r\n })\r\n \r\n model.isActive = true\r\n return model\r\n },\r\n\r\n // Take the file and update the avatar display to display the image\r\n selectFile: function (e) {\r\n var avatar = _.first(e.target.files)\r\n\r\n if (!avatar) return console.warn('No image selected, leaving unchanged')\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (avatarFile) {\r\n this.$('.avatar').attr('style', 'background:url(\"' + avatarFile.target.result + '\") no-repeat center center;').attr('data-has-image', 'true')\r\n this.cachedAvatar = avatarFile.target.result\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(avatar)\r\n },\r\n\r\n checkLineStatus: function (e) {\r\n var hasValue = _.reduce(\r\n this.$('.line-item-container input').map(function (index, el) { return $(el).val() }),\r\n function (memo, value) {\r\n return memo || (!!value && value !== '$')\r\n },\r\n false\r\n )\r\n\r\n if (hasValue || e.type === 'focusin') {\r\n this.$('.line-item-container').addClass('forceLabelsOpen')\r\n } else {\r\n this.$('.line-item-container').removeClass('forceLabelsOpen')\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = ContactsView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow flex error-row\\\">\\r\\n <div class=\\\"line-number\\\">\"\n + alias4(((helper = (helper = helpers.lineNumber || (depth0 != null ? depth0.lineNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lineNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"reason\\\">\"\n + alias4(((helper = (helper = helpers.reason || (depth0 != null ? depth0.reason : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reason\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block errors\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Contacts Import Errors</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"line-number\\\">Line #</div>\\r\\n <div class=\\\"reason\\\">Error</div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.errors : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15 push-15-r\\\" name=\\\"completeReview\\\">Complete Review</button>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"import-button\\\">\\r\\n <button class=\\\"btn btn-primary pull-right push-30\\\" name=\\\"openImport\\\">Import</button>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block no-padding tabbed collapsed\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"own-template\\\" id=\\\"ownTemplate\\\">\\r\\n <div class=\\\"pull-right\\\"><i class=\\\"fa fa-close expanding-group-close cancel\\\"></i></div>\\r\\n <div class=\\\"steps\\\">\\r\\n <div class=\\\"step1\\\">\\r\\n <h3>Step 1: Download the outline</h3>\\r\\n <p><a href=\\\"http://get.crunched.help/hc/en-us/articles/235947168-How-to-import-contacts\\\" target=\\\"_blank\\\">Click here</a> to download an import template. You can update this spreadsheet with your own data.</p>\\r\\n </div>\\r\\n <div class=\\\"step2\\\">\\r\\n <h3>Step 2: Upload your data</h3>\\r\\n <p>Once you've updated the outline and saved it, please upload it here to import your data.</p>\\r\\n <label>\\r\\n <span class=\\\"file-name\\\"></span>\\r\\n <span class=\\\"floating\\\">Upload File</span>\\r\\n <input type=\\\"file\\\" name=\\\"outlineUpload\\\">\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15-r push-15 importUpload\\\" name=\\\"upload\\\">Upload</button>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"import-message\\\">\\r\\n <span class=\\\"import-templates\\\">Add using templates</span>\\r\\n <span class=\\\"manually\\\">Add manually</span>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar CreateView = require('lists/list/create/view')\r\nvar Template = require('lists/contacts/import/template')\r\nvar ErrorTemplate = require('lists/contacts/import/error-template')\r\nvar HasContactsTemplate = require('lists/contacts/import/has-contacts')\r\nvar sweetAlert = require('sweetalert2')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar ScrollTo = require('jquery-scrollto')\r\n\r\nvar ListView = CreateView.extend({\r\n className: 'import',\r\n events: {\r\n 'change input[type=file]': 'changeFile',\r\n 'click button[name=upload]': 'uploadOwn',\r\n 'click button[name=completeReview]': 'completeReview',\r\n 'click button[name=openImport]': 'openImport',\r\n 'click .cancel': 'close'\r\n },\r\n initialize: function () {\r\n this.Template = Template\r\n this.listenTo(this.model, 'change:contacts', this.render)\r\n this.on('uploadErrors', this.uploadErrors, this)\r\n this.on('uploadSuccess', this.uploadSuccess, this)\r\n this.on('importFailed', this.importFailed, this)\r\n },\r\n render: function () {\r\n var TemplateToRender = (this.model.get('contacts').length && !this.forceOpen) ? HasContactsTemplate : Template\r\n this.$el.html(TemplateToRender(this.model.toViewModel()))\r\n\r\n if (this.onRender) {\r\n this.onRender()\r\n }\r\n\r\n return this\r\n },\r\n changeFile: function (e) {\r\n var contactSpreadsheet = _.first(e.target.files)\r\n\r\n if (!contactSpreadsheet) {\r\n return console.warn('No image selected, leaving unchanged')\r\n }\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (contactSpreadsheetFile) {\r\n if (this.checkFileExtension(contactSpreadsheet)) {\r\n this.cachedContactSpreadsheet = contactSpreadsheetFile.target.result\r\n this.$('.file-name').text(contactSpreadsheet.name)\r\n this.fileNameLabelStyling()\r\n }\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(contactSpreadsheet)\r\n\r\n this.isValidFileExtension = this.checkFileExtension(contactSpreadsheet)\r\n },\r\n // For Edge browser, to prevent an overraping text issue of text:file-name and a label.\r\n fileNameLabelStyling: function () {\r\n this.$('.floating').css({\r\n 'top': '-29px',\r\n 'font-weight': 600,\r\n 'font-size': '13px'\r\n })\r\n },\r\n checkFileExtension: function (selectedFile) {\r\n var validExts = new Array('.xlsx')\r\n var fileExt = selectedFile.name\r\n fileExt = fileExt.substring(fileExt.lastIndexOf('.')).toLowerCase()\r\n if (validExts.indexOf(fileExt) < 0) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'You can only upload Excel(*.xlsx) file.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n\r\n this.$('.file-name').text('')\r\n this.$('.floating').css({\r\n 'top': '-5px',\r\n 'font-weight': 400,\r\n 'font-size': '15px'\r\n })\r\n this.isValidFileExtension = false\r\n return false\r\n } else {\r\n this.isValidFileExtension = true\r\n return true\r\n }\r\n },\r\n uploadOwn: function () {\r\n if (!!this.validateFileType()) {\r\n this.upload(this.cachedContactSpreadsheet)\r\n // To prevent importing a previously uploaded or selected file while no file is selected for the second time\r\n this.cachedContactSpreadsheet = ''\r\n this.isValidFileExtension = false\r\n }\r\n },\r\n validateFileType: function () {\r\n if (this.isValidFileExtension) {\r\n var fileType = this.cachedContactSpreadsheet\r\n var xlsxMimeType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\r\n fileType = fileType.substring(fileType.lastIndexOf(':') + 1, fileType.lastIndexOf(';'))\r\n\r\n // if a selected file extension is correct by checking its name,\r\n // but if there is no reader or an application installed for the file type in the local machine,\r\n // OS will not recognize the file type. Hence, if the selected file type is valid, but the mime type is empty, we set the type manually.\r\n if (fileType === '' && this.isValidFileExtension || fileType !== xlsxMimeType && this.isValidFileExtension) {\r\n var index = this.cachedContactSpreadsheet.lastIndexOf(':') + 1\r\n if (fileType !== '') {\r\n // When there is no reader for the file, FireFox passes: \"application/octet-stream\"\r\n this.cachedContactSpreadsheet = this.cachedContactSpreadsheet.replace(fileType, '')\r\n }\r\n this.cachedContactSpreadsheet = this.insert(this.cachedContactSpreadsheet, index, xlsxMimeType)\r\n }\r\n\r\n var insertedMimeType = this.cachedContactSpreadsheet\r\n insertedMimeType = insertedMimeType.substring(insertedMimeType.lastIndexOf(':') + 1, insertedMimeType.lastIndexOf(';'))\r\n\r\n return (fileType === xlsxMimeType) || (fileType === '' && this.isValidFileExtension && insertedMimeType === xlsxMimeType) || (fileType !== xlsxMimeType && this.isValidFileExtension && insertedMimeType === xlsxMimeType)\r\n }\r\n },\r\n insert: function (str, index, value) {\r\n return str.substr(0, index) + value + str.substr(index)\r\n },\r\n upload: function (spreadsheet) {\r\n this.$('.importUpload').prop('disabled', true)\r\n this.trigger('upload', {import: spreadsheet})\r\n },\r\n btnEnable: function () {\r\n $('.importUpload').prop('disabled', false)\r\n },\r\n completeReview: function () {\r\n this.$('.errors').remove()\r\n\r\n $('.block[hidden-during-review], .import-message[hidden-during-review], .import-button[hidden-during-review]')\r\n .removeClass('hidden')\r\n .attr('hidden-during-review', null)\r\n\r\n $('.page-heading').ScrollTo()\r\n },\r\n uploadErrors: function (errors, successCount) {\r\n this.close()\r\n\r\n $('.block, .import-message, .import-button')\r\n .addClass('hidden')\r\n .attr('hidden-during-review', '1')\r\n\r\n this.$el.append(ErrorTemplate({errors: errors}))\r\n var totalCount = errors.length + successCount\r\n\r\n if (!successCount) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: successCount + ' of ' + totalCount + ' contacts have been imported, some information couldn\\'t be parsed.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n } else {\r\n sweetAlert({\r\n title: 'Warning',\r\n text: successCount + ' of ' + totalCount + ' contacts have been imported, some information couldn\\'t be parsed.',\r\n type: 'warning',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n }\r\n },\r\n uploadSuccess: function (successCount) {\r\n this.close()\r\n\r\n sweetAlert({\r\n title: 'Success',\r\n text: successCount + ' of ' + successCount + ' contacts have been imported. Please set up your contact assignments to get the most out of Crunched.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n importFailed: function (errorMessage) {\r\n this.close()\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Failed to import the contacts. ' + errorMessage,\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n openImport: function () {\r\n this.forceOpen = true\r\n this.$el.addClass('forced-open')\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.close.bind(this))\r\n this.render()\r\n },\r\n close: function () {\r\n this.forceOpen = false\r\n this.$el.removeClass('forced-open')\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n this.render()\r\n }\r\n})\r\n\r\nmodule.exports = ListView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar ContactsService = require('lists/contacts/service')\r\nvar ContactImportView = require('lists/contacts/import/view')\r\n\r\nvar ContactImportWidget = function () {\r\n this.contactsService = new ContactsService()\r\n this.model = new Backbone.Model({\r\n contacts: []\r\n })\r\n\r\n this.model.toViewModel = this.model.toJSON.bind(this.model)\r\n\r\n this.view = new ContactImportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('upload', this.upload.bind(this))\r\n\r\n this.loadContacts()\r\n}\r\n\r\nContactImportWidget.prototype = _.clone(Backbone.Events)\r\n\r\nContactImportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nContactImportWidget.prototype.loadContacts = function () {\r\n return this.contactsService.getList().then(function (results) {\r\n this.model.set('contacts', results)\r\n }.bind(this))\r\n}\r\n\r\nContactImportWidget.prototype.upload = function (spreadsheet) {\r\n return this.contactsService.importSpreadsheet(spreadsheet).then(function (results) {\r\n return this.loadContacts().then(function () {\r\n var errors = results.parseErrors\r\n var successCount = results.successCount\r\n\r\n this.once('refreshed', function () {\r\n if (errors.length) {\r\n this.view.trigger('uploadErrors', errors, successCount)\r\n } else {\r\n this.view.trigger('uploadSuccess', successCount)\r\n }\r\n }.bind(this))\r\n\r\n this.trigger('refresh')\r\n }.bind(this))\r\n }.bind(this), function (error){\r\n this.view.btnEnable()\r\n this.view.trigger('importFailed', error.message)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = ContactImportWidget\r\n","'use strict'\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\nvar _ = require('lodash')\r\n\r\nvar contactMethods = {\r\n 1: \"Work Phone\",\r\n 2: \"Mobile Phone\",\r\n 3: \"Home Phone\",\r\n 4: \"Fax\",\r\n 5: \"Email Address\",\r\n 6: \"Other\"\r\n}\r\n\r\nvar Contact = ListEntry.extend({\r\n defaults: {\r\n communicationMethods: []\r\n },\r\n\r\n toJSON: function () {\r\n return {\r\n contactId: this.get('contactId'),\r\n firstName: this.get('firstName'),\r\n lastName: this.get('lastName'),\r\n suffix: this.get('suffix'),\r\n addressLine1: this.get('addressLine1'),\r\n addressLine2: this.get('addressLine2'),\r\n city: this.get('city'),\r\n state: this.get('state'),\r\n postalCode: this.get('postalCode'),\r\n profilePicture: this.get('profilePicture'),\r\n notes: this.get('notes'),\r\n isActive: !!this.get('isActive'),\r\n communicationMethods: this.get('communicationMethods')\r\n }\r\n }\r\n}, {\r\n parse: function (json) {\r\n return new Contact({\r\n contactId: json.contactId,\r\n canDelete: json.canDelete,\r\n firstName: json.firstName,\r\n lastName: json.lastName,\r\n suffix: json.suffix,\r\n addressLine1: json.addressLine1,\r\n addressLine2: json.addressLine2,\r\n city: json.city,\r\n state: json.state,\r\n postalCode: json.postalCode,\r\n profilePicture: json.profilePicture,\r\n notes: json.notes,\r\n isActive: !!json.isActive,\r\n communicationMethods: _.map(json.communicationMethods, function (method) {\r\n method.methodTypeText = contactMethods[method.methodType]\r\n return method\r\n }),\r\n id: json.id,\r\n telephone: (_.first(\r\n _.filter(\r\n json.communicationMethods,\r\n function (method) {\r\n return [1, 2, 3, 4].indexOf(method.methodType) !== -1\r\n }\r\n )\r\n ) || {data: ''}).data,\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = Contact\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"remove\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-unlock-alt pull-right disable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-lock pull-right enable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"contactId\\\">\"\n + alias4(((helper = (helper = helpers.contactId || (depth0 != null ? depth0.contactId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"contactId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"first-name\\\">\"\n + alias4(((helper = (helper = helpers.firstName || (depth0 != null ? depth0.firstName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"firstName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"last-name\\\">\"\n + alias4(((helper = (helper = helpers.lastName || (depth0 != null ? depth0.lastName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lastName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"address\\\">\"\n + alias4(((helper = (helper = helpers.addressLine1 || (depth0 != null ? depth0.addressLine1 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine1\",\"hash\":{},\"data\":data}) : helper)))\n + \" \"\n + alias4(((helper = (helper = helpers.city || (depth0 != null ? depth0.city : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"city\",\"hash\":{},\"data\":data}) : helper)))\n + \", \"\n + alias4(((helper = (helper = helpers.state || (depth0 != null ? depth0.state : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"state\",\"hash\":{},\"data\":data}) : helper)))\n + \" \"\n + alias4(((helper = (helper = helpers.postalCode || (depth0 != null ? depth0.postalCode : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"postalCode\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"telephone\\\">\"\n + alias4(((helper = (helper = helpers.telephone || (depth0 != null ? depth0.telephone : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"telephone\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n <a class=\\\"fa fa-trash-o pull-right \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.canDelete : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isActive : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(5, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('lists/contacts/item/template')\r\n\r\nvar ContactsView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n if (!this.model.get('isActive')) this.$el.addClass('notActive')\r\n }\r\n})\r\n\r\nmodule.exports = ContactsView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"contactId-sort\"] || (depth0 != null ? depth0[\"contactId-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"contactId-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"firstName-sort\"] || (depth0 != null ? depth0[\"firstName-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"firstName-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"lastName-sort\"] || (depth0 != null ? depth0[\"lastName-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"lastName-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Contacts</h3>\\r\\n <i class=\\\"fa fa-close pull-right clear-search-box\\\"></i>\\r\\n <input type=\\\"text\\\" class=\\\"pull-right search-box\\\" placeholder=\\\"Search...\\\" value=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.search || (depth0 != null ? depth0.search : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"search\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" />\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"contactId\\\">ID <i data-sort-field=\\\"contactId\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"contactId-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"first-name\\\">First Name <i data-sort-field=\\\"firstName\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"firstName-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"last-name\\\">Last Name <i data-sort-field=\\\"lastName\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"lastName-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"address\\\">Customer Address</div>\\r\\n <div class=\\\"telephone\\\">Telephone</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\"><p class=\\\"center\\\">Loading more contacts...</p></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('lists/contacts/list/template')\r\nvar ContactView = require('lists/contacts/item/view')\r\nvar DetailsView = require('lists/contacts/read/view')\r\nvar UpdateView = require('lists/contacts/update/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\n// TODO: Sorting\r\nvar ContactsView = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort',\r\n 'keyup .search-box': 'searchList',\r\n 'click .clear-search-box': 'clearSearch'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = ContactView\r\n this.model.set('search', '')\r\n this.model.set('sort', 'asc')\r\n this.model.set('sortField', 'contactId')\r\n this.model.set('contactId-sort', 'asc')\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.on('showDetails', this.showDetails.bind(this))\r\n this.on('showEdit', this.showEdit.bind(this))\r\n this.on('enable', this.showEnable.bind(this))\r\n this.on('disable', this.showDisable.bind(this))\r\n this.on('delete', this.showDelete.bind(this))\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more contacts...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more contacts.')\r\n },\r\n\r\n showDetails: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n var details = new DetailsView({model: model})\r\n\r\n // View to show beneath $lineItem, and if the 'active' class should be added to $lineItem's classes\r\n this.showChildView(details, $lineItem, true)\r\n },\r\n\r\n showEdit: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n var update = new UpdateView({model: model})\r\n update.on('update', function () {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('update')\r\n this.trigger.apply(this, args)\r\n }, this)\r\n\r\n this.showChildView(update, $lineItem, false)\r\n },\r\n\r\n showEnable: function (contactId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + contactId + '\"]'), 'Are you sure you want to enable this contact?', 'confirmEnable', contactId)\r\n },\r\n\r\n showDisable: function (contactId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + contactId + '\"]'), 'Are you sure you want to disable this contact?', 'confirmDisable', contactId)\r\n },\r\n\r\n showDelete: function (contactId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + contactId + '\"]'), 'Are you sure you want to delete this contact?', 'confirmDelete', contactId)\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.unset('contactId-sort')\r\n this.model.unset('firstName-sort')\r\n this.model.unset('lastName-sort')\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n },\r\n\r\n searchList: function (e) {\r\n if (e.which === 13) {\r\n var $currentTarget = $(e.currentTarget)\r\n\r\n this.model.set({\r\n page: 1,\r\n search: $currentTarget.val()\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n }\r\n },\r\n\r\n clearSearch: function (e) {\r\n var $sibiling = $(e.currentTarget).parent().children('.search-box')\r\n\r\n if ($sibiling.val() === '') {\r\n return\r\n }\r\n\r\n $sibiling.val('')\r\n\r\n if (this.model.get('search') === '') {\r\n return\r\n }\r\n\r\n this.model.set({\r\n page: 1,\r\n search: ''\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n }\r\n})\r\n\r\nmodule.exports = ContactsView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"data-has-image\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div class=\\\"col-xs-12 distribution distribution-block\\\">\\r\\n <h3>Contact Methods</h3>\\r\\n <div class=\\\"line-item-container col-xs-12 no-padding\\\">\\r\\n <div>\\r\\n <div class=\\\"col-xs-2\\\"><b>Type</b></div>\\r\\n <div class=\\\"col-xs-10\\\"><b>Contact Info</b></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.communicationMethods : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"distribution col-xs-12 no-padding\\\">\\r\\n <div class=\\\"col-xs-2\\\">\"\n + alias4(((helper = (helper = helpers.methodTypeText || (depth0 != null ? depth0.methodTypeText : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"methodTypeText\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-10\\\">\"\n + alias4(((helper = (helper = helpers.data || (depth0 != null ? depth0.data : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"data\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <div class=\\\"avatar\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.profilePicture : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" data-no-op style=\\\"background:url('\"\n + ((stack1 = ((helper = (helper = helpers.profilePicture || (depth0 != null ? depth0.profilePicture : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"profilePicture\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"') no-repeat center center;\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"primary-info\\\">\\r\\n <div class=\\\"form-group contact-id-container\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Contact ID</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.contactId || (depth0 != null ? depth0.contactId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"contactId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"flex name-container\\\">\\r\\n <div class=\\\"form-group first-name\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>First Name</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.firstName || (depth0 != null ? depth0.firstName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"firstName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group last-name\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Last Name</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.lastName || (depth0 != null ? depth0.lastName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lastName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Suffix</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.suffix || (depth0 != null ? depth0.suffix : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"suffix\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group notes-container\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Notes</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"notes\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side address-info\\\">\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Address Line 1</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.addressLine1 || (depth0 != null ? depth0.addressLine1 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine1\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Address Line 2</b> \\r\\n <p>\"\n + alias4(((helper = (helper = helpers.addressLine2 || (depth0 != null ? depth0.addressLine2 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine2\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"city-state\\\">\\r\\n <div class=\\\"form-group city\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>City</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.city || (depth0 != null ? depth0.city : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"city\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group state\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>State</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.state || (depth0 != null ? depth0.state : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"state\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group zipcode\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b class=\\\"control-label\\\">Zip Code</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.postalCode || (depth0 != null ? depth0.postalCode : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"postalCode\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\"></span>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.communicationMethods : depth0)) != null ? stack1.length : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </form>\\r\\n </div>\\r\\n </div>\\r\\n</div> \";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var Backbone = require('backbone')\r\nvar Template = require('lists/contacts/read/template')\r\n\r\n// TODO: Replace contact method drop down with static text instead of read only drop down\r\nvar ReadView = Backbone.View.extend({\r\n className: 'block read has-animation fadeInDown expanded',\r\n\r\n attributes: function () {\r\n return {\r\n 'data-id': this.model.id\r\n }\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.model.toViewModel()))\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = ReadView\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar ContactsService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nContactsService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nContactsService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'contacts'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nContactsService.prototype.getList = function () {\r\n var apiPath = this.GetPath('list')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nContactsService.prototype.setStatus = function (contactId, status) {\r\n var apiPath = this.GetPath(contactId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nContactsService.prototype.importSpreadsheet = function (spreadsheet) {\r\n var apiPath = this.GetPath('import')\r\n return this.restClient.post(apiPath, spreadsheet)\r\n}\r\n\r\nmodule.exports = ContactsService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"data-has-image\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right cancel\\\"></i>\\r\\n <h3>Update Contact</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <label class=\\\"avatar\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.profilePicture : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" style=\\\"background:url('\"\n + ((stack1 = ((helper = (helper = helpers.profilePicture || (depth0 != null ? depth0.profilePicture : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"profilePicture\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"') no-repeat center center;\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n <input type=\\\"file\\\" accept=\\\"image/*\\\" />\\r\\n </label>\\r\\n <div class=\\\"primary-info\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"maxLength\":\"20\",\"inputLabel\":\"Contact ID\",\"inputName\":\"contactId\",\"inputId\":\"update-contact-id\",\"wrapperClasses\":\"contact-id-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"flex name-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"First Name\",\"inputName\":\"firstName\",\"inputId\":\"update-first-name\",\"wrapperClasses\":\"first-name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Last Name\",\"inputName\":\"lastName\",\"inputId\":\"update-last-name\",\"wrapperClasses\":\"last-name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Suffix\",\"inputName\":\"suffix\",\"inputId\":\"update-suffix\",\"wrapperClasses\":\"suffix\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"form-group notes-container\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"update-notes\\\" name=\\\"notes\\\" rows=\\\"4\\\"></textarea>\\r\\n <label for=\\\"update-notes\\\">Notes</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side address-info\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 1\",\"inputName\":\"addressLine1\",\"inputId\":\"update-address-line1\",\"wrapperClasses\":\"address-line1\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 2\",\"inputName\":\"addressLine2\",\"inputId\":\"update-address-line2\",\"wrapperClasses\":\"address-line2\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"city-state\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"City\",\"inputName\":\"city\",\"inputId\":\"update-city\",\"wrapperClasses\":\"city\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group state\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"update-state\\\" name=\\\"state\\\" size=\\\"1\\\">\\r\\n <option></option>\\r\\n <option value=\\\"AL\\\">AL</option>\\r\\n <option value=\\\"AK\\\">AK</option>\\r\\n <option value=\\\"AZ\\\">AZ</option>\\r\\n <option value=\\\"AR\\\">AR</option>\\r\\n <option value=\\\"CA\\\">CA</option>\\r\\n <option value=\\\"CO\\\">CO</option>\\r\\n <option value=\\\"CT\\\">CT</option>\\r\\n <option value=\\\"DE\\\">DE</option>\\r\\n <option value=\\\"FL\\\">FL</option>\\r\\n <option value=\\\"GA\\\">GA</option>\\r\\n <option value=\\\"HI\\\">HI</option>\\r\\n <option value=\\\"ID\\\">ID</option>\\r\\n <option value=\\\"IL\\\">IL</option>\\r\\n <option value=\\\"IN\\\">IN</option>\\r\\n <option value=\\\"IA\\\">IA</option>\\r\\n <option value=\\\"KS\\\">KS</option>\\r\\n <option value=\\\"KY\\\">KY</option>\\r\\n <option value=\\\"LA\\\">LA</option>\\r\\n <option value=\\\"ME\\\">ME</option>\\r\\n <option value=\\\"MD\\\">MD</option>\\r\\n <option value=\\\"MA\\\">MA</option>\\r\\n <option value=\\\"MI\\\">MI</option>\\r\\n <option value=\\\"MN\\\">MN</option>\\r\\n <option value=\\\"MS\\\">MS</option>\\r\\n <option value=\\\"MO\\\">MO</option>\\r\\n <option value=\\\"MT\\\">MT</option>\\r\\n <option value=\\\"NE\\\">NE</option>\\r\\n <option value=\\\"NV\\\">NV</option>\\r\\n <option value=\\\"NH\\\">NH</option>\\r\\n <option value=\\\"NJ\\\">NJ</option>\\r\\n <option value=\\\"NM\\\">NM</option>\\r\\n <option value=\\\"NY\\\">NY</option>\\r\\n <option value=\\\"NC\\\">NC</option>\\r\\n <option value=\\\"ND\\\">ND</option>\\r\\n <option value=\\\"OH\\\">OH</option>\\r\\n <option value=\\\"OK\\\">OK</option>\\r\\n <option value=\\\"OR\\\">OR</option>\\r\\n <option value=\\\"PA\\\">PA</option>\\r\\n <option value=\\\"RI\\\">RI</option>\\r\\n <option value=\\\"SC\\\">SC</option>\\r\\n <option value=\\\"SD\\\">SD</option>\\r\\n <option value=\\\"TN\\\">TN</option>\\r\\n <option value=\\\"TX\\\">TX</option>\\r\\n <option value=\\\"UT\\\">UT</option>\\r\\n <option value=\\\"VT\\\">VT</option>\\r\\n <option value=\\\"VA\\\">VA</option>\\r\\n <option value=\\\"WA\\\">WA</option>\\r\\n <option value=\\\"WV\\\">WV</option>\\r\\n <option value=\\\"WI\\\">WI</option>\\r\\n <option value=\\\"WY\\\">WY</option>\\r\\n <option value=\\\"OTHER\\\">OTHER</option>\\r\\n </select>\\r\\n <label for=\\\"update-state\\\">State</label>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Zip Code\",\"inputName\":\"postalCode\",\"inputId\":\"update-zipcode\",\"wrapperClasses\":\"zipcode\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"distribution\\\">\\r\\n <h3>Contact Methods</h3>\\r\\n <div class=\\\"line-item-container\\\">\\r\\n <div class=\\\"create-contact-method\\\">\\r\\n <div class=\\\"form-group method-type\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"update-methodType\\\" name=\\\"methodType\\\" size=\\\"1\\\">\\r\\n <option value=\\\"6\\\">Other</option>\\r\\n <option value=\\\"5\\\">Email Address</option>\\r\\n <option value=\\\"2\\\">Mobile Phone</option>\\r\\n <option value=\\\"1\\\">Work Phone</option>\\r\\n <option value=\\\"3\\\">Home Phone</option>\\r\\n <option value=\\\"4\\\">Fax</option>\\r\\n </select>\\r\\n <label for=\\\"update-methodType\\\">Type</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group autocomplete method-data\\\">\\r\\n <div class=\\\"form-material floating \\\">\\r\\n <input class=\\\"form-control ui-autocomplete-input\\\" type=\\\"text\\\" id=\\\"update-contactPoint\\\" name=\\\"Description\\\" value=\\\"\\\" autocomplete=\\\"off\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"update-contactPoint\\\">Contact Info</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\"></span>\\r\\n </div>\\r\\n <i class=\\\"fa fa-close remove\\\"></i>\\r\\n </div>\\r\\n </div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Contact Method</button>\\r\\n <br>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Update Contact</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Contacts must have a first name.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/contacts/create/view')\r\nvar Template = require('lists/contacts/update/template')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\n\r\nvar UpdateView = CreateView.extend({\r\n className: 'block update expanded has-animation fadeInDown',\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n // Fill in inputs with our data\r\n var model = this.model.toViewModel()\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else {\r\n $el.val(model[$el.attr('name')])\r\n }\r\n })\r\n\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n\r\n // Remove empty contact line from the create side\r\n this.$('.create-contact-method').remove()\r\n\r\n // Add contact lines with our data\r\n _.forEach(model['communicationMethods'], function (contactMethod) {\r\n var $distributionLine = this.addContactMethod()\r\n $distributionLine.find('select').val(contactMethod.methodType)\r\n $distributionLine.find('input').val(contactMethod.data)\r\n }.bind(this))\r\n }\r\n})\r\n\r\nmodule.exports = UpdateView\r\n","var ListContainer = require('lists/list/view')\r\nvar ListView = require('lists/contacts/list/view')\r\nvar CreateView = require('lists/contacts/create/view')\r\nvar ImportWidget = require('lists/contacts/import/widget')\r\n\r\nvar ContactsView = ListContainer.extend({\r\n className: 'contacts list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n this.listView = new ListView({model: this.model})\r\n this.forwardEvents(this.listView)\r\n\r\n this.createView = new CreateView({model: this.model})\r\n this.forwardEvents(this.createView)\r\n\r\n this.importWidget = new ImportWidget()\r\n \r\n this.importWidget.on('refresh', function () {\r\n this.trigger('refresh', this.importWidget.trigger.bind(this.importWidget, 'refreshed'))\r\n }.bind(this))\r\n \r\n this.on('created', function () {\r\n this.createView.trigger('resetInputs')\r\n }.bind(this))\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n console.log('container -> editDetails')\r\n this.listView.trigger('showEdit', model)\r\n }.bind(this))\r\n\r\n this.on('widgetShown', function () {\r\n this.listView.trigger('bindScroll')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n \r\n this.$el.append(this.importWidget.show())\r\n this.$el.append(this.createView.render().$el)\r\n this.$el.append(this.listView.render().$el)\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = ContactsView\r\n","'use strict'\r\n\r\nvar _ = require('underscore')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar Contacts = require('lists/contacts/contacts')\r\nvar Service = require('lists/contacts/service')\r\nvar ListContainer = require('lists/contacts/view')\r\n\r\nvar ContactsWidget = function () {\r\n this.service = new Service()\r\n this.modelType = Contacts\r\n this.viewType = ListContainer\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n\r\n this.view.on('refresh', this.refresh, this)\r\n this.view.on('refresh', this.reset, this)\r\n \r\n this.on('shown', function () {\r\n this.view.trigger('widgetShown')\r\n }.bind(this))\r\n}\r\n\r\nContactsWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nContactsWidget.prototype.refresh = function (callback) {\r\n var result = this.service.getList().then(function (results) {\r\n this.model.set('contacts', results)\r\n }.bind(this))\r\n \r\n if (callback) {\r\n return result.then(callback)\r\n } else {\r\n return result\r\n }\r\n}\r\n\r\nmodule.exports = ContactsWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"form-group onlineMethodText\\\">\\r\\n <div>Accept online payments today, <span class=\\\"greenText\\\"><a href=\\\"http://crunched.io/payment-processing\\\" target=\\\"_blank\\\">Learn More</a></span></div>\\r\\n </div>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"form-group is-active\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Credit Card</span>\\r\\n <input type=\\\"checkbox\\\" name=\\\"allowCreditCards\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3>Add New Customer</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <label class=\\\"avatar\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n <input type=\\\"file\\\" accept=\\\"image/*\\\" />\\r\\n </label>\\r\\n <div class=\\\"primary-info\\\">\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"maxLength\":\"20\",\"inputLabel\":\"Customer ID\",\"inputName\":\"customerId\",\"inputId\":\"create-customer-id\",\"wrapperClasses\":\"customer-id-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Customer Name\",\"inputName\":\"name\",\"inputId\":\"create-name\",\"wrapperClasses\":\"name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"form-group printed-name\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control \\\" type=\\\"text\\\" id=\\\"create-printed-name\\\" name=\\\"printedName\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"create-printed-name\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" data-original-title=\\\"The printed name is displayed on checks and invoices\\\"><img src=\\\"/img/question-circle.svg\\\" class=\\\"printed-name-tooltip\\\" alt=\\\"?\\\" /> Printed Name</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\"></span>\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Email\",\"inputName\":\"email\",\"inputId\":\"create-email-name\",\"wrapperClasses\":\"email\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 1\",\"inputName\":\"addressLine1\",\"inputId\":\"create-address-line1\",\"wrapperClasses\":\"address-line1-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 2\",\"inputName\":\"addressLine2\",\"inputId\":\"create-address-line2\",\"wrapperClasses\":\"address-line2-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"city-state\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"City\",\"inputName\":\"city\",\"inputId\":\"create-city\",\"wrapperClasses\":\"city\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group state\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"create-state\\\" name=\\\"state\\\" size=\\\"1\\\" style=\\\"height: 35px;\\\">\\r\\n <option></option>\\r\\n <option value=\\\"AL\\\">AL</option>\\r\\n <option value=\\\"AK\\\">AK</option>\\r\\n <option value=\\\"AZ\\\">AZ</option>\\r\\n <option value=\\\"AR\\\">AR</option>\\r\\n <option value=\\\"CA\\\">CA</option>\\r\\n <option value=\\\"CO\\\">CO</option>\\r\\n <option value=\\\"CT\\\">CT</option>\\r\\n <option value=\\\"DE\\\">DE</option>\\r\\n <option value=\\\"FL\\\">FL</option>\\r\\n <option value=\\\"GA\\\">GA</option>\\r\\n <option value=\\\"HI\\\">HI</option>\\r\\n <option value=\\\"ID\\\">ID</option>\\r\\n <option value=\\\"IL\\\">IL</option>\\r\\n <option value=\\\"IN\\\">IN</option>\\r\\n <option value=\\\"IA\\\">IA</option>\\r\\n <option value=\\\"KS\\\">KS</option>\\r\\n <option value=\\\"KY\\\">KY</option>\\r\\n <option value=\\\"LA\\\">LA</option>\\r\\n <option value=\\\"ME\\\">ME</option>\\r\\n <option value=\\\"MD\\\">MD</option>\\r\\n <option value=\\\"MA\\\">MA</option>\\r\\n <option value=\\\"MI\\\">MI</option>\\r\\n <option value=\\\"MN\\\">MN</option>\\r\\n <option value=\\\"MS\\\">MS</option>\\r\\n <option value=\\\"MO\\\">MO</option>\\r\\n <option value=\\\"MT\\\">MT</option>\\r\\n <option value=\\\"NE\\\">NE</option>\\r\\n <option value=\\\"NV\\\">NV</option>\\r\\n <option value=\\\"NH\\\">NH</option>\\r\\n <option value=\\\"NJ\\\">NJ</option>\\r\\n <option value=\\\"NM\\\">NM</option>\\r\\n <option value=\\\"NY\\\">NY</option>\\r\\n <option value=\\\"NC\\\">NC</option>\\r\\n <option value=\\\"ND\\\">ND</option>\\r\\n <option value=\\\"OH\\\">OH</option>\\r\\n <option value=\\\"OK\\\">OK</option>\\r\\n <option value=\\\"OR\\\">OR</option>\\r\\n <option value=\\\"PA\\\">PA</option>\\r\\n <option value=\\\"RI\\\">RI</option>\\r\\n <option value=\\\"SC\\\">SC</option>\\r\\n <option value=\\\"SD\\\">SD</option>\\r\\n <option value=\\\"TN\\\">TN</option>\\r\\n <option value=\\\"TX\\\">TX</option>\\r\\n <option value=\\\"UT\\\">UT</option>\\r\\n <option value=\\\"VT\\\">VT</option>\\r\\n <option value=\\\"VA\\\">VA</option>\\r\\n <option value=\\\"WA\\\">WA</option>\\r\\n <option value=\\\"WV\\\">WV</option>\\r\\n <option value=\\\"WI\\\">WI</option>\\r\\n <option value=\\\"WY\\\">WY</option>\\r\\n <option value=\\\"OTHER\\\">OTHER</option>\\r\\n </select>\\r\\n <label for=\\\"create-state\\\">State</label>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Zip Code\",\"inputName\":\"postalCode\",\"inputId\":\"create-zipcode\",\"wrapperClasses\":\"zipcode\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Telephone\",\"inputName\":\"telephoneOne\",\"inputId\":\"create-telephone-one\",\"wrapperClasses\":\"telephone-one-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Telephone 2\",\"inputName\":\"telephoneTwo\",\"inputId\":\"create-telephone-two\",\"wrapperClasses\":\"telephone-two-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container tax-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"wrapperClasses\":\"tax-rate-id-container\",\"inputLabel\":\"Tax Rate ID\",\"inputName\":\"rateId\",\"inputId\":\"tax-rate-id\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"wrapperClasses\":\"tax-rate-percentile-container\",\"inputLabel\":\"Tax Rate %\",\"inputName\":\"taxRate\",\"inputId\":\"tax-rate-percentile\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"taxRateId\\\" />\\r\\n </div>\\r\\n <div class=\\\"department\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Department\",\"inputName\":\"department\",\"inputId\":\"create-department\",\"wrapperClasses\":\"department\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"departmentId\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"departmentName\\\" />\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side notes-info\\\">\\r\\n <div class=\\\"form-group onlineMethodHeader\\\">\\r\\n <div>Online Payment Methods</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.paymentsEnabled : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group notes-container\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"create-notes\\\" name=\\\"notes\\\" rows=\\\"14\\\"></textarea>\\r\\n <label for=\\\"create-notes\\\">Notes</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"distribution contact-list\\\">\\r\\n <h3>Contacts</h3>\\r\\n <div class=\\\"line-item-container\\\">The customer currently has no contacts.</div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Contact</button>\\r\\n <br>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Save Customer</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Customers must have a first name.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('lists/customers/create/template')\r\nvar ContactLine = require('lists/contacts/common/line-item')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\n\r\nvar valid = $('<div class=\"bg-primary-lighter\" style=\"display: block;\"><i class=\"fa fa-check-circle fa-2x fa-inverse\"></i><span class=\"message\">Customer is valid.</span></div>')\r\nvar invalid = $('<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">Customer must have a printed name.</span></div>')\r\n\r\nvar CustomersView = CreateView.extend({\r\n className: 'block create',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'change input[type=file]': 'selectFile',\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'click': 'expand',\r\n 'click .add-more-line-items': 'addContact',\r\n 'change input[name=name]': 'updatedPrintedName'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) {\r\n this.Template = Template\r\n }\r\n\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n this.on('resetInputs', function () {\r\n this.cachedAvatar = null\r\n }, this)\r\n\r\n this.listenTo(this.model, 'change:taxList', this.render.bind(this))\r\n this.listenTo(this.model, 'change:departmentList', this.render.bind(this))\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n this.determineStatus()\r\n \r\n this.autoComplete(\r\n this.model.get('taxList'),\r\n 'rateId',\r\n this.$('input[name=rateId]'),\r\n this.salesTaxSelected.bind(this)\r\n )\r\n\r\n this.autoComplete(\r\n this.model.get('departmentList'),\r\n 'name',\r\n this.$('input[name=department]'),\r\n this.departmentSelected.bind(this),\r\n 'CREATENEW'\r\n )\r\n \r\n var companyInfo = JSON.parse(localStorage.getItem('crunchedActiveCompanyInfo'))\r\n if (companyInfo.paymentsEnabled) {\r\n this.model.set('paymentsEnabled', companyInfo.paymentsEnabled)\r\n }\r\n },\r\n\r\n updatedPrintedName: function () {\r\n if (this.$('input[name=printedName]').val().length < 1) {\r\n this.$('input[name=printedName]')\r\n .val(this.$('input[name=name]').val())\r\n .parent()\r\n .addClass('open')\r\n this.determineStatus()\r\n }\r\n },\r\n\r\n addContact: function () {\r\n var index = this.$('.line-item-container > div').length + 1\r\n\r\n if (index === 1) {\r\n this.$('.line-item-container').html('')\r\n }\r\n\r\n var $lineItem = $(ContactLine({ index: index }))\r\n this.$('.line-item-container').append($lineItem)\r\n this.OneUI($lineItem)\r\n\r\n if (index > 0) {\r\n $lineItem.find('.remove').on('click', function (e) {\r\n var parent = $lineItem.parent()\r\n\r\n $lineItem.remove()\r\n\r\n if (this.$('.line-item-container > div').length === 0) {\r\n parent.html('The customer currently has no contacts.')\r\n }\r\n }.bind(this))\r\n }\r\n\r\n this.autoComplete(\r\n this.model.get('contactList'),\r\n 'fullName',\r\n $lineItem.find('input[name=ContactName]'),\r\n function (selectedContact) {\r\n $lineItem.find('input[name=ContactName]')\r\n .val(selectedContact['fullName'])\r\n .parent()\r\n .addClass('open')\r\n\r\n $lineItem.find('.contactId').val(selectedContact['id'])\r\n $lineItem.find('.contactAddress').val(selectedContact['addressLine1']).parent().addClass('open')\r\n $lineItem.find('.contactCity').val(selectedContact['city']).parent().addClass('open')\r\n $lineItem.find('.contactState').val(selectedContact['state']).parent().addClass('open')\r\n }\r\n )\r\n\r\n $lineItem.find('input:first').focus()\r\n this.trigger('lineItemAdded', $lineItem)\r\n return $lineItem\r\n },\r\n\r\n isValid: function () {\r\n return !!this.$('input[name=printedName]').val().length\r\n },\r\n\r\n determineStatus: function () {\r\n if (this.isValid()) {\r\n this.$('.status').html(valid)\r\n } else {\r\n this.$('.status').html(invalid)\r\n }\r\n },\r\n\r\n // This is a method used by the base class when a form is submitted on this view\r\n toJSON: function () {\r\n var profilePicture = this.cachedAvatar\r\n var model = {\r\n profilePictureUpload: profilePicture\r\n }\r\n\r\n if (!this.$('input[name=printedName]').val().length) {\r\n throw new Error('The customer must have a printed name')\r\n }\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n model.contacts = _.filter(_.map(this.$('.contact-item'), function (contactLine) {\r\n var $contactLine = this.$(contactLine)\r\n var id = $contactLine.find('input[name=contactId]').val()\r\n return {\r\n id: id\r\n }\r\n }), function (item) {\r\n return item.id\r\n })\r\n\r\n model.salesTax = model.taxRateId ? {\r\n salesTaxId: model.taxRateId\r\n } : null\r\n\r\n model.department = (model.departmentId && model.departmentId !== 'CREATENEW') ? {\r\n id: model.departmentId,\r\n name: model.departmentName\r\n } : { name: model.departmentName }\r\n \r\n model.isActive = true\r\n return model\r\n },\r\n\r\n // Take the file and update the avatar display to display the image\r\n selectFile: function (e) {\r\n var avatar = _.first(e.target.files)\r\n\r\n if (!avatar) return console.warn('No image selected, leaving unchanged')\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (avatarFile) {\r\n this.$('.avatar').attr('style', 'background:url(\"' + avatarFile.target.result + '\") no-repeat center center;').attr('data-has-image', 'true')\r\n this.cachedAvatar = avatarFile.target.result\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(avatar)\r\n },\r\n \r\n salesTaxSelected: function (salesTax) {\r\n this.$('input[name=rateId]')\r\n .val(salesTax.rateId)\r\n .parent()\r\n .addClass('open')\r\n\r\n this.$('input[name=taxRate]').val(salesTax.taxRate).parent().addClass('open')\r\n this.$('input[name=taxRateId]').val(salesTax.id)\r\n },\r\n \r\n departmentSelected: function (department) {\r\n this.$('input[name=department]')\r\n .val(department.name)\r\n .parent()\r\n .addClass('open')\r\n \r\n this.$('input[name=department]').val(department.name).parent().addClass('open')\r\n this.$('input[name=departmentId]').val(department.id)\r\n this.$('input[name=departmentName]').val(department.name)\r\n }\r\n})\r\n\r\nmodule.exports = CustomersView\r\n","'use strict'\r\n\r\nvar Customer = require('lists/customers/item/customer')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar Customers = ListWrapper.extend({\r\n childModel: Customer\r\n})\r\n\r\n\r\nmodule.exports = Customers\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow flex error-row\\\">\\r\\n <div class=\\\"line-number\\\">\"\n + alias4(((helper = (helper = helpers.lineNumber || (depth0 != null ? depth0.lineNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lineNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"reason\\\">\"\n + alias4(((helper = (helper = helpers.reason || (depth0 != null ? depth0.reason : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reason\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block errors\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Customers Import Errors</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"line-number\\\">Line #</div>\\r\\n <div class=\\\"reason\\\">Error</div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.errors : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15 push-15-r\\\" name=\\\"completeReview\\\">Complete Review</button>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"import-button\\\">\\r\\n <button class=\\\"btn btn-primary pull-right push-30\\\" name=\\\"openImport\\\">Import</button>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block no-padding tabbed collapsed\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"own-template\\\" id=\\\"ownTemplate\\\">\\r\\n <div class=\\\"pull-right\\\"><i class=\\\"fa fa-close expanding-group-close cancel\\\"></i></div>\\r\\n <div class=\\\"steps\\\">\\r\\n <div class=\\\"step1\\\">\\r\\n <h3>Step 1: Download the outline</h3>\\r\\n <p><a href=\\\"http://get.crunched.help/hc/en-us/articles/236008767-How-to-import-customers\\\" target=\\\"_blank\\\">Click here</a> to download an import template. You can update this spreadsheet with your own data.</p>\\r\\n </div>\\r\\n <div class=\\\"step2\\\">\\r\\n <h3>Step 2: Upload your data</h3>\\r\\n <p>Once you've updated the outline and saved it, please upload it here to import your data.</p>\\r\\n <label>\\r\\n <span class=\\\"file-name\\\"></span>\\r\\n <span class=\\\"floating\\\">Upload File</span>\\r\\n <input type=\\\"file\\\" name=\\\"outlineUpload\\\">\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15-r push-15 importUpload\\\" name=\\\"upload\\\">Upload</button>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"import-message\\\">\\r\\n <span class=\\\"import-templates\\\">Add using templates</span>\\r\\n <span class=\\\"manually\\\">Add manually</span>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar CreateView = require('lists/list/create/view')\r\nvar Template = require('lists/customers/import/template')\r\nvar ErrorTemplate = require('lists/customers/import/error-template')\r\nvar HasCustomersTemplate = require('lists/customers/import/has-customers')\r\nvar sweetAlert = require('sweetalert2')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar ScrollTo = require('jquery-scrollto')\r\n\r\nvar ListView = CreateView.extend({\r\n className: 'import',\r\n events: {\r\n 'change input[type=file]': 'changeFile',\r\n 'click button[name=upload]': 'uploadOwn',\r\n 'click button[name=completeReview]': 'completeReview',\r\n 'click button[name=openImport]': 'openImport',\r\n 'click .cancel': 'close'\r\n },\r\n initialize: function () {\r\n this.Template = Template\r\n this.listenTo(this.model, 'change:customers', this.render)\r\n this.on('uploadErrors', this.uploadErrors, this)\r\n this.on('uploadSuccess', this.uploadSuccess, this)\r\n this.on('importFailed', this.importFailed, this)\r\n },\r\n render: function () {\r\n var TemplateToRender = (this.model.get('customers').length && !this.forceOpen) ? HasCustomersTemplate : Template\r\n this.$el.html(TemplateToRender(this.model.toViewModel()))\r\n\r\n if (this.onRender) {\r\n this.onRender()\r\n }\r\n\r\n return this\r\n },\r\n changeFile: function (e) {\r\n var customerSpreadsheet = _.first(e.target.files)\r\n\r\n if (!customerSpreadsheet) {\r\n return console.warn('No image selected, leaving unchanged')\r\n }\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (customerSpreadsheetFile) {\r\n if (this.checkFileExtension(customerSpreadsheet)) {\r\n this.cachedCustomerSpreadsheet = customerSpreadsheetFile.target.result\r\n this.$('.file-name').text(customerSpreadsheet.name)\r\n this.fileNameLabelStyling()\r\n }\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(customerSpreadsheet)\r\n this.isValidFileExtension = this.checkFileExtension(customerSpreadsheet)\r\n },\r\n // For Edge browser, to prevent an overraping text issue of text:file-name and a label.\r\n fileNameLabelStyling: function () {\r\n this.$('.floating').css({\r\n 'top': '-29px',\r\n 'font-weight': 600,\r\n 'font-size': '13px'\r\n })\r\n },\r\n checkFileExtension: function (selectedFile) {\r\n var validExts = new Array('.xlsx')\r\n var fileExt = selectedFile.name\r\n fileExt = fileExt.substring(fileExt.lastIndexOf('.')).toLowerCase()\r\n if (validExts.indexOf(fileExt) < 0) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'You can only upload Excel(*.xlsx) file.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n\r\n this.$('.file-name').text('')\r\n this.$('.floating').css({\r\n 'top': '-5px',\r\n 'font-weight': 400,\r\n 'font-size': '15px'\r\n })\r\n this.isValidFileExtension = false\r\n return false\r\n } else {\r\n this.isValidFileExtension = true\r\n return true\r\n }\r\n },\r\n uploadOwn: function () {\r\n if (!!this.validateFileType()) {\r\n this.upload(this.cachedCustomerSpreadsheet)\r\n // To prevent importing a previously uploaded or selected file while no file is selected for the second time\r\n this.cachedCustomerSpreadsheet = ''\r\n this.isValidFileExtension = false\r\n }\r\n },\r\n validateFileType: function () {\r\n if (this.isValidFileExtension) {\r\n var fileType = this.cachedCustomerSpreadsheet\r\n var xlsxMimeType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\r\n fileType = fileType.substring(fileType.lastIndexOf(':') + 1, fileType.lastIndexOf(';'))\r\n\r\n // if a selected file extension is correct by checking its name,\r\n // but if there is no reader or an application installed for the file type in the local machine,\r\n // OS will not recognize the file type. Hence, if the selected file type is valid, but the mime type is empty, we set the type manually.\r\n if (fileType === '' && this.isValidFileExtension || fileType !== xlsxMimeType && this.isValidFileExtension) {\r\n var index = this.cachedCustomerSpreadsheet.lastIndexOf(':') + 1\r\n if (fileType !== '') {\r\n // When there is no reader for the file, FireFox passes: \"application/octet-stream\"\r\n this.cachedCustomerSpreadsheet = this.cachedCustomerSpreadsheet.replace(fileType, '')\r\n }\r\n this.cachedCustomerSpreadsheet = this.insert(this.cachedCustomerSpreadsheet, index, xlsxMimeType)\r\n }\r\n\r\n var insertedMimeType = this.cachedCustomerSpreadsheet\r\n insertedMimeType = insertedMimeType.substring(insertedMimeType.lastIndexOf(':') + 1, insertedMimeType.lastIndexOf(';'))\r\n\r\n return (fileType === xlsxMimeType) || (fileType === '' && this.isValidFileExtension && insertedMimeType === xlsxMimeType) || (fileType !== xlsxMimeType && this.isValidFileExtension && insertedMimeType === xlsxMimeType)\r\n }\r\n },\r\n insert: function (str, index, value) {\r\n return str.substr(0, index) + value + str.substr(index)\r\n },\r\n upload: function (spreadsheet) {\r\n this.$('.importUpload').prop('disabled', true)\r\n this.trigger('upload', {import: spreadsheet})\r\n },\r\n btnEnable: function () {\r\n $('.importUpload').prop('disabled', false)\r\n },\r\n completeReview: function () {\r\n this.$('.errors').remove()\r\n\r\n $('.block[hidden-during-review], .import-message[hidden-during-review], .import-button[hidden-during-review]')\r\n .removeClass('hidden')\r\n .attr('hidden-during-review', null)\r\n\r\n $('.page-heading').ScrollTo()\r\n },\r\n uploadErrors: function (errors, successCount) {\r\n this.close()\r\n\r\n $('.block, .import-message, .import-button')\r\n .addClass('hidden')\r\n .attr('hidden-during-review', '1')\r\n\r\n this.$el.append(ErrorTemplate({errors: errors}))\r\n var totalCount = errors.length + successCount\r\n\r\n if (!successCount) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: successCount + ' of ' + totalCount + ' customers have been imported, some information couldn\\'t be parsed.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n } else {\r\n sweetAlert({\r\n title: 'Warning',\r\n text: successCount + ' of ' + totalCount + ' customers have been imported, some information couldn\\'t be parsed.',\r\n type: 'warning',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n }\r\n },\r\n uploadSuccess: function (successCount) {\r\n this.close()\r\n\r\n sweetAlert({\r\n title: 'Success',\r\n text: successCount + ' of ' + successCount + ' customers have been imported. Please set up your customer assignments to get the most out of Crunched.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n importFailed: function (errorMessage) {\r\n this.close()\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Failed to import the customers. ' + errorMessage,\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n openImport: function () {\r\n this.forceOpen = true\r\n this.$el.addClass('forced-open')\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.close.bind(this))\r\n this.render()\r\n },\r\n close: function () {\r\n this.forceOpen = false\r\n this.$el.removeClass('forced-open')\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n this.render()\r\n }\r\n})\r\n\r\nmodule.exports = ListView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar CustomerService = require('lists/customers/service')\r\nvar CustomerImportView = require('lists/customers/import/view')\r\n\r\nvar CustomerImportWidget = function () {\r\n this.customersService = new CustomerService()\r\n this.model = new Backbone.Model({\r\n customers: []\r\n })\r\n\r\n this.model.toViewModel = this.model.toJSON.bind(this.model)\r\n\r\n this.view = new CustomerImportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('upload', this.upload.bind(this))\r\n\r\n this.loadCustomers()\r\n}\r\n\r\nCustomerImportWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCustomerImportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nCustomerImportWidget.prototype.loadCustomers = function () {\r\n return this.customersService.getList().then(function (results) {\r\n this.model.set('customers', results)\r\n }.bind(this))\r\n}\r\n\r\nCustomerImportWidget.prototype.upload = function (spreadsheet) {\r\n return this.customersService.importSpreadsheet(spreadsheet).then(function (results) {\r\n return this.loadCustomers().then(function () {\r\n var errors = results.parseErrors\r\n var successCount = results.successCount\r\n\r\n this.once('refreshed', function () {\r\n if (errors.length) {\r\n this.view.trigger('uploadErrors', errors, successCount)\r\n } else {\r\n this.view.trigger('uploadSuccess', successCount)\r\n }\r\n }.bind(this))\r\n\r\n this.trigger('refresh')\r\n }.bind(this))\r\n }.bind(this), function (error){\r\n this.view.btnEnable() \r\n this.view.trigger('importFailed', error.message)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = CustomerImportWidget\r\n","'use strict'\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\nvar _ = require('lodash')\r\n\r\nvar Customer = ListEntry.extend({\r\n defaults: {\r\n contacts: []\r\n }\r\n}, {\r\n parse: function (json) {\r\n var companyInfo = JSON.parse(localStorage.getItem('crunchedActiveCompanyInfo'))\r\n return new Customer({\r\n customerId: json.customerId,\r\n name: json.name,\r\n printedName: json.printedName,\r\n addressLine1: json.addressLine1,\r\n addressLine2: json.addressLine2,\r\n city: json.city,\r\n state: json.state,\r\n postalCode: json.postalCode,\r\n profilePicture: json.profilePicture,\r\n notes: json.notes,\r\n telephoneOne: json.telephoneOne,\r\n telephoneTwo: json.telephoneTwo,\r\n email: json.email,\r\n isActive: !!json.isActive,\r\n contacts: _.map(json.contacts, function (contact) {\r\n return contact\r\n }),\r\n salesTax: json.salesTax,\r\n id: json.id,\r\n allowCreditCards: json.allowCreditCards,\r\n paymentsEnabled: companyInfo.paymentsEnabled,\r\n department: json.department\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = Customer\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-unlock-alt pull-right disable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-lock pull-right enable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"customerId\\\">\"\n + alias4(((helper = (helper = helpers.customerId || (depth0 != null ? depth0.customerId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"customerId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"name\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"printed-name\\\">\"\n + alias4(((helper = (helper = helpers.printedName || (depth0 != null ? depth0.printedName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"printedName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"email\\\">\"\n + alias4(((helper = (helper = helpers.email || (depth0 != null ? depth0.email : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"email\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"telephoneOne\\\">\"\n + alias4(((helper = (helper = helpers.telephoneOne || (depth0 != null ? depth0.telephoneOne : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"telephoneOne\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n <a class=\\\"fa fa-trash-o pull-right remove\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isActive : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('lists/customers/item/template')\r\n\r\nvar CustomersView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n if (!this.model.get('isActive')) {\r\n this.$el.addClass('notActive')\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = CustomersView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"customerId-sort\"] || (depth0 != null ? depth0[\"customerId-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"customerId-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"name-sort\"] || (depth0 != null ? depth0[\"name-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"name-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"printedName-sort\"] || (depth0 != null ? depth0[\"printedName-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"printedName-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Customers</h3>\\r\\n <i class=\\\"fa fa-close pull-right clear-search-box\\\"></i>\\r\\n <input type=\\\"text\\\" class=\\\"pull-right search-box\\\" placeholder=\\\"Search...\\\" value=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.search || (depth0 != null ? depth0.search : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"search\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" />\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"customerId\\\">ID <i data-sort-field=\\\"customerId\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"customerId-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"name\\\">Customer Name <i data-sort-field=\\\"name\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"name-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"printed-name\\\">Printed Name <i data-sort-field=\\\"printedName\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"printedName-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"email\\\">Email</div>\\r\\n <div class=\\\"telephoneOne\\\">Telephone</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\"><p class=\\\"center\\\">Loading more customers...</p></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('lists/customers/list/template')\r\nvar CustomerView = require('lists/customers/item/view')\r\nvar DetailsView = require('lists/customers/read/view')\r\nvar UpdateView = require('lists/customers/update/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\n// TODO: Sorting\r\nvar CustomersView = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort',\r\n 'keyup .search-box': 'searchList',\r\n 'click .clear-search-box': 'clearSearch'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = CustomerView\r\n this.model.set('search', '')\r\n this.model.set('sort', 'asc')\r\n this.model.set('sortField', 'customerId')\r\n this.model.set('customerId-sort', 'asc')\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.on('showDetails', this.showDetails.bind(this))\r\n this.on('showEdit', this.showEdit.bind(this))\r\n this.on('enable', this.showEnable.bind(this))\r\n this.on('disable', this.showDisable.bind(this))\r\n this.on('delete', this.showDelete.bind(this))\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more customers...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more customers.')\r\n },\r\n\r\n showDetails: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n\r\n if (model.get('salesTax')) {\r\n var salesTax = model.get('salesTax')\r\n if (salesTax.salesTaxId) {\r\n salesTax.salesTax = _.find(this.model.get('taxList'), {id: salesTax.salesTaxId})\r\n }\r\n }\r\n\r\n var details = new DetailsView({model: model})\r\n\r\n // View to show beneath $lineItem, and if the 'active' class should be added to $lineItem's classes\r\n this.showChildView(details, $lineItem, true)\r\n },\r\n\r\n showEdit: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n model.set('contactList', this.model.get('contactList'))\r\n model.set('taxList', this.model.get('taxList'))\r\n model.set('departmentList', this.model.get('departmentList'))\r\n var update = new UpdateView({model: model})\r\n update.on('update', function () {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('update')\r\n this.trigger.apply(this, args)\r\n }, this)\r\n\r\n this.showChildView(update, $lineItem, false)\r\n },\r\n\r\n showEnable: function (customerId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + customerId + '\"]'), 'Are you sure you want to enable this customer?', 'confirmEnable', customerId)\r\n },\r\n\r\n showDisable: function (customerId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + customerId + '\"]'), 'Are you sure you want to disable this customer?', 'confirmDisable', customerId)\r\n },\r\n\r\n showDelete: function (customerId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + customerId + '\"]'), 'Are you sure you want to delete this customer?', 'confirmDelete', customerId)\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.unset('customerId-sort')\r\n this.model.unset('name-sort')\r\n this.model.unset('printedName-sort')\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n },\r\n\r\n searchList: function (e) {\r\n if (e.which === 13) {\r\n var $currentTarget = $(e.currentTarget)\r\n\r\n this.model.set({\r\n page: 1,\r\n search: $currentTarget.val()\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n }\r\n },\r\n\r\n clearSearch: function (e) {\r\n var $sibiling = $(e.currentTarget).parent().children('.search-box')\r\n\r\n if ($sibiling.val() === '') {\r\n return\r\n }\r\n\r\n $sibiling.val('')\r\n\r\n if (this.model.get('search') === '') {\r\n return\r\n }\r\n\r\n this.model.set({\r\n page: 1,\r\n search: ''\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n }\r\n})\r\n\r\nmodule.exports = CustomersView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"data-has-image\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return container.escapeExpression(container.lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.salesTax : depth0)) != null ? stack1.salesTax : stack1)) != null ? stack1.rateId : stack1), depth0));\n},\"5\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return container.escapeExpression(container.lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.salesTax : depth0)) != null ? stack1.salesTax : stack1)) != null ? stack1.taxRate : stack1), depth0));\n},\"7\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <p>\"\n + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.department : depth0)) != null ? stack1.name : stack1), depth0))\n + \"</p>\\r\\n\";\n},\"9\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"form-group onlineMethodText\\\">\\r\\n <div>Accept online payments today, <span class=\\\"greenText\\\"><a href=\\\"http://crunched.io/payment-processing\\\" target=\\\"_blank\\\">Learn More</a></span></div>\\r\\n </div>\\r\\n\";\n},\"11\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div class=\\\"form-group is-active\\\">\\r\\n <span>Credit Card</span>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.allowCreditCards : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(12, data, 0),\"inverse\":container.program(14, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\";\n},\"12\":function(container,depth0,helpers,partials,data) {\n return \" <i class=\\\"fa fa-check\\\"></i>\\r\\n\";\n},\"14\":function(container,depth0,helpers,partials,data) {\n return \" <i class=\\\"fa fa-times\\\"></i>\\r\\n\";\n},\"16\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div class=\\\"col-xs-12 distribution\\\">\\r\\n <h3>Contacts</h3>\\r\\n <div class=\\\"line-item-container view-container col-xs-12 no-padding\\\">\\r\\n <div class=\\\"distribution col-xs-12 no-padding contact-item contact-item-header flex\\\">\\r\\n <div class=\\\"contactId\\\"><b>Contact ID</b></div>\\r\\n <div class=\\\"name\\\"><b>Name</b></div>\\r\\n <div class=\\\"address\\\"><b>Address</b></div>\\r\\n <div class=\\\"city\\\"><b>City</b></div>\\r\\n <div class=\\\"state\\\"><b>State</b></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.contacts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(17, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n\";\n},\"17\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"distribution col-xs-12 form-group no-padding contact-item listItem flex\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"contactId\\\">\"\n + alias4(((helper = (helper = helpers.contactId || (depth0 != null ? depth0.contactId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"contactId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"name\\\">\"\n + alias4(((helper = (helper = helpers.firstName || (depth0 != null ? depth0.firstName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"firstName\",\"hash\":{},\"data\":data}) : helper)))\n + \" \"\n + alias4(((helper = (helper = helpers.lastName || (depth0 != null ? depth0.lastName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lastName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"address\\\">\"\n + alias4(((helper = (helper = helpers.addressLine1 || (depth0 != null ? depth0.addressLine1 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine1\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"city\\\">\"\n + alias4(((helper = (helper = helpers.city || (depth0 != null ? depth0.city : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"city\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"state\\\">\"\n + alias4(((helper = (helper = helpers.state || (depth0 != null ? depth0.state : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"state\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div> \\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <div class=\\\"avatar\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.profilePicture : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" data-no-op style=\\\"background:url('\"\n + ((stack1 = ((helper = (helper = helpers.profilePicture || (depth0 != null ? depth0.profilePicture : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"profilePicture\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"') no-repeat center center;\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"primary-info\\\">\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"form-group customer-id-container\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Customer ID</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.customerId || (depth0 != null ? depth0.customerId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"customerId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group name\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Customer Name</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"name-container\\\">\\r\\n <div class=\\\"form-group printed-name\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Printed Name</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.printedName || (depth0 != null ? depth0.printedName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"printedName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group email\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Email</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.email || (depth0 != null ? depth0.email : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"email\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Address Line 1</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.addressLine1 || (depth0 != null ? depth0.addressLine1 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine1\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Address Line 2</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.addressLine2 || (depth0 != null ? depth0.addressLine2 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine2\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"city-state\\\">\\r\\n <div class=\\\"form-group city\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>City</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.city || (depth0 != null ? depth0.city : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"city\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group state no-padding\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>State</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.state || (depth0 != null ? depth0.state : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"state\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group zipcode\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b class=\\\"control-label\\\">Zip Code</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.postalCode || (depth0 != null ? depth0.postalCode : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"postalCode\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\"></span>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"form-group telephone-one\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Telephone One</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.telephoneOne || (depth0 != null ? depth0.telephoneOne : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"telephoneOne\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group telephone-two\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Telephone Two</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.telephoneTwo || (depth0 != null ? depth0.telephoneTwo : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"telephoneTwo\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"form-group telephone-one\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Tax Rate ID</b>\\r\\n <p>\"\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.salesTax : depth0)) != null ? stack1.salesTax : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group telephone-two\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Tax Rate %</b>\\r\\n <p>\"\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.salesTax : depth0)) != null ? stack1.salesTax : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"form-group department-container\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Department</b>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.department : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side notes-info\\\">\\r\\n <div class=\\\"form-group onlineMethodHeader\\\">\\r\\n <div>Online Payment Methods</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.paymentsEnabled : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(9, data, 0),\"inverse\":container.program(11, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group notes-container\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Notes</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"notes\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.contacts : depth0)) != null ? stack1.length : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(16, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </form>\\r\\n </div>\\r\\n </div>\\r\\n</div> \\r\\n<div id=\\\"modalHolder\\\">\\r\\n <div class=\\\"modal list contacts\\\" id=\\\"readContactModal\\\" tabindex=\\\"-1\\\" role=\\\"dialog\\\" aria-hidden=\\\"true\\\" style=\\\"display: none;\\\">\\r\\n <div class=\\\"modal-dialog modal-lg\\\">\\r\\n <div class=\\\"modal-content block read has-animation fadeInDown expanded\\\">\\r\\n <div class=\\\"block block-themed block-transparent remove-margin-b\\\">\\r\\n <div class=\\\"block-header bg-primary\\\">\\r\\n <ul class=\\\"block-options\\\">\\r\\n <li>\\r\\n <button data-dismiss=\\\"modal\\\" type=\\\"button\\\"><i class=\\\"fa fa-times pull-right close\\\"></i></button>\\r\\n </li>\\r\\n </ul>\\r\\n <h3>View Contact</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\" id=\\\"readContactContainer\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"modal-footer\\\">\\r\\n <button class=\\\"btn btn-sm btn-primary\\\" type=\\\"button\\\" data-dismiss=\\\"modal\\\">Close</button>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var _ = require('underscore')\r\nvar Backbone = require('backbone')\r\nvar Template = require('lists/customers/read/template')\r\nvar Contact = require('lists/contacts/item/contact')\r\nvar ReadContactView = require('lists/contacts/read/view')\r\nvar $ = require('jquery')\r\n\r\n// TODO: Replace customer method drop down with static text instead of read only drop down\r\nvar ReadView = Backbone.View.extend({\r\n className: 'block read has-animation fadeInDown expanded',\r\n\r\n attributes: function () {\r\n return {\r\n 'data-id': this.model.id\r\n }\r\n },\r\n\r\n events: {\r\n 'click .contact-item': 'openContactItem'\r\n },\r\n\r\n openContactItem: function (e) {\r\n // If this has an active class on it (reserved for when actively viewing an item) don't do anything as it's already open.\r\n if (this.$el.hasClass('active')) return\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n\r\n var models = _.where(this.model.get('contacts'), {'id': $(e.currentTarget).attr('data-id')})\r\n\r\n if (models == null || models.length < 1) {\r\n return\r\n }\r\n\r\n this.showContactDetails(new Contact(models[0]))\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.model.toViewModel()))\r\n\r\n return this\r\n },\r\n\r\n showContactDetails: function (model) {\r\n var contactView = new ReadContactView({model: model})\r\n contactView.$el[0].className = 'block read'\r\n\r\n var $contactView = contactView.render().$el\r\n\r\n var $contactModal = this.$('#readContactContainer')\r\n $contactModal.append($contactView)\r\n\r\n this.$('#readContactModal').on('hide.bs.modal', function () {\r\n $('body #readContactModal').detach().appendTo('#modalHolder')\r\n this.$('#readContactContainer').html('')\r\n }.bind(this))\r\n\r\n this.$('#readContactModal').detach().appendTo('body').modal('show')\r\n }\r\n})\r\n\r\nmodule.exports = ReadView\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar CustomersService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nCustomersService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nCustomersService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'customers'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nCustomersService.prototype.getList = function () {\r\n var apiPath = this.GetPath('list')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nCustomersService.prototype.setStatus = function (customerId, status) {\r\n var apiPath = this.GetPath(customerId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nCustomersService.prototype.importSpreadsheet = function (spreadsheet) {\r\n var apiPath = this.GetPath('import')\r\n return this.restClient.post(apiPath, spreadsheet)\r\n}\r\n\r\nmodule.exports = CustomersService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"data-has-image\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"form-group onlineMethodText\\\">\\r\\n <div>Accept online payments today, <span class=\\\"greenText\\\"><a href=\\\"http://crunched.io/payment-processing\\\" target=\\\"_blank\\\">Learn More</a></span></div>\\r\\n </div>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"form-group is-active\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Credit Card</span>\\r\\n <input type=\\\"checkbox\\\" name=\\\"allowCreditCards\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right cancel\\\"></i>\\r\\n <h3>Update Customer</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side address-info\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <label class=\\\"avatar\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.profilePicture : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" style=\\\"background:url('\"\n + ((stack1 = ((helper = (helper = helpers.profilePicture || (depth0 != null ? depth0.profilePicture : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"profilePicture\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"') no-repeat center center;\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n <input type=\\\"file\\\" accept=\\\"image/*\\\" />\\r\\n </label>\\r\\n <div class=\\\"primary-info\\\">\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"maxLength\":\"20\",\"inputLabel\":\"Customer ID\",\"inputName\":\"customerId\",\"inputId\":\"update-customer-id\",\"wrapperClasses\":\"customer-id-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Customer Name\",\"inputName\":\"name\",\"inputId\":\"update-name\",\"wrapperClasses\":\"name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"form-group printed-name\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control \\\" type=\\\"text\\\" id=\\\"update-printed-name\\\" name=\\\"printedName\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"update-printed-name\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" data-original-title=\\\"The printed name is displayed on checks and invoices\\\"><img src=\\\"/img/question-circle.svg\\\" class=\\\"printed-name-tooltip\\\" alt=\\\"?\\\" /> Printed Name</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\"></span>\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Email\",\"inputName\":\"email\",\"inputId\":\"update-email-name\",\"wrapperClasses\":\"email\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 1\",\"inputName\":\"addressLine1\",\"inputId\":\"update-address-line1\",\"wrapperClasses\":\"address-line1-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 2\",\"inputName\":\"addressLine2\",\"inputId\":\"update-address-line2\",\"wrapperClasses\":\"address-line2-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"city-state\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"City\",\"inputName\":\"city\",\"inputId\":\"update-city\",\"wrapperClasses\":\"city\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group state\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"update-state\\\" name=\\\"state\\\" size=\\\"1\\\" style=\\\"height: 35px;\\\">\\r\\n <option></option>\\r\\n <option value=\\\"AL\\\">AL</option>\\r\\n <option value=\\\"AK\\\">AK</option>\\r\\n <option value=\\\"AZ\\\">AZ</option>\\r\\n <option value=\\\"AR\\\">AR</option>\\r\\n <option value=\\\"CA\\\">CA</option>\\r\\n <option value=\\\"CO\\\">CO</option>\\r\\n <option value=\\\"CT\\\">CT</option>\\r\\n <option value=\\\"DE\\\">DE</option>\\r\\n <option value=\\\"FL\\\">FL</option>\\r\\n <option value=\\\"GA\\\">GA</option>\\r\\n <option value=\\\"HI\\\">HI</option>\\r\\n <option value=\\\"ID\\\">ID</option>\\r\\n <option value=\\\"IL\\\">IL</option>\\r\\n <option value=\\\"IN\\\">IN</option>\\r\\n <option value=\\\"IA\\\">IA</option>\\r\\n <option value=\\\"KS\\\">KS</option>\\r\\n <option value=\\\"KY\\\">KY</option>\\r\\n <option value=\\\"LA\\\">LA</option>\\r\\n <option value=\\\"ME\\\">ME</option>\\r\\n <option value=\\\"MD\\\">MD</option>\\r\\n <option value=\\\"MA\\\">MA</option>\\r\\n <option value=\\\"MI\\\">MI</option>\\r\\n <option value=\\\"MN\\\">MN</option>\\r\\n <option value=\\\"MS\\\">MS</option>\\r\\n <option value=\\\"MO\\\">MO</option>\\r\\n <option value=\\\"MT\\\">MT</option>\\r\\n <option value=\\\"NE\\\">NE</option>\\r\\n <option value=\\\"NV\\\">NV</option>\\r\\n <option value=\\\"NH\\\">NH</option>\\r\\n <option value=\\\"NJ\\\">NJ</option>\\r\\n <option value=\\\"NM\\\">NM</option>\\r\\n <option value=\\\"NY\\\">NY</option>\\r\\n <option value=\\\"NC\\\">NC</option>\\r\\n <option value=\\\"ND\\\">ND</option>\\r\\n <option value=\\\"OH\\\">OH</option>\\r\\n <option value=\\\"OK\\\">OK</option>\\r\\n <option value=\\\"OR\\\">OR</option>\\r\\n <option value=\\\"PA\\\">PA</option>\\r\\n <option value=\\\"RI\\\">RI</option>\\r\\n <option value=\\\"SC\\\">SC</option>\\r\\n <option value=\\\"SD\\\">SD</option>\\r\\n <option value=\\\"TN\\\">TN</option>\\r\\n <option value=\\\"TX\\\">TX</option>\\r\\n <option value=\\\"UT\\\">UT</option>\\r\\n <option value=\\\"VT\\\">VT</option>\\r\\n <option value=\\\"VA\\\">VA</option>\\r\\n <option value=\\\"WA\\\">WA</option>\\r\\n <option value=\\\"WV\\\">WV</option>\\r\\n <option value=\\\"WI\\\">WI</option>\\r\\n <option value=\\\"WY\\\">WY</option>\\r\\n <option value=\\\"OTHER\\\">OTHER</option>\\r\\n </select>\\r\\n <label for=\\\"update-state\\\">State</label>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Zip Code\",\"inputName\":\"postalCode\",\"inputId\":\"update-zipcode\",\"wrapperClasses\":\"zipcode\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Telephone\",\"inputName\":\"telephoneOne\",\"inputId\":\"update-telephone-one\",\"wrapperClasses\":\"telephone-one-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Telephone 2\",\"inputName\":\"telephoneTwo\",\"inputId\":\"update-telephone-two\",\"wrapperClasses\":\"telephone-two-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container tax-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"wrapperClasses\":\"tax-rate-id-container\",\"inputLabel\":\"Tax Rate ID\",\"inputName\":\"rateId\",\"inputId\":\"tax-rate-id\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"wrapperClasses\":\"tax-rate-percentile-container\",\"inputLabel\":\"Tax Rate %\",\"inputName\":\"taxRate\",\"inputId\":\"tax-rate-percentile\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"taxRateId\\\" />\\r\\n </div>\\r\\n <div class=\\\"department\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"wrapperClasses\":\"department\",\"inputLabel\":\"Department\",\"inputName\":\"department\",\"inputId\":\"create-department\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"departmentId\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"departmentName\\\" />\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side notes-info\\\">\\r\\n <div class=\\\"form-group onlineMethodHeader\\\">\\r\\n <div>Online Payment Methods</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.paymentsEnabled : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(5, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n <div class=\\\"form-group notes-container\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"update-notes\\\" name=\\\"notes\\\" rows=\\\"14\\\"></textarea>\\r\\n <label for=\\\"update-notes\\\">Notes</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"distribution\\\">\\r\\n <h3>Contacts</h3>\\r\\n <div class=\\\"line-item-container\\\"></div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Contact</button>\\r\\n <br>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Update Customer</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Customers must have a first name.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/customers/create/view')\r\nvar Template = require('lists/customers/update/template')\r\nvar _ = require('lodash')\r\n\r\nvar UpdateView = CreateView.extend({\r\n className: 'block update expanded has-animation fadeInDown',\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n // Fill in inputs with our data\r\n var model = this.model.toViewModel()\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else {\r\n $el.val(model[$el.attr('name')])\r\n }\r\n })\r\n\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n\r\n // Remove empty customer line from the create side\r\n this.$('.create-customer-method').remove()\r\n\r\n // Add customer lines with our data\r\n _.forEach(model['contacts'], function (contact) {\r\n var $contactLine = this.addContact()\r\n $contactLine.find('.contactId').val(contact.id)\r\n $contactLine.find('.autocomplete input').val(contact.firstName + ' ' + contact.lastName)\r\n $contactLine.find('.contactAddress').val(contact.addressLine1)\r\n $contactLine.find('.contactCity').val(contact.city)\r\n $contactLine.find('.contactState').val(contact.state)\r\n }.bind(this))\r\n\r\n this.autoComplete(\r\n this.model.get('taxList'),\r\n 'rateId',\r\n this.$('input[name=rateId]'),\r\n this.salesTaxSelected.bind(this)\r\n )\r\n\r\n if (model.salesTax && model.salesTax.salesTaxId) {\r\n var salesTax = _.find(this.model.get('taxList'), {id: model.salesTax.salesTaxId})\r\n if (salesTax) {\r\n this.salesTaxSelected(salesTax)\r\n }\r\n }\r\n\r\n this.autoComplete(\r\n this.model.get('departmentList'),\r\n 'name',\r\n this.$('input[name=department]'),\r\n this.departmentSelected.bind(this),\r\n 'CREATENEW'\r\n )\r\n\r\n if (model.department) {\r\n this.departmentSelected(model.department)\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = UpdateView\r\n","var ListContainer = require('lists/list/view')\r\nvar ListView = require('lists/customers/list/view')\r\nvar CreateView = require('lists/customers/create/view')\r\nvar ImportWidget = require('lists/customers/import/widget')\r\n\r\nvar CustomersView = ListContainer.extend({\r\n className: 'customers list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n this.listView = new ListView({model: this.model})\r\n this.forwardEvents(this.listView)\r\n\r\n this.createView = new CreateView({model: this.model})\r\n this.forwardEvents(this.createView)\r\n \r\n this.importWidget = new ImportWidget()\r\n\r\n this.importWidget.on('refresh', function () {\r\n this.trigger('refresh', this.importWidget.trigger.bind(this.importWidget, 'refreshed'))\r\n }.bind(this))\r\n\r\n this.on('created', function () {\r\n this.createView.trigger('resetInputs')\r\n }.bind(this))\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n console.log('container -> editDetails')\r\n this.listView.trigger('showEdit', model)\r\n }.bind(this))\r\n\r\n this.on('widgetShown', function () {\r\n this.listView.trigger('bindScroll')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n },\r\n\r\n render: function () { \r\n // Empty out any existing contents\r\n this.$el.html('')\r\n \r\n this.$el.append(this.importWidget.show())\r\n this.$el.append(this.createView.render().$el)\r\n this.$el.append(this.listView.render().$el)\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = CustomersView\r\n","'use strict'\r\n\r\nvar _ = require('underscore')\r\nvar Q = require('q')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar Customers = require('lists/customers/customers')\r\nvar Service = require('lists/customers/service')\r\nvar ContactService = require('lists/contacts/service')\r\nvar DepartmentService = require('lists/departments/service')\r\nvar SalesTaxService = require('lists/sales-taxes/service')\r\nvar ListContainer = require('lists/customers/view')\r\n\r\nvar CustomersWidget = function () {\r\n this.service = new Service()\r\n this.contactService = new ContactService()\r\n this.departmentService = new DepartmentService()\r\n this.salesTaxService = new SalesTaxService()\r\n this.modelType = Customers\r\n this.viewType = ListContainer\r\n \r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n this.view.on('refresh', this.refresh, this)\r\n this.view.on('refresh', this.reset, this)\r\n \r\n this.view.on('onAfterCreate', function () {\r\n this.departmentService.getList().then(function (departmentList) {\r\n this.model.set('departmentList', departmentList)\r\n }.bind(this))\r\n }, this)\r\n\r\n this.view.on('onAfterUpdate', function () {\r\n this.departmentService.getList().then(function (departmentList) {\r\n this.model.set('departmentList', departmentList)\r\n }.bind(this))\r\n }, this)\r\n \r\n this.on('shown', function () {\r\n Q.all([\r\n this.contactService.getList(),\r\n this.salesTaxService.getList(),\r\n this.departmentService.getList()\r\n ]).spread(function (results, salesTaxes, departments) {\r\n this.model.set({\r\n 'contactList': _.map(results, function (contact) {\r\n contact['fullName'] = contact.firstName + ' ' + contact.lastName\r\n return contact\r\n }),\r\n 'taxList': salesTaxes,\r\n 'departmentList': departments\r\n })\r\n }.bind(this)).then(function () {\r\n this.view.trigger('widgetShown')\r\n }.bind(this))\r\n }.bind(this))\r\n}\r\n\r\nCustomersWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nCustomersWidget.prototype.refresh = function (callback) {\r\n var result = this.service.getList().then(function (results) {\r\n this.model.set('customers', results)\r\n }.bind(this))\r\n \r\n if (callback) {\r\n return result.then(callback)\r\n } else {\r\n return result;\r\n }\r\n}\r\n\r\nmodule.exports = CustomersWidget\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar DepartmentService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nDepartmentService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nDepartmentService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'departments'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nDepartmentService.prototype.getList = function () {\r\n var apiPath = this.GetPath('list')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nmodule.exports = DepartmentService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"data-has-image\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \"data-no-op\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.readonly : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.program(9, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"6\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.disposalDate : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"7\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Disposal Price\",\"inputName\":\"disposalPrice\",\"inputId\":\"disposalPrice\",\"inputClasses\":\"currency-field\",\"wrapperClasses\":\"disposal-price-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Disposal Date\",\"wrapperClasses\":\"disposal-date-container\",\"inputName\":\"disposalDate\",\"inputClasses\":\"disposal-date\",\"inputId\":\"disposalDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\");\n},\"9\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Disposal Price\",\"inputName\":\"disposalPrice\",\"inputId\":\"disposalPrice\",\"inputClasses\":\"currency-field\",\"wrapperClasses\":\"disposal-price-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Disposal Date\",\"wrapperClasses\":\"disposal-date-container\",\"inputName\":\"disposalDate\",\"inputClasses\":\"disposal-date\",\"inputId\":\"disposalDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\");\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3></h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <label class=\\\"avatar\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.picture : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.readonly : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" style=\\\"background:url('\"\n + ((stack1 = ((helper = (helper = helpers.picture || (depth0 != null ? depth0.picture : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"picture\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"') no-repeat center center;\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n <input type=\\\"file\\\" accept=\\\"image/*\\\"/>\\r\\n </label>\\r\\n <div class=\\\"flex\\\">\\r\\n <div class=\\\"side-by-side\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Asset Number\",\"inputName\":\"assetNumber\",\"inputId\":\"assetNumber\",\"inputClasses\":\"asset-number\",\"wrapperClasses\":\"asset-number-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Purchase Price\",\"inputName\":\"purchasePrice\",\"inputId\":\"purchasePrice\",\"inputClasses\":\"currency-field\",\"wrapperClasses\":\"purchase-price-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Purchase Date\",\"wrapperClasses\":\"purchase-date-container\",\"inputName\":\"purchaseDate\",\"inputClasses\":\"purchase-date\",\"inputId\":\"purchaseDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.textarea,depth0,{\"name\":\"textarea\",\"hash\":{\"inputRows\":\"4\",\"inputLabel\":\"Description\",\"inputName\":\"description\",\"inputId\":\"description\",\"wrapperClasses\":\"description-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"side-by-side\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.id : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.textarea,depth0,{\"name\":\"textarea\",\"hash\":{\"inputRows\":\"4\",\"inputLabel\":\"Notes\",\"inputName\":\"notes\",\"inputId\":\"notes\",\"wrapperClasses\":\"notes-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"actions\\\">\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\"><span class=\\\"selectedActionBtnText\\\">Save</span> Fixed Asset</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Fixed asset must have a description.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('lists/fixed-asset/create/template')\r\nvar _ = require('lodash')\r\nvar numbro = require('numbro')\r\nvar moment = require('moment')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar FixedAssetCreateView = CreateView.extend({\r\n className: 'block create',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'change input[type=file]': 'selectFile',\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'click': 'expand'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) {\r\n this.Template = Template\r\n }\r\n\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n this.on('resetInputs', function () {\r\n this.cachedAvatar = null\r\n }, this)\r\n this.on('bindAutocomplete', function () {\r\n this.render()\r\n }, this)\r\n this.on('errorCreating', function (errorMessage) {\r\n this.$('.status').html(this.getErrorStatusBar(errorMessage))\r\n setTimeout(this.determineStatus.bind(this), 3000)\r\n }.bind(this))\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n if (this.$el.hasClass('read')) {\r\n return\r\n } else if (this.$el.hasClass('create')) {\r\n this.$('.selectedActionBtnText').html(\"Save\")\r\n } else if (this.$el.hasClass('update')) {\r\n this.$('.selectedActionBtnText').html(\"Update\")\r\n }\r\n\r\n this.$('.purchase-date-container .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('purchaseDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.disposal-date-container .date').datepicker('setStartDate', e.date)\r\n this.$('.date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.disposal-date-container .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('disposalDate') || '')\r\n .datepicker('setEndDate', moment().format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.determineStatus()\r\n },\r\n\r\n isValid: function () {\r\n return !!this.$('input[name=assetNumber]').val() &&\r\n !!(this.$('input[name=purchasePrice]').val() && this.$('input[name=purchasePrice]').val() !== '$') &&\r\n !!this.$('input[name=purchaseDate]').val() &&\r\n !!this.$('textarea[name=description]').val()\r\n },\r\n\r\n determineStatus: function () {\r\n var errorMessage\r\n if (this.isValid()) {\r\n this.$('.status').html(this.getSuccessStatusBar('Fixed asset is valid.'))\r\n } else if (!this.$('input[name=assetNumber]').val()) {\r\n errorMessage = 'Fixed asset requires an asset number.'\r\n } else if (!(this.$('input[name=purchasePrice]').val() && this.$('input[name=purchasePrice]').val() !== '$')) {\r\n errorMessage = 'Fixed asset requires an original purchase price.'\r\n } else if (!this.$('input[name=purchaseDate]').val()) {\r\n errorMessage = 'Fixed asset requires an original purchase date.'\r\n } else if (!this.$('textarea[name=description]').val()) {\r\n errorMessage = 'Fixed asset requires a description.'\r\n }\r\n\r\n if (errorMessage) {\r\n this.$('.status').html(this.getErrorStatusBar(errorMessage))\r\n }\r\n },\r\n\r\n // This is a method used by the base class when a form is submitted on this view\r\n toJSON: function () {\r\n var itemPicture = this.cachedAvatar\r\n var model = {\r\n pictureUpload: itemPicture\r\n }\r\n\r\n if (!this.isValid()) {\r\n throw new Error('Invalid data supplied.')\r\n }\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n if ($el.hasClass('currency-field')) {\r\n elValue = numbro().unformat(elValue)\r\n }\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n return model\r\n },\r\n\r\n // Take the file and update the avatar display to display the image\r\n selectFile: function (e) {\r\n var avatar = _.first(e.target.files)\r\n\r\n if (!avatar) return console.warn('No image selected, leaving unchanged')\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (avatarFile) {\r\n this.$('.avatar').attr('style', 'background:url(\"' + avatarFile.target.result + '\") no-repeat center center;').attr('data-has-image', 'true')\r\n this.cachedAvatar = avatarFile.target.result\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(avatar)\r\n }\r\n})\r\n\r\nmodule.exports = FixedAssetCreateView\r\n","'use strict'\r\n\r\nvar FixedAsset = require('lists/fixed-asset/item/fixed-asset')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar FixedAssetView = ListWrapper.extend({\r\n childModel: FixedAsset\r\n})\r\n\r\n\r\nmodule.exports = FixedAssetView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow flex error-row\\\">\\r\\n <div class=\\\"line-number\\\">\"\n + alias4(((helper = (helper = helpers.lineNumber || (depth0 != null ? depth0.lineNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lineNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"reason\\\">\"\n + alias4(((helper = (helper = helpers.reason || (depth0 != null ? depth0.reason : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reason\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block errors\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Fixed Assets Import Errors</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"line-number\\\">Line #</div>\\r\\n <div class=\\\"reason\\\">Error</div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.errors : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15 push-15-r\\\" name=\\\"completeReview\\\">Complete Review</button>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"import-button\\\">\\r\\n <button class=\\\"btn btn-primary pull-right push-30\\\" name=\\\"openImport\\\">Import</button>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block no-padding tabbed collapsed\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"own-template\\\" id=\\\"ownTemplate\\\">\\r\\n <div class=\\\"pull-right\\\"><i class=\\\"fa fa-close expanding-group-close cancel\\\"></i></div>\\r\\n <div class=\\\"steps\\\">\\r\\n <div class=\\\"step1\\\">\\r\\n <h3>Step 1: Download the outline</h3>\\r\\n <p><a href=\\\"http://get.crunched.help/hc/en-us/articles/236008747-How-to-import-fixed-assets\\\" target=\\\"_blank\\\">Click here</a> to download an import template. You can update this spreadsheet with your own data.</p>\\r\\n </div>\\r\\n <div class=\\\"step2\\\">\\r\\n <h3>Step 2: Upload your data</h3>\\r\\n <p>Once you've updated the outline and saved it, please upload it here to import your data.</p>\\r\\n <label>\\r\\n <span class=\\\"file-name\\\"></span>\\r\\n <span class=\\\"floating\\\">Upload File</span>\\r\\n <input type=\\\"file\\\" name=\\\"outlineUpload\\\">\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15-r push-15 importUpload\\\" name=\\\"upload\\\">Upload</button>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"import-message\\\">\\r\\n <span class=\\\"import-templates\\\">Add using templates</span>\\r\\n <span class=\\\"manually\\\">Add manually</span>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar CreateView = require('lists/list/create/view')\r\nvar Template = require('lists/fixed-asset/import/template')\r\nvar ErrorTemplate = require('lists/fixed-asset/import/error-template')\r\nvar HasFixedAssetsTemplate = require('lists/fixed-asset/import/has-fixedAssets')\r\nvar sweetAlert = require('sweetalert2')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar ScrollTo = require('jquery-scrollto')\r\n\r\nvar ListView = CreateView.extend({\r\n className: 'import',\r\n events: {\r\n 'change input[type=file]': 'changeFile',\r\n 'click button[name=upload]': 'uploadOwn',\r\n 'click button[name=completeReview]': 'completeReview',\r\n 'click button[name=openImport]': 'openImport',\r\n 'click .cancel': 'close'\r\n },\r\n initialize: function () {\r\n this.Template = Template\r\n this.listenTo(this.model, 'change:fixedAssets', this.render)\r\n this.on('uploadErrors', this.uploadErrors, this)\r\n this.on('uploadSuccess', this.uploadSuccess, this)\r\n this.on('importFailed', this.importFailed, this)\r\n },\r\n render: function () {\r\n var TemplateToRender = (this.model.get('fixedAssets').length && !this.forceOpen) ? HasFixedAssetsTemplate : Template\r\n this.$el.html(TemplateToRender(this.model.toViewModel()))\r\n\r\n if (this.onRender) {\r\n this.onRender()\r\n }\r\n\r\n return this\r\n },\r\n changeFile: function (e) {\r\n var fixedAssetsSpreadsheet = _.first(e.target.files)\r\n\r\n if (!fixedAssetsSpreadsheet) {\r\n return console.warn('No image selected, leaving unchanged')\r\n }\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (fixedAssetsSpreadsheetFile) {\r\n if (this.checkFileExtension(fixedAssetsSpreadsheet)) {\r\n this.cachedFixedAssetSpreadsheet = fixedAssetsSpreadsheetFile.target.result\r\n this.$('.file-name').text(fixedAssetsSpreadsheet.name)\r\n this.fileNameLabelStyling()\r\n }\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(fixedAssetsSpreadsheet)\r\n this.isValidFileExtension = this.checkFileExtension(fixedAssetsSpreadsheet)\r\n },\r\n // For Edge browser, to prevent an overraping text issue of text:file-name and a label.\r\n fileNameLabelStyling: function () {\r\n this.$('.floating').css({\r\n 'top': '-29px',\r\n 'font-weight': 600,\r\n 'font-size': '13px'\r\n })\r\n },\r\n checkFileExtension: function (selectedFile) {\r\n var validExts = new Array('.xlsx')\r\n var fileExt = selectedFile.name\r\n fileExt = fileExt.substring(fileExt.lastIndexOf('.')).toLowerCase()\r\n if (validExts.indexOf(fileExt) < 0) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'You can only upload Excel(*.xlsx) file.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n\r\n this.$('.file-name').text('')\r\n this.$('.floating').css({\r\n 'top': '-5px',\r\n 'font-weight': 400,\r\n 'font-size': '15px'\r\n })\r\n this.isValidFileExtension = false\r\n return false\r\n } else {\r\n this.isValidFileExtension = true\r\n return true\r\n }\r\n },\r\n uploadOwn: function () {\r\n if (!!this.validateFileType()) {\r\n this.upload(this.cachedFixedAssetSpreadsheet)\r\n // To prevent importing a previously uploaded or selected file while no file is selected for the second time\r\n this.cachedFixedAssetSpreadsheet = ''\r\n this.isValidFileExtension = false\r\n }\r\n },\r\n validateFileType: function () {\r\n if (this.isValidFileExtension) {\r\n var fileType = this.cachedFixedAssetSpreadsheet\r\n var xlsxMimeType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\r\n fileType = fileType.substring(fileType.lastIndexOf(':') + 1, fileType.lastIndexOf(';'))\r\n\r\n // if a selected file extension is correct by checking its name,\r\n // but if there is no reader or an application installed for the file type in the local machine,\r\n // OS will not recognize the file type. Hence, if the selected file type is valid, but the mime type is empty, we set the type manually.\r\n if (fileType === '' && this.isValidFileExtension || fileType !== xlsxMimeType && this.isValidFileExtension) {\r\n var index = this.cachedFixedAssetSpreadsheet.lastIndexOf(':') + 1\r\n if (fileType !== '') {\r\n // When there is no reader for the file, FireFox passes: \"application/octet-stream\"\r\n this.cachedFixedAssetSpreadsheet = this.cachedFixedAssetSpreadsheet.replace(fileType, '')\r\n }\r\n this.cachedFixedAssetSpreadsheet = this.insert(this.cachedFixedAssetSpreadsheet, index, xlsxMimeType)\r\n }\r\n\r\n var insertedMimeType = this.cachedFixedAssetSpreadsheet\r\n insertedMimeType = insertedMimeType.substring(insertedMimeType.lastIndexOf(':') + 1, insertedMimeType.lastIndexOf(';'))\r\n\r\n return (fileType === xlsxMimeType) || (fileType === '' && this.isValidFileExtension && insertedMimeType === xlsxMimeType) || (fileType !== xlsxMimeType && this.isValidFileExtension && insertedMimeType === xlsxMimeType)\r\n }\r\n },\r\n insert: function (str, index, value) {\r\n return str.substr(0, index) + value + str.substr(index)\r\n },\r\n upload: function (spreadsheet) {\r\n this.$('.importUpload').prop('disabled', true)\r\n this.trigger('upload', {import: spreadsheet})\r\n },\r\n btnEnable: function () {\r\n $('.importUpload').prop('disabled', false)\r\n },\r\n completeReview: function () {\r\n this.$('.errors').remove()\r\n\r\n $('.block[hidden-during-review], .import-message[hidden-during-review], .import-button[hidden-during-review]')\r\n .removeClass('hidden')\r\n .attr('hidden-during-review', null)\r\n\r\n $('.page-heading').ScrollTo()\r\n },\r\n uploadErrors: function (errors, successCount) {\r\n this.close()\r\n\r\n $('.block, .import-message, .import-button')\r\n .addClass('hidden')\r\n .attr('hidden-during-review', '1')\r\n\r\n this.$el.append(ErrorTemplate({errors: errors}))\r\n var totalCount = errors.length + successCount\r\n\r\n if (!successCount) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: successCount + ' of ' + totalCount + ' fixed assets have been imported, some information couldn\\'t be parsed.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n } else {\r\n sweetAlert({\r\n title: 'Warning',\r\n text: successCount + ' of ' + totalCount + ' fixed assets have been imported, some information couldn\\'t be parsed.',\r\n type: 'warning',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n }\r\n },\r\n uploadSuccess: function (successCount) {\r\n this.close()\r\n\r\n sweetAlert({\r\n title: 'Success',\r\n text: successCount + ' of ' + successCount + ' fixed assets have been imported. Please set up your fixed assets assignments to get the most out of Crunched.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n importFailed: function (errorMessage) {\r\n this.close()\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Failed to import the fixed assets. ' + errorMessage,\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n openImport: function () {\r\n this.forceOpen = true\r\n this.$el.addClass('forced-open')\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.close.bind(this))\r\n this.render()\r\n },\r\n close: function () {\r\n this.forceOpen = false\r\n this.$el.removeClass('forced-open')\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n this.render()\r\n }\r\n})\r\n\r\nmodule.exports = ListView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar FixedAssetService = require('lists/fixed-asset/service')\r\nvar FixedAssetImportView = require('lists/fixed-asset/import/view')\r\n\r\nvar FixedAssetImportWidget = function () {\r\n this.fixedAssetService = new FixedAssetService()\r\n this.model = new Backbone.Model({\r\n fixedAssets: []\r\n })\r\n\r\n this.model.toViewModel = this.model.toJSON.bind(this.model)\r\n\r\n this.view = new FixedAssetImportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('upload', this.upload.bind(this))\r\n\r\n this.loadFixedAssets()\r\n}\r\n\r\nFixedAssetImportWidget.prototype = _.clone(Backbone.Events)\r\n\r\nFixedAssetImportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nFixedAssetImportWidget.prototype.loadFixedAssets = function () {\r\n return this.fixedAssetService.getList().then(function (results) {\r\n this.model.set('fixedAssets', results.collection)\r\n }.bind(this))\r\n}\r\n\r\nFixedAssetImportWidget.prototype.upload = function (spreadsheet) {\r\n return this.fixedAssetService.importSpreadsheet(spreadsheet).then(function (results) {\r\n return this.loadFixedAssets().then(function () {\r\n var errors = results.parseErrors\r\n var successCount = results.successCount\r\n\r\n this.once('refreshed', function () {\r\n if (errors.length) {\r\n this.view.trigger('uploadErrors', errors, successCount)\r\n } else {\r\n this.view.trigger('uploadSuccess', successCount)\r\n }\r\n }.bind(this))\r\n\r\n this.trigger('refresh')\r\n }.bind(this))\r\n }.bind(this), function (error){\r\n this.view.btnEnable() \r\n this.view.trigger('importFailed', error.message)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = FixedAssetImportWidget\r\n","'use strict'\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\nvar moment = require('moment')\r\n\r\nvar FixedAsset = ListEntry.extend({}, {\r\n parse: function (json) {\r\n return new FixedAsset({\r\n id: json.id,\r\n assetNumber: json.assetNumber,\r\n description: json.description,\r\n disposalDate: json.disposalDate ? moment(json.disposalDate) : null,\r\n shortDisposalDate: moment(json.disposalDate).format('MM/DD/YYYY'),\r\n disposalPrice: json.disposalPrice,\r\n isActive: json.isActive,\r\n notes: json.notes,\r\n picture: json.picture,\r\n purchaseDate: moment(json.purchaseDate),\r\n shortPurchaseDate: moment(json.purchaseDate).format('MM/DD/YYYY'),\r\n purchasePrice: json.purchasePrice\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = FixedAsset\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"asset-number\\\">\"\n + alias4(((helper = (helper = helpers.assetNumber || (depth0 != null ? depth0.assetNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"assetNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"purchase-date date\\\">\"\n + alias4(((helper = (helper = helpers.shortPurchaseDate || (depth0 != null ? depth0.shortPurchaseDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortPurchaseDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"description\\\">\"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"purchase-price currency\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.purchasePrice : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.disposalDate : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('lists/fixed-asset/item/template')\r\n\r\nvar FixedAssetView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n if (this.model.get('disposalDate')) {\r\n this.$el.addClass('notActive')\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = FixedAssetView\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\"></h3>\\r\\n <i class=\\\"fa fa-close pull-right clear-search-box\\\"></i>\\r\\n <input type=\\\"text\\\" class=\\\"pull-right search-box\\\" placeholder=\\\"Search...\\\" value=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.search || (depth0 != null ? depth0.search : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"search\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" />\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"asset-number\\\">Asset Number</div>\\r\\n <div class=\\\"purchase-date date\\\">Purchase Date</div>\\r\\n <div class=\\\"description\\\">Description</div>\\r\\n <div class=\\\"purchase-price currency\\\">Purchase Price</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\"><p class=\\\"center\\\">Loading more fixed assets...</p></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('lists/fixed-asset/list/template')\r\nvar CustomerView = require('lists/fixed-asset/item/view')\r\nvar DetailsView = require('lists/fixed-asset/read/view')\r\nvar UpdateView = require('lists/fixed-asset/update/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\nvar FixedAssetsListView = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort',\r\n 'keyup .search-box': 'searchList',\r\n 'click .clear-search-box': 'clearSearch'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = CustomerView\r\n this.model.set('search', '')\r\n this.model.set('sort', 'asc')\r\n this.model.set('sortField', 'purchaseDate')\r\n this.model.set('purchaseDate-sort', 'desc')\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.on('showDetails', this.showDetails.bind(this))\r\n this.on('showEdit', this.showEdit.bind(this))\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more fixed assets...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more fixed assets.')\r\n },\r\n\r\n showDetails: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n var details = new DetailsView({model: model})\r\n\r\n // View to show beneath $lineItem, and if the 'active' class should be added to $lineItem's classes\r\n this.showChildView(details, $lineItem, true)\r\n },\r\n\r\n showEdit: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n\r\n model.set('vendorList', this.model.get('vendorList'))\r\n model.set('accountList', this.model.get('accountList'))\r\n var update = new UpdateView({ model: model })\r\n update.on('update', function () {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('update')\r\n this.trigger.apply(this, args)\r\n }, this)\r\n this.on('updateError', function (errorMessage) {\r\n update.trigger('errorUpdating', errorMessage)\r\n })\r\n\r\n this.showChildView(update, $lineItem, false)\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.unset('purchaseDate-sort')\r\n this.model.unset('disposalDate-sort')\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n },\r\n\r\n searchList: function (e) {\r\n if (e.which === 13) {\r\n var $currentTarget = $(e.currentTarget)\r\n\r\n this.model.set({\r\n page: 1,\r\n search: $currentTarget.val()\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n }\r\n },\r\n\r\n clearSearch: function (e) {\r\n var $sibiling = $(e.currentTarget).parent().children('.search-box')\r\n\r\n if ($sibiling.val() === '') {\r\n return\r\n }\r\n\r\n $sibiling.val('')\r\n\r\n if (this.model.get('search') === '') {\r\n return\r\n }\r\n\r\n this.model.set({\r\n page: 1,\r\n search: ''\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n }\r\n})\r\n\r\nmodule.exports = FixedAssetsListView\r\n","var UpdateView = require('lists/fixed-asset/update/view')\r\n\r\nvar DepositReadView = UpdateView.extend({\r\n className: 'block read expanded',\r\n\r\n initialize: function () {\r\n UpdateView.prototype.initialize.apply(this, arguments)\r\n this.model.set('readonly', true)\r\n },\r\n\r\n onRender: function () {\r\n\r\n UpdateView.prototype.onRender.apply(this, arguments)\r\n this.$('input,select,textarea').attr('disabled', true)\r\n },\r\n\r\n toJSON: function () {\r\n throw new Error(\"Read views can't create JSON objects.\")\r\n }\r\n})\r\n\r\nmodule.exports = DepositReadView\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar FixedAssetService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nFixedAssetService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nFixedAssetService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'fixed-assets'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nFixedAssetService.prototype.getList = function () {\r\n var apiPath = this.GetPath()\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nFixedAssetService.prototype.importSpreadsheet = function (spreadsheet) {\r\n var apiPath = this.GetPath('import')\r\n return this.restClient.post(apiPath, spreadsheet)\r\n}\r\n\r\nmodule.exports = FixedAssetService\r\n","var CreateView = require('lists/fixed-asset/create/view')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar numbro = require('numbro')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar dateParams = require('datepicker/datepicker-params') \r\n\r\nvar DepositUpdateView = CreateView.extend({\r\n className: 'block update expanded',\r\n\r\n initialize: function () {\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n\r\n this.on('errorUpdating', function (errorMessage) {\r\n this.$('.status').html(this.getErrorStatusBar(errorMessage))\r\n setTimeout(this.determineStatus.bind(this), 3000)\r\n }.bind(this))\r\n },\r\n\r\n onRender: function () {\r\n var model = this.model.toViewModel()\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n if (model.checkbook && model.checkbook.name) {\r\n model.checkbookSearch = model.checkbook.name\r\n }\r\n\r\n _.each(this.$('input, textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var isDate = $el.closest('.form-material').hasClass('date')\r\n var isCurrency = $el.hasClass('currency') || $el.hasClass('currency-field')\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else if (isDate) {\r\n $el\r\n .val(model[$el.attr('name')])\r\n .datepicker('setDate', model[$el.attr('name')] ? model[$el.attr('name')].format(dateParams.format) : '')\r\n .closest('.floating')\r\n .addClass('open')\r\n } else if (isCurrency) {\r\n $el.val(numbro(model[$el.attr('name')]).formatCurrency('$0,0.00'))\r\n } else if (model[$el.attr('name')]) {\r\n $el.val(model[$el.attr('name')]).closest('.floating').addClass('open')\r\n }\r\n })\r\n \r\n this.determineStatus()\r\n },\r\n\r\n save: function (e) {\r\n e.preventDefault()\r\n\r\n var model = this.toJSON()\r\n\r\n if (model.disposalDate && !this.model.get('disposalDate')) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'Setting a disposal date will mark this fixed asset as disposed. You will not be able to edit this after you save.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#DD6B55',\r\n confirmButtonText: 'Dispose',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n var id = this.getId()\r\n if (id) {\r\n this.$('.save').prop('disabled', true)\r\n this.trigger('update', id, model)\r\n }\r\n }.bind(this))\r\n } else {\r\n var id = this.getId()\r\n if (id) {\r\n this.$('.save').prop('disabled', true)\r\n this.trigger('update', id, model)\r\n }\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = DepositUpdateView\r\n","var ListContainer = require('lists/list/view')\r\nvar ListView = require('lists/fixed-asset/list/view')\r\nvar CreateView = require('lists/fixed-asset/create/view')\r\nvar ImportWidget = require('lists/fixed-asset/import/widget')\r\nvar moment = require('moment')\r\n\r\nvar FixedAssetsView = ListContainer.extend({\r\n className: 'fixed-assets list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n // Set initial date values\r\n this.model.set({\r\n purchaseDate: moment(),\r\n disposalDate: moment(null)\r\n })\r\n\r\n this.listView = new ListView({ model: this.model })\r\n this.forwardEvents(this.listView)\r\n\r\n this.createView = new CreateView({ model: this.model })\r\n this.forwardEvents(this.createView)\r\n\r\n this.importWidget = new ImportWidget()\r\n\r\n this.importWidget.on('refresh', function () {\r\n this.trigger('refresh', this.importWidget.trigger.bind(this.importWidget, 'refreshed'))\r\n }.bind(this))\r\n\r\n this.on('created', function () {\r\n this.createView.trigger('resetInputs')\r\n }.bind(this))\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n this.listView.trigger('showEdit', model)\r\n }.bind(this))\r\n\r\n this.on('widgetShown', function () {\r\n this.listView.trigger('bindScroll')\r\n this.createView.trigger('bindAutocomplete')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n\r\n this.on('createError', function (errorMessage) {\r\n this.createView.trigger('errorCreating', errorMessage)\r\n })\r\n\r\n this.on('updateFailed', function (errorMessage) {\r\n this.listView.trigger('updateError', errorMessage)\r\n })\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n\r\n this.$el.append(this.importWidget.show())\r\n this.$el.append(this.createView.render().$el)\r\n this.$el.append(this.listView.render().$el)\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = FixedAssetsView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar FixedAssets = require('lists/fixed-asset/fixed-assets')\r\nvar Service = require('lists/fixed-asset/service')\r\nvar ListContainer = require('lists/fixed-asset/view')\r\n\r\nvar FixedAssetsWidget = function () {\r\n this.service = new Service()\r\n this.modelType = FixedAssets\r\n this.viewType = ListContainer\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n \r\n this.view.on('refresh', this.refresh, this)\r\n this.view.on('refresh', this.reset, this)\r\n}\r\n\r\nFixedAssetsWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nFixedAssetsWidget.prototype.refresh = function (callback) {\r\n var result = this.service.getList().then(function (results) {\r\n this.model.set('fixedAssets', results.collection)\r\n }.bind(this))\r\n \r\n if (callback) {\r\n return result.then(callback)\r\n } else {\r\n return result\r\n }\r\n}\r\n\r\nmodule.exports = FixedAssetsWidget\r\n","var Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\nvar Item = Backbone.View.extend({\r\n className: 'itemrow flex',\r\n\r\n events: {\r\n 'submit form': 'save',\r\n 'click .collapse': 'collapse',\r\n 'click .cancel': 'cancel'\r\n },\r\n\r\n initialize: function () {\r\n if (!this.toJSON) {\r\n console.warn('toJSON not set on CreateView, used for turning the data in the create form into a JSON model for submission to the back end.')\r\n throw new Error('toJSON not set on CreateView, used for turning the data in the create form into a JSON model for submission to the back end.')\r\n }\r\n if (!this.Template) {\r\n console.warn('Template is not set on CreateView')\r\n throw new Error('Template is not set on CreateView')\r\n }\r\n\r\n this.on('resetInputs', this.reset, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(this.Template(this.model.toViewModel()))\r\n\r\n if (this.onRender) {\r\n this.onRender()\r\n }\r\n\r\n return this\r\n },\r\n\r\n save: function (e) {\r\n if (e) {\r\n e.preventDefault()\r\n }\r\n\r\n var model = this.toJSON()\r\n var id = this.getId()\r\n this.$('.save').prop('disabled', true)\r\n\r\n if (id) {\r\n this.trigger('update', id, model)\r\n } else {\r\n this.trigger('create', model)\r\n }\r\n },\r\n\r\n getId: function () {\r\n return this.model.id\r\n },\r\n\r\n expand: function () {\r\n if (!this.$el.hasClass('expanded')) {\r\n this.$el.addClass('expanded')\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.collapse.bind(this))\r\n }\r\n\r\n if (this.determineStatus) {\r\n this.determineStatus()\r\n }\r\n },\r\n\r\n collapse: function (e) {\r\n if (e) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n if (!this.$el.hasClass('create')) {\r\n this.cancel()\r\n }\r\n }\r\n if (this.$el.hasClass('cross-list-modal')) {\r\n this.$el.modal('hide')\r\n $('.modal-backdrop').remove()\r\n return\r\n }\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n this.$el.removeClass('expanded')\r\n this.trigger('collapsed')\r\n },\r\n\r\n cancel: function (e) {\r\n if (e) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n }\r\n if (this.$el.hasClass('cross-list-modal')) {\r\n this.$el.modal('hide')\r\n $('.modal-backdrop').remove()\r\n return\r\n }\r\n this.collapse()\r\n this.trigger('remove')\r\n this.remove()\r\n this.trigger('cancelled')\r\n },\r\n\r\n reset: function () {\r\n this.collapse()\r\n this.render()\r\n },\r\n\r\n /**\r\n * Sets up autocomplete on a text input against a data source.\r\n *\r\n * @param {Array<Object>} dataSource - The source of the autocomplete information.\r\n * @param {string} property - The property of the objects that will be autocompleted against.\r\n * @param {jQuery Selection} $input - The input element that will be able to autocomplete.\r\n * @param {Function(Object)} onSelected - Callback that will be called when the user selects an object.\r\n * @param {string} createId - The ID to give instances that will be created. Leave undefined to disable.\r\n */\r\n autoComplete: function (dataSource, property, $input, onSelected, createId) {\r\n if (!$input || !$input.length || !dataSource || !property || $input.attr('no-autocomplete')) {\r\n return\r\n }\r\n\r\n // When using autocomplete, it is expected to be in a material form element\r\n // and within a container that will contain all of the related fields.\r\n // When not in a container, add the 'data-not-autocomplete-boundary' attribute to the element\r\n // to prevent us from using that as the autocomplete container.\r\n // We will instead use the form-group element.\r\n var $lineItem = $input.parent().parent().parent()\r\n\r\n if ($lineItem.attr('data-not-autocomplete-boundary') !== undefined) {\r\n $lineItem = $input.parent().parent()\r\n }\r\n\r\n var autocompleteOptions = {\r\n source: this.autocompleteSource.bind(this, dataSource, property, $input, createId),\r\n delay: 100,\r\n minLength: 0,\r\n appendTo: $('#main-container'),\r\n select: function (e, ui) {\r\n var id = ui.item.value\r\n selected(id, e)\r\n },\r\n change: function (e, ui) {\r\n var id = getId()\r\n if (!id) {\r\n $lineItem.find('input').val('').closest('.floating').removeClass('open')\r\n } else {\r\n selected(id, e)\r\n }\r\n },\r\n focus: function (e, ui) {\r\n e.preventDefault()\r\n },\r\n open: function (e, ui) {\r\n autocomplete.menu.element.position({at: 'left bottom', my: 'left top', of: $input, within: $('main'), collision: 'none'})\r\n autocomplete.menu.element.css({\r\n 'width': $input.outerWidth(),\r\n 'top': Number(autocomplete.menu.element.css('top').replace('px', '')) + 2,\r\n 'z-index': (Number(this.$el.css('z-index')) || 10) + 1\r\n })\r\n }.bind(this)\r\n }\r\n\r\n var autocomplete = $input.data('ui-autocomplete')\r\n var preExistingAutocomplete = !!autocomplete\r\n if (!preExistingAutocomplete) {\r\n autocomplete = $input.autocomplete(autocompleteOptions).on('focus', function () {\r\n $input.autocomplete('search', '')\r\n }).data('ui-autocomplete')\r\n\r\n $.extend(autocomplete, {\r\n _renderMenu: function (ul, items) {\r\n _.each(items, function (item) {\r\n var $listItem = this._renderItemData(ul, item)\r\n $listItem.attr('data-id', item.value)\r\n }.bind(this))\r\n },\r\n _resizeMenu: function () {\r\n this.menu.element.css({\r\n 'width': $input.outerWidth(),\r\n position: 'absolute'\r\n }).addClass('z-1')\r\n }\r\n })\r\n } else {\r\n autocomplete.option(autocompleteOptions)\r\n }\r\n\r\n // autocompleteGetId: function ($input, autocomplete) {\r\n var getId = this.autocompleteGetId.bind(this, $input, autocomplete)\r\n // dataSource, property, $input, createId, onSelected, id, e\r\n var selected = this.autocompleteHandleSelected.bind(this, dataSource, property, $input, onSelected, createId)\r\n\r\n if (!preExistingAutocomplete) {\r\n this.autocompleteBindExitCallbacks($input, $lineItem, getId)\r\n }\r\n\r\n this.trigger('autocompleteBound', $input, property, dataSource)\r\n },\r\n\r\n autocompleteSource: function (dataSource, property, $input, createId, req, res) {\r\n var sortedSource = dataSource\r\n\r\n if (!dataSource.noSort) {\r\n sortedSource = _.sortBy(dataSource, [property])\r\n }\r\n\r\n var source = _.chain(sortedSource).filter(function (entry) {\r\n return !req.term || (entry[property].toLowerCase().indexOf(req.term.toLowerCase()) !== -1)\r\n }).map(function (entry) {\r\n return {\r\n label: entry[property],\r\n value: entry['id']\r\n }\r\n }).value()\r\n\r\n if (createId && req.term) {\r\n source = _.concat(source, {\r\n label: \"Create '\" + req.term + \"'\",\r\n value: createId\r\n })\r\n }\r\n\r\n res(source)\r\n },\r\n\r\n autocompleteGetId: function ($input, autocomplete) {\r\n if ($input.attr('data-selection-id') && $input.attr('data-selection') === $input.val()) {\r\n return $input.attr('data-selection-id')\r\n }\r\n\r\n var selectedItem = null\r\n\r\n if (!$input.val()) {\r\n return null\r\n }\r\n\r\n _.each(autocomplete.menu.element.find('li'), function (el) {\r\n var isMatching = $(el).text() === $input.val()\r\n if (isMatching && !selectedItem) {\r\n selectedItem = $(el)\r\n }\r\n })\r\n if (!selectedItem) {\r\n selectedItem = autocomplete.menu.element.find('li:first-child')\r\n }\r\n\r\n return selectedItem.attr('data-id')\r\n },\r\n\r\n autocompleteBindExitCallbacks: function ($input, $lineItem, getIdCallback) {\r\n var onTriggerSelected = function () {\r\n var id = getIdCallback()\r\n if (!id) {\r\n $lineItem.find('input').val('').closest('.floating').removeClass('open')\r\n } else {\r\n $input.autocomplete('instance')._trigger('select', 'autocompleteselect', {item: {value: id}})\r\n $input.autocomplete('close')\r\n }\r\n }\r\n\r\n var oldValue\r\n\r\n var keyDownCallback = function (e) {\r\n oldValue = $(e.currentTarget).val()\r\n }\r\n\r\n var keyUpCallback = function (e) {\r\n if ($(e.currentTarget).val() !== oldValue) {\r\n if ($input.attr('data-selection-id')) {\r\n console.log('Allowing reselection on autocomplete')\r\n $input.attr('data-selection-id', '')\r\n }\r\n }\r\n\r\n if (e.which === 13) {\r\n console.log('Allowing reselection based on user explicitly selecting an item')\r\n $input.attr('data-selection-id', '')\r\n onTriggerSelected()\r\n }\r\n }\r\n\r\n var onFocusOut = function (e) {\r\n var id = getIdCallback()\r\n if ($input.attr('data-selection-id') === id) {\r\n console.log('Allowing reselection on autocomplete')\r\n $input.attr('data-selection-id', '')\r\n }\r\n }\r\n\r\n $input.on('keydown', keyDownCallback)\r\n $input.on('keyup', keyUpCallback)\r\n $input.on('focusout', onFocusOut)\r\n },\r\n\r\n autocompleteHandleSelected: function (dataSource, property, $input, onSelected, createId, id, e) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n\r\n var selectedEntry\r\n // If we don't have a createID or we aren't creating, find the entry\r\n if (!createId || id !== createId) {\r\n selectedEntry = _.find(dataSource, {id: id})\r\n } else {\r\n // Create an object with what we know about the object and pass it along\r\n selectedEntry = {\r\n id: createId\r\n }\r\n selectedEntry[property] = $input.val()\r\n }\r\n\r\n if ($input.attr('data-selection-id') !== id) {\r\n $input\r\n .attr('data-selection', $input.val())\r\n .attr('data-selection-id', id)\r\n\r\n onSelected(selectedEntry)\r\n }\r\n },\r\n\r\n getErrorStatusBar: function (error) {\r\n return $('<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">' + error + '</span></div>')\r\n },\r\n\r\n getSuccessStatusBar: function (message) {\r\n return $('<div class=\"bg-primary-lighter\" style=\"display: block;\"><i class=\"fa fa-check-circle fa-2x fa-inverse\"></i><span class=\"message\">' + message + '</span></div>')\r\n },\r\n\r\n forwardEvents: function (subject, blackList) {\r\n subject.on('all', function (triggerName) {\r\n if (blackList && blackList.indexOf(triggerName) !== -1) {\r\n return\r\n }\r\n this.trigger.apply(this, arguments)\r\n console.log('CreateView forwarding', triggerName)\r\n }.bind(this))\r\n }\r\n})\r\n\r\nmodule.exports = Item\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\n\r\nvar Contact = Backbone.Model.extend({\r\n toViewModel: function () {\r\n var data = Backbone.Model.prototype.toJSON.apply(this, arguments)\r\n\r\n _.each(data, function (translatedValue, propertyName, dataReference) {\r\n if (!translatedValue) {\r\n return\r\n }\r\n\r\n if (translatedValue.toViewModel && typeof (translatedValue.toViewModel) === 'function') {\r\n translatedValue = translatedValue.toViewModel()\r\n }\r\n\r\n // If we have an invalid moment instance, we should skip this property.\r\n if (!translatedValue) {\r\n return\r\n }\r\n\r\n if (translatedValue.length && Array.isArray(translatedValue)) {\r\n translatedValue = _.map(translatedValue, function (translatedValueChild) {\r\n if (translatedValueChild.toViewModel && typeof (translatedValueChild.toViewModel) === 'function') {\r\n translatedValueChild = translatedValueChild.toViewModel()\r\n }\r\n\r\n return translatedValueChild\r\n })\r\n }\r\n\r\n dataReference[propertyName] = translatedValue\r\n })\r\n\r\n return data\r\n }\r\n})\r\n\r\nmodule.exports = Contact\r\n","var Backbone = require('backbone')\r\n\r\nvar Item = Backbone.View.extend({\r\n className: 'itemrow flex',\r\n\r\n events: {\r\n 'click .remove': 'deleteItem',\r\n 'click .disable': 'disableItem',\r\n 'click .enable': 'enableItem',\r\n 'click .edit': 'editItem',\r\n 'click .void': 'voidItem',\r\n 'click': 'openItem'\r\n },\r\n\r\n initialize: function () {\r\n if (!this.Template) {\r\n console.warn('Template is not set on ItemView')\r\n throw new Error('Template is not set on ItemView')\r\n }\r\n },\r\n\r\n attributes: function () {\r\n return {\r\n 'data-id': this.model.id\r\n }\r\n },\r\n\r\n render: function () {\r\n this.$el.html(this.Template(this.model.toViewModel()))\r\n if (this.onRender) this.onRender()\r\n return this\r\n },\r\n openItem: function (e) {\r\n // If this has an active class on it (reserved for when actively viewing an item) don't do anything as it's already open.\r\n if (this.$el.hasClass('active')) return\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n this.trigger('get', this.model.id)\r\n },\r\n deleteItem: function (e) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n this.trigger('delete', this.model.id)\r\n },\r\n voidItem: function (e) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n this.trigger('void', this.model.id)\r\n },\r\n disableItem: function (e) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n this.trigger('disable', this.model.id)\r\n },\r\n enableItem: function (e) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n this.trigger('enable', this.model.id)\r\n },\r\n editItem: function (e) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n this.trigger('edit', this.model.id)\r\n }\r\n})\r\n\r\nmodule.exports = Item\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar Q = require('q')\r\n\r\nvar List = Backbone.Model.extend(\r\n {\r\n initialize: function () {\r\n if (!this.childModel) console.warn('childModel not set on List model. Used for the underlying collection.')\r\n\r\n var items = new (Backbone.Collection.extend({\r\n model: this.childModel\r\n }))\r\n\r\n this.set({\r\n items: items,\r\n page: 1\r\n })\r\n\r\n items.on('add', function () {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('add')\r\n this.trigger.apply(this, args)\r\n }.bind(this))\r\n items.on('reset', function () {\r\n this.set({page: 1}, {silent: true})\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('reset')\r\n this.trigger.apply(this, args)\r\n }.bind(this))\r\n\r\n this.add = function () { this.get('items').add.apply(this.get('items'), arguments) }.bind(this)\r\n this.reset = function () { this.get('items').reset.apply(this.get('items'), arguments) }.bind(this)\r\n this.map = function () { return this.get('items').map.apply(this.get('items'), arguments) }.bind(this)\r\n this.loadMore = function () {\r\n var deferred = Q.defer()\r\n this.once('add', function (items) {\r\n deferred.resolve(items)\r\n })\r\n this.trigger('loadMore')\r\n return deferred.promise\r\n }.bind(this)\r\n this.toViewModel = function () {\r\n var data = Backbone.Model.prototype.toJSON.apply(this, arguments)\r\n _.each(data, function (translatedValue, propertyName, dataReference) {\r\n if (!translatedValue) {\r\n return\r\n }\r\n\r\n if (translatedValue.toViewModel && typeof (translatedValue.toViewModel) === 'function') {\r\n translatedValue = translatedValue.toViewModel()\r\n }\r\n\r\n // If we have an invalid moment instance, we should skip this property.\r\n if (!translatedValue) {\r\n return\r\n }\r\n\r\n if (translatedValue.length && Array.isArray(translatedValue)) {\r\n translatedValue = _.map(translatedValue, function (translatedValueChild) {\r\n if (translatedValueChild.toViewModel && typeof (translatedValueChild.toViewModel) === 'function') {\r\n translatedValueChild = translatedValueChild.toViewModel()\r\n }\r\n\r\n return translatedValueChild\r\n })\r\n }\r\n\r\n dataReference[propertyName] = translatedValue\r\n })\r\n\r\n return _.extend(data, {\r\n items: this.get('items').map(function (item) { return item.toViewModel() })\r\n })\r\n }.bind(this)\r\n },\r\n\r\n getModel: function (data) {\r\n /* eslint-disable new-cap */\r\n return this.childModel.parse ? this.childModel.parse(data) : new this.childModel(data)\r\n /* eslint-enable new-cap */\r\n }\r\n }\r\n)\r\n\r\nmodule.exports = List\r\n","var Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar ConfirmWidget = require('forms/confirm/widget')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nfunction onscreen ($el) {\r\n if (!$el.length) {\r\n return false\r\n }\r\n\r\n var viewportBottom = $(window).scrollTop() + $(window).height()\r\n return $el.offset().top <= viewportBottom\r\n}\r\n\r\nvar ListView = Backbone.View.extend({\r\n initialize: function () {\r\n this.listenTo(this.model, 'add', this.addChild.bind(this))\r\n if (!this.childView) {\r\n console.warn('childView not set on ListView. Used for displaying children in the list.')\r\n throw new Error('childView not set on ListView. Used for displaying children in the list.')\r\n }\r\n if (!this.Template) {\r\n console.warn('Template is not set on ListView')\r\n throw new Error('Template is not set on ListView')\r\n }\r\n\r\n this.listenTo(this.model, 'reset', this.render.bind(this))\r\n this.listenTo(this.model, 'loadingPage', this.showLoadingMore.bind(this))\r\n this.listenTo(this.model, 'loadedPage', this.showNoMore.bind(this))\r\n\r\n this.on('checkIfNeedsNextPage', this.checkIfNeedsNextPage.bind(this))\r\n\r\n this.on('bindScroll', function () {\r\n $(window).on('scroll', function (e) {\r\n this.checkIfNeedsNextPage()\r\n }.bind(this))\r\n })\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more to show.')\r\n },\r\n\r\n checkIfNeedsNextPage: function (listCount) {\r\n // If we're checking from a loadedPage event, check the count of items we got.\r\n // If it's 0, we shouldn't keep checking if we should load more.\r\n if (listCount !== undefined && listCount === 0) {\r\n return\r\n }\r\n if (onscreen(this.$('.infinite-scrolling-indicator'))) {\r\n this.trigger('loadMore')\r\n }\r\n },\r\n\r\n render: function () {\r\n this.$el.html(this.Template(this.model.toViewModel()))\r\n this.$infinity = this.$('.infinity').listView()\r\n\r\n this.model.get('items').each(function (child) { this.addChild(child, this.model.get('items')) }.bind(this))\r\n\r\n if (this.onRender) {\r\n this.onRender()\r\n }\r\n\r\n return this\r\n },\r\n\r\n addChild: function (child, collection) {\r\n if (!this.$infinity) {\r\n return\r\n }\r\n /* eslint-disable new-cap */\r\n var childView = new this.childView({model: child, collection: collection})\r\n /* eslint-enable new-cap */\r\n\r\n // Forward events from children onto the container\r\n childView.on('all', function (triggerName) {\r\n console.log('ListContainer forwarding from child', triggerName)\r\n this.trigger.apply(this, arguments)\r\n }.bind(this))\r\n\r\n this.$infinity.append(childView.render().$el)\r\n childView.delegateEvents()\r\n },\r\n\r\n // The generic function for a position of an inline alert\r\n showChildView: function (childView, $lineItem, markActive) {\r\n this.collapse()\r\n\r\n var $infinity = this.$('.infinity')\r\n var $childView = childView.render().$el\r\n\r\n var lineItemBottom = $lineItem.height() + $lineItem.position().top\r\n var infinityHeight = $infinity.height()\r\n\r\n $childView.css({display: 'none', top: lineItemBottom})\r\n $infinity.append($childView)\r\n childView.delegateEvents()\r\n\r\n var recalcBottomPadding = function () {\r\n var childViewHeight = $childView.height()\r\n var paddingBottom = (childViewHeight + lineItemBottom) - infinityHeight\r\n\r\n if (paddingBottom > 0) {\r\n $infinity.css({\r\n 'padding-bottom': paddingBottom\r\n })\r\n }\r\n }\r\n\r\n childView.on('heightChanged', recalcBottomPadding)\r\n childView.on('remove', this.collapse.bind(this))\r\n recalcBottomPadding()\r\n\r\n $childView.css({\r\n display: 'block'\r\n })\r\n\r\n if (markActive) $lineItem.addClass('active')\r\n\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', function () {\r\n $childView.remove()\r\n this.collapse()\r\n }.bind(this))\r\n\r\n $lineItem.ScrollTo()\r\n },\r\n\r\n showInlineConfirmationMessage: function ($lineItem, message, triggers, id, color, yesText, noText) {\r\n var confirm = new ConfirmWidget(\r\n message,\r\n color || 'warning'\r\n )\r\n\r\n confirm.addChoice(noText || 'No', 'cancel')\r\n confirm.on('cancel', this.collapse, this)\r\n\r\n if (triggers) {\r\n confirm.addChoice(yesText || 'Yes', 'proceed')\r\n confirm.on('proceed', function () {\r\n this.trigger(triggers, id)\r\n this.collapse()\r\n }, this)\r\n }\r\n\r\n this.showChildView(confirm.view, $lineItem, true)\r\n },\r\n\r\n showConfirmationMessage: function ($lineItem, message, triggers, id, color, yesText, noText) {\r\n var textForNo = noText ? noText : 'No'\r\n var textForYes = yesText ? yesText : 'Yes'\r\n\r\n if (!triggers) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: message,\r\n type: 'warning',\r\n showCancelButton: true,\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: textForNo\r\n })\r\n } else {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: message,\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: textForYes,\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: textForNo\r\n }).then(function () {\r\n this.trigger(triggers, id)\r\n }.bind(this))\r\n }\r\n },\r\n\r\n // The generic function to collapse an inline alert\r\n collapse: function () {\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n this.$('.update, .read, .confirm').remove()\r\n this.$('.infinity').attr('style', '')\r\n this.$('.itemrow.active').removeClass('active')\r\n }\r\n})\r\n\r\nmodule.exports = ListView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar RestClient = require('rest/client')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar GenericListsService = function () {\r\n this.restClient = new RestClient()\r\n this.companyService = new CompanyService()\r\n}\r\n\r\nGenericListsService.prototype.GetPath = function () {\r\n throw new Error('Not Implemented, you need to override in the GetPath method on the service. See lists/list/service.js for example.')\r\n}\r\n\r\nGenericListsService.prototype.GetQuery = function (queryObject) {\r\n queryObject = _.transform(queryObject, function (res, val, key) {\r\n if (val) {\r\n res[key] = val\r\n }\r\n })\r\n\r\n var query = $.param(queryObject)\r\n\r\n if (query) {\r\n return '?' + query\r\n } else {\r\n return false\r\n }\r\n}\r\n\r\nGenericListsService.prototype.getAll = function (page, pageSize, sort, sortField, search) {\r\n var apiPath = this.GetPath() + this.GetQuery({page: page, pageSize: pageSize, sort: sort, sortField: sortField, search: search})\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nGenericListsService.prototype.get = function (modelId) {\r\n var apiPath = this.GetPath(modelId)\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nGenericListsService.prototype.create = function (modelData) {\r\n var apiPath = this.GetPath()\r\n return this.restClient.post(apiPath, modelData)\r\n}\r\n\r\nGenericListsService.prototype.update = function (modelId, modelData) {\r\n var apiPath = this.GetPath(modelId)\r\n return this.restClient.put(apiPath, modelData)\r\n}\r\n\r\n// As a note, we can not use the word delete as it is a reserved word in ES5+.\r\nGenericListsService.prototype.remove = function (modelId) {\r\n var apiPath = this.GetPath(modelId)\r\n return this.restClient.del(apiPath)\r\n}\r\n\r\nGenericListsService.prototype.setStatus = function (modelId, status) {\r\n var apiPath = this.GetPath(modelId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nmodule.exports = GenericListsService\r\n","var Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar ListContainer = Backbone.View.extend({\r\n initialize: function () {\r\n this.on('reset', function () {\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n })\r\n this.on('createError', this.showErrorModal, this)\r\n this.on('updateFailed', this.showErrorModal, this)\r\n },\r\n\r\n forwardEvents: function (subject, blackList) {\r\n subject.on('all', function (triggerName) {\r\n if (blackList && blackList.indexOf(triggerName) !== -1) {\r\n return\r\n }\r\n this.trigger.apply(this, arguments)\r\n console.log('ListContainer forwarding', triggerName)\r\n }.bind(this))\r\n },\r\n \r\n showErrorModal: function (error) {\r\n $('.btn').prop('disabled', false)\r\n $('.save').prop('disabled', false)\r\n if (error.statusCode === 409) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: error.message,\r\n type: 'error',\r\n confirmButtonColor: '#19aea6'\r\n })\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = ListContainer\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar needsQueue = {}\r\n\r\nvar ListWidget = function () {\r\n var def = Q.defer()\r\n this.queue = def.promise\r\n def.resolve()\r\n\r\n _.each(needsQueue, function (callback, name) {\r\n if (this[name]) {\r\n if (typeof this[name] === 'function') {\r\n this[name] = this.wrapQueueCall(this[name])\r\n }\r\n } else {\r\n this[name] = this.wrapQueueCall(callback)\r\n }\r\n }.bind(this))\r\n\r\n // Check if there's a service\r\n if (!this.service) {\r\n throw new Error('service is not set on ListWidget. Used as the primary interface with the back end.')\r\n } else {\r\n // Check if the service conforms to what we're expecting\r\n if (!this.service.getAll) {\r\n console.warn('service on ListWidget expected to have getAll method, but does not exist.')\r\n throw new Error('service on ListWidget expected to have getAll method, but does not exist.')\r\n }\r\n if (!this.service.get) {\r\n console.warn('service on ListWidget expected to have get method, but does not exist.')\r\n throw new Error('service on ListWidget expected to have get method, but does not exist.')\r\n }\r\n if (!this.service.create) {\r\n console.warn('service on ListWidget expected to have create method, but does not exist.')\r\n throw new Error('service on ListWidget expected to have create method, but does not exist.')\r\n }\r\n if (!this.service.update) {\r\n console.warn('service on ListWidget expected to have update method, but does not exist.')\r\n throw new Error('service on ListWidget expected to have update method, but does not exist.')\r\n }\r\n\r\n // These are non critical features and are not required for a basic Create/Read/Update/List\r\n\r\n if (!this.service.remove) {\r\n console.warn('service on ListWidget does not have remove, functionality to perform the deleting of an object will not work as expected.')\r\n }\r\n if (!this.service.setStatus) {\r\n console.warn('service on ListWidget does not have setStatus, functionality to perform setting the status of an object will not work as expected.')\r\n }\r\n if (!this.service.setVoid) {\r\n console.warn('service on ListWidget does not have setVoid, functionality to perform the voiding of an object will not work as expected.')\r\n }\r\n }\r\n\r\n // Check if there's already a list view registered otherwise use our stock version\r\n if (!this.viewType) {\r\n console.warn('view not set on ListWidget. Used as the view for items to be displayed in the list.')\r\n throw new Error('view not set on ListWidget. Used as the view for items to be displayed in the list.')\r\n }\r\n // Check if there's a default model type and initialize it.\r\n if (!this.modelType) {\r\n console.warn('modelType not set on ListWidget. Used for containing collection of items, global states, etc.')\r\n throw new Error('modelType not set on ListWidget. Used for containing collection of items, global states, etc.')\r\n }\r\n // Instantiate the base model and view.\r\n /* eslint-disable new-cap */\r\n this.model = new this.modelType(this.arguments)\r\n this.view = new this.viewType({ model: this.model })\r\n /* eslint-enable new-cap */\r\n\r\n if (!this.model.get('items') || !this.model.add) throw new Error('modelType does not extend base list model and does not conform to expected methods and properties.')\r\n\r\n this.loadPage()\r\n\r\n this.model.on('reset', function () {\r\n this.view.trigger('reset')\r\n this.trigger('reset')\r\n this.loadPage()\r\n }.bind(this))\r\n\r\n this.view.on('create', this.create.bind(this))\r\n this.view.on('get', this.get.bind(this))\r\n this.view.on('edit', this.edit.bind(this))\r\n this.view.on('update', this.update.bind(this))\r\n this.view.on('confirmEnable', this.confirmEnable.bind(this))\r\n this.view.on('confirmDisable', this.confirmDisable.bind(this))\r\n this.view.on('confirmDelete', this.confirmDelete.bind(this))\r\n this.view.on('confirmVoid', this.confirmVoid.bind(this))\r\n this.view.on('loadMore', _.debounce(this.loadPage.bind(this), 250, {\r\n 'leading': true,\r\n 'trailing': false\r\n }))\r\n this.view.on('created updated statusUpdated itemDeleted itemVoided', this.reset.bind(this))\r\n this.on('create', this.create.bind(this))\r\n this.on('get', this.get.bind(this))\r\n this.on('edit', this.edit.bind(this))\r\n this.on('update', this.update.bind(this))\r\n this.on('confirmEnable', this.confirmEnable.bind(this))\r\n this.on('confirmDisable', this.confirmDisable.bind(this))\r\n this.on('confirmDelete', this.confirmDelete.bind(this))\r\n this.on('confirmVoid', this.confirmVoid.bind(this))\r\n this.on('loadMore', _.debounce(this.loadPage.bind(this), 250, {\r\n 'leading': true,\r\n 'trailing': false\r\n }))\r\n this.on('created updated statusUpdated itemDeleted itemVoided', this.reset.bind(this))\r\n}\r\n\r\nListWidget.prototype = _.clone(Backbone.Events)\r\n\r\nListWidget.prototype.wrapQueueCall = function (callback) {\r\n return function () {\r\n var def = Q.defer()\r\n var args = arguments\r\n var stackSnapshot = new Error()\r\n this.queue = this.queue.then(function () {\r\n this.queue = this.queue.then(function () {\r\n var oldStack = stackSnapshot\r\n return callback.apply(this, args)\r\n }.bind(this)).catch(function (err) {\r\n console.error(err, err.stack)\r\n }).then(function () {\r\n def.resolve.apply(def, arguments)\r\n })\r\n }.bind(this))\r\n return def.promise\r\n }\r\n}\r\n\r\nListWidget.prototype.childModel = function (item) {\r\n // Convert the results to the proper models\r\n if (this.model.childModel) {\r\n if (this.model.childModel.parse) {\r\n return this.model.childModel.parse(item)\r\n } else {\r\n /* eslint-disable new-cap */\r\n return new this.model.childModel(item)\r\n /* eslint-enable new-cap */\r\n }\r\n } else {\r\n return item\r\n }\r\n}\r\n\r\nListWidget.prototype.reset = function () {\r\n this.model.reset()\r\n}\r\n\r\nListWidget.prototype.show = function () {\r\n return this.view.render().$el\r\n}\r\n\r\nneedsQueue.loadPage = function () {\r\n if (this.loadingMore || this.preventLoad) {\r\n return\r\n }\r\n\r\n this.loadingMore = true\r\n var currentPage = this.model.get('page')\r\n this.view.trigger('loadingPage', currentPage)\r\n this.model.trigger('loadingPage', currentPage)\r\n\r\n return this.service.getAll(currentPage, 100, this.model.get('sort'), this.model.get('sortField'), this.model.get('search')).then(function (result) {\r\n this.loadingMore = false\r\n\r\n if (result.collection.length) {\r\n this.model.set('page', currentPage + 1)\r\n } else {\r\n this.view.trigger('EOF')\r\n }\r\n\r\n this.model.set('sortField', result.sortField)\r\n this.model.set('sort', result.sort)\r\n this.model.add(_.map(result.collection, this.childModel.bind(this)))\r\n this.view.trigger('loadedPage', result.collection.length)\r\n this.model.trigger('loadedPage', result.collection.length)\r\n }.bind(this))\r\n}\r\n\r\nneedsQueue.create = function (model) {\r\n if (this.creating) {\r\n return\r\n }\r\n\r\n this.creating = true\r\n\r\n return this.service.create(model).then(function () {\r\n this.creating = false\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('created')\r\n this.view.trigger.apply(this.view, args)\r\n this.trigger.apply(this, args)\r\n this.view.trigger('onAfterCreate')\r\n }.bind(this), function (error) {\r\n this.creating = false\r\n console.error('Error creating:', error)\r\n this.view.trigger('createError', error)\r\n }.bind(this))\r\n}\r\n\r\nneedsQueue.get = function (modelId) {\r\n return this.service.get(modelId).then(function (item) {\r\n var model = this.childModel(item)\r\n this.view.trigger('details', model)\r\n }.bind(this))\r\n}\r\n\r\nneedsQueue.edit = function (modelId) {\r\n return this.service.get(modelId).then(function (item) {\r\n var model = this.childModel(item)\r\n this.view.trigger('editDetails', model)\r\n }.bind(this))\r\n}\r\n\r\nneedsQueue.update = function (modelId, model, shouldTriggerEvents) {\r\n var updatePromise = this.service.update(modelId, model)\r\n\r\n if (shouldTriggerEvents !== false) {\r\n return updatePromise.then(function (result) {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('updated')\r\n this.view.trigger.apply(this.view, args)\r\n this.view.trigger('onAfterUpdate')\r\n }.bind(this), function (err) {\r\n console.error(err)\r\n this.view.trigger('updateFailed', err)\r\n }.bind(this))\r\n }\r\n\r\n return updatePromise\r\n}\r\n\r\nneedsQueue.confirmEnable = function (modelId) {\r\n return this.service.setStatus(modelId, true).then(function (response) {\r\n this.trigger('statusUpdated', response)\r\n this.view.trigger('statusUpdated', modelId, true)\r\n }.bind(this))\r\n}\r\nneedsQueue.confirmDisable = function (modelId) {\r\n return this.service.setStatus(modelId, false).then(function (response) {\r\n this.trigger('statusUpdated', response)\r\n this.view.trigger('statusUpdated', modelId, false)\r\n }.bind(this), function (error) {\r\n this.trigger('statusUpdated', error)\r\n }.bind(this))\r\n}\r\nneedsQueue.confirmDelete = function (modelId) {\r\n return this.service.remove(modelId).then(function () {\r\n this.trigger('itemDeleted', modelId)\r\n this.view.trigger('itemDeleted', modelId)\r\n }.bind(this))\r\n}\r\nneedsQueue.confirmVoid = function (modelId) {\r\n return this.service.setVoid(modelId).then(function () {\r\n this.view.trigger('itemVoided', modelId)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = ListWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar ContactsWidget = require('lists/contacts/widget')\r\nvar CustomersWidget = require('lists/customers/widget')\r\nvar VendorsWidget = require('lists/vendors/widget')\r\nvar SalesTaxesWidget = require('lists/sales-taxes/widget')\r\nvar ItemsWidget = require('lists/sales-entry/widget')\r\nvar FixedAssetsWidget = require('lists/fixed-asset/widget')\r\n\r\nvar ListsRouter = Router.extend({\r\n routes: {\r\n 'lists/contacts': 'showContacts',\r\n 'lists/customers': 'showCustomers',\r\n 'lists/vendors': 'showVendors',\r\n 'lists/sales-tax-rates': 'showSalesTaxes',\r\n 'lists/sales-entries': 'showSalesItems',\r\n 'lists/fixed-assets': 'showFixedAssets',\r\n 'lists/checkbooks': 'showCheckbooks'\r\n },\r\n\r\n showContacts: function () {\r\n Backbone.trigger('app:showInFrame', new ContactsWidget())\r\n Backbone.trigger('app:updateTitle', 'Contacts', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Lists'}, {label: 'Contacts'}])\r\n },\r\n showCustomers: function () {\r\n Backbone.trigger('app:showInFrame', new CustomersWidget())\r\n Backbone.trigger('app:updateTitle', 'Customers', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Lists'}, {label: 'Customers'}])\r\n },\r\n showVendors: function () {\r\n Backbone.trigger('app:showInFrame', new VendorsWidget())\r\n Backbone.trigger('app:updateTitle', 'Vendors', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Lists'}, {label: 'Vendors'}])\r\n },\r\n showSalesTaxes: function () {\r\n Backbone.trigger('app:showInFrame', new SalesTaxesWidget())\r\n Backbone.trigger('app:updateTitle', 'Sales Tax Rates', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Lists'}, {label: 'Sales Tax Rates'}])\r\n },\r\n showSalesItems: function () {\r\n Backbone.trigger('app:showInFrame', new ItemsWidget())\r\n Backbone.trigger('app:updateTitle', 'Sales Items', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Lists'}, {label: 'Sales Items'}])\r\n },\r\n showFixedAssets: function () {\r\n Backbone.trigger('app:showInFrame', new FixedAssetsWidget())\r\n Backbone.trigger('app:updateTitle', 'Fixed Assets', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Lists'}, {label: 'Fixed Assets'}])\r\n }\r\n})\r\n\r\nmodule.exports = ListsRouter\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3>Add Sales Item</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <label class=\\\"avatar\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n <input type=\\\"file\\\" accept=\\\"image/*\\\" />\\r\\n </label>\\r\\n <div class=\\\"primary-info\\\">\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"maxLength\":\"20\",\"inputLabel\":\"Sales ID\",\"inputName\":\"saleEntryId\",\"inputId\":\"create-sales-entry-id\",\"wrapperClasses\":\"sales-entry-id-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Name\",\"inputName\":\"name\",\"inputId\":\"create-name\",\"wrapperClasses\":\"name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"accountNumberSearch\",\"inputId\":\"accountNumberSearch\",\"wrapperClasses\":\"account-number-search\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Description\",\"inputName\":\"accountNameSearch\",\"inputId\":\"accountNameSearch\",\"wrapperClasses\":\"name account-description-search\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"ledgerAccountId\\\" />\\r\\n </div>\\r\\n <div class=\\\"display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"index\":(depth0 != null ? depth0.index : depth0),\"inputClasses\":\"currency-field\",\"inputLabel\":\"Price\",\"inputName\":\"price\",\"inputId\":\"price\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side memo-info\\\">\\r\\n <div class=\\\"display-container flex\\\">\\r\\n <div class=\\\"form-group is-discountable\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Discountable</span>\\r\\n <input type=\\\"checkbox\\\" name=\\\"isDiscountable\\\" checked><span></span>\\r\\n </label>\\r\\n </div>\\r\\n <div class=\\\"form-group is-sales-tax-enabled\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Sales Tax</span>\\r\\n <input type=\\\"checkbox\\\" name=\\\"isSalesTaxEnabled\\\" checked><span></span>\\r\\n </label>\\r\\n </div>\\r\\n <div class=\\\"form-group is-excise-tax-enabled\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Excise Tax</span>\\r\\n <input type=\\\"checkbox\\\" name=\\\"isExciseTaxEnabled\\\" checked><span></span>\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group memo-container\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"create-memo\\\" name=\\\"notes\\\" rows=\\\"6\\\"></textarea>\\r\\n <label for=\\\"create-memo\\\">Memo</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"distribution contact-list\\\">\\r\\n <h3>Supplier</h3>\\r\\n <div class=\\\"line-item-container\\\">The sales item currently has no suppliers.</div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Supplier</button>\\r\\n <br>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Save Sales Item</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i\\r\\n class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Sales item must have a\\r\\n name.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('lists/sales-entry/create/template')\r\nvar SalesEntryLine = require('lists/vendors/common/line-item')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar numbro = require('numbro')\r\n\r\nvar valid = '<div class=\"bg-primary-lighter\" style=\"display: block;\"><i class=\"fa fa-check-circle fa-2x fa-inverse\"></i><span class=\"message\">Sales item is valid.</span></div>'\r\nvar invalid = '<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">Sales item must have a name.</span></div>'\r\nvar invalidWithoutAccount = '<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">Sales item must have an account.</span></div>'\r\n\r\nvar SalesCreateView = CreateView.extend({\r\n className: 'block create',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'change input[type=file]': 'selectFile',\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'click': 'expand',\r\n 'click .add-more-line-items': 'addVendor'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) {\r\n this.Template = Template\r\n }\r\n\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n this.on('resetInputs', function () {\r\n this.cachedAvatar = null\r\n }, this)\r\n this.on('bindAutocomplete', function () {\r\n this.render()\r\n }, this)\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n this.determineStatus()\r\n\r\n this.autoComplete(\r\n this.model.get('accountList'),\r\n 'accountNumber',\r\n this.$('input[name=accountNumberSearch]'),\r\n this.accountSelected.bind(this)\r\n )\r\n\r\n this.autoComplete(\r\n this.model.get('accountList'),\r\n 'accountName',\r\n this.$('input[name=accountNameSearch]'),\r\n this.accountSelected.bind(this)\r\n )\r\n },\r\n\r\n accountSelected: function (account) {\r\n this.$('input[name=ledgerAccountId]')\r\n .val(account.id)\r\n .closest('.floating')\r\n .addClass('open')\r\n this.$('input[name=accountNumberSearch]')\r\n .val(account.accountNumber)\r\n .closest('.floating')\r\n .addClass('open')\r\n this.$('input[name=accountNameSearch]')\r\n .val(account.accountName)\r\n .closest('.floating')\r\n .addClass('open')\r\n },\r\n\r\n vendorSelected: function ($vendorEntryContainer, selectedVendor) {\r\n $vendorEntryContainer.find('input[name=vendorPrintedName]')\r\n .val(selectedVendor['printedName'])\r\n .parent()\r\n .addClass('open')\r\n $vendorEntryContainer\r\n .find('input[name=vendorEmail]')\r\n .val(selectedVendor['email'])\r\n $vendorEntryContainer\r\n .find('input[name=vendorId]')\r\n .val(selectedVendor['vendorId'])\r\n $vendorEntryContainer\r\n .find('input[name=id]')\r\n .val(selectedVendor['id'])\r\n },\r\n\r\n addVendor: function () {\r\n var index = this.$('.line-item-container > div').length + 1\r\n\r\n if (index === 1) {\r\n this.$('.line-item-container').html('')\r\n }\r\n\r\n var $lineItem = $(SalesEntryLine({ index: index }))\r\n this.$('.line-item-container').append($lineItem)\r\n this.OneUI($lineItem)\r\n\r\n $lineItem.find('input').on('focusout', this.checkLineStatus.bind(this)).on('focusin', this.checkLineStatus.bind(this))\r\n\r\n if (index > 0) {\r\n $lineItem.find('.remove').on('click', function (e) {\r\n var parent = $lineItem.parent()\r\n\r\n $lineItem.remove()\r\n\r\n if (this.$('.line-item-container > div').length === 0) {\r\n parent.html('The sales item currently has no suppliers.')\r\n }\r\n }.bind(this))\r\n }\r\n\r\n this.autoComplete(\r\n _.filter(this.model.get('vendorList'), 'printedName'),\r\n 'printedName',\r\n $lineItem.find('input[name=vendorPrintedName]'),\r\n _.partial(this.vendorSelected, $lineItem).bind(this)\r\n )\r\n\r\n this.autoComplete(\r\n _.filter(this.model.get('vendorList'), 'vendorId'),\r\n 'vendorId',\r\n $lineItem.find('input[name=vendorId]'),\r\n _.partial(this.vendorSelected, $lineItem).bind(this)\r\n )\r\n\r\n this.autoComplete(\r\n _.filter(this.model.get('vendorList'), 'email'),\r\n 'email',\r\n $lineItem.find('input[name=vendorEmail]'),\r\n _.partial(this.vendorSelected, $lineItem).bind(this)\r\n )\r\n\r\n $lineItem.find('input:first').focus()\r\n this.trigger('lineItemAdded', $lineItem)\r\n return $lineItem\r\n },\r\n\r\n isValid: function () {\r\n return !!this.$('input[name=name]').val() && !!this.$('input[name=accountNumberSearch]').val() && !!this.$('input[name=accountNameSearch]').val()\r\n },\r\n\r\n determineStatus: function () {\r\n if (this.isValid()) {\r\n this.$('.status').html(valid)\r\n } else if (!this.$('input[name=name]').val()) {\r\n this.$('.status').html(invalid)\r\n } else if (!this.$('input[name=accountNumberSearch]').val() && !this.$('input[name=accountNameSearch]').val()) {\r\n this.$('.status').html(invalidWithoutAccount)\r\n }\r\n },\r\n\r\n // This is a method used by the base class when a form is submitted on this view\r\n toJSON: function () {\r\n var itemPicture = this.cachedAvatar\r\n var model = {\r\n itemPictureUpload: itemPicture\r\n }\r\n\r\n if (!this.isValid()) {\r\n throw new Error('The sales item needs to have at least one field filled in.')\r\n }\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n if ($el.hasClass('currency-field')) {\r\n elValue = numbro().unformat(elValue)\r\n }\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n model['vendors'] = _.filter(_.map(this.$('.vendor-item'), function (vendorItem) {\r\n var $vendorItem = this.$(vendorItem)\r\n var id = $vendorItem.find('input[name=id]').val()\r\n return {\r\n id: id\r\n }\r\n }), function (item) {\r\n return item.id\r\n })\r\n\r\n model.isActive = true\r\n return model\r\n },\r\n\r\n // Take the file and update the avatar display to display the image\r\n selectFile: function (e) {\r\n var avatar = _.first(e.target.files)\r\n\r\n if (!avatar) return console.warn('No image selected, leaving unchanged')\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (avatarFile) {\r\n this.$('.avatar').attr('style', 'background:url(\"' + avatarFile.target.result + '\") no-repeat center center;').attr('data-has-image', 'true')\r\n this.cachedAvatar = avatarFile.target.result\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(avatar)\r\n },\r\n\r\n checkLineStatus: function (e) {\r\n var hasValue = _.reduce(\r\n this.$('.line-item-container input').map(function (index, el) { return $(el).val() }),\r\n function (memo, value) {\r\n return memo || (!!value && value != '$')\r\n },\r\n false\r\n )\r\n\r\n if (hasValue || e.type == 'focusin') {\r\n this.$('.line-item-container').addClass('forceLabelsOpen')\r\n } else {\r\n this.$('.line-item-container').removeClass('forceLabelsOpen')\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = SalesCreateView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow flex error-row\\\">\\r\\n <div class=\\\"line-number\\\">\"\n + alias4(((helper = (helper = helpers.lineNumber || (depth0 != null ? depth0.lineNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lineNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"reason\\\">\"\n + alias4(((helper = (helper = helpers.reason || (depth0 != null ? depth0.reason : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reason\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block errors\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Sales Item Import Errors</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"line-number\\\">Line #</div>\\r\\n <div class=\\\"reason\\\">Error</div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.errors : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15 push-15-r\\\" name=\\\"completeReview\\\">Complete Review</button>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"import-button\\\">\\r\\n <button class=\\\"btn btn-primary pull-right push-30\\\" name=\\\"openImport\\\">Import</button>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block no-padding tabbed collapsed\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"own-template\\\" id=\\\"ownTemplate\\\">\\r\\n <div class=\\\"pull-right\\\"><i class=\\\"fa fa-close expanding-group-close cancel\\\"></i></div>\\r\\n <div class=\\\"steps\\\">\\r\\n <div class=\\\"step1\\\">\\r\\n <h3>Step 1: Download the outline</h3>\\r\\n <p><a href=\\\"http://get.crunched.help/hc/en-us/articles/236008907-How-to-import-sales-items\\\" target=\\\"_blank\\\">Click here</a> to download an import template. You can update this spreadsheet with your own data.</p>\\r\\n </div>\\r\\n <div class=\\\"step2\\\">\\r\\n <h3>Step 2: Upload your data</h3>\\r\\n <p>Once you've updated the outline and saved it, please upload it here to import your data.</p>\\r\\n <label>\\r\\n <span class=\\\"file-name\\\"></span>\\r\\n <span class=\\\"floating\\\">Upload File</span>\\r\\n <input type=\\\"file\\\" name=\\\"outlineUpload\\\">\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15-r push-15 importUpload\\\" name=\\\"upload\\\">Upload</button>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"import-message\\\">\\r\\n <span class=\\\"import-templates\\\">Add using templates</span>\\r\\n <span class=\\\"manually\\\">Add manually</span>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar CreateView = require('lists/list/create/view')\r\nvar Template = require('lists/sales-entry/import/template')\r\nvar ErrorTemplate = require('lists/sales-entry/import/error-template')\r\nvar HasSalesEntriesTemplate = require('lists/sales-entry/import/has-salesEntries')\r\nvar sweetAlert = require('sweetalert2')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar ScrollTo = require('jquery-scrollto')\r\n\r\nvar ListView = CreateView.extend({\r\n className: 'import',\r\n events: {\r\n 'change input[type=file]': 'changeFile',\r\n 'click button[name=upload]': 'uploadOwn',\r\n 'click button[name=completeReview]': 'completeReview',\r\n 'click button[name=openImport]': 'openImport',\r\n 'click .cancel': 'close'\r\n },\r\n initialize: function () {\r\n this.Template = Template\r\n this.listenTo(this.model, 'change:salesEntries', this.render)\r\n this.on('uploadErrors', this.uploadErrors, this)\r\n this.on('uploadSuccess', this.uploadSuccess, this)\r\n this.on('importFailed', this.importFailed, this)\r\n },\r\n render: function () {\r\n var TemplateToRender = (this.model.get('salesEntries').length && !this.forceOpen) ? HasSalesEntriesTemplate : Template\r\n this.$el.html(TemplateToRender(this.model.toViewModel()))\r\n\r\n if (this.onRender) {\r\n this.onRender()\r\n }\r\n\r\n return this\r\n },\r\n changeFile: function (e) {\r\n var salesEntrySpreadsheet = _.first(e.target.files)\r\n\r\n if (!salesEntrySpreadsheet) {\r\n return console.warn('No image selected, leaving unchanged')\r\n }\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (salesEntrySpreadsheetFile) {\r\n if (this.checkFileExtension(salesEntrySpreadsheet)) {\r\n this.cachedSalesEntrySpreadsheet = salesEntrySpreadsheetFile.target.result\r\n this.$('.file-name').text(salesEntrySpreadsheet.name)\r\n this.fileNameLabelStyling()\r\n }\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(salesEntrySpreadsheet)\r\n this.isValidFileExtension = this.checkFileExtension(salesEntrySpreadsheet)\r\n },\r\n // For Edge browser, to prevent an overraping text issue of text:file-name and a label.\r\n fileNameLabelStyling: function () {\r\n this.$('.floating').css({\r\n 'top': '-29px',\r\n 'font-weight': 600,\r\n 'font-size': '13px'\r\n })\r\n },\r\n checkFileExtension: function (selectedFile) {\r\n var validExts = new Array('.xlsx')\r\n var fileExt = selectedFile.name\r\n fileExt = fileExt.substring(fileExt.lastIndexOf('.')).toLowerCase()\r\n if (validExts.indexOf(fileExt) < 0) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'You can only upload Excel(*.xlsx) file.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n\r\n this.$('.file-name').text('')\r\n this.$('.floating').css({\r\n 'top': '-5px',\r\n 'font-weight': 400,\r\n 'font-size': '15px'\r\n })\r\n this.isValidFileExtension = false\r\n return false\r\n } else {\r\n this.isValidFileExtension = true\r\n return true\r\n }\r\n },\r\n uploadOwn: function () {\r\n if (this.validateFileType()) {\r\n this.upload(this.cachedSalesEntrySpreadsheet)\r\n // To prevent importing a previously uploaded or selected file while no file is selected for the second time\r\n this.cachedSalesEntrySpreadsheet = ''\r\n this.isValidFileExtension = false\r\n }\r\n },\r\n validateFileType: function () {\r\n if (this.isValidFileExtension) {\r\n var fileType = this.cachedSalesEntrySpreadsheet\r\n var xlsxMimeType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\r\n fileType = fileType.substring(fileType.lastIndexOf(':') + 1, fileType.lastIndexOf(';'))\r\n\r\n // if a selected file extension is correct by checking its name,\r\n // but if there is no reader or an application installed for the file type in the local machine,\r\n // OS will not recognize the file type. Hence, if the selected file type is valid, but the mime type is empty, we set the type manually.\r\n if (fileType === '' && this.isValidFileExtension || fileType !== xlsxMimeType && this.isValidFileExtension) {\r\n var index = this.cachedSalesEntrySpreadsheet.lastIndexOf(':') + 1\r\n if (fileType !== '') {\r\n // When there is no reader for the file, FireFox passes: \"application/octet-stream\"\r\n this.cachedSalesEntrySpreadsheet = this.cachedSalesEntrySpreadsheet.replace(fileType, '')\r\n }\r\n this.cachedSalesEntrySpreadsheet = this.insert(this.cachedSalesEntrySpreadsheet, index, xlsxMimeType)\r\n }\r\n\r\n var insertedMimeType = this.cachedSalesEntrySpreadsheet\r\n insertedMimeType = insertedMimeType.substring(insertedMimeType.lastIndexOf(':') + 1, insertedMimeType.lastIndexOf(';'))\r\n\r\n return (fileType === xlsxMimeType) || (fileType === '' && this.isValidFileExtension && insertedMimeType === xlsxMimeType) || (fileType !== xlsxMimeType && this.isValidFileExtension && insertedMimeType === xlsxMimeType)\r\n }\r\n },\r\n insert: function (str, index, value) {\r\n return str.substr(0, index) + value + str.substr(index)\r\n },\r\n upload: function (spreadsheet) {\r\n this.$('.importUpload').prop('disabled', true)\r\n this.trigger('upload', { import: spreadsheet })\r\n },\r\n btnEnable: function () {\r\n $('.importUpload').prop('disabled', false)\r\n },\r\n completeReview: function () {\r\n this.$('.errors').remove()\r\n\r\n $('.block[hidden-during-review], .import-message[hidden-during-review], .import-button[hidden-during-review]')\r\n .removeClass('hidden')\r\n .attr('hidden-during-review', null)\r\n\r\n $('.page-heading').ScrollTo()\r\n },\r\n uploadErrors: function (errors, successCount) {\r\n this.close()\r\n\r\n $('.block, .import-message, .import-button')\r\n .addClass('hidden')\r\n .attr('hidden-during-review', '1')\r\n\r\n this.$el.append(ErrorTemplate({ errors: errors }))\r\n var totalCount = errors.length + successCount\r\n\r\n if (!successCount) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: successCount + ' of ' + totalCount + ' sales items have been imported, some information couldn\\'t be parsed.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n } else {\r\n sweetAlert({\r\n title: 'Warning',\r\n text: successCount + ' of ' + totalCount + ' sales items have been imported, some information couldn\\'t be parsed.',\r\n type: 'warning',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n }\r\n },\r\n uploadSuccess: function (successCount) {\r\n this.close()\r\n\r\n sweetAlert({\r\n title: 'Success',\r\n text: successCount + ' of ' + successCount + ' sales items have been imported. Please set up your sales items assignments to get the most out of Crunched.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n importFailed: function (errorMessage) {\r\n this.close()\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Failed to import the sales items. ' + errorMessage,\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n openImport: function () {\r\n this.forceOpen = true\r\n this.$el.addClass('forced-open')\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.close.bind(this))\r\n this.render()\r\n },\r\n close: function () {\r\n this.forceOpen = false\r\n this.$el.removeClass('forced-open')\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n this.render()\r\n }\r\n})\r\n\r\nmodule.exports = ListView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar SalesEntryService = require('lists/sales-entry/service')\r\nvar SalesEntryImportView = require('lists/sales-entry/import/view')\r\n\r\nvar SalesEntryImportWidget = function () {\r\n this.salesEntryService = new SalesEntryService()\r\n this.model = new Backbone.Model({\r\n salesEntries: []\r\n })\r\n\r\n this.model.toViewModel = this.model.toJSON.bind(this.model)\r\n\r\n this.view = new SalesEntryImportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('upload', this.upload.bind(this))\r\n\r\n this.loadSalesEntry()\r\n}\r\n\r\nSalesEntryImportWidget.prototype = _.clone(Backbone.Events)\r\n\r\nSalesEntryImportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nSalesEntryImportWidget.prototype.loadSalesEntry = function () {\r\n return this.salesEntryService.getList().then(function (results) {\r\n this.model.set('salesEntries', results)\r\n }.bind(this))\r\n}\r\n\r\nSalesEntryImportWidget.prototype.upload = function (spreadsheet) {\r\n return this.salesEntryService.importSpreadsheet(spreadsheet).then(function (results) {\r\n return this.loadSalesEntry().then(function () {\r\n var errors = results.parseErrors\r\n var successCount = results.successCount\r\n\r\n this.once('refreshed', function () {\r\n if (errors.length) {\r\n this.view.trigger('uploadErrors', errors, successCount)\r\n } else {\r\n this.view.trigger('uploadSuccess', successCount)\r\n }\r\n }.bind(this))\r\n\r\n this.trigger('refresh')\r\n }.bind(this))\r\n }.bind(this), function (error){\r\n this.view.btnEnable() \r\n this.view.trigger('importFailed', error.message)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = SalesEntryImportWidget\r\n","'use strict'\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\nvar _ = require('lodash')\r\nvar numbro = require('numbro')\r\n\r\nvar SaleEntry = ListEntry.extend({\r\n defaults: {\r\n vendors: []\r\n }\r\n}, {\r\n parse: function (json) {\r\n return new SaleEntry({\r\n saleEntryId: json.saleEntryId,\r\n id: json.id,\r\n name: json.name,\r\n itemPicture: json.itemPicture,\r\n notes: json.notes,\r\n isDiscountable: !!json.isDiscountable,\r\n isSalesTaxEnabled: !!json.isSalesTaxEnabled,\r\n isExciseTaxEnabled: !!json.isExciseTaxEnabled,\r\n isActive: !!json.isActive,\r\n price: json.price,\r\n priceText: numbro(Number(json.price)).formatCurrency('$0,0.00'),\r\n vendors: _.map(json.vendors, function (contact) {\r\n return contact\r\n }),\r\n ledgerAccountId: json.ledgerAccountId\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = SaleEntry\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"<i class=\\\"fa fa-check\\\"></i>\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \"<i class=\\\"fa fa-times\\\"></i>\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \"<i\\r\\n class=\\\"fa fa-times\\\"></i>\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-unlock-alt pull-right disable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"9\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-lock pull-right enable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"entryId\\\">\"\n + alias4(((helper = (helper = helpers.saleEntryId || (depth0 != null ? depth0.saleEntryId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"saleEntryId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"name\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"price currency\\\">\"\n + alias4(((helper = (helper = helpers.priceText || (depth0 != null ? depth0.priceText : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"priceText\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"is-discountable\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isDiscountable : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n</div>\\r\\n<div class=\\\"is-sales-tax-enabled\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isSalesTaxEnabled : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(5, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n<div class=\\\"is-excise-tax-enabled\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isExciseTaxEnabled : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(5, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n <a class=\\\"fa fa-trash-o pull-right remove\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isActive : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.program(9, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('lists/sales-entry/item/template')\r\n\r\nvar CustomersView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n if (!this.model.get('isActive')) this.$el.addClass('notActive')\r\n }\r\n})\r\n\r\nmodule.exports = CustomersView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"saleEntryId-sort\"] || (depth0 != null ? depth0[\"saleEntryId-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"saleEntryId-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"name-sort\"] || (depth0 != null ? depth0[\"name-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"name-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Sales Items</h3>\\r\\n <i class=\\\"fa fa-close pull-right clear-search-box\\\"></i>\\r\\n <input type=\\\"text\\\" class=\\\"pull-right search-box\\\" placeholder=\\\"Search...\\\" value=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.search || (depth0 != null ? depth0.search : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"search\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" />\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"entryId\\\">Sales ID <i data-sort-field=\\\"saleEntryId\\\"\\r\\n class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"saleEntryId-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"name\\\">Item Name <i data-sort-field=\\\"name\\\"\\r\\n class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"name-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"price currency\\\">Price</div>\\r\\n <div class=\\\"is-discountable\\\">Discountable</div>\\r\\n <div class=\\\"is-sales-tax-enabled\\\">Sales Tax</div>\\r\\n <div class=\\\"is-excise-tax-enabled\\\">Excise Tax</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\">\\r\\n <p class=\\\"center\\\">Loading more sales items...</p>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('lists/sales-entry/list/template')\r\nvar CustomerView = require('lists/sales-entry/item/view')\r\nvar DetailsView = require('lists/sales-entry/read/view')\r\nvar UpdateView = require('lists/sales-entry/update/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\nvar SalesListView = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort',\r\n 'keyup .search-box': 'searchList',\r\n 'click .clear-search-box': 'clearSearch'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = CustomerView\r\n this.model.set('search', '')\r\n this.model.set('sort', 'asc')\r\n this.model.set('sortField', 'saleEntryId')\r\n this.model.set('saleEntryId-sort', 'asc')\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.on('showDetails', this.showDetails.bind(this))\r\n this.on('showEdit', this.showEdit.bind(this))\r\n this.on('enable', this.showEnable.bind(this))\r\n this.on('disable', this.showDisable.bind(this))\r\n this.on('delete', this.showDelete.bind(this))\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more sales items...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more sales items.')\r\n },\r\n\r\n showDetails: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n var details = new DetailsView({ model: model })\r\n\r\n // View to show beneath $lineItem, and if the 'active' class should be added to $lineItem's classes\r\n this.showChildView(details, $lineItem, true)\r\n },\r\n\r\n showEdit: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n\r\n model.set('vendorList', this.model.get('vendorList'))\r\n model.set('accountList', this.model.get('accountList'))\r\n\r\n var update = new UpdateView({ model: model })\r\n update.on('update', function () {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('update')\r\n this.trigger.apply(this, args)\r\n }, this)\r\n\r\n this.showChildView(update, $lineItem, false)\r\n },\r\n\r\n showEnable: function (saleEntryId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + saleEntryId + '\"]'), 'Are you sure you want to enable this sales item?', 'confirmEnable', saleEntryId)\r\n },\r\n\r\n showDisable: function (saleEntryId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + saleEntryId + '\"]'), 'Are you sure you want to disable this sales item?', 'confirmDisable', saleEntryId)\r\n },\r\n\r\n showDelete: function (saleEntryId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + saleEntryId + '\"]'), 'Are you sure you want to delete this sales item?', 'confirmDelete', saleEntryId)\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.unset('saleEntryId-sort')\r\n this.model.unset('name-sort')\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, { silent: true })\r\n\r\n this.model.reset()\r\n },\r\n\r\n searchList: function (e) {\r\n if (e.which === 13) {\r\n var $currentTarget = $(e.currentTarget)\r\n\r\n this.model.set({\r\n page: 1,\r\n search: $currentTarget.val()\r\n }, { silent: true })\r\n\r\n this.model.reset()\r\n }\r\n },\r\n\r\n clearSearch: function (e) {\r\n var $sibiling = $(e.currentTarget).parent().children('.search-box')\r\n\r\n if ($sibiling.val() === '') {\r\n return\r\n }\r\n\r\n $sibiling.val('')\r\n\r\n if (this.model.get('search') === '') {\r\n return\r\n }\r\n\r\n this.model.set({\r\n page: 1,\r\n search: ''\r\n }, { silent: true })\r\n\r\n this.model.reset()\r\n }\r\n})\r\n\r\nmodule.exports = SalesListView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"data-has-image\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \"<i class=\\\"fa fa-check\\\"></i>\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \"<i class=\\\"fa fa-times\\\"></i>\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div class=\\\"col-xs-12 distribution\\\">\\r\\n <h3>Suppliers</h3>\\r\\n <div class=\\\"line-item-container view-container col-xs-12 no-padding\\\">\\r\\n <div class=\\\"distribution col-xs-12 no-padding vendor-header flex\\\">\\r\\n <div class=\\\"col-xs-2 accountNumber\\\"><b>Id</b></div>\\r\\n <div class=\\\"col-xs-2 accountName\\\"><b>Printed Name</b></div>\\r\\n <div class=\\\"col-xs-2 details\\\"><b>Email</b></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.vendors : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"distribution col-xs-12 form-group no-padding vendor-item flex\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"col-xs-2\\\">\"\n + alias4(((helper = (helper = helpers.vendorId || (depth0 != null ? depth0.vendorId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"vendorId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-2\\\">\"\n + alias4(((helper = (helper = helpers.printedName || (depth0 != null ? depth0.printedName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"printedName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-2\\\">\"\n + alias4(((helper = (helper = helpers.email || (depth0 != null ? depth0.email : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"email\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <div class=\\\"avatar\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.itemPicture : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" data-no-op\\r\\n style=\\\"background:url('\"\n + ((stack1 = ((helper = (helper = helpers.itemPicture || (depth0 != null ? depth0.itemPicture : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"itemPicture\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"') no-repeat center center;\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"primary-info\\\">\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"form-group sales-entry-id-container\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Sales ID</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.saleEntryId || (depth0 != null ? depth0.saleEntryId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"saleEntryId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group name\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Name</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"flex price-container\\\">\\r\\n <div class=\\\"form-group printed-name\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Price</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.priceText || (depth0 != null ? depth0.priceText : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"priceText\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side memo-info\\\">\\r\\n <div class=\\\"display-container flex\\\">\\r\\n <div class=\\\"is-discountable\\\">\\r\\n <span>Discountable</span>\\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isDiscountable : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(5, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n </div>\\r\\n <div class=\\\"is-sales-tax-enabled\\\">\\r\\n <span>Sales Tax</span>\\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isSalesTaxEnabled : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(5, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n </div>\\r\\n <div class=\\\"is-excise-tax-enabled\\\">\\r\\n <span>Excise Tax</span>\\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isExciseTaxEnabled : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(5, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group memo-container\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Memo</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"notes\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.vendors : depth0)) != null ? stack1.length : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </form>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var Backbone = require('backbone')\r\nvar Template = require('lists/sales-entry/read/template')\r\n\r\nvar ReadView = Backbone.View.extend({\r\n className: 'block read has-animation fadeInDown expanded',\r\n\r\n attributes: function () {\r\n return {\r\n 'data-id': this.model.id\r\n }\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.model.toViewModel()))\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = ReadView\r\n","'use strict'\r\n\r\nvar Customer = require('lists/sales-entry/item/sale-entry')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar Customers = ListWrapper.extend({\r\n childModel: Customer\r\n})\r\n\r\nmodule.exports = Customers\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar SalesEntryService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nSalesEntryService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nSalesEntryService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'sales-entries'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nSalesEntryService.prototype.getList = function () {\r\n var apiPath = this.GetPath('list')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nSalesEntryService.prototype.setStatus = function (customerId, status) {\r\n var apiPath = this.GetPath(customerId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nSalesEntryService.prototype.importSpreadsheet = function (spreadsheet) {\r\n var apiPath = this.GetPath('import')\r\n return this.restClient.post(apiPath, spreadsheet)\r\n}\r\n\r\nmodule.exports = SalesEntryService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"data-has-image\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right cancel\\\"></i>\\r\\n <h3>Edit Sales Item</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <label class=\\\"avatar\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.itemPicture : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n style=\\\"background:url('\"\n + ((stack1 = ((helper = (helper = helpers.itemPicture || (depth0 != null ? depth0.itemPicture : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"itemPicture\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"') no-repeat center center;\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n <input type=\\\"file\\\" accept=\\\"image/*\\\" />\\r\\n </label>\\r\\n <div class=\\\"primary-info\\\">\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"maxLength\":\"20\",\"inputLabel\":\"Sales ID\",\"inputName\":\"saleEntryId\",\"inputId\":\"update-sales-entry-id\",\"wrapperClasses\":\"sales-entry-id-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Name\",\"inputName\":\"name\",\"inputId\":\"update-name\",\"wrapperClasses\":\"name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"accountNumberSearch\",\"inputId\":\"accountNumberSearch\",\"wrapperClasses\":\"account-number-search\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Description\",\"inputName\":\"accountNameSearch\",\"inputId\":\"accountNameSearch\",\"wrapperClasses\":\"name account-description-search\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"ledgerAccountId\\\" />\\r\\n </div>\\r\\n <div class=\\\"display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"index\":(depth0 != null ? depth0.index : depth0),\"inputClasses\":\"currency-field\",\"inputLabel\":\"Price\",\"inputName\":\"price\",\"inputId\":\"price\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side memo-info\\\">\\r\\n <div class=\\\"display-container flex\\\">\\r\\n <div class=\\\"form-group is-discountable\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Discountable</span>\\r\\n <input type=\\\"checkbox\\\" name=\\\"isDiscountable\\\" checked><span></span>\\r\\n </label>\\r\\n </div>\\r\\n <div class=\\\"form-group is-sales-tax-enabled\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Sales Tax</span>\\r\\n <input type=\\\"checkbox\\\" name=\\\"isSalesTaxEnabled\\\" checked><span></span>\\r\\n </label>\\r\\n </div>\\r\\n <div class=\\\"form-group is-excise-tax-enabled\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Excise Tax</span>\\r\\n <input type=\\\"checkbox\\\" name=\\\"isExciseTaxEnabled\\\" checked><span></span>\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group memo-container\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"update-memo\\\" name=\\\"notes\\\" rows=\\\"8\\\"></textarea>\\r\\n <label for=\\\"update-memo\\\">Memo</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"distribution contact-list\\\">\\r\\n <h3>Supplier</h3>\\r\\n <div class=\\\"line-item-container\\\">The sales item currently has no suppliers.</div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Supplier</button>\\r\\n <br>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Update Sales Item</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i\\r\\n class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Sales item must have a\\r\\n name.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/sales-entry/create/view')\r\nvar Template = require('lists/sales-entry/update/template')\r\nvar _ = require('lodash')\r\n\r\nvar UpdateView = CreateView.extend({\r\n className: 'block update expanded has-animation fadeInDown',\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n // Fill in inputs with our data\r\n var model = this.model.toViewModel()\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else {\r\n $el.val(model[$el.attr('name')])\r\n }\r\n })\r\n\r\n if (this.model.get('account')) {\r\n this.accountSelected(this.model.get('account'))\r\n }\r\n\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n\r\n // Remove empty customer line from the create side\r\n this.$('.create-customer-method').remove()\r\n\r\n // Add customer lines with our data\r\n _.forEach(model['vendors'], function (vendor) {\r\n var $vendorLine = this.addVendor()\r\n $vendorLine.find('input[name=id]').val(vendor.id)\r\n $vendorLine.find('input[name=vendorId]').val(vendor.vendorId)\r\n $vendorLine.find('input[name=vendorPrintedName]').val(vendor.printedName)\r\n $vendorLine.find('input[name=vendorEmail]').val(vendor.email)\r\n }.bind(this))\r\n }\r\n})\r\n\r\nmodule.exports = UpdateView\r\n","var ListContainer = require('lists/list/view')\r\nvar ListView = require('lists/sales-entry/list/view')\r\nvar CreateView = require('lists/sales-entry/create/view')\r\nvar ImportWidget = require('lists/sales-entry/import/widget')\r\n\r\nvar CustomersView = ListContainer.extend({\r\n className: 'sales-item list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n this.listView = new ListView({ model: this.model })\r\n this.forwardEvents(this.listView)\r\n\r\n this.createView = new CreateView({ model: this.model })\r\n this.forwardEvents(this.createView)\r\n\r\n this.importWidget = new ImportWidget()\r\n\r\n this.importWidget.on('refresh', function () {\r\n this.trigger('refresh', this.importWidget.trigger.bind(this.importWidget, 'refreshed'))\r\n }.bind(this))\r\n\r\n this.on('created', function () {\r\n this.createView.trigger('resetInputs')\r\n }.bind(this))\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n console.log('container -> editDetails')\r\n this.trigger('resolveDependencies', model, 'editDependenciesResolved')\r\n }.bind(this))\r\n\r\n this.on('editDependenciesResolved', function (model) {\r\n this.listView.trigger('showEdit', model)\r\n })\r\n\r\n this.on('widgetShown', function () {\r\n this.listView.trigger('bindScroll')\r\n this.createView.trigger('bindAutocomplete')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n\r\n this.$el.append(this.importWidget.show())\r\n this.$el.append(this.createView.render().$el)\r\n this.$el.append(this.listView.render().$el)\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = CustomersView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar SaleEntries = require('lists/sales-entry/sale-entries')\r\nvar Service = require('lists/sales-entry/service')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar VendorService = require('lists/vendors/service')\r\nvar ListContainer = require('lists/sales-entry/view')\r\n\r\nvar SaleEntriesWidget = function () {\r\n this.service = new Service()\r\n this.vendorService = new VendorService()\r\n this.accountService = new AccountService()\r\n this.modelType = SaleEntries\r\n this.viewType = ListContainer\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n\r\n this.view.on('resolveDependencies', this.resolveDependencies, this)\r\n this.view.on('refresh', this.refresh, this)\r\n this.view.on('refresh', this.reset, this)\r\n\r\n this.on('shown', function () {\r\n this.readyPromise = Q.all(\r\n this.accountService.fetchAccounts().then(function (accounts) {\r\n this.model.set('accountList', _.map(accounts, function (account) {\r\n return account.toJSON()\r\n }))\r\n this.model.set('accountLookup', _.keyBy(this.model.get('accountList'), 'id'))\r\n return accounts\r\n }.bind(this)),\r\n this.vendorService.getList().then(function (results) {\r\n this.model.set('vendorList', _.map(results, function (vendor) {\r\n vendor['fullName'] = vendor.firstName + ' ' + vendor.lastName\r\n return vendor\r\n }))\r\n return results\r\n }.bind(this))\r\n ).then(function () {\r\n this.view.trigger('widgetShown')\r\n }.bind(this), function (err) {\r\n console.error(err)\r\n })\r\n }.bind(this))\r\n}\r\n\r\nSaleEntriesWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nSaleEntriesWidget.prototype.resolveDependencies = function (model, triggers) {\r\n this.readyPromise.then(function () {\r\n model.set('account', this.model.get('accountLookup')[model.get('ledgerAccountId')])\r\n this.view.trigger(triggers, model)\r\n }.bind(this))\r\n}\r\n\r\nSaleEntriesWidget.prototype.refresh = function (callback) {\r\n var result = this.service.getList().then(function (results) {\r\n this.model.set('salesEntries', results)\r\n }.bind(this))\r\n \r\n if (callback) {\r\n return result.then(callback)\r\n } else {\r\n return result\r\n }\r\n}\r\n\r\nmodule.exports = SaleEntriesWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3>Add New Sales Tax Rate</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <div class=\\\"primary-info\\\">\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"maxLength\":\"20\",\"inputLabel\":\"Rate ID\",\"inputName\":\"rateId\",\"inputId\":\"create-rateId\",\"wrapperClasses\":\"rate-id-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Tax %\",\"inputName\":\"taxRate\",\"inputId\":\"create-taxRate\",\"wrapperClasses\":\"tax-rate-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group frequency-container\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"create-frequency\\\" name=\\\"frequency\\\" size=\\\"1\\\" style=\\\"height: 35px;\\\">\\r\\n <option value=\\\"1\\\">Monthly</option>\\r\\n <option value=\\\"2\\\">Quarterly</option>\\r\\n <option value=\\\"3\\\">Yearly</option>\\r\\n </select>\\r\\n <label for=\\\"create-frequency\\\">Frequency</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"ledgerAccountId\\\" class=\\\"ledgerAccountId\\\" />\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"AccountNumber\",\"inputId\":\"create-account-number\",\"wrapperClasses\":\"account-number-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Name\",\"inputName\":\"AccountName\",\"inputId\":\"create-account-name\",\"wrapperClasses\":\"account-name-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side notes-info\\\">\\r\\n <div class=\\\"form-group notes-container\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"create-description\\\" name=\\\"description\\\" rows=\\\"1\\\"></textarea>\\r\\n <label for=\\\"create-description\\\">Description</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"distribution\\\">\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Save Sales Tax</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Sales Taxes must have a rate.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('lists/sales-taxes/create/template')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\n\r\nvar valid = $('<div class=\"bg-primary-lighter\" style=\"display: block;\"><i class=\"fa fa-check-circle fa-2x fa-inverse\"></i><span class=\"message\">Sales Tax Rate is valid.</span></div>')\r\nvar invalid = $('<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">Sales Tax Rate requires all fields, except description.</span></div>')\r\n\r\nvar SalesTaxesView = CreateView.extend({\r\n accountAutoComplete: function (name, $autocomplete, $accountNumber, $accountName) {\r\n this.autoComplete(\r\n _.filter(_.map(this.model.get('accountList'), function (account) {\r\n return account.toJSON()\r\n }), {status: true}),\r\n name,\r\n $autocomplete,\r\n this.accountSelectedCallback.bind(this, $accountNumber, $accountName)\r\n )\r\n },\r\n\r\n accountSelectedCallback: function ($accountNumber, $accountName, account) {\r\n $accountNumber\r\n .val(account.accountNumber)\r\n .parent()\r\n .addClass('open')\r\n $accountName\r\n .val(account.accountName)\r\n .parent()\r\n .addClass('open')\r\n\r\n var $salesTaxContainer = $accountNumber.parent().parent().parent()\r\n $salesTaxContainer.find('.ledgerAccountId').val(account.id)\r\n this.determineStatus()\r\n },\r\n\r\n className: 'block create',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'change select': 'determineStatus',\r\n 'click': 'expand'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) this.Template = Template\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n this.model.on('change:accountList', this.render, this)\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n this.determineStatus()\r\n\r\n if (this.model.get('accountList')) {\r\n this.accountAutoComplete(\r\n 'accountNumber',\r\n this.$el.find('input[name=AccountNumber]'),\r\n this.$el.find('input[name=AccountNumber]'),\r\n this.$el.find('input[name=AccountName]')\r\n )\r\n\r\n this.accountAutoComplete(\r\n 'accountName',\r\n this.$el.find('input[name=AccountName]'),\r\n this.$el.find('input[name=AccountNumber]'),\r\n this.$el.find('input[name=AccountName]')\r\n )\r\n }\r\n },\r\n\r\n isValid: function () {\r\n return this.$('input[type=text], select').filter(function () { return this.value.length > 0 }).length === this.$('input[type=text], select').length\r\n },\r\n\r\n determineStatus: function () {\r\n if (this.isValid()) {\r\n this.$('.status').html(valid)\r\n } else {\r\n this.$('.status').html(invalid)\r\n }\r\n },\r\n\r\n // This is a method used by the base class when a form is submitted on this view\r\n toJSON: function () {\r\n var model = {}\r\n\r\n var hasValidInput = false\r\n\r\n _.each(this.$('.meta input, .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n if (!isCheckbox) {\r\n hasValidInput = hasValidInput || !!elValue\r\n }\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n if (!hasValidInput) throw new Error('The sales tax may not be empty')\r\n \r\n model.isActive = true\r\n return model\r\n }\r\n})\r\n\r\nmodule.exports = SalesTaxesView\r\n","'use strict'\r\n\r\nvar _ = require('underscore')\r\n\r\nvar Frequency = Object.freeze({\r\n Monthly: 1,\r\n Quarterly: 2,\r\n Yearly: 3\r\n})\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\n\r\nvar SalesTax = ListEntry.extend({\r\n toJSON: function () {\r\n return {\r\n rateId: this.get('rateId'),\r\n taxRate: this.get('taxRate'),\r\n description: this.get('description'),\r\n frequency: this.get('frequency'),\r\n isActive: this.get('isActive'),\r\n ledgerAccountId: this.get('ledgerAccountId')\r\n }\r\n }\r\n}, {\r\n Frequency: Frequency,\r\n parse: function (json) {\r\n return new SalesTax({\r\n rateId: json.rateId,\r\n taxRate: json.taxRate,\r\n description: json.description,\r\n frequency: json.frequency,\r\n isActive: !!json.isActive,\r\n ledgerAccountId: json.ledgerAccountId,\r\n id: json.id,\r\n taxFrequency: _.invert(Frequency)[json.frequency]\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = SalesTax\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-unlock-alt pull-right disable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-lock pull-right enable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"rateId\\\">\"\n + alias4(((helper = (helper = helpers.rateId || (depth0 != null ? depth0.rateId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"rateId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"taxRate\\\">\"\n + alias4(((helper = (helper = helpers.taxRate || (depth0 != null ? depth0.taxRate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"taxRate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"frequency\\\">\"\n + alias4(((helper = (helper = helpers.taxFrequency || (depth0 != null ? depth0.taxFrequency : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"taxFrequency\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"description\\\">\"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n <a class=\\\"fa fa-trash-o pull-right remove\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isActive : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('lists/sales-taxes/item/template')\r\n\r\nvar SalesTaxesView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n if (!this.model.get('isActive')) this.$el.addClass('notActive')\r\n }\r\n})\r\n\r\nmodule.exports = SalesTaxesView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"rateId-sort\"] || (depth0 != null ? depth0[\"rateId-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"rateId-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"taxRate-sort\"] || (depth0 != null ? depth0[\"taxRate-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"taxRate-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"frequency-sort\"] || (depth0 != null ? depth0[\"frequency-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"frequency-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Sales Tax Rates</h3>\\r\\n <i class=\\\"fa fa-close pull-right clear-search-box\\\"></i>\\r\\n <input type=\\\"text\\\" class=\\\"pull-right search-box\\\" placeholder=\\\"Search...\\\" value=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.search || (depth0 != null ? depth0.search : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"search\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" />\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"rateId\\\">ID <i data-sort-field=\\\"rateId\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"rateId-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"taxRate\\\">Tax % <i data-sort-field=\\\"taxRate\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"taxRate-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"frequency\\\">Frequency <i data-sort-field=\\\"frequency\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"frequency-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"description\\\">Description</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\"><p class=\\\"center\\\">Loading more sales tax rates...</p></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('lists/sales-taxes/list/template')\r\nvar CustomerView = require('lists/sales-taxes/item/view')\r\nvar DetailsView = require('lists/sales-taxes/read/view')\r\nvar UpdateView = require('lists/sales-taxes/update/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\n// TODO: Sorting\r\nvar SalesTaxesView = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort',\r\n 'keyup .search-box': 'searchList',\r\n 'click .clear-search-box': 'clearSearch'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = CustomerView\r\n this.model.set('search', '')\r\n this.model.set('sort', 'asc')\r\n this.model.set('sortField', 'rateId')\r\n this.model.set('rateId-sort', 'asc')\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.on('showDetails', this.showDetails.bind(this))\r\n this.on('showEdit', this.showEdit.bind(this))\r\n this.on('enable', this.showEnable.bind(this))\r\n this.on('disable', this.showDisable.bind(this))\r\n this.on('delete', this.showDelete.bind(this))\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more sales tax rates...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more sales tax rates.')\r\n },\r\n\r\n showDetails: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n\r\n var accounts = _.filter(this.model.get('accountList'), {'attributes': {status: true}})\r\n var accountLookup = _.keyBy(accounts, 'attributes.id')\r\n var account = accountLookup[model.get('ledgerAccountId')]\r\n\r\n model.set('accountNumber', account.get('accountNumber'))\r\n model.set('accountName', account.get('accountName'))\r\n\r\n var details = new DetailsView({model: model})\r\n\r\n // View to show beneath $lineItem, and if the 'active' class should be added to $lineItem's classes\r\n this.showChildView(details, $lineItem, true)\r\n },\r\n\r\n showEdit: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n model.set('accountList', this.model.get('accountList'))\r\n var update = new UpdateView({model: model})\r\n update.on('update', function () {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('update')\r\n this.trigger.apply(this, args)\r\n }, this)\r\n\r\n this.showChildView(update, $lineItem, false)\r\n },\r\n\r\n showEnable: function (rateId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + rateId + '\"]'), 'Are you sure you want to enable this sales tax rate?', 'confirmEnable', rateId)\r\n },\r\n\r\n showDisable: function (rateId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + rateId + '\"]'), 'Are you sure you want to disable this sales tax rate?', 'confirmDisable', rateId)\r\n },\r\n\r\n showDelete: function (rateId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + rateId + '\"]'), 'Are you sure you want to delete this sales tax rate?', 'confirmDelete', rateId)\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.unset('rateId-sort')\r\n this.model.unset('name-sort')\r\n this.model.unset('printedName-sort')\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n },\r\n\r\n searchList: function (e) {\r\n if (e.which === 13) {\r\n var $currentTarget = $(e.currentTarget)\r\n\r\n this.model.set({\r\n page: 1,\r\n search: $currentTarget.val()\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n }\r\n },\r\n\r\n clearSearch: function (e) {\r\n var $sibiling = $(e.currentTarget).parent().children('.search-box')\r\n\r\n if ($sibiling.val() === '') {\r\n return\r\n }\r\n\r\n $sibiling.val('')\r\n\r\n if (this.model.get('search') === '') {\r\n return\r\n }\r\n\r\n this.model.set({\r\n page: 1,\r\n search: ''\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n }\r\n})\r\n\r\nmodule.exports = SalesTaxesView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div class=\\\"distribution\\\">\\r\\n <h3>Contacts</h3>\\r\\n <div class=\\\"line-item-container view-container no-padding\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.contacts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"contact-item flex\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"form-group autocomplete contactId\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.contactId || (depth0 != null ? depth0.contactId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"contactId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n <label class=\\\"control-label\\\">Contact ID</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group autocomplete name\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.firstName || (depth0 != null ? depth0.firstName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"firstName\",\"hash\":{},\"data\":data}) : helper)))\n + \" \"\n + alias4(((helper = (helper = helpers.lastName || (depth0 != null ? depth0.lastName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lastName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n <label class=\\\"control-label\\\">Name</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group autocomplete address\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.addressLine1 || (depth0 != null ? depth0.addressLine1 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine1\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n <label class=\\\"control-label\\\">Address</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group autocomplete city\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.city || (depth0 != null ? depth0.city : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"city\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n <label class=\\\"control-label\\\">City</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group autocomplete state\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.state || (depth0 != null ? depth0.state : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"state\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n <label class=\\\"control-label\\\">State</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <div class=\\\"primary-info\\\">\\r\\n <div class=\\\"flex name-container\\\">\\r\\n <div class=\\\"form-group customer-id-container\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Rate ID</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.rateId || (depth0 != null ? depth0.rateId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"rateId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group name\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Tax Rate</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.taxRate || (depth0 != null ? depth0.taxRate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"taxRate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group name\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Frequency</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.taxFrequency || (depth0 != null ? depth0.taxFrequency : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"taxFrequency\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div> \\r\\n <div class=\\\"flex name-container\\\"> \\r\\n <div class=\\\"form-group email\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Account Number</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.accountNumber || (depth0 != null ? depth0.accountNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div> \\r\\n <div class=\\\"form-group printed-name\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Account Name</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.accountName || (depth0 != null ? depth0.accountName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side notes-info\\\"> \\r\\n <div class=\\\"form-group notes-container\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Description</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.contacts : depth0)) != null ? stack1.length : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </form>\\r\\n </div>\\r\\n</div>\\r\\n<div id=\\\"modalHolder\\\">\\r\\n <div class=\\\"modal list contacts\\\" id=\\\"readContactModal\\\" tabindex=\\\"-1\\\" role=\\\"dialog\\\" aria-hidden=\\\"true\\\" style=\\\"display: none;\\\">\\r\\n <div class=\\\"modal-dialog modal-lg\\\">\\r\\n <div class=\\\"modal-content block read has-animation fadeInDown expanded\\\">\\r\\n <div class=\\\"block block-themed block-transparent remove-margin-b\\\">\\r\\n <div class=\\\"block-header bg-primary\\\">\\r\\n <ul class=\\\"block-options\\\">\\r\\n <li>\\r\\n <button data-dismiss=\\\"modal\\\" type=\\\"button\\\"><i class=\\\"fa fa-times pull-right close\\\"></i></button>\\r\\n </li>\\r\\n </ul>\\r\\n <h3>View Contact</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\" id=\\\"readContactContainer\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"modal-footer\\\">\\r\\n <button class=\\\"btn btn-sm btn-primary\\\" type=\\\"button\\\" data-dismiss=\\\"modal\\\">Close</button>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var Backbone = require('backbone')\r\nvar Template = require('lists/sales-taxes/read/template')\r\n\r\n// TODO: Replace customer method drop down with static text instead of read only drop down\r\nvar ReadView = Backbone.View.extend({\r\n className: 'block read has-animation fadeInDown expanded',\r\n\r\n attributes: function () {\r\n return {\r\n 'data-id': this.model.id\r\n }\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.model.toViewModel()))\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = ReadView\r\n","'use strict'\r\n\r\nvar SalesTax = require('lists/sales-taxes/item/sales-tax')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar SalesTaxes = ListWrapper.extend({\r\n childModel: SalesTax\r\n})\r\n\r\n\r\nmodule.exports = SalesTaxes\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar SalesTaxesService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nSalesTaxesService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nSalesTaxesService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'sales-taxes'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nSalesTaxesService.prototype.getList = function () {\r\n var apiPath = this.GetPath('list')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nSalesTaxesService.prototype.setStatus = function (salesTaxId, status) {\r\n var apiPath = this.GetPath(salesTaxId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nmodule.exports = SalesTaxesService\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right cancel\\\"></i>\\r\\n <h3>Update Sales Tax Rate</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <div class=\\\"primary-info\\\">\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"maxLength\":\"20\",\"inputLabel\":\"Rate ID\",\"inputName\":\"rateId\",\"inputId\":\"update-rateId\",\"wrapperClasses\":\"rate-id-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Tax %\",\"inputName\":\"taxRate\",\"inputId\":\"update-taxRate\",\"wrapperClasses\":\"tax-rate-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group frequency-container\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"update-frequency\\\" name=\\\"frequency\\\" size=\\\"1\\\" style=\\\"height: 35px;\\\">\\r\\n <option value=\\\"1\\\">Monthly</option>\\r\\n <option value=\\\"2\\\">Quarterly</option>\\r\\n <option value=\\\"3\\\">Yearly</option>\\r\\n </select>\\r\\n <label for=\\\"update-frequency\\\">Frequency</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"flex display-container\\\"> \\r\\n <input type=\\\"hidden\\\" name=\\\"ledgerAccountId\\\" class=\\\"ledgerAccountId\\\" /> \\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"AccountNumber\",\"inputId\":\"update-account-number\",\"wrapperClasses\":\"account-number-container autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Name\",\"inputName\":\"AccountName\",\"inputId\":\"update-account-name\",\"wrapperClasses\":\"account-name-container autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side notes-info\\\"> \\r\\n <div class=\\\"form-group notes-container\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"update-description\\\" name=\\\"description\\\" rows=\\\"1\\\"></textarea>\\r\\n <label for=\\\"update-description\\\">Description</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"distribution\\\">\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Update Sales Tax</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Sales Taxes must have a rate.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/sales-taxes/create/view')\r\nvar Template = require('lists/sales-taxes/update/template')\r\nvar _ = require('lodash')\r\n\r\nvar UpdateView = CreateView.extend({\r\n className: 'block update expanded has-animation fadeInDown',\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n // Fill in inputs with our data\r\n var model = this.model.toViewModel()\r\n _.each(this.$('.meta input, .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else {\r\n $el.val(model[$el.attr('name')])\r\n }\r\n })\r\n\r\n var accounts = _.filter(this.model.get('accountList'), {'attributes': {status: true}})\r\n var accountLookup = _.keyBy(accounts, 'attributes.id')\r\n\r\n var account = accountLookup[this.model.get('ledgerAccountId')]\r\n\r\n this.$('.autocomplete input[name=AccountNumber]').val(account.get('accountNumber'))\r\n this.$('.autocomplete input[name=AccountName]').val(account.get('accountName'))\r\n\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n this.trigger('loadAutocomplete')\r\n }\r\n})\r\n\r\nmodule.exports = UpdateView\r\n","var ListContainer = require('lists/list/view')\r\nvar ListView = require('lists/sales-taxes/list/view')\r\nvar CreateView = require('lists/sales-taxes/create/view')\r\n\r\nvar SalesTaxesWidgetView = ListContainer.extend({\r\n className: 'sales-taxes list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n this.listView = new ListView({model: this.model})\r\n this.forwardEvents(this.listView)\r\n\r\n this.createView = new CreateView({model: this.model})\r\n this.forwardEvents(this.createView)\r\n\r\n this.on('created', function () {\r\n this.createView.trigger('resetInputs')\r\n }.bind(this))\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n console.log('container -> editDetails')\r\n this.listView.trigger('showEdit', model)\r\n }.bind(this))\r\n\r\n this.on('widgetShown', function () {\r\n this.listView.trigger('bindScroll')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n\r\n this.$el.append(this.createView.render().$el)\r\n this.$el.append(this.listView.render().$el)\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = SalesTaxesWidgetView\r\n","'use strict'\r\n\r\nvar _ = require('underscore')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar SalesTaxes = require('lists/sales-taxes/sales-taxes')\r\nvar Service = require('lists/sales-taxes/service')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar ListContainer = require('lists/sales-taxes/view')\r\n\r\nvar SalesTaxesWidget = function () {\r\n this.service = new Service()\r\n this.accountService = new AccountService()\r\n this.modelType = SalesTaxes\r\n this.viewType = ListContainer\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n\r\n this.on('shown', function () {\r\n this.accountService.fetchAccounts(false).then(function (accounts) {\r\n this.model.set('accountList', accounts)\r\n }.bind(this)).then(function () {\r\n this.view.trigger('widgetShown')\r\n }.bind(this))\r\n }.bind(this))\r\n}\r\n\r\nSalesTaxesWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nmodule.exports = SalesTaxesWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"vendor-item flex\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"id\\\" class=\\\"id\\\" />\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Id\",\"inputName\":\"vendorId\",\"inputId\":\"id\",\"wrapperClasses\":\"col-xs-2 autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"vendor-printed-name\",\"inputLabel\":\"Printed Name\",\"inputName\":\"vendorPrintedName\",\"wrapperClasses\":\"col-xs-5 autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"vendor-email\",\"inputLabel\":\"Email\",\"inputName\":\"vendorEmail\",\"wrapperClasses\":\"col-xs-5 autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <i class=\\\"fa fa-close remove\\\"></i>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3>Add New Vendor</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side address-info\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <label class=\\\"avatar\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n <input type=\\\"file\\\" accept=\\\"image/*\\\" />\\r\\n </label>\\r\\n <div class=\\\"primary-info\\\">\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"maxLength\":\"20\",\"inputLabel\":\"Vendor ID\",\"inputName\":\"vendorId\",\"inputId\":\"create-vendor-id\",\"wrapperClasses\":\"vendor-id-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Vendor Name\",\"inputName\":\"name\",\"inputId\":\"create-name\",\"wrapperClasses\":\"name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"form-group printed-name\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control \\\" type=\\\"text\\\" id=\\\"create-printed-name\\\" name=\\\"printedName\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"create-printed-name\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" data-original-title=\\\"The printed name is displayed on checks and invoices\\\"><img src=\\\"/img/question-circle.svg\\\" class=\\\"printed-name-tooltip\\\" alt=\\\"?\\\" /> Printed Name</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\"></span>\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Email\",\"inputName\":\"email\",\"inputId\":\"create-email-name\",\"wrapperClasses\":\"email\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 1\",\"inputName\":\"addressLine1\",\"inputId\":\"create-address-line1\",\"wrapperClasses\":\"address-line1-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 2\",\"inputName\":\"addressLine2\",\"inputId\":\"create-address-line2\",\"wrapperClasses\":\"address-line2-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"city-state\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"City\",\"inputName\":\"city\",\"inputId\":\"create-city\",\"wrapperClasses\":\"city\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group state\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"create-state\\\" name=\\\"state\\\" size=\\\"1\\\" style=\\\"height: 35px;\\\">\\r\\n <option></option>\\r\\n <option value=\\\"AL\\\">AL</option>\\r\\n <option value=\\\"AK\\\">AK</option>\\r\\n <option value=\\\"AZ\\\">AZ</option>\\r\\n <option value=\\\"AR\\\">AR</option>\\r\\n <option value=\\\"CA\\\">CA</option>\\r\\n <option value=\\\"CO\\\">CO</option>\\r\\n <option value=\\\"CT\\\">CT</option>\\r\\n <option value=\\\"DE\\\">DE</option>\\r\\n <option value=\\\"FL\\\">FL</option>\\r\\n <option value=\\\"GA\\\">GA</option>\\r\\n <option value=\\\"HI\\\">HI</option>\\r\\n <option value=\\\"ID\\\">ID</option>\\r\\n <option value=\\\"IL\\\">IL</option>\\r\\n <option value=\\\"IN\\\">IN</option>\\r\\n <option value=\\\"IA\\\">IA</option>\\r\\n <option value=\\\"KS\\\">KS</option>\\r\\n <option value=\\\"KY\\\">KY</option>\\r\\n <option value=\\\"LA\\\">LA</option>\\r\\n <option value=\\\"ME\\\">ME</option>\\r\\n <option value=\\\"MD\\\">MD</option>\\r\\n <option value=\\\"MA\\\">MA</option>\\r\\n <option value=\\\"MI\\\">MI</option>\\r\\n <option value=\\\"MN\\\">MN</option>\\r\\n <option value=\\\"MS\\\">MS</option>\\r\\n <option value=\\\"MO\\\">MO</option>\\r\\n <option value=\\\"MT\\\">MT</option>\\r\\n <option value=\\\"NE\\\">NE</option>\\r\\n <option value=\\\"NV\\\">NV</option>\\r\\n <option value=\\\"NH\\\">NH</option>\\r\\n <option value=\\\"NJ\\\">NJ</option>\\r\\n <option value=\\\"NM\\\">NM</option>\\r\\n <option value=\\\"NY\\\">NY</option>\\r\\n <option value=\\\"NC\\\">NC</option>\\r\\n <option value=\\\"ND\\\">ND</option>\\r\\n <option value=\\\"OH\\\">OH</option>\\r\\n <option value=\\\"OK\\\">OK</option>\\r\\n <option value=\\\"OR\\\">OR</option>\\r\\n <option value=\\\"PA\\\">PA</option>\\r\\n <option value=\\\"RI\\\">RI</option>\\r\\n <option value=\\\"SC\\\">SC</option>\\r\\n <option value=\\\"SD\\\">SD</option>\\r\\n <option value=\\\"TN\\\">TN</option>\\r\\n <option value=\\\"TX\\\">TX</option>\\r\\n <option value=\\\"UT\\\">UT</option>\\r\\n <option value=\\\"VT\\\">VT</option>\\r\\n <option value=\\\"VA\\\">VA</option>\\r\\n <option value=\\\"WA\\\">WA</option>\\r\\n <option value=\\\"WV\\\">WV</option>\\r\\n <option value=\\\"WI\\\">WI</option>\\r\\n <option value=\\\"WY\\\">WY</option>\\r\\n <option value=\\\"OTHER\\\">OTHER</option>\\r\\n </select>\\r\\n <label for=\\\"create-state\\\">State</label>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Zip Code\",\"inputName\":\"postalCode\",\"inputId\":\"create-zipcode\",\"wrapperClasses\":\"zipcode\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Telephone\",\"inputName\":\"telephoneOne\",\"inputId\":\"create-telephone-one\",\"wrapperClasses\":\"telephone-one-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Telephone 2\",\"inputName\":\"telephoneTwo\",\"inputId\":\"create-telephone-two\",\"wrapperClasses\":\"telephone-two-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side notes-info\\\">\\r\\n <div class=\\\"flex checkbox-container\\\">\\r\\n <div class=\\\"form-group is-supplier\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Supplier</span>\\r\\n <input type=\\\"checkbox\\\" name=\\\"isSupplier\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group notes-container\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"create-notes\\\" name=\\\"notes\\\" rows=\\\"14\\\"></textarea>\\r\\n <label for=\\\"create-notes\\\">Notes</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"distribution contact-list\\\">\\r\\n <h3>Contacts</h3>\\r\\n <div class=\\\"line-item-container\\\">The vendor currently has no contacts.</div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Contact</button>\\r\\n <br>\\r\\n <h3>Expense Distributions</h3>\\r\\n <div class=\\\"expense-line-item-container\\\">The vendor currently has no expense distributions.</div>\\r\\n <button class=\\\"clickable-button add-more-expense-line-items\\\" type=\\\"button\\\">+ Additional Expense Distribution</button>\\r\\n <br>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Save Vendor</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Vendors must have a first name.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('lists/vendors/create/template')\r\nvar ContactLine = require('lists/contacts/common/line-item')\r\nvar ExpenseDistributionLine = require('lists/vendors/expense-distribution-line-item')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar numbro = require('numbro')\r\n\r\nvar VendorsView = CreateView.extend({\r\n autocomplete: function (name, $autocomplete, $contactName) {\r\n var contacts = _.sortBy(this.model.get('contactList'), ['attributes' + name])\r\n\r\n var contactLookup = _.keyBy(contacts, 'id')\r\n\r\n var contactSelectedCallback = function (contactId) {\r\n var selectedContact = contactLookup[contactId]\r\n\r\n $contactName\r\n .val(selectedContact['fullName'])\r\n .parent()\r\n .addClass('open')\r\n\r\n var $contactContainer = $contactName.parent().parent().parent()\r\n $contactContainer.find('.contactId').val(selectedContact['id'])\r\n $contactContainer.find('.contactAddress').val(selectedContact['addressLine1']).parent().addClass('open')\r\n $contactContainer.find('.contactCity').val(selectedContact['city']).parent().addClass('open')\r\n $contactContainer.find('.contactState').val(selectedContact['state']).parent().addClass('open')\r\n }\r\n\r\n var getContactId = function () {\r\n var selectedItem = null\r\n\r\n if (!$autocomplete.val()) {\r\n return null\r\n }\r\n\r\n _.each(autocomplete.menu.element.find('li'), function (el) {\r\n var isMatching = $(el).text() === $autocomplete.val()\r\n if (isMatching && !selectedItem) {\r\n selectedItem = $(el)\r\n }\r\n })\r\n if (!selectedItem) {\r\n selectedItem = autocomplete.menu.element.find('li:first-child')\r\n }\r\n\r\n return selectedItem.attr('data-id')\r\n }\r\n\r\n var autocomplete = $.extend($autocomplete.autocomplete({\r\n source: _.map(contacts, function (contact) {\r\n return {\r\n label: contact[name],\r\n value: contact['id']\r\n }\r\n }),\r\n delay: 100,\r\n minLength: 0,\r\n appendTo: $('#main-container'),\r\n select: function (event, ui) {\r\n var contactId = ui.item.value\r\n contactSelectedCallback(contactId)\r\n event.preventDefault()\r\n },\r\n change: function (event, ui) {\r\n var contactId = getContactId()\r\n if (!contactId) {\r\n $contactName.val('').closest('.floating').removeClass('open')\r\n } else {\r\n contactSelectedCallback(contactId)\r\n event.preventDefault()\r\n }\r\n },\r\n focus: function (event, ui) {\r\n event.preventDefault()\r\n },\r\n open: function (event, ui) {\r\n autocomplete.menu.element.css({\r\n 'width': $autocomplete.outerWidth(),\r\n 'top': Number(autocomplete.menu.element.css('top').replace('px', '')) + 2\r\n })\r\n }\r\n }).on('focus', function () {\r\n $autocomplete.autocomplete('search', '')\r\n }).data('ui-autocomplete'), {\r\n _renderMenu: function (ul, items) {\r\n _.each(items, function (item) {\r\n var $listItem = this._renderItemData(ul, item)\r\n $listItem.attr('data-id', item.value)\r\n }.bind(this))\r\n },\r\n _resizeMenu: function () {\r\n this.menu.element.css({\r\n 'width': $autocomplete.outerWidth(),\r\n position: 'absolute'\r\n }).addClass('z-1')\r\n }\r\n })\r\n\r\n $autocomplete.on('keyup', function (e) {\r\n if (e.which === 13) {\r\n var contactId = getContactId()\r\n if (!contactId) {\r\n $contactName.val('').closest('.floating').removeClass('open')\r\n return\r\n } else {\r\n $autocomplete.autocomplete('instance')._trigger('select', 'autocompleteselect', {item: {value: contactId}})\r\n $autocomplete.autocomplete('close')\r\n }\r\n }\r\n })\r\n },\r\n\r\n expenseAutocomplete: function (name, $autocomplete, $accountNumber, $accountName) {\r\n var accounts = _.sortBy(_.filter(this.model.get('accountList'), {'attributes': {status: true}}), ['attributes' + name])\r\n\r\n var accountLookup = _.keyBy(accounts, 'attributes.id')\r\n\r\n var accountSelectedCallback = function (accountId) {\r\n $accountNumber\r\n .val(accountLookup[accountId].get('accountNumber'))\r\n .parent()\r\n .addClass('open')\r\n $accountName\r\n .val(accountLookup[accountId].get('accountName'))\r\n .parent()\r\n .addClass('open')\r\n\r\n var $contactContainer = $accountNumber.parent().parent().parent()\r\n $contactContainer.find('.accountId').val(accountId)\r\n this.$el.find('input[name=DefaultAmount]').focus()\r\n }.bind(this)\r\n\r\n var getAccountId = function () {\r\n var selectedItem = null\r\n\r\n if (!$autocomplete.val()) {\r\n return null\r\n }\r\n\r\n _.each(autocomplete.menu.element.find('li'), function (el) {\r\n var isMatching = $(el).text() === $autocomplete.val()\r\n if (isMatching && !selectedItem) {\r\n selectedItem = $(el)\r\n }\r\n })\r\n if (!selectedItem) {\r\n selectedItem = autocomplete.menu.element.find('li:first-child')\r\n }\r\n\r\n return selectedItem.attr('data-id')\r\n }\r\n\r\n var autocomplete = $.extend($autocomplete.autocomplete({\r\n source: _.map(accounts, function (account) {\r\n return {\r\n label: account.get(name),\r\n value: account.get('id')\r\n }\r\n }),\r\n delay: 100,\r\n minLength: 0,\r\n appendTo: $('#main-container'),\r\n select: function (event, ui) {\r\n var accountId = ui.item.value\r\n accountSelectedCallback(accountId)\r\n event.preventDefault()\r\n },\r\n change: function (event, ui) {\r\n var accountId = getAccountId()\r\n if (!accountId) {\r\n $accountName.val('').closest('.floating').removeClass('open')\r\n $accountNumber.val('').closest('.floating').removeClass('open')\r\n } else {\r\n accountSelectedCallback(accountId)\r\n event.preventDefault()\r\n }\r\n },\r\n focus: function (event, ui) {\r\n event.preventDefault()\r\n },\r\n open: function (event, ui) {\r\n autocomplete.menu.element.css({\r\n 'width': $autocomplete.outerWidth(),\r\n 'top': Number(autocomplete.menu.element.css('top').replace('px', '')) + 2\r\n })\r\n }\r\n }).on('focus', function () {\r\n $autocomplete.autocomplete('search', '')\r\n }).data('ui-autocomplete'), {\r\n _renderMenu: function (ul, items) {\r\n _.each(items, function (item) {\r\n var $listItem = this._renderItemData(ul, item)\r\n $listItem.attr('data-id', item.value)\r\n }.bind(this))\r\n },\r\n _resizeMenu: function () {\r\n this.menu.element.css({\r\n 'width': $autocomplete.outerWidth(),\r\n position: 'absolute'\r\n }).addClass('z-1')\r\n }\r\n })\r\n\r\n $autocomplete.on('keyup', function (e) {\r\n if (e.which === 13) {\r\n var accountId = getAccountId()\r\n if (!accountId) {\r\n $accountName.val('').closest('.floating').removeClass('open')\r\n $accountNumber.val('').closest('.floating').removeClass('open')\r\n return\r\n } else {\r\n $autocomplete.autocomplete('instance')._trigger('select', 'autocompleteselect', {item: {value: accountId}})\r\n $autocomplete.autocomplete('close')\r\n }\r\n }\r\n })\r\n },\r\n\r\n className: 'block create',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'change input[type=file]': 'selectFile',\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'click': 'expand',\r\n 'click .add-more-line-items': 'addContact',\r\n 'click .add-more-expense-line-items': 'addExpenseDistribution',\r\n 'change input[name=name]': 'updatedPrintedName'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) {\r\n this.Template = Template\r\n }\r\n\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n this.on('resetInputs', function () {\r\n this.cachedAvatar = null\r\n }, this)\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n this.determineStatus()\r\n },\r\n\r\n updatedPrintedName: function () {\r\n if (this.$('input[name=printedName]').val().length < 1) {\r\n this.$('input[name=printedName]')\r\n .val(this.$('input[name=name]').val())\r\n .parent()\r\n .addClass('open')\r\n }\r\n },\r\n\r\n addContact: function () {\r\n var index = this.$('.line-item-container > div').length + 1\r\n\r\n if (index === 1) {\r\n this.$('.line-item-container').html('')\r\n }\r\n\r\n var $lineItem = $(ContactLine({ index: index }))\r\n this.$('.line-item-container').append($lineItem)\r\n this.OneUI($lineItem)\r\n\r\n if (index > 0) {\r\n $lineItem.find('.remove').on('click', function (e) {\r\n var parent = $lineItem.parent()\r\n\r\n $lineItem.remove()\r\n\r\n if (this.$('.line-item-container > div').length === 0) {\r\n parent.html('The vendor currently has no contacts.')\r\n }\r\n }.bind(this))\r\n }\r\n\r\n this.autocomplete(\r\n 'fullName',\r\n $lineItem.find('input[name=ContactName]'),\r\n $lineItem.find('input[name=ContactName]')\r\n )\r\n\r\n $lineItem.find('input:first').focus()\r\n this.trigger('lineItemAdded', $lineItem)\r\n return $lineItem\r\n },\r\n\r\n addExpenseDistribution: function () {\r\n var index = this.$('.expense-line-item-container > div').length + 1\r\n\r\n if (index === 1) {\r\n this.$('.expense-line-item-container').html('')\r\n }\r\n\r\n var $lineItem = $(ExpenseDistributionLine({ index: index }))\r\n this.$('.expense-line-item-container').append($lineItem)\r\n this.OneUI($lineItem)\r\n\r\n if (index > 0) {\r\n $lineItem.find('.remove').on('click', function (e) {\r\n var parent = $lineItem.parent()\r\n\r\n $lineItem.remove()\r\n\r\n if (this.$('.expense-line-item-container > div') === 0) {\r\n parent.html('The vendor currently has no expense distributions.')\r\n }\r\n }.bind(this))\r\n }\r\n\r\n this.expenseAutocomplete(\r\n 'accountNumber',\r\n $lineItem.find('input[name=AccountNumber]'),\r\n $lineItem.find('input[name=AccountNumber]'),\r\n $lineItem.find('input[name=AccountName]')\r\n )\r\n\r\n this.expenseAutocomplete(\r\n 'accountName',\r\n $lineItem.find('input[name=AccountName]'),\r\n $lineItem.find('input[name=AccountNumber]'),\r\n $lineItem.find('input[name=AccountName]')\r\n )\r\n\r\n $lineItem.find('input:first').focus()\r\n this.trigger('expenseLineItemAdded', $lineItem)\r\n return $lineItem\r\n },\r\n\r\n isValid: function () {\r\n return this.$('input[name=printedName]').val().length && this.getExpenseDistributions().length\r\n },\r\n\r\n determineStatus: function () {\r\n var errorMessage\r\n if (this.isValid()) {\r\n this.$('.status').html(this.getSuccessStatusBar('Vendor is valid.'))\r\n } else if (!this.$('input[name=printedName]').val().length) {\r\n errorMessage = 'Vendor must have a printed name.'\r\n } else if (!this.getExpenseDistributions().length) {\r\n errorMessage = 'Vendor must have expense distributions'\r\n }\r\n\r\n if (errorMessage) {\r\n this.$('.status').html(this.getErrorStatusBar(errorMessage))\r\n }\r\n },\r\n\r\n // This is a method used by the base class when a form is submitted on this view\r\n toJSON: function () {\r\n var profilePicture = this.cachedAvatar\r\n var model = {\r\n profilePictureUpload: profilePicture\r\n }\r\n\r\n if (!this.$('input[name=printedName]').val().length) {\r\n throw new Error('The vendor must have a printed name')\r\n }\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n model['contacts'] = _.filter(_.map(this.$('.contact-item'), function (contactLine) {\r\n var $contactLine = this.$(contactLine)\r\n var id = $contactLine.find('input[name=contactId]').val()\r\n return {\r\n id: id\r\n }\r\n }), function (item) {\r\n return item.id\r\n })\r\n\r\n model.isActive = true\r\n model['expenseDistributions'] = this.getExpenseDistributions()\r\n\r\n return model\r\n },\r\n\r\n getExpenseDistributions: function () {\r\n return _.filter(_.map(this.$('.expense-distribution-item'), function (expenseLine) {\r\n var $expenseLine = this.$(expenseLine)\r\n return {\r\n ledgerAccountId: $expenseLine.find('input[name=accountId]').val(),\r\n details: $expenseLine.find('input[name=details]').val()\r\n }\r\n }), function (item) {\r\n return item.ledgerAccountId\r\n })\r\n },\r\n\r\n // Take the file and update the avatar display to display the image\r\n selectFile: function (e) {\r\n var avatar = _.first(e.target.files)\r\n\r\n if (!avatar) return console.warn('No image selected, leaving unchanged')\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (avatarFile) {\r\n this.$('.avatar').attr('style', 'background:url(\"' + avatarFile.target.result + '\") no-repeat center center;').attr('data-has-image', 'true')\r\n this.cachedAvatar = avatarFile.target.result\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(avatar)\r\n }\r\n})\r\n\r\nmodule.exports = VendorsView\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"expense-distribution-item flex\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"accountId\\\" class=\\\"accountId\\\" />\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"index\":(depth0 != null ? depth0.index : depth0),\"inputLabel\":\"Account Number\",\"inputName\":\"AccountNumber\",\"inputId\":\"accountNumber\",\"wrapperClasses\":\"col-xs-4 autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"index\":(depth0 != null ? depth0.index : depth0),\"inputLabel\":\"Account Description\",\"inputName\":\"AccountName\",\"inputId\":\"accountName\",\"wrapperClasses\":\"col-xs-4 autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"index\":(depth0 != null ? depth0.index : depth0),\"inputClasses\":\"expenseDetails\",\"inputLabel\":\"Details\",\"inputName\":\"details\",\"inputId\":\"details\",\"wrapperClasses\":\"col-xs-4\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <i class=\\\"fa fa-close remove\\\"></i>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow flex error-row\\\">\\r\\n <div class=\\\"line-number\\\">\"\n + alias4(((helper = (helper = helpers.lineNumber || (depth0 != null ? depth0.lineNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lineNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"reason\\\">\"\n + alias4(((helper = (helper = helpers.reason || (depth0 != null ? depth0.reason : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reason\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block errors\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Vendors Import Errors</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"line-number\\\">Line #</div>\\r\\n <div class=\\\"reason\\\">Error</div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.errors : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15 push-15-r\\\" name=\\\"completeReview\\\">Complete Review</button>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"import-button\\\">\\r\\n <button class=\\\"btn btn-primary pull-right push-30\\\" name=\\\"openImport\\\">Import</button>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block no-padding tabbed collapsed\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"own-template\\\" id=\\\"ownTemplate\\\">\\r\\n <div class=\\\"pull-right\\\"><i class=\\\"fa fa-close expanding-group-close cancel\\\"></i></div>\\r\\n <div class=\\\"steps\\\">\\r\\n <div class=\\\"step1\\\">\\r\\n <h3>Step 1: Download the outline</h3>\\r\\n <p><a href=\\\"http://get.crunched.help/hc/en-us/articles/235947188-How-to-import-vendors\\\" target=\\\"_blank\\\">Click here</a> to download an import template. You can update this spreadsheet with your own data.</p>\\r\\n </div>\\r\\n <div class=\\\"step2\\\">\\r\\n <h3>Step 2: Upload your data</h3>\\r\\n <p>Once you've updated the outline and saved it, please upload it here to import your data.</p>\\r\\n <label>\\r\\n <span class=\\\"file-name\\\"></span>\\r\\n <span class=\\\"floating\\\">Upload File</span>\\r\\n <input type=\\\"file\\\" name=\\\"outlineUpload\\\">\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right push-15-r push-15 importUpload\\\" name=\\\"upload\\\">Upload</button>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"import-message\\\">\\r\\n <span class=\\\"import-templates\\\">Add using templates</span>\\r\\n <span class=\\\"manually\\\">Add manually</span>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar CreateView = require('lists/list/create/view')\r\nvar Template = require('lists/vendors/import/template')\r\nvar ErrorTemplate = require('lists/vendors/import/error-template')\r\nvar HasVendorsTemplate = require('lists/vendors/import/has-vendors')\r\nvar sweetAlert = require('sweetalert2')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar ScrollTo = require('jquery-scrollto')\r\n\r\nvar ListView = CreateView.extend({\r\n className: 'import',\r\n events: {\r\n 'change input[type=file]': 'changeFile',\r\n 'click button[name=upload]': 'uploadOwn',\r\n 'click button[name=completeReview]': 'completeReview',\r\n 'click button[name=openImport]': 'openImport',\r\n 'click .cancel': 'close'\r\n },\r\n initialize: function () {\r\n this.Template = Template\r\n this.listenTo(this.model, 'change:vendors', this.render)\r\n this.on('uploadErrors', this.uploadErrors, this)\r\n this.on('uploadSuccess', this.uploadSuccess, this)\r\n this.on('importFailed', this.importFailed, this)\r\n },\r\n render: function () {\r\n var TemplateToRender = (this.model.get('vendors').length && !this.forceOpen) ? HasVendorsTemplate : Template\r\n this.$el.html(TemplateToRender(this.model.toViewModel()))\r\n\r\n if (this.onRender) {\r\n this.onRender()\r\n }\r\n\r\n return this\r\n },\r\n changeFile: function (e) {\r\n var vendorSpreadsheet = _.first(e.target.files)\r\n\r\n if (!vendorSpreadsheet) {\r\n return console.warn('No image selected, leaving unchanged')\r\n }\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (vendorSpreadsheetFile) {\r\n if (this.checkFileExtension(vendorSpreadsheet)) {\r\n this.cachedVendorSpreadsheet = vendorSpreadsheetFile.target.result\r\n this.$('.file-name').text(vendorSpreadsheet.name)\r\n this.fileNameLabelStyling()\r\n }\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(vendorSpreadsheet)\r\n this.isValidFileExtension = this.checkFileExtension(vendorSpreadsheet)\r\n },\r\n // For Edge browser, to prevent an overraping text issue of text:file-name and a label.\r\n fileNameLabelStyling: function () {\r\n this.$('.floating').css({\r\n 'top': '-29px',\r\n 'font-weight': 600,\r\n 'font-size': '13px'\r\n })\r\n },\r\n checkFileExtension: function (selectedFile) {\r\n var validExts = new Array('.xlsx')\r\n var fileExt = selectedFile.name\r\n fileExt = fileExt.substring(fileExt.lastIndexOf('.')).toLowerCase()\r\n if (validExts.indexOf(fileExt) < 0) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'You can only upload Excel(*.xlsx) file.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n\r\n this.$('.file-name').text('')\r\n this.$('.floating').css({\r\n 'top': '-5px',\r\n 'font-weight': 400,\r\n 'font-size': '15px'\r\n })\r\n this.isValidFileExtension = false\r\n return false\r\n } else {\r\n this.isValidFileExtension = true\r\n return true\r\n }\r\n },\r\n uploadOwn: function () {\r\n if (!!this.validateFileType()) {\r\n this.upload(this.cachedVendorSpreadsheet)\r\n // To prevent importing a previously uploaded or selected file while no file is selected for the second time\r\n this.cachedVendorSpreadsheet = ''\r\n this.isValidFileExtension = false\r\n }\r\n },\r\n validateFileType: function () {\r\n if (this.isValidFileExtension) {\r\n var fileType = this.cachedVendorSpreadsheet\r\n var xlsxMimeType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\r\n fileType = fileType.substring(fileType.lastIndexOf(':') + 1, fileType.lastIndexOf(';'))\r\n\r\n // if a selected file extension is correct by checking its name,\r\n // but if there is no reader or an application installed for the file type in the local machine,\r\n // OS will not recognize the file type. Hence, if the selected file type is valid, but the mime type is empty, we set the type manually.\r\n if (fileType === '' && this.isValidFileExtension || fileType !== xlsxMimeType && this.isValidFileExtension) {\r\n var index = this.cachedVendorSpreadsheet.lastIndexOf(':') + 1\r\n if (fileType !== '') {\r\n // When there is no reader for the file, FireFox passes: \"application/octet-stream\"\r\n this.cachedVendorSpreadsheet = this.cachedVendorSpreadsheet.replace(fileType, '')\r\n }\r\n\r\n this.cachedVendorSpreadsheet = this.insert(this.cachedVendorSpreadsheet, index, xlsxMimeType)\r\n }\r\n\r\n var insertedMimeType = this.cachedVendorSpreadsheet\r\n insertedMimeType = insertedMimeType.substring(insertedMimeType.lastIndexOf(':') + 1, insertedMimeType.lastIndexOf(';'))\r\n\r\n return (fileType === xlsxMimeType) || (fileType === '' && this.isValidFileExtension && insertedMimeType === xlsxMimeType) || (fileType !== xlsxMimeType && this.isValidFileExtension && insertedMimeType === xlsxMimeType)\r\n }\r\n },\r\n insert: function (str, index, value) {\r\n return str.substr(0, index) + value + str.substr(index)\r\n },\r\n upload: function (spreadsheet) {\r\n this.$('.importUpload').prop('disabled', true)\r\n this.trigger('upload', {import: spreadsheet})\r\n },\r\n btnEnable: function () {\r\n $('.importUpload').prop('disabled', false)\r\n },\r\n completeReview: function () {\r\n this.$('.errors').remove()\r\n\r\n $('.block[hidden-during-review], .import-message[hidden-during-review], .import-button[hidden-during-review]')\r\n .removeClass('hidden')\r\n .attr('hidden-during-review', null)\r\n\r\n $('.page-heading').ScrollTo()\r\n },\r\n uploadErrors: function (errors, successCount) {\r\n this.close()\r\n\r\n $('.block, .import-message, .import-button')\r\n .addClass('hidden')\r\n .attr('hidden-during-review', '1')\r\n\r\n this.$el.append(ErrorTemplate({errors: errors}))\r\n var totalCount = errors.length + successCount\r\n\r\n if (!successCount) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: successCount + ' of ' + totalCount + ' vendors have been imported, some information couldn\\'t be parsed.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n } else {\r\n sweetAlert({\r\n title: 'Warning',\r\n text: successCount + ' of ' + totalCount + ' vendors have been imported, some information couldn\\'t be parsed.',\r\n type: 'warning',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'View Results'\r\n })\r\n }\r\n },\r\n uploadSuccess: function (successCount) {\r\n this.close()\r\n\r\n sweetAlert({\r\n title: 'Success',\r\n text: successCount + ' of ' + successCount + ' vendors have been imported. Please set up your vendors assignments to get the most out of Crunched.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n importFailed: function (errorMessage) {\r\n this.close()\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Failed to import the vendors. ' + errorMessage,\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n },\r\n openImport: function () {\r\n this.forceOpen = true\r\n this.$el.addClass('forced-open')\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.close.bind(this))\r\n this.render()\r\n },\r\n close: function () {\r\n this.forceOpen = false\r\n this.$el.removeClass('forced-open')\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n this.render()\r\n }\r\n})\r\n\r\nmodule.exports = ListView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar VendorService = require('lists/vendors/service')\r\nvar VendorImportView = require('lists/vendors/import/view')\r\n\r\nvar VendorImportWidget = function () {\r\n this.vendorsService = new VendorService()\r\n this.model = new Backbone.Model({\r\n vendors: []\r\n })\r\n\r\n this.model.toViewModel = this.model.toJSON.bind(this.model)\r\n\r\n this.view = new VendorImportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('upload', this.upload.bind(this))\r\n\r\n this.loadVendors()\r\n}\r\n\r\nVendorImportWidget.prototype = _.clone(Backbone.Events)\r\n\r\nVendorImportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nVendorImportWidget.prototype.loadVendors = function () {\r\n return this.vendorsService.getList().then(function (results) {\r\n this.model.set('vendors', results)\r\n }.bind(this))\r\n}\r\n\r\nVendorImportWidget.prototype.upload = function (spreadsheet) {\r\n return this.vendorsService.importSpreadsheet(spreadsheet).then(function (results) {\r\n return this.loadVendors().then(function () {\r\n var errors = results.parseErrors\r\n var successCount = results.successCount\r\n\r\n this.once('refreshed', function () {\r\n if (errors.length) {\r\n this.view.trigger('uploadErrors', errors, successCount)\r\n } else {\r\n this.view.trigger('uploadSuccess', successCount)\r\n }\r\n }.bind(this))\r\n\r\n this.trigger('refresh')\r\n }.bind(this))\r\n }.bind(this), function (error) {\r\n this.view.btnEnable()\r\n this.view.trigger('importFailed', error.message)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = VendorImportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-unlock-alt pull-right disable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-lock pull-right enable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"vendorId\\\">\"\n + alias4(((helper = (helper = helpers.vendorId || (depth0 != null ? depth0.vendorId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"vendorId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"name\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"printed-name\\\">\"\n + alias4(((helper = (helper = helpers.printedName || (depth0 != null ? depth0.printedName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"printedName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"email\\\">\"\n + alias4(((helper = (helper = helpers.email || (depth0 != null ? depth0.email : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"email\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"telephoneOne\\\">\"\n + alias4(((helper = (helper = helpers.telephoneOne || (depth0 != null ? depth0.telephoneOne : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"telephoneOne\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n <a class=\\\"fa fa-trash-o pull-right remove\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isActive : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\nvar _ = require('lodash')\r\nvar Payable = require('payables/payable/item/payable')\r\n\r\nvar Vendor = ListEntry.extend({\r\n defaults: {\r\n contacts: [],\r\n expenseDistributions: []\r\n }\r\n}, {\r\n parse: function (json) {\r\n return new Vendor({\r\n vendorId: json.vendorId,\r\n name: json.name,\r\n printedName: json.printedName,\r\n addressLine1: json.addressLine1,\r\n addressLine2: json.addressLine2,\r\n city: json.city,\r\n state: json.state,\r\n postalCode: json.postalCode,\r\n profilePicture: json.profilePicture,\r\n notes: json.notes,\r\n telephoneOne: json.telephoneOne,\r\n telephoneTwo: json.telephoneTwo,\r\n email: json.email,\r\n isSupplier: !!json.isSupplier,\r\n isActive: !!json.isActive,\r\n contacts: _.map(json.contacts, function (contact) {\r\n return contact\r\n }),\r\n expenseDistributions: _.map(json.expenseDistributions, function (expenseDistribution) {\r\n return expenseDistribution\r\n }),\r\n id: json.id,\r\n unpaidPayables: _.map(json.unpaidPayables || [], function (payable) {\r\n var payableResult = Payable.parse(payable)\r\n\r\n payableResult.set('vendorId', json.id)\r\n\r\n return payableResult\r\n })\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = Vendor\r\n","var ItemView = require('lists/list/item/view')\r\nvar Template = require('lists/vendors/item/template')\r\n\r\nvar VendorsView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n if (!this.model.get('isActive')) this.$el.addClass('notActive')\r\n }\r\n})\r\n\r\nmodule.exports = VendorsView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"vendorId-sort\"] || (depth0 != null ? depth0[\"vendorId-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"vendorId-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"name-sort\"] || (depth0 != null ? depth0[\"name-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"name-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"printedName-sort\"] || (depth0 != null ? depth0[\"printedName-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"printedName-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Vendors</h3>\\r\\n <i class=\\\"fa fa-close pull-right clear-search-box\\\"></i>\\r\\n <input type=\\\"text\\\" class=\\\"pull-right search-box\\\" placeholder=\\\"Search...\\\" value=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.search || (depth0 != null ? depth0.search : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"search\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" />\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"vendorId\\\">ID <i data-sort-field=\\\"vendorId\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"vendorId-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"name\\\">Vendor Name <i data-sort-field=\\\"name\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"name-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"printed-name\\\">Printed Name <i data-sort-field=\\\"printedName\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"printedName-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"email\\\">Email</div>\\r\\n <div class=\\\"telephoneOne\\\">Telephone</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\"><p class=\\\"center\\\">Loading more vendors...</p></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('lists/vendors/list/template')\r\nvar VendorView = require('lists/vendors/item/view')\r\nvar DetailsView = require('lists/vendors/read/view')\r\nvar UpdateView = require('lists/vendors/update/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\nvar VendorsView = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort',\r\n 'keyup .search-box': 'searchList',\r\n 'click .clear-search-box': 'clearSearch'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = VendorView\r\n this.model.set('search', '')\r\n this.model.set('sort', 'asc')\r\n this.model.set('sortField', 'vendorId')\r\n this.model.set('vendorId-sort', 'asc')\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.on('showDetails', this.showDetails.bind(this))\r\n this.on('showEdit', this.showEdit.bind(this))\r\n this.on('enable', this.showEnable.bind(this))\r\n this.on('disable', this.showDisable.bind(this))\r\n this.on('delete', this.showDelete.bind(this))\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more vendors...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more vendors.')\r\n },\r\n\r\n showDetails: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n\r\n var accounts = _.filter(this.model.get('accountList'), { 'attributes': { status: true } })\r\n var accountLookup = _.keyBy(accounts, 'attributes.id')\r\n\r\n // Add expense distribution lines with our data\r\n _.forEach(model.get('expenseDistributions'), function (expenseDistribution) {\r\n var account = accountLookup[expenseDistribution.ledgerAccountId]\r\n expenseDistribution['accountNumber'] = account.get('accountNumber')\r\n expenseDistribution['accountName'] = account.get('accountName')\r\n })\r\n\r\n var details = new DetailsView({ model: model })\r\n\r\n // View to show beneath $lineItem, and if the 'active' class should be added to $lineItem's classes\r\n this.showChildView(details, $lineItem, true)\r\n },\r\n\r\n showEdit: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n model.set('contactList', this.model.get('contactList'))\r\n model.set('accountList', this.model.get('accountList'))\r\n var update = new UpdateView({ model: model })\r\n update.on('update', function () {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('update')\r\n this.trigger.apply(this, args)\r\n }, this)\r\n\r\n this.showChildView(update, $lineItem, false)\r\n },\r\n\r\n showEnable: function (vendorId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + vendorId + '\"]'), 'Are you sure you want to enable this vendor?', 'confirmEnable', vendorId)\r\n },\r\n\r\n showDisable: function (vendorId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + vendorId + '\"]'), 'Are you sure you want to disable this vendor?', 'confirmDisable', vendorId)\r\n },\r\n\r\n showDelete: function (vendorId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + vendorId + '\"]'), 'Are you sure you want to delete this vendor?', 'confirmDelete', vendorId)\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.unset('vendorId-sort')\r\n this.model.unset('name-sort')\r\n this.model.unset('printedName-sort')\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, { silent: true })\r\n\r\n this.model.reset()\r\n },\r\n\r\n searchList: function (e) {\r\n if (e.which === 13) {\r\n var $currentTarget = $(e.currentTarget)\r\n\r\n this.model.set({\r\n page: 1,\r\n search: $currentTarget.val()\r\n }, { silent: true })\r\n\r\n this.model.reset()\r\n }\r\n },\r\n\r\n clearSearch: function (e) {\r\n var $sibiling = $(e.currentTarget).parent().children('.search-box')\r\n\r\n if ($sibiling.val() === '') {\r\n return\r\n }\r\n\r\n $sibiling.val('')\r\n\r\n if (this.model.get('search') === '') {\r\n return\r\n }\r\n\r\n this.model.set({\r\n page: 1,\r\n search: ''\r\n }, { silent: true })\r\n\r\n this.model.reset()\r\n }\r\n})\r\n\r\nmodule.exports = VendorsView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"data-has-image\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <i class=\\\"fa fa-check\\\"></i>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \" <i class=\\\"fa fa-times\\\"></i>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div class=\\\"col-xs-12 distribution\\\">\\r\\n <h3>Contacts</h3>\\r\\n <div class=\\\"line-item-container view-container col-xs-12 no-padding\\\">\\r\\n <div class=\\\"distribution col-xs-12 no-padding contact-item contact-item-header flex\\\">\\r\\n <div class=\\\"contactId\\\"><b>Contact ID</b></div>\\r\\n <div class=\\\"name\\\"><b>Name</b></div>\\r\\n <div class=\\\"address\\\"><b>Address</b></div>\\r\\n <div class=\\\"city\\\"><b>City</b></div>\\r\\n <div class=\\\"state\\\"><b>State</b></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.contacts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"distribution col-xs-12 form-group no-padding contact-item listItem flex\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"contactId\\\">\"\n + alias4(((helper = (helper = helpers.contactId || (depth0 != null ? depth0.contactId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"contactId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"name\\\">\"\n + alias4(((helper = (helper = helpers.firstName || (depth0 != null ? depth0.firstName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"firstName\",\"hash\":{},\"data\":data}) : helper)))\n + \" \"\n + alias4(((helper = (helper = helpers.lastName || (depth0 != null ? depth0.lastName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lastName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"address\\\">\"\n + alias4(((helper = (helper = helpers.addressLine1 || (depth0 != null ? depth0.addressLine1 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine1\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"city\\\">\"\n + alias4(((helper = (helper = helpers.city || (depth0 != null ? depth0.city : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"city\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"state\\\">\"\n + alias4(((helper = (helper = helpers.state || (depth0 != null ? depth0.state : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"state\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div> \\r\\n </div>\\r\\n\";\n},\"10\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div class=\\\"col-xs-12 distribution\\\">\\r\\n <h3>Expense Distributions</h3>\\r\\n <div class=\\\"line-item-container view-container col-xs-12 no-padding\\\">\\r\\n <div class=\\\"distribution col-xs-12 no-padding expense-distribution-item expense-distribution-header flex\\\">\\r\\n <div class=\\\"accountNumber\\\"><b>Account Number</b></div>\\r\\n <div class=\\\"accountName\\\"><b>Account Name</b></div>\\r\\n <div class=\\\"details\\\"><b>Details</b></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.expenseDistributions : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(11, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n\";\n},\"11\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"distribution col-xs-12 form-group no-padding expense-distribution-item flex\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"accountNumber\\\">\"\n + alias4(((helper = (helper = helpers.accountNumber || (depth0 != null ? depth0.accountNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"accountName\\\">\"\n + alias4(((helper = (helper = helpers.accountName || (depth0 != null ? depth0.accountName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"details\\\">\"\n + alias4(((helper = (helper = helpers.details || (depth0 != null ? depth0.details : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"details\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side address-info\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <div class=\\\"avatar\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.profilePicture : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" data-no-op style=\\\"background:url('\"\n + ((stack1 = ((helper = (helper = helpers.profilePicture || (depth0 != null ? depth0.profilePicture : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"profilePicture\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"') no-repeat center center;\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"primary-info\\\">\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"form-group vendor-id-container\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Vendor ID</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.vendorId || (depth0 != null ? depth0.vendorId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"vendorId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group name\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Vendor Name</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div>\\r\\n <div class=\\\"form-group printed-name\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Printed Name</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.printedName || (depth0 != null ? depth0.printedName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"printedName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group email\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Email</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.email || (depth0 != null ? depth0.email : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"email\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Address Line 1</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.addressLine1 || (depth0 != null ? depth0.addressLine1 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine1\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Address Line 2</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.addressLine2 || (depth0 != null ? depth0.addressLine2 : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"addressLine2\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"city-state\\\">\\r\\n <div class=\\\"form-group city\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>City</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.city || (depth0 != null ? depth0.city : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"city\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group state\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>State</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.state || (depth0 != null ? depth0.state : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"state\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group zipcode\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b class=\\\"control-label\\\">Zip Code</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.postalCode || (depth0 != null ? depth0.postalCode : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"postalCode\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\"></span>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"form-group telephone-one\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Telephone One</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.telephoneOne || (depth0 != null ? depth0.telephoneOne : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"telephoneOne\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group telephone-two\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Telephone Two</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.telephoneTwo || (depth0 != null ? depth0.telephoneTwo : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"telephoneTwo\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side notes-info\\\">\\r\\n <div class=\\\"flex checkbox-container\\\">\\r\\n <div class=\\\"form-group is-supplier\\\">\\r\\n <span>Supplier</span>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isSupplier : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(5, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <div class=\\\"form-group notes-container\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <b>Notes</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"notes\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.contacts : depth0)) != null ? stack1.length : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.expenseDistributions : depth0)) != null ? stack1.length : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(10, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </form>\\r\\n </div>\\r\\n </div>\\r\\n</div> \\r\\n<div id=\\\"modalHolder\\\">\\r\\n <div class=\\\"modal list contacts\\\" id=\\\"readContactModal\\\" tabindex=\\\"-1\\\" role=\\\"dialog\\\" aria-hidden=\\\"true\\\" style=\\\"display: none;\\\">\\r\\n <div class=\\\"modal-dialog modal-lg\\\">\\r\\n <div class=\\\"modal-content block read has-animation fadeInDown expanded\\\">\\r\\n <div class=\\\"block block-themed block-transparent remove-margin-b\\\">\\r\\n <div class=\\\"block-header bg-primary\\\">\\r\\n <ul class=\\\"block-options\\\">\\r\\n <li>\\r\\n <button data-dismiss=\\\"modal\\\" type=\\\"button\\\"><i class=\\\"fa fa-times pull-right close\\\"></i></button>\\r\\n </li>\\r\\n </ul>\\r\\n <h3>View Contact</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\" id=\\\"readContactContainer\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"modal-footer\\\">\\r\\n <button class=\\\"btn btn-sm btn-primary\\\" type=\\\"button\\\" data-dismiss=\\\"modal\\\">Close</button>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var _ = require('underscore')\r\nvar Backbone = require('backbone')\r\nvar Template = require('lists/vendors/read/template')\r\nvar Contact = require('lists/contacts/item/contact')\r\nvar ReadContactView = require('lists/contacts/read/view')\r\nvar $ = require('jquery')\r\n\r\n// TODO: Replace vendor method drop down with static text instead of read only drop down\r\nvar ReadView = Backbone.View.extend({\r\n className: 'block read has-animation fadeInDown expanded',\r\n\r\n attributes: function () {\r\n return {\r\n 'data-id': this.model.id\r\n }\r\n },\r\n\r\n events: {\r\n 'click .contact-item': 'openContactItem'\r\n },\r\n\r\n openContactItem: function (e) {\r\n // If this has an active class on it (reserved for when actively viewing an item) don't do anything as it's already open.\r\n if (this.$el.hasClass('active')) return\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n\r\n var models = _.where(this.model.get('contacts'), {'id': $(e.currentTarget).attr('data-id')})\r\n\r\n if (models == null || models.length < 1) {\r\n return\r\n }\r\n\r\n this.showContactDetails(new Contact(models[0]))\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.model.toViewModel()))\r\n\r\n return this\r\n },\r\n\r\n showContactDetails: function (model) {\r\n var contactView = new ReadContactView({model: model})\r\n contactView.$el[0].className = 'block read'\r\n\r\n var $contactView = contactView.render().$el\r\n\r\n var $contactModal = this.$('#readContactContainer')\r\n $contactModal.append($contactView)\r\n\r\n this.$('#readContactModal').on('hide.bs.modal', function () {\r\n $('body #readContactModal').detach().appendTo('#modalHolder')\r\n this.$('#readContactContainer').html('')\r\n }.bind(this))\r\n\r\n this.$('#readContactModal').detach().appendTo('body').modal('show')\r\n }\r\n})\r\n\r\nmodule.exports = ReadView\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar VendorsService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nVendorsService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nVendorsService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'vendors'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nVendorsService.prototype.getList = function () {\r\n var apiPath = this.GetPath('list')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nVendorsService.prototype.setStatus = function (vendorId, status) {\r\n var apiPath = this.GetPath(vendorId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nVendorsService.prototype.importSpreadsheet = function (spreadsheet) {\r\n var apiPath = this.GetPath('import')\r\n return this.restClient.post(apiPath, spreadsheet)\r\n}\r\n\r\nmodule.exports = VendorsService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"data-has-image\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right cancel\\\"></i>\\r\\n <h3>Update Vendor</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side address-info\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <label class=\\\"avatar\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.profilePicture : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" style=\\\"background:url('\"\n + ((stack1 = ((helper = (helper = helpers.profilePicture || (depth0 != null ? depth0.profilePicture : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"profilePicture\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"') no-repeat center center;\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n <input type=\\\"file\\\" accept=\\\"image/*\\\" />\\r\\n </label>\\r\\n <div class=\\\"primary-info\\\">\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"maxLength\":\"20\",\"inputLabel\":\"Vendor ID\",\"inputName\":\"vendorId\",\"inputId\":\"update-vendor-id\",\"wrapperClasses\":\"vendor-id-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Vendor Name\",\"inputName\":\"name\",\"inputId\":\"update-name\",\"wrapperClasses\":\"name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n <div class=\\\"form-group printed-name\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control \\\" type=\\\"text\\\" id=\\\"update-printed-name\\\" name=\\\"printedName\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"update-printed-name\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" data-original-title=\\\"The printed name is displayed on checks and invoices\\\"><img src=\\\"/img/question-circle.svg\\\" class=\\\"printed-name-tooltip\\\" alt=\\\"?\\\" /> Printed Name</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\"></span>\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Email\",\"inputName\":\"email\",\"inputId\":\"update-email-name\",\"wrapperClasses\":\"email\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 1\",\"inputName\":\"addressLine1\",\"inputId\":\"update-address-line1\",\"wrapperClasses\":\"address-line1-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 2\",\"inputName\":\"addressLine2\",\"inputId\":\"update-address-line2\",\"wrapperClasses\":\"address-line2-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"city-state\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"City\",\"inputName\":\"city\",\"inputId\":\"update-city\",\"wrapperClasses\":\"city\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group state\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"update-state\\\" name=\\\"state\\\" size=\\\"1\\\" style=\\\"height: 35px;\\\">\\r\\n <option></option>\\r\\n <option value=\\\"AL\\\">AL</option>\\r\\n <option value=\\\"AK\\\">AK</option>\\r\\n <option value=\\\"AZ\\\">AZ</option>\\r\\n <option value=\\\"AR\\\">AR</option>\\r\\n <option value=\\\"CA\\\">CA</option>\\r\\n <option value=\\\"CO\\\">CO</option>\\r\\n <option value=\\\"CT\\\">CT</option>\\r\\n <option value=\\\"DE\\\">DE</option>\\r\\n <option value=\\\"FL\\\">FL</option>\\r\\n <option value=\\\"GA\\\">GA</option>\\r\\n <option value=\\\"HI\\\">HI</option>\\r\\n <option value=\\\"ID\\\">ID</option>\\r\\n <option value=\\\"IL\\\">IL</option>\\r\\n <option value=\\\"IN\\\">IN</option>\\r\\n <option value=\\\"IA\\\">IA</option>\\r\\n <option value=\\\"KS\\\">KS</option>\\r\\n <option value=\\\"KY\\\">KY</option>\\r\\n <option value=\\\"LA\\\">LA</option>\\r\\n <option value=\\\"ME\\\">ME</option>\\r\\n <option value=\\\"MD\\\">MD</option>\\r\\n <option value=\\\"MA\\\">MA</option>\\r\\n <option value=\\\"MI\\\">MI</option>\\r\\n <option value=\\\"MN\\\">MN</option>\\r\\n <option value=\\\"MS\\\">MS</option>\\r\\n <option value=\\\"MO\\\">MO</option>\\r\\n <option value=\\\"MT\\\">MT</option>\\r\\n <option value=\\\"NE\\\">NE</option>\\r\\n <option value=\\\"NV\\\">NV</option>\\r\\n <option value=\\\"NH\\\">NH</option>\\r\\n <option value=\\\"NJ\\\">NJ</option>\\r\\n <option value=\\\"NM\\\">NM</option>\\r\\n <option value=\\\"NY\\\">NY</option>\\r\\n <option value=\\\"NC\\\">NC</option>\\r\\n <option value=\\\"ND\\\">ND</option>\\r\\n <option value=\\\"OH\\\">OH</option>\\r\\n <option value=\\\"OK\\\">OK</option>\\r\\n <option value=\\\"OR\\\">OR</option>\\r\\n <option value=\\\"PA\\\">PA</option>\\r\\n <option value=\\\"RI\\\">RI</option>\\r\\n <option value=\\\"SC\\\">SC</option>\\r\\n <option value=\\\"SD\\\">SD</option>\\r\\n <option value=\\\"TN\\\">TN</option>\\r\\n <option value=\\\"TX\\\">TX</option>\\r\\n <option value=\\\"UT\\\">UT</option>\\r\\n <option value=\\\"VT\\\">VT</option>\\r\\n <option value=\\\"VA\\\">VA</option>\\r\\n <option value=\\\"WA\\\">WA</option>\\r\\n <option value=\\\"WV\\\">WV</option>\\r\\n <option value=\\\"WI\\\">WI</option>\\r\\n <option value=\\\"WY\\\">WY</option>\\r\\n <option value=\\\"OTHER\\\">OTHER</option>\\r\\n </select>\\r\\n <label for=\\\"update-state\\\">State</label>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Zip Code\",\"inputName\":\"postalCode\",\"inputId\":\"update-zipcode\",\"wrapperClasses\":\"zipcode\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex display-container\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Telephone\",\"inputName\":\"telephoneOne\",\"inputId\":\"update-telephone-one\",\"wrapperClasses\":\"telephone-one-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Telephone 2\",\"inputName\":\"telephoneTwo\",\"inputId\":\"update-telephone-two\",\"wrapperClasses\":\"telephone-two-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side notes-info\\\">\\r\\n <div class=\\\"flex checkbox-container\\\">\\r\\n <div class=\\\"form-group is-supplier\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Supplier</span>\\r\\n <input type=\\\"checkbox\\\" name=\\\"isSupplier\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group notes-container\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <textarea class=\\\"form-control\\\" id=\\\"update-notes\\\" name=\\\"notes\\\" rows=\\\"14\\\"></textarea>\\r\\n <label for=\\\"update-notes\\\">Notes</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"distribution\\\">\\r\\n <h3>Contacts</h3>\\r\\n <div class=\\\"line-item-container\\\">The vendor currently has no contacts.</div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Contact</button>\\r\\n <br>\\r\\n <h3>Expense Distributions</h3>\\r\\n <div class=\\\"expense-line-item-container\\\">The vendor currently has no expense distributions.</div>\\r\\n <button class=\\\"clickable-button add-more-expense-line-items\\\" type=\\\"button\\\">+ Additional Expense Distribution</button>\\r\\n <br>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Update Vendor</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Vendors must have a first name.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/vendors/create/view')\r\nvar Template = require('lists/vendors/update/template')\r\nvar _ = require('lodash')\r\nvar numbro = require('numbro')\r\n\r\nvar UpdateView = CreateView.extend({\r\n className: 'block update expanded has-animation fadeInDown',\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n // Fill in inputs with our data\r\n var model = this.model.toViewModel()\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else {\r\n $el.val(model[$el.attr('name')])\r\n }\r\n })\r\n\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n\r\n // Remove empty vendor line from the create side\r\n this.$('.create-vendor-method').remove()\r\n\r\n // Add contact lines with our data\r\n _.forEach(model['contacts'], function (contact) {\r\n var $contactLine = this.addContact()\r\n $contactLine.find('.contactId').val(contact.id)\r\n $contactLine.find('.autocomplete input').val(contact.firstName + ' ' + contact.lastName)\r\n $contactLine.find('.contactAddress').val(contact.addressLine1)\r\n $contactLine.find('.contactCity').val(contact.city)\r\n $contactLine.find('.contactState').val(contact.state)\r\n }.bind(this))\r\n\r\n var accounts = _.filter(this.model.get('accountList'), {'attributes': {status: true}})\r\n var accountLookup = _.keyBy(accounts, 'attributes.id')\r\n\r\n // Add expense distribution lines with our data\r\n _.forEach(model['expenseDistributions'], function (expenseDistribution) {\r\n var $contactLine = this.addExpenseDistribution()\r\n $contactLine.find('.accountId').val(expenseDistribution.ledgerAccountId)\r\n\r\n var account = accountLookup[expenseDistribution.ledgerAccountId]\r\n\r\n $contactLine.find('.autocomplete input[name=AccountNumber]').val(account.get('accountNumber'))\r\n $contactLine.find('.autocomplete input[name=AccountName]').val(account.get('accountName'))\r\n $contactLine.find('.expenseDetails').val(expenseDistribution.details)\r\n $contactLine.find('.expenseAmount').val(numbro(expenseDistribution.defaultAmount).formatCurrency('$0,0.00'))\r\n }.bind(this))\r\n \r\n this.determineStatus()\r\n }\r\n})\r\n\r\nmodule.exports = UpdateView\r\n","'use strict'\r\n\r\nvar Vendor = require('lists/vendors/item/vendor')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar Vendors = ListWrapper.extend({\r\n childModel: Vendor\r\n})\r\n\r\n\r\nmodule.exports = Vendors\r\n","var ListContainer = require('lists/list/view')\r\nvar ListView = require('lists/vendors/list/view')\r\nvar CreateView = require('lists/vendors/create/view')\r\nvar ImportWidget = require('lists/vendors/import/widget')\r\n\r\nvar VendorsView = ListContainer.extend({\r\n className: 'vendors list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n this.listView = new ListView({model: this.model})\r\n this.forwardEvents(this.listView)\r\n\r\n this.createView = new CreateView({model: this.model})\r\n this.forwardEvents(this.createView)\r\n \r\n this.importWidget = new ImportWidget()\r\n \r\n this.importWidget.on('refresh', function () {\r\n this.trigger('refresh', this.importWidget.trigger.bind(this.importWidget, 'refreshed'))\r\n }.bind(this))\r\n\r\n this.on('created', function () {\r\n this.createView.trigger('resetInputs')\r\n }.bind(this))\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n console.log('container -> editDetails')\r\n this.listView.trigger('showEdit', model)\r\n }.bind(this))\r\n\r\n this.on('widgetShown', function () {\r\n this.listView.trigger('bindScroll')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n\r\n this.$el.append(this.importWidget.show())\r\n this.$el.append(this.createView.render().$el)\r\n this.$el.append(this.listView.render().$el)\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = VendorsView\r\n","'use strict'\r\n\r\nvar _ = require('underscore')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar Vendors = require('lists/vendors/vendors')\r\nvar Service = require('lists/vendors/service')\r\nvar ContactService = require('lists/contacts/service')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar ListContainer = require('lists/vendors/view')\r\n\r\nvar VendorsWidget = function () {\r\n this.service = new Service()\r\n this.contactService = new ContactService()\r\n this.accountService = new AccountService()\r\n this.modelType = Vendors\r\n this.viewType = ListContainer\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n \r\n this.view.on('refresh', this.refresh, this)\r\n this.view.on('refresh', this.reset, this)\r\n\r\n this.on('shown', function () {\r\n this.contactService.getList().then(function (results) {\r\n this.model.set('contactList', _.map(results, function (contact) {\r\n contact['fullName'] = contact.firstName + ' ' + contact.lastName\r\n return contact\r\n }))\r\n }.bind(this)).then(\r\n this.accountService.fetchAccounts(false).then(function (accounts) {\r\n this.model.set('accountList', accounts)\r\n }.bind(this)).then(function () {\r\n this.view.trigger('widgetShown')\r\n }.bind(this))\r\n ).done()\r\n }.bind(this))\r\n}\r\n\r\nVendorsWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nVendorsWidget.prototype.refresh = function (callback) {\r\n var result = this.service.getList().then(function (results) {\r\n this.model.set('vendors', results) \r\n }.bind(this))\r\n \r\n if (callback) {\r\n return result.then(callback)\r\n } else {\r\n return result\r\n }\r\n}\r\n\r\nmodule.exports = VendorsWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block reset-password-request\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"col-xs-12 col-md-12 col-lg-12 textMessage\\\">\\r\\n <h3 class=\\\"text-center\\\">Please check your email to continue resetting your password.</h3>\\r\\n <p class=\\\"text-center\\\">You should receive a link to reset your password within 5 minutes.<span class=\\\"resend\\\"> (Resend)</span></p>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"no-padding registration-footer\\\" style=\\\"text-align: center;\\\">\\r\\n <p><a href=\\\"/login\\\">© Crunched, Inc. 2017</a></p>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"form-group no-padding headerText\\\">\\r\\n <p>Enter your email to reset your password.</p>\\r\\n </div> \\r\\n\\r\\n <div class=\\\"form-group no-padding emailInputContainer\\\" style=\\\"width:65%; margin: 0 auto;\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"login-email\\\" class=\\\"form-control\\\" name=\\\"email\\\" />\\r\\n <label class=\\\"control-label\\\" for=\\\"login-email\\\">Email</label>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"form-group no-padding submit\\\">\\r\\n <button type=\\\"submit\\\" class=\\\"btn btn-primary submit\\\">Reset Password</button>\\r\\n </div>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"screenTitle\\\">Cannot reset password.</h3>\\r\\n <p class=\\\"titleHelpText\\\">Educational users are unable to reset passwords. Please speak with your administrator. <a href=\\\"/\\\">Return to Login</a></p>\\r\\n </div>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \" <p><a href=\\\"/registration\\\">Don't have an account?</a></p>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block forgot-password\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"col-xs-12 col-md-12 col-lg-12 inputSection\\\">\\r\\n <form class=\\\"form-material\\\" role=\\\"form\\\">\\r\\n <span class=\\\"logo flex\\\">\\r\\n <img src=\\\"/img/crunched-logo-color.svg\\\" class=\\\"logoimageColor-login\\\" alt=\\\"/img/crunched-logo-color.svg\\\"> \\r\\n </span>\\r\\n\\r\\n <div class=\\\"text-danger help-block animated fadeInDown validation-summary-errors\\\">\\r\\n <div class=\\\"errorMessage\\\"></div>\\r\\n </div>\\r\\n\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n </form> \\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n\\r\\n<div class=\\\"no-padding registration-footer\\\" style=\\\"text-align: center;\\\">\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <p><a href=\\\"/login\\\">© Crunched, Inc. 2017</a></p>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar ForgotPasswordTemplate = require('login/forgot-password/template')\r\nvar RequestSentTemplate = require('login/forgot-password/request-sent-template')\r\nvar Config = require('config/config')\r\n\r\nvar ForgotPasswordView = Backbone.View.extend({\r\n className: 'forgot-password-container',\r\n\r\n events: {\r\n 'submit form': 'resetPassword', \r\n 'click .resend': 'render'\r\n },\r\n\r\n initialize: function () {\r\n this.on('requestSent', this.requestSent, this)\r\n this.on('requestError', this.requestError, this)\r\n },\r\n\r\n render: function () {\r\n $('#page-container').attr('style', 'padding: 0 !important;')\r\n $('#sidebar, #header-navbar, #side-overlay, .content.bg-white.titlebar').attr('style', 'display:none;')\r\n \r\n this.$el.html(ForgotPasswordTemplate(this.createViewModel()))\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n isEducationalLicense: Config['IS_EDUCATIONAL_LICENSE']\r\n }\r\n },\r\n\r\n resetPassword: function (e) {\r\n e.preventDefault()\r\n\r\n this.trigger('resetPassword', this.$('#login-email').val())\r\n },\r\n\r\n requestSent: function (e) {\r\n this.$el.html(RequestSentTemplate())\r\n },\r\n\r\n requestError: function (e) {\r\n this.$('.text-danger').html('').append('<div>' + e.message + '</div>').parent().addClass('has-error')\r\n }\r\n})\r\n\r\nmodule.exports = ForgotPasswordView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar ForgotPasswordView = require('login/forgot-password/view')\r\nvar LoginService = require('login/service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar ForgotPasswordWidget = function () {\r\n this.view = new ForgotPasswordView({ model: new Backbone.Model({}) })\r\n this.loginService = new LoginService()\r\n this.companyService = new CompanyService()\r\n this.view.on('resetPassword', this.resetPassword, this)\r\n}\r\n\r\nForgotPasswordWidget.prototype = _.clone(Backbone.Events)\r\n\r\nForgotPasswordWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nForgotPasswordWidget.prototype.resetPassword = function (email) {\r\n this.loginService.requestResetPassword(email).then(function () {\r\n this.view.trigger('requestSent')\r\n }.bind(this)).fail(function (reason) {\r\n this.view.trigger('requestError', reason)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = ForgotPasswordWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \" <h3>Enter your new password.</h3>\\r\\n \\r\\n <div class=\\\"form-group col-sm-12 passwordInput\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"login-password\\\" class=\\\"form-control\\\" type=\\\"password\\\" name=\\\"password\\\" />\\r\\n <label class=\\\"control-label\\\" for=\\\"login-password\\\">Password</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-error\\\"></span>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"form-group col-sm-12 confirmPasswordInput\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"login-password-confirm\\\" class=\\\"form-control\\\" type=\\\"password\\\" name=\\\"password\\\" />\\r\\n <label class=\\\"control-label\\\" for=\\\"login-password-confirm\\\">Confirm Password</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-error\\\"></span>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"form-group col-sm-12 submit\\\">\\r\\n <button type=\\\"submit\\\" class=\\\"btn btn-primary\\\">Reset Password</button>\\r\\n </div>\\r\\n \\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"screenTitle\\\">Cannot reset password.</h3>\\r\\n <p class=\\\"titleHelpText\\\">Educational users are unable to reset passwords. Please speak with your administrator. <a href=\\\"/\\\">Return to Login</a></p>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block reset-password\\\">\\r\\n <div class=\\\"block-content col-md-8 col-lg-8 col-md-offset-2 col-lg-offset-2\\\">\\r\\n <section>\\r\\n <form class=\\\"form-horizontal\\\" role=\\\"form\\\">\\r\\n <span class=\\\"logo flex\\\">\\r\\n <img src=\\\"/img/crunched-logo-color.svg\\\" class=\\\"logoimageColor-login\\\" alt=\\\"/img/crunched-logo-color.svg\\\"> \\r\\n </span>\\r\\n\\r\\n <div class=\\\"text-danger help-block animated fadeInDown validation-summary-errors\\\">\\r\\n <div class=\\\"errorMessage\\\"></div>\\r\\n </div>\\r\\n\\r\\n\"\n + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n </form>\\r\\n </section>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"no-padding registration-footer\\\" style=\\\"text-align: center;\\\">\\r\\n <p>\\r\\n <a href=\\\"/login\\\">© Crunched, Inc. 2017</a>\\r\\n </p>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar ResetPasswordTemplate = require('login/reset-password/template')\r\nvar $ = require('jquery')\r\n\r\nvar oneDigitMessage = \"Passwords must have at least one digit ('0'-'9').\"\r\nvar oneUppercaseMessage = \"Passwords must have at least one uppercase ('A'-'Z').\"\r\nvar passwordLengthMessage = 'Your password must be at least 6 characters.'\r\nvar passwordRequired = 'The password field is required.'\r\nvar passwordMatching = 'These passwords don\\'t match. Please try again.'\r\n\r\nvar ResetPasswordView = Backbone.View.extend({\r\n className: 'col-sm-8 col-sm-offset-2',\r\n\r\n events: {\r\n 'keyup input': 'validate',\r\n 'submit form': 'resetPassword'\r\n },\r\n\r\n render: function () {\r\n $('#page-container').attr('style', 'padding: 0 !important;')\r\n $('#sidebar, #header-navbar, #side-overlay, .content.bg-white.titlebar').attr('style', 'display:none;')\r\n this.$el.html(ResetPasswordTemplate(this.model.toJSON()))\r\n return this\r\n },\r\n\r\n resetPassword: function (e) {\r\n e.preventDefault()\r\n\r\n if (this.validate()) {\r\n this.trigger('resetPassword', this.$('#login-password-confirm').val())\r\n }\r\n },\r\n\r\n validate: function (e) {\r\n var password = this.$('input#login-password').val()\r\n var confirmPassword = this.$('input#login-password-confirm').val()\r\n\r\n var hasNumbers = !!(/[0-9]+/g).exec(password)\r\n var hasUppercase = !!(/[A-Z]+/g).exec(password)\r\n\r\n var feedbackSummary = this.$('.validation-summary-errors').find('ul')\r\n feedbackSummary.empty()\r\n\r\n this.$('.field-validation-error').empty()\r\n this.$('.has-error').removeClass('has-error')\r\n\r\n var isInvalid = !password || password.length < 6 || !hasNumbers || !hasUppercase || confirmPassword !== password\r\n\r\n if (isInvalid) {\r\n var passwordFeedbackField = this.$('input#login-password').parent().siblings('.field-validation-error')\r\n var passwordConfirmFeedbackField = this.$('input#login-password-confirm').parent().siblings('.field-validation-error')\r\n \r\n if (!password) {\r\n passwordFeedbackField.append('<div>' + passwordRequired + '</div>').parent().addClass('has-error')\r\n }\r\n if (password.length < 6) {\r\n passwordFeedbackField.append('<div>' + passwordLengthMessage + '</div>').parent().addClass('has-error')\r\n }\r\n if (!hasNumbers) {\r\n passwordFeedbackField.append('<div>' + oneDigitMessage + '</div>').parent().addClass('has-error')\r\n }\r\n if (!hasUppercase) {\r\n passwordFeedbackField.append('<div>' + oneUppercaseMessage + '</div>').parent().addClass('has-error')\r\n }\r\n if (!!confirmPassword && password !== confirmPassword) {\r\n passwordConfirmFeedbackField.append('<div>' + passwordMatching + '</div>').parent().addClass('has-error')\r\n }\r\n }\r\n\r\n return !isInvalid\r\n }\r\n})\r\n\r\nmodule.exports = ResetPasswordView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar ResetPasswordView = require('login/reset-password/view')\r\nvar LoginService = require('login/service')\r\nvar CompanyService = require('company/company-service')\r\nvar Config = require('config/config')\r\n\r\nvar ResetPasswordWidget = function () {\r\n this.model = new Backbone.Model({\r\n userId: LoginService.getResetUserId(),\r\n resetCode: LoginService.getResetCode(),\r\n isEducationalLicense: Config['IS_EDUCATIONAL_LICENSE']\r\n })\r\n // LoginService.setResetCode('', '')\r\n\r\n if (!this.model.get('userId') || !this.model.get('resetCode')) {\r\n Backbone.trigger('app:navigate', 'login')\r\n throw new Error('No valid UserId or ResetCode, sending back to login page.')\r\n }\r\n\r\n this.view = new ResetPasswordView({\r\n model: this.model\r\n })\r\n\r\n this.loginService = new LoginService()\r\n this.companyService = new CompanyService()\r\n this.view.on('resetPassword', this.resetPassword, this)\r\n}\r\n\r\nResetPasswordWidget.prototype = _.clone(Backbone.Events)\r\n\r\nResetPasswordWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nResetPasswordWidget.prototype.resetPassword = function (password) {\r\n this.loginService.resetPassword(this.model.get('userId'), this.model.get('resetCode'), password).then(function () {\r\n Backbone.trigger('app:navigate', 'login')\r\n })\r\n}\r\n\r\nmodule.exports = ResetPasswordWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar SessionService = require('session/session-service')\r\nvar LoginService = require('login/service')\r\nvar LoginWidget = require('login/widget')\r\nvar ForgotPasswordWidget = require('login/forgot-password/widget')\r\nvar ResetPasswordWidget = require('login/reset-password/widget')\r\n\r\nvar LoginRouter = Router.extend({\r\n routes: {\r\n 'login?token=:token': 'showLoginWithToken',\r\n 'login?token=:partnerToken': 'showLoginWithPartnerToken',\r\n 'login': 'showLogin',\r\n 'login/forgot-password': 'showForgotPassword',\r\n 'login/reset-password-code/:userId/': 'resetPasswordCode',\r\n 'login/reset-password': 'resetPassword'\r\n },\r\n\r\n showLoginWithToken: function (token) {\r\n if (SessionService.isSessionActive()) {\r\n Backbone.trigger('app:navigate', '')\r\n return\r\n }\r\n Backbone.trigger('app:showInFrame', new LoginWidget(token, 1))\r\n Backbone.trigger('app:updateTitle', 'Log in', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Authentication'}, {label: 'Log In', href: '/login'}])\r\n },\r\n\r\n showLoginWithPartnerToken: function (partnerToken) {\r\n if (SessionService.isSessionActive()) {\r\n Backbone.trigger('app:navigate', '')\r\n return\r\n }\r\n Backbone.trigger('app:showInFrame', new LoginWidget(partnerToken, 2))\r\n Backbone.trigger('app:updateTitle', 'Log in', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Authentication'}, {label: 'Log In', href: '/login'}])\r\n },\r\n\r\n showLogin: function () {\r\n if (SessionService.isSessionActive()) {\r\n Backbone.trigger('app:navigate', '')\r\n return\r\n }\r\n Backbone.trigger('app:showInFrame', new LoginWidget())\r\n Backbone.trigger('app:updateTitle', 'Log in', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Authentication'}, {label: 'Log In', href: '/login'}])\r\n },\r\n\r\n showForgotPassword: function () {\r\n if (SessionService.isSessionActive()) {\r\n Backbone.trigger('app:navigate', '')\r\n return\r\n }\r\n Backbone.trigger('app:showInFrame', new ForgotPasswordWidget())\r\n Backbone.trigger('app:updateTitle', 'Forgot Password', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Authentication'}, {label: 'Log In', href: '/login'}, {label: 'Forgot Password'}])\r\n },\r\n\r\n resetPasswordCode: function (userId) {\r\n // Store reset code in localStorage\r\n var resetCode = decodeURIComponent(window.location.hash.substr(1))\r\n LoginService.setResetCode(userId, resetCode)\r\n Backbone.trigger('app:navigate', 'login/reset-password')\r\n },\r\n\r\n resetPassword: function () {\r\n if (SessionService.isSessionActive()) {\r\n Backbone.trigger('app:navigate', '')\r\n return\r\n }\r\n\r\n Backbone.trigger('app:showInFrame', new ResetPasswordWidget())\r\n Backbone.trigger('app:updateTitle', 'Forgot Password', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Authentication'}, {label: 'Log In', href: '/login'}, {label: 'Forgot Password'}])\r\n }\r\n})\r\n\r\nmodule.exports = LoginRouter\r\n","'use strict'\r\n\r\nvar RestClient = require('rest/client')\r\nvar Config = require('config/config')\r\nvar $ = require('jquery')\r\n\r\nvar LoginService = function () {\r\n this.client = new RestClient()\r\n}\r\n\r\nLoginService.prototype.authenticate = function (emailAddress, password) {\r\n if (!emailAddress.includes('@')) {\r\n emailAddress += '@crunched.io'\r\n }\r\n return this.client.postForm(Config['CRUNCHED_API_HOST'] + '/token', { userName: emailAddress, password: password, grant_type: 'password' })\r\n .then(function (response) {\r\n return response.access_token\r\n })\r\n}\r\n\r\nLoginService.prototype.deauthenticate = function () {\r\n localStorage.removeItem('crunchedActiveCompany')\r\n}\r\n\r\nLoginService.prototype.requestResetPassword = function (email) {\r\n return this.client.post(Config['CRUNCHED_API_HOST'] + '/account/forgot-password', email)\r\n}\r\n\r\nLoginService.prototype.registerToken = function (token, authTokenOverride) {\r\n return this.client.post(Config['CRUNCHED_API_HOST'] + '/account/register-token/' + token, { token: token }, authTokenOverride)\r\n}\r\n\r\nLoginService.prototype.resetPassword = function (userId, resetCode, newPassword) {\r\n return this.client.put(Config['CRUNCHED_API_HOST'] + '/account/reset-password', {\r\n userId: userId,\r\n code: resetCode,\r\n password: newPassword\r\n })\r\n}\r\n\r\nLoginService.setResetCode = LoginService.prototype.setResetCode = function (userId, resetCode) {\r\n localStorage.setItem('crunched-reset-password-user-id', userId)\r\n localStorage.setItem('crunched-reset-password-code', resetCode)\r\n}\r\n\r\nLoginService.prototype.getNews = function () {\r\n return this.client.get(Config['CRUNCHED_API_HOST'] + '/account/news')\r\n}\r\n\r\nLoginService.prototype.getProfile = function () {\r\n return this.client.get(Config['CRUNCHED_API_HOST'] + '/account/profile')\r\n}\r\n\r\nLoginService.prototype.updateProfile = function (profile) {\r\n return this.client.put(Config['CRUNCHED_API_HOST'] + '/account/profile', profile).then(function (response) {\r\n response.profile = profile\r\n return response\r\n })\r\n}\r\n\r\nLoginService.getResetUserId = LoginService.prototype.getResetUserId = function () { return localStorage.getItem('crunched-reset-password-user-id') }\r\nLoginService.getResetCode = LoginService.prototype.getResetCode = function () { return localStorage.getItem('crunched-reset-password-code') }\r\n\r\nmodule.exports = LoginService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"inactivity-alter\\\">\\r\\n <div class=\\\"alert alert-danger alert-dismissable\\\">\\r\\n <button type=\\\"button\\\" class=\\\"close\\\" data-dismiss=\\\"alert\\\" aria-hidden=\\\"true\\\">×</button>\\r\\n <p>You were logged out due to inactivity. Please login again to continue your work.</p>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <p class=\\\"col-sm-12\\\">\\r\\n <a href=\\\"/login/forgot-password\\\">Forgot password?</a>\\r\\n </p>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \" <p>\\r\\n <a href=\\\"/registration\\\">Don't have an account?</a>\\r\\n </p>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.inactivityLogout : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"<div class=\\\"block login-container\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"col-md-4 textSection no-padding\\\">\\r\\n <div class=\\\"textContent\\\">\\r\\n <p>Easily view and edit all of your memorized transactions under business settings.</p>\\r\\n <p class=\\\"learnMoreText\\\"><span><a\\r\\n href=\\\"http://get.crunched.help/hc/en-us/sections/204233738-Memorized-Transactions\\\" target=\\\"_blank\\\">Learn\\r\\n More</a></span></p>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"col-md-8 col-lg-8 inputSection\\\">\\r\\n <form class=\\\"form-material\\\" role=\\\"form\\\">\\r\\n <span class=\\\"logo flex\\\">\\r\\n <img src=\\\"/img/crunched-logo-color.svg\\\" class=\\\"logoimageColor-login\\\" alt=\\\"/img/crunched-logo-color.svg\\\">\\r\\n </span>\\r\\n\\r\\n <div class=\\\"text-danger help-block animated fadeInDown validation-summary-errors\\\">\\r\\n <div class=\\\"errorMessage-login\\\"></div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"form-group no-padding emailInputContainer\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"login-email\\\" class=\\\"form-control\\\" name=\\\"email\\\" />\\r\\n <label class=\\\"control-label\\\" for=\\\"login-email\\\">Email Address</label>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"form-group no-padding passwordInputContainer\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"login-password\\\" class=\\\"form-control\\\" type=\\\"password\\\" name=\\\"password\\\" />\\r\\n <label class=\\\"control-label\\\" for=\\\"login-password\\\">Password</label>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"form-group no-padding submit\\\">\\r\\n <button type=\\\"submit\\\" class=\\\"btn btn-primary submit\\\">Log in</button>\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\\r\\n </form>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"no-padding login-footer\\\" style=\\\"text-align: center;\\\">\\r\\n\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <p> © Crunched, Inc. \"\n + container.escapeExpression(((helper = (helper = helpers.copyrightYear || (depth0 != null ? depth0.copyrightYear : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"copyrightYear\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar LoginTemplate = require('login/template')\r\nvar $ = require('jquery')\r\nvar Config = require('config/config')\r\n\r\nvar Config = require('config/config')\r\nvar emailOrPasswordInvalidText = 'Sorry, the email and/or password you entered is invalid.'\r\nvar emailFieldEmptyText = 'Please enter your email.'\r\nvar passwordFieldEmptyText = 'Please enter your password.'\r\nvar bothFieldsEmptyText = 'Please enter your email and password.'\r\n\r\nvar LoginView = Backbone.View.extend({\r\n className: 'login',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:inactivityLogout', this.render)\r\n },\r\n\r\n events: {\r\n 'submit form': 'login'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(LoginTemplate(this.createViewModel()))\r\n $('#page-container').attr('style', 'padding: 0 !important;')\r\n $('#sidebar, #header-navbar, #side-overlay, .content.bg-white.titlebar').attr('style', 'display:none;')\r\n\r\n if (this.model.get('inactivityLogout')) {\r\n this.$el.find('.block').parent().attr('style', 'margin-top: 5%;')\r\n } else {\r\n this.$el.find('.block').parent().attr('style', 'margin-top: 8%;')\r\n }\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n inactivityLogout: this.model.get('inactivityLogout'),\r\n copyrightYear: this.model.get('copyrightYear'),\r\n isEducationalLicense: Config['IS_EDUCATIONAL_LICENSE']\r\n }\r\n },\r\n\r\n validate: function (e) {\r\n var email = this.$(\"[name='email']\").val()\r\n var password = this.$(\"[name='password']\").val()\r\n var feedbackSummary = this.$('.validation-summary-errors').find('.errorMessage-login')\r\n\r\n feedbackSummary.empty()\r\n\r\n if (!email || !password) {\r\n feedbackSummary.empty()\r\n if (!email && !password) {\r\n feedbackSummary.append('<div>' + bothFieldsEmptyText + '</div>')\r\n } else if (!email && !!password) {\r\n feedbackSummary.append('<div>' + emailFieldEmptyText + '</div>')\r\n } else if (!!email && !password) {\r\n feedbackSummary.append('<div>' + passwordFieldEmptyText + '</div>')\r\n }\r\n }\r\n },\r\n\r\n login: function (e) {\r\n e.preventDefault()\r\n var email = this.$(\"[name='email']\").val()\r\n var password = this.$(\"[name='password']\").val()\r\n\r\n this.validate()\r\n\r\n if (email && password) {\r\n this.trigger('login', email, password)\r\n }\r\n },\r\n\r\n showFailedLogin: function () {\r\n this.$(\"[name='password']\").val('')\r\n this.$('input#login-password').parent().removeClass('open')\r\n\r\n var feedbackSummary = this.$('.validation-summary-errors').find('.errorMessage-login')\r\n feedbackSummary.empty()\r\n feedbackSummary.append('<div>' + emailOrPasswordInvalidText + '</div>')\r\n }\r\n})\r\n\r\nmodule.exports = LoginView\r\n","'use strict'\r\n\r\nvar Q = require('q')\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar moment = require('moment')\r\nvar LoginView = require('login/view')\r\nvar LoginService = require('login/service')\r\nvar CompanyService = require('company/company-service')\r\nvar SessionService = require('session/session-service')\r\n\r\nvar LoginWidget = function (token, tokenType) {\r\n this.model = new Backbone.Model({\r\n token: token,\r\n copyrightYear: moment().format('YYYY')\r\n })\r\n\r\n var inactivityLogout = SessionService.getInactivityLogout()\r\n this.model.set('inactivityLogout', inactivityLogout === 'true')\r\n SessionService.setInactivityLogout(false)\r\n\r\n this.view = new LoginView({\r\n model: this.model\r\n })\r\n this.loginService = new LoginService()\r\n this.companyService = new CompanyService()\r\n this.view.on('login', this.login, this)\r\n}\r\n\r\nLoginWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nLoginWidget.prototype.login = function (emailAddress, password) {\r\n this.loginService.authenticate(emailAddress, password).then(function (token) {\r\n if (this.model.get('token')) {\r\n return this.loginService.registerToken(this.model.get('token'), token).then(function () {\r\n $('#page-container, #sidebar, #header-navbar, #side-overlay, .content.bg-white.titlebar').attr('style', null)\r\n $('#logoimage-without-menu').attr('style', 'display:none !important;')\r\n Backbone.trigger('app:login', token, emailAddress)\r\n })\r\n }\r\n\r\n $('#page-container, #sidebar, #header-navbar, #side-overlay, .content.bg-white.titlebar').attr('style', null)\r\n $('#logoimage-without-menu').attr('style', 'display:none !important;')\r\n Backbone.trigger('app:login', token, emailAddress)\r\n }.bind(this), function () {\r\n this.view.showFailedLogin()\r\n throw new Error('Login unsuccessful')\r\n }.bind(this)).then(function () {\r\n return Q.all([this.companyService.fetchCompany(), this.loginService.getProfile(), this.companyService.fetchCompanies()])\r\n }.bind(this)).spread(function (company, profile, companies) {\r\n if (!company) {\r\n Backbone.trigger('app:navigate', 'welcome')\r\n }\r\n SessionService.setNumberOfCompany(companies)\r\n SessionService.setProfile(profile)\r\n this.companyService.setActiveCompany(company)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = LoginWidget\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar MemorizationService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nMemorizationService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nMemorizationService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'memorized-invoices'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nMemorizationService.prototype.getList = function (entryType) {\r\n var apiPath = this.GetPath('list')\r\n\r\n if (entryType) {\r\n apiPath = apiPath + this.GetQuery({ entryType: entryType })\r\n }\r\n\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nMemorizationService.prototype.setStatus = function (memorizationId, status) {\r\n var apiPath = this.GetPath(memorizationId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nMemorizationService.prototype.getAll = function (page, pageSize, sort, sortField, filter) {\r\n var apiPath = this.GetPath() + this.GetQuery({page: page, pageSize: pageSize, sort: sort, sortField: sortField, status: filter})\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nMemorizationService.prototype.setVoid = function (memorizationId) {\r\n var apiPath = this.GetPath(memorizationId, 'void')\r\n return this.restClient.put(apiPath, true)\r\n}\r\n\r\nmodule.exports = MemorizationService\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar MemorizationService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nMemorizationService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nMemorizationService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'memorized-entries'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nMemorizationService.prototype.getList = function (entryType) {\r\n var apiPath = this.GetPath('list')\r\n\r\n if (entryType) {\r\n apiPath = apiPath + this.GetQuery({ entryType: entryType })\r\n }\r\n\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nMemorizationService.prototype.setStatus = function (memorizationId, status) {\r\n var apiPath = this.GetPath(memorizationId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nMemorizationService.prototype.getAll = function (page, pageSize, sort, sortField, filter) {\r\n var apiPath = this.GetPath() + this.GetQuery({page: page, pageSize: pageSize, sort: sort, sortField: sortField, status: filter})\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nMemorizationService.prototype.setVoid = function (memorizationId) {\r\n var apiPath = this.GetPath(memorizationId, 'void')\r\n return this.restClient.put(apiPath, true)\r\n}\r\n\r\nmodule.exports = MemorizationService\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar MemorizationService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nMemorizationService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nMemorizationService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'memorized-payables'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nMemorizationService.prototype.getList = function (entryType) {\r\n var apiPath = this.GetPath('list')\r\n\r\n if (entryType) {\r\n apiPath = apiPath + this.GetQuery({ entryType: entryType })\r\n }\r\n\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nMemorizationService.prototype.setStatus = function (memorizationId, status) {\r\n var apiPath = this.GetPath(memorizationId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nMemorizationService.prototype.getAll = function (page, pageSize, sort, sortField, filter) {\r\n var apiPath = this.GetPath() + this.GetQuery({page: page, pageSize: pageSize, sort: sort, sortField: sortField, status: filter})\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nMemorizationService.prototype.setVoid = function (memorizationId) {\r\n var apiPath = this.GetPath(memorizationId, 'void')\r\n return this.restClient.put(apiPath, true)\r\n}\r\n\r\nmodule.exports = MemorizationService\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar MemorizationService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nMemorizationService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nMemorizationService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'memorized-quotes'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nMemorizationService.prototype.getList = function (entryType) {\r\n var apiPath = this.GetPath('list')\r\n\r\n if (entryType) {\r\n apiPath = apiPath + this.GetQuery({ entryType: entryType })\r\n }\r\n\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nMemorizationService.prototype.setStatus = function (memorizationId, status) {\r\n var apiPath = this.GetPath(memorizationId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nMemorizationService.prototype.getAll = function (page, pageSize, sort, sortField, filter) {\r\n var apiPath = this.GetPath() + this.GetQuery({page: page, pageSize: pageSize, sort: sort, sortField: sortField, status: filter})\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nMemorizationService.prototype.setVoid = function (memorizationId) {\r\n var apiPath = this.GetPath(memorizationId, 'void')\r\n return this.restClient.put(apiPath, true)\r\n}\r\n\r\nmodule.exports = MemorizationService\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<ul class=\\\"nav nav-tabs nav-tabs-alt\\\" data-toggle=\\\"tabs\\\">\\r\\n <li class=\\\"active\\\"><a data-memorization-type=\\\"MemorizedCheck\\\" href=\\\"#new-checks\\\">Check</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedDeposit\\\" href=\\\"#new-deposits\\\">Deposit</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedEFTPayment\\\" href=\\\"#new-eft-payments\\\">EFT Payment</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedEFTDeposit\\\" href=\\\"#new-eft-deposits\\\">EFT Deposit</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedGeneral\\\" href=\\\"#new-journal-entries\\\" class=\\\"general-journal\\\">Journal</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedQuote\\\" href=\\\"#new-quotes\\\">Quote</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedAR\\\" href=\\\"#new-invoices\\\">Invoice</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedAP\\\" href=\\\"#new-payables\\\">Payable</a></li>\\r\\n <li class=\\\"pull-right cancel-button\\\">\\r\\n <i class=\\\"fa fa-close expanding-group-close cancel\\\"></i>\\r\\n </li>\\r\\n</ul>\\r\\n<div class=\\\"block-content tab-content\\\">\\r\\n <div class=\\\"tab-pane active check\\\" id=\\\"new-checks\\\" data-memorization-type=\\\"MemorizedCheck\\\"></div>\\r\\n <div class=\\\"tab-pane deposit\\\" id=\\\"new-deposits\\\" data-memorization-type=\\\"MemorizedDeposit\\\"></div>\\r\\n <div class=\\\"tab-pane eft-payment\\\" id=\\\"new-eft-payments\\\" data-memorization-type=\\\"MemorizedEFTPayment\\\"></div>\\r\\n <div class=\\\"tab-pane eft-deposit\\\" id=\\\"new-eft-deposits\\\" data-memorization-type=\\\"MemorizedEFTDeposit\\\"></div>\\r\\n <div class=\\\"tab-pane journal-entry\\\" id=\\\"new-journal-entries\\\" data-memorization-type=\\\"MemorizedGeneral\\\"></div>\\r\\n <div class=\\\"tab-pane quotes receivables list\\\" id=\\\"new-quotes\\\" data-memorization-type=\\\"MemorizedQuote\\\"></div>\\r\\n <div class=\\\"tab-pane invoices receivables list\\\" id=\\\"new-invoices\\\" data-memorization-type=\\\"MemorizedAR\\\"></div>\\r\\n <div class=\\\"tab-pane payables list\\\" id=\\\"new-payables\\\" data-memorization-type=\\\"MemorizedAP\\\"></div>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('memorization/recurring/create/template')\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar CreateCheckWidget = require('checkbook/check/create-check-widget')\r\nvar CreateDepositWidget = require('checkbook/deposit/create-deposit-widget')\r\nvar CreateEftPaymentWidget = require('checkbook/eft-payment/create-eft-payment-widget')\r\nvar CreateEftDepositWidget = require('checkbook/eft-deposit/create-eft-deposit-widget')\r\nvar CreateJournalEntryWidget = require('journal/create/widget')\r\n\r\nvar ContactsView = CreateView.extend({\r\n className: 'block create collapsed tabbed',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'change input[type=file]': 'selectFile',\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'click .add-more-line-items': 'addContactMethod',\r\n 'change .is-recurring': 'toggleShowRecurring'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function (options) {\r\n if (!this.Template) this.Template = Template\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n\r\n this.createInvoice = options.invoiceCreateView\r\n this.createPayable = options.payableCreateView\r\n this.createQuote = options.quoteCreateView\r\n\r\n var fakeCheckbook = new Backbone.Model({ })\r\n this.createEftDeposit = new CreateEftDepositWidget(fakeCheckbook)\r\n this.createEftPayment = new CreateEftPaymentWidget(fakeCheckbook)\r\n this.createDeposit = new CreateDepositWidget(fakeCheckbook)\r\n this.createCheck = new CreateCheckWidget(fakeCheckbook)\r\n this.createJournalEntry = new CreateJournalEntryWidget()\r\n\r\n this.model.on('change:checkbooks', function () {\r\n fakeCheckbook.set('checkbooks', _.map(this.model.get('checkbooks'), function (checkbook) {\r\n return checkbook.toJSON()\r\n }))\r\n }.bind(this))\r\n\r\n this.createEftPayment.on('eftPaymentCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n this.createEftDeposit.on('eftDepositCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n this.createDeposit.on('depositCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n this.createCheck.on('checkCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n this.createJournalEntry.on('itemCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n\r\n this.memorizationCallbacks = {\r\n MemorizedCheck: this.createCheck.view.memorizationSelected.bind(this.createCheck.view),\r\n MemorizedDeposit: this.createDeposit.view.memorizationSelected.bind(this.createDeposit.view),\r\n MemorizedEFTPayment: this.createEftPayment.view.memorizationSelected.bind(this.createEftPayment.view),\r\n MemorizedEFTDeposit: this.createEftDeposit.view.memorizationSelected.bind(this.createEftDeposit.view),\r\n MemorizedGeneral: this.createJournalEntry.view.memorizationSelected.bind(this.createJournalEntry.view),\r\n MemorizedQuote: this.createQuote.memorizationSelected.bind(this.createQuote),\r\n MemorizedAR: this.createInvoice.memorizationSelected.bind(this.createInvoice),\r\n MemorizedAP: this.createPayable.memorizationSelected.bind(this.createPayable)\r\n }\r\n\r\n this.setMemorizedEntryDateCallback = {\r\n MemorizedCheck: this.createCheck.view.setMemorizedEntryDate.bind(this.createCheck.view),\r\n MemorizedDeposit: this.createDeposit.view.setMemorizedEntryDate.bind(this.createDeposit.view),\r\n MemorizedEFTPayment: this.createEftPayment.view.setMemorizedEntryDate.bind(this.createEftPayment.view),\r\n MemorizedEFTDeposit: this.createEftDeposit.view.setMemorizedEntryDate.bind(this.createEftDeposit.view),\r\n MemorizedGeneral: this.createJournalEntry.view.setMemorizedEntryDate.bind(this.createJournalEntry.view),\r\n MemorizedAR: this.createInvoice.setMemorizedEntryDate.bind(this.createInvoice),\r\n MemorizedAP: this.createPayable.setMemorizedEntryDate.bind(this.createPayable)\r\n }\r\n\r\n this.delegateEventsCallback = {\r\n MemorizedCheck: this.createCheck.view.delegateEvents.bind(this.createCheck.view),\r\n MemorizedDeposit: this.createDeposit.view.delegateEvents.bind(this.createDeposit.view),\r\n MemorizedEFTPayment: this.createEftPayment.view.delegateEvents.bind(this.createEftPayment.view),\r\n MemorizedEFTDeposit: this.createEftDeposit.view.delegateEvents.bind(this.createEftDeposit.view),\r\n MemorizedGeneral: this.createJournalEntry.view.delegateEvents.bind(this.createJournalEntry.view),\r\n MemorizedAR: this.createInvoice.delegateEvents.bind(this.createInvoice),\r\n MemorizedAP: this.createPayable.delegateEvents.bind(this.createPayable)\r\n }\r\n\r\n _.each([\r\n this.createCheck.view, this.createDeposit.view, this.createEftPayment.view, this.createEftDeposit.view, this.createJournalEntry.view, this.createQuote, this.createInvoice, this.createPayable\r\n ], function (view) {\r\n this.listenTo(view, 'autocompleteBound', function ($input, property, dataSource) {\r\n if (property === 'label') {\r\n $input.autocomplete('destroy')\r\n }\r\n })\r\n }.bind(this))\r\n\r\n this.on('showEdit', this.selectMemorization.bind(this))\r\n },\r\n\r\n selectMemorization: function (memorization) {\r\n if (memorization.get('type') === 'MemorizedAR') {\r\n var $el = this.createInvoice.$el\r\n $el.addClass('expanded')\r\n this.$('#new-invoices').html($el)\r\n var memorizationLabel = $el.find('input[name=\"memorizationLabel\"],input[name=label]')\r\n memorizationLabel.attr('no-autocomplete', true)\r\n if (memorizationLabel.data('ui-autocomplete')) {\r\n memorizationLabel.autocomplete('destroy')\r\n }\r\n }\r\n\r\n var memorizationEntry = this.memorizationCallbacks[memorization.get('type')](memorization.get('memorizationId'))\r\n if (memorizationEntry && memorizationEntry.checkbook && memorizationEntry.checkbook.checkbookId) {\r\n var checkbook = _.find(this.model.get('checkbooks'), {attributes: { id: memorizationEntry.checkbook.checkbookId }})\r\n this.setMemorizedEntryDateCallback[memorization.get('type')](memorization.get('recurringDate'), checkbook.get('account'))\r\n } else {\r\n this.setMemorizedEntryDateCallback[memorization.get('type')](memorization.get('recurringDate'))\r\n }\r\n this.delegateEventsCallback[memorization.get('type')]()\r\n this.$('.active').removeClass('active')\r\n this.$(\"a[data-memorization-type='\" + memorization.get('type') + \"']\").closest('li').addClass('active')\r\n this.$(\"div[data-memorization-type='\" + memorization.get('type') + \"']\").addClass('active')\r\n this.$el.addClass('editing')\r\n this.handleClick()\r\n },\r\n\r\n handleClick: function (e) {\r\n if (!this.active) {\r\n this.$el.removeClass('collapsed').addClass('expanded')\r\n if (!this.$el.hasClass('editing')) {\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.close.bind(this))\r\n }\r\n this.active = true\r\n\r\n this.$('.expandable, .block.create').addClass('expanded')\r\n }\r\n },\r\n\r\n expand: function (e) {\r\n this.handleClick(e)\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n this.tabs = {\r\n '#new-eft-deposits': this.createEftDeposit,\r\n '#new-eft-payments': this.createEftPayment,\r\n '#new-deposits': this.createDeposit,\r\n '#new-checks': this.createCheck,\r\n '#new-journal-entries': this.createJournalEntry,\r\n\r\n // These are not widgets, they are the underlying views\r\n '#new-invoices': this.createInvoice,\r\n '#new-payables': this.createPayable,\r\n '#new-quotes': this.createQuote\r\n }\r\n\r\n this.createInvoice.delegateEvents()\r\n this.createPayable.delegateEvents()\r\n this.createQuote.delegateEvents()\r\n\r\n _.each(this.tabs, function (value, key) {\r\n var $el\r\n\r\n if (value.render) {\r\n $el = value.render().$el\r\n } else if (value.show) {\r\n $el = value.show()\r\n }\r\n\r\n this.$(key).html($el)\r\n var memorizationLabel = $el.find('input[name=\"memorizationLabel\"],input[name=label]')\r\n memorizationLabel.attr('no-autocomplete', true)\r\n if (memorizationLabel.data('ui-autocomplete')) {\r\n memorizationLabel.autocomplete('destroy')\r\n }\r\n }.bind(this))\r\n\r\n // We need to manually add the expanded class since we're using these views differently than their intention\r\n _.each([this.createInvoice.$el, this.createPayable.$el, this.createQuote.$el], function ($createView) {\r\n $createView.addClass('expanded')\r\n })\r\n\r\n if (window.location.hash) {\r\n this.$(\"a[href='\" + window.location.hash + \"']\").tab('show')\r\n }\r\n\r\n this.$el.on('click', this.handleClick.bind(this))\r\n },\r\n save: function () { },\r\n toJSON: function () { },\r\n\r\n close: function (e) {\r\n this.$('.expanded').removeClass('expanded')\r\n var isEditing = this.$el.hasClass('editing')\r\n this.$el.addClass('collapsed').removeClass('expanded').removeClass('editing')\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n this.active = false\r\n\r\n $('.ui-autocomplete.ui-front.ui-menu.ui-widget.ui-widget-content').css('display', 'none')\r\n\r\n if (e && e.stopImmediatePropagation) {\r\n e.stopImmediatePropagation()\r\n }\r\n if (isEditing) {\r\n this.reset()\r\n }\r\n },\r\n\r\n cancel: function (e) {\r\n this.close(e)\r\n this.trigger('cancelled')\r\n },\r\n\r\n collapse: function (e) {\r\n this.close(e)\r\n this.trigger('cancelled')\r\n },\r\n\r\n reset: function () {\r\n this.collapse()\r\n _.each(this.tabs, function (value, key) {\r\n if (value.render) {\r\n value.render()\r\n } else if (value.show) {\r\n value.show()\r\n }\r\n })\r\n },\r\n\r\n toggleShowRecurring: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var $checkbox = $currentTarget.find('input')\r\n this.$('.tab-pane.active .recurring-meta-container')\r\n .toggleClass(\r\n 'show-recurring',\r\n !!$checkbox.prop('checked')\r\n )\r\n }\r\n})\r\n\r\nmodule.exports = ContactsView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar ListEntry = require('lists/list/item/entry')\r\n\r\nvar types = {\r\n MemorizedCheck: 'Check',\r\n MemorizedDeposit: 'Deposit',\r\n MemorizedEFTPayment: 'EFT Payment',\r\n MemorizedEFTDeposit: 'EFT Deposit',\r\n MemorizedGeneral: 'Journal Entry',\r\n MemorizedQuote: 'Quote',\r\n MemorizedAR: 'Invoice',\r\n MemorizedAP: 'Payable'\r\n}\r\n\r\nvar Recurring = ListEntry.extend({}, {\r\n parse: function (json) {\r\n var recurring = new Recurring({\r\n shortRecurringDate: moment(json.recurringDate).format('MM/DD/YYYY'),\r\n recurringDate: json.recurringDate,\r\n label: json.label,\r\n description: json.description,\r\n amount: json.amount,\r\n type: json.type,\r\n id: json.id + json.recurringDate,\r\n memorizationId: json.id,\r\n friendlyType: types[json.type]\r\n })\r\n\r\n return recurring\r\n }\r\n})\r\n\r\nmodule.exports = Recurring\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <a class=\\\"fa fa-trash-o pull-right remove\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"type\\\">\"\n + alias4(((helper = (helper = helpers.friendlyType || (depth0 != null ? depth0.friendlyType : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"friendlyType\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"recurring-date date\\\">\"\n + alias4(((helper = (helper = helpers.shortRecurringDate || (depth0 != null ? depth0.shortRecurringDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortRecurringDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"memorization-label\\\">\"\n + alias4(((helper = (helper = helpers.label || (depth0 != null ? depth0.label : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"label\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"description\\\">\"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"amount currency\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.amount : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isVoid : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('memorization/recurring/item/template')\r\n\r\nvar PayableView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n if (this.model.get('isVoid')) this.$el.addClass('notActive')\r\n }\r\n})\r\n\r\nmodule.exports = PayableView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"payableDate-sort\"] || (depth0 != null ? depth0[\"payableDate-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"payableDate-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Queued Transactions</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"type\\\">Type</div>\\r\\n <div class=\\\"recurring-date date\\\">Recurring Date<i data-sort-field=\\\"payableDate\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0[\"payableDate-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"memorization-label\\\">Label</div>\\r\\n <div class=\\\"description\\\">Description</div>\\r\\n <div class=\\\"open-balance currency\\\">Amount</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\"><p class=\\\"center\\\">Loading more payables...</p></div>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('memorization/recurring/list/template')\r\nvar ReccuringEntryView = require('memorization/recurring/item/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\n// TODO: Sorting\r\nvar PayableListView = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort',\r\n 'change select[name=filterSelection]': 'changeFilter'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = ReccuringEntryView\r\n this.model.set('filter', 1)\r\n this.model.set('sort', 'asc')\r\n this.model.set('sortField', 'dueDate')\r\n this.model.set('dueDate-sort', 'asc')\r\n this.model.on('change:unpaidBalance', this.render.bind(this))\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.on('delete', this.showDelete.bind(this))\r\n },\r\n\r\n onRender: function () {\r\n if (this.model.get('filter')) {\r\n this.$('select[name=filterSelection]').val(this.model.get('filter'))\r\n }\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more recurring memorizations...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more recurring memorizations.')\r\n },\r\n\r\n showDelete: function (payableId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + payableId + '\"]'), 'Are you sure you want to delete this recurring transaction?', 'confirmDelete', payableId)\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.unset('payableDate-sort')\r\n this.model.unset('dueDate-sort')\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n },\r\n\r\n changeFilter: function (e) {\r\n var selectedFilter = $(e.currentTarget).val()\r\n\r\n this.model.set({\r\n filter: selectedFilter\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n },\r\n\r\n hide: function () {\r\n this.$el.addClass('hidden')\r\n },\r\n\r\n show: function () {\r\n this.$el.removeClass('hidden')\r\n }\r\n})\r\n\r\nmodule.exports = PayableListView\r\n","'use strict'\r\n\r\nvar recurring = require('memorization/recurring/item/recurring')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar RecurringMemorizations = ListWrapper.extend({\r\n childModel: recurring\r\n})\r\n\r\nmodule.exports = RecurringMemorizations\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar MemorizationService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nMemorizationService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nMemorizationService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'memorizations',\r\n 'recurring'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nMemorizationService.prototype.setStatus = function (memorizationId, status) {\r\n var apiPath = this.GetPath(memorizationId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nMemorizationService.prototype.getAll = function (page, pageSize, sort, sortField, filter) {\r\n var apiPath = this.GetPath() + this.GetQuery({page: page, pageSize: pageSize, sort: sort, sortField: sortField, status: filter})\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nMemorizationService.prototype.setVoid = function (memorizationId) {\r\n var apiPath = this.GetPath(memorizationId, 'void')\r\n return this.restClient.put(apiPath, true)\r\n}\r\n\r\nMemorizationService.prototype.getRecurringCount = function () {\r\n var apiPath = this.GetPath('count')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nMemorizationService.prototype.remove = function (memorizationId, memorizationRecurringDate) {\r\n var apiPath = this.GetPath()\r\n return this.restClient.del(apiPath, {\r\n memorizedEntryId: memorizationId,\r\n recurrenceDate: memorizationRecurringDate\r\n })\r\n}\r\n\r\nmodule.exports = MemorizationService\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var Backbone = require('backbone')\r\nvar ListContainer = require('lists/list/view')\r\nvar ListView = require('memorization/recurring/list/view')\r\nvar CreateView = require('memorization/recurring/create/view')\r\n\r\nvar RecurringView = ListContainer.extend({\r\n className: 'memorization recurring list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n this.listView = new ListView({model: this.model})\r\n this.forwardEvents(this.listView)\r\n\r\n this.forwardEvents(this.invoiceWidget)\r\n this.forwardEvents(this.payableWidget)\r\n this.forwardEvents(this.createQuoteWidget)\r\n\r\n this.createView = new CreateView({\r\n model: this.model,\r\n invoiceCreateView: this.invoiceWidget.getCreateView(),\r\n payableCreateView: this.payableWidget.getCreateView(),\r\n quoteCreateView: this.createQuoteWidget.getCreateView()\r\n })\r\n this.createView.on('cancelled', function () {\r\n this.createView.$el.remove()\r\n }.bind(this))\r\n this.forwardEvents(this.createView)\r\n\r\n this.on('created itemCreated memorizationUpdated memorizationCreated', function () {\r\n this.model.reset()\r\n this.createView.trigger('resetInputs')\r\n Backbone.trigger('app:reloadAside')\r\n }.bind(this))\r\n\r\n this.on('itemDeleted', function () {\r\n Backbone.trigger('app:reloadAside')\r\n })\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n console.log('container -> editDetails')\r\n this.listView.trigger('showEdit', model)\r\n }.bind(this))\r\n\r\n this.on('widgetShown', function () {\r\n this.listView.trigger('bindScroll')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n\r\n this.on('edit get', this.showEdit.bind(this))\r\n\r\n this.on('cancelled', function () {\r\n this.listView.show()\r\n }.bind(this))\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n\r\n this.createView.render()\r\n this.$el.append(this.listView.render().$el)\r\n\r\n return this\r\n },\r\n\r\n showEdit: function (modelId) {\r\n var memorizationEntry = this.model.get('items').get(modelId)\r\n this.listView.hide()\r\n this.createView.trigger('showEdit', memorizationEntry)\r\n this.$el.append(this.createView.$el)\r\n this.createView.delegateEvents()\r\n },\r\n\r\n getCreateView: function () {\r\n return this.createView\r\n },\r\n\r\n getListView: function () {\r\n return this.listView\r\n },\r\n\r\n showError: function (errorMessage) {\r\n this.createView.showError(errorMessage)\r\n }\r\n})\r\n\r\nmodule.exports = RecurringView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar Recurring = require('memorization/recurring/recurring-memorizations')\r\nvar Service = require('memorization/recurring/service')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar ListContainer = require('memorization/recurring/view')\r\nvar InvoiceWidget = require('receivables/invoices/widget')\r\nvar PayableWidget = require('payables/payable/widget')\r\nvar CreateQuoteWidget = require('receivables/quotes/widget')\r\n\r\nvar RecurringWidget = function () {\r\n this.service = new Service()\r\n this.modelType = Recurring\r\n\r\n this.invoiceWidget = new InvoiceWidget()\r\n this.payableWidget = new PayableWidget()\r\n this.createQuoteWidget = new CreateQuoteWidget()\r\n\r\n this.viewType = ListContainer.extend({\r\n invoiceWidget: this.invoiceWidget,\r\n payableWidget: this.payableWidget,\r\n createQuoteWidget: this.createQuoteWidget\r\n })\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n\r\n this.checkbookService = new CheckbookService()\r\n\r\n this.checkbookService.fetchCheckbookList().then(function (checkbooks) {\r\n this.model.set('checkbooks', checkbooks)\r\n }.bind(this)).done()\r\n\r\n this.on('shown', function () {\r\n this.view.trigger('widgetShown')\r\n }.bind(this))\r\n}\r\n\r\nRecurringWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nRecurringWidget.prototype.getCreateView = function () {\r\n return this.view.getCreateView()\r\n}\r\n\r\nRecurringWidget.prototype.getListView = function () {\r\n return this.view.getListView()\r\n}\r\n\r\nRecurringWidget.prototype.edit = function (modelId) { }\r\nRecurringWidget.prototype.get = function (modelId) { }\r\n\r\nRecurringWidget.prototype.confirmDelete = function (modelId) {\r\n var memorizationEntry = this.model.get('items').get(modelId)\r\n return this.service.remove(\r\n memorizationEntry.get('memorizationId'),\r\n memorizationEntry.get('recurringDate')\r\n ).then(function () {\r\n this.view.trigger('itemDeleted', modelId)\r\n }.bind(this))\r\n}\r\n\r\nRecurringWidget.prototype.create = function () { }\r\n\r\nmodule.exports = RecurringWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar RecurringWidget = require('memorization/recurring/widget')\r\n\r\nvar MemorizationRouter = Router.extend({\r\n routes: {\r\n 'memorizations/recurring': 'showRecurring'\r\n },\r\n\r\n showRecurring: function () {\r\n Backbone.trigger('app:showInFrame', new RecurringWidget())\r\n Backbone.trigger('app:updateTitle', 'Queued Transactions', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Queued Transactions'}])\r\n }\r\n})\r\n\r\nmodule.exports = MemorizationRouter\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar MemorizationService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nMemorizationService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nMemorizationService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'memorizations'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nMemorizationService.prototype.setStatus = function (memorizationId, status) {\r\n var apiPath = this.GetPath(memorizationId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nMemorizationService.prototype.getAll = function (page, pageSize, sort, sortField, filter) {\r\n var apiPath = this.GetPath() + this.GetQuery({ page: page, pageSize: pageSize, sort: sort, sortField: sortField, status: filter })\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nMemorizationService.prototype.setVoid = function (memorizationId) {\r\n var apiPath = this.GetPath(memorizationId, 'void')\r\n return this.restClient.put(apiPath, true)\r\n}\r\n\r\nMemorizationService.prototype.getRecurring = function (page, pageSize, sort, sortField) {\r\n var apiPath = this.GetPath('recurring') + this.GetQuery({ page: page || 1, pageSize: pageSize || 100, sort: sort, sortField: sortField })\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nMemorizationService.prototype.getRecurringCount = function () {\r\n var apiPath = this.GetPath('recurring', 'count')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nmodule.exports = MemorizationService\r\n","var Backbone = require('backbone')\r\n\r\nvar MaterialButton = Backbone.View.extend({\r\n Expand: function (e, dataClass) {\r\n if ($('.expanded').length > 0) return\r\n\r\n var $e = $(e.currentTarget || ('.' + e))\r\n dataClass = dataClass || $e.attr('data-class')\r\n var hiddenHeight = $e.find('.hidden-content.' + dataClass).height() + 35\r\n $('#page-container').addClass('expanded')\r\n $e\r\n .addClass('expanded')\r\n .height(hiddenHeight)\r\n .parent()\r\n .addClass(dataClass)\r\n .height(hiddenHeight)\r\n $('.overlay')\r\n .css('opacity', '1')\r\n .off('click')\r\n .on('click', this.Close.bind(this))\r\n\r\n $e.find('.fa-close')\r\n .off('click')\r\n .on('click', this.Close.bind(this))\r\n $e.find('.hidden-content.' + dataClass)\r\n .find('input:first')\r\n .focus()\r\n $e.scrollTop(0)\r\n },\r\n Close: function (e) {\r\n $('.expanded')\r\n .removeClass('expanded')\r\n .filter('.btn')\r\n .attr('style', '')\r\n $('.expanding-btn-group')\r\n .attr('class', 'expanding-btn-group')\r\n .attr('style', '')\r\n $('.overlay').css('opacity', '0')\r\n if (e && e.preventDefault && e.stopImmediatePropagation) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = MaterialButton\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div id=\\\"sidebar-scroll\\\">\\r\\n <div class=\\\"sidebar-content\\\">\\r\\n <div class=\\\"side-header side-content\\\" style=\\\"padding-top: 17px;\\\">\\r\\n <a href=\\\"/\\\">\\r\\n <span class=\\\"logo flex\\\">\\r\\n <img src=\\\"/img/crunched-logo-icon.svg\\\" class=\\\"logoimage-icon\\\" alt=\\\"/img/crunched-logo-icon.svg\\\" />\\r\\n <img src=\\\"/img/crunched-logo-text.svg\\\" class=\\\"logoimage-text sidebar-mini-hide\\\"\\r\\n alt=\\\"/img/crunched-logo-text.svg\\\" />\\r\\n </span>\\r\\n </a>\\r\\n </div>\\r\\n <ul class=\\\"nav-main\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isLoggedIn : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(9, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </ul>\\r\\n <div class=\\\"nav-copyright sidebar-mini-hide\\\">Crunched, Inc. © \"\n + container.escapeExpression(((helper = (helper = helpers.copyrightYear || (depth0 != null ? depth0.copyrightYear : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"copyrightYear\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \" <li><a href=\\\"/\\\"><i class=\\\"fa fa-th-large\\\"></i><span class=\\\"sidebar-mini-hide\\\">Dashboard</span></a></li>\\r\\n <li>\\r\\n <a class=\\\"nav-submenu\\\" data-toggle=\\\"nav-submenu\\\" href=\\\"#\\\"><i class=\\\"si si-calculator\\\"></i><span\\r\\n class=\\\"sidebar-mini-hide\\\">Banking</span></a>\\r\\n <ul>\\r\\n <li><a href=\\\"/checkbook\\\" match=\\\"^/checkbook/[^/]{10,}/?$\\\"><span class=\\\"sidebar-mini-hide\\\">Checkbook</span></a>\\r\\n </li>\\r\\n <li><a href=\\\"/checkbook/reconcile\\\" match=\\\"/checkbook/[^/]*/reconcile\\\"><span\\r\\n class=\\\"sidebar-mini-hide\\\">Reconciliation</span></a></li>\\r\\n </ul>\\r\\n </li>\\r\\n <li>\\r\\n <a class=\\\"nav-submenu\\\" data-toggle=\\\"nav-submenu\\\" href=\\\"#\\\"><i class=\\\"fa fa-money\\\" aria-hidden=\\\"true\\\"></i><span\\r\\n class=\\\"sidebar-mini-hide\\\">Income</span></a>\\r\\n <ul>\\r\\n <li><a href=\\\"/receivables/quotes\\\" match=\\\"/receivables/quotes[^/]*\\\"><span\\r\\n class=\\\"sidebar-mini-hide\\\">Quotes</span></a></li>\\r\\n <li><a href=\\\"/receivables/invoices\\\"><span class=\\\"sidebar-mini-hide\\\">Invoices</span></a></li>\\r\\n <li><a href=\\\"/receivables/payments\\\"><span class=\\\"sidebar-mini-hide\\\">Customer Payments</span></a></li>\\r\\n <li><a href=\\\"/receivables/deposits\\\"><span class=\\\"sidebar-mini-hide\\\">Deposits</span></a></li>\\r\\n </ul>\\r\\n </li>\\r\\n <li>\\r\\n <a class=\\\"nav-submenu\\\" data-toggle=\\\"nav-submenu\\\" href=\\\"#\\\"><i class=\\\"fa fa-credit-card\\\"\\r\\n aria-hidden=\\\"true\\\"></i><span class=\\\"sidebar-mini-hide\\\">Expenses</span></a>\\r\\n <ul>\\r\\n <li><a href=\\\"/payables\\\"><span class=\\\"sidebar-mini-hide\\\">Payables</span></a></li>\\r\\n <li><a href=\\\"/payables/apply-payments\\\"><span class=\\\"sidebar-mini-hide\\\">Apply Payments</span></a></li>\\r\\n </ul>\\r\\n </li>\\r\\n <li><a href=\\\"https://gusto.com/r/sOvGn\\\" target=\\\"_blank\\\"><i class=\\\"fa fa-users\\\" aria-hidden=\\\"true\\\"></i><span\\r\\n class=\\\"sidebar-mini-hide\\\">Payroll </span></a></li>\\r\\n <li><a href=\\\"/journal\\\"><i class=\\\"fa fa-file-text-o\\\" aria-hidden=\\\"true\\\"></i><span class=\\\"sidebar-mini-hide\\\">Journal\\r\\n Entries</span></a></li>\\r\\n <li>\\r\\n <a class=\\\"nav-submenu\\\" data-toggle=\\\"nav-submenu\\\" href=\\\"#\\\"><i class=\\\"fa fa-list\\\" aria-hidden=\\\"true\\\"></i><span\\r\\n class=\\\"sidebar-mini-hide\\\">Lists</span></a>\\r\\n <ul>\\r\\n <li><a href=\\\"/lists/contacts\\\"><span class=\\\"sidebar-mini-hide\\\">Contacts</span></a></li>\\r\\n <li><a href=\\\"/lists/customers\\\"><span class=\\\"sidebar-mini-hide\\\">Customers</span></a></li>\\r\\n <li><a href=\\\"/lists/vendors\\\"><span class=\\\"sidebar-mini-hide\\\">Vendors</span></a></li>\\r\\n <li><a href=\\\"/lists/sales-entries\\\"><span class=\\\"sidebar-mini-hide\\\">Sales Items</span></a></li>\\r\\n <li><a href=\\\"/lists/fixed-assets\\\"><span class=\\\"sidebar-mini-hide\\\">Fixed Assets</span></a></li>\\r\\n </ul>\\r\\n </li>\\r\\n <li>\\r\\n <a class=\\\"nav-submenu\\\" data-toggle=\\\"nav-submenu\\\" href=\\\"#\\\"><i class=\\\"fa fa-book\\\" aria-hidden=\\\"true\\\"></i><span\\r\\n class=\\\"sidebar-mini-hide\\\">Reports</span></a>\\r\\n <ul>\\r\\n <li><a class=\\\"nav-submenu\\\" data-toggle=\\\"nav-submenu\\\" href=\\\"#\\\"><span\\r\\n class=\\\"sidebar-mini-hide\\\">Financial</span></a>\\r\\n <ul>\\r\\n <li><a href=\\\"/reports/information-return-report\\\"><span class=\\\"sidebar-mini-hide\\\">1099 Report</span></a>\\r\\n </li>\\r\\n <li><a href=\\\"/reports/accounts-payable-aging\\\"><span class=\\\"sidebar-mini-hide\\\">AP Aging</span></a></li>\\r\\n <li><a href=\\\"/reports/accounts-receivable-aging\\\"><span class=\\\"sidebar-mini-hide\\\">AR Aging</span></a></li>\\r\\n <li><a href=\\\"/reports/balance-sheet\\\"><span class=\\\"sidebar-mini-hide\\\">Balance Sheet</span></a></li>\\r\\n <li><a href=\\\"/reports/customer-sales-journal\\\"><span class=\\\"sidebar-mini-hide\\\">Customer Sales\\r\\n Journal</span></a></li>\\r\\n <li><a href=\\\"/reports/departments\\\"><span class=\\\"sidebar-mini-hide\\\">Department</span></a></li>\\r\\n <li><a href=\\\"/reports/income-statement\\\"><span class=\\\"sidebar-mini-hide\\\">Income Statement</span></a></li>\\r\\n <li><a href=\\\"/reports/item-sales-journal\\\"><span class=\\\"sidebar-mini-hide\\\">Item Sales Journal</span></a>\\r\\n </li>\\r\\n <li><a href=\\\"/reports/purchases-journal\\\"><span class=\\\"sidebar-mini-hide\\\">Purchases Journal</span></a></li>\\r\\n <li><a href=\\\"/reports/sales-tax-rate\\\"><span class=\\\"sidebar-mini-hide\\\">Sales Tax Rate</span></a></li>\\r\\n </ul>\\r\\n </li>\\r\\n <li><a class=\\\"nav-submenu\\\" data-toggle=\\\"nav-submenu\\\" href=\\\"#\\\"><span\\r\\n class=\\\"sidebar-mini-hide\\\">Accountant</span></a>\\r\\n <ul>\\r\\n <li><a href=\\\"/reports/general-ledger\\\"><span class=\\\"sidebar-mini-hide\\\">General Ledger</span></a></li>\\r\\n <li><a href=\\\"/reports/trial-balance\\\"><span class=\\\"sidebar-mini-hide\\\">Trial Balance</span></a></li>\\r\\n </ul>\\r\\n </li>\\r\\n <li><a class=\\\"nav-submenu\\\" data-toggle=\\\"nav-submenu\\\" href=\\\"#\\\"><span\\r\\n class=\\\"sidebar-mini-hide\\\">Banking</span></a>\\r\\n <ul>\\r\\n <li><a href=\\\"/reports/checkbook-disbursements\\\"><span class=\\\"sidebar-mini-hide\\\">Checkbook\\r\\n Disbursements</span></a></li>\\r\\n <li><a href=\\\"/reports/checkbook-register\\\"><span class=\\\"sidebar-mini-hide\\\">Checkbook Register</span></a>\\r\\n </li>\\r\\n <li><a href=\\\"/reports/reconciliation\\\"><span class=\\\"sidebar-mini-hide\\\">Reconciliation</span></a></li>\\r\\n </ul>\\r\\n </li>\\r\\n <li><a class=\\\"nav-submenu\\\" data-toggle=\\\"nav-submenu\\\" href=\\\"#\\\"><span class=\\\"sidebar-mini-hide\\\">Lists</span></a>\\r\\n <ul>\\r\\n <li><a href=\\\"/reports/chart-of-accounts\\\"><span class=\\\"sidebar-mini-hide\\\">Chart of Accounts</span></a></li>\\r\\n <li><a href=\\\"/reports/customer-list\\\"><span class=\\\"sidebar-mini-hide\\\">Customers</span></a></li>\\r\\n <li><a href=\\\"/reports/fixed-asset\\\"><span class=\\\"sidebar-mini-hide\\\">Fixed Assets</span></a></li>\\r\\n <li><a href=\\\"/reports/vendor-list\\\"><span class=\\\"sidebar-mini-hide\\\">Vendors</span></a></li>\\r\\n </ul>\\r\\n </li>\\r\\n </ul>\\r\\n </li>\\r\\n <li>\\r\\n <a class=\\\"nav-submenu\\\" data-toggle=\\\"nav-submenu\\\" href=\\\"#\\\"><i class=\\\"fa fa-cog\\\" aria-hidden=\\\"true\\\"></i><span\\r\\n class=\\\"sidebar-mini-hide\\\">Settings</span></a>\\r\\n <ul>\\r\\n <li><a href=\\\"/settings/company/edit\\\"><span class=\\\"sidebar-mini-hide\\\">Business Profile</span></a></li>\\r\\n <li><a class=\\\"nav-submenu\\\" data-toggle=\\\"nav-submenu\\\" href=\\\"#\\\"><span class=\\\"sidebar-mini-hide\\\">Business\\r\\n Settings</span></a>\\r\\n <ul>\\r\\n <li><a href=\\\"/settings/accounts\\\"><span class=\\\"sidebar-mini-hide\\\">Account Assignments</span></a></li>\\r\\n <li><a href=\\\"/generalledgeraccounts\\\"><span class=\\\"sidebar-mini-hide\\\">Chart of Accounts</span></a></li>\\r\\n <li><a href=\\\"/settings/closing-entries\\\"><span class=\\\"sidebar-mini-hide\\\">Closing Entries</span></a></li>\\r\\n <li><a href=\\\"/lists/sales-tax-rates\\\"><span class=\\\"sidebar-mini-hide\\\">Sales Tax Setup</span></a></li>\\r\\n <li><a href=\\\"/settings/business-settings\\\"><span class=\\\"sidebar-mini-hide\\\">Year End Date</span></a></li>\\r\\n <li><a href=\\\"/settings/memorizations\\\"><span class=\\\"sidebar-mini-hide\\\">Memorizations</span></a></li>\\r\\n <li><a href=\\\"/settings/invoices\\\"><span class=\\\"sidebar-mini-hide\\\">Invoices</span></a></li>\\r\\n </ul>\\r\\n </li>\\r\\n <li><a class=\\\"nav-submenu\\\" data-toggle=\\\"nav-submenu\\\" href=\\\"#\\\"><span\\r\\n class=\\\"sidebar-mini-hide\\\">Administrative</span></a>\\r\\n <ul>\\r\\n <li><a href=\\\"/settings/profile\\\"><span class=\\\"sidebar-mini-hide\\\">Edit Profile</span></a></li>\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <li><a href=\\\"/settings/checkbooks\\\"><span class=\\\"sidebar-mini-hide\\\">Checkbooks Manager</span></a></li>\\r\\n\"\n + ((stack1 = (helpers.if_not_eq_0 || (depth0 && depth0.if_not_eq_0) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.activeUserRole : depth0),{\"name\":\"if_not_eq_0\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <li><a href=\\\"/memorizations/recurring\\\"><span class=\\\"sidebar-mini-hide\\\">Queued Transactions</span></a></li>\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </ul>\\r\\n </li>\\r\\n </ul>\\r\\n </li>\\r\\n <li><a href=\\\"http://get.crunched.help/hc/en-us\\\" target=\\\"_blank\\\"><i class=\\\"fa fa-life-ring\\\"\\r\\n aria-hidden=\\\"true\\\"></i><span class=\\\"sidebar-mini-hide\\\">Support</span></a></li>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <li><a href=\\\"/settings/users\\\"><span class=\\\"sidebar-mini-hide\\\">Manage Users</span></a></li>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \" <li><a href=\\\"/settings/checkbook/transactions\\\"><span class=\\\"sidebar-mini-hide\\\">Checkbook\\r\\n Transactions</span></a></li>\\r\\n <li><a href=\\\"/settings/reconciliations\\\" match=\\\"/settings/reconciliations/[^/]*/?$\\\"><span\\r\\n class=\\\"sidebar-mini-hide\\\">Closed Reconciliations</span></a></li>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \" <li><a href=\\\"/settings/subscription\\\"><span class=\\\"sidebar-mini-hide\\\">My Subscription</span></a></li>\\r\\n\";\n},\"9\":function(container,depth0,helpers,partials,data) {\n return \" <li><a href=\\\"/login\\\"><i class=\\\"si si-login\\\" alt=\\\"Log in\\\" title=\\\"Log in\\\"></i><span class=\\\"sidebar-mini-hide\\\">Log\\r\\n in</span></a></li>\\r\\n <li><a href=\\\"/registration\\\"><i class=\\\"si si-users\\\"></i><span class=\\\"sidebar-mini-hide\\\">Register</span></a></li>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isValidUrl : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar NavTemplate = require('nav/template')\r\nvar CompanyService = require('company/company-service')\r\nvar Config = require('config/config')\r\n\r\nvar NavView = Backbone.View.extend({\r\n tagName: 'nav',\r\n\r\n id: 'sidebar',\r\n\r\n initialize: function () {\r\n this.companyService = new CompanyService()\r\n\r\n this.listenTo(this.model, 'change', this.render)\r\n Backbone.on('app:navigate', this.updateActiveNav.bind(this))\r\n Backbone.on('activeCompanyChanged', this.render.bind(this))\r\n },\r\n\r\n render: function () {\r\n this.$el.html(NavTemplate(this.createViewModel()))\r\n this.updateActiveNav()\r\n this.$('.nav-main').slimScroll({\r\n height: '91vh'\r\n })\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n var activeCompanyInfo = this.companyService.getActiveCompanyInfo()\r\n var urlFirstIndex = Backbone.history.getFragment(Backbone.history.location.pathname).split('/')\r\n if (urlFirstIndex[0] === 'payment' || urlFirstIndex[0] === 'login' || urlFirstIndex[0] === 'registration' || urlFirstIndex[0] === 'welcome') {\r\n this.isValidUrl = false\r\n } else {\r\n this.isValidUrl = true\r\n }\r\n\r\n return {\r\n activeUserRole: (this.model.get('isLoggedIn') && !!activeCompanyInfo) ? activeCompanyInfo.role : 0,\r\n isLoggedIn: this.model.get('isLoggedIn'),\r\n isValidUrl: this.isValidUrl,\r\n copyrightYear: this.model.get('copyrightYear'),\r\n isEducationalLicense: Config['IS_EDUCATIONAL_LICENSE']\r\n\r\n }\r\n },\r\n\r\n updateActiveNav: function () {\r\n this.$('.active').removeClass('active')\r\n this.$('.open').removeClass('open')\r\n var pathMatching = _.find(this.$('a[match]'), function (ele) {\r\n var pathMatch = this.$(ele).attr('match')\r\n return window.location.pathname.match(pathMatch)\r\n }.bind(this))\r\n var $activeMenuLink\r\n var urlParameter = Backbone.history.getFragment(Backbone.history.location.pathname).split('/')\r\n\r\n if (urlParameter[0] === 'settings' && urlParameter[1] === 'subscription' && urlParameter.length > 2) {\r\n this.urlLocation = '/settings/subscription'\r\n } else {\r\n this.urlLocation = window.location.pathname\r\n }\r\n\r\n if (!pathMatching) {\r\n $activeMenuLink = this.$(\"a[href='\" + this.urlLocation + \"']\").addClass('active')\r\n } else {\r\n $activeMenuLink = this.$(pathMatching).addClass('active')\r\n }\r\n\r\n $activeMenuLink\r\n .closest('li > ul')\r\n .parent()\r\n .parent()\r\n .parent()\r\n .addClass('open')\r\n\r\n $activeMenuLink\r\n .closest('li > ul')\r\n .parent()\r\n .addClass('open')\r\n }\r\n})\r\n\r\nmodule.exports = NavView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar SessionService = require('session/session-service')\r\nvar LoginService = require('login/service')\r\nvar NavView = require('nav/view')\r\nvar Config = require('config/config')\r\nvar moment = require('moment')\r\n\r\nvar NavWidget = function () {\r\n this.model = new Backbone.Model({\r\n isLoggedIn: SessionService.isSessionActive(),\r\n isEducationalLicense: Config['IS_EDUCATIONAL_LICENSE'],\r\n copyrightYear: moment().format('YYYY')\r\n })\r\n\r\n this.view = new NavView({\r\n model: this.model\r\n })\r\n\r\n this.loginService = new LoginService()\r\n Backbone.on('app:sessionStarted', function () {\r\n this.model.set('isLoggedIn', true)\r\n this.view.delegateEvents()\r\n }, this)\r\n\r\n Backbone.on('app:sessionEnded', function () {\r\n this.model.set('isLoggedIn', false)\r\n this.view.delegateEvents()\r\n }, this)\r\n}\r\n\r\nNavWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = NavWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Payable Cut-off Date\",\"inputName\":\"filterDate\",\"inputId\":\"filter-date\",\"wrapperClasses\":\"filter-date\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\");\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var Backbone = require('backbone')\r\nvar Template = require('payables/apply-payment/filter/template')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar PayablesView = Backbone.View.extend({\r\n className: 'filter',\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n\r\n this.listenTo(this.model, 'change:vendorLookup add', this.render.bind(this))\r\n },\r\n\r\n render: function () {\r\n this.$el.html(this.Template(this.model.toViewModel()))\r\n\r\n this.$('.date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('filterDate').format(dateParams.format))\r\n .datepicker('setStartDate', this.model.get('minDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.date').datepicker('hide', null)\r\n this.model.set('filterDate', moment(e.date).endOf('day'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = PayablesView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"payableDate-sort\"] || (depth0 != null ? depth0[\"payableDate-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"payableDate-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"3\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \" <div class=\\\"vendor-row itemrow\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.checkbox,depth0,{\"name\":\"checkbox\",\"hash\":{\"wrapperClasses\":\"vendor-name-global selection\",\"inputName\":\"vendorNameSelect\",\"inputLabel\":(depth0 != null ? depth0.printedName : depth0)},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.filteredPayables : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(4, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"4\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"payable-row itemrow\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" data-vendor-id=\\\"\"\n + alias4(((helper = (helper = helpers.vendorId || (depth0 != null ? depth0.vendorId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"vendorId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"vendor-name-global selection\\\"> </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.checkbox,depth0,{\"name\":\"checkbox\",\"hash\":{\"isChecked\":(depth0 != null ? depth0.isQueued : depth0),\"wrapperClasses\":\"invoice-number selection\",\"inputName\":\"invoiceNumberSelect\",\"inputLabel\":(depth0 != null ? depth0.invoiceNumber : depth0)},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"due-date date\\\">\"\n + alias4(((helper = (helper = helpers.shortDueDate || (depth0 != null ? depth0.shortDueDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortDueDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"spaceBtn\\\"></div>\\r\\n <div class=\\\"form-material floating amount\\\">\\r\\n <input class=\\\"form-control currency currency-field\\\" type=\\\"text\\\" name=\\\"unpaidAmount\\\" value=\\\"\"\n + alias4(((helper = (helper = helpers.unpaidAmount || (depth0 != null ? depth0.unpaidAmount : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"unpaidAmount\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n </div>\\r\\n\\r\\n <div class=\\\"pay-with\\\">\\r\\n <div class=\\\"form-group check-selection\\\">\\r\\n <div class=\\\"form-material floating input-group open\\\" style=\\\"width: 100%;\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"payable-\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" data-vendor-id=\\\"\"\n + alias4(((helper = (helper = helpers.vendorId || (depth0 != null ? depth0.vendorId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"vendorId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depths[1] != null ? depths[1].filteredPayables : depths[1]),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(5, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias3(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"index\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Check \"\n + alias3((helpers.add || (depth0 && depth0.add) || alias2).call(alias1,(data && data.index),1,{\"name\":\"add\",\"hash\":{},\"data\":data}))\n + \"</option>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"title\\\">Apply Payments</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content create expanded\\\">\\r\\n <form>\\r\\n <div>\\r\\n <div class=\\\"payables\\\">\\r\\n <div class=\\\"table table-hover table-borderless history table-striped\\\">\\r\\n <div class=\\\"head\\\">\\r\\n <div class=\\\"vendor-name\\\">Vendor Name<i data-sort-field=\\\"payableDate\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"payableDate-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.checkbox,depth0,{\"name\":\"checkbox\",\"hash\":{\"wrapperClasses\":\"invoice-number-global selection\",\"inputName\":\"invoiceNumberGlobal\",\"inputLabel\":\"Invoice #\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"due-date date\\\">Due Date</div>\\r\\n <div class=\\\"spaceBtn\\\"></div>\\r\\n <div class=\\\"amount currency\\\">Amount</div>\\r\\n <div class=\\\"pay-with\\\">Pay With</div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.filteredVendors : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(3, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"actions\\\">\\r\\n <button class=\\\"btn btn-primary pull-right save post-button\\\">Pay Selected</button>\\r\\n <button class=\\\"btn pull-right cancel-button\\\">Cancel</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\"></div>\\r\\n </form>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true,\"useDepths\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('payables/apply-payment/listing/template')\r\nvar SummaryView = require('payables/apply-payment/summary/view')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar numbro = require('numbro')\r\n\r\nvar PayablesView = CreateView.extend({\r\n className: 'block list',\r\n\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'change input[type=checkbox]': 'selectedChanged',\r\n 'change input[name=unpaidAmount]': 'selectedUnpaidChanged',\r\n 'change select': 'selectedChanged'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.listenTo(this.model, 'add change:queuedChecks change:filteredVendors', this.render.bind(this))\r\n this.summaryView = new SummaryView({\r\n model: this.model\r\n })\r\n\r\n this.on('reviewChecks', this.showPrintReview)\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html(this.Template(this.model.toViewModel()))\r\n this.$('.payables').prepend(this.summaryView.render().$el)\r\n\r\n this.summaryView.delegateEvents()\r\n\r\n this.determineStatus()\r\n\r\n this.$('input[name=checkNumber]').val(this.model.get('nextCheckNumber'))\r\n\r\n return this\r\n },\r\n\r\n determineStatus: function () {\r\n this.$('.status').html(this.getSuccessStatusBar('All data is valid.'))\r\n },\r\n\r\n selectedUnpaidChanged: function (event) {\r\n var $input = $(event.currentTarget)\r\n var val = $input.val()\r\n var payableId = $input.closest('.payable-row').attr('data-id')\r\n\r\n if ($input.hasClass('currency-field')) {\r\n val = numbro().unformat(val)\r\n }\r\n\r\n if (val <= 0 || val > this.model.get('payableLookup')[payableId].get('unpaidAmount')) {\r\n $input.val(numbro(this.model.get('payableLookup')[payableId].get('unpaidAmount')).formatCurrency('$0,0.00'))\r\n this.model.get('payableLookup')[payableId].set('unpaidAmountEdited', this.model.get('payableLookup')[payableId].get('unpaidAmount'))\r\n } else {\r\n this.model.get('payableLookup')[payableId].set('unpaidAmountEdited', val)\r\n }\r\n this.selectedChanged(event)\r\n },\r\n\r\n selectedChanged: function (e) {\r\n var $currentTarget = this.$(e.currentTarget)\r\n var checkboxName = $currentTarget.attr('name')\r\n\r\n if (checkboxName === 'invoiceNumberGlobal') {\r\n this.$('input[type=checkbox]').prop('checked', $currentTarget.prop('checked'))\r\n }\r\n\r\n var vendorId\r\n\r\n if (checkboxName === 'vendorNameSelect') {\r\n vendorId = $currentTarget.closest('.vendor-row').attr('data-id')\r\n this.$('.payable-row[data-vendor-id=' + vendorId + '] input[type=checkbox]').prop('checked', $currentTarget.prop('checked'))\r\n }\r\n\r\n if (checkboxName === 'invoiceNumberSelect') {\r\n vendorId = $currentTarget.closest('.payable-row').attr('data-vendor-id')\r\n\r\n // If any of the payables of that vendor id is not checked\r\n var anyVendorPayablesNotChecked = this.$('.payable-row[data-vendor-id=' + vendorId + '] input[type=checkbox]:not(:checked)').length\r\n this.$('.vendor-row[data-id=' + vendorId + '] input[type=checkbox]').prop('checked', !anyVendorPayablesNotChecked)\r\n }\r\n\r\n var anyNotChecked = this.$('.payable-row input[type=checkbox]:not(:checked)').length\r\n this.$('input[name=invoiceNumberGlobal]').prop('checked', !anyNotChecked)\r\n\r\n var $selectedPayables = this.$('.payable-row input[type=checkbox]:checked').closest('.payable-row')\r\n var $selectedChecks = $selectedPayables.find('.pay-with select')\r\n \r\n if(e.currentTarget.selectedIndex != null){\r\n \r\n vendorId = $currentTarget.closest('.payable-row').attr('data-vendor-id')\r\n var payableId = $currentTarget.attr('data-id')\r\n\r\n var vendorKey = _.findKey(this.model.get('filteredVendors'), function (item) { return item.id == vendorId })\r\n var selectedVendor = _.get(this.model.get('filteredVendors'), vendorKey)\r\n\r\n var payableKey = _.findKey(selectedVendor.get('filteredPayables'), function (item) { return item.id == payableId })\r\n var selectedPayable = _.get(selectedVendor.get('filteredPayables'), payableKey)\r\n \r\n var previousPosition = selectedPayable.get('queuePosition')\r\n\r\n var previousCount = _.filter(selectedVendor.get('filteredPayables'), function (item) {\r\n return item.get('queuePosition') == previousPosition\r\n }).length\r\n\r\n var newCount = _.filter(selectedVendor.get('filteredPayables'), function (item) {\r\n return item.get('queuePosition') == e.currentTarget.selectedIndex\r\n }).length\r\n\r\n selectedPayable.set({\r\n queuePosition: e.currentTarget.selectedIndex\r\n })\r\n\r\n if (previousCount == 14 && newCount == 13) { //enable and disable\r\n _.each(selectedVendor.get('filteredPayables'), function (check) {\r\n this.$('#payable-' + check.get('id') + ' option[value=' + previousPosition + ']').prop('disabled', false)\r\n if (check.get('queuePosition') != e.currentTarget.selectedIndex) {\r\n this.$('#payable-' + check.get('id') + ' option[value=' + e.currentTarget.selectedIndex + ']').prop('disabled', true)\r\n }\r\n })\r\n } else if (previousCount == 14 && newCount != 13) { //enable\r\n _.each(selectedVendor.get('filteredPayables'), function (check) {\r\n this.$('#payable-' + check.get('id') + ' option[value=' + previousPosition + ']').prop('disabled', false)\r\n })\r\n } else if (previousCount != 14 && newCount == 13) {\r\n _.each(selectedVendor.get('filteredPayables'), function (check) {\r\n if (check.get('queuePosition') != e.currentTarget.selectedIndex) {\r\n this.$('#payable-' + check.get('id') + ' option[value=' + e.currentTarget.selectedIndex + ']').prop('disabled', true)\r\n }\r\n })\r\n }\r\n }\r\n\r\n var uniqueChecks = _.uniqBy($selectedChecks, function(check){\r\n return [check.selectedIndex, '-', check.dataset.vendorId].join()\r\n })\r\n\r\n var selectedPayables = _.map($selectedPayables, function (payableRow) {\r\n var payableId = this.$(payableRow).attr('data-id')\r\n return this.model.get('payableLookup')[payableId]\r\n }.bind(this))\r\n\r\n var batchAmount = _.reduce(selectedPayables, function (memo, payable) {\r\n var unpaidAmount = (payable.get('unpaidAmountEdited') === undefined ? payable.get('unpaidAmount') : payable.get('unpaidAmountEdited'))\r\n return memo + unpaidAmount\r\n }, 0)\r\n\r\n this.$('.post-button').prop('disabled', !selectedPayables || selectedPayables.length === 0)\r\n\r\n this.model.set({\r\n checkCount: uniqueChecks.length,\r\n batchAmount: batchAmount,\r\n selectedPayables: selectedPayables\r\n })\r\n },\r\n\r\n toJSON: function () {\r\n var payables = _.values(_.groupBy(_.map(this.$('.payable-row input[type=checkbox]:checked').closest('.payable-row'), function (payableRow) {\r\n var $payableRow = this.$(payableRow)\r\n var vendorId = $payableRow.attr('data-vendor-id')\r\n var payableId = $payableRow.attr('data-id')\r\n var payable = this.model.get('payableLookup')[payableId]\r\n\r\n return {\r\n amount: (payable.get('unpaidAmountEdited') === undefined ? payable.get('unpaidAmount') : payable.get('unpaidAmountEdited')),\r\n payableId: payableId,\r\n checkNumber: $payableRow.find('select').val() + vendorId\r\n }\r\n }.bind(this)), 'checkNumber'))\r\n\r\n return {\r\n startingCheckNumber: this.$('input[name=checkNumber]').val(),\r\n checkbookId: this.$('select.my-checkbooks').val(),\r\n payablePaymentGroups: payables,\r\n postedDate: this.$('input[name=postingDate]').val()\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = PayablesView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <option value=\\\"\\\">---</option>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<span class=\\\"check-count\\\"></span>\\r\\n<div class=\\\"form-group checkbook-selection\\\">\\r\\n <div class=\\\"form-material floating input-group open\\\" style=\\\"width: 100%;\\\">\\r\\n <select class=\\\"form-control my-checkbooks\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" <option value=\\\"null\\\">Create New</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\">Checkbook</label>\\r\\n </div>\\r\\n</div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Check Date\",\"inputId\":\"posting-date\",\"wrapperClasses\":\"posting-date\",\"inputName\":\"postingDate\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Check #\",\"wrapperClasses\":\"check-number\",\"inputName\":\"checkNumber\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputLabel\":\"Ending Check #\",\"wrapperClasses\":\"check-number-ending\",\"inputName\":\"checkNumberEnding\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputClasses\":\"currency-field\",\"inputLabel\":\"Batch Amount\",\"wrapperClasses\":\"batch-amount\",\"inputName\":\"batchAmount\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputClasses\":\"currency-field\",\"inputLabel\":\"Projected Balance\",\"wrapperClasses\":\"projected-amount\",\"inputName\":\"projectedAmount\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\");\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var Backbone = require('backbone')\r\nvar Template = require('payables/apply-payment/summary/template')\r\nvar numbro = require('numbro')\r\nvar moment = require('moment')\r\n\r\nvar SummaryView = Backbone.View.extend({\r\n className: 'summary',\r\n\r\n events: {\r\n 'keyup input[name=checkNumber]': 'changeCheckNumber',\r\n 'change .my-checkbooks': 'changeCheckbook'\r\n },\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:checkbooks change:availableBalance change:checkCount change:batchAmount', this.render.bind(this))\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.model.toViewModel()))\r\n\r\n var batchAmount = this.model.get('batchAmount') || 0\r\n var availableBalance = this.model.get('availableBalance') || 0\r\n var checkCount = this.model.get('checkCount') || 0\r\n\r\n this.$('.date').datepicker({\r\n format: 'mm/dd/yyyy',\r\n autoclose: true,\r\n todayHighlight: true\r\n }).datepicker('setDate', this.model.get('checkDate'))\r\n .closest('.floating')\r\n .addClass('open')\r\n .find('input').mask('99/99/9999', { placeholder: 'MM/DD/YYYY' })\r\n .on('change', function (e) {\r\n // Ensure that the selected date is stored so it is not lost when payments are selected\r\n this.model.set('checkDate', e.currentTarget.value)\r\n }.bind(this))\r\n\r\n this.$('input[name=checkNumber]').val(this.model.get('nextCheckNumber'))\r\n this.$('select.my-checkbooks').val(this.model.get('checkbookId'))\r\n this.$('input[name=checkNumberEnding]').val(this.model.get('nextCheckNumber') + (this.model.get('checkCount') || 1) - 1)\r\n this.$('.check-count').text(checkCount + ' Checks')\r\n this.$('input[name=batchAmount]').val(numbro(batchAmount).formatCurrency('$0,0.00'))\r\n this.$('input[name=projectedAmount]').val(numbro(availableBalance - batchAmount).formatCurrency('$0,0.00'))\r\n\r\n return this\r\n },\r\n\r\n changeCheckNumber: function () {\r\n this.model.set('nextCheckNumber', this.$('input[name=checkNumber]').val())\r\n this.$('input[name=checkNumberEnding]').val(Number(this.model.get('nextCheckNumber')) + Number((this.model.get('checkCount') || 1)) - 1)\r\n },\r\n\r\n changeCheckbook: function () {\r\n var checkbookId = this.$('select.my-checkbooks').val()\r\n this.model.set('checkbookId', checkbookId)\r\n }\r\n})\r\n\r\nmodule.exports = SummaryView\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListContainer = require('lists/list/view')\r\nvar Template = require('payables/apply-payment/template')\r\nvar ListingView = require('payables/apply-payment/listing/view')\r\nvar FilterView = require('payables/apply-payment/filter/view')\r\nvar RibbonTemplate = require('forms/ribbon')\r\nvar PrintReviewWidget = require('checkbook/print-review/widget')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar SpinnerView = require('spinner/view')\r\n\r\nvar PayablesView = ListContainer.extend({\r\n className: 'payables apply-payment',\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n\r\n this.model.set({ \r\n filterDate: moment.utc().endOf('day').add(7, 'days'),\r\n minDate:moment.utc()\r\n })\r\n\r\n this.listingView = new ListingView({model: this.model})\r\n this.forwardEvents(this.listingView)\r\n\r\n this.filterView = new FilterView({model: this.model})\r\n\r\n this.on('created', function () {\r\n this.listingView.trigger('checksCreated')\r\n }.bind(this))\r\n\r\n this.on('printReview', function (checks) {\r\n this.listingView.trigger('reviewChecks', checks)\r\n }.bind(this))\r\n\r\n this.listenTo(this.model, 'add change:queuedChecks change:filteredVendors change:pageLoaded', this.render.bind(this))\r\n this.spinner = new SpinnerView()\r\n },\r\n\r\n render: function () {\r\n this.$el.html('')\r\n if (!!this.model.get('pageLoaded') && this.model.get('pageLoaded')) {\r\n if (!this.model.get('filteredVendors') || !this.model.get('filteredVendors').length) {\r\n this.$el.append(this.filterView.render().$el)\r\n this.$el.append(RibbonTemplate({message: 'No payables found'}))\r\n } else {\r\n this.$el.append(this.filterView.render().$el)\r\n this.filterView.delegateEvents()\r\n this.$el.append(this.listingView.render().$el)\r\n this.listingView.delegateEvents()\r\n }\r\n } else {\r\n this.$el.append('<div class=\"spinnerImage\"><i class=\"fa fa-3x fa-cog fa-spin spinner-image\"></i></div>')\r\n }\r\n\r\n if (this.model.get('queuedChecks') && this.model.get('queuedChecks').length) {\r\n this.showPrintReview(this.model.get('queuedChecks'))\r\n }\r\n\r\n if (this.model.get('filteredVendors') && this.model.get('filteredVendors').length > 0) {\r\n _.each(this.model.get('filteredVendors'), function (vendor) {\r\n var payables = vendor.get('filteredPayables')\r\n if (payables.length > 14) {\r\n var checksToDisable = Math.round(payables.length / 14)\r\n\r\n for (var i = payables.length - 1; i >= 0; i--) {\r\n this.$('#payable-' + payables[i].id).val(payables[i].get('queuePosition'))\r\n\r\n for (var j = 0; j < checksToDisable; j++) {\r\n if (j !== payables[i].get('queuePosition')) {\r\n this.$('#payable-' + payables[i].id + ' option[value=' + j + ']').prop('disabled', true)\r\n }\r\n }\r\n }\r\n }\r\n })\r\n }\r\n return this\r\n },\r\n\r\n showPrintReview: function (checks) {\r\n var printReview = new PrintReviewWidget(this.model, checks)\r\n var $printReview = printReview.show()\r\n this.$el.append($printReview)\r\n\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n })\r\n $('.review-message').css({\r\n display: 'none'\r\n })\r\n\r\n printReview.on('reviewCompleted', function () {\r\n this.trigger('reviewCompleted')\r\n $printReview.remove()\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n }.bind(this))\r\n }\r\n})\r\n\r\nmodule.exports = PayablesView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar Q = require('q')\r\nvar GenericListWidget = require('lists/list/widget')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar PayableService = require('payables/payable/service')\r\nvar VendorService = require('lists/vendors/service')\r\nvar Vendors = require('lists/vendors/vendors')\r\nvar sweetAlert = require('sweetalert2')\r\nvar moment = require('moment')\r\n\r\nvar ApplyPaymentView = require('payables/apply-payment/view')\r\n\r\nvar ApplyPaymentWidget = function () {\r\n this.service = new PayableService()\r\n this.vendorService = new VendorService()\r\n this.checkbookService = new CheckbookService()\r\n this.viewType = ApplyPaymentView\r\n this.modelType = Vendors\r\n\r\n this.checkbookService.fetchCheckbookList()\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n\r\n this.loadUnpaid()\r\n this.loadCheckbooks()\r\n\r\n this.model.on('change:checkbookId', this.loadCheckbook.bind(this))\r\n this.model.on('add', this.filterUnpaid.bind(this))\r\n this.model.on('change:filterDate', this.filterDateSelectedForUnpaid.bind(this))\r\n this.view.on('reviewCompleted', function () {\r\n this.loadCheckbook().then(this.loadUnpaid.bind(this))\r\n }.bind(this))\r\n}\r\n\r\nApplyPaymentWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nApplyPaymentWidget.prototype.loadCheckbooks = function () {\r\n this.checkbookService.fetchCheckbookList().then(function (checkbooks) {\r\n if (Object.keys(checkbooks).length === 0) {\r\n sweetAlert({\r\n title: 'Warning',\r\n text: 'To apply payables payments, a checkbook is required to record the payments. Please create one.',\r\n type: 'warning',\r\n showCancelButton: false,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Ok'\r\n }).then(function () {\r\n Backbone.trigger('app:navigate', 'settings/checkbooks')\r\n })\r\n }\r\n\r\n var firstCheckbook = _.first(checkbooks)\r\n this.model.set({\r\n 'checkbooks': checkbooks,\r\n 'checkbookList': _.keyBy(checkbooks, 'id'),\r\n 'checkDate': moment().format()\r\n })\r\n this.model.set('checkbookId', firstCheckbook.id)\r\n }.bind(this))\r\n}\r\n\r\nApplyPaymentWidget.prototype.loadCheckbook = function () {\r\n var checkbookId = this.model.get('checkbookId')\r\n return Q.all([\r\n this.checkbookService.fetchAvailableAccountBalance(checkbookId),\r\n this.checkbookService.fetchStartingCheckNumber(checkbookId),\r\n this.checkbookService.fetchQueued(checkbookId, true)\r\n ]).spread(function (availableBalance, startingCheckNumber, queuedChecks) {\r\n this.model.set({\r\n availableBalance: availableBalance,\r\n nextCheckNumber: startingCheckNumber.startingNumber,\r\n queuedChecks: queuedChecks\r\n })\r\n }.bind(this))\r\n}\r\n\r\nApplyPaymentWidget.prototype.loadUnpaid = function () {\r\n this.model.reset()\r\n this.model.set('pageLoaded', false)\r\n return this.service.getUnpaid().then(function (unpaid) {\r\n this.model.add(_.map(unpaid, this.childModel.bind(this)))\r\n this.model.set('payableGroups', _.map(unpaid, this.childModel.bind(this)))\r\n var payees = this.model.get('payableGroups')\r\n this.model.set({\r\n checkCount: 0,\r\n vendorLookup: _.keyBy(payees, 'id'),\r\n payableLookup: _.keyBy(_.flatten(_.map(payees, function (payee) {\r\n return payee.get('unpaidPayables')\r\n })), 'id')\r\n })\r\n this.filterUnpaid()\r\n return unpaid\r\n }.bind(this)).done(function () {\r\n this.model.set('pageLoaded', true)\r\n }.bind(this))\r\n}\r\n\r\nApplyPaymentWidget.prototype.loadPage = function () {\r\n // Do nothing\r\n}\r\n\r\nApplyPaymentWidget.prototype.create = function (model) {\r\n if (this.creating) {\r\n return\r\n }\r\n this.creating = true\r\n\r\n var defer = Q.defer()\r\n this.loopLoadingUnpaid(defer)\r\n\r\n return this.service.applyPayments(model).then(function () {\r\n this.creating = false\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('created')\r\n this.view.trigger.apply(this.view, args)\r\n\r\n return defer.promise\r\n }.bind(this), function (error) {\r\n this.creating = false\r\n console.error('Error creating:', error)\r\n this.view.trigger('createError', error)\r\n }.bind(this)).then(function (queue) {\r\n this.model.set('queuedChecks', queue)\r\n }.bind(this)).done()\r\n}\r\n\r\nApplyPaymentWidget.prototype.loopLoadingUnpaid = function (originalPromise) {\r\n var checkbookId = this.model.get('checkbookId')\r\n var gotResponse = false\r\n var aliveChecker = -1\r\n this.checkbookService.fetchQueued(checkbookId, true).then(function (queue) {\r\n clearTimeout(aliveChecker)\r\n if (queue.length === 0) {\r\n // Try again 5 seconds after we get the response from the previous try\r\n setTimeout(this.loopLoadingUnpaid.bind(this, originalPromise), 5000)\r\n } else {\r\n gotResponse = true\r\n originalPromise.resolve(queue)\r\n }\r\n }.bind(this), function () {\r\n console.warn('Error caught when trying to get print review queue')\r\n setTimeout(this.loopLoadingUnpaid.bind(this, originalPromise), 5000)\r\n })\r\n\r\n aliveChecker = setTimeout(function () {\r\n if (!gotResponse) {\r\n console.log('No response detected, did the request time out?')\r\n this.loopLoadingUnpaid(originalPromise)\r\n }\r\n }.bind(this), 15000)\r\n}\r\n\r\nApplyPaymentWidget.prototype.filterUnpaid = function () {\r\n var payees = _.map(this.model.get('payableGroups'), function (item) {\r\n var filteredPayables = item.get('unpaidPayables')\r\n\r\n filteredPayables = _.sortBy(filteredPayables, function (payable) {\r\n return payable.get('dueDate')\r\n })\r\n\r\n item.set('filteredPayables', filteredPayables)\r\n\r\n if (item.attributes.filteredPayables.length > 0) {\r\n var position = 0\r\n _.each(item.attributes.filteredPayables, function (payable) {\r\n var index = item.attributes.filteredPayables.indexOf(payable)\r\n if (index !== 0 && index % 14 === 0) {\r\n position++\r\n }\r\n payable.attributes.queuePosition = position\r\n })\r\n }\r\n\r\n return item\r\n })\r\n this.model.set('filteredVendors', _.filter(payees, function (payee) {\r\n return payee.get('filteredPayables').length\r\n }))\r\n}\r\n\r\nApplyPaymentWidget.prototype.filterDateSelectedForUnpaid = function () {\r\n var filterDate = this.model.get('filterDate')\r\n this.model.reset()\r\n this.model.set('pageLoaded', false)\r\n return this.service.getUnpaid(filterDate).then(function (unpaid) {\r\n this.model.add(_.map(unpaid, this.childModel.bind(this)))\r\n this.model.set('payableGroups', _.map(unpaid, this.childModel.bind(this)))\r\n\r\n var $selectedPayables = $('.payable-row input[type=checkbox]:checked').closest('.payable-row')\r\n var $selectedChecks = $selectedPayables.find('.pay-with select')\r\n var uniqueChecks = _.uniqBy($selectedChecks, function (x) {\r\n return [x.selectedIndex, '-', x.dataset.vendorId].join()\r\n })\r\n\r\n var payees = this.model.get('payableGroups')\r\n this.model.set({\r\n checkCount: uniqueChecks.length,\r\n vendorLookup: _.keyBy(payees, 'id'),\r\n payableLookup: _.keyBy(_.flatten(_.map(payees, function (payee) {\r\n return payee.get('unpaidPayables')\r\n })), 'id')\r\n })\r\n return unpaid\r\n }.bind(this)).done(function () {\r\n this.filterUnpaid()\r\n this.model.set('pageLoaded', true)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = ApplyPaymentWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"expense-distribution flex\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"accountId\\\" />\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"AccountNumber\",\"inputId\":\"id\",\"wrapperClasses\":\"accountNumber autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Description\",\"inputName\":\"Description\",\"inputId\":\"description\",\"wrapperClasses\":\"accountName autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"currency currency-field\",\"inputLabel\":\"Amount\",\"inputName\":\"distributionAmount\",\"inputId\":\"distributionAmount\",\"wrapperClasses\":\"expense autocomplete\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <i class=\\\"fa fa-close remove\\\"></i>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurringFrequency\\\" size=\\\"1\\\">\\r\\n <option value=\\\"1\\\">Weekly</option>\\r\\n <option value=\\\"2\\\">Bi-Weekly</option>\\r\\n <option value=\\\"3\\\">Monthly</option>\\r\\n <option value=\\\"4\\\">Bi-Monthly</option>\\r\\n <option value=\\\"5\\\">Quarterly</option>\\r\\n <option value=\\\"6\\\">Semi-Annual</option>\\r\\n <option value=\\\"7\\\">Annual</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Frequency</label>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, buffer = \n \" <div class=\\\"form-group recurring-checkbook-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurring-checkbook\\\" size=\\\"1\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Checkbook</label>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \" <input type=\\\"hidden\\\" name=\\\"recurring-checkbook\\\" />\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, buffer = \n \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3 class=\\\"title\\\"></h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side vendor-info\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizationId\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizedEntryDate\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"vendorId\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Memorized Label\",\"inputName\":\"label\",\"inputId\":\"memorized-label\",\"wrapperClasses\":\"memorized-label\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Vendor ID\",\"inputName\":\"vendorIdSearch\",\"inputId\":\"vendor-id-search\",\"wrapperClasses\":\"vendor-id-search\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Vendor Name\",\"inputName\":\"name\",\"inputId\":\"vendor-name-search\",\"wrapperClasses\":\"vendor-name-search\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Printed Name\",\"inputName\":\"printedName\",\"inputId\":\"printedName\",\"wrapperClasses\":\"printed-name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 1\",\"inputName\":\"addressLine1\",\"inputId\":\"address-line1\",\"wrapperClasses\":\"address-line1\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 2\",\"inputName\":\"addressLine2\",\"inputId\":\"address-line2\",\"wrapperClasses\":\"address-line2\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"city-state\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"City\",\"inputName\":\"city\",\"inputId\":\"city\",\"wrapperClasses\":\"city\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.stateSelect,depth0,{\"name\":\"stateSelect\",\"hash\":{\"inputId\":\"state\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Zip Code\",\"inputName\":\"postalCode\",\"inputId\":\"zipcode\",\"wrapperClasses\":\"zipcode\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side payable-info\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"wrapperClasses\":\"invoice-number\",\"inputLabel\":\"Invoice Number\",\"inputName\":\"invoiceNumber\",\"inputId\":\"invoiceNumber\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"wrapperClasses\":\"terms\",\"inputLabel\":\"Terms\",\"inputName\":\"terms\",\"inputId\":\"terms\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Date\",\"wrapperClasses\":\"payable-date\",\"inputName\":\"payableDate\",\"inputId\":\"payableDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Amount\",\"inputClasses\":\"currency currency-field\",\"inputName\":\"amount\",\"wrapperClasses\":\"amount\",\"inputId\":\"amount\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group queueTime\\\">\\r\\n <div class=\\\"form-material\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"queue\\\" name=\\\"queue\\\" size=\\\"1\\\">\\r\\n <option value=\\\"0\\\">No Queue</option>\\r\\n <option value=\\\"1\\\">1 Day</option>\\r\\n <option value=\\\"3\\\">3 Days</option>\\r\\n <option value=\\\"5\\\">5 Days</option>\\r\\n <option value=\\\"7\\\">7 Days</option>\\r\\n <option value=\\\"14\\\">14 Days</option>\\r\\n <option value=\\\"30\\\">30 Days</option>\\r\\n <option value=\\\"60\\\">60 Days</option>\\r\\n <option value=\\\"90\\\">90 Days</option>\\r\\n </select>\\r\\n <label for=\\\"new-account-type\\\">Queue</label>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Due Date\",\"wrapperClasses\":\"due-date\",\"inputName\":\"dueDate\",\"inputId\":\"payableDueDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputLabel\":\"Discount\",\"inputClasses\":\"currency currency-field\",\"inputName\":\"reduction\",\"wrapperClasses\":\"reduction\",\"inputId\":\"reduction\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"PO/Ref#\",\"inputName\":\"referenceNumber\",\"wrapperClasses\":\"reference-number\",\"inputId\":\"referenceNumber\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.checkbox,depth0,{\"name\":\"checkbox\",\"hash\":{\"wrapperClasses\":\"is-1099\",\"inputName\":\"is1099\",\"inputLabel\":\"1099\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group is-recurring\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Recurring</span> <input type=\\\"checkbox\\\" name=\\\"isRecurring\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"distribution item-list\\\">\\r\\n <h3>Expense Distribution</h3>\\r\\n <div class=\\\"line-item-container forceLabelsOpen\\\">The payable has no expense distributions.</div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Expense Distribution</button>\\r\\n <br />\\r\\n <div class=\\\"col-xs-12 recurring-meta-container no-padding\\\">\\r\\n <h3>Recurrence</h3>\\r\\n <div class=\\\"flex col-xs-12\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Start Date\",\"wrapperClasses\":\"recurring-start-date\",\"inputName\":\"recurringDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group recurring-frequency-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(alias1,options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(7, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"distribution item-list\\\" id=\\\"payment-history-container\\\" style=\\\"display:none;\\\">\\r\\n <h3>Payment History</h3>\\r\\n <div class=\\\"payment-line-item-container forceLabelsOpen\\\"></div>\\r\\n <br />\\r\\n </div>\\r\\n\\r\\n <div class=\\\"review\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.textarea,depth0,{\"name\":\"textarea\",\"hash\":{\"inputRows\":\"7\",\"inputLabel\":\"Notes\",\"inputName\":\"notes\",\"inputId\":\"notes\",\"wrapperClasses\":\"notes-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <br>\\r\\n <button class=\\\"btn btn-primary memorize-button\\\">Memorize</button>\\r\\n <button class=\\\"btn btn-primary pull-right save post-button\\\">Payable</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-primary-lighter\\\" style=\\\"display: block;\\\"><i class=\\\"fa fa-check-circle fa-2x fa-inverse\\\"></i><span\\r\\n class=\\\"message\\\">Payable is valid.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('payables/payable/create/template')\r\nvar ExpenseDistribution = require('payables/payable/create/expense-distribution')\r\nvar moment = require('moment')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar numbro = require('numbro')\r\nvar sweetAlert = require('sweetalert2')\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar CreatePayable = CreateView.extend({\r\n className: 'block create',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'click': 'expand',\r\n 'click .add-more-line-items': 'addDistribution',\r\n 'click .memorize-button': 'memorize'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) this.Template = Template\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n this.on('resetInputs', function () {\r\n this.cachedAvatar = null\r\n }, this)\r\n\r\n this.on('bindAutocomplete', this.bindAutocomplete, this)\r\n this.on('bindMemorizations', this.bindMemorizations, this)\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n // Due Date\r\n this.$('.due-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('dueDate').format(dateParams.format))\r\n .datepicker('setStartDate', this.model.get('payableDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.payable-date .date').datepicker('setEndDate', e.date)\r\n this.$('.due-date .date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // Payable Date\r\n this.$('.payable-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('payableDate').format(dateParams.format))\r\n .datepicker('setEndDate', this.model.get('dueDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.due-date .date').datepicker('setStartDate', e.date)\r\n this.$('.payable-date .date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.recurring-start-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('payableDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.recurring-start-date .date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n var $amount = this.$('input[name=amount]')\r\n $amount.on('keyup', function (e) {\r\n if (numbro().unformat($amount.val()) < 0) {\r\n $amount.val('')\r\n }\r\n })\r\n\r\n this.bindAutocomplete()\r\n this.bindMemorizations()\r\n },\r\n\r\n bindAutocomplete: function () {\r\n var vendorListWithId = _.filter(this.model.get('vendorList'), function (vendor) {\r\n return vendor.vendorId !== ''\r\n })\r\n\r\n this.autoComplete(\r\n vendorListWithId,\r\n 'vendorId',\r\n this.$('input[name=vendorIdSearch]'),\r\n this.vendorSelected.bind(this)\r\n )\r\n\r\n this.autoComplete(\r\n this.model.get('vendorList'),\r\n 'name',\r\n this.$('input[name=name]'),\r\n this.vendorSelected.bind(this)\r\n )\r\n },\r\n\r\n bindMemorizations: function () {\r\n this.autoComplete(\r\n this.model.get('memorizationList'),\r\n 'label',\r\n this.$('input[name=label]'),\r\n this.memorizationSelected.bind(this),\r\n 'CREATENEW'\r\n )\r\n },\r\n\r\n memorizationSelected: function (memorization) {\r\n if (typeof memorization === 'string') {\r\n memorization = _.find(this.model.get('memorizationList'), { id: memorization })\r\n }\r\n\r\n this.$('input[name=label]').val(memorization.label).closest('.floating').addClass('open')\r\n\r\n this.$('input[name=memorizationId]')\r\n .val(memorization.id)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n if (memorization.id === 'CREATENEW') {\r\n return\r\n }\r\n\r\n _.each(this.$('input:not([type=file]), textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var isDate = $el.closest('.form-material').hasClass('date')\r\n var isCurrency = $el.hasClass('currency') || $el.hasClass('currency-field')\r\n if (isCheckbox) {\r\n $el.prop('checked', memorization[$el.attr('name')])\r\n } else if (isDate) {\r\n $el.val(moment(memorization[$el.attr('name')]).format(dateParams.format)).closest('.floating').addClass('open')\r\n } else if (isCurrency) {\r\n $el.val(numbro(memorization[$el.attr('name')]).formatCurrency('$0,0.00')).closest('.floating').addClass('open')\r\n } else if (memorization[$el.attr('name')]) {\r\n $el.val(memorization[$el.attr('name')]).closest('.floating').addClass('open')\r\n }\r\n }.bind(this))\r\n\r\n this.$('.is-recurring input').prop('checked', memorization.isRecurring)\r\n this.$('select[name=recurringFrequency]').val(memorization.recurringFrequency)\r\n\r\n this.$('.recurring-start-date .date')\r\n .datepicker('setDate', moment(memorization.recurringDate)._d)\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // Remove empty customer line from the create side\r\n this.$('.expense-distribution').remove()\r\n\r\n this.$('.line-item-container').html('')\r\n // Add customer lines with our data\r\n _.forEach(memorization['payableDistributions'], function (lineItem) {\r\n var $distribution = this.addDistribution()\r\n $distribution.find('input[name=accountId]').val(lineItem.account.id)\r\n $distribution.find('input[name=AccountNumber]').val(lineItem.account.accountNumber).parent().addClass('open')\r\n $distribution.find('input[name=Description]').val(lineItem.account.accountName).parent().addClass('open')\r\n $distribution.find('input[name=distributionAmount]').val(numbro(lineItem.amount).formatCurrency('$0,0.00')).parent().addClass('open')\r\n }.bind(this))\r\n },\r\n\r\n isValid: function () {\r\n return this.$('input[name=amount]').val() &&\r\n this.$('input[name=printedName]').val() &&\r\n this.$('input[name=payableDate]').val() &&\r\n this.$('input[name=dueDate]').val() &&\r\n this.getDistributions().length &&\r\n !this.calculateDiscrepency()\r\n },\r\n\r\n determineStatus: function () {\r\n var errorMessage\r\n if (this.isValid()) {\r\n this.$('.status').html(this.getSuccessStatusBar('Payable is valid.'))\r\n } else if (!this.$('input[name=amount]').val()) {\r\n errorMessage = 'Needs a valid amount to be paid.'\r\n } else if (!this.$('input[name=printedName]').val()) {\r\n errorMessage = 'The vendor needs at least a printed name.'\r\n } else if (!this.$('input[name=payableDate]').val() || !this.$('input[name=dueDate]').val()) {\r\n errorMessage = 'Invalid dates, must have a payable date and a due date.'\r\n } else if (!this.getDistributions().length) {\r\n errorMessage = 'Must have at least one expense distribution'\r\n } else if (this.calculateDiscrepency()) {\r\n errorMessage = 'There is a discrepency of ' + numbro(this.calculateDiscrepency()).formatCurrency('$0,0.00')\r\n }\r\n\r\n if (errorMessage) {\r\n this.$('.status').html(this.getErrorStatusBar(errorMessage))\r\n }\r\n },\r\n\r\n // This is a method used by the base class when a form is submitted on this view\r\n toJSON: function () {\r\n if (!this.isValid()) {\r\n this.determineStatus()\r\n throw new Error('Not valid')\r\n }\r\n\r\n var model = {}\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select, .review textarea, .recurring-meta-container *:input'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n if ($el.hasClass('currency') || $el.hasClass('currency-field')) {\r\n elValue = numbro().unformat(elValue)\r\n }\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n if (model.memorizationId === 'CREATENEW') {\r\n model.memorizationId = ''\r\n }\r\n\r\n model.recurringFrequency = Number(model.recurringFrequency)\r\n model.memorizedEntryId = model.memorizationId\r\n model['payableDistributions'] = this.getDistributions()\r\n\r\n return model\r\n },\r\n\r\n getDistributions: function () {\r\n return _.filter(_.map(this.$('.expense-distribution'), function (distributionLine) {\r\n var $distributionLine = this.$(distributionLine)\r\n\r\n var ledgerAccountId = $distributionLine.find('input[name=accountId]').val()\r\n var amount = numbro().unformat($distributionLine.find('input[name=distributionAmount]').val())\r\n\r\n return {\r\n amount: amount,\r\n ledgerAccountId: ledgerAccountId\r\n }\r\n }), function (item) {\r\n return item.amount && item.ledgerAccountId\r\n })\r\n },\r\n\r\n calculateDiscrepency: function () {\r\n return (_.reduce(this.getDistributions(), function (memo, distribution) {\r\n return memo + distribution.amount * 100\r\n }, 0) / 100) - numbro().unformat(this.$('.meta input[name=amount]').val()) + numbro().unformat(this.$('.meta input[name=reduction]').val())\r\n },\r\n\r\n checkLineStatus: function (e) {\r\n var hasValue = _.reduce(\r\n this.$('.line-item-container input').map(function (index, el) { return $(el).val() }),\r\n function (memo, value) {\r\n return memo || (!!value && value !== '$')\r\n },\r\n false\r\n )\r\n\r\n if (hasValue || e.type === 'focusin') {\r\n this.$('.line-item-container').addClass('forceLabelsOpen')\r\n } else {\r\n this.$('.line-item-container').removeClass('forceLabelsOpen')\r\n }\r\n },\r\n\r\n addDistribution: function () {\r\n var index = this.$('.line-item-container > div').length + 1\r\n\r\n if (index === 1) {\r\n this.$('.line-item-container').html('')\r\n }\r\n\r\n var $expenseDistribution = $(ExpenseDistribution())\r\n this.$('.line-item-container').append($expenseDistribution)\r\n this.OneUI($expenseDistribution)\r\n\r\n this.trigger('heightChanged')\r\n\r\n $expenseDistribution.find('input').on('focusout', this.checkLineStatus.bind(this)).on('focusin', this.checkLineStatus.bind(this))\r\n\r\n $expenseDistribution.find('.remove').on('click', function () {\r\n $expenseDistribution.remove()\r\n\r\n if (!this.$('.line-item-container > div').length) {\r\n this.$('.line-item-container').html('The payment currently has no payment allocations.')\r\n }\r\n\r\n this.trigger('heightChanged')\r\n }.bind(this))\r\n\r\n this.autoComplete(\r\n this.model.get('accountList'),\r\n 'accountNumber',\r\n $expenseDistribution.find('input[name=AccountNumber]'),\r\n this.accountSelected.bind(this, $expenseDistribution)\r\n )\r\n\r\n this.autoComplete(\r\n this.model.get('accountList'),\r\n 'accountName',\r\n $expenseDistribution.find('input[name=Description]'),\r\n this.accountSelected.bind(this, $expenseDistribution)\r\n )\r\n\r\n var $distributionAmount = $expenseDistribution.find('input[name=distributionAmount]')\r\n $distributionAmount.on('keyup', function (e) {\r\n if (numbro().unformat($distributionAmount.val()) < 0) {\r\n $distributionAmount.val('')\r\n }\r\n })\r\n\r\n return $expenseDistribution\r\n },\r\n\r\n accountSelected: function ($expenseDistribution, account) {\r\n $expenseDistribution.find('input[name=AccountNumber]').val(account.accountNumber)\r\n $expenseDistribution.find('input[name=Description]').val(account.accountName)\r\n $expenseDistribution.find('input[name=accountId]').val(account.id)\r\n $expenseDistribution.find('input[name=Amount]').focus()\r\n },\r\n\r\n vendorSelected: function (vendor) {\r\n this.$('input[name=vendorId]').val(vendor.id)\r\n this.$('input[name=vendorIdSearch]')\r\n .val(vendor.vendorId)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=name]')\r\n .val(vendor.name)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=printedName]')\r\n .val(vendor.printedName)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=addressLine1]')\r\n .val(vendor.addressLine1)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=addressLine2]')\r\n .val(vendor.addressLine2)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=city]')\r\n .val(vendor.city)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('select[name=state]')\r\n .val(vendor.state)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=postalCode]')\r\n .val(vendor.postalCode)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.line-item-container').html('')\r\n _.each(vendor.expenseDistributions, function (lineItem) {\r\n var $lineItem = this.addDistribution()\r\n $lineItem.find('input[name=accountId]').val(lineItem.ledgerAccountId)\r\n var account = this.model.get('accountLookup')[lineItem.ledgerAccountId]\r\n $lineItem.find('input[name=AccountNumber]').val(account.accountNumber).closest('.floating').addClass('open')\r\n $lineItem.find('input[name=Description]').val(account.accountName).closest('.floating').addClass('open')\r\n }.bind(this))\r\n },\r\n\r\n memorize: function (e) {\r\n if (e) {\r\n e.preventDefault()\r\n }\r\n\r\n var payable = this.toJSON()\r\n payable.journalType = 'AP'\r\n\r\n if (payable.memorizationId) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'You will be overwriting any previously memorized information.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize', payable)\r\n }.bind(this))\r\n } else {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize', payable)\r\n }\r\n },\r\n\r\n showError: function (errorMessage) {\r\n this.$('.status').html(this.getErrorStatusBar(errorMessage))\r\n setTimeout(this.determineStatus.bind(this), 3000)\r\n },\r\n\r\n setMemorizedEntryDate: function (entryDate) {\r\n this.$('input[name=memorizedEntryDate]').val(entryDate)\r\n },\r\n\r\n memBtnEnable: function () {\r\n this.$('.memorize-button').prop('disabled', false)\r\n }\r\n})\r\n\r\nmodule.exports = CreatePayable\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar ListEntry = require('lists/list/item/entry')\r\n\r\nvar Payable = ListEntry.extend({}, {\r\n parse: function (json) {\r\n var payable = new Payable({\r\n addressLine1: json.addressLine1,\r\n addressLine2: json.addressLine2,\r\n city: json.city,\r\n dueDate: moment(json.dueDate),\r\n shortDueDate: moment(json.dueDate).format('MM/DD/YYYY'),\r\n id: json.id,\r\n invoiceNumber: json.invoiceNumber,\r\n is1099: json.is1099,\r\n isVoid: json.isVoid,\r\n name: json.name,\r\n notes: json.notes,\r\n payableDate: moment(json.payableDate),\r\n shortPayableDate: moment(json.payableDate).format('MM/DD/YYYY'),\r\n payableDistributions: json.payableDistributions,\r\n postalCode: json.postalCode,\r\n printedName: json.printedName,\r\n reduction: json.reduction,\r\n referenceNumber: json.referenceNumber,\r\n state: json.state,\r\n terms: json.terms,\r\n vendorId: json.vendorId,\r\n status: json.isVoid ? 'Void' : (json.isPaid ? 'Paid' : 'Open'),\r\n unpaidAmount: json.unpaidAmount,\r\n queue: json.queue,\r\n isQueued: json.isQueued,\r\n queuePosition: 0,\r\n openBalance: json.openBalance,\r\n payablePayments: _.map(json.payablePayments, function (detail) {\r\n detail.paymentDate = moment(detail.paymentDate).format('MM/DD/YYYY')\r\n return detail\r\n }),\r\n })\r\n\r\n var totalBalance = 0\r\n _.each(json.payableDistributions, function (distribution) {\r\n totalBalance = totalBalance + distribution.amount\r\n })\r\n payable.set({\r\n 'amount': totalBalance + payable.get('reduction')\r\n })\r\n\r\n return payable\r\n }\r\n})\r\n\r\nmodule.exports = Payable\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <a class=\\\"fa fa-ban pull-right void\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"payable-date date\\\">\"\n + alias4(((helper = (helper = helpers.shortPayableDate || (depth0 != null ? depth0.shortPayableDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortPayableDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"status\\\">\"\n + alias4(((helper = (helper = helpers.status || (depth0 != null ? depth0.status : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"status\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"printed-name\\\">\"\n + alias4(((helper = (helper = helpers.printedName || (depth0 != null ? depth0.printedName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"printedName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"due-date date\\\">\"\n + alias4(((helper = (helper = helpers.shortDueDate || (depth0 != null ? depth0.shortDueDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortDueDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"reference\\\">\"\n + alias4(((helper = (helper = helpers.invoiceNumber || (depth0 != null ? depth0.invoiceNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"invoiceNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"open-balance currency\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.openBalance : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isVoid : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('payables/payable/item/template')\r\n\r\nvar PayableView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n if (this.model.get('isVoid')) {\r\n this.$el.addClass('notActive')\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = PayableView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"payableDate-sort\"] || (depth0 != null ? depth0[\"payableDate-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"payableDate-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"dueDate-sort\"] || (depth0 != null ? depth0[\"dueDate-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"dueDate-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Payables</h3>\\r\\n <b class=\\\"pull-right\\\" id=\\\"unpaidBalance\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"left\\\" data-original-title=\\\"Total unpaid expenses\\\">\\r\\n <i class=\\\"fa fa-question-circle\\\" aria-hidden=\\\"true\\\"></i> Unpaid Balance: \"\n + container.escapeExpression((helpers.numbro || (depth0 && depth0.numbro) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.unpaidBalance : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"\\r\\n </b>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"form-group filter\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control filter-selection\\\" name=\\\"filterSelection\\\" id=\\\"filterSelection\\\">\\r\\n <option value=\\\"0\\\">All</option>\\r\\n <option value=\\\"1\\\">Open</option>\\r\\n <option value=\\\"2\\\">Paid</option>\\r\\n <option value=\\\"3\\\">Void</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"filterSelection\\\">Filter</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"payable-date date\\\">Payable Date<i data-sort-field=\\\"payableDate\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"payableDate-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"status\\\">Status</div>\\r\\n <div class=\\\"printed-name\\\">Vendor Name</div>\\r\\n <div class=\\\"due-date date\\\">Due Date<i data-sort-field=\\\"dueDate\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"dueDate-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"reference\\\">Reference #</div>\\r\\n <div class=\\\"open-balance currency\\\">Open Amount</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\"><p class=\\\"center\\\">Loading more payables...</p></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('payables/payable/list/template')\r\nvar PayableView = require('payables/payable/item/view')\r\nvar DetailsView = require('payables/payable/read/view')\r\nvar UpdateView = require('payables/payable/update/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\n// TODO: Sorting\r\nvar PayableListView = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort',\r\n 'change select[name=filterSelection]': 'changeFilter'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = PayableView\r\n this.model.set('filter', 1)\r\n this.model.set('sort', 'asc')\r\n this.model.set('sortField', 'dueDate')\r\n this.model.set('dueDate-sort', 'asc')\r\n this.model.on('change:unpaidBalance', this.render.bind(this))\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.on('showDetails', this.showDetails.bind(this))\r\n this.on('showEdit', this.showEdit.bind(this))\r\n this.on('void', this.showVoid.bind(this))\r\n this.on('enable', this.showEnable.bind(this))\r\n this.on('disable', this.showDisable.bind(this))\r\n this.on('delete', this.showDelete.bind(this))\r\n },\r\n\r\n onRender: function () {\r\n if (this.model.get('filter')) {\r\n this.$('select[name=filterSelection]').val(this.model.get('filter'))\r\n }\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more payables...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more payables.')\r\n },\r\n\r\n showDetails: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n var details = new DetailsView({model: model})\r\n\r\n // View to show beneath $lineItem, and if the 'active' class should be added to $lineItem's classes\r\n this.showChildView(details, $lineItem, true)\r\n },\r\n\r\n showVoid: function (payableId) {\r\n this.showConfirmationMessage(\r\n this.$('.itemrow[data-id=\"' + payableId + '\"]'),\r\n 'Are you sure you want to void this payable?',\r\n 'confirmVoid',\r\n payableId\r\n )\r\n },\r\n\r\n showEdit: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n var update = new UpdateView({model: model})\r\n update.on('update', function () {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('update')\r\n this.trigger.apply(this, args)\r\n }, this)\r\n\r\n this.showChildView(update, $lineItem, false)\r\n },\r\n\r\n showEnable: function (payableId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + payableId + '\"]'), 'Are you sure you want to enable this contact?', 'confirmEnable', payableId)\r\n },\r\n\r\n showDisable: function (payableId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + payableId + '\"]'), 'Are you sure you want to disable this contact?', 'confirmDisable', payableId)\r\n },\r\n\r\n showDelete: function (payableId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + payableId + '\"]'), 'Are you sure you want to delete this contact?', 'confirmDelete', payableId)\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.unset('payableDate-sort')\r\n this.model.unset('dueDate-sort')\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n },\r\n\r\n changeFilter: function (e) {\r\n var selectedFilter = $(e.currentTarget).val()\r\n\r\n this.model.set({\r\n filter: selectedFilter\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n }\r\n})\r\n\r\nmodule.exports = PayableListView\r\n","'use strict'\r\n\r\nvar Payable = require('payables/payable/item/payable')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar Payables = ListWrapper.extend({\r\n childModel: Payable\r\n})\r\n\r\nmodule.exports = Payables\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"payment-history flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Payment Date\",\"inputName\":\"paymentDate\",\"inputId\":\"id\",\"wrapperClasses\":\"paymentDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"currency currency-field\",\"inputLabel\":\"Amount\",\"inputName\":\"amount\",\"inputId\":\"amount\",\"wrapperClasses\":\"amount\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var UpdateView = require('payables/payable/update/view')\r\n\r\nvar PayableReadView = UpdateView.extend({\r\n className: 'block read expanded',\r\n \r\n onRender: function () {\r\n UpdateView.prototype.onRender.apply(this, arguments)\r\n this.$('input,select,textarea').attr('disabled', true)\r\n this.$('.date input:disabled').closest('.date').addClass('readonly').attr('readonly', 'readonly')\r\n this.$('.input-group-addon .fa-calendar').css({display: 'none'})\r\n this.$('input[type=checkbox]').each(function (index, el) {\r\n var $el = this.$(el)\r\n $el.replaceWith($el.prop('checked') ? '<i class=\"fa fa-check\"></i>' : '<i class=\"fa fa-times\"></i>')\r\n }.bind(this))\r\n\r\n var model = this.model.toViewModel()\r\n if (model['payablePayments'].length > 0) {\r\n this.$('#payment-history-container').attr('style', null)\r\n }\r\n },\r\n \r\n toJSON: function () {\r\n throw new Error(\"Read views can't create JSON objects.\")\r\n }\r\n})\r\n\r\nmodule.exports = PayableReadView\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar GenericListsService = require('lists/list/service')\r\nvar SessionService = require('session/session-service')\r\nvar Q = require('q')\r\n\r\nvar PayablesService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nPayablesService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nPayablesService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'payables'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nPayablesService.prototype.getList = function () {\r\n var apiPath = this.GetPath('list')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nPayablesService.prototype.setStatus = function (payableId, status) {\r\n var apiPath = this.GetPath(payableId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nPayablesService.prototype.getAll = function (page, pageSize, sort, sortField, filter) {\r\n var apiPath = this.GetPath() + this.GetQuery({page: page, pageSize: pageSize, sort: sort, sortField: sortField, status: filter})\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nPayablesService.prototype.setVoid = function (payableId) {\r\n var apiPath = this.GetPath(payableId, 'void')\r\n return this.restClient.put(apiPath, true)\r\n}\r\n\r\nPayablesService.prototype.getAccountsPayableBalance = function () {\r\n var apiPath = this.GetPath('balance')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nPayablesService.prototype.getUnpaid = function (dueDate) {\r\n var apiPath = this.GetPath('unpaid')\r\n var urlParams = {}\r\n if (!!dueDate) {\r\n urlParams.dueDate = dueDate.toISOString()\r\n apiPath = apiPath + '?' + $.param(urlParams)\r\n }\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nPayablesService.prototype.unpaidBalance = function () {\r\n var apiPath = this.GetPath('unpaid-balance')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nPayablesService.prototype.applyPayments = function (checks) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'checkbooks',\r\n checks.checkbookId,\r\n 'payable-payments',\r\n 'print'\r\n ]\r\n\r\n var apiPath = actionPathElements.join('/') + '?' + $.param({\r\n accessToken: SessionService.getToken()\r\n })\r\n\r\n /**\r\n * Because we need to download a PDF of the checks, we have to submit the data\r\n * from a form so that the browser knows to download the returned file.\r\n */\r\n var checkDataForm = document.createElement('form')\r\n checkDataForm.action = apiPath\r\n checkDataForm.method = 'POST'\r\n\r\n var startingCheckNumber = $(\"<input name='startingCheckNumber'>\").val(checks.startingCheckNumber)\r\n checkDataForm.appendChild(startingCheckNumber[0])\r\n\r\n var payablePaymentGroupData = $(\"<input name='payablePaymentGroupData'>\").val(JSON.stringify(checks.payablePaymentGroups))\r\n checkDataForm.appendChild(payablePaymentGroupData[0])\r\n\r\n var postedDateString = $(\"<input name='postedDateString'>\").val(checks.postedDate)\r\n checkDataForm.appendChild(postedDateString[0])\r\n\r\n var $formElement = $(checkDataForm)\r\n $formElement.css({\r\n display: 'none'\r\n })\r\n\r\n $('body').append($formElement)\r\n\r\n checkDataForm.submit()\r\n\r\n $formElement.remove()\r\n\r\n var defer = Q.defer()\r\n defer.resolve()\r\n return defer.promise\r\n}\r\n\r\nmodule.exports = PayablesService\r\n","var CreateView = require('payables/payable/create/view')\r\nvar _ = require('lodash')\r\nvar numbro = require('numbro')\r\nvar PaymentHistory = require('payables/payable/read/payment-history-line-item')\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar PayableUpdateView = CreateView.extend({\r\n className: 'block update expanded has-animation fadeInDown',\r\n\r\n events: _.extend(_.clone(CreateView.prototype.events), {}),\r\n\r\n onRender: function () {\r\n var model = this.model.toViewModel()\r\n\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n\r\n _.each(this.$('input:not([type=file]), textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var isDate = $el.closest('.form-material').hasClass('date')\r\n var isCurrency = $el.hasClass('currency') || $el.hasClass('currency-field')\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else if (isDate) {\r\n $el.val(model[$el.attr('name')])\r\n } else if (isCurrency) {\r\n $el.val(numbro(model[$el.attr('name')]).formatCurrency('$0,0.00'))\r\n } else if (model[$el.attr('name')]) {\r\n $el.val(model[$el.attr('name')]).closest('.floating').addClass('open')\r\n }\r\n }.bind(this))\r\n\r\n this.$('input[name=reduction]').attr('disabled', false)\r\n\r\n // Remove empty customer line from the create side\r\n this.$('.expense-distribution').remove()\r\n\r\n this.$('.line-item-container').html('')\r\n // Add customer lines with our data\r\n _.forEach(model['payableDistributions'], function (lineItem) {\r\n var $distribution = this.addDistribution()\r\n $distribution.find('input[name=accountId]').val(lineItem.account.id)\r\n $distribution.find('input[name=AccountNumber]').val(lineItem.account.accountNumber).parent().addClass('open')\r\n $distribution.find('input[name=Description]').val(lineItem.account.accountName).parent().addClass('open')\r\n $distribution.find('input[name=distributionAmount]').val(numbro(lineItem.amount).formatCurrency('$0,0.00')).parent().addClass('open')\r\n }.bind(this))\r\n\r\n // Populate datepickers\r\n this.populateDates()\r\n\r\n if (this.$el.hasClass('read')) {\r\n this.$('.payment-line-item-container').html('')\r\n _.forEach(model['payablePayments'], function (lineItem) {\r\n var $paymentHistory = this.addPaymentHistory()\r\n $paymentHistory.find('input[name=paymentDate]').val(lineItem.paymentDate)\r\n $paymentHistory.find('input[name=amount]').val(numbro(lineItem.amount).formatCurrency('$0,0.00')).parent().addClass('open')\r\n }.bind(this))\r\n }\r\n },\r\n \r\n addPaymentHistory: function () {\r\n var $paymentHistory = $(PaymentHistory())\r\n this.$('.payment-line-item-container').append($paymentHistory)\r\n this.OneUI($paymentHistory)\r\n\r\n this.trigger('heightChanged')\r\n\r\n return $paymentHistory\r\n },\r\n\r\n addSalesEntry: function () {\r\n var $salesEntry = CreateView.prototype.addSalesEntry.apply(this, arguments)\r\n if (this.model.get('isPosted') || this.model.get('hasQuote')) {\r\n $salesEntry.find('input, button, select, textarea').attr('disabled', true)\r\n }\r\n return $salesEntry\r\n },\r\n\r\n populateDates: function () {\r\n this.$('.due-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('dueDate').format(dateParams.format))\r\n .datepicker('setStartDate', this.model.get('payableDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.payable-date .date').datepicker('setEndDate', e.date)\r\n this.modified = true\r\n this.$('.due-date .date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.payable-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('payableDate').format(dateParams.format))\r\n .datepicker('setEndDate', this.model.get('dueDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.due-date .date').datepicker('setStartDate', e.date)\r\n this.modified = true\r\n this.$('.payable-date .date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n }\r\n})\r\n\r\nmodule.exports = PayableUpdateView\r\n","var ListContainer = require('lists/list/view')\r\nvar ListView = require('payables/payable/list/view')\r\nvar CreateView = require('payables/payable/create/view')\r\nvar moment = require('moment')\r\nvar PayablesView = ListContainer.extend({\r\n className: 'payables list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n // Default payable date values\r\n this.model.set({\r\n payableDate: moment(),\r\n dueDate: moment().add(1, 'M')\r\n })\r\n\r\n this.listView = new ListView({model: this.model})\r\n this.forwardEvents(this.listView)\r\n\r\n this.createView = new CreateView({model: this.model})\r\n this.forwardEvents(this.createView)\r\n\r\n this.on('created', function () {\r\n this.createView.trigger('resetInputs')\r\n }.bind(this))\r\n\r\n this.on('widgetReady', function () {\r\n this.createView.trigger('bindAutocomplete')\r\n this.listView.trigger('bindScroll')\r\n })\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n console.log('container -> editDetails')\r\n this.listView.trigger('showEdit', model)\r\n }.bind(this))\r\n\r\n this.on('widgetShown', function () {\r\n this.listView.trigger('bindScroll')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n\r\n this.on('memorizationsBind', function () {\r\n this.createView.trigger('bindMemorizations')\r\n }.bind(this))\r\n\r\n this.on('autocompleteBind', function () {\r\n this.createView.trigger('bindAutocomplete')\r\n })\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n\r\n this.$el.append(this.createView.render().$el)\r\n this.$el.append(this.listView.render().$el)\r\n\r\n return this\r\n },\r\n\r\n getCreateView: function () {\r\n return this.createView\r\n },\r\n\r\n getListView: function () {\r\n return this.listView\r\n },\r\n\r\n showError: function (errorMessage) {\r\n this.createView.showError(errorMessage)\r\n },\r\n \r\n memBtnEnable: function () {\r\n this.$('.memorize-button').prop('disabled', false)\r\n }\r\n})\r\n\r\nmodule.exports = PayablesView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar Payables = require('payables/payable/payables')\r\nvar Service = require('payables/payable/service')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar VendorService = require('lists/vendors/service')\r\nvar MemorizationService = require('memorization/payables/service')\r\nvar ListContainer = require('payables/payable/view')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar PayablesWidget = function () {\r\n this.service = new Service()\r\n this.accountService = new AccountService()\r\n this.vendorService = new VendorService()\r\n this.memorizationService = new MemorizationService()\r\n this.modelType = Payables\r\n this.viewType = ListContainer\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n\r\n this.loadDependencies()\r\n\r\n this.on('shown', function () {\r\n this.readyPromise.then(function () {\r\n this.view.trigger('widgetReady')\r\n }.bind(this))\r\n }.bind(this))\r\n\r\n this.view.on('memorize', this.memorize.bind(this))\r\n this.view.on('created itemVoided', this.loadUnpaid.bind(this))\r\n}\r\n\r\nPayablesWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nPayablesWidget.prototype.loadDependencies = function () {\r\n this.readyPromise = Q.all([\r\n this.loadVendors(),\r\n this.loadAccounts(),\r\n this.loadUnpaid()\r\n ]).then(this.loadMemorizations.bind(this)).then(function () {\r\n this.view.trigger('autocompleteBind')\r\n }.bind(this))\r\n}\r\n\r\nPayablesWidget.prototype.loadVendors = function () {\r\n return this.vendorService.getList().then(function (vendors) {\r\n this.model.set({\r\n vendorList: vendors,\r\n vendorLookup: _.keyBy(vendors, 'id')\r\n })\r\n }.bind(this))\r\n}\r\n\r\nPayablesWidget.prototype.loadAccounts = function () {\r\n return this.accountService.fetchAccounts(false).then(function (accounts) {\r\n return _.map(accounts, function (account) {\r\n return account.toJSON()\r\n })\r\n }).then(function (accounts) {\r\n this.model.set({\r\n accountList: accounts,\r\n accountLookup: _.keyBy(accounts, 'id')\r\n })\r\n }.bind(this))\r\n}\r\n\r\nPayablesWidget.prototype.loadUnpaid = function () {\r\n return this.service.unpaidBalance().then(function (unpaid) {\r\n this.model.set('unpaidBalance', unpaid.balance)\r\n }.bind(this))\r\n}\r\n\r\nPayablesWidget.prototype.loadPage = function () {\r\n if (this.loadingMore) {\r\n return\r\n }\r\n this.loadingMore = true\r\n var currentPage = this.model.get('page')\r\n this.view.trigger('loadingPage', currentPage)\r\n this.model.trigger('loadingPage', currentPage)\r\n return this.service.getAll(currentPage, 100, this.model.get('sort'), this.model.get('sortField'), this.model.get('filter')).then(function (result) {\r\n this.loadingMore = false\r\n if (result.collection.length) {\r\n this.model.set('page', currentPage + 1)\r\n } else {\r\n this.view.trigger('EOF')\r\n }\r\n this.model.set('sortField', result.sortField)\r\n this.model.set('sort', result.sort)\r\n this.model.add(_.map(result.collection, this.childModel.bind(this)))\r\n this.view.trigger('loadedPage', result.collection.length)\r\n this.model.trigger('loadedPage', result.collection.length)\r\n }.bind(this))\r\n}\r\n\r\nPayablesWidget.prototype.edit = function (modelId) {\r\n return this.service.get(modelId).then(function (item) {\r\n var model = this.childModel(item)\r\n this.resolveDependencies(model)\r\n this.view.trigger('editDetails', model)\r\n }.bind(this))\r\n}\r\n\r\nPayablesWidget.prototype.get = function (modelId) {\r\n return this.service.get(modelId).then(function (item) {\r\n var model = this.childModel(item)\r\n this.resolveDependencies(model)\r\n this.view.trigger('details', model)\r\n }.bind(this))\r\n}\r\n\r\nPayablesWidget.prototype.loadMemorizations = function () {\r\n return this.memorizationService.getList().then(function (memorizations) {\r\n _.each(memorizations, function (memorization) {\r\n memorization.vendor = this.model.get('vendorLookup')[memorization.vendorId]\r\n if (memorization.vendor) {\r\n memorization.vendorIdSearch = memorization.vendor.vendorId\r\n }\r\n var total = 0\r\n _.each(memorization.payableDistributions, function (distribution) {\r\n distribution.account = this.model.get('accountLookup')[distribution.ledgerAccountId]\r\n total = total + (distribution.amount * 100)\r\n }.bind(this))\r\n memorization.amount = total / 100\r\n }.bind(this))\r\n this.model.set('memorizationList', memorizations)\r\n this.view.trigger('memorizationsBind')\r\n }.bind(this))\r\n}\r\n\r\nPayablesWidget.prototype.resolveDependencies = function (payable) {\r\n payable.set({\r\n accountList: this.model.get('accountList'),\r\n vendorList: this.model.get('vendorList')\r\n })\r\n\r\n _.each(payable.get('payableDistributions'), function (distribution) {\r\n distribution.account = this.model.get('accountLookup')[distribution.ledgerAccountId]\r\n }.bind(this))\r\n return payable\r\n}\r\n\r\nPayablesWidget.prototype.memorize = function (payable) {\r\n var deferral\r\n\r\n if (!payable.label) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Please enter in a memorization label for this transaction',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6'\r\n })\r\n this.view.memBtnEnable()\r\n return\r\n }\r\n\r\n if (!payable.vendorId) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Please select a vendor for this transaction',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6'\r\n })\r\n this.view.memBtnEnable()\r\n return\r\n }\r\n\r\n if (payable.memorizationId) {\r\n deferral = this.memorizationService.update(payable.memorizationId, payable).then(function () {\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your payable has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationUpdated')\r\n }.bind(this))\r\n } else {\r\n deferral = this.memorizationService.create(payable).then(function (response) {\r\n this.view.trigger('setMemorizationId', response.message)\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your payable has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationCreated')\r\n }.bind(this))\r\n }\r\n\r\n deferral.fail(function (err) {\r\n this.view.showError(err.message)\r\n }.bind(this))\r\n\r\n this.view.memBtnEnable()\r\n deferral.then(this.loadMemorizations.bind(this))\r\n}\r\n\r\nPayablesWidget.prototype.getCreateView = function () {\r\n return this.view.getCreateView()\r\n}\r\n\r\nPayablesWidget.prototype.getListView = function () {\r\n return this.view.getListView()\r\n}\r\n\r\nmodule.exports = PayablesWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar PayablesWidget = require('payables/payable/widget')\r\nvar ApplyPaymentsWidget = require('payables/apply-payment/widget')\r\n\r\nvar PayablesRouter = Router.extend({\r\n routes: {\r\n 'payables': 'showPayables',\r\n 'payables/apply-payments': 'showApplyPayments'\r\n },\r\n\r\n showPayables: function () {\r\n Backbone.trigger('app:showInFrame', new PayablesWidget())\r\n Backbone.trigger('app:updateTitle', 'Payables', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Payables'}])\r\n },\r\n\r\n showApplyPayments: function () {\r\n Backbone.trigger('app:showInFrame', new ApplyPaymentsWidget())\r\n Backbone.trigger('app:updateTitle', 'Payables', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Payables'}, {label: 'Apply Payments'}])\r\n }\r\n})\r\n\r\nmodule.exports = PayablesRouter\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar SessionService = require('session/session-service')\r\nvar PaymentLinkWidget = require('payment-link/widget')\r\n\r\nvar PaymentLinkRouter = Router.extend({\r\n routes: {\r\n 'payment/:companyId/:invoiceId/:customerId': 'showPayInvoice'\r\n },\r\n \r\n showPayInvoice: function (companyId, invoiceId, customerId) {\r\n Backbone.trigger('app:showInFrame', new PaymentLinkWidget(companyId, invoiceId, customerId))\r\n Backbone.trigger('app:updateTitle', '', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: ''}, {label: ''}])\r\n } \r\n})\r\n\r\nmodule.exports = PaymentLinkRouter\r\n","'use strict'\r\n\r\nvar RestClient = require('rest/client')\r\nvar Config = require('config/config')\r\nvar $ = require('jquery')\r\n\r\nvar PaymentLinkService = function () {\r\n this.client = new RestClient()\r\n}\r\n\r\nPaymentLinkService.prototype.getInvoice = function (companyId, invoiceId, customerId) {\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'customer-payment',\r\n companyId,\r\n invoiceId,\r\n customerId\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n return this.client.get(actionPath).then(function (response) {\r\n return response\r\n })\r\n}\r\n\r\nPaymentLinkService.prototype.payInvoice = function (companyId, invoiceId, customerId, paymentInfo) {\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'customer-payment',\r\n companyId,\r\n invoiceId,\r\n customerId\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n return this.client.post(actionPath, paymentInfo)\r\n}\r\n\r\nPaymentLinkService.prototype.downloadInvoice = function (companyId, invoiceId, customerId) {\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'customer-payment',\r\n companyId,\r\n invoiceId,\r\n customerId,\r\n 'export'\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n return this.client.download(actionPath)\r\n}\r\n\r\nmodule.exports = PaymentLinkService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.company : depth0)) != null ? stack1.addressLine1 : stack1), depth0));\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.company : depth0)) != null ? stack1.addressLine2 : stack1), depth0));\n},\"5\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.company : depth0)) != null ? stack1.city : stack1), depth0))\n + \", \";\n},\"7\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" \"\n + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.company : depth0)) != null ? stack1.state : stack1), depth0))\n + \" \";\n},\"9\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" \"\n + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.company : depth0)) != null ? stack1.postalCode : stack1), depth0))\n + \" \";\n},\"11\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.customer : depth0)) != null ? stack1.addressLine1 : stack1), depth0));\n},\"13\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.customer : depth0)) != null ? stack1.addressLine2 : stack1), depth0));\n},\"15\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.customer : depth0)) != null ? stack1.city : stack1), depth0))\n + \", \";\n},\"17\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" \"\n + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.customer : depth0)) != null ? stack1.state : stack1), depth0))\n + \" \";\n},\"19\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" \"\n + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.customer : depth0)) != null ? stack1.postalCode : stack1), depth0))\n + \" \";\n},\"21\":function(container,depth0,helpers,partials,data) {\n return \" <div>Terms: </div>\\r\\n\";\n},\"23\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <div>\"\n + container.escapeExpression(((helper = (helper = helpers.terms || (depth0 != null ? depth0.terms : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"terms\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n\";\n},\"25\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow flex\\\">\\r\\n <div class=\\\"itemId\\\">\"\n + alias4(((helper = (helper = helpers.itemId || (depth0 != null ? depth0.itemId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"itemId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"description itemColumn\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"price itemColumn text-right\\\">$\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.price : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"qty itemColumn text-right\\\">\"\n + alias4(((helper = (helper = helpers.quantity || (depth0 != null ? depth0.quantity : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"quantity\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"t-text itemColumn text-right\\\">T</div>\\r\\n <div class=\\\"discount itemColumn text-right\\\">$\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.discount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"total itemColumn text-right\\\">$\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.total : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div> \\r\\n </div>\\r\\n\";\n},\"27\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"memoLabel\\\">Memo:</div>\\r\\n <div class=\\\"memoText\\\">Applied free overnight shipping due to your upcoming trip tomorrow.</div>\\r\\n\";\n},\"29\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"tyText\\\">Thank You!</div>\\r\\n\";\n},\"31\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"block-header\\\">\\r\\n <div class=\\\"head-text\\\">Enter Your Payment Information</div>\\r\\n <div class=\\\"paymentTypeImg flex\\\">\\r\\n <div><img src=\\\"/img/credit-card.png\\\" class=\\\"visaImg\\\" alt=\\\"/img/credit-card.png\\\"/></div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group paymentTypeContainer\\\" style=\\\"display:none !important;\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"paymentType\\\" name=\\\"paymentType\\\" size=\\\"1\\\">\\r\\n <option>Choose</option>\\r\\n <option>Credit Card</option>\\r\\n </select>\\r\\n <label for=\\\"paymentType\\\">Choose Your Payment Type</label>\\r\\n </div>\\r\\n </div> \\r\\n <div class=\\\"text-danger help-block animated fadeInDown validation-summary-errors\\\">\\r\\n <div class=\\\"errorMessage\\\"></div>\\r\\n </div> \\r\\n <div class=\\\"block-content\\\">\\r\\n <form class=\\\"form-material\\\" role=\\\"form\\\">\\r\\n <div class=\\\"creditCardInfo\\\">\\r\\n <div class=\\\"creditCardNumberAndSecurityCode\\\">\\r\\n <div class=\\\"creditCardInfoHeaderContainer\\\">\\r\\n <div class=\\\"form-group col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\" style=\\\"margin-top: 0px;\\\">\\r\\n <div class=\\\"creditCardInfoHeader\\\">Credit Card Information</div>\\r\\n </div>\\r\\n </div> \\r\\n </div> \\r\\n <div class=\\\"form-group col-lg-7 col-md-7 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"creditNumber\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"creditNumber\\\" maxlength=\\\"20\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"creditNumber\\\">Card Number</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group col-lg-5 col-md-5 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"securityCode\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"securityCode\\\" maxlength=\\\"4\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"securityCode\\\">Security Code</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"nameOnCardAndExpDate\\\">\\r\\n <div class=\\\"form-group col-lg-7 col-md-7 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"nameOnCard\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"nameOnCard\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"nameOnCard\\\">Name On Card</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"expDate col-lg-5 col-md-5 col-xs-12 no-padding\\\">\\r\\n <div class=\\\"form-group col-lg-5 col-md-5 exp-month\\\" style=\\\"padding-right: 0px;\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <select class=\\\"form-control expMonth\\\" id=\\\"expMonth\\\" name=\\\"expMonth\\\" size=\\\"1\\\"></select>\\r\\n <label for=\\\"expMonth\\\">Exp. Date</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group col-lg-7 col-md-7 exp-year\\\" style=\\\"padding-left: 5px;\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"expYear\\\" name=\\\"expYear\\\" size=\\\"1\\\"></select> \\r\\n </div>\\r\\n </div> \\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"billingAddress\\\">\\r\\n <div class=\\\"billingInfoHeaderContainer\\\">\\r\\n <div class=\\\"form-group col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <div class=\\\"billingInfoHeader\\\">Billing Address</div>\\r\\n </div>\\r\\n </div> \\r\\n </div>\\r\\n <div class=\\\"streetAddress\\\">\\r\\n <div class=\\\"form-group col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"streetAddress\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"streetAddress\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"streetAddress\\\">Street Address</label>\\r\\n </div>\\r\\n </div> \\r\\n </div>\\r\\n <div class=\\\"cityAndState\\\">\\r\\n <div class=\\\"form-group col-lg-6 col-md-6 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"city\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"city\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"city\\\">City</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group col-lg-6 col-md-6 col-xs-12 stateContainer\\\">\\r\\n <div class=\\\"form-material floating stateList\\\">\\r\\n <select class=\\\"form-control selectpicker\\\" id=\\\"state\\\" name=\\\"StateCode\\\" data-container=\\\"body\\\">\\r\\n <option></option>\\r\\n <option value=\\\"AK\\\">Alaska</option>\\r\\n <option value=\\\"AL\\\">Alabama</option>\\r\\n <option value=\\\"AR\\\">Arkansas</option>\\r\\n <option value=\\\"AZ\\\">Arizona</option>\\r\\n <option value=\\\"CA\\\">California</option>\\r\\n <option value=\\\"CO\\\">Colorado</option>\\r\\n <option value=\\\"CT\\\">Connecticut</option>\\r\\n <option value=\\\"DC\\\">District of Columbia</option>\\r\\n <option value=\\\"DE\\\">Delaware</option>\\r\\n <option value=\\\"FL\\\">Florida</option>\\r\\n <option value=\\\"GA\\\">Georgia</option>\\r\\n <option value=\\\"HI\\\">Hawaii</option>\\r\\n <option value=\\\"IA\\\">Iowa</option>\\r\\n <option value=\\\"ID\\\">Idaho</option>\\r\\n <option value=\\\"IL\\\">Illinois</option>\\r\\n <option value=\\\"IN\\\">Indiana</option>\\r\\n <option value=\\\"KS\\\">Kansas</option>\\r\\n <option value=\\\"KY\\\">Kentucky</option>\\r\\n <option value=\\\"LA\\\">Louisiana</option>\\r\\n <option value=\\\"MA\\\">Massachusetts</option>\\r\\n <option value=\\\"MD\\\">Maryland</option>\\r\\n <option value=\\\"ME\\\">Maine</option>\\r\\n <option value=\\\"MI\\\">Michigan</option>\\r\\n <option value=\\\"MN\\\">Minnesota</option>\\r\\n <option value=\\\"MO\\\">Missouri</option>\\r\\n <option value=\\\"MS\\\">Mississippi</option>\\r\\n <option value=\\\"MT\\\">Montana</option>\\r\\n <option value=\\\"NC\\\">North Carolina</option>\\r\\n <option value=\\\"ND\\\">North Dakota</option>\\r\\n <option value=\\\"NE\\\">Nebraska</option>\\r\\n <option value=\\\"NH\\\">New Hampshire</option>\\r\\n <option value=\\\"NJ\\\">New Jersey</option>\\r\\n <option value=\\\"NM\\\">New Mexico</option>\\r\\n <option value=\\\"NV\\\">Nevada</option>\\r\\n <option value=\\\"NY\\\">New York</option>\\r\\n <option value=\\\"OH\\\">Ohio</option>\\r\\n <option value=\\\"OK\\\">Oklahoma</option>\\r\\n <option value=\\\"OR\\\">Oregon</option>\\r\\n <option value=\\\"PA\\\">Pennsylvania</option>\\r\\n <option value=\\\"RI\\\">Rhode Island</option>\\r\\n <option value=\\\"SC\\\">South Carolina</option>\\r\\n <option value=\\\"SD\\\">South Dakota</option>\\r\\n <option value=\\\"TN\\\">Tennessee</option>\\r\\n <option value=\\\"TX\\\">Texas</option>\\r\\n <option value=\\\"UT\\\">Utah</option>\\r\\n <option value=\\\"VA\\\">Virginia</option>\\r\\n <option value=\\\"VT\\\">Vermont</option>\\r\\n <option value=\\\"WA\\\">Washington</option>\\r\\n <option value=\\\"WI\\\">Wisconsin</option>\\r\\n <option value=\\\"WV\\\">West Virginia</option>\\r\\n <option value=\\\"WY\\\">Wyoming</option>\\r\\n <option value=\\\"OTHER\\\">OTHER</option>\\r\\n </select>\\r\\n <label class=\\\"stateLabel\\\" for=\\\"state\\\">State</label> \\r\\n </div>\\r\\n </div> \\r\\n </div>\\r\\n <div class=\\\"zipCodeAndCountry\\\">\\r\\n <div class=\\\"form-group col-lg-6 col-md-6 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"postalCode\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"postalCode\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"postalCode\\\">Zip Code</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group col-lg-6 col-md-6 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"country\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"country\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"country\\\">Country</label>\\r\\n </div>\\r\\n </div> \\r\\n </div> \\r\\n </div>\\r\\n <div class=\\\"paymentAmountContainer\\\">\\r\\n <div class=\\\"paymentAmountHeaderContainer\\\">\\r\\n <div class=\\\"form-group col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <div class=\\\"paymentAmountInfoHeader\\\">Amount</div>\\r\\n </div>\\r\\n </div> \\r\\n </div>\\r\\n <div class=\\\"form-group col-lg-8 col-md-8 col-xs-8\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control currency currency-field paymentAmount\\\" type=\\\"text\\\" data-val=\\\"true\\\" id=\\\"paymentAmount\\\" name=\\\"paymentAmount\\\" value=\\\"0\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"paymentAmount\\\">Payment Amount in (USD)</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group col-lg-4 col-md-4 col-xs-4\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control balanceAmount\\\" type=\\\"text\\\" data-val=\\\"true\\\" id=\\\"balanceAmount\\\" name=\\\"balanceAmount\\\" value=\\\"$\"\n + container.escapeExpression((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.openBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"\\\" disabled>\\r\\n <label class=\\\"control-label\\\" for=\\\"balanceAmount\\\">Balance</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group col-lg-12 col-md-12 col-xs-12 no-padding submit\\\">\\r\\n <div class=\\\"payNowBtn\\\">\\r\\n <button type=\\\"submit\\\" class=\\\"btn btn-primary submit\\\">Pay Now</button>\\r\\n </div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {}, alias4=helpers.helperMissing, alias5=\"function\";\n\n return \"\\r\\n<div class=\\\"payment-block\\\">\\r\\n <!--Header Block-->\\r\\n <div class=\\\"header-block\\\">\\r\\n <div class=\\\"payment-header\\\">\\r\\n <div class=\\\"businessName\\\">\"\n + alias2(alias1(((stack1 = (depth0 != null ? depth0.company : depth0)) != null ? stack1.name : stack1), depth0))\n + \"</div>\\r\\n <div class='open-balance currency'>$\"\n + alias2((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias4).call(alias3,(depth0 != null ? depth0.openBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class='openBalance-text'>Balance Due (USD)</div>\\r\\n </div>\\r\\n <div class=\\\"invoiceControls\\\">\\r\\n <div class=\\\"actions\\\">\\r\\n <span class=\\\"download\\\"><i class=\\\"fa fa-file-pdf-o\\\"></i> PDF</span>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"invoiceAndPaymentBlock flex\\\">\\r\\n <!--Invoice Column-->\\r\\n <div class=\\\"invoiceBlock\\\">\\r\\n <div class=\\\"block no-padding\\\"> \\r\\n <div class=\\\"block-header\\\">\\r\\n <div class='companyLogo pull-left'></div>\\r\\n <div class='pull-right invoiceLabel'>INVOICE</div>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"invoiceData\\\">\\r\\n <div class=\\\"companyInfo\\\">\\r\\n <div>\"\n + alias2(alias1(((stack1 = (depth0 != null ? depth0.company : depth0)) != null ? stack1.name : stack1), depth0))\n + \"</div>\\r\\n <div>\"\n + ((stack1 = helpers[\"if\"].call(alias3,((stack1 = (depth0 != null ? depth0.company : depth0)) != null ? stack1.addressLine1 : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div>\"\n + ((stack1 = helpers[\"if\"].call(alias3,((stack1 = (depth0 != null ? depth0.company : depth0)) != null ? stack1.addressLine2 : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div>\\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias3,((stack1 = (depth0 != null ? depth0.company : depth0)) != null ? stack1.city : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias3,((stack1 = (depth0 != null ? depth0.company : depth0)) != null ? stack1.state : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias3,((stack1 = (depth0 != null ? depth0.company : depth0)) != null ? stack1.postalCode : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(9, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n </div> \\r\\n </div>\\r\\n <div class=\\\"invoiceSubHeader flex\\\">\\r\\n <div class=\\\"invoiceCustomerInfo no-padding\\\">\\r\\n <span><b>Bill To:</b></span>\\r\\n <div>\"\n + alias2(alias1(((stack1 = (depth0 != null ? depth0.customer : depth0)) != null ? stack1.printedName : stack1), depth0))\n + \"</div>\\r\\n <div>\"\n + ((stack1 = helpers[\"if\"].call(alias3,((stack1 = (depth0 != null ? depth0.customer : depth0)) != null ? stack1.addressLine1 : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(11, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div>\"\n + ((stack1 = helpers[\"if\"].call(alias3,((stack1 = (depth0 != null ? depth0.customer : depth0)) != null ? stack1.addressLine2 : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(13, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div>\\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias3,((stack1 = (depth0 != null ? depth0.customer : depth0)) != null ? stack1.city : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(15, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias3,((stack1 = (depth0 != null ? depth0.customer : depth0)) != null ? stack1.state : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(17, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias3,((stack1 = (depth0 != null ? depth0.customer : depth0)) != null ? stack1.postalCode : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(19, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"invoiceDateBlock no-padding flex\\\">\\r\\n <div class=\\\"date-headers\\\">\\r\\n <div>Invoice #: </div>\\r\\n <div>Invoice Date: </div>\\r\\n <div>Due Date: </div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias3,(depth0 != null ? depth0.terms : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(21, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div> </div>\\r\\n </div>\\r\\n <div class=\\\"date-value\\\">\\r\\n <div>\"\n + alias2(((helper = (helper = helpers.invoiceNumber || (depth0 != null ? depth0.invoiceNumber : depth0)) != null ? helper : alias4),(typeof helper === alias5 ? helper.call(alias3,{\"name\":\"invoiceNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div>\"\n + alias2(((helper = (helper = helpers.invoiceDate || (depth0 != null ? depth0.invoiceDate : depth0)) != null ? helper : alias4),(typeof helper === alias5 ? helper.call(alias3,{\"name\":\"invoiceDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div>\"\n + alias2(((helper = (helper = helpers.invoiceDueDate || (depth0 != null ? depth0.invoiceDueDate : depth0)) != null ? helper : alias4),(typeof helper === alias5 ? helper.call(alias3,{\"name\":\"invoiceDueDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias3,(depth0 != null ? depth0.terms : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(23, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div> </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"invoiceItems\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"itemId\\\">ID</div>\\r\\n <div class=\\\"description itemColumn\\\">Description</div>\\r\\n <div class=\\\"price itemColumn text-right\\\">Price</div> \\r\\n <div class=\\\"qty itemColumn text-right\\\">Qty</div>\\r\\n <div class=\\\"t-text itemColumn text-right\\\">T</div>\\r\\n <div class=\\\"discount itemColumn text-right\\\">Discount</div>\\r\\n <div class=\\\"total itemColumn text-right\\\">Total</div>\\r\\n </div>\\r\\n <div class=\\\"lineItem\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias3,(depth0 != null ? depth0.lineItems : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(25, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"itemrow flex\\\"></div>\\r\\n <div class=\\\"itemrow flex\\\"></div>\\r\\n <div class=\\\"itemrow flex totals-row subTotal\\\">\\r\\n <div class=\\\"itemId\\\"></div>\\r\\n <div class=\\\"description itemColumn\\\"></div>\\r\\n <div class=\\\"price itemColumn text-right\\\"></div> \\r\\n <div class=\\\"qty itemColumn text-right\\\"></div>\\r\\n <div class=\\\"t-text itemColumn text-right\\\"></div>\\r\\n <div class=\\\"discount text-right totalLabel\\\">Subtotal:</div>\\r\\n <div class=\\\"total itemColumn text-right totalBalance\\\">$\"\n + alias2((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias4).call(alias3,(depth0 != null ? depth0.subTotal : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow flex totals-row salesTax\\\">\\r\\n <div class=\\\"itemId\\\"></div>\\r\\n <div class=\\\"description itemColumn\\\"></div>\\r\\n <div class=\\\"price itemColumn text-right\\\"></div> \\r\\n <div class=\\\"qty itemColumn text-right\\\"></div>\\r\\n <div class=\\\"t-text itemColumn text-right\\\"></div>\\r\\n <div class=\\\"discount text-right totalLabel\\\">Sales Tax (\"\n + alias2(alias1(((stack1 = (depth0 != null ? depth0.salesTax : depth0)) != null ? stack1.taxRate : stack1), depth0))\n + \"%):</div>\\r\\n <div class=\\\"total itemColumn text-right totalBalance\\\">$\"\n + alias2((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias4).call(alias3,(depth0 != null ? depth0.tax : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow flex totals-row invoiceTotal\\\">\\r\\n <div class=\\\"itemId\\\"></div>\\r\\n <div class=\\\"description itemColumn\\\"></div>\\r\\n <div class=\\\"price itemColumn text-right\\\"></div> \\r\\n <div class=\\\"qty itemColumn text-right\\\"></div>\\r\\n <div class=\\\"t-text itemColumn text-right\\\"></div>\\r\\n <div class=\\\"discount text-right totalLabel\\\">Invoice Total:</div>\\r\\n <div class=\\\"total itemColumn text-right totalBalance\\\">$\"\n + alias2((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias4).call(alias3,(depth0 != null ? depth0.totalPrice : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow flex totals-row payments\\\">\\r\\n <div class=\\\"itemId\\\"></div>\\r\\n <div class=\\\"description itemColumn\\\"></div>\\r\\n <div class=\\\"price itemColumn text-right\\\"></div> \\r\\n <div class=\\\"qty itemColumn text-right\\\"></div>\\r\\n <div class=\\\"t-text itemColumn text-right\\\"></div>\\r\\n <div class=\\\"discount text-right totalLabel\\\">Payments:</div>\\r\\n <div class=\\\"total itemColumn text-right totalBalance\\\">$\"\n + alias2((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias4).call(alias3,(depth0 != null ? depth0.payments : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow flex totals-row balanceDue\\\">\\r\\n <div class=\\\"itemId\\\"></div>\\r\\n <div class=\\\"description itemColumn\\\"></div>\\r\\n <div class=\\\"price itemColumn text-right\\\"></div> \\r\\n <div class=\\\"qty itemColumn text-right\\\"></div>\\r\\n <div class=\\\"t-text itemColumn text-right\\\"></div>\\r\\n <div class=\\\"discount text-right totalLabel\\\">Balance Due:</div>\\r\\n <div class=\\\"total itemColumn text-right totalBalance\\\">$\"\n + alias2((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias4).call(alias3,(depth0 != null ? depth0.openBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow flex\\\"></div>\\r\\n <div class=\\\"itemrow flex memoContainer\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias3,(depth0 != null ? depth0.memo : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(27, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <!--Payment Block-->\\r\\n <div class=\\\"paymentBlock\\\">\\r\\n <div class=\\\"block\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias3,(depth0 != null ? depth0.isPaid : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(29, data, 0),\"inverse\":container.program(31, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar PaymentLinkTemplate = require('payment-link/template')\r\nvar $ = require('jquery')\r\nvar moment = require('moment')\r\nvar _ = require('lodash')\r\nvar numbro = require('numbro')\r\n\r\nvar paymentAmountError = 'Invalid payment amount.'\r\nvar requiredFieldEmptyError = 'Please fill out the required fields.'\r\n\r\nvar PaymentLinkView = Backbone.View.extend({\r\n className: 'customer-payment',\r\n \r\n initialize: function () {\r\n this.listenTo(this.model, 'change', this.render)\r\n this.on('failure', this.failure, this)\r\n },\r\n\r\n events: {\r\n 'click .download': 'downloadPDF',\r\n 'submit form': 'payNow',\r\n 'change input, select': 'validate',\r\n 'keyup input, select': 'validate',\r\n 'focusout input, select': 'validate'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(PaymentLinkTemplate(this.createViewModel()))\r\n $('#page-container').attr('style', 'padding: 0 !important;')\r\n $('#sidebar, #side-overlay, .content.bg-white.titlebar').attr('style', 'display:none;')\r\n $('#header-navbar').attr('style', 'left: 0px !important; padding:0px !important;')\r\n this.populateMonthDropdown()\r\n this.populateYearDropdown()\r\n this.$('.selectpicker').selectpicker({\r\n size: 5,\r\n dropupAuto: false,\r\n noneSelectedText: ''\r\n }) \r\n \r\n return this\r\n },\r\n\r\n createViewModel: function () { \r\n if (this.model.get('invoice')) {\r\n var invoice = this.model.get('invoice') \r\n \r\n var payments = invoice.totalPrice - invoice.openBalance\r\n \r\n this.isBalanced = false\r\n if (payments.toFixed(2) >= 0.1 && payments.toFixed(2) < invoice.totalPrice && invoice.openBalance > 0) {\r\n this.isBalanced = true\r\n }\r\n \r\n this.isPaid = false\r\n if (invoice.openBalance === 0) {\r\n this.isPaid = true\r\n }\r\n\r\n return {\r\n invoice: invoice,\r\n isBalanced: this.isBalanced,\r\n isPaid: this.isPaid,\r\n openBalance: invoice.openBalance,\r\n company: invoice.company,\r\n customer: invoice.customer,\r\n invoiceNumber: invoice.invoiceNumber,\r\n invoiceDate: moment(invoice.date).format('MM/DD/YYYY'),\r\n invoiceDueDate: moment(invoice.dueDate).format('MM/DD/YYYY'),\r\n terms: invoice.terms,\r\n lineItems: invoice.lineItems,\r\n subTotal: invoice.subTotal,\r\n salesTax: invoice.salesTax,\r\n tax: invoice.tax,\r\n totalPrice: invoice.totalPrice,\r\n payments: payments.toFixed(2),\r\n memo: invoice.memo\r\n }\r\n }\r\n },\r\n \r\n populateMonthDropdown: function () {\r\n var todayDate = new Date()\r\n todayDate = moment(todayDate)\r\n // moment.month() is zero based, so it will return 0-11.\r\n var currentMonth = todayDate.month() + 1\r\n\r\n var months = _.range(1, 13)\r\n _.each(months, function (value, key) {\r\n var monthDisplay = value < 10 ? '0' + value : value\r\n $('#expMonth').append($('<option value=\"' + value + '\">' + monthDisplay + '</option>'))\r\n if (currentMonth === value) {\r\n $('#expMonth').val(value)\r\n }\r\n }, this)\r\n },\r\n \r\n populateYearDropdown: function () {\r\n var baseYear = 2017\r\n var years = _.range(baseYear, (baseYear + 21))\r\n _.each(years, function (value, key) {\r\n $('#expYear').append($('<option value=\"' + value + '\">' + value + '</option>'))\r\n }, this)\r\n },\r\n\r\n validate: function (event) {\r\n var invoice = this.model.get('invoice')\r\n var creditCard = this.$('input#creditNumber').val()\r\n var cvv = this.$('input#securityCode').val()\r\n var nameOnCard = this.$('input#nameOnCard').val()\r\n var expirationMonth = this.$('#expMonth').val()\r\n var expirationYear = this.$('#expYear').val()\r\n \r\n var streetAddress = this.$('input#streetAddress').val()\r\n var city = this.$('input#city').val()\r\n var state = this.$('#state').val()\r\n var postalCode = this.$('input#postalCode').val()\r\n var country = this.$('input#country').val()\r\n\r\n var paymentAmount = numbro().unformat(this.$('input#paymentAmount').val())\r\n\r\n if (!!state) {\r\n this.$('.stateList').addClass('open')\r\n } else {\r\n this.$('.stateList').removeClass('open')\r\n }\r\n\r\n creditCard = creditCard.replace(/[^\\d]+/g, '')\r\n cvv = cvv.replace(/[^\\d]+/g, '')\r\n var feedbackSummary = this.$('.validation-summary-errors').find('.errorMessage')\r\n this.$('.has-error').removeClass('has-error')\r\n feedbackSummary.empty()\r\n \r\n if (!!this.model.get('invoice')) {\r\n var accumulatedBalance = invoice.openBalance - paymentAmount\r\n if (paymentAmount >= invoice.openBalance) {\r\n accumulatedBalance = 0\r\n } else if (paymentAmount <= 0) {\r\n accumulatedBalance = invoice.openBalance\r\n } \r\n \r\n this.$('input#balanceAmount').val(numbro(accumulatedBalance).formatCurrency('$0,0.00')) \r\n }\r\n \r\n if ((!!paymentAmount && paymentAmount <= 0) || (!!paymentAmount && !!this.model.get('invoice') && paymentAmount > invoice.openBalance)) {\r\n feedbackSummary.empty()\r\n feedbackSummary.append('<div>' + paymentAmountError + '</div>')\r\n this.$('input#paymentAmount').parent().parent().addClass('has-error')\r\n } \r\n },\r\n \r\n payNow: function (event) {\r\n event.preventDefault()\r\n \r\n var invoice = this.model.get('invoice')\r\n var creditCard = this.$('input#creditNumber').val()\r\n var cvv = this.$('input#securityCode').val()\r\n var nameOnCard = this.$('input#nameOnCard').val()\r\n var expirationMonth = this.$('#expMonth').val()\r\n var expirationYear = this.$('#expYear').val()\r\n\r\n var streetAddress = this.$('input#streetAddress').val()\r\n var city = this.$('input#city').val()\r\n var state = this.$('#state').val()\r\n var postalCode = this.$('input#postalCode').val()\r\n var country = this.$('input#country').val()\r\n\r\n var paymentAmount = numbro().unformat(this.$('input#paymentAmount').val())\r\n \r\n creditCard = creditCard.replace(/[^\\d]+/g, '')\r\n cvv = cvv.replace(/[^\\d]+/g, '')\r\n \r\n var feedbackSummary = this.$('.validation-summary-errors').find('.errorMessage')\r\n this.$('.has-error').removeClass('has-error')\r\n feedbackSummary.empty()\r\n \r\n if ((!!paymentAmount && paymentAmount <= 0) || (!!paymentAmount && !!this.model.get('invoice') && paymentAmount > invoice.openBalance) \r\n || !creditCard || !cvv || !nameOnCard || !expirationMonth || !expirationYear || !streetAddress || !postalCode || !paymentAmount\r\n || (!!expirationMonth && !!expirationYear && !this.isExpDateValid()) ) {\r\n \r\n if (!creditCard || !cvv || !nameOnCard || !expirationMonth || !expirationYear || !streetAddress || !postalCode || !paymentAmount) {\r\n feedbackSummary.empty()\r\n feedbackSummary.append('<div>' + requiredFieldEmptyError + '</div>')\r\n }\r\n if ((!!paymentAmount && paymentAmount <= 0) || (!!paymentAmount && !!this.model.get('invoice') && paymentAmount > invoice.openBalance)) {\r\n feedbackSummary.empty()\r\n feedbackSummary.append('<div>' + paymentAmountError + '</div>')\r\n this.$('input#paymentAmount').parent().parent().addClass('has-error')\r\n }\r\n if (!creditCard) {\r\n this.$('input#creditNumber').parent().parent().addClass('has-error')\r\n }\r\n if (!cvv ) {\r\n this.$('input#securityCode').parent().parent().addClass('has-error')\r\n }\r\n if (!nameOnCard ) {\r\n this.$('input#nameOnCard').parent().parent().addClass('has-error')\r\n }\r\n if (!expirationMonth ) {\r\n this.$('#expMonth').parent().parent().addClass('has-error')\r\n }\r\n if (!expirationYear ) {\r\n this.$('#expYear').parent().parent().addClass('has-error')\r\n }\r\n if (!streetAddress ) {\r\n this.$('input#streetAddress').parent().parent().addClass('has-error')\r\n }\r\n if (!postalCode ) {\r\n this.$('input#postalCode').parent().parent().addClass('has-error')\r\n }\r\n if (!paymentAmount || (!!paymentAmount && paymentAmount <= 0) || (!!paymentAmount && !!this.model.get('invoice') && paymentAmount > invoice.openBalance)) {\r\n this.$('input#paymentAmount').parent().parent().addClass('has-error')\r\n }\r\n if (!!expirationMonth && !!expirationYear && !this.isExpDateValid()) {\r\n this.$('#expMonth').parent().parent().addClass('has-error')\r\n this.$('#expYear').parent().parent().addClass('has-error')\r\n }\r\n } else {\r\n var data = {\r\n amount: paymentAmount,\r\n name: nameOnCard,\r\n streetAddress: streetAddress,\r\n postalCode: postalCode,\r\n creditCard: {\r\n cardNumber: creditCard,\r\n cvv: cvv,\r\n expirationMonth: expirationMonth,\r\n expirationYear: expirationYear\r\n }\r\n }\r\n \r\n this.trigger('payNow', data, this)\r\n }\r\n \r\n },\r\n\r\n isExpDateValid: function () {\r\n var selectedMonth = this.$('#expMonth').val()\r\n var selectedYear = this.$('#expYear').val()\r\n\r\n var todayDate = new Date()\r\n todayDate = moment(todayDate)\r\n var currentYear = todayDate.year()\r\n var currentMonth = todayDate.month() + 1\r\n\r\n if (selectedYear === currentYear.toString()) {\r\n return selectedMonth >= currentMonth\r\n } else {\r\n return true\r\n }\r\n },\r\n \r\n downloadPDF: function () {\r\n this.trigger('download')\r\n },\r\n \r\n failure: function (message) {\r\n var feedbackSummary = this.$('.validation-summary-errors').find('.errorMessage').empty()\r\n feedbackSummary.append('<div>' + message + '</div>')\r\n }\r\n \r\n\r\n\r\n})\r\n\r\nmodule.exports = PaymentLinkView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar PaymentLinkView = require('payment-link/view')\r\nvar PaymentLinkService = require('payment-link/service')\r\n\r\nvar PaymentLinkWidget = function (companyId, invoiceId, customerId) {\r\n this.companyId = companyId \r\n this.invoiceId = invoiceId\r\n this.customerId = customerId\r\n \r\n this.model = new Backbone.Model()\r\n this.paymentLinkService = new PaymentLinkService()\r\n this.view = new PaymentLinkView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('download', this.downloadInvoice, this)\r\n this.view.on('payNow', this.payInvoice.bind(this))\r\n}\r\n\r\nPaymentLinkWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.getInvoice()\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nPaymentLinkWidget.prototype.getInvoice = function () {\r\n this.paymentLinkService.getInvoice(this.companyId, this.invoiceId, this.customerId).then(function (invoice) {\r\n this.model.set('invoice', invoice)\r\n }.bind(this))\r\n}\r\n\r\nPaymentLinkWidget.prototype.payInvoice = function (paymentInfo) {\r\n this.paymentLinkService.payInvoice(this.companyId, this.invoiceId, this.customerId, paymentInfo).then(function (response) {\r\n this.getInvoice()\r\n return response\r\n }.bind(this), function (response) {\r\n this.view.trigger('failure', response.message || 'An error occured.')\r\n }.bind(this))\r\n}\r\n\r\nPaymentLinkWidget.prototype.downloadInvoice = function () {\r\n this.paymentLinkService.downloadInvoice(this.companyId, this.invoiceId, this.customerId)\r\n}\r\n\r\nmodule.exports = PaymentLinkWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"payment itemrow\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.checkbox,depth0,{\"name\":\"checkbox\",\"hash\":{\"inputName\":\"paymentSelected\",\"wrapperClasses\":\"payment-selected\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"payment-date date\\\">\"\n + alias4(((helper = (helper = helpers.shortPaymentDate || (depth0 != null ? depth0.shortPaymentDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortPaymentDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"invoice-number\\\">\"\n + alias4(((helper = (helper = helpers.invoiceNumber || (depth0 != null ? depth0.invoiceNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"invoiceNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"customer-name\\\">\"\n + alias4(((helper = (helper = helpers.customerName || (depth0 != null ? depth0.customerName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"customerName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"source\\\">\"\n + alias4(((helper = (helper = helpers.source || (depth0 != null ? depth0.source : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"source\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"payment-reference reference\\\">\"\n + alias4(((helper = (helper = helpers.reference || (depth0 != null ? depth0.reference : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reference\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"payment-amount currency\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.amount : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"payment itemrow\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.checkbox,depth0,{\"name\":\"checkbox\",\"hash\":{\"isChecked\":true,\"inputName\":\"paymentSelected\",\"wrapperClasses\":\"payment-selected\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"payment-date date\\\">\"\n + alias4(((helper = (helper = helpers.shortPaymentDate || (depth0 != null ? depth0.shortPaymentDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortPaymentDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"invoice-number\\\">\"\n + alias4(((helper = (helper = helpers.invoiceNumber || (depth0 != null ? depth0.invoiceNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"invoiceNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"customer-name\\\">\"\n + alias4(((helper = (helper = helpers.customerName || (depth0 != null ? depth0.customerName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"customerName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"source\\\">\"\n + alias4(((helper = (helper = helpers.source || (depth0 != null ? depth0.source : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"source\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"payment-reference\\\">\"\n + alias4(((helper = (helper = helpers.reference || (depth0 != null ? depth0.reference : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reference\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"payment-amount currency\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.amount : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3 class=\\\"title\\\"></h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Checkbook\",\"inputName\":\"checkbookSearch\",\"inputId\":\"checkbookSearch\",\"wrapperClasses\":\"checkbook-search\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Deposit Date\",\"wrapperClasses\":\"deposit-date\",\"inputName\":\"depositDate\",\"inputId\":\"depositDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputLabel\":\"Amount\",\"inputName\":\"amount\",\"inputClasses\":\"currency-field\",\"inputId\":\"amount\",\"wrapperClasses\":\"amount\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"checkbookId\\\" />\\r\\n </div>\\r\\n <div class=\\\"payments table table-hover table-borderless table-striped\\\">\\r\\n <h3></h3>\\r\\n <div class=\\\"payment head\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.checkbox,depth0,{\"name\":\"checkbox\",\"hash\":{\"inputName\":\"paymentSelectedGlobal\",\"wrapperClasses\":\"payment-selected-global\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"payment-date date\\\">Payment Date</div>\\r\\n <div class=\\\"invoice-number\\\">Invoice Number</div>\\r\\n <div class=\\\"customer-name\\\">Customer Name</div>\\r\\n <div class=\\\"source\\\">Payment Type</div>\\r\\n <div class=\\\"payment-reference reference\\\">Reference</div>\\r\\n <div class=\\\"payment-amount currency\\\">Amount</div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.paymentsList : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.paymentEntries : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <div class=\\\"meta summary\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Reduction Amount\",\"inputName\":\"reductionAmount\",\"inputClasses\":\"currency-field\",\"inputId\":\"reductionAmount\",\"wrapperClasses\":\"reduction-amount\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Reduction Account #\",\"inputName\":\"reductionAccountNumberSearch\",\"inputId\":\"reductionAccountNumber\",\"wrapperClasses\":\"reduction-account-number\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Reduction Account Description\",\"inputName\":\"reductionAccountDescriptionSearch\",\"inputId\":\"reductionAccountDescription\",\"wrapperClasses\":\"reduction-account-description\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputLabel\":\"Total Deposit\",\"inputName\":\"totalDeposit\",\"inputClasses\":\"currency-field\",\"inputId\":\"totalDeposit\",\"wrapperClasses\":\"total-deposit\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"reductionAccountId\\\" />\\r\\n </div>\\r\\n <div class=\\\"actions\\\">\\r\\n <button class=\\\"btn btn-primary save save-button\\\">Save Deposit</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i\\r\\n class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Sales item must have a\\r\\n name.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('receivables/deposits/create/template')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar numbro = require('numbro')\r\nvar moment = require('moment')\r\nvar Q = require('q')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar valid = $('<div class=\"bg-primary-lighter\" style=\"display: block;\"><i class=\"fa fa-check-circle fa-2x fa-inverse\"></i><span class=\"message\">Deposit is valid.</span></div>')\r\nvar invalid = $('<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">Deposit must have a printed name, deposit date, due date, and at least one item.</span></div>')\r\n\r\nvar DepositCreateView = CreateView.extend({\r\n className: 'block create',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'click input': 'determineStatus',\r\n 'click': 'expand'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) {\r\n this.Template = Template\r\n }\r\n\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n\r\n var bindAutocomplete = Q.defer()\r\n this.bindAutocomplete = bindAutocomplete.promise\r\n this.on('bindAutocomplete', function () {\r\n bindAutocomplete.resolve()\r\n })\r\n\r\n this.model.on('change:paymentsList', this.render, this)\r\n },\r\n\r\n isValid: function () {\r\n return !!this.$('input[name=depositDate]').val() &&\r\n !!this.$('input[name=checkbookId]').val() &&\r\n !!(this.$('input[name=reductionAccountId]').val() || (!numbro().unformat(this.$('input[name=reductionAmount]').val()))) &&\r\n !!this.getLineItems().length\r\n },\r\n\r\n determineStatus: function () {\r\n if (this.isValid()) {\r\n this.$('.status').html(valid)\r\n } else {\r\n this.$('.status').html(invalid)\r\n }\r\n },\r\n\r\n selectReductionAccount: function (account) {\r\n this.$('input[name=reductionAccountNumberSearch]')\r\n .val(account.accountNumber)\r\n .closest('.floating')\r\n .addClass('open')\r\n this.$('input[name=reductionAccountDescriptionSearch]')\r\n .val(account.accountName)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('input[name=reductionAccountId]').val(account.id)\r\n this.determineStatus()\r\n },\r\n\r\n onRender: function () {\r\n this.$('.date input:disabled').closest('.date').addClass('readonly').attr('readonly', 'readonly')\r\n\r\n this.$('.deposit-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', moment().format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.deposit-date .date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.bindAutocomplete.then(function () {\r\n this.autoComplete(\r\n this.model.get('accountList'),\r\n 'accountNumber',\r\n this.$('input[name=reductionAccountNumberSearch]'),\r\n this.selectReductionAccount.bind(this)\r\n )\r\n\r\n this.autoComplete(\r\n this.model.get('accountList'),\r\n 'accountName',\r\n this.$('input[name=reductionAccountDescriptionSearch]'),\r\n this.selectReductionAccount.bind(this)\r\n )\r\n\r\n this.autoComplete(\r\n this.model.get('checkbookList'),\r\n 'name',\r\n this.$('input[name=checkbookSearch]'),\r\n function (checkbook) {\r\n this.$('input[name=checkbookSearch]')\r\n .val(checkbook.name)\r\n .closest('.floating')\r\n .addClass('open')\r\n this.$('input[name=checkbookId]').val(checkbook.id)\r\n this.determineStatus()\r\n }.bind(this)\r\n )\r\n }.bind(this))\r\n\r\n this.$('.payment input[type=checkbox]').off('change').on('change', this.recalcAmount.bind(this))\r\n this.$('input[name=reductionAmount]').val(numbro(0).formatCurrency('$0,0.00')).on('keyup', this.recalcAmount.bind(this))\r\n },\r\n\r\n recalcAmount: function (e) {\r\n if (e) {\r\n var $currentTarget = this.$(e.currentTarget)\r\n var isHeader = $currentTarget.closest('.payment').hasClass('head')\r\n\r\n if ($currentTarget.attr('name') === 'paymentSelected') {\r\n var anyNotChecked = this.$('.payment-selected input[type=checkbox]:not(:checked)').length\r\n this.$('input[name=paymentSelectedGlobal]').prop('checked', !anyNotChecked)\r\n }\r\n\r\n if (isHeader) {\r\n this.$('input[type=checkbox]').prop('checked', $currentTarget.prop('checked'))\r\n }\r\n }\r\n\r\n var totalAmount = 0\r\n this.$('.payment:not(.head) input[type=checkbox]:checked').each(function (index, checkbox) {\r\n var $checkbox = this.$(checkbox)\r\n var paymentId = $checkbox.closest('.payment').attr('data-id')\r\n var payment = this.model.get('paymentsLookup')[paymentId]\r\n totalAmount = totalAmount + (payment.amount * 100)\r\n }.bind(this))\r\n totalAmount = totalAmount / 100\r\n\r\n this.$('input[name=amount]')\r\n .val(numbro(totalAmount).formatCurrency('$0,0.00'))\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n var reductionAmount = numbro().unformat(this.$('input[name=reductionAmount]').val())\r\n\r\n var totalDeposit = totalAmount - reductionAmount\r\n this.$('input[name=totalDeposit]')\r\n .val(numbro(totalDeposit).formatCurrency('$0,0.00'))\r\n .closest('.floating')\r\n .addClass('open')\r\n },\r\n\r\n // This is a method used by the base class when a form is submitted on this view\r\n toJSON: function () {\r\n if (!this.isValid()) {\r\n this.determineStatus()\r\n throw new Error('Not valid')\r\n }\r\n\r\n var deposit = { }\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n if ($el.hasClass('currency') || $el.hasClass('currency-field')) {\r\n elValue = numbro().unformat(elValue)\r\n }\r\n\r\n deposit[$el.attr('name')] = elValue\r\n })\r\n\r\n deposit['payments'] = this.getLineItems()\r\n\r\n return deposit\r\n },\r\n\r\n getLineItems: function () {\r\n return _.map(this.$('.payment:not(.head) input[type=checkbox]:checked'), function (checkbox) {\r\n var $checkbox = this.$(checkbox)\r\n var paymentId = $checkbox.closest('.payment').attr('data-id')\r\n return { paymentId: paymentId }\r\n }.bind(this))\r\n }\r\n})\r\n\r\nmodule.exports = DepositCreateView\r\n","'use strict'\r\n\r\nvar Deposit = require('receivables/deposits/item/deposit')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar Deposits = ListWrapper.extend({\r\n childModel: Deposit\r\n})\r\n\r\nmodule.exports = Deposits\r\n","'use strict'\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\n\r\nvar Deposit = ListEntry.extend({}, {\r\n parse: function (json) {\r\n return new Deposit({\r\n amount: json.amount,\r\n checkbookId: json.checkbookId,\r\n checkbook: json.checkbook,\r\n depositDate: json.depositDate,\r\n id: json.id,\r\n paymentEntries: json.paymentEntries,\r\n payments: json.payments,\r\n reductionAccountId: json.reductionAccountId,\r\n reductionAmount: json.reductionAmount,\r\n reductionAccount: json.reductionAccount,\r\n reference: json.reference,\r\n shortDepositDate: moment(json.depositDate).format('MM/DD/YYYY'),\r\n paymentsLookup: json.paymentsLookup,\r\n isVoid: json.isVoid\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = Deposit\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isVoid : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-ban pull-right void\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \"<div class=\\\"deposit-date date\\\">\"\n + alias3(((helper = (helper = helpers.shortDepositDate || (depth0 != null ? depth0.shortDepositDate : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"shortDepositDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"description\\\">\"\n + alias3(container.lambda(((stack1 = (depth0 != null ? depth0.checkbook : depth0)) != null ? stack1.name : stack1), depth0))\n + \"</div>\\r\\n<div class=\\\"amount currency\\\">\"\n + alias3((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.amount : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n<div class=\\\"reduction currency\\\">\"\n + alias3((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.reductionAmount : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_eq_0 || (depth0 && depth0.if_not_eq_0) || alias2).call(alias1,(depth0 != null ? depth0.activeUserRole : depth0),{\"name\":\"if_not_eq_0\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('receivables/deposits/item/template')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar DepositView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n this.companyService = new CompanyService()\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n render: function () {\r\n var activeCompanyInfo = this.companyService.getActiveCompanyInfo()\r\n this.model.set('activeUserRole', activeCompanyInfo.role)\r\n \r\n this.$el.html(this.Template(this.model.toViewModel()))\r\n if (this.model.get('isVoid')) this.$el.addClass('notActive')\r\n if (this.onRender) this.onRender()\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = DepositView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \" <b class=\\\"pull-right\\\" id=\\\"availableBalance\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"left\\\"\\r\\n data-original-title=\\\"Total pending deposit amount\\\">\\r\\n <i class=\\\"fa fa-question-circle\\\" aria-hidden=\\\"true\\\"></i> Pending Deposit Balance: \"\n + container.escapeExpression((helpers.numbro || (depth0 && depth0.numbro) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.pendingBalance : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"\\r\\n </b>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"depositDate-sort\"] || (depth0 != null ? depth0[\"depositDate-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"depositDate-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\"></h3>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isPending : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"deposit-date date\\\">Date <i data-sort-field=\\\"depositDate\\\"\\r\\n class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0[\"depositDate-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"description\\\">Description</div>\\r\\n <div class=\\\"amount currency\\\">Amount</div>\\r\\n <div class=\\\"reduction currency\\\">Reduction</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\">\\r\\n <p class=\\\"center\\\">Loading more deposits...</p>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('receivables/deposits/list/template')\r\nvar DepositView = require('receivables/deposits/item/view')\r\nvar DetailsView = require('receivables/deposits/read/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\nvar DepositsList = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = DepositView\r\n this.model.set('sort', 'desc')\r\n this.model.set('sortField', 'depositDate')\r\n this.model.set('depositDate-sort', 'desc')\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.model.on('change:pendingBalance', this.render.bind(this))\r\n\r\n this.on('showDetails', this.showDetails.bind(this))\r\n this.on('void', this.showVoid.bind(this))\r\n },\r\n\r\n onRender: function () {\r\n if (this.model.get('isPending') && !this.$el.hasClass('pending-deposits')) {\r\n this.$el.addClass('pending-deposits')\r\n }\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more deposits...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more deposits.')\r\n },\r\n\r\n showDetails: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n var details = new DetailsView({ model: model })\r\n\r\n // View to show beneath $lineItem, and if the 'active' class should be added to $lineItem's classes\r\n this.showChildView(details, $lineItem, true)\r\n },\r\n\r\n showVoid: function (invoiceId) {\r\n this.showConfirmationMessage(\r\n this.$('.itemrow[data-id=\"' + invoiceId + '\"]'),\r\n 'Are you sure you want to void this deposit?',\r\n 'confirmVoid',\r\n invoiceId\r\n )\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, { silent: true })\r\n\r\n this.model.reset()\r\n }\r\n})\r\n\r\nmodule.exports = DepositsList\r\n","var UpdateView = require('receivables/deposits/update/view')\r\n\r\nvar DepositReadView = UpdateView.extend({\r\n className: 'block read expanded',\r\n\r\n onRender: function () {\r\n UpdateView.prototype.onRender.apply(this, arguments)\r\n this.$('input,select,textarea').attr('disabled', true)\r\n this.$('.input-group-addon .fa-calendar').css({display: 'none'})\r\n this.$('.payment-selected-global').css('display', 'none')\r\n },\r\n\r\n toJSON: function () {\r\n throw new Error(\"Read views can't create JSON objects.\")\r\n }\r\n})\r\n\r\nmodule.exports = DepositReadView\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar DepositService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nDepositService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nDepositService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'deposits'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nDepositService.prototype.getAll = function (page, pageSize, pending, sort, sortField) {\r\n var apiPath = this.GetPath() + this.GetQuery({page: page, pageSize: pageSize, pending: pending, sort: sort, sortField: sortField})\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nDepositService.prototype.generateDeposit = function (quoteId) {\r\n var apiPath = this.GetPath('generate-deposit', quoteId)\r\n return this.restClient.post(apiPath)\r\n}\r\n\r\nDepositService.prototype.setVoid = function (depositId) {\r\n var apiPath = this.GetPath(depositId, 'void')\r\n return this.restClient.put(apiPath)\r\n}\r\n\r\nDepositService.prototype.getPendingBalance = function () {\r\n var apiPath = this.GetPath('pending-balance')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nDepositService.prototype.getOpenDeposits = function () {\r\n var apiPath = this.GetPath('open-deposits')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nmodule.exports = DepositService\r\n","var CreateView = require('receivables/deposits/create/view')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar numbro = require('numbro')\r\n\r\nvar DepositUpdateView = CreateView.extend({\r\n className: 'block update expanded',\r\n\r\n onRender: function () {\r\n var model = this.model.toViewModel()\r\n\r\n if (model.checkbook && model.checkbook.name) {\r\n model.checkbookSearch = model.checkbook.name\r\n }\r\n\r\n if (model.reductionAccount && model.reductionAccount.accountNumber) {\r\n model.reductionAccountNumberSearch = model.reductionAccount.accountNumber\r\n model.reductionAccountDescriptionSearch = model.reductionAccount.accountName\r\n }\r\n\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n\r\n _.each(this.$('input, textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var isDate = $el.closest('.form-material').hasClass('date')\r\n var isCurrency = $el.hasClass('currency') || $el.hasClass('currency-field')\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else if (isDate) {\r\n $el.val(moment(model[$el.attr('name')]).format('MM/DD/YYYY')).closest('.floating').addClass('open')\r\n } else if (isCurrency) {\r\n $el.val(numbro(model[$el.attr('name')]).formatCurrency('$0,0.00'))\r\n } else if (model[$el.attr('name')]) {\r\n $el.val(model[$el.attr('name')]).closest('.floating').addClass('open')\r\n }\r\n })\r\n\r\n this.recalcAmount()\r\n }\r\n})\r\n\r\nmodule.exports = DepositUpdateView\r\n","var ListContainer = require('lists/list/view')\r\nvar ListView = require('receivables/deposits/list/view')\r\nvar CreateView = require('receivables/deposits/create/view')\r\nvar _ = require('lodash')\r\n\r\nvar DepositsView = ListContainer.extend({\r\n className: 'deposits receivables list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n this.listView = new ListView({model: this.model})\r\n this.forwardEvents(this.listView)\r\n\r\n this.createView = new CreateView({model: this.model})\r\n this.forwardEvents(this.createView)\r\n\r\n this.on('created', function () {\r\n this.createView.trigger('resetInputs')\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n console.log('container -> editDetails')\r\n this.listView.trigger('showEdit', model)\r\n }.bind(this))\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('dataLoaded', function () {\r\n this.listView.trigger('bindScroll')\r\n this.createView.onRender()\r\n this.createView.trigger('bindAutocomplete')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n\r\n this.on('forwardSalesEntryError', function () {\r\n _.partial(this.createView.trigger, 'salesEntryError').apply(this.createView, arguments)\r\n if (this.updateView) {\r\n _.partial(this.updateView.trigger, 'salesEntryError').apply(this.updateView, arguments)\r\n }\r\n }.bind(this))\r\n\r\n this.on('forwardSalesEntryCreated', function () {\r\n _.partial(this.createView.trigger, 'salesEntryCreated').apply(this.createView, arguments)\r\n if (this.updateView) {\r\n _.partial(this.updateView.trigger, 'salesEntryCreated').apply(this.updateView, arguments)\r\n }\r\n }.bind(this))\r\n },\r\n\r\n getListView: function () {\r\n return this.listView\r\n },\r\n\r\n setPendingListView: function (pendingListView) {\r\n this.pendingListView = pendingListView\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n\r\n if (!this.model.get('isPending')) {\r\n this.$el.append(this.createView.render().$el)\r\n }\r\n if (this.pendingListView) {\r\n this.$el.append(this.pendingListView.render().$el)\r\n }\r\n this.$el.append(this.listView.render().$el)\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = DepositsView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar moment = require('moment')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar Deposits = require('receivables/deposits/deposits')\r\nvar Service = require('receivables/deposits/service')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar CustomerService = require('lists/customers/service')\r\nvar PaymentsService = require('receivables/payments/service')\r\nvar ListContainer = require('receivables/deposits/view')\r\n\r\nvar PaymentType = Object.freeze({\r\n 1: 'Cash',\r\n 2: 'Check',\r\n 3: 'Credit Card',\r\n 4: 'EFT'\r\n})\r\n\r\nvar DepositWidget = function (isPending) {\r\n this.service = new Service()\r\n this.accountService = new AccountService()\r\n this.checkbookService = new CheckbookService()\r\n this.customerService = new CustomerService()\r\n this.paymentsService = new PaymentsService()\r\n this.modelType = Deposits\r\n this.viewType = ListContainer\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n\r\n this.checkbookPromise = this.checkbookService.fetchCheckbookList().then(function (checkbooks) {\r\n this.model.set('checkbookList', _.map(checkbooks, function (checkbook) {\r\n return checkbook.toJSON()\r\n }))\r\n this.model.set('checkbookLookup', _.keyBy(this.model.get('checkbookList'), 'id'))\r\n }.bind(this))\r\n\r\n this.accountPromise = this.accountService.fetchAccounts(true).then(function (accounts) {\r\n this.model.set('accountList', _.map(accounts, function (account) {\r\n return account.toJSON()\r\n }))\r\n this.model.set('accountLookup', _.keyBy(this.model.get('accountList'), 'id'))\r\n }.bind(this))\r\n\r\n this.loadPayments()\r\n\r\n this.readyPromise = Q.all([this.checkbookPromise, this.accountPromise]).then(function () {\r\n this.view.trigger('dataLoaded')\r\n }.bind(this))\r\n\r\n this.view.on('created', this.loadPayments.bind(this))\r\n this.view.on('reset', this.loadPayments.bind(this))\r\n}\r\n\r\nDepositWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nDepositWidget.prototype.loadPayments = function () {\r\n this.paymentsPromise = this.paymentsService.getUndeposited().then(function (payments) {\r\n payments = _.filter(payments, function (payment) {\r\n return payment.invoices.length !== 0\r\n })\r\n\r\n this.model.set('paymentsList', _.map(payments, function (payment) {\r\n payment.shortPaymentDate = moment(payment.paymentDate).format('MM/DD/YYYY')\r\n payment.invoiceNumber = (payment.invoices.length > 1) ? 'Multiple' : payment.invoices[0].invoiceNumber\r\n if (payment.source < 1 || payment.source > 4) {\r\n payment.source = 1\r\n }\r\n payment.source = PaymentType[payment.source] ? PaymentType[payment.source] : payment.source\r\n return payment\r\n }))\r\n this.model.set('paymentsLookup', _.keyBy(this.model.get('paymentsList'), 'id'))\r\n }.bind(this))\r\n}\r\n\r\nDepositWidget.prototype.resolveReferences = function (deposit) {\r\n var checkbookId = deposit.checkbookId\r\n var reductionAccountId = deposit.reductionAccountId\r\n\r\n if (checkbookId) {\r\n var checkbook = this.model.get('checkbookLookup')[checkbookId]\r\n deposit.checkbook = checkbook\r\n }\r\n\r\n if (reductionAccountId) {\r\n var account = this.model.get('accountLookup')[reductionAccountId]\r\n deposit.reductionAccount = account\r\n }\r\n\r\n if (deposit.paymentEntries && deposit.paymentEntries.length) {\r\n _.map(deposit.paymentEntries, function (payment) {\r\n payment.shortPaymentDate = moment(payment.paymentDate).format('MM/DD/YYYY')\r\n if (payment.invoices !== null && !!payment.invoices) {\r\n payment.invoiceNumber = (payment.invoices.length > 1) ? 'Multiple' : payment.invoices[0].invoiceNumber\r\n }\r\n if (payment.source < 1 || payment.source > 4) {\r\n payment.source = 1\r\n }\r\n payment.source = PaymentType[payment.source] ? PaymentType[payment.source] : payment.source\r\n return payment\r\n })\r\n deposit.paymentsLookup = _.keyBy(deposit.paymentEntries, 'id')\r\n }\r\n\r\n return deposit\r\n}\r\n\r\nDepositWidget.prototype.get = function (modelId) {\r\n return this.service.get(modelId).then(function (item) {\r\n return this.readyPromise.then(_.partial(this.resolveReferences, item).bind(this)).then(function (item) {\r\n return this.childModel(item)\r\n }.bind(this))\r\n }.bind(this)).then(function (deposit) {\r\n this.view.trigger('details', deposit)\r\n }.bind(this))\r\n}\r\n\r\nDepositWidget.prototype.loadPage = function () {\r\n if (this.loadingMore) return\r\n this.loadingMore = true\r\n var currentPage = this.model.get('page')\r\n this.view.trigger('loadingPage', currentPage)\r\n this.model.trigger('loadingPage', currentPage)\r\n return this.service.getAll(currentPage, 100, this.model.get('isPending'), this.model.get('sort'), this.model.get('sortField')).then(function (result) {\r\n return this.readyPromise.then(function () { return result })\r\n }.bind(this)).then(function (result) {\r\n _.each(result.collection, this.resolveReferences.bind(this))\r\n return result\r\n }.bind(this)).then(function (result) {\r\n this.loadingMore = false\r\n if (result.collection.length) {\r\n this.model.set('page', currentPage + 1)\r\n } else {\r\n this.view.trigger('EOF')\r\n }\r\n this.model.set('sortField', result.sortField)\r\n this.model.set('sort', result.sort)\r\n this.model.add(_.map(result.collection, this.childModel.bind(this)))\r\n this.view.trigger('loadedPage', result.collection.length)\r\n this.model.trigger('loadedPage', result.collection.length)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = DepositWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3 class=\\\"title\\\"></h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Reference\",\"inputName\":\"reference\",\"inputId\":\"reference\",\"wrapperClasses\":\"reference\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Payment Date\",\"inputName\":\"paymentDate\",\"inputId\":\"paymentDate\",\"wrapperClasses\":\"payment-date\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Amount\",\"inputClasses\":\"currency currency-field\",\"inputName\":\"amount\",\"inputId\":\"amount\",\"wrapperClasses\":\"amount\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Apply Payment</button>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('receivables/invoices/apply-payment/template')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar moment = require('moment')\r\nvar numbro = require('numbro')\r\nvar dateParams = require('datepicker/datepicker-params')\r\nvar valid = $('<div class=\"bg-primary-lighter\" style=\"display: block;\"><i class=\"fa fa-check-circle fa-2x fa-inverse\"></i><span class=\"message\">Payment is valid.</span></div>')\r\n\r\nvar ApplyPaymentView = CreateView.extend({\r\n className: 'block create apply-payment expanded',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'click': 'expand',\r\n 'click .add-more-line-items': 'addInvoice'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) {\r\n this.Template = Template\r\n }\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n this.determineStatus()\r\n\r\n this.$('.payment-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', moment().format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.payment-date .date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n },\r\n\r\n isValid: function () {\r\n return (this.$('input[name=customerId]').val() || this.model.get('customerId')) &&\r\n numbro().unformat(this.$('input[name=amount]').val()) &&\r\n // We have to multiply and divide by 100 to avoid rounding issues when working with cents.\r\n numbro().unformat(this.$('input[name=amount]').val()) >= (_.reduce(this.getDistributions(), function (memo, distribution) {\r\n return memo + (distribution.amount * 100)\r\n }, 0) / 100)\r\n },\r\n\r\n determineStatus: function () {\r\n // We have to multiply and divide by 100 to avoid rounding issues when working with cents.\r\n var isValidAmountDistribution = numbro().unformat(this.$('input[name=amount]').val()) >= (_.reduce(this.getDistributions(), function (memo, distribution) {\r\n return memo + (distribution.amount * 100)\r\n }, 0) / 100)\r\n if (this.isValid()) {\r\n this.$('.status').html(valid)\r\n } else {\r\n var errorMessage = this.invalidMessage('This payment is not valid.')\r\n if (!(this.$('input[name=customerId]').val() || this.model.get('customerId'))) {\r\n errorMessage = this.invalidMessage('You must select a customer that is making this payment.')\r\n } else if (!numbro().unformat(this.$('input[name=amount]').val())) {\r\n errorMessage = this.invalidMessage('You must specify an amount for this payment.')\r\n } else if (!isValidAmountDistribution) {\r\n errorMessage = this.invalidMessage('You can not distribute more than the payment is worth.')\r\n }\r\n this.$('.status').html(errorMessage)\r\n }\r\n },\r\n\r\n invalidMessage: function (message) {\r\n return $('<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">' + message + '</span></div>')\r\n },\r\n\r\n // This is a method used by the base class when a form is submitted on this view\r\n toJSON: function () {\r\n if (!this.isValid()) {\r\n throw new Error('Payment is not valid')\r\n }\r\n\r\n var model = {}\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n if ($el.hasClass('currency') || $el.hasClass('currency-field')) {\r\n elValue = numbro().unformat(elValue)\r\n }\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n model.customerId = this.model.get('customerId')\r\n model.invoicePayments = this.getDistributions()\r\n\r\n return model\r\n },\r\n\r\n getDistributions: function () {\r\n return [{\r\n invoiceId: this.model.id,\r\n amount: numbro().unformat(this.$('input[name=amount]').val())\r\n }]\r\n },\r\n\r\n // We need to override the default logic for telling if we're going to be updating or creating a new\r\n // We will always be creating a new payment here\r\n getId: function () {\r\n return null\r\n }\r\n})\r\n\r\nmodule.exports = ApplyPaymentView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"form-group onlineMethodText\\\">\\r\\n <div>Accept online payments today, <span class=\\\"greenText\\\"><a href=\\\"http://crunched.io/payment-processing\\\"\\r\\n target=\\\"_blank\\\">Learn More</a></span></div>\\r\\n </div>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"form-group cardCheckboxContainer\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Credit Card</span>\\r\\n <input type=\\\"checkbox\\\" name=\\\"allowCreditCards\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <select class=\\\"form-control\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" name=\\\"recurringFrequency\\\" size=\\\"1\\\">\\r\\n <option value=\\\"1\\\">Weekly</option>\\r\\n <option value=\\\"2\\\">Bi-Weekly</option>\\r\\n <option value=\\\"3\\\">Monthly</option>\\r\\n <option value=\\\"4\\\">Bi-Monthly</option>\\r\\n <option value=\\\"5\\\">Quarterly</option>\\r\\n <option value=\\\"6\\\">Semi-Annual</option>\\r\\n <option value=\\\"7\\\">Annual</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"\"\n + alias4(((helper = (helper = helpers.uniqueId || (depth0 != null ? depth0.uniqueId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"uniqueId\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">Frequency</label>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, buffer = \n \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3 class=\\\"title\\\"></h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side display-container\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"value\":(depth0 != null ? depth0.nextInvoiceNumber : depth0),\"inputLabel\":\"Invoice Number\",\"inputName\":\"invoiceNumber\",\"inputId\":\"invoice-number\",\"wrapperClasses\":\"invoice-number\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Memorized Label\",\"inputName\":\"label\",\"inputId\":\"memorized-label\",\"wrapperClasses\":\"memorized-label\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Customer ID\",\"inputName\":\"customerIdSearch\",\"inputId\":\"customer-id-search\",\"wrapperClasses\":\"customer-id-search\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Customer Name\",\"inputName\":\"customerNameSearch\",\"inputId\":\"customer-name-search\",\"wrapperClasses\":\"customer-name-search\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"customerId\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizationId\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizedEntryDate\\\" />\\r\\n </div>\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Printed Name\",\"inputName\":\"printedName\",\"inputId\":\"printed-name\",\"wrapperClasses\":\"printed-name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Department\",\"inputName\":\"departmentName\",\"inputId\":\"department-name\",\"wrapperClasses\":\"department-name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"departmentId\\\">\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 1\",\"inputName\":\"addressLine1\",\"inputId\":\"address-line1\",\"wrapperClasses\":\"address-line1\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 2\",\"inputName\":\"addressLine2\",\"inputId\":\"address-line2\",\"wrapperClasses\":\"address-line2\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"city-state\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"City\",\"inputName\":\"city\",\"inputId\":\"city\",\"wrapperClasses\":\"city\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.stateSelect,depth0,{\"name\":\"stateSelect\",\"hash\":{\"inputId\":\"state\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Zip Code\",\"inputName\":\"postalCode\",\"inputId\":\"zipcode\",\"wrapperClasses\":\"zipcode\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side memo-info\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Date\",\"wrapperClasses\":\"quoteDate\",\"inputName\":\"date\",\"inputId\":\"quoteDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Due Date\",\"wrapperClasses\":\"dueDate\",\"inputName\":\"dueDate\",\"inputId\":\"quoteDueDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInputTaxRate,depth0,{\"name\":\"floatingInputTaxRate\",\"hash\":{\"wrapperClasses\":\"tax-rate-id-container\",\"inputLabel\":\"Tax Rate ID\",\"inputName\":\"rateId\",\"inputId\":\"tax-rate-id\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"wrapperClasses\":\"tax-rate-percentile-container\",\"inputLabel\":\"Tax Rate %\",\"inputName\":\"taxRate\",\"inputId\":\"tax-rate-percentile\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"taxRateId\\\" />\\r\\n </div>\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Terms\",\"inputName\":\"terms\",\"wrapperClasses\":\"terms\",\"inputId\":\"terms\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"PO/Ref#\",\"inputName\":\"purchaseOrderNumber\",\"wrapperClasses\":\"reference\",\"inputId\":\"reference\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\\r\\n <div class=\\\"form-group onlineMethodHeader\\\">\\r\\n <div>Online Payment Methods</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.paymentsEnabled : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n\"\n + ((stack1 = container.invokePartial(partials.textarea,depth0,{\"name\":\"textarea\",\"hash\":{\"inputRows\":\"4\",\"inputLabel\":\"Memo\",\"inputName\":\"memo\",\"inputId\":\"memo\",\"wrapperClasses\":\"memo-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group is-recurring\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span>Recurring</span> <input type=\\\"checkbox\\\" name=\\\"isRecurring\\\"><span></span>\\r\\n </label>\\r\\n </div>\\r\\n </div>\\r\\n <input type=\\\"hidden\\\" name=\\\"isVoid\\\" value=\\\"\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"isPosted\\\" value=\\\"\\\">\\r\\n </div>\\r\\n <div class=\\\"distribution item-list\\\">\\r\\n <h3>Itemization</h3>\\r\\n <div class=\\\"line-item-container forceLabelsOpen\\\">The invoice currently has no sales items.</div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Sales Items</button>\\r\\n <br />\\r\\n <div class=\\\"col-xs-12 recurring-meta-container no-padding\\\">\\r\\n <h3>Recurrence</h3>\\r\\n <div class=\\\"flex col-xs-12\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Start Date\",\"wrapperClasses\":\"recurring-start-date\",\"inputName\":\"recurringDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"form-group recurring-frequency-wrapper\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n\";\n stack1 = ((helper = (helper = helpers.hasUniqueId || (depth0 != null ? depth0.hasUniqueId : depth0)) != null ? helper : helpers.helperMissing),(options={\"name\":\"hasUniqueId\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data}),(typeof helper === \"function\" ? helper.call(alias1,options) : helper));\n if (!helpers.hasUniqueId) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}\n if (stack1 != null) { buffer += stack1; }\n return buffer + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"review\\\">\\r\\n <h3>Review</h3>\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.textarea,depth0,{\"name\":\"textarea\",\"hash\":{\"inputRows\":\"7\",\"inputLabel\":\"Notes\",\"inputName\":\"notes\",\"inputId\":\"notes\",\"wrapperClasses\":\"notes-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"totals\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputClasses\":\"currency-field\",\"inputLabel\":\"Subtotal\",\"inputName\":\"subTotal\",\"inputId\":\"subTotal\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputClasses\":\"currency-field\",\"inputLabel\":\"Sales Tax\",\"inputName\":\"estTax\",\"inputId\":\"estTax\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputClasses\":\"currency-field\",\"inputLabel\":\"Invoice Total\",\"inputName\":\"quoteTotal\",\"inputId\":\"quoteTotal\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <br>\\r\\n <button class=\\\"btn btn-primary memorize-button\\\">Memorize</button>\\r\\n <button class=\\\"btn btn-primary pull-left apply-payment\\\">Apply Payment</button>\\r\\n <button class=\\\"btn btn-primary pull-right post-button\\\">Post Invoice</button>\\r\\n <button class=\\\"btn btn-primary pull-right create-invoice\\\">Invoice</button>\\r\\n <button class=\\\"btn btn-gray pull-right cancel\\\">Cancel</button>\\r\\n <button class=\\\"btn btn-danger pull-right void-button\\\">Void</button>\\r\\n <button class=\\\"btn btn-danger pull-right delete-button\\\">Delete</button>\\r\\n <button class=\\\"btn btn-primary pull-right print-button\\\">Print</button>\\r\\n <button class=\\\"btn btn-primary pull-right email-button\\\">Email</button>\\r\\n <button class=\\\"btn btn-primary pull-right packing-slip-button\\\">Packing Slip</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i\\r\\n class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Sales item must have a\\r\\n name.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('receivables/quotes/create/view')\r\nvar Template = require('receivables/invoices/create/template')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar Backbone = require('backbone')\r\nvar numbro = require('numbro')\r\nvar moment = require('moment')\r\nvar sweetAlert = require('sweetalert2')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar valid = $('<div class=\"bg-primary-lighter\" style=\"display: block;\"><i class=\"fa fa-check-circle fa-2x fa-inverse\"></i><span class=\"message\">Invoice is valid.</span></div>')\r\nvar invalid = $('<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">Invoice must have a printed name, invoice date, due date, at least one item, and invoice number must not be negative.</span></div>')\r\n\r\nvar InvoiceCreateView = CreateView.extend({\r\n className: 'block create',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'click .post-button': 'post',\r\n 'click .create-invoice': 'save',\r\n 'click .void-button': 'confirmVoid',\r\n 'click .delete-button': 'deleteInvoice',\r\n 'click': 'expand',\r\n 'click .taxRateClose': 'taxRateEmpty'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) {\r\n this.Template = Template\r\n }\r\n this.companyService = new CompanyService()\r\n\r\n this.model.on('change:nextInvoiceNumber', this.render, this)\r\n\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n this.$('.recurring-start-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', moment().format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.recurring-start-date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.isCreate = this.$el.hasClass('create')\r\n if (this.$el.hasClass('create')) {\r\n this.$('.invoiceNumber').remove()\r\n this.checkSubscription()\r\n }\r\n\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n },\r\n\r\n setDates: function () {\r\n var startDate = new Date()\r\n var oneMonth = moment(startDate).add(1, 'M')._d\r\n\r\n this.loadDates(startDate, oneMonth, 'dueDate')\r\n },\r\n\r\n taxRateEmpty: function (e) {\r\n e.preventDefault()\r\n e.stopPropagation()\r\n\r\n this.$('input[name=rateId]').val('')\r\n this.$('input[name=rateId]').attr('data-selection', '')\r\n this.$('input[name=rateId]').attr('data-selection-id', '')\r\n this.$('input[name=taxRate]').val('')\r\n this.recalculateAndSetSalesItem()\r\n },\r\n\r\n isValid: function () {\r\n return !!this.$('input[name=dueDate]').val() && !!this.$('input[name=date]').val() && !!this.$('input[name=printedName]').val() && !!this.getLineItems().length && this.$('input[name=invoiceNumber]').val() > 0\r\n },\r\n\r\n determineStatus: function () {\r\n if (this.isValid()) {\r\n this.$('.status').html(valid)\r\n } else {\r\n this.$('.status').html(invalid)\r\n }\r\n },\r\n\r\n checkSubscription: function () {\r\n var activeCompanyInfo = this.companyService.getActiveCompanyInfo()\r\n var activeSubscription = activeCompanyInfo.activeSubscription\r\n var allowInvoices = activeCompanyInfo.allowInvoices\r\n\r\n return activeSubscription && allowInvoices\r\n },\r\n\r\n subscriptionAlertModal: function () {\r\n sweetAlert({\r\n text: '<b>You have exceeded your plans limits. <br />Would you like to upgrade now?</b>',\r\n type: 'warning',\r\n closeOnConfirm: true,\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Cancel',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes'\r\n }).then(function () {\r\n Backbone.trigger('app:navigate', 'settings/subscription')\r\n }.bind(this))\r\n },\r\n\r\n // This is a method used by the base class when a form is submitted on this view\r\n toJSON: function () {\r\n if (!this.isValid()) {\r\n this.determineStatus()\r\n throw new Error('Not valid')\r\n }\r\n\r\n var invoice = { }\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select, .recurring-meta-container *:input'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n if ($el.hasClass('currency') || $el.hasClass('currency-field')) {\r\n elValue = numbro().unformat(elValue)\r\n }\r\n\r\n invoice[$el.attr('name')] = elValue\r\n })\r\n\r\n invoice['lineItems'] = this.getLineItems()\r\n\r\n if (invoice.taxRateId) {\r\n invoice.salesTax = { salesTaxId: invoice.taxRateId }\r\n }\r\n\r\n invoice.recurringFrequency = Number(invoice.recurringFrequency)\r\n invoice.memorizedEntryId = invoice.memorizationId\r\n\r\n invoice.isVoid = !!invoice.isVoid\r\n invoice.isPosted = !!invoice.isPosted\r\n invoice.notes = this.$('textarea[name=notes]').val()\r\n\r\n return invoice\r\n },\r\n\r\n post: function (e) {\r\n e.preventDefault()\r\n if (!this.checkSubscription() && !!this.isCreate) {\r\n this.subscriptionAlertModal()\r\n } else if (this.isValid()) {\r\n this.$('.post-button').prop('disabled', true)\r\n this.$('input[name=isPosted]').val('true')\r\n this.save(e)\r\n }\r\n },\r\n\r\n getId: function () {\r\n return this.model.id\r\n },\r\n\r\n save: function (e) {\r\n e.preventDefault()\r\n if (!this.checkSubscription() && !!this.isCreate) {\r\n this.subscriptionAlertModal()\r\n } else {\r\n var model = this.toJSON()\r\n var id = this.getId()\r\n\r\n this.$('.post-button').prop('disabled', true)\r\n this.$('.create-invoice').prop('disabled', true)\r\n if (id) { \r\n this.trigger('update', id, model)\r\n } else { \r\n this.trigger('create', model)\r\n }\r\n }\r\n },\r\n\r\n confirmVoid: function (e) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'You will not be able to use this invoice again after voiding it!',\r\n type: 'warning',\r\n closeOnConfirm: true,\r\n closeOnCancel: true,\r\n showCancelButton: true,\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Cancel',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes, void it'\r\n }).then(function () {\r\n this.$('.void-button').prop('disabled', true)\r\n this.trigger('confirmVoid', this.model.id)\r\n }.bind(this))\r\n e.preventDefault()\r\n },\r\n\r\n deleteInvoice: function (e) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: this.model.get('hasQuote') ? 'This will reopen the quote that you used to create this invoice.' : 'You will not be able to recover this invoice!',\r\n type: 'warning',\r\n closeOnConfirm: true,\r\n closeOnCancel: true,\r\n showCancelButton: true,\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Cancel',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: this.model.get('hasQuote') ? 'Yes, reopen it' : 'Yes, delete it'\r\n }).then(function () {\r\n this.$('.delete-button').prop('disabled', true)\r\n this.trigger('confirmDelete', this.model.id)\r\n }.bind(this))\r\n e.preventDefault()\r\n },\r\n\r\n setMemorizedEntryDate: function (entryDate) {\r\n this.$('input[name=memorizedEntryDate]').val(entryDate)\r\n }\r\n})\r\n\r\nmodule.exports = InvoiceCreateView\r\n","'use strict'\r\n\r\nvar Invoice = require('receivables/invoices/item/invoice')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar Invoices = ListWrapper.extend({\r\n childModel: Invoice\r\n})\r\n\r\n\r\nmodule.exports = Invoices\r\n","'use strict'\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\nvar moment = require('moment')\r\n\r\nvar Invoice = ListEntry.extend({}, {\r\n parse: function (json) {\r\n var companyInfo = JSON.parse(localStorage.getItem('crunchedActiveCompanyInfo'))\r\n\r\n return new Invoice({\r\n addressLine1: json.addressLine1,\r\n addressLine2: json.addressLine2,\r\n city: json.city,\r\n postalCode: json.postalCode,\r\n state: json.state,\r\n name: json.name,\r\n printedName: json.printedName,\r\n date: json.date,\r\n shortDate: moment(json.date).format('MM/DD/YYYY'),\r\n dueDate: json.dueDate,\r\n shortDueDate: moment(json.dueDate).format('MM/DD/YYYY'),\r\n id: json.id,\r\n memo: json.memo,\r\n purchaseOrderNumber: json.purchaseOrderNumber,\r\n terms: json.terms,\r\n customer: json.customer,\r\n customerId: json.customerId,\r\n lineItems: json.lineItems,\r\n invoiceNumber: json.invoiceNumber,\r\n salesTax: json.salesTax,\r\n notes: json.notes,\r\n isVoid: json.isVoid,\r\n isPosted: json.isPosted,\r\n hasQuote: json.hasQuote,\r\n totalPrice: json.totalPrice,\r\n hasOpenBalance: json.hasOpenBalance,\r\n canEmail: json.canEmail,\r\n canVoid: json.canVoid,\r\n allowCreditCards: json.allowCreditCards,\r\n paymentsEnabled: companyInfo.paymentsEnabled,\r\n department: json.department\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = Invoice\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <a class=\\\"fa fa-ban pull-right void\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n <a class=\\\"fa fa-usd pull-right open-payments\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"itemNumber\\\">\"\n + alias4(((helper = (helper = helpers.invoiceNumber || (depth0 != null ? depth0.invoiceNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"invoiceNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"customer\\\">\"\n + alias4(((helper = (helper = helpers.printedName || (depth0 != null ? depth0.printedName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"printedName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"startDate\\\">\"\n + alias4(((helper = (helper = helpers.shortDate || (depth0 != null ? depth0.shortDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"dueDate\\\">\"\n + alias4(((helper = (helper = helpers.shortDueDate || (depth0 != null ? depth0.shortDueDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortDueDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"memo\\\">\"\n + alias4(((helper = (helper = helpers.memo || (depth0 != null ? depth0.memo : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"memo\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"total-amount currency\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.totalPrice : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n <a class=\\\"fa fa-trash-o pull-right remove\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isVoid : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('receivables/invoices/item/template')\r\nvar _ = require('lodash')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar InvoiceView = ItemView.extend({\r\n events: _.extend(_.clone(ItemView.prototype.events), {\r\n 'click .open-payments': 'openPayments'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n if (this.model.get('isVoid')) {\r\n this.$el.addClass('notActive')\r\n }\r\n },\r\n\r\n voidItem: function (e) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n if (this.model.get('canVoid')) {\r\n this.trigger('void', this.model.id)\r\n } else {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'You can not void this invoice as it has a deposit associated with its payments.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6'\r\n })\r\n }\r\n },\r\n\r\n openPayments: function (e) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n this.trigger('openPayments', this.model.id)\r\n }\r\n})\r\n\r\nmodule.exports = InvoiceView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \" <b class=\\\"pull-right\\\" id=\\\"availableBalance\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"left\\\" data-original-title=\\\"Total pending invoice amount\\\">\\r\\n <i class=\\\"fa fa-question-circle\\\" aria-hidden=\\\"true\\\"></i> Pending Invoice Balance: \"\n + container.escapeExpression((helpers.numbro || (depth0 && depth0.numbro) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.pendingBalance : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"\\r\\n </b>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \"invoicesListContainer\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \" <div class =\\\"flex\\\">\\r\\n\\r\\n <div class=\\\"form-group filter\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <select class=\\\"form-control filter-selection\\\" name=\\\"filterSelection\\\" id=\\\"filterSelection\\\">\\r\\n <option value=\\\"0\\\">All</option>\\r\\n <option value=\\\"1\\\">Open</option>\\r\\n <option value=\\\"2\\\">Paid</option>\\r\\n <option value=\\\"3\\\">Void</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"filterSelection\\\">Filter</label>\\r\\n </div>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"form-group filter filterCustomer\\\">\\r\\n <div class=\\\"form-material floating filterCustomerMaterial open\\\">\\r\\n <select class=\\\"form-control selectpicker filter-selection-customer\\\" name=\\\"filterCustomerSelection\\\" id=\\\"filterCustomerSelection\\\" data-live-search=\\\"true\\\" size=\\\"1\\\">\\r\\n <option value=\\\"all\\\" selected>All</option>\\r\\n </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"filterCustomerSelection\\\">Customer</label>\\r\\n </div>\\r\\n </div>\\r\\n \\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\"></h3>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isPending : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n<div class=\\\"block-content \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isPending : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\\">\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isPending : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"itemNumber\\\">Invoice Number</div>\\r\\n <div class=\\\"customer\\\">Customer Name</div>\\r\\n <div class=\\\"startDate\\\">Dated</div>\\r\\n <div class=\\\"dueDate\\\">Due Date</div>\\r\\n <div class=\\\"memo\\\">Memo</div>\\r\\n <div class=\\\"total-amount currency\\\">Invoice Total</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\"><p class=\\\"center\\\">Loading more invoices...</p></div>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('receivables/invoices/list/template')\r\nvar InvoiceView = require('receivables/invoices/item/view')\r\nvar DetailsView = require('receivables/invoices/read/view')\r\nvar PaymentsView = require('receivables/invoices/read-payments/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\nvar InvoiceListVist = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort',\r\n 'change select[name=filterSelection]': 'changeFilter',\r\n 'change select[name=filterCustomerSelection]': 'changeCustomerSelection',\r\n 'change input[aria-label=Search]': 'customerListlabelOpen'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = InvoiceView\r\n this.model.set('filter', 1)\r\n this.isSelectedCustomerAll = true\r\n\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.model.on('change:pendingBalance change:customerList', this.render.bind(this))\r\n\r\n this.on('showDetails', this.showDetails.bind(this))\r\n this.on('void', this.showVoid.bind(this))\r\n this.on('delete', this.showDelete.bind(this))\r\n this.on('showPayments', this.showPayments.bind(this))\r\n },\r\n\r\n render: function () {\r\n\r\n this.$el.html(this.Template(this.model.toViewModel()))\r\n this.$infinity = this.$('.infinity').listView()\r\n\r\n this.model.get('items').each(function (child) {\r\n this.addChild(child, this.model.get('items'))\r\n }.bind(this))\r\n\r\n if (this.model.get('isPending') && !this.$el.hasClass('pending-invoices')) {\r\n this.$el.addClass('pending-invoices')\r\n }\r\n\r\n if (this.model.get('filter')) {\r\n this.$('select[name=filterSelection]').val(this.model.get('filter'))\r\n }\r\n \r\n this.populateCustomerList()\r\n\r\n if (!!this.selectedCustomerId && this.selectedCustomerId !== undefined) {\r\n this.$('#filterCustomerSelection').val(this.selectedCustomerId)\r\n }\r\n\r\n this.$('.selectpicker').selectpicker({\r\n size: 4,\r\n dropupAuto: false,\r\n noneSelectedText: '',\r\n liveSearchPlaceholder: \"Search\",\r\n width: 'auto'\r\n })\r\n \r\n return this\r\n },\r\n\r\n changeCustomerSelection: function (event) {\r\n if (!!event) {\r\n event.preventDefault()\r\n }\r\n this.selectedCustomerId = this.$('#filterCustomerSelection').val()\r\n this.isSelectedCustomerAll = this.selectedCustomerId === 'all' ? true : false\r\n this.render()\r\n },\r\n\r\n addChild: function (child, collection) {\r\n if (!this.$infinity) {\r\n return\r\n }\r\n\r\n /* eslint-disable new-cap */\r\n var childView = new this.childView({model: child, collection: collection})\r\n /* eslint-enable new-cap */\r\n\r\n // Forward events from children onto the container\r\n childView.on('all', function (triggerName) {\r\n console.log('ListContainer forwarding from child', triggerName)\r\n this.trigger.apply(this, arguments)\r\n }.bind(this))\r\n\r\n if ((!!this.selectedCustomerId && this.selectedCustomerId === child.get('customerId')) || (!!this.isSelectedCustomerAll && this.isSelectedCustomerAll)) {\r\n this.$infinity.append(childView.render().$el)\r\n }\r\n childView.delegateEvents()\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more invoices...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more invoices.')\r\n },\r\n\r\n showDetails: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n var details = new DetailsView({model: model})\r\n\r\n // View to show beneath $lineItem, and if the 'active' class should be added to $lineItem's classes\r\n this.showChildView(details, $lineItem, true)\r\n },\r\n\r\n showPayments: function (payments, invoiceId) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + invoiceId + '\"]')\r\n var details = new PaymentsView({model: payments})\r\n\r\n // View to show beneath $lineItem, and if the 'active' class should be added to $lineItem's classes\r\n this.showChildView(details, $lineItem, true)\r\n },\r\n\r\n showVoid: function (invoiceId) {\r\n this.showConfirmationMessage(\r\n this.$('.itemrow[data-id=\"' + invoiceId + '\"]'),\r\n 'Are you sure you want to void this invoice?',\r\n 'confirmVoid',\r\n invoiceId\r\n )\r\n },\r\n\r\n showDelete: function (invoiceId) {\r\n this.showConfirmationMessage(\r\n this.$('.itemrow[data-id=\"' + invoiceId + '\"]'),\r\n this.model.get('items').get(invoiceId).get('hasQuote') ? 'Are you sure you want to delete this invoice and reopen the original quote?' : 'Are you sure you want to delete this invoice?',\r\n 'confirmDelete',\r\n invoiceId\r\n )\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n },\r\n\r\n changeFilter: function (e) {\r\n var selectedFilter = $(e.currentTarget).val()\r\n\r\n this.model.set({\r\n filter: selectedFilter\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n },\r\n\r\n populateCustomerList: function () {\r\n if (!!this.model.get('customerList') && this.model.get('customerList').length) {\r\n this.filteredCustomerList = _.uniqBy(this.model.get('customerList'), function (customer) {\r\n return customer.id\r\n }.bind(this))\r\n }\r\n \r\n this.filteredCustomerListSorted = _.sortBy(this.filteredCustomerList, ['printedName'])\r\n\r\n _.each(this.filteredCustomerListSorted, function (value, key) {\r\n this.$('#filterCustomerSelection').append($('<option value=\"' + value.id + '\">' + value.printedName + '</option>'))\r\n }.bind(this))\r\n },\r\n\r\n customerListlabelOpen: function () {\r\n this.$('.filterCustomerMaterial').addClass('open')\r\n }\r\n\r\n})\r\n\r\nmodule.exports = InvoiceListVist\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isVoid : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\\">\\r\\n <div class=\\\"reference\\\">\"\n + alias4(((helper = (helper = helpers.reference || (depth0 != null ? depth0.reference : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reference\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"paymentDate date\\\">\"\n + alias4(((helper = (helper = helpers.shortPaymentDate || (depth0 != null ? depth0.shortPaymentDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortPaymentDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"invoiceAmount currency\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.invoiceAmount : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"openBalance currency\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.openBalance : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"appliedAmount currency\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.amount : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"afterPayment currency\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.afterPayment : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"notActive\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"reference\\\">Reference</div>\\r\\n <div class=\\\"paymentDate date\\\">Payment Date</div>\\r\\n <div class=\\\"invoiceAmount currency\\\">Invoice Amount</div>\\r\\n <div class=\\\"openBalance currency\\\">Open Balance</div>\\r\\n <div class=\\\"appliedAmount currency\\\">Applied Amount</div>\\r\\n <div class=\\\"afterPayment currency\\\">Remaining</div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.payments : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var Backbone = require('backbone')\r\nvar Template = require('receivables/invoices/read-payments/template')\r\n\r\nvar ReadPaymentsView = Backbone.View.extend({\r\n className: 'block read read-payments expanded',\r\n\r\n render: function () {\r\n this.$el.html(Template(this.model))\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = ReadPaymentsView\r\n","var UpdateView = require('receivables/invoices/update/view')\r\n\r\nvar InvoiceReadView = UpdateView.extend({\r\n className: 'block read expanded',\r\n\r\n onRender: function () {\r\n UpdateView.prototype.onRender.apply(this, arguments)\r\n this.$('input,select,textarea').attr('disabled', true)\r\n this.$('.input-group-addon .fa-calendar').css({display: 'none'})\r\n this.$('.date input:disabled').closest('.date').addClass('readonly').attr('readonly', 'readonly')\r\n },\r\n\r\n toJSON: function () {\r\n throw new Error(\"Read views can't create JSON objects.\")\r\n }\r\n})\r\n\r\nmodule.exports = InvoiceReadView\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar InvoiceService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nInvoiceService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nInvoiceService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'invoices'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nInvoiceService.prototype.getAll = function (page, pageSize, pending, sort, sortField, filter) {\r\n var apiPath = this.GetPath() + this.GetQuery({page: page, pageSize: pageSize, pending: pending, sort: sort, sortField: sortField, status: filter})\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nInvoiceService.prototype.generateInvoice = function (quoteId) {\r\n var apiPath = this.GetPath('generate-invoice', quoteId)\r\n return this.restClient.post(apiPath)\r\n}\r\n\r\nInvoiceService.prototype.printInvoice = function (invoiceId) {\r\n var apiPath = this.GetPath(invoiceId, 'export')\r\n return this.restClient.download(apiPath)\r\n}\r\n\r\nInvoiceService.prototype.emailInvoice = function (invoiceId) {\r\n var apiPath = this.GetPath(invoiceId, 'email')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nInvoiceService.prototype.printPackingSlip = function (invoiceId) {\r\n var apiPath = this.GetPath(invoiceId, 'packing-slip-export')\r\n return this.restClient.download(apiPath)\r\n}\r\n\r\nInvoiceService.prototype.setVoid = function (invoiceId) {\r\n var apiPath = this.GetPath(invoiceId, 'void')\r\n return this.restClient.put(apiPath)\r\n}\r\n\r\nInvoiceService.prototype.getPendingBalance = function () {\r\n var apiPath = this.GetPath('pending-balance')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nInvoiceService.prototype.getAccountsReceivableBalance = function () {\r\n var apiPath = this.GetPath('balance')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nInvoiceService.prototype.getOpenInvoices = function () {\r\n var apiPath = this.GetPath('open-invoices')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nInvoiceService.prototype.getPayments = function (invoiceId) {\r\n var apiPath = this.GetPath(invoiceId, 'payments')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nInvoiceService.prototype.getNextInvoiceNumber = function () {\r\n var apiPath = this.GetPath('next-invoice-number')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nmodule.exports = InvoiceService\r\n","var CreateView = require('receivables/invoices/create/view')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar numbro = require('numbro')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar InvoiceUpdateView = CreateView.extend({\r\n className: 'block update expanded',\r\n\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'click .print-button': 'printInvoice',\r\n 'click .packing-slip-button': 'printPackingSlip',\r\n 'click .email-button': 'emailInvoice',\r\n 'click .apply-payment': 'applyPayment'\r\n }),\r\n\r\n onRender: function () {\r\n var model = this.model.toViewModel()\r\n\r\n if (model.customer) {\r\n model.customerIdSearch = model.customer.customerId\r\n model.customerNameSearch = model.customer.name\r\n }\r\n\r\n if (model.department) {\r\n model.departmentName = model.department.name\r\n model.departmentId = model.department.id\r\n }\r\n \r\n var departmentList = this.model.get('departmentList')\r\n\r\n this.autoComplete(\r\n departmentList,\r\n 'name',\r\n this.$('input[name=departmentName]'),\r\n this.departmentSelected.bind(this),\r\n 'CREATENEW'\r\n )\r\n\r\n // You can not update a customer once the invoice has been created\r\n this.$('input[name=customerIdSearch], input[name=customerNameSearch]').attr('disabled', true)\r\n this.$('.email-button').attr('disabled', !model.canEmail)\r\n\r\n var selector = ':not([name=notes]):not(.cancel):not(.void-button):not(.create-invoice):not(.post-button):not(.print-button):not(.packing-slip-button):not(.email-button)'\r\n if (!model.isPosted) {\r\n // Pending invoice\r\n this.$el.addClass('pending-invoice')\r\n\r\n if (model.hasQuote) {\r\n // Is from a quote\r\n this.$('.delete-button').text('Reopen Quote').attr('disabled', false)\r\n }\r\n }\r\n\r\n if (model.isPosted || model.hasQuote) {\r\n if (model.isPosted) {\r\n // Posted invoice\r\n selector = selector + ':not(.apply-payment)'\r\n } else if (model.hasQuote) {\r\n // Pending invoice with a quote\r\n selector = selector + ':not(.delete-button):not([name=invoiceNumber])'\r\n }\r\n this.$('input,textarea,button,select').filter(selector).attr('disabled', true)\r\n }\r\n\r\n if (!model.hasOpenBalance) {\r\n this.$('.apply-payment').attr('disabled', true)\r\n }\r\n\r\n if (model.salesTax) {\r\n model.rateId = model.salesTax.salesTax.rateId\r\n model.taxRate = model.salesTax.salesTax.taxRate\r\n model.taxRateId = model.salesTax.salesTaxId\r\n }\r\n\r\n _.each(this.$('input:not([type=file]), textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var isDate = $el.closest('.form-material').hasClass('date')\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else if (isDate) {\r\n $el.val(moment(model[$el.attr('name')]).format('MM/DD/YYYY')).closest('.floating').addClass('open')\r\n } else if (model[$el.attr('name')]) {\r\n $el.val(model[$el.attr('name')]).closest('.floating').addClass('open')\r\n }\r\n }.bind(this))\r\n\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n\r\n // Remove empty customer line from the create side\r\n this.$('.create-customer-method').remove()\r\n\r\n this.$('.line-item-container').html('')\r\n // Add customer lines with our data\r\n _.forEach(model['lineItems'], function (lineItem) {\r\n var $saleEntry = this.addSalesEntry(lineItem.id)\r\n $saleEntry.find('input[name=id]').val(lineItem.salesEntryId).parent().addClass('open')\r\n $saleEntry.find('input[name=price]').val(numbro(lineItem.price).formatCurrency('$0,0.00')).parent().addClass('open')\r\n $saleEntry.find('input[name=discount]').val(numbro(lineItem.discount).formatCurrency('$0,0.00')).parent().addClass('open')\r\n $saleEntry.find('input[name=quantity]').val(lineItem.quantity).parent().addClass('open')\r\n $saleEntry.find('input[name=saleEntryId]').val(lineItem.salesEntry.saleEntryId).parent().addClass('open')\r\n $saleEntry.find('input[name=name]').val(lineItem.salesEntry.name).parent().addClass('open')\r\n $saleEntry.recalculateAndSetSalesItem()\r\n }.bind(this))\r\n },\r\n\r\n setDates: function () {\r\n var startDate = new Date(this.model.get('date'))\r\n var endDate = new Date(this.model.get('dueDate'))\r\n var startDateUTC = new Date(startDate.getTime() + startDate.getTimezoneOffset() * 60000)\r\n var endDateUTC = new Date(endDate.getTime() + endDate.getTimezoneOffset() * 60000)\r\n\r\n this.loadDates(startDateUTC, endDateUTC, 'dueDate')\r\n },\r\n addSalesEntry: function () {\r\n var $salesEntry = CreateView.prototype.addSalesEntry.apply(this, arguments)\r\n if (this.model.get('isPosted') || this.model.get('hasQuote')) {\r\n $salesEntry.find('input, button, select, textarea').attr('disabled', true)\r\n }\r\n return $salesEntry\r\n },\r\n printInvoice: function (e) {\r\n e.preventDefault()\r\n\r\n sweetAlert({\r\n title: 'Save Invoice',\r\n text: 'Would you like to save your invoice before printing?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Save and Print',\r\n cancelButtonColor: '#425565',\r\n cancelButtonText: 'Print'\r\n }).then(function (saveAndPrint) {\r\n this.trigger('saveAndPrint', this.model.id, this.toJSON())\r\n }.bind(this), function () {\r\n this.trigger('printInvoice', this.model.id)\r\n }.bind(this))\r\n },\r\n printPackingSlip: function (e) {\r\n e.preventDefault()\r\n\r\n sweetAlert({\r\n title: 'Save Invoice',\r\n text: 'Would you like to save your invoice before printing the packing slip?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Save and Print',\r\n cancelButtonColor: '#425565',\r\n cancelButtonText: 'Print'\r\n }).then(function (saveAndPrintPackingSlip) {\r\n this.trigger('saveAndPrintPackingSlip', this.model.id, this.toJSON())\r\n }.bind(this), function () {\r\n this.trigger('printPackingSlip', this.model.id)\r\n }.bind(this))\r\n },\r\n emailInvoice: function (e) {\r\n e.preventDefault()\r\n\r\n sweetAlert({\r\n title: 'Email Invoice',\r\n text: 'Would you like to save your invoice before emailing?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Save and Email',\r\n cancelButtonColor: '#425565',\r\n cancelButtonText: 'Email'\r\n }).then(function (saveAndEmail) {\r\n this.trigger('saveAndEmail', this.model.id, this.toJSON())\r\n }.bind(this), function () {\r\n this.trigger('emailInvoice', this.model.id)\r\n }.bind(this))\r\n },\r\n applyPayment: function (e) {\r\n e.preventDefault()\r\n this.trigger('showApplyPayment')\r\n }\r\n})\r\n\r\nmodule.exports = InvoiceUpdateView\r\n","var ListContainer = require('lists/list/view')\r\nvar ListView = require('receivables/invoices/list/view')\r\nvar CreateView = require('receivables/invoices/create/view')\r\nvar UpdateView = require('receivables/invoices/update/view')\r\nvar ApplyPaymentView = require('receivables/invoices/apply-payment/view')\r\nvar ScrollTo = require('jquery-scrollto')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\n\r\nvar InvoiceView = ListContainer.extend({\r\n className: 'invoices receivables list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n this.listView = new ListView({model: this.model})\r\n this.forwardEvents(this.listView)\r\n\r\n this.createView = new CreateView({model: this.model})\r\n this.forwardEvents(this.createView)\r\n\r\n this.on('created', function () {\r\n this.createView.trigger('resetInputs')\r\n }.bind(this))\r\n\r\n this.on('reset', function () {\r\n this.$('.hidden').removeClass('hidden')\r\n this.$('.expanded').removeClass('expanded')\r\n this.render()\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n this.showEdit(model)\r\n }.bind(this))\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('dataLoaded', function () {\r\n this.listView.trigger('bindScroll')\r\n this.createView.onRender()\r\n this.createView.trigger('bindAutocomplete')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n\r\n this.on('forwardSalesEntryError', function () {\r\n _.partial(this.createView.trigger, 'salesEntryError').apply(this.createView, arguments)\r\n if (this.updateView) {\r\n _.partial(this.updateView.trigger, 'salesEntryError').apply(this.updateView, arguments)\r\n }\r\n }.bind(this))\r\n\r\n this.on('forwardSalesEntryCreated', function () {\r\n _.partial(this.createView.trigger, 'salesEntryCreated').apply(this.createView, arguments)\r\n if (this.updateView) {\r\n _.partial(this.updateView.trigger, 'salesEntryCreated').apply(this.updateView, arguments)\r\n }\r\n }.bind(this))\r\n\r\n this.on('paymentListing', function (payments, invoidId) {\r\n this.listView.trigger('showPayments', payments, invoidId)\r\n }.bind(this))\r\n },\r\n\r\n showEdit: function (model) {\r\n if (this.listView) {\r\n this.listView.collapse()\r\n }\r\n\r\n if (this.pendingListView) {\r\n this.pendingListView.collapse()\r\n }\r\n\r\n this.updateView = new UpdateView({model: model})\r\n\r\n // Forwarding events\r\n var events = ['update', 'confirmDelete', 'confirmDisable', 'confirmVoid', 'createSalesEntry', 'printInvoice', 'saveAndPrint', 'printPackingSlip', 'saveAndPrintPackingSlip', 'emailInvoice', 'saveAndEmail']\r\n _.each(events, function (eventName) {\r\n this.updateView.on(eventName, function () {\r\n _.partial(this.trigger, eventName).apply(this, arguments)\r\n }, this)\r\n }.bind(this))\r\n\r\n // We should already have all of the lists, so autocomplete should work\r\n this.updateView.trigger('bindAutocomplete')\r\n\r\n // If any of these are done, return back to the list view\r\n this.updateView.on('cancelled collapsed confirmDisable confirmDelete create update', function () {\r\n this.$('.hidden').removeClass('hidden')\r\n this.$('.expanded').removeClass('expanded')\r\n this.updateView.remove()\r\n }.bind(this))\r\n\r\n // Hide the list views and show the update view\r\n this.$('> *').addClass('hidden')\r\n this.$el.append(this.updateView.render().$el)\r\n this.updateView.$el.ScrollTo()\r\n\r\n // Bind any special events\r\n if (this.showApplyPayment) {\r\n this.updateView.on('showApplyPayment', _.partial(this.showApplyPayment, model).bind(this))\r\n }\r\n },\r\n\r\n getListView: function () {\r\n return this.listView\r\n },\r\n\r\n setPendingListView: function (pendingListView) {\r\n this.pendingListView = pendingListView\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n\r\n if (!this.model.get('isPending')) {\r\n this.$el.append(this.createView.render().$el)\r\n if (this.pendingListView) {\r\n this.$el.append(this.pendingListView.render().$el)\r\n this.pendingListView.delegateEvents()\r\n }\r\n this.$el.append(this.listView.render().$el)\r\n\r\n this.listView.delegateEvents()\r\n this.createView.delegateEvents()\r\n }\r\n\r\n return this\r\n },\r\n\r\n showApplyPayment: function (invoiceModel) {\r\n this.applyPaymentView = new ApplyPaymentView({\r\n model: invoiceModel\r\n })\r\n this.$el.append(this.applyPaymentView.render().$el)\r\n\r\n var closeModal = function () {\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n this.applyPaymentView.$el.remove()\r\n }.bind(this)\r\n\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').on('click', closeModal)\r\n this.applyPaymentView.$el.ScrollTo()\r\n this.applyPaymentView.on('cancelled collapsed', closeModal)\r\n this.applyPaymentView.on('create', function (model) {\r\n this.trigger('applyPayment', model)\r\n closeModal()\r\n }.bind(this))\r\n },\r\n\r\n getCreateView: function () {\r\n return this.createView\r\n },\r\n\r\n showError: function (errorMessage) {\r\n this.createView.showError(errorMessage)\r\n },\r\n\r\n memBtnEnable: function () {\r\n this.$('.memorize-button').prop('disabled', false)\r\n }\r\n})\r\n\r\nmodule.exports = InvoiceView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar GenericListWidget = require('receivables/quotes/widget')\r\n\r\nvar Backbone = require('backbone')\r\nvar Invoices = require('receivables/invoices/invoices')\r\nvar Service = require('receivables/invoices/service')\r\nvar PaymentService = require('receivables/payments/service')\r\nvar MemorizationService = require('memorization/invoices/service')\r\nvar DepartmentService = require('lists/departments/service')\r\nvar ListContainer = require('receivables/invoices/view')\r\n\r\nvar InvoiceWidget = function (isPending, postedInvoiceId, paymentsEnabled) {\r\n this.memorizationService = new MemorizationService()\r\n this.paymentService = new PaymentService()\r\n this.departmentService = new DepartmentService();\r\n\r\n GenericListWidget.apply(this)\r\n\r\n this.model.set('isPending', isPending)\r\n this.model.set('paymentsEnabled', paymentsEnabled)\r\n\r\n if (!isPending) {\r\n this.pendingWidget = new InvoiceWidget(true)\r\n this.model.on('reset', function () {\r\n if (this.resetting) { return }\r\n this.resetting = true\r\n this.pendingWidget.reset()\r\n this.resetting = false\r\n }.bind(this))\r\n this.pendingWidget.on('reset', function () {\r\n if (this.resetting) {\r\n return\r\n }\r\n\r\n this.resetting = true\r\n this.reset()\r\n this.resetting = false\r\n }.bind(this))\r\n\r\n this.pendingWidget.on('editDetails', function (invoice) {\r\n invoice.set('departmentList', this.view.model.get('departmentList'))\r\n\r\n this.view.trigger('editDetails', invoice)\r\n }.bind(this))\r\n\r\n var pendingListView = this.pendingWidget.getListView()\r\n this.view.setPendingListView(pendingListView)\r\n } else {\r\n this.loadPendingBalance()\r\n this.on('reset', this.loadPendingBalance, this)\r\n this.view.off('created editDetails')\r\n }\r\n\r\n this.view.on('printInvoice', function (invoiceId) {\r\n this.printInvoice(invoiceId)\r\n }.bind(this))\r\n\r\n this.view.on('emailInvoice', function (invoiceId) {\r\n this.emailInvoice(invoiceId)\r\n }.bind(this))\r\n\r\n this.view.on('printPackingSlip', function (invoiceId) {\r\n this.printPackingSlip(invoiceId)\r\n }.bind(this))\r\n\r\n this.view.on('decline', function (modelId) {\r\n this.decline(modelId).then(function () {\r\n Backbone.trigger('app:navigate', 'receivables/invoices')\r\n })\r\n }.bind(this))\r\n\r\n this.view.on('applyPayment', function (payment) {\r\n this.paymentService.create(payment).then(function () {\r\n this.reset()\r\n }.bind(this))\r\n }.bind(this))\r\n\r\n this.view.on('openPayments', this.getPayments.bind(this))\r\n this.view.on('saveAndPrint', this.saveAndPrint.bind(this))\r\n this.view.on('saveAndPrintPackingSlip', this.saveAndPrintPackingSlip.bind(this))\r\n this.view.on('saveAndEmail', this.saveAndEmail.bind(this))\r\n\r\n this.view.on('onAfterCreate', this.getDepartmentList.bind(this))\r\n this.view.on('onAfterUpdate', this.getDepartmentList.bind(this))\r\n\r\n if (postedInvoiceId) {\r\n this.trigger('edit', postedInvoiceId)\r\n }\r\n}\r\n\r\nInvoiceWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nInvoiceWidget.prototype.getDepartmentList = function () {\r\n this.departmentService.getList().then(function (departmentList) {\r\n this.model.set('departmentList', departmentList)\r\n }.bind(this))\r\n}\r\n\r\nInvoiceWidget.prototype.loadPendingBalance = function () {\r\n return this.service.getPendingBalance().then(function (result) {\r\n this.model.set('pendingBalance', result.balance)\r\n }.bind(this))\r\n}\r\n\r\nInvoiceWidget.prototype.initialize = function () {\r\n GenericListWidget.prototype.initialize.apply(this, arguments)\r\n this.service = new Service()\r\n this.modelType = Invoices\r\n this.viewType = ListContainer\r\n}\r\n\r\nInvoiceWidget.prototype.getListView = function () {\r\n return this.view.getListView()\r\n}\r\n\r\nInvoiceWidget.prototype.loadPage = function () {\r\n if (this.loadingMore) return\r\n this.loadingMore = true\r\n var currentPage = this.model.get('page')\r\n this.view.trigger('loadingPage', currentPage)\r\n this.model.trigger('loadingPage', currentPage)\r\n\r\n this.service.getNextInvoiceNumber().then(function (result) {\r\n this.model.set(\"nextInvoiceNumber\", result);\r\n }.bind(this));\r\n\r\n return this.service.getAll(currentPage, 100, this.model.get('isPending'), this.model.get('sort'), this.model.get('sortField'), this.model.get('filter')).then(function (result) {\r\n this.loadingMore = false\r\n if (result.collection.length) {\r\n this.model.set('page', currentPage + 1)\r\n } else {\r\n this.view.trigger('EOF')\r\n }\r\n this.model.set('sortField', result.sortField)\r\n this.model.set('sort', result.sort)\r\n this.model.add(_.map(result.collection, this.childModel.bind(this)))\r\n this.view.trigger('loadedPage', result.collection.length)\r\n this.model.trigger('loadedPage', result.collection.length)\r\n }.bind(this))\r\n}\r\n\r\nInvoiceWidget.prototype.resolveReferences = function (invoice) {\r\n var lineItems = invoice.get('lineItems')\r\n var salesTax = invoice.get('salesTax')\r\n var companyInfo = JSON.parse(localStorage.getItem('crunchedActiveCompanyInfo'))\r\n\r\n invoice.set('vendorList', this.model.get('vendorList'))\r\n invoice.set('accountList', this.model.get('accountList'))\r\n\r\n invoice.set('salesEntryList', this.model.get('salesEntryList'))\r\n invoice.set('customerList', this.model.get('customerList'))\r\n invoice.set('salesTaxRates', this.model.get('salesTaxRates'))\r\n invoice.set('paymentsEnabled', companyInfo.paymentsEnabled)\r\n\r\n invoice.set('departmentList', this.model.get('departmentList'))\r\n\r\n this.model.set('paymentsEnabled', companyInfo.paymentsEnabled)\r\n\r\n if (salesTax) {\r\n salesTax.salesTax = this.model.get('salesTaxLookup')[salesTax.salesTaxId]\r\n }\r\n\r\n if (lineItems && lineItems.length) {\r\n _.each(lineItems, function (lineItem) {\r\n lineItem.salesEntry = this.model.get('salesEntryLookup')[lineItem.salesEntryId]\r\n return lineItem\r\n }.bind(this))\r\n }\r\n\r\n return invoice\r\n}\r\n\r\nInvoiceWidget.prototype.get = function (modelId) {\r\n return this.service.get(modelId).then(function (item) {\r\n return this.readyPromise.then(function () {\r\n return this.childModel(item)\r\n }.bind(this))\r\n }.bind(this)).then(this.resolveReferences.bind(this)).then(function (invoice) {\r\n this.view.trigger('details', invoice)\r\n }.bind(this))\r\n}\r\n\r\nInvoiceWidget.prototype.getPayments = function (modelId) {\r\n return this.service.getPayments(modelId).then(function (results) {\r\n var payments = {\r\n invoiceAmount: this.model.get('items').get(modelId).get('totalPrice'),\r\n payments: results\r\n }\r\n\r\n _.reduce(payments.payments, function (memo, payment) {\r\n payment.openBalance = memo\r\n payment.afterPayment = !payment.isVoid ? Math.max(memo - payment.amount, 0) : memo\r\n payment.invoiceAmount = payments.invoiceAmount\r\n payment.shortPaymentDate = moment(payment.paymentDate).format('MM/DD/YYYY')\r\n return payment.afterPayment\r\n }, payments.invoiceAmount)\r\n\r\n this.view.trigger('paymentListing', payments, modelId)\r\n }.bind(this))\r\n}\r\n\r\nInvoiceWidget.prototype.edit = function (modelId) {\r\n return this.service.get(modelId).then(function (item) {\r\n return this.readyPromise.then(function () {\r\n return this.childModel(item)\r\n }.bind(this))\r\n }.bind(this)).then(this.resolveReferences.bind(this)).then(function (invoice) {\r\n this.view.trigger('editDetails', invoice)\r\n this.trigger('editDetails', invoice)\r\n }.bind(this))\r\n}\r\n\r\nInvoiceWidget.prototype.editMemorization = function (modelId) {\r\n return this.memorizationService.get(modelId).then(function (item) {\r\n return this.readyPromise.then(function () {\r\n return this.childModel(item)\r\n }.bind(this))\r\n }.bind(this)).then(this.resolveReferences.bind(this)).then(function (invoice) {\r\n this.view.trigger('editDetails', invoice)\r\n this.trigger('editDetails', invoice)\r\n }.bind(this))\r\n}\r\n\r\nInvoiceWidget.prototype.printInvoice = function (invoiceId) {\r\n this.service.printInvoice(invoiceId)\r\n}\r\n\r\nInvoiceWidget.prototype.saveAndPrint = function (invoiceId, model) {\r\n this.update(invoiceId, model, false).then(function () {\r\n this.printInvoice(invoiceId)\r\n }.bind(this))\r\n}\r\n\r\nInvoiceWidget.prototype.printPackingSlip = function (invoiceId) {\r\n this.service.printPackingSlip(invoiceId)\r\n}\r\n\r\nInvoiceWidget.prototype.saveAndPrintPackingSlip = function (invoiceId, model) {\r\n this.update(invoiceId, model, false).then(function () {\r\n this.printPackingSlip(invoiceId)\r\n }.bind(this))\r\n}\r\n\r\nInvoiceWidget.prototype.emailInvoice = function (invoiceId) {\r\n this.service.emailInvoice(invoiceId)\r\n}\r\n\r\nInvoiceWidget.prototype.saveAndEmail = function (invoiceId, model) {\r\n this.update(invoiceId, model, false).then(function () {\r\n this.emailInvoice(invoiceId)\r\n }.bind(this))\r\n}\r\n\r\nInvoiceWidget.prototype.load = GenericListWidget.prototype.load\r\nInvoiceWidget.prototype.bindEvents = GenericListWidget.prototype.bindEvents\r\n\r\nInvoiceWidget.prototype.getCreateView = function () {\r\n return this.view.getCreateView()\r\n}\r\n\r\nInvoiceWidget.prototype.getListView = function () {\r\n return this.view.getListView()\r\n}\r\n\r\nmodule.exports = InvoiceWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"invoice-payment\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"invoiceId\\\" class=\\\"id\\\" />\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Invoice #\",\"inputName\":\"invoiceNumber\",\"inputId\":\"invoiceNumber\",\"wrapperClasses\":\"autocomplete id-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputLabel\":\"Invoice Date\",\"inputName\":\"invoiceDate\",\"inputId\":\"invoiceDate\",\"wrapperClasses\":\"invoice-date date\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputLabel\":\"Due Date\",\"inputName\":\"dueDate\",\"inputId\":\"dueDate\",\"wrapperClasses\":\"due-date date\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputClasses\":\"currency-field\",\"inputLabel\":\"Invoice Amount\",\"inputName\":\"invoiceAmount\",\"inputId\":\"invoiceAmount\",\"wrapperClasses\":\"invoice-amount\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputClasses\":\"currency-field\",\"inputLabel\":\"Open Balance\",\"inputName\":\"openBalance\",\"inputId\":\"openBalance\",\"wrapperClasses\":\"open-balance\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"currency-field\",\"inputLabel\":\"Apply Payment\",\"inputName\":\"amount\",\"inputId\":\"applied-amount\",\"wrapperClasses\":\"applied-balance\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <i class=\\\"fa fa-close remove\\\"></i>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3 class=\\\"title\\\"></h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side display-container\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Customer Id\",\"inputName\":\"customerIdSearch\",\"inputId\":\"customerIdSearch\",\"wrapperClasses\":\"customer-id\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Customer Name\",\"inputName\":\"customerNameSearch\",\"inputId\":\"customerNameSearch\",\"wrapperClasses\":\"customer-name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"customerId\\\">\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side memo-info\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating paymentType\\\">\\r\\n <select class=\\\"form-control source\\\" id=\\\"source\\\" name=\\\"source\\\" size=\\\"1\\\">\\r\\n <option value=\\\"1\\\">Cash</option>\\r\\n <option value=\\\"2\\\">Check</option>\\r\\n <option value=\\\"3\\\">Credit Card</option>\\r\\n <option value=\\\"4\\\">EFT</option>\\r\\n </select>\\r\\n <label for=\\\"source\\\">Payment Type</label>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Payment Date\",\"inputName\":\"paymentDate\",\"inputId\":\"paymentDate\",\"wrapperClasses\":\"payment-date date\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Amount\",\"inputClasses\":\"currency currency-field\",\"inputName\":\"amount\",\"inputId\":\"amount\",\"wrapperClasses\":\"amount\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Reference\",\"inputName\":\"reference\",\"inputId\":\"reference\",\"wrapperClasses\":\"reference\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"distribution item-list\\\">\\r\\n <h3>Payment Allocation</h3>\\r\\n <div class=\\\"line-item-container allow-none\\\">The payment currently has no payment allocations.</div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Payment Allocation</button>\\r\\n <br>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Save</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i\\r\\n class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Sales item must have a\\r\\n name.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('receivables/payments/create/template')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar InvoiceLine = require('receivables/payments/create/line-item')\r\nvar moment = require('moment')\r\nvar numbro = require('numbro')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar valid = $('<div class=\"bg-primary-lighter\" style=\"display: block;\"><i class=\"fa fa-check-circle fa-2x fa-inverse\"></i><span class=\"message\">Payment is valid.</span></div>')\r\n\r\nvar PaymentsView = CreateView.extend({\r\n className: 'block create',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'click': 'expand',\r\n 'click .add-more-line-items': 'addInvoice'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) {\r\n this.Template = Template\r\n }\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n this.model.on('change:invoiceList change:customerList', this.render, this)\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n this.addInvoice()\r\n this.determineStatus()\r\n this.$('.date input:disabled').closest('.date').addClass('readonly').attr('readonly', 'readonly')\r\n\r\n this.$('.payment-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', moment().format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.payment-date .date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n var customerSelectedCallback = function (customer) {\r\n this.$('input[name=customerIdSearch]')\r\n .val(customer.customerId)\r\n .parent()\r\n .addClass('open')\r\n this.$('input[name=customerNameSearch]')\r\n .val(customer.name)\r\n .parent()\r\n .addClass('open')\r\n this.$('input[name=customerId]').val(customer.id)\r\n this.determineStatus()\r\n this.$('.line-item-container').html('')\r\n this.addInvoice()\r\n this.autoCompleteForInvoice()\r\n }.bind(this)\r\n \r\n var customerList = this.model.get('customerList')\r\n var activeCustomerList = _.filter(customerList, ['isActive', true])\r\n\r\n this.autoComplete(\r\n _.filter(activeCustomerList, function (customer) {\r\n return customer.customerId\r\n }),\r\n 'customerId',\r\n this.$('input[name=customerIdSearch]'),\r\n customerSelectedCallback\r\n )\r\n\r\n this.autoComplete(\r\n activeCustomerList,\r\n 'name',\r\n this.$('input[name=customerNameSearch]'),\r\n customerSelectedCallback\r\n )\r\n },\r\n\r\n addInvoice: function (invoiceId) {\r\n var index = this.$('.line-item-container > div').length + 1\r\n\r\n if (index === 1) {\r\n this.$('.line-item-container').html('')\r\n }\r\n\r\n var $paymentDistribution = $(InvoiceLine({ id: invoiceId || index }))\r\n this.$('.line-item-container').append($paymentDistribution)\r\n this.OneUI($paymentDistribution)\r\n\r\n this.trigger('heightChanged')\r\n\r\n $paymentDistribution.find('input').on('focusout', this.checkLineStatus.bind(this)).on('focusin', this.checkLineStatus.bind(this))\r\n\r\n $paymentDistribution.find('.remove').on('click', function () {\r\n $paymentDistribution.remove()\r\n\r\n if (!this.$('.line-item-container > div').length) {\r\n this.$('.line-item-container').html('The payment currently has no payment allocations.')\r\n }\r\n\r\n this.trigger('heightChanged')\r\n }.bind(this))\r\n \r\n this.autoCompleteForInvoice()\r\n this.trigger('lineItemAdded', $paymentDistribution)\r\n return $paymentDistribution\r\n },\r\n\r\n autoCompleteForInvoice: function () {\r\n var invoiceList = this.model.get('invoiceList')\r\n var selectedCustomerId = this.$('input[name=customerId]').val()\r\n var filterdInvoiceList = !!selectedCustomerId ? _.filter(invoiceList, ['customerId', selectedCustomerId]) : invoiceList\r\n var $paymentDistribution = this.$('.distribution .invoice-payment')\r\n\r\n _.each($paymentDistribution, function (paymentLineItem) {\r\n var $paymentLineItem = this.$(paymentLineItem)\r\n this.autoComplete(\r\n filterdInvoiceList,\r\n 'invoiceNumber',\r\n $paymentLineItem.find('input[name=invoiceNumber]'),\r\n function (invoice) {\r\n $paymentLineItem\r\n .find('input[name=invoiceId]')\r\n .val(invoice.id)\r\n $paymentLineItem\r\n .find('input[name=invoiceNumber]')\r\n .val(invoice.invoiceNumber)\r\n $paymentLineItem\r\n .find('input[name=dueDate]')\r\n .val(moment(invoice.dueDate).format(dateParams.format))\r\n $paymentLineItem\r\n .find('input[name=invoiceDate]')\r\n .val(moment(invoice.invoiceDate).format(dateParams.format))\r\n $paymentLineItem\r\n .find('input[name=invoiceAmount]')\r\n .val(numbro(invoice.invoiceAmount).formatCurrency('$0,0.00'))\r\n $paymentLineItem\r\n .find('input[name=openBalance]')\r\n .val(numbro(invoice.openBalance).formatCurrency('$0,0.00'))\r\n }\r\n )\r\n }.bind(this))\r\n },\r\n\r\n isValid: function () {\r\n var distributionAmount = (_.reduce(this.getDistributions(), function (memo, distribution) {\r\n return memo + (distribution.amount * 100)\r\n }, 0) / 100)\r\n \r\n this.isDistributionAmountZero = false\r\n _.map(this.getDistributions(), function (distribution) {\r\n if (distribution.amount === 0) {\r\n this.isDistributionAmountZero = true\r\n }\r\n }.bind(this))\r\n\r\n return this.$('input[name=customerId]').val() &&\r\n numbro().unformat(this.$('input[name=amount]').val()) &&\r\n // We have to multiply and divide by 100 to avoid rounding issues when working with cents.\r\n numbro().unformat(this.$('input[name=amount]').val()) >= distributionAmount &&\r\n !this.isDistributionAmountZero\r\n },\r\n\r\n determineStatus: function () {\r\n // We have to multiply and divide by 100 to avoid rounding issues when working with cents.\r\n var isValidAmountDistribution = numbro().unformat(this.$('input[name=amount]').val()) >= (_.reduce(this.getDistributions(), function (memo, distribution) {\r\n return memo + (distribution.amount * 100)\r\n }, 0) / 100)\r\n if (this.isValid()) {\r\n this.$('.status').html(valid)\r\n } else {\r\n var errorMessage = this.invalidMessage('This payment is not valid.')\r\n if (!this.$('input[name=customerId]').val()) {\r\n errorMessage = this.invalidMessage('You must select a customer that is making this payment.')\r\n } else if (!numbro().unformat(this.$('input[name=amount]').val())) {\r\n errorMessage = this.invalidMessage('You must specify an amount for this payment.')\r\n } else if (!isValidAmountDistribution) {\r\n errorMessage = this.invalidMessage('You can not distribute more than the payment is worth.')\r\n }\r\n this.$('.status').html(errorMessage)\r\n }\r\n },\r\n\r\n invalidMessage: function (message) {\r\n return $('<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">' + message + '</span></div>')\r\n },\r\n\r\n // This is a method used by the base class when a form is submitted on this view\r\n toJSON: function () {\r\n if (!this.isValid()) {\r\n throw new Error('Payment is not valid')\r\n }\r\n\r\n var model = {}\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n if ($el.hasClass('currency') || $el.hasClass('currency-field')) {\r\n elValue = numbro().unformat(elValue)\r\n }\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n model['invoicePayments'] = this.getDistributions()\r\n\r\n return model\r\n },\r\n\r\n checkLineStatus: function (e) {\r\n var hasValue = _.reduce(\r\n this.$('.line-item-container input').map(function (index, el) { return $(el).val() }),\r\n function (memo, value) {\r\n return memo || (!!value && value !== '$')\r\n },\r\n false\r\n )\r\n\r\n if (hasValue || e.type === 'focusin') {\r\n this.$('.line-item-container').addClass('forceLabelsOpen')\r\n } else {\r\n this.$('.line-item-container').removeClass('forceLabelsOpen')\r\n }\r\n },\r\n\r\n getDistributions: function () {\r\n return _.filter(_.map(this.$('.invoice-payment'), function (distributionLine) {\r\n var $distributionLine = this.$(distributionLine)\r\n\r\n var amount = numbro().unformat($distributionLine.find('input[name=amount]').val())\r\n var invoiceId = $distributionLine.find('input[name=invoiceId]').val()\r\n\r\n return {\r\n amount: amount,\r\n invoiceId: invoiceId\r\n }\r\n }), function (item) {\r\n return item.invoiceId\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = PaymentsView\r\n","'use strict'\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\nvar moment = require('moment')\r\nvar _ = require('lodash')\r\n\r\nvar PaymentType = Object.freeze({\r\n 1: 'Cash',\r\n 2: 'Check',\r\n 3: 'Credit Card',\r\n 4: 'EFT'\r\n})\r\n\r\nvar Payment = ListEntry.extend({}, {\r\n \r\n parse: function (json) {\r\n if (json.source < 1 || json.source > 4) {\r\n json.source = 1\r\n }\r\n var payment = new Payment({\r\n PaymentType: PaymentType,\r\n amount: json.amount,\r\n customerId: json.customerId,\r\n customerName: '',\r\n sourceIndex: json.source,\r\n source: !!PaymentType[json.source] ? PaymentType[json.source] : json.source,\r\n id: json.id,\r\n invoicePayments: json.invoicePayments,\r\n paymentDate: moment(json.paymentDate).format('MM/DD/YYYY'),\r\n reference: json.reference,\r\n shortPaymentDate: json.paymentDate,\r\n customer: json.customer,\r\n // Meta info\r\n customerNameSearch: json.customerNameSearch,\r\n printedName: json.printedName,\r\n customerIdSearch: json.customerIdSearch,\r\n customerLookup: json.customerLookup,\r\n invoices: json.invoices,\r\n invoiceNumber: json.invoiceNumber,\r\n unappliedAmount: json.unappliedAmount,\r\n isVoid: json.isVoid,\r\n canVoid: json.canVoid\r\n })\r\n return payment\r\n }\r\n})\r\n\r\nmodule.exports = Payment\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return container.escapeExpression((helpers.numbro || (depth0 && depth0.numbro) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.unappliedAmount : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}));\n},\"3\":function(container,depth0,helpers,partials,data) {\n return container.escapeExpression((helpers.numbro || (depth0 && depth0.numbro) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.amount : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}));\n},\"5\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.canVoid : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-ban pull-right void\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"payment-date date\\\">\"\n + alias4(((helper = (helper = helpers.shortPaymentDate || (depth0 != null ? depth0.shortPaymentDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortPaymentDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"invoice-number\\\">\"\n + alias4(((helper = (helper = helpers.invoiceNumber || (depth0 != null ? depth0.invoiceNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"invoiceNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"customer-name\\\">\"\n + alias4(((helper = (helper = helpers.customerNameSearch || (depth0 != null ? depth0.customerNameSearch : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"customerNameSearch\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"source\\\">\"\n + alias4(((helper = (helper = helpers.source || (depth0 != null ? depth0.source : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"source\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"reference\\\">\"\n + alias4(((helper = (helper = helpers.reference || (depth0 != null ? depth0.reference : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reference\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"currency\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.unappliedAmount : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n<div class=\\\"actions pull-right\\\">\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isVoid : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('receivables/payments/item/template')\r\nvar _ = require('lodash')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar PaymentsView = ItemView.extend({\r\n events: _.extend(_.clone(ItemView.prototype.events), {\r\n 'click .void': 'showVoid'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n this.listenTo(this.model, 'change:customerName', this.render.bind(this))\r\n },\r\n\r\n onRender: function () {\r\n if (this.model.get('isVoid')) {\r\n this.$el.addClass('notActive')\r\n }\r\n },\r\n\r\n showVoid: function (e) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n\r\n if (this.model.get('canVoid')) {\r\n this.trigger('void', this.model.id)\r\n } else {\r\n sweetAlert({\r\n title: 'Unable to Void',\r\n text: 'The deposit related to this payment must first be voided',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6'\r\n })\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = PaymentsView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \" <b class=\\\"pull-right\\\" id=\\\"availableBalance\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"left\\\" data-original-title=\\\"Total pending invoice amount\\\">\\r\\n <i class=\\\"fa fa-question-circle\\\" aria-hidden=\\\"true\\\"></i> Unapplied Balance: \"\n + container.escapeExpression((helpers.numbro || (depth0 && depth0.numbro) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.pendingBalance : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"\\r\\n </b>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Payments</h3>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isPending : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"payment-date date\\\">Payment Date</div>\\r\\n <div class=\\\"invoice-number\\\">Invoice Number</div>\\r\\n <div class=\\\"customer-name\\\">Customer Name</div>\\r\\n <div class=\\\"source\\\">Payment Type</div>\\r\\n <div class=\\\"reference\\\">Reference</div>\\r\\n <div class=\\\"currency\\\">Amount</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\"><p class=\\\"center\\\">Loading more payments...</p></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('receivables/payments/list/template')\r\nvar PaymentView = require('receivables/payments/item/view')\r\nvar DetailsView = require('receivables/payments/read/view')\r\nvar UpdateView = require('receivables/payments/update/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\n// TODO: Sorting\r\nvar PaymentsView = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort',\r\n 'click .void': 'showVoid'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = PaymentView\r\n this.model.set('sort', 'asc')\r\n this.model.set('sortField', 'paymentDate')\r\n this.model.set('paymentDate-sort', 'asc')\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.model.on('change:pendingBalance', this.render, this)\r\n this.on('showDetails', this.showDetails.bind(this))\r\n this.on('showEdit', this.showEdit.bind(this))\r\n this.on('void', this.showVoid.bind(this))\r\n },\r\n\r\n onRender: function () {\r\n if (this.model.get('isPending') && !this.$el.hasClass('prepayment')) {\r\n this.$el.addClass('prepayment')\r\n }\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more payments...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more payments.')\r\n },\r\n\r\n showDetails: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n var details = new DetailsView({model: model})\r\n\r\n // View to show beneath $lineItem, and if the 'active' class should be added to $lineItem's classes\r\n this.showChildView(details, $lineItem, true)\r\n },\r\n\r\n showEdit: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n var update = new UpdateView({model: model})\r\n update.on('update', function () {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('update')\r\n this.trigger.apply(this, args)\r\n }, this)\r\n\r\n this.showChildView(update, $lineItem, false)\r\n },\r\n\r\n showVoid: function (paymentId) {\r\n this.showConfirmationMessage(\r\n this.$('.itemrow[data-id=\"' + paymentId + '\"]'),\r\n 'Are you sure you want to void this payment?',\r\n 'confirmVoidReload',\r\n paymentId\r\n )\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.unset('paymentDate-sort')\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n }\r\n})\r\n\r\nmodule.exports = PaymentsView\r\n","'use strict'\r\n\r\nvar Payment = require('receivables/payments/item/payment')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar Payments = ListWrapper.extend({\r\n childModel: Payment\r\n})\r\n\r\nmodule.exports = Payments\r\n","var UpdateView = require('receivables/payments/update/view')\r\n\r\n// TODO: Replace payment method drop down with static text instead of read only drop down\r\nvar ReadView = UpdateView.extend({\r\n className: 'block read has-animation fadeInDown expanded',\r\n\r\n attributes: function () {\r\n return {\r\n 'data-id': this.model.id\r\n }\r\n },\r\n\r\n onRender: function () {\r\n UpdateView.prototype.onRender.apply(this, arguments)\r\n this.$('input,select,textarea').attr('disabled', true)\r\n this.$('.input-group-addon .fa-calendar').css({display: 'none'})\r\n this.$('.date input:disabled').closest('.date').addClass('readonly').attr('readonly', 'readonly')\r\n }\r\n})\r\n\r\nmodule.exports = ReadView\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar PaymentsService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nPaymentsService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nPaymentsService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'payments'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nPaymentsService.prototype.getAll = function (page, pageSize, pending, sort, sortField) {\r\n var apiPath = this.GetPath() + this.GetQuery({page: page, pageSize: pageSize, pending: pending, sort: sort, sortField: sortField})\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nPaymentsService.prototype.getList = function () {\r\n var apiPath = this.GetPath('list')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nPaymentsService.prototype.setStatus = function (paymentId, status) {\r\n var apiPath = this.GetPath(paymentId, 'enable')\r\n return this.restClient.put(apiPath, !!status)\r\n}\r\n\r\nPaymentsService.prototype.voidPayment = function (paymentId) {\r\n var apiPath = this.GetPath(paymentId, 'void')\r\n return this.restClient.put(apiPath)\r\n}\r\n\r\nPaymentsService.prototype.getUnallocatedBalance = function () {\r\n var apiPath = this.GetPath('unallocated-balance')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nPaymentsService.prototype.getUndeposited = function () {\r\n var apiPath = this.GetPath('undeposited')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nmodule.exports = PaymentsService\r\n","var CreateView = require('receivables/payments/create/view')\r\nvar _ = require('lodash')\r\nvar numbro = require('numbro')\r\nvar moment = require('moment')\r\n\r\nvar UpdateView = CreateView.extend({\r\n className: 'block update expanded has-animation fadeInDown',\r\n\r\n initialize: function () {\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n // Fill in inputs with our data\r\n var model = this.model.toViewModel()\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var isDate = $el.closest('.form-material').hasClass('date')\r\n var isCurrency = $el.hasClass('currency') || $el.hasClass('currency-field')\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else if (isDate) {\r\n $el.val(moment(model[$el.attr('name')]).format('MM/DD/YYYY')).closest('.floating').addClass('open')\r\n } else if (isCurrency) {\r\n $el.val(numbro(model[$el.attr('name')]).formatCurrency('$0,0.00'))\r\n } else if (model[$el.attr('name')]) {\r\n $el.val(model[$el.attr('name')]).closest('.floating').addClass('open')\r\n }\r\n }.bind(this))\r\n\r\n this.$('select.source option[value=\"' + model.sourceIndex + '\"]').attr(\"selected\", \"selected\")\r\n \r\n if (this.model.get('invoicePayments').length) {\r\n this.$('input[name=amount]').attr('disabled', true)\r\n }\r\n\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n\r\n // Remove empty payment line from the create side\r\n this.$('.invoice-payment').remove()\r\n\r\n // Add payment lines with our data\r\n _.forEach(model['invoicePayments'], function (invoicePayment) {\r\n var $paymentDistribution = this.addInvoice(invoicePayment.id)\r\n $paymentDistribution\r\n .find('input[name=invoiceId]')\r\n .val(invoicePayment.invoice.id)\r\n $paymentDistribution\r\n .find('input[name=invoiceNumber]')\r\n .val(invoicePayment.invoice.invoiceNumber)\r\n $paymentDistribution\r\n .find('input[name=dueDate]')\r\n .val(moment(invoicePayment.invoice.dueDate || invoicePayment.invoice.goodThroughDate).format('MM/DD/YYYY'))\r\n $paymentDistribution\r\n .find('input[name=invoiceDate]')\r\n .val(moment(invoicePayment.invoice.invoiceDate || invoicePayment.invoice.date).format('MM/DD/YYYY'))\r\n $paymentDistribution\r\n .find('input[name=invoiceAmount]')\r\n .val(numbro(invoicePayment.invoice.invoiceAmount).formatCurrency('$0,0.00'))\r\n $paymentDistribution\r\n .find('input[name=openBalance]')\r\n .val(numbro((invoicePayment.invoice.openBalance || 0) + invoicePayment.amount).formatCurrency('$0,0.00'))\r\n $paymentDistribution\r\n .find('input[name=amount]')\r\n .val(numbro(invoicePayment.amount).formatCurrency('$0,0.00'))\r\n }.bind(this))\r\n\r\n this.determineStatus()\r\n }\r\n})\r\n\r\nmodule.exports = UpdateView\r\n","var ListContainer = require('lists/list/view')\r\nvar ListView = require('receivables/payments/list/view')\r\nvar CreateView = require('receivables/payments/create/view')\r\n\r\nvar PaymentsView = ListContainer.extend({\r\n className: 'payments receivables list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n this.listView = new ListView({model: this.model})\r\n this.forwardEvents(this.listView)\r\n\r\n this.createView = new CreateView({model: this.model})\r\n this.forwardEvents(this.createView)\r\n\r\n this.on('created', function () {\r\n this.createView.trigger('resetInputs')\r\n }.bind(this))\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n console.log('container -> editDetails')\r\n this.listView.trigger('showEdit', model)\r\n }.bind(this))\r\n\r\n this.on('widgetShown', function () {\r\n this.listView.trigger('bindScroll')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n },\r\n\r\n getListView: function () {\r\n return this.listView\r\n },\r\n\r\n setPendingListView: function (pendingListView) {\r\n this.pendingListView = pendingListView\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n\r\n if (!this.model.get('isPending')) {\r\n this.$el.append(this.createView.render().$el)\r\n }\r\n if (this.pendingListView) {\r\n this.$el.append(this.pendingListView.render().$el)\r\n }\r\n this.$el.append(this.listView.render().$el)\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = PaymentsView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar Backbone = require('backbone')\r\nvar Payments = require('receivables/payments/payments')\r\nvar Service = require('receivables/payments/service')\r\nvar CustomerService = require('lists/customers/service')\r\nvar InvoiceService = require('receivables/invoices/service')\r\nvar ListContainer = require('receivables/payments/view')\r\n\r\nvar PaymentsWidget = function (isPending) {\r\n this.service = new Service()\r\n this.modelType = Payments\r\n this.viewType = ListContainer\r\n this.customerService = new CustomerService()\r\n this.invoiceService = new InvoiceService()\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n\r\n this.model.set('isPending', isPending)\r\n if (!isPending) {\r\n this.pendingWidget = new PaymentsWidget(true)\r\n this.model.on('reset', function () {\r\n if (this.resetting) { return }\r\n this.resetting = true\r\n this.pendingWidget.reset()\r\n this.resetting = false\r\n }.bind(this))\r\n this.pendingWidget.on('reset', function () {\r\n if (this.resetting) { return }\r\n this.resetting = true\r\n this.reset()\r\n this.resetting = false\r\n }.bind(this))\r\n\r\n var pendingListView = this.pendingWidget.getListView()\r\n this.view.setPendingListView(pendingListView)\r\n } else {\r\n this.view.off('created')\r\n this.getUnappliedBalance()\r\n this.on('reset', this.getUnappliedBalance, this)\r\n }\r\n\r\n this.readyPromise = Q.all([\r\n this.customerService.getList().then(function (results) {\r\n this.model.set('customerList', results)\r\n this.model.set('customerLookup', _.keyBy(results, 'id'))\r\n }.bind(this)),\r\n this.getOpenInvoices()\r\n ])\r\n\r\n this.on('reset', function () {\r\n this.getOpenInvoices()\r\n }.bind(this))\r\n\r\n this.on('shown', function () {\r\n this.view.trigger('widgetShown')\r\n }.bind(this))\r\n\r\n this.view.on('confirmVoidReload', function (paymentId) {\r\n this.confirmVoid(paymentId).then(function () {\r\n Backbone.trigger('app:navigate', 'receivables/payments')\r\n })\r\n }.bind(this))\r\n}\r\n\r\nPaymentsWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nPaymentsWidget.prototype.getUnappliedBalance = function () {\r\n return this.service.getUnallocatedBalance().then(function (result) {\r\n this.model.set('pendingBalance', result.balance)\r\n }.bind(this))\r\n}\r\n\r\nPaymentsWidget.prototype.getOpenInvoices = function () {\r\n return this.invoiceService.getOpenInvoices().then(function (results) {\r\n this.model.set('invoiceList', results)\r\n this.model.set('invoiceLookup', _.keyBy(results, 'id'))\r\n }.bind(this))\r\n}\r\n\r\nPaymentsWidget.prototype.getListView = function () {\r\n return this.view.getListView()\r\n}\r\n\r\nPaymentsWidget.prototype.loadPage = function () {\r\n if (this.loadingMore) return\r\n this.loadingMore = true\r\n var currentPage = this.model.get('page')\r\n this.view.trigger('loadingPage', currentPage)\r\n this.model.trigger('loadingPage', currentPage)\r\n return this.service.getAll(currentPage, 25, this.model.get('isPending'), this.model.get('sort'), this.model.get('sortField')).then(function (result) {\r\n return Q.all(_.map(result.collection, function (payment) {\r\n return this.resolveReferences(this.model.getModel(payment))\r\n }.bind(this))).then(function (collection) {\r\n result.collection = _.map(collection, function (payment) {\r\n return payment.toJSON()\r\n })\r\n return result\r\n })\r\n }.bind(this)).then(function (result) {\r\n this.loadingMore = false\r\n if (result.collection.length) {\r\n this.model.set('page', currentPage + 1)\r\n } else {\r\n this.view.trigger('EOF')\r\n }\r\n this.model.set('sortField', result.sortField)\r\n this.model.set('sort', result.sort)\r\n this.model.add(_.map(result.collection, this.childModel.bind(this)))\r\n this.view.trigger('loadedPage', result.collection.length)\r\n this.model.trigger('loadedPage', result.collection.length)\r\n }.bind(this))\r\n}\r\n\r\nPaymentsWidget.prototype.resolveReferences = function (payment) {\r\n return this.readyPromise.then(function () {\r\n var customerId = payment.get('customerId')\r\n var invoicePayments = payment.get('invoicePayments')\r\n\r\n payment.set('customerLookup', this.model.get('customerLookup'))\r\n\r\n _.each(payment.get('invoices'), function (invoice) {\r\n _.extend(invoice, this.model.get('invoiceLookup')[invoice.id] || {})\r\n }.bind(this))\r\n\r\n payment.set('invoiceLookup', _.extend(_.clone(this.model.get('invoiceLookup')), _.keyBy(payment.get('invoices'), 'id')))\r\n\r\n payment.set({\r\n invoiceList: _.values(payment.get('invoiceLookup')),\r\n customerList: _.values(payment.get('customerLookup'))\r\n })\r\n\r\n if (this.model.get('isPending')) {\r\n payment.set('unappliedAmount', _.reduce(invoicePayments, function (memo, payment) {\r\n return memo - (payment.amount * 100)\r\n }, payment.get('amount') * 100) / 100)\r\n }\r\n\r\n if (invoicePayments && invoicePayments.length) {\r\n _.each(invoicePayments, function (lineItem) {\r\n lineItem.invoice = payment.get('invoiceLookup')[lineItem.invoiceId]\r\n })\r\n\r\n payment.set('invoiceNumber', '')\r\n if (invoicePayments.length > 1) {\r\n payment.set('invoiceNumber', 'Multiple')\r\n } else {\r\n var firstInvoicePayment = _.first(invoicePayments)\r\n payment.set('invoiceNumber', firstInvoicePayment.invoice.invoiceNumber)\r\n }\r\n }\r\n\r\n if (customerId) {\r\n payment.set('customer', payment.get('customerLookup')[customerId])\r\n payment.set('customerNameSearch', payment.get('customer').name)\r\n payment.set('printedName', payment.get('customer').printedName)\r\n payment.set('customerIdSearch', payment.get('customer').customerId)\r\n }\r\n\r\n return payment\r\n }.bind(this))\r\n}\r\n\r\nPaymentsWidget.prototype.get = function (modelId) {\r\n return this.service.get(modelId).then(function (item) {\r\n return this.readyPromise.then(function () {\r\n return this.childModel(item)\r\n }.bind(this))\r\n }.bind(this)).then(this.resolveReferences.bind(this)).then(function (payment) {\r\n this.view.trigger('details', payment)\r\n }.bind(this))\r\n}\r\n\r\nPaymentsWidget.prototype.edit = function (modelId) {\r\n return this.service.get(modelId).then(function (item) {\r\n return this.readyPromise.then(function () {\r\n return this.childModel(item)\r\n }.bind(this))\r\n }.bind(this)).then(this.resolveReferences.bind(this)).then(function (payment) {\r\n this.view.trigger('editDetails', payment)\r\n this.trigger('editDetails', payment)\r\n }.bind(this))\r\n}\r\n\r\nPaymentsWidget.prototype.confirmVoid = function (modelId) {\r\n return this.service.voidPayment(modelId)\r\n}\r\n\r\nmodule.exports = PaymentsWidget\r\n","'use strict'\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\n\r\nvar QuoteEntry = ListEntry.extend({}, {\r\n parse: function (json) {\r\n return new QuoteEntry({\r\n id: json.id,\r\n revision: json.revision,\r\n lineItems: json.lineItems,\r\n terms: json.terms,\r\n purchaseOrderNumber: json.purchaseOrderNumber,\r\n memo: json.memo,\r\n date: new Date(json.date),\r\n shortDate: moment(json.date).format('MM/DD/YYYY'),\r\n goodThroughDate: new Date(json.goodThroughDate),\r\n shortGoodThroughDate: moment(json.goodThroughDate).format('MM/DD/YYYY'),\r\n name: json.name,\r\n printedName: json.printedName,\r\n addressLine1: json.addressLine1,\r\n addressLine2: json.addressLine2,\r\n city: json.city,\r\n state: json.state,\r\n postalCode: json.postalCode,\r\n salesTax: json.salesTax\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = QuoteEntry\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.quoteNumber || (depth0 != null ? depth0.quoteNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"quoteNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('receivables/quote/item/template')\r\nvar $ = require('jquery')\r\n\r\nvar QuoteView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n render: function () {\r\n this.$el = $(this.Template(this.model.toViewModel()))\r\n this.el = this.$el[0]\r\n if (this.onRender) this.onRender()\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = QuoteView\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"form-material floating input-group open\\\" style=\\\"width: 100%;\\\">\\r\\n <select class=\\\"form-control my-checkbooks\\\" id=\\\"revision-selector\\\">\\r\\n </select>\\r\\n <label class=\\\"control-label\\\" for=\\\"revision-selector\\\">Revision</label>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar QuoteView = require('receivables/quote/item/view')\r\nvar _ = require('lodash')\r\nvar Template = require('receivables/quote/list/template')\r\n\r\nvar QuoteListVist = ListView.extend({\r\n className: 'form-group revision-listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'change select': 'changeSelectedEntry'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = QuoteView\r\n ListView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading quote entries...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more quote entries.')\r\n },\r\n\r\n addChild: function (child) {\r\n /* eslint-disable new-cap */\r\n var childView = new this.childView({model: child})\r\n /* eslint-enable new-cap */\r\n this.$('select').append(childView.render().$el)\r\n childView.delegateEvents()\r\n },\r\n\r\n changeSelectedEntry: function (e) {\r\n var selectedId = this.$('select').val()\r\n this.model.get('currentQuote').set('currentEntryId', selectedId)\r\n }\r\n})\r\n\r\nmodule.exports = QuoteListVist\r\n","var CreateView = require('receivables/quotes/create/view')\r\nvar Template = require('receivables/quotes/create/template')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar numbro = require('numbro')\r\nvar Backbone = require('backbone')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar UpdateView = CreateView.extend({\r\n className: 'block update expanded has-animation fadeInDown',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'click .decline': 'decline',\r\n 'click .create-invoice': 'createInvoice',\r\n 'keyup': 'detectChanges',\r\n 'click .print-button': 'printQuote',\r\n 'click .email-button': 'emailQuote'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n\r\n this.model.on('change:currentQuote change:selectedEntry', this.render, this)\r\n this.on('lineItemRemoved', function () {\r\n this.modified = true\r\n }.bind(this))\r\n },\r\n\r\n onRender: function () {\r\n this.modified = false\r\n this.$el.removeClass('readOnly')\r\n this.$el.removeClass('isDeclined')\r\n this.$('input[name=quoteNumber]').attr('disabled', true)\r\n\r\n if (!this.model.get('currentQuote') || !this.model.get('selectedEntry')) {\r\n return\r\n }\r\n\r\n // Fill in inputs with our data\r\n var model = _.clone(this.model.get('currentQuote').toViewModel())\r\n _.extend(model, this.model.get('selectedEntry').toViewModel())\r\n\r\n this.data = model\r\n\r\n if (model.customer) {\r\n model.customerIdSearch = model.customer.customerId\r\n model.customerNameSearch = model.customer.name\r\n }\r\n\r\n if (model.department) {\r\n model.departmentName = model.department.name\r\n model.departmentId = model.department.id\r\n }\r\n\r\n this.$('input[name=customerIdSearch], input[name=customerNameSearch]').attr('disabled', true)\r\n\r\n if (model.salesTax && model.salesTax.salesTax) {\r\n model.rateId = model.salesTax.salesTax.rateId\r\n model.taxRate = model.salesTax.salesTax.taxRate\r\n model.taxRateId = model.salesTax.salesTaxId\r\n }\r\n\r\n model.quoteNumber = model.quoteNumber + '-' + model.revision\r\n this.quoteEntryId = this.model.get('selectedEntry').id\r\n\r\n _.each(this.$('input:not([type=file]), textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var isDate = $el.closest('.form-material').hasClass('date')\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else if (isDate) {\r\n $el.val(moment(model[$el.attr('name')]).format('MM/DD/YYYY')).closest('.floating').addClass('open')\r\n } else {\r\n $el.val(model[$el.attr('name')]).closest('.floating').addClass('open')\r\n }\r\n }.bind(this))\r\n\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n\r\n // Remove empty customer line from the create side\r\n this.$('.create-customer-method').remove()\r\n\r\n this.$('.line-item-container').html('')\r\n // Add customer lines with our data\r\n _.forEach(model['lineItems'], function (lineItem) {\r\n var $saleEntry = this.addSalesEntry()\r\n $saleEntry.find('input[name=id]').val(lineItem.salesEntryId).parent().addClass('open')\r\n $saleEntry.find('input[name=price]').val(numbro(lineItem.price).formatCurrency('$0,0.00')).parent().addClass('open')\r\n $saleEntry.find('input[name=discount]').val(numbro(lineItem.discount).formatCurrency('$0,0.00')).parent().addClass('open')\r\n $saleEntry.find('input[name=quantity]').val(lineItem.quantity).parent().addClass('open')\r\n $saleEntry.find('input[name=saleEntryId]').val(lineItem.salesEntry.saleEntryId).parent().addClass('open')\r\n $saleEntry.find('input[name=name]').val(lineItem.salesEntry.name).parent().addClass('open')\r\n $saleEntry.recalculateAndSetSalesItem()\r\n }.bind(this))\r\n\r\n if (model.revision !== model.highestRevision || model.hasInvoice) {\r\n this.$('input, textarea, select').attr('disabled', true)\r\n this.$el.addClass('readOnly')\r\n }\r\n\r\n this.$('.email-button').attr('disabled', !model.canEmail)\r\n\r\n if (model.isDeclined) {\r\n this.$el.addClass('isDeclined')\r\n }\r\n },\r\n\r\n setDates: function () {\r\n // Fill in inputs with our data\r\n var model = _.clone(this.model.get('currentQuote').toViewModel())\r\n _.extend(model, this.model.get('selectedEntry').toViewModel())\r\n\r\n var startDate = new Date(model.date)\r\n var endDate = new Date(model.goodThroughDate)\r\n var startDateUTC = new Date(startDate.getTime() + startDate.getTimezoneOffset() * 60000)\r\n var endDateUTC = new Date(endDate.getTime() + endDate.getTimezoneOffset() * 60000)\r\n\r\n this.loadDates(startDateUTC, endDateUTC, 'goodThroughDate')\r\n },\r\n\r\n detectChanges: function (e) {\r\n var $el = this.$(e.target)\r\n var elName = $el.attr('name')\r\n if (elName !== 'memo' && elName !== 'notes') {\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n if ($el.hasClass('currency') || $el.hasClass('currency-field')) {\r\n elValue = numbro().unformat(elValue)\r\n }\r\n\r\n if (elValue !== this.data[elName]) {\r\n this.modified = true\r\n }\r\n }\r\n },\r\n\r\n addSalesEntry: function (e) {\r\n var results = CreateView.prototype.addSalesEntry.apply(this, arguments)\r\n\r\n if (e) {\r\n this.modified = true\r\n }\r\n return results\r\n },\r\n\r\n expand: function () {},\r\n collapse: function () {},\r\n getId: function () {\r\n return this.model.get('currentQuote').id\r\n },\r\n\r\n cancel: function (e) {\r\n e.preventDefault()\r\n Backbone.trigger('app:navigate', 'receivables/quotes')\r\n },\r\n\r\n decline: function (e) {\r\n e.preventDefault()\r\n this.$('.decline').prop('disabled', true)\r\n this.trigger('decline', this.getId())\r\n },\r\n\r\n createInvoice: function (e) {\r\n e.preventDefault()\r\n this.$('.create-invoice').prop('disabled', true)\r\n this.trigger('createInvoice', this.getId())\r\n },\r\n\r\n printQuote: function (e) {\r\n e.preventDefault()\r\n\r\n sweetAlert({\r\n title: 'Print Quote',\r\n text: 'Would you like to save your quote before printing?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Save and Print',\r\n cancelButtonColor: '#425565',\r\n cancelButtonText: 'Print'\r\n }).then(function (saveAndPrint) {\r\n this.trigger('saveAndPrint', this.getId(), this.model.get('selectedEntry').id, this.toJSON())\r\n }.bind(this), function () {\r\n this.trigger('printQuote', this.getId(), this.model.get('selectedEntry').id)\r\n }.bind(this))\r\n },\r\n\r\n emailQuote: function (e) {\r\n e.preventDefault()\r\n\r\n sweetAlert({\r\n title: 'Email Quote',\r\n text: 'Would you like to save your quote before emailing?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Save and Email',\r\n cancelButtonColor: '#425565',\r\n cancelButtonText: 'Email'\r\n }).then(function (saveAndEmail) {\r\n this.trigger('saveAndEmail', this.getId(), this.model.get('selectedEntry').id, this.toJSON())\r\n }.bind(this), function () {\r\n this.trigger('emailQuote', this.getId(), this.model.get('selectedEntry').id)\r\n }.bind(this))\r\n }\r\n})\r\n\r\nmodule.exports = UpdateView\r\n","var ListContainer = require('lists/list/view')\r\nvar ListView = require('receivables/quote/list/view')\r\nvar UpdateView = require('receivables/quote/update/view')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\n\r\nvar CustomersView = ListContainer.extend({\r\n className: 'quote receivables list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n this.listView = new ListView({model: this.model})\r\n this.forwardEvents(this.listView)\r\n\r\n this.updateView = new UpdateView({model: this.model})\r\n this.forwardEvents(this.updateView)\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('widgetShown', function () {\r\n this.listView.trigger('bindScroll')\r\n }.bind(this))\r\n\r\n this.on('dataLoaded', function () {\r\n this.updateView.trigger('bindAutocomplete')\r\n })\r\n\r\n this.on('forwardSalesEntryError', function () {\r\n _.partial(this.updateView.trigger, 'salesEntryError').apply(this.updateView, arguments)\r\n }.bind(this))\r\n\r\n this.on('forwardSalesEntryCreated', function () {\r\n _.partial(this.updateView.trigger, 'salesEntryCreated').apply(this.updateView, arguments)\r\n }.bind(this))\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n\r\n this.$el.append(this.listView.render().$el)\r\n this.$el.append(this.updateView.render().$el)\r\n\r\n return this\r\n },\r\n \r\n btnEnable: function () {\r\n $('.btn').prop('disabled', false)\r\n }\r\n})\r\n\r\nmodule.exports = CustomersView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar Backbone = require('backbone')\r\nvar Quotes = require('receivables/quotes/quotes')\r\nvar QuoteEntry = require('receivables/quote/item/quote-entry')\r\nvar Service = require('receivables/quotes/service')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar CustomerService = require('lists/customers/service')\r\nvar SalesEntryService = require('lists/sales-entry/service')\r\nvar InvoicesService = require('receivables/invoices/service')\r\nvar SalesTaxService = require('lists/sales-taxes/service')\r\nvar VendorService = require('lists/vendors/service')\r\nvar DepartmentService = require('lists/departments/service')\r\nvar ListContainer = require('receivables/quote/view')\r\n\r\nvar Q = require('q')\r\n\r\nvar QuoteWidget = function (id) {\r\n this.id = id\r\n this.service = new Service()\r\n this.salesEntryService = new SalesEntryService()\r\n this.customerService = new CustomerService()\r\n this.salesTaxService = new SalesTaxService()\r\n this.invoicesService = new InvoicesService()\r\n this.vendorService = new VendorService()\r\n this.accountService = new AccountService()\r\n this.departmentService = new DepartmentService()\r\n this.modelType = Quotes\r\n this.viewType = ListContainer\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n\r\n this.model.set('id', this.id)\r\n\r\n this.view.on('decline', function (modelId) {\r\n this.decline(modelId).then(function () {\r\n Backbone.trigger('app:navigate', 'receivables/quotes')\r\n })\r\n }.bind(this))\r\n\r\n this.view.on('createInvoice', function (modelId) {\r\n this.createInvoice(modelId).then(function (response) {\r\n Backbone.trigger('app:navigate', 'receivables/invoices/' + response.message)\r\n })\r\n }.bind(this))\r\n\r\n this.view.on('saveAndPrint', this.saveAndPrint.bind(this))\r\n this.view.on('printQuote', this.printQuote.bind(this))\r\n this.view.on('saveAndEmail', this.saveAndEmail.bind(this))\r\n this.view.on('emailQuote', this.emailQuote.bind(this))\r\n\r\n this.view.on('updated', function () {\r\n this.loaded = false\r\n this.model.reset()\r\n }.bind(this))\r\n\r\n var customerListPromise = this.customerService.getList().then(function (results) {\r\n this.model.set('customerList', results)\r\n this.model.set('customerLookup', _.keyBy(results, 'id'))\r\n }.bind(this))\r\n\r\n var salesEntryPromise = this.loadSalesEntries()\r\n\r\n var salesTaxPromise = this.salesTaxService.getList().then(function (results) {\r\n this.model.set('salesTaxRates', results)\r\n this.model.set('salesTaxLookup', _.keyBy(results, 'id'))\r\n }.bind(this))\r\n\r\n var accountPromise = this.accountService.fetchAccounts().then(function (accounts) {\r\n this.model.set('accountList', _.map(accounts, function (account) {\r\n return account.toJSON()\r\n }))\r\n this.model.set('accountLookup', _.keyBy(this.model.get('accountList'), 'id'))\r\n return accounts\r\n }.bind(this))\r\n\r\n var vendorListPromise = this.vendorService.getList().then(function (results) {\r\n this.model.set('vendorList', _.map(results, function (vendor) {\r\n vendor['fullName'] = vendor.firstName + ' ' + vendor.lastName\r\n return vendor\r\n }))\r\n }.bind(this))\r\n\r\n var departmentListPromise = this.departmentService.getList().then(function (departmentList) {\r\n this.model.set('departmentList', departmentList);\r\n }.bind(this))\r\n\r\n var hasBeenShown = Q.defer()\r\n this.on('shown', function () {\r\n hasBeenShown.resolve()\r\n })\r\n\r\n Q.all([\r\n hasBeenShown,\r\n customerListPromise,\r\n salesEntryPromise,\r\n salesTaxPromise,\r\n accountPromise,\r\n vendorListPromise,\r\n departmentListPromise\r\n ]).then(function () {\r\n this.view.trigger('dataLoaded')\r\n }.bind(this)).done()\r\n\r\n this.model.on('change:currentQuote', function (model, child) {\r\n customerListPromise.then(function () {\r\n if (child.get('customerId')) {\r\n child.set('customer', this.model.get('customerLookup')[child.get('customerId')])\r\n }\r\n\r\n child.on('change:currentEntryId', function (quote, entryId) {\r\n return Q.all([salesEntryPromise, salesTaxPromise]).then(function () {\r\n return this.service.getEntry(quote.id, entryId)\r\n }.bind(this)).then(function (quoteDetails) {\r\n var entry = quoteDetails.quoteEntry\r\n\r\n if (entry.salesTax && entry.salesTax.salesTaxId) {\r\n entry.salesTax.salesTax = this.model.get('salesTaxLookup')[entry.salesTax.salesTaxId]\r\n }\r\n\r\n if (entry.lineItems && entry.lineItems.length) {\r\n entry.lineItems = _.map(entry.lineItems, function (lineItem) {\r\n lineItem.salesEntry = this.model.get('salesEntryLookup')[lineItem.salesEntryId]\r\n return lineItem\r\n }.bind(this))\r\n }\r\n\r\n this.model.set('selectedEntry', new QuoteEntry(entry))\r\n }.bind(this)).done()\r\n }.bind(this))\r\n\r\n child.set('currentEntryId', model.get('items').first().id)\r\n }.bind(this))\r\n }.bind(this))\r\n\r\n this.view.on('createSalesEntry', this.createSalesEntry, this)\r\n}\r\n\r\nQuoteWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nQuoteWidget.prototype.loadPage = function () {\r\n if (this.loadingMore || this.loaded) return\r\n this.loadingMore = true\r\n this.view.trigger('loadingPage', 1)\r\n this.model.trigger('loadingPage', 1)\r\n return this.service.get(this.id).then(function (result) {\r\n this.loaded = true\r\n this.loadingMore = false\r\n this.model.reset()\r\n var currentQuote = this.model.childModel.parse(result)\r\n this.model.add(currentQuote.get('quoteEntries').map(function (entry) {\r\n return entry\r\n }))\r\n this.model.set('currentQuote', currentQuote)\r\n }.bind(this))\r\n}\r\n\r\nQuoteWidget.prototype.decline = function (modelId) {\r\n return this.service.decline(modelId).then(function () {\r\n this.view.trigger('declined', modelId)\r\n }.bind(this), function (error){\r\n this.view.btnEnable()\r\n }.bind(this))\r\n}\r\n\r\nQuoteWidget.prototype.createInvoice = function (modelId) {\r\n return this.invoicesService.generateInvoice(modelId).fail(function (error) {\r\n this.view.btnEnable()\r\n }.bind(this))\r\n}\r\n\r\nQuoteWidget.prototype.loadSalesEntries = function () {\r\n return this.salesEntryService.getList().then(function (results) {\r\n this.model.set('salesEntryList', results)\r\n this.model.set('salesEntryLookup', _.keyBy(results, 'id'))\r\n\r\n return results\r\n }.bind(this))\r\n}\r\n\r\nQuoteWidget.prototype.createSalesEntry = function (customer) {\r\n this.salesEntryService.create(customer).then(function (result) {\r\n return this.loadSalesEntries().then(function (salesEntries) {\r\n var salesEntry = this.model.get('salesEntryLookup')[result.message]\r\n this.view.trigger('forwardSalesEntryCreated', salesEntry)\r\n }.bind(this))\r\n }.bind(this), function (err) {\r\n console.error(err)\r\n this.view.trigger('forwardSalesEntryError')\r\n }.bind(this)).done()\r\n}\r\n\r\nQuoteWidget.prototype.printQuote = function (quoteId, quoteEntryId) {\r\n this.service.printQuote(quoteId, quoteEntryId)\r\n}\r\n\r\nQuoteWidget.prototype.saveAndPrint = function (quoteId, quoteEntryId, model) {\r\n this.update(quoteId, model, false).then(function (response) {\r\n this.printQuote(quoteId, response.message)\r\n }.bind(this)).done()\r\n}\r\n\r\nQuoteWidget.prototype.emailQuote = function (quoteId, quoteEntryId) {\r\n this.service.emailQuote(quoteId, quoteEntryId)\r\n}\r\n\r\nQuoteWidget.prototype.saveAndEmail = function (quoteId, quoteEntryId, model) {\r\n this.update(quoteId, model, false).then(function (response) {\r\n this.service.emailQuote(quoteId, quoteEntryId)\r\n }.bind(this)).done()\r\n}\r\n\r\nmodule.exports = QuoteWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"sales-entry\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"id\\\" class=\\\"id\\\" />\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Id\",\"inputName\":\"saleEntryId\",\"inputId\":\"id\",\"wrapperClasses\":\"autocomplete id-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Item Name\",\"inputName\":\"name\",\"inputId\":\"name\",\"wrapperClasses\":\"autocomplete name-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"currency-field\",\"inputLabel\":\"Unit Price\",\"inputName\":\"price\",\"inputId\":\"price\",\"wrapperClasses\":\"price-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputType\":\"number\",\"inputLabel\":\"Quantity\",\"inputName\":\"quantity\",\"inputId\":\"quantity\",\"wrapperClasses\":\"quantity-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputClasses\":\"currency-field\",\"inputLabel\":\"Gross Total\",\"inputName\":\"grossTotal\",\"inputId\":\"grossTotal\",\"wrapperClasses\":\"gross-total-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"currency-field\",\"inputLabel\":\"Discount $\",\"inputName\":\"discount\",\"inputId\":\"discount\",\"wrapperClasses\":\"discount-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputClasses\":\"currency-field\",\"inputLabel\":\"Total\",\"inputName\":\"total\",\"inputId\":\"total\",\"wrapperClasses\":\"total-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <i class=\\\"fa fa-close remove\\\"></i>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3 class=\\\"title\\\"></h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"side-by-side display-container\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Memorized Label\",\"inputName\":\"label\",\"inputId\":\"memorized-label\",\"wrapperClasses\":\"memorized-label\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Customer ID\",\"inputName\":\"customerIdSearch\",\"inputId\":\"customer-id-search\",\"wrapperClasses\":\"customer-id-search\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Customer Name\",\"inputName\":\"customerNameSearch\",\"inputId\":\"customer-name-search\",\"wrapperClasses\":\"customer-name-search\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"customerId\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"memorizationId\\\" />\\r\\n </div>\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Printed Name\",\"inputName\":\"printedName\",\"inputId\":\"printed-name\",\"wrapperClasses\":\"printed-name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Department\",\"inputName\":\"departmentName\",\"inputId\":\"department-name\",\"wrapperClasses\":\"department-name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"departmentId\\\">\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 1\",\"inputName\":\"addressLine1\",\"inputId\":\"address-line1\",\"wrapperClasses\":\"address-line1\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Address Line 2\",\"inputName\":\"addressLine2\",\"inputId\":\"address-line2\",\"wrapperClasses\":\"address-line2\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"city-state\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"City\",\"inputName\":\"city\",\"inputId\":\"city\",\"wrapperClasses\":\"city\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.stateSelect,depth0,{\"name\":\"stateSelect\",\"hash\":{\"inputId\":\"state\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Zip Code\",\"inputName\":\"postalCode\",\"inputId\":\"zipcode\",\"wrapperClasses\":\"zipcode\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <div class=\\\"side-by-side memo-info\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Date\",\"wrapperClasses\":\"quoteDate\",\"inputName\":\"date\",\"inputId\":\"quoteDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Good Through Date\",\"wrapperClasses\":\"dueDate\",\"inputName\":\"goodThroughDate\",\"inputId\":\"quoteDueDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Quote #\",\"wrapperClasses\":\"quoteNumber\",\"inputName\":\"quoteNumber\",\"inputId\":\"quoteNumber\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInputTaxRate,depth0,{\"name\":\"floatingInputTaxRate\",\"hash\":{\"wrapperClasses\":\"tax-rate-id-container\",\"inputLabel\":\"Tax Rate ID\",\"inputName\":\"rateId\",\"inputId\":\"tax-rate-id\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"wrapperClasses\":\"tax-rate-percentile-container\",\"inputLabel\":\"Tax Rate %\",\"inputName\":\"taxRate\",\"inputId\":\"tax-rate-percentile\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"taxRateId\\\" />\\r\\n </div>\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Terms\",\"inputName\":\"terms\",\"wrapperClasses\":\"terms\",\"inputId\":\"terms\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"PO/Ref#\",\"inputName\":\"purchaseOrderNumber\",\"wrapperClasses\":\"reference\",\"inputId\":\"reference\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.textarea,depth0,{\"name\":\"textarea\",\"hash\":{\"inputRows\":\"4\",\"inputLabel\":\"Memo\",\"inputName\":\"memo\",\"inputId\":\"memo\",\"wrapperClasses\":\"memo-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <div class=\\\"distribution item-list\\\">\\r\\n <h3>Itemization</h3>\\r\\n <div class=\\\"line-item-container forceLabelsOpen\\\">The quote currently has no sales items.</div>\\r\\n <button class=\\\"clickable-button add-more-line-items\\\" type=\\\"button\\\">+ Additional Sales Items</button>\\r\\n </div>\\r\\n <div class=\\\"review\\\">\\r\\n <h3>Review</h3>\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.textarea,depth0,{\"name\":\"textarea\",\"hash\":{\"inputRows\":\"7\",\"inputLabel\":\"Notes\",\"inputName\":\"notes\",\"inputId\":\"notes\",\"wrapperClasses\":\"notes-container\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"totals\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputClasses\":\"currency-field\",\"inputLabel\":\"Subtotal\",\"inputName\":\"subTotal\",\"inputId\":\"subTotal\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputClasses\":\"currency-field\",\"inputLabel\":\"Estimated Tax\",\"inputName\":\"estTax\",\"inputId\":\"estTax\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"isDisabled\":true,\"inputClasses\":\"currency-field\",\"inputLabel\":\"Quote Total\",\"inputName\":\"quoteTotal\",\"inputId\":\"quoteTotal\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <br>\\r\\n <button class=\\\"btn btn-primary memorize-button\\\">Memorize</button>\\r\\n <button class=\\\"btn btn-primary pull-right create-invoice\\\">Invoice</button>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Add Quote</button>\\r\\n <button class=\\\"btn btn-gray pull-right cancel\\\">Cancel</button>\\r\\n <button class=\\\"btn btn-danger pull-right decline\\\">Decline</button>\\r\\n <button class=\\\"btn btn-primary pull-right print-button\\\">Print</button>\\r\\n <button class=\\\"btn btn-primary pull-right email-button\\\">Email</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i\\r\\n class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Sales item must have a\\r\\n name.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var Backbone = require('backbone')\r\nvar CreateView = require('lists/list/create/view')\r\nvar CreateSalesEntryView = require('lists/sales-entry/create/view')\r\nvar Template = require('receivables/quotes/create/template')\r\nvar SalesEntryLine = require('receivables/quotes/create/line-item')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar Q = require('q')\r\nvar numbro = require('numbro')\r\nvar moment = require('moment')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar valid = $('<div class=\"bg-primary-lighter\" style=\"display: block;\"><i class=\"fa fa-check-circle fa-2x fa-inverse\"></i><span class=\"message\">Quote is valid.</span></div>')\r\nvar invalid = $('<div class=\"bg-danger-light\" style=\"display: block;\"><i class=\"fa fa-exclamation-circle fa-2x fa-inverse\"></i><span class=\"message\">Quote must have a printed name, quote number, quote date, due date, and at least one item.</span></div>')\r\n\r\nvar QuoteCreateView = CreateView.extend({\r\n className: 'block create',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'change input[type=file]': 'selectFile',\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'click': 'expand',\r\n 'click .add-more-line-items': 'addSalesEntry',\r\n 'click .memorize-button': 'memorize',\r\n 'click .taxRateClose': 'taxRateEmpty'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) {\r\n this.Template = Template\r\n }\r\n\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n\r\n var loadedData = Q.defer()\r\n var rendered = Q.defer()\r\n\r\n this.renderDeferral = rendered\r\n\r\n this.on('bindAutocomplete', function () {\r\n loadedData.resolve()\r\n })\r\n\r\n this.model.on('change:nextQuoteNumber', this.render, this)\r\n\r\n this.readyPromise = Q.all([rendered.promise, loadedData.promise])\r\n\r\n this.on('bindMemorizations', function () {\r\n this.bindMemorizations()\r\n }.bind(this))\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n this.determineStatus()\r\n this.renderDeferral.resolve()\r\n\r\n this.readyPromise.then(function () {\r\n // Sales tax autocomplete\r\n this.autoComplete(\r\n this.model.get('salesTaxRates'),\r\n 'rateId',\r\n this.$('input[name=rateId]'),\r\n this.salesTaxSelected.bind(this)\r\n )\r\n\r\n var customerList = this.model.get('customerList')\r\n var activeCustomerList = _.filter(customerList, ['isActive', true])\r\n\r\n this.autoComplete(\r\n _.filter(activeCustomerList, function (customer) {\r\n return customer.customerId\r\n }),\r\n 'customerId',\r\n this.$('input[name=customerIdSearch]'),\r\n this.customerSelected.bind(this)\r\n )\r\n\r\n this.autoComplete(\r\n activeCustomerList,\r\n 'name',\r\n this.$('input[name=customerNameSearch]'),\r\n this.customerSelected.bind(this)\r\n )\r\n\r\n var departmentList = this.model.get('departmentList')\r\n\r\n this.autoComplete(\r\n departmentList,\r\n 'name',\r\n this.$('input[name=departmentName]'),\r\n this.departmentSelected.bind(this),\r\n 'CREATENEW'\r\n )\r\n }.bind(this))\r\n\r\n if (this.model.get('quoteDate') && this.model.get('goodThroughDate')) {\r\n this.populateDates()\r\n }\r\n\r\n if (this.model.get('nextQuoteNumber')) {\r\n this.$('input[name=quoteNumber]')\r\n .val(this.model.get('nextQuoteNumber'))\r\n .parent()\r\n .addClass('open')\r\n }\r\n\r\n this.$('.line-item-container').html('')\r\n this.addSalesEntry()\r\n this.bindMemorizations()\r\n },\r\n\r\n setDates: function () {\r\n var startDate = new Date()\r\n var startDateUTC = new Date(startDate.getTime() + startDate.getTimezoneOffset() * 60000)\r\n var oneMonth = moment(startDateUTC).add(1, 'M')._d\r\n\r\n this.loadDates(startDateUTC, oneMonth, 'goodThroughDate')\r\n },\r\n\r\n taxRateEmpty: function (e) {\r\n e.preventDefault()\r\n e.stopPropagation()\r\n\r\n this.$('input[name=rateId]').val('')\r\n this.$('input[name=rateId]').attr('data-selection', '')\r\n this.$('input[name=rateId]').attr('data-selection-id', '')\r\n this.$('input[name=taxRate]').val('')\r\n this.recalculateAndSetSalesItem()\r\n },\r\n\r\n populateDates: function () {\r\n this.$('.date input:disabled').closest('.date').addClass('readonly').attr('readonly', 'readonly')\r\n\r\n // Quote Date\r\n this.$('.quoteDate .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('quoteDate').format(dateParams.format))\r\n .datepicker('setEndDate', this.model.get('goodThroughDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.dueDate .date').datepicker('setStartDate', e.date)\r\n this.$('.quoteDate .date').datepicker('hide', null)\r\n this.modified = true\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // Quote good through date\r\n this.$('.dueDate .date').datepicker(dateParams.params)\r\n .datepicker('setDate', this.model.get('goodThroughDate').format(dateParams.format))\r\n .datepicker('setStartDate', this.model.get('quoteDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.$('.quoteDate .date').datepicker('setEndDate', e.date)\r\n this.$('.dueDate .date').datepicker('hide', null)\r\n this.modified = true\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.recurring-start-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', moment().format(dateParams.format))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n },\r\n\r\n bindMemorizations: function () {\r\n this.autoComplete(\r\n this.model.get('memorizationList'),\r\n 'label',\r\n this.$('input[name=label]'),\r\n this.memorizationSelected.bind(this),\r\n 'CREATENEW'\r\n )\r\n },\r\n\r\n customerSelected: function (customer) {\r\n this.$('input[name=customerIdSearch]')\r\n .val(customer.customerId)\r\n .parent()\r\n .addClass('open')\r\n this.$('input[name=customerNameSearch]')\r\n .val(customer.name)\r\n .parent()\r\n .addClass('open')\r\n this.$('input[name=customerId]').val(customer.id)\r\n this.$('input[name=printedName]')\r\n .val(customer.printedName)\r\n .parent()\r\n .addClass('open')\r\n this.$('input[name=addressLine1]').val(customer.addressLine1).parent().addClass('open')\r\n this.$('input[name=addressLine2]').val(customer.addressLine2).parent().addClass('open')\r\n this.$('input[name=city]').val(customer.city).parent().addClass('open')\r\n this.$('select[name=state]').val(customer.state).parent().addClass('open')\r\n this.$('input[name=postalCode]').val(customer.postalCode).parent().addClass('open')\r\n\r\n if (customer.salesTax && customer.salesTax.salesTaxId) {\r\n var salesTaxRate = _.find(this.model.get('salesTaxRates'), { id: customer.salesTax.salesTaxId })\r\n this.salesTaxSelected(salesTaxRate)\r\n }\r\n\r\n if (customer.department) {\r\n this.$('input[name=departmentName]').val(customer.department.name).parent().addClass('open')\r\n this.$('input[name=departmentId]').val(customer.department.id)\r\n }\r\n },\r\n\r\n departmentSelected: function (department) {\r\n this.$('input[name=departmentName]').val(department.name).parent().addClass('open')\r\n this.$('input[name=departmentId]').val(department.id)\r\n },\r\n\r\n salesTaxSelected: function (salesTaxRate) {\r\n this.$('input[name=rateId]')\r\n .val(salesTaxRate.rateId)\r\n .parent()\r\n .addClass('open')\r\n this.$('input[name=taxRate]')\r\n .val(salesTaxRate.taxRate)\r\n .parent()\r\n .addClass('open')\r\n this.$('input[name=taxRateId]').val(salesTaxRate.id)\r\n this.recalculateAndSetSalesItem()\r\n },\r\n\r\n memorizationSelected: function (memorization) {\r\n if (typeof memorization === 'string') {\r\n memorization = _.find(this.model.get('memorizationList'), { id: memorization })\r\n }\r\n\r\n this.$('input[name=memorizationLabel]').val(memorization.label).closest('.floating').addClass('open')\r\n\r\n this.$('input[name=memorizationId]')\r\n .val(memorization.id)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n if (memorization.id === 'CREATENEW') {\r\n return\r\n }\r\n\r\n memorization.memorizationId = memorization.id\r\n\r\n if (memorization.customer) {\r\n memorization.customerIdSearch = memorization.customer.customerId\r\n memorization.customerNameSearch = memorization.customer.name\r\n }\r\n\r\n if (memorization.salesTax && memorization.salesTax.id) {\r\n memorization.rateId = memorization.salesTax.rateId\r\n memorization.taxRate = memorization.salesTax.taxRate\r\n memorization.taxRateId = memorization.salesTax.id\r\n }\r\n\r\n this.$('.is-recurring input').prop('checked', memorization.isRecurring)\r\n this.$('select[name=recurringFrequency]').val(memorization.recurringFrequency)\r\n\r\n this.$('.recurring-start-date .date')\r\n .datepicker('setDate', moment(memorization.recurringDate)._d)\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n _.each(this.$('input:not([type=file]), textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n if (!memorization[$el.attr('name')]) {\r\n return\r\n }\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var isDate = $el.closest('.form-material').hasClass('date')\r\n if (isCheckbox) {\r\n $el.prop('checked', memorization[$el.attr('name')])\r\n } else if (isDate) {\r\n $el.val(moment(memorization[$el.attr('name')]).format(dateParams.format)).closest('.floating').addClass('open')\r\n } else {\r\n $el.val(memorization[$el.attr('name')]).closest('.floating').addClass('open')\r\n }\r\n }.bind(this))\r\n\r\n this.$('.line-item-container').html('')\r\n _.forEach(memorization['lineItems'], function (lineItem) {\r\n var $saleEntry = this.addSalesEntry()\r\n $saleEntry.find('input[name=id]').val(lineItem.salesEntryId).parent().addClass('open')\r\n $saleEntry.find('input[name=price]').val(numbro(lineItem.price).formatCurrency('$0,0.00')).parent().addClass('open')\r\n $saleEntry.find('input[name=discount]').val(numbro(lineItem.discount).formatCurrency('$0,0.00')).parent().addClass('open')\r\n $saleEntry.find('input[name=quantity]').val(lineItem.quantity).parent().addClass('open')\r\n $saleEntry.find('input[name=saleEntryId]').val(lineItem.salesEntry.saleEntryId).parent().addClass('open')\r\n $saleEntry.find('input[name=name]').val(lineItem.salesEntry.name).parent().addClass('open')\r\n $saleEntry.recalculateAndSetSalesItem()\r\n }.bind(this))\r\n },\r\n\r\n addSalesEntry: function (id) {\r\n var index = this.$('.line-item-container > div').length + 1\r\n\r\n if (index === 1) {\r\n this.$('.line-item-container').html('')\r\n }\r\n\r\n var $lineItem = $(SalesEntryLine({ index: index, id: id }))\r\n this.$('.line-item-container').append($lineItem)\r\n this.OneUI($lineItem)\r\n\r\n if (index > 0) {\r\n $lineItem.find('.remove').on('click', function (e) {\r\n $lineItem.remove()\r\n\r\n if (!this.$('.line-item-container > div').length) {\r\n this.$('.line-item-container').html('The quote currently has no sales items.')\r\n }\r\n\r\n this.trigger('lineItemRemoved', $lineItem)\r\n this.recalculateAndSetSalesItem()\r\n }.bind(this))\r\n }\r\n\r\n $lineItem.find('input[name=discount]').val(0)\r\n $lineItem.find('input[name=quantity]').val(1)\r\n this.recalculateAndSetSalesItem($lineItem)\r\n\r\n var salesEntryList = this.model.get('salesEntryList')\r\n var sortedIdList = _.sortBy(salesEntryList, ['attributes.saleEntryId'])\r\n var sortedNameList = _.sortBy(salesEntryList, ['attributes.name'])\r\n\r\n var createNewSalesEntry = {\r\n id: 'CREATENEW',\r\n name: 'Create new',\r\n saleEntryId: 'Create new'\r\n }\r\n\r\n sortedIdList.noSort = true\r\n sortedIdList.unshift(createNewSalesEntry)\r\n sortedNameList.noSort = true\r\n sortedNameList.unshift(createNewSalesEntry)\r\n\r\n this.autoComplete(\r\n sortedIdList,\r\n 'saleEntryId',\r\n $lineItem.find('input[name=saleEntryId]'),\r\n _.partial(this.recalculateAndSetSalesItem.bind(this), $lineItem)\r\n )\r\n this.autoComplete(\r\n sortedNameList,\r\n 'name',\r\n $lineItem.find('input[name=name]'),\r\n _.partial(this.recalculateAndSetSalesItem.bind(this), $lineItem)\r\n )\r\n\r\n $lineItem.find('input[name=price],input[name=discount]')\r\n .on('keyup', _.partial(this.recalculateAndSetSalesItem.bind(this), $lineItem))\r\n\r\n $lineItem.find('input[name=quantity]')\r\n .on('keyup', function (event) {\r\n var value = parseInt($(event.currentTarget).val())\r\n\r\n if (value <= 0) {\r\n value = 1\r\n }\r\n\r\n $(event.currentTarget).val(value)\r\n\r\n this.recalculateAndSetSalesItem($lineItem)\r\n }.bind(this))\r\n\r\n $lineItem.find('input:first').focus()\r\n this.trigger('lineItemAdded', $lineItem)\r\n\r\n $lineItem.recalculateAndSetSalesItem = _.partial(this.recalculateAndSetSalesItem.bind(this), $lineItem)\r\n return $lineItem\r\n },\r\n\r\n recalculateAndSetSalesItem: function ($lineItem, salesEntry) {\r\n if ($lineItem) {\r\n if (salesEntry && !salesEntry.which) {\r\n if (salesEntry.id === 'CREATENEW') {\r\n this.showNewSalesEntry($lineItem, salesEntry)\r\n return\r\n }\r\n this.selectSalesEntry($lineItem, salesEntry)\r\n }\r\n var unitPrice = numbro().unformat($lineItem.find('input[name=price]').val())\r\n var quantity = $lineItem.find('input[name=quantity]').val()\r\n var discount = numbro().unformat($lineItem.find('input[name=discount]').val())\r\n if (discount > (unitPrice * quantity)) {\r\n discount = unitPrice * quantity\r\n $lineItem.find('input[name=discount]').val(numbro(discount).formatCurrency('$0,0.00'))\r\n }\r\n $lineItem.find('input[name=grossTotal]').val(numbro(Number(unitPrice * quantity)).formatCurrency('$0,0.00'))\r\n $lineItem.find('input[name=total]').val(numbro(Number((unitPrice * quantity) - discount)).formatCurrency('$0,0.00'))\r\n }\r\n\r\n this.determineStatus()\r\n\r\n var subTotal = _.reduce(this.$('.sales-entry'), function (memo, entry) {\r\n var $entry = $(entry)\r\n var total = numbro().unformat($entry.find('input[name=total]').val()) * 100\r\n return memo + total\r\n }, 0) / 100\r\n\r\n this.$('input[name=subTotal]').val(numbro(subTotal).formatCurrency('$0,0.00'))\r\n\r\n var salesTax = this.$('input[name=taxRate]').val()\r\n var estimatedTax = 0\r\n if (salesTax) {\r\n var taxRate = Number(salesTax)\r\n estimatedTax = subTotal * (taxRate / 100)\r\n }\r\n\r\n this.$('input[name=estTax]').val(numbro(estimatedTax).formatCurrency('$0,0.00')).parent().addClass('open')\r\n this.$('input[name=quoteTotal]').val(numbro(estimatedTax + subTotal).formatCurrency('$0,0.00'))\r\n },\r\n\r\n showNewSalesEntry: function ($lineItem, salesEntry) {\r\n var salesEntryModel = new Backbone.Model()\r\n salesEntryModel.toViewModel = salesEntryModel.toJSON.bind(salesEntryModel)\r\n salesEntryModel.set('vendorList', this.model.get('vendorList'))\r\n salesEntryModel.set('accountList', this.model.get('accountList'))\r\n var createSalesEntry = new CreateSalesEntryView({ model: salesEntryModel })\r\n createSalesEntry.render().$el.addClass('cross-list-modal sales-item-create expanded').appendTo('#main-container').modal('show')\r\n\r\n var closeCallback = function () {\r\n $('.modal-backdrop').remove()\r\n $('body').removeClass('modal-open')\r\n createSalesEntry.$el.remove()\r\n }\r\n\r\n createSalesEntry.on('create', function (model) {\r\n this.off('salesEntryCreated salesEntryError')\r\n this.once('salesEntryCreated', function (result) {\r\n this.recalculateAndSetSalesItem($lineItem, result)\r\n }.bind(this))\r\n this.once('salesEntryError salesEntryCreated', closeCallback.bind(this))\r\n this.trigger('createSalesEntry', model)\r\n }.bind(this))\r\n\r\n $('.modal-backdrop.in').on('click', closeCallback.bind(this))\r\n },\r\n\r\n selectSalesEntry: function ($lineItem, saleEntry) {\r\n $lineItem\r\n .find('input[name=saleEntryId]')\r\n .val(saleEntry['saleEntryId'])\r\n .parent()\r\n .addClass('open')\r\n $lineItem\r\n .find('input[name=name]')\r\n .val(saleEntry['name'])\r\n $lineItem\r\n .find('input[name=price]')\r\n .val(numbro(Number(saleEntry['price'])).formatCurrency('$0,0.00'))\r\n $lineItem\r\n .find('input[name=id]')\r\n .val(saleEntry['id'])\r\n },\r\n\r\n isValid: function () {\r\n return !!this.$('input[name=quoteNumber]').val() && !!this.$('input[name=goodThroughDate]').val() && !!this.$('input[name=date]').val() && !!this.$('input[name=printedName]').val() && !!this.getLineItems().length\r\n },\r\n\r\n determineStatus: function () {\r\n if (this.isValid()) {\r\n this.$('.status').html(valid)\r\n } else {\r\n this.$('.status').html(invalid)\r\n }\r\n },\r\n\r\n // This is a method used by the base class when a form is submitted on this view\r\n toJSON: function () {\r\n if (!this.isValid()) {\r\n this.determineStatus()\r\n throw new Error('Not valid')\r\n }\r\n\r\n var quoteEntry = {}\r\n var quote = {\r\n quoteEntry: quoteEntry\r\n }\r\n\r\n if (this.modified === false && this.model.get('selectedEntry')) {\r\n quoteEntry.id = this.model.get('selectedEntry').id\r\n quoteEntry.revision = this.model.get('selectedEntry').get('revision')\r\n }\r\n\r\n _.each(this.$('input:not([type=file]), textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n if ($el.hasClass('currency') || $el.hasClass('currency-field')) {\r\n elValue = numbro().unformat(elValue)\r\n }\r\n\r\n quoteEntry[$el.attr('name')] = elValue\r\n })\r\n\r\n quoteEntry['lineItems'] = this.getLineItems()\r\n\r\n if (quoteEntry.taxRateId) {\r\n quoteEntry.salesTax = { salesTaxId: quoteEntry.taxRateId }\r\n }\r\n if (quoteEntry.customerId) {\r\n quote.customerId = quoteEntry.customerId\r\n }\r\n quote.quoteNumber = Number(quoteEntry.quoteNumber)\r\n quote.notes = this.$('textarea[name=notes]').val()\r\n quoteEntry.notes = quote.notes\r\n\r\n return quote\r\n },\r\n\r\n memorize: function (e) {\r\n if (e) {\r\n e.preventDefault()\r\n }\r\n\r\n var quote = this.toJSON()\r\n var entry = quote.quoteEntry || quote\r\n\r\n if (entry.memorizationId === 'CREATENEW') {\r\n delete entry.memorizationId\r\n }\r\n\r\n if (entry.memorizationId) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'You will be overwriting any previously memorized information.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize', entry)\r\n }.bind(this))\r\n } else {\r\n this.$('.memorize-button').prop('disabled', true)\r\n this.trigger('memorize', entry)\r\n }\r\n },\r\n\r\n cancel: function (e) {\r\n this.render()\r\n this.collapse(e)\r\n },\r\n\r\n getLineItems: function () {\r\n return _.filter(_.map(this.$('.sales-entry'), function (salesEntryItem) {\r\n var $salesEntryItem = this.$(salesEntryItem)\r\n var id = $salesEntryItem.find('input[name=id]').val()\r\n var unitPrice = numbro().unformat($salesEntryItem.find('input[name=price]').val())\r\n var quantity = Number($salesEntryItem.find('input[name=quantity]').val())\r\n var discount = numbro().unformat($salesEntryItem.find('input[name=discount]').val())\r\n return {\r\n salesEntryId: id,\r\n price: unitPrice,\r\n quantity: quantity,\r\n discount: discount\r\n }\r\n }), function (item) {\r\n return item.salesEntryId\r\n })\r\n },\r\n\r\n showError: function (errorMessage) {\r\n this.$('.status').html(this.getErrorStatusBar(errorMessage))\r\n setTimeout(this.determineStatus.bind(this), 3000)\r\n },\r\n\r\n memBtnEnable: function () {\r\n this.$('.memorize-button').prop('disabled', false)\r\n }\r\n})\r\n\r\nmodule.exports = QuoteCreateView\r\n","'use strict'\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\nvar _ = require('lodash')\r\nvar QuoteEntry = require('receivables/quote/item/quote-entry')\r\nvar Backbone = require('backbone')\r\n\r\nvar QuoteEntries = Backbone.Collection.extend({model: QuoteEntry})\r\n\r\nvar Quote = ListEntry.extend({\r\n toViewModel: function () {\r\n var viewModel = Backbone.Model.prototype.toJSON.apply(this, arguments)\r\n\r\n if (viewModel.customer && viewModel.customer.toViewModel) {\r\n viewModel.customer = viewModel.customer.toViewModel()\r\n }\r\n\r\n if (viewModel.quoteEntry && viewModel.quoteEntry.toViewModel) {\r\n viewModel.quoteEntry = viewModel.quoteEntry.toViewModel()\r\n }\r\n\r\n return viewModel\r\n }\r\n}, {\r\n parse: function (json) {\r\n var highestRevision = null\r\n\r\n var quote = new Quote({\r\n id: json.id,\r\n canEmail: json.canEmail,\r\n hasInvoice: json.hasInvoice,\r\n quoteNumber: json.quoteNumber,\r\n notes: json.notes,\r\n isDeclined: json.isDeclined,\r\n customerId: json.customerId,\r\n quoteEntries: new QuoteEntries(_.reverse(_.map(json.quoteEntries, function (entry) {\r\n var quoteEntry = QuoteEntry.parse(entry)\r\n quoteEntry.set('quoteNumber', json.quoteNumber + '-' + quoteEntry.get('revision'))\r\n highestRevision = Math.max(highestRevision, entry.revision)\r\n return quoteEntry\r\n }))),\r\n quoteEntry: json.quoteEntry ? QuoteEntry.parse(json.quoteEntry) : null,\r\n customer: null,\r\n totalPrice: json.totalPrice,\r\n department: json.department\r\n })\r\n\r\n if (highestRevision === null) {\r\n var quoteEntry = quote.get('quoteEntry')\r\n quoteEntry.set('quoteNumber', json.quoteNumber + '-' + quoteEntry.get('revision'))\r\n highestRevision = Math.max(highestRevision, quoteEntry.get('revision'))\r\n quote.set('quoteRevision', quoteEntry.get('quoteNumber'))\r\n } else {\r\n quote.set('quoteRevision', quote.get('quoteNumber') + '-' + highestRevision)\r\n }\r\n\r\n quote.set('highestRevision', highestRevision)\r\n\r\n return quote\r\n }\r\n})\r\n\r\nmodule.exports = Quote\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression, alias4=container.lambda;\n\n return \"<div class=\\\"itemNumber\\\">\"\n + alias3(((helper = (helper = helpers.quoteRevision || (depth0 != null ? depth0.quoteRevision : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"quoteRevision\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"customer\\\">\"\n + alias3(alias4(((stack1 = (depth0 != null ? depth0.quoteEntry : depth0)) != null ? stack1.printedName : stack1), depth0))\n + \"</div>\\r\\n<div class=\\\"startDate\\\">\"\n + alias3(alias4(((stack1 = (depth0 != null ? depth0.quoteEntry : depth0)) != null ? stack1.shortDate : stack1), depth0))\n + \"</div>\\r\\n<div class=\\\"goodThroughDate\\\">\"\n + alias3(alias4(((stack1 = (depth0 != null ? depth0.quoteEntry : depth0)) != null ? stack1.shortGoodThroughDate : stack1), depth0))\n + \"</div>\\r\\n<div class=\\\"memo\\\">\"\n + alias3(alias4(((stack1 = (depth0 != null ? depth0.quoteEntry : depth0)) != null ? stack1.memo : stack1), depth0))\n + \"</div>\\r\\n<div class=\\\"total\\\">\"\n + alias3((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.totalPrice : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n <a href=\\\"#\\\" class=\\\"fa fa-search pull-right\\\" aria-hidden=\\\"true\\\"></a>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('receivables/quotes/item/template')\r\n\r\nvar QuoteView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n\r\n this.model.on('change:customer', function () {\r\n this.render()\r\n }.bind(this))\r\n },\r\n\r\n onRender: function () {\r\n if (this.model.get('isDeclined')) this.$el.addClass('notActive')\r\n }\r\n})\r\n\r\nmodule.exports = QuoteView\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Quotes</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"itemNumber\\\">Quote Number</div>\\r\\n <div class=\\\"customer\\\">Customer Name</div>\\r\\n <div class=\\\"startDate\\\">Dated</div>\\r\\n <div class=\\\"goodThroughDate\\\">Expiring</div>\\r\\n <div class=\\\"memo\\\">Memo</div>\\r\\n <div class=\\\"total\\\">Quote Total</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\"><p class=\\\"center\\\">Loading more quotes...</p></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('receivables/quotes/list/template')\r\nvar QuoteView = require('receivables/quotes/item/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\nvar QuoteListVist = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = QuoteView\r\n ListView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more quotes...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more quotes.')\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n }\r\n})\r\n\r\nmodule.exports = QuoteListVist\r\n","'use strict'\r\n\r\nvar Quote = require('receivables/quotes/item/quote')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar Quotes = ListWrapper.extend({\r\n childModel: Quote\r\n})\r\n\r\n\r\nmodule.exports = Quotes\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar QuotesService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nQuotesService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nQuotesService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'quotes'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nQuotesService.prototype.getEntry = function (quoteId, quoteEntryId) {\r\n var apiPath = this.GetPath(quoteId, 'quote-entries', quoteEntryId)\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nQuotesService.prototype.decline = function (modelId) {\r\n var apiPath = this.GetPath(modelId, 'decline')\r\n return this.restClient.put(apiPath)\r\n}\r\n\r\nQuotesService.prototype.getNextQuoteNumber = function () {\r\n var apiPath = this.GetPath('next-quote-number')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nQuotesService.prototype.printQuote = function (quoteId, quoteEntryId) {\r\n var apiPath = this.GetPath(quoteId, 'quote-entries', quoteEntryId, 'export')\r\n return this.restClient.download(apiPath)\r\n}\r\n\r\nQuotesService.prototype.emailQuote = function (quoteId, quoteEntryId) {\r\n var apiPath = this.GetPath(quoteId, 'quote-entries', quoteEntryId, 'email')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nmodule.exports = QuotesService\r\n","var ListContainer = require('lists/list/view')\r\nvar ListView = require('receivables/quotes/list/view')\r\nvar CreateView = require('receivables/quotes/create/view')\r\nvar _ = require('lodash')\r\n\r\nvar CustomersView = ListContainer.extend({\r\n className: 'quotes receivables list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n this.listView = new ListView({model: this.model})\r\n this.forwardEvents(this.listView)\r\n\r\n this.createView = new CreateView({model: this.model})\r\n this.forwardEvents(this.createView)\r\n\r\n this.on('created', function () {\r\n this.createView.trigger('resetInputs')\r\n }.bind(this))\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showQuote', model)\r\n }.bind(this))\r\n\r\n this.on('dataLoaded', function () {\r\n this.listView.trigger('bindScroll')\r\n // We're going to hijack this method here to load in our newly loaded data\r\n this.createView.onRender()\r\n this.createView.trigger('bindAutocomplete')\r\n this.createView.trigger('bindMemorizations')\r\n }.bind(this))\r\n\r\n this.on('memorizationsBind', function () {\r\n this.createView.trigger('bindMemorizations')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n\r\n this.on('forwardSalesEntryError', function () {\r\n _.partial(this.createView.trigger, 'salesEntryError').apply(this.createView, arguments)\r\n }.bind(this))\r\n\r\n this.on('forwardSalesEntryCreated', function () {\r\n _.partial(this.createView.trigger, 'salesEntryCreated').apply(this.createView, arguments)\r\n }.bind(this))\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n\r\n this.$el.append(this.createView.render().$el)\r\n this.$el.append(this.listView.render().$el)\r\n\r\n return this\r\n },\r\n\r\n getCreateView: function () {\r\n return this.createView\r\n },\r\n\r\n getListView: function () {\r\n return this.listView\r\n },\r\n\r\n showError: function (errorMessage) {\r\n this.createView.showError(errorMessage)\r\n },\r\n \r\n memBtnEnable: function () {\r\n this.$('.memorize-button').prop('disabled', false)\r\n }\r\n})\r\n\r\nmodule.exports = CustomersView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar Backbone = require('backbone')\r\nvar GenericListWidget = require('lists/list/widget')\r\nvar sweetAlert = require('sweetalert2')\r\nvar moment = require('moment')\r\n\r\nvar Quotes = require('receivables/quotes/quotes')\r\nvar Service = require('receivables/quotes/service')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar CustomerService = require('lists/customers/service')\r\nvar MemorizationService = require('memorization/quotes/service')\r\nvar SalesEntryService = require('lists/sales-entry/service')\r\nvar SalesTaxService = require('lists/sales-taxes/service')\r\nvar VendorService = require('lists/vendors/service')\r\nvar ListContainer = require('receivables/quotes/view')\r\nvar DepartmentService = require('lists/departments/service')\r\n\r\nvar QuotesWidget = function () {\r\n this.initialize()\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n\r\n this.load()\r\n this.bindEvents()\r\n}\r\n\r\nQuotesWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nQuotesWidget.prototype.initialize = function () {\r\n this.service = new Service()\r\n this.salesEntryService = new SalesEntryService()\r\n this.customerService = new CustomerService()\r\n if (!this.memorizationService) {\r\n this.memorizationService = new MemorizationService()\r\n }\r\n this.salesTaxService = new SalesTaxService()\r\n this.vendorService = new VendorService()\r\n this.accountService = new AccountService()\r\n this.departmentService = new DepartmentService()\r\n this.modelType = Quotes\r\n this.viewType = ListContainer\r\n}\r\n\r\nQuotesWidget.prototype.bindEvents = function () {\r\n this.model.on('add', function (child, collection, meta) {\r\n if (child.get('customerId')) {\r\n this.customerListPromise.then(function () {\r\n child.set('customer', this.model.get('customerLookup')[child.get('customerId')])\r\n }.bind(this))\r\n }\r\n }.bind(this))\r\n\r\n this.view.on('showQuote', this.showQuote, this)\r\n this.view.on('createSalesEntry', this.createSalesEntry, this)\r\n this.view.on('memorize', this.memorize, this)\r\n}\r\n\r\nQuotesWidget.prototype.load = function () {\r\n\r\n // Set quote default dates\r\n this.model.set({\r\n quoteDate: moment(),\r\n goodThroughDate: moment().add(1, 'M')\r\n })\r\n\r\n this.customerListPromise = this.customerService.getList().then(function (results) {\r\n this.model.set({\r\n customerList: results,\r\n customerLookup: _.keyBy(results, 'id')\r\n })\r\n }.bind(this))\r\n\r\n this.departmentListPromise = this.departmentService.getList().then(function (results) {\r\n this.model.set('departmentList', results)\r\n }.bind(this))\r\n\r\n this.salesEntryPromise = this.loadSalesEntries()\r\n\r\n this.salesTaxPromise = this.salesTaxService.getList().then(function (results) {\r\n this.model.set({\r\n salesTaxRates: results,\r\n salesTaxLookup: _.keyBy(results, 'id')\r\n })\r\n }.bind(this))\r\n\r\n var vendorListPromise = this.vendorService.getList().then(function (results) {\r\n this.model.set('vendorList', _.map(results, function (vendor) {\r\n vendor['fullName'] = vendor.firstName + ' ' + vendor.lastName\r\n return vendor\r\n }))\r\n }.bind(this))\r\n\r\n this.accountPromise = this.accountService.fetchAccounts().then(function (accounts) {\r\n this.model.set({\r\n accountList: _.map(accounts, function (account) { return account.toJSON() }),\r\n accountLookup: _.keyBy(this.model.get('accountList'), 'id')\r\n })\r\n\r\n return accounts\r\n }.bind(this))\r\n\r\n this.hasBeenShown = Q.defer()\r\n this.on('shown', function () {\r\n this.hasBeenShown.resolve()\r\n }.bind(this))\r\n\r\n if (this.service.getNextQuoteNumber) {\r\n this.nextNumberPromise = this.service.getNextQuoteNumber().then(function (result) {\r\n this.model.set('nextQuoteNumber', result.startingNumber)\r\n }.bind(this))\r\n\r\n this.view.on('created', function () {\r\n this.service.getNextQuoteNumber().then(function (result) {\r\n this.model.set('nextQuoteNumber', result.startingNumber)\r\n }.bind(this))\r\n }.bind(this))\r\n } else {\r\n this.nextNumberPromise = Q.defer()\r\n this.nextNumberPromise.resolve()\r\n }\r\n\r\n this.readyPromise = Q.all([\r\n this.hasBeenShown,\r\n this.customerListPromise,\r\n this.salesEntryPromise,\r\n this.salesTaxPromise,\r\n this.nextNumberPromise,\r\n this.accountPromise,\r\n vendorListPromise,\r\n this.departmentListPromise\r\n ]).then(this.loadMemorizations.bind(this)).then(function () {\r\n this.view.trigger('dataLoaded')\r\n }.bind(this))\r\n}\r\n\r\nQuotesWidget.prototype.loadMemorizations = function () {\r\n return this.memorizationService.getList().then(function (memorizations) {\r\n console.log(memorizations)\r\n\r\n _.each(memorizations, function (memorization) {\r\n var salesTaxId = (memorization.salesTax || {}).salesTaxId\r\n var customerId = memorization.customerId\r\n\r\n if (salesTaxId) {\r\n memorization.salesTax = this.model.get('salesTaxLookup')[salesTaxId]\r\n }\r\n\r\n if (customerId) {\r\n memorization.customer = this.model.get('customerLookup')[customerId]\r\n }\r\n\r\n _.each(memorization.lineItems, function (lineItem) {\r\n lineItem.salesEntry = this.model.get('salesEntryLookup')[lineItem.salesEntryId]\r\n return lineItem\r\n }.bind(this))\r\n }.bind(this))\r\n\r\n this.model.set({\r\n memorizationList: memorizations,\r\n memorizationLookup: _.keyBy(memorizations, 'id')\r\n })\r\n\r\n this.view.trigger('memorizationsBind')\r\n }.bind(this))\r\n}\r\n\r\nQuotesWidget.prototype.loadSalesEntries = function () {\r\n return this.salesEntryService.getList().then(function (results) {\r\n this.model.set('salesEntryList', results)\r\n this.model.set('salesEntryLookup', _.keyBy(results, 'id'))\r\n\r\n return results\r\n }.bind(this))\r\n}\r\n\r\nQuotesWidget.prototype.createSalesEntry = function (customer) {\r\n this.salesEntryService.create(customer).then(function (result) {\r\n return this.loadSalesEntries().then(function (salesEntries) {\r\n var salesEntry = this.model.get('salesEntryLookup')[result.message]\r\n this.view.trigger('forwardSalesEntryCreated', salesEntry)\r\n this.trigger('forwardSalesEntryCreated', salesEntry)\r\n }.bind(this))\r\n }.bind(this), function (err) {\r\n console.error(err)\r\n this.view.trigger('forwardSalesEntryError')\r\n this.trigger('forwardSalesEntryError')\r\n }.bind(this)).done()\r\n}\r\n\r\nQuotesWidget.prototype.showQuote = function (quote) {\r\n Backbone.trigger('app:navigate', 'receivables/quotes/' + quote.id)\r\n}\r\n\r\nQuotesWidget.prototype.memorize = function (receivable) {\r\n var deferral\r\n\r\n if (!receivable.label) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Please enter in a memorization label for this transaction',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6'\r\n })\r\n this.view.memBtnEnable()\r\n return\r\n }\r\n\r\n if (!receivable.customerId) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Please select a customer for this transaction',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6'\r\n })\r\n this.view.memBtnEnable()\r\n return\r\n }\r\n\r\n var receivableType = receivable.dueDate === undefined ? 'quote' : 'invoice'\r\n\r\n if (receivable.memorizationId) {\r\n deferral = this.memorizationService.update(receivable.memorizationId, receivable).then(function () {\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your ' + receivableType + ' has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationUpdated')\r\n }.bind(this))\r\n } else {\r\n deferral = this.memorizationService.create(receivable).then(function (response) {\r\n this.view.trigger('setMemorizationId', response.message)\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your ' + receivableType + ' has been memorized.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.trigger('memorizationCreated')\r\n }.bind(this))\r\n }\r\n\r\n deferral.fail(function (err) {\r\n this.view.showError(err.message)\r\n }.bind(this))\r\n\r\n this.view.memBtnEnable()\r\n deferral.then(this.loadMemorizations.bind(this))\r\n}\r\n\r\nQuotesWidget.prototype.getCreateView = function () {\r\n return this.view.getCreateView()\r\n}\r\n\r\nQuotesWidget.prototype.getListView = function () {\r\n return this.view.getListView()\r\n}\r\n\r\nmodule.exports = QuotesWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar QuotesWidget = require('receivables/quotes/widget')\r\nvar QuoteWidget = require('receivables/quote/widget')\r\nvar InvoicesWidget = require('receivables/invoices/widget')\r\nvar PaymentsWidget = require('receivables/payments/widget')\r\nvar DepositsWidget = require('receivables/deposits/widget')\r\n\r\nvar ListsRouter = Router.extend({\r\n routes: {\r\n 'receivables/quotes': 'showQuotes',\r\n 'receivables/quotes/:quoteId': 'showQuote',\r\n 'receivables/invoices': 'showInvoices',\r\n 'receivables/invoices/:invoiceId': 'showInvoices',\r\n 'receivables/payments': 'showPayments',\r\n 'receivables/deposits': 'showDeposits'\r\n },\r\n\r\n showQuotes: function () {\r\n Backbone.trigger('app:showInFrame', new QuotesWidget())\r\n Backbone.trigger('app:updateTitle', 'Quotes', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Receivables'}, {label: 'Quotes'}])\r\n },\r\n\r\n showInvoices: function (invoiceId) {\r\n var companyInfo = JSON.parse(localStorage.getItem('crunchedActiveCompanyInfo'))\r\n Backbone.trigger('app:showInFrame', new InvoicesWidget(undefined, invoiceId, companyInfo.paymentsEnabled))\r\n Backbone.trigger('app:updateTitle', 'Invoices', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Receivables'}, {label: 'Invoices'}])\r\n },\r\n\r\n showQuote: function (quoteId) {\r\n Backbone.trigger('app:showInFrame', new QuoteWidget(quoteId))\r\n Backbone.trigger('app:updateTitle', 'Quotes', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Receivables'}, {label: 'Quotes'}])\r\n },\r\n\r\n showPayments: function () {\r\n Backbone.trigger('app:showInFrame', new PaymentsWidget())\r\n Backbone.trigger('app:updateTitle', 'Payments', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Receivables'}, {label: 'Payments'}])\r\n },\r\n\r\n showDeposits: function () {\r\n Backbone.trigger('app:showInFrame', new DepositsWidget())\r\n Backbone.trigger('app:updateTitle', 'Deposits', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Receivables'}, {label: 'Deposits'}])\r\n }\r\n})\r\n\r\nmodule.exports = ListsRouter\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar RegistrationWidget = require('registration/registration-widget')\r\nvar SessionService = require('session/session-service')\r\n\r\nvar RegistrationRouter = Router.extend({\r\n routes: {\r\n 'registration?token=:token': 'showRegistrationWithToken',\r\n 'registration?referral=:referral': 'showRegistrationWithReferral',\r\n 'registration': 'showRegistration'\r\n },\r\n\r\n showRegistrationWithToken: function (token) {\r\n if (SessionService.isSessionActive()) {\r\n Backbone.trigger('app:navigate', '')\r\n return\r\n }\r\n Backbone.trigger('app:showInFrame', new RegistrationWidget(token, null))\r\n Backbone.trigger('app:updateTitle', 'Register', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Authentication'}, {label: 'Register', href: '/registration'}])\r\n },\r\n\r\n showRegistrationWithReferral: function (referral) {\r\n if (SessionService.isSessionActive()) {\r\n Backbone.trigger('app:navigate', '')\r\n return\r\n }\r\n Backbone.trigger('app:showInFrame', new RegistrationWidget(null, referral))\r\n Backbone.trigger('app:updateTitle', 'Register', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Authentication'}, {label: 'Register', href: '/registration'}])\r\n },\r\n\r\n showRegistration: function () {\r\n if (SessionService.isSessionActive()) {\r\n Backbone.trigger('app:navigate', '')\r\n return\r\n }\r\n Backbone.trigger('app:showInFrame', new RegistrationWidget(null))\r\n Backbone.trigger('app:updateTitle', 'Register', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Authentication'}, {label: 'Register', href: '/registration'}])\r\n }\r\n})\r\n\r\nmodule.exports = RegistrationRouter\r\n","'use strict'\r\n\r\nvar RestClient = require('rest/client')\r\nvar Config = require('config/config')\r\n\r\nvar RegistrationService = function () {\r\n this.client = new RestClient()\r\n}\r\n\r\nRegistrationService.prototype.register = function (registerData, token) {\r\n return this.client.post(Config['CRUNCHED_API_HOST'] + '/account/register',\r\n {\r\n emailAddress: registerData.email,\r\n password: registerData.password,\r\n firstName: registerData.firstName,\r\n lastName: registerData.lastName,\r\n state: registerData.state,\r\n phone: registerData.phoneNumber,\r\n referralCode: registerData.referralCode,\r\n token: token\r\n })\r\n}\r\n\r\nRegistrationService.prototype.registerToken = function (token) {\r\n return this.client.post(Config['CRUNCHED_API_HOST'] + '/account/register-token/' + token, { token: token })\r\n}\r\n\r\nRegistrationService.prototype.getEmailStatus = function (email) {\r\n return this.client.get(Config['CRUNCHED_API_HOST'] + '/account/email-status?email=' + email)\r\n}\r\n\r\nmodule.exports = RegistrationService\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar RegistrationTemplate = require('registration/registration')\r\nvar RegistrationService = require('registration/registration-service')\r\n\r\nvar oneDigitMessage = \"Passwords must have at least one digit ('0'-'9').\"\r\nvar oneUppercaseMessage = \"Passwords must have at least one uppercase ('A'-'Z').\"\r\nvar passwordLengthMessage = 'Your password must be at least 6 characters.'\r\nvar passwordRequired = 'The password field is required.'\r\nvar confirmPasswordUnmatch = 'These passwords don\\'t match. Please try again.'\r\n\r\nvar emailRequired = 'The email field is required.'\r\n\r\nvar emailAlreadyInUse = 'The email address you entered is already in use.'\r\nvar allFieldsRequired = 'All fields are required.'\r\nvar invalidInputForFirstName = 'Invalid input for your first name.'\r\nvar invalidInputForLastName = 'Invalid input for your last name.'\r\nvar invalidInputForPhone = 'Invalid input for your phone number.'\r\n\r\nvar RegistrationView = Backbone.View.extend({\r\n className: 'registration',\r\n\r\n events: {\r\n 'click .continue': 'continue',\r\n 'submit form': 'register',\r\n 'click .changeInfo': 'toggleContainer',\r\n 'change input, select': 'validateUserInfo',\r\n 'keyup input, select': 'validateUserInfo',\r\n 'focusout input, select': 'validateUserInfo'\r\n },\r\n\r\n initialize: function () {\r\n this.registrationService = new RegistrationService()\r\n this.on('failure', this.failure, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(RegistrationTemplate({\r\n referralCode: this.model.get('referralCode'),\r\n isEducationalLicense: this.model.get('isEducationalLicense')\r\n }))\r\n $('#page-container').attr('style', 'padding: 0 !important;')\r\n $('#sidebar, #header-navbar, #side-overlay, .content.bg-white.titlebar').attr('style', 'display:none;')\r\n this.$('#phone').mask('(999) 999-9999', {placeholder: ' '})\r\n this.$('.selectpicker').selectpicker({\r\n size: 5,\r\n dropupAuto: false,\r\n noneSelectedText: ''\r\n })\r\n\r\n if (this.model.get('referralCode') !== undefined && this.model.get('referralCode') !== null) {\r\n this.$('#referralCode').prop('disabled', 'disabled')\r\n }\r\n\r\n return this\r\n },\r\n\r\n validateUserInfo: function (event) {\r\n var containerDisplay = this.$('.registration-container').css('display')\r\n var passwordBlockDisplay = this.$('.registration-password').css('display')\r\n\r\n if (containerDisplay !== 'none' && passwordBlockDisplay === 'none') {\r\n var firstName = this.$('input#firstName').val()\r\n var lastName = this.$('input#lastName').val()\r\n var email = this.$('input#email').val()\r\n var phoneNumber = this.$('input#phone').val()\r\n var state = this.$('#state').val()\r\n var isCheckedForTerms = this.$('input#iAgreeCheckBox').prop('checked')\r\n\r\n if (state) {\r\n this.$('.stateList').addClass('open')\r\n } else {\r\n this.$('.stateList').removeClass('open')\r\n }\r\n\r\n var fieldNum = /^[a-zA-Z]+$/i\r\n var hasLetterForPhone = !!(/[a-zA-Z]+/g).exec(phoneNumber)\r\n\r\n var feedbackSummary = this.$('.validation-summary-errors').find('.errorMessage')\r\n\r\n this.$('.has-error').removeClass('has-error')\r\n feedbackSummary.empty()\r\n\r\n if (!firstName || !lastName || !email || !phoneNumber || !state || !isCheckedForTerms || !(firstName.match(fieldNum)) || !(lastName.match(fieldNum)) || !!hasLetterForPhone) {\r\n if (!firstName || !lastName || !email || !phoneNumber || !state || !isCheckedForTerms) {\r\n feedbackSummary.empty()\r\n feedbackSummary.append('<div>' + allFieldsRequired + '</div>')\r\n }\r\n if (!!firstName && !(firstName.match(fieldNum))) {\r\n feedbackSummary.empty()\r\n feedbackSummary.append('<div>' + invalidInputForFirstName + '</div>')\r\n this.$('input#firstName').parent().parent().addClass('has-error')\r\n }\r\n if (!!lastName && !(lastName.match(fieldNum))) {\r\n feedbackSummary.empty()\r\n feedbackSummary.append('<div>' + invalidInputForLastName + '</div>')\r\n this.$('input#lastName').parent().parent().addClass('has-error')\r\n }\r\n if (!!phoneNumber && !!hasLetterForPhone) {\r\n feedbackSummary.empty()\r\n feedbackSummary.append('<div>' + invalidInputForPhone + '</div>')\r\n this.$('input#phone').parent().parent().addClass('has-error')\r\n }\r\n } else {\r\n feedbackSummary.empty()\r\n }\r\n } else if (containerDisplay === 'none' && passwordBlockDisplay !== 'none') {\r\n var password = this.$('input#password').val()\r\n var confirmPassword = this.$('input#confirm-password').val()\r\n\r\n var hasNumbers = !!(/[0-9]+/g).exec(password)\r\n var hasUppercase = !!(/[A-Z]+/g).exec(password)\r\n\r\n this.$('.field-validation-error').empty()\r\n this.$('.has-error').removeClass('has-error')\r\n\r\n if (!password || password.length < 6 || !hasNumbers || !hasUppercase) {\r\n var passwordFeedbackField = this.$('input#password').parent().siblings('.field-validation-error')\r\n if (!password) {\r\n passwordFeedbackField.append('<div>' + passwordRequired + '</div>').parent().addClass('has-error')\r\n }\r\n if (password.length < 6) {\r\n passwordFeedbackField.append('<div>' + passwordLengthMessage + '</div>').parent().addClass('has-error')\r\n }\r\n if (!hasNumbers) {\r\n passwordFeedbackField.append('<div>' + oneDigitMessage + '</div>').parent().addClass('has-error')\r\n }\r\n if (!hasUppercase) {\r\n passwordFeedbackField.append('<div>' + oneUppercaseMessage + '</div>').parent().addClass('has-error')\r\n }\r\n } else if (!!confirmPassword && (confirmPassword !== password)) {\r\n var passwordConfirmFeedbackField = this.$('input#confirm-password').parent().siblings('.field-validation-error')\r\n passwordConfirmFeedbackField.append('<div>' + confirmPasswordUnmatch + '</div>').parent().addClass('has-error')\r\n }\r\n }\r\n },\r\n\r\n continue: function (event) {\r\n event.preventDefault()\r\n event.stopPropagation()\r\n\r\n var firstName = this.$('input#firstName').val()\r\n var lastName = this.$('input#lastName').val()\r\n var email = this.$('input#email').val()\r\n var phoneNumber = this.$('input#phone').val()\r\n var state = this.$('#state').val()\r\n var isCheckedForTerms = this.$('input#iAgreeCheckBox').prop('checked')\r\n\r\n var fieldNum = /^[a-zA-Z]+$/i\r\n var hasLetterForPhone = !!(/[a-zA-Z]+/g).exec(phoneNumber)\r\n\r\n var feedbackSummary = this.$('.validation-summary-errors').find('.errorMessage')\r\n\r\n this.validateUserInfo()\r\n this.isActive = ''\r\n this.registrationService.getEmailStatus(email).done(function (response) {\r\n this.isActive = response.isActive\r\n if (this.isActive) {\r\n feedbackSummary.empty()\r\n feedbackSummary.append('<div>' + emailAlreadyInUse + '</div>')\r\n }\r\n if (!this.isActive && !!firstName && !!lastName && !!email && !!phoneNumber && !!state && !!isCheckedForTerms && !!(firstName.match(fieldNum)) && !!(lastName.match(fieldNum)) && !hasLetterForPhone) {\r\n this.displayEmail()\r\n this.toggleContainer()\r\n }\r\n }.bind(this))\r\n },\r\n\r\n displayEmail: function () {\r\n var email = this.$('input#email').val()\r\n var emailContainer = this.$('.userEmailEnteredContainer').find('#userEmailEntered')\r\n emailContainer.empty()\r\n emailContainer.append(email)\r\n },\r\n\r\n toggleContainer: function () {\r\n this.$('.block').toggle()\r\n },\r\n\r\n register: function (event) {\r\n event.preventDefault()\r\n\r\n var firstName = this.$('input#firstName').val()\r\n var lastName = this.$('input#lastName').val()\r\n var email = this.$('input#email').val()\r\n var phoneNumber = this.$('input#phone').val()\r\n var state = this.$('#state').val()\r\n var referralCode = this.$('#referralCode').val()\r\n var isCheckedForTerms = this.$('input#iAgreeCheckBox').prop('checked')\r\n\r\n var password = this.$('input#password').val()\r\n var confirmPassword = this.$('input#confirm-password').val()\r\n\r\n var fieldNum = /^[a-zA-Z]+$/i\r\n var hasLetterForPhone = !!(/[a-zA-Z]+/g).exec(phoneNumber)\r\n\r\n var hasNumbers = !!(/[0-9]+/g).exec(password)\r\n var hasUppercase = !!(/[A-Z]+/g).exec(password)\r\n\r\n this.validateUserInfo()\r\n\r\n if (firstName && !!(firstName.match(fieldNum)) && lastName && !!(lastName.match(fieldNum)) && email && phoneNumber && !hasLetterForPhone &&\r\n state && isCheckedForTerms && password && password.length > 5 && confirmPassword && hasNumbers && hasUppercase && (confirmPassword === password)) {\r\n this.profileData = {\r\n email: email,\r\n firstName: firstName,\r\n lastName: lastName,\r\n phoneNumber: phoneNumber,\r\n state: state\r\n }\r\n\r\n this.registerData = {\r\n email: email,\r\n password: password,\r\n firstName: firstName,\r\n lastName: lastName,\r\n phoneNumber: phoneNumber,\r\n state: state,\r\n referralCode: referralCode\r\n }\r\n\r\n this.trigger('registerAndProfile', this.registerData, this.profileData, this)\r\n }\r\n },\r\n\r\n failure: function (message) {\r\n var feedbackSummary = this.$('.validation-summary-errors').find('.errorMessage').empty()\r\n feedbackSummary.append('<div>' + message + '</div>')\r\n }\r\n})\r\n\r\nmodule.exports = RegistrationView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Config = require('config/config')\r\nvar RegistrationView = require('registration/registration-view')\r\nvar RegistrationService = require('registration/registration-service')\r\nvar LoginService = require('login/service')\r\nvar SessionService = require('session/session-service')\r\n\r\nvar RegistrationWidget = function (token, referralCode) {\r\n this.registrationService = new RegistrationService()\r\n this.loginService = new LoginService()\r\n\r\n this.token = token\r\n this.model = new Backbone.Model()\r\n this.model.set('referralCode', referralCode)\r\n this.model.set('isEducationalLicense', Config['IS_EDUCATIONAL_LICENSE'])\r\n\r\n this.view = new RegistrationView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('registerAndProfile', this.registerAndProfile.bind(this))\r\n}\r\n\r\nRegistrationWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nRegistrationWidget.prototype.register = function (username, password, referral) {\r\n this.registrationService.register(username, password, this.token).then(function () {\r\n Backbone.trigger('app:navigate', 'login')\r\n }).fail(function (response) {\r\n this.view.trigger('failure', response.message || 'An error occured')\r\n }.bind(this))\r\n}\r\n\r\nRegistrationWidget.prototype.registerAndProfile = function (registerData, profileData) {\r\n this.userName = registerData.email\r\n this.password = registerData.password\r\n this.firstName = registerData.firstName\r\n\r\n return this.registrationService.register(registerData, this.token).done(function (response) {\r\n this.loginService.authenticate(this.userName, this.password).done(function (token) {\r\n SessionService.startSession(token, this.userName)\r\n return this.loginService.updateProfile(profileData).done(function () {\r\n Backbone.trigger('app:navigate', 'welcome')\r\n })\r\n }.bind(this))\r\n }.bind(this), function (response) {\r\n this.view.trigger('failure', response.message || 'An error occured.')\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = RegistrationWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <div class=\\\"form-group no-padding firstNameInputContainer\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"firstName\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"firstName\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"firstName\\\">First Name</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group no-padding lastNameInputContainer\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"lastName\\\" class=\\\"form-control\\\" name=\\\"lastName\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"lastName\\\">Last Name</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group no-padding emailInputContainer\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"email\\\" class=\\\"form-control\\\" name=\\\"email\\\" />\\r\\n <label class=\\\"control-label\\\" for=\\\"email\\\">Email Address</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group no-padding phoneNumInputContainer\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"phone\\\" class=\\\"js-masked-phone form-control\\\" type=\\\"text\\\" name=\\\"phoneNumber\\\" maxlength=\\\"10\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"phone\\\">Phone Number</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group no-padding stateContainer\\\">\\r\\n <div class=\\\"form-material floating stateList\\\">\\r\\n <select class=\\\"form-control selectpicker\\\" id=\\\"state\\\" name=\\\"StateCode\\\" data-container=\\\"body\\\">\\r\\n <option></option>\\r\\n <option value=\\\"AK\\\">Alaska (AK)</option>\\r\\n <option value=\\\"AL\\\">Alabama (AL)</option>\\r\\n <option value=\\\"AR\\\">Arkansas (AR)</option>\\r\\n <option value=\\\"AZ\\\">Arizona (AZ)</option>\\r\\n <option value=\\\"CA\\\">California (CA)</option>\\r\\n <option value=\\\"CO\\\">Colorado (CO)</option>\\r\\n <option value=\\\"CT\\\">Connecticut (CT)</option>\\r\\n <option value=\\\"DC\\\">District of Columbia (DC)</option>\\r\\n <option value=\\\"DE\\\">Delaware (DE)</option>\\r\\n <option value=\\\"FL\\\">Florida (FL)</option>\\r\\n <option value=\\\"GA\\\">Georgia (GA)</option>\\r\\n <option value=\\\"HI\\\">Hawaii (HI)</option>\\r\\n <option value=\\\"IA\\\">Iowa (IA)</option>\\r\\n <option value=\\\"ID\\\">Idaho (ID)</option>\\r\\n <option value=\\\"IL\\\">Illinois (IL)</option>\\r\\n <option value=\\\"IN\\\">Indiana (IN)</option>\\r\\n <option value=\\\"KS\\\">Kansas (KS)</option>\\r\\n <option value=\\\"KY\\\">Kentucky (KY)</option>\\r\\n <option value=\\\"LA\\\">Louisiana (LA)</option>\\r\\n <option value=\\\"MA\\\">Massachusetts (MA)</option>\\r\\n <option value=\\\"MD\\\">Maryland (MD)</option>\\r\\n <option value=\\\"ME\\\">Maine (ME)</option>\\r\\n <option value=\\\"MI\\\">Michigan (MI)</option>\\r\\n <option value=\\\"MN\\\">Minnesota (MN)</option>\\r\\n <option value=\\\"MO\\\">Missouri (MO)</option>\\r\\n <option value=\\\"MS\\\">Mississippi (MS)</option>\\r\\n <option value=\\\"MT\\\">Montana (MT)</option>\\r\\n <option value=\\\"NC\\\">North Carolina (NC)</option>\\r\\n <option value=\\\"ND\\\">North Dakota (ND)</option>\\r\\n <option value=\\\"NE\\\">Nebraska (NE)</option>\\r\\n <option value=\\\"NH\\\">New Hampshire (NH)</option>\\r\\n <option value=\\\"NJ\\\">New Jersey (NJ)</option>\\r\\n <option value=\\\"NM\\\">New Mexico (NM)</option>\\r\\n <option value=\\\"NV\\\">Nevada (NV)</option>\\r\\n <option value=\\\"NY\\\">New York (NY)</option>\\r\\n <option value=\\\"OH\\\">Ohio (OH)</option>\\r\\n <option value=\\\"OK\\\">Oklahoma (OK)</option>\\r\\n <option value=\\\"OR\\\">Oregon (OR)</option>\\r\\n <option value=\\\"PA\\\">Pennsylvania (PA)</option>\\r\\n <option value=\\\"RI\\\">Rhode Island (RI)</option>\\r\\n <option value=\\\"SC\\\">South Carolina (SC)</option>\\r\\n <option value=\\\"SD\\\">South Dakota (SD)</option>\\r\\n <option value=\\\"TN\\\">Tennessee (TN)</option>\\r\\n <option value=\\\"TX\\\">Texas (TX)</option>\\r\\n <option value=\\\"UT\\\">Utah (UT)</option>\\r\\n <option value=\\\"VA\\\">Virginia (VA)</option>\\r\\n <option value=\\\"VT\\\">Vermont (VT)</option>\\r\\n <option value=\\\"WA\\\">Washington (WA)</option>\\r\\n <option value=\\\"WI\\\">Wisconsin (WI)</option>\\r\\n <option value=\\\"WV\\\">West Virginia (WV)</option>\\r\\n <option value=\\\"WY\\\">Wyoming (WY)</option>\\r\\n <option value=\\\"OTHER\\\">OTHER</option>\\r\\n </select>\\r\\n <label class=\\\"stateLabel\\\" for=\\\"state\\\">State</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group no-padding referralCodeInputContainer\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"referralCode\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"referralCode\\\" maxlength=\\\"14\\\" value=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.referralCode || (depth0 != null ? depth0.referralCode : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"referralCode\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" />\\r\\n <label class=\\\"control-label\\\" for=\\\"referralCode\\\">Referral Code</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group checkBoxContainer\\\">\\r\\n <label class=\\\"css-input css-checkbox css-checkbox-primary\\\">\\r\\n <span style=\\\"margin-left: 5px;\\\">I agree to the <a href=\\\"http://crunched.io/terms-privacy\\\" target=\\\"_blank\\\"><span class=\\\"greenText\\\">Terms of Use</span></a> and <a href=\\\"http://crunched.io/terms-privacy\\\" target=\\\"_blank\\\"><span class=\\\"greenText\\\">Privacy Policy</span></a></span>\\r\\n <input type=\\\"checkbox\\\" id=\\\"iAgreeCheckBox\\\" name=\\\"iAgreeCheckBox\\\" />\\r\\n <span></span>\\r\\n </label>\\r\\n </div>\\r\\n <div class=\\\"form-group no-padding continueContainer\\\">\\r\\n <button class=\\\"btn btn-primary continue\\\">Continue</button>\\r\\n </div>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"screenTitle\\\">Cannot create account.</h3>\\r\\n <p class=\\\"titleHelpText\\\">Educational users are unable to create new accounts. Please speak with your administrator. <a href=\\\"/\\\">Return to Login</a></p>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block registration-container\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"col-xs-4 col-md-4 col-lg-4 textSection no-padding\\\">\\r\\n <div class=\\\"textContent\\\">\\r\\n <p class=\\\"headerText\\\">Get started in minutes</p>\\r\\n <p>Crunched gives you the ability to take control of your business operations by providing you with an easy to use, smart online accounting solution.</p>\\r\\n <p>Try if free for 30 days - No credit card required - Cancel anytime</p>\\r\\n </div>\\r\\n <div class=\\\"textContent\\\">\\r\\n <p class=\\\"footerText\\\">Are you an <span class=\\\"greenText\\\"><a href=\\\"https://www.crunched.io/partners\\\" target=\\\"_blank\\\">accountant</a></span> or <span class=\\\"greenText\\\"><a href=\\\"https://www.crunched.io/partners\\\" target=\\\"_blank\\\">bookkeeper</a>?</span></p>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"col-xs-8 col-md-8 col-lg-8 inputSection\\\">\\r\\n <form class=\\\"form-material\\\" role=\\\"form\\\">\\r\\n <span class=\\\"logo flex\\\">\\r\\n <img src=\\\"/img/crunched-logo-color.svg\\\" class=\\\"logoimageColor-login\\\" alt=\\\"/img/crunched-logo-color.svg\\\"> \\r\\n </span>\\r\\n <div class=\\\"text-danger help-block animated fadeInDown validation-summary-errors\\\">\\r\\n <div class=\\\"errorMessage\\\"></div>\\r\\n </div>\\r\\n\\r\\n\"\n + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </form>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block registration-password\\\" style=\\\"display:none;\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"col-xs-12 col-md-12 col-lg-12 inputSection\\\">\\r\\n <form class=\\\"form-material\\\" role=\\\"form\\\">\\r\\n <span class=\\\"logo flex\\\">\\r\\n <img src=\\\"/img/crunched-logo-color.svg\\\" class=\\\"logoimageColor-login\\\" alt=\\\"/img/crunched-logo-color.svg\\\"> \\r\\n </span>\\r\\n <div class=\\\"text-danger help-block animated fadeInDown validation-summary-errors\\\">\\r\\n <div class=\\\"errorMessage\\\"></div>\\r\\n </div> \\r\\n <div class=\\\"form-group no-padding createlabelText\\\">\\r\\n <p>We will create an account for</p>\\r\\n </div>\\r\\n <div class=\\\"form-group no-padding userEmailEnteredContainer flex\\\">\\r\\n <p id=\\\"userEmailEntered\\\"></p>\\r\\n <span class=\\\"changeInfo\\\"> (change)</span>\\r\\n </div> \\r\\n <div class=\\\"form-group no-padding headerForPassword\\\">\\r\\n <p>Setup your password</p>\\r\\n </div>\\r\\n <div class=\\\"form-group no-padding passwordInputContainer\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"password\\\" class=\\\"form-control\\\" type=\\\"password\\\" name=\\\"password\\\" />\\r\\n <label class=\\\"control-label\\\" for=\\\"password\\\">Password</label>\\r\\n </div>\\r\\n <div class=\\\"help-block text-right animated fadeInDown\\\"></div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-error\\\"></span>\\r\\n </div> \\r\\n <div class=\\\"form-group no-padding passwordConfirmInputContainer\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"confirm-password\\\" class=\\\"form-control\\\" type=\\\"password\\\" name=\\\"confirm-password\\\" />\\r\\n <label class=\\\"control-label\\\" for=\\\"confirm-password\\\">Confirm Password</label>\\r\\n </div>\\r\\n <div class=\\\"help-block text-right animated fadeInDown\\\"></div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-error\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group no-padding submit\\\">\\r\\n <button type=\\\"submit\\\" class=\\\"btn btn-primary submit\\\">Create Account</button>\\r\\n </div>\\r\\n </form> \\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"no-padding registration-footer\\\" style=\\\"text-align: center;\\\">\\r\\n <p><a href=\\\"/login\\\">Already have an account?</a></p>\\r\\n <p> © Crunched, Inc. 2017</p>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"name\\\"><strong>\"\n + alias3(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</strong></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.payables : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row companyTotal\\\">\\r\\n <div class=\\\"text-right totalLabel\\\">Total: </div>\\r\\n <div class=\\\"currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.openTotal : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.openTotalThirty : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.openTotalSixty : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.openTotalNinety : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.openTotalNinetyExtended : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow accountBuffer flex\\\"></div>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountTransaction flex\\\">\\r\\n <div class=\\\"number invoiceNumber\\\">\"\n + alias4(((helper = (helper = helpers.invoiceNumber || (depth0 != null ? depth0.invoiceNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"invoiceNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"date invoiceDate\\\">\"\n + alias4(((helper = (helper = helpers.invoiceDate || (depth0 != null ? depth0.invoiceDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"invoiceDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"date dueDate\\\">\"\n + alias4(((helper = (helper = helpers.dueDate || (depth0 != null ? depth0.dueDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"dueDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.openAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + ((stack1 = (helpers.if_gteq_lteq || (depth0 && depth0.if_gteq_lteq) || alias2).call(alias1,0,30,(depth0 != null ? depth0.aging : depth0),{\"name\":\"if_gteq_lteq\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.program(10, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + ((stack1 = (helpers.if_gteq_lteq || (depth0 && depth0.if_gteq_lteq) || alias2).call(alias1,31,61,(depth0 != null ? depth0.aging : depth0),{\"name\":\"if_gteq_lteq\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.program(10, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + ((stack1 = (helpers.if_gteq_lteq || (depth0 && depth0.if_gteq_lteq) || alias2).call(alias1,61,90,(depth0 != null ? depth0.aging : depth0),{\"name\":\"if_gteq_lteq\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.program(10, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + ((stack1 = (helpers.if_gt || (depth0 && depth0.if_gt) || alias2).call(alias1,(depth0 != null ? depth0.aging : depth0),90,{\"name\":\"if_gt\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.program(10, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n return container.escapeExpression((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.openAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \" \";\n},\"10\":function(container,depth0,helpers,partials,data) {\n return \" - \";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report as of\",\"inputId\":\"end-date\",\"wrapperClasses\":\"end-date\",\"inputName\":\"endDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"apaReport reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"number invoiceNumber\\\">Invoice #</div>\\r\\n <div class=\\\"date invoiceDate\\\">Invoice Date <i class=\\\"fa fa-sort-\"\n + alias4(((helper = (helper = helpers.sort || (depth0 != null ? depth0.sort : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"sort\",\"hash\":{},\"data\":data}) : helper)))\n + \" history-sort-toggle\\\"></i></div>\\r\\n <div class=\\\"date dueDate\\\">Due Date <i class=\\\"fa fa-sort-\"\n + alias4(((helper = (helper = helpers.sort || (depth0 != null ? depth0.sort : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"sort\",\"hash\":{},\"data\":data}) : helper)))\n + \" history-sort-toggle\\\"></i></div>\\r\\n <div class=\\\"currency\\\">Open Amount</div>\\r\\n <div class=\\\"currency\\\">0-30 Days</div>\\r\\n <div class=\\\"currency\\\">31-60 Days</div>\\r\\n <div class=\\\"currency\\\">61-90 Days</div>\\r\\n <div class=\\\"currency\\\" style=\\\"padding-right: 15px;\\\">Over 90</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.items : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row\\\">\\r\\n <div class=\\\"text-right totalLabel\\\">Grand Total: </div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandOpenTotal : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandOpenTotalThirty : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandOpenTotalSixty : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandOpenTotalNinety : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandOpenTotalExtended : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div> \\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar Template = require('reports/accounts-payable-aging/template')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar AccountsPayableAgingReportView = Backbone.View.extend({\r\n\r\n events: {\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.createViewModel()))\r\n\r\n $('.datepicker').remove()\r\n\r\n this.$('.form-material.date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('dateSelected', this.model.get('endDate'))\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.form-material.date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n var report = this.model.get('report')\r\n\r\n return {\r\n items: report.items,\r\n companyName: report.companyName,\r\n endDate: moment(report.endDate),\r\n sort: report.sort,\r\n isAccrual: report.isAccrual,\r\n grandOpenTotal: report.openTotal,\r\n grandOpenTotalThirty: report.openTotalThirty,\r\n grandOpenTotalSixty: report.openTotalSixty,\r\n grandOpenTotalNinety: report.openTotalNinety,\r\n grandOpenTotalExtended: report.openTotalNinetyExtended\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n\r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').items.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n\r\n ribbon: function (message) {\r\n return RibbonTemplate({ message: message })\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').items.length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = AccountsPayableAgingReportView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar AccountsPayableAgingReportView = require('reports/accounts-payable-aging/view')\r\nvar ReportService = require('reports/report-service')\r\n\r\nvar AccountsPayableAgingReportWidget = function () {\r\n this.model = new Backbone.Model({\r\n endDate: moment().endOf('month')\r\n })\r\n this.reportService = new ReportService()\r\n this.view = new AccountsPayableAgingReportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('dateSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', function () {\r\n this.updateReport(this.model.get('endDate'))\r\n }.bind(this))\r\n \r\n this.fetchReport()\r\n}\r\n\r\nAccountsPayableAgingReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nAccountsPayableAgingReportWidget.prototype.fetchReport = function () {\r\n this.reportService.fetchAccountsPayableAgingReport().then(function (report) {\r\n this.model.set({\r\n report: report,\r\n sort: report.sort\r\n })\r\n if (report.items.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nAccountsPayableAgingReportWidget.prototype.updateReport = function (endDate) {\r\n this.reportService.fetchAccountsPayableAgingReport(new Date(endDate), this.model.get('sort')).then(function (report) {\r\n this.model.set('report', report)\r\n if (report.items.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nAccountsPayableAgingReportWidget.prototype.downloadReport = function () {\r\n this.reportService.downloadAccountsPayableAgingReport(this.model.get('endDate'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = AccountsPayableAgingReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"name\\\"><strong>\"\n + alias3(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</strong></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.invoices : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row companyTotal\\\">\\r\\n <div class=\\\"text-right totalLabel\\\">Total: </div>\\r\\n <div class=\\\"currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.openTotal : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.openTotalThirty : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.openTotalSixty : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.openTotalNinety : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.openTotalNinetyExtended : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow accountBuffer flex\\\"></div>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountTransaction flex\\\">\\r\\n <div class=\\\"number invoiceNumber\\\">\"\n + alias4(((helper = (helper = helpers.invoiceNumber || (depth0 != null ? depth0.invoiceNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"invoiceNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"date invoiceDate\\\">\"\n + alias4(((helper = (helper = helpers.invoiceDate || (depth0 != null ? depth0.invoiceDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"invoiceDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"date dueDate\\\">\"\n + alias4(((helper = (helper = helpers.dueDate || (depth0 != null ? depth0.dueDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"dueDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.openAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + ((stack1 = (helpers.if_gteq_lteq || (depth0 && depth0.if_gteq_lteq) || alias2).call(alias1,0,30,(depth0 != null ? depth0.aging : depth0),{\"name\":\"if_gteq_lteq\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.program(10, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + ((stack1 = (helpers.if_gteq_lteq || (depth0 && depth0.if_gteq_lteq) || alias2).call(alias1,31,61,(depth0 != null ? depth0.aging : depth0),{\"name\":\"if_gteq_lteq\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.program(10, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + ((stack1 = (helpers.if_gteq_lteq || (depth0 && depth0.if_gteq_lteq) || alias2).call(alias1,61,90,(depth0 != null ? depth0.aging : depth0),{\"name\":\"if_gteq_lteq\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.program(10, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + ((stack1 = (helpers.if_gt || (depth0 && depth0.if_gt) || alias2).call(alias1,(depth0 != null ? depth0.aging : depth0),90,{\"name\":\"if_gt\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.program(10, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n return container.escapeExpression((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.openAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \" \";\n},\"10\":function(container,depth0,helpers,partials,data) {\n return \" - \";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report End\",\"inputId\":\"end-date\",\"wrapperClasses\":\"end-date\",\"inputName\":\"endDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"araReport reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"number invoiceNumber\\\">Invoice #</div>\\r\\n <div class=\\\"date invoiceDate\\\">Invoice Date <i class=\\\"fa fa-sort-\"\n + alias4(((helper = (helper = helpers.sort || (depth0 != null ? depth0.sort : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"sort\",\"hash\":{},\"data\":data}) : helper)))\n + \" history-sort-toggle\\\"></i></div>\\r\\n <div class=\\\"date dueDate\\\">Due Date <i class=\\\"fa fa-sort-\"\n + alias4(((helper = (helper = helpers.sort || (depth0 != null ? depth0.sort : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"sort\",\"hash\":{},\"data\":data}) : helper)))\n + \" history-sort-toggle\\\"></i></div>\\r\\n <div class=\\\"currency\\\">Open Amount</div>\\r\\n <div class=\\\"currency\\\">0-30 Days</div>\\r\\n <div class=\\\"currency\\\">31-60 Days</div>\\r\\n <div class=\\\"currency\\\">61-90 Days</div>\\r\\n <div class=\\\"currency\\\" style=\\\"padding-right: 15px;\\\">Over 90</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.items : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row\\\">\\r\\n <div class=\\\"text-right totalLabel\\\">Grand Total: </div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandOpenTotal : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandOpenTotalThirty : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandOpenTotalSixty : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandOpenTotalNinety : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandOpenTotalExtended : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar Template = require('reports/accounts-receivable-aging/template')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar AccountsReceivableAgingReportView = Backbone.View.extend({\r\n\r\n events: {\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.createViewModel()))\r\n\r\n $('.datepicker').remove()\r\n\r\n this.$('.form-material.date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('dateSelected')\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.form-material.date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n var report = this.model.get('report')\r\n\r\n return {\r\n items: report.items,\r\n companyName: report.companyName,\r\n endDate: moment(report.endDate),\r\n sort: report.sort,\r\n isAccrual: report.isAccrual,\r\n grandOpenTotal: report.openTotal,\r\n grandOpenTotalThirty: report.openTotalThirty,\r\n grandOpenTotalSixty: report.openTotalSixty,\r\n grandOpenTotalNinety: report.openTotalNinety,\r\n grandOpenTotalExtended: report.openTotalNinetyExtended\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n\r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').items.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n\r\n ribbon: function (message) {\r\n return RibbonTemplate({ message: message })\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').items.length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = AccountsReceivableAgingReportView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar AccountsReceivableAgingReportView = require('reports/accounts-receivable-aging/view')\r\nvar ReportService = require('reports/report-service')\r\n\r\nvar AccountsReceivableAgingReportWidget = function () {\r\n this.model = new Backbone.Model({\r\n endDate: moment().endOf('month')\r\n })\r\n this.reportService = new ReportService()\r\n this.view = new AccountsReceivableAgingReportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('dateSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', function () {\r\n this.updateReport(this.model.get('endDate'))\r\n }.bind(this))\r\n\r\n this.fetchReport()\r\n}\r\n\r\nAccountsReceivableAgingReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nAccountsReceivableAgingReportWidget.prototype.fetchReport = function () {\r\n this.reportService.fetchAccountsReceivableAgingReport().then(function (report) {\r\n this.model.set('report', report)\r\n if (report.items.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nAccountsReceivableAgingReportWidget.prototype.updateReport = function () {\r\n this.reportService.fetchAccountsReceivableAgingReport(this.model.get('endDate'), this.model.get('sort')).then(function (report) {\r\n this.model.set('report', report)\r\n if (report.items.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nAccountsReceivableAgingReportWidget.prototype.downloadReport = function () {\r\n this.reportService.downloadAccountsReceivableAgingReport(this.model.get('endDate'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = AccountsReceivableAgingReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = (helpers.if_eq || (depth0 && depth0.if_eq) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.reportingCategory : depth0),\"Uncategorized\",{\"name\":\"if_eq\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"7\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \" <div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12 uncategorized-block\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"balanceSheetReport reportData\\\">\\r\\n <div class=\\\"itemrow flex uncatagorized-total\\\">\\r\\n <div class=\\\"col-lg-6 col-md-6 col-xs-6 uncatagorized-title\\\"><strong>**\"\n + alias3(((helper = (helper = helpers.reportingCategory || (depth0 != null ? depth0.reportingCategory : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"reportingCategory\",\"hash\":{},\"data\":data}) : helper)))\n + \"**</strong></div>\\r\\n <div class=\\\"col-lg-2 col-md-2 col-xs-2 dollar-sign\\\"><strong>$</strong></div>\\r\\n <div class=\\\"col-lg-1 col-md-1 col-xs-1 currency\\\"><strong><span>\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.endingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></strong></div> \\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.accounts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n var alias1=container.lambda, alias2=container.escapeExpression;\n\n return \" <div class=\\\"itemrow flex uncatagorized-account\\\">\\r\\n <div class=\\\"col-lg-1 col-md-1 col-xs-1\\\"></div>\\r\\n <div class=\\\"col-lg-1 col-md-1 col-xs-1 account-number\\\">\"\n + alias2(alias1((depth0 != null ? depth0.accountNumber : depth0), depth0))\n + \"</div>\\r\\n <div class=\\\"col-lg-1 col-md-1 col-xs-1\\\"></div>\\r\\n <div class=\\\"col-lg-3 col-md-3 col-xs-3\\\">\"\n + alias2(alias1((depth0 != null ? depth0.accountName : depth0), depth0))\n + \"</div>\\r\\n <div class=\\\"col-lg-1 col-md-1 col-xs-1\\\">\"\n + alias2(alias1((depth0 != null ? depth0.accountType : depth0), depth0))\n + \"</div>\\r\\n <div class=\\\"col-lg-1 col-md-1 col-xs-1\\\"></div> \\r\\n <div class=\\\"col-lg-1 col-md-1 col-xs-1 currency\\\"><span>\"\n + alias2((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.endingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></div>\\r\\n </div>\\r\\n\";\n},\"10\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1;\n\n return ((stack1 = (helpers.if_eq_or_3arg || (depth0 && depth0.if_eq_or_3arg) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.reportingCategory : depth0),\"Current Assets\",\"Fixed Assets\",\"Other Assets\",{\"name\":\"if_eq_or_3arg\",\"hash\":{},\"fn\":container.program(11, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"11\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {};\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"categoryGroupName\\\"><strong>\"\n + alias2(alias1((depth0 != null ? depth0.reportingCategory : depth0), depth0))\n + \"</strong></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias3,(depth0 != null ? depth0.accounts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(12, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row-group\\\">\\r\\n <div class=\\\"col-xs-9 totalGroupLabel\\\">Total \"\n + alias2(alias1((depth0 != null ? depth0.reportingCategory : depth0), depth0))\n + \"</div>\\r\\n <div class=\\\"col-xs-1 dollar-sign\\\"></div>\\r\\n <div class=\\\"col-xs-2 totalGroupBalance currency\\\">\"\n + alias2((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || helpers.helperMissing).call(alias3,(depth0 != null ? depth0.endingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow flex\\\"></div>\\r\\n\";\n},\"12\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=container.escapeExpression, alias2=depth0 != null ? depth0 : {}, alias3=helpers.helperMissing;\n\n return \" <div class=\\\"itemrow flex\\\">\\r\\n <div class=\\\"col-xs-9\\\">\"\n + alias1(container.lambda((depth0 != null ? depth0.accountName : depth0), depth0))\n + \"</div>\\r\\n <div class=\\\"col-xs-1 dollar-sign\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias2,(helpers.or || (depth0 && depth0.or) || alias3).call(alias2,(helpers.eq || (depth0 && depth0.eq) || alias3).call(alias2,(depths[1] != null ? depths[1].reportingCategory : depths[1]),\"Current Assets\",{\"name\":\"eq\",\"hash\":{},\"data\":data}),(helpers.and || (depth0 && depth0.and) || alias3).call(alias2,(helpers.eq || (depth0 && depth0.eq) || alias3).call(alias2,(depths[1] != null ? depths[1].reportingCategory : depths[1]),\"Fixed Assets\",{\"name\":\"eq\",\"hash\":{},\"data\":data}),(depths[2] != null ? depths[2].firstSignShownFA : depths[2]),{\"name\":\"and\",\"hash\":{},\"data\":data}),{\"name\":\"or\",\"hash\":{},\"data\":data}),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(13, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers[\"if\"].call(alias2,(helpers.and || (depth0 && depth0.and) || alias3).call(alias2,(helpers.eq || (depth0 && depth0.eq) || alias3).call(alias2,(depths[1] != null ? depths[1].reportingCategory : depths[1]),\"Other Assets\",{\"name\":\"eq\",\"hash\":{},\"data\":data}),(depths[2] != null ? depths[2].firstSignShownOA : depths[2]),{\"name\":\"and\",\"hash\":{},\"data\":data}),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(13, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \\r\\n </div>\\r\\n <div class=\\\"col-xs-2 currency\\\">\"\n + alias1((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias3).call(alias2,(depth0 != null ? depth0.endingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"13\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" \"\n + ((stack1 = (helpers.if_eq || (depth0 && depth0.if_eq) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(data && data.index),0,{\"name\":\"if_eq\",\"hash\":{},\"fn\":container.program(14, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n\";\n},\"14\":function(container,depth0,helpers,partials,data) {\n return \"$\";\n},\"16\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1;\n\n return ((stack1 = (helpers.if_eq_or_2arg || (depth0 && depth0.if_eq_or_2arg) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.reportingCategory : depth0),\"Current Liabilities\",\"Other Liabilities\",{\"name\":\"if_eq_or_2arg\",\"hash\":{},\"fn\":container.program(17, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"17\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {};\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"categoryGroupName\\\"><strong>\"\n + alias2(alias1((depth0 != null ? depth0.reportingCategory : depth0), depth0))\n + \"</strong></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias3,(depth0 != null ? depth0.accounts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(18, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row-group\\\">\\r\\n <div class=\\\"col-xs-9 totalGroupLabel\\\">Total \"\n + alias2(alias1((depth0 != null ? depth0.reportingCategory : depth0), depth0))\n + \"</div>\\r\\n <div class=\\\"col-xs-1 dollar-sign\\\"></div>\\r\\n <div class=\\\"col-xs-2 totalGroupBalance currency\\\">\"\n + alias2((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || helpers.helperMissing).call(alias3,(depth0 != null ? depth0.endingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow flex\\\"></div>\\r\\n\";\n},\"18\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=container.escapeExpression, alias2=depth0 != null ? depth0 : {}, alias3=helpers.helperMissing;\n\n return \" <div class=\\\"itemrow flex\\\">\\r\\n <div class=\\\"col-xs-9\\\">\"\n + alias1(container.lambda((depth0 != null ? depth0.accountName : depth0), depth0))\n + \"</div>\\r\\n <div class=\\\"col-xs-1 dollar-sign\\\"> \\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias2,(helpers.or || (depth0 && depth0.or) || alias3).call(alias2,(helpers.eq || (depth0 && depth0.eq) || alias3).call(alias2,(depths[1] != null ? depths[1].reportingCategory : depths[1]),\"Current Liabilities\",{\"name\":\"eq\",\"hash\":{},\"data\":data}),(depths[2] != null ? depths[2].firstSignShownOtherLiability : depths[2]),{\"name\":\"or\",\"hash\":{},\"data\":data}),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(19, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"col-xs-2 currency\\\">\"\n + alias1((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias3).call(alias2,(depth0 != null ? depth0.endingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"19\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" \"\n + ((stack1 = (helpers.if_eq || (depth0 && depth0.if_eq) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(data && data.index),0,{\"name\":\"if_eq\",\"hash\":{},\"fn\":container.program(14, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n\";\n},\"21\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"itemrow flex totals-row\\\">\\r\\n <div class=\\\"col-xs-9 totalLabel\\\">Total Liabilities</div>\\r\\n <div class=\\\"col-xs-1 dollar-sign-liabilityTotal\\\"></div>\\r\\n <div class=\\\"col-xs-2 totalBalance-liabilityTotal currency\\\">\"\n + container.escapeExpression((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.liabilitiesEndingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div> \\r\\n <div class=\\\"itemrow flex\\\"></div>\\r\\n\";\n},\"23\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1;\n\n return ((stack1 = (helpers.if_eq || (depth0 && depth0.if_eq) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.reportingCategory : depth0),\"Equity\",{\"name\":\"if_eq\",\"hash\":{},\"fn\":container.program(24, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"24\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {};\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"categoryGroupName\\\"><strong>\"\n + alias2(alias1((depth0 != null ? depth0.reportingCategory : depth0), depth0))\n + \"</strong></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias3,(depth0 != null ? depth0.accounts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(25, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row-group\\\">\\r\\n <div class=\\\"col-xs-9 totalGroupLabel\\\">Total \"\n + alias2(alias1((depth0 != null ? depth0.reportingCategory : depth0), depth0))\n + \"</div>\\r\\n <div class=\\\"col-xs-1 dollar-sign\\\"></div>\\r\\n <div class=\\\"col-xs-2 totalGroupBalance currency\\\">\"\n + alias2((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || helpers.helperMissing).call(alias3,(depth0 != null ? depth0.endingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow flex\\\"></div>\\r\\n\";\n},\"25\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=container.escapeExpression, alias2=depth0 != null ? depth0 : {};\n\n return \" <div class=\\\"itemrow flex\\\">\\r\\n <div class=\\\"col-xs-9\\\">\"\n + alias1(container.lambda((depth0 != null ? depth0.accountName : depth0), depth0))\n + \"</div>\\r\\n <div class=\\\"col-xs-1 dollar-sign\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias2,(depths[2] != null ? depths[2].firstSignShownEquity : depths[2]),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(19, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"col-xs-2 currency\\\">\"\n + alias1((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || helpers.helperMissing).call(alias2,(depth0 != null ? depth0.endingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating input-group date\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"endDate\\\" name=\\\"endDate\\\" value=\\\"\"\n + alias3(((helper = (helper = helpers.endDate || (depth0 != null ? depth0.endDate : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"endDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"endDate\\\">Report as of</label>\\r\\n <span class=\\\"input-group-addon\\\"><i class=\\\"fa fa-calendar\\\"></i></span>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(1, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"balance-sheet\\\">\\r\\n <!--Uncategorized Block-->\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.reportingGroups : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(6, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n <!--Assets Column-->\\r\\n <div class=\\\"col-lg-6 col-md-6 col-xs-12 assets categorized\\\">\\r\\n <div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12 categorized\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Assets</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"balanceSheetReport reportData table table-striped table-hover\\\">\\r\\n <!--Current Assets, Fixed Assets, Other Assets-->\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.reportingGroups : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(10, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n \\r\\n <div class=\\\"itemrow flex totals-row assetsTotal\\\">\\r\\n <div class=\\\"col-xs-9 totalLabel\\\">Total Assets</div>\\r\\n <div class=\\\"col-xs-1 dollar-sign\\\">$</div>\\r\\n <div class=\\\"col-xs-2 totalBalance currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.assetsEndingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"itemrow flex\\\"></div>\\r\\n\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <!--Liabilities & Equity Column-->\\r\\n <div class=\\\"col-lg-6 col-md-6 col-xs-12 liabilities-equity categorized\\\">\\r\\n <div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12 categorized\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Liabilities & Equity</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"balanceSheetReport reportData table table-striped table-hover\\\">\\r\\n <!--Current Liabilities, Other Liabilities-->\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.reportingGroups : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(16, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \\r\\n <!--Liabilities Total-->\\r\\n\"\n + ((stack1 = (helpers.if_not_eq_0 || (depth0 && depth0.if_not_eq_0) || alias2).call(alias1,(depth0 != null ? depth0.liabilitiesEndingBalance : depth0),{\"name\":\"if_not_eq_0\",\"hash\":{},\"fn\":container.program(21, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n <!--Equity-->\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.reportingGroups : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(23, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \\r\\n \\r\\n <div class=\\\"itemrow flex totals-row liabilities-equity-total\\\">\\r\\n <div class=\\\"col-xs-9 totalLabel\\\">Total Liabilities & Equity</div>\\r\\n <div class=\\\"col-xs-1 dollar-sign\\\">$</div>\\r\\n <div class=\\\"col-xs-2 totalBalance currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.liabilitiesEquityEndingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"itemrow flex\\\"></div>\\r\\n\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"useData\":true,\"useDepths\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar Template = require('reports/balance-sheet/template')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar BalanceSheetReportView = Backbone.View.extend({\r\n\r\n events: {\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.createViewModel()))\r\n\r\n $('.datepicker').remove()\r\n\r\n this.$('.form-material.date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('dateSelected', this.model.get('endDate'))\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.form-material.date').datepicker('hide', null)\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$el.on('change', '.categorized', function () {\r\n this.equalColumnHeight()\r\n }.bind(this))\r\n\r\n this.equalColumnHeight()\r\n\r\n return this\r\n },\r\n\r\n equalColumnHeight: function () {\r\n var assetsColumnHeight = this.$el.find('.assets').height()\r\n var liablityColumnHeight = this.$el.find('.liabilities-equity').height()\r\n var numOfLines = 0\r\n\r\n if (assetsColumnHeight !== liablityColumnHeight) {\r\n if (assetsColumnHeight < liablityColumnHeight) {\r\n numOfLines = (liablityColumnHeight - assetsColumnHeight) / 44\r\n for (var i = 0; i < numOfLines; i++) {\r\n $('<div class=\"itemrow flex\"></div>').insertBefore('.assetsTotal')\r\n }\r\n } else if (liablityColumnHeight < assetsColumnHeight) {\r\n numOfLines = (assetsColumnHeight - liablityColumnHeight) / 44\r\n for (var j = 0; j < numOfLines; j++) {\r\n $('<div class=\"itemrow flex\"></div>').insertBefore('.liabilities-equity-total')\r\n }\r\n }\r\n }\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n var report = this.model.get('report')\r\n\r\n this.firstSignShownEquity = true\r\n this.firstSignShownOtherLiability = true\r\n\r\n this.firstSignShownOA = true\r\n this.firstSignShownFA = true\r\n\r\n _.map(report.reportingGroups, function (group) {\r\n if (group.reportingCategory === 'Current Liabilities' && group.endingBalance !== 0) {\r\n this.firstSignShownOtherLiability = false\r\n }\r\n if (group.reportingCategory === 'Current Liabilities' || group.reportingCategory === 'Other Liabilities') {\r\n if (group.endingBalance !== 0) {\r\n this.firstSignShownEquity = false\r\n }\r\n }\r\n if (group.reportingCategory === 'Current Assets' && group.endingBalance !== 0) {\r\n this.firstSignShownFA = false\r\n }\r\n if (group.reportingCategory === 'Current Assets' || group.reportingCategory === 'Fixed Assets') {\r\n if (group.endingBalance !== 0) {\r\n this.firstSignShownOA = false\r\n }\r\n }\r\n }.bind(this))\r\n\r\n return {\r\n reportingGroups: report.reportingGroups,\r\n companyName: report.companyName,\r\n endDate: moment(report.endDate),\r\n sort: report.sort,\r\n isAccrual: report.isAccrual,\r\n assetsEndingBalance: report.assetsEndingBalance,\r\n liabilitiesEndingBalance: report.liabilitiesEndingBalance,\r\n liabilitiesEquityEndingBalance: report.liabilitiesEquityEndingBalance,\r\n firstSignShownEquity: this.firstSignShownEquity,\r\n firstSignShownOtherLiability: this.firstSignShownOtherLiability,\r\n firstSignShownFA: this.firstSignShownFA,\r\n firstSignShownOA: this.firstSignShownOA\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n\r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').reportingGroups.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n\r\n ribbon: function (message) {\r\n return RibbonTemplate({ message: message })\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').reportingGroups.length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n\r\n})\r\n\r\nmodule.exports = BalanceSheetReportView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar BalanceSheetReportView = require('reports/balance-sheet/view')\r\nvar ReportService = require('reports/report-service')\r\n\r\nvar BalanceSheetReportWidget = function () {\r\n this.model = new Backbone.Model({\r\n endDate: moment().endOf('month')\r\n })\r\n this.reportService = new ReportService()\r\n this.view = new BalanceSheetReportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('dateSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', function () {\r\n this.updateReport(this.model.get('endDate'))\r\n }.bind(this))\r\n \r\n this.fetchReport()\r\n}\r\n\r\nBalanceSheetReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nBalanceSheetReportWidget.prototype.fetchReport = function () {\r\n this.reportService.fetchBalanceSheetReport().then(function (report) {\r\n this.model.set('report', report)\r\n if (report.reportingGroups.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nBalanceSheetReportWidget.prototype.updateReport = function (endDate) {\r\n this.reportService.fetchBalanceSheetReport(new Date(endDate), this.model.get('sort')).then(function (report) {\r\n this.model.set({\r\n report: report,\r\n sort: report.sort\r\n })\r\n if (report.reportingGroups.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nBalanceSheetReportWidget.prototype.downloadReport = function () {\r\n this.reportService.downloadBalanceSheetReport(this.model.get('endDate'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = BalanceSheetReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountOverview col-xs-12 no-padding \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.status : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\\">\\r\\n <div class=\\\"col-xs-3\\\">\"\n + alias4(((helper = (helper = helpers.accountNumber || (depth0 != null ? depth0.accountNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-2\\\">\"\n + alias4(((helper = (helper = helpers.accountType || (depth0 != null ? depth0.accountType : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountType\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-5\\\">\"\n + alias4(((helper = (helper = helpers.accountName || (depth0 != null ? depth0.accountName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-2\\\">\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.status : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"notActive\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Inactive\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n <div class=\\\"pull-right\\\">\\r\\n <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"col-xs-12 head no-padding\\\">\\r\\n <div class=\\\"col-xs-3\\\">Account # </div>\\r\\n <div class=\\\"col-xs-2\\\">Type</div>\\r\\n <div class=\\\"col-xs-5\\\">Description</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.accounts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar ChartOfAccountsReport = require('reports/chart-of-accounts/report')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar ChartOfAccountsView = Backbone.View.extend({\r\n\r\n className: 'chart-of-accounts-report',\r\n\r\n events: {\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:accounts', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(ChartOfAccountsReport(this.createViewModel()))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('accounts')) {\r\n return {\r\n accounts: _.chain(this.model.get('accounts')).map(function (account) {\r\n return account.toJSON()\r\n }).value()\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n \r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('accounts') || (!!this.model.get('accounts') && !this.model.get('accounts').length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n \r\n ribbon: function (message) {\r\n return RibbonTemplate({message: message})\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('accounts') && this.model.get('accounts').length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n\r\n})\r\n\r\nmodule.exports = ChartOfAccountsView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar ChartOfAccountsView = require('reports/chart-of-accounts/view')\r\nvar ReportService = require('reports/report-service')\r\nvar LedgerAccountService = require('generalledgeraccounts/service')\r\n\r\nvar ChartOfAccountsReportWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.view = new ChartOfAccountsView({\r\n model: this.model\r\n })\r\n this.reportService = new ReportService()\r\n this.ledgerAccountService = new LedgerAccountService()\r\n\r\n this.view.on('download', this.downloadReport, this)\r\n \r\n this.fetchReport()\r\n}\r\n\r\nChartOfAccountsReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nChartOfAccountsReportWidget.prototype.fetchReport = function () {\r\n this.ledgerAccountService.fetchAccounts(true, false).then(function (accounts) {\r\n this.model.set('accounts', accounts)\r\n if (accounts.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nChartOfAccountsReportWidget.prototype.downloadReport = function () {\r\n this.reportService.downloadChartOfAccounts()\r\n}\r\n\r\nmodule.exports = ChartOfAccountsReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <option value=\\\"loading\\\" selected disabled>\"\n + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isDoneLoadingCheckbook : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.program(7, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</option>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \"Loading...\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \"No\\r\\n checkbook\";\n},\"9\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(10, data, 0),\"inverse\":container.program(12, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"10\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"12\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"14\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow flex \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isVoided : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(15, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\\">\\r\\n <div class=\\\"date\\\">\"\n + alias4(((helper = (helper = helpers.postedOn || (depth0 != null ? depth0.postedOn : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"postedOn\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"type\\\">\"\n + alias4(((helper = (helper = helpers.type || (depth0 != null ? depth0.type : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"type\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"description\\\">\"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"memo\\\">\"\n + alias4(((helper = (helper = helpers.memo || (depth0 != null ? depth0.memo : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"memo\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4(((helper = (helper = helpers.withdrawal || (depth0 != null ? depth0.withdrawal : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"withdrawal\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"15\":function(container,depth0,helpers,partials,data) {\n return \"notActive\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n <div class=\\\"form-group my-checkbooks\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <select class=\\\"form-control select-checkbook\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.checkbookLookup : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label class=\\\"control-label\\\">Checkbook</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating input-group date\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"startDate\\\" name=\\\"startDate\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"startDate\\\">Report Start</label>\\r\\n <span class=\\\"input-group-addon\\\"><i class=\\\"fa fa-calendar\\\"></i></span>\\r\\n </div>\\r\\n </div>\\r\\n -\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating input-group date\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"endDate\\\" name=\\\"endDate\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"endDate\\\">Report End</label>\\r\\n <span class=\\\"input-group-addon\\\"><i class=\\\"fa fa-calendar\\\"></i></span>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(9, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary download\\\">\\r\\n Download\\r\\n </button>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"date\\\">Date <i class=\\\"fa fa-sort-\"\n + container.escapeExpression(((helper = (helper = helpers.sort || (depth0 != null ? depth0.sort : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"sort\",\"hash\":{},\"data\":data}) : helper)))\n + \" history-sort-toggle\\\"></i></div>\\r\\n <div class=\\\"type\\\">#/Type</div>\\r\\n <div class=\\\"description\\\">Description</div>\\r\\n <div class=\\\"memo\\\">Memo</div>\\r\\n <div class=\\\"currency\\\">Withdrawl</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.checks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(14, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar CheckbookDisbursementsReportTemplate = require('reports/checkbook-disbursements/template')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar CheckbookDisbursementsReportView = Backbone.View.extend({\r\n events: {\r\n 'change .select-checkbook': 'changeCheckbook',\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:selectedCheckbook change:isDoneLoadingCheckbook', this.render.bind(this))\r\n this.model.on('change:report', this.reportUpdated, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n reportUpdated: function () {\r\n this.model.set({\r\n startDate: this.model.get('report').startDate,\r\n endDate: this.model.get('report').endDate,\r\n sort: this.model.get('report').sort,\r\n selectedCheckbook: this.model.get('selectedCheckbook')\r\n }, { silent: true })\r\n\r\n this.render()\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CheckbookDisbursementsReportTemplate(this.createViewModel()))\r\n\r\n this.$('.select-checkbook').val(this.model.get('selectedCheckbook'))\r\n\r\n $('.datepicker').remove()\r\n\r\n this.$('.form-material.date').datepicker({\r\n format: 'mm/dd/yyyy',\r\n autoclose: true,\r\n todayHighlight: true\r\n }).find('input').mask('99/99/9999', { placeholder: 'MM/DD/YYYY' })\r\n\r\n if (this.model.get('endDate')) {\r\n this.$('#startDate').closest('.date').datepicker('setEndDate', this.model.get('endDate'))\r\n this.$('#endDate').closest('.date').datepicker('setDate', this.model.get('endDate')).closest('.floating').addClass('open')\r\n }\r\n\r\n if (this.model.get('startDate')) {\r\n this.$('#endDate').closest('.date').datepicker('setStartDate', this.model.get('startDate'))\r\n this.$('#startDate').closest('.date').datepicker('setDate', this.model.get('startDate')).closest('.floating').addClass('open')\r\n }\r\n\r\n this.$('#startDate').closest('.date').on('changeDate', function (e) {\r\n if (e.date) {\r\n $(e.currentTarget).closest('.floating').addClass('open')\r\n } else {\r\n $(e.currentTarget).closest('.floating').removeClass('open')\r\n }\r\n\r\n this.model.set('startDate', e.date)\r\n this.$('#endDate').closest('.date').datepicker('setStartDate', e.date).datepicker('show')\r\n }.bind(this))\r\n\r\n this.$('#endDate').closest('.date').on('changeDate', function (e) {\r\n e.date.setHours(23)\r\n e.date.setMinutes(59)\r\n e.date.setSeconds(59)\r\n e.date.setMilliseconds(999)\r\n\r\n if (e.date) {\r\n $(e.currentTarget).closest('.floating').addClass('open')\r\n } else {\r\n $(e.currentTarget).closest('.floating').removeClass('open')\r\n }\r\n\r\n this.$('#startDate').closest('.date').datepicker('setEndDate', e.date)\r\n this.$('#endDate').closest('.date').datepicker('hide')\r\n }.bind(this)).on('hide', function (e) {\r\n e.date.setHours(23)\r\n e.date.setMinutes(59)\r\n e.date.setSeconds(59)\r\n e.date.setMilliseconds(999)\r\n\r\n this.model.set('endDate', e.date)\r\n\r\n var startDate = this.model.get('startDate')\r\n var reportStartDate = this.model.get('report').startDate\r\n var endDate = this.model.get('endDate')\r\n var reportEndDate = this.model.get('report').endDate\r\n var startDateEqual = startDate.getDate() === reportStartDate.getDate() &&\r\n startDate.getMonth() === reportStartDate.getMonth() &&\r\n startDate.getFullYear() === reportStartDate.getFullYear()\r\n\r\n var endDateEqual = endDate.getDate() === reportEndDate.getDate() &&\r\n endDate.getMonth() === reportEndDate.getMonth() &&\r\n endDate.getFullYear() === reportEndDate.getFullYear()\r\n\r\n if (!startDateEqual || !endDateEqual) {\r\n this.trigger('datesSelected', startDate, endDate)\r\n }\r\n }.bind(this))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report') && this.model.get('checkbookLookup') && this.model.get('checkbooks')) {\r\n var report = this.model.get('report')\r\n return {\r\n checks: _.chain(report.checks).map(function (check) {\r\n var type = check.get('type')\r\n\r\n if ((type === 'Check' && (check.get('status').toLowerCase() === 'cleared' || check.get('status').toLowerCase() === 'posted')) || type === 'AP Payment') {\r\n type = check.get('checkNumber')\r\n }\r\n\r\n return {\r\n id: check.id,\r\n postedOn: check.get('postedOn').format('MM/DD/YYYY'),\r\n status: check,\r\n type: type,\r\n isVoided: check.get('isVoided'),\r\n description: check.get('description'),\r\n memo: check.get('memo'),\r\n withdrawal: check.get('credit'),\r\n deposit: check.get('debit'),\r\n balance: check.get('balance')\r\n }\r\n }).value(),\r\n companyName: report.companyName,\r\n endDate: moment(report.endDate),\r\n startDate: moment(report.startDate),\r\n sort: report.sort,\r\n isAccrual: report.isAccrual,\r\n checkbookLookup: this.model.get('checkbookLookup'),\r\n checkbooks: this.model.get('checkbooks'),\r\n isDoneLoadingCheckbook: this.model.get('isDoneLoadingCheckbook')\r\n }\r\n } else {\r\n return {\r\n isDoneLoadingCheckbook: this.model.get('isDoneLoadingCheckbook')\r\n }\r\n }\r\n },\r\n\r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').checks.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = (!!this.model.get('checkbooks') && this.model.get('checkbooks').length <= 0) ? 'No checkbook found' : 'No data found'\r\n message = error ? error.message : message\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n\r\n ribbon: function (message) {\r\n return RibbonTemplate({ message: message })\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').checks.length > 0) {\r\n this.trigger('download')\r\n }\r\n },\r\n\r\n changeCheckbook: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n\r\n this.model.set('selectedCheckbook', $currentTarget.val())\r\n this.trigger('checkbookChanged')\r\n }\r\n\r\n})\r\n\r\nmodule.exports = CheckbookDisbursementsReportView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar CheckbookDisbursementsReportView = require('reports/checkbook-disbursements/view')\r\nvar CheckbookRegisterReportService = require('reports/checkbook-register/service')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\n\r\nvar CheckbookDisbursementsReportWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.view = new CheckbookDisbursementsReportView({\r\n model: this.model\r\n })\r\n\r\n this.model.set({ 'checkbookLookup': null, 'selectedCheckbook': null })\r\n\r\n this.checkbookRegisterReportService = new CheckbookRegisterReportService()\r\n this.checkbookService = new CheckbookService()\r\n\r\n this.view.on('checkbookChanged', this.updateReport, this)\r\n this.view.on('datesSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', _.ary(this.updateReport, 0), this)\r\n}\r\n\r\nCheckbookDisbursementsReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.loadCheckbooks()\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nCheckbookDisbursementsReportWidget.prototype.loadCheckbooks = function () {\r\n this.model.set('isDoneLoadingCheckbook', false)\r\n this.checkbookService.fetchCheckbookList()\r\n .then(function (checkbooks) {\r\n var jsonCheckbooks = _.map(checkbooks, function (checkbook) { return checkbook.toJSON() })\r\n this.model.set('checkbooks', jsonCheckbooks)\r\n this.model.set('checkbookLookup', _.keyBy(jsonCheckbooks, 'id'))\r\n\r\n var firstCheckbook = _.first(jsonCheckbooks)\r\n\r\n if (firstCheckbook) {\r\n this.model.set('selectedCheckbook', firstCheckbook.id)\r\n this.updateReport()\r\n }\r\n this.model.set('isDoneLoadingCheckbook', true)\r\n if (checkbooks.length <= 0) {\r\n this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.model.set('isDoneLoadingCheckbook', true)\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nCheckbookDisbursementsReportWidget.prototype.updateReport = function () {\r\n if (!this.model.get('selectedCheckbook')) {\r\n return\r\n }\r\n\r\n this.checkbookRegisterReportService.fetchCheckbookRegisterReport(this.model.get('selectedCheckbook'), this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort'), true).then(function (report) {\r\n this.model.set('report', report)\r\n if (report.checks.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nCheckbookDisbursementsReportWidget.prototype.downloadReport = function () {\r\n if (!this.model.get('selectedCheckbook')) {\r\n return\r\n }\r\n\r\n this.checkbookRegisterReportService.downloadCheckbookRegisterReport(this.model.get('selectedCheckbook'), this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort'), true)\r\n}\r\n\r\nmodule.exports = CheckbookDisbursementsReportWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar CheckbookLineItem = require('checkbook/checkbook-line-item')\r\nvar _ = require('lodash')\r\n\r\nvar CheckbookRegisterReport = Backbone.Model.extend({\r\n toJSON: function () {\r\n var cloned = _.clone(this.attributes)\r\n\r\n cloned.checks = _.map(cloned.checks, function (check) {\r\n return check.toJSON()\r\n })\r\n\r\n return cloned\r\n }\r\n}, {\r\n parse: function (json) {\r\n return new CheckbookRegisterReport({\r\n id: json.id,\r\n name: json.name,\r\n accountNumber: json.accountNumber,\r\n checks: _.map(json.checks, function (journalEntry) {\r\n return CheckbookLineItem.parse(journalEntry)\r\n }),\r\n isAccrual: json.isAccrual\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = CheckbookRegisterReport\r\n","'use strict'\r\n\r\nvar RestClient = require('rest/client')\r\nvar Config = require('config/config')\r\nvar _ = require('underscore')\r\nvar $ = require('jquery')\r\nvar CheckbookLineItem = require('checkbook/checkbook-line-item')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar CheckbookRegisterReportService = function () {\r\n this.client = new RestClient()\r\n this.companyService = new CompanyService()\r\n}\r\n\r\nCheckbookRegisterReportService.prototype.fetchCheckbookRegisterReport = function (checkbookId, startDate, endDate, dateSort, isDisbursements) {\r\n var urlParams = {}\r\n if (startDate) {\r\n urlParams.startDate = startDate.toISOString()\r\n }\r\n\r\n if (endDate) {\r\n urlParams.endDate = endDate.toISOString()\r\n }\r\n\r\n if (dateSort) {\r\n urlParams.sort = dateSort\r\n } else {\r\n urlParams.sort = 'asc'\r\n }\r\n\r\n urlParams.isDisbursements = isDisbursements\r\n\r\n urlParams = $.param(urlParams)\r\n if (urlParams) {\r\n urlParams = '?' + urlParams\r\n }\r\n\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.client.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/checkbook-register-report/' + checkbookId + urlParams)\r\n .then(function (response) {\r\n response.checks = _.map(response.checks, function (check) {\r\n return CheckbookLineItem.parse(check)\r\n })\r\n\r\n response.endDate = new Date(response.endDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n response.startDate = new Date(response.startDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n\r\n return response\r\n })\r\n}\r\n\r\nCheckbookRegisterReportService.prototype.downloadCheckbookRegisterReport = function (checkbookId, startDate, endDate, dateSort, isDisbursements) {\r\n var urlParams = {}\r\n if (startDate) {\r\n urlParams.startDate = startDate.toISOString()\r\n }\r\n\r\n if (endDate) {\r\n urlParams.endDate = endDate.toISOString()\r\n }\r\n\r\n if (dateSort) {\r\n urlParams.sort = dateSort\r\n } else {\r\n urlParams.sort = 'asc'\r\n }\r\n\r\n var companyId = this.companyService.getActiveCompanyId()\r\n var reportType = !isDisbursements ? 'register' : 'disbursements'\r\n this.client.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/checkbook-' + reportType + '-report/' + checkbookId + '/export', urlParams)\r\n}\r\n\r\nmodule.exports = CheckbookRegisterReportService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <option value=\\\"loading\\\" selected disabled>\"\n + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isDoneLoadingCheckbook : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.program(7, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</option>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \"Loading...\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \"No\\r\\n checkbook\";\n},\"9\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(10, data, 0),\"inverse\":container.program(12, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"10\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"12\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"14\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow flex \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isVoided : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(15, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\\">\\r\\n <div class=\\\"date\\\">\"\n + alias4(((helper = (helper = helpers.postedOn || (depth0 != null ? depth0.postedOn : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"postedOn\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"type\\\">\"\n + alias4(((helper = (helper = helpers.type || (depth0 != null ? depth0.type : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"type\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"description\\\">\"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"memo\\\">\"\n + alias4(((helper = (helper = helpers.memo || (depth0 != null ? depth0.memo : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"memo\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4(((helper = (helper = helpers.deposit || (depth0 != null ? depth0.deposit : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"deposit\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4(((helper = (helper = helpers.withdrawal || (depth0 != null ? depth0.withdrawal : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"withdrawal\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4(((helper = (helper = helpers.balance || (depth0 != null ? depth0.balance : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"balance\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"15\":function(container,depth0,helpers,partials,data) {\n return \"notActive\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n <div class=\\\"form-group my-checkbooks\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <select class=\\\"form-control select-checkbook\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.checkbookLookup : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label class=\\\"control-label\\\">Checkbook</label>\\r\\n </div>\\r\\n </div>\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report Start\",\"inputId\":\"start-date\",\"wrapperClasses\":\"start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" -\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report End\",\"inputId\":\"end-date\",\"wrapperClasses\":\"end-date\",\"inputName\":\"endDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(9, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary download\\\">\\r\\n Download\\r\\n </button>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"date\\\">Date <i class=\\\"fa fa-sort-\"\n + container.escapeExpression(((helper = (helper = helpers.sort || (depth0 != null ? depth0.sort : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"sort\",\"hash\":{},\"data\":data}) : helper)))\n + \" history-sort-toggle\\\"></i></div>\\r\\n <div class=\\\"type\\\">#/Type</div>\\r\\n <div class=\\\"description\\\">Description</div>\\r\\n <div class=\\\"memo\\\">Memo</div>\\r\\n <div class=\\\"currency\\\">Deposit</div>\\r\\n <div class=\\\"currency\\\">Withdrawl</div>\\r\\n <div class=\\\"currency\\\">Balance</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.checks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(14, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar CheckbookRegisterReportTemplate = require('reports/checkbook-register/template')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar CheckbookRegisterReportView = Backbone.View.extend({\r\n\r\n events: {\r\n 'change .select-checkbook': 'changeCheckbook',\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:selectedCheckbook change:isDoneLoadingCheckbook', this.render.bind(this))\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CheckbookRegisterReportTemplate(this.createViewModel()))\r\n\r\n this.$('.select-checkbook').val(this.model.get('selectedCheckbook'))\r\n\r\n $('.datepicker').remove()\r\n\r\n // Start Date\r\n this.$('.start-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('startDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, close and open end date\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('startDate', moment(e.date).startOf('day'))\r\n this.$('.start-date .date').datepicker('hide', null)\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('show')\r\n this.$('.end-date .date').find('input').focus()\r\n } else {\r\n this.model.set('startDate', moment().startOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // End Date\r\n this.$('.end-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('datesSelected')\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, refresh\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.end-date .date').datepicker('hide', null)\r\n } else {\r\n this.model.set('endDate', moment().endOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.start-date .date').datepicker('setEndDate', this.model.get('endDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report') && this.model.get('checkbookLookup') && this.model.get('checkbooks')) {\r\n var report = this.model.get('report')\r\n return {\r\n checks: _.chain(report.checks).map(function (check) {\r\n var type = check.get('type')\r\n\r\n if ((type === 'Check' && (check.get('status').toLowerCase() === 'cleared' || check.get('status').toLowerCase() === 'posted')) || type === 'AP Payment') {\r\n type = check.get('checkNumber')\r\n }\r\n\r\n return {\r\n id: check.id,\r\n postedOn: check.get('postedOn').format(dateParams.format),\r\n status: check,\r\n type: type,\r\n isVoided: check.get('isVoided'),\r\n description: check.get('description'),\r\n memo: check.get('memo'),\r\n withdrawal: check.get('credit'),\r\n deposit: check.get('debit'),\r\n balance: check.get('balance')\r\n }\r\n }).value(),\r\n companyName: report.companyName,\r\n endDate: moment(report.endDate),\r\n startDate: moment(report.startDate),\r\n sort: report.sort,\r\n isAccrual: report.isAccrual,\r\n checkbookLookup: this.model.get('checkbookLookup'),\r\n checkbooks: this.model.get('checkbooks'),\r\n isDoneLoadingCheckbook: this.model.get('isDoneLoadingCheckbook')\r\n }\r\n } else {\r\n return {\r\n isDoneLoadingCheckbook: this.model.get('isDoneLoadingCheckbook')\r\n }\r\n }\r\n },\r\n\r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').checks.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = (!!this.model.get('checkbooks') && this.model.get('checkbooks').length <= 0) ? 'No checkbook found' : 'No data found'\r\n message = !!error ? error.message : message\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n\r\n ribbon: function (message) {\r\n return RibbonTemplate({ message: message })\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').checks.length > 0) {\r\n this.trigger('download')\r\n }\r\n },\r\n\r\n changeCheckbook: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n\r\n this.model.set('selectedCheckbook', $currentTarget.val())\r\n this.trigger('checkbookChanged')\r\n }\r\n\r\n})\r\n\r\nmodule.exports = CheckbookRegisterReportView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar CheckbookRegisterReportView = require('reports/checkbook-register/view')\r\nvar CheckbookRegisterReportService = require('reports/checkbook-register/service')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\n\r\nvar CheckbookRegisterReportWidget = function () {\r\n this.model = new Backbone.Model({\r\n startDate: moment().startOf('month'),\r\n endDate: moment().endOf('month')\r\n })\r\n this.view = new CheckbookRegisterReportView({\r\n model: this.model\r\n })\r\n\r\n this.model.set({ 'checkbookLookup': null, 'selectedCheckbook': null })\r\n\r\n this.checkbookRegisterReportService = new CheckbookRegisterReportService()\r\n this.checkbookService = new CheckbookService()\r\n\r\n this.view.on('checkbookChanged', this.updateReport, this)\r\n this.view.on('datesSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', _.ary(this.updateReport, 0), this)\r\n}\r\n\r\nCheckbookRegisterReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.loadCheckbooks()\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nCheckbookRegisterReportWidget.prototype.loadCheckbooks = function () {\r\n this.model.set('isDoneLoadingCheckbook', false)\r\n this.checkbookService.fetchCheckbookList()\r\n .then(function (checkbooks) {\r\n var jsonCheckbooks = _.map(checkbooks, function (checkbook) { return checkbook.toJSON() })\r\n this.model.set('checkbooks', jsonCheckbooks)\r\n this.model.set('checkbookLookup', _.keyBy(jsonCheckbooks, 'id'))\r\n\r\n var firstCheckbook = _.first(jsonCheckbooks)\r\n\r\n if (firstCheckbook) {\r\n this.model.set('selectedCheckbook', firstCheckbook.id)\r\n this.updateReport()\r\n }\r\n this.model.set('isDoneLoadingCheckbook', true)\r\n if (checkbooks.length <= 0) {\r\n this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.model.set('isDoneLoadingCheckbook', true)\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nCheckbookRegisterReportWidget.prototype.updateReport = function () {\r\n if (!this.model.get('selectedCheckbook')) {\r\n return\r\n }\r\n\r\n this.checkbookRegisterReportService.fetchCheckbookRegisterReport(this.model.get('selectedCheckbook'), this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort'), false).then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n if (report.checks.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nCheckbookRegisterReportWidget.prototype.downloadReport = function () {\r\n if (!this.model.get('selectedCheckbook')) {\r\n return\r\n }\r\n\r\n this.checkbookRegisterReportService.downloadCheckbookRegisterReport(this.model.get('selectedCheckbook'), this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = CheckbookRegisterReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(data && data.index),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n <div class=\\\"itemrow report-header\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.entries : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow report-total\\\"><div>Total \"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div><div class=\\\"pull-right\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.total : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div></div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"itemrow report-spacer\\\"></div>\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow flex\\\">\\r\\n <div class=\\\"date\\\">\"\n + alias4(((helper = (helper = helpers.shortPostedDate || (depth0 != null ? depth0.shortPostedDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortPostedDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"ref\\\" alt=\\\"\"\n + alias4(((helper = (helper = helpers.reference || (depth0 != null ? depth0.reference : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reference\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" title=\\\"\"\n + alias4(((helper = (helper = helpers.reference || (depth0 != null ? depth0.reference : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reference\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.reference || (depth0 != null ? depth0.reference : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reference\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"type\\\">\"\n + alias4(((helper = (helper = helpers.journalType || (depth0 != null ? depth0.journalType : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"journalType\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"description\\\">\"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"amount currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.amount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block-header\\\"><h3>Details</h3></div>\\r\\n<div class=\\\"block-content\\\">\\r\\n<div class=\\\"reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"date\\\">Date <i class=\\\"fa fa-sort-\"\n + container.escapeExpression(((helper = (helper = helpers.sort || (depth0 != null ? depth0.sort : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"sort\",\"hash\":{},\"data\":data}) : helper)))\n + \" history-sort-toggle\\\"></i></div>\\r\\n <div class=\\\"ref\\\"># / REF</div>\\r\\n <div class=\\\"type\\\">Type</div>\\r\\n <div class=\\\"description\\\">Description</div>\\r\\n <div class=\\\"amount currency\\\">Amount</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.details : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Template = require('reports/checkbook/reconciliation/list/template')\r\n\r\nvar ListView = Backbone.View.extend({\r\n className: 'block report-details',\r\n\r\n initialize: function () {\r\n this.model.on('change:reconciliationReport', this.render.bind(this))\r\n },\r\n\r\n render: function () {\r\n if (this.model.get('reconciliationReport')) {\r\n this.$el.html(Template(this.model.get('reconciliationReport').toJSON()))\r\n this.model.set('sort', this.model.get('reconciliationReport').get('sort'), {silent: true})\r\n }\r\n\r\n this.$('.history-sort-toggle').on('click', this.sortToggle.bind(this))\r\n\r\n this.delegateEvents()\r\n\r\n return this\r\n },\r\n\r\n sortToggle: function (e) {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('sort')))\r\n this.model.set('sort', newSortMode)\r\n }\r\n})\r\n\r\nmodule.exports = ListView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar CheckbookReconciliationReportView = require('reports/checkbook/reconciliation/list/view')\r\n\r\nvar CheckbookReconciliationReportWidget = function (model) {\r\n this.model = model\r\n this.view = new CheckbookReconciliationReportView({\r\n model: this.model\r\n })\r\n}\r\n\r\nCheckbookReconciliationReportWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCheckbookReconciliationReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = CheckbookReconciliationReportWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3>Notes</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"reconciledOn\\\">\\r\\n <div class=\\\"key\\\">Reconciled on:</div>\\r\\n <div class=\\\"value\\\">\"\n + alias4(((helper = (helper = helpers.shortReconciledDate || (depth0 != null ? depth0.shortReconciledDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortReconciledDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"reconciledBy\\\">\\r\\n <div class=\\\"key\\\">Reconciled by:</div>\\r\\n <div class=\\\"value\\\">\"\n + alias4(((helper = (helper = helpers.reconciliationUser || (depth0 != null ? depth0.reconciliationUser : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"reconciliationUser\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Template = require('reports/checkbook/reconciliation/notes/template')\r\n\r\nvar NotesView = Backbone.View.extend({\r\n className: 'block report-notes',\r\n\r\n initialize: function () {\r\n this.model.on('change:reconciliationReport', this.render.bind(this))\r\n },\r\n\r\n render: function () {\r\n if (this.model.get('reconciliationReport')) {\r\n this.$el.html(Template(this.model.get('reconciliationReport').toJSON()))\r\n this.model.set('sort', this.model.get('reconciliationReport').get('sort'), {silent: true})\r\n }\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = NotesView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar CheckbookReconciliationReportView = require('reports/checkbook/reconciliation/notes/view')\r\n\r\nvar CheckbookReconciliationReportNotesWidget = function (model) {\r\n this.model = model\r\n this.view = new CheckbookReconciliationReportView({\r\n model: this.model\r\n })\r\n}\r\n\r\nCheckbookReconciliationReportNotesWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCheckbookReconciliationReportNotesWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = CheckbookReconciliationReportNotesWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar _ = require('lodash')\r\n\r\nfunction MapEntries (entries, summationHolder) {\r\n var totalDebits = 0\r\n var totalCredits = 0\r\n\r\n var results = _.map(entries, function (entry) {\r\n totalDebits = totalDebits + entry.debit\r\n totalCredits = totalCredits + entry.credit\r\n entry.amount = entry.debit || entry.credit\r\n entry.shortPostedDate = moment(entry.postedDate).format('MM/DD/YYYY')\r\n\r\n return entry\r\n })\r\n\r\n summationHolder.total = totalDebits - totalCredits\r\n\r\n return results\r\n}\r\n\r\nvar ReconciliationReport = Backbone.Model.extend({ }, {\r\n parse: function (json) {\r\n // We have to use objects here to use them as pointers for MapEntries\r\n var clearedDeposits = { total: 0 }\r\n var clearedPayments = { total: 0 }\r\n var unclearedDeposits = { total: 0 }\r\n var unclearedPayments = { total: 0 }\r\n var futureUnclearedDeposits = { total: 0 }\r\n var futureUnclearedPayments = { total: 0 }\r\n\r\n var report = new ReconciliationReport(_.extend(json, {\r\n clearedDeposits: MapEntries(json.clearedDeposits, clearedDeposits),\r\n clearedPayments: MapEntries(json.clearedPayments, clearedPayments),\r\n unclearedDeposits: MapEntries(json.unclearedDeposits, unclearedDeposits),\r\n unclearedPayments: MapEntries(json.unclearedPayments, unclearedPayments),\r\n futureUnclearedDeposits: MapEntries(json.futureUnclearedDeposits, futureUnclearedDeposits),\r\n futureUnclearedPayments: MapEntries(json.futureUnclearedPayments, futureUnclearedPayments),\r\n totalclearedDeposits: clearedDeposits.total,\r\n totalclearedPayments: clearedPayments.total,\r\n totalunclearedDeposits: unclearedDeposits.total,\r\n totalunclearedPayments: unclearedPayments.total,\r\n futureTotalunclearedDeposits: futureUnclearedDeposits.total,\r\n futureTotalunclearedPayments: futureUnclearedPayments.total,\r\n shortEndDate: moment(json.endDate).format('MM/DD/YYYY'),\r\n shortReconciledDate: moment(json.reconciliationDate).format('MM/DD/YYYY'),\r\n isAccrual: json.isAccrual\r\n }))\r\n\r\n var details = [\r\n {name: 'Cleared Deposits & EFT Deposits', entries: report.get('clearedDeposits'), total: clearedDeposits.total},\r\n {name: 'Cleared Checks & EFT Payments', entries: report.get('clearedPayments'), total: -clearedPayments.total},\r\n {name: 'Uncleared Deposits & EFT Deposits as of ' + report.get('shortEndDate'), entries: report.get('unclearedDeposits'), total: unclearedDeposits.total},\r\n {name: 'Uncleared Checks & EFT Payments as of ' + report.get('shortEndDate'), entries: report.get('unclearedPayments'), total: -unclearedPayments.total},\r\n {name: 'Uncleared Deposits & EFT Deposits after ' + report.get('shortEndDate'), entries: report.get('futureUnclearedDeposits'), total: futureUnclearedDeposits.total},\r\n {name: 'Uncleared Checks & EFT Payments after ' + report.get('shortEndDate'), entries: report.get('futureUnclearedPayments'), total: -futureUnclearedPayments.total}\r\n ]\r\n\r\n report.set('details', details)\r\n\r\n return report\r\n }\r\n})\r\n\r\nmodule.exports = ReconciliationReport\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression, alias4=\"function\";\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3>Summary</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"beginningBalance\\\">\\r\\n <p>Statement Beginning Balance <span class=\\\"pull-right\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.statementBeginningBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></p>\\r\\n <p>Plus: Cleared Deposits & EFT Deposits <span class=\\\"pull-right\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.statementBeginningBalancePlusDeposits : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></p>\\r\\n <p>Minus: Cleared Checks & EFT Payments <span class=\\\"pull-right\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.statementBeginningBalanceMinusPayments : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></p>\\r\\n </div>\\r\\n <div class=\\\"endingBalance\\\">\\r\\n <p>Statement Ending Balance <span class=\\\"pull-right\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.statementEndingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></p>\\r\\n <p>Plus: Uncleared Deposits & EFT Deposits as of \"\n + alias3(((helper = (helper = helpers.shortEndDate || (depth0 != null ? depth0.shortEndDate : depth0)) != null ? helper : alias2),(typeof helper === alias4 ? helper.call(alias1,{\"name\":\"shortEndDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"<span class=\\\"pull-right\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.statementEndingBalancePlusDeposits : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></p>\\r\\n <p>Minus: Uncleared Checks & EFT Payments as of \"\n + alias3(((helper = (helper = helpers.shortEndDate || (depth0 != null ? depth0.shortEndDate : depth0)) != null ? helper : alias2),(typeof helper === alias4 ? helper.call(alias1,{\"name\":\"shortEndDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"<span class=\\\"pull-right\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.statementEndingBalanceMinusPayments : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></p>\\r\\n </div>\\r\\n <div class=\\\"checkbookBeginningBalance\\\">\\r\\n <p>Checkbook Balance as of \"\n + alias3(((helper = (helper = helpers.shortEndDate || (depth0 != null ? depth0.shortEndDate : depth0)) != null ? helper : alias2),(typeof helper === alias4 ? helper.call(alias1,{\"name\":\"shortEndDate\",\"hash\":{},\"data\":data}) : helper)))\n + \" <span class=\\\"pull-right\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.checkbookBeginningBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></p>\\r\\n <p>Plus: Uncleared Deposits & EFT Deposits after \"\n + alias3(((helper = (helper = helpers.shortEndDate || (depth0 != null ? depth0.shortEndDate : depth0)) != null ? helper : alias2),(typeof helper === alias4 ? helper.call(alias1,{\"name\":\"shortEndDate\",\"hash\":{},\"data\":data}) : helper)))\n + \" <span class=\\\"pull-right\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.checkbookBeginningBalancePlusDeposits : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></p>\\r\\n <p>Minus: Uncleared Checks & EFT Payments after \"\n + alias3(((helper = (helper = helpers.shortEndDate || (depth0 != null ? depth0.shortEndDate : depth0)) != null ? helper : alias2),(typeof helper === alias4 ? helper.call(alias1,{\"name\":\"shortEndDate\",\"hash\":{},\"data\":data}) : helper)))\n + \" <span class=\\\"pull-right\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.checkbookBeginningBalanceMinusPayments : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></p>\\r\\n </div>\\r\\n <div class=\\\"checkbookEndingBalance\\\">\\r\\n <p>Checkbook Balance as of \"\n + alias3(((helper = (helper = helpers.shortReconciledDate || (depth0 != null ? depth0.shortReconciledDate : depth0)) != null ? helper : alias2),(typeof helper === alias4 ? helper.call(alias1,{\"name\":\"shortReconciledDate\",\"hash\":{},\"data\":data}) : helper)))\n + \" <span class=\\\"pull-right\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.checkbookEndingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></p>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Template = require('reports/checkbook/reconciliation/summary/template')\r\n\r\nvar ReportSummary = Backbone.View.extend({\r\n className: 'block report-summary',\r\n\r\n initialize: function () {\r\n this.model.on('change:reconciliationReport', this.render.bind(this))\r\n },\r\n\r\n render: function () {\r\n if (this.model.get('reconciliationReport')) {\r\n this.$el.html(Template(this.model.get('reconciliationReport').toJSON()))\r\n }\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = ReportSummary\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar CheckbookReconciliationReportView = require('reports/checkbook/reconciliation/summary/view')\r\n\r\nvar CheckbookReconciliationReportWidget = function (model) {\r\n this.model = model\r\n this.view = new CheckbookReconciliationReportView({\r\n model: this.model\r\n })\r\n}\r\n\r\nCheckbookReconciliationReportWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCheckbookReconciliationReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = CheckbookReconciliationReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <option value=\\\"loading\\\" selected disabled>\"\n + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isDoneLoadingCheckbook : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.program(7, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</option>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \"Loading...\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \"---\";\n},\"9\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.reconciliations : depth0)) != null ? stack1.length : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(10, data, 0),\"inverse\":container.program(13, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"10\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.reconciliations : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(11, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"11\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.shortEndDate || (depth0 != null ? depth0.shortEndDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortEndDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"13\":function(container,depth0,helpers,partials,data) {\n return \" <option value=\\\"null\\\" selected>No reconciliations</option>\\r\\n\";\n},\"15\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <option value=\\\"loading\\\" selected>\"\n + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isDoneLoadingCheckbook : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</option>\\r\\n\";\n},\"17\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(18, data, 0),\"inverse\":container.program(20, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"18\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"20\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"reportControls\\\">\\r\\n <div class=\\\"form-group my-checkbooks\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <select class=\\\"form-control select-checkbook\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.checkbookLookup : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label class=\\\"control-label\\\" >Checkbook</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group checkbook-reconciliations\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <select class=\\\"form-control select-reconciliation\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.reconciliationsLookup : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(9, data, 0),\"inverse\":container.program(15, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label class=\\\"control-label\\\">Period Ending</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(17, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"btn btn-primary download\\\" id=\\\"reconcilReportDownload\\\" style=\\\"border-color: #19aea6;\\\">Download</div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar Template = require('reports/checkbook/reconciliation/template')\r\nvar Summary = require('reports/checkbook/reconciliation/summary/widget')\r\nvar DetailList = require('reports/checkbook/reconciliation/list/widget')\r\nvar Notes = require('reports/checkbook/reconciliation/notes/widget')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar ReconciliationReport = Backbone.View.extend({\r\n className: 'checkbook-reconciliation-report',\r\n\r\n events: {\r\n 'change .select-checkbook': 'changeCheckbook',\r\n 'change .select-reconciliation': 'changeReconciliation',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.summaryView = new Summary(this.model)\r\n this.details = new DetailList(this.model)\r\n this.notes = new Notes(this.model)\r\n\r\n this.listenTo(this.model, 'change:selectedCheckbook', this.render.bind(this))\r\n this.listenTo(this.model, 'change:selectedReconciliation', this.render.bind(this))\r\n this.listenTo(this.model, 'change:reconciliations', this.render.bind(this))\r\n this.listenTo(this.model, 'change:isAccrual change:isDoneLoadingCheckbook', this.render.bind(this))\r\n\r\n this.on('noReconciliationsOrCheckbook', this.noReconciliationsOrCheckbook, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.model.toJSON()))\r\n\r\n if (this.model.get('selectedCheckbook') && this.model.get('selectedReconciliation')) {\r\n this.$el.append(this.summaryView.show())\r\n this.$el.append(this.details.show())\r\n this.$el.append(this.notes.show())\r\n\r\n this.$('.select-checkbook').val(this.model.get('selectedCheckbook'))\r\n this.$('.select-reconciliation').val(this.model.get('selectedReconciliation'))\r\n } else if (this.model.get('selectedCheckbook') && !this.model.get('selectedReconciliation')) {\r\n this.$('.select-checkbook').val(this.model.get('selectedCheckbook'))\r\n }\r\n\r\n return this\r\n },\r\n\r\n changeCheckbook: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n\r\n this.model.set('selectedCheckbook', $currentTarget.val())\r\n },\r\n\r\n changeReconciliation: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n\r\n this.model.set('selectedReconciliation', $currentTarget.val())\r\n },\r\n\r\n noReconciliationsOrCheckbook: function (error) {\r\n this.render()\r\n if (!this.model.get('reconciliations') || (!!this.model.get('reconciliations') && !this.model.get('reconciliations').length) ||\r\n !this.model.get('checkbooks') || (!!this.model.get('checkbooks') && this.model.get('checkbooks').length <= 0)) {\r\n this.$('#reconcilReportDownload').addClass('disabled')\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = (!!this.model.get('checkbooks') && this.model.get('checkbooks').length <= 0) ? 'No checkbook found' : 'We could not find any reconciliations for this checkbook.'\r\n message = error ? error.message : message\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n\r\n ribbon: function (message) {\r\n return RibbonTemplate({message: message})\r\n },\r\n\r\n download: function (e) {\r\n this.trigger('download')\r\n }\r\n})\r\n\r\nmodule.exports = ReconciliationReport\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar CheckbookReconciliationReportView = require('reports/checkbook/reconciliation/view')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar ReportService = require('reports/report-service')\r\n\r\nvar CheckbookReconciliationReportWidget = function (checkbookId) {\r\n this.model = new Backbone.Model({\r\n checkbookId: checkbookId\r\n })\r\n this.view = new CheckbookReconciliationReportView({\r\n model: this.model\r\n })\r\n\r\n this.checkbookService = new CheckbookService()\r\n this.reportService = new ReportService()\r\n\r\n this.model.on('change:selectedCheckbook', this.updateReconciliations, this)\r\n this.model.on('change:selectedReconciliation', this.updateReconciliation, this)\r\n this.model.on('change:sort', this.updateReconciliation, this)\r\n\r\n this.view.on('download', this.downloadReport, this)\r\n}\r\n\r\nCheckbookReconciliationReportWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCheckbookReconciliationReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.loadCheckbooks()\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nCheckbookReconciliationReportWidget.prototype.loadCheckbooks = function () {\r\n this.model.set({'checkbookLookup': null, 'selectedCheckbook': null, 'reconciliationsLookup': null, 'selectedReconciliation': null})\r\n this.model.set('isDoneLoadingCheckbook', false)\r\n\r\n this.checkbookService.fetchCheckbookList()\r\n .then(function (checkbooks) {\r\n var jsonCheckbooks = _.map(checkbooks, function (checkbook) { return checkbook.toJSON() })\r\n this.model.set('checkbooks', jsonCheckbooks)\r\n this.model.set('checkbookLookup', _.keyBy(jsonCheckbooks, 'id'))\r\n\r\n var firstCheckbook = _.first(jsonCheckbooks)\r\n\r\n if (firstCheckbook) {\r\n this.model.set('selectedCheckbook', firstCheckbook.id)\r\n }\r\n this.model.set('isDoneLoadingCheckbook', true)\r\n\r\n if (checkbooks.length <= 0) {\r\n this.view.trigger('noReconciliationsOrCheckbook')\r\n }\r\n }.bind(this), function (error) {\r\n this.model.set('isDoneLoadingCheckbook', true)\r\n this.view.trigger('noReconciliationsOrCheckbook', error)\r\n }.bind(this))\r\n}\r\n\r\nCheckbookReconciliationReportWidget.prototype.updateReconciliations = function () {\r\n this.model.set({'reconciliationsLookup': null, 'selectedReconciliation': null})\r\n if (!this.model.get('selectedCheckbook')) {\r\n return\r\n }\r\n this.checkbookService.fetchReconciliations(this.model.get('selectedCheckbook')).then(function (reconciliations) {\r\n var jsonReconciliations = reconciliations.map(function (reconciliation) { return reconciliation.toJSON() })\r\n this.model.set('reconciliations', jsonReconciliations)\r\n this.model.set('reconciliationsLookup', _.keyBy(jsonReconciliations, 'id'))\r\n\r\n var firstReconciliation = _.first(jsonReconciliations)\r\n if (!firstReconciliation) {\r\n return this.view.trigger('noReconciliationsOrCheckbook')\r\n }\r\n this.model.set('selectedReconciliation', firstReconciliation.id)\r\n }.bind(this))\r\n}\r\n\r\nCheckbookReconciliationReportWidget.prototype.updateReconciliation = function () {\r\n if (!this.model.get('selectedCheckbook') || !this.model.get('selectedReconciliation')) {\r\n return\r\n }\r\n this.reportService.fetchReconciliationReport(this.model.get('selectedCheckbook'), this.model.get('selectedReconciliation'), this.model.get('sort')).then(function (reconciliation) {\r\n this.model.set('isAccrual', reconciliation.get('isAccrual'))\r\n this.model.set('reconciliationReport', reconciliation)\r\n }.bind(this))\r\n}\r\n\r\nCheckbookReconciliationReportWidget.prototype.downloadReport = function () {\r\n if (!this.model.get('selectedCheckbook') || !this.model.get('selectedReconciliation')) {\r\n return\r\n }\r\n this.reportService.downloadReconciliationReport(this.model.get('selectedCheckbook'), this.model.get('selectedReconciliation'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = CheckbookReconciliationReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"customerId\\\">\"\n + alias4(((helper = (helper = helpers.customerId || (depth0 != null ? depth0.customerId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"customerId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"name\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"printedName\\\">\"\n + alias4(((helper = (helper = helpers.printedName || (depth0 != null ? depth0.printedName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"printedName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"state\\\">\"\n + alias4(((helper = (helper = helpers.state || (depth0 != null ? depth0.state : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"state\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"salesTax\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.taxRate : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"active\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isActive : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.program(8, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" \"\n + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.taxRate : depth0)) != null ? stack1.rateId : stack1), depth0))\n + \"\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \" Exempt\\r\\n\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n return \" Yes\\r\\n\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n return \" No\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n <div class=\\\"pull-right\\\">\\r\\n <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"customerId\\\">ID</div>\\r\\n <div class=\\\"name\\\">Customer Name</div>\\r\\n <div class=\\\"printedName\\\">Printed Name</div>\\r\\n <div class=\\\"state\\\">State</div>\\r\\n <div class=\\\"salesTax\\\">Sales Tax</div>\\r\\n <div class=\\\"active\\\">Active</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.customers : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar CustomerListReport = require('reports/customer-list/report')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar CustomerListView = Backbone.View.extend({\r\n\r\n className: 'list-report',\r\n\r\n events: {\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(CustomerListReport(this.createViewModel()))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n return {\r\n customers: this.model.get('report').customers\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n \r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').customers.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n \r\n ribbon: function (message) {\r\n return RibbonTemplate({message: message})\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').customers.length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n\r\n})\r\n\r\nmodule.exports = CustomerListView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar CustomerListView = require('reports/customer-list/view')\r\nvar ReportService = require('reports/report-service')\r\n\r\nvar CustomerListReportWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.view = new CustomerListView({\r\n model: this.model\r\n })\r\n this.reportService = new ReportService()\r\n\r\n this.view.on('download', this.downloadReport, this)\r\n \r\n this.fetchReport()\r\n}\r\n\r\nCustomerListReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nCustomerListReportWidget.prototype.fetchReport = function () {\r\n this.reportService.fetchCustomerListReport().then(function (report) {\r\n this.model.set('report', report)\r\n if (report.customers.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nCustomerListReportWidget.prototype.downloadReport = function () {\r\n this.reportService.downloadCustomerListReport()\r\n}\r\n\r\nmodule.exports = CustomerListReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"6\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"rate\\\"><strong>\"\n + alias3(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</strong></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.sales : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(7, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row no-padding\\\">\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 type indented\\\"></div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 number invoiceNumber\\\"></div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 date\\\"></div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 currency\\\">Total:</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.totalSale : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.taxableAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.exemptAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.taxAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow accountBuffer flex\\\"></div>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountTransaction flex no-padding\\\">\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 type indented\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depths[1] != null ? depths[1].isAccrual : depths[1]),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(8, data, 0, blockParams, depths),\"inverse\":container.program(10, data, 0, blockParams, depths),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 number invoiceNumber\\\">\"\n + alias4(((helper = (helper = helpers.invoiceNumber || (depth0 != null ? depth0.invoiceNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"invoiceNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 date\\\">\"\n + alias4(((helper = (helper = helpers.postedDate || (depth0 != null ? depth0.postedDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"postedDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 currency\\\"></div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.totalSale : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.taxableAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.exemptAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.taxAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n return \"AR\";\n},\"10\":function(container,depth0,helpers,partials,data) {\n return \"AR Payment\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report Start\",\"inputId\":\"start-date\",\"wrapperClasses\":\"start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" -\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report End\",\"inputId\":\"end-date\",\"wrapperClasses\":\"end-date\",\"inputName\":\"endDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(1, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"cust-sales-journal-report reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex no-padding\\\">\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 type indented\\\">Type</div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 number invoiceNumber\\\">Invoice #</div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 date\\\">Date</div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 currency\\\"></div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency totalSale\\\">Total Sale</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency taxable\\\">Taxable</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency exempt\\\">Exempt</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency salesTax\\\">Sales Tax</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.groups : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(6, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row no-padding\\\">\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 type indented\\\"></div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 number invoiceNumber\\\"></div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 date\\\"></div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 currency\\\">Grand Total:</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandTotalSale : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandTaxableAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandExemptAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandSalesTax : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true,\"useDepths\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar Template = require('reports/customer-sales-journal/template')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar CustomerSalesJournalReportView = Backbone.View.extend({\r\n\r\n events: {\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.createViewModel()))\r\n\r\n $('.datepicker').remove()\r\n\r\n // Start Date\r\n this.$('.start-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('startDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n \r\n // If date is typed in and is valid, refresh\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('startDate', moment(e.date).startOf('day'))\r\n this.$('.start-date .date').datepicker('hide', null)\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('show')\r\n this.$('.end-date .date').find('input').focus()\r\n } else {\r\n this.model.set('startDate', '')\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // End date\r\n this.$('.end-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('datesSelected')\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n \r\n // If date is typed in and is valid, refresh\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.end-date .date').datepicker('hide', null)\r\n } else {\r\n this.model.set('endDate', moment().endOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // Prevent start date after end date, and end date before start date\r\n this.$('.start-date .date').datepicker('setEndDate', this.model.get('endDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n var report = this.model.get('report')\r\n _.map (report.groups, function (vendor) {\r\n _.map (vendor.sales, function (sale) {\r\n sale.postedDate = moment(sale.postedDate).format(dateParams.format) \r\n })\r\n })\r\n return {\r\n groups: report.groups,\r\n companyName: report.companyName,\r\n endDate: moment(report.endDate),\r\n startDate: moment(report.startDate),\r\n sort: report.sort,\r\n isAccrual: report.isAccrual,\r\n grandTotalSale: report.totalSale,\r\n grandTaxableAmount: report.taxableAmount,\r\n grandExemptAmount: report.exemptAmount,\r\n grandSalesTax: report.taxAmount\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n \r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').groups.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n \r\n ribbon: function (message) {\r\n return RibbonTemplate({ message: message })\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').groups.length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n\r\n})\r\n\r\nmodule.exports = CustomerSalesJournalReportView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar CustomerSalesJournalReportView = require('reports/customer-sales-journal/view')\r\nvar ReportService = require('reports/report-service')\r\n\r\nvar CustomerSalesJournalReportWidget = function () {\r\n this.model = new Backbone.Model({\r\n startDate: moment().startOf('month'),\r\n endDate: moment().endOf('month')\r\n })\r\n \r\n this.reportService = new ReportService()\r\n this.view = new CustomerSalesJournalReportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('datesSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', _.ary(this.updateReport, 0), this)\r\n\r\n this.fetchReport()\r\n}\r\n\r\nCustomerSalesJournalReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nCustomerSalesJournalReportWidget.prototype.fetchReport = function () {\r\n this.reportService.fetchCustomerSalesJournalReport().then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n if (report.groups.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nCustomerSalesJournalReportWidget.prototype.updateReport = function () {\r\n this.reportService.fetchCustomerSalesJournalReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort')).then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n if (report.groups.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nCustomerSalesJournalReportWidget.prototype.downloadReport = function () {\r\n this.reportService.downloadCustomerSalesJournalReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = CustomerSalesJournalReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"rate\\\"><strong>\"\n + alias4(((helper = (helper = helpers.departmentName || (depth0 != null ? depth0.departmentName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"departmentName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</strong></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.invoices : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row no-padding\\\">\\r\\n <div class=\\\"col-xs-10 text-right\\\">\"\n + alias4(((helper = (helper = helpers.departmentName || (depth0 != null ? depth0.departmentName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"departmentName\",\"hash\":{},\"data\":data}) : helper)))\n + \" Total: </div><div class=\\\"col-xs-2 currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.total : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow accountBuffer flex\\\"></div>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountTransaction flex\\\">\\r\\n <div class=\\\"date\\\">\"\n + alias4(((helper = (helper = helpers.date || (depth0 != null ? depth0.date : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"date\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"number\\\">\"\n + alias4(((helper = (helper = helpers.invoiceNumber || (depth0 != null ? depth0.invoiceNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"invoiceNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"description\\\">\"\n + alias4(((helper = (helper = helpers.customerName || (depth0 != null ? depth0.customerName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"customerName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"type indented\\\">\"\n + alias4(((helper = (helper = helpers.type || (depth0 != null ? depth0.type : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"type\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.amount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report Start\",\"inputId\":\"start-date\",\"wrapperClasses\":\"start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" -\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report End\",\"inputId\":\"end-date\",\"wrapperClasses\":\"end-date\",\"inputName\":\"endDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"date\\\">Date</div>\\r\\n <div class=\\\"number\\\">Invoice #</div>\\r\\n <div class=\\\"description\\\">Customer Name</div>\\r\\n <div class=\\\"type indented\\\">Type</div>\\r\\n <div class=\\\"currency\\\">Amount</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.departments : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row no-padding\\\">\\r\\n <div class=\\\"col-xs-10 text-right\\\">Total: </div><div class=\\\"col-xs-2 currency\\\">\"\n + container.escapeExpression((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.total : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar Template = require('reports/department/template')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar DepartmentReportView = Backbone.View.extend({\r\n\r\n events: {\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.createViewModel()))\r\n\r\n $('.datepicker').remove()\r\n\r\n // Start Date\r\n this.$('.start-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('startDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, refresh\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('startDate', moment(e.date).startOf('day'))\r\n this.$('.start-date .date').datepicker('hide', null)\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('show')\r\n this.$('.end-date .date').find('input').focus()\r\n } else {\r\n this.model.set('startDate', moment().startOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // End Date\r\n this.$('.end-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('datesSelected')\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, refresh\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.end-date .date').datepicker('hide', null)\r\n } else {\r\n this.model.set('endDate', moment().endOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n this.$('.start-date .date').datepicker('setEndDate', this.model.get('endDate').format(dateParams.format))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n var report = this.model.get('report')\r\n return {\r\n departments: report.departments,\r\n companyName: report.companyName,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort,\r\n isAccrual: report.isAccrual,\r\n total: report.total\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n \r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').departments.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n \r\n ribbon: function (message) {\r\n return RibbonTemplate({message: message})\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').departments.length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = DepartmentReportView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar DepartmentReportView = require('reports/department/view')\r\nvar ReportService = require('reports/report-service')\r\n\r\nvar DepartmentReportWidget = function () {\r\n this.model = new Backbone.Model({\r\n startDate: moment().startOf('month'),\r\n endDate: moment().endOf('month')\r\n })\r\n\r\n this.reportService = new ReportService()\r\n this.view = new DepartmentReportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('datesSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', function () {\r\n this.updateReport(this.model.get('startDate'), this.model.get('endDate'))\r\n }.bind(this))\r\n\r\n this.fetchReport()\r\n}\r\n\r\nDepartmentReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nDepartmentReportWidget.prototype.fetchReport = function () {\r\n this.reportService.fetchDepartmentReport().then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n\r\n if (report.departments.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nDepartmentReportWidget.prototype.updateReport = function () {\r\n this.reportService.fetchDepartmentReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort')).then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n \r\n if (report.departments.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nDepartmentReportWidget.prototype.downloadReport = function () {\r\n this.reportService.downloadDepartmentReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = DepartmentReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow col-xs-12 no-padding\\\">\\r\\n <div class=\\\"col-xs-2\\\">\"\n + alias4(((helper = (helper = helpers.assetNumber || (depth0 != null ? depth0.assetNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"assetNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-3\\\">\"\n + alias4(((helper = (helper = helpers.shortPurchaseDate || (depth0 != null ? depth0.shortPurchaseDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortPurchaseDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-4\\\">\"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 currency\\\"><span class=\\\"purchasePrice\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.purchasePrice : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n <div class=\\\"pull-right\\\">\\r\\n <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"col-xs-12 head no-padding\\\">\\r\\n <div class=\\\"col-xs-2\\\">Asset # </div>\\r\\n <div class=\\\"col-xs-3\\\">Purchase Date</div>\\r\\n <div class=\\\"col-xs-4\\\">Description</div>\\r\\n <div class=\\\"col-xs-2 amountHeader\\\">Amount</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.fixedAssets : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar Template = require('reports/fixed-asset/template')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar FixedAssetView = Backbone.View.extend({\r\n\r\n className: 'fixed-assets-list',\r\n\r\n events: {\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.createViewModel()))\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n var report = this.model.get('report')\r\n \r\n _.map(report.fixedAssets, function (fixedAsset){\r\n fixedAsset.purchaseDate = moment(fixedAsset.purchaseDate)\r\n }.bind(this))\r\n\r\n return {\r\n fixedAssets: report.fixedAssets,\r\n companyName: report.companyName, \r\n isAccrual: report.isAccrual \r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n \r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').fixedAssets.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n \r\n ribbon: function (message) {\r\n return RibbonTemplate({message: message})\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').fixedAssets.length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n\r\n})\r\n\r\nmodule.exports = FixedAssetView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar FixedAssetView = require('reports/fixed-asset/view')\r\nvar ReportService = require('reports/report-service')\r\n\r\nvar FixedAssetReportWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.view = new FixedAssetView({\r\n model: this.model\r\n })\r\n this.reportService = new ReportService()\r\n\r\n this.view.on('download', this.downloadReport, this)\r\n \r\n this.fetchReport()\r\n}\r\n\r\nFixedAssetReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nFixedAssetReportWidget.prototype.fetchReport = function () {\r\n this.reportService.fetchFixedAssetListReport().then(function (report) {\r\n this.model.set('report', report)\r\n if (report.fixedAssets.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nFixedAssetReportWidget.prototype.downloadReport = function () {\r\n this.reportService.downloadFixedAssetListReport()\r\n}\r\n\r\nmodule.exports = FixedAssetReportWidget\r\n","'use strict'\r\n\r\nvar RestClient = require('rest/client')\r\nvar Config = require('config/config')\r\nvar _ = require('underscore')\r\nvar $ = require('jquery')\r\nvar GeneralLedgerReport = require('reports/general-ledger-report/general-ledger-report')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar GeneralLedgerReportService = function () {\r\n this.client = new RestClient()\r\n this.companyService = new CompanyService()\r\n}\r\n\r\nGeneralLedgerReportService.prototype.fetchGeneralLedgerReport = function (startDate, endDate, dateSort) {\r\n var urlParams = {}\r\n if (startDate) {\r\n urlParams.startDate = startDate.toISOString()\r\n }\r\n\r\n if (endDate) {\r\n urlParams.endDate = endDate.toISOString()\r\n }\r\n\r\n if (dateSort) {\r\n urlParams.sort = dateSort\r\n } else {\r\n urlParams.sort = 'asc'\r\n }\r\n\r\n urlParams = $.param(urlParams)\r\n if (urlParams) {\r\n urlParams = '?' + urlParams\r\n }\r\n\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.client.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/ledger-accounts-report' + urlParams)\r\n .then(function (response) {\r\n var endingBalance = 0\r\n response.accounts = _.chain(response.accounts)\r\n .map(function (report) {\r\n var generalLedgerReport = GeneralLedgerReport.parse(report)\r\n // We store the balance as a number multiplied by 10, that way we can preserve the cents\r\n // and stop the browser from rounding when doing arithmatic.\r\n endingBalance = endingBalance + generalLedgerReport.get('endingBalance') * 100\r\n return generalLedgerReport\r\n })\r\n .value()\r\n\r\n response.endDate = new Date(response.endDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n response.startDate = new Date(response.startDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n // We store the balance as a number multiplied by 10, that way we can preserve the cents\r\n // and stop the browser from rounding when doing arithmatic.\r\n response.endingBalance = endingBalance / 100\r\n\r\n return response\r\n })\r\n}\r\n\r\nGeneralLedgerReportService.prototype.downloadGeneralLedgerReport = function (startDate, endDate, dateSort) {\r\n var urlParams = {}\r\n if (startDate) {\r\n urlParams.startDate = startDate.toISOString()\r\n }\r\n\r\n if (endDate) {\r\n urlParams.endDate = endDate.toISOString()\r\n }\r\n\r\n if (dateSort) {\r\n urlParams.sort = dateSort\r\n } else {\r\n urlParams.sort = 'asc'\r\n }\r\n\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.client.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/ledger-accounts-report/export', urlParams)\r\n}\r\n\r\nmodule.exports = GeneralLedgerReportService\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Entry = require('reports/general-ledger-report/ledger-entry')\r\nvar _ = require('lodash')\r\n\r\nvar GeneralLedgerReport = Backbone.Model.extend({\r\n toJSON: function () {\r\n var cloned = _.clone(this.attributes)\r\n\r\n cloned.entries = _.map(cloned.entries, function (entry) {\r\n return entry.toJSON()\r\n })\r\n\r\n return cloned\r\n }\r\n}, {\r\n parse: function (json) {\r\n var creditSummation = 0\r\n var debitSummation = 0\r\n var accountReport = new GeneralLedgerReport({\r\n id: json.id,\r\n name: json.name,\r\n accountNumber: json.accountNumber,\r\n startingBalance: json.startingBalance,\r\n entries: _.map(json.entries, function (journalEntry) {\r\n var reportJournalEntry = Entry.parse(journalEntry)\r\n creditSummation = creditSummation + reportJournalEntry.get('creditSummation')\r\n debitSummation = debitSummation + reportJournalEntry.get('debitSummation')\r\n\r\n return reportJournalEntry\r\n }),\r\n endingBalance: json.endingBalance,\r\n isAccrual: json.isAccrual\r\n })\r\n\r\n accountReport.set('creditSummation', creditSummation)\r\n accountReport.set('debitSummation', debitSummation)\r\n\r\n return accountReport\r\n }\r\n})\r\n\r\nmodule.exports = GeneralLedgerReport\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Distribution = require('checkbook/distribution')\r\nvar moment = require('moment')\r\nvar _ = require('lodash')\r\n\r\nvar LedgerEntry = Backbone.Model.extend({\r\n toJSON: function () {\r\n var cloned = _.clone(this.attributes)\r\n cloned.details = _.map(this.get('details'), function (detail) {\r\n if (detail.toJSON) {\r\n return detail.toJSON()\r\n } else {\r\n return detail\r\n }\r\n })\r\n\r\n return cloned\r\n }\r\n}, {\r\n parse: function (json) {\r\n var creditSummation = 0\r\n var debitSummation = 0\r\n\r\n var reportEntry = new LedgerEntry({\r\n id: json.id,\r\n journalType: json.journalType,\r\n description: (json.journalType === 'APPayment') ? json.description + \" \" + json.check.printedName : json.description,\r\n date: moment(json.postedDate),\r\n notes: json.notes,\r\n voidJournal: json.voidJournal,\r\n is1099: json.is1099,\r\n details: _.map(json.lineItems, function (lineItem) {\r\n var lineItemDistribution = Distribution.parse(lineItem)\r\n creditSummation = creditSummation + Number(lineItem.credit)\r\n debitSummation = debitSummation + Number(lineItem.debit)\r\n\r\n return lineItemDistribution\r\n }),\r\n shortDate: moment(json.postedDate).format('MM/DD/YYYY'),\r\n reference: json.reference || {name: ((json.journalType === 'Check') || (json.journalType === 'APPayment')) ? json.check.checkNumber : ''},\r\n check: json.check ? {\r\n printedName: json.check.printedName,\r\n isHandwritten: json.check.handwritten,\r\n checkNumber: json.check.checkNumber,\r\n memo: json.check.memo,\r\n address: json.check.address ? {\r\n addressLine1: json.check.address.addressLine1,\r\n addressLine2: json.check.address.addressLine2,\r\n city: json.check.address.city,\r\n state: json.check.address.state,\r\n zip: json.check.address.postalCode\r\n } : null\r\n } : null\r\n })\r\n\r\n reportEntry.set('creditSummation', creditSummation)\r\n reportEntry.set('debitSummation', debitSummation)\r\n\r\n return reportEntry\r\n }\r\n})\r\n\r\nmodule.exports = LedgerEntry\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar MaskedInput = require('jquery.maskedinput')\r\nvar ViewGeneralLedgerReportTemplate = require('reports/general-ledger-report/view-general-ledger-report')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar ViewGeneralLedgerReportView = Backbone.View.extend({\r\n\r\n events: {\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(ViewGeneralLedgerReportTemplate(this.createViewModel()))\r\n\r\n $('.datepicker').remove()\r\n\r\n // Start Date\r\n this.$('.start-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('startDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, close and open end date\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('startDate', moment(e.date).startOf('day'))\r\n this.$('.start-date .date').datepicker('hide', null)\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('show')\r\n this.$('.end-date .date').find('input').focus()\r\n } else {\r\n this.model.set('startDate', moment().startOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // End Date\r\n this.$('.end-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('datesSelected')\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, refresh\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.end-date .date').datepicker('hide', null)\r\n } else {\r\n this.model.set('endDate', moment().endOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.start-date .date').datepicker('setEndDate', this.model.get('endDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n var report = this.model.get('report')\r\n return {\r\n accounts: _.chain(report.accounts).map(function (account) {\r\n return account.toJSON()\r\n }).value(),\r\n companyName: report.companyName,\r\n endDate: moment(report.endDate),\r\n startDate: moment(report.startDate),\r\n sort: report.sort,\r\n endingBalance: report.endingBalance,\r\n isAccrual: report.isAccrual\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n \r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').accounts.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n \r\n ribbon: function (message) {\r\n return RibbonTemplate({message: message})\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').accounts.length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n\r\n})\r\n\r\nmodule.exports = ViewGeneralLedgerReportView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar ViewGeneralLedgerReportView = require('reports/general-ledger-report/view-general-ledger-report-view')\r\nvar GeneralLedgerReportService = require('reports/general-ledger-report/general-ledger-report-service')\r\n\r\nvar ViewGeneralLedgerReportWidget = function () {\r\n this.model = new Backbone.Model({\r\n startDate: moment().startOf('month'),\r\n endDate: moment().endOf('month')\r\n })\r\n\r\n this.view = new ViewGeneralLedgerReportView({\r\n model: this.model\r\n })\r\n this.generalLedgerReportService = new GeneralLedgerReportService()\r\n\r\n this.view.on('datesSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', function () {\r\n this.updateReport(this.model.get('startDate'), this.model.get('endDate'))\r\n }.bind(this))\r\n\r\n this.fetchReport()\r\n}\r\n\r\nViewGeneralLedgerReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nViewGeneralLedgerReportWidget.prototype.fetchReport = function () {\r\n this.generalLedgerReportService.fetchGeneralLedgerReport().then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n\r\n if (report.accounts.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nViewGeneralLedgerReportWidget.prototype.updateReport = function () {\r\n this.generalLedgerReportService.fetchGeneralLedgerReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort')).then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n\r\n if (report.accounts.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nViewGeneralLedgerReportWidget.prototype.downloadReport = function () {\r\n this.generalLedgerReportService.downloadGeneralLedgerReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = ViewGeneralLedgerReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"6\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"description\\\"><strong>\"\n + alias4(((helper = (helper = helpers.accountNumber || (depth0 != null ? depth0.accountNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \" \"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</strong></div>\\r\\n <div class=\\\"currency\\\"><strong>\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.startingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</strong></div>\\r\\n <div class=\\\"currency\\\"></div>\\r\\n <div class=\\\"currency\\\"></div>\\r\\n <div class=\\\"currency\\\">\"\n + ((stack1 = helpers.unless.call(alias1,((stack1 = (depth0 != null ? depth0.entries : depth0)) != null ? stack1.length : stack1),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(7, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.entries : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(9, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.entries : depth0)) != null ? stack1.length : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(13, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow accountBuffer flex\\\"></div>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \"<strong>\"\n + container.escapeExpression((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.endingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</strong>\";\n},\"9\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1;\n\n return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.details : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(10, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"10\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {}, alias4=helpers.helperMissing;\n\n return \" <div class=\\\"itemrow accountTransaction flex\\\">\\r\\n <div class=\\\"date\\\">\"\n + alias2(alias1((depths[1] != null ? depths[1].shortDate : depths[1]), depth0))\n + \"</div>\\r\\n <div class=\\\"reference\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias3,(depths[1] != null ? depths[1].reference : depths[1]),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(11, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"type\\\">\"\n + alias2(alias1((depths[1] != null ? depths[1].journalType : depths[1]), depth0))\n + \"</div>\\r\\n <div class=\\\"description\\\">\"\n + alias2(alias1((depths[1] != null ? depths[1].description : depths[1]), depth0))\n + \"</div>\\r\\n <div class=\\\"currency\\\"></div>\\r\\n <div class=\\\"currency\\\">\"\n + alias2((helpers[\"numbro-report\"] || (depth0 && depth0[\"numbro-report\"]) || alias4).call(alias3,(depth0 != null ? depth0.debit : depth0),{\"name\":\"numbro-report\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias2((helpers[\"numbro-report-negative\"] || (depth0 && depth0[\"numbro-report-negative\"]) || alias4).call(alias3,(depth0 != null ? depth0.credit : depth0),{\"name\":\"numbro-report-negative\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\"></div>\\r\\n </div>\\r\\n\";\n},\"11\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1;\n\n return container.escapeExpression(container.lambda(((stack1 = (depths[1] != null ? depths[1].reference : depths[1])) != null ? stack1.name : stack1), depth0));\n},\"13\":function(container,depth0,helpers,partials,data) {\n var alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountEndingOverview flex\\\">\\r\\n <div class=\\\"description\\\"></div>\\r\\n <div class=\\\"currency\\\"><strong>\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.debitSummation : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</strong></div>\\r\\n <div class=\\\"currency\\\"><strong>\"\n + alias3((helpers[\"numbro-report-showzero-negative\"] || (depth0 && depth0[\"numbro-report-showzero-negative\"]) || alias2).call(alias1,(depth0 != null ? depth0.creditSummation : depth0),{\"name\":\"numbro-report-showzero-negative\",\"hash\":{},\"data\":data}))\n + \"</strong></div>\\r\\n <div class=\\\"currency\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"itemrow accountEndingOverview flex\\\">\\r\\n <div class=\\\"description\\\"></div>\\r\\n <div class=\\\"currency\\\"><strong>\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.endingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</strong></div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report Start\",\"inputId\":\"start-date\",\"wrapperClasses\":\"start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" -\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report End\",\"inputId\":\"end-date\",\"wrapperClasses\":\"end-date\",\"inputName\":\"endDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"<div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(1, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"<button class=\\\"btn btn-primary download\\\">\\r\\n Download\\r\\n</button>\\r\\n</div>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n<div class=\\\"block-content\\\">\\r\\n<div class=\\\"reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"date\\\">Date <i class=\\\"fa fa-sort-\"\n + alias3(((helper = (helper = helpers.sort || (depth0 != null ? depth0.sort : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"sort\",\"hash\":{},\"data\":data}) : helper)))\n + \" history-sort-toggle\\\"></i></div>\\r\\n <div class=\\\"reference\\\">REF</div>\\r\\n <div class=\\\"type\\\">Type</div>\\r\\n <div class=\\\"description\\\">Description</div>\\r\\n <div class=\\\"currency\\\">Beginning</div>\\r\\n <div class=\\\"currency\\\">Debit</div>\\r\\n <div class=\\\"currency\\\">(Credit)</div>\\r\\n <div class=\\\"currency\\\">Ending</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.accounts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(6, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row\\\">\\r\\n <div class=\\\"col-xs-6\\\">Total Balance: </div><div class=\\\"col-xs-6 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.endingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n</div>\\r\\n</div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true,\"useDepths\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"6\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {};\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"categoryGroupName\\\"><strong>\"\n + alias2(alias1((depth0 != null ? depth0.reportingCategory : depth0), depth0))\n + \"</strong></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias3,(depth0 != null ? depth0.accounts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(7, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n <div class=\\\"itemrow flex totals-row-group\\\">\\r\\n <div class=\\\"col-xs-9 totalGroupLabel\\\">Total \"\n + alias2(alias1((depth0 != null ? depth0.reportingCategory : depth0), depth0))\n + \"</div>\\r\\n <div class=\\\"col-xs-1\\\"></div>\\r\\n <div class=\\\"col-xs-2 totalGroupBalance currency\\\">\\r\\n <div class=\\\"col-xs-1 dollar-sign\\\"></div>\\r\\n <span>\"\n + alias2((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || helpers.helperMissing).call(alias3,(depth0 != null ? depth0.endingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"itemrow flex\\\"></div>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=container.escapeExpression, alias2=depth0 != null ? depth0 : {}, alias3=helpers.helperMissing;\n\n return \" <div class=\\\"itemrow flex\\\">\\r\\n <div class=\\\"col-xs-9\\\">\"\n + alias1(container.lambda((depth0 != null ? depth0.accountName : depth0), depth0))\n + \"</div>\\r\\n <div class=\\\"col-xs-1\\\"></div>\\r\\n <div class=\\\"col-xs-2 currency\\\">\\r\\n <div class=\\\"col-xs-1 dollar-sign\\\">\\r\\n\"\n + ((stack1 = (helpers.if_eq || (depth0 && depth0.if_eq) || alias3).call(alias2,(container.data(data, 1) && container.data(data, 1).index),0,{\"name\":\"if_eq\",\"hash\":{},\"fn\":container.program(8, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <span>\"\n + alias1((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias3).call(alias2,(depth0 != null ? depth0.endingBalance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span>\\r\\n </div>\\r\\n </div>\\r\\n\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" \"\n + ((stack1 = (helpers.if_eq || (depth0 && depth0.if_eq) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(data && data.index),0,{\"name\":\"if_eq\",\"hash\":{},\"fn\":container.program(9, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n\";\n},\"9\":function(container,depth0,helpers,partials,data) {\n return \"$\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report Start\",\"inputId\":\"start-date\",\"wrapperClasses\":\"start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" -\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report End\",\"inputId\":\"end-date\",\"wrapperClasses\":\"end-date\",\"inputName\":\"endDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(1, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"incomeStatementReport reportData table table-striped table-hover\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.reportingGroups : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(6, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n <div class=\\\"itemrow flex totals-row assetsTotal\\\">\\r\\n <div class=\\\"col-xs-9 totalLabel\\\">Net Income</div>\\r\\n <div class=\\\"col-xs-1\\\"></div>\\r\\n <div class=\\\"col-xs-2 totalBalance currency\\\">\\r\\n <div class=\\\"col-xs-1 dollar-sign\\\">$</div>\\r\\n <span>\"\n + container.escapeExpression((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.netIncome : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"itemrow flex\\\"></div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true,\"useDepths\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar Template = require('reports/income-statement/template')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar IncomeStatementReportView = Backbone.View.extend({\r\n\r\n events: {\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.createViewModel()))\r\n\r\n $('.datepicker').remove()\r\n\r\n // Start Date\r\n this.$('.start-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('startDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, refresh\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('startDate', moment(e.date).startOf('day'))\r\n this.$('.start-date .date').datepicker('hide', null)\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('show')\r\n this.$('.end-date .date').find('input').focus()\r\n } else {\r\n this.model.set('startDate', moment().startOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // End Date\r\n this.$('.end-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('datesSelected')\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, refresh\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.end-date .date').datepicker('hide', null)\r\n } else {\r\n this.model.set('endDate', moment().endOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.start-date .date').datepicker('setEndDate', this.model.get('endDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n var report = this.model.get('report')\r\n\r\n return {\r\n reportingGroups: report.reportingGroups,\r\n companyName: report.companyName,\r\n endDate: moment(report.endDate),\r\n startDate: moment(report.startDate),\r\n sort: report.sort,\r\n endingBalance: report.endingBalance,\r\n isAccrual: report.isAccrual,\r\n netIncome: report.netIncome\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n\r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').reportingGroups.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n\r\n ribbon: function (message) {\r\n return RibbonTemplate({message: message})\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').reportingGroups.length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n\r\n})\r\n\r\nmodule.exports = IncomeStatementReportView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar IncomeStatementReportView = require('reports/income-statement/view')\r\nvar ReportService = require('reports/report-service')\r\n\r\nvar IncomeStatementReportWidget = function () {\r\n this.model = new Backbone.Model({\r\n startDate: moment().startOf('month'),\r\n endDate: moment().endOf('month')\r\n })\r\n\r\n this.reportService = new ReportService()\r\n this.view = new IncomeStatementReportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('datesSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', _.ary(this.updateReport, 0), this)\r\n \r\n this.fetchReport()\r\n}\r\n\r\nIncomeStatementReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nIncomeStatementReportWidget.prototype.fetchReport = function () {\r\n this.reportService.fetchIncomeStatementReport().then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n\r\n if (report.reportingGroups.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nIncomeStatementReportWidget.prototype.updateReport = function () {\r\n this.reportService.fetchIncomeStatementReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort')).then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n \r\n if (report.reportingGroups.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nIncomeStatementReportWidget.prototype.downloadReport = function () {\r\n this.reportService.downloadIncomeStatementReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = IncomeStatementReportWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar _ = require('lodash')\r\n\r\nvar InfoReturnEntry = Backbone.Model.extend({\r\n toJSON: function () {\r\n var cloned = _.clone(this.attributes)\r\n cloned.details = _.map(this.get('details'), function (detail) {\r\n if (detail.toJSON) {\r\n return detail.toJSON()\r\n } else {\r\n return detail\r\n }\r\n })\r\n\r\n return cloned\r\n }\r\n}, {\r\n parse: function (json) {\r\n var debitSummation = 0\r\n\r\n var reportEntry = new InfoReturnEntry({\r\n memorizedEntryId: json.memorizedEntryId,\r\n memorizedEntryDate: moment(json.memorizedEntryDate),\r\n voidJournal: json.voidJournal,\r\n isReverse: json.isReverse,\r\n reference: json.reference || {name: json.journalType === 'Check' ? json.check.checkNumber : ''},\r\n vendor: json.vendor,\r\n postedDate: moment(json.postedDate).format('MM/DD/YYYY'),\r\n id: json.id,\r\n is1099: json.is1099,\r\n journalType: json.journalType,\r\n description: json.description,\r\n notes: json.notes,\r\n details: _.map(json.lineItems, function (lineItem) {\r\n var lineItemDistribution = {\r\n credit: lineItem.credit,\r\n debit: lineItem.debit,\r\n ledgerAccountId: lineItem.ledgerAccountId,\r\n amount: lineItem.credit || lineItem.debit,\r\n accountName: lineItem.ledgerAccount.accountName,\r\n accountNumber: lineItem.ledgerAccount.accountNumber\r\n\r\n }\r\n debitSummation = debitSummation + Number(lineItem.debit)\r\n return lineItemDistribution\r\n }),\r\n check: json.check ? {\r\n status: json.staus,\r\n checkNumber: json.check.checkNumber,\r\n isPosted: json.check.isPosted,\r\n printedName: json.check.printedName,\r\n isHandwritten: json.check.handwritten,\r\n memo: json.check.memo,\r\n address: json.check.address ? {\r\n addressLine1: json.check.address.addressLine1,\r\n addressLine2: json.check.address.addressLine2,\r\n city: json.check.address.city,\r\n state: json.check.address.state,\r\n zip: json.check.address.postalCode\r\n } : null\r\n } : null\r\n })\r\n\r\n reportEntry.set('debitSummation', debitSummation)\r\n\r\n return reportEntry\r\n }\r\n})\r\n\r\nmodule.exports = InfoReturnEntry\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Entry = require('reports/information-return-report/entry')\r\nvar _ = require('lodash')\r\n\r\nvar InformationReturnReport = Backbone.Model.extend({\r\n toJSON: function () {\r\n var cloned = _.clone(this.attributes)\r\n\r\n cloned.entries = _.map(cloned.entries, function (entry) {\r\n return entry.toJSON()\r\n })\r\n\r\n return cloned\r\n }\r\n}, {\r\n parse: function (json) {\r\n var debitSummation = 0\r\n var accountReport = new InformationReturnReport({\r\n name: json.name,\r\n items: _.map(json.items, function (journalEntry) {\r\n var reportJournalEntry = Entry.parse(journalEntry)\r\n debitSummation = debitSummation + reportJournalEntry.get('debitSummation')\r\n\r\n return reportJournalEntry\r\n })\r\n })\r\n\r\n accountReport.set('debitSummation', debitSummation)\r\n\r\n return accountReport\r\n }\r\n})\r\n\r\nmodule.exports = InformationReturnReport\r\n","'use strict'\r\n\r\nvar RestClient = require('rest/client')\r\nvar Config = require('config/config')\r\nvar _ = require('underscore')\r\nvar $ = require('jquery')\r\nvar InformationReturnReport = require('reports/information-return-report/report')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar InformationReturnReportService = function () {\r\n this.client = new RestClient()\r\n this.companyService = new CompanyService()\r\n}\r\n\r\nInformationReturnReportService.prototype.fetchInformationReturnReport = function (startDate, endDate, dateSort) {\r\n var urlParams = {}\r\n if (startDate) {\r\n urlParams.startDate = startDate.toISOString()\r\n }\r\n\r\n if (endDate) {\r\n urlParams.endDate = endDate.toISOString()\r\n }\r\n\r\n if (dateSort) {\r\n urlParams.sort = dateSort\r\n } else {\r\n urlParams.sort = 'asc'\r\n }\r\n\r\n urlParams = $.param(urlParams)\r\n if (urlParams) {\r\n urlParams = '?' + urlParams\r\n }\r\n\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.client.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/information-return-report' + urlParams)\r\n .then(function (response) {\r\n response.checks = _.chain(response.checks)\r\n .map(function (report) {\r\n var infoReturnReport = InformationReturnReport.parse(report)\r\n return infoReturnReport\r\n })\r\n .value()\r\n\r\n response.endDate = new Date(response.endDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n response.startDate = new Date(response.startDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n response.companyName = response.companyName\r\n response.isAccrual = response.isAccrual\r\n\r\n return response\r\n })\r\n}\r\n\r\nInformationReturnReportService.prototype.downloadInformationReturnReport = function (startDate, endDate, dateSort) {\r\n var urlParams = {}\r\n if (startDate) {\r\n urlParams.startDate = startDate.toISOString()\r\n }\r\n\r\n if (endDate) {\r\n urlParams.endDate = endDate.toISOString()\r\n }\r\n\r\n if (dateSort) {\r\n urlParams.sort = dateSort\r\n } else {\r\n urlParams.sort = 'asc'\r\n }\r\n\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.client.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/information-return-report/export', urlParams)\r\n}\r\n\r\nmodule.exports = InformationReturnReportService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"comapnyName\\\"><strong>\"\n + container.escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</strong></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.items : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.items : depth0)) != null ? stack1.length : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(13, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow accountBuffer flex\\\"></div>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {};\n\n return \" <div class=\\\"itemrow accountTransaction flex\\\">\\r\\n <div class=\\\"type\\\">\"\n + alias2(alias1(((stack1 = (depth0 != null ? depth0.attributes : depth0)) != null ? stack1.journalType : stack1), depth0))\n + \"</div>\\r\\n <div class=\\\"reference\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias3,((stack1 = (depth0 != null ? depth0.attributes : depth0)) != null ? stack1.check : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div> \\r\\n <div class=\\\"date\\\">\"\n + alias2(alias1(((stack1 = (depth0 != null ? depth0.attributes : depth0)) != null ? stack1.postedDate : stack1), depth0))\n + \"</div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias3,((stack1 = (depth0 != null ? depth0.attributes : depth0)) != null ? stack1.details : stack1),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(10, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return container.escapeExpression(container.lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.attributes : depth0)) != null ? stack1.check : stack1)) != null ? stack1.checkNumber : stack1), depth0));\n},\"10\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = (helpers.if_gt_0 || (depth0 && depth0.if_gt_0) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.debit : depth0),{\"name\":\"if_gt_0\",\"hash\":{},\"fn\":container.program(11, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"11\":function(container,depth0,helpers,partials,data) {\n var alias1=container.lambda, alias2=container.escapeExpression;\n\n return \" <div class=\\\"description\\\">\"\n + alias2(alias1((depth0 != null ? depth0.accountName : depth0), depth0))\n + \"</div>\\r\\n <div class=\\\"accountNumber\\\">\"\n + alias2(alias1((depth0 != null ? depth0.accountNumber : depth0), depth0))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias2((helpers[\"numbro-report\"] || (depth0 && depth0[\"numbro-report\"]) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.debit : depth0),{\"name\":\"numbro-report\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n\";\n},\"13\":function(container,depth0,helpers,partials,data) {\n return \"\\r\\n <div class=\\\"itemrow flex totals-row\\\">\\r\\n <div class=\\\"description\\\"></div>\\r\\n <div class=\\\"col-xs-6 totalLabel\\\">Total: </div>\\r\\n <div class=\\\"col-xs-6 totalBalance currency\\\">\"\n + container.escapeExpression((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.debitSummation : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report Start\",\"inputId\":\"start-date\",\"wrapperClasses\":\"start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" -\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report End\",\"inputId\":\"end-date\",\"wrapperClasses\":\"end-date\",\"inputName\":\"endDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary download\\\">\\r\\n Download\\r\\n </button>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"infoReturnReport reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"type\\\">Type</div>\\r\\n <div class=\\\"reference\\\">#/REF</div>\\r\\n <div class=\\\"date\\\">Date <i class=\\\"fa fa-sort-\"\n + container.escapeExpression(((helper = (helper = helpers.sort || (depth0 != null ? depth0.sort : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"sort\",\"hash\":{},\"data\":data}) : helper)))\n + \" history-sort-toggle\\\"></i></div> \\r\\n <div class=\\\"description\\\">Distribution Account</div>\\r\\n <div class=\\\"accountNumber\\\">Account #</div>\\r\\n <div class=\\\"currency\\\">Amount</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.checks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar InfoReturnReportTemplate = require('reports/information-return-report/template')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar InformationReturnReport = Backbone.View.extend({\r\n\r\n events: {\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noChecks', this.noChecks, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(InfoReturnReportTemplate(this.createViewModel()))\r\n\r\n $('.datepicker').remove()\r\n\r\n // Start Date\r\n this.$('.start-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('startDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, close and open end date\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('startDate', moment(e.date).startOf('day'))\r\n this.$('.start-date .date').datepicker('hide', null)\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('show')\r\n this.$('.end-date .date').find('input').focus()\r\n } else {\r\n this.model.set('startDate', moment().startOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // End Date\r\n this.$('.end-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('datesSelected')\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, refresh\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.end-date .date').datepicker('hide', null)\r\n } else {\r\n this.model.set('endDate', moment().endOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.start-date .date').datepicker('setEndDate', this.model.get('endDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n var report = this.model.get('report')\r\n return {\r\n checks: _.chain(report.checks).map(function (check) {\r\n return check.toJSON()\r\n }).value(),\r\n companyName: report.companyName,\r\n endDate: moment(report.endDate),\r\n startDate: moment(report.startDate),\r\n sort: report.sort,\r\n isAccrual: report.isAccrual\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n\r\n noChecks: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').checks.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n \r\n ribbon:function(message) {\r\n return RibbonTemplate({message: message})\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').checks.length > 0) {\r\n this.trigger('download')\r\n }\r\n } \r\n \r\n})\r\n\r\nmodule.exports = InformationReturnReport\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar InformationReturnReportView = require('reports/information-return-report/view')\r\nvar InformationReturnReportService = require('reports/information-return-report/service')\r\n\r\nvar InformationReturnReportWidget = function () {\r\n this.model = new Backbone.Model({\r\n startDate: moment().startOf('month'),\r\n endDate: moment().endOf('month')\r\n })\r\n\r\n this.view = new InformationReturnReportView({\r\n model: this.model\r\n })\r\n this.service = new InformationReturnReportService()\r\n\r\n this.view.on('datesSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', function () {\r\n this.updateReport()\r\n }.bind(this))\r\n\r\n this.fetchReport()\r\n}\r\n\r\nInformationReturnReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nInformationReturnReportWidget.prototype.fetchReport = function () {\r\n this.service.fetchInformationReturnReport().then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n\r\n if (report.checks.length <= 0) {\r\n return this.view.trigger('noChecks')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noChecks', error)\r\n }.bind(this))\r\n}\r\n\r\nInformationReturnReportWidget.prototype.updateReport = function () {\r\n this.service.fetchInformationReturnReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort')).then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n\r\n if (report.checks.length <= 0) {\r\n return this.view.trigger('noChecks')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nInformationReturnReportWidget.prototype.downloadReport = function () {\r\n this.service.downloadInformationReturnReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = InformationReturnReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"6\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"rate\\\"><strong>\"\n + alias3(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</strong></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.sales : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(7, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row no-padding\\\">\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 type indented\\\"></div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 number invoiceNumber\\\"></div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 date\\\"></div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 currency\\\">Total:</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.totalSale : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.taxableAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.exemptAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.taxAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow accountBuffer flex\\\"></div>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountTransaction flex no-padding\\\">\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 type indented\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depths[1] != null ? depths[1].isAccrual : depths[1]),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(8, data, 0, blockParams, depths),\"inverse\":container.program(10, data, 0, blockParams, depths),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 number invoiceNumber\\\">\"\n + alias4(((helper = (helper = helpers.invoiceNumber || (depth0 != null ? depth0.invoiceNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"invoiceNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 date\\\">\"\n + alias4(((helper = (helper = helpers.postedDate || (depth0 != null ? depth0.postedDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"postedDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 currency\\\"></div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.totalSale : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.taxableAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.exemptAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.taxAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n return \"AR\";\n},\"10\":function(container,depth0,helpers,partials,data) {\n return \"AR Payment\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report Start\",\"inputId\":\"start-date\",\"wrapperClasses\":\"start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" -\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report End\",\"inputId\":\"end-date\",\"wrapperClasses\":\"end-date\",\"inputName\":\"endDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(1, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"item-sales-journal-report reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex no-padding\\\">\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 type indented\\\">Type</div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 number invoiceNumber\\\">Invoice #</div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 date\\\">Date</div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 currency\\\"></div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency totalSale\\\">Total Sale</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency taxable\\\">Taxable</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency exempt\\\">Exempt</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency salesTax\\\">Sales Tax</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.groups : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(6, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row no-padding\\\">\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 type indented\\\"></div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 number invoiceNumber\\\"></div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 date\\\"></div>\\r\\n <div class=\\\"col-xs-1 col-md-1 col-lg-1 currency\\\">Grand Total:</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandTotalSale : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandTaxableAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandExemptAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 col-md-2 col-lg-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.grandSalesTax : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true,\"useDepths\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar Template = require('reports/item-sales-journal/template')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar ItemSalesJournalReportView = Backbone.View.extend({\r\n\r\n events: {\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.createViewModel()))\r\n\r\n $('.datepicker').remove()\r\n\r\n // Start Date\r\n this.$('.start-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('startDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, close and open end date\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('startDate', moment(e.date).startOf('day'))\r\n this.$('.start-date .date').datepicker('hide', null)\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('show')\r\n this.$('.end-date .date').find('input').focus()\r\n } else {\r\n this.model.set('startDate', moment().startOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // End Date\r\n this.$('.end-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('datesSelected')\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, refresh\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.end-date .date').datepicker('hide', null)\r\n } else {\r\n this.model.set('endDate', moment().endOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.start-date .date').datepicker('setEndDate', this.model.get('endDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n var report = this.model.get('report')\r\n _.map (report.groups, function (vendor) {\r\n _.map (vendor.sales, function (sale) {\r\n sale.postedDate = moment(sale.postedDate).format(dateParams.format) \r\n }) \r\n })\r\n return {\r\n groups: report.groups,\r\n companyName: report.companyName,\r\n endDate: moment(report.endDate),\r\n startDate: moment(report.startDate),\r\n sort: report.sort,\r\n isAccrual: report.isAccrual,\r\n grandTotalSale: report.totalSale,\r\n grandTaxableAmount: report.taxableAmount,\r\n grandExemptAmount: report.exemptAmount,\r\n grandSalesTax: report.taxAmount\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n \r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').groups.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n \r\n ribbon: function (message) {\r\n return RibbonTemplate({message: message})\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').groups.length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n\r\n})\r\n\r\nmodule.exports = ItemSalesJournalReportView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar ItemSalesJournalReportView = require('reports/item-sales-journal/view')\r\nvar ReportService = require('reports/report-service')\r\n\r\nvar ItemSalesJournalReportWidget = function () {\r\n this.model = new Backbone.Model({\r\n startDate: moment().startOf('month'),\r\n endDate: moment().endOf('month')\r\n })\r\n\r\n this.reportService = new ReportService()\r\n this.view = new ItemSalesJournalReportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('datesSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', _.ary(this.updateReport, 0), this)\r\n\r\n this.fetchReport()\r\n}\r\n\r\nItemSalesJournalReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nItemSalesJournalReportWidget.prototype.fetchReport = function () {\r\n this.reportService.fetchItemSalesJournalReport().then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n\r\n if (report.groups.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this).bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nItemSalesJournalReportWidget.prototype.updateReport = function () {\r\n this.reportService.fetchItemSalesJournalReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort')).then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n \r\n if (report.groups.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nItemSalesJournalReportWidget.prototype.downloadReport = function () {\r\n this.reportService.downloadItemSalesJournalReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = ItemSalesJournalReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"6\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"rate\\\"><strong>\"\n + alias3(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</strong></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.payables : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(7, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row no-padding\\\">\\r\\n <div class=\\\"col-xs-11 text-right\\\">Purchase Amount: </div><div class=\\\"col-xs-1 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.purchaseAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow accountBuffer flex\\\"></div>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountTransaction flex\\\">\\r\\n <div class=\\\"type indented\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depths[2] != null ? depths[2].isAccrual : depths[2]),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(8, data, 0, blockParams, depths),\"inverse\":container.program(10, data, 0, blockParams, depths),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"date\\\">\"\n + alias4(((helper = (helper = helpers.postedDate || (depth0 != null ? depth0.postedDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"postedDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"description\\\">\"\n + alias4(((helper = (helper = helpers.accountName || (depth0 != null ? depth0.accountName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"number\\\">\"\n + alias4(((helper = (helper = helpers.accountNumber || (depth0 != null ? depth0.accountNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.amount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n return \"AP\";\n},\"10\":function(container,depth0,helpers,partials,data) {\n return \"AP Payment\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"reportControls\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report Start\",\"inputId\":\"start-date\",\"wrapperClasses\":\"start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" -\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report End\",\"inputId\":\"end-date\",\"wrapperClasses\":\"end-date\",\"inputName\":\"endDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(1, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"type indented\\\">Type</div>\\r\\n <div class=\\\"date\\\">Date</div>\\r\\n <div class=\\\"description\\\">Distribution Account</div>\\r\\n <div class=\\\"number\\\">Account #</div>\\r\\n <div class=\\\"currency\\\">Amount</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.vendors : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(6, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true,\"useDepths\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar Template = require('reports/purchases-journal/template')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar PurchasesJournalReportView = Backbone.View.extend({\r\n\r\n events: {\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.createViewModel()))\r\n\r\n $('.datepicker').remove()\r\n\r\n // Start Date\r\n this.$('.start-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('startDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, close and open end date\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('startDate', moment(e.date).startOf('day'))\r\n this.$('.start-date .date').datepicker('hide', null)\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('show')\r\n this.$('.end-date .date').find('input').focus()\r\n } else {\r\n this.model.set('startDate', moment().startOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // End Date\r\n this.$('.end-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('datesSelected')\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, refresh\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.end-date .date').datepicker('hide', null)\r\n } else {\r\n this.model.set('endDate', moment().endOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.start-date .date').datepicker('setEndDate', this.model.get('endDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n var report = this.model.get('report')\r\n\r\n _.map (report.vendors, function (vendor) {\r\n _.map (vendor.payables, function (payable) {\r\n payable.postedDate = moment(payable.postedDate).format(dateParams.format) \r\n }) \r\n })\r\n return {\r\n vendors: report.vendors,\r\n companyName: report.companyName,\r\n endDate: moment(report.endDate),\r\n startDate: moment(report.startDate),\r\n sort: report.sort,\r\n isAccrual: report.isAccrual\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n \r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').vendors.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n \r\n ribbon: function (message) {\r\n return RibbonTemplate({message: message})\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').vendors.length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n\r\n})\r\n\r\nmodule.exports = PurchasesJournalReportView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar PurchasesJournalReportView = require('reports/purchases-journal/view')\r\nvar ReportService = require('reports/report-service')\r\n\r\nvar PurchasesJournalReportWidget = function () {\r\n this.model = new Backbone.Model({\r\n startDate: moment().startOf('month'),\r\n endDate: moment().endOf('month')\r\n })\r\n\r\n this.reportService = new ReportService()\r\n this.view = new PurchasesJournalReportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('datesSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', _.ary(this.updateReport, 0), this)\r\n \r\n this.fetchReport()\r\n}\r\n\r\nPurchasesJournalReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nPurchasesJournalReportWidget.prototype.fetchReport = function () {\r\n this.reportService.fetchPurchasesJournalReport().then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n\r\n if (report.vendors.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nPurchasesJournalReportWidget.prototype.updateReport = function () {\r\n this.reportService.fetchPurchasesJournalReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort')).then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n \r\n if (report.vendors.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nPurchasesJournalReportWidget.prototype.downloadReport = function () {\r\n this.reportService.downloadPurchasesJournalReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = PurchasesJournalReportWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar ViewGeneralLedgerReportWidget = require('reports/general-ledger-report/view-general-ledger-report-widget')\r\nvar TrialBalanceReportWidget = require('reports/trial-balance/report-widget')\r\nvar CheckbookReconciliationReportWidget = require('reports/checkbook/reconciliation/widget')\r\nvar ChartOfAccountsReportWidget = require('reports/chart-of-accounts/widget')\r\nvar CheckbookRegisterReportWidget = require('reports/checkbook-register/widget')\r\nvar CheckbookDisbursementsReportWidget = require('reports/checkbook-disbursements/widget')\r\nvar SalesTaxRateReportWidget = require('reports/sales-tax-rate/widget')\r\nvar DepartmentReportWidget = require('reports/department/widget')\r\nvar CustomerListReportWidget = require('reports/customer-list/widget')\r\nvar VendorListReportWidget = require('reports/vendor-list/widget')\r\nvar InformationReturnReportWidget = require('reports/information-return-report/widget')\r\nvar AccountsPayableAgingReportWidget = require('reports/accounts-payable-aging/widget')\r\nvar AccountsReceivableAgingReportWidget = require('reports/accounts-receivable-aging/widget')\r\nvar BalanceSheetReportWidget = require('reports/balance-sheet/widget')\r\nvar IncomeStatementReportWidget = require('reports/income-statement/widget')\r\nvar FixedAssetReportWidget = require('reports/fixed-asset/widget')\r\nvar PurchasesJournalReportWidget = require('reports/purchases-journal/widget')\r\nvar CustomerSalesJournalReportWidget = require('reports/customer-sales-journal/widget')\r\nvar ItemSalesJournalReportWidget = require('reports/item-sales-journal/widget')\r\n\r\nvar ReportRouter = Router.extend({\r\n routes: {\r\n 'reports/general-ledger': 'showGeneralLedgerReport',\r\n 'reports/trial-balance': 'showTrialBalanceReport',\r\n 'reports/reconciliation': 'showCheckbookReconciliationReport',\r\n 'reports/chart-of-accounts': 'showChartOfAccountsReport',\r\n 'reports/checkbook-register': 'showCheckbookRegisterReport',\r\n 'reports/checkbook-disbursements': 'showCheckbookDisbursementsReport',\r\n 'reports/sales-tax-rate': 'showSalesTaxRateReport',\r\n 'reports/departments': 'showDepartmentReport',\r\n 'reports/customer-list': 'showCustomerListReport',\r\n 'reports/vendor-list': 'showVendorListReport',\r\n 'reports/information-return-report': 'showInfomationReturnReport',\r\n 'reports/accounts-payable-aging': 'showAccountsPayableAgingReport',\r\n 'reports/accounts-receivable-aging': 'showAccountsReceivableAgingReport',\r\n 'reports/balance-sheet': 'showBalanceSheetReport',\r\n 'reports/income-statement': 'showIncomeStatementReport',\r\n 'reports/fixed-asset': 'showFixedAssetReport',\r\n 'reports/purchases-journal': 'showPurchasesJournalReport',\r\n 'reports/customer-sales-journal': 'showCustomerSalesJournalReport',\r\n 'reports/item-sales-journal': 'showItemSalesJournalReport'\r\n },\r\n\r\n showGeneralLedgerReport: function () {\r\n Backbone.trigger('app:showInFrame', new ViewGeneralLedgerReportWidget())\r\n Backbone.trigger('app:updateTitle', 'General Ledger Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'General Ledger Report' }])\r\n },\r\n\r\n showTrialBalanceReport: function () {\r\n Backbone.trigger('app:showInFrame', new TrialBalanceReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Trial Balance Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Trial Balance Report' }])\r\n },\r\n\r\n showCheckbookReconciliationReport: function () {\r\n Backbone.trigger('app:showInFrame', new CheckbookReconciliationReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Checkbook Reconciliation Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Checkbook Reconciliation Report' }])\r\n },\r\n\r\n showChartOfAccountsReport: function () {\r\n Backbone.trigger('app:showInFrame', new ChartOfAccountsReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Chart of Accounts List', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Chart of Accounts List' }])\r\n },\r\n\r\n showCheckbookRegisterReport: function () {\r\n Backbone.trigger('app:showInFrame', new CheckbookRegisterReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Checkbook Register Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Checkbook Register Report' }])\r\n },\r\n\r\n showCheckbookDisbursementsReport: function () {\r\n Backbone.trigger('app:showInFrame', new CheckbookDisbursementsReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Checkbook Disbursements Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Checkbook Disbursements Report' }])\r\n },\r\n\r\n showSalesTaxRateReport: function () {\r\n Backbone.trigger('app:showInFrame', new SalesTaxRateReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Sales Tax Rate Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Sales Tax Rate Report' }])\r\n },\r\n\r\n showDepartmentReport: function () {\r\n Backbone.trigger('app:showInFrame', new DepartmentReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Departments', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Departments' }])\r\n },\r\n\r\n showCustomerListReport: function () {\r\n Backbone.trigger('app:showInFrame', new CustomerListReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Customer List', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Customer List' }])\r\n },\r\n\r\n showVendorListReport: function () {\r\n Backbone.trigger('app:showInFrame', new VendorListReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Vendor List', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Vendor List' }])\r\n },\r\n\r\n showInfomationReturnReport: function () {\r\n Backbone.trigger('app:showInFrame', new InformationReturnReportWidget())\r\n Backbone.trigger('app:updateTitle', '1099 Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: '1099 Report' }])\r\n },\r\n\r\n showAccountsPayableAgingReport: function () {\r\n Backbone.trigger('app:showInFrame', new AccountsPayableAgingReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Accounts Payable Aging Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Accounts Payable Aging Report' }])\r\n },\r\n\r\n showAccountsReceivableAgingReport: function () {\r\n Backbone.trigger('app:showInFrame', new AccountsReceivableAgingReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Accounts Receivable Aging Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Accounts Receivable Aging Report' }])\r\n },\r\n\r\n showBalanceSheetReport: function () {\r\n Backbone.trigger('app:showInFrame', new BalanceSheetReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Balance Sheet Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Balance Sheet Report' }])\r\n },\r\n\r\n showIncomeStatementReport: function () {\r\n Backbone.trigger('app:showInFrame', new IncomeStatementReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Income Statement Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Income Statement Report' }])\r\n },\r\n\r\n showFixedAssetReport: function () {\r\n Backbone.trigger('app:showInFrame', new FixedAssetReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Fixed Asset List', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Fixed Asset List' }])\r\n },\r\n\r\n showPurchasesJournalReport: function () {\r\n Backbone.trigger('app:showInFrame', new PurchasesJournalReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Purchases Journal Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Purchases Journal Report' }])\r\n },\r\n\r\n showCustomerSalesJournalReport: function () {\r\n Backbone.trigger('app:showInFrame', new CustomerSalesJournalReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Customer Sales Journal Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: 'Customer Sales Journal Report' }])\r\n },\r\n\r\n showItemSalesJournalReport: function () {\r\n Backbone.trigger('app:showInFrame', new ItemSalesJournalReportWidget())\r\n Backbone.trigger('app:updateTitle', 'Item Sales Journal Report', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{ label: 'Reports' }, { label: '\"Item Sales Journal Report' }])\r\n }\r\n\r\n})\r\n\r\nmodule.exports = ReportRouter\r\n","'use strict'\r\n\r\nvar $ = require('jquery')\r\nvar _ = require('underscore')\r\nvar moment = require('moment')\r\nvar Config = require('config/config')\r\nvar RestClient = require('rest/client')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar ReconciliationReport = require('reports/checkbook/reconciliation/report')\r\n\r\nvar ReportService = function () {\r\n this.restClient = new RestClient()\r\n this.companyService = new CompanyService()\r\n}\r\n\r\nReportService.prototype.fetchReconciliationReport = function (checkbookId, reconciliationId, sort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'reports',\r\n 'checkbook-reconciliation-report',\r\n reconciliationId\r\n ]\r\n\r\n var apiPath = actionPathElements.join('/')\r\n\r\n var parameters = {}\r\n if (sort) {\r\n parameters.sort = sort\r\n\r\n apiPath = apiPath + '?' + $.param(parameters)\r\n }\r\n\r\n return this.restClient.get(apiPath).then(function (reconciliation) {\r\n return ReconciliationReport.parse(reconciliation)\r\n })\r\n}\r\n\r\nReportService.prototype.downloadReconciliationReport = function (checkbookId, reconciliationId) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'reports',\r\n 'checkbook-reconciliation-report',\r\n reconciliationId,\r\n 'export'\r\n ]\r\n\r\n var apiPath = actionPathElements.join('/')\r\n\r\n return this.restClient.download(apiPath)\r\n}\r\n\r\nReportService.prototype.downloadChartOfAccounts = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.restClient.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/chart-of-accounts-report/export')\r\n}\r\n\r\nReportService.prototype.fetchSalesTaxRateReport = function (startDate, endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/sales-tax-rate-report' + this.getReportUrlParams(startDate, endDate, dateSort))\r\n .then(function (response) {\r\n response.taxRates = _.chain(response.taxRates)\r\n .map(function (report) {\r\n report.invoices = _.chain(report.invoices)\r\n .map(function (invoice) {\r\n invoice.exemptAmount = invoice.totalSale - invoice.taxableAmount\r\n invoice.date = moment(invoice.journalEntry.postedDate).format('MM/DD/YYYY')\r\n\r\n return invoice\r\n })\r\n .value()\r\n\r\n return report\r\n })\r\n .value()\r\n\r\n response.endDate = new Date(response.endDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n response.startDate = new Date(response.startDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.downloadSalesTaxRateReport = function (startDate, endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.restClient.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/sales-tax-rate-report/export', this.getUrlParams(startDate, endDate, dateSort))\r\n}\r\n\r\nReportService.prototype.fetchIncomeStatementReport = function (startDate, endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/income-statement-report' + this.getReportUrlParams(startDate, endDate, dateSort))\r\n .then(function (response) {\r\n response.endDate = new Date(response.endDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n response.startDate = new Date(response.startDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.downloadIncomeStatementReport = function (startDate, endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.restClient.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/income-statement-report/export', this.getUrlParams(startDate, endDate, dateSort))\r\n}\r\n\r\nReportService.prototype.fetchCustomerListReport = function (sort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/customer-list-report' + this.getReportUrlParams(null, null, sort))\r\n .then(function (response) {\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.downloadCustomerListReport = function (sort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.restClient.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/customer-list-report/export', this.getUrlParams(null, null, sort))\r\n}\r\n\r\nReportService.prototype.fetchVendorListReport = function (sort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/vendor-list-report' + this.getReportUrlParams(null, null, sort))\r\n .then(function (response) {\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.downloadVendorListReport = function (sort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.restClient.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/vendor-list-report/export', this.getUrlParams(null, null, sort))\r\n}\r\n\r\nReportService.prototype.fetchAccountsPayableAgingReport = function (endDate, dateSort) {\r\n var urlParams = {}\r\n\r\n if (endDate) {\r\n urlParams.endDate = endDate.toISOString()\r\n }\r\n\r\n if (dateSort) {\r\n urlParams.sort = dateSort\r\n } else {\r\n urlParams.sort = 'asc'\r\n }\r\n\r\n urlParams = $.param(urlParams)\r\n if (urlParams) {\r\n urlParams = '?' + urlParams\r\n }\r\n\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/accounts-payable-aging-report' + urlParams)\r\n .then(function (response) {\r\n response.items = _.chain(response.items)\r\n .map(function (report) {\r\n report.payables = _.chain(report.payables)\r\n .map(function (payable) {\r\n payable.dueDate = moment(payable.dueDate).format('MM/DD/YYYY')\r\n payable.invoiceDate = moment(payable.payableDate).format('MM/DD/YYYY')\r\n return payable\r\n })\r\n .value()\r\n\r\n return report\r\n })\r\n .value()\r\n\r\n response.endDate = new Date(response.endDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n response.startDate = new Date(response.startDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.fetchAccountsReceivableAgingReport = function (endDate, dateSort) {\r\n var urlParams = {}\r\n\r\n if (endDate) {\r\n urlParams.endDate = endDate.toISOString()\r\n }\r\n\r\n if (dateSort) {\r\n urlParams.sort = dateSort\r\n } else {\r\n urlParams.sort = 'asc'\r\n }\r\n\r\n urlParams = $.param(urlParams)\r\n if (urlParams) {\r\n urlParams = '?' + urlParams\r\n }\r\n\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/accounts-receivable-aging-report' + urlParams)\r\n .then(function (response) {\r\n response.items = _.chain(response.items)\r\n .map(function (report) {\r\n report.invoices = _.chain(report.invoices)\r\n .map(function (invoice) {\r\n invoice.dueDate = moment(invoice.dueDate).format('MM/DD/YYYY')\r\n invoice.invoiceDate = moment(invoice.date).format('MM/DD/YYYY')\r\n return invoice\r\n })\r\n .value()\r\n\r\n return report\r\n })\r\n .value()\r\n\r\n response.endDate = new Date(response.endDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n response.startDate = new Date(response.startDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.downloadAccountsPayableAgingReport = function (endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.restClient.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/accounts-payable-aging-report/export', this.getUrlParams(null, endDate, dateSort))\r\n}\r\n\r\nReportService.prototype.downloadAccountsReceivableAgingReport = function (endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.restClient.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/accounts-receivable-aging-report/export', this.getUrlParams(null, endDate, dateSort))\r\n}\r\n\r\nReportService.prototype.fetchBalanceSheetReport = function (endDate, dateSort) {\r\n var urlParams = {}\r\n\r\n if (endDate) {\r\n urlParams.endDate = endDate.toISOString()\r\n }\r\n\r\n if (dateSort) {\r\n urlParams.sort = dateSort\r\n } else {\r\n urlParams.sort = 'asc'\r\n }\r\n\r\n urlParams = $.param(urlParams)\r\n if (urlParams) {\r\n urlParams = '?' + urlParams\r\n }\r\n\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/balance-sheet-report' + urlParams)\r\n .then(function (response) {\r\n response.endDate = new Date(response.endDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.downloadBalanceSheetReport = function (endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.restClient.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/balance-sheet-report/export', this.getUrlParams(null, endDate, dateSort))\r\n}\r\n\r\nReportService.prototype.fetchPurchasesJournalReport = function (startDate, endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/purchases-journal-report' + this.getReportUrlParams(startDate, endDate, dateSort))\r\n .then(function (response) {\r\n response.endDate = new Date(response.endDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n response.startDate = new Date(response.startDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.downloadPurchasesJournalReport = function (startDate, endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.restClient.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/purchases-journal-report/export', this.getUrlParams(startDate, endDate, dateSort))\r\n}\r\n\r\nReportService.prototype.fetchFixedAssetListReport = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/fixed-asset-list-report')\r\n .then(function (response) {\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.downloadFixedAssetListReport = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.restClient.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/fixed-asset-list-report/export')\r\n}\r\n\r\nReportService.prototype.fetchCustomerSalesJournalReport = function (startDate, endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/customer-sales-journal-report' + this.getReportUrlParams(startDate, endDate, dateSort))\r\n .then(function (response) {\r\n response.endDate = new Date(response.endDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n response.startDate = new Date(response.startDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.downloadCustomerSalesJournalReport = function (startDate, endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.restClient.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/customer-sales-journal-report/export', this.getUrlParams(startDate, endDate, dateSort))\r\n}\r\n\r\nReportService.prototype.fetchItemSalesJournalReport = function (startDate, endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/item-sales-journal-report' + this.getReportUrlParams(startDate, endDate, dateSort))\r\n .then(function (response) {\r\n response.endDate = new Date(response.endDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n response.startDate = new Date(response.startDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.downloadItemSalesJournalReport = function (startDate, endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.restClient.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/item-sales-journal-report/export', this.getUrlParams(startDate, endDate, dateSort))\r\n}\r\n\r\nReportService.prototype.fetchFinancialStatus = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/financial-status')\r\n .then(function (response) {\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.fetchCheckbookStatus = function (id, filterType) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/checkbook-status/' + id + '?filterType=' + filterType)\r\n .then(function (response) {\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.getIncomeExpenseStatuses = function (filterType) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/accounting-status' + '?filterType=' + filterType)\r\n .then(function (response) {\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.fetchDepartmentReport = function (startDate, endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n return this.restClient.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/department-report' + this.getReportUrlParams(startDate, endDate, dateSort))\r\n .then(function (response) {\r\n _.each(response.departments, function (department) {\r\n _.each(department.invoices, function (invoice) {\r\n invoice.date = moment(invoice.date).format('MM/DD/YYYY')\r\n })\r\n })\r\n\r\n response.endDate = new Date(response.endDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n response.startDate = new Date(response.startDate.replace(/-/g, '\\/').replace(/T.+/, ''))\r\n\r\n return response\r\n })\r\n}\r\n\r\nReportService.prototype.downloadDepartmentReport = function (startDate, endDate, dateSort) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.restClient.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/department-report/export', this.getUrlParams(startDate, endDate, dateSort))\r\n}\r\n\r\nReportService.prototype.getUrlParams = function (startDate, endDate, sort) {\r\n var urlParams = {}\r\n\r\n if (startDate) {\r\n urlParams.startDate = startDate.toISOString()\r\n }\r\n\r\n if (endDate) {\r\n urlParams.endDate = endDate.toISOString()\r\n }\r\n\r\n if (sort) {\r\n urlParams.sort = sort\r\n } else {\r\n urlParams.sort = 'asc'\r\n }\r\n\r\n return urlParams\r\n}\r\n\r\nReportService.prototype.getReportUrlParams = function (startDate, endDate, sort) {\r\n var urlParams = this.getUrlParams(startDate, endDate, sort)\r\n\r\n urlParams = $.param(urlParams)\r\n\r\n if (urlParams) {\r\n urlParams = '?' + urlParams\r\n }\r\n\r\n return urlParams\r\n}\r\n\r\nmodule.exports = ReportService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"rate\\\"><strong>\"\n + alias4(((helper = (helper = helpers.rateId || (depth0 != null ? depth0.rateId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"rateId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</strong></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.invoices : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row no-padding\\\">\\r\\n <div class=\\\"col-xs-10 text-right\\\">\"\n + alias4(((helper = (helper = helpers.rateId || (depth0 != null ? depth0.rateId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"rateId\",\"hash\":{},\"data\":data}) : helper)))\n + \" Liability: </div><div class=\\\"col-xs-2 currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.salesTaxTotal : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow accountBuffer flex\\\"></div>\\r\\n\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountTransaction flex\\\">\\r\\n <div class=\\\"type indented\\\">Invoice</div>\\r\\n <div class=\\\"number\\\">\"\n + alias4(((helper = (helper = helpers.invoiceNumber || (depth0 != null ? depth0.invoiceNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"invoiceNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"date\\\">\"\n + alias4(((helper = (helper = helpers.date || (depth0 != null ? depth0.date : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"date\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"description\\\">\"\n + alias4(container.lambda(((stack1 = (depth0 != null ? depth0.customer : depth0)) != null ? stack1.printedName : stack1), depth0))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.totalSale : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.taxableAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.exemptAmount : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <div class=\\\"currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.salesTax : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report Start\",\"inputId\":\"start-date\",\"wrapperClasses\":\"start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" -\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report End\",\"inputId\":\"end-date\",\"wrapperClasses\":\"end-date\",\"inputName\":\"endDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n<div class=\\\"block-content\\\">\\r\\n<div class=\\\"reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"type indented\\\">Type</div>\\r\\n <div class=\\\"number\\\">Number</div>\\r\\n <div class=\\\"date\\\">Date <i class=\\\"fa fa-sort-\"\n + alias3(((helper = (helper = helpers.sort || (depth0 != null ? depth0.sort : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"sort\",\"hash\":{},\"data\":data}) : helper)))\n + \" history-sort-toggle\\\"></i></div>\\r\\n <div class=\\\"description\\\">Customer</div>\\r\\n <div class=\\\"currency\\\">Total Sale</div>\\r\\n <div class=\\\"currency\\\">Taxable</div>\\r\\n <div class=\\\"currency\\\">Exempt</div>\\r\\n <div class=\\\"currency\\\">Sales Tax</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.taxRates : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow flex totals-row no-padding\\\">\\r\\n <div class=\\\"col-xs-10 text-right\\\">Total Liability: </div><div class=\\\"col-xs-2 currency\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.totalLiability : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n</div>\\r\\n</div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar Template = require('reports/sales-tax-rate/template')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar SalesTaxRateReportView = Backbone.View.extend({\r\n\r\n events: {\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.createViewModel()))\r\n\r\n $('.datepicker').remove()\r\n\r\n // Start Date\r\n this.$('.start-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('startDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, close and open end date\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('startDate', moment(e.date).startOf('day'))\r\n this.$('.start-date .date').datepicker('hide', null)\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('show')\r\n this.$('.end-date .date').find('input').focus()\r\n } else {\r\n this.model.set('startDate', moment().startOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // End Date\r\n this.$('.end-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('datesSelected')\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, refresh\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.end-date .date').datepicker('hide', null)\r\n } else {\r\n this.model.set('endDate', moment().endOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.start-date .date').datepicker('setEndDate', this.model.get('endDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n var report = this.model.get('report')\r\n return {\r\n taxRates: report.taxRates,\r\n totalLiability: report.totalLiability,\r\n companyName: report.companyName,\r\n endDate: moment(report.endDate),\r\n startDate: moment(report.startDate),\r\n sort: report.sort,\r\n endingBalance: report.endingBalance,\r\n isAccrual: report.isAccrual\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n \r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').taxRates.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n \r\n ribbon: function (message) {\r\n return RibbonTemplate({message: message})\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').taxRates.length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n\r\n})\r\n\r\nmodule.exports = SalesTaxRateReportView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar SalesTaxRateReportView = require('reports/sales-tax-rate/view')\r\nvar ReportService = require('reports/report-service')\r\n\r\nvar SalesTaxRateReportWidget = function () {\r\n this.model = new Backbone.Model({\r\n startDate: moment().startOf('month'),\r\n endDate: moment().endOf('month')\r\n })\r\n\r\n this.reportService = new ReportService()\r\n this.view = new SalesTaxRateReportView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('datesSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', function () {\r\n this.updateReport()\r\n }.bind(this))\r\n\r\n this.fetchReport()\r\n}\r\n\r\nSalesTaxRateReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nSalesTaxRateReportWidget.prototype.fetchReport = function () {\r\n this.reportService.fetchSalesTaxRateReport().then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n\r\n if (report.taxRates.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nSalesTaxRateReportWidget.prototype.updateReport = function () {\r\n this.reportService.fetchSalesTaxRateReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort')).then(function (report) {\r\n this.model.set({\r\n report: report,\r\n startDate: moment(report.startDate),\r\n endDate: moment(report.endDate),\r\n sort: report.sort\r\n })\r\n \r\n if (report.taxRates.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nSalesTaxRateReportWidget.prototype.downloadReport = function () {\r\n this.reportService.downloadSalesTaxRateReport(this.model.get('startDate'), this.model.get('endDate'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = SalesTaxRateReportWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar moment = require('moment')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar TrialBalanceReport = require('reports/trial-balance/report')\r\nvar MaskedInput = require('jquery.maskedinput')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar ViewGeneralLedgerReportView = Backbone.View.extend({\r\n\r\n className: 'trial-balance-report',\r\n\r\n events: {\r\n 'click .history-sort-toggle': 'sortToggle',\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(TrialBalanceReport(this.createViewModel()))\r\n\r\n $('.datepicker').remove()\r\n\r\n this.$('.date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('dateSelected')\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n // Verify date and don't update unless it's valid\r\n var currentValue = e.currentTarget.children[0].value\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.end-date .date').datepicker('hide', null)\r\n } else {\r\n this.model.set('endDate', moment().endOf('month'))\r\n }\r\n }.bind(this))\r\n .closest('.floating')\r\n .addClass('open')\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n var report = this.model.get('report')\r\n return {\r\n accounts: _.chain(report.get('accounts')).map(function (account) {\r\n return account.toJSON()\r\n }).value(),\r\n companyName: report.get('companyName'),\r\n endDate: moment(report.get('endDate')),\r\n sort: report.get('sort'),\r\n total: report.get('total'),\r\n profitLoss: report.get('profitLoss'),\r\n isAccrual: report.get('isAccrual')\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n \r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').get('accounts').length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n \r\n ribbon: function (message) {\r\n return RibbonTemplate({message: message})\r\n },\r\n\r\n sortToggle: function () {\r\n var newSortMode = _.first(_.without(['asc', 'desc'], this.model.get('report').sort))\r\n this.model.set('sort', newSortMode)\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').get('accounts').length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n\r\n})\r\n\r\nmodule.exports = ViewGeneralLedgerReportView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar ViewGeneralLedgerReportView = require('reports/trial-balance/report-view')\r\nvar TrialBalanceService = require('reports/trial-balance/trial-balance-service')\r\n\r\nvar TrialBalanceReportWidget = function () {\r\n this.model = new Backbone.Model({\r\n endDate: moment().endOf('month')\r\n })\r\n\r\n this.view = new ViewGeneralLedgerReportView({\r\n model: this.model\r\n })\r\n this.trialBalanceService = new TrialBalanceService()\r\n\r\n this.view.on('dateSelected', this.updateReport, this)\r\n this.view.on('download', this.downloadReport, this)\r\n this.model.on('change:sort', _.ary(this.updateReport, 0), this)\r\n\r\n this.fetchReport()\r\n}\r\n\r\nTrialBalanceReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().$el\r\n}\r\n\r\nTrialBalanceReportWidget.prototype.fetchReport = function () {\r\n this.trialBalanceService.fetchTrialBalance().then(function (report) {\r\n this.model.set({\r\n report: report,\r\n sort: report.sort\r\n })\r\n\r\n if (report.get('accounts').length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nTrialBalanceReportWidget.prototype.updateReport = function () {\r\n this.trialBalanceService.fetchTrialBalance(this.model.get('endDate'), this.model.get('sort')).then(function (report) {\r\n this.model.set({\r\n report: report,\r\n sort: report.sort\r\n })\r\n\r\n if (report.get('accounts').length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this))\r\n}\r\n\r\nTrialBalanceReportWidget.prototype.downloadReport = function () {\r\n this.trialBalanceService.downloadTrialBalance(this.model.get('report').get('endDate'), this.model.get('sort'))\r\n}\r\n\r\nmodule.exports = TrialBalanceReportWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <span class=\\\"account-type\\\">\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" Basis</span>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"Accrual\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Cash\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"col-xs-3\\\">\"\n + alias4(((helper = (helper = helpers.accountNumber || (depth0 != null ? depth0.accountNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-2\\\">\"\n + alias4(((helper = (helper = helpers.accountType || (depth0 != null ? depth0.accountType : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountType\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-5\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-2 currency\\\">\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.balance : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=container.escapeExpression;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n\\r\\n\"\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Report as of\",\"inputId\":\"end-date\",\"wrapperClasses\":\"end-date\",\"inputName\":\"endDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"\\r\\n <div class=\\\"pull-right\\\">\\r\\n\"\n + ((stack1 = (helpers.if_not_null || (depth0 && depth0.if_not_null) || alias2).call(alias1,(depth0 != null ? depth0.isAccrual : depth0),{\"name\":\"if_not_null\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"col-xs-12 head no-padding\\\">\\r\\n <div class=\\\"col-xs-3\\\">Account # <i class=\\\"fa fa-sort-\"\n + alias3(((helper = (helper = helpers.sort || (depth0 != null ? depth0.sort : depth0)) != null ? helper : alias2),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"sort\",\"hash\":{},\"data\":data}) : helper)))\n + \" history-sort-toggle\\\"></i></div>\\r\\n <div class=\\\"col-xs-2\\\">Type</div>\\r\\n <div class=\\\"col-xs-5\\\">Description</div>\\r\\n <div class=\\\"col-xs-2 currency\\\">Amount</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.accounts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"itemrow overview col-xs-12 no-padding\\\">\\r\\n <div class=\\\"col-xs-offset-10 col-xs-2 currency trialBalanceTotal\\\">\"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.total : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"itemrow overview col-xs-12 no-padding\\\">\\r\\n <div class=\\\"col-xs-offset-10 col-xs-2 currency profitLoss\\\">Profit/(Loss) \"\n + alias3((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.profitLoss : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\n\r\nvar AccountTrialBalance = Backbone.Model.extend({\r\n toJSON: function () {\r\n var cloned = _.omit(this.attributes, ['accounts'])\r\n\r\n return cloned\r\n }\r\n}, {\r\n parse: function (json) {\r\n return new AccountTrialBalance({\r\n accountNumber: json.accountNumber,\r\n accountType: json.accountType,\r\n balance: json.balance,\r\n id: json.id,\r\n name: json.name\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = AccountTrialBalance\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar AccountTrialBalance = require('reports/trial-balance/trial-balance-account')\r\n\r\nvar TrialBalance = Backbone.Model.extend({\r\n toJSON: function () {\r\n var cloned = _.omit(this.attributes, ['accounts'])\r\n\r\n return cloned\r\n }\r\n}, {\r\n parse: function (json) {\r\n var report = new TrialBalance()\r\n\r\n var total = 0\r\n report.set('accounts', _.chain(json.accounts)\r\n .map(function (account) {\r\n var trialBalanceAccount = AccountTrialBalance.parse(account)\r\n\r\n total = total + account.balance\r\n\r\n return trialBalanceAccount\r\n })\r\n .value())\r\n\r\n report.set('endDate', new Date(json.endDate.replace(/-/g, '\\/').replace(/T.+/, '')))\r\n report.set('startDate', new Date(json.startDate.replace(/-/g, '\\/').replace(/T.+/, '')))\r\n report.set('total', total)\r\n report.set('profitLoss', json.profitLoss)\r\n report.set('isAccrual', json.isAccrual)\r\n\r\n return report\r\n }\r\n})\r\n\r\nmodule.exports = TrialBalance\r\n","'use strict'\r\n\r\nvar RestClient = require('rest/client')\r\nvar Config = require('config/config')\r\nvar $ = require('jquery')\r\nvar TrialBalance = require('reports/trial-balance/trial-balance-report')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar TrialBalanceService = function () {\r\n this.client = new RestClient()\r\n this.companyService = new CompanyService()\r\n}\r\n\r\nTrialBalanceService.prototype.fetchTrialBalance = function (endDate, dateSort) {\r\n var urlParams = {}\r\n\r\n if (endDate) {\r\n urlParams.endDate = endDate.toISOString()\r\n }\r\n\r\n if (dateSort) {\r\n urlParams.sort = dateSort\r\n } else {\r\n urlParams.sort = 'asc'\r\n }\r\n\r\n urlParams = $.param(urlParams)\r\n if (urlParams) {\r\n urlParams = '?' + urlParams\r\n }\r\n\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.client.get(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/trial-balance-report' + urlParams)\r\n .then(function (response) {\r\n return TrialBalance.parse(response)\r\n })\r\n}\r\n\r\nTrialBalanceService.prototype.downloadTrialBalance = function (endDate, dateSort) {\r\n var urlParams = {}\r\n\r\n if (endDate) {\r\n urlParams.endDate = endDate.toISOString()\r\n }\r\n\r\n if (dateSort) {\r\n urlParams.sort = dateSort\r\n } else {\r\n urlParams.sort = 'asc'\r\n }\r\n\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.client.download(Config['CRUNCHED_API_HOST'] + '/companies/' + companyId + '/reports/trial-balance-report/export', urlParams)\r\n}\r\n\r\nmodule.exports = TrialBalanceService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow accountOverview flex\\\">\\r\\n <div class=\\\"customerId\\\">\"\n + alias4(((helper = (helper = helpers.vendorId || (depth0 != null ? depth0.vendorId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"vendorId\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"name\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"printedName\\\">\"\n + alias4(((helper = (helper = helpers.printedName || (depth0 != null ? depth0.printedName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"printedName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"expenseDistribution\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.expenseAccounts : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"supplier\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isSupplier : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.program(6, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <div class=\\\"active\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isActive : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.program(6, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <span>\"\n + container.escapeExpression(((helper = (helper = helpers.accountName || (depth0 != null ? depth0.accountName : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"accountName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \" Yes\\r\\n\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n return \" No\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"reportControls\\\">\\r\\n <div class=\\\"pull-right\\\">\\r\\n <button class=\\\"btn btn-primary download\\\">Download</button>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block no-padding col-lg-12 col-md-12 col-xs-12\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>Report</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"reportData table table-striped table-hover\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"customerId\\\">ID</div>\\r\\n <div class=\\\"name\\\">Vendor Name</div>\\r\\n <div class=\\\"printedName\\\">Printed Name</div>\\r\\n <div class=\\\"expenseDistribution\\\">Expense Distribution</div>\\r\\n <div class=\\\"supplier\\\">Supplier</div>\\r\\n <div class=\\\"active\\\">Active</div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.vendors : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar VendorListReport = require('reports/vendor-list/report')\r\nvar RibbonTemplate = require('forms/ribbon')\r\n\r\nvar VendorListView = Backbone.View.extend({\r\n\r\n className: 'list-report',\r\n\r\n events: {\r\n 'click .download': 'download'\r\n },\r\n\r\n initialize: function () {\r\n this.model.on('change:report', this.render, this)\r\n this.on('noItems', this.noItems, this)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(VendorListReport(this.createViewModel()))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('report')) {\r\n return {\r\n vendors: this.model.get('report').vendors\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n \r\n noItems: function (error) {\r\n this.render()\r\n if (!this.model.get('report') || (!!this.model.get('report') && !this.model.get('report').vendors.length)) {\r\n this.$('.download').prop('disabled', true)\r\n this.$('> *:not(.reportControls)').remove()\r\n var message = !!error ? error.message : 'No data found'\r\n this.$el.append(this.ribbon(message))\r\n }\r\n },\r\n \r\n ribbon: function (message) {\r\n return RibbonTemplate({message: message})\r\n },\r\n\r\n download: function () {\r\n if (!!this.model.get('report') && this.model.get('report').vendors.length > 0) {\r\n this.trigger('download')\r\n }\r\n }\r\n\r\n})\r\n\r\nmodule.exports = VendorListView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar VendorListView = require('reports/vendor-list/view')\r\nvar ReportService = require('reports/report-service')\r\n\r\nvar VendorListReportWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.view = new VendorListView({\r\n model: this.model\r\n })\r\n this.reportService = new ReportService()\r\n\r\n this.view.on('download', this.downloadReport, this)\r\n\r\n this.fetchReport()\r\n}\r\n\r\nVendorListReportWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.reportService.fetchVendorListReport().then(function (report) {\r\n this.model.set('report', report)\r\n }.bind(this))\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nVendorListReportWidget.prototype.fetchReport = function () {\r\n this.reportService.fetchVendorListReport().then(function (report) {\r\n this.model.set('report', report)\r\n if (report.vendors.length <= 0) {\r\n return this.view.trigger('noItems')\r\n }\r\n }.bind(this), function (error) {\r\n this.view.trigger('noItems', error)\r\n }.bind(this))\r\n}\r\n\r\nVendorListReportWidget.prototype.downloadReport = function () {\r\n this.reportService.downloadVendorListReport()\r\n}\r\n\r\nmodule.exports = VendorListReportWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar q = require('q')\r\nvar _ = require('lodash')\r\nvar SessionService = require('session/session-service')\r\n\r\n/**\r\n * Creates a new RestClient instance that can be used to communicate with remote APIs.\r\n * This client assumes it is communicating with the GSG Portal API exclusively, and will add Authorization headers based on our session.\r\n *\r\n * @constructor\r\n */\r\nvar RestClient = function () {}\r\n\r\nfunction makeRequest (url, options, overrideToken) {\r\n if (overrideToken || SessionService.isSessionActive()) {\r\n options.headers['Authorization'] = 'Bearer ' + (overrideToken || SessionService.getToken())\r\n }\r\n\r\n return q($.ajax(url, options)).fail(function (jqXHR) {\r\n if (jqXHR.status === 401) {\r\n Backbone.trigger('app:logout')\r\n }\r\n\r\n var errorMessage = 'API call unsuccessful'\r\n if (jqXHR && jqXHR.responseJSON && jqXHR.responseJSON.message) errorMessage = jqXHR.responseJSON.message\r\n\r\n throw $.extend(new Error(errorMessage), jqXHR.responseJSON)\r\n })\r\n}\r\n\r\n/**\r\n * Retrieves a resource via HTTP GET.\r\n * @param {string} url - The fully-qualified URL to access the resource on.\r\n * @returns A JQuery Promise containing the resource, or an error.\r\n */\r\nRestClient.prototype.get = function (url) {\r\n var options = {\r\n headers: {\r\n 'Accept': 'application/json'\r\n },\r\n type: 'GET'\r\n }\r\n return makeRequest(url, options)\r\n}\r\n\r\n/**\r\n * Creates a resource via HTTP POST.\r\n * @param {string} url - The fully-qualified URL to create a resource under.\r\n * @param {*} body - Any object that can be stringified as JSON.\r\n * @returns A JQuery Promise representing the success of the creation attempt, or an error.\r\n */\r\nRestClient.prototype.post = function (url, body, overrideToken) {\r\n var options = {\r\n headers: {\r\n 'Accept': 'application/json',\r\n 'Content-Type': 'application/json'\r\n },\r\n type: 'POST',\r\n processData: false,\r\n data: JSON.stringify(body)\r\n }\r\n return makeRequest(url, options, overrideToken)\r\n}\r\n\r\nRestClient.prototype.postForm = function (url, params) {\r\n var options = {\r\n headers: {\r\n 'Accept': 'application/json',\r\n 'Content-Type': 'application/x-www-form-urlencoded'\r\n },\r\n type: 'POST',\r\n data: params\r\n }\r\n\r\n return makeRequest(url, options)\r\n}\r\n\r\n/**\r\n * Updates a resource via HTTP PUT.\r\n * @param {string} url - The fully-qualified URL to update a resource at.\r\n * @param (*} body - Any object that can be stringified as JSON.\r\n * @returns A JQuery Promise representing the success of the update; typically includes the updated resource.\r\n * Otherwise, encapsulates an error.\r\n */\r\nRestClient.prototype.put = function (url, body) {\r\n var options = {\r\n headers: {\r\n 'Accept': 'application/json',\r\n 'Content-Type': 'application/json'\r\n },\r\n type: 'PUT',\r\n processData: false,\r\n data: JSON.stringify(body)\r\n }\r\n return makeRequest(url, options)\r\n}\r\n\r\n/**\r\n * Deletes a resource via HTTP DELETE.\r\n * @param {string} url - The fully-qualified URL to delete a resource at.\r\n * @returns A JQuery Promise representing the success of the deletion or an error.\r\n */\r\nRestClient.prototype.del = function (url, body) {\r\n var options = {\r\n headers: {\r\n 'Accept': 'application/json'\r\n },\r\n type: 'DELETE',\r\n data: body\r\n }\r\n return makeRequest(url, options)\r\n}\r\n\r\n/**\r\n * Redirects the client to the resource in an attempt to download a file.\r\n * @param {string} url - The fully-qualified URL to redirect the client to.\r\n * @param {object} urlParams - An object mapping the url parameters.\r\n */\r\nRestClient.prototype.download = function (url, urlParams) {\r\n // Prevent access token from getting outside of the client\r\n urlParams = _.clone(urlParams || {})\r\n urlParams.accessToken = SessionService.getToken()\r\n var urlWithParams = url + '?' + $.param(urlParams)\r\n\r\n // Set the window location to redirect the user to the url with the parameters.\r\n window.location = urlWithParams\r\n}\r\n\r\nmodule.exports = RestClient\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar SessionService = require('session/session-service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar AppRouter = Backbone.Router.extend({\r\n initialize: function () {\r\n this.companyService = new CompanyService()\r\n this.bind('route', this.updateAnalytics)\r\n },\r\n\r\n updateAnalytics: function () {\r\n ga('send', 'pageview', {page: window.location.pathname})\r\n },\r\n\r\n _bindRoutes: function () {\r\n // Based off of backbone's route binding method\r\n if (!this.routes) return\r\n this.routes = _.result(this, 'routes')\r\n var route\r\n var routes = _.keys(this.routes)\r\n while ((route = routes.pop()) != null) {\r\n this._bindPreRouteCheck(route, this.routes[route])\r\n this.route(route, this.routes[route])\r\n }\r\n },\r\n\r\n _bindPreRouteCheck: function (route, routeCallbackName) {\r\n var oldCallback = this[routeCallbackName]\r\n\r\n this[routeCallbackName] = this._routePreCheck(route, routeCallbackName, oldCallback)\r\n },\r\n\r\n _routePreCheck: function (route, routeCallbackName, oldCallback) {\r\n var callback = function () {\r\n var originalArguments = arguments\r\n var sinceLastCompanyPull = Date.now() - (this.lastCompanyPull || 0)\r\n\r\n // When doing an indexOf for a string, if it is at the beginning, it will return 0 (falsy), hence !route.indexOf implies that the route begins with the string.\r\n // The inverse is true, if the route does not begin or does not contain the string, it will return -1 (which is truthy), flipping that gives us our false.\r\n\r\n // If the user isn't logged in and they aren't trying to login\r\n if (!SessionService.isSessionActive()) {\r\n if ((route.indexOf('login') && route.indexOf('registration'))) {\r\n var urlFirstIndex = Backbone.history.getFragment(Backbone.history.location.pathname).split(\"/\")\r\n if (urlFirstIndex[0] !== \"payment\") {\r\n Backbone.trigger('app:navigate', 'login')\r\n return\r\n }\r\n }\r\n // If the route starts with login or registration\r\n } else if (!route.indexOf('login')) {\r\n Backbone.trigger('app:navigate', '')\r\n // If the route starts with receivables\r\n } else if (!route.indexOf('receivables')) {\r\n var hasReceivableAccounts = CompanyService.prototype.getHasAccountsReceivableAccounts()\r\n if (!hasReceivableAccounts) {\r\n Backbone.trigger('app:navigate', 'settings/accounts')\r\n return\r\n }\r\n } else if (!route.indexOf('payables')) {\r\n var hasPayableAccounts = CompanyService.prototype.getHasAccountsPayableAccounts()\r\n if (!hasPayableAccounts) {\r\n Backbone.trigger('app:navigate', 'settings/accounts')\r\n return\r\n }\r\n } \r\n\r\n if (SessionService.isSessionActive() && CompanyService.prototype.getActiveCompanyId()) {\r\n if (sinceLastCompanyPull > (5 * 60 * 1000)) {\r\n this.companyService.fetchCompany().then(function (company) {\r\n this.companyService.setActiveCompany(company)\r\n this.lastCompanyPull = Date.now()\r\n callback.apply(this, originalArguments)\r\n }.bind(this)).done()\r\n } else {\r\n return oldCallback.apply(this, arguments)\r\n }\r\n } else {\r\n return oldCallback.apply(this, arguments)\r\n }\r\n }\r\n\r\n return callback\r\n }\r\n})\r\n\r\nmodule.exports = AppRouter\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\n\r\nfunction isSessionActive () {\r\n return !!localStorage.getItem('crunched-session')\r\n}\r\n\r\nfunction startSession (token, emailAddress) {\r\n localStorage.setItem('crunched-session', token)\r\n localStorage.setItem('crunched-session-email', emailAddress)\r\n Backbone.trigger('app:sessionStarted')\r\n}\r\n\r\nfunction endSession () {\r\n localStorage.removeItem('crunched-session')\r\n localStorage.removeItem('crunched-session-email')\r\n localStorage.removeItem('crunched-session-profile')\r\n localStorage.removeItem('crunchedActiveCompany')\r\n localStorage.removeItem('crunchedActiveCompanyInfo')\r\n localStorage.removeItem('crunched-session-numberOfCompanies')\r\n localStorage.removeItem('crunchedActiveCompanySubscriptionInfo')\r\n localStorage.removeItem('hasAccountsPayableAccounts')\r\n localStorage.removeItem('hasAccountsReceivableAccounts')\r\n Backbone.trigger('app:sessionEnded')\r\n}\r\n\r\nfunction getToken () {\r\n return localStorage.getItem('crunched-session')\r\n}\r\n\r\nfunction getEmail () {\r\n return localStorage.getItem('crunched-session-email')\r\n}\r\n\r\nfunction setProfile (profile) {\r\n localStorage.setItem('crunched-session-profile', JSON.stringify(profile))\r\n Backbone.trigger('myProfileChanged')\r\n}\r\n\r\nfunction getProfile () {\r\n return JSON.parse(localStorage.getItem('crunched-session-profile'))\r\n}\r\n\r\nfunction setNumberOfCompany (companies) {\r\n localStorage.setItem('crunched-session-numberOfCompanies', companies.length)\r\n}\r\n\r\nfunction getNumberOfCompany () {\r\n return localStorage.getItem('crunched-session-numberOfCompanies')\r\n}\r\n\r\nfunction setInactivityLogout (inactivityLogout) {\r\n localStorage.setItem('crunched-inactivity-logout', inactivityLogout)\r\n}\r\n\r\nfunction getInactivityLogout () {\r\n return localStorage.getItem('crunched-inactivity-logout')\r\n}\r\n\r\nfunction getActiveSubscriptionInfo () {\r\n return JSON.parse(localStorage.getItem('crunchedActiveCompanySubscriptionInfo'))\r\n}\r\n\r\nmodule.exports.isSessionActive = isSessionActive\r\nmodule.exports.startSession = startSession\r\nmodule.exports.endSession = endSession\r\nmodule.exports.getToken = getToken\r\nmodule.exports.getEmail = getEmail\r\nmodule.exports.setProfile = setProfile\r\nmodule.exports.getProfile = getProfile\r\nmodule.exports.setNumberOfCompany = setNumberOfCompany\r\nmodule.exports.getNumberOfCompany = getNumberOfCompany\r\nmodule.exports.setInactivityLogout = setInactivityLogout\r\nmodule.exports.getInactivityLogout = getInactivityLogout\r\nmodule.exports.getActiveSubscriptionInfo = getActiveSubscriptionInfo\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"\\r\\n<div class=\\\"block-header cash-accrual-header\\\">\\r\\n <h3>Cash or Accrual</h3>\\r\\n</div>\\r\\n\\r\\n<form method=\\\"post\\\" autocomplete=\\\"on\\\"> \\r\\n <div class=\\\"block-content1\\\">\\r\\n <p class=\\\"titleHelpText\\\">\\r\\n Reporting your income and expenses will depend on your accounting method. If you are unsure which is right for you, please contact your accountant or tax preparer to discuss.\\r\\n </p>\\r\\n <div class=\\\"flex\\\">\\r\\n <label class=\\\"css-input css-radio css-radio-primary\\\">Cash \\r\\n <input type=\\\"radio\\\" name=\\\"accountingMethod\\\" value=\\\"cash\\\" checked>\\r\\n <span></span>\\r\\n </label>\\r\\n <label class=\\\"css-input css-radio css-radio-primary\\\">Accrual \\r\\n <input type=\\\"radio\\\" name=\\\"accountingMethod\\\" value=\\\"accrual\\\">\\r\\n <span></span>\\r\\n </label>\\r\\n </div>\\r\\n <p class=\\\"note\\\">\\r\\n <b>Note:</b> Once you save your accounting method, you will not be able to change it. You will have to create a new business to use another accounting method.\\r\\n </p>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"year-end-header\\\">\\r\\n <h3>Set Year-End Date</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content2\\\">\\r\\n <p class=\\\"titleHelpText\\\">Please indicate the account period / year end month and day here:</p>\\r\\n <div class=\\\"form-group col-xs-6 year-end-month\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"accountingPeriodMonth\\\" name=\\\"accountingPeriodMonth\\\" size=\\\"1\\\"></select>\\r\\n <label for=\\\"material-select2\\\">Month</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group col-xs-6\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"accountingPeriodDay\\\" name=\\\"accountingPeriodDay\\\" size=\\\"1\\\"></select> \\r\\n <label for=\\\"material-select2\\\">Day</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <br/>\\r\\n <div class=\\\"actions\\\">\\r\\n <button class=\\\"btn btn-primary save save-button pull-right\\\">Next</button>\\r\\n <button class=\\\"btn btn-default cancel cancel-button pull-right\\\">Back</button>\\r\\n </div>\\r\\n</form>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('settings/accounting-method/template')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar moment = require('moment')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar AccountingMethodView = CreateView.extend({\r\n className: 'settings company accounting-method',\r\n \r\n events: _.extend(_.clone(CreateView.prototype.events), { \r\n 'change input[type=file]': 'changeFile'\r\n }),\r\n \r\n initialize: function () {\r\n this.Template = Template\r\n\r\n this.listenTo(this.model, 'change', this.render.bind(this))\r\n },\r\n \r\n onRender: function () {\r\n this.populateMonthDropdown()\r\n this.populateDayDropdown()\r\n\r\n var monthChanged = false\r\n this.$el.on('change', '#accountingPeriodMonth', function () {\r\n monthChanged = true\r\n this.populateDayDropdown(monthChanged)\r\n }.bind(this))\r\n },\r\n \r\n populateMonthDropdown: function () {\r\n var self = this\r\n var monthsOption = moment.months()\r\n _.each(monthsOption, function (month, index) {\r\n if (index + 1 === 12) {\r\n self.$('#accountingPeriodMonth').append($('<option value=\"' + (index + 1) + '\"' + 'selected = true >' + month + '</option>'))\r\n } else {\r\n self.$('#accountingPeriodMonth').append($('<option value=\"' + (index + 1) + '\">' + month + '</option>'))\r\n }\r\n }, this)\r\n },\r\n \r\n populateDayDropdown: function (monthChanged) {\r\n if (monthChanged) {\r\n for (var i = 0; i < this.$('#accountingPeriodDay option').length; i++) {\r\n this.$('#accountingPeriodDay option').remove(i)\r\n }\r\n }\r\n var mthDayformat = '2015-' + Number(this.$('#accountingPeriodMonth').val())\r\n var numberOfDays = moment(mthDayformat, 'YYYY-MM').daysInMonth()\r\n for (var i = 1; i <= numberOfDays; i++) {\r\n if (Number(this.$('#accountingPeriodMonth').val()) === 12 && i === 31) {\r\n this.$('#accountingPeriodDay').append($('<option value=\"' + i + '\"' + 'selected =true >' + i + '</option>'))\r\n } else {\r\n this.$('#accountingPeriodDay').append($('<option value=\"' + i + '\">' + i + '</option>'))\r\n }\r\n }\r\n },\r\n \r\n changeFile: function (e) {\r\n var signatureImage = _.first(e.target.files)\r\n\r\n if (!signatureImage) {\r\n return console.warn('No image selected, leaving unchanged')\r\n }\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (signatureImageFile) {\r\n if (this.checkFileExtension(signatureImage)) {\r\n this.cachedSignatureImage = signatureImageFile.target.result\r\n this.$('.signature-img').attr('style', 'background:url(\"' + signatureImageFile.target.result + '\") no-repeat center center;').attr('data-has-image', 'true')\r\n }\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(signatureImage)\r\n\r\n this.isValidFileExtension = this.checkFileExtension(signatureImage)\r\n },\r\n\r\n checkFileExtension: function (selectedFile) {\r\n var validExts = new Array('.png', '.gif')\r\n var fileExt = selectedFile.name\r\n fileExt = fileExt.substring(fileExt.lastIndexOf('.')).toLowerCase()\r\n if (validExts.indexOf(fileExt) < 0) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'You can only upload image(*.png or *.gif) file.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n\r\n this.cachedSignatureImage = ''\r\n this.isValidFileExtension = false\r\n return false\r\n \r\n } else {\r\n this.isValidFileExtension = true\r\n return true\r\n }\r\n },\r\n \r\n toJSON: function () {\r\n var model = {}\r\n\r\n model.accountingMethod = this.$('input[name=accountingMethod]:checked').val()\r\n model.accountingPeriodMonth = this.$('#accountingPeriodMonth').val()\r\n model.accountingPeriodDay = this.$('#accountingPeriodDay').val()\r\n model.signatureFileUpload = this.cachedSignatureImage\r\n\r\n return model\r\n },\r\n \r\n cancel: function (e) {\r\n e.preventDefault()\r\n this.trigger('back')\r\n },\r\n \r\n collapse: function (e) {\r\n this.cancel(e)\r\n } \r\n})\r\n\r\nmodule.exports = AccountingMethodView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Model = require('lists/list/item/entry')\r\nvar View = require('settings/accounting-method/view')\r\nvar UserService = require('login/service')\r\n\r\nvar AccountingMethodWidget = function () {\r\n this.model = new Model()\r\n this.userService = new UserService()\r\n this.view = new View({\r\n model: this.model\r\n })\r\n}\r\n\r\nAccountingMethodWidget.prototype = _.clone(Backbone.Events)\r\n\r\nAccountingMethodWidget.prototype.show = function () {\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = AccountingMethodWidget\r\n","'use strict'\r\n\r\nvar ListWrapper = require('lists/list/list')\r\nvar Backbone = require('backbone')\r\n\r\nvar Accounts = ListWrapper.extend({\r\n childModel: Backbone.Model\r\n})\r\n\r\n\r\nmodule.exports = Accounts\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"static-accounts block\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Accounts Receivable</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <form>\\r\\n <div class=\\\"line-item-container\\\">\\r\\n <div class=\\\"system-account\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"accountId\\\" />\\r\\n <div class=\\\"account-description\\\" data-account-default-description=\\\"Accounts Receivable\\\">Accounts Receivable<i class=\\\"fa fa-question-circle\\\" aria-hidden=\\\"true\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"right\\\" data-original-title=\\\"Outstanding invoices to be paid by customers\\\"></i></div>\\r\\n <div data-account-type=\\\"4\\\" class=\\\"account-selection\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"accountNumberSearch\",\"inputClasses\":\"account-id-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"account-selection-description\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Description\",\"inputName\":\"accountDescriptionSearch\",\"inputClasses\":\"account-description-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"system-account\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"accountId\\\" />\\r\\n <div class=\\\"account-description\\\" data-account-default-description=\\\"Discounts\\\">Discounts<i class=\\\"fa fa-question-circle\\\" aria-hidden=\\\"true\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"right\\\" data-original-title=\\\"Applied discounts to posted invoices (contra account)\\\"></i></div>\\r\\n <div data-account-type=\\\"3\\\" class=\\\"account-selection\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"accountNumberSearch\",\"inputClasses\":\"account-id-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"account-selection-description\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Description\",\"inputName\":\"accountDescriptionSearch\",\"inputClasses\":\"account-description-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"system-account\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"accountId\\\" />\\r\\n <div class=\\\"account-description\\\" data-account-default-description=\\\"Undeposited Customer Payments\\\">Undeposited Customer Payments<i class=\\\"fa fa-question-circle\\\" aria-hidden=\\\"true\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"right\\\" data-original-title=\\\"Customer payments applied to an invoice not yet deposited\\\"></i></div>\\r\\n <div data-account-type=\\\"1\\\" class=\\\"account-selection\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"accountNumberSearch\",\"inputClasses\":\"account-id-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"account-selection-description\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Description\",\"inputName\":\"accountDescriptionSearch\",\"inputClasses\":\"account-description-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"system-account\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"accountId\\\" />\\r\\n <div class=\\\"account-description\\\" data-account-default-description=\\\"Unapplied Customer Payments\\\">Unapplied Customer Payments<i class=\\\"fa fa-question-circle\\\" aria-hidden=\\\"true\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"right\\\" data-original-title=\\\"Customer deposits, or payments received not yet applied to invoices (unearned revenue)\\\"></i></div>\\r\\n <div data-account-type=\\\"2\\\" class=\\\"account-selection\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"accountNumberSearch\",\"inputClasses\":\"account-id-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"account-selection-description\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Description\",\"inputName\":\"accountDescriptionSearch\",\"inputClasses\":\"account-description-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"system-account\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"accountId\\\" />\\r\\n <div class=\\\"account-description\\\" data-account-default-description=\\\"Write-offs\\\">Write-offs<i class=\\\"fa fa-question-circle\\\" aria-hidden=\\\"true\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"right\\\" data-original-title=\\\"Uncollectible invoiced amounts or bad debts\\\"></i></div>\\r\\n <div data-account-type=\\\"5\\\" class=\\\"account-selection\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"accountNumberSearch\",\"inputClasses\":\"account-id-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"account-selection-description\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Description\",\"inputName\":\"accountDescriptionSearch\",\"inputClasses\":\"account-description-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Accounts Payable</h3>\\r\\n </div>\\r\\n <div class=\\\"system-account\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"accountId\\\" />\\r\\n <div class=\\\"account-description\\\" data-account-default-description=\\\"Accounts Payable\\\">Accounts Payable<i class=\\\"fa fa-question-circle\\\" aria-hidden=\\\"true\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"right\\\" data-original-title=\\\"Amounts due to vendors and suppliers\\\"></i></div>\\r\\n <div data-account-type=\\\"6\\\" class=\\\"account-selection\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"accountNumberSearch\",\"inputClasses\":\"account-id-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"account-selection-description\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Description\",\"inputName\":\"accountDescriptionSearch\",\"inputClasses\":\"account-description-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"system-account\\\">\\r\\n <input type=\\\"hidden\\\" name=\\\"accountId\\\" />\\r\\n <div class=\\\"account-description\\\" data-account-default-description=\\\"Purchase Discounts\\\">Purchase Discounts<i class=\\\"fa fa-question-circle\\\" aria-hidden=\\\"true\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"right\\\" data-original-title=\\\"Discounts taken on vendor purchases (contra account)\\\"></i></div>\\r\\n <div data-account-type=\\\"7\\\" class=\\\"account-selection\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"accountNumberSearch\",\"inputClasses\":\"account-id-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"account-selection-description\\\">\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Description\",\"inputName\":\"accountDescriptionSearch\",\"inputClasses\":\"account-description-search\",\"wrapperClasses\":\"autocomplete\"},\"data\":data,\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"actions\\\">\\r\\n <button class=\\\"btn btn-primary save save-button\\\">Save Accounts</button>\\r\\n </div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('settings/accounts/template')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar AccountClassesToTypes = [\r\n -1,\r\n 'Asset', // Undeposited Customer Payments -> Asset\r\n 'Liability', // Unapplied Customer Payments -> Liability\r\n 'Revenue', // Discounts -> Revenue\r\n 'Asset', // Accounts Receivable -> Assets\r\n 'Expense', // Write-offs -> Expense,\r\n 'Liability', // Accounts Payable -> Liability\r\n 'Expense' // Purchase Discounts -> Expense\r\n]\r\n\r\nvar StaticAccountList = CreateView.extend({\r\n className: 'static-accounts-container',\r\n \r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'change input[name=accountNumberSearch], input[name=accountDescriptionSearch]': 'checkForBtn',\r\n 'keyup input[name=accountNumberSearch], input[name=accountDescriptionSearch]': 'checkForBtn',\r\n 'focusout input[name=accountNumberSearch], input[name=accountDescriptionSearch]': 'checkForBtn',\r\n 'focusin input[name=accountNumberSearch], input[name=accountDescriptionSearch]': 'checkForBtn'\r\n }),\r\n \r\n initialize: function () {\r\n this.Template = Template\r\n\r\n this.model.on('change:accountList', this.render, this)\r\n this.on('alertSuccess', this.alertSuccess, this) \r\n this.on('saveAccountsFailed', this.showError, this)\r\n \r\n },\r\n \r\n onRender: function () {\r\n this.$('.system-account')\r\n .each(function (index, systemAccount) {\r\n var $systemAccount = $(systemAccount)\r\n var accountClass = Number($systemAccount.find('.account-selection').attr('data-account-type'))\r\n var account = _.find(this.model.get('accountList'), {'accountClass': accountClass})\r\n console.log('Looking for', accountClass, 'found', account)\r\n if (account) {\r\n $systemAccount.find('input[name=accountId]').val(account.id)\r\n $systemAccount.find('input[name=accountDescriptionSearch]').val(account.accountName)\r\n $systemAccount.find('input[name=accountNumberSearch]').val(account.accountNumber)\r\n this.checkLineStatus()\r\n }\r\n }.bind(this))\r\n .find('input[type=text]')\r\n .on('focusout', this.checkLineStatus.bind(this))\r\n .on('focusin', this.checkLineStatus.bind(this))\r\n \r\n this.bindAutocomplete()\r\n this.$('.save').prop('disabled', true)\r\n return this\r\n },\r\n\r\n checkLineStatus: function (e) {\r\n var hasValue = _.reduce(\r\n this.$('.line-item-container input').map(function (index, el) { return $(el).val() }),\r\n function (memo, value) {\r\n return memo || (!!value && value !== '$')\r\n },\r\n false\r\n )\r\n\r\n if (hasValue || e.type === 'focusin') {\r\n this.$('.line-item-container').addClass('forceLabelsOpen')\r\n } else {\r\n this.$('.line-item-container').removeClass('forceLabelsOpen')\r\n }\r\n },\r\n\r\n checkForBtn: function (e) {\r\n this.numberOfChanged = 0\r\n\r\n this.$('.system-account')\r\n .each(function (index, systemAccount) {\r\n var $systemAccount = $(systemAccount)\r\n var accountClass = Number($systemAccount.find('.account-selection').attr('data-account-type'))\r\n var account = _.find(this.model.get('accountList'), {'accountClass': accountClass})\r\n\r\n if (account) {\r\n if ($systemAccount.find('input[name=accountId]').val() !== account.id\r\n && $systemAccount.find('input[name=accountDescriptionSearch]').val() !== account.accountName\r\n && $systemAccount.find('input[name=accountNumberSearch]').val() !== account.accountNumber) {\r\n if (!$systemAccount.find('input[name=accountDescriptionSearch]').val() && !$systemAccount.find('input[name=accountNumberSearch]').val()) {\r\n //empty out the accountId and data-selection when there is no value for the field to prevent false API to be sent\r\n $systemAccount.find('input[name=accountId]').val('')\r\n } else {\r\n this.numberOfChanged += 1\r\n }\r\n }\r\n } else {\r\n if (!!$systemAccount.find('input[name=accountId]').val()\r\n && !!$systemAccount.find('input[name=accountDescriptionSearch]').val()\r\n && !!$systemAccount.find('input[name=accountNumberSearch]').val()) {\r\n this.numberOfChanged += 1\r\n }\r\n }\r\n }.bind(this))\r\n\r\n if (this.numberOfChanged > 0) {\r\n this.$('.save').prop('disabled', false)\r\n } else {\r\n this.$('.save').prop('disabled', true)\r\n }\r\n },\r\n\r\n getUsedAccounts: function (without) {\r\n return _.map(_.without(this.$('.system-account'), without), function (systemAccount) {\r\n return this.$(systemAccount).find('input[name=accountId]').val()\r\n }.bind(this))\r\n },\r\n\r\n bindAutocomplete: function () {\r\n if (!this.model.get('accountList')) {\r\n return\r\n }\r\n\r\n _.each(this.$('.system-account'), function (staticAccountRow) {\r\n var $staticAccount = this.$(staticAccountRow)\r\n\r\n var usedAccounts = this.getUsedAccounts(staticAccountRow)\r\n\r\n var availableAccounts = this.model.get('accountList').filter(function (account) {\r\n return usedAccounts.indexOf(account.id) === -1\r\n })\r\n\r\n this.autoComplete(\r\n availableAccounts,\r\n 'accountNumber',\r\n $staticAccount.find('input[name=accountNumberSearch]:not(:focus)'),\r\n this.accountSelected.bind(this, $staticAccount),\r\n 'CREATENEW'\r\n )\r\n\r\n this.autoComplete(\r\n availableAccounts,\r\n 'accountName',\r\n $staticAccount.find('input[name=accountDescriptionSearch]:not(:focus)'),\r\n this.accountSelected.bind(this, $staticAccount),\r\n 'CREATENEW'\r\n )\r\n }.bind(this))\r\n },\r\n\r\n accountSelected: function ($staticAccount, account) {\r\n $staticAccount.find('input[name=accountNumberSearch]')\r\n .val(account.accountNumber)\r\n .closest('.floating')\r\n .addClass('open')\r\n $staticAccount.find('input[name=accountDescriptionSearch]')\r\n .val(account.accountName)\r\n .closest('.floating')\r\n .addClass('open')\r\n $staticAccount.find('input[name=accountId]').val(account.id)\r\n\r\n if (account.id === 'CREATENEW') {\r\n if (account.accountNumber) {\r\n $staticAccount.find('input[name=accountDescriptionSearch]')\r\n .autocomplete('disable')\r\n .val($staticAccount.find('.account-description').attr('data-account-default-description'))\r\n }\r\n if (account.accountName) {\r\n $staticAccount.find('input[name=accountNumberSearch]')\r\n .autocomplete('disable')\r\n }\r\n } else {\r\n $staticAccount.find('input[name=accountDescriptionSearch]').autocomplete('enable')\r\n $staticAccount.find('input[name=accountNumberSearch]').autocomplete('enable')\r\n }\r\n\r\n this.bindAutocomplete()\r\n },\r\n\r\n save: function (e) {\r\n e.preventDefault()\r\n\r\n if (this.saving) {\r\n return\r\n }\r\n this.saving = true\r\n this.once('saved', function () {\r\n this.saving = false\r\n }.bind(this))\r\n \r\n this.$('.save').prop('disabled', true)\r\n this.trigger('saveAccounts', this.toJSON(this.model.get('accountList')))\r\n },\r\n\r\n alertSuccess: function () {\r\n this.saving = false\r\n\r\n sweetAlert({\r\n title: 'Accounts Saved',\r\n text: 'Your account assignments have saved successfully',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6'\r\n }).then(function () {\r\n this.$('.save').prop('disabled', false)\r\n this.render()\r\n }.bind(this))\r\n },\r\n \r\n showError: function (error) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: error.message,\r\n type: 'error',\r\n confirmButtonColor: '#19aea6'\r\n }).then(function () {\r\n this.render()\r\n }.bind(this))\r\n },\r\n\r\n toJSON: function (accountList) {\r\n return _.filter(_.map(this.$('.system-account'), function (systemAccount) {\r\n var $systemAccount = $(systemAccount)\r\n var accountClass = Number($systemAccount.find('.account-selection').attr('data-account-type'))\r\n if (!AccountClassesToTypes[accountClass]) {\r\n var errorMessage = 'Couldn\\'t find the appropriate accountType for the accountClass' + accountClass\r\n console.error(errorMessage)\r\n throw new Error(errorMessage)\r\n }\r\n\r\n var reportingCategory = 'Uncategorized'\r\n\r\n var account = _.find(accountList, {'id': $systemAccount.find('input[name=accountId]').val()})\r\n if (account !== null && account !== undefined) {\r\n reportingCategory = account.reportingCategory\r\n }\r\n\r\n return {\r\n id: $systemAccount.find('input[name=accountId]').val(),\r\n reportingCategory: reportingCategory,\r\n accountNumber: $systemAccount.find('input[name=accountNumberSearch]').val(),\r\n accountName: $systemAccount.find('input[name=accountDescriptionSearch]').val(),\r\n accountClass: accountClass,\r\n accountType: AccountClassesToTypes[accountClass]\r\n }\r\n }), 'id')\r\n }\r\n})\r\n\r\nmodule.exports = StaticAccountList\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar ListView = require('settings/accounts/view')\r\nvar Accounts = require('settings/accounts/accounts')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar CompanyService = require('company/company-service')\r\nvar Q = require('q')\r\n\r\nvar StaticAccountsWidget = function () {\r\n this.model = new Accounts()\r\n this.service = new AccountService()\r\n this.companyService = new CompanyService()\r\n this.view = new ListView({\r\n model: this.model\r\n })\r\n\r\n this.fetchAccounts()\r\n\r\n this.view.on('saveAccounts', this.saveAccounts.bind(this))\r\n}\r\n\r\nStaticAccountsWidget.prototype = _.clone(Backbone.Events)\r\n\r\nStaticAccountsWidget.prototype.show = function () {\r\n return this.view.render().$el\r\n}\r\n\r\nStaticAccountsWidget.prototype.fetchAccounts = function () {\r\n this.service.fetchAccounts(false, false).then(function (staticAccounts) {\r\n this.model.set('accountList', _.map(staticAccounts, function (account) {\r\n return account.toJSON()\r\n }))\r\n }.bind(this))\r\n}\r\n\r\nStaticAccountsWidget.prototype.saveAccounts = function (accounts) {\r\n if (this.saving) {\r\n return\r\n }\r\n this.saving = true\r\n\r\n Q.all(_.map(accounts, function (account) {\r\n if (account.id === 'CREATENEW') {\r\n return this.createAccount(account)\r\n } else {\r\n return this.updateAccount(account)\r\n }\r\n }.bind(this))).then(function () {\r\n return this.companyService.fetchCompany()\r\n }.bind(this)).then(function (company) {\r\n this.companyService.setActiveCompany(company)\r\n this.lastCompanyPull = Date.now()\r\n }.bind(this)).then(function () {\r\n this.saving = false\r\n this.fetchAccounts()\r\n this.view.trigger('alertSuccess')\r\n }.bind(this)), function (err) {\r\n console.error(err)\r\n this.view.checkForBtn()\r\n this.view.trigger('saveAccountsFailed', err)\r\n }.bind(this)\r\n}\r\n\r\nStaticAccountsWidget.prototype.createAccount = function (account) {\r\n delete account.id\r\n account.status = true\r\n return this.service.createAccount(account).fail(function (err) {\r\n console.log(err.message)\r\n this.view.checkForBtn()\r\n }.bind(this))\r\n}\r\n\r\nStaticAccountsWidget.prototype.updateAccount = function (account) {\r\n account.status = true\r\n return this.service.updateAccount(new Backbone.Model(account)).fail(function (err) {\r\n console.log(err.message)\r\n this.view.checkForBtn()\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = StaticAccountsWidget\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar BusinessService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nBusinessService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nBusinessService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nBusinessService.prototype.update = function (model) {\r\n var apiPath = this.GetPath()\r\n return this.restClient.put(apiPath, model)\r\n}\r\n\r\nBusinessService.prototype.getList = function () {\r\n var apiPath = this.GetPath()\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nmodule.exports = BusinessService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"data-has-image\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <form method=\\\"post\\\" autocomplete=\\\"on\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Set Fiscal Year</h3>\\r\\n </div>\\r\\n <br/>\\r\\n <p class=\\\"form-group\\\">\\r\\n Please indicate the account period / year end month and day here:\\r\\n </p>\\r\\n <br/>\\r\\n <br/>\\r\\n <div class=\\\"flex year-end-date\\\">\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control accountingPeriodMonth\\\" id=\\\"accountingPeriodMonth\\\" name=\\\"accountingPeriodMonth\\\" size=\\\"1\\\"></select>\\r\\n <label for=\\\"material-select2\\\">Month</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"accountingPeriodDay\\\" name=\\\"accountingPeriodDay\\\" size=\\\"1\\\"></select> \\r\\n <label for=\\\"material-select2\\\">Day</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <br/>\\r\\n <br/>\\r\\n <br/>\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Signature</h3>\\r\\n </div>\\r\\n <br/>\\r\\n <p class=\\\"form-group signature-upload-text\\\">\\r\\n Upload a signature image file to be used for printed checks:\\r\\n </p>\\r\\n\\r\\n <div class=\\\"flex signature-upload\\\">\\r\\n <div class=\\\"form-group\\\">\\r\\n <div>\\r\\n <label class=\\\"signature-img\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.signatureFile : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" style=\\\"background:url('\"\n + ((stack1 = ((helper = (helper = helpers.signatureFile || (depth0 != null ? depth0.signatureFile : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"signatureFile\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"') no-repeat center center;\\\">\\r\\n <div class=\\\"signature-overlay\\\"> </div>\\r\\n <input type=\\\"file\\\" accept=\\\"image/*\\\" />\\r\\n </label>\\r\\n <span class=\\\"note-upload flex\\\">* Please note that the signature image (*.png or *.gif) must be no larger than 240px by 36px.</span>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <br/>\\r\\n <div class=\\\"actions\\\">\\r\\n <button class=\\\"btn btn-primary save save-button pull-right\\\">Save Settings</button>\\r\\n <br/>\\r\\n <br/>\\r\\n </div>\\r\\n <div class=\\\"status\\\"></div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('settings/business-settings/template')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar moment = require('moment')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar BusinessSettingsView = CreateView.extend({\r\n className: 'settings business',\r\n\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'click .save': 'update',\r\n 'change input[type=file]': 'changeFile'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n\r\n this.listenTo(this.model, 'change:companyInfo', this.render.bind(this))\r\n this.on('updated', this.updated, this)\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n this.$el.html(this.Template(this.createViewModel()))\r\n this.populateMonthDropdown()\r\n this.populateDayDropdown()\r\n\r\n var monthChanged = false\r\n this.$el.on('change', '#accountingPeriodMonth', function () {\r\n monthChanged = true\r\n this.populateDayDropdown(monthChanged)\r\n }.bind(this))\r\n\r\n if (this.model.get('companyInfo') != null && this.model.get('companyInfo').accountingPeriodMonth != null && this.model.get('companyInfo').accountingPeriodDay != null) {\r\n this.model.companyInfo = this.model.get('companyInfo')\r\n var model = this.model.companyInfo\r\n _.each(this.$('input:not([type=file]), textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else {\r\n $el.val(model[$el.attr('name')]) \r\n }\r\n }.bind(this))\r\n } \r\n },\r\n \r\n createViewModel: function () {\r\n var signatureFile = ''\r\n\r\n if (this.model.get('companyInfo')) {\r\n var companyInfo = this.model.get('companyInfo')\r\n\r\n signatureFile = companyInfo.signatureFile || signatureFile\r\n }\r\n\r\n var data = {\r\n signatureFile: signatureFile\r\n }\r\n\r\n return data\r\n }, \r\n \r\n changeFile: function (e) {\r\n var signatureImage = _.first(e.target.files)\r\n\r\n if (!signatureImage) {\r\n return console.warn('No image selected, leaving unchanged')\r\n }\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (signatureImageFile) {\r\n if (this.checkFileExtension(signatureImage)) {\r\n this.cachedSignatureImage = signatureImageFile.target.result\r\n this.$('.signature-img').attr('style', 'background:url(\"' + signatureImageFile.target.result + '\") no-repeat center center;').attr('data-has-image', 'true')\r\n }\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(signatureImage)\r\n\r\n this.isValidFileExtension = this.checkFileExtension(signatureImage)\r\n },\r\n\r\n checkFileExtension: function (selectedFile) {\r\n var validExts = new Array('.png', '.gif')\r\n var fileExt = selectedFile.name\r\n fileExt = fileExt.substring(fileExt.lastIndexOf('.')).toLowerCase()\r\n if (validExts.indexOf(fileExt) < 0) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'You can only upload image(*.png or *.gif) file.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n \r\n this.cachedSignatureImage = ''\r\n this.isValidFileExtension = false\r\n return false\r\n \r\n } else {\r\n this.isValidFileExtension = true\r\n return true\r\n }\r\n },\r\n\r\n updated: function () {\r\n this.$('.save').prop('disabled', false)\r\n this.cachedSignatureImage = ''\r\n this.isValidFileExtension = false\r\n },\r\n\r\n toJSON: function () {\r\n var companyInfo = this.model.get('companyInfo')\r\n\r\n var id = companyInfo.id\r\n var name = companyInfo.name\r\n var phone = companyInfo.phone\r\n var emailAddress = companyInfo.emailAddress\r\n var website = companyInfo.website\r\n var accountingPeriodMonth = Number(this.$('#accountingPeriodMonth').val())\r\n var accountingPeriodDay = Number(this.$('#accountingPeriodDay').val())\r\n var isAccrual = companyInfo.isAccrual\r\n var addressLine1 = companyInfo.addressLine1\r\n var addressLine2 = companyInfo.addressLine2\r\n var city = companyInfo.city\r\n var state = companyInfo.state\r\n var postalCode = companyInfo.postalCode\r\n var signatureFileUpload = !!this.cachedSignatureImage ? this.cachedSignatureImage : companyInfo.signatureFileUpload\r\n var signatureFile = companyInfo.signatureFile\r\n\r\n var model = {\r\n id: id,\r\n name: name,\r\n phone: phone,\r\n emailAddress: emailAddress,\r\n website: website,\r\n accountingPeriodMonth: accountingPeriodMonth,\r\n accountingPeriodDay: accountingPeriodDay,\r\n isAccrual: isAccrual,\r\n addressLine1: addressLine1,\r\n addressLine2: addressLine2,\r\n city: city,\r\n state: state,\r\n postalCode: postalCode,\r\n signatureFileUpload: signatureFileUpload,\r\n signatureFile: signatureFile\r\n }\r\n return model\r\n },\r\n\r\n populateMonthDropdown: function () {\r\n var monthsOption = moment.months()\r\n _.each(monthsOption, function (month, index) {\r\n this.$('#accountingPeriodMonth').append($('<option value=\"' + (index + 1) + '\">' + month + '</option>'))\r\n }, this)\r\n },\r\n\r\n populateDayDropdown: function (monthChanged) {\r\n if (monthChanged) {\r\n for (var i = 0; i < this.$('#accountingPeriodDay option').length; i++) {\r\n this.$('#accountingPeriodDay option').remove(i)\r\n }\r\n }\r\n var mthDayformat = '2015-' + Number(this.$('#accountingPeriodMonth').val())\r\n var numberOfDays = moment(mthDayformat, 'YYYY-MM').daysInMonth()\r\n for (var i = 1; i <= numberOfDays; i++) {\r\n this.$('#accountingPeriodDay').append($('<option value=\"' + i + '\">' + i + '</option>'))\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = BusinessSettingsView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar GenericListWidget = require('lists/list/widget')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar Model = require('lists/list/item/entry')\r\nvar View = require('settings/business-settings/view')\r\nvar UserService = require('login/service')\r\nvar BusinessSettingsService = require('settings/business-settings/service')\r\n\r\nvar BusinessWidget = function () {\r\n this.model = new Model()\r\n this.userService = new UserService()\r\n this.service = new BusinessSettingsService()\r\n\r\n this.view = new View({\r\n model: this.model\r\n })\r\n\r\n this.listenTo(this.view, 'update', this.save.bind(this))\r\n}\r\n\r\nBusinessWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nBusinessWidget.prototype.show = function () {\r\n Q.all([this.service.getList()]).then(function (companyInfo) {\r\n this.model.set('id', companyInfo[0].id)\r\n this.model.set('companyInfo', companyInfo[0])\r\n }.bind(this))\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nBusinessWidget.prototype.save = function (id, model) {\r\n this.service.update(model)\r\n .then(function (response) {\r\n if (response.success) {\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'The fiscal year end month and day saved successfully.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.view.trigger('updated')\r\n }\r\n }.bind(this), function (error) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Failed to save the fiscal year end month and day.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = BusinessWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <option value=\\\"\\\">---</option>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.checkbookLookup : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"6\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"Start Date\",\"inputId\":\"start-date\",\"wrapperClasses\":\"start-date\",\"inputName\":\"startDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.dateInput,depth0,{\"name\":\"dateInput\",\"hash\":{\"inputLabel\":\"End Date\",\"inputId\":\"end-date\",\"wrapperClasses\":\"end-date\",\"inputName\":\"endDate\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\");\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"controls\\\">\\r\\n <div class=\\\"form-group checkbook-selection\\\" style=\\\"height: 54px;\\\">\\r\\n <div class=\\\"form-material floating input-group open\\\" style=\\\"width: 100%;\\\">\\r\\n <select class=\\\"form-control my-checkbooks select-checkbook\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.checkbookLookup : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label class=\\\"control-label\\\">Checkbook</label>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isDoneLoadingCheckbook : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n<div class=\\\"transaction-history-container checkbooks\\\"></div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Template = require('settings/checkbook/transactions/template')\r\nvar CheckbookHistoryWidget = require('checkbook/history/checkbook-history-widget')\r\nvar Ribbon = require('forms/ribbon')\r\nvar moment = require('moment')\r\nvar _ = require('lodash')\r\n\r\nvar dateParams = require('datepicker/datepicker-params')\r\n\r\nvar TransactionsView = Backbone.View.extend({\r\n\r\n className: 'checkbook-transactions',\r\n\r\n initialize: function () {\r\n this.on('loadHistory', this.render.bind(this))\r\n this.on('noItems', this.noItems, this)\r\n this.listenTo(this.model, 'change:isDoneLoadingCheckbook', this.render.bind(this))\r\n },\r\n\r\n events: {\r\n 'change .my-checkbooks': 'changeCheckbook'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(Template(this.model.toJSON()))\r\n\r\n this.loadHistory()\r\n\r\n // Start Date\r\n this.$('.start-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('startDate').format(dateParams.format))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, close and open end date\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('startDate', moment(e.date).startOf('day'))\r\n this.$('.start-date .date').datepicker('hide', null)\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('show')\r\n this.$('.end-date .date').find('input').focus()\r\n } else {\r\n this.model.set('startDate', moment().startOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n // End Date\r\n this.$('.end-date .date').datepicker(dateParams.options)\r\n .datepicker('setDate', this.model.get('endDate').format(dateParams.format))\r\n .on('hide', function (e) {\r\n this.trigger('loadHistory')\r\n }.bind(this))\r\n .on('changeDate', function (e) {\r\n var currentValue = e.currentTarget.children[0].value\r\n\r\n // If date is typed in and is valid, refresh\r\n if (currentValue.match(dateParams.regex)) {\r\n this.model.set('endDate', moment(e.date).endOf('day'))\r\n this.$('.end-date .date').datepicker('hide', null)\r\n } else {\r\n this.model.set('endDate', moment().endOf('month'))\r\n }\r\n }.bind(this))\r\n .find('input').mask('99/99/9999', { placeholder: dateParams.format })\r\n .closest('.floating')\r\n .addClass('open')\r\n\r\n this.$('.start-date .date').datepicker('setEndDate', this.model.get('endDate').format(dateParams.format))\r\n this.$('.end-date .date').datepicker('setStartDate', this.model.get('startDate').format(dateParams.format))\r\n\r\n return this\r\n },\r\n\r\n loadHistory: function () {\r\n if (this.model.id) {\r\n if (this.history) {\r\n this.history.remove()\r\n }\r\n\r\n var startDate = this.model.get('startDate').toISOString()\r\n var endDate = this.model.get('endDate').toISOString()\r\n\r\n this.history = new CheckbookHistoryWidget(this.model, true, startDate, endDate)\r\n\r\n this.$('.my-checkbooks').val(this.model.id)\r\n this.$('.transaction-history-container').html('').append(this.history.show())\r\n }\r\n },\r\n\r\n changeCheckbook: function (e) {\r\n this.model.set({\r\n id: this.$('.my-checkbooks').val()\r\n })\r\n\r\n this.render()\r\n },\r\n\r\n noItems: function (error) {\r\n this.render()\r\n this.$('> *:not(.controls)').remove()\r\n var message = error ? error.message : 'No checkbook found'\r\n this.$el.append(this.ribbon(message))\r\n },\r\n\r\n ribbon: function (message) {\r\n return Ribbon({ message: message })\r\n }\r\n})\r\n\r\nmodule.exports = TransactionsView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar CheckbookTransactionsView = require('settings/checkbook/transactions/view')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar CheckbookTransactionsWidget = function () {\r\n this.model = new Backbone.Model({\r\n startDate: moment().startOf('month'),\r\n endDate: moment().endOf('month')\r\n })\r\n this.view = new CheckbookTransactionsView({\r\n model: this.model\r\n })\r\n\r\n this.checkbookService = new CheckbookService()\r\n this.companyService = new CompanyService()\r\n}\r\n\r\nCheckbookTransactionsWidget.prototype = _.clone(Backbone.Events)\r\n\r\nCheckbookTransactionsWidget.prototype.show = function () {\r\n var activeCompanyInfo = this.companyService.getActiveCompanyInfo()\r\n if (activeCompanyInfo.role === 0) {\r\n return\r\n }\r\n this.view.delegateEvents()\r\n this.loadCheckbooks()\r\n return this.view.render().$el\r\n}\r\n\r\nCheckbookTransactionsWidget.prototype.loadCheckbooks = function () {\r\n this.model.set('isDoneLoadingCheckbook', false, { silent: true })\r\n\r\n this.checkbookService.fetchCheckbookList()\r\n .then(function (checkbookData) {\r\n if (checkbookData.length <= 0) {\r\n this.model.set('isDoneLoadingCheckbook', true)\r\n this.view.trigger('noItems')\r\n }\r\n\r\n var checkbooks = _.map(checkbookData, function (checkbook) { return checkbook.toJSON() })\r\n\r\n this.model.set({\r\n id: _.first(checkbooks).id,\r\n checkbookLookup: _.keyBy(checkbooks, 'id'),\r\n isDoneLoadingCheckbook: true\r\n })\r\n }.bind(this), function (error) {\r\n this.model.set('isDoneLoadingCheckbook', true)\r\n this.view.trigger('noItems', error)\r\n }.bind(this)).done()\r\n}\r\n\r\nmodule.exports = CheckbookTransactionsWidget\r\n","'use strict'\r\n\r\nvar Checkbook = require('settings/checkbooks/item/checkbook')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar Checkbooks = ListWrapper.extend({\r\n childModel: Checkbook\r\n})\r\n\r\nmodule.exports = Checkbooks\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3>Add New Checkbook</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content meta\\\">\\r\\n <form>\\r\\n <div class=\\\"add-new-checkbook col-xs-12 no-padding\\\">\\r\\n\\r\\n <div class=\\\"form-group col-sm-3 col-xs-12 autocomplete\\\">\\r\\n <div class=\\\"form-material floating input-group ledgeraccountnumber\\\">\\r\\n <input class=\\\"form-control accountNumber\\\" type=\\\"text\\\" data-val=\\\"true\\\" data-val-required=\\\"The account field is required.\\\" id=\\\"accountNumber\\\" name=\\\"accountNumber\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"accountNumber\\\">GL Account #</label>\\r\\n <span class=\\\"input-group-addon\\\" for=\\\"accountNumber\\\"><label for=\\\"AccountNumber\\\"><i class=\\\"fa fa-sort\\\"></i></label></span>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"accountNumber\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"form-group col-sm-6 col-xs-12 autocomplete\\\">\\r\\n <div class=\\\"form-material floating input-group accountName\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" data-val=\\\"true\\\" data-val-required=\\\"The account field is required.\\\" id=\\\"accountName\\\" name=\\\"accountName\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"accountName\\\">GL Account Description</label>\\r\\n <span class=\\\"input-group-addon\\\" for=\\\"accountName\\\"><label for=\\\"accountName\\\"><i class=\\\"fa fa-sort\\\"></i></label></span>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"accountName\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"form-group col-sm-3 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating input-group\\\">\\r\\n <input class=\\\"form-control currency currency-field startingBalance\\\" type=\\\"text\\\" data-val=\\\"true\\\" data-val-required=\\\"The starting balance field is required.\\\" id=\\\"startingBalance\\\" name=\\\"startingBalance\\\" value=\\\"0\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"startingBalance\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" data-original-title=\\\"Beginning balance amount will not be reflected in your ledger. This amount will only act as a starting point to calculate your current checkbook registers balance. If you are entering a beginning balance, be sure your ledger’s ending account balance and checkbooks beginning balance will match as you cannot post journal entries to accounts associated with a checkbook. If this is a new account with a zero balance, you may leave the amount at $0.00.\\\">\\r\\n <img src=\\\"/img/question-circle.svg\\\" class=\\\"unprinted-tooltip\\\" alt=\\\"?\\\" /> Starting Balance\\r\\n </label>\\r\\n <span class=\\\"input-group-addon\\\" for=\\\"startingBalance\\\"><label for=\\\"startingBalance\\\"></label></span>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"startingBalance\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"form-group col-sm-12 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating new-checkbook-name\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" data-val=\\\"true\\\" data-val-required=\\\"The checkbook name field is required.\\\" id=\\\"new-checkbook-name\\\" name=\\\"name\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"new-checkbook-name\\\">Checkbook Name</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"new-checkbook-name\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n\\r\\n </div>\\r\\n <div class=\\\"block-content hidden-content col-lg-12 no-padding\\\">\\r\\n <div class=\\\"col-sm-12 col-xs-12\\\">\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Submit</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"col-lg-12 needs-more-data bg-danger-light\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i>All fields must be completed. Please try again and click Submit to create account.</div>\\r\\n <div class=\\\"col-lg-12 bg-primary-lighter all-data-filled\\\"><i class=\\\"fa fa-check-circle fa-2x fa-inverse\\\"></i>All fields have been completed. Click Submit to create account.</div>\\r\\n </div>\\r\\n </div>\\r\\n </form>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('settings/checkbooks/create/template')\r\nvar _ = require('lodash')\r\nvar numbro = require('numbro')\r\n\r\nvar CreateCheckbookView = CreateView.extend({\r\n className: 'block create',\r\n\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'keyup input': 'detectValidation',\r\n 'keyup textarea': 'detectValidation',\r\n 'change input': 'detectValidation',\r\n 'focusout input': 'detectValidation',\r\n 'click': 'expand'\r\n }),\r\n\r\n initialize: function () {\r\n if (!this.Template) {\r\n this.Template = Template\r\n }\r\n\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n\r\n this.listenTo(this.model, 'change:accountListWithoutExisting', this.render)\r\n },\r\n\r\n onRender: function () {\r\n this.$('.needs-more-data')\r\n this.$('.all-data-filled').hide()\r\n\r\n this.$('[data-toggle=\"tooltip\"], .js-tooltip').tooltip({\r\n container: 'body',\r\n animation: false\r\n })\r\n\r\n this.autoCompleteForGLAccount()\r\n this.detectValidation()\r\n\r\n return this\r\n },\r\n\r\n autoCompleteForGLAccount: function () {\r\n if (!this.model.get('accountListWithoutExisting')) {\r\n return\r\n }\r\n var $accountLineItem = this.$('.block-content .add-new-checkbook')\r\n this.autoComplete(\r\n this.model.get('accountListWithoutExisting'),\r\n 'accountNumber',\r\n $accountLineItem.find('input[name=accountNumber]'),\r\n this.accountSelectedCallback.bind(this, $accountLineItem)\r\n )\r\n\r\n this.autoComplete(\r\n this.model.get('accountListWithoutExisting'),\r\n 'accountName',\r\n $accountLineItem.find('input[name=accountName]'),\r\n this.accountSelectedCallback.bind(this, $accountLineItem)\r\n )\r\n },\r\n\r\n accountSelectedCallback: function ($lineItem, account) {\r\n $lineItem.find('input[name=accountNumber]')\r\n .val(account.accountNumber)\r\n .parent()\r\n .addClass('open')\r\n $lineItem.find('input[name=accountName]')\r\n .val(account.accountName)\r\n .parent()\r\n .addClass('open')\r\n },\r\n\r\n detectValidation: function (e) {\r\n var accountNumber = this.$('input[name=accountNumber]').val()\r\n var description = this.$('input[name=accountName]').val()\r\n var checkbookName = this.$('#new-checkbook-name').val()\r\n\r\n if (!accountNumber || !description || !checkbookName ) {\r\n this.$('.needs-more-data').show()\r\n this.$('.all-data-filled').hide()\r\n } else {\r\n this.$('.needs-more-data').hide()\r\n this.$('.all-data-filled').show()\r\n }\r\n },\r\n\r\n toJSON: function () {\r\n var model = { }\r\n\r\n var accountNumber = this.$('input[name=accountNumber]').val()\r\n var description = this.$('input[name=accountName]').val()\r\n var checkbookName = this.$('#new-checkbook-name').val()\r\n\r\n if (!accountNumber || !description || !checkbookName ) {\r\n throw new Error('Unable to save checkbook, please try again.')\r\n }\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n \r\n if ($el.attr('name') === 'startingBalance') {\r\n elValue = numbro().unformat(elValue)\r\n } \r\n \r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n model['ledgerAccount'] = this.getLedgerAccountId(model)\r\n return model\r\n },\r\n\r\n getLedgerAccountId: function (model) {\r\n var account = _.find(this.model.get('accountListWithoutExisting'), function (item) {\r\n return item.accountNumber === model['accountNumber']\r\n })\r\n\r\n if (account) {\r\n return account.id\r\n }\r\n\r\n return null\r\n }\r\n})\r\n\r\nmodule.exports = CreateCheckbookView\r\n","'use strict'\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\nvar numbro = require('numbro')\r\n\r\nvar Checkbook = ListEntry.extend({\r\n defaults: { }\r\n}, {\r\n parse: function (json) {\r\n return new Checkbook({\r\n canDelete: json.canDelete,\r\n id: json.id,\r\n name: json.name,\r\n isDisabled: json.isDisabled,\r\n ledgerAccount: json.ledgerAccount,\r\n startingBalance: numbro(json.startingBalance).formatCurrency('($0,0.00)')\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = Checkbook\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.canDelete : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-trash-o pull-right remove\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-unlock-alt pull-right disable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <a class=\\\"fa fa-lock pull-right enable\\\" data-id=\\\"\"\n + container.escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"name\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"accountNumber\\\">\"\n + alias4(((helper = (helper = helpers.accountNumber || (depth0 != null ? depth0.accountNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"accountDescription\\\">\"\n + alias4(((helper = (helper = helpers.accountName || (depth0 != null ? depth0.accountName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isDisabled : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(6, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('settings/checkbooks/item/template')\r\n\r\nvar CheckbooksView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n this.listenTo(this.model, 'change', this.render.bind(this))\r\n }\r\n})\r\n\r\nmodule.exports = CheckbooksView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"-\"\n + container.escapeExpression(((helper = (helper = helpers[\"name-sort\"] || (depth0 != null ? depth0[\"name-sort\"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"name-sort\",\"hash\":{},\"data\":data}) : helper)));\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Checkbooks</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"name\\\">Checkbook Name <i data-sort-field=\\\"name\\\" class=\\\"fa fa-sort\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0[\"name-sort\"] : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" sort-toggle\\\"></i></div>\\r\\n <div class=\\\"accountNumber\\\">GL Account #</div>\\r\\n <div class=\\\"accountDescription\\\">GL Account Description</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\"><p class=\\\"center\\\">Loading more checkbooks...</p></div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('settings/checkbooks/list/template')\r\nvar CheckbookView = require('settings/checkbooks/item/view')\r\nvar DetailsView = require('settings/checkbooks/read/view')\r\nvar UpdateView = require('settings/checkbooks/update/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar CheckbooksView = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = CheckbookView\r\n this.model.set('sort', 'asc')\r\n this.model.set('sortField', 'name')\r\n this.model.set('name-sort', 'asc')\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.on('showDetails', this.showDetails.bind(this))\r\n this.on('showEdit', this.showEdit.bind(this))\r\n this.on('enable', this.showEnable.bind(this))\r\n this.on('disable', this.showDisable.bind(this))\r\n this.on('delete', this.showDelete.bind(this))\r\n this.on('reset', this.reset.bind(this))\r\n },\r\n\r\n reset: function () {\r\n this.model.reset()\r\n },\r\n\r\n addChild: function (child) {\r\n if (!this.$infinity) {\r\n return\r\n }\r\n\r\n var account = _.find(this.model.get('accountList'), function (item) {\r\n return item.id === child.get('ledgerAccount')\r\n })\r\n\r\n if (account) {\r\n child.set('accountNumber', account.accountNumber)\r\n child.set('accountName', account.accountName)\r\n }\r\n\r\n /* eslint-disable new-cap */\r\n var childView = new this.childView({model: child})\r\n /* eslint-enable new-cap */\r\n\r\n // Forward events from children onto the container\r\n childView.on('all', function (triggerName) {\r\n console.log('ListContainer forwarding from child', triggerName)\r\n this.trigger.apply(this, arguments)\r\n }.bind(this))\r\n\r\n this.$infinity.append(childView.render().$el)\r\n childView.delegateEvents()\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more checkbooks...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more checkbooks.')\r\n },\r\n\r\n showDetails: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n var details = new DetailsView({model: model})\r\n\r\n // View to show beneath $lineItem, and if the 'active' class should be added to $lineItem's classes\r\n this.showChildView(details, $lineItem, true)\r\n },\r\n\r\n showEdit: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n var update = new UpdateView({model: model})\r\n update.on('update', function () {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('update')\r\n this.trigger.apply(this, args)\r\n }, this)\r\n\r\n this.showChildView(update, $lineItem, false)\r\n },\r\n\r\n showEnable: function (checkbookId) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'Are you sure you want to enable this checkbook?',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#DD6B55',\r\n confirmButtonText: 'Enable Checkbook',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.trigger('confirmEnable', checkbookId)\r\n }.bind(this))\r\n },\r\n\r\n showDisable: function (checkbookId) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'Disabling this checkbook will prevent you from creating new transactions or printing unprinted checks.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#DD6B55',\r\n confirmButtonText: 'Disable Checkbook',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.trigger('confirmDisable', checkbookId)\r\n }.bind(this))\r\n },\r\n\r\n showDelete: function (checkbookId) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'Deleting this checkbook can not be undone.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#DD6B55',\r\n confirmButtonText: 'Delete Checkbook',\r\n cancelButtonText: 'Cancel'\r\n }).then(function () {\r\n this.trigger('confirmDelete', checkbookId)\r\n }.bind(this))\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.unset('name-sort')\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n }\r\n\r\n})\r\n\r\nmodule.exports = CheckbooksView\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block\\\">\\r\\n <div class=\\\"check-meta block-content\\\">\\r\\n \\r\\n <div class=\\\"col-xs-6\\\">\\r\\n <div class=\\\"accountNumber\\\">\\r\\n <b>GL Account #</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.accountNumber || (depth0 != null ? depth0.accountNumber : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountNumber\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"description\\\">\\r\\n <b>Description</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div>\\r\\n <div class=\\\"accountDescription\\\">\\r\\n <b>GL Account Description</b>\\r\\n <p>\"\n + alias4(((helper = (helper = helpers.accountName || (depth0 != null ? depth0.accountName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"accountName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"startingBalance\\\">\\r\\n <b>Starting Balance</b>\\r\\n <p class=\\\"col-xs-6 no-padding\\\">\"\n + alias4(((helper = (helper = helpers.startingBalance || (depth0 != null ? depth0.startingBalance : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"startingBalance\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var Backbone = require('backbone')\r\nvar Template = require('settings/checkbooks/read/template')\r\n\r\n// TODO: Replace vendor method drop down with static text instead of read only drop down\r\nvar ReadView = Backbone.View.extend({\r\n className: 'block read has-animation fadeInDown expanded',\r\n\r\n render: function () {\r\n this.$el.html(Template(this.model.toViewModel()))\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = ReadView\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar CheckbooksService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nCheckbooksService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nCheckbooksService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'checkbooks'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nCheckbooksService.prototype.fetchCheckbookList = function () {\r\n var apiPath = this.GetPath('list')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nCheckbooksService.prototype.fetchAccountBalance = function (checkbookId) {\r\n var apiPath = this.GetPath(checkbookId, 'account-balance')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nCheckbooksService.prototype.enableCheckbook = function (checkbookId) {\r\n var apiPath = this.GetPath(checkbookId, 'enable')\r\n return this.restClient.put(apiPath)\r\n}\r\n\r\nCheckbooksService.prototype.fetchAvailableAccountBalance = function (checkbookId) {\r\n var apiPath = this.GetPath(checkbookId, 'available-account-balance')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nCheckbooksService.prototype.fetchBalances = function () {\r\n var apiPath = this.GetPath('balances')\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nmodule.exports = CheckbooksService\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right cancel\\\"></i>\\r\\n <h3>Update Checkbook</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content meta\\\">\\r\\n <div class=\\\"add-new-checkbook col-xs-12 no-padding\\\">\\r\\n \\r\\n <div class=\\\"form-group col-sm-3 col-xs-12 autocomplete\\\">\\r\\n <div class=\\\"form-material floating input-group ledgeraccountnumber\\\">\\r\\n <input class=\\\"form-control LedgerAccountNumber\\\" type=\\\"text\\\" data-val=\\\"true\\\" data-val-required=\\\"The account field is required.\\\" id=\\\"update-accountNumber\\\" name=\\\"accountNumber\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"update-AccountNumber\\\">GL Account #</label>\\r\\n <span class=\\\"input-group-addon\\\" for=\\\"AccountNumber\\\"><label for=\\\"AccountNumber\\\"><i class=\\\"fa fa-sort\\\"></i></label></span>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"accountNumber\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"form-group col-sm-6 col-xs-12 autocomplete\\\">\\r\\n <div class=\\\"form-material floating input-group accountName\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" data-val=\\\"true\\\" data-val-required=\\\"The account field is required.\\\" id=\\\"update-accountName\\\" name=\\\"accountName\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"update-accountName\\\">GL Account Description</label>\\r\\n <span class=\\\"input-group-addon\\\" for=\\\"accountName\\\"><label for=\\\"accountName\\\"><i class=\\\"fa fa-sort\\\"></i></label></span>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"accountName\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"form-group col-sm-3 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating input-group startingBalance\\\">\\r\\n <input class=\\\"form-control currency currency-field startingBalance\\\" type=\\\"text\\\" data-val=\\\"true\\\" data-val-required=\\\"The starting balance field is required.\\\" id=\\\"update-startingBalance\\\" name=\\\"startingBalance\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"update-startingBalance\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" data-original-title=\\\"Beginning balance amount will not be reflected in your ledger. This amount will only act as a starting point to calculate your current checkbook registers balance. If you are entering a beginning balance, be sure your ledger’s ending account balance and checkbooks beginning balance will match as you cannot post journal entries to accounts associated with a checkbook. If this is a new account with a zero balance, you may leave the amount at $0.00.\\\">\\r\\n <img src=\\\"/img/question-circle.svg\\\" class=\\\"unprinted-tooltip\\\" alt=\\\"?\\\" /> Starting Balance\\r\\n </label>\\r\\n <span class=\\\"input-group-addon\\\" for=\\\"update-startingBalance\\\"><label for=\\\"startingBalance\\\"></label></span>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"startingBalance\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"form-group col-sm-12 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating new-checkbook-name\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" data-val=\\\"true\\\" data-val-required=\\\"The checkbook name field is required.\\\" id=\\\"update-new-checkbook-name\\\" name=\\\"name\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"update-new-checkbook-name\\\">Checkbook Name</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDown field-validation-valid\\\" data-valmsg-for=\\\"new-checkbook-name\\\" data-valmsg-replace=\\\"true\\\"></span>\\r\\n </div>\\r\\n \\r\\n </div>\\r\\n <div class=\\\"block-content hidden-content col-lg-12 no-padding\\\">\\r\\n <div class=\\\"col-sm-12 col-xs-12\\\">\\r\\n <button class=\\\"btn btn-primary pull-right save addNew\\\">Update</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"col-lg-12 needs-more-data bg-danger-light\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i>All fields must be completed. Please try again and click Submit to update account.</div>\\r\\n <div class=\\\"col-lg-12 bg-primary-lighter all-data-filled\\\"><i class=\\\"fa fa-check-circle fa-2x fa-inverse\\\"></i>All fields have been completed. Click Submit to update account.</div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('settings/checkbooks/create/view')\r\nvar Template = require('settings/checkbooks/update/template')\r\nvar _ = require('lodash')\r\nvar numbro = require('numbro')\r\n\r\nvar UpdateView = CreateView.extend({\r\n className: 'block update expanded has-animation fadeInDown',\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'keyup input': 'detectValidation',\r\n 'keyup textarea': 'detectValidation',\r\n 'change input': 'detectValidation',\r\n 'focusout input': 'detectValidation',\r\n 'click .save': 'update'\r\n }),\r\n\r\n onRender: function () {\r\n // Fill in inputs with our data\r\n var model = this.model.toViewModel()\r\n this.$('input[name=accountNumber]').attr('disabled', true).css('color', '#c5c5c5')\r\n this.$('input[name=accountName]').attr('disabled', true).css('color', '#c5c5c5')\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else {\r\n $el.val(model[$el.attr('name')])\r\n }\r\n })\r\n\r\n this.$('[data-toggle=\"tooltip\"], .js-tooltip').tooltip({\r\n container: 'body',\r\n animation: false\r\n })\r\n\r\n this.detectValidation()\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n },\r\n\r\n detectValidation: function (e) {\r\n var accountNumber = this.$('input[name=accountNumber]').val()\r\n var description = this.$('input[name=accountName]').val()\r\n var checkbookName = this.$('#update-new-checkbook-name').val()\r\n\r\n if (!accountNumber || !description || !checkbookName) {\r\n this.$('.needs-more-data').show()\r\n this.$('.all-data-filled').hide()\r\n } else {\r\n this.$('.needs-more-data').hide()\r\n this.$('.all-data-filled').show()\r\n }\r\n },\r\n\r\n toJSON: function () {\r\n var model = { }\r\n\r\n var accountNumber = this.$('input[name=accountNumber]').val()\r\n var accountName = this.$('input[name=accountName]').val() // description\r\n var name = this.$('#update-new-checkbook-name').val() // checkbookName\r\n\r\n var id = this.model.get('id')\r\n var isDisabled = this.model.get('isDisabled')\r\n var ledgerAccount = this.model.get('ledgerAccount')\r\n\r\n if (!accountNumber || !accountName || !name) {\r\n throw new Error('Unable to update checkbook, please try again.')\r\n }\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n \r\n if ($el.attr('name') === 'startingBalance') {\r\n elValue = numbro().unformat(elValue)\r\n } \r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n model['id'] = id\r\n model['isDisabled'] = isDisabled\r\n model['ledgerAccount'] = ledgerAccount\r\n\r\n return model\r\n },\r\n\r\n update: function (e) {\r\n e.preventDefault()\r\n\r\n var model = this.toJSON()\r\n var id = model['id']\r\n if (id) {\r\n this.$('.save').prop('disabled', true)\r\n this.trigger('update', id, model)\r\n }\r\n },\r\n\r\n getLedgerAccountId: function (model) {\r\n // this should return from a hidden field since we aren't using the auto-complete\r\n var account = _.find(this.model.get('accountList'), function (item) {\r\n return item.accountNumber === model['accountNumber']\r\n })\r\n\r\n if (account) {\r\n return account.id\r\n }\r\n return null\r\n }\r\n})\r\n\r\nmodule.exports = UpdateView\r\n","var ListContainer = require('lists/list/view')\r\nvar ListView = require('settings/checkbooks/list/view')\r\nvar CreateCheckbookView = require('settings/checkbooks/create/view')\r\nvar _ = require('lodash')\r\n\r\nvar CheckbooksView = ListContainer.extend({\r\n className: 'checkbooks list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n this.listView = new ListView({model: this.model})\r\n this.forwardEvents(this.listView)\r\n\r\n this.createView = new CreateCheckbookView({model: this.model})\r\n this.forwardEvents(this.createView)\r\n\r\n this.on('created', function () {\r\n this.createView.trigger('resetInputs')\r\n }.bind(this))\r\n\r\n this.on('widgetReady', function () {\r\n this.createView.trigger('reset')\r\n this.listView.trigger('reset')\r\n })\r\n\r\n this.on('details', function (model) {\r\n this.setLedgerAccount(model)\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n console.log('container -> editDetails')\r\n this.setLedgerAccount(model)\r\n this.listView.trigger('showEdit', model)\r\n }.bind(this))\r\n\r\n this.on('widgetShown', function () {\r\n this.listView.trigger('bindScroll')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n this.$el.append(this.createView.render().$el)\r\n this.$el.append(this.listView.render().$el)\r\n\r\n return this\r\n },\r\n\r\n reset: function () {\r\n this.render()\r\n },\r\n\r\n setLedgerAccount: function (model) {\r\n var account = _.find(this.model.get('accountList'), function (item) {\r\n return item.id === model.get('ledgerAccount')\r\n })\r\n\r\n if (account) {\r\n model.set('accountNumber', account.accountNumber)\r\n model.set('accountName', account.accountName)\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = CheckbooksView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar Checkbooks = require('settings/checkbooks/checkbooks')\r\nvar Service = require('settings/checkbooks/service')\r\nvar ContactService = require('lists/contacts/service')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar ListContainer = require('settings/checkbooks/view')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar CheckbooksWidget = function () {\r\n this.service = new Service()\r\n this.contactService = new ContactService()\r\n this.accountService = new AccountService()\r\n this.modelType = Checkbooks\r\n this.viewType = ListContainer\r\n this.preventLoad = true\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n\r\n this.loadDependencies()\r\n\r\n this.on('shown', function () {\r\n this.readyPromise.then(function () {\r\n this.preventLoad = false\r\n this.view.trigger('widgetReady')\r\n }.bind(this))\r\n }.bind(this))\r\n\r\n this.on('created', function () {\r\n this.loadDependencies()\r\n }.bind(this))\r\n\r\n this.on('itemDeleted', function () {\r\n this.loadDependencies()\r\n }.bind(this))\r\n\r\n this.on('statusUpdated', function (response) {\r\n if (!response.success) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: response.message,\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonTest: 'OK'\r\n })\r\n }\r\n })\r\n}\r\n\r\nCheckbooksWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nCheckbooksWidget.prototype.loadDependencies = function () {\r\n this.readyPromise = Q.all([\r\n this.loadAllAccounts(),\r\n this.loadAccountsWithoutExistingAcc()\r\n ])\r\n}\r\n\r\nCheckbooksWidget.prototype.loadAllAccounts = function () {\r\n return this.accountService.fetchAccounts(true).then(function (accounts) {\r\n return _.map(accounts, function (account) {\r\n return account.toJSON()\r\n })\r\n }).then(function (accounts) {\r\n this.model.set({\r\n accountList: accounts,\r\n accountLookup: _.keyBy(accounts, 'id')\r\n })\r\n }.bind(this))\r\n}\r\n\r\nCheckbooksWidget.prototype.loadAccountsWithoutExistingAcc = function () {\r\n return this.accountService.fetchAccounts(false).then(function (accounts) {\r\n accounts = _.filter(accounts, function (account) {\r\n if (!!account.get('status')) {\r\n return account\r\n }\r\n })\r\n return _.map(accounts, function (account) {\r\n return account.toJSON()\r\n })\r\n }).then(function (accounts) {\r\n this.model.set({\r\n accountListWithoutExisting: accounts,\r\n accountLookupWithout: _.keyBy(accounts, 'id')\r\n })\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = CheckbooksWidget\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar BalanceService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nBalanceService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nBalanceService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'balance-sheet-links'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nBalanceService.prototype.createGroup = function (modelData) {\r\n var apiPath = this.GetPath('group')\r\n return this.restClient.post(apiPath, modelData)\r\n}\r\n\r\nBalanceService.prototype.getList = function () {\r\n var apiPath = this.GetPath()\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nmodule.exports = BalanceService\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"new-journal-entry-item flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"account-number-lookup-left\",\"wrapperClasses\":\"account-number col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Description\",\"inputName\":\"account-desc-lookup-left\",\"wrapperClasses\":\"account-description col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Number\",\"inputName\":\"account-number-lookup-right\",\"wrapperClasses\":\"account-number col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Account Description\",\"inputName\":\"account-desc-lookup-right\",\"wrapperClasses\":\"account-description col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"fromLedgerAccountId\\\" class=\\\"id\\\" />\\r\\n <input type=\\\"hidden\\\" name=\\\"toLedgerAccountId\\\" class=\\\"id\\\" />\\r\\n <i class=\\\"fa fa-close remove\\\"></i>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar IncomeService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nIncomeService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nIncomeService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'income-sheet-links'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nIncomeService.prototype.createGroup = function (modelData) {\r\n var apiPath = this.GetPath('group')\r\n return this.restClient.post(apiPath, modelData)\r\n}\r\n\r\nIncomeService.prototype.getList = function () {\r\n var apiPath = this.GetPath()\r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nmodule.exports = IncomeService\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"new-journal-entry-item flex\\\"> \\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"id\":\"percentage\",\"inputLabel\":\"Percentage\",\"inputName\":\"allocation\",\"wrapperClasses\":\"percentage col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"id\":\"account-number\",\"inputLabel\":\"Account Number\",\"inputName\":\"account-number-lookup\",\"wrapperClasses\":\"account-number col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"id\":\"description\",\"inputLabel\":\"Account Description\",\"inputName\":\"account-desc-lookup\",\"wrapperClasses\":\"account-description col-xs-12\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" <input type=\\\"hidden\\\" name=\\\"toLedgerAccountId\\\" class=\\\"id\\\" />\\r\\n <i class=\\\"fa fa-close remove\\\"></i>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block-content\\\">\\r\\n <form method=\\\"post\\\" autocomplete=\\\"on\\\">\\r\\n <h3>Income Statement (Required)</h3>\\r\\n <p>After year-end, it’s time to start with a fresh, zero balance, income statement. Your previous year’s profit/loss needs to be closed to a balance sheet equity account. For more information on closing entries, see the article <a href=\\\"http://get.crunched.help/hc/en-us/articles/115001560348-What-is-a-year-end-closing-entry-\\\" target=\\\"_blank\\\">What is a year-end closing entry?</a></p>\\r\\n <div class=\\\"distribution distributions income-statement\\\">\\r\\n <div class=\\\"income-line-item-container\\\">\\r\\n </div>\\r\\n <button class=\\\"clickable-button add-more-income-line-items\\\" type=\\\"button\\\">+ Additional Income Allocation</button>\\r\\n </div>\\r\\n <br>\\r\\n <h3>Balance Sheet (Not required)</h3>\\r\\n <p>Close one balance sheet account to another balance sheet account at year-end.</p>\\r\\n <div class=\\\"balance-sheet\\\">\\r\\n <div class=\\\"mapping-line-item-container\\\">\\r\\n </div>\\r\\n <button class=\\\"clickable-button add-more-mapping-line-items\\\" type=\\\"button\\\">+ Additional Account Mapping</button>\\r\\n <br>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Save</button>\\r\\n <br>\\r\\n </div>\\r\\n </form>\\r\\n</div>\\r\\n<div class=\\\"status\\\"> \\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('settings/closing-entries/template')\r\nvar IncomeDistributionLine = require('settings/closing-entries/income-statement-distribution')\r\nvar MappingDistributionLine = require('settings/closing-entries/balance-sheet-distribution')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar Backbone = require('backbone')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar ClosingEntriesView = CreateView.extend({\r\n\r\n className: 'settings closing-entries block',\r\n \r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'click .add-more-income-line-items': 'addIncomeAllocation',\r\n 'click .add-more-mapping-line-items': 'addAccountMapping',\r\n 'change input': 'validateExtras',\r\n 'keyup input': 'validateExtras',\r\n 'focusout input': 'validateExtras',\r\n 'click .save': 'create'\r\n }),\r\n \r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) {\r\n this.Template = Template\r\n }\r\n this.listenTo(this.model, 'change', this.render.bind(this))\r\n this.listenTo(this.model, 'incomeAllocation', this.render.bind(this))\r\n this.listenTo(this.model, 'balanceMapping', this.render.bind(this))\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n this.on('resetInputs', function () {\r\n this.cachedAvatar = null\r\n }, this)\r\n Backbone.on('closingEntriesSavedSuccessfully', this.savedSuccessfully, this)\r\n Backbone.on('closingEntriesFailedToSave', this.failedToSave, this)\r\n },\r\n \r\n savedSuccessfully: function () {\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'All the closing entries have been saved.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n }).then(function () {\r\n this.$('.save').prop('disabled', false)\r\n }.bind(this))\r\n },\r\n \r\n failedToSave: function (error) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Failed to save the closing entries.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n }).then(function () {\r\n this.$('.save').prop('disabled', false)\r\n }.bind(this)) \r\n },\r\n \r\n getUsedIncomeAccounts: function (without) {\r\n return _.map(_.without(this.$('.income-line-item-container .new-journal-entry-item'), without), function (item) {\r\n return this.$(item).find('input[name=account-number-lookup]').val()\r\n }.bind(this))\r\n },\r\n \r\n getUsedBalanceLeftAccounts: function (without) {\r\n return _.map(_.without(this.$('.mapping-line-item-container .new-journal-entry-item'), without), function (item) {\r\n return this.$(item).find('input[name=account-number-lookup-left]').val()\r\n }.bind(this))\r\n },\r\n\r\n addIncomeAllocation: function (e) {\r\n var index = this.$('.income-line-item-container > div').length + 1\r\n\r\n if (index === 1) {\r\n this.$('.income-line-item-container').html('')\r\n }\r\n\r\n var $lineItem = $(IncomeDistributionLine({index: index}))\r\n this.$('.income-line-item-container').append($lineItem)\r\n this.OneUI($lineItem)\r\n\r\n // Remove only if there are more than 1 items.\r\n if (index > 1) {\r\n $lineItem.find('.remove').on('click', function (e) {\r\n $lineItem.remove()\r\n })\r\n }\r\n this.autoCompleteForIncome()\r\n\r\n if (e) {\r\n $lineItem.find('input:first').focus()\r\n }\r\n this.trigger('lineItemAdded', $lineItem)\r\n return $lineItem\r\n },\r\n\r\n autoCompleteForIncome: function () {\r\n if (!this.model.get('accountIncomeListDistributeTo')) {\r\n return\r\n }\r\n _.each(this.$('.income-line-item-container .new-journal-entry-item'), function (incomeLineItem) {\r\n var $incomeLineItem = this.$(incomeLineItem)\r\n var usedIncomeAccounts = this.getUsedIncomeAccounts(incomeLineItem)\r\n var availableIncomeAccounts = this.model.get('accountIncomeListDistributeTo').filter(function (account) {\r\n return usedIncomeAccounts.indexOf(account.accountNumber) === -1\r\n })\r\n\r\n this.autoComplete(\r\n availableIncomeAccounts,\r\n 'accountNumber',\r\n $incomeLineItem.find('input[name=account-number-lookup]'),\r\n this.accountSelectedCallbackForIncome.bind(this, $incomeLineItem)\r\n )\r\n\r\n this.autoComplete(\r\n availableIncomeAccounts,\r\n 'accountName',\r\n $incomeLineItem.find('input[name=account-desc-lookup]'),\r\n this.accountSelectedCallbackForIncome.bind(this, $incomeLineItem)\r\n )\r\n }.bind(this))\r\n },\r\n\r\n accountSelectedCallbackForIncome: function ($lineItem, account) {\r\n $lineItem.find('input[name=account-number-lookup]')\r\n .val(account.accountNumber)\r\n .parent()\r\n .addClass('open')\r\n $lineItem.find('input[name=account-desc-lookup]')\r\n .val(account.accountName)\r\n .parent()\r\n .addClass('open')\r\n $lineItem.find('input[name=toLedgerAccountId]')\r\n .val(account.id)\r\n this.validateExtras()\r\n },\r\n\r\n autoCompleteForBalanceLeft: function () {\r\n if (!this.model.get('accountListDistributeFrom')) {\r\n return\r\n }\r\n _.each(this.$('.mapping-line-item-container .new-journal-entry-item'), function (balanceLineItem) {\r\n var $balanceLineItem = this.$(balanceLineItem)\r\n var usedBalanceLeftAccounts = this.getUsedBalanceLeftAccounts(balanceLineItem)\r\n var availabelBalanceLeftAccounts = this.model.get('accountListDistributeFrom').filter(function (account) {\r\n return usedBalanceLeftAccounts.indexOf(account.accountNumber) === -1\r\n })\r\n\r\n this.autoComplete(\r\n availabelBalanceLeftAccounts,\r\n 'accountNumber',\r\n $balanceLineItem.find('input[name=account-number-lookup-left]'),\r\n this.accountSelectedCallbackLeftForBalance.bind(this, $balanceLineItem)\r\n )\r\n\r\n this.autoComplete(\r\n availabelBalanceLeftAccounts,\r\n 'accountName',\r\n $balanceLineItem.find('input[name=account-desc-lookup-left]'),\r\n this.accountSelectedCallbackLeftForBalance.bind(this, $balanceLineItem)\r\n )\r\n }.bind(this))\r\n },\r\n\r\n addAccountMapping: function (e) {\r\n var index = this.$('.mapping-line-item-container > div').length + 1\r\n\r\n if (index === 1) {\r\n this.$('.mapping-line-item-container').html('')\r\n }\r\n\r\n var $lineItem = $(MappingDistributionLine({index: index}))\r\n this.$('.mapping-line-item-container').append($lineItem)\r\n this.OneUI($lineItem)\r\n\r\n // Remove only if there are more than 1 items.\r\n if (index > 0) {\r\n $lineItem.find('.remove').on('click', function (e) {\r\n $lineItem.remove()\r\n })\r\n }\r\n this.autoCompleteForBalanceLeft()\r\n\r\n this.autoComplete(\r\n this.model.get('accountListDistributeTo'),\r\n 'accountNumber',\r\n $lineItem.find('input[name=account-number-lookup-right]'),\r\n this.accountSelectedCallbackRightForBalance.bind(this, $lineItem)\r\n )\r\n\r\n this.autoComplete(\r\n this.model.get('accountListDistributeTo'),\r\n 'accountName',\r\n $lineItem.find('input[name=account-desc-lookup-right]'),\r\n this.accountSelectedCallbackRightForBalance.bind(this, $lineItem)\r\n )\r\n\r\n if (e) {\r\n $lineItem.find('input:first').focus()\r\n }\r\n this.trigger('lineItemAdded', $lineItem)\r\n return $lineItem\r\n },\r\n\r\n accountSelectedCallbackLeftForBalance: function ($lineItem, account) {\r\n $lineItem.find('input[name=account-number-lookup-left]')\r\n .val(account.accountNumber)\r\n .parent()\r\n .addClass('open')\r\n $lineItem.find('input[name=account-desc-lookup-left]')\r\n .val(account.accountName)\r\n .parent()\r\n .addClass('open')\r\n $lineItem.find('input[name=fromLedgerAccountId]')\r\n .val(account.id)\r\n this.validateExtras()\r\n },\r\n\r\n accountSelectedCallbackRightForBalance: function ($lineItem, account) {\r\n $lineItem.find('input[name=account-number-lookup-right]')\r\n .val(account.accountNumber)\r\n .parent()\r\n .addClass('open')\r\n $lineItem.find('input[name=account-desc-lookup-right]')\r\n .val(account.accountName)\r\n .parent()\r\n .addClass('open')\r\n $lineItem.find('input[name=toLedgerAccountId]')\r\n .val(account.id)\r\n this.validateExtras()\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n if (this.model.get('incomeAllocation') && this.model.get('accountIncomeListDistributeTo')) {\r\n _.each(this.model.get('incomeAllocation'), function (incomeAllocation) {\r\n var $lineItem = this.addIncomeAllocation()\r\n var account = _.first(_.filter(this.model.get('accountIncomeListDistributeTo'), {id: incomeAllocation.toLedgerAccountId}))\r\n if (!account) {\r\n return\r\n }\r\n this.accountSelectedCallbackForIncome($lineItem, account)\r\n\r\n $lineItem.find('input[name=allocation]').val(incomeAllocation.allocation)\r\n }.bind(this))\r\n } else {\r\n this.addIncomeAllocation()\r\n }\r\n\r\n if (this.model.get('balanceMapping') && this.model.get('accountListDistributeTo') && this.model.get('accountListDistributeFrom')) {\r\n _.each(this.model.get('balanceMapping'), function (balanceMapping) {\r\n var $lineItem = this.addAccountMapping()\r\n var accountFrom = _.first(_.filter(this.model.get('accountListDistributeFrom'), {id: balanceMapping.fromLedgerAccountId}))\r\n if (!accountFrom) {\r\n return\r\n }\r\n this.accountSelectedCallbackLeftForBalance($lineItem, accountFrom)\r\n var accountTo = _.first(_.filter(this.model.get('accountListDistributeTo'), {id: balanceMapping.toLedgerAccountId}))\r\n if (!accountTo) {\r\n return\r\n }\r\n this.accountSelectedCallbackRightForBalance($lineItem, accountTo)\r\n }.bind(this))\r\n }\r\n this.validateExtras()\r\n },\r\n\r\n showError: function (message) {\r\n this.$('.status').html(this.getErrorStatusBar(message))\r\n },\r\n\r\n showSuccess: function (message) {\r\n this.$('.status').html(this.getSuccessStatusBar(message))\r\n },\r\n \r\n validateIncomeAndBalanceStatement: function () {\r\n if (!this.isIncomeAccountNumberfilledForFirstRow()) {\r\n this.showError('Income statement closing entry requires at least one balance sheet account.')\r\n } else if (!this.isPercentageValid()) {\r\n this.showError('Income statement closing entry needs to total 100%.')\r\n } else if (!this.isBothFromAndToLedgerAccountExist()) {\r\n this.showError('Two balance sheet accounts are required.')\r\n } else if (!this.isIncomeRowEntirelyEmpty()) {\r\n this.showError('All income statement fields are required.')\r\n } else {\r\n this.showSuccess('Your closing entries are ready to be saved.')\r\n }\r\n },\r\n\r\n isIncomeRowEntirelyEmpty: function () {\r\n var items = _.filter(this.$('.income-line-item-container .new-journal-entry-item'), function (row, index) {\r\n return ((!!this.$(row).find('input[name=allocation]').val() && !this.$(row).find('input[name=account-number-lookup]').val()) || (!this.$(row).find('input[name=allocation]').val() && !!this.$(row).find('input[name=account-number-lookup]').val()))\r\n })\r\n return !items.length\r\n },\r\n\r\n isPercentageValid: function () {\r\n var totalPercentage = 0\r\n _.map(this.$('.income-line-item-container .new-journal-entry-item'), function (row, index) {\r\n totalPercentage += Number(this.$(row).find('input[name=allocation]').val())\r\n })\r\n return totalPercentage === 100\r\n },\r\n\r\n isIncomeAccountNumberfilledForFirstRow: function () {\r\n var items = _.filter(this.$('.income-line-item-container .new-journal-entry-item input[name=account-number-lookup]'), function (row, index) {\r\n if (this.$('.income-line-item-container .new-journal-entry-item input[name=account-number-lookup]').length < 2) {\r\n // convert the DOM object to jQuery object, check if it has a value; if it does not it will filter it\r\n return !this.$(row).val()\r\n }\r\n }.bind(this))\r\n return !items.length\r\n },\r\n\r\n isBothFromAndToLedgerAccountExist: function () {\r\n var items = _.filter(this.$('.mapping-line-item-container .new-journal-entry-item'), function (row, index) {\r\n return (!this.$(row).find('input[name=account-number-lookup-left]').val() && !!this.$(row).find('input[name=account-number-lookup-right]').val()) || (!!this.$(row).find('input[name=account-number-lookup-left]').val() && !this.$(row).find('input[name=account-number-lookup-right]').val())\r\n }.bind(this))\r\n return !items.length\r\n },\r\n\r\n isFromLedgerAccountUnique: function () {\r\n var items = []\r\n _.map(this.$('.mapping-line-item-container .new-journal-entry-item'), function (row, index) {\r\n items[index] = this.$(row).find('input[name=account-number-lookup-left]').val()\r\n }.bind(this))\r\n\r\n var uniqAccounts = _.uniq(items)\r\n return items.length === uniqAccounts.length\r\n },\r\n\r\n validateExtras: function () {\r\n this.validateIncomeAndBalanceStatement()\r\n this.autoCompleteForIncome()\r\n this.autoCompleteForBalanceLeft()\r\n },\r\n\r\n toJSON: function () {\r\n var model = {}\r\n if (!(this.isPercentageValid() && this.isIncomeAccountNumberfilledForFirstRow() && this.isBothFromAndToLedgerAccountExist() && this.isFromLedgerAccountUnique())) {\r\n throw new Error('Error!')\r\n }\r\n // takes inputs and convert to object\r\n model['income'] = _.filter(_.map(this.$('.income-line-item-container .new-journal-entry-item'), function (incomeAllocation) {\r\n var $incomeAllocation = this.$(incomeAllocation)\r\n var allocation = Number($incomeAllocation.find('input[name=allocation]').val())\r\n var toLedgerAccountId = $incomeAllocation.find('input[name=toLedgerAccountId]').val()\r\n return {\r\n allocation: Number(allocation),\r\n toLedgerAccountId: toLedgerAccountId\r\n }\r\n }), function (item) {\r\n return item.toLedgerAccountId\r\n })\r\n\r\n model['balance'] = _.filter(_.map(this.$('.mapping-line-item-container .new-journal-entry-item'), function (balanceMapping) {\r\n var $balanceMapping = this.$(balanceMapping)\r\n var fromLedgerAccountId = $balanceMapping.find('input[name=fromLedgerAccountId]').val()\r\n var toLedgerAccountId = $balanceMapping.find('input[name=toLedgerAccountId]').val()\r\n return {\r\n fromLedgerAccountId: fromLedgerAccountId,\r\n toLedgerAccountId: toLedgerAccountId\r\n }\r\n }), function (item) {\r\n return item.fromLedgerAccountId && item.toLedgerAccountId\r\n })\r\n\r\n return model\r\n },\r\n \r\n cancel: function (e) {\r\n e.preventDefault()\r\n this.trigger('back')\r\n },\r\n \r\n collapse: function (e) {\r\n this.cancel(e)\r\n }\r\n})\r\n\r\nmodule.exports = ClosingEntriesView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar Backbone = require('backbone')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar Model = require('lists/list/item/entry')\r\nvar ListContainer = require('settings/closing-entries/view')\r\nvar AccountService = require('generalledgeraccounts/service')\r\nvar IncomeSheetService = require('settings/closing-entries/income-allocation/service')\r\nvar BalanceSheetService = require('settings/closing-entries/balance-mapping/service')\r\n\r\nvar ClosingEntriesWidget = function () {\r\n this.model = new Model()\r\n this.view = new ListContainer({model: this.model})\r\n this.service = new AccountService()\r\n this.incomeSheetService = new IncomeSheetService()\r\n this.balanceSheetService = new BalanceSheetService()\r\n this.on('shown', function () {\r\n this.service.fetchAccounts(false).then(function (accounts) {\r\n var accountList = _.map(accounts, function (account) {\r\n var accountJSON = account.toJSON()\r\n return accountJSON\r\n })\r\n\r\n var accountListDistributeFrom = _.filter(accountList, function (account) {\r\n var accountType = account.accountType.toLowerCase()\r\n return (accountType === 'asset' || accountType === 'liability' || accountType === 'equity')\r\n })\r\n\r\n var accountListDistributeTo = _.filter(accountList, function (account) {\r\n var accountType = account.accountType.toLowerCase()\r\n return (accountType === 'asset' || accountType === 'liability' || accountType === 'equity')\r\n })\r\n\r\n var accountIncomeListDistributeTo = _.filter(accountList, function (account) {\r\n var accountType = account.accountType.toLowerCase()\r\n return (accountType !== 'expense' && accountType !== 'revenue')\r\n })\r\n\r\n this.model.set('accountListDistributeFrom', accountListDistributeFrom)\r\n this.model.set('accountListDistributeTo', accountListDistributeTo)\r\n this.model.set('accountIncomeListDistributeTo', accountIncomeListDistributeTo)\r\n }.bind(this)).then(function () {\r\n this.view.trigger('widgetShown')\r\n }.bind(this))\r\n }.bind(this))\r\n this.listenTo(this.view, 'create', this.save.bind(this))\r\n}\r\n\r\nClosingEntriesWidget.prototype = _.clone(GenericListWidget.prototype)\r\nClosingEntriesWidget.prototype.show = function () {\r\n Q.all([\r\n this.incomeSheetService.getList(),\r\n this.balanceSheetService.getList()\r\n ]).spread(function (incomeAllocation, balanceMapping) {\r\n this.model.set('incomeAllocation', incomeAllocation)\r\n this.model.set('balanceMapping', balanceMapping)\r\n }.bind(this))\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nClosingEntriesWidget.prototype.save = function (model) {\r\n Q.all([\r\n this.incomeSheetService.createGroup(model.income),\r\n this.balanceSheetService.createGroup(model.balance)\r\n ]).spread(function (responseIncome, responseBalance) {\r\n if (responseIncome.success && responseBalance.success) {\r\n Backbone.trigger('closingEntriesSavedSuccessfully')\r\n }\r\n }, function (error) {\r\n Backbone.trigger('closingEntriesFailedToSave', error)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = ClosingEntriesWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"<div class=\\\"block-content col-xs-12\\\">\\r\\n <div class=\\\"image-container\\\">\\r\\n <div class=\\\"img-toolbar\\\" id=\\\"edit-actions\\\">\\r\\n <div class=\\\"img-edit-buttons\\\">\\r\\n <div class=\\\"btn-group\\\">\\r\\n <button class=\\\"btn btn-primary\\\" data-method=\\\"zoom\\\" data-option=\\\"0.1\\\" title=\\\"Zoom In\\\" type=\\\"button\\\">\\r\\n <span class=\\\"docs-tooltip\\\" data-toggle=\\\"tooltip\\\" title data-original-title=\\\"Zoom In\\\">\\r\\n <span class=\\\"fa fa-search-plus\\\"></span>\\r\\n </span> \\r\\n </button>\\r\\n <button class=\\\"btn btn-primary\\\" data-method=\\\"zoom\\\" data-option=\\\"-0.1\\\" title=\\\"Zoom Out\\\" type=\\\"button\\\">\\r\\n <span class=\\\"docs-tooltip\\\" data-toggle=\\\"tooltip\\\" title data-original-title=\\\"Zoom Out\\\">\\r\\n <span class=\\\"fa fa-search-minus\\\"></span>\\r\\n </span> \\r\\n </button> \\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n <img id=\\\"imageSelected\\\" src=\"\n + container.escapeExpression(((helper = (helper = helpers.invoiceLogoFile || (depth0 != null ? depth0.invoiceLogoFile : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"invoiceLogoFile\",\"hash\":{},\"data\":data}) : helper)))\n + \" style=\\\"visibility: hidden;\\\">\\r\\n </div>\\r\\n <ul>\\r\\n <li>Any part of the your logo that is outside of the blue rectangle will be not included in the final image.</li>\\r\\n <li>Use the magnfiting glass buttons above the preview (or your mouse wheel) to zoom your logo in/out.</li>\\r\\n <li>Click and drag anywhere in the preview area to adjust the position of your logo.</li>\\r\\n </ul>\\r\\n <div class=\\\"no-padding actions\\\">\\r\\n <button class=\\\"btn btn-primary pull-right cancel\\\" type=\\\"button\\\">Cancel</button>\\r\\n <button class=\\\"btn btn-primary pull-right upload-result\\\" type=\\\"button\\\">OK</button>\\r\\n <label class=\\\"btn btn-primary pull-right uploadNewImage\\\"><input type=\\\"file\\\" id=\\\"upload\\\" accept=\\\"image/*\\\"/>Upload Image</label>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar EditImageTemplate = require('settings/invoices/logo/template')\r\n\r\nvar SessionService = require('session/session-service')\r\nvar Config = require('config/config')\r\n\r\nvar EditImageView = Backbone.View.extend({\r\n className: 'block image-modification-modal z-1',\r\n\r\n initialize: function () {\r\n this.listenTo(this.invoiceLogoFile, 'change', this.render)\r\n },\r\n\r\n events: {\r\n 'click .upload-result': 'uploadResult',\r\n 'click .cancel': 'cancel',\r\n 'change .uploadNewImage': 'changeFile',\r\n 'click .img-edit-buttons': 'editActions'\r\n },\r\n\r\n render: function () {\r\n this.$el.html(EditImageTemplate(this.createViewModel()))\r\n\r\n if (this.model.get('editedInvoiceLogoFile')) {\r\n this.invoiceLogoFile = this.model.get('editedInvoiceLogoFile')\r\n }\r\n\r\n this.imageEditerSetup()\r\n\r\n this.$el.on('change', '#upload', this.changeFile.bind(this))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('companyInfo')) {\r\n var companyInfo = this.model.get('companyInfo')\r\n\r\n this.invoiceLogoFile = !!this.model.get('editedInvoiceLogoFile') ? this.model.get('editedInvoiceLogoFile') : this.getInvoiceLogoUrl()\r\n this.invoiceLogoFile = companyInfo.invoiceLogoFile ? this.invoiceLogoFile : '/img/crunched-logo-color_200.png'\r\n }\r\n\r\n var data = {\r\n invoiceLogoFile: this.invoiceLogoFile,\r\n hasEditedFile: !!this.model.get('editedInvoiceLogoFile')\r\n }\r\n\r\n return data\r\n },\r\n\r\n getInvoiceLogoUrl: function () {\r\n var companyInfo = this.model.get('companyInfo')\r\n\r\n return Config['CRUNCHED_API_HOST'] + '/companies/' + companyInfo.id + '/invoice-logo?accessToken=' + SessionService.getToken()\r\n },\r\n\r\n changeFile: function (e) {\r\n var selectedFile = _.first(e.target.files)\r\n\r\n if (!selectedFile) {\r\n return console.warn('No image selected, leaving unchanged')\r\n }\r\n\r\n var reader = new FileReader()\r\n\r\n reader.onload = function (selectedUploadFile) {\r\n if (this.checkFileExtension(selectedFile)) {\r\n this.cachedSelectedFile = selectedUploadFile.target.result\r\n this.invoiceLogoFile = selectedUploadFile.target.result\r\n\r\n if (!!this.invoiceLogoFile) {\r\n this.$('#imageSelected').attr('src', this.invoiceLogoFile)\r\n\r\n this.uploadCrop.cropper('replace', this.invoiceLogoFile)\r\n }\r\n }\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(selectedFile)\r\n\r\n this.isValidFileExtension = this.checkFileExtension(selectedFile)\r\n },\r\n\r\n editActions: function (event) {\r\n var e = event || window.event\r\n var target = e.target || e.srcElement\r\n var result\r\n var input\r\n var data\r\n\r\n if (!this.uploadCrop) {\r\n return\r\n }\r\n\r\n while (target !== this) {\r\n if (target.getAttribute('data-method')) {\r\n break\r\n }\r\n\r\n target = target.parentNode\r\n }\r\n\r\n if (target === this || target.disabled || target.className.indexOf('disabled') > -1) {\r\n return\r\n }\r\n\r\n data = {\r\n method: target.getAttribute('data-method'),\r\n target: target.getAttribute('data-target'),\r\n option: target.getAttribute('data-option'),\r\n secondOption: target.getAttribute('data-second-option')\r\n }\r\n\r\n if (data.method) {\r\n if (typeof data.target !== 'undefined') {\r\n input = document.querySelector(data.target)\r\n\r\n if (!target.hasAttribute('data-option') && data.target && input) {\r\n try {\r\n data.option = JSON.parse(input.value)\r\n } catch (e) {\r\n console.log(e.message)\r\n }\r\n }\r\n }\r\n\r\n if (data.method === 'getCroppedCanvas') {\r\n data.option = JSON.parse(data.option)\r\n }\r\n\r\n result = this.uploadCrop.cropper(data.method, data.option, data.secondOption)\r\n\r\n switch (data.method) {\r\n case 'scaleX':\r\n case 'scaleY':\r\n target.setAttribute('data-option', -data.option)\r\n break\r\n }\r\n }\r\n },\r\n\r\n imageEditerSetup: function () {\r\n var $image = this.$('.image-container > img')\r\n\r\n this.$dataX = $('#dataX')\r\n this.$dataY = $('#dataY')\r\n this.$dataHeight = $('#dataHeight')\r\n this.$dataWidth = $('#dataWidth')\r\n\r\n this.uploadCrop = $image.cropper({\r\n guides: false,\r\n highlight: false,\r\n dragCrop: false,\r\n cropBoxMovable: false,\r\n cropBoxResizable: false,\r\n dragMode: 'move',\r\n minContainerWidth: 930,\r\n minContainerHeight: 390,\r\n\r\n ready: function () {\r\n var width = 347\r\n var height = 132\r\n\r\n var xOffset = 6\r\n var yOffset = 7\r\n\r\n $image.cropper('setCropBoxData', {\r\n left: xOffset,\r\n top: yOffset,\r\n width: width,\r\n height: height\r\n })\r\n\r\n $image.cropper('setCanvasData', {\r\n left: xOffset,\r\n top: yOffset,\r\n width: width,\r\n height: height\r\n })\r\n\r\n var canvasData = $image.cropper('getCanvasData')\r\n\r\n $image.cropper('setCanvasData', {\r\n left: xOffset,\r\n top: yOffset - ((canvasData.height - height) / 2),\r\n width: width,\r\n height: height\r\n })\r\n },\r\n\r\n done: function (data) {\r\n this.$dataX.val(Math.round(data.x))\r\n this.$dataY.val(Math.round(data.y))\r\n this.$dataHeight.val(Math.round(data.height))\r\n this.$dataWidth.val(Math.round(data.width))\r\n }\r\n })\r\n\r\n },\r\n\r\n uploadResult: function (e) {\r\n var $image = this.$('.image-container > img')\r\n var result = this.uploadCrop.cropper('getCroppedCanvas', {\r\n fillColor: '#FFFFFF'\r\n })\r\n\r\n this.invoiceLogoFile = result.toDataURL('image/png')\r\n\r\n this.trigger('update', this.invoiceLogoFile)\r\n },\r\n\r\n imageCroppieEditerSetup: function () {\r\n this.uploadCrop = this.$('.image-container').croppie()\r\n\r\n this.uploadCrop.croppie('bind', {\r\n url: this.invoiceLogoFile,\r\n }).then(function () {\r\n console.log('Invoice logo bind complete')\r\n })\r\n },\r\n\r\n uploadCroppieResult: function (e) {\r\n this.uploadCrop.croppie('result', {\r\n type: 'base64',\r\n size: 'viewport'\r\n }).then(function (resp) {\r\n this.invoiceLogoFile = resp\r\n\r\n this.trigger('update', this.invoiceLogoFile)\r\n }.bind(this))\r\n },\r\n\r\n checkFileExtension: function (selectedFile) {\r\n var validExts = new Array('.png', '.gif')\r\n\r\n var fileExt = selectedFile.name\r\n\r\n fileExt = fileExt.substring(fileExt.lastIndexOf('.')).toLowerCase()\r\n\r\n if (validExts.indexOf(fileExt) < 0) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'You can only upload image(*.png or *.gif) file.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n\r\n this.cachedSelectedFile = ''\r\n this.isValidFileExtension = false\r\n\r\n return false\r\n\r\n } else {\r\n this.isValidFileExtension = true\r\n\r\n return true\r\n }\r\n },\r\n\r\n cancel: function () {\r\n this.trigger('cancel')\r\n }\r\n})\r\n\r\nmodule.exports = EditImageView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\n\r\nvar EditImageView = require('settings/invoices/logo/view')\r\n\r\nvar EditImageWidget = function (companyInfo, editedInvoiceLogoFile) {\r\n this.model = new Backbone.Model({\r\n companyInfo: companyInfo,\r\n editedInvoiceLogoFile: editedInvoiceLogoFile\r\n })\r\n\r\n this.view = new EditImageView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('cancel', this.cancelEditing, this)\r\n this.view.on('update', this.updateExisting, this)\r\n}\r\n\r\nEditImageWidget.prototype = _.clone(Backbone.Events)\r\n\r\nEditImageWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n return this.view.render().el\r\n}\r\n\r\nEditImageWidget.prototype.cancelEditing = function () {\r\n this.trigger('cancel')\r\n}\r\n\r\nEditImageWidget.prototype.updateExisting = function (updated) {\r\n this.trigger('updateImage', updated)\r\n}\r\n\r\nmodule.exports = EditImageWidget","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar InvoiceSettingsService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nInvoiceSettingsService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nInvoiceSettingsService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nInvoiceSettingsService.prototype.update = function (model) {\r\n var apiPath = this.GetPath()\r\n\r\n return this.restClient.put(apiPath, model)\r\n}\r\n\r\nInvoiceSettingsService.prototype.getList = function () {\r\n var apiPath = this.GetPath()\r\n \r\n return this.restClient.get(apiPath)\r\n}\r\n\r\nmodule.exports = InvoiceSettingsService\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper;\n\n return \" <label class=\\\"invoice-logo-img editImage\\\" data-has-image>\\r\\n <img src=\\\"\"\n + ((stack1 = ((helper = (helper = helpers.invoiceLogoFile || (depth0 != null ? depth0.invoiceLogoFile : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"invoiceLogoFile\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"\\\" id=\\\"logo-image\\\">\\r\\n </label>\\r\\n <button type=\\\"button\\\" class=\\\"btn btn-primary\\\" id=\\\"edit-button\\\">Edit</button>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <div id=\\\"upload-image-container\\\">\\r\\n <label class=\\\"invoice-logo-img editImage\\\">\\r\\n <img id=\\\"logo-image\\\">\\r\\n </label>\\r\\n </div>\\r\\n <button type=\\\"button\\\" class=\\\"btn btn-primary\\\" id=\\\"upload-button\\\">Upload</button>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"block\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <form>\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Invoice Logo</h3>\\r\\n </div>\\r\\n <div class=\\\"flex invoice-logo-upload\\\">\\r\\n <div class=\\\"form-group\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.invoiceLogoFile : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <br/>\\r\\n <div class=\\\"actions\\\">\\r\\n <button class=\\\"btn btn-primary pull-right\\\" id=\\\"save-button\\\">Save Settings</button>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var _ = require('lodash')\r\nvar $ = require('jquery')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar CreateView = require('lists/list/create/view')\r\nvar EditImageWidget = require('settings/invoices/logo/widget')\r\nvar Template = require('settings/invoices/template')\r\n\r\nvar Config = require('config/config')\r\nvar SessionService = require('session/session-service')\r\n\r\nvar InvoiceSettingsView = CreateView.extend({\r\n className: 'settings invoices',\r\n\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'click .save': 'update',\r\n 'click #edit-button': 'editImage',\r\n 'click #upload-button': 'editImage'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n\r\n this.listenTo(this.model, 'change', this.render.bind(this))\r\n\r\n this.on('updated', this.updated, this)\r\n\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n this.$el.html(this.Template(this.createViewModel()))\r\n\r\n this.on(this.editedInvoiceLogoFile, 'change', this.changeFile.bind(this))\r\n },\r\n\r\n changeFile: function (editedInvoiceLogoFile) {\r\n if (editedInvoiceLogoFile) {\r\n this.cachedInvoiceLogoImage = editedInvoiceLogoFile\r\n\r\n this.$('#logo-image').attr('src', this.cachedInvoiceLogoImage).attr('data-has-image', 'true')\r\n }\r\n },\r\n\r\n checkFileExtension: function (selectedFile) {\r\n var validExts = new Array('.png', '.gif')\r\n var fileExt = selectedFile.name\r\n\r\n fileExt = fileExt.substring(fileExt.lastIndexOf('.')).toLowerCase()\r\n\r\n if (validExts.indexOf(fileExt) < 0) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'You can only upload image(*.png or *.gif) file.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n\r\n this.cachedInvoiceLogoImage = ''\r\n this.isValidFileExtension = false\r\n\r\n return false\r\n } else {\r\n this.isValidFileExtension = true\r\n\r\n return true\r\n }\r\n },\r\n\r\n createViewModel: function () {\r\n var invoiceLogoFile = ''\r\n\r\n if (this.model.get('companyInfo')) {\r\n var companyInfo = this.model.get('companyInfo')\r\n\r\n invoiceLogoFile = companyInfo.invoiceLogoFile ? this.getInvoiceLogoUrl() : this.editedInvoiceLogoFile\r\n }\r\n\r\n var data = {\r\n invoiceLogoFile: invoiceLogoFile\r\n }\r\n\r\n return data\r\n },\r\n\r\n editImage: function (e) {\r\n var edit = new EditImageWidget(this.model.get('companyInfo'), this.editedInvoiceLogoFile)\r\n var $edit = $(edit.show())\r\n\r\n this.$('.block-content').append($edit)\r\n\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).on('click', function () {\r\n edit.trigger('cancel')\r\n })\r\n\r\n edit.on('cancel close updateImage', function () {\r\n $edit.remove()\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n }, this)\r\n\r\n edit.on('updateImage', function (selectedImage) {\r\n this.editedInvoiceLogoFile = selectedImage\r\n\r\n this.changeFile(this.editedInvoiceLogoFile)\r\n\r\n $('#upload-image-container').show()\r\n $('#upload-button').text('Edit')\r\n }, this)\r\n },\r\n\r\n getInvoiceLogoUrl: function () {\r\n var companyInfo = this.model.get('companyInfo')\r\n\r\n return Config['CRUNCHED_API_HOST'] + '/companies/' + companyInfo.id + '/invoice-logo?accessToken=' + SessionService.getToken()\r\n },\r\n\r\n updated: function () {\r\n this.$('.save').prop('disabled', false)\r\n\r\n this.cachedInvoiceLogoImage = ''\r\n this.isValidFileExtension = false\r\n this.editedInvoiceLogoFile = ''\r\n },\r\n\r\n toJSON: function () {\r\n var companyInfo = this.model.get('companyInfo')\r\n\r\n var id = companyInfo.id\r\n var name = companyInfo.name\r\n var phone = companyInfo.phone\r\n var emailAddress = companyInfo.emailAddress\r\n var website = companyInfo.website\r\n var accountingPeriodMonth = companyInfo.accountingPeriodMonth\r\n var accountingPeriodDay = companyInfo.accountingPeriodDay\r\n var isAccrual = companyInfo.isAccrual\r\n var addressLine1 = companyInfo.addressLine1\r\n var addressLine2 = companyInfo.addressLine2\r\n var city = companyInfo.city\r\n var state = companyInfo.state\r\n var postalCode = companyInfo.postalCode\r\n var signatureFile = companyInfo.signatureFile\r\n var invoiceLogoFileUpload = this.cachedInvoiceLogoImage ? this.cachedInvoiceLogoImage : companyInfo.invoiceLogoFileUpload\r\n var invoiceLogoFile = companyInfo.invoiceLogoFile\r\n\r\n var model = {\r\n id: id,\r\n name: name,\r\n phone: phone,\r\n emailAddress: emailAddress,\r\n website: website,\r\n accountingPeriodMonth: accountingPeriodMonth,\r\n accountingPeriodDay: accountingPeriodDay,\r\n isAccrual: isAccrual,\r\n addressLine1: addressLine1,\r\n addressLine2: addressLine2,\r\n city: city,\r\n state: state,\r\n postalCode: postalCode,\r\n signatureFile: signatureFile,\r\n invoiceLogoFileUpload: invoiceLogoFileUpload,\r\n invoiceLogoFile: invoiceLogoFile\r\n }\r\n\r\n return model\r\n }\r\n})\r\n\r\nmodule.exports = InvoiceSettingsView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar GenericListWidget = require('lists/list/widget')\r\nvar Model = require('lists/list/item/entry')\r\nvar View = require('settings/invoices/view')\r\nvar InvoiceSettingsService = require('settings/invoices/service')\r\n\r\nvar InvoiceSettingsWidget = function () {\r\n this.model = new Model()\r\n this.service = new InvoiceSettingsService()\r\n\r\n this.view = new View({\r\n model: this.model\r\n })\r\n\r\n this.listenTo(this.view, 'update', this.save.bind(this))\r\n}\r\n\r\nInvoiceSettingsWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nInvoiceSettingsWidget.prototype.show = function () {\r\n Q.all([\r\n this.service.getList()]\r\n ).then(function (companyInfo) {\r\n this.model.set('id', companyInfo[0].id)\r\n this.model.set('companyInfo', companyInfo[0])\r\n }.bind(this))\r\n\r\n return this.view.render().$el\r\n}\r\n\r\nInvoiceSettingsWidget.prototype.save = function (id, model) {\r\n this.service.update(model)\r\n .then(function (response) {\r\n if (response.success) {\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'All of your changes are saved successfully.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n this.view.trigger('updated')\r\n }\r\n }.bind(this), function (error) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: 'Failed to save the changes.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n })\r\n}\r\n\r\nmodule.exports = InvoiceSettingsWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<ul class=\\\"nav nav-tabs nav-tabs-alt\\\" data-toggle=\\\"tabs\\\">\\r\\n <li class=\\\"active\\\"><a data-memorization-type=\\\"MemorizedCheck\\\" href=\\\"#new-checks\\\">Check</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedDeposit\\\" href=\\\"#new-deposits\\\">Deposit</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedEFTPayment\\\" href=\\\"#new-eft-payments\\\">EFT Payment</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedEFTDeposit\\\" href=\\\"#new-eft-deposits\\\">EFT Deposit</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedGeneral\\\" href=\\\"#new-journal-entries\\\" class=\\\"general-journal\\\">Journal</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedQuote\\\" href=\\\"#new-quotes\\\">Quote</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedAR\\\" href=\\\"#new-invoices\\\">Invoice</a></li>\\r\\n <li class=\\\"\\\"><a data-memorization-type=\\\"MemorizedAP\\\" href=\\\"#new-payables\\\">Payable</a></li>\\r\\n <li class=\\\"pull-right cancel-button\\\">\\r\\n <i class=\\\"fa fa-close expanding-group-close cancel\\\"></i>\\r\\n </li>\\r\\n</ul>\\r\\n<div class=\\\"block-content tab-content\\\">\\r\\n <div class=\\\"tab-pane active check\\\" id=\\\"new-checks\\\" data-memorization-type=\\\"MemorizedCheck\\\"></div>\\r\\n <div class=\\\"tab-pane deposit\\\" id=\\\"new-deposits\\\" data-memorization-type=\\\"MemorizedDeposit\\\"></div>\\r\\n <div class=\\\"tab-pane eft-payment\\\" id=\\\"new-eft-payments\\\" data-memorization-type=\\\"MemorizedEFTPayment\\\"></div>\\r\\n <div class=\\\"tab-pane eft-deposit\\\" id=\\\"new-eft-deposits\\\" data-memorization-type=\\\"MemorizedEFTDeposit\\\"></div>\\r\\n <div class=\\\"tab-pane journal-entry\\\" id=\\\"new-journal-entries\\\" data-memorization-type=\\\"MemorizedGeneral\\\"></div>\\r\\n <div class=\\\"tab-pane quotes receivables list\\\" id=\\\"new-quotes\\\" data-memorization-type=\\\"MemorizedQuote\\\"></div>\\r\\n <div class=\\\"tab-pane invoices receivables list\\\" id=\\\"new-invoices\\\" data-memorization-type=\\\"MemorizedAR\\\"></div>\\r\\n <div class=\\\"tab-pane payables list\\\" id=\\\"new-payables\\\" data-memorization-type=\\\"MemorizedAP\\\"></div>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('settings/memorizations/create/template')\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar CreateCheckWidget = require('checkbook/check/create-check-widget')\r\nvar CreateDepositWidget = require('checkbook/deposit/create-deposit-widget')\r\nvar CreateEftPaymentWidget = require('checkbook/eft-payment/create-eft-payment-widget')\r\nvar CreateEftDepositWidget = require('checkbook/eft-deposit/create-eft-deposit-widget')\r\nvar CreateJournalEntryWidget = require('journal/create/widget')\r\n\r\nvar ContactsView = CreateView.extend({\r\n className: 'block create collapsed tabbed',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'change input[type=file]': 'selectFile',\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'click .add-more-line-items': 'addContactMethod',\r\n 'change .is-recurring': 'toggleShowRecurring'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function (options) {\r\n if (!this.Template) this.Template = Template\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n\r\n this.createInvoice = options.invoiceCreateView\r\n this.createPayable = options.payableCreateView\r\n this.createQuote = options.quoteCreateView\r\n\r\n var fakeCheckbook = new Backbone.Model({\r\n isMemorizationMode: true\r\n })\r\n this.createEftDeposit = new CreateEftDepositWidget(fakeCheckbook)\r\n this.createEftPayment = new CreateEftPaymentWidget(fakeCheckbook)\r\n this.createDeposit = new CreateDepositWidget(fakeCheckbook)\r\n this.createCheck = new CreateCheckWidget(fakeCheckbook)\r\n this.createJournalEntry = new CreateJournalEntryWidget()\r\n\r\n this.model.on('change:checkbooks', function () {\r\n fakeCheckbook.set('checkbooks', _.map(this.model.get('checkbooks'), function (checkbook) {\r\n return checkbook.toJSON()\r\n }))\r\n }.bind(this))\r\n\r\n this.createEftDeposit.on('memorizationUpdated memorizationCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n this.createEftPayment.on('memorizationUpdated memorizationCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n this.createDeposit.on('memorizationUpdated memorizationCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n this.createCheck.on('memorizationUpdated memorizationCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n this.createJournalEntry.on('memorizationUpdated memorizationCreated', function () {\r\n this.trigger('itemCreated')\r\n }, this)\r\n\r\n this.memorizationCallbacks = {\r\n MemorizedCheck: this.createCheck.view.memorizationSelected.bind(this.createCheck.view),\r\n MemorizedDeposit: this.createDeposit.view.memorizationSelected.bind(this.createDeposit.view),\r\n MemorizedEFTPayment: this.createEftPayment.view.memorizationSelected.bind(this.createEftPayment.view),\r\n MemorizedEFTDeposit: this.createEftDeposit.view.memorizationSelected.bind(this.createEftDeposit.view),\r\n MemorizedGeneral: this.createJournalEntry.view.memorizationSelected.bind(this.createJournalEntry.view),\r\n MemorizedQuote: this.createQuote.memorizationSelected.bind(this.createQuote),\r\n MemorizedAR: this.createInvoice.memorizationSelected.bind(this.createInvoice),\r\n MemorizedAP: this.createPayable.memorizationSelected.bind(this.createPayable)\r\n }\r\n\r\n _.each([\r\n this.createCheck.view, this.createDeposit.view, this.createEftPayment.view, this.createEftDeposit.view, this.createJournalEntry.view, this.createQuote, this.createInvoice, this.createPayable\r\n ], function (view) {\r\n this.listenTo(view, 'autocompleteBound', function ($input, property, dataSource) {\r\n if (property === 'label') {\r\n $input.autocomplete('destroy')\r\n }\r\n })\r\n }.bind(this))\r\n\r\n this.on('showEdit', this.selectMemorization.bind(this))\r\n },\r\n\r\n selectMemorization: function (memorization) {\r\n this.memorizationCallbacks[memorization.get('type')](memorization.id)\r\n this.$(\"a[data-memorization-type='\" + memorization.get('type') + \"']\").tab('show')\r\n this.$el.addClass('editing')\r\n this.handleClick()\r\n\r\n var pseudoTarget = this.$('div[data-memorization-type=\"' + memorization.get('type') + '\"] .is-recurring')\r\n\r\n this.toggleShowRecurring({\r\n currentTarget: pseudoTarget.get(0)\r\n })\r\n },\r\n\r\n handleClick: function (e) {\r\n if (!this.active) {\r\n this.$el.removeClass('collapsed').addClass('expanded')\r\n if (!this.$el.hasClass('editing')) {\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n }).off('click').one('click', this.close.bind(this))\r\n }\r\n this.active = true\r\n\r\n this.$('.expandable, .block.create').addClass('expanded')\r\n }\r\n },\r\n\r\n expand: function (e) {\r\n this.handleClick(e)\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n this.tabs = {\r\n '#new-eft-deposits': this.createEftDeposit,\r\n '#new-eft-payments': this.createEftPayment,\r\n '#new-deposits': this.createDeposit,\r\n '#new-checks': this.createCheck,\r\n '#new-journal-entries': this.createJournalEntry,\r\n\r\n // These are not widgets, they are the underlying views\r\n '#new-invoices': this.createInvoice,\r\n '#new-payables': this.createPayable,\r\n '#new-quotes': this.createQuote\r\n }\r\n\r\n this.createInvoice.delegateEvents()\r\n this.createPayable.delegateEvents()\r\n this.createQuote.delegateEvents()\r\n\r\n _.each(this.tabs, function (value, key) {\r\n var $el\r\n\r\n if (value.render) {\r\n $el = value.render().$el\r\n } else if (value.show) {\r\n $el = value.show()\r\n }\r\n\r\n this.$(key).html($el)\r\n var memorizationLabel = $el.find('input[name=\"memorizationLabel\"],input[name=label]')\r\n memorizationLabel.attr('no-autocomplete', true)\r\n if (memorizationLabel.data('ui-autocomplete')) {\r\n memorizationLabel.autocomplete('destroy')\r\n }\r\n }.bind(this))\r\n\r\n // We need to manually add the expanded class since we're using these views differently than their intention\r\n _.each([this.createInvoice.$el, this.createPayable.$el, this.createQuote.$el], function ($createView) {\r\n $createView.addClass('expanded')\r\n })\r\n\r\n if (window.location.hash) {\r\n this.$(\"a[href='\" + window.location.hash + \"']\").tab('show')\r\n }\r\n\r\n this.$el.on('click', this.handleClick.bind(this))\r\n },\r\n save: function () { },\r\n toJSON: function () { },\r\n\r\n close: function (e) {\r\n this.$('.expanded').removeClass('expanded')\r\n var isEditing = this.$el.hasClass('editing')\r\n this.$el.addClass('collapsed').removeClass('expanded').removeClass('editing')\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n }).off('click')\r\n this.active = false\r\n\r\n $('.ui-autocomplete.ui-front.ui-menu.ui-widget.ui-widget-content').css('display', 'none')\r\n\r\n if (e && e.stopImmediatePropagation) {\r\n e.stopImmediatePropagation()\r\n }\r\n if (isEditing) {\r\n this.reset()\r\n }\r\n },\r\n\r\n cancel: function (e) {\r\n this.close(e)\r\n this.trigger('cancelled')\r\n },\r\n\r\n collapse: function (e) {\r\n this.close(e)\r\n this.trigger('cancelled')\r\n },\r\n\r\n reset: function () {\r\n this.collapse()\r\n _.each(this.tabs, function (value, key) {\r\n if (value.render) {\r\n value.render()\r\n } else if (value.show) {\r\n value.show()\r\n }\r\n })\r\n },\r\n\r\n toggleShowRecurring: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var $checkbox = $currentTarget.find('input')\r\n this.$('.tab-pane.active .recurring-meta-container')\r\n .toggleClass(\r\n 'show-recurring',\r\n !!$checkbox.prop('checked')\r\n )\r\n }\r\n})\r\n\r\nmodule.exports = ContactsView\r\n","'use strict'\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\n\r\nvar Memorization = ListEntry.extend({}, {\r\n parse: function (json) {\r\n return new Memorization({\r\n amount: json.amount,\r\n description: json.description,\r\n id: json.id,\r\n label: json.label,\r\n type: json.type\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = Memorization\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"memorization-label\\\">\"\n + alias4(((helper = (helper = helpers.label || (depth0 != null ? depth0.label : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"label\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"description\\\">\"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"amount\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.amount : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n <a class=\\\"fa fa-trash-o pull-right remove\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ItemView = require('lists/list/item/view')\r\nvar Template = require('settings/memorizations/item/template')\r\n\r\nvar MemorizationView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n }\r\n})\r\n\r\nmodule.exports = MemorizationView\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Memorizations</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"memorization-label\\\">Label</div>\\r\\n <div class=\\\"description\\\">Description</div>\\r\\n <div class=\\\"amount\\\">Amount</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\"><p class=\\\"center\\\">Loading more contacts...</p></div>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('settings/memorizations/list/template')\r\nvar MemorizationView = require('settings/memorizations/item/view')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\n\r\nvar MemorizationList = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort'\r\n }),\r\n\r\n initialize: function (options) {\r\n this.invoiceListView = options.invoiceListView\r\n this.payableListView = options.payableListView\r\n this.quoteListView = options.quoteListView\r\n\r\n _.each([this.invoiceListView, this.payableListView, this.quoteListView], function (listView) {\r\n listView.showChildView = this.showChildView.bind(this)\r\n if (listView.showDetails) {\r\n listView.showDetails = listView.showDetails.bind(this)\r\n }\r\n if (listView.showEdit) {\r\n listView.showEdit = listView.showEdit.bind(this)\r\n }\r\n }.bind(this))\r\n\r\n this.Template = Template\r\n this.childView = MemorizationView\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.on('enable', this.showEnable.bind(this))\r\n this.on('disable', this.showDisable.bind(this))\r\n this.on('delete', this.showDelete.bind(this))\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more memorizations...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more memorizations.')\r\n },\r\n\r\n showEnable: function (memorizationId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + memorizationId + '\"]'), 'Are you sure you want to enable this memorization?', 'confirmEnable', memorizationId)\r\n },\r\n\r\n showDisable: function (memorizationId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + memorizationId + '\"]'), 'Are you sure you want to disable this memorization?', 'confirmDisable', memorizationId)\r\n },\r\n\r\n showDelete: function (memorizationId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + memorizationId + '\"]'), 'Are you sure you want to delete this memorization?', 'confirmDelete', memorizationId)\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.unset('memorizationId-sort')\r\n this.model.unset('firstName-sort')\r\n this.model.unset('lastName-sort')\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n },\r\n\r\n hide: function () {\r\n this.$el.addClass('hidden')\r\n },\r\n\r\n show: function () {\r\n this.$el.removeClass('hidden')\r\n }\r\n})\r\n\r\nmodule.exports = MemorizationList\r\n","'use strict'\r\n\r\nvar Memorization = require('settings/memorizations/item/memorization')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar Memorizations = ListWrapper.extend({\r\n childModel: Memorization\r\n})\r\n\r\n\r\nmodule.exports = Memorizations\r\n","var Backbone = require('backbone')\r\nvar ListContainer = require('lists/list/view')\r\nvar ListView = require('settings/memorizations/list/view')\r\nvar CreateView = require('settings/memorizations/create/view')\r\n\r\nvar ContactsView = ListContainer.extend({\r\n className: 'memorizations list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n\r\n this.listView = new ListView({\r\n model: this.model,\r\n invoiceListView: this.invoiceWidget.getListView(),\r\n payableListView: this.payableWidget.getListView(),\r\n quoteListView: this.createQuoteWidget.getListView(),\r\n invoiceMainView: this.invoiceWidget.view\r\n })\r\n this.forwardEvents(this.listView)\r\n this.invoiceWidget.view.showEdit = this.invoiceWidget.view.showEdit.bind(this)\r\n\r\n this.forwardEvents(this.invoiceWidget)\r\n this.forwardEvents(this.payableWidget)\r\n this.forwardEvents(this.createQuoteWidget)\r\n\r\n this.createView = new CreateView({\r\n model: this.model,\r\n invoiceCreateView: this.invoiceWidget.getCreateView(),\r\n payableCreateView: this.payableWidget.getCreateView(),\r\n quoteCreateView: this.createQuoteWidget.getCreateView()\r\n })\r\n this.forwardEvents(this.createView)\r\n\r\n this.on('created itemCreated memorizationUpdated memorizationCreated', function () {\r\n this.model.reset()\r\n this.createView.trigger('resetInputs')\r\n Backbone.trigger('app:reloadAside')\r\n }.bind(this))\r\n\r\n this.on('itemDeleted', function () {\r\n Backbone.trigger('app:reloadAside')\r\n })\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n console.log('container -> editDetails')\r\n this.listView.trigger('showEdit', model)\r\n }.bind(this))\r\n\r\n this.on('widgetShown', function () {\r\n this.listView.trigger('bindScroll')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n\r\n this.on('edit get', this.showEdit.bind(this))\r\n\r\n this.on('cancelled', function () {\r\n this.listView.show()\r\n }.bind(this))\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n\r\n this.$el.append(this.createView.render().$el)\r\n this.$el.append(this.listView.render().$el)\r\n\r\n return this\r\n },\r\n\r\n showEdit: function (modelId) {\r\n var memorizationEntry = this.model.get('items').get(modelId)\r\n this.listView.hide()\r\n this.createView.trigger('showEdit', memorizationEntry)\r\n }\r\n})\r\n\r\nmodule.exports = ContactsView\r\n","'use strict'\r\n\r\nvar _ = require('underscore')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar Contacts = require('settings/memorizations/memorizations')\r\nvar Service = require('memorization/service')\r\nvar ListContainer = require('settings/memorizations/view')\r\nvar InvoiceWidget = require('receivables/invoices/widget')\r\nvar PayableWidget = require('payables/payable/widget')\r\nvar CreateQuoteWidget = require('receivables/quotes/widget')\r\n\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar InvoicesMemorizationService = require('memorization/invoices/service')\r\nvar PayablesMemorizationService = require('memorization/payables/service')\r\nvar QuotesMemorizationService = require('memorization/quotes/service')\r\nvar JournalEntrysMemorizationService = require('memorization/journal-entries/service')\r\n\r\nvar MemorizationWidget = function () {\r\n this.service = new Service()\r\n this.modelType = Contacts\r\n\r\n this.invoiceWidget = new InvoiceWidget()\r\n this.payableWidget = new PayableWidget()\r\n this.createQuoteWidget = new CreateQuoteWidget()\r\n\r\n this.invoicesMemorizationService = new InvoicesMemorizationService()\r\n this.payablesMemorizationService = new PayablesMemorizationService()\r\n this.quotesMemorizationService = new QuotesMemorizationService()\r\n this.journalEntrysMemorizationService = new JournalEntrysMemorizationService()\r\n this.checkbookService = new CheckbookService()\r\n\r\n this.viewType = ListContainer.extend({\r\n invoiceWidget: this.invoiceWidget,\r\n payableWidget: this.payableWidget,\r\n createQuoteWidget: this.createQuoteWidget\r\n })\r\n\r\n this.serviceLookup = {\r\n MemorizedCheck: this.journalEntrysMemorizationService,\r\n MemorizedDeposit: this.journalEntrysMemorizationService,\r\n MemorizedEFTPayment: this.journalEntrysMemorizationService,\r\n MemorizedEFTDeposit: this.journalEntrysMemorizationService,\r\n MemorizedGeneral: this.journalEntrysMemorizationService,\r\n MemorizedQuote: this.quotesMemorizationService,\r\n MemorizedAR: this.invoicesMemorizationService,\r\n MemorizedAP: this.payablesMemorizationService\r\n }\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n\r\n this.checkbookService.fetchCheckbookList().then(function (checkbooks) {\r\n this.model.set('checkbooks', checkbooks)\r\n }.bind(this))\r\n\r\n this.on('shown', function () {\r\n this.view.trigger('widgetShown')\r\n }.bind(this))\r\n}\r\n\r\nMemorizationWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nMemorizationWidget.prototype.edit = function (modelId) { }\r\nMemorizationWidget.prototype.get = function (modelId) { }\r\n\r\nMemorizationWidget.prototype.confirmDelete = function (modelId) {\r\n var memorizationEntry = this.model.get('items').get(modelId)\r\n var service = this.serviceLookup[memorizationEntry.get('type')]\r\n\r\n return service.remove(modelId).then(function () {\r\n this.view.trigger('itemDeleted', modelId)\r\n }.bind(this))\r\n}\r\n\r\nMemorizationWidget.prototype.create = function () { }\r\n\r\nmodule.exports = MemorizationWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"data-has-image\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputType\":\"password\",\"inputLabel\":\"Current Password\",\"inputName\":\"currentPassword\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"tags\":\"autocomplete='new-password'\",\"inputType\":\"password\",\"inputLabel\":\"New Password\",\"inputName\":\"newPassword\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"static-accounts block\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Profile</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <form method=\\\"post\\\" autocomplete=\\\"on\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <div>\\r\\n <label class=\\\"avatar\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.picture : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" style=\\\"background:url('\"\n + ((stack1 = ((helper = (helper = helpers.picture || (depth0 != null ? depth0.picture : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"picture\",\"hash\":{},\"data\":data}) : helper))) != null ? stack1 : \"\")\n + \"') no-repeat center center;\\\">\\r\\n <div class=\\\"avatar-overlay\\\"> </div>\\r\\n <input type=\\\"file\\\" accept=\\\"image/*\\\" />\\r\\n </label>\\r\\n </div>\\r\\n <div class=\\\"profile-container\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"tags\":\"autocomplete='given-name'\",\"inputLabel\":\"First Name\",\"inputName\":\"firstName\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"tags\":\"autocomplete='family-name'\",\"inputLabel\":\"Last Name\",\"inputName\":\"lastName\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputClasses\":\"phoneNumber\",\"tags\":\"autocomplete='phonenumber tel'\",\"inputType\":\"tel\",\"inputLabel\":\"Phone Number\",\"inputName\":\"phoneNumber\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <div class=\\\"error-message text-danger\\\"></div>\\r\\n <div class=\\\"actions\\\">\\r\\n <button class=\\\"btn btn-primary save save-button\\\">Save Settings</button>\\r\\n </div>\\r\\n <div class=\\\"status\\\"></div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('settings/profile/template')\r\nvar _ = require('lodash')\r\n\r\nvar oneDigitMessage = \"Passwords must have at least one digit ('0'-'9').\"\r\nvar oneUppercaseMessage = \"Passwords must have at least one uppercase ('A'-'Z').\"\r\nvar passwordLengthMessage = 'Your password must be at least 6 characters.'\r\nvar passwordRequired = 'The password field is required.'\r\nvar currentPasswordRequired = 'Your current password is required to change your password'\r\n\r\nvar ProfileView = CreateView.extend({\r\n className: 'settings profile',\r\n\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'change input[type=file]': 'selectFile',\r\n 'keyup input': 'determineStatus',\r\n 'focusout input': 'determineStatus'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n\r\n this.listenTo(this.model, 'change', this.render.bind(this))\r\n\r\n this.on('updateFailed', function (error) {\r\n this.$('.error-message')\r\n .text(error.message)\r\n .removeClass('hidden')\r\n })\r\n },\r\n\r\n onRender: function () {\r\n // Fill in inputs with our data\r\n var model = this.model.toViewModel()\r\n this.$('.phoneNumber').mask('(999) 999-9999', { placeholder: ' ' })\r\n _.each(this.$('input:not([type=file]), textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else {\r\n $el.val(model[$el.attr('name')])\r\n }\r\n })\r\n\r\n this.determineStatus()\r\n },\r\n\r\n toJSON: function () {\r\n var profilePicture = this.cachedAvatar\r\n var model = {\r\n pictureUpload: profilePicture\r\n }\r\n\r\n _.each(this.$('input:not([type=file]), textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n this.$('.error-message').addClass('hidden')\r\n this.$('input[type=password]').val('')\r\n\r\n return model\r\n },\r\n\r\n // Take the file and update the avatar display to display the image\r\n selectFile: function (e) {\r\n var avatar = _.first(e.target.files)\r\n\r\n if (!avatar) return console.warn('No image selected, leaving unchanged')\r\n\r\n var reader = new FileReader()\r\n reader.onload = function (avatarFile) {\r\n this.$('.avatar').attr('style', 'background:url(\"' + avatarFile.target.result + '\") no-repeat center center;').attr('data-has-image', 'true')\r\n this.cachedAvatar = avatarFile.target.result\r\n }.bind(this)\r\n\r\n reader.readAsDataURL(avatar)\r\n },\r\n\r\n determineStatus: function (e) {\r\n var errorMessage\r\n if (!this.$('input[name=currentPassword]').val() && this.$('input[name=newPassword]').val()) {\r\n errorMessage = currentPasswordRequired\r\n } else if (this.$('input[name=newPassword]').val()) {\r\n var newPassword = this.$('input[name=newPassword]').val()\r\n var hasNumbers = !!(/[0-9]+/g).exec(newPassword)\r\n var hasUppercase = !!(/[A-Z]+/g).exec(newPassword)\r\n\r\n if (!newPassword) {\r\n errorMessage = passwordRequired\r\n }\r\n if (newPassword.length < 6) {\r\n errorMessage = passwordLengthMessage\r\n }\r\n if (!hasNumbers) {\r\n errorMessage = oneDigitMessage\r\n }\r\n if (!hasUppercase) {\r\n errorMessage = oneUppercaseMessage\r\n }\r\n }\r\n\r\n if (errorMessage) {\r\n this.$('.status').html(this.getErrorStatusBar(errorMessage))\r\n } else {\r\n this.$('.status').html(this.getSuccessStatusBar('Your profile is ready to be updated.'))\r\n }\r\n },\r\n\r\n showError: function (message) {\r\n this.btnEnable()\r\n this.$('.status').html(this.getErrorStatusBar(message))\r\n setTimeout(this.determineStatus.bind(this), 3000)\r\n },\r\n\r\n btnEnable: function () {\r\n this.$('.save').prop('disabled', false)\r\n }\r\n})\r\n\r\nmodule.exports = ProfileView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Model = require('lists/list/item/entry')\r\nvar View = require('settings/profile/view')\r\nvar UserService = require('login/service')\r\nvar SessionService = require('session/session-service')\r\nvar Config = require('config/config')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar ProfileWidget = function () {\r\n this.model = new Model(SessionService.getProfile())\r\n this.model.set({ 'isEducationalLicense': Config['IS_EDUCATIONAL_LICENSE'] })\r\n\r\n this.userService = new UserService()\r\n this.view = new View({\r\n model: this.model\r\n })\r\n\r\n this.view.on('create', this.save.bind(this))\r\n this.view.on('update', this.update.bind(this))\r\n}\r\n\r\nProfileWidget.prototype = _.clone(Backbone.Events)\r\n\r\nProfileWidget.prototype.show = function () {\r\n return this.view.render().$el\r\n}\r\n\r\nProfileWidget.prototype.save = function (model) {\r\n this.update(null, model)\r\n}\r\n\r\nProfileWidget.prototype.update = function (modelId, model, confirmed) {\r\n // If we aren't setting a new password, don't even send the field\r\n if (!model.newPassword) {\r\n delete model.newPassword\r\n }\r\n\r\n if (!model.currentPassword && model.newPassword) {\r\n return sweetAlert({\r\n title: 'Error',\r\n text: 'Please enter your current password to update your password.',\r\n type: 'error',\r\n confirmButtonColor: '#19aea6'\r\n })\r\n } else if (model.currentPassword && model.newPassword && !confirmed) {\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: 'This will update your password, if you click cancel we\\'ll still update your profile but leave your password as is.',\r\n type: 'warning',\r\n showCancelButton: true,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Update',\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Only update profile'\r\n }).then(function () {\r\n this.update(modelId, model, true)\r\n }.bind(this), function () {\r\n delete model.newPassword\r\n this.update(modelId, model)\r\n }.bind(this)).done()\r\n return\r\n }\r\n\r\n var updatePromise = this.userService.updateProfile(model)\r\n\r\n return updatePromise.then(function (result) {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('updated')\r\n this.view.trigger.apply(this.view, args)\r\n }.bind(this))\r\n .then(this.userService.getProfile.bind(this.userService))\r\n .then(function (profile) {\r\n SessionService.setProfile(profile)\r\n this.model.set(profile)\r\n Backbone.trigger('app:reloadAside')\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your profile has been updated.',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6'\r\n }).then(function () {\r\n this.view.btnEnable()\r\n }.bind(this))\r\n }.bind(this))\r\n .fail(function (err) {\r\n this.view.showError(err)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = ProfileWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <option value=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isSelected : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</option>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"selected\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \" <option value=\\\"\\\">---</option>\\r\\n\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.reconciliations : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"7\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"itemrow col-xs-12 flex\\\">\\r\\n <div class=\\\"col-xs-3\\\">\"\n + alias4(((helper = (helper = helpers.shortEndDate || (depth0 != null ? depth0.shortEndDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortEndDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-6\\\">\"\n + alias4(((helper = (helper = helpers.shortClosedDate || (depth0 != null ? depth0.shortClosedDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"shortClosedDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div class=\\\"col-xs-3 currency\\\">\"\n + alias4((helpers.numbro || (depth0 && depth0.numbro) || alias2).call(alias1,(depth0 != null ? depth0.accountBalance : depth0),{\"name\":\"numbro\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n <a href=\\\"#\\\" class=\\\"fa fa-undo action reopen\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n </div>\\r\\n\";\n},\"9\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"col-xs-12 text-center\\\">\\r\\n <span class=\\\"center\\\">No reconciliations to show</span>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"col-xs-4 row\\\">\\r\\n <div class=\\\"form-group\\\" style=\\\"height: 54px;\\\">\\r\\n <div class=\\\"form-material floating input-group open\\\" style=\\\"width: 100%;\\\">\\r\\n <select class=\\\"form-control my-checkbooks\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.checkbooks : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </select>\\r\\n <label class=\\\"control-label\\\">Checkbook</label>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<div class=\\\"block reconciliation-listing\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <h3>All Reconciliations</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content col-xs-12\\\">\\r\\n <div class=\\\"table table-hover table-borderless table-striped col-xs-12\\\">\\r\\n <div class=\\\"head col-xs-12 flex\\\">\\r\\n <div class=\\\"col-xs-3\\\">Statement Date</div>\\r\\n <div class=\\\"col-xs-6\\\">Reconciled Date</div>\\r\\n <div class=\\\"col-xs-3 currency\\\">Account Balance</div>\\r\\n <div class=\\\"action\\\"></div>\\r\\n </div>\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,((stack1 = (depth0 != null ? depth0.reconciliations : depth0)) != null ? stack1.length : stack1),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.program(9, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar ListTemplate = require('settings/reconciliations/list/list')\r\nvar sweetAlert = require('sweetalert2')\r\n\r\nvar ReconciliationsListView = Backbone.View.extend({\r\n events: {\r\n 'change .my-checkbooks': 'changeCheckbook',\r\n 'click .reopen': 'reopenReconciliation'\r\n },\r\n className: 'reconciliation-list',\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:checkbooks change:reconciliations', this.render, this)\r\n this.on('openReview', this.openReview, this)\r\n },\r\n render: function () {\r\n if (this.model.get('reconciliations')) {\r\n this.reconciliationLookup = _.keyBy(this.model.get('reconciliations').toJSON(), 'id')\r\n }\r\n this.$el.html(ListTemplate(this.createViewModel()))\r\n\r\n return this\r\n },\r\n createViewModel: function () {\r\n if (this.model.get('checkbooks').length) {\r\n return {\r\n checkbooks: this.model.get('checkbooks').toJSON(),\r\n reconciliations: this.model.get('reconciliations').toJSON()\r\n }\r\n } else {\r\n return {}\r\n }\r\n },\r\n\r\n changeCheckbook: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var checkbookId = $currentTarget.val()\r\n Backbone.trigger('app:navigate', 'settings/reconciliations/' + checkbookId)\r\n },\r\n\r\n openReview: function (e) {\r\n sweetAlert({\r\n title: 'Confirmation',\r\n text: '<p>You have reopend the following reconciliation periods:</p><p><b>' + this.model.get('reopenedReconciliation').shortEndDate + ' - Current</b></p>',\r\n type: 'success',\r\n closeOnConfirm: true,\r\n closeOnCancel: false,\r\n showCancelButton: false,\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Close'\r\n }).then(function () {\r\n this.trigger('closedReview')\r\n }.bind(this), function () {\r\n this.trigger('closedReview')\r\n }.bind(this))\r\n e.preventDefault()\r\n },\r\n\r\n reopenReconciliation: function (e) {\r\n console.log(e)\r\n var $currentTarget = $(e.currentTarget)\r\n var reconciliationId = $currentTarget.attr('data-id')\r\n\r\n var reconciliation = this.reconciliationLookup[reconciliationId]\r\n\r\n sweetAlert({\r\n title: 'Are you sure?',\r\n text: '<p>You’re trying to reopen the reconciliation period with a beginning date of:</p><p><b>' + reconciliation.shortEndDate + '</b></p><p>Please be aware, if you proceed, you will undo all subsequent reconciliations too.</p>',\r\n type: 'warning',\r\n closeOnConfirm: true,\r\n closeOnCancel: true,\r\n showCancelButton: true,\r\n cancelButtonColor: '#999999',\r\n cancelButtonText: 'Cancel',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'Yes, reopen it'\r\n }).then(function () {\r\n this.trigger('reopen', reconciliation)\r\n }.bind(this))\r\n e.preventDefault()\r\n }\r\n})\r\n\r\nmodule.exports = ReconciliationsListView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('underscore')\r\nvar q = require('q')\r\nvar ReconciliationListView = require('settings/reconciliations/list/view')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\n\r\nvar ReconciliationListWidget = function (checkbookId) {\r\n this.model = new Backbone.Model({\r\n checkbooks: [],\r\n checkbookId: checkbookId\r\n })\r\n\r\n this.view = new ReconciliationListView({\r\n model: this.model\r\n })\r\n\r\n this.view.on('closedReview', this.fetch, this)\r\n this.view.on('reopen', this.reopen, this)\r\n\r\n this.checkbookService = new CheckbookService()\r\n\r\n this.fetch()\r\n}\r\n\r\nReconciliationListWidget.prototype = _.clone(Backbone.Events)\r\n\r\nReconciliationListWidget.prototype.fetch = function () {\r\n q.all([\r\n this.checkbookService.fetchCheckbookList(),\r\n this.checkbookService.fetchReconciliations(this.model.get('checkbookId'))\r\n ]).then(function (results) {\r\n this.updated.apply(this, results)\r\n }.bind(this), function (error){\r\n console.log(error.message)\r\n }.bind(this))\r\n}\r\n\r\nReconciliationListWidget.prototype.updated = function (checkbooks, checkbookReconciliations) {\r\n var checkbookCollection = new Backbone.Collection()\r\n checkbookCollection.add(_.map(checkbooks, function (checkbook) {\r\n checkbook.set('isSelected', checkbook.id === this.model.get('checkbookId'))\r\n return checkbook\r\n }.bind(this)))\r\n\r\n this.model.set({\r\n checkbooks: checkbookCollection,\r\n reconciliations: checkbookReconciliations\r\n })\r\n}\r\n\r\nReconciliationListWidget.prototype.reopen = function (reconciliation) {\r\n this.checkbookService.reopenReconciliations(reconciliation.checkbookId, reconciliation.id).then(function () {\r\n this.model.set('reopenedReconciliation', reconciliation)\r\n this.view.trigger('openReview')\r\n }.bind(this))\r\n}\r\n\r\n\r\nReconciliationListWidget.prototype.show = function () {\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = ReconciliationListWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\n\r\nvar Reconciliation = Backbone.Model.extend({\r\n defaults: {\r\n id: '00000000-0000-0000-0000-000000000000',\r\n isClosed: false,\r\n entries: [],\r\n startDate: new Date(),\r\n endDate: new Date()\r\n }\r\n},\r\n {\r\n parse: function (json) {\r\n return new Reconciliation({\r\n id: json.id,\r\n isClosed: json.isClosed,\r\n entries: json.entries,\r\n startDate: json.startDate,\r\n endDate: json.endDate\r\n })\r\n }\r\n })\r\n\r\nmodule.exports = Reconciliation\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar ReconciliationListWidget = require('settings/reconciliations/list/widget')\r\nvar CheckbookService = require('checkbook/checkbook-service')\r\nvar EditCompanyWidget = require('company/update/widget')\r\nvar CheckbookTransactions = require('settings/checkbook/transactions/widget')\r\nvar StaticAccounts = require('settings/accounts/widget')\r\nvar Memorizations = require('settings/memorizations/widget')\r\nvar AccountingMethod = require('settings/accounting-method/widget')\r\nvar ProfileSettings = require('settings/profile/widget')\r\nvar ClosingEntries = require('settings/closing-entries/widget')\r\nvar UserSettings = require('settings/users/widget')\r\nvar BusinessSettings = require('settings/business-settings/widget')\r\nvar CheckbooksWidget = require('settings/checkbooks/widget')\r\nvar SubscriptionWidget = require('settings/subscription/widget')\r\nvar EditSubscirptionWidget = require('settings/subscription/update-plan/widget')\r\nvar EditBillingInfoWidget = require('settings/subscription/update-billingInfo/widget')\r\nvar SubscriptionReceiptWidget = require('settings/subscription/receipt/widget')\r\nvar InvoicesSettings = require('settings/invoices/widget')\r\n\r\nvar SettingsRouter = Router.extend({\r\n routes: {\r\n 'settings/reconciliations': 'showReconciliationList',\r\n 'settings/reconciliations/:checkbookId': 'showReconciliationList',\r\n 'settings/company/edit': 'editCompany',\r\n 'settings/checkbooks': 'showCheckbooks',\r\n 'settings/checkbook/transactions': 'showCheckbookTransactions',\r\n 'settings/accounts': 'showStaticAccounts',\r\n 'settings/memorizations': 'showMemorizations',\r\n 'settings/accounting-method': 'showAccountingMethod',\r\n 'settings/profile': 'showProfileSettings',\r\n 'settings/closing-entries': 'showClosingEntries',\r\n 'settings/users': 'showUsers',\r\n 'settings/business-settings': 'showBusinessSettings',\r\n 'settings/subscription': 'showSubscription',\r\n 'settings/subscription/edit-plan': 'showEditSubscription',\r\n 'settings/subscription/edit-plan/:isSelectedAnnual/:selectedPlanId': 'showEditSubscription',\r\n 'settings/subscription/edit-payment-method': 'showEditBillingInfo',\r\n 'settings/subscription/edit-payment-method/:isSelectedAnnual/:selectedPlanId': 'showEditBillingInfo',\r\n 'settings/subscription/receipt/:receiptId': 'showSubscriptionReceipt',\r\n 'settings/invoices': 'showInvoicesSettings'\r\n },\r\n\r\n showReconciliationList: function (checkbookId) {\r\n if (!checkbookId) {\r\n var checkbookService = new CheckbookService()\r\n\r\n checkbookService.fetchCheckbookList().then(function (checkbooks) {\r\n var firstCheckbook = _.first(checkbooks)\r\n\r\n if (firstCheckbook) {\r\n Backbone.trigger('app:navigate', 'settings/reconciliations/' + firstCheckbook.id)\r\n return\r\n } else {\r\n // When there is no checkbook found, but to allow a user to visit the page\r\n Backbone.trigger('app:navigate', 'settings/reconciliations/' + 0) \r\n return\r\n }\r\n }, function (error) {\r\n Backbone.trigger('app:navigate', 'settings/reconciliations/' + 0) \r\n })\r\n return\r\n }\r\n Backbone.trigger('app:showInFrame', new ReconciliationListWidget(checkbookId))\r\n Backbone.trigger('app:updateTitle', 'Reconciliations', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Company', href: '/company'}, {label: 'Checkbook'}, {label: 'Reconciliations'}])\r\n },\r\n\r\n editCompany: function () {\r\n Backbone.trigger('app:showInFrame', new EditCompanyWidget())\r\n Backbone.trigger('app:updateTitle', 'Company', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Company'}, {label: 'Edit Details'}])\r\n },\r\n\r\n showCheckbookTransactions: function () {\r\n Backbone.trigger('app:showInFrame', new CheckbookTransactions())\r\n Backbone.trigger('app:updateTitle', 'Checkbook Transactions', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Checkbook'}, {label: 'Transactions'}])\r\n },\r\n\r\n showStaticAccounts: function () {\r\n Backbone.trigger('app:showInFrame', new StaticAccounts())\r\n Backbone.trigger('app:updateTitle', 'Account Assignments', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Account Assignments'}])\r\n },\r\n\r\n showMemorizations: function () {\r\n Backbone.trigger('app:showInFrame', new Memorizations())\r\n Backbone.trigger('app:updateTitle', 'Memorizations', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Memorizations'}])\r\n },\r\n\r\n showAccountingMethod: function () {\r\n Backbone.trigger('app:showInFrame', new AccountingMethod())\r\n Backbone.trigger('app:updateTitle', 'Accounting Method', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Accounting Method'}])\r\n },\r\n\r\n showProfileSettings: function () {\r\n Backbone.trigger('app:showInFrame', new ProfileSettings())\r\n Backbone.trigger('app:updateTitle', 'Profile', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Edit Profile'}])\r\n },\r\n\r\n showClosingEntries: function () {\r\n Backbone.trigger('app:showInFrame', new ClosingEntries())\r\n Backbone.trigger('app:updateTitle', 'Closing Entries', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Closing Entries'}])\r\n },\r\n\r\n showUsers: function () {\r\n Backbone.trigger('app:showInFrame', new UserSettings())\r\n Backbone.trigger('app:updateTitle', 'Manage Users', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Manage Users'}])\r\n },\r\n\r\n showBusinessSettings: function () {\r\n Backbone.trigger('app:showInFrame', new BusinessSettings())\r\n Backbone.trigger('app:updateTitle', 'Business Settings', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Business Settings'}])\r\n },\r\n\r\n showCheckbooks: function () {\r\n Backbone.trigger('app:showInFrame', new CheckbooksWidget())\r\n Backbone.trigger('app:updateTitle', 'Checkbooks', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Lists'}, {label: 'Checkbooks'}])\r\n },\r\n\r\n showSubscription: function () {\r\n Backbone.trigger('app:showInFrame', new SubscriptionWidget())\r\n Backbone.trigger('app:updateTitle', 'My Subscription', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Subscription'}])\r\n },\r\n\r\n showEditSubscription: function (isSelectedAnnual, selectedPlanId) {\r\n Backbone.trigger('app:showInFrame', new EditSubscirptionWidget(isSelectedAnnual, selectedPlanId))\r\n Backbone.trigger('app:updateTitle', 'My Subscription', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Subscription'}])\r\n },\r\n \r\n showEditBillingInfo: function (isSelectedAnnual, selectedPlanId) {\r\n Backbone.trigger('app:showInFrame', new EditBillingInfoWidget(isSelectedAnnual, selectedPlanId))\r\n Backbone.trigger('app:updateTitle', 'My Subscription', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Subscription'}])\r\n },\r\n \r\n showSubscriptionReceipt: function (receiptId) {\r\n Backbone.trigger('app:showInFrame', new SubscriptionReceiptWidget(receiptId))\r\n Backbone.trigger('app:updateTitle', 'My Subscription', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Subscription'}])\r\n },\r\n \r\n showInvoicesSettings: function (receiptId) {\r\n Backbone.trigger('app:showInFrame', new InvoicesSettings())\r\n Backbone.trigger('app:updateTitle', 'Invoice Settings', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Settings'}, {label: 'Invoices'}])\r\n }\r\n})\r\n\r\nmodule.exports = SettingsRouter\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"<i class=\\\"fa fa-close pull-right collapse updateBillingInfoClose\\\" style=\\\"padding-right: 10px; padding-top: 5px;\\\"></i>\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.planBoxTitle || (depth0 != null ? depth0.planBoxTitle : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"planBoxTitle\",\"hash\":{},\"data\":data}) : helper)));\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \"You selected\";\n},\"7\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return container.escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \" Plan, \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isPriceZero : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(8, data, 0),\"inverse\":container.program(11, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"8\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"Billed \"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAnnual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(9, data, 0),\"inverse\":container.program(11, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"9\":function(container,depth0,helpers,partials,data) {\n return \"Annually\";\n},\"11\":function(container,depth0,helpers,partials,data) {\n return \"Monthly\";\n},\"13\":function(container,depth0,helpers,partials,data) {\n return \"Free Trial\";\n},\"15\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.price || (depth0 != null ? depth0.price : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"price\",\"hash\":{},\"data\":data}) : helper)));\n},\"17\":function(container,depth0,helpers,partials,data) {\n return \"0\";\n},\"19\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isPriceZero : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(20, data, 0),\"inverse\":container.program(23, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"20\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAnnual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(21, data, 0),\"inverse\":container.program(23, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"21\":function(container,depth0,helpers,partials,data) {\n return \"yr\";\n},\"23\":function(container,depth0,helpers,partials,data) {\n return \"mo\";\n},\"25\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isPriceZero : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(26, data, 0),\"inverse\":container.program(29, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"26\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAnnual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(27, data, 0),\"inverse\":container.program(29, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"27\":function(container,depth0,helpers,partials,data) {\n return \"year\";\n},\"29\":function(container,depth0,helpers,partials,data) {\n return \"month\";\n},\"31\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isPriceZero : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(32, data, 0),\"inverse\":container.program(34, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"32\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" , with your next payment due on \\r\\n <span>\"\n + container.escapeExpression(((helper = (helper = helpers.nextBillingDate || (depth0 != null ? depth0.nextBillingDate : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"nextBillingDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>. \\r\\n\";\n},\"34\":function(container,depth0,helpers,partials,data) {\n return \" . In the even you exceed plan limits, you will be asked to update your billing information.\\r\\n\";\n},\"36\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.postButtonText || (depth0 != null ? depth0.postButtonText : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"postButtonText\",\"hash\":{},\"data\":data}) : helper)));\n},\"38\":function(container,depth0,helpers,partials,data) {\n return \"Confirm\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isUpdateView : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n<div class=\\\"billingInfoContainer\\\">\\r\\n <div class=\\\"block-header no-padding\\\">\\r\\n <h3 class=\\\"screenTitle\\\">\"\n + alias4(((helper = (helper = helpers.screenTitle || (depth0 != null ? depth0.screenTitle : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"screenTitle\",\"hash\":{},\"data\":data}) : helper)))\n + \"</h3>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"block-content no-padding\\\">\\r\\n <div class=\\\"smallText\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.planBoxTitle : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(5, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \":</div>\\r\\n\\r\\n <div class=\\\"planList\\\">\\r\\n <!--Plan Selected-->\\r\\n <div class=\\\"form-group planPreview\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"form-material floating flex\\\">\\r\\n <div class=\\\"col-xs-9 planName\\\">\\r\\n <div class=\\\"planNameText selectedPlanNameText\\\">\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isTrial : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.program(13, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"changePlanText\\\">(Change Plan)</div>\\r\\n </div>\\r\\n <div class=\\\"col-xs-3 planAmount\\\">\\r\\n <div><span class=\\\"currency\\\">$\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isTrial : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(15, data, 0),\"inverse\":container.program(17, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</span>/\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isTrial : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(19, data, 0),\"inverse\":container.program(23, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"smallText\\\">Enter card information:</div>\\r\\n <div class=\\\"paymentTypeImg\\\">\\r\\n <div><img src=\\\"/img/credit-card.png\\\" class=\\\"visaImg\\\" alt=\\\"/img/credit-card.png\\\"/></div>\\r\\n </div>\\r\\n\\r\\n <form class=\\\"form-material\\\" role=\\\"form\\\">\\r\\n <div class=\\\"paymentInfoContainer\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <div class=\\\"form-group col-lg-5 col-md-5 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"creditNumber\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"creditNumber\\\" maxlength=\\\"20\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"creditNumber\\\">Card Number</label>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"expDate col-lg-3 col-md-3 no-padding\\\">\\r\\n <div class=\\\"form-group col-lg-5 col-md-5 exp-month open\\\" style=\\\"padding-right: 0px;\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <select class=\\\"form-control expMonth selectpicker\\\" id=\\\"expMonth\\\" name=\\\"expMonth\\\" size=\\\"1\\\"></select>\\r\\n <label class=\\\"expMonthLabel\\\" for=\\\"expMonth\\\" style=\\\"font-size: 13px;\\\">Exp. Date</label>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"form-group col-lg-7 col-md-7 exp-year\\\" style=\\\"padding-left: 5px;\\\">\\r\\n <div class=\\\"form-material floating open\\\">\\r\\n <select class=\\\"form-control selectpicker\\\" id=\\\"expYear\\\" name=\\\"expYear\\\" size=\\\"1\\\"></select> \\r\\n </div>\\r\\n </div> \\r\\n </div>\\r\\n\\r\\n <div class=\\\"form-group col-lg-2 col-md-2 col-xs-12 security-code\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"securityCode\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"securityCode\\\" maxlength=\\\"4\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"securityCode\\\">Security Code</label>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"form-group col-lg-2 col-md-2 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"postalCode\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"postalCode\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"postalCode\\\">Zip Code</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"col-lg-12 col-md-12 no-padding\\\">\\r\\n <div class=\\\"form-group col-lg-5 col-md-5 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"nameOnCard\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"nameOnCard\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"nameOnCard\\\">Name On Card</label>\\r\\n </div>\\r\\n </div>\\r\\n <div class=\\\"form-group col-lg-7 col-md-7 col-xs-12\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"streetAddress\\\" class=\\\"form-control\\\" type=\\\"text\\\" name=\\\"streetAddress\\\" value />\\r\\n <label class=\\\"control-label\\\" for=\\\"streetAddress\\\">Street Address</label>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"youAgreeTextContainer\\\">\\r\\n <div class=\\\"form-group youAgreeText\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <div class=\\\"smallText no-padding\\\">By clicking submit, you agree that:</div>\\r\\n <div class=\\\"youAgreeTextContent\\\">To ensure uninterrupted service, your subscription will be set to continuous auto-renewal payments of\\r\\n <span>$\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isTrial : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(15, data, 0),\"inverse\":container.program(17, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</span> per \\r\\n <span>\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isTrial : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(25, data, 0),\"inverse\":container.program(29, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</span>\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isTrial : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(31, data, 0),\"inverse\":container.program(34, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" You can cancel your subscription from your Subscription page, or by contacting Crunched Support.\\r\\n You also agree to our \\r\\n <a href=\\\"http://crunched.io/terms-privacy\\\" target=\\\"_blank\\\"><span class=\\\"greenText\\\">Terms of Service</span></a> and\\r\\n <a href=\\\"http://crunched.io/terms-privacy\\\" target=\\\"_blank\\\"><span class=\\\"greenText\\\">Privacy Policy</span></a>. \\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"form-group col-xs-12 action\\\">\\r\\n <button class=\\\"btn btn-primary save\\\" id=\\\"paySubmitButton\\\">\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.postButtonText : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(36, data, 0),\"inverse\":container.program(38, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</button> \\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar BillingInfoTemplate = require('settings/subscription/billing-info/template')\r\n\r\nvar BillingInfoView = Backbone.View.extend({\r\n events: {\r\n 'click .changePlanText': 'back',\r\n 'submit form': 'payNow',\r\n 'change input, select': 'validate',\r\n 'keyup input, select': 'validate',\r\n 'focusout input, select': 'validate'\r\n },\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change', this.render.bind(this))\r\n },\r\n\r\n render: function () {\r\n this.$el.html(BillingInfoTemplate(this.createViewModel()))\r\n this.populateMonthDropdown()\r\n this.populateYearDropdown()\r\n this.$('.selectpicker').selectpicker({\r\n size: 5,\r\n dropupAuto: false,\r\n noneSelectedText: ''\r\n })\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('planInfo')) {\r\n var plan = this.model.get('planInfo')\r\n var isAnnual = plan.isAnnual\r\n\r\n var todayDate = new Date()\r\n var todayDateUTC = new Date(todayDate.getTime())\r\n var billingOffset = !!isAnnual && isAnnual ? 12 : 1\r\n var nextBillingDate = moment(todayDateUTC).add(billingOffset, 'M')._d\r\n\r\n return {\r\n screenTitle: 'Enter Billing Information',\r\n postButtonText: 'Submit',\r\n isAnnual: plan.isAnnual,\r\n id: plan.planLevel.id,\r\n payPeriod: plan.selectedPayPeriod,\r\n name: plan.planLevel.name,\r\n price: isAnnual ? plan.planLevel.annualPlanPrice : plan.planLevel.price,\r\n nextBillingDate: moment(nextBillingDate).format('MM/DD/YYYY')\r\n }\r\n }\r\n },\r\n\r\n validate: function (event) {\r\n event.preventDefault()\r\n this.$('.has-error').removeClass('has-error')\r\n },\r\n\r\n payNow: function (event) {\r\n event.preventDefault()\r\n if (this.model.get('planInfo')) {\r\n var creditCard = this.$('input#creditNumber').val()\r\n var expirationMonth = this.$('#expMonth').val()\r\n var expirationYear = this.$('#expYear').val()\r\n var cvv = this.$('input#securityCode').val()\r\n var postalCode = this.$('input#postalCode').val()\r\n var nameOnCard = this.$('input#nameOnCard').val()\r\n var streetAddress = this.$('input#streetAddress').val()\r\n\r\n creditCard = creditCard.replace(/[^\\d]+/g, '')\r\n cvv = cvv.replace(/[^\\d]+/g, '')\r\n this.$('.has-error').removeClass('has-error')\r\n\r\n if (!creditCard || !cvv || !nameOnCard || !expirationMonth || !expirationYear || !postalCode || !streetAddress || (!!expirationMonth && !!expirationYear && !this.isExpDateValid())) {\r\n if (!creditCard) {\r\n this.$('input#creditNumber').parent().parent().addClass('has-error')\r\n }\r\n if (!cvv) {\r\n this.$('input#securityCode').parent().parent().addClass('has-error')\r\n }\r\n if (!nameOnCard) {\r\n this.$('input#nameOnCard').parent().parent().addClass('has-error')\r\n }\r\n if (!expirationMonth) {\r\n this.$('#expMonth').parent().parent().addClass('has-error')\r\n }\r\n if (!expirationYear) {\r\n this.$('#expYear').parent().parent().addClass('has-error')\r\n }\r\n if (!postalCode) {\r\n this.$('input#postalCode').parent().parent().addClass('has-error')\r\n }\r\n if (!streetAddress) {\r\n this.$('input#streetAddress').parent().parent().addClass('has-error')\r\n }\r\n if (!!expirationMonth && !!expirationYear && !this.isExpDateValid()) {\r\n this.$('#expMonth').parent().parent().addClass('has-error')\r\n this.$('#expYear').parent().parent().addClass('has-error')\r\n }\r\n } else {\r\n this.$('#paySubmitButton').prop('disabled', true)\r\n var paymentInformation = {\r\n name: nameOnCard,\r\n streetAddress: streetAddress,\r\n postalCode: postalCode,\r\n creditCard: {\r\n cardNumber: creditCard,\r\n cvv: cvv,\r\n expirationMonth: expirationMonth,\r\n expirationYear: expirationYear\r\n }\r\n }\r\n\r\n this.trigger('payNow', paymentInformation, this)\r\n }\r\n }\r\n },\r\n\r\n isExpDateValid: function () {\r\n var selectedMonth = this.$('#expMonth').val()\r\n var selectedYear = this.$('#expYear').val()\r\n\r\n var todayDate = new Date()\r\n todayDate = moment(todayDate)\r\n var currentYear = todayDate.year()\r\n var currentMonth = todayDate.month() + 1\r\n\r\n if (selectedYear === currentYear.toString()) {\r\n return selectedMonth >= currentMonth\r\n } else {\r\n return true\r\n }\r\n },\r\n\r\n back: function (e) {\r\n e.preventDefault()\r\n this.trigger('back')\r\n },\r\n\r\n populateMonthDropdown: function () {\r\n var todayDate = new Date()\r\n todayDate = moment(todayDate)\r\n // moment.month() is zero based, so it will return 0-11.\r\n var currentMonth = todayDate.month() + 1\r\n var months = _.range(1, 13)\r\n\r\n _.each(months, function (value, key) {\r\n var monthDisplay = value < 10 ? '0' + value : value\r\n $('#expMonth').append($('<option value=\"' + value + '\">' + monthDisplay + '</option>'))\r\n if (currentMonth === value) {\r\n $('#expMonth').val(value)\r\n }\r\n }, this)\r\n },\r\n\r\n populateYearDropdown: function () {\r\n var baseYear = 2017\r\n var years = _.range(baseYear, (baseYear + 21))\r\n _.each(years, function (value, key) {\r\n $('#expYear').append($('<option value=\"' + value + '\">' + value + '</option>'))\r\n }, this)\r\n }\r\n})\r\n\r\nmodule.exports = BillingInfoView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Model = require('lists/list/item/entry')\r\nvar BillingInfoView = require('settings/subscription/billing-info/view')\r\nvar UserService = require('login/service')\r\n\r\nvar BillingInfoWidget = function () {\r\n this.model = new Model()\r\n this.userService = new UserService()\r\n this.view = new BillingInfoView({\r\n model: this.model\r\n })\r\n}\r\n\r\nBillingInfoWidget.prototype = _.clone(Backbone.Events)\r\n\r\nBillingInfoWidget.prototype.show = function () {\r\n return this.view.render().$el\r\n}\r\n\r\nmodule.exports = BillingInfoWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"form-group planListItem\\\" id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\\r\\n <div class=\\\"form-material floating flex\\\">\\r\\n <div class=\\\"col-xs-3 planName\\\">\\r\\n <div class=\\\"planNameText\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"col-xs-6 planDescription\\\">\\r\\n <p><b>Includes:</b> \"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n <div class=\\\"col-xs-3 planAmount\\\">\\r\\n <div><span class=\\\"currency\\\">$\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depths[1] != null ? depths[1].isAnnualChecked : depths[1]),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0, blockParams, depths),\"inverse\":container.program(4, data, 0, blockParams, depths),\"data\":data})) != null ? stack1 : \"\")\n + \"</span>\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depths[1] != null ? depths[1].isAnnualChecked : depths[1]),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(6, data, 0, blockParams, depths),\"inverse\":container.program(8, data, 0, blockParams, depths),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.annualPlanPrice || (depth0 != null ? depth0.annualPlanPrice : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"annualPlanPrice\",\"hash\":{},\"data\":data}) : helper)));\n},\"4\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.price || (depth0 != null ? depth0.price : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"price\",\"hash\":{},\"data\":data}) : helper)));\n},\"6\":function(container,depth0,helpers,partials,data) {\n return \"/yr\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n return \"/mo\";\n},\"10\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.postButtonText || (depth0 != null ? depth0.postButtonText : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"postButtonText\",\"hash\":{},\"data\":data}) : helper)));\n},\"12\":function(container,depth0,helpers,partials,data) {\n return \"Confirm\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"planList\\\">\\r\\n <!--Plan List-->\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.planLevels : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n<div class=\\\"form-group col-xs-12 action\\\">\\r\\n <button class=\\\"btn btn-primary save\\\" id=\\\"continueToBilling\\\" disabled>\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.postButtonText : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(10, data, 0, blockParams, depths),\"inverse\":container.program(12, data, 0, blockParams, depths),\"data\":data})) != null ? stack1 : \"\")\n + \"</button> \\r\\n</div>\\r\\n\";\n},\"useData\":true,\"useDepths\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar ChoosePlanListTemplate = require('settings/subscription/plan-selection/list/template')\r\n\r\nvar ChoosePlanListView = Backbone.View.extend({\r\n className: 'block-content no-padding',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:planLevels change:isAnnualChecked', this.render) \r\n },\r\n \r\n render: function () {\r\n this.$el.html(ChoosePlanListTemplate(this.createViewModel()))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (!!this.model.get('planLevels')) {\r\n this.populateAnnualPrice()\r\n var planLevels = this.model.get('planLevels')\r\n return {\r\n planLevels: planLevels,\r\n isAnnualChecked: this.isAnnualChecked,\r\n screenTitle: 'Choose Your Plan',\r\n postButtonText: 'Next'\r\n }\r\n } else {\r\n return {\r\n screenTitle: 'Choose Your Plan',\r\n postButtonText: 'Next'\r\n } \r\n }\r\n },\r\n\r\n populateAnnualPrice: function () {\r\n var selectedPayPeriod = this.selectedPayPeriod\r\n \r\n if (selectedPayPeriod === 'payAnnually') {\r\n _.map(this.model.get('planLevels'), function (plan){\r\n if (plan.price !== 0) {\r\n var annualPlanPrice = (plan.price - plan.annualDiscount) * 12\r\n plan.annualPlanPrice = annualPlanPrice\r\n } else {\r\n plan.annualPlanPrice = 0\r\n }\r\n }.bind(this))\r\n }\r\n },\r\n \r\n refresh: function (selectedPayPeriod) {\r\n this.selectedPayPeriod = selectedPayPeriod\r\n this.isAnnualChecked = (selectedPayPeriod === 'payAnnually') ? true : false\r\n this.model.set('isAnnualChecked', this.isAnnualChecked)\r\n }\r\n\r\n})\r\n\r\nmodule.exports = ChoosePlanListView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \"<i class=\\\"fa fa-close pull-right collapse updateBillingInfoClose\\\" style=\\\"padding-right: 10px; padding-top: 5px;\\\"></i>\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \"display: none;\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \" <label class=\\\"css-input css-radio css-radio-primary\\\"> \\r\\n <input type=\\\"radio\\\" id=\\\"payYrPeriod\\\" name=\\\"payPeriod\\\" value=\\\"payAnnually\\\">Pay annually\\r\\n <span></span>\\r\\n </label>\\r\\n <div class=\\\"discountTextContainer\\\">\\r\\n <div class=\\\"discountText\\\">Save $60</div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isUpdateView : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n<div class=\\\"planSelection\\\">\\r\\n <div class=\\\"block-header no-padding\\\">\\r\\n <h3 class=\\\"screenTitle\\\">\"\n + container.escapeExpression(((helper = (helper = helpers.screenTitle || (depth0 != null ? depth0.screenTitle : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"screenTitle\",\"hash\":{},\"data\":data}) : helper)))\n + \"</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content no-padding planLevels\\\">\\r\\n <div class=\\\"flex payPeriodContainer\\\">\\r\\n <label class=\\\"css-input css-radio css-radio-primary\\\" style=\\\"\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.hasPartner : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\\"> \\r\\n <input type=\\\"radio\\\" id=\\\"payMthPeriod\\\" name=\\\"payPeriod\\\" value=\\\"payMonthly\\\" checked>Pay monthly\\r\\n <span></span>\\r\\n </label>\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasPartner : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n</div> \";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar ChoosePlanTemplate = require('settings/subscription/plan-selection/template')\r\nvar ChoosePlanListView = require('settings/subscription/plan-selection/list/view')\r\n\r\nvar ChoosePlanView = Backbone.View.extend({\r\n\r\n events: {\r\n 'click .save': 'continue',\r\n 'click .planListItem': 'selectPlan',\r\n 'click #payMthPeriod': 'refreshPrice',\r\n 'click #payYrPeriod': 'refreshPrice'\r\n },\r\n\r\n initialize: function () {\r\n this.choosePlanListView = new ChoosePlanListView({model: this.model})\r\n this.listenTo(this.model, 'change:planLevels', this.render)\r\n },\r\n\r\n render: function () {\r\n this.$el.html(ChoosePlanTemplate(this.createViewModel()))\r\n this.$('.planSelection').append(this.choosePlanListView.render().$el)\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n screenTitle: 'Choose Your Plan',\r\n hasPartner: this.model.get('hasPartner')\r\n }\r\n },\r\n\r\n refreshPrice: function () {\r\n var selectedPayPeriod = this.$('input[name=payPeriod]:checked').val()\r\n this.choosePlanListView.refresh(selectedPayPeriod)\r\n },\r\n\r\n continue: function (event) {\r\n event.preventDefault()\r\n if (!this.validate()) {\r\n console.log('No plan is selected.')\r\n return\r\n }\r\n\r\n var id = this.$('.planList').find('.selected-plan').attr('id')\r\n var selectedPayPeriod = this.$('input[name=payPeriod]:checked').val()\r\n\r\n var selectedPlanLevel = _.find(this.model.get('planLevels'), function (plan) {\r\n return plan.id === id\r\n })\r\n\r\n var model = {\r\n isAnnual: !!((selectedPayPeriod === 'payAnnually' && selectedPlanLevel.price !== 0)),\r\n selectedPayPeriod: selectedPayPeriod,\r\n planLevel: selectedPlanLevel\r\n }\r\n this.trigger('continueToBilling', model)\r\n },\r\n\r\n selectPlan: function (e) {\r\n e.preventDefault()\r\n var $currentTarget = $(e.currentTarget)\r\n this.$('.selected-plan').removeClass('selected-plan')\r\n $currentTarget.addClass('selected-plan')\r\n this.validate()\r\n },\r\n\r\n validate: function () {\r\n this.hasSelectedPlan = this.$('.planList').find('.planListItem').hasClass('selected-plan')\r\n var hasSelectedPayPeriod = this.$('input[name=payPeriod]:checked').val()\r\n\r\n if (!!this.hasSelectedPlan && this.hasSelectedPlan) {\r\n this.$('#continueToBilling').prop('disabled', false)\r\n } else {\r\n this.$('#continueToBilling').prop('disabled', true)\r\n }\r\n\r\n return !!this.hasSelectedPlan && !!hasSelectedPayPeriod\r\n }\r\n\r\n})\r\n\r\nmodule.exports = ChoosePlanView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar ChoosePlanView = require('settings/subscription/plan-selection/view')\r\nvar Service = require('settings/subscription/service')\r\n\r\nvar ChoosePlanWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.view = new ChoosePlanView({\r\n model: this.model\r\n })\r\n this.service = new Service()\r\n this.view.on('continueToBilling', this.trigger.bind(this, 'create'), this)\r\n}\r\n\r\nChoosePlanWidget.prototype = _.clone(Backbone.Events)\r\n\r\nChoosePlanWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nChoosePlanWidget.prototype.getPlanLevels = function () {\r\n this.service.fetchPlanLevels().then(function (response) {\r\n this.model.set('planLevels', response)\r\n }.bind(this), function () {\r\n console.log('Fail to fetch plan lists.')\r\n })\r\n}\r\n\r\nmodule.exports = ChoosePlanWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.addressLine1 || (depth0 != null ? depth0.addressLine1 : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"addressLine1\",\"hash\":{},\"data\":data}) : helper)));\n},\"3\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.addressLine2 || (depth0 != null ? depth0.addressLine2 : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"addressLine2\",\"hash\":{},\"data\":data}) : helper)));\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.city || (depth0 != null ? depth0.city : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"city\",\"hash\":{},\"data\":data}) : helper)))\n + \", \";\n},\"7\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" \"\n + container.escapeExpression(((helper = (helper = helpers.state || (depth0 != null ? depth0.state : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"state\",\"hash\":{},\"data\":data}) : helper)))\n + \" \";\n},\"9\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" \"\n + container.escapeExpression(((helper = (helper = helpers.postalCode || (depth0 != null ? depth0.postalCode : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"postalCode\",\"hash\":{},\"data\":data}) : helper)))\n + \" \";\n},\"11\":function(container,depth0,helpers,partials,data) {\n return \"style=\\\"visibility: hidden;\\\"\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"action\\\">\\r\\n <i class=\\\"fa fa-print\\\"><span class=\\\"printLabel\\\">Print</span></i>\\r\\n</div>\\r\\n<div class=\\\"subscription block subscriptionReceiptContainer\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse receiptClose\\\"></i>\\r\\n <div class=\\\"subsriptionReceipt\\\">\\r\\n <div class=\\\"subsriptionReceiptContent\\\"> \\r\\n <div class=\\\"block-header no-padding\\\">\\r\\n <h3 class=\\\"receiptHeader\\\">Receipt (\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \")</h3>\\r\\n <div class=\\\"receiptDate\\\"><span>\"\n + alias4(((helper = (helper = helpers.paymentDate || (depth0 != null ? depth0.paymentDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"paymentDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span></div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"receiptSubHeader flex\\\">\\r\\n <div class=\\\"receiptBillToInfo no-padding\\\">\\r\\n <h4>Issued To: </h4>\\r\\n <div>\"\n + alias4(((helper = (helper = helpers.payeeName || (depth0 != null ? depth0.payeeName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"payeeName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div>\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.addressLine1 : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div>\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.addressLine2 : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div>\\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.city : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.state : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.postalCode : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(9, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"receiptIssuedToInfo no-padding\\\" style=\\\"display: none;\\\">\\r\\n <h4></h4>\\r\\n <div></div>\\r\\n <div>\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.addressLine1 : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div>\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.addressLine2 : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div>\\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.city : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.state : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.postalCode : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(9, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n </div>\\r\\n </div> \\r\\n </div>\\r\\n\\r\\n <div class=\\\"block-content no-padding\\\">\\r\\n <div class=\\\"statementContainer\\\">\\r\\n <h4>Billing statement:</h4>\\r\\n <div class=\\\"statementContent flex\\\">\\r\\n <div class=\\\"billingDescription\\\">\\r\\n <span>\"\n + alias4(((helper = (helper = helpers.subscriptionName || (depth0 != null ? depth0.subscriptionName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"subscriptionName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>\\r\\n <span></span>\\r\\n </div>\\r\\n <div class=\\\"billingAmount\\\"><span>$\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.totalPrice : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</span></div> \\r\\n </div>\\r\\n\\r\\n <div class=\\\"totalAmountContainer flex\\\">\\r\\n <div class=\\\"billingDescription\\\"> </div>\\r\\n <div class=\\\"totalAmountContent flex\\\">\\r\\n <div class=\\\"totalLabel\\\">Total</div>\\r\\n <div class=\\\"totalAmount\\\">$\"\n + alias4((helpers[\"numbro-report-showzero\"] || (depth0 && depth0[\"numbro-report-showzero\"]) || alias2).call(alias1,(depth0 != null ? depth0.totalPrice : depth0),{\"name\":\"numbro-report-showzero\",\"hash\":{},\"data\":data}))\n + \"</div>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"paymentMethodContainer flex\\\">\\r\\n <div class=\\\"billingDescription\\\"> </div>\\r\\n <div class=\\\"paymentMethodContent flex\\\">\\r\\n <div class=\\\"paymentMethodLabel\\\">Payment Method</div>\\r\\n <div class=\\\"paymentMethod\\\">\\r\\n <div>\"\n + alias4(((helper = (helper = helpers.paymentMethod || (depth0 != null ? depth0.paymentMethod : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"paymentMethod\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div>\"\n + alias4(((helper = (helper = helpers.cardLastFour || (depth0 != null ? depth0.cardLastFour : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"cardLastFour\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n <div>\"\n + alias4(((helper = (helper = helpers.cardExpiration || (depth0 != null ? depth0.cardExpiration : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"cardExpiration\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div> \\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"receiptFooter\\\" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isAnnual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(11, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \">\\r\\n <div>Save <b>$60</b> a year by upgrading to an annual plan</div>\\r\\n <div class=\\\"upgradeText\\\"><a href=\\\"/settings/subscription/edit-plan\\\">Upgrade Now</a></div>\\r\\n </div>\\r\\n </div> \\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar moment = require('moment')\r\nvar SubscriptionReceiptTemplate = require('settings/subscription/receipt/template')\r\nvar Service = require('settings/subscription/service')\r\n\r\nvar SubscriptionReceiptView = Backbone.View.extend({\r\n className: 'receiptContainer',\r\n \r\n events: {\r\n 'click .collapse': 'close',\r\n 'click .fa-print': 'print'\r\n },\r\n \r\n initialize: function () {\r\n this.service = new Service()\r\n this.listenTo(this.model, 'change:receiptInfo', this.render.bind(this))\r\n },\r\n \r\n render: function () {\r\n this.$el.html(SubscriptionReceiptTemplate(this.createViewModel()))\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (!!this.model.get('receiptInfo')) {\r\n var receiptInfo = this.model.get('receiptInfo')\r\n \r\n var currentSubscriptionInfo = this.service.getActiveSubscriptionInfo()\r\n this.isAnnual = currentSubscriptionInfo.isAnnual\r\n\r\n receiptInfo.paymentDate = moment(new Date(receiptInfo.paymentDate)).format('MMMM DD, YYYY')\r\n \r\n return {\r\n cardExpiration: receiptInfo.cardExpiration,\r\n cardLastFour: receiptInfo.cardLastFour,\r\n id: receiptInfo.id,\r\n payeeName: receiptInfo.payeeName,\r\n paymentDate: receiptInfo.paymentDate,\r\n paymentMethod: receiptInfo.paymentMethod,\r\n subscriptionName: receiptInfo.subscriptionName,\r\n totalPrice: receiptInfo.total,\r\n isAnnual: this.isAnnual\r\n }\r\n }\r\n },\r\n \r\n close: function (e) {\r\n Backbone.trigger('app:navigate', 'settings/subscription')\r\n },\r\n \r\n print: function (e) {\r\n window.print()\r\n }\r\n})\r\n\r\nmodule.exports = SubscriptionReceiptView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar q = require('q')\r\nvar SubscriptionReceiptView = require('settings/subscription/receipt/view')\r\nvar Service = require('settings/subscription/service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar SubscriptionReceiptWidget = function (receiptId) {\r\n this.model = new Backbone.Model({\r\n receiptId: receiptId\r\n })\r\n this.view = new SubscriptionReceiptView({\r\n model: this.model\r\n })\r\n\r\n this.service = new Service()\r\n this.companyService = new CompanyService()\r\n\r\n this.fetch(receiptId)\r\n}\r\n\r\nSubscriptionReceiptWidget.prototype = _.clone(Backbone.Events)\r\n\r\nSubscriptionReceiptWidget.prototype.fetch = function (receiptId) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.service.fetchPaymentHistoryForReceiptId(receiptId, companyId).then(function (result) {\r\n this.model.set('receiptInfo', result)\r\n }.bind(this))\r\n}\r\n\r\nSubscriptionReceiptWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nmodule.exports = SubscriptionReceiptWidget\r\n","'use strict'\r\n\r\nvar RestClient = require('rest/client')\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar SubscriptionService = function () {\r\n this.client = new RestClient()\r\n this.companyService = new CompanyService()\r\n}\r\n\r\nSubscriptionService.prototype.fetchPlanLevels = function () {\r\n return this.client.get(Config['CRUNCHED_API_HOST'] + '/plan-levels').then(function (response) {\r\n return response\r\n })\r\n}\r\n\r\nSubscriptionService.prototype.getActiveSubscriptionInfo = function () {\r\n return JSON.parse(localStorage.getItem('crunchedActiveCompanySubscriptionInfo'))\r\n}\r\n\r\nSubscriptionService.prototype.createSubscription = function (subscriptionInfo, companyId) {\r\n if (!companyId || (typeof companyId !== 'string')) {\r\n companyId = this.companyService.getActiveCompanyId()\r\n }\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'subscriptions'\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n var apiPath = actionPath\r\n\r\n this.companyId = companyId\r\n return this.client.put(apiPath, subscriptionInfo).then(function (response) {\r\n this.companyService.updateActiveCompany(this.companyId).done(function () {\r\n return response\r\n })\r\n }.bind(this))\r\n}\r\n\r\nSubscriptionService.prototype.updateSubscription = function (subscriptionInfo, companyId) {\r\n if (!companyId || (typeof companyId !== 'string')) {\r\n companyId = this.companyService.getActiveCompanyId()\r\n }\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'subscriptions'\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n var apiPath = actionPath\r\n\r\n this.companyId = companyId\r\n return this.client.put(apiPath, subscriptionInfo).then(function (response) {\r\n this.response = response\r\n this.companyService.updateActiveCompany(this.companyId).done(function () {\r\n return this.response\r\n }.bind(this))\r\n }.bind(this))\r\n}\r\n\r\nSubscriptionService.prototype.fetchCompanySubscription = function (companyId) {\r\n if (!companyId || (typeof companyId !== 'string')) {\r\n companyId = this.companyService.getActiveCompanyId()\r\n }\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'subscriptions'\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n var apiPath = actionPath\r\n\r\n this.companyId = companyId\r\n return this.client.get(apiPath).then(function (response) {\r\n var companyInfo = this.companyService.getActiveCompanyInfo()\r\n response.activeSubscription = companyInfo.activeSubscription\r\n response.subscriptionProcessing = companyInfo.subscriptionProcessing\r\n localStorage.setItem('crunchedActiveCompanySubscriptionInfo', JSON.stringify(response))\r\n return response\r\n }.bind(this))\r\n}\r\n\r\nSubscriptionService.prototype.updateBillingInfo = function (paymentInfo, companyId) {\r\n if (!companyId || (typeof companyId !== 'string')) {\r\n companyId = this.companyService.getActiveCompanyId()\r\n }\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'subscriptions',\r\n 'card-account'\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n var apiPath = actionPath\r\n\r\n this.companyId = companyId\r\n return this.client.put(apiPath, paymentInfo).then(function (response) {\r\n return response\r\n })\r\n}\r\n\r\nSubscriptionService.prototype.fetchBillingInfo = function (companyId) {\r\n if (!companyId || (typeof companyId !== 'string')) {\r\n companyId = this.companyService.getActiveCompanyId()\r\n }\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'subscriptions',\r\n 'card-account'\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n var apiPath = actionPath\r\n\r\n this.companyId = companyId\r\n return this.client.get(apiPath).then(function (response) {\r\n response = (response === null) ? false : response\r\n return response\r\n })\r\n}\r\n\r\nSubscriptionService.prototype.fetchPaymentHistory = function (companyId) {\r\n if (!companyId || (typeof companyId !== 'string')) {\r\n companyId = this.companyService.getActiveCompanyId()\r\n }\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'subscriptions',\r\n 'payments'\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n var apiPath = actionPath\r\n\r\n return this.client.get(apiPath).then(function (response) {\r\n return response\r\n })\r\n}\r\n\r\nSubscriptionService.prototype.fetchPaymentHistoryForReceiptId = function (receiptId, companyId) {\r\n if (!companyId || (typeof companyId !== 'string')) {\r\n companyId = this.companyService.getActiveCompanyId()\r\n }\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'subscriptions',\r\n 'payments',\r\n receiptId\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n var apiPath = actionPath\r\n\r\n return this.client.get(apiPath).then(function (response) {\r\n response = (response === null) ? false : response\r\n return response\r\n })\r\n}\r\n\r\nSubscriptionService.prototype.checkPassword = function (password) {\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'account',\r\n 'verify-access'\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n var apiPath = actionPath\r\n\r\n return this.client.post(apiPath, password).then(function (response) {\r\n return response\r\n })\r\n}\r\n\r\nSubscriptionService.prototype.deleteAccount = function (companyId) {\r\n if (!companyId || (typeof companyId !== 'string')) {\r\n companyId = this.companyService.getActiveCompanyId()\r\n }\r\n var actionPathSegments = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId\r\n ]\r\n var actionPath = actionPathSegments.join('/')\r\n var apiPath = actionPath\r\n\r\n return this.client.del(apiPath).then(function (response) {\r\n return response\r\n })\r\n}\r\n\r\nmodule.exports = SubscriptionService\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<div class=\\\"toggleContainer pauseDeleteAccountContainer\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3>Delete Account</h3>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"block-content col-xs-12 confirmContainer\\\">\\r\\n\\r\\n <div class=\\\"pauseAccountContainer\\\" style=\\\"display:none;\\\">\\r\\n <label class=\\\"css-input css-radio css-radio-primary\\\"> \\r\\n <input type=\\\"radio\\\" id=\\\"pauseAccount\\\" name=\\\"pauseDeleteAccount\\\" value=\\\"pauseAccount\\\">\\r\\n <span></span>\\r\\n <div class=\\\"pauseDeleteDescription\\\">\\r\\n <b>Temporarily pause billing for my monthly plan on this account</b>\\r\\n </div>\\r\\n </label>\\r\\n <div class=\\\"pauseDeleteDescription\\\">\\r\\n All adding, editing, and deleting of information will be disabled. You will still be able to view and print all information and data.\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"deleteAccountContainer\\\">\\r\\n <label class=\\\"css-input css-radio css-radio-primary\\\"> \\r\\n <input type=\\\"radio\\\" id=\\\"deleteAccount\\\" name=\\\"pauseDeleteAccount\\\" value=\\\"deleteAccount\\\" checked>\\r\\n <span></span>\\r\\n <div class=\\\"pauseDeleteDescription deleteAccountLabel\\\">\\r\\n <b>Permanently delete this account</b>\\r\\n </div>\\r\\n </label>\\r\\n <div class=\\\"pauseDeleteDescription\\\">\\r\\n The account will no longer be available, and all data in the account will be permanently deleted.\\r\\n <br />\\r\\n <div class=\\\"deleteAccountWarningText\\\">\\r\\n <span>Be sure to export all of your data before deleting your account.</span>\\r\\n <span><a href=\\\"http://get.crunched.help/hc/en-us/articles/115003662247?flash_digest=6cd34d13c49fff48d9439f7e14db7276de26d555\\\" target=\\\"_blank\\\">Learn More</a></span>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"col-xs-12 no-padding action\\\">\\r\\n <button class=\\\"btn btn-primary pauseDeleteAccountContinueBtn\\\" type=\\\"button\\\"><span class=\\\"selectedActionBtnText\\\">Delete</span> Account</button>\\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"toggleContainer confirmPasswordForPauseDeleteContainer\\\" style=\\\"display:none;\\\">\\r\\n <div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\" id=\\\"closePauseDeleteModal\\\"></i>\\r\\n <h3>Are you sure?</h3>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"text-danger help-block animated fadeInDown validation-summary-errors\\\">\\r\\n <div class=\\\"errorMessage\\\"></div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"block-content col-xs-12 confirmContainer\\\">\\r\\n <div class=\\\"form-group no-padding headerForPasswordInput\\\">\\r\\n <p>Please enter your password:</p>\\r\\n </div> \\r\\n\\r\\n <div class=\\\"form-group no-padding passwordInputContainer\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input id=\\\"password\\\" class=\\\"form-control\\\" type=\\\"password\\\" name=\\\"password\\\" />\\r\\n <label class=\\\"control-label\\\" for=\\\"password\\\">Password</label>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"col-xs-12 no-padding action\\\">\\r\\n <button class=\\\"btn btn-primary pauseDeleteAccountSubmit\\\" id=\\\"pauseDeleteAccountSubmit\\\" type=\\\"button\\\"><span class=\\\"selectedActionBtnText\\\">Delete</span> My Account</button>\\r\\n </div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar ConfirmModalTemplate = require('settings/subscription/summary/confirm-modal/template')\r\n\r\nvar PauseDeleteConfirmView = Backbone.View.extend({\r\n className: 'block pause-delete-confirmation-modal z-1',\r\n\r\n events: {\r\n 'click .collapse': 'cancel',\r\n 'click #deleteAccount': 'refreshBtnText',\r\n 'click #pauseAccount': 'refreshBtnText',\r\n 'click .pauseDeleteAccountContinueBtn': 'continue',\r\n 'click .pauseDeleteAccountSubmit': 'checkPassword'\r\n },\r\n \r\n initialize: function () {\r\n this.on('checkedPassword', this.checkedPassword.bind(this))\r\n this.on('checkedPasswordFailed', this.checkedPasswordFailed.bind(this))\r\n this.on('failedDeleteAccount', this.failedDeleteAccount.bind(this))\r\n },\r\n \r\n render: function () {\r\n this.$el.html(ConfirmModalTemplate(this.createViewModel()))\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n return {\r\n screenTitle: 'Delete Account'\r\n }\r\n },\r\n\r\n refreshBtnText: function () {\r\n var selectedOption = this.$('input[name=pauseDeleteAccount]:checked').val()\r\n if (selectedOption === \"deleteAccount\") {\r\n this.$('.selectedActionBtnText').html(\"Delete\")\r\n } else {\r\n this.$('.selectedActionBtnText').html(\"Pause\")\r\n } \r\n },\r\n \r\n continue: function (event) {\r\n event.preventDefault()\r\n var selectedOption = this.$('input[name=pauseDeleteAccount]:checked').val()\r\n \r\n if (!!selectedOption) {\r\n this.toggleContainer()\r\n }\r\n },\r\n \r\n toggleContainer: function () {\r\n this.$('.toggleContainer').toggle()\r\n },\r\n \r\n pauseOrDeleteAccount: function (isValidPassword) {\r\n var selectedOption = this.$('input[name=pauseDeleteAccount]:checked').val()\r\n if (isValidPassword !== undefined && !!isValidPassword && !!selectedOption) {\r\n this.$('#pauseDeleteAccountSubmit').prop('disabled', true)\r\n this.$('#closePauseDeleteModal').addClass('disabled')\r\n if (selectedOption === \"pauseAccount\") {\r\n this.trigger('pauseAccount')\r\n } else if (selectedOption === \"deleteAccount\") {\r\n this.trigger('deleteAccount')\r\n }\r\n } else {\r\n this.$('#pauseDeleteAccountSubmit').prop('disabled', false)\r\n this.$('#closePauseDeleteModal').removeClass('disabled')\r\n }\r\n },\r\n \r\n checkPassword: function (event) {\r\n event.preventDefault()\r\n var feedbackSummary = this.$('.validation-summary-errors').find('.errorMessage')\r\n var password = this.$('input#password').val()\r\n var passwordEmptyText = \"Please enter your password.\"\r\n \r\n if (!!password) {\r\n this.trigger('checkPassword', password)\r\n } else {\r\n feedbackSummary.empty()\r\n feedbackSummary.append('<div>' + passwordEmptyText + '</div>')\r\n }\r\n },\r\n \r\n checkedPassword: function (isValidPassword) {\r\n var invalidPasswordText = \"Sorry, the password you entered is invalid.\"\r\n var feedbackSummary = this.$('.validation-summary-errors').find('.errorMessage')\r\n feedbackSummary.empty()\r\n if (!isValidPassword) {\r\n feedbackSummary.append('<div>' + invalidPasswordText + '</div>')\r\n } else {\r\n this.pauseOrDeleteAccount(isValidPassword)\r\n }\r\n },\r\n \r\n checkedPasswordFailed: function (error) {\r\n var feedbackSummary = this.$('.validation-summary-errors').find('.errorMessage')\r\n feedbackSummary.empty()\r\n feedbackSummary.append('<div>' + error.message + '</div>')\r\n },\r\n \r\n failedDeleteAccount: function (error) {\r\n var feedbackSummary = this.$('.validation-summary-errors').find('.errorMessage')\r\n feedbackSummary.empty()\r\n feedbackSummary.append('<div>' + error.message + '</div>')\r\n this.$('#pauseDeleteAccountSubmit').prop('disabled', false)\r\n this.$('#closePauseDeleteModal').removeClass('disabled')\r\n },\r\n \r\n cancel: function (e) {\r\n e.preventDefault()\r\n if (!$(e.currentTarget).hasClass('disabled')) {\r\n this.trigger('cancel')\r\n }\r\n } \r\n})\r\n\r\nmodule.exports = PauseDeleteConfirmView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar PauseDeleteConfirmView = require('settings/subscription/summary/confirm-modal/view')\r\nvar Service = require('settings/subscription/service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar PauseDeleteConfirmWidget = function () {\r\n this.model = new Backbone.Model()\r\n \r\n this.view = new PauseDeleteConfirmView({\r\n model: this.model\r\n })\r\n\r\n this.service = new Service()\r\n this.companyService = new CompanyService()\r\n\r\n this.view.on('cancel', function () {\r\n this.trigger('cancel')\r\n }, this)\r\n \r\n this.view.on('pauseAccount', this.pauseAccount.bind(this))\r\n this.view.on('deleteAccount', this.deleteAccount.bind(this))\r\n this.view.on('checkPassword', this.checkPassword.bind(this))\r\n \r\n}\r\n\r\nPauseDeleteConfirmWidget.prototype = _.clone(Backbone.Events)\r\n\r\nPauseDeleteConfirmWidget.prototype.show = function () {\r\n var $el = this.view.render().$el\r\n this.view.delegateEvents()\r\n\r\n return $el\r\n}\r\n\r\n// these functions to be wired with backend (3/2/2017 12:54 PM)\r\nPauseDeleteConfirmWidget.prototype.pauseAccount = function () {\r\n \r\n}\r\n\r\nPauseDeleteConfirmWidget.prototype.deleteAccount = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.service.deleteAccount(companyId).done(function (response) {\r\n if (!!response.success) {\r\n return this.companyService.fetchCompanies().then(function (companies) {\r\n if (companies.length > 0) {\r\n Backbone.trigger('app:changeCompany', companies[0].id, true)\r\n } else {\r\n localStorage.removeItem('crunchedActiveCompany')\r\n localStorage.removeItem('crunchedActiveCompanyInfo')\r\n localStorage.removeItem('crunched-session-numberOfCompanies')\r\n Backbone.trigger('activeCompanyChanged')\r\n Backbone.trigger('app:navigate', 'business-creation')\r\n }\r\n }.bind(this))\r\n }\r\n }.bind(this), function (error) {\r\n console.log('Failed to delete the account: ' + error.message)\r\n this.view.trigger('failedDeleteAccount', error)\r\n }.bind(this))\r\n}\r\n\r\nPauseDeleteConfirmWidget.prototype.checkPassword = function (password) {\r\n this.service.checkPassword(password).then(function (response) {\r\n this.view.trigger('checkedPassword', response.success)\r\n }.bind(this), function (error) {\r\n this.view.trigger('checkedPasswordFailed', error.message)\r\n }.bind(this))\r\n}\r\n\r\n\r\nmodule.exports = PauseDeleteConfirmWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"block-header no-padding\\\">\\r\\n <h3 class=\\\"summarySectionTitle\\\">Your Plan</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content no-padding\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <div class=\\\"summaryInfo\\\">Your next billing date is: \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isExpired : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(8, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"menuLink\\\">\\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.subscriptionProcessing : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(10, data, 0),\"inverse\":container.program(12, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n <div class=\\\"flex planSummary\\\">\\r\\n <div class=\\\"summaryInfo\\\">\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isTrial : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(14, data, 0),\"inverse\":container.program(16, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n <div class=\\\"planDescription\\\">\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isExpired : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(18, data, 0),\"inverse\":container.program(26, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n </div>\\r\\n\\r\\n <div class=\\\"block-header no-padding\\\">\\r\\n <h3 class=\\\"summarySectionTitle\\\">Payment Method</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content no-padding\\\">\\r\\n <div class=\\\"flex\\\">\\r\\n <div class=\\\"summaryInfo creditCardInfo\\\" \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasBillingInfo : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(28, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \">\\r\\n <span>\"\n + alias4(((helper = (helper = helpers.cardType || (depth0 != null ? depth0.cardType : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"cardType\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>:\\r\\n <span>XXXX-XXXX-XXXX-\"\n + alias4(((helper = (helper = helpers.lastFour || (depth0 != null ? depth0.lastFour : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lastFour\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>\\r\\n </div>\\r\\n <div class=\\\"menuLink creditCardInfo\\\"><a href=\\\"/settings/subscription/edit-payment-method\\\">Change Payment Method</a></div>\\r\\n </div>\\r\\n <div class=\\\"flex planSummary\\\">\\r\\n <div class=\\\"summaryInfo\\\" \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasBillingInfo : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(28, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \">Expiration: <span>\"\n + alias4(((helper = (helper = helpers.expiryMonth || (depth0 != null ? depth0.expiryMonth : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"expiryMonth\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>/<span>\"\n + alias4(((helper = (helper = helpers.expiryYear || (depth0 != null ? depth0.expiryYear : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"expiryYear\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span></div>\\r\\n </div>\\r\\n </div>\\r\\n \\r\\n\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.hasPaymentHistory : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(30, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \\r\\n <div class=\\\"block-content no-padding\\\">\\r\\n <div class=\\\"pauseDeleteTextContainer\\\"><a id=\\\"pauseDeleteText\\\" class=\\\"pauseDeleteText\\\" href=\\\"\\\">Delete account</a></div>\\r\\n </div>\\r\\n \\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \"<b>\"\n + container.escapeExpression(((helper = (helper = helpers.nextBillingDate || (depth0 != null ? depth0.nextBillingDate : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"nextBillingDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</b> \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isTrial : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"3\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"(Billed <span>\"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAnnual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(4, data, 0),\"inverse\":container.program(6, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</span>)\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Annually\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n return \"Monthly\";\n},\"8\":function(container,depth0,helpers,partials,data) {\n return \"<b>Plan Expired</b>\";\n},\"10\":function(container,depth0,helpers,partials,data) {\n return \" <b class=\\\"pull-right\\\" id=\\\"subscriptionProcessing\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"left\\\" data-original-title=\\\"Subscriptions can only be updated once every thirty minutes\\\">\\r\\n <i class=\\\"fa fa-question-circle\\\" aria-hidden=\\\"true\\\"></i>\\r\\n <span>Adjust Plan</span>\\r\\n </b>\\r\\n\";\n},\"12\":function(container,depth0,helpers,partials,data) {\n return \" <a href=\\\"/settings/subscription/edit-plan\\\" id=\\\"adjustPlanLink\\\">Adjust Plan</a>\\r\\n\";\n},\"14\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"<span>\"\n + container.escapeExpression(((helper = (helper = helpers.planName || (depth0 != null ? depth0.planName : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"planName\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span> Plan\";\n},\"16\":function(container,depth0,helpers,partials,data) {\n return \"Free Trial\";\n},\"18\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isTrial : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(19, data, 0),\"inverse\":container.program(21, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"19\":function(container,depth0,helpers,partials,data) {\n return \" <span>$0</span> per month\\r\\n\";\n},\"21\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {};\n\n return \" <span>$\"\n + container.escapeExpression(((helper = (helper = helpers.price || (depth0 != null ? depth0.price : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(alias1,{\"name\":\"price\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span> per \\r\\n <span>\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isAnnual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(22, data, 0),\"inverse\":container.program(24, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</span>\\r\\n\";\n},\"22\":function(container,depth0,helpers,partials,data) {\n return \"year\";\n},\"24\":function(container,depth0,helpers,partials,data) {\n return \"month\";\n},\"26\":function(container,depth0,helpers,partials,data) {\n return \" Expired\\r\\n\";\n},\"28\":function(container,depth0,helpers,partials,data) {\n return \"style=\\\"visibility:hidden;\\\"\";\n},\"30\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \" <div class=\\\"block-header no-padding\\\">\\r\\n <h3 class=\\\"summarySectionTitle\\\">Billing Activity</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content no-padding\\\">\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(helpers.limit || (depth0 && depth0.limit) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.payHistory : depth0),(depth0 != null ? depth0.loadIndexForPayHistory : depth0),{\"name\":\"limit\",\"hash\":{},\"data\":data}),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(31, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" <div class=\\\"flex planSummary viewMoreContainer\\\">\\r\\n <div class=\\\"summaryInfo\\\"><span class=\\\"viewMore\\\"><a>View More</a></span></div>\\r\\n </div>\\r\\n </div>\\r\\n\";\n},\"31\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <div class=\\\"flex planSummary\\\">\\r\\n <div class=\\\"summaryInfo paymentHistory\\\"><span><a href=\\\"/settings/subscription/receipt/\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\">\"\n + alias4(((helper = (helper = helpers.paymentDate || (depth0 != null ? depth0.paymentDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"paymentDate\",\"hash\":{},\"data\":data}) : helper)))\n + \"</a></span></div>\\r\\n <div class=\\\"planDescription paymentHistory\\\">\\r\\n <span>\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.total : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(32, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</span>\\r\\n </div>\\r\\n </div>\\r\\n\";\n},\"32\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"$\"\n + container.escapeExpression(((helper = (helper = helpers.total || (depth0 != null ? depth0.total : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"total\",\"hash\":{},\"data\":data}) : helper)));\n},\"34\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"block-header\\\">\\r\\n <p class=\\\"titleHelpText\\\">You are subscribed to an educational license.</p>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<div class=\\\"subsriptionSummary\\\">\\r\\n <div class=\\\"subsriptionSummaryContent\\\"> \\r\\n\\r\\n\"\n + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(34, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"\\r\\n\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Config = require('config/config')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar sweetAlert = require('sweetalert2')\r\nvar Service = require('settings/subscription/service')\r\nvar SubscriptionSummaryTemplate = require('settings/subscription/summary/template')\r\nvar ConfirmModalWidget = require('settings/subscription/summary/confirm-modal/widget')\r\nvar ConfirmModalTemplate = require('settings/subscription/summary/confirm-modal/template')\r\n\r\nvar SubscriptionSummaryView = Backbone.View.extend({\r\n className: 'subscription block',\r\n\r\n events: {\r\n 'click #pauseDeleteText': 'confirmModal',\r\n 'click .viewMore': 'loadMorePayHistory'\r\n },\r\n\r\n initialize: function () {\r\n this.on('widgetReady', this.render.bind(this))\r\n this.listenTo(this.model, 'change:subscriptionInfo change:billingInfo change:paymentHistory', this.render.bind(this))\r\n this.loadIndexForPayHistory = 5\r\n },\r\n\r\n render: function () {\r\n $('.tooltip').remove()\r\n this.$el.html(SubscriptionSummaryTemplate(this.createViewModel()))\r\n this.checkLoadingPayHistory()\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('subscriptionInfo')) {\r\n var subscriptionInfo = this.model.get('subscriptionInfo')\r\n if (this.model.get('billingInfo')) {\r\n var billingInfo = this.model.get('billingInfo')\r\n var cardType = billingInfo.cardType\r\n var lastFour = billingInfo.lastFour\r\n var expiryMonth = billingInfo.expiryMonth\r\n var expiryYear = billingInfo.expiryYear\r\n }\r\n if (this.model.get('paymentHistory')) {\r\n var payHistory = this.model.get('paymentHistory')\r\n _.map(payHistory, function (item) {\r\n item.paymentDate = moment(new Date(item.paymentDate)).format('MMMM DD, YYYY')\r\n })\r\n }\r\n\r\n this.hasPaymentHisotry = !!(!!this.model.get('paymentHistory') && (this.model.get('paymentHistory').length > 0))\r\n this.hasBillingInfo = !!(!!this.model.get('billingInfo') && (cardType !== null) && (lastFour !== null) && (expiryMonth !== null) && (expiryYear !== null))\r\n var isExpired = !!((!subscriptionInfo.activeSubscription && !subscriptionInfo.isTrial))\r\n return {\r\n hasBillingInfo: this.hasBillingInfo,\r\n cardType: cardType ? cardType : '',\r\n lastFour: lastFour ? lastFour : '',\r\n expiryMonth: expiryMonth ? expiryMonth : '',\r\n expiryYear: expiryYear ? expiryYear : '',\r\n isExpired: isExpired,\r\n isTrial: subscriptionInfo.isTrial,\r\n nextBillingDate: moment(subscriptionInfo.nextBillingDate).format('MM/DD/YYYY'),\r\n activeSubscription: subscriptionInfo.activeSubscription,\r\n subscriptionProcessing: subscriptionInfo.subscriptionProcessing,\r\n isAnnual: subscriptionInfo.isAnnual,\r\n planName: subscriptionInfo.planLevel.name,\r\n price: !subscriptionInfo.isAnnual ? subscriptionInfo.planLevel.price : ((subscriptionInfo.planLevel.price - subscriptionInfo.planLevel.annualDiscount) * 12),\r\n hasPaymentHistory: this.hasPaymentHisotry,\r\n payHistory: payHistory ? payHistory : '',\r\n loadIndexForPayHistory: this.loadIndexForPayHistory,\r\n isEducationalLicense: Config['IS_EDUCATIONAL_LICENSE']\r\n }\r\n }\r\n },\r\n\r\n loadMorePayHistory: function (event) {\r\n event.preventDefault()\r\n event.stopPropagation()\r\n if (!!this.model.get('paymentHistory') && this.model.get('paymentHistory').length > 0 && this.loadIndexForPayHistory < this.model.get('paymentHistory').length) {\r\n this.loadIndexForPayHistory += 5\r\n }\r\n this.render()\r\n },\r\n\r\n checkLoadingPayHistory: function () {\r\n if (!!this.model.get('paymentHistory') && this.model.get('paymentHistory').length > 0) {\r\n if (this.loadIndexForPayHistory >= this.model.get('paymentHistory').length) {\r\n this.$('.viewMoreContainer').css('display', 'none')\r\n console.log('No more payment history.')\r\n }\r\n }\r\n },\r\n\r\n confirmModal: function (event) {\r\n event.preventDefault()\r\n event.stopPropagation()\r\n var confirmModalWidget = new ConfirmModalWidget()\r\n var $confirmModalWidget = confirmModalWidget.show()\r\n $('div.content.main').append($confirmModalWidget.show())\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n })\r\n\r\n confirmModalWidget.on('cancel', function () {\r\n $confirmModalWidget.remove()\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n this.render()\r\n }.bind(this))\r\n }\r\n})\r\n\r\nmodule.exports = SubscriptionSummaryView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar Q = require('q')\r\nvar SubscriptionSummaryView = require('settings/subscription/summary/view')\r\nvar Service = require('settings/subscription/service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar SubscriptionSummaryWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.view = new SubscriptionSummaryView({\r\n model: this.model\r\n })\r\n this.service = new Service()\r\n this.companyService = new CompanyService()\r\n \r\n this.loadDependencies()\r\n\r\n this.on('shown', function () {\r\n this.readyPromise.then(function () {\r\n this.preventLoad = false\r\n this.view.trigger('widgetReady')\r\n }.bind(this))\r\n }.bind(this))\r\n}\r\n\r\nSubscriptionSummaryWidget.prototype = _.clone(Backbone.Events)\r\n\r\nSubscriptionSummaryWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nSubscriptionSummaryWidget.prototype.loadDependencies = function () {\r\n this.readyPromise = Q.all([\r\n this.fetchCompanySubscription(),\r\n this.fetchBillingInfo(),\r\n this.fetchPaymentHistory()\r\n ])\r\n}\r\n\r\nSubscriptionSummaryWidget.prototype.fetchCompanySubscription = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.service.fetchCompanySubscription(companyId).then(function (response) {\r\n this.model.set('subscriptionInfo', response)\r\n }.bind(this), function () { \r\n console.log('Fail to fetch subscription information.')\r\n }.bind(this))\r\n}\r\n\r\nSubscriptionSummaryWidget.prototype.fetchBillingInfo = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.service.fetchBillingInfo(companyId).then(function (response) {\r\n if (response !== false) {\r\n this.model.set('billingInfo', response)\r\n }\r\n }.bind(this), function () { \r\n console.log('Fail to fetch billing information.')\r\n }.bind(this))\r\n}\r\n\r\nSubscriptionSummaryWidget.prototype.fetchPaymentHistory = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.service.fetchPaymentHistory(companyId).then(function (response) {\r\n response = _.sortBy(response, function (item) {\r\n return item.paymentDate\r\n }.bind(this)).reverse()\r\n this.model.set('paymentHistory', response)\r\n }.bind(this), function () {\r\n console.log('Fail to fetch payment history.')\r\n }.bind(this))\r\n}\r\n\r\nSubscriptionSummaryWidget.prototype.refresh = function () {\r\n this.loadDependencies()\r\n}\r\n\r\n\r\nmodule.exports = SubscriptionSummaryWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar moment = require('moment')\r\nvar sweetAlert = require('sweetalert2')\r\nvar UpdateBillingInfoTemplate = require('settings/subscription/billing-info/template')\r\nvar UpdatePlanConfirmModelWidget = require('settings/subscription/update-plan/confirm-modal/widget')\r\n\r\nvar UpdateBillingInfoView = Backbone.View.extend({\r\n className: 'subscription block subscription-view-container',\r\n\r\n events: {\r\n 'click .changePlanText': 'changePlan',\r\n 'submit form': 'payNow',\r\n 'change input, select': 'validate',\r\n 'keyup input, select': 'validate',\r\n 'focusout input, select': 'validate',\r\n 'click .updateBillingInfoClose': 'close'\r\n },\r\n\r\n initialize: function () {\r\n this.on('widgetReady', this.render.bind(this))\r\n this.listenTo(this.model, 'change', this.render.bind(this))\r\n },\r\n\r\n render: function () {\r\n this.$el.html(UpdateBillingInfoTemplate(this.createViewModel()))\r\n this.populateMonthDropdown()\r\n this.populateYearDropdown()\r\n this.$('.selectpicker').selectpicker({\r\n size: 5,\r\n dropupAuto: false,\r\n noneSelectedText: ''\r\n })\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('subscriptionInfo')) {\r\n var info = this.model.get('subscriptionInfo')\r\n var annualPlanPrice = (info.planLevel.price - info.planLevel.annualDiscount) * 12\r\n var isPriceZero = info.planLevel.price === 0\r\n var isTrial = info.isTrial\r\n return {\r\n isTrial: isTrial,\r\n isUpdateView: true,\r\n screenTitle: 'Edit Billing Information',\r\n planBoxTitle: 'Your current plan',\r\n name: info.planLevel.name,\r\n isAnnual: info.isAnnual,\r\n price: info.isAnnual ? annualPlanPrice : info.planLevel.price,\r\n nextBillingDate: moment(info.nextBillingDate).format('MM/DD/YYYY'),\r\n postButtonText: 'Save',\r\n isPriceZero: isPriceZero\r\n }\r\n }\r\n },\r\n\r\n validate: function (event) {\r\n event.preventDefault()\r\n this.$('.has-error').removeClass('has-error')\r\n },\r\n\r\n payNow: function (event) {\r\n event.preventDefault()\r\n var creditCard = this.$('input#creditNumber').val()\r\n var expirationMonth = this.$('#expMonth').val()\r\n var expirationYear = this.$('#expYear').val()\r\n var cvv = this.$('input#securityCode').val()\r\n var postalCode = this.$('input#postalCode').val()\r\n var nameOnCard = this.$('input#nameOnCard').val()\r\n var streetAddress = this.$('input#streetAddress').val()\r\n\r\n creditCard = creditCard.replace(/[^\\d]+/g, '')\r\n cvv = cvv.replace(/[^\\d]+/g, '')\r\n this.$('.has-error').removeClass('has-error')\r\n\r\n if (!creditCard || !cvv || !nameOnCard || !expirationMonth || !expirationYear || !postalCode || !streetAddress || (!!expirationMonth && !!expirationYear && !this.isExpDateValid())) {\r\n if (!creditCard) {\r\n this.$('input#creditNumber').parent().parent().addClass('has-error')\r\n }\r\n if (!cvv) {\r\n this.$('input#securityCode').parent().parent().addClass('has-error')\r\n }\r\n if (!nameOnCard) {\r\n this.$('input#nameOnCard').parent().parent().addClass('has-error')\r\n }\r\n if (!expirationMonth) {\r\n this.$('#expMonth').parent().parent().addClass('has-error')\r\n }\r\n if (!expirationYear) {\r\n this.$('#expYear').parent().parent().addClass('has-error')\r\n }\r\n if (!postalCode) {\r\n this.$('input#postalCode').parent().parent().addClass('has-error')\r\n }\r\n if (!streetAddress) {\r\n this.$('input#streetAddress').parent().parent().addClass('has-error')\r\n }\r\n if (!!expirationMonth && !!expirationYear && !this.isExpDateValid()) {\r\n this.$('#expMonth').parent().parent().addClass('has-error')\r\n this.$('#expYear').parent().parent().addClass('has-error')\r\n }\r\n } else {\r\n this.$('#paySubmitButton').prop('disabled', true)\r\n var paymentInformation = {\r\n name: nameOnCard,\r\n streetAddress: streetAddress,\r\n postalCode: postalCode,\r\n creditCard: {\r\n cardNumber: creditCard,\r\n cvv: cvv,\r\n expirationMonth: expirationMonth,\r\n expirationYear: expirationYear\r\n }\r\n }\r\n if (!!this.model.get('isSelectedAnnual') && !!this.model.get('selectedPlanId')) {\r\n UpdatePlanConfirmModelWidget.holdCard(paymentInformation)\r\n this.back()\r\n } else {\r\n this.trigger('updateBillingInfoForSubscription', paymentInformation, this)\r\n }\r\n }\r\n },\r\n\r\n isExpDateValid: function () {\r\n var selectedMonth = this.$('#expMonth').val()\r\n var selectedYear = this.$('#expYear').val()\r\n\r\n var todayDate = new Date()\r\n todayDate = moment(todayDate)\r\n var currentYear = todayDate.year()\r\n var currentMonth = todayDate.month() + 1\r\n\r\n if (selectedYear === currentYear.toString()) {\r\n return selectedMonth >= currentMonth\r\n } else {\r\n return true\r\n }\r\n },\r\n\r\n back: function () {\r\n if (!!this.model.get('isSelectedAnnual') && !!this.model.get('selectedPlanId')) {\r\n Backbone.trigger('app:navigate', 'settings/subscription/edit-plan/' + this.model.get('isSelectedAnnual') + '/' + this.model.get('selectedPlanId'))\r\n } else {\r\n Backbone.history.history.back()\r\n }\r\n },\r\n\r\n changePlan: function (e) {\r\n e.preventDefault()\r\n Backbone.trigger('app:navigate', 'settings/subscription/edit-plan')\r\n },\r\n\r\n close: function (e) {\r\n e.preventDefault()\r\n Backbone.trigger('app:navigate', 'settings/subscription')\r\n },\r\n\r\n populateMonthDropdown: function () {\r\n var todayDate = new Date()\r\n todayDate = moment(todayDate)\r\n // moment.month() is zero based, so it will return 0-11.\r\n var currentMonth = todayDate.month() + 1\r\n var months = _.range(1, 13)\r\n\r\n _.each(months, function (value, key) {\r\n var monthDisplay = value < 10 ? '0' + value : value\r\n $('#expMonth').append($('<option value=\"' + value + '\">' + monthDisplay + '</option>'))\r\n if (currentMonth === value) {\r\n $('#expMonth').val(value)\r\n }\r\n }, this)\r\n },\r\n\r\n populateYearDropdown: function () {\r\n var baseYear = 2017\r\n var years = _.range(baseYear, (baseYear + 21))\r\n _.each(years, function (value, key) {\r\n $('#expYear').append($('<option value=\"' + value + '\">' + value + '</option>'))\r\n }, this)\r\n },\r\n\r\n btnEnable: function () {\r\n $('#paySubmitButton').prop('disabled', false)\r\n },\r\n\r\n showErrorAlert: function (error) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: error.message,\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n }\r\n\r\n})\r\n\r\nmodule.exports = UpdateBillingInfoView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\nvar UpdateBillingInfoView = require('settings/subscription/update-billingInfo/view')\r\nvar Service = require('settings/subscription/service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar UpdateBillingInfoWidget = function (isSelectedAnnual, selectedPlanId) {\r\n this.model = new Backbone.Model()\r\n this.view = new UpdateBillingInfoView({\r\n model: this.model\r\n })\r\n\r\n if (!!isSelectedAnnual && !!selectedPlanId) {\r\n this.model.set({\r\n 'isSelectedAnnual': isSelectedAnnual,\r\n 'selectedPlanId': selectedPlanId\r\n })\r\n }\r\n\r\n this.service = new Service()\r\n this.companyService = new CompanyService()\r\n\r\n this.loadDependencies()\r\n\r\n this.on('shown', function () {\r\n this.readyPromise.then(function () {\r\n this.preventLoad = false\r\n this.view.trigger('widgetReady')\r\n }.bind(this))\r\n }.bind(this))\r\n this.view.on('updateBillingInfoForSubscription', this.updateBillingInfo.bind(this))\r\n}\r\n\r\nUpdateBillingInfoWidget.prototype = _.clone(Backbone.Events)\r\n\r\nUpdateBillingInfoWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nUpdateBillingInfoWidget.prototype.loadDependencies = function () {\r\n this.readyPromise = Q.all([\r\n this.fetchCompanySubscription()\r\n ])\r\n}\r\n\r\nUpdateBillingInfoWidget.prototype.fetchCompanySubscription = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.service.fetchCompanySubscription(companyId).then(function (response) {\r\n this.model.set('subscriptionInfo', response)\r\n }.bind(this), function () {\r\n console.log('Fail to fetch subscription information.')\r\n })\r\n}\r\n\r\nUpdateBillingInfoWidget.prototype.updateBillingInfo = function (paymentInfo) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.service.updateBillingInfo(paymentInfo, companyId).then(function (response) {\r\n this.view.back()\r\n }.bind(this), function (error) {\r\n this.view.showErrorAlert(error)\r\n this.view.btnEnable()\r\n console.log('Fail to update billing information.')\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = UpdateBillingInfoWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \"<span>, Billed \"\n + ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAnnual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0),\"inverse\":container.program(4, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"2\":function(container,depth0,helpers,partials,data) {\n return \"Annually\";\n},\"4\":function(container,depth0,helpers,partials,data) {\n return \"Monthly\";\n},\"6\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isAnnual : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.program(9, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"7\":function(container,depth0,helpers,partials,data) {\n return \"year\";\n},\"9\":function(container,depth0,helpers,partials,data) {\n return \"month\";\n},\"11\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.hasBillingInfo : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(12, data, 0),\"inverse\":container.program(14, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"12\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \" <span>Card ending in </span>\\r\\n <span>\"\n + container.escapeExpression(((helper = (helper = helpers.lastFour || (depth0 != null ? depth0.lastFour : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"lastFour\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span>\\r\\n\";\n},\"14\":function(container,depth0,helpers,partials,data) {\n return \" <span>Please update your payment method </span>\\r\\n\";\n},\"16\":function(container,depth0,helpers,partials,data) {\n return \" <span>None Required</span>\\r\\n\";\n},\"18\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.hasBillingInfo : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(19, data, 0),\"inverse\":container.program(21, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"19\":function(container,depth0,helpers,partials,data) {\n return \"(change)\";\n},\"21\":function(container,depth0,helpers,partials,data) {\n return \"(update)\";\n},\"23\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isPriceZero : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(24, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"24\":function(container,depth0,helpers,partials,data) {\n return \"disabled\";\n},\"26\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers[\"if\"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.postButtonText : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(27, data, 0),\"inverse\":container.program(29, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"27\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.postButtonText || (depth0 != null ? depth0.postButtonText : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"postButtonText\",\"hash\":{},\"data\":data}) : helper)));\n},\"29\":function(container,depth0,helpers,partials,data) {\n return \"Submit\";\n},\"31\":function(container,depth0,helpers,partials,data) {\n return \"Done\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3>\"\n + alias4(((helper = (helper = helpers.screenTitle || (depth0 != null ? depth0.screenTitle : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"screenTitle\",\"hash\":{},\"data\":data}) : helper)))\n + \"</h3>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"block-content col-xs-12 confirmContainer\\\">\\r\\n <p>Here is a summary of your new subscription.</p>\\r\\n\\r\\n <div>\\r\\n <span><b>Subscription:</b></span>\\r\\n <span>\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \" Plan</span>\\r\\n \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isPriceZero : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</span>\\r\\n </div>\\r\\n \\r\\n <div>\\r\\n <span><b>Rate:</b></span>\\r\\n <span>$\"\n + alias4(((helper = (helper = helpers.price || (depth0 != null ? depth0.price : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"price\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span> per \\r\\n <span>\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isPriceZero : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.program(9, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</span>\\r\\n </div>\\r\\n \\r\\n <div>\\r\\n <span><b>Billing Method:</b></span>\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isPriceZero : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(11, data, 0),\"inverse\":container.program(16, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" <span class=\\\"changePayInfo\\\">\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isPriceZero : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(18, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</span>\\r\\n </div> \\r\\n \\r\\n <div class=\\\"col-xs-12 no-padding action\\\">\\r\\n <button class=\\\"btn btn-primary updatePlanFinishReview\\\" type=\\\"button\\\" \"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasBillingInfo : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(23, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \">\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isPriceZero : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(26, data, 0),\"inverse\":container.program(31, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \"</button>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar ConfirmNewPlanModalTemplate = require('settings/subscription/update-plan/confirm-modal/template')\r\nvar sweetAlert = require('sweetalert2')\r\nvar Service = require('settings/subscription/service')\r\n\r\nvar AdjustPlanModalView = Backbone.View.extend({\r\n className: 'block new-plan-confirmation-modal z-1',\r\n\r\n events: {\r\n 'click .collapse': 'cancel',\r\n 'click .changePayInfo': 'editBillingInfo',\r\n 'click .updatePlanFinishReview': 'confirm',\r\n },\r\n \r\n initialize: function () {\r\n this.service = new Service()\r\n },\r\n \r\n render: function () {\r\n this.$el.html(ConfirmNewPlanModalTemplate(this.createViewModel()))\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (!!this.model.get('planInfo')) {\r\n var planInfo = this.model.get('planInfo').model\r\n var holdingPaymentInfo = this.model.get('holdingPaymentInfo')\r\n \r\n if (!!planInfo.billingInfo || !!holdingPaymentInfo) {\r\n if (!!planInfo.billingInfo && !!planInfo.billingInfo.lastFour) {\r\n var billingInfo = planInfo.billingInfo\r\n var lastFour = billingInfo.lastFour\r\n }\r\n if (!!holdingPaymentInfo && !!holdingPaymentInfo.creditCard && !!holdingPaymentInfo.creditCard.cardNumber) {\r\n var holdingCardInfo = holdingPaymentInfo.creditCard.cardNumber\r\n var lastFourOfHoldingInfo = holdingCardInfo.substr(holdingCardInfo.length - 4)\r\n lastFour = lastFourOfHoldingInfo\r\n }\r\n } \r\n var isPriceZero = planInfo.planLevel.price === 0 ? true: false\r\n var annualPrice = !planInfo.planLevel.annualPlanPrice ? (planInfo.planLevel.price - planInfo.planLevel.annualDiscount) * 12 : planInfo.planLevel.annualPlanPrice\r\n return {\r\n screenTitle: 'Your new plan',\r\n postButtonText: 'Confirm',\r\n name: planInfo.planLevel.name, \r\n isAnnual: planInfo.isAnnual,\r\n hasBillingInfo: ((!!planInfo.billingInfo && (planInfo.billingInfo.lastFour !== null))|| !!holdingPaymentInfo) ? true: false,\r\n price: planInfo.isAnnual ? annualPrice : planInfo.planLevel.price,\r\n isTrial: planInfo.isTrial,\r\n lastFour: !!lastFour ? lastFour : '',\r\n isPriceZero: isPriceZero\r\n }\r\n }\r\n },\r\n \r\n confirm: function (event) {\r\n event.preventDefault()\r\n if (!!this.model.get('holdingPaymentInfo')) {\r\n this.trigger('updateSubscriptionPlanAndPaymentInfo', this.model.get('holdingPaymentInfo'))\r\n } else {\r\n this.trigger('updateSubscriptionPlan')\r\n }\r\n },\r\n \r\n validate: function () {\r\n var hasSelectedPlan = this.$('.planList').find('.planListItem').hasClass('selected-plan')\r\n var hasSelectedPayPeriod = this.$('input[name=payPeriod]:checked').val()\r\n return !!hasSelectedPlan && !!hasSelectedPayPeriod\r\n },\r\n \r\n cancel: function (e) {\r\n this.trigger('cancel')\r\n },\r\n \r\n editBillingInfo: function (e) {\r\n this.trigger('updateBillingInfo')\r\n }\r\n \r\n})\r\n\r\nmodule.exports = AdjustPlanModalView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar ConfirmNewPlanModalView = require('settings/subscription/update-plan/confirm-modal/view')\r\nvar Service = require('settings/subscription/service')\r\nvar HoldingPaymentInformation = null\r\n\r\nvar ConfirmNewPlanModalWidget = function (planInfo) {\r\n \r\n this.model = new Backbone.Model()\r\n this.model.set('planInfo', planInfo)\r\n this.model.set('holdingPaymentInfo', HoldingPaymentInformation)\r\n \r\n this.view = new ConfirmNewPlanModalView({\r\n model: this.model\r\n })\r\n this.service = new Service()\r\n this.view.on('cancel', function () {\r\n this.trigger('cancel')\r\n }, this)\r\n this.view.on('updateBillingInfo', function () {\r\n this.trigger('updateBillingInfo')\r\n }, this)\r\n this.view.on('updateSubscriptionPlan', function () {\r\n this.trigger('updateSubscriptionPlan')\r\n }, this)\r\n this.view.on('updateSubscriptionPlanAndPaymentInfo', function (holdingPaymentInfo) {\r\n this.trigger('updateSubscriptionPlan', holdingPaymentInfo)\r\n }, this)\r\n}\r\n\r\nConfirmNewPlanModalWidget.prototype = _.clone(Backbone.Events)\r\n\r\nConfirmNewPlanModalWidget.prototype.show = function () {\r\n var $el = this.view.render().$el\r\n this.view.delegateEvents()\r\n\r\n return $el\r\n}\r\n\r\nmodule.exports = ConfirmNewPlanModalWidget\r\nmodule.exports.holdCard = function (paymentInfo) {\r\n HoldingPaymentInformation = paymentInfo\r\n}\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" \\r\\n <div id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\" class=\\\"form-group planListItem \"\n + ((stack1 = helpers[\"if\"].call(alias1,(helpers.and || (depth0 && depth0.and) || alias2).call(alias1,(helpers.eq || (depth0 && depth0.eq) || alias2).call(alias1,(depths[1] != null ? depths[1].currentPlanId : depths[1]),(depth0 != null ? depth0.id : depth0),{\"name\":\"eq\",\"hash\":{},\"data\":data}),(helpers.eq || (depth0 && depth0.eq) || alias2).call(alias1,(depths[1] != null ? depths[1].selectedPayPeriod : depths[1]),(depths[1] != null ? depths[1].currentPayPeriod : depths[1]),{\"name\":\"eq\",\"hash\":{},\"data\":data}),{\"name\":\"and\",\"hash\":{},\"data\":data}),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(2, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(helpers.and || (depth0 && depth0.and) || alias2).call(alias1,(helpers.eq || (depth0 && depth0.eq) || alias2).call(alias1,(depths[1] != null ? depths[1].isNotTrialAndIsPlanPriceZero : depths[1]),true,{\"name\":\"eq\",\"hash\":{},\"data\":data}),(helpers.eq || (depth0 && depth0.eq) || alias2).call(alias1,(depths[1] != null ? depths[1].currentPlanId : depths[1]),(depth0 != null ? depth0.id : depth0),{\"name\":\"eq\",\"hash\":{},\"data\":data}),{\"name\":\"and\",\"hash\":{},\"data\":data}),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"\\\">\\r\\n <div class=\\\"form-material floating flex\\\">\\r\\n <div class=\\\"col-xs-3 planName\\\">\\r\\n <div class=\\\"planNameText\\\">\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n </div>\\r\\n <div class=\\\"col-xs-6 planDescription\\\">\\r\\n <p><b>Includes:</b> \"\n + alias4(((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"description\",\"hash\":{},\"data\":data}) : helper)))\n + \"</p>\\r\\n </div>\\r\\n <div class=\\\"col-xs-3 planAmount\\\">\\r\\n <div><span class=\\\"currency\\\">$\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depths[1] != null ? depths[1].isAnnualChecked : depths[1]),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(5, data, 0, blockParams, depths),\"inverse\":container.program(7, data, 0, blockParams, depths),\"data\":data})) != null ? stack1 : \"\")\n + \"</span>\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depths[1] != null ? depths[1].isAnnualChecked : depths[1]),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(9, data, 0, blockParams, depths),\"inverse\":container.program(11, data, 0, blockParams, depths),\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n\";\n},\"2\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1;\n\n return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depths[1] != null ? depths[1].isTrial : depths[1]),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(3, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \"disabledPlanListItem\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.annualPlanPrice || (depth0 != null ? depth0.annualPlanPrice : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"annualPlanPrice\",\"hash\":{},\"data\":data}) : helper)));\n},\"7\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.price || (depth0 != null ? depth0.price : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"price\",\"hash\":{},\"data\":data}) : helper)));\n},\"9\":function(container,depth0,helpers,partials,data) {\n return \"/yr\";\n},\"11\":function(container,depth0,helpers,partials,data) {\n return \"/mo\";\n},\"13\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return container.escapeExpression(((helper = (helper = helpers.postButtonText || (depth0 != null ? depth0.postButtonText : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"postButtonText\",\"hash\":{},\"data\":data}) : helper)));\n},\"15\":function(container,depth0,helpers,partials,data) {\n return \"Confirm\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"planList\\\">\\r\\n <!--Plan List-->\\r\\n\"\n + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.planLevels : depth0),{\"name\":\"each\",\"hash\":{},\"fn\":container.program(1, data, 0, blockParams, depths),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n<div class=\\\"form-group col-xs-12 action\\\">\\r\\n <button class=\\\"btn btn-primary save\\\" id=\\\"continueToBilling\\\" disabled>\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.postButtonText : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(13, data, 0, blockParams, depths),\"inverse\":container.program(15, data, 0, blockParams, depths),\"data\":data})) != null ? stack1 : \"\")\n + \"</button> \\r\\n</div>\\r\\n\";\n},\"useData\":true,\"useDepths\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar UpdatePlanListTemplate = require('settings/subscription/update-plan/list/template')\r\n\r\nvar UpdatePlanListView = Backbone.View.extend({\r\n className: 'block-content no-padding',\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:planLevels change:isAnnualChecked change:subscriptionInfo', this.render) \r\n },\r\n \r\n render: function () {\r\n this.$el.html(UpdatePlanListTemplate(this.createViewModel()))\r\n\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (!!this.model.get('planLevels') && !!this.model.get('subscriptionInfo')) {\r\n this.populateAnnualPrice()\r\n var planLevels = this.model.get('planLevels')\r\n\r\n var currentPlanId = this.model.get('subscriptionInfo').planLevelId\r\n var selectedPayPeriod = $('input[name=payPeriod]:checked').val()\r\n var currentPayPeriod = !this.model.get('subscriptionInfo').isAnnual ? 'payMonthly' : 'payAnnually'\r\n var isCurrentAnnual = this.model.get('subscriptionInfo').isAnnual\r\n var isTrial = this.model.get('subscriptionInfo').isTrial\r\n var isCurrentPlanPriceZero = this.model.get('subscriptionInfo').planLevel.price === 0 ? true : false\r\n var isNotTrialAndIsPlanPriceZero = !isTrial && isCurrentPlanPriceZero ? true : false\r\n \r\n return {\r\n isTrial: isTrial,\r\n planLevels: planLevels,\r\n isAnnualChecked: this.isAnnualChecked,\r\n postButtonText: 'Confirm',\r\n isCurrentAnnaul: isCurrentAnnual,\r\n currentPlanId: currentPlanId,\r\n selectedPayPeriod: selectedPayPeriod,\r\n currentPayPeriod: currentPayPeriod,\r\n isCurrentPlanPriceZero: isCurrentPlanPriceZero,\r\n isNotTrialAndIsPlanPriceZero: isNotTrialAndIsPlanPriceZero\r\n }\r\n } else {\r\n return {\r\n postButtonText: 'Continue To Billing'\r\n } \r\n }\r\n },\r\n\r\n populateAnnualPrice: function () {\r\n var selectedPayPeriod = this.selectedPayPeriod\r\n \r\n if (selectedPayPeriod === 'payAnnually') {\r\n _.map(this.model.get('planLevels'), function (plan){\r\n if (plan.price !== 0) {\r\n var annualPlanPrice = (plan.price - plan.annualDiscount) * 12\r\n plan.annualPlanPrice = annualPlanPrice\r\n } else {\r\n plan.annualPlanPrice = 0\r\n }\r\n }.bind(this))\r\n }\r\n },\r\n \r\n refresh: function (selectedPayPeriod) {\r\n this.selectedPayPeriod = selectedPayPeriod\r\n this.isAnnualChecked = (selectedPayPeriod === 'payAnnually') ? true : false\r\n this.model.set('isAnnualChecked', this.isAnnualChecked)\r\n }\r\n\r\n})\r\n\r\nmodule.exports = UpdatePlanListView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar sweetAlert = require('sweetalert2')\r\nvar ChoosePlanTemplate = require('settings/subscription/plan-selection/template')\r\nvar ConfirmNewPlanModalWidget = require('settings/subscription/update-plan/confirm-modal/widget')\r\nvar UpdatePlanListView = require('settings/subscription/update-plan/list/view')\r\n\r\nvar AdjustPlanView = Backbone.View.extend({\r\n className: 'subscription block subscription-view-container',\r\n\r\n events: {\r\n 'click .save': 'confirm',\r\n 'click .planListItem': 'selectPlan',\r\n 'click #payMthPeriod': 'refreshPrice',\r\n 'click #payYrPeriod': 'refreshPrice',\r\n 'click .collapse': 'close'\r\n },\r\n\r\n initialize: function () {\r\n this.listenTo(this.model, 'change:planLevels change:subscriptionInfo change:billingInfo change:isSelectedAnnual change:selectedPlanId', this.render.bind(this))\r\n this.listenTo(this.model, 'change:planLevels', this.refreshPrice.bind(this))\r\n this.on('widgetReady', this.render.bind(this))\r\n this.updatePlanListView = new UpdatePlanListView({model: this.model})\r\n this.repopulateCount = 0\r\n },\r\n\r\n render: function () {\r\n this.$el.html(ChoosePlanTemplate(this.createViewModel()))\r\n this.$('.planSelection').append(this.updatePlanListView.render().$el)\r\n\r\n if (!!this.model.get('planLevels') && !!this.model.get('subscriptionInfo')) {\r\n if (!!this.model.get('isSelectedAnnual') && !!this.model.get('selectedPlanId')) {\r\n if (this.repopulateCount === 0) {\r\n this.repopulateConfirmModal()\r\n this.repopulateCount += 1\r\n }\r\n }\r\n }\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (this.model.get('subscriptionInfo')) {\r\n var subscriptionInfo = this.model.get('subscriptionInfo')\r\n var isTrial = subscriptionInfo.isTrial\r\n }\r\n\r\n return {\r\n isTrial: isTrial,\r\n isUpdateView: true,\r\n screenTitle: 'Adjust Your Plan',\r\n postButtonText: 'Confirm'\r\n }\r\n },\r\n\r\n refreshPrice: function () {\r\n var selectedPayPeriod = this.$('input[name=payPeriod]:checked').val()\r\n this.updatePlanListView.refresh(selectedPayPeriod)\r\n },\r\n\r\n confirm: function (event) {\r\n event.preventDefault()\r\n if (!this.validate()) {\r\n console.log('No plan is selected.')\r\n return\r\n }\r\n var id = this.$('.planList').find('.selected-plan').attr('id')\r\n var selectedPayPeriod = this.$('input[name=payPeriod]:checked').val()\r\n\r\n var selectedPlanLevel = _.find(this.model.get('planLevels'), function (plan) {\r\n return plan.id === id\r\n })\r\n\r\n if (this.model.get('subscriptionInfo')) {\r\n var subscriptionInfo = this.model.get('subscriptionInfo')\r\n var isTrial = subscriptionInfo.isTrial\r\n }\r\n\r\n var model = {\r\n isTrial: isTrial,\r\n isAnnual: selectedPayPeriod === 'payAnnually',\r\n selectedPayPeriod: selectedPayPeriod,\r\n planLevel: selectedPlanLevel,\r\n billingInfo: this.model.get('billingInfo')\r\n }\r\n\r\n this.confirmModal(model)\r\n },\r\n\r\n repopulateConfirmModal: function () {\r\n if (!!this.model.get('planLevels') && !!this.model.get('subscriptionInfo')) {\r\n if (!!this.model.get('isSelectedAnnual') && !!this.model.get('selectedPlanId')) {\r\n var subscriptionInfo = this.model.get('subscriptionInfo')\r\n var isTrial = subscriptionInfo.isTrial\r\n\r\n var isAnnual = this.model.get('isSelectedAnnual') !== '0'\r\n var id = this.model.get('selectedPlanId')\r\n var selectedPayPeriod = this.model.get('isSelectedAnnual') === '0' ? 'payMonthly' : 'payAnnually'\r\n\r\n this.$('input[value=' + selectedPayPeriod + ']').prop('checked', true)\r\n this.refreshPrice()\r\n\r\n var planLevel = _.find(this.model.get('planLevels'), function (plan) {\r\n return plan.id === id\r\n })\r\n\r\n var billingInfo = this.model.get('billingInfo')\r\n\r\n var model = {\r\n isTrial: isTrial,\r\n isAnnual: isAnnual,\r\n selectedPayPeriod: selectedPayPeriod,\r\n planLevel: planLevel,\r\n billingInfo: billingInfo\r\n }\r\n\r\n this.confirmModal(model)\r\n }\r\n }\r\n },\r\n\r\n confirmModal: function (model) {\r\n var confirmNewPlanModalWidget = new ConfirmNewPlanModalWidget({model: model})\r\n var $confirmNewPlanModalWidget = confirmNewPlanModalWidget.show()\r\n $('div.content.main').append($confirmNewPlanModalWidget.show())\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n })\r\n\r\n confirmNewPlanModalWidget.on('cancel', function () {\r\n $confirmNewPlanModalWidget.remove()\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n if (!!this.model.get('isSelectedAnnual') && !!this.model.get('selectedPlanId')) {\r\n var paymentInfo = null\r\n ConfirmNewPlanModalWidget.holdCard(paymentInfo)\r\n Backbone.trigger('app:navigate', 'settings/subscription/edit-plan')\r\n } else {\r\n this.render()\r\n this.refreshPrice()\r\n }\r\n }.bind(this))\r\n\r\n confirmNewPlanModalWidget.on('updateBillingInfo', function () {\r\n $confirmNewPlanModalWidget.remove()\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n var selectedPlanId = model.planLevel.id\r\n var isSelectedAnnual = model.selectedPayPeriod === 'payMonthly' ? 0 : 1\r\n\r\n Backbone.trigger('app:navigate', 'settings/subscription/edit-payment-method/' + isSelectedAnnual + '/' + selectedPlanId)\r\n })\r\n\r\n confirmNewPlanModalWidget.on('updateSubscriptionPlan', function (holdingPaymentInfo) {\r\n this.update(holdingPaymentInfo)\r\n $('.updatePlanFinishReview').prop('disabled', true)\r\n }.bind(this))\r\n },\r\n\r\n emptyHoldingPaymentInfo: function () {\r\n var paymentInfo = null\r\n ConfirmNewPlanModalWidget.holdCard(paymentInfo)\r\n },\r\n\r\n confirmModalBtnEnable: function () {\r\n $('.updatePlanFinishReview').prop('disabled', false)\r\n },\r\n\r\n update: function (holdingPaymentInfo) {\r\n if (!this.validate()) {\r\n console.log('No plan is selected.')\r\n return\r\n }\r\n\r\n var id = this.$('.planList').find('.selected-plan').attr('id') || this.model.get('selectedPlanId')\r\n var selectedPayPeriod = this.$('input[name=payPeriod]:checked').val()\r\n\r\n var selectedPlanLevel = _.find(this.model.get('planLevels'), function (plan) {\r\n return plan.id === id\r\n })\r\n\r\n var model = {\r\n isAnnual: !!((selectedPayPeriod === 'payAnnually' && selectedPlanLevel.price !== 0)),\r\n planLevel: {\r\n id: id\r\n }\r\n }\r\n\r\n if (holdingPaymentInfo) {\r\n this.trigger('updatePaymentInfoAndPlan', holdingPaymentInfo, model)\r\n } else {\r\n this.trigger('update', model)\r\n }\r\n },\r\n\r\n selectPlan: function (e) {\r\n e.preventDefault()\r\n var $currentTarget = $(e.currentTarget)\r\n this.$('.selected-plan').removeClass('selected-plan')\r\n var selectedPayPeriod = this.$('input[name=payPeriod]:checked').val()\r\n var currentPayPeriod = !this.model.get('subscriptionInfo').isAnnual ? 'payMonthly' : 'payAnnually'\r\n\r\n if (this.model.get('subscriptionInfo')) {\r\n var subscriptionInfo = this.model.get('subscriptionInfo')\r\n var isTrial = subscriptionInfo.isTrial\r\n var isCurrentPlanPriceZero = this.model.get('subscriptionInfo').planLevel.price === 0\r\n var isNotTrialAndIsPlanPriceZero = !!(!isTrial && isCurrentPlanPriceZero)\r\n }\r\n\r\n if (((this.model.get('subscriptionInfo').planLevelId === $currentTarget.attr('id')) && (selectedPayPeriod === currentPayPeriod) && !isTrial) ||\r\n (!!isNotTrialAndIsPlanPriceZero && (this.model.get('subscriptionInfo').planLevelId === $currentTarget.attr('id')))) {\r\n console.log('You selected the same plan as the current one.')\r\n } else {\r\n $currentTarget.addClass('selected-plan')\r\n }\r\n\r\n this.validate()\r\n },\r\n\r\n validate: function () {\r\n this.hasSelectedPlan = this.$('.planList').find('.planListItem').hasClass('selected-plan') || !!this.model.get('selectedPlanId')\r\n var hasSelectedPayPeriod = this.$('input[name=payPeriod]:checked').val()\r\n\r\n if (!!this.hasSelectedPlan && this.hasSelectedPlan) {\r\n this.$('#continueToBilling').prop('disabled', false)\r\n } else {\r\n this.$('#continueToBilling').prop('disabled', true)\r\n }\r\n\r\n return !!this.hasSelectedPlan && !!hasSelectedPayPeriod\r\n },\r\n\r\n close: function (e) {\r\n e.preventDefault()\r\n Backbone.trigger('app:navigate', 'settings/subscription')\r\n },\r\n\r\n showErrorAlert: function (error) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: error.message,\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n }\r\n\r\n})\r\n\r\nmodule.exports = AdjustPlanView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar Q = require('q')\r\nvar UpdatePlanView = require('settings/subscription/update-plan/view')\r\nvar Service = require('settings/subscription/service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar UpdatePlanWidget = function (isSelectedAnnual, selectedPlanId) {\r\n this.model = new Backbone.Model()\r\n this.view = new UpdatePlanView({\r\n model: this.model\r\n })\r\n\r\n if (!!isSelectedAnnual && !!selectedPlanId) {\r\n this.model.set({'isSelectedAnnual': isSelectedAnnual, 'selectedPlanId': selectedPlanId})\r\n }\r\n this.service = new Service()\r\n this.companyService = new CompanyService()\r\n this.loadDependencies()\r\n\r\n this.on('shown', function () {\r\n this.readyPromise.then(function () {\r\n this.preventLoad = false\r\n this.view.trigger('widgetReady')\r\n }.bind(this))\r\n }.bind(this))\r\n\r\n this.view.on('update', this.updatePlan.bind(this))\r\n this.view.on('updatePaymentInfoAndPlan', this.updateBillingInfoAndPlan.bind(this))\r\n}\r\n\r\nUpdatePlanWidget.prototype = _.clone(Backbone.Events)\r\n\r\nUpdatePlanWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n return this.view.render().el\r\n}\r\n\r\nUpdatePlanWidget.prototype.loadDependencies = function () {\r\n this.readyPromise = Q.all([\r\n this.getPlanLevels(),\r\n this.fetchCompanySubscription(),\r\n this.fetchBillingInfo()\r\n ])\r\n}\r\n\r\nUpdatePlanWidget.prototype.getPlanLevels = function () {\r\n return this.service.fetchPlanLevels().then(function (response) {\r\n this.model.set('planLevels', response)\r\n }.bind(this), function (error) {\r\n console.log('Fail to fetch plan lists. ' + error.message)\r\n })\r\n}\r\n\r\nUpdatePlanWidget.prototype.fetchCompanySubscription = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.service.fetchCompanySubscription(companyId).then(function (response) {\r\n this.model.set('subscriptionInfo', response)\r\n }.bind(this), function (error) {\r\n console.log('Fail to fetch subscription information. ' + error.message)\r\n })\r\n}\r\n\r\nUpdatePlanWidget.prototype.fetchBillingInfo = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.service.fetchBillingInfo(companyId).then(function (response) {\r\n if (response !== false) {\r\n this.model.set('billingInfo', response)\r\n }\r\n }.bind(this), function (error) {\r\n console.log('Fail to fetch billing information. ' + error.message)\r\n })\r\n}\r\n\r\nUpdatePlanWidget.prototype.updatePlan = function (planInfo) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n this.service.updateSubscription(planInfo, companyId).done(function (response) {\r\n this.response = response\r\n this.companyService.updateActiveCompany(companyId).done(function () {\r\n Backbone.trigger('app:navigate', 'settings/subscription')\r\n Backbone.trigger('updatedSubscription')\r\n })\r\n }.bind(this), function (error) {\r\n this.view.showErrorAlert(error)\r\n this.view.confirmModalBtnEnable()\r\n console.log('Fail to update subscription plan. ' + error.message)\r\n }.bind(this))\r\n}\r\n\r\nUpdatePlanWidget.prototype.updateBillingInfo = function (paymentInfo) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.service.updateBillingInfo(paymentInfo, companyId).then(function (response) {\r\n return response\r\n }, function (error) {\r\n this.view.showErrorAlert(error)\r\n this.view.confirmModalBtnEnable()\r\n console.log('Fail to update billing information. ' + error.message)\r\n }.bind(this))\r\n}\r\n\r\nUpdatePlanWidget.prototype.updateBillingInfoAndPlan = function (holdingPaymentInfo, planInfo) {\r\n return this.updateBillingInfo(holdingPaymentInfo).done(function (response) {\r\n return this.fetchBillingInfo().done(function () {\r\n if (response !== undefined && !!response.success) {\r\n this.view.emptyHoldingPaymentInfo()\r\n return this.updatePlan(planInfo)\r\n }\r\n }.bind(this), function (error) {\r\n this.view.confirmModalBtnEnable()\r\n console.log(error.message)\r\n }.bind(this))\r\n }.bind(this), function (error) {\r\n this.view.confirmModalBtnEnable()\r\n console.log(error.message)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = UpdatePlanWidget\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar SubscriptionWizardWidget = require('settings/subscription/wizard/widget')\r\nvar SubscriptionSummaryWidget = require('settings/subscription/summary/widget')\r\n\r\nvar SubscriptionView = Backbone.View.extend({\r\n\r\n initialize: function () {\r\n this.subscriptionWizardWidget = new SubscriptionWizardWidget()\r\n this.subscriptionSummaryWidget = new SubscriptionSummaryWidget()\r\n\r\n this.subscriptionWizardWidget.on('createdSubscription', function () {\r\n $zopim(function () {\r\n $zopim.livechat.endChat()\r\n $zopim.livechat.hideAll()\r\n })\r\n this.refresh.bind(this)\r\n }.bind(this))\r\n this.listenTo(this.model, 'change:isActiveSubscription change:isTrial change:loaded', this.render.bind(this))\r\n Backbone.on('updatedSubscription', function () {\r\n $zopim(function () {\r\n $zopim.livechat.endChat()\r\n $zopim.livechat.hideAll()\r\n })\r\n this.render.bind(this)\r\n }.bind(this))\r\n },\r\n\r\n render: function () {\r\n if (this.model.get('loaded') && this.model.get('isTrial') !== undefined && this.model.get('isActiveSubscription') !== undefined) {\r\n if (!this.model.get('isTrial') && this.model.get('isActiveSubscription')) {\r\n this.$el.empty().append(this.subscriptionSummaryWidget.show())\r\n } else {\r\n this.$el.empty().append(this.subscriptionWizardWidget.show())\r\n }\r\n }\r\n return this\r\n },\r\n\r\n refresh: function () {\r\n this.subscriptionSummaryWidget.refresh()\r\n this.trigger('refresh')\r\n }\r\n})\r\n\r\nmodule.exports = SubscriptionView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar SubscriptionView = require('settings/subscription/view')\r\nvar SubscriptionService = require('settings/subscription/service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar SubscriptionWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.service = new SubscriptionService()\r\n this.companyService = new CompanyService()\r\n this.view = new SubscriptionView({\r\n model: this.model\r\n })\r\n this.view.on('refresh', this.refresh.bind(this))\r\n}\r\n\r\nSubscriptionWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n this.getActiveCompanyInfo()\r\n return this.view.render().$el\r\n}\r\n\r\nSubscriptionWidget.prototype.getActiveCompanyInfo = function () {\r\n var activeCompanyId = this.companyService.getActiveCompanyId()\r\n this.model.set('loaded', false)\r\n this.companyService.fetchCompany(activeCompanyId).then(function (response) {\r\n this.model.set({\r\n isActiveSubscription: response.get('activeSubscription'),\r\n isTrial: response.get('isTrial')\r\n })\r\n this.model.set('loaded', true)\r\n }.bind(this))\r\n}\r\n\r\nSubscriptionWidget.prototype.refresh = function () {\r\n this.getActiveCompanyInfo()\r\n}\r\nmodule.exports = SubscriptionWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3>\"\n + alias4(((helper = (helper = helpers.screenTitle || (depth0 != null ? depth0.screenTitle : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"screenTitle\",\"hash\":{},\"data\":data}) : helper)))\n + \"</h3>\\r\\n</div>\\r\\n\\r\\n<div class=\\\"block-content col-xs-12 confirmContainer\\\">\\r\\n <p>Here is a summary of your new subscription.</p>\\r\\n\\r\\n <div>\\r\\n <span><b>Subscription:</b></span>\\r\\n <span>\"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)))\n + \" Plan</span>\\r\\n </div>\\r\\n \\r\\n <div>\\r\\n <span><b>Rate:</b></span>\\r\\n <span>$\"\n + alias4(((helper = (helper = helpers.price || (depth0 != null ? depth0.price : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"price\",\"hash\":{},\"data\":data}) : helper)))\n + \"</span> per \\r\\n <span>month</span>\\r\\n </div>\\r\\n \\r\\n <div>\\r\\n <span><b>Billing Method:</b></span>\\r\\n <span>None Required</span>\\r\\n </div> \\r\\n \\r\\n <div class=\\\"col-xs-12 no-padding action\\\">\\r\\n <button class=\\\"btn btn-primary newPlanFinishReview\\\" type=\\\"button\\\">Done</button>\\r\\n </div>\\r\\n</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar ConfirmNewPlanModalTemplate = require('settings/subscription/wizard/confirm-modal/template')\r\nvar sweetAlert = require('sweetalert2')\r\nvar Service = require('settings/subscription/service')\r\n\r\nvar NewPlanConfirmView = Backbone.View.extend({\r\n className: 'block new-plan-confirmation-modal z-1',\r\n\r\n events: {\r\n 'click .collapse': 'cancel',\r\n 'click .newPlanFinishReview': 'confirm'\r\n },\r\n \r\n initialize: function () {\r\n this.service = new Service()\r\n },\r\n \r\n render: function () {\r\n this.$el.html(ConfirmNewPlanModalTemplate(this.createViewModel()))\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n if (!!this.model.get('planInfo')) {\r\n var planInfo = this.model.get('planInfo').model\r\n return {\r\n screenTitle: 'Your new plan',\r\n name: planInfo.planLevel.name, \r\n price: planInfo.planLevel.price \r\n }\r\n }\r\n },\r\n \r\n confirm: function (event) {\r\n event.preventDefault()\r\n\r\n this.trigger('subscriptionPay')\r\n },\r\n \r\n validate: function () {\r\n var hasSelectedPlan = this.$('.planList').find('.planListItem').hasClass('selected-plan')\r\n var hasSelectedPayPeriod = this.$('input[name=payPeriod]:checked').val()\r\n return !!hasSelectedPlan && !!hasSelectedPayPeriod\r\n },\r\n \r\n cancel: function (e) {\r\n this.trigger('cancel')\r\n } \r\n})\r\n\r\nmodule.exports = NewPlanConfirmView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar ConfirmNewPlanModalView = require('settings/subscription/wizard/confirm-modal/view')\r\nvar Service = require('settings/subscription/service')\r\n\r\nvar ConfirmNewPlanModalWidget = function (planInfo) {\r\n this.model = new Backbone.Model()\r\n this.model.set('planInfo', planInfo)\r\n\r\n this.view = new ConfirmNewPlanModalView({\r\n model: this.model\r\n })\r\n this.service = new Service()\r\n this.view.on('cancel', function () {\r\n this.trigger('cancel')\r\n }, this)\r\n this.view.on('subscriptionPay', function () {\r\n this.trigger('subscriptionPay')\r\n }, this)\r\n}\r\n\r\nConfirmNewPlanModalWidget.prototype = _.clone(Backbone.Events)\r\n\r\nConfirmNewPlanModalWidget.prototype.show = function () {\r\n var $el = this.view.render().$el\r\n this.view.delegateEvents()\r\n\r\n return $el\r\n}\r\n\r\nmodule.exports = ConfirmNewPlanModalWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('settings/subscription/wizard/template')\r\nvar $ = require('jquery')\r\nvar _ = require('lodash')\r\nvar sweetAlert = require('sweetalert2')\r\nvar Backbone = require('backbone')\r\nvar Service = require('settings/subscription/service')\r\n\r\nvar SelectPlanView = require('settings/subscription/plan-selection/view')\r\nvar BillingInfoView = require('settings/subscription/billing-info/view')\r\n\r\nvar BulletsTemplate = require('forms/bullets')\r\nvar ConfirmNewPlanModalWidget = require('settings/subscription/wizard/confirm-modal/widget')\r\n\r\nvar SubscriptionView = CreateView.extend({\r\n className: 'subscription block',\r\n\r\n events: {\r\n 'click .bullet': 'clickBullet'\r\n },\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.service = new Service()\r\n\r\n this.listenTo(this.model, 'change:planLevels', this.render.bind(this))\r\n\r\n var selectPlanView = new SelectPlanView({model: this.model})\r\n var billingInfoView = new BillingInfoView({model: this.model})\r\n\r\n this.views = [\r\n {\r\n name: 'selectPlan',\r\n label: '',\r\n view: selectPlanView,\r\n events: {'continueToBilling': this.selectedPlanInfo.bind(this)},\r\n nextOn: 'continueToBilling'\r\n },\r\n {\r\n name: 'billingInfo',\r\n label: '',\r\n view: billingInfoView,\r\n events: {\r\n 'payNow': this.payNow.bind(this)\r\n },\r\n isReady: function () {\r\n return !!this.$('.planList').find('.planListItem').hasClass('selected-plan') && !!this.$('input[name=payPeriod]:checked').val() && this.planInfo.planLevel.price !== 0\r\n }.bind(this),\r\n backOn: 'back'\r\n }\r\n ]\r\n\r\n // Transform the events to trigger callbacks on the view's events.\r\n // If there is a nextOn entry, the view should transition to the next view upon\r\n // the nextOn trigger being executed.\r\n _.each(this.views, function (viewEntry) {\r\n _.each(viewEntry.events, function (callback, name) {\r\n viewEntry.view.on(name, callback)\r\n })\r\n\r\n var currentIndex = this.views.indexOf(viewEntry)\r\n\r\n if (viewEntry.nextOn) {\r\n viewEntry.view.on(viewEntry.nextOn, this.showChild.bind(this, this.views[currentIndex + 1]))\r\n }\r\n if (viewEntry.backOn) {\r\n viewEntry.view.on(viewEntry.backOn, this.showChild.bind(this, this.views[currentIndex - 1]))\r\n }\r\n }.bind(this))\r\n\r\n this.on('createdSubscription', this.createdSubscription.bind(this))\r\n },\r\n\r\n selectedPlanInfo: function (planInfo) {\r\n this.planInfo = planInfo\r\n this.model.set('planInfo', this.planInfo)\r\n\r\n if (this.planInfo.planLevel.price === 0) {\r\n this.confirmModal(this.planInfo)\r\n }\r\n },\r\n\r\n confirmModal: function (model) {\r\n var confirmNewPlanModalWidget = new ConfirmNewPlanModalWidget({model: model})\r\n var $confirmNewPlanModalWidget = confirmNewPlanModalWidget.show()\r\n $('div.content.main').append($confirmNewPlanModalWidget.show())\r\n $('.overlay').css({\r\n display: 'block',\r\n opacity: 1\r\n })\r\n\r\n confirmNewPlanModalWidget.on('cancel', function () {\r\n $confirmNewPlanModalWidget.remove()\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n this.render()\r\n }.bind(this))\r\n\r\n confirmNewPlanModalWidget.on('subscriptionPay', function () {\r\n $confirmNewPlanModalWidget.remove()\r\n $('.overlay').css({\r\n display: 'none',\r\n opacity: 0\r\n })\r\n this.trigger('subscriptionPay', this.planInfo, this)\r\n }.bind(this))\r\n },\r\n\r\n payNow: function (paymentInformation) {\r\n this.planInfo.paymentInformation = paymentInformation\r\n\r\n this.trigger('subscriptionPay', this.planInfo, this)\r\n },\r\n\r\n createdSubscription: function (response) {\r\n Backbone.trigger('app:navigate', 'settings/subscription')\r\n },\r\n\r\n onRender: function () {\r\n this.$el.html('')\r\n // Render all of the views in a hidden container, that way\r\n // if the user goes back and forth, the data will still be there.\r\n _.each(this.views, function (viewEntry) {\r\n var $container = $('<div />')\r\n .addClass('hidden subscription-view-container')\r\n .html(viewEntry.view.render().$el)\r\n .attr('name', viewEntry.name)\r\n\r\n viewEntry.view.delegateEvents()\r\n\r\n this.$el.append($container)\r\n }.bind(this))\r\n\r\n this.showChild(this.views[0])\r\n },\r\n\r\n clickBullet: function (e) {\r\n var $currentTarget = this.$(e.currentTarget)\r\n var bulletName = $currentTarget.attr('name')\r\n var viewEntry = _.find(this.views, {name: bulletName})\r\n this.showChild(viewEntry)\r\n },\r\n\r\n showChild: function (viewEntry) {\r\n var view = viewEntry.view\r\n\r\n // Check if there's a callback to see if the view is ready\r\n // If there is a callback and it returns false, return out and don't do anything else.\r\n if (viewEntry.isReady && !viewEntry.isReady()) {\r\n return\r\n }\r\n\r\n this.$('.subscription-view-container').addClass('hidden')\r\n this.$('.subscription-view-container[name=\"' + viewEntry.name + '\"]').removeClass('hidden')\r\n\r\n this.$('.bullets').remove()\r\n this.$('.block-header').append(BulletsTemplate({\r\n classes: 'pull-right',\r\n bullets: this.getBullets(viewEntry)\r\n }))\r\n\r\n view.delegateEvents()\r\n },\r\n\r\n getBullets: function (currentView) {\r\n return _.map(this.views, function (entry) {\r\n return {\r\n label: entry.label,\r\n classes: currentView === entry ? 'current' : '',\r\n name: entry.name\r\n }\r\n })\r\n },\r\n\r\n toJSON: function () {\r\n var model = {}\r\n\r\n _.each(this.$('input:not([type=file]), textarea, select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n this.$('.error-message').addClass('hidden')\r\n this.$('input[type=password]').val('')\r\n\r\n return model\r\n },\r\n\r\n btnEnable: function () {\r\n $('#paySubmitButton').prop('disabled', false)\r\n },\r\n\r\n showErrorAlert: function (error) {\r\n sweetAlert({\r\n title: 'Error',\r\n text: error.message,\r\n confirmButtonColor: '#19aea6',\r\n type: 'error'\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = SubscriptionView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar _ = require('lodash')\r\nvar Q = require('q')\r\n\r\nvar Model = require('lists/list/item/entry')\r\nvar View = require('settings/subscription/wizard/view')\r\nvar Service = require('settings/subscription/service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar SubscriptionWidget = function () {\r\n this.service = new Service()\r\n this.companyService = new CompanyService()\r\n\r\n var activeCompanyInfo = this.companyService.getActiveCompanyInfo()\r\n\r\n this.model = new Model({\r\n hasPartner: activeCompanyInfo.partnerType !== null && activeCompanyInfo.partnerType !== 0\r\n })\r\n\r\n this.view = new View({\r\n model: this.model\r\n })\r\n\r\n this.view.on('subscriptionPay', this.createSubscription.bind(this))\r\n}\r\n\r\nSubscriptionWidget.prototype = _.clone(Backbone.Events)\r\n\r\nSubscriptionWidget.prototype.show = function () {\r\n this.getPlanLevels()\r\n return this.view.render().$el\r\n}\r\n\r\nSubscriptionWidget.prototype.getPlanLevels = function () {\r\n this.service.fetchPlanLevels().then(function (response) {\r\n this.model.set('planLevels', response)\r\n }.bind(this), function () {\r\n console.log('Fail to fetch plan lists.')\r\n })\r\n}\r\n\r\nSubscriptionWidget.prototype.createSubscription = function (paymentInfo) {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n return this.service.createSubscription(paymentInfo, companyId).done(function (response) {\r\n this.response = response\r\n this.companyService.updateActiveCompany(companyId).done(function () {\r\n this.view.trigger('createdSubscription')\r\n this.trigger('createdSubscription')\r\n }.bind(this))\r\n }.bind(this), function (error) {\r\n this.view.showErrorAlert(error)\r\n this.view.btnEnable()\r\n console.log('Fail to create the subscription.')\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = SubscriptionWidget\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return \" <div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right collapse\\\"></i>\\r\\n <h3>Add New User</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div>\\r\\n <form>\\r\\n <div class=\\\"meta\\\">\\r\\n\"\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"First Name\",\"inputName\":\"firstName\",\"wrapperClasses\":\"first-name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Last Name\",\"inputName\":\"lastName\",\"wrapperClasses\":\"last-name\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + ((stack1 = container.invokePartial(partials.floatingInput,depth0,{\"name\":\"floatingInput\",\"hash\":{\"inputLabel\":\"Email Address\",\"inputName\":\"email\",\"wrapperClasses\":\"email\"},\"data\":data,\"indent\":\" \",\"helpers\":helpers,\"partials\":partials,\"decorators\":container.decorators})) != null ? stack1 : \"\")\n + \" </div>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Save User</button>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\">Users must have a name.</span></div>\\r\\n </div>\\r\\n </form>\\r\\n </div>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"usePartial\":true,\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('lists/list/create/view')\r\nvar Template = require('settings/users/create/template')\r\nvar _ = require('lodash')\r\nvar SessionService = require('session/session-service')\r\n\r\nvar CreateUserView = CreateView.extend({\r\n className: 'block create',\r\n\r\n // We want to re-use the pre-existing events already implemented for us\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'change input[type=file]': 'selectFile',\r\n 'keyup input': 'determineStatus',\r\n 'keyup textarea': 'determineStatus',\r\n 'click': 'expand'\r\n }),\r\n\r\n // Set the template so rendering can be handled behind the scenes\r\n initialize: function () {\r\n if (!this.Template) {\r\n this.Template = Template\r\n }\r\n\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n // Rendering is already handled in the base class, but we still have to do some work on our end\r\n onRender: function () {\r\n this.determineStatus()\r\n },\r\n\r\n isValid: function () {\r\n var email = this.$('input[name=email]').val()\r\n var emailRegex = /.+@.+/\r\n var isSelf = (email || '').toLowerCase() === (SessionService.getEmail() || '').toLowerCase()\r\n return !!email && !isSelf && email.match(emailRegex)\r\n },\r\n\r\n determineStatus: function () {\r\n var errorMessage\r\n if (this.isValid()) {\r\n this.$('.status').html(this.getSuccessStatusBar('User is valid.'))\r\n } else {\r\n errorMessage = 'User needs to have a valid email address.'\r\n }\r\n\r\n if (errorMessage) {\r\n this.$('.status').html(this.getErrorStatusBar(errorMessage))\r\n }\r\n },\r\n\r\n // This is a method used by the base class when a form is submitted on this view\r\n toJSON: function () {\r\n var model = { }\r\n\r\n if (!this.isValid()) {\r\n throw new Error('The user must have a valid email')\r\n }\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n\r\n model[$el.attr('name')] = elValue\r\n })\r\n\r\n return model\r\n }\r\n})\r\n\r\nmodule.exports = CreateUserView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"style=\\\"background-image:url('\"\n + container.escapeExpression(((helper = (helper = helpers.picture || (depth0 != null ? depth0.picture : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"picture\",\"hash\":{},\"data\":data}) : helper)))\n + \"');\\\" \";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \"<span>You</span>\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing;\n\n return ((stack1 = helpers[\"if\"].call(alias1,(helpers.or || (depth0 && depth0.or) || alias2).call(alias1,(helpers.equal || (depth0 && depth0.equal) || alias2).call(alias1,(depth0 != null ? depth0.activeUserRole : depth0),3,{\"name\":\"equal\",\"hash\":{},\"data\":data}),(helpers.equal || (depth0 && depth0.equal) || alias2).call(alias1,(depth0 != null ? depth0.activeUserRole : depth0),2,{\"name\":\"equal\",\"hash\":{},\"data\":data}),{\"name\":\"or\",\"hash\":{},\"data\":data}),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(6, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"6\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return ((stack1 = helpers[\"if\"].call(alias1,(helpers.ne || (depth0 && depth0.ne) || helpers.helperMissing).call(alias1,(depth0 != null ? depth0.role : depth0),3,{\"name\":\"ne\",\"hash\":{},\"data\":data}),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(7, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\");\n},\"7\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \" <a class=\\\"fa fa-trash-o pull-right remove\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n <a class=\\\"fa fa-pencil pull-right edit\\\" data-id=\\\"\"\n + alias4(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"id\",\"hash\":{},\"data\":data}) : helper)))\n + \"\\\"></a>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3=\"function\", alias4=container.escapeExpression;\n\n return \"<div class=\\\"avatar\\\"><div \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.hasPicture : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"></div></div>\\r\\n<div class=\\\"name\\\">\"\n + alias4(((helper = (helper = helpers.firstName || (depth0 != null ? depth0.firstName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"firstName\",\"hash\":{},\"data\":data}) : helper)))\n + \" \"\n + alias4(((helper = (helper = helpers.lastName || (depth0 != null ? depth0.lastName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"lastName\",\"hash\":{},\"data\":data}) : helper)))\n + \" \"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.isSelf : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n<div class=\\\"email\\\">\"\n + alias4(((helper = (helper = helpers.email || (depth0 != null ? depth0.email : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"email\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"role\\\">\"\n + alias4(((helper = (helper = helpers.roleTitle || (depth0 != null ? depth0.roleTitle : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"roleTitle\",\"hash\":{},\"data\":data}) : helper)))\n + \"</div>\\r\\n<div class=\\\"actions\\\">\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isSelf : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(5, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"</div>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar ListEntry = require('lists/list/item/entry')\r\nvar SessionService = require('session/session-service')\r\n\r\nvar Role = Object.freeze({\r\n 0: 'Bookkeeper',\r\n 1: 'Accountant',\r\n 2: 'Manager',\r\n 3: 'Business Owner'\r\n})\r\n\r\nvar User = ListEntry.extend({ }, {\r\n parse: function (json) {\r\n return new User({\r\n id: json.id,\r\n email: json.email,\r\n firstName: json.firstName,\r\n lastName: json.lastName,\r\n phoneNumber: json.phoneNumber,\r\n roleTitle: Role[json.role],\r\n role: json.role,\r\n isSelf: (json.email || '').toLowerCase() === (SessionService.getEmail() || '').toLowerCase(),\r\n picture: json.picture,\r\n hasPicture: json.picture !== null\r\n })\r\n }\r\n})\r\n\r\nmodule.exports = User\r\n","var ItemView = require('lists/list/item/view')\r\nvar Template = require('settings/users/item/template')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar UserView = ItemView.extend({\r\n initialize: function () {\r\n this.Template = Template\r\n this.companyService = new CompanyService()\r\n ItemView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n onRender: function () {\r\n this.$el.html(this.Template(this.createViewModel()))\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n var activeCompanyInfo = this.companyService.getActiveCompanyInfo()\r\n return {\r\n activeUserRole: activeCompanyInfo.role,\r\n id: this.model.get('id'),\r\n email: this.model.get('email'),\r\n firstName: this.model.get('firstName'),\r\n lastName: this.model.get('lastName'),\r\n roleTitle: this.model.get('roleTitle'),\r\n role: this.model.get('role'),\r\n isSelf: this.model.get('isSelf'),\r\n picture: this.model.get('picture'),\r\n hasPicture: this.model.get('hasPicture')\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = UserView\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"pull-left\\\">Users</h3>\\r\\n </div>\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"table table-hover table-borderless list\\\">\\r\\n <div class=\\\"head flex\\\">\\r\\n <div class=\\\"avatar\\\"></div>\\r\\n <div class=\\\"name\\\">Name</div>\\r\\n <div class=\\\"email\\\">Email Address</div>\\r\\n <div class=\\\"role\\\">Role</div>\\r\\n <div class=\\\"actions\\\"> </div>\\r\\n </div>\\r\\n <div class=\\\"infinity\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"infinite-scrolling-indicator itemrow\\\"><p class=\\\"center\\\">Loading more users...</p></div>\\r\\n </div>\\r\\n\";\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <div class=\\\"block-header\\\">\\r\\n <h3 class=\\\"screenTitle\\\">Cannot manage users.</h3>\\r\\n <p class=\\\"titleHelpText\\\">Educational users are unable to create new accounts. Please speak with your administrator.</p>\\r\\n </div>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.program(3, data, 0),\"data\":data})) != null ? stack1 : \"\");\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var ListView = require('lists/list/list/view')\r\nvar Template = require('settings/users/list/template')\r\nvar UserView = require('settings/users/item/view')\r\nvar UpdateView = require('settings/users/update/view')\r\nvar _ = require('lodash')\r\nvar $ = require('jquery')\r\n\r\nvar UsersView = ListView.extend({\r\n className: 'block listing',\r\n\r\n events: _.extend(_.clone(ListView.prototype.events), {\r\n 'click .sort-toggle': 'toggleSort',\r\n 'keyup .search-box': 'searchList',\r\n 'click .clear-search-box': 'clearSearch'\r\n }),\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n this.childView = UserView\r\n this.model.set('search', '')\r\n this.model.set('sort', 'asc')\r\n this.model.set('sortField', 'email')\r\n this.model.set('userId-sort', 'asc')\r\n ListView.prototype.initialize.apply(this, arguments)\r\n\r\n this.on('delete', this.showDelete.bind(this))\r\n this.on('showEdit', this.showEdit.bind(this))\r\n },\r\n\r\n showLoadingMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('Loading more users...')\r\n },\r\n\r\n showNoMore: function (page) {\r\n this.$('.infinite-scrolling-indicator p').text('No more users.')\r\n },\r\n\r\n showDelete: function (userId) {\r\n this.showConfirmationMessage(this.$('.itemrow[data-id=\"' + userId + '\"]'), 'Are you sure you want to remove this user from your company?', 'confirmDelete', userId)\r\n },\r\n\r\n showEdit: function (model) {\r\n var $lineItem = this.$('.itemrow[data-id=\"' + model.id + '\"]')\r\n var update = new UpdateView({model: model})\r\n update.on('update', function () {\r\n var args = Array.prototype.slice.call(arguments)\r\n args.unshift('update')\r\n this.trigger.apply(this, args)\r\n }, this)\r\n\r\n this.showChildView(update, $lineItem, false)\r\n },\r\n\r\n toggleSort: function (e) {\r\n var $currentTarget = $(e.currentTarget)\r\n var sortField = $currentTarget.attr('data-sort-field')\r\n var sortMode = _.find(['fa-sort-desc', 'fa-sort-asc'], function (className) { return !$currentTarget.hasClass(className) }).substr(8)\r\n\r\n this.model.unset('userId-sort')\r\n this.model.unset('name-sort')\r\n this.model.unset('printedName-sort')\r\n\r\n this.model.set(sortField + '-sort', sortMode)\r\n\r\n this.model.set({\r\n page: 1,\r\n sortField: sortField,\r\n sort: sortMode\r\n }, {silent: true})\r\n\r\n this.model.reset()\r\n }\r\n})\r\n\r\nmodule.exports = UsersView\r\n","'use strict'\r\n\r\nvar Config = require('config/config')\r\nvar _ = require('lodash')\r\nvar GenericListsService = require('lists/list/service')\r\n\r\nvar UsersService = function () {\r\n GenericListsService.apply(this, arguments)\r\n}\r\n\r\nUsersService.prototype = _.clone(GenericListsService.prototype)\r\n\r\nUsersService.prototype.GetPath = function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n\r\n var actionPathElements = [\r\n Config['CRUNCHED_API_HOST'],\r\n 'companies',\r\n companyId,\r\n 'users'\r\n ]\r\n\r\n actionPathElements = _.concat(actionPathElements, arguments)\r\n\r\n return actionPathElements.join('/')\r\n}\r\n\r\nUsersService.prototype.create = function (modelData) {\r\n var apiPath = this.GetPath('invitations')\r\n return this.restClient.post(apiPath, modelData)\r\n}\r\n\r\nUsersService.prototype.update = function (modelId, modelData) {\r\n var apiPath = this.GetPath(modelId)\r\n return this.restClient.put(apiPath, modelData)\r\n}\r\n\r\nUsersService.prototype.get = function (modelId) {\r\n var apiPath = this.GetPath()\r\n return this.restClient.get(apiPath).then(function (response) {\r\n response = _.find(response.collection, function (user) {\r\n return user.id === modelId\r\n })\r\n return response\r\n })\r\n}\r\n\r\nmodule.exports = UsersService\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \"<div class=\\\"block-header\\\">\\r\\n <i class=\\\"fa fa-close pull-right cancel\\\"></i>\\r\\n <h3>Update User</h3>\\r\\n</div>\\r\\n<div class=\\\"block-content\\\">\\r\\n <div class=\\\"meta\\\">\\r\\n <div class=\\\"form-group picture\\\">\\r\\n <div style=\\\"background-image:url('\"\n + container.escapeExpression(((helper = (helper = helpers.picture || (depth0 != null ? depth0.picture : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"picture\",\"hash\":{},\"data\":data}) : helper)))\n + \"');\\\"></div>\\r\\n </div>\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"id\\\" name=\\\"name\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"name\\\">Name</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDownn field-validation-valid\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <input class=\\\"form-control\\\" type=\\\"text\\\" id=\\\"id\\\" name=\\\"email\\\" value=\\\"\\\">\\r\\n <label class=\\\"control-label\\\" for=\\\"email\\\">Email Address</label>\\r\\n </div>\\r\\n <span class=\\\"text-danger help-block text-right animated fadeInDownn field-validation-valid\\\"></span>\\r\\n </div>\\r\\n <div class=\\\"form-group\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <select class=\\\"form-control\\\" id=\\\"role\\\" name=\\\"role\\\" size=\\\"1\\\">\\r\\n <option value=\\\"0\\\">Bookkeeper</option>\\r\\n <option value=\\\"1\\\">Accountant</option>\\r\\n <option value=\\\"2\\\">Manager</option>\\r\\n </select>\\r\\n <label for=\\\"role-select\\\">Role</label>\\r\\n </div>\\r\\n </div> \\r\\n </div>\\r\\n <button class=\\\"btn btn-primary pull-right save save-button\\\">Update User</button>\\r\\n <div class=\\\"status\\\">\\r\\n <div class=\\\"bg-danger-light\\\" style=\\\"display: block;\\\"><i class=\\\"fa fa-exclamation-circle fa-2x fa-inverse\\\"></i><span class=\\\"message\\\"><!--Validation Message--></span></div>\\r\\n </div>\\r\\n</div>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","var CreateView = require('settings/users/create/view')\r\nvar Template = require('settings/users/update/template')\r\nvar _ = require('lodash')\r\n\r\nvar UpdateView = CreateView.extend({\r\n className: 'block update expanded has-animation fadeInDown',\r\n\r\n initialize: function () {\r\n this.Template = Template\r\n CreateView.prototype.initialize.apply(this, arguments)\r\n },\r\n\r\n events: _.extend(_.clone(CreateView.prototype.events), {\r\n 'click .save': 'update'\r\n }),\r\n\r\n onRender: function () {\r\n // Fill in inputs with our data\r\n var model = this.model.toViewModel()\r\n this.$('input[name=name]').attr('disabled', true).css('color', '#c5c5c5')\r\n this.$('input[name=email]').attr('disabled', true).css('color', '#c5c5c5')\r\n\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n if (isCheckbox) {\r\n $el.prop('checked', model[$el.attr('name')])\r\n } else {\r\n $el.val(model[$el.attr('name')])\r\n }\r\n })\r\n\r\n this.$('input[name=name]').val(model['firstName'] + ' ' + model['lastName'])\r\n\r\n this.$('[data-toggle=\"tooltip\"], .js-tooltip').tooltip({\r\n container: 'body',\r\n animation: false\r\n })\r\n\r\n CreateView.prototype.onRender.apply(this, arguments)\r\n },\r\n\r\n toJSON: function () {\r\n var model = { }\r\n var id = this.model.get('id')\r\n _.each(this.$('.meta input:not([type=file]), .meta textarea, .meta select'), function (el) {\r\n var $el = this.$(el)\r\n\r\n var isCheckbox = $el.attr('type') === 'checkbox'\r\n var elValue = isCheckbox ? !!$el.prop('checked') : $el.val()\r\n model[$el.attr('name')] = elValue\r\n })\r\n model['id'] = id\r\n\r\n return model\r\n },\r\n\r\n update: function (e) {\r\n e.preventDefault()\r\n\r\n var model = this.toJSON()\r\n var id = model['id']\r\n if (id) {\r\n this.$('.save').prop('disabled', true)\r\n this.trigger('update', id, model)\r\n }\r\n }\r\n})\r\n\r\nmodule.exports = UpdateView\r\n","'use strict'\r\n\r\nvar User = require('settings/users/item/user')\r\nvar ListWrapper = require('lists/list/list')\r\n\r\nvar Users = ListWrapper.extend({\r\n childModel: User\r\n})\r\n\r\n\r\nmodule.exports = Users\r\n","var Config = require('config/config')\r\nvar ListContainer = require('lists/list/view')\r\nvar ListView = require('settings/users/list/view')\r\nvar CreateView = require('settings/users/create/view')\r\nvar sweetAlert = require('sweetalert2')\r\nvar CompanyService = require('company/company-service')\r\nvar SubscriptionService = require('settings/subscription/service')\r\n\r\nvar UsersView = ListContainer.extend({\r\n className: 'users list',\r\n\r\n initialize: function () {\r\n ListContainer.prototype.initialize.apply(this, arguments)\r\n this.companyService = new CompanyService()\r\n this.subscriptionService = new SubscriptionService()\r\n\r\n this.model.set('isEducationalLicense', Config['IS_EDUCATIONAL_LICENSE'])\r\n this.listView = new ListView({model: this.model})\r\n this.forwardEvents(this.listView)\r\n\r\n this.initializeCreateView()\r\n\r\n this.on('created', function () {\r\n this.createView.trigger('resetInputs')\r\n sweetAlert({\r\n title: 'Success',\r\n text: 'Your invite has been sent out!',\r\n type: 'success',\r\n confirmButtonColor: '#19aea6',\r\n confirmButtonText: 'OK'\r\n })\r\n }.bind(this))\r\n\r\n this.on('details', function (model) {\r\n this.listView.trigger('showDetails', model)\r\n }.bind(this))\r\n\r\n this.on('editDetails', function (model) {\r\n console.log('container -> editDetails')\r\n this.listView.trigger('showEdit', model)\r\n }.bind(this))\r\n\r\n this.on('widgetShown', function () {\r\n this.listView.trigger('bindScroll')\r\n }.bind(this))\r\n\r\n this.on('loadedPage', function (resultCount) {\r\n this.listView.trigger('checkIfNeedsNextPage', resultCount)\r\n }.bind(this))\r\n },\r\n\r\n initializeCreateView: function () {\r\n var activeCompanyInfo = this.companyService.getActiveCompanyInfo()\r\n var hasActiveSubscription = activeCompanyInfo.activeSubscription\r\n var activeSubscriptionInfo = this.subscriptionService.getActiveSubscriptionInfo()\r\n\r\n if (hasActiveSubscription && (activeSubscriptionInfo.planLevel.name !== 'Free' && activeSubscriptionInfo.planLevel.price !== 0)) {\r\n this.createView = new CreateView({model: this.model})\r\n this.forwardEvents(this.createView)\r\n }\r\n },\r\n\r\n render: function () {\r\n // Empty out any existing contents\r\n this.$el.html('')\r\n var activeCompanyInfo = this.companyService.getActiveCompanyInfo()\r\n\r\n if (this.createView != undefined && (activeCompanyInfo.role === 3 || activeCompanyInfo.role === 2)) {\r\n this.$el.append(this.createView.render().$el)\r\n this.$el.append(this.listView.render().$el)\r\n } else {\r\n this.$el.append(this.listView.render().$el)\r\n }\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = UsersView\r\n","'use strict'\r\n\r\nvar _ = require('lodash')\r\nvar GenericListWidget = require('lists/list/widget')\r\n\r\nvar Users = require('settings/users/users')\r\nvar Service = require('settings/users/service')\r\nvar ListContainer = require('settings/users/view')\r\n\r\nvar UsersWidget = function () {\r\n this.service = new Service()\r\n this.modelType = Users\r\n this.viewType = ListContainer\r\n\r\n try {\r\n GenericListWidget.apply(this, arguments)\r\n } catch (ex) {\r\n console.warn(ex.message)\r\n throw ex\r\n }\r\n}\r\n\r\nUsersWidget.prototype = _.clone(GenericListWidget.prototype)\r\n\r\nmodule.exports = UsersWidget\r\n","var __templateData = Handlebars.template({\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n return \"<i class=\\\"fa fa-3x fa-cog fa-spin spinner-image\\\"></i>\\r\\n\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Template = require('spinner/template')\r\n\r\nvar SpinnerView = Backbone.View.extend({\r\n className: 'spinner',\r\n \r\n render: function () {\r\n this.$el.html(Template())\r\n\r\n return this\r\n }\r\n})\r\n\r\nmodule.exports = SpinnerView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Router = require('router')\r\nvar SessionService = require('session/session-service')\r\nvar WelcomeWidget = require('welcome/widget')\r\n\r\nvar WelcomeRouter = Router.extend({\r\n routes: {\r\n 'welcome': 'showWelcome'\r\n },\r\n\r\n showWelcome: function () {\r\n Backbone.trigger('app:showInFrame', new WelcomeWidget())\r\n Backbone.trigger('app:updateTitle', 'Welcome', '')\r\n Backbone.trigger('app:updateBreadcrumb', [{label: 'Welcome'}, {label: 'Welcome', href: '/welcome'}])\r\n }\r\n})\r\n\r\nmodule.exports = WelcomeRouter\r\n","var __templateData = Handlebars.template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return \", \"\n + container.escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === \"function\" ? helper.call(depth0 != null ? depth0 : {},{\"name\":\"name\",\"hash\":{},\"data\":data}) : helper)));\n},\"3\":function(container,depth0,helpers,partials,data) {\n return \" <p>Choose from a template, import existing, or create your own</p>\\r\\n\";\n},\"5\":function(container,depth0,helpers,partials,data) {\n return \" <p>Add all of your institution's accounts</p>\\r\\n\";\n},\"compiler\":[7,\">= 4.0.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, alias1=depth0 != null ? depth0 : {};\n\n return \"<div class=\\\"block\\\">\\r\\n <div class=\\\"block-content\\\">\\r\\n <div class=\\\"col-xs-12 col-md-12 col-lg-12\\\">\\r\\n <form class=\\\"form-material\\\" role=\\\"form\\\">\\r\\n \\r\\n <div class=\\\"form-group no-padding welcomeText1\\\">\\r\\n <p>Welcome to Crunched\"\n + ((stack1 = helpers[\"if\"].call(alias1,(depth0 != null ? depth0.name : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data})) != null ? stack1 : \"\")\n + \"!</p>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"form-group no-padding welcomeText2\\\">\\r\\n <p>To make setup as quick as possible, we will be guiding you through <br />the following <b>three</b> steps. You will need to know:</p>\\r\\n </div> \\r\\n \\r\\n <div class=\\\"form-group no-padding textItem\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <i class=\\\"fa fa-check-circle\\\"></i> \\r\\n <p>General Business Profile</p>\\r\\n <p>Provide general business information that will show on invoices, checks, etc.</p>\\r\\n </div>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"form-group no-padding textItem\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <i class=\\\"fa fa-check-circle\\\"></i>\\r\\n <p>Accounting method and year-end setup</p>\\r\\n <p>Select cash or accrual and set your year-end date</p>\\r\\n </div>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"form-group no-padding textItem\\\">\\r\\n <div class=\\\"form-material floating\\\">\\r\\n <i class=\\\"fa fa-check-circle\\\"></i>\\r\\n <p>Chart of accounts <span class=\\\"smallText\\\">(not required)</span></p>\\r\\n\"\n + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isEducationalLicense : depth0),{\"name\":\"unless\",\"hash\":{},\"fn\":container.program(3, data, 0),\"inverse\":container.program(5, data, 0),\"data\":data})) != null ? stack1 : \"\")\n + \" </div>\\r\\n </div>\\r\\n \\r\\n <div class=\\\"form-group no-padding submit\\\">\\r\\n <button type=\\\"submit\\\" class=\\\"btn btn-primary getStarted\\\">Get Started</button>\\r\\n </div> \\r\\n \\r\\n </form> \\r\\n </div>\\r\\n </div>\\r\\n</div>\\r\\n<script type=\\\"text/javascript\\\">\\r\\n var capterra_vkey = '1d0582fefb0b770219d7bfaeeb55969a',\\r\\n capterra_vid = '2113042',\\r\\n capterra_prefix = (('https:' == document.location.protocol) ? 'https://ct.capterra.com' : 'http://ct.capterra.com');\\r\\n\\r\\n (function() {\\r\\n var ct = document.createElement('script'); ct.type = 'text/javascript'; ct.async = true;\\r\\n ct.src = capterra_prefix + '/capterra_tracker.js?vid=' + capterra_vid + '&vkey=' + capterra_vkey;\\r\\n var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ct, s);\\r\\n })();\\r\\n</script>\\r\\n<!-- Google Code for Crunched Signups Conversion Page -->\\r\\n<script type=\\\"text/javascript\\\">\\r\\n/* <![CDATA[ */\\r\\nvar google_conversion_id = 855202179;\\r\\nvar google_conversion_language = \\\"en\\\";\\r\\nvar google_conversion_format = \\\"3\\\";\\r\\nvar google_conversion_color = \\\"ffffff\\\";\\r\\nvar google_conversion_label = \\\"1acuCPSMzXMQg7PllwM\\\";\\r\\nvar google_remarketing_only = false;\\r\\n/* ]]> */\\r\\n</script>\\r\\n<script type=\\\"text/javascript\\\" src=\\\"//www.googleadservices.com/pagead/conversion.js\\\">\\r\\n</script>\\r\\n<noscript>\\r\\n<div style=\\\"display:inline;\\\">\\r\\n<img height=\\\"1\\\" width=\\\"1\\\" style=\\\"border-style:none;\\\" alt=\\\"\\\" src=\\\"//www.googleadservices.com/pagead/conversion/855202179/?label=1acuCPSMzXMQg7PllwM&guid=ON&script=0\\\"/>\\r\\n</div>\\r\\n</noscript>\";\n},\"useData\":true});\nif (typeof define === 'function' && define.amd) {\n define([], function() {\n return __templateData;\n });\n} else if (typeof module === 'object' && module && module.exports) {\n module.exports = __templateData;\n} else {\n __templateData;\n}","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar Config = require('config/config')\r\nvar $ = require('jquery')\r\nvar WelcomeTemplate = require('welcome/template')\r\nvar SessionService = require('session/session-service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar WelcomeView = Backbone.View.extend({\r\n className: 'welcome',\r\n\r\n events: {\r\n 'click .getStarted': 'getStarted'\r\n },\r\n\r\n initialize: function () {\r\n this.companyService = new CompanyService()\r\n this.listenTo(this.model, 'change', this.render.bind(this))\r\n Backbone.once('pageUiWithoutNav', this.pageUiWithoutNav.bind(this))\r\n fbq('track', 'CompleteRegistration')\r\n },\r\n\r\n render: function () {\r\n this.$el.html(WelcomeTemplate(this.createViewModel()))\r\n\r\n this.pageUiWithoutNav()\r\n return this\r\n },\r\n\r\n createViewModel: function () {\r\n var name = SessionService.getEmail() || ''\r\n\r\n this.companyService.fetchCompany().then(function (company) {\r\n this.hasCompany = company ? true : false\r\n }.bind(this))\r\n\r\n if (this.model.get('profile')) {\r\n var profile = this.model.get('profile')\r\n name = profile.firstName\r\n }\r\n\r\n return {\r\n name: name,\r\n hasCompany: this.hasCompany,\r\n isEducationalLicense: Config['IS_EDUCATIONAL_LICENSE']\r\n }\r\n },\r\n\r\n getStarted: function (event) {\r\n event.preventDefault()\r\n Backbone.trigger('app:navigate', 'business-creation')\r\n },\r\n\r\n pageUiWithoutNav: function () {\r\n if (!this.hasCompany) {\r\n $('#page-container').attr('style', 'padding: 0 !important;')\r\n $('#sidebar, #side-overlay, .content.bg-white.titlebar').attr('style', 'display:none;')\r\n $('#header-navbar').attr('style', 'left: 0px !important; padding: 0px !important;')\r\n }\r\n },\r\n\r\n hasCompany: function () {\r\n var companyId = this.companyService.getActiveCompanyId()\r\n if (companyId === null || companyId === undefined) {\r\n this.companyService.fetchCompany().then(function (company) {\r\n if (!company || company === null || company === undefined) {\r\n Backbone.trigger('app:navigate', 'welcome')\r\n } else {\r\n this.companyService.setActiveCompany(company)\r\n }\r\n }.bind(this))\r\n }\r\n }\r\n\r\n})\r\n\r\nmodule.exports = WelcomeView\r\n","'use strict'\r\n\r\nvar Backbone = require('backbone')\r\nvar $ = require('jquery')\r\nvar WelcomeView = require('welcome/view')\r\nvar SessionService = require('session/session-service')\r\nvar LoginService = require('login/service')\r\nvar CompanyService = require('company/company-service')\r\n\r\nvar WelcomeWidget = function () {\r\n this.model = new Backbone.Model()\r\n this.view = new WelcomeView({\r\n model: this.model\r\n })\r\n this.loginService = new LoginService()\r\n this.companyService = new CompanyService()\r\n}\r\n\r\nWelcomeWidget.prototype.show = function () {\r\n this.view.delegateEvents()\r\n\r\n this.companyService.fetchCompany().then(function (company) {\r\n if (company) {\r\n $('#page-container, #sidebar, #header-navbar, #side-overlay, .content.bg-white.titlebar, ul.logoimage-without-menu').attr('style', null)\r\n Backbone.trigger('app:navigate', '')\r\n } else {\r\n $('#page-container').attr('style', 'padding: 0 !important;')\r\n $('.logoimage-without-menu').attr('style', 'display:block !important;')\r\n $('#sidebar, #side-overlay, .content.bg-white.titlebar').attr('style', 'display:none;')\r\n $('#header-navbar').attr('style', 'left: 0px !important; padding: 0px !important;')\r\n }\r\n })\r\n\r\n this.getUserProfile()\r\n return this.view.render().$el\r\n}\r\n\r\nWelcomeWidget.prototype.getUserProfile = function () {\r\n this.loginService.getProfile().then(function (profile) {\r\n SessionService.setProfile(profile)\r\n this.model.set('profile', profile)\r\n }.bind(this))\r\n}\r\n\r\nmodule.exports = WelcomeWidget\r\n"]}