Compare commits

...

292 Commits

Author SHA1 Message Date
a.bouhuolia
f1899e1ce1 Merge branch 'develop' into main 2022-01-08 18:20:08 +02:00
elforjani13
76d6cd0eaa fix(MoneyOutForm): BIG-270 publish & draft cashflow. 2022-01-08 18:14:39 +02:00
elforjani13
90b4f86a0d fix(MoneyInForm): BIG-270 publish & draft cashflow. 2022-01-08 18:14:17 +02:00
Ahmed Bouhuolia
5766d25bd1 Merge pull request #18 from bigcapitalhq/BIG-271-hotjar-client-application-integration
`BIG-271` Hotjar client application integration.
2022-01-08 18:06:54 +02:00
elforjani13
6a5d96e869 BIG-271 Hotjar client application integration. 2022-01-08 17:59:30 +02:00
Ahmed Bouhuolia
69f16d1977 Merge pull request #17 from bigcapitalhq/BIG-270-publish-and-draft-cashflow-transaction-should-be-always-publish
BIG-270 Publish and draft cashflow transaction.
2022-01-08 17:02:54 +02:00
elforjani13
9973693a86 BIG-270 Publish and draft cashflow transaction. 2022-01-08 16:59:31 +02:00
Ahmed Bouhuolia
11851d114d Merge pull request #16 from bigcapitalhq/develop
Release 1.5.5
2022-01-04 22:35:49 +02:00
elforjani13
3a3dd7a565 fix(VendorForm): placeholder phone number. 2022-01-04 22:31:01 +02:00
elforjani13
687dda1e7c fix(inviteUserFrom): fix localiztion. 2022-01-04 21:31:58 +02:00
elforjani13
bfa809c831 feat(VendorList): add note accessor & personal phone. 2022-01-04 20:47:43 +02:00
elforjani13
07145e92ab feat(CustomerList): add note accessor & personal phone. 2022-01-04 20:47:28 +02:00
a.bouhuolia
21779007be fix: application version. 2022-01-03 23:14:11 +02:00
a.bouhuolia
4fc1ecdc2d Merge branch 'main' of https://github.com/bigcapitalhq/client into main 2022-01-03 19:42:48 +02:00
a.bouhuolia
c9b5cecf7a Merge branch 'develop' into main 2022-01-03 19:42:23 +02:00
a.bouhuolia
4a46c00a07 chore: bump version. 2022-01-03 19:42:05 +02:00
a.bouhuolia
5c7ac0593d feat(GlobalErrors): localize the global errors. 2022-01-03 18:31:52 +02:00
a.bouhuolia
fa25fb4ede fix(TrialBalanceSheet): expand account name column. 2022-01-03 18:02:24 +02:00
elforjani13
c31e9dcd29 fix: inventory adjustment & contacts drawer. 2022-01-03 14:35:50 +02:00
a.bouhuolia
3566d3b855 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2022-01-03 13:53:40 +02:00
a.bouhuolia
c5da97bce0 chore: changlog. 2022-01-03 13:53:04 +02:00
a.bouhuolia
0cfbe633bd feat: add .env.example file. 2022-01-03 13:53:02 +02:00
a.bouhuolia
55098d7b78 chore: remove repo logo. 2022-01-03 13:53:00 +02:00
a.bouhuolia
78610cd519 chore: upload repo logo. 2022-01-03 13:52:59 +02:00
a.bouhuolia
828a28b976 chore: update package-lock.json. 2022-01-03 13:52:58 +02:00
a.bouhuolia
daf5fc8aba feat: add version numebr on sidebar footer. 2022-01-03 13:49:55 +02:00
elforjani13
430ab95dc3 landed cost localiztion. 2022-01-03 13:38:22 +02:00
Ahmed Bouhuolia
8100a57195 Merge pull request #15 from bigcapitalhq/develop
Merge `develop` to `main`
2022-01-03 12:31:14 +02:00
a.bouhuolia
97d890bcef chore: remove repo logo. 2022-01-03 12:30:15 +02:00
a.bouhuolia
521df8511d chore: upload repo logo. 2022-01-03 12:24:28 +02:00
a.bouhuolia
73ec49b36a chore: update package-lock.json. 2022-01-03 12:06:07 +02:00
a.bouhuolia
cfc625edf9 Merge branch 'develop' 2022-01-03 11:46:00 +02:00
elforjani13
e1b6f0d879 fix:APAging summary stye. 2022-01-02 18:39:53 +02:00
a.bouhuolia
ecda9296b8 fix(FinancialReport): BIG-205 Financial reports missing border final border bottom. 2022-01-02 17:24:35 +02:00
a.bouhuolia
aba732724b Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2022-01-02 16:37:46 +02:00
a.bouhuolia
40bc7d4e99 fix: BIG-222 Manual journal details entries table footer. 2022-01-02 16:37:37 +02:00
elforjani13
7f1844aa6b BIG-231 Transactions number on drawer title. 2022-01-02 13:38:40 +02:00
a.bouhuolia
7ab7456d08 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2022-01-01 18:11:15 +02:00
a.bouhuolia
de53a24d58 fix: BIG-209 Account details such as normal, account type not localized. 2022-01-01 18:11:06 +02:00
a.bouhuolia
e0c565388a fix: BIG-196 Bill landed cost transactions formatted allocate type. 2022-01-01 18:06:46 +02:00
elforjani13
3c73540b4e BIG-210 Refund credit & vendor drawer detail. 2022-01-01 15:34:04 +02:00
elforjani13
a4a2d0c888 BIG-225 Optimize style of refund vendor form. 2022-01-01 11:00:08 +02:00
elforjani13
e9797fd9a0 BIG-214 Min width submit button on edit mode. 2022-01-01 10:27:32 +02:00
elforjani13
40ae1aeb52 BIG-225 Add menu divider before delete on contextMenu. 2021-12-30 21:54:32 +02:00
elforjani13
b2c08d5645 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-30 21:33:31 +02:00
elforjani13
ee6f4028eb BIG-232 customer and vendor drawer link. 2021-12-30 21:33:18 +02:00
a.bouhuolia
cdb8ea6721 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-30 15:39:26 +02:00
a.bouhuolia
0173630e80 fix: BIG-206 Reconcilate credit note and vendor credit with invoices should amount to credit be max the invoice remaining amount. 2021-12-30 15:39:22 +02:00
elforjani13
4403bf2b06 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-30 12:54:41 +02:00
elforjani13
f8e44c4f4e BIG-220 Avoid display empty status. 2021-12-30 12:54:22 +02:00
a.bouhuolia
0bd11419bb fix: BIG-199 Purchase invoice partial payment status progress height not consistent with sell invoice style. 2021-12-30 12:50:27 +02:00
a.bouhuolia
c1e229814f Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-30 12:38:12 +02:00
a.bouhuolia
871dcb62c4 fix: BIG-213 Landed cost checkbox disable with inventory items not service in purchase invoice. 2021-12-30 12:38:03 +02:00
elforjani13
5bf591d8c9 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-30 12:36:21 +02:00
elforjani13
75b1cce380 BIG-211 Invalidate reconciliation credit & vendor transaction. 2021-12-30 12:35:28 +02:00
a.bouhuolia
119e6fa216 fix: BIG-195 Allocate landed cost amount max number should be transaction remaining amount. 2021-12-30 12:30:02 +02:00
elforjani13
6b98e1f1c2 BIG-204 payment transactions context menu actions. 2021-12-30 12:28:42 +02:00
elforjani13
fa23aa67d3 BIG-202 Remove the allocate actions bar. 2021-12-30 12:15:23 +02:00
elforjani13
9474a4fcd1 BIG-197 Bill landed amount text right align. 2021-12-30 11:56:58 +02:00
elforjani13
81c81bd09f fix: add ability credit & vendor tabs. 2021-12-29 14:37:03 +02:00
elforjani13
1492c24cfb fix: formatted_type in inventory adjustment. 2021-12-29 12:34:12 +02:00
a.bouhuolia
b4e9ee7ff3 feat(GLTable): columns text overflow. 2021-12-28 19:52:21 +02:00
elforjani13
e97bf56adb feat: isLoading state. 2021-12-28 18:32:55 +02:00
elforjani13
11d44c128b Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-28 17:58:53 +02:00
elforjani13
e615f62ef5 fix: customer & inventory adjustment. 2021-12-28 17:57:50 +02:00
a.bouhuolia
c69d29fb22 feat(TransactionsLocking): localization. 2021-12-28 17:53:47 +02:00
a.bouhuolia
1e472d278a fix(Estimate): estimate status. 2021-12-28 17:01:35 +02:00
elforjani13
1688f49bc1 fix: fix localiztion. 2021-12-28 13:43:53 +02:00
elforjani13
9182e13c07 feat: estimate & cashflow. 2021-12-28 13:10:15 +02:00
elforjani13
f2150a982a fix: add type_formatted in item detail. 2021-12-28 12:30:47 +02:00
elforjani13
d8efb17651 feat: add notes. 2021-12-28 12:21:56 +02:00
elforjani13
1e361dac66 feat: notes. 2021-12-27 22:23:41 +02:00
elforjani13
a6cd483eb9 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-27 22:05:32 +02:00
elforjani13
765f00d203 feat: permissions localiztion. 2021-12-27 22:05:17 +02:00
a.bouhuolia
088d7d4b1d feat(TransactionsLocking): modify AR localization. 2021-12-27 18:59:01 +02:00
a.bouhuolia
92c9001c52 feat(AccountDetail): more transactions icon in RTL mode. 2021-12-27 18:43:02 +02:00
a.bouhuolia
93bd2af1d7 feat(Card): card footer actions. 2021-12-27 18:29:52 +02:00
a.bouhuolia
f261555b86 feat(InvoiceDetails): invoice payment transactions ability access control. 2021-12-27 16:19:13 +02:00
a.bouhuolia
62ab31efd2 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-27 16:02:16 +02:00
a.bouhuolia
96cb3177aa feat: WIP role form localization. 2021-12-27 16:01:22 +02:00
elforjani13
d5f7cdf131 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-27 15:20:48 +02:00
elforjani13
6ad3065f1f feat: landed hint. 2021-12-27 15:19:16 +02:00
a.bouhuolia
0860db87fb Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-27 15:05:17 +02:00
a.bouhuolia
2707415319 feat: Role form permissions dependecies. 2021-12-27 15:04:57 +02:00
elforjani13
99716e99a9 feat: localiztion. 2021-12-27 14:44:04 +02:00
a.bouhuolia
d1a67ca2ed Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-27 11:08:10 +02:00
a.bouhuolia
a1ed9bf4da feat: add rtlcss to styled components. 2021-12-27 11:08:05 +02:00
elforjani13
99df627633 feat: empty status in credit & vednor. 2021-12-26 20:56:25 +02:00
a.bouhuolia
e1646e92a8 fix: BIG-160 Remove expense default resource type on universal search. 2021-12-26 20:07:11 +02:00
a.bouhuolia
d4138fdf4e feat(RoleForm): service full access. 2021-12-26 19:09:20 +02:00
a.bouhuolia
49b6deed6d Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-26 18:26:22 +02:00
a.bouhuolia
0dddf3d1d0 feat: permissions service full access. 2021-12-26 18:26:05 +02:00
elforjani13
d5acb3696e feat: add convert to vendor credit in drawer. 2021-12-26 17:11:04 +02:00
elforjani13
2a9c1a9833 feat: add convert to credit note in drawer. 2021-12-26 16:34:05 +02:00
elforjani13
80d86b01de feat: add payment receive & bill detail footer. 2021-12-26 13:28:25 +02:00
elforjani13
4a42fa4edc feat: credit note detail footer. 2021-12-26 13:26:53 +02:00
elforjani13
8ea92513fe feat: receipt detail footer. 2021-12-26 13:26:10 +02:00
elforjani13
a075b998d3 feat: estimate detail footer. 2021-12-26 13:25:52 +02:00
elforjani13
93aa60124b feat: add convert to vendor credit. 2021-12-26 13:25:07 +02:00
elforjani13
f9a7306e47 feat: add convert to credit note. 2021-12-26 13:24:38 +02:00
elforjani13
10f0d47b54 fix: BIG-145 rename product/service to product. 2021-12-26 13:22:27 +02:00
a.bouhuolia
1d505db7bf fix: BIG-193 purchase item description does fill on item entries table. 2021-12-25 19:40:14 +02:00
a.bouhuolia
6975ebb9e7 feat: styled preferences page cards. 2021-12-25 19:35:07 +02:00
a.bouhuolia
5defb5a279 feat: credit note and vendor credit universal search. 2021-12-25 18:52:46 +02:00
a.bouhuolia
1497a27e7d feat: add terms and conditions to invoice details. 2021-12-25 12:10:29 +02:00
elforjani13
af9f4c45fc feat: add inventory adjustment entries. 2021-12-23 17:58:26 +02:00
elforjani13
d719ac60bd feat: add ability credit & vendor & item transactions. 2021-12-23 17:27:28 +02:00
elforjani13
789c8db693 feat: localization. 2021-12-23 13:33:02 +02:00
a.bouhuolia
7eea202f9d feat(CommercialDoc): tweak in style. 2021-12-23 11:16:28 +02:00
a.bouhuolia
5b581b86f4 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-23 11:10:28 +02:00
a.bouhuolia
1ad2117c37 feat: optimize style of card component. 2021-12-23 11:10:07 +02:00
elforjani13
b1afa88c16 feat: add localization. 2021-12-22 22:02:38 +02:00
elforjani13
4b7af1c634 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-22 20:43:07 +02:00
elforjani13
29a4ab7590 feat: add locking localization. 2021-12-22 20:42:41 +02:00
a.bouhuolia
7150f12a01 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-22 19:17:46 +02:00
a.bouhuolia
934b0abbe6 feat: optimize style of role permissions form. 2021-12-22 19:17:41 +02:00
elforjani13
b36468ff7f feat: add localization. 2021-12-22 15:59:16 +02:00
a.bouhuolia
10c421dea0 feat: optimize account details. 2021-12-21 20:29:51 +02:00
a.bouhuolia
661cbaf11e feat: optimize landed cost entries table style. 2021-12-21 20:18:34 +02:00
a.bouhuolia
1e5b394575 feat: optimize style of reconcile customer/vendor credit table. 2021-12-21 20:09:32 +02:00
a.bouhuolia
dd7b44eb29 feat: display expense formatted amount. 2021-12-21 18:36:45 +02:00
a.bouhuolia
a456b9d942 feat: optimize expense and manual journal details status. 2021-12-21 18:10:58 +02:00
a.bouhuolia
5429643db5 feat: optimize expense and manual journal details. 2021-12-21 17:57:03 +02:00
a.bouhuolia
13310b1aac feat: optimize table of item associated transactions. 2021-12-21 17:11:41 +02:00
a.bouhuolia
7987f68aa3 refactor: payment made details total lines. 2021-12-21 16:55:35 +02:00
a.bouhuolia
1d159c2757 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-21 16:51:54 +02:00
a.bouhuolia
588995e759 refactor: Total lines of commercial documents. 2021-12-21 16:51:47 +02:00
a.bouhuolia
e2349f1951 feat: changelog. 2021-12-21 16:47:15 +02:00
elforjani13
e80901c7a6 fix: itemPerfernce. 2021-12-21 12:24:25 +02:00
elforjani13
c87a98a5e4 fix: accountant. 2021-12-21 12:12:06 +02:00
elforjani13
da3564d315 fix: handle switch button item transaction. 2021-12-21 10:43:04 +02:00
elforjani13
0d924464ea feat: add style of payment made. 2021-12-20 16:47:48 +02:00
elforjani13
961082c50b Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-20 16:11:21 +02:00
elforjani13
828c33bee1 feat: add style of vendor credit. 2021-12-20 16:11:10 +02:00
a.bouhuolia
1540a20a6e Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-20 16:08:30 +02:00
a.bouhuolia
2a37497648 feat: optimize style of sale receipt details. 2021-12-20 16:08:25 +02:00
elforjani13
dbe067a27c Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-20 15:31:15 +02:00
elforjani13
3511348d04 feat: add style of bill. 2021-12-20 15:31:03 +02:00
a.bouhuolia
ace3fdc569 feat: optmize style of payment receive details. 2021-12-20 14:33:48 +02:00
a.bouhuolia
a0098382e7 feat: optimize style of sale estimate details. 2021-12-20 14:12:19 +02:00
a.bouhuolia
a953236bff Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-20 13:28:22 +02:00
a.bouhuolia
4dda2a37aa feat: optimize style of invoice details.
feat: optimize style of credit note details.
feat: optimize global style checkbox  of the application.
2021-12-20 13:19:59 +02:00
elforjani13
0e79dceae8 feat: add journal entries credit & vendor. 2021-12-20 11:47:01 +02:00
elforjani13
0ca0a2ee0b feat: add context menu. 2021-12-20 11:12:38 +02:00
elforjani13
7095903653 feat: add contextMenu in item transactions. 2021-12-19 19:29:42 +02:00
elforjani13
30841d57dc feat: add item payment transactions. 2021-12-19 18:25:41 +02:00
elforjani13
d0f889850c feat: add contextMenu in invoice & bill transactions. 2021-12-19 17:30:16 +02:00
elforjani13
f9fe3506c5 feat: item payment transactions. 2021-12-19 17:29:25 +02:00
elforjani13
8390e5ea6b fix: fix errors. 2021-12-16 21:11:21 +02:00
a.bouhuolia
fcd1a8849d fix(Invoice|Bill): draft status round tag. 2021-12-16 14:48:38 +02:00
a.bouhuolia
9bd047917d feat(EstimatesList): optimize status tags. 2021-12-16 12:49:11 +02:00
a.bouhuolia
2108666f3a Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-15 22:31:28 +02:00
a.bouhuolia
0f10b71604 feat(Changelog): release v1.5.0 logs. 2021-12-15 22:31:24 +02:00
elforjani13
09e739a5a9 feat: edit locking transactions. 2021-12-15 20:45:42 +02:00
elforjani13
a7a94ba201 fix: fix format. 2021-12-15 20:19:04 +02:00
a.bouhuolia
3466828b65 feat(VendorCredit): optimize data table style. 2021-12-15 19:55:47 +02:00
a.bouhuolia
cfed874182 feat(RefundCreditNote): optimize style. 2021-12-15 19:54:17 +02:00
a.bouhuolia
c688b8700e feat(TextStatus): new component. 2021-12-15 19:53:21 +02:00
a.bouhuolia
7a608d2ee3 feat: transactions locking content. 2021-12-15 19:53:04 +02:00
a.bouhuolia
33b998cbda Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-15 12:01:44 +02:00
a.bouhuolia
d7da0ad24e feat: architect transactions locking. 2021-12-15 11:59:39 +02:00
elforjani13
92cff82184 feat: add edit locking transactions. 2021-12-14 22:05:17 +02:00
a.bouhuolia
7cd2b1c533 feat: transactions list container dynamic width. 2021-12-14 19:09:41 +02:00
a.bouhuolia
29a34f826a feat: controlled transactions locking type. 2021-12-14 19:01:15 +02:00
a.bouhuolia
bd97a73c65 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-14 18:04:07 +02:00
a.bouhuolia
eebe4c46fa feat: handle transactions locking request error. 2021-12-14 18:03:58 +02:00
elforjani13
6aba694518 feat: add payment trasnactions. 2021-12-14 17:56:42 +02:00
elforjani13
ae7d37a0e0 Merge branch 'feature/associated-payment-transactions' into develop 2021-12-14 13:06:05 +02:00
elforjani13
897e674912 feat add localization & auto focus. 2021-12-13 20:14:16 +02:00
a.bouhuolia
a52f00eeb2 feat: optimize transactions locking. 2021-12-13 19:22:56 +02:00
a.bouhuolia
0ee9b54a9b fix: cancel partial locking. 2021-12-13 17:46:26 +02:00
a.bouhuolia
dd8bb9cb18 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-13 17:37:32 +02:00
a.bouhuolia
86762d2dc8 feat: add little space between items of transactions locking. 2021-12-13 17:37:26 +02:00
elforjani13
c124002605 feat: add cancel unlocking alert. 2021-12-13 17:36:48 +02:00
a.bouhuolia
8e18d4a0dc feat: modify the locked transactions module. 2021-12-13 16:47:52 +02:00
a.bouhuolia
21e075b479 feat: validate before move to full and partial transactions locking. 2021-12-13 16:28:36 +02:00
a.bouhuolia
51dfee699f Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-13 15:23:49 +02:00
a.bouhuolia
a6a10ef6b8 feat: switch betweel full and partial transactions locking. 2021-12-13 15:22:33 +02:00
elforjani13
fba46e2479 feat: add module in payload. 2021-12-13 15:20:16 +02:00
elforjani13
c4650f5d31 fix: name list. 2021-12-13 14:03:34 +02:00
a.bouhuolia
a441f78e61 Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop 2021-12-13 13:58:13 +02:00
a.bouhuolia
280d991567 feat: add lock all transactions at once callout. 2021-12-13 13:53:21 +02:00
elforjani13
62e5db86a5 feat: locking transaction page. 2021-12-13 13:48:21 +02:00
a.bouhuolia
4fe4178090 feat: optimize transactions locking style. 2021-12-13 12:12:48 +02:00
elforjani13
dfc0fbbb71 feat: add transactions locking query. 2021-12-12 19:15:31 +02:00
elforjani13
295fff4746 feat: add unlocking transactions dialog. 2021-12-12 19:10:58 +02:00
elforjani13
c671fcd011 feat: add unlocking partail transactions dialog. 2021-12-12 19:06:55 +02:00
elforjani13
a6141d9f73 feat: add transactions locking. 2021-12-12 19:01:52 +02:00
elforjani13
91d1dddfed fix: add credited_amount & calculate remaining. 2021-12-09 16:55:29 +02:00
elforjani13
ca746df86d feat: add quick create & sortable. 2021-12-09 14:01:53 +02:00
elforjani13
02330c84b1 feat: invalidate query. 2021-12-08 22:59:48 +02:00
elforjani13
c89b8b131d fix: fix notes. 2021-12-08 22:43:44 +02:00
elforjani13
3690c88c04 fix: loading state on submit button. 2021-12-08 20:11:09 +02:00
elforjani13
6573f19ff8 fix: notes. 2021-12-08 18:53:14 +02:00
elforjani13
a948dd4236 feat: add delete reconcile & handle error. 2021-12-08 18:51:21 +02:00
a.bouhuolia
56b1c36c9d Merge branch 'feature/credit-memo' into develop 2021-12-08 15:43:49 +02:00
a.bouhuolia
bc7ec834c0 Merge branch 'feature/credit-memo' into develop 2021-12-08 15:21:39 +02:00
elforjani13
5963d14fdd feat: add reconcile vendor credit. 2021-12-08 14:33:33 +02:00
elforjani13
80b8083059 feat: add reconcile credit style. 2021-12-07 21:12:56 +02:00
elforjani13
ecaf23d269 feat: add reconcile credit transactions table. 2021-12-07 20:58:17 +02:00
elforjani13
14f33c667b feat: handle error message. 2021-12-07 20:56:54 +02:00
elforjani13
78c42acb17 feat: add reconcile credit note. 2021-12-07 20:55:47 +02:00
elforjani13
192bcdc696 feat: add filterByTypes 2021-12-07 11:00:57 +02:00
elforjani13
ac99a6ca75 feat: add status & opened alert in credit & vendor. 2021-12-06 16:28:42 +02:00
elforjani13
2a48d9be51 feat: add refund transactions. 2021-12-05 19:30:52 +02:00
elforjani13
ab48e6092a feat: add refund credit & vendor dialogs. 2021-12-05 19:29:39 +02:00
elforjani13
bf99bda616 fix: credit & vendor reducer. 2021-12-04 22:16:36 +02:00
elforjani13
e1a3f471cb feat: add Invalidate landed cost in bill. 2021-12-04 18:59:01 +02:00
elforjani13
07e52bef7a feat: add payment transaction & style 2021-12-04 18:08:20 +02:00
a.bouhuolia
d3c5131020 fix: allocate landed cost on inventory items. 2021-12-04 16:32:37 +02:00
elforjani13
58a0ed4ecd fix: formatted amount & lang in credit view. 2021-12-04 12:41:08 +02:00
elforjani13
26cf1d20f3 feat: add formatted amount & date in credit view. 2021-12-02 17:04:24 +02:00
elforjani13
0fedd2479d feat: add formatted amount & data in credit. 2021-12-02 16:07:18 +02:00
elforjani13
ba585271b0 feat: landed cost fields & style. 2021-12-02 15:36:29 +02:00
elforjani13
0c4259a05b feat: style journal entries. 2021-12-02 15:34:26 +02:00
elforjani13
31e0bbc187 feat: add View detail. 2021-12-01 16:59:37 +02:00
elforjani13
43b91503d2 feat: add auto increment in vendor credit number. 2021-12-01 14:02:54 +02:00
elforjani13
432e2d202a feat: add Auto increment in credit note number. 2021-12-01 14:02:31 +02:00
elforjani13
eeb16f4362 feat: add create & edit & delete in credit note. 2021-11-30 21:04:36 +02:00
elforjani13
15fa1729a2 feat: add create & edit & delete in vendor credit. 2021-11-30 16:34:13 +02:00
elforjani13
119d0b2839 feat: Vendor Credit note. 2021-11-29 16:33:43 +02:00
elforjani13
0a9798e7a7 feat: Credit note. 2021-11-29 16:14:22 +02:00
a.bouhuolia
008faaece6 Merge branch 'master' of https://github.com/bigcapitalhq/client 2021-11-28 09:05:55 +02:00
a.bouhuolia
27916585a5 Merge branch 'develop' 2021-11-28 09:04:32 +02:00
elforjani13
346696f673 fix: ability option key. 2021-11-27 20:23:40 +02:00
elforjani13
68227b81e8 fix: pause transactions locaking. 2021-11-27 19:44:06 +02:00
elforjani13
0c806366cd feat: handle error delete role. 2021-11-27 18:51:35 +02:00
a.bouhuolia
8b28d6894f feat: avoid display any dashboard before boot complete loading. 2021-11-27 17:53:54 +02:00
a.bouhuolia
3db00f6f70 feat: universal search permissions access control. 2021-11-27 17:22:29 +02:00
a.bouhuolia
56ab0a68e2 feat: add default role permissions in new mode. 2021-11-27 16:43:33 +02:00
elforjani13
4ac32b3aad feat: handle error roles table. 2021-11-27 13:52:37 +02:00
elforjani13
f98b429fcc feat: add localiztion. 2021-11-27 11:50:21 +02:00
a.bouhuolia
012f204c5c Merge branch 'featrue/roles-permission' into develop 2021-11-26 23:56:34 +02:00
a.bouhuolia
7c62466c5b Merge branch 'featrue/roles-permission' of https://github.com/bigcapitalhq/client into featrue/roles-permission 2021-11-26 23:38:49 +02:00
a.bouhuolia
111ade2ac8 feat: shortcuts keyword table permissions access control. 2021-11-26 23:38:39 +02:00
elforjani13
408e3cbb0b Merge branch 'featrue/roles-permission' of https://github.com/bigcapitalhq/client into featrue/roles-permission 2021-11-26 22:40:50 +02:00
elforjani13
9cc770f168 feat: edit user dialog handle error. 2021-11-26 22:40:06 +02:00
a.bouhuolia
383a9aad3b Merge branch 'featrue/roles-permission' of https://github.com/bigcapitalhq/client into featrue/roles-permission 2021-11-26 22:27:37 +02:00
a.bouhuolia
1be30fd142 feat: application and dashboard async booting. 2021-11-26 22:27:27 +02:00
elforjani13
63cb3f9fef fix: Abilities keys. 2021-11-26 20:56:00 +02:00
elforjani13
ca3ff3fd8f Merge branch 'featrue/roles-permission' of https://github.com/bigcapitalhq/client into featrue/roles-permission 2021-11-26 19:51:29 +02:00
elforjani13
313d0f3d0f fix: role field in invite & User dialog. 2021-11-26 19:48:19 +02:00
elforjani13
64bf223458 feat: handle errors. 2021-11-26 19:46:48 +02:00
elforjani13
97c421e2f1 feat: roles data & delete alert. 2021-11-26 19:43:06 +02:00
a.bouhuolia
ccad55dd4a feat: dashboard quick new access control. 2021-11-26 19:37:36 +02:00
a.bouhuolia
a21d70a59d feat: sidebar permission access control. 2021-11-26 19:07:18 +02:00
a.bouhuolia
c2ccb7f879 Merge branch 'featrue/roles-permission' of https://github.com/bigcapitalhq/client into featrue/roles-permission 2021-11-26 16:13:51 +02:00
a.bouhuolia
fe9ca215ab feat: handle forbidden request error. 2021-11-26 16:11:42 +02:00
a.bouhuolia
c14b35356b feat: dashboard meta boot and authenticated user request query. 2021-11-26 16:09:42 +02:00
a.bouhuolia
6fd8a24802 feat: dashboard meta boot. 2021-11-26 16:08:49 +02:00
a.bouhuolia
80531b7fdb feat: save @casl package dependency. 2021-11-25 22:54:16 +02:00
elforjani13
600a835dad feat: home page ability. 2021-11-25 16:03:40 +02:00
elforjani13
3dff8763d4 feat: ability reports home page. 2021-11-25 15:20:44 +02:00
elforjani13
e197d66d9f Merge branch 'feature/draft' into featrue/roles-permission 2021-11-25 14:37:09 +02:00
elforjani13
5dfb592ecc feat: ability context. 2021-11-25 14:36:34 +02:00
elforjani13
2630e0235d feat: add cashflow & vendor ability. 2021-11-25 13:02:09 +02:00
elforjani13
8b4dfe4ded feat: add role name in edit & invite user dialog. 2021-11-25 12:21:29 +02:00
elforjani13
9ceee6d02e feat: reports abilities. 2021-11-24 14:35:38 +02:00
elforjani13
553334f063 feat: ability home page option. 2021-11-24 14:09:24 +02:00
elforjani13
aef8eb7907 feat: empty status ability. 2021-11-24 11:47:18 +02:00
elforjani13
cc1f4cc26b feat: ability option. 2021-11-23 22:38:16 +02:00
elforjani13
719302b241 feat: add expense ability. 2021-11-23 22:15:02 +02:00
elforjani13
3db52e9c63 feat: add manual journal ability. 2021-11-23 21:56:36 +02:00
elforjani13
7393d68b7a feat: add account ability. 2021-11-23 21:42:16 +02:00
elforjani13
6ec86d3cf7 feat: add customer & vendor ability. 2021-11-23 21:26:34 +02:00
elforjani13
1cba4b5f18 feat: add bill & payment made ability. 2021-11-23 20:29:35 +02:00
elforjani13
3a8e1f5238 feat: add payment receive ability. 2021-11-23 20:15:29 +02:00
elforjani13
371e374dc5 feat: add receipt ability. 2021-11-23 20:08:05 +02:00
elforjani13
c2650c76e8 feat: add invoice ability. 2021-11-23 20:03:26 +02:00
elforjani13
fc74346695 feat: add estimate ability. 2021-11-23 19:37:49 +02:00
elforjani13
fca4dedeac feat: add item & inventory adjustment ability. 2021-11-23 19:29:58 +02:00
elforjani13
e5d02043ad feat: item & inventory. 2021-11-23 16:51:40 +02:00
a.bouhuolia
51fde0cc31 Merge branch 'feature/draft' of https://github.com/bigcapitalhq/client 2021-11-23 15:29:17 +02:00
elforjani13
afee2e90e0 ability. 2021-11-23 15:24:53 +02:00
elforjani13
802f7cc442 fix: add note to customer & vendor details. 2021-11-23 13:13:23 +02:00
elforjani13
d45005d8c2 fix: delete role alert. 2021-11-22 19:58:43 +02:00
elforjani13
15e7f34879 feat: delete & edit role. 2021-11-22 19:53:40 +02:00
elforjani13
a54ddf27c7 feat: delete & edit role. 2021-11-21 23:56:29 +02:00
elforjani13
955ae97c19 feat: add roles permission schema. 2021-11-21 18:21:10 +02:00
elforjani13
ddbadb67c8 feat: submit roles permission schema. 2021-11-21 17:10:49 +02:00
elforjani13
b853eb1e75 fix: roles form. 2021-11-21 01:45:14 +02:00
elforjani13
c139e129bf feat: roles permission & style & component. 2021-11-21 01:13:41 +02:00
elforjani13
3d3827b683 feat: add transactions locking icon. 2021-11-20 20:55:57 +02:00
a.bouhuolia
cf6d8d6038 feat: add hints to transactions locking item. 2021-11-20 20:40:09 +02:00
a.bouhuolia
d12b965bac feat: optimize transactions locking page style. 2021-11-20 20:38:02 +02:00
a.bouhuolia
5f0700b5e5 fix: hotbug account dialog edit payload transformation. 2021-11-20 18:52:45 +02:00
a.bouhuolia
48348da663 fix: invite user auth route. 2021-11-20 15:49:28 +02:00
elforjani13
fe8f41f200 feat: Transactions locking. 2021-11-18 17:28:11 +02:00
elforjani13
0ad5a9ed03 feat: item payment transactions. 2021-11-15 21:45:24 +02:00
elforjani13
bd282acae4 feat: invoice payment transactions. 2021-11-15 21:44:46 +02:00
elforjani13
377fb07c70 feat: bill payment transactions. 2021-11-15 21:43:39 +02:00
elforjani13
b32abc0417 fix: fix localization. 2021-11-14 11:53:35 +02:00
626 changed files with 25111 additions and 3266 deletions

1
.env.example Normal file
View File

@@ -0,0 +1 @@
APP_VERSION=$npm_package_version

1
.gitignore vendored
View File

@@ -13,6 +13,7 @@
# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local

View File

@@ -2,6 +2,52 @@
All notable changes to Bigcapital server-side will be in this file.
## [1.5.3] - 03-01-2020
### Fixed
- Localize the global errors.
- Expand account name column on trial balance sheet.
## [1.5.0] - 20-12-2021
### Added
- Add credit note on sales module.
- Add vendor credit on purchases module.
- Optimize landed costs on purchase invoices.
- Display associated payment transactions on sale invoice drawer.
- Display associated pamyment transactions on purchase invoice drawer.
- Display item associate invoice, bill, estimate and receipt transactions.
- Transactions locking on all transactions or individual modules.
- Roles and permissions access control module.
- Optimize readonly details style of invoice, receipt, estimate, payment receive,
purchase invoice, expense, manual journal, inventory adjustment and cashflow transaction.
### Changed
- Dashboard meta boot and authenticated user request query.
- Optimize Arabic localization.
## [1.4.0] - 11-09-2021
### Added
- Add SMS notification on sale invoice, receipt, customers payments modules.
- Customer quick create in customers list.
- Item quick create in items list.
### Changes
change: BIG-171 alerts in global scope and lazy loading.
### Fixed
fix: BIG-140 - Reordering sell, cost and inventory account on item details.
fix: BIG-144 - Typo adjustment dialog success message.
fix: BIG-148 - Items entries ordered by index.
fix: BIG-132 AR/AP aging summary report filter by none transactions/zero contacts.
## [1.2.0-RC] - 03-09-2021
Here we write upgrading notes for brands. It's a team effort to make them as
@@ -32,7 +78,7 @@ straightforward as possible.
- Inventory adjustment publish action.
- Customers and vendors activate and inactivate action.
- Add refresh button on dashboard actions bar to all datatables resources.
- Add clickable datatable rows to display each row details.
- Add clickable datatable rows to display each row details.
### Changed

View File

@@ -85,6 +85,9 @@ function getClientEnvironment(publicUrl) {
WDS_SOCKET_HOST: process.env.WDS_SOCKET_HOST,
WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH,
WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT,
// Application version.
VERSION: paths.appVersion
}
);
// Stringify all values so we can feed into webpack DefinePlugin

View File

@@ -48,6 +48,8 @@ const resolveModule = (resolveFn, filePath) => {
return resolveFn(`${filePath}.js`);
};
const appVersion = require(resolveApp('package.json')).version;
// config after eject: we're in ./config/
module.exports = {
dotenv: resolveApp('.env'),
@@ -65,6 +67,7 @@ module.exports = {
proxySetup: resolveApp('src/setupProxy.js'),
appNodeModules: resolveApp('node_modules'),
publicUrlOrPath,
appVersion
};

779
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "bigcapital-client",
"version": "1.2.0",
"version": "1.5.3",
"private": true,
"dependencies": {
"@babel/core": "7.8.4",
@@ -10,6 +10,8 @@
"@blueprintjs/select": "^3.11.2",
"@blueprintjs/table": "^3.8.3",
"@blueprintjs/timezone": "^3.6.2",
"@casl/ability": "^5.4.3",
"@casl/react": "^2.3.0",
"@reduxjs/toolkit": "^1.2.5",
"@sentry/react": "^6.13.2",
"@sentry/tracing": "^6.13.2",
@@ -34,6 +36,7 @@
"cross-env": "^7.0.2",
"css-loader": "3.4.2",
"deep-map-keys": "^2.0.1",
"dependency-graph": "^0.11.0",
"dotenv": "8.2.0",
"dotenv-expand": "5.1.0",
"eslint": "^6.6.0",
@@ -44,6 +47,7 @@
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-react": "7.18.0",
"eslint-plugin-react-hooks": "^1.6.1",
"fast-deep-equal": "^3.1.3",
"file-loader": "4.3.0",
"flow-bin": "^0.123.0",
"formik": "^2.2.5",
@@ -104,6 +108,7 @@
"semver": "6.3.0",
"style-loader": "0.23.1",
"styled-components": "^5.3.1",
"stylis-rtlcss": "^2.1.1",
"terser-webpack-plugin": "2.3.4",
"ts-pnp": "1.1.5",
"url-loader": "2.3.0",

View File

@@ -2,7 +2,11 @@
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicons/favicon-32.ico" sizes="32x32">
<link
rel="icon"
href="%PUBLIC_URL%/favicons/favicon-32.ico"
sizes="32x32"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
@@ -15,6 +19,22 @@
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!-- Hotjar Tracking Code for https://app.bigcapital.ly/ -->
<script>
(function (h, o, t, j, a, r) {
h.hj =
h.hj ||
function () {
(h.hj.q = h.hj.q || []).push(arguments);
};
h._hjSettings = { hjid: 2774528, hjsv: 6 };
a = o.getElementsByTagName('head')[0];
r = o.createElement('script');
r.async = 1;
r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv;
a.appendChild(r);
})(window, document, 'https://static.hotjar.com/c/hotjar-', '.js?sv=');
</script>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
@@ -41,7 +61,11 @@
To create a production bundle, use `npm run build` or `yarn build`.
-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flexboxgrid/6.3.1/flexboxgrid.min.css" type="text/css" >
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/flexboxgrid/6.3.1/flexboxgrid.min.css"
type="text/css"
/>
<!-- <link href="https://cdn.syncfusion.com/ej2/material.css" rel="stylesheet"> -->
<!-- <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> -->
</body>

6
src/common/TableStyle.js Normal file
View File

@@ -0,0 +1,6 @@
export const TableStyle = {
Constrant: 'constrant',
Regular: 'regular'
}

178
src/common/abilityOption.js Normal file
View File

@@ -0,0 +1,178 @@
export const AbilitySubject = {
Item: 'Item',
InventoryAdjustment: 'InventoryAdjustment',
Estimate: 'SaleEstimate',
Invoice: 'SaleInvoice',
Receipt: 'SaleReceipt',
PaymentReceive: 'PaymentReceive',
Bill: 'Bill',
PaymentMade: 'PaymentMade',
Customer: 'Customer',
Vendor: 'Vendor',
Account: 'Account',
ManualJournal: 'ManualJournal',
Expense: 'Expense',
Cashflow: 'Cashflow',
Report: 'Report',
Preferences: 'Preferences',
ExchangeRate: 'ExchangeRate',
SubscriptionBilling: 'SubscriptionBilling',
CreditNote: 'CreditNote',
VendorCredit: 'VendorCredit',
};
export const ItemAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
};
export const InventoryAdjustmentAction = {
Create: 'Create',
Edit: 'Edit',
View: 'View',
Delete: 'Delete',
};
export const SaleEstimateAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
NotifyBySms: 'NotifyBySms',
};
export const SaleInvoiceAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
Writeoff: 'bad-debt',
NotifyBySms: 'NotifyBySms',
};
export const SaleReceiptAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
NotifyBySms: 'NotifyBySms',
};
export const PaymentReceiveAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
NotifyBySms: 'NotifyBySms',
};
export const CreditNoteAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
Refund: 'Refund'
};
export const VendorCreditAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
Refund: 'Refund'
};
export const BillAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
NotifyBySms: 'NotifyBySms',
};
export const PaymentMadeAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
};
export const CustomerAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
};
export const VendorAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
};
export const AccountAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
TransactionsLocking: 'TransactionsLocking',
};
export const ManualJournalAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
TransactionLocking: 'TransactionLocking',
};
export const ExpenseAction = {
View: 'View',
Create: 'Create',
Edit: 'Edit',
Delete: 'Delete',
};
export const CashflowAction = {
View: 'View',
Create: 'Create',
Delete: 'Delete',
};
export const ReportsAction = {
ALL: 'all',
READ_BALANCE_SHEET: 'read-balance-sheet',
READ_TRIAL_BALANCE_SHEET: 'read-trial-balance-sheet',
READ_PROFIT_LOSS: 'read-profit-loss',
READ_JOURNAL: 'read-journal',
READ_GENERAL_LEDGET: 'read-general-ledger',
READ_CASHFLOW: 'read-cashflow',
READ_AR_AGING_SUMMARY: 'read-ar-aging-summary',
READ_AP_AGING_SUMMARY: 'read-ap-aging-summary',
READ_PURCHASES_BY_ITEMS: 'read-purchases-by-items',
READ_SALES_BY_ITEMS: 'read-sales-by-items',
READ_CUSTOMERS_TRANSACTIONS: 'read-customers-transactions',
READ_VENDORS_TRANSACTIONS: 'read-vendors-transactions',
READ_CUSTOMERS_SUMMARY_BALANCE: 'read-customers-summary-balance',
READ_VENDORS_SUMMARY_BALANCE: 'read-vendors-summary-balance',
READ_INVENTORY_VALUATION_SUMMARY: 'read-inventory-valuation-summary',
READ_INVENTORY_ITEM_DETAILS: 'read-inventory-item-details',
READ_CASHFLOW_ACCOUNT_TRANSACTION: 'read-cashflow-account-transactions',
};
export const PreferencesAbility = {
Mutate: 'Mutate',
};
export const ExchangeRateAbility = {
View: 'view',
Create: 'create',
Delete: 'delete',
};
export const SubscriptionBillingAbility = {
View: 'view',
Payment: 'payment',
};

View File

@@ -39,6 +39,8 @@ const CLASSES = {
PAGE_FORM_ITEM: 'page-form--item',
PAGE_FORM_MAKE_JOURNAL: 'page-form--make-journal-entries',
PAGE_FORM_EXPENSE: 'page-form--expense',
PAGE_FORM_CREDIT_NOTE:'page-form--credit-note',
PAGE_FORM_VENDOR_CREDIT_NOTE:'page-form--vendor-credit-note',
FORM_GROUP_LIST_SELECT: 'form-group--select-list',
@@ -67,6 +69,7 @@ const CLASSES = {
PREFERENCES_PAGE_INSIDE_CONTENT_CURRENCIES: 'preferences-page__inside-content--currencies',
PREFERENCES_PAGE_INSIDE_CONTENT_ACCOUNTANT: 'preferences-page__inside-content--accountant',
PREFERENCES_PAGE_INSIDE_CONTENT_SMS_INTEGRATION: 'preferences-page__inside-content--sms-integration',
PREFERENCES_PAGE_INSIDE_CONTENT_ROLES_FORM: 'preferences-page__inside-content--roles-form',
FINANCIAL_REPORT_INSIDER: 'dashboard__insider--financial-report',

View File

@@ -14,4 +14,8 @@ export const DRAWERS = {
QUICK_WRITE_VENDOR: 'quick-write-vendor',
QUICK_CREATE_CUSTOMER: 'quick-create-customer',
QUICK_CREATE_ITEM: 'quick-create-item',
CREDIT_NOTE_DETAIL_DRAWER: 'credit-note-detail-drawer',
VENDOR_CREDIT_DETAIL_DRAWER: 'vendor-credit-detail-drawer',
REFUND_CREDIT_NOTE_DETAIL_DRAWER:'refund-credit-detail-drawer',
REFUND_VENDOR_CREDIT_DETAIL_DRAWER:'refund-vendor-detail-drawer'
};

View File

@@ -1,5 +1,21 @@
import React from 'react';
import { FormattedMessage as T } from 'components';
import {
SaleInvoiceAction,
SaleEstimateAction,
AbilitySubject,
SaleReceiptAction,
CustomerAction,
PaymentReceiveAction,
BillAction,
VendorAction,
PaymentMadeAction,
AccountAction,
ManualJournalAction,
ExpenseAction,
ItemAction,
ReportsAction,
} from '../common/abilityOption';
export const accountsReceivable = [
{
@@ -9,21 +25,29 @@ export const accountsReceivable = [
title: <T id={'sales_invoices'} />,
description: <T id={'tracking_sales_invoices_with_your_customers'} />,
link: '/invoices',
subject: AbilitySubject.Invoice,
ability: SaleInvoiceAction.View,
},
{
title: <T id={'sales_estimates'} />,
description: <T id={'manage_your_sales_estimates_to_create_quotes'} />,
link: '/estimates',
subject: AbilitySubject.Estimate,
ability: SaleEstimateAction.View,
},
{
title: <T id={'sales_receipts'} />,
description: <T id={'manage_sales_receipts_for_sales_that_get_paid'} />,
link: '/receipts',
subject: AbilitySubject.Receipt,
ability: SaleReceiptAction.View,
},
{
title: <T id={'customers'} />,
description: <T id={'manage_the_customers_relations_with_customer'} />,
link: '/customers',
subject: AbilitySubject.Customer,
ability: CustomerAction.View,
},
{
title: <T id={'customers_payments'} />,
@@ -31,6 +55,8 @@ export const accountsReceivable = [
<T id={'manage_payment_transactions_from_your_customers'} />
),
link: '/payment-receives',
subject: AbilitySubject.PaymentReceive,
ability: PaymentReceiveAction.View,
},
],
},
@@ -46,6 +72,8 @@ export const accountsPayable = [
<T id={'manage_the_purchase_invoices_with_your_vendors'} />
),
link: '/bills',
subject: AbilitySubject.Bill,
ability: BillAction.View,
},
{
title: <T id={'vendors'} />,
@@ -53,11 +81,15 @@ export const accountsPayable = [
<T id={'manage_the_vendors_relations_with_vendor_relations'} />
),
link: '/vendors',
subject: AbilitySubject.Vendor,
ability: VendorAction.View,
},
{
title: <T id={'vendors_payments'} />,
description: <T id={'manage_payments_transactions_to_your_vendors'} />,
link: '/payment-mades',
subject: AbilitySubject.PaymentMade,
ability: PaymentMadeAction.View,
},
],
},
@@ -77,21 +109,35 @@ export const financialAccounting = [
/>
),
link: '/accounts',
subject: AbilitySubject.Account,
ability: AccountAction.View,
},
{
title: <T id={'manual_journal'}/>,
description:<T id={'manage_manual_journal_transactions_on_accounts'}/>,
title: <T id={'manual_journal'} />,
description: (
<T id={'manage_manual_journal_transactions_on_accounts'} />
),
link: '/manual-journals',
subject: AbilitySubject.ManualJournal,
ability: ManualJournalAction.View,
},
{
title: <T id={'expenses'}/>,
description:<T id={'track_your_indirect_expenses_under_specific_categories'}/>,
title: <T id={'expenses'} />,
description: (
<T id={'track_your_indirect_expenses_under_specific_categories'} />
),
link: '/expenses',
subject: AbilitySubject.Expense,
ability: ExpenseAction.View,
},
{
title: <T id={'financial_statements'}/>,
description:<T id={'show_financial_reports_about_your_organization'}/>,
title: <T id={'financial_statements'} />,
description: (
<T id={'show_financial_reports_about_your_organization'} />
),
link: '/financial-reports',
subject: AbilitySubject.Report,
ability: ReportsAction.ALL,
},
],
},
@@ -102,19 +148,27 @@ export const productsServices = [
sectionTitle: <T id={'products_services_inventory'} />,
shortcuts: [
{
title: <T id={'products_services'}/>,
description:<T id={'manage_your_products_inventory_or_non_inventory'}/>,
title: <T id={'products_services'} />,
description: (
<T id={'manage_your_products_inventory_or_non_inventory'} />
),
link: '/items',
subject: AbilitySubject.Item,
ability: ItemAction.View,
},
{
title: <T id={'products_services_categories'}/>,
description:<T id={'group_your_products_and_service'}/>,
title: <T id={'products_services_categories'} />,
description: <T id={'group_your_products_and_service'} />,
link: 'items/categories',
},
{
title: <T id={'inventory_adjustments'}/>,
description: <T id={'manage_your_inventory_adjustment_of_inventory_items'}/>,
title: <T id={'inventory_adjustments'} />,
description: (
<T id={'manage_your_inventory_adjustment_of_inventory_items'} />
),
link: '/inventory-adjustments',
subject: AbilitySubject.InventoryAdjustment,
ability: SaleInvoiceAction.View,
},
],
},

4
src/common/index.js Normal file
View File

@@ -0,0 +1,4 @@
export * from './TableStyle';

View File

@@ -0,0 +1,51 @@
import intl from 'react-intl-universal';
import {
AbilitySubject,
SaleEstimateAction,
SaleReceiptAction,
SaleInvoiceAction,
BillAction,
} from '../common/abilityOption';
import { useAbilitiesFilter } from '../hooks';
export const getItemPaymentTransactions = () => [
{
name: 'invoices',
label: intl.get('invoices'),
permission: {
subject: AbilitySubject.Invoice,
ability: SaleInvoiceAction.View,
},
},
{
name: 'estimates',
label: intl.get('estimates'),
permission: {
subject: AbilitySubject.Estimate,
ability: SaleEstimateAction.View,
},
},
{
name: 'receipts',
label: intl.get('receipts'),
permission: {
subject: AbilitySubject.Receipt,
ability: SaleReceiptAction.View,
},
},
{
name: 'bills',
label: intl.get('bills'),
permission: {
subject: AbilitySubject.Bill,
ability: BillAction.View,
},
},
];
export const useGetItemPaymentTransactionsMenu = () => {
const itemTransactionMenu = getItemPaymentTransactions();
const abilitiesFilter = useAbilitiesFilter();
return abilitiesFilter(itemTransactionMenu);
};

View File

@@ -1,110 +1,228 @@
import React from 'react';
import intl from 'react-intl-universal';
import {
AbilitySubject,
AccountAction,
BillAction,
CashflowAction,
CustomerAction,
ExpenseAction,
ItemAction,
ManualJournalAction,
ReportsAction,
SaleEstimateAction,
SaleInvoiceAction,
SaleReceiptAction,
VendorAction,
} from './abilityOption';
export default [
{
shortcut_key: 'Shift + I',
description: intl.get('jump_to_the_invoices'),
permission: {
ability: SaleInvoiceAction.View,
subject: AbilitySubject.Invoice,
},
},
{
shortcut_key: 'Shift + E',
description: intl.get('jump_to_the_estimates'),
permission: {
ability: SaleEstimateAction.View,
subject: AbilitySubject.Estimate,
},
},
{
shortcut_key: 'Shift + R',
description: intl.get('jump_to_the_receipts'),
permission: {
ability: SaleReceiptAction.View,
subject: AbilitySubject.Receipt,
},
},
{
shortcut_key: 'Shift + X',
description: intl.get('jump_to_the_expenses'),
permission: {
ability: ExpenseAction.View,
subject: AbilitySubject.Expense,
},
},
{
shortcut_key: 'Shift + C',
description: intl.get('jump_to_the_customers'),
permission: {
ability: CustomerAction.View,
subject: AbilitySubject.Customer,
},
},
{
shortcut_key: 'Shift + V',
description: intl.get('jump_to_the_vendors'),
permission: {
ability: VendorAction.View,
subject: AbilitySubject.Vendor,
},
},
{
shortcut_key: 'Shift + A',
description: intl.get('jump_to_the_chart_of_accounts'),
permission: {
ability: AccountAction.View,
subject: AbilitySubject.Account,
},
},
{
shortcut_key: 'Shift + B',
description: intl.get('jump_to_the_bills'),
permission: {
ability: BillAction.View,
subject: AbilitySubject.Bill,
},
},
{
shortcut_key: 'Shift + M',
description: intl.get('jump_to_the_manual_journals'),
permission: {
ability: ManualJournalAction.View,
subject: AbilitySubject.ManualJournal,
},
},
{
shortcut_key: 'Shift + W',
description: intl.get('jump_to_the_items'),
permission: {
ability: ItemAction.View,
subject: AbilitySubject.Item,
},
},
{
shortcut_key: 'Shift + D',
description: intl.get('jump_to_the_add_money_in'),
permission: {
ability: CashflowAction.Create,
subject: AbilitySubject.Cashflow,
},
},
{
shortcut_key: 'Shift + Q',
description: intl.get('jump_to_the_add_money_out'),
permission: {
ability: CashflowAction.Create,
subject: AbilitySubject.Cashflow,
},
},
{
shortcut_key: 'Shift + 1',
description: intl.get('jump_to_the_balance_sheet'),
permission: {
ability: ReportsAction.READ_BALANCE_SHEET,
subject: AbilitySubject.Report,
},
},
{
shortcut_key: 'Shift + 2',
description: intl.get('jump_to_the_profit_loss_sheet'),
permission: {
ability: ReportsAction.READ_PROFIT_LOSS,
subject: AbilitySubject.Report,
},
},
{
shortcut_key: 'Shift + 3',
description: intl.get('jump_to_the_journal_sheet'),
permission: {
ability: ReportsAction.READ_JOURNAL,
subject: AbilitySubject.Report,
},
},
{
shortcut_key: 'Shift + 4',
description: intl.get('jump_to_the_general_ledger_sheet'),
permission: {
ability: ReportsAction.READ_GENERAL_LEDGET,
subject: AbilitySubject.Report,
},
},
{
shortcut_key: 'Shift + 5',
description: intl.get('jump_to_the_trial_balance_sheet'),
permission: {
ability: ReportsAction.READ_TRIAL_BALANCE_SHEET,
subject: AbilitySubject.Report,
},
},
{
shortcut_key: 'Ctrl + Shift + I ',
description: intl.get('create_a_new_invoice'),
permission: {
ability: SaleInvoiceAction.Create,
subject: AbilitySubject.Invoice,
},
},
{
shortcut_key: 'Ctrl + Shift + E ',
description: intl.get('create_a_new_estimate'),
permission: {
ability: SaleEstimateAction.Create,
subject: AbilitySubject.Estimate,
},
},
{
shortcut_key: 'Ctrl + Shift + R ',
description: intl.get('create_a_new_receipt'),
permission: {
ability: SaleReceiptAction.Create,
subject: AbilitySubject.Receipt,
},
},
{
shortcut_key: 'Ctrl + Shift + X ',
description: intl.get('create_a_new_expense'),
permission: {
ability: ExpenseAction.Create,
subject: AbilitySubject.Expense,
},
},
{
shortcut_key: 'Ctrl + Shift + C ',
description: intl.get('create_a_new_customer'),
permission: {
ability: CustomerAction.Create,
subject: AbilitySubject.Customer,
},
},
{
shortcut_key: 'Ctrl + Shift + V ',
description: intl.get('create_a_new_vendor'),
permission: {
ability: VendorAction.Create,
subject: AbilitySubject.Vendor,
},
},
{
shortcut_key: 'Ctrl + Shift + B ',
description: intl.get('create_a_new_bill'),
permission: {
ability: BillAction.Create,
subject: AbilitySubject.Bill,
},
},
{
shortcut_key: 'Ctrl + Shift + M ',
description: intl.get('create_a_new_journal'),
permission: {
ability: ManualJournalAction.Create,
subject: AbilitySubject.ManualJournal,
},
},
{
shortcut_key: 'Ctrl + Shift + W ',
description: intl.get('create_a_new_item'),
permission: {
ability: ItemAction.Create,
subject: AbilitySubject.Item,
},
},
{
shortcut_key: 'Ctrl + / ',

View File

@@ -0,0 +1,659 @@
import { chain } from 'lodash';
import intl from 'react-intl-universal';
import {
AbilitySubject,
AccountAction,
BillAction,
CreditNoteAction,
CustomerAction,
ExpenseAction,
ItemAction,
ManualJournalAction,
PaymentMadeAction,
PaymentReceiveAction,
ReportsAction,
SaleEstimateAction,
SaleInvoiceAction,
SaleReceiptAction,
VendorAction,
VendorCreditAction,
} from './abilityOption';
export const ModulePermissionsStyle = {
Columns: 'columns',
Vertical: 'vertical',
};
const PermissionColumn = {
View: 'view',
Create: 'create',
Delete: 'delete',
Edit: 'edit',
};
export const getPermissionsSchema = () => [
{
label: intl.get('permissions.items_inventory'),
type: ModulePermissionsStyle.Columns,
serviceFullAccess: true,
columns: [
{ label: intl.get('permissions.column.view'), key: 'view' },
{ label: intl.get('permissions.column.create'), key: 'create' },
{ label: intl.get('permissions.column.edit'), key: 'edit' },
{ label: intl.get('permissions.column.delete'), key: 'delete' },
],
services: [
{
label: intl.get('permissions.items'),
subject: AbilitySubject.Item,
permissions: [
{
label: intl.get('permissions.column.view'),
key: ItemAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: ItemAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: ItemAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: ItemAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: ItemAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: ItemAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: ItemAction.Edit }],
},
],
},
{
label: intl.get('permissions.inventory_adjustment'),
subject: AbilitySubject.InventoryAdjustment,
permissions: [
{
label: 'View',
key: ItemAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: 'Create',
key: ItemAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: ItemAction.View }],
},
{
label: 'Edit',
key: ItemAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: ItemAction.Create }],
},
{
label: 'Delete',
key: ItemAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: ItemAction.Edit }],
},
],
},
],
},
{
label: intl.get('permissions.contacts'),
type: ModulePermissionsStyle.Columns,
serviceFullAccess: true,
moduleFullAccess: true,
columns: [
{ label: intl.get('permissions.column.view'), key: 'view' },
{ label: intl.get('permissions.column.create'), key: 'create' },
{ label: intl.get('permissions.column.edit'), key: 'edit' },
{ label: intl.get('permissions.column.delete'), key: 'delete' },
],
services: [
{
label: intl.get('permissions.customers'),
subject: AbilitySubject.Customer,
permissions: [
{
label: intl.get('permissions.column.view'),
key: CustomerAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: CustomerAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: CustomerAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: CustomerAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: CustomerAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: CustomerAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: CustomerAction.Edit }],
},
],
},
{
label: intl.get('permissions.vendors'),
subject: AbilitySubject.Vendor,
permissions: [
{
label: intl.get('permissions.column.view'),
key: VendorAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: VendorAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: VendorAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: VendorAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: VendorAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: VendorAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: VendorAction.Edit }],
},
],
},
],
},
{
label: intl.get('permissions.sales'),
type: ModulePermissionsStyle.Columns,
serviceFullAccess: true,
moduleFullAccess: true,
columns: [
{ label: intl.get('permissions.column.view'), key: 'view' },
{ label: intl.get('permissions.column.create'), key: 'create' },
{ label: intl.get('permissions.column.edit'), key: 'edit' },
{ label: intl.get('permissions.column.delete'), key: 'delete' },
],
services: [
{
label: intl.get('permissions.sale_invoice'),
subject: AbilitySubject.Invoice,
permissions: [
{
label: intl.get('permissions.column.view'),
key: SaleInvoiceAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: SaleInvoiceAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: SaleInvoiceAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: SaleInvoiceAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: SaleInvoiceAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: SaleInvoiceAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: SaleInvoiceAction.Edit }],
},
{
label: intl.get('permissions.column.written_off_invoice'),
key: SaleInvoiceAction.Writeoff,
depend: [{ key: SaleInvoiceAction.Edit }],
},
],
},
{
label: intl.get('permissions.sale_estimate'),
subject: AbilitySubject.Estimate,
permissions: [
{
label: intl.get('permissions.column.view'),
key: SaleEstimateAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: SaleEstimateAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: SaleEstimateAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: SaleEstimateAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: SaleEstimateAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: SaleEstimateAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: SaleEstimateAction.Edit }],
},
],
},
{
label: intl.get('permissions.sale_receipt'),
subject: AbilitySubject.Receipt,
permissions: [
{
label: intl.get('permissions.column.view'),
key: SaleReceiptAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: SaleReceiptAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: SaleReceiptAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: SaleReceiptAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: SaleReceiptAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: SaleReceiptAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: SaleReceiptAction.Edit }],
},
],
},
{
label: intl.get('permissions.credit_note'),
subject: AbilitySubject.CreditNote,
permissions: [
{
label: intl.get('permissions.column.view'),
key: CreditNoteAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: CreditNoteAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: CreditNoteAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: CreditNoteAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: CreditNoteAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: CreditNoteAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: CreditNoteAction.Edit }],
},
{
label: intl.get('permissions.column.refund_credit_note'),
key: CreditNoteAction.Refund,
depend: [{ key: CreditNoteAction.View }],
},
],
},
{
label: intl.get('permissions.payment_receive'),
subject: AbilitySubject.PaymentReceive,
permissions: [
{
label: intl.get('permissions.column.view'),
key: PaymentReceiveAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: PaymentReceiveAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: PaymentReceiveAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: PaymentReceiveAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: PaymentReceiveAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: PaymentReceiveAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: PaymentReceiveAction.Edit }],
},
],
},
],
},
{
label: intl.get('permissions.purchases'),
type: ModulePermissionsStyle.Columns,
serviceFullAccess: true,
moduleFullAccess: true,
columns: [
{ label: intl.get('permissions.column.view'), key: 'view' },
{ label: intl.get('permissions.column.create'), key: 'create' },
{ label: intl.get('permissions.column.edit'), key: 'edit' },
{ label: intl.get('permissions.column.delete'), key: 'delete' },
],
services: [
{
label: intl.get('permissions.bills'),
subject: AbilitySubject.Bill,
permissions: [
{
label: intl.get('permissions.column.view'),
key: BillAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: BillAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: BillAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: BillAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: BillAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: BillAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: BillAction.Edit }],
},
],
},
{
label: intl.get('permissions.vendor_credits'),
subject: AbilitySubject.VendorCredit,
permissions: [
{
label: intl.get('permissions.column.view'),
key: VendorCreditAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: VendorCreditAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: VendorCreditAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: VendorCreditAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: VendorCreditAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: VendorCreditAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: VendorCreditAction.Edit }],
},
{
label: intl.get('permissions.column.refund_vendor_credit'),
key: VendorCreditAction.Refund,
depend: [{ key: VendorCreditAction.View }],
},
],
},
{
label: intl.get('permissions.payment_made'),
subject: AbilitySubject.PaymentMade,
permissions: [
{
label: intl.get('permissions.column.view'),
key: PaymentMadeAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: PaymentMadeAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: PaymentMadeAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: PaymentMadeAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: PaymentMadeAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: PaymentMadeAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: PaymentMadeAction.Edit }],
},
],
},
],
},
{
label: intl.get('permissions.financial_accounting'),
type: ModulePermissionsStyle.Columns,
serviceFullAccess: true,
moduleFullAccess: true,
columns: [
{ label: intl.get('permissions.column.view'), key: 'view' },
{ label: intl.get('permissions.column.create'), key: 'create' },
{ label: intl.get('permissions.column.edit'), key: 'edit' },
{ label: intl.get('permissions.column.delete'), key: 'delete' },
],
services: [
{
label: intl.get('permissions.manual_journals'),
subject: AbilitySubject.ManualJournal,
permissions: [
{
label: intl.get('permissions.column.view'),
key: ManualJournalAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: ManualJournalAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: ManualJournalAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: ManualJournalAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: ManualJournalAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: ManualJournalAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: ManualJournalAction.Edit }],
},
],
},
{
label: intl.get('permissions.chart_of_accounts'),
subject: AbilitySubject.Account,
permissions: [
{
label: intl.get('permissions.column.view'),
key: AccountAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: AccountAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: AccountAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: AccountAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: AccountAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: AccountAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: AccountAction.Edit }],
},
{
label: intl.get('permissions.column.transactions_locking'),
key: AccountAction.TransactionsLocking,
},
],
},
{
label: intl.get('permissions.expenses'),
subject: AbilitySubject.Expense,
permissions: [
{
label: intl.get('permissions.column.view'),
key: ExpenseAction.View,
relatedColumn: PermissionColumn.View,
},
{
label: intl.get('permissions.column.create'),
key: ExpenseAction.Create,
relatedColumn: PermissionColumn.Create,
depend: [{ key: ExpenseAction.View }],
},
{
label: intl.get('permissions.column.edit'),
key: ExpenseAction.Edit,
relatedColumn: PermissionColumn.Edit,
depend: [{ key: ExpenseAction.Create }],
},
{
label: intl.get('permissions.column.delete'),
key: ExpenseAction.Delete,
relatedColumn: PermissionColumn.Delete,
depend: [{ key: ExpenseAction.Edit }],
},
],
},
],
},
{
label: intl.get('permissions.reports'),
type: ModulePermissionsStyle.Vertical,
serviceFullAccess: true,
moduleFullAccess: true,
services: [
{
label: intl.get('permissions.financial_reports'),
subject: AbilitySubject.Report,
permissions: [
{
label: intl.get('permissions.balance_sheet'),
key: ReportsAction.READ_BALANCE_SHEET,
},
{
label: intl.get('permissions.trial_balance_sheet'),
key: ReportsAction.READ_TRIAL_BALANCE_SHEET,
},
{
label: intl.get('permissions.profit_loss_sheet'),
key: ReportsAction.READ_PROFIT_LOSS,
},
{
label: intl.get('permissions.cash_flow_sheet'),
key: ReportsAction.READ_CASHFLOW,
},
{
label: intl.get('permissions.journal_sheet'),
key: ReportsAction.READ_JOURNAL,
},
{
label: intl.get('permissions.general_ledger'),
key: ReportsAction.READ_GENERAL_LEDGET,
},
{
label: intl.get('permissions.a_r_aging_summary_report'),
key: ReportsAction.READ_AR_AGING_SUMMARY,
},
{
label: intl.get('permissions.a_r_aging_summary_report'),
key: ReportsAction.READ_AP_AGING_SUMMARY,
},
{
label: intl.get('permissions.purchases_by_items'),
key: ReportsAction.READ_PURCHASES_BY_ITEMS,
},
{
label: intl.get('permissions.sales_by_items'),
key: ReportsAction.READ_SALES_BY_ITEMS,
},
{
label: intl.get('permissions.customers_transactions'),
key: ReportsAction.READ_CUSTOMERS_TRANSACTIONS,
},
{
label: intl.get('permissions.vendors_transactions'),
key: ReportsAction.READ_VENDORS_TRANSACTIONS,
},
{
label: intl.get('permissions.customers_summary_balance'),
key: ReportsAction.READ_CUSTOMERS_SUMMARY_BALANCE,
},
{
label: intl.get('permissions.vendors_summary_balance'),
key: ReportsAction.READ_VENDORS_SUMMARY_BALANCE,
},
{
label: intl.get('permissions.inventory_valuation_summary'),
key: ReportsAction.READ_INVENTORY_VALUATION_SUMMARY,
},
{
label: intl.get('permissions.inventory_items_details'),
key: ReportsAction.READ_INVENTORY_ITEM_DETAILS,
},
{
label: intl.get('permissions.cashflow_account_transactions'),
key: ReportsAction.READ_CASHFLOW_ACCOUNT_TRANSACTION,
},
],
},
],
},
];
export function getPermissionsSchemaService(subject) {
const permissions = getPermissionsSchema();
return chain(permissions)
.map((perm) => perm.services)
.flatten()
.find((service) => service.subject === subject)
.value();
}
export function getPermissionsSchemaServices() {
const permissions = getPermissionsSchema();
return chain(permissions)
.map((module) => module.services)
.flatten()
.value();
}

View File

@@ -1,10 +1,71 @@
import intl from 'react-intl-universal';
import {
AbilitySubject,
SaleInvoiceAction,
CustomerAction,
VendorAction,
ManualJournalAction,
ExpenseAction,
} from '../common/abilityOption';
import { useAbilitiesFilter } from '../hooks';
export const getQuickNewActions = () => [
{ path: 'invoices/new', name: intl.get('sale_invoice') },
{ path: 'bills/new', name: intl.get('purchase_invoice') },
{ path: 'make-journal-entry', name: intl.get('manual_journal') },
{ path: 'expenses/new', name: intl.get('expense') },
{ path: 'customers/new', name: intl.get('customer') },
{ path: 'vendors/new', name: intl.get('vendor') },
{
path: 'invoices/new',
name: intl.get('sale_invoice'),
permission: {
subject: AbilitySubject.Invoice,
ability: SaleInvoiceAction.Create,
},
},
{
path: 'bills/new',
name: intl.get('purchase_invoice'),
permission: {
subject: AbilitySubject.Invoice,
ability: SaleInvoiceAction.Create,
},
},
{
path: 'make-journal-entry',
name: intl.get('manual_journal'),
permission: {
subject: AbilitySubject.ManualJournal,
ability: ManualJournalAction.Create,
},
},
{
path: 'expenses/new',
name: intl.get('expense'),
permission: {
subject: AbilitySubject.Expense,
ability: ExpenseAction.Create,
},
},
{
path: 'customers/new',
name: intl.get('customer'),
permission: {
subject: AbilitySubject.Customer,
ability: CustomerAction.Create,
},
},
{
path: 'vendors/new',
name: intl.get('vendor'),
permission: {
subject: AbilitySubject.Vendor,
ability: VendorAction.Vendor,
},
},
];
/**
* Retrieve the dashboard quick new menu items.
*/
export const useGetQuickNewMenu = () => {
const quickNewMenu = getQuickNewActions();
const abilitiesFilter = useAbilitiesFilter();
return abilitiesFilter(quickNewMenu);
};

View File

@@ -11,4 +11,6 @@ export const RESOURCES_TYPES = {
EXPENSE: 'expense',
MANUAL_JOURNAL: 'manual_journal',
ACCOUNT: 'account',
CREDIT_NOTE: 'credit_note',
VENDOR_CREDIT:'vendor_credit'
};

View File

@@ -14,6 +14,8 @@ export const TABLES = {
EXPENSES: 'expenses',
CASHFLOW_ACCOUNTS: 'cashflow_accounts',
CASHFLOW_Transactions: 'cashflow_transactions',
CREDIT_NOTES: 'credit_notes',
VENDOR_CREDITS: 'vendor_credits',
};
export const TABLE_SIZE = {

View File

@@ -3,6 +3,7 @@ import { MenuItem, Button } from '@blueprintjs/core';
import { Select } from '@blueprintjs/select';
import * as R from 'ramda';
import classNames from 'classnames';
import intl from 'react-intl-universal'
import { MenuItemNestedText, FormattedMessage as T } from 'components';
import { filterAccountsByQuery } from './utils';
@@ -16,7 +17,7 @@ const createNewItemRenderer = (query, active, handleClick) => {
return (
<MenuItem
icon="add"
text={`Create "${query}"`}
text={intl.get('list.create', { value: `"${query}"` })}
active={active}
onClick={handleClick}
/>

View File

@@ -18,7 +18,7 @@ const createNewItemRenderer = (query, active, handleClick) => {
return (
<MenuItem
icon="add"
text={`Create "${query}"`}
text={intl.get('list.create', { value: `"${query}"` })}
active={active}
onClick={handleClick}
/>

View File

@@ -1,17 +1,60 @@
import React from 'react';
import clsx from 'classnames';
import styled from 'styled-components';
import Style from './style.module.scss';
export function Alert({ title, description, intent }) {
export function Alert({ title, description, children, intent, className }) {
return (
<div
className={clsx(Style.root, {
[`${Style['root_' + intent]}`]: intent,
})}
>
{title && <h3 className={clsx(Style.title)}>{title}</h3>}
{description && <p class={clsx(Style.description)}>{description}</p>}
</div>
<AlertRoot className={clsx(className)} intent={intent}>
{title && <AlertTitle>{title}</AlertTitle>}
{description && <AlertDesc>{description}</AlertDesc>}
{children && <AlertDesc>{children}</AlertDesc>}
</AlertRoot>
);
}
const AlertRoot = styled.div`
border: 1px solid rgb(223, 227, 230);
padding: 12px;
border-radius: 6px;
margin-bottom: 20px;
${(props) =>
props.intent === 'danger' &&
`
border-color: rgb(249, 198, 198);
background: rgb(255, 248, 248);
${AlertDesc} {
color: #d95759;
}
${AlertTitle} {
color: rgb(205, 43, 49);
}
`}
${(props) =>
props.intent === 'primary' &&
`
background: #fff;
border-color: #98a8ee;
${AlertTitle} {
color: #1a3bd4;
}
${AlertDesc} {
color: #455883;
}
`}
`;
export const AlertTitle = styled.h3`
color: rgb(17, 24, 28);
margin-bottom: 4px;
font-size: 14px;
font-weight: 600;
`;
export const AlertDesc = styled.p`
color: rgb(104, 112, 118);
margin: 0;
`;

View File

@@ -1,32 +0,0 @@
.root {
border: 1px solid rgb(223, 227, 230);
padding: 12px;
border-radius: 6px;
margin-bottom: 20px;
&_danger {
border-color: rgb(249, 198, 198);
background: rgb(255, 248, 248);
.description {
color: #d95759;
}
.title {
color: rgb(205, 43, 49);
}
}
}
.title {
color: rgb(17, 24, 28);
margin-bottom: 4px;
font-size: 14px;
font-weight: 600;
}
.description {
color: rgb(104, 112, 118);
margin: 0;
}

View File

@@ -4,7 +4,6 @@ import styled from 'styled-components';
import { Classes } from '@blueprintjs/core';
import clsx from 'classnames';
import Icon from '../Icon';
import { whenRtl, whenLtr } from 'utils/styled-components';
const ACCOUNT_TYPE = {
CASH: 'cash',
@@ -185,9 +184,7 @@ const MetaLineValue = styled.div`
text-align: center;
color: rgb(23, 43, 77);
font-size: 11px;
${whenLtr(`margin-left: auto;`)}
${whenRtl(`margin-right: auto;`)}
margin-left: auto;
`;
const BankAccountMeta = styled.div`
@@ -204,7 +201,5 @@ const AccountIconWrap = styled.div`
position: absolute;
top: 14px;
color: #abb3bb;
${whenLtr(`right: 12px;`)}
${whenRtl(`left: 12px;`)}
right: 12px;
`;

View File

@@ -5,6 +5,7 @@ export const ButtonLink = styled.button`
border: 0;
background: transparent;
cursor: pointer;
text-align: inherit;
&:hover,
&:active {

View File

@@ -1,6 +0,0 @@
import React from 'react';
import classNames from 'classnames';
export default function Card({ className, children }) {
return <div className={classNames('card', className)}>{children}</div>;
}

View File

@@ -0,0 +1,27 @@
import React from 'react';
import styled from 'styled-components';
export function Card({ className, children }) {
return <CardRoot className={className}>{children}</CardRoot>;
}
const CardRoot = styled.div`
padding: 15px;
margin: 15px;
background: #fff;
border: 1px solid #d2dce2;
`;
export const CardFooterActions = styled.div`
padding-top: 16px;
border-top: 1px solid #e0e7ea;
margin-top: 30px;
.bp3-button {
min-width: 70px;
+ .bp3-button {
margin-left: 10px;
}
}
`;

View File

@@ -0,0 +1,25 @@
import styled from 'styled-components';
import { Card } from '../Card';
import DataTable from '../DataTable';
export const CommercialDocBox = styled(Card)`
padding: 22px 20px;
`;
export const CommercialDocHeader = styled.div`
margin-bottom: 25px;
`;
export const CommercialDocTopHeader = styled.div`
margin-bottom: 25px;
`;
export const CommercialDocEntriesTable = styled(DataTable)`
.tbody .tr:last-child .td {
border-bottom: 1px solid #d2dce2;
}
`;
export const CommercialDocFooter = styled.div`
margin-top: 25px;
`;

View File

@@ -1,4 +1,5 @@
import React from 'react';
import intl from 'react-intl-universal';
import { MenuItem } from '@blueprintjs/core';
// Filter Contact List
@@ -34,7 +35,7 @@ export const createNewItemRenderer = (query, active, handleClick) => {
return (
<MenuItem
icon="add"
text={`Create "${query}"`}
text={intl.get('list.create', { value: `"${query}"` })}
active={active}
shouldDismissPopover={false}
onClick={handleClick}

View File

@@ -0,0 +1,25 @@
import React from 'react';
import * as R from 'ramda';
import { ButtonLink } from 'components';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
function CustomerDrawerLinkComponent({
// #ownProps
children,
customerId,
// #withDrawerActions
openDrawer,
}) {
// Handle view customer drawer.
const handleCustomerDrawer = () => {
openDrawer('customer-details-drawer', { customerId });
};
return <ButtonLink onClick={handleCustomerDrawer}>{children}</ButtonLink>;
}
export const CustomerDrawerLink = R.compose(withDrawerActions)(
CustomerDrawerLinkComponent,
);

View File

@@ -0,0 +1 @@
export * from './CustomerDrawerLink';

View File

@@ -1,28 +0,0 @@
import React from 'react';
import { useUser } from 'hooks/query';
import withAuthentication from '../../containers/Authentication/withAuthentication';
const AuthenticatedUserContext = React.createContext();
function AuthenticatedUserComponent({ authenticatedUserId, children }) {
const { data: user, ...restProps } = useUser(authenticatedUserId);
return (
<AuthenticatedUserContext.Provider
value={{
user,
...restProps,
}}
children={children}
/>
);
}
export const AuthenticatedUser = withAuthentication(
({ authenticatedUserId }) => ({
authenticatedUserId,
}),
)(AuthenticatedUserComponent);
export const useAuthenticatedUser = () =>
React.useContext(AuthenticatedUserContext);

View File

@@ -0,0 +1,25 @@
import React from 'react';
import { Ability } from '@casl/ability';
import { createContextualCan } from '@casl/react';
import { useDashboardMeta } from '../../hooks/query';
export const AbilityContext = React.createContext();
export const Can = createContextualCan(AbilityContext.Consumer);
/**
* Dashboard ability provider.
*/
export function DashboardAbilityProvider({ children }) {
const {
data: { abilities },
} = useDashboardMeta();
// Ability instance.
const ability = new Ability(abilities);
return (
<AbilityContext.Provider value={ability}>
{children}
</AbilityContext.Provider>
);
}

View File

@@ -1,16 +1,19 @@
import React from 'react';
import classnames from 'classnames';
import clsx from 'classnames';
import { Navbar } from '@blueprintjs/core';
export default function DashboardActionsBar({ children, name }) {
export default function DashboardActionsBar({ className, children, name }) {
return (
<div
className={classnames({
'dashboard__actions-bar': true,
[`dashboard__actions-bar--${name}`]: !!name
})}
className={clsx(
{
'dashboard__actions-bar': true,
[`dashboard__actions-bar--${name}`]: !!name,
},
className,
)}
>
<Navbar className='navbar--dashboard-actions-bar'>{children}</Navbar>
<Navbar className="navbar--dashboard-actions-bar">{children}</Navbar>
</div>
);
}

View File

@@ -1,18 +1,53 @@
import React from 'react';
import * as R from 'ramda';
import { useUser, useCurrentOrganization } from '../../hooks/query';
import {
useAuthenticatedAccount,
useCurrentOrganization,
useDashboardMeta,
} from '../../hooks/query';
import { useSplashLoading } from '../../hooks/state';
import { useWatch, useWatchImmediate, useWhen } from '../../hooks';
import withAuthentication from '../../containers/Authentication/withAuthentication';
import { setCookie, getCookie } from '../../utils';
/**
* Dashboard async booting.
* Dashboard meta async booting.
*/
function DashboardBootJSX({ authenticatedUserId }) {
export function useDashboardMetaBoot() {
const {
data: dashboardMeta,
isLoading: isDashboardMetaLoading,
isSuccess: isDashboardMetaSuccess,
} = useDashboardMeta({
keepPreviousData: true,
});
const [startLoading, stopLoading] = useSplashLoading();
useWatchImmediate((value) => {
value && startLoading();
}, isDashboardMetaLoading);
useWatchImmediate(() => {
isDashboardMetaSuccess && stopLoading();
}, isDashboardMetaSuccess);
return {
isLoading: isDashboardMetaLoading,
};
}
/**
* Dashboard async booting.
* @returns {{ isLoading: boolean }}
*/
export function useDashboardBoot() {
const { isLoading } = useDashboardMetaBoot();
return { isLoading };
}
/**
* Application async booting.
*/
export function useApplicationBoot() {
// Fetches the current user's organization.
const {
isSuccess: isCurrentOrganizationSuccess,
@@ -22,7 +57,7 @@ function DashboardBootJSX({ authenticatedUserId }) {
// Authenticated user.
const { isSuccess: isAuthUserSuccess, isLoading: isAuthUserLoading } =
useUser(authenticatedUserId);
useAuthenticatedAccount();
// Initial locale cookie value.
const localeCookie = getCookie('locale');
@@ -86,11 +121,8 @@ function DashboardBootJSX({ authenticatedUserId }) {
isBooted.current = true;
},
);
return null;
}
export const DashboardBoot = R.compose(
withAuthentication(({ authenticatedUserId }) => ({
authenticatedUserId,
})),
)(DashboardBootJSX);
return {
isLoading: isOrgLoading || isAuthUserLoading,
};
}

View File

@@ -1,8 +1,16 @@
import React from 'react';
import { DashboardAbilityProvider } from '../../components';
import { useDashboardBoot } from './DashboardBoot';
/**
* Dashboard provider.
*/
export default function DashboardProvider({ children }) {
return children;
const { isLoading } = useDashboardBoot();
// Avoid display any dashboard component before complete booting.
if (isLoading) {
return null;
}
return <DashboardAbilityProvider>{children}</DashboardAbilityProvider>;
}

View File

@@ -1,9 +1,16 @@
import React from 'react';
import { ThemeProvider } from 'styled-components';
import { ThemeProvider, StyleSheetManager } from 'styled-components';
import rtlcss from 'stylis-rtlcss';
import { useAppIntlContext } from '../AppIntlProvider';
export function DashboardThemeProvider({ children }) {
const { direction } = useAppIntlContext();
return <ThemeProvider theme={{ dir: direction }}>{children}</ThemeProvider>;
return (
<StyleSheetManager
{...(direction === 'rtl' ? { stylisPlugins: [rtlcss] } : {})}
>
<ThemeProvider theme={{ dir: direction }}>{children}</ThemeProvider>
</StyleSheetManager>
);
}

View File

@@ -23,6 +23,7 @@ import withDashboard from 'containers/Dashboard/withDashboard';
import QuickNewDropdown from 'containers/QuickNewDropdown/QuickNewDropdown';
import { compose } from 'utils';
import withSubscriptions from '../../containers/Subscriptions/withSubscriptions';
import { useGetUniversalSearchTypeOptions } from '../../containers/UniversalSearch/utils';
function DashboardTopbarSubscriptionMessage() {
return (
@@ -142,11 +143,8 @@ function DashboardTopbar({
<Navbar class="dashboard__topbar-navbar">
<NavbarGroup>
<If condition={isSubscriptionActive}>
<Button
<DashboardQuickSearchButton
onClick={() => openGlobalSearch(true)}
className={Classes.MINIMAL}
icon={<Icon icon={'search-24'} iconSize={20} />}
text={<T id={'quick_find'} />}
/>
<QuickNewDropdown />
@@ -195,3 +193,23 @@ export default compose(
'main',
),
)(DashboardTopbar);
/**
* Dashboard quick search button.
*/
function DashboardQuickSearchButton({ ...rest }) {
const searchTypeOptions = useGetUniversalSearchTypeOptions();
// Can't continue if there is no any search type option.
if (searchTypeOptions.length <= 0) {
return null;
}
return (
<Button
className={Classes.MINIMAL}
icon={<Icon icon={'search-24'} iconSize={20} />}
text={<T id={'quick_find'} />}
{...rest}
/>
);
}

View File

@@ -1,31 +1,15 @@
import React from 'react';
import * as R from 'ramda';
import { AuthenticatedUser } from './AuthenticatedUser';
import { DashboardBoot } from '../../components';
import withDashboard from '../../containers/Dashboard/withDashboard';
import { useApplicationBoot } from '../../components';
/**
* Private pages provider.
*/
function PrivatePagesProviderComponent({
splashScreenCompleted,
export function PrivatePagesProvider({
// #ownProps
children,
}) {
return (
<AuthenticatedUser>
<DashboardBoot />
const { isLoading } = useApplicationBoot();
{splashScreenCompleted ? children : null}
</AuthenticatedUser>
);
return <React.Fragment>{!isLoading ? children : null}</React.Fragment>;
}
export const PrivatePagesProvider = R.compose(
withDashboard(({ splashScreenCompleted }) => ({
splashScreenCompleted,
})),
)(PrivatePagesProviderComponent);

View File

@@ -14,10 +14,14 @@ import { firstLettersArgs } from 'utils';
import { useAuthActions } from 'hooks/state';
import withDialogActions from 'containers/Dialog/withDialogActions';
import { compose } from 'utils';
import withSubscriptions from '../../containers/Subscriptions/withSubscriptions';
import { useAuthenticatedUser } from './AuthenticatedUser';
import { useAuthenticatedAccount } from 'hooks/query'
import { compose } from 'utils';
/**
* Dashboard topbar user.
*/
function DashboardTopbarUser({
openDialog,
@@ -28,7 +32,7 @@ function DashboardTopbarUser({
const { setLogout } = useAuthActions();
// Retrieve authenticated user information.
const { user } = useAuthenticatedUser();
const { data: user } = useAuthenticatedAccount();
const onClickLogout = () => {
setLogout();

View File

@@ -1,3 +1,4 @@
export * from './SplashScreen';
export * from './DashboardBoot';
export * from './DashboardThemeProvider';
export * from './DashboardAbilityProvider';

View File

@@ -16,6 +16,7 @@ export default function TableWrapper({ children }) {
expandable,
virtualizedRows,
className,
styleName,
size,
},
} = useContext(TableContext);
@@ -28,6 +29,7 @@ export default function TableWrapper({ children }) {
'is-expandable': expandable,
'is-loading': loading,
'has-virtualized-rows': virtualizedRows,
[`table--${styleName}`]: styleName,
})}
>
<ScrollSync>

View File

@@ -17,6 +17,7 @@ const useDetailsMenuContext = () => React.useContext(DetailsMenuContext);
export function DetailsMenu({
children,
direction = DIRECTION.VERTICAL,
textAlign,
minLabelSize,
className,
}) {
@@ -27,6 +28,7 @@ export function DetailsMenu({
{
'details-menu--vertical': direction === DIRECTION.VERTICAL,
'details-menu--horizantal': direction === DIRECTION.HORIZANTAL,
[`align-${textAlign}`]: textAlign,
},
className,
)}

View File

@@ -0,0 +1,15 @@
import React from 'react';
import styled from 'styled-components';
import { Classes } from '@blueprintjs/core';
export function DialogFooter({ children }) {
return (
<DialogFooterRoot className={Classes.DIALOG_FOOTER}>
{children}
</DialogFooterRoot>
);
}
const DialogFooterRoot = styled.div`
display: flex;
`;

View File

@@ -2,6 +2,10 @@ import React from 'react';
import styled from 'styled-components';
import { Classes } from '@blueprintjs/core';
/**
* Dialog footer actions.
* @returns {React.JSX}
*/
export function DialogFooterActions({ alignment = 'right', children }) {
return (
<DialogFooterActionsRoot
@@ -13,14 +17,25 @@ export function DialogFooterActions({ alignment = 'right', children }) {
);
}
/**
* Dialog footer.
* @returns {React.JSX}
*/
export function DialogFooter({ ...props }) {
return <DialogFooterRoot {...props} />;
}
const DialogFooterRoot = styled.div`
flex: 0 0 auto;
margin: 0 20px;
`;
const DialogFooterActionsRoot = styled.div`
margin-left: -10px;
margin-right: -10px;
justify-content: ${(props) =>
props.alignment === 'right' ? 'flex-end' : 'flex-start'};
${(props) =>
props.alignment === 'right' ? 'margin-left: auto;' : 'margin-right: auto;'};
.bp3-button {
margin-left: 10px;
margin-left: 10px;
margin-left: 5px;
margin-left: 5px;
}
`;

View File

@@ -3,4 +3,5 @@
export * from './Dialog';
export * from './DialogFooterActions';
export * from './DialogSuspense';
export * from './DialogContent';
export * from './DialogContent';
export * from './DialogFooter';

View File

@@ -23,8 +23,15 @@ import BadDebtDialog from '../containers/Dialogs/BadDebtDialog';
import NotifyInvoiceViaSMSDialog from '../containers/Dialogs/NotifyInvoiceViaSMSDialog';
import NotifyReceiptViaSMSDialog from '../containers/Dialogs/NotifyReceiptViaSMSDialog';
import NotifyEstimateViaSMSDialog from '../containers/Dialogs/NotifyEstimateViaSMSDialog';
import NotifyPaymentReceiveViaSMSDialog from '../containers/Dialogs/NotifyPaymentReceiveViaSMSDialog'
import NotifyPaymentReceiveViaSMSDialog from '../containers/Dialogs/NotifyPaymentReceiveViaSMSDialog';
import SMSMessageDialog from '../containers/Dialogs/SMSMessageDialog';
import RefundCreditNoteDialog from '../containers/Dialogs/RefundCreditNoteDialog';
import RefundVendorCreditDialog from '../containers/Dialogs/RefundVendorCreditDialog';
import ReconcileCreditNoteDialog from '../containers/Dialogs/ReconcileCreditNoteDialog';
import ReconcileVendorCreditDialog from '../containers/Dialogs/ReconcileVendorCreditDialog';
import LockingTransactionsDialog from '../containers/Dialogs/LockingTransactionsDialog';
import UnlockingTransactionsDialog from '../containers/Dialogs/UnlockingTransactionsDialog';
import UnlockingPartialTransactionsDialog from '../containers/Dialogs/UnlockingPartialTransactionsDialog';
/**
* Dialogs container.
@@ -58,6 +65,15 @@ export default function DialogsContainer() {
<BadDebtDialog dialogName={'write-off-bad-debt'} />
<SMSMessageDialog dialogName={'sms-message-form'} />
<RefundCreditNoteDialog dialogName={'refund-credit-note'} />
<RefundVendorCreditDialog dialogName={'refund-vendor-credit'} />
<ReconcileCreditNoteDialog dialogName={'reconcile-credit-note'} />
<ReconcileVendorCreditDialog dialogName={'reconcile-vendor-credit'} />
<LockingTransactionsDialog dialogName={'locking-transactions'} />
<UnlockingTransactionsDialog dialogName={'unlocking-transactions'} />
<UnlockingPartialTransactionsDialog
dialogName={'unlocking-partial-transactions'}
/>
</div>
);
}

View File

@@ -0,0 +1,12 @@
import React from 'react';
import styled from 'styled-components';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
export function DrawerActionsBar({ ...props }) {
return <DrawerActionsBarRoot {...props} />;
}
const DrawerActionsBarRoot = styled(DashboardActionsBar)`
border-bottom: 1px solid #d9d9da;
`;

View File

@@ -1,15 +1,54 @@
import React from 'react';
import { Tabs } from '@blueprintjs/core';
import styled from 'styled-components';
/**
* Drawer main tabs.
*/
export function DrawerMainTabs({ children, ...restProps }) {
return (
<div class="drawer__main-tabs">
<DrawerMainTabsRoot>
<Tabs animate={true} large={true} {...restProps}>
{children}
</Tabs>
</div>
</DrawerMainTabsRoot>
);
}
const DrawerMainTabsRoot = styled.div`
.bp3-tabs {
.bp3-tab-list {
position: relative;
background-color: #fff;
padding: 0 15px;
border-bottom: 2px solid #e1e2e8;
> *:not(:last-child) {
margin-right: 25px;
}
&.bp3-large > .bp3-tab {
font-size: 15px;
color: #7f8596;
margin: 0 1rem;
&[aria-selected='true'],
&:not([aria-disabled='true']):hover {
color: #0052cc;
}
}
.bp3-tab-indicator-wrapper .bp3-tab-indicator {
height: 2px;
bottom: -2px;
}
}
.bp3-tab-panel {
margin-top: 0;
.card {
margin: 15px;
}
}
}
`;

View File

@@ -13,3 +13,5 @@ export function DrawerLoading({ loading, mount = false, children }) {
export function DrawerBody({ children }) {
return <div className={Classes.DRAWER_BODY}>{children}</div>;
}
export * from './DrawerActionsBar';

View File

@@ -17,6 +17,10 @@ import CashflowTransactionDetailDrawer from '../containers/Drawers/CashflowTrans
import QuickCreateCustomerDrawer from '../containers/Drawers/QuickCreateCustomerDrawer';
import QuickCreateItemDrawer from '../containers/Drawers/QuickCreateItemDrawer';
import QuickWriteVendorDrawer from '../containers/Drawers/QuickWriteVendorDrawer';
import CreditNoteDetailDrawer from '../containers/Drawers/CreditNoteDetailDrawer';
import VendorCreditDetailDrawer from '../containers/Drawers/VendorCreditDetailDrawer';
import RefundCreditNoteDetailDrawer from '../containers/Drawers/RefundCreditNoteDetailDrawer';
import RefundVendorCreditDetailDrawer from '../containers/Drawers/RefundVendorCreditDetailDrawer';
import { DRAWERS } from 'common/drawers';
@@ -47,6 +51,14 @@ export default function DrawersContainer() {
<QuickCreateCustomerDrawer name={DRAWERS.QUICK_CREATE_CUSTOMER} />
<QuickCreateItemDrawer name={DRAWERS.QUICK_CREATE_ITEM} />
<QuickWriteVendorDrawer name={DRAWERS.QUICK_WRITE_VENDOR} />
<CreditNoteDetailDrawer name={DRAWERS.CREDIT_NOTE_DETAIL_DRAWER} />
<VendorCreditDetailDrawer name={DRAWERS.VENDOR_CREDIT_DETAIL_DRAWER} />
<RefundCreditNoteDetailDrawer
name={DRAWERS.REFUND_CREDIT_NOTE_DETAIL_DRAWER}
/>
<RefundVendorCreditDetailDrawer
name={DRAWERS.REFUND_VENDOR_CREDIT_DETAIL_DRAWER}
/>
</div>
);
}

View File

@@ -0,0 +1,14 @@
import { useDeepCompareEffect } from 'hooks/utils';
export function FormikObserver({ onChange, values }) {
useDeepCompareEffect(() => {
onChange(values);
}, [values]);
return null;
}
FormikObserver.defaultProps = {
onChange: () => null,
};

View File

@@ -1 +1,2 @@
export * from './FormObserver';
export * from './FormObserver';
export * from './FormikObserver';

View File

@@ -3,7 +3,7 @@ import { MenuItem } from '@blueprintjs/core';
import { Suggest } from '@blueprintjs/select';
import classNames from 'classnames';
import * as R from 'ramda';
import intl from 'react-intl-universal';
import { CLASSES } from 'common/classes';
import { FormattedMessage as T } from 'components';
@@ -24,7 +24,7 @@ const createNewItemRenderer = (query, active, handleClick) => {
return (
<MenuItem
icon="add"
text={`Create "${query}"`}
text={intl.get('list.create', { value: `"${query}"` })}
active={active}
shouldDismissPopover={false}
onClick={handleClick}

View File

@@ -1,6 +1,8 @@
import React from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import classNames from 'classnames';
import * as R from 'ramda';
import { CLASSES } from 'common/classes';
import PreferencesTopbar from 'components/Preferences/PreferencesTopbar';
@@ -8,18 +10,28 @@ import PreferencesContentRoute from 'components/Preferences/PreferencesContentRo
import DashboardErrorBoundary from 'components/Dashboard/DashboardErrorBoundary';
import PreferencesSidebar from 'components/Preferences/PreferencesSidebar';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import 'style/pages/Preferences/Page.scss';
/**
* Preferences page.
*/
export default function PreferencesPage() {
function PreferencesPage({ toggleSidebarExpand }) {
// Shrink the dashboard sidebar once open application preferences page.
React.useEffect(() => {
toggleSidebarExpand(false);
}, [toggleSidebarExpand]);
return (
<ErrorBoundary FallbackComponent={DashboardErrorBoundary}>
<div id={'dashboard'} className={classNames(
CLASSES.DASHBOARD_CONTENT,
CLASSES.DASHBOARD_CONTENT_PREFERENCES,
)}>
<div
id={'dashboard'}
className={classNames(
CLASSES.DASHBOARD_CONTENT,
CLASSES.DASHBOARD_CONTENT_PREFERENCES,
)}
>
<div className={classNames(CLASSES.PREFERENCES_PAGE)}>
<PreferencesSidebar />
@@ -32,3 +44,5 @@ export default function PreferencesPage() {
</ErrorBoundary>
);
}
export default R.compose(withDashboardActions)(PreferencesPage);

View File

@@ -1,20 +1,37 @@
import React from 'react';
import SidebarContainer from 'components/Sidebar/SidebarContainer';
import SidebarHead from 'components/Sidebar/SidebarHead';
import SidebarMenu from 'components/Sidebar/SidebarMenu';
import { useGetSidebarMenu } from './utils';
import 'style/containers/Dashboard/Sidebar.scss';
export default function Sidebar({ dashboardContentRef }) {
const menu = useGetSidebarMenu();
return (
<SidebarContainer>
<SidebarHead />
<div className="sidebar__menu">
<SidebarMenu />
<SidebarMenu menu={menu} />
</div>
<div class="sidebar__version">0.0.1-beta version.</div>
<SidebarFooterVersion />
</SidebarContainer>
);
}
/**
* Sidebar footer version.
* @returns {React.JSX}
*/
function SidebarFooterVersion() {
const { VERSION } = process.env;
if (!VERSION) {
return null;
}
return <div class="sidebar__version">v{VERSION}</div>;
}

View File

@@ -3,7 +3,7 @@ import { Button, Popover, Menu, Position } from '@blueprintjs/core';
import Icon from 'components/Icon';
import { compose, firstLettersArgs } from 'utils';
import withCurrentOrganization from '../../containers/Organization/withCurrentOrganization';
import { useAuthenticatedUser } from '../Dashboard/AuthenticatedUser';
import { useAuthenticatedAccount } from '../../hooks/query';
// Popover modifiers.
const POPOVER_MODIFIERS = {
@@ -18,7 +18,7 @@ function SidebarHead({
organization,
}) {
// Retrieve authenticated user information.
const { user } = useAuthenticatedUser();
const { data: user } = useAuthenticatedAccount();
return (
<div className="sidebar__head">

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { Menu, MenuDivider } from '@blueprintjs/core';
import { useHistory, useLocation } from 'react-router-dom';
import sidebarMenuList from 'config/sidebarMenu';
import { Choose } from 'components';
import Icon from 'components/Icon';
import MenuItem from 'components/MenuItem';
@@ -24,7 +24,7 @@ function SidebarMenuItemSpace({ space }) {
return <div class="bp3-menu-spacer" style={{ height: `${space}px` }} />;
}
function SidebarMenu({ isSubscriptionActive }) {
function SidebarMenu({ menu, isSubscriptionActive }) {
const history = useHistory();
const location = useLocation();
@@ -93,7 +93,7 @@ function SidebarMenu({ isSubscriptionActive }) {
});
};
const filterItems = sidebarMenuList.filter(
const filterItems = menu.filter(
(item) => isSubscriptionActive || item.enableBilling,
);
const items = menuItemsMapper(filterItems);

View File

@@ -0,0 +1,48 @@
import sidebarMenuList from 'config/sidebarMenu';
import { isArray, isEmpty } from 'lodash';
import { useAbilityContext } from 'hooks/utils';
export function useGetSidebarMenu() {
const ability = useAbilityContext();
return sidebarMenuList
.map((item) => {
const children = isArray(item.children)
? item.children.filter((childItem) => {
return isArray(childItem.permission)
? childItem.permission.some((perm) =>
ability.can(perm.ability, perm.subject),
)
: childItem?.permission?.ability && childItem?.permission?.subject
? ability.can(
childItem.permission.ability,
childItem.permission.subject,
)
: true;
})
: [];
return {
...item,
...(isArray(item.children)
? {
children,
}
: {}),
};
})
.filter((item) => {
return isArray(item.permission)
? item.permission.some((per) =>
ability.can(per.ability, per.subject),
)
: item?.permission?.ability && item?.permission?.subject
? ability.can(item.permission.ability, item.permission.subject)
: true;
})
.filter((item) =>
isEmpty(item.children) && !item.href && !item.label && !item.divider
? false
: true,
);
}

View File

@@ -0,0 +1,33 @@
import styled from 'styled-components';
export const Table = styled.table`
width: 100%;
vertical-align: top;
border-color: #dee2e6;
border-spacing: 0;
`;
export const TBody = styled.tbody``;
export const TR = styled.tr``;
export const TD = styled.td`
padding: 0.5rem 0.5rem;
border-bottom-width: 1px;
border-bottom-color: inherit;
border-bottom-style: solid;
${(props) =>
props.textAlign === 'right' &&
`
text-align: right;`}
`;
export const TRDarkSingleLine = styled(TR)`
${TD} {
border-bottom: 1px solid #000;
}
`;
export const TRDarkDoubleLines = styled(TR)`
${TD} {
border-bottom: 3px double #000;
}
`;

View File

@@ -0,0 +1,11 @@
import styled from 'styled-components';
export const CurrencyTag = styled.span`
background: #3e9215;
color: #fff;
display: inline-block;
border-radius: 3px;
padding: 2px 4px;
line-height: 1;
margin-left: 4px;
`;

View File

@@ -0,0 +1,3 @@
export * from './CurrencyTag';

View File

@@ -0,0 +1,28 @@
import React from 'react';
import styled from 'styled-components';
export function TextStatus({ intent, children }) {
return <TextStatusRoot intent={intent}>{children}</TextStatusRoot>;
}
const TextStatusRoot = styled.span`
${(props) =>
props.intent === 'warning' &&
`
color: #ec5b0a;`}
${(props) =>
props.intent === 'success' &&
`
color: #2ba01d;`}
${(props) =>
props.intent === 'none' &&
`
color: #777;`}
${(props) =>
props.intent === 'primary' &&
`
color: #1652c8;`}
`;

View File

@@ -1,12 +0,0 @@
.total_lines {}
.total_line {
display: flex;
border-bottom: 1px solid #d2dde2;
:global .amount,
:global .title{
padding: 8px;
}
}

View File

@@ -1,23 +1,93 @@
import React from 'react';
import clsx from 'classnames';
import styled from 'styled-components';
import TotalLinesCls from './TotalLines.module.scss';
export const TotalLineBorderStyle = {
SingleDark: 'SingleDark',
DoubleDark: 'DoubleDark',
};
export function TotalLines({ children, className }) {
export const TotalLineTextStyle = {
Regular: 'Regular',
Bold: 'Bold',
};
export function TotalLines({
children,
amountColWidth,
labelColWidth,
className,
}) {
return (
<div className={clsx('total_lines', TotalLinesCls.total_lines, className)}>
<TotalLinesRoot
className={className}
amountColWidth={amountColWidth}
labelColWidth={labelColWidth}
>
{children}
</div>
</TotalLinesRoot>
);
}
export function TotalLine({ title, value, className }) {
export function TotalLine({ title, value, borderStyle, textStyle, className }) {
return (
<div
className={clsx('total_lines_line', TotalLinesCls.total_line, className)}
<TotalLineRoot
borderStyle={borderStyle}
textStyle={textStyle}
className={className}
>
<div class="title">{title}</div>
<div class="amount">{value}</div>
</div>
</TotalLineRoot>
);
}
export const TotalLinesRoot = styled.div`
display: table;
${(props) =>
props.amountColWidth &&
`
.amount{
width: ${props.amountColWidth}
}
`}
${(props) =>
props.labelColWidth &&
`
.title{
width: ${props.labelColWidth}
}
`}
`;
export const TotalLineRoot = styled.div`
display: table-row;
.amount,
.title {
display: table-cell;
padding: 8px;
border-bottom: 1px solid #d2dde2;
${(props) =>
props.borderStyle === TotalLineBorderStyle.DoubleDark &&
`
border-bottom: 3px double #000;
`}
${(props) =>
props.borderStyle === TotalLineBorderStyle.SingleDark &&
`
border-bottom: 1px double #000;
`}
${(props) =>
props.textStyle === TotalLineTextStyle.Bold &&
`
font-weight: 600;
`}
}
.amount {
text-align: right;
}
`;

View File

@@ -0,0 +1,6 @@
import React from 'react';
import clsx from 'classnames';
export function Paragraph({ className, children }) {
return <p className={clsx('paragraph', className)}>{children}</p>;
}

View File

@@ -0,0 +1,2 @@
export * from './Paragraph';

View File

@@ -0,0 +1,13 @@
import React from 'react';
export function Join({ items, sep }) {
return items.length > 0
? items.reduce((result, item) => (
<>
{result}
{sep}
{item}
</>
))
: null;
}

View File

@@ -1,4 +1,5 @@
export * from './FormatNumber';
export * from './FormatDate';
export * from './FormatDate';
export * from './Join';

View File

@@ -0,0 +1,23 @@
import React from 'react';
import * as R from 'ramda';
import { ButtonLink } from 'components';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
function VendorDrawerLinkComponent({
// #ownProps
children,
vendorId,
// #withDrawerActions
openDrawer,
}) {
// Handle view customer drawer.
const handleVendorDrawer = () => {
openDrawer('vendor-details-drawer', { vendorId });
};
return <ButtonLink onClick={handleVendorDrawer}>{children}</ButtonLink>;
}
export const VendorDrawerLink = R.compose(withDrawerActions)(VendorDrawerLinkComponent);

View File

@@ -0,0 +1 @@
export * from './VendorDrawerLink'

View File

@@ -54,7 +54,6 @@ import Postbox from './Postbox';
import AccountsSuggestField from './AccountsSuggestField';
import MaterialProgressBar from './MaterialProgressBar';
import { MoneyFieldCell } from './DataTableCells';
import Card from './Card';
import AvaterCell from './AvaterCell';
import { ItemsMultiSelect } from './Items';
@@ -87,6 +86,15 @@ export * from './Button';
export * from './IntersectionObserver';
export * from './SMSPreview';
export * from './Contacts';
export * from './Utils/Join';
export * from './Typo';
export * from './TextStatus';
export * from './Tags';
export * from './CommercialDoc';
export * from './Card';
export * from './Customers'
export * from './Vendors'
export * from './Table';
const Hint = FieldHint;
@@ -153,7 +161,6 @@ export {
MaterialProgressBar,
MoneyFieldCell,
ItemsMultiSelect,
Card,
AvaterCell,
MoreMenuItems,
};

View File

@@ -1,5 +1,6 @@
import React from 'react';
import { FormattedMessage as T } from 'components';
import { ReportsAction, AbilitySubject } from '../common/abilityOption';
export const financialReportMenus = [
{
@@ -11,6 +12,8 @@ export const financialReportMenus = [
<T id={'reports_a_company_s_assets_liabilities_and_shareholders'} />
),
link: '/financial-reports/balance-sheet',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_BALANCE_SHEET,
},
{
title: <T id={'trial_balance_sheet'} />,
@@ -18,11 +21,15 @@ export const financialReportMenus = [
<T id={'summarizes_the_credit_and_debit_balance_of_each_account'} />
),
link: '/financial-reports/trial-balance-sheet',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_TRIAL_BALANCE_SHEET,
},
{
title: <T id={'profit_loss_report'} />,
desc: <T id={'reports_the_revenues_costs_and_expenses'} />,
link: '/financial-reports/profit-loss-sheet',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_PROFIT_LOSS,
},
{
title: <T id={'cash_flow_statement'} />,
@@ -30,16 +37,22 @@ export const financialReportMenus = [
<T id={'reports_inflow_and_outflow_of_cash_and_cash_equivalents'} />
),
link: '/financial-reports/cash-flow',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_CASHFLOW,
},
{
title: <T id={'journal_report'} />,
desc: <T id={'the_debit_and_credit_entries_of_system_transactions'} />,
link: '/financial-reports/journal-sheet',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_JOURNAL,
},
{
title: <T id={'general_ledger_report'} />,
desc: <T id={'reports_every_transaction_going_in_and_out_of_your'} />,
link: '/financial-reports/general-ledger',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_GENERAL_LEDGET,
},
{
title: <T id={'receivable_aging_summary'} />,
@@ -47,11 +60,15 @@ export const financialReportMenus = [
<T id={'summarize_total_unpaid_balances_of_customers_invoices'} />
),
link: '/financial-reports/receivable-aging-summary',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_AR_AGING_SUMMARY,
},
{
title: <T id={'payable_aging_summary'} />,
desc: <T id={'summarize_total_unpaid_balances_of_vendors_purchase'} />,
link: '/financial-reports/payable-aging-summary',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_AP_AGING_SUMMARY,
},
],
},
@@ -71,6 +88,8 @@ export const SalesAndPurchasesReportMenus = [
/>
),
link: '/financial-reports/purchases-by-items',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_PURCHASES_BY_ITEMS,
},
{
title: <T id={'sales_by_items'} />,
@@ -82,6 +101,8 @@ export const SalesAndPurchasesReportMenus = [
/>
),
link: '/financial-reports/sales-by-items',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_SALES_BY_ITEMS,
},
{
title: <T id={'inventory_valuation'} />,
@@ -93,6 +114,8 @@ export const SalesAndPurchasesReportMenus = [
/>
),
link: '/financial-reports/inventory-valuation',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_INVENTORY_VALUATION_SUMMARY,
},
{
title: <T id={'customers_balance_summary'} />,
@@ -104,6 +127,8 @@ export const SalesAndPurchasesReportMenus = [
/>
),
link: '/financial-reports/customers-balance-summary',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_CUSTOMERS_SUMMARY_BALANCE,
},
{
title: <T id={'vendors_balance_summary'} />,
@@ -111,6 +136,8 @@ export const SalesAndPurchasesReportMenus = [
<T id={'summerize_the_total_amount_your_business_owes_each_vendor'} />
),
link: '/financial-reports/vendors-balance-summary',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_VENDORS_SUMMARY_BALANCE,
},
{
title: <T id={'customers_transactions'} />,
@@ -120,6 +147,8 @@ export const SalesAndPurchasesReportMenus = [
/>
),
link: '/financial-reports/transactions-by-customers',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_CUSTOMERS_TRANSACTIONS,
},
{
title: <T id={'vendors_transactions'} />,
@@ -131,6 +160,8 @@ export const SalesAndPurchasesReportMenus = [
/>
),
link: '/financial-reports/transactions-by-vendors',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_VENDORS_TRANSACTIONS,
},
{
title: <T id={'inventory_item_details'} />,
@@ -138,6 +169,8 @@ export const SalesAndPurchasesReportMenus = [
<T id={'reports_every_transaction_going_in_and_out_of_your_items'} />
),
link: '/financial-reports/inventory-item-details',
subject: AbilitySubject.Report,
ability: ReportsAction.READ_INVENTORY_ITEM_DETAILS,
},
],
},

View File

@@ -1,5 +1,26 @@
import React from 'react';
import { FormattedMessage as T } from 'components';
import {
ReportsAction,
AbilitySubject,
ItemAction,
InventoryAdjustmentAction,
SaleEstimateAction,
SaleInvoiceAction,
SaleReceiptAction,
PaymentReceiveAction,
BillAction,
PaymentMadeAction,
CustomerAction,
VendorAction,
AccountAction,
ManualJournalAction,
ExpenseAction,
CashflowAction,
PreferencesAbility,
ExchangeRateAbility,
SubscriptionBillingAbility,
} from '../common/abilityOption';
export default [
{
@@ -11,6 +32,32 @@ export default [
{
text: <T id={'sales_inventory'} />,
label: true,
permission: [
{
subject: AbilitySubject.Item,
ability: ItemAction.View,
},
{
subject: AbilitySubject.InventoryAdjustment,
ability: InventoryAdjustmentAction.View,
},
{
subject: AbilitySubject.Estimate,
ability: SaleEstimateAction.View,
},
{
subject: AbilitySubject.Invoice,
ability: SaleInvoiceAction.View,
},
{
subject: AbilitySubject.Receipt,
ability: SaleReceiptAction.View,
},
{
subject: AbilitySubject.PaymentReceive,
ability: PaymentReceiveAction.View,
},
],
},
{
text: <T id={'items'} />,
@@ -18,37 +65,70 @@ export default [
{
text: <T id={'items'} />,
href: '/items',
permission: {
subject: AbilitySubject.Item,
ability: ItemAction.View,
},
},
{
text: <T id={'inventory_adjustments'} />,
href: '/inventory-adjustments',
permission: {
subject: AbilitySubject.InventoryAdjustment,
ability: InventoryAdjustmentAction.View,
},
},
{
text: <T id={'category_list'} />,
href: '/items/categories',
permission: {
subject: AbilitySubject.Item,
ability: ItemAction.View,
},
},
{
text: <T id={'New tasks'} />,
label: true,
permission: [
{
subject: AbilitySubject.Item,
ability: ItemAction.Create,
},
],
},
{
divider: true,
permission: [
{
subject: AbilitySubject.Item,
ability: ItemAction.Create,
},
],
},
{
text: <T id={'New inventory item'} />,
href: '/items/new',
permission: {
subject: AbilitySubject.Item,
ability: ItemAction.Create,
},
},
{
text: <T id={'New service'} />,
href: '/items/new',
permission: {
subject: AbilitySubject.Item,
ability: ItemAction.Create,
},
},
{
text: <T id={'New item category'} />,
href: '/items/categories/new',
permission: {
subject: AbilitySubject.Item,
ability: ItemAction.Create,
},
},
// {
// text: <T id={'New inventory adjustment'} />,
// },
],
},
{
@@ -57,43 +137,117 @@ export default [
{
text: <T id={'estimates'} />,
href: '/estimates',
newTabHref: '/estimates/new',
permission: {
subject: AbilitySubject.Estimate,
ability: SaleEstimateAction.View,
},
},
{
text: <T id={'invoices'} />,
href: '/invoices',
newTabHref: '/invoices/new',
permission: {
subject: AbilitySubject.Invoice,
ability: SaleInvoiceAction.View,
},
},
{
text: <T id={'receipts'} />,
href: '/receipts',
permission: {
subject: AbilitySubject.Receipt,
ability: SaleReceiptAction.View,
},
},
{
text: <T id={'sidebar_credit_note'} />,
href: '/credit-notes',
},
{
text: <T id={'payment_receives'} />,
href: '/payment-receives',
permission: {
subject: AbilitySubject.PaymentReceive,
ability: PaymentReceiveAction.View,
},
},
{
text: <T id={'New tasks'} />,
label: true,
permission: [
{
subject: AbilitySubject.Estimate,
ability: SaleEstimateAction.Create,
},
{
subject: AbilitySubject.Invoice,
ability: SaleInvoiceAction.Create,
},
{
subject: AbilitySubject.Receipt,
ability: SaleReceiptAction.Create,
},
{
subject: AbilitySubject.PaymentReceive,
ability: PaymentReceiveAction.Create,
},
],
},
{
divider: true,
permission: [
{
subject: AbilitySubject.Estimate,
ability: SaleEstimateAction.Create,
},
{
subject: AbilitySubject.Invoice,
ability: SaleInvoiceAction.Create,
},
{
subject: AbilitySubject.Receipt,
ability: SaleReceiptAction.Create,
},
{
subject: AbilitySubject.PaymentReceive,
ability: PaymentReceiveAction.Create,
},
],
},
{
text: <T id={'new_estimate'} />,
href: '/estimates/new',
permission: {
subject: AbilitySubject.Estimate,
ability: SaleEstimateAction.Create,
},
},
{
text: <T id={'new_invoice'} />,
href: '/invoices/new',
permission: {
subject: AbilitySubject.Invoice,
ability: SaleInvoiceAction.Create,
},
},
{
text: <T id={'new_receipt'} />,
href: '/receipts/new',
permission: {
subject: AbilitySubject.Receipt,
ability: SaleReceiptAction.Create,
},
},
{
text: <T id={'credit_note.label.new_credit_note'} />,
href: '/credit-notes/new',
},
{
text: <T id={'new_payment_receive'} />,
href: '/payment-receives/new',
permission: {
subject: AbilitySubject.PaymentReceive,
ability: PaymentReceiveAction.Create,
},
},
],
},
@@ -103,27 +257,74 @@ export default [
{
text: <T id={'bills'} />,
href: '/bills',
newTabHref: '/bills/new',
permission: {
subject: AbilitySubject.Bill,
ability: BillAction.View,
},
},
{
text: <T id={'sidebar_vendor_credits'} />,
href: '/vendor-credits',
},
{
text: <T id={'payment_mades'} />,
href: '/payment-mades',
newTabHref: '/payment-mades/new',
permission: {
subject: AbilitySubject.PaymentMade,
ability: PaymentMadeAction.View,
},
},
{
text: <T id={'New tasks'} />,
label: true,
permission: [
{
subject: AbilitySubject.Bill,
ability: BillAction.Create,
},
{
subject: AbilitySubject.PaymentMade,
ability: PaymentMadeAction.Create,
},
],
},
{
divider: true,
permission: [
{
subject: AbilitySubject.Bill,
ability: BillAction.Create,
},
{
subject: AbilitySubject.PaymentMade,
ability: PaymentMadeAction.Create,
},
],
},
{
text: <T id={'New purchase invoice'} />,
href: '/bills/new',
permission: {
subject: AbilitySubject.Bill,
ability: BillAction.Create,
},
},
{
text: <T id={'vendor_credits.label.new_vendor_credit'} />,
href: '/vendor-credits/new',
permission: {
subject: AbilitySubject.Bill,
ability: BillAction.Create,
},
},
{
text: <T id={'new_payment_made'} />,
href: '/payment-mades/new',
permission: {
subject: AbilitySubject.PaymentMade,
ability: PaymentMadeAction.Create,
},
},
],
},
@@ -133,33 +334,77 @@ export default [
{
text: <T id={'customers'} />,
href: '/customers',
newTabHref: '/customers/new',
permission: {
subject: AbilitySubject.Customer,
ability: CustomerAction.View,
},
},
{
text: <T id={'vendors'} />,
href: '/vendors',
newTabHref: '/vendors/new',
permission: {
subject: AbilitySubject.Vendor,
ability: VendorAction.Create,
},
},
{
text: <T id={'New tasks'} />,
label: true,
permission: [
{
subject: AbilitySubject.Customer,
ability: CustomerAction.View,
},
{
subject: AbilitySubject.Vendor,
ability: VendorAction.View,
},
],
},
{
divider: true,
permission: [
{
subject: AbilitySubject.Customer,
ability: CustomerAction.View,
},
{
subject: AbilitySubject.Vendor,
ability: VendorAction.View,
},
],
},
{
text: <T id={'new_customer'} />,
href: '/customers/new',
permission: {
subject: AbilitySubject.Customer,
ability: CustomerAction.View,
},
},
{
text: <T id={'new_vendor'} />,
href: '/vendors/new',
permission: {
subject: AbilitySubject.Vendor,
ability: VendorAction.View,
},
},
],
},
{
text: <T id={'accounting'} />,
label: true,
permission: [
{
subject: AbilitySubject.Account,
ability: AccountAction.View,
},
{
subject: AbilitySubject.ManualJournal,
ability: ManualJournalAction.View,
},
],
},
{
text: <T id={'financial'} />,
@@ -167,25 +412,57 @@ export default [
{
text: <T id={'accounts_chart'} />,
href: '/accounts',
permission: {
subject: AbilitySubject.Account,
ability: AccountAction.View,
},
},
{
text: <T id={'manual_journals'} />,
href: '/manual-journals',
permission: {
subject: AbilitySubject.ManualJournal,
ability: ManualJournalAction.View,
},
},
{
text: <T id={'sidebar.transactions_locaking'} />,
href: '/transactions-locking',
// permission: {
// subject: AbilitySubject.ManualJournal,
// ability: ManualJournalAction.TransactionLocking,
// },
},
{
text: <T id={'exchange_rate'} />,
href: '/exchange-rates',
permission: {
subject: AbilitySubject.ExchangeRate,
ability: ExchangeRateAbility.View,
},
},
{
text: <T id={'New tasks'} />,
label: true,
permission: {
subject: AbilitySubject.ManualJournal,
ability: ManualJournalAction.Create,
},
},
{
divider: true,
permission: {
subject: AbilitySubject.ManualJournal,
ability: ManualJournalAction.Create,
},
},
{
text: <T id={'make_journal_entry'} />,
href: '/make-journal-entry',
permission: {
subject: AbilitySubject.ManualJournal,
ability: ManualJournalAction.Create,
},
},
],
},
@@ -195,29 +472,61 @@ export default [
{
text: <T id={'siebar.cashflow.label_cash_and_bank_accounts'} />,
href: '/cashflow-accounts',
permission: {
subject: AbilitySubject.Cashflow,
ability: CashflowAction.View,
},
},
{
text: <T id={'New tasks'} />,
label: true,
permission: [
{
subject: AbilitySubject.Cashflow,
ability: CashflowAction.Create,
},
],
},
{
divider: true,
permission: [
{
subject: AbilitySubject.Cashflow,
ability: CashflowAction.Create,
},
],
},
{
text: <T id={'cash_flow.label.add_money_in'} />,
href: '/cashflow-accounts',
permission: {
subject: AbilitySubject.Cashflow,
ability: CashflowAction.Create,
},
},
{
text: <T id={'cash_flow.label.add_money_out'} />,
href: '/cashflow-accounts',
permission: {
subject: AbilitySubject.Cashflow,
ability: CashflowAction.Create,
},
},
{
text: <T id={'cash_flow.label.add_cash_account'} />,
href: '/cashflow-accounts',
permission: {
subject: AbilitySubject.Cashflow,
ability: CashflowAction.Create,
},
},
{
text: <T id={'cash_flow.label.add_bank_account'} />,
href: '/cashflow-accounts',
permission: {
subject: AbilitySubject.Cashflow,
ability: CashflowAction.Create,
},
},
],
},
@@ -227,17 +536,33 @@ export default [
{
text: <T id={'expenses'} />,
href: '/expenses',
permission: {
subject: AbilitySubject.Expense,
ability: ExpenseAction.View,
},
},
{
text: <T id={'New tasks'} />,
label: true,
permission: {
subject: AbilitySubject.Expense,
ability: ExpenseAction.Create,
},
},
{
divider: true,
permission: {
subject: AbilitySubject.Expense,
ability: ExpenseAction.Create,
},
},
{
text: <T id={'new_expense'} />,
href: '/expenses/new',
permission: {
subject: AbilitySubject.Expense,
ability: ExpenseAction.Create,
},
},
],
},
@@ -247,80 +572,216 @@ export default [
{
text: <T id={'balance_sheet'} />,
href: '/financial-reports/balance-sheet',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_BALANCE_SHEET,
},
},
{
text: <T id={'trial_balance_sheet'} />,
href: '/financial-reports/trial-balance-sheet',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_TRIAL_BALANCE_SHEET,
},
},
{
text: <T id={'journal'} />,
href: '/financial-reports/journal-sheet',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_JOURNAL,
},
},
{
text: <T id={'general_ledger'} />,
href: '/financial-reports/general-ledger',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_GENERAL_LEDGET,
},
},
{
text: <T id={'profit_loss_sheet'} />,
href: '/financial-reports/profit-loss-sheet',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_PROFIT_LOSS,
},
},
{
text: <T id={'cash_flow_statement'} />,
href: '/financial-reports/cash-flow',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_CASHFLOW_ACCOUNT_TRANSACTION,
},
},
{
text: <T id={'AR_Aging_Summary'} />,
href: '/financial-reports/receivable-aging-summary',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_AR_AGING_SUMMARY,
},
},
{
text: <T id={'AP_Aging_Summary'} />,
href: '/financial-reports/payable-aging-summary',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_AP_AGING_SUMMARY,
},
},
{
text: <T id={'Sales/Purchases'} />,
label: true,
permission: [
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_PURCHASES_BY_ITEMS,
},
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_SALES_BY_ITEMS,
},
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_CUSTOMERS_TRANSACTIONS,
},
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_VENDORS_TRANSACTIONS,
},
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_CUSTOMERS_SUMMARY_BALANCE,
},
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_VENDORS_SUMMARY_BALANCE,
},
],
},
{
divider: true,
permission: [
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_PURCHASES_BY_ITEMS,
},
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_SALES_BY_ITEMS,
},
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_CUSTOMERS_TRANSACTIONS,
},
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_VENDORS_TRANSACTIONS,
},
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_CUSTOMERS_SUMMARY_BALANCE,
},
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_VENDORS_SUMMARY_BALANCE,
},
],
},
{
text: <T id={'purchases_by_items'} />,
href: '/financial-reports/purchases-by-items',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_PURCHASES_BY_ITEMS,
},
},
{
text: <T id={'sales_by_items'} />,
href: '/financial-reports/sales-by-items',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_SALES_BY_ITEMS,
},
},
{
text: <T id={'customers_transactions'} />,
href: '/financial-reports/transactions-by-customers',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_CUSTOMERS_TRANSACTIONS,
},
},
{
text: <T id={'vendors_transactions'} />,
href: '/financial-reports/transactions-by-vendors',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_VENDORS_TRANSACTIONS,
},
},
{
text: <T id={'customers_balance_summary'} />,
href: '/financial-reports/customers-balance-summary',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_CUSTOMERS_SUMMARY_BALANCE,
},
},
{
text: <T id={'vendors_balance_summary'} />,
href: '/financial-reports/vendors-balance-summary',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_VENDORS_SUMMARY_BALANCE,
},
},
{
text: <T id={'inventory'} />,
label: true,
permission: [
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_INVENTORY_ITEM_DETAILS,
},
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_INVENTORY_VALUATION_SUMMARY,
},
],
},
{
divider: true,
permission: [
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_INVENTORY_ITEM_DETAILS,
},
{
subject: AbilitySubject.Report,
ability: ReportsAction.READ_INVENTORY_VALUATION_SUMMARY,
},
],
},
{
text: <T id={'inventory_item_details'} />,
href: '/financial-reports/inventory-item-details',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_INVENTORY_ITEM_DETAILS,
},
},
{
text: <T id={'inventory_valuation'} />,
href: '/financial-reports/inventory-valuation',
permission: {
subject: AbilitySubject.Report,
ability: ReportsAction.READ_INVENTORY_VALUATION_SUMMARY,
},
},
],
},
@@ -328,14 +789,32 @@ export default [
text: <T id={'system'} />,
enableBilling: true,
label: true,
permission: [
{
subject: AbilitySubject.Preferences,
ability: PreferencesAbility.Mutate,
},
{
subject: AbilitySubject.SubscriptionBilling,
ability: SubscriptionBillingAbility.View,
},
],
},
{
text: <T id={'preferences'} />,
href: '/preferences',
permission: {
subject: AbilitySubject.Preferences,
ability: PreferencesAbility.Mutate,
},
},
{
text: <T id={'billing'} />,
href: '/billing',
enableBilling: true,
permission: {
subject: AbilitySubject.SubscriptionBilling,
ability: SubscriptionBillingAbility.View,
},
},
];

View File

@@ -26,8 +26,11 @@ import withManualJournals from './withManualJournals';
import withSettingsActions from '../../Settings/withSettingsActions';
import withSettings from '../../Settings/withSettings';
import { If, DashboardActionViewsList } from 'components';
import { Can, If, DashboardActionViewsList } from 'components';
import {
ManualJournalAction,
AbilitySubject,
} from '../../../common/abilityOption';
import { compose } from 'utils';
/**
@@ -86,13 +89,14 @@ function ManualJournalActionsBar({
onChange={handleTabChange}
/>
<NavbarDivider />
<Button
className={Classes.MINIMAL}
icon={<Icon icon="plus" />}
text={<T id={'journal_entry'} />}
onClick={onClickNewManualJournal}
/>
<Can I={ManualJournalAction.Create} a={AbilitySubject.ManualJournal}>
<Button
className={Classes.MINIMAL}
icon={<Icon icon="plus" />}
text={<T id={'journal_entry'} />}
onClick={onClickNewManualJournal}
/>
</Can>
<AdvancedFilterPopover
advancedFilterProps={{
conditions: manualJournalsFilterConditions,

View File

@@ -2,7 +2,11 @@ import React from 'react';
import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
import { EmptyStatus } from 'components';
import { FormattedMessage as T } from 'components';
import { Can, FormattedMessage as T } from 'components';
import {
AbilitySubject,
ManualJournalAction,
} from '../../../common/abilityOption';
export default function ManualJournalsEmptyStatus() {
const history = useHistory();
@@ -17,19 +21,21 @@ export default function ManualJournalsEmptyStatus() {
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/make-journal-entry');
}}
>
<T id={'make_journal'} />
</Button>
<Can I={ManualJournalAction.Create} a={AbilitySubject.ManualJournal}>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/make-journal-entry');
}}
>
<T id={'make_journal'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
</Can>
</>
}
/>

View File

@@ -46,8 +46,7 @@ function ManualJournalsListProvider({ query, tableStateChanged, ...props }) {
isEmptyStatus,
};
const isPageLoading =
isManualJournalsLoading || isViewsLoading || isResourceMetaLoading;
const isPageLoading = isViewsLoading || isResourceMetaLoading;
return (
<DashboardInsider loading={isPageLoading} name={'manual-journals'}>

View File

@@ -13,7 +13,18 @@ import {
} from '@blueprintjs/core';
import intl from 'react-intl-universal';
import { FormattedMessage as T, Choose, Money, If, Icon } from 'components';
import {
Can,
FormattedMessage as T,
Choose,
Money,
If,
Icon,
} from 'components';
import {
ManualJournalAction,
AbilitySubject,
} from '../../../common/abilityOption';
import { safeCallback } from 'utils';
/**
@@ -90,13 +101,13 @@ export const StatusAccessor = (row) => {
return (
<Choose>
<Choose.When condition={!!row.is_published}>
<Tag minimal={true}>
<Tag minimal={true} round={true}>
<T id={'published'} />
</Tag>
</Choose.When>
<Choose.Otherwise>
<Tag minimal={true} intent={Intent.WARNING}>
<Tag minimal={true} intent={Intent.WARNING} round={true}>
<T id={'draft'} />
</Tag>
</Choose.Otherwise>
@@ -150,25 +161,32 @@ export const ActionsMenu = ({
text={intl.get('view_details')}
onClick={safeCallback(onViewDetails, original)}
/>
<MenuDivider />
<If condition={!original.is_published}>
<Can I={ManualJournalAction.Edit} a={AbilitySubject.ManualJournal}>
<MenuDivider />
<If condition={!original.is_published}>
<MenuItem
icon={<Icon icon="arrow-to-top" />}
text={intl.get('publish_journal')}
onClick={safeCallback(onPublish, original)}
/>
</If>
</Can>
<Can I={ManualJournalAction.Edit} a={AbilitySubject.ManualJournal}>
<MenuItem
icon={<Icon icon="arrow-to-top" />}
text={intl.get('publish_journal')}
onClick={safeCallback(onPublish, original)}
icon={<Icon icon="pen-18" />}
text={intl.get('edit_journal')}
onClick={safeCallback(onEdit, original)}
/>
</If>
<MenuItem
icon={<Icon icon="pen-18" />}
text={intl.get('edit_journal')}
onClick={safeCallback(onEdit, original)}
/>
<MenuItem
text={intl.get('delete_journal')}
icon={<Icon icon="trash-16" iconSize={16} />}
intent={Intent.DANGER}
onClick={safeCallback(onDelete, original)}
/>
</Can>
<Can I={ManualJournalAction.Delete} a={AbilitySubject.ManualJournal}>
<MenuDivider />
<MenuItem
text={intl.get('delete_journal')}
icon={<Icon icon="trash-16" iconSize={16} />}
intent={Intent.DANGER}
onClick={safeCallback(onDelete, original)}
/>
</Can>
</Menu>
);
};

View File

@@ -151,6 +151,7 @@ export default function MakeJournalFloatingAction() {
disabled={isSubmitting}
intent={Intent.PRIMARY}
onClick={handleSubmitPublishBtnClick}
style={{ minWidth: '85px' }}
text={<T id={'save'} />}
/>
<Popover

View File

@@ -7,7 +7,8 @@ import {
useJournal,
useCreateJournal,
useEditJournal,
useSettings
useSettings,
useSettingsManualJournals
} from 'hooks/query';
const MakeJournalFormContext = createContext();
@@ -40,7 +41,7 @@ function MakeJournalProvider({ journalId, ...props }) {
const { mutateAsync: editJournalMutate } = useEditJournal();
// Loading the journal settings.
const { isLoading: isSettingsLoading } = useSettings();
const { isLoading: isSettingsLoading } = useSettingsManualJournals();
// Submit form payload.
const [submitPayload, setSubmitPayload] = useState({});

View File

@@ -1,6 +1,10 @@
import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from 'common/resourcesTypes';
import withDrawerActions from '../Drawer/withDrawerActions';
import {
AbilitySubject,
ManualJournalAction,
} from '../../common/abilityOption';
/**
* Universal search manual journal item select action.
@@ -44,4 +48,8 @@ export const universalSearchJournalBind = () => ({
optionItemLabel: intl.get('manual_journals'),
selectItemAction: JournalUniversalSearchSelectAction,
itemSelect: manualJournalsToSearch,
permission: {
ability: ManualJournalAction.View,
subject: AbilitySubject.ManualJournal,
},
});

View File

@@ -1,7 +1,10 @@
import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from '../../common/resourcesTypes';
import withDrawerActions from '../Drawer/withDrawerActions';
import { AbilitySubject, AccountAction } from '../../common/abilityOption';
import { RESOURCES_TYPES } from '../../common/resourcesTypes';
function AccountUniversalSearchItemSelectComponent({
// #ownProps
resourceType,
@@ -42,4 +45,8 @@ export const universalSearchAccountBind = () => ({
optionItemLabel: intl.get('accounts'),
selectItemAction: AccountUniversalSearchItemSelect,
itemSelect: accountToSearch,
permission: {
ability: AccountAction.View,
subject: AbilitySubject.Account,
},
});

View File

@@ -15,6 +15,7 @@ import { FormattedMessage as T } from 'components';
import {
AdvancedFilterPopover,
If,
Can,
DashboardActionViewsList,
DashboardFilterButton,
DashboardRowsHeightButton,
@@ -30,6 +31,8 @@ import withAlertActions from 'containers/Alert/withAlertActions';
import withAccountsTableActions from './withAccountsTableActions';
import withSettings from '../Settings/withSettings';
import withSettingsActions from '../Settings/withSettingsActions';
import { AccountAction, AbilitySubject } from '../../common/abilityOption';
import { compose } from 'utils';
/**
@@ -116,13 +119,14 @@ function AccountsActionsBar({
onChange={handleTabChange}
/>
<NavbarDivider />
<Button
className={Classes.MINIMAL}
icon={<Icon icon="plus" />}
text={<T id={'new_account'} />}
onClick={onClickNewAccount}
/>
<Can I={AccountAction.Create} a={AbilitySubject.Account}>
<Button
className={Classes.MINIMAL}
icon={<Icon icon="plus" />}
text={<T id={'new_account'} />}
onClick={onClickNewAccount}
/>
</Can>
<AdvancedFilterPopover
advancedFilterProps={{
conditions: accountsFilterConditions,
@@ -183,11 +187,13 @@ function AccountsActionsBar({
onChange={handleTableRowSizeChange}
/>
<NavbarDivider />
<Switch
labelElement={<T id={'inactive'} />}
defaultChecked={accountsInactiveMode}
onChange={handleInactiveSwitchChange}
/>
<Can I={AccountAction.Edit} a={AbilitySubject.Account}>
<Switch
labelElement={<T id={'inactive'} />}
defaultChecked={accountsInactiveMode}
onChange={handleInactiveSwitchChange}
/>
</Can>
</NavbarGroup>
<NavbarGroup align={Alignment.RIGHT}>
<Button

View File

@@ -8,9 +8,10 @@ import {
MenuDivider,
Intent,
} from '@blueprintjs/core';
import { Icon, Money, If } from 'components';
import { Can, Icon, Money, If } from 'components';
import intl from 'react-intl-universal';
import { safeCallback } from 'utils';
import { AbilitySubject, AccountAction } from '../../common/abilityOption';
/**
* Accounts table actions menu.
@@ -34,38 +35,45 @@ export function ActionsMenu({
text={intl.get('view_details')}
onClick={safeCallback(onViewDetails, original)}
/>
<MenuDivider />
<MenuItem
icon={<Icon icon="pen-18" />}
text={intl.get('edit_account')}
onClick={safeCallback(onEdit, original)}
/>
<MenuItem
icon={<Icon icon="plus" />}
text={intl.get('new_child_account')}
onClick={safeCallback(onNewChild, original)}
/>
<MenuDivider />
<If condition={original.active}>
<Can I={AccountAction.Edit} a={AbilitySubject.Account}>
<MenuDivider />
<MenuItem
text={intl.get('inactivate_account')}
icon={<Icon icon="pause-16" iconSize={16} />}
onClick={safeCallback(onInactivate, original)}
icon={<Icon icon="pen-18" />}
text={intl.get('edit_account')}
onClick={safeCallback(onEdit, original)}
/>
</If>
<If condition={!original.active}>
<MenuItem
text={intl.get('activate_account')}
icon={<Icon icon="play-16" iconSize={16} />}
onClick={safeCallback(onActivate, original)}
icon={<Icon icon="plus" />}
text={intl.get('new_child_account')}
onClick={safeCallback(onNewChild, original)}
/>
</If>
<MenuItem
text={intl.get('delete_account')}
icon={<Icon icon="trash-16" iconSize={16} />}
intent={Intent.DANGER}
onClick={safeCallback(onDelete, original)}
/>
<MenuDivider />
</Can>
<Can I={AccountAction.Edit} a={AbilitySubject.Account}>
<If condition={original.active}>
<MenuItem
text={intl.get('inactivate_account')}
icon={<Icon icon="pause-16" iconSize={16} />}
onClick={safeCallback(onInactivate, original)}
/>
</If>
<If condition={!original.active}>
<MenuItem
text={intl.get('activate_account')}
icon={<Icon icon="play-16" iconSize={16} />}
onClick={safeCallback(onActivate, original)}
/>
</If>
</Can>
<Can I={AccountAction.Edit} a={AbilitySubject.Account}>
<MenuItem
text={intl.get('delete_account')}
icon={<Icon icon="trash-16" iconSize={16} />}
intent={Intent.DANGER}
onClick={safeCallback(onDelete, original)}
/>
</Can>
</Menu>
);
}

View File

@@ -57,9 +57,7 @@ function BillTransactionDeleteAlert({
loading={isLoading}
>
<p>
<T
id={`Once your delete this located landed cost, you won't be able to restore it later, Are your sure you want to delete this transaction?`}
/>
<T id={`landed_cost.once_your_delete_this_located_landed_cost`} />
</p>
</Alert>
);

View File

@@ -0,0 +1,83 @@
import React from 'react';
import intl from 'react-intl-universal';
import { FormattedMessage as T, FormattedHTMLMessage } from 'components';
import { Intent, Alert } from '@blueprintjs/core';
import { AppToaster } from 'components';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { useDeleteCreditNote } from 'hooks/query';
import { handleDeleteErrors } from '../../Sales/CreditNotes/CreditNotesLanding/utils';
import { compose } from 'utils';
/**
* Credit note delete alert.
*/
function CreditNoteDeleteAlert({
name,
// #withAlertStoreConnect
isOpen,
payload: { creditNoteId },
// #withAlertActions
closeAlert,
// #withDrawerActions
closeDrawer,
}) {
const { isLoading, mutateAsync: deleteCreditNoteMutate } =
useDeleteCreditNote();
// handle cancel delete credit note alert.
const handleCancelDeleteAlert = () => {
closeAlert(name);
};
const handleConfirmCreditNoteDelete = () => {
deleteCreditNoteMutate(creditNoteId)
.then(() => {
AppToaster.show({
message: intl.get('credit_note.alert.delete_message'),
intent: Intent.SUCCESS,
});
closeDrawer('credit-note-detail-drawer');
})
.catch(
({
response: {
data: { errors },
},
}) => {
handleDeleteErrors(errors);
},
)
.finally(() => {
closeAlert(name);
});
};
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'delete'} />}
icon="trash"
intent={Intent.DANGER}
isOpen={isOpen}
onCancel={handleCancelDeleteAlert}
onConfirm={handleConfirmCreditNoteDelete}
loading={isLoading}
>
<p>
<FormattedHTMLMessage id={'credit_note.once_delete_this_credit_note'} />
</p>
</Alert>
);
}
export default compose(
withAlertStoreConnect(),
withAlertActions,
withDrawerActions,
)(CreditNoteDeleteAlert);

View File

@@ -0,0 +1,68 @@
import React from 'react';
import { FormattedMessage as T } from 'components';
import intl from 'react-intl-universal';
import { Intent, Alert } from '@blueprintjs/core';
import { useOpenCreditNote } from 'hooks/query';
import { AppToaster } from 'components';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';
import { compose } from 'utils';
/**
* Credit note opened alert.
*/
function CreditNoteOpenedAlert({
name,
// #withAlertStoreConnect
isOpen,
payload: { creditNoteId },
// #withAlertActions
closeAlert,
}) {
const { mutateAsync: openCreditNoteMutate, isLoading } = useOpenCreditNote();
// Handle cancel opened credit note alert.
const handleAlertCancel = () => {
closeAlert(name);
};
// Handle confirm credit note opened.
const handleAlertConfirm = () => {
openCreditNoteMutate(creditNoteId)
.then(() => {
AppToaster.show({
message: intl.get('credit_note_opened.alert.success_message'),
intent: Intent.SUCCESS,
});
})
.catch((error) => {})
.finally(() => {
closeAlert(name);
});
};
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'open'} />}
intent={Intent.WARNING}
isOpen={isOpen}
onCancel={handleAlertCancel}
onConfirm={handleAlertConfirm}
loading={isLoading}
>
<p>
<T id={'credit_note_opened.are_sure_to_open_this_credit'} />
</p>
</Alert>
);
}
export default compose(
withAlertStoreConnect(),
withAlertActions,
)(CreditNoteOpenedAlert);

View File

@@ -0,0 +1,87 @@
import React from 'react';
import intl from 'react-intl-universal';
import { FormattedMessage as T, FormattedHTMLMessage } from 'components';
import { Intent, Alert } from '@blueprintjs/core';
import { AppToaster } from 'components';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { useDeleteReconcileCredit } from 'hooks/query';
import { handleDeleteErrors } from '../../Sales/CreditNotes/CreditNotesLanding/utils';
import { compose } from 'utils';
/**
* Reconcile credit note delete alert.
*/
function ReconcileCreditNoteDeleteAlert({
name,
// #withAlertStoreConnect
isOpen,
payload: { creditNoteId },
// #withAlertActions
closeAlert,
// #withDrawerActions
closeDrawer,
}) {
const { isLoading, mutateAsync: deleteReconcileCreditMutate } =
useDeleteReconcileCredit();
// handle cancel delete credit note alert.
const handleCancelDeleteAlert = () => {
closeAlert(name);
};
const handleConfirmVendorCreditDelete = () => {
deleteReconcileCreditMutate(creditNoteId)
.then(() => {
AppToaster.show({
message: intl.get('reconcile_credit_note.alert.success_message'),
intent: Intent.SUCCESS,
});
})
.catch(
({
response: {
data: { errors },
},
}) => {
// handleDeleteErrors(errors);
},
)
.finally(() => {
closeAlert(name);
});
};
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'delete'} />}
icon="trash"
intent={Intent.DANGER}
isOpen={isOpen}
onCancel={handleCancelDeleteAlert}
onConfirm={handleConfirmVendorCreditDelete}
loading={isLoading}
>
<p>
<FormattedHTMLMessage
id={
'reconcile_credit_note.once_you_delete_this_reconcile_credit_note'
}
/>
</p>
</Alert>
);
}
export default compose(
withAlertStoreConnect(),
withAlertActions,
withDrawerActions,
)(ReconcileCreditNoteDeleteAlert);

View File

@@ -0,0 +1,76 @@
import React from 'react';
import intl from 'react-intl-universal';
import { FormattedMessage as T, FormattedHTMLMessage } from 'components';
import { Intent, Alert } from '@blueprintjs/core';
import { AppToaster } from 'components';
import { useDeleteRefundCreditNote } from 'hooks/query';
import withAlertActions from 'containers/Alert/withAlertActions';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { compose } from 'utils';
/**
* Refund credit transactions delete alert
*/
function RefundCreditNoteDeleteAlert({
name,
// #withAlertStoreConnect
isOpen,
payload: { creditNoteId },
// #withAlertActions
closeAlert,
// #withDrawerActions
closeDrawer,
}) {
const { mutateAsync: deleteRefundCreditMutate, isLoading } =
useDeleteRefundCreditNote();
// Handle cancel delete.
const handleCancelAlert = () => {
closeAlert(name);
};
// Handle confirm delete .
const handleConfirmRefundCreditDelete = () => {
deleteRefundCreditMutate(creditNoteId)
.then(() => {
AppToaster.show({
message: intl.get('refund_credit_transactions.alert.delete_message'),
intent: Intent.SUCCESS,
});
closeDrawer('refund-credit-detail-drawer');
})
.catch(() => {})
.finally(() => {
closeAlert(name);
});
};
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'delete'} />}
icon="trash"
intent={Intent.DANGER}
isOpen={isOpen}
onCancel={handleCancelAlert}
onConfirm={handleConfirmRefundCreditDelete}
loading={isLoading}
>
<p>
<T
id={`refund_credit_transactions.once_your_delete_this_refund_credit_note`}
/>
</p>
</Alert>
);
}
export default compose(
withAlertStoreConnect(),
withAlertActions,
withDrawerActions,
)(RefundCreditNoteDeleteAlert);

View File

@@ -0,0 +1,83 @@
import React from 'react';
import intl from 'react-intl-universal';
import { FormattedMessage as T, FormattedHTMLMessage } from 'components';
import { Intent, Alert } from '@blueprintjs/core';
import { AppToaster } from 'components';
import { useDeleteRole } from 'hooks/query';
import { handleDeleteErrors } from '../../Preferences/Users/Roles/utils';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';
import { compose } from 'utils';
/**
* Role delete alert.
*/
function RoleDeleteAlert({
name,
// #withAlertStoreConnect
isOpen,
payload: { roleId },
// #withAlertActions
closeAlert,
}) {
const { mutateAsync: deleteRole, isLoading } = useDeleteRole();
// Handle cancel delete role alert.
const handleCancelDelete = () => {
closeAlert(name);
};
// Handle confirm delete role.
const handleConfirmDeleteRole = () => {
deleteRole(roleId)
.then(() => {
AppToaster.show({
message: intl.get('roles.permission_schema.delete.alert_message'),
intent: Intent.SUCCESS,
});
})
.catch(
({
response: {
data: { errors },
},
}) => {
handleDeleteErrors(errors);
},
)
.finally(() => {
closeAlert(name);
});
};
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'delete'} />}
icon="trash"
intent={Intent.DANGER}
isOpen={isOpen}
onCancel={handleCancelDelete}
onConfirm={handleConfirmDeleteRole}
loading={isLoading}
>
<p>
<FormattedHTMLMessage
id={
'roles.permission_schema.once_delete_this_role_you_will_able_to_restore_it'
}
/>
</p>
</Alert>
);
}
export default compose(
withAlertStoreConnect(),
withAlertActions,
)(RoleDeleteAlert);

View File

@@ -0,0 +1,81 @@
import React from 'react';
import intl from 'react-intl-universal';
import { FormattedMessage as T } from 'components';
import { Intent, Alert } from '@blueprintjs/core';
import { AppToaster } from 'components';
import { useCancelUnlockingPartialTransactions } from 'hooks/query';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';
import { compose } from 'utils';
/**
* Cancel Unlocking partial transactions alerts.
*/
function CancelUnlockingPartialTarnsactions({
name,
// #withAlertStoreConnect
isOpen,
payload: { module },
// #withAlertActions
closeAlert,
}) {
const { mutateAsync: cancelUnlockingPartial, isLoading } =
useCancelUnlockingPartialTransactions();
// Handle cancel.
const handleCancel = () => {
closeAlert(name);
};
// Handle confirm.
const handleConfirm = () => {
const values = {
module: module,
};
cancelUnlockingPartial(values)
.then(() => {
AppToaster.show({
message: intl.get(
'unlocking_partial_transactions.alert.cancel_message',
),
intent: Intent.SUCCESS,
});
})
.catch(
({
response: {
data: { errors },
},
}) => {},
)
.finally(() => {
closeAlert(name);
});
};
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'yes'} />}
intent={Intent.DANGER}
isOpen={isOpen}
onCancel={handleCancel}
onConfirm={handleConfirm}
loading={isLoading}
>
<p>
<T id={'unlocking_partial_transactions.alert.message'} />
</p>
</Alert>
);
}
export default compose(
withAlertStoreConnect(),
withAlertActions,
)(CancelUnlockingPartialTarnsactions);

View File

@@ -0,0 +1,83 @@
import React from 'react';
import intl from 'react-intl-universal';
import { FormattedMessage as T, FormattedHTMLMessage } from 'components';
import { Intent, Alert } from '@blueprintjs/core';
import { AppToaster } from 'components';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { useDeleteReconcileVendorCredit } from 'hooks/query';
import { compose } from 'utils';
/**
* Reconcile vendor credit delete alert.
*/
function ReconcileVendorCreditDeleteAlert({
name,
// #withAlertStoreConnect
isOpen,
payload: { vendorCreditId },
// #withAlertActions
closeAlert,
// #withDrawerActions
closeDrawer,
}) {
const { isLoading, mutateAsync: deleteReconcileVendorCreditMutate } =
useDeleteReconcileVendorCredit();
// handle cancel delete credit note alert.
const handleCancelDeleteAlert = () => {
closeAlert(name);
};
const handleConfirmReconcileVendorCreditDelete = () => {
deleteReconcileVendorCreditMutate(vendorCreditId)
.then(() => {
AppToaster.show({
message: intl.get('reconcile_vendor_credit.alert.success_message'),
intent: Intent.SUCCESS,
});
// closeDrawer('vendor-credit-detail-drawer');
})
.catch(
({
response: {
data: { errors },
},
}) => {},
)
.finally(() => {
closeAlert(name);
});
};
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'delete'} />}
icon="trash"
intent={Intent.DANGER}
isOpen={isOpen}
onCancel={handleCancelDeleteAlert}
onConfirm={handleConfirmReconcileVendorCreditDelete}
loading={isLoading}
>
<p>
<FormattedHTMLMessage
id={'reconcile_vendor_credit.alert.once_you_delete_this_reconcile_vendor_credit'}
/>
</p>
</Alert>
);
}
export default compose(
withAlertStoreConnect(),
withAlertActions,
withDrawerActions,
)(ReconcileVendorCreditDeleteAlert);

View File

@@ -0,0 +1,78 @@
import React from 'react';
import intl from 'react-intl-universal';
import { FormattedMessage as T, FormattedHTMLMessage } from 'components';
import { Intent, Alert } from '@blueprintjs/core';
import { AppToaster } from 'components';
import { useDeleteRefundVendorCredit } from 'hooks/query';
import withAlertActions from 'containers/Alert/withAlertActions';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { compose } from 'utils';
/**
* Refund Vendor transactions delete alert.
*/
function RefundVendorCreditDeleteAlert({
name,
// #withAlertStoreConnect
isOpen,
payload: { vendorCreditId },
// #withAlertActions
closeAlert,
// #withDrawerActions
closeDrawer,
}) {
const { mutateAsync: deleteRefundVendorCreditMutate, isLoading } =
useDeleteRefundVendorCredit();
// Handle cancel delete.
const handleCancelAlert = () => {
closeAlert(name);
};
// Handle confirm delete .
const handleConfirmRefundVendorCreditDelete = () => {
deleteRefundVendorCreditMutate(vendorCreditId)
.then(() => {
AppToaster.show({
message: intl.get(
'refund_vendor_credit_transactions.alert.delete_message',
),
intent: Intent.SUCCESS,
});
closeDrawer('refund-vendor-detail-drawer');
})
.catch(() => {})
.finally(() => {
closeAlert(name);
});
};
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'delete'} />}
icon="trash"
intent={Intent.DANGER}
isOpen={isOpen}
onCancel={handleCancelAlert}
onConfirm={handleConfirmRefundVendorCreditDelete}
loading={isLoading}
>
<p>
<T
id={`refund_vendor_credit_transactions.once_your_delete_this_refund_vendor_credit`}
/>
</p>
</Alert>
);
}
export default compose(
withAlertStoreConnect(),
withAlertActions,
withDrawerActions,
)(RefundVendorCreditDeleteAlert);

View File

@@ -0,0 +1,84 @@
import React from 'react';
import intl from 'react-intl-universal';
import { FormattedMessage as T, FormattedHTMLMessage } from 'components';
import { Intent, Alert } from '@blueprintjs/core';
import { AppToaster } from 'components';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { handleDeleteErrors } from '../../Purchases/CreditNotes/CreditNotesLanding/utils';
import { useDeleteVendorCredit } from 'hooks/query';
import { compose } from 'utils';
/**
* Vendor Credit delete alert.
*/
function VendorCreditDeleteAlert({
name,
// #withAlertStoreConnect
isOpen,
payload: { vendorCreditId },
// #withAlertActions
closeAlert,
// #withDrawerActions
closeDrawer,
}) {
const { isLoading, mutateAsync: deleteVendorCreditMutate } =
useDeleteVendorCredit();
// handle cancel delete credit note alert.
const handleCancelDeleteAlert = () => {
closeAlert(name);
};
const handleConfirmCreditDelete = () => {
deleteVendorCreditMutate(vendorCreditId)
.then(() => {
AppToaster.show({
message: intl.get('vendor_credits.alert.delete_message'),
intent: Intent.SUCCESS,
});
closeDrawer('vendor-credit-detail-drawer');
})
.catch(
({
response: {
data: { errors },
},
}) => {
handleDeleteErrors(errors);
},
)
.finally(() => {
closeAlert(name);
});
};
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'delete'} />}
icon="trash"
intent={Intent.DANGER}
isOpen={isOpen}
onCancel={handleCancelDeleteAlert}
onConfirm={handleConfirmCreditDelete}
loading={isLoading}
>
<p>
<FormattedHTMLMessage
id={'vendor_credits.note.once_delete_this_vendor_credit_note'}
/>
</p>
</Alert>
);
}
export default compose(
withAlertStoreConnect(),
withAlertActions,
withDrawerActions,
)(VendorCreditDeleteAlert);

View File

@@ -0,0 +1,69 @@
import React from 'react';
import { FormattedMessage as T } from 'components';
import intl from 'react-intl-universal';
import { Intent, Alert } from '@blueprintjs/core';
import { useOpenVendorCredit } from 'hooks/query';
import { AppToaster } from 'components';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';
import { compose } from 'utils';
/**
* Vendor credit opened alert.
*/
function VendorCreditOpenedAlert({
name,
// #withAlertStoreConnect
isOpen,
payload: { vendorCreditId },
// #withAlertActions
closeAlert,
}) {
const { mutateAsync: openVendorCreditMutate, isLoading } =
useOpenVendorCredit();
// Handle cancel opened credit note alert.
const handleAlertCancel = () => {
closeAlert(name);
};
// Handle confirm vendor credit as opened.
const handleAlertConfirm = () => {
openVendorCreditMutate(vendorCreditId)
.then(() => {
AppToaster.show({
message: intl.get('vendor_credit_opened.alert.success_message'),
intent: Intent.SUCCESS,
});
})
.catch((error) => {})
.finally(() => {
closeAlert(name);
});
};
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'open'} />}
intent={Intent.WARNING}
isOpen={isOpen}
onCancel={handleAlertCancel}
onConfirm={handleAlertConfirm}
loading={isLoading}
>
<p>
<T id={'vendor_credit_opened.are_sure_to_open_this_credit'} />
</p>
</Alert>
);
}
export default compose(
withAlertStoreConnect(),
withAlertActions,
)(VendorCreditOpenedAlert);

View File

@@ -16,6 +16,10 @@ import ExpensesAlerts from '../Expenses/ExpensesAlerts';
import AccountTransactionsAlerts from '../CashFlow/AccountTransactions/AccountTransactionsAlerts';
import UsersAlerts from '../Preferences/Users/UsersAlerts';
import CurrenciesAlerts from '../Preferences/Currencies/CurrenciesAlerts';
import RolesAlerts from '../Preferences/Users/Roles/RolesAlerts';
import CreditNotesAlerts from '../Sales/CreditNotes/CreditNotesAlerts';
import VendorCreditNotesAlerts from '../Purchases/CreditNotes/VendorCreditNotesAlerts';
import TransactionsLockingAlerts from '../TransactionsLocking/TransactionsLockingAlerts'
export default [
...AccountsAlerts,
@@ -36,4 +40,8 @@ export default [
...AccountTransactionsAlerts,
...UsersAlerts,
...CurrenciesAlerts,
...RolesAlerts,
...CreditNotesAlerts,
...VendorCreditNotesAlerts,
...TransactionsLockingAlerts
];

View File

@@ -18,7 +18,6 @@ import { useAccountTransactionsContext } from './AccountTransactionsProvider';
import { handleCashFlowTransactionType } from './utils';
import { compose } from 'utils';
import { whenRtl, whenLtr } from 'utils/styled-components';
/**
* Account transactions data table.
@@ -129,8 +128,7 @@ const CashflowTransactionsTable = styled(DashboardConstrantTable)`
.tbody-inner {
.tr .td:not(:first-child) {
${whenLtr(`border-left: 1px solid #e6e6e6;`)}
${whenRtl(`border-right: 1px solid #e6e6e6;`)}
border-left: 1px solid #e6e6e6;
}
}
}

View File

@@ -14,7 +14,6 @@ import { curry } from 'lodash/fp';
import { Icon } from '../../../components';
import { useAccountTransactionsContext } from './AccountTransactionsProvider';
import { whenRtl, whenLtr } from 'utils/styled-components';
function AccountSwitchButton() {
const { currentAccount } = useAccountTransactionsContext();
@@ -23,7 +22,7 @@ function AccountSwitchButton() {
<AccountSwitchButtonBase
minimal={true}
rightIcon={<Icon icon={'arrow-drop-down'} iconSize={24} />}
>
>
<AccountSwitchText>{currentAccount.name}</AccountSwitchText>
</AccountSwitchButtonBase>
);
@@ -161,8 +160,7 @@ const AccountBalanceAmount = styled.span`
font-weight: 600;
display: inline-block;
color: rgb(31, 50, 85);
${whenLtr(`margin-left: 10px;`)}
${whenRtl(`margin-right: 10px;`)}
margin-left: 10px;
`;
const AccountSwitchItemName = styled.div`
@@ -180,7 +178,6 @@ const AccountSwitchItemUpdatedAt = styled.div`
const AccountSwitchButtonBase = styled(Button)`
.bp3-button-text {
${whenLtr(`margin-right: 5px;`)}
${whenRtl(`margin-left: 5px;`)}
margin-right: 5px;
}
`;

View File

@@ -4,9 +4,10 @@ import intl from 'react-intl-universal';
import { Intent, Menu, MenuItem, MenuDivider } from '@blueprintjs/core';
import { MaterialProgressBar } from 'components';
import { FormatDateCell, If, Icon } from 'components';
import { Can, FormatDateCell, If, Icon } from 'components';
import { useAccountTransactionsContext } from './AccountTransactionsProvider';
import { TRANSACRIONS_TYPE } from 'common/cashflowOptions';
import { AbilitySubject, CashflowAction } from '../../../common/abilityOption';
import { safeCallback } from 'utils';
export function ActionsMenu({
@@ -20,15 +21,17 @@ export function ActionsMenu({
text={intl.get('view_details')}
onClick={safeCallback(onViewDetails, original)}
/>
<If condition={TRANSACRIONS_TYPE.includes(original.reference_type)}>
<MenuDivider />
<MenuItem
text={intl.get('delete_transaction')}
intent={Intent.DANGER}
onClick={safeCallback(onDelete, original)}
icon={<Icon icon="trash-16" iconSize={16} />}
/>
</If>
<Can I={CashflowAction.Delete} a={AbilitySubject.Cashflow}>
<If condition={TRANSACRIONS_TYPE.includes(original.reference_type)}>
<MenuDivider />
<MenuItem
text={intl.get('delete_transaction')}
intent={Intent.DANGER}
onClick={safeCallback(onDelete, original)}
icon={<Icon icon="trash-16" iconSize={16} />}
/>
</If>
</Can>
</Menu>
);
}
@@ -83,7 +86,7 @@ export function useAccountTransactionsColumns() {
className: 'deposit',
textOverview: true,
align: 'right',
clickable: true
clickable: true,
},
{
id: 'withdrawal',
@@ -93,7 +96,7 @@ export function useAccountTransactionsColumns() {
width: 150,
textOverview: true,
align: 'right',
clickable: true
clickable: true,
},
{
id: 'running_balance',
@@ -103,7 +106,7 @@ export function useAccountTransactionsColumns() {
width: 150,
textOverview: true,
align: 'right',
clickable: true
clickable: true,
},
{
id: 'balance',

Some files were not shown because too many files have changed in this diff Show More