Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
abouolia committed Jan 13, 2022
2 parents f1899e1 + a958c60 commit da699a7
Show file tree
Hide file tree
Showing 49 changed files with 829 additions and 172 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to Bigcapital server-side will be in this file.

## [1.5.8] - 13-01-2022

### Added
- Add payment receive PDF print.
- Add credit note PDF print.

### Fixed
- fix: Payment receive initial loading state depends on request loading state instead fetching.
- fix: Balance sheet report alert positioning.
- fix: Separate customer and vendor inactivate and activate alerts.
- fix: Hide convert to invoice button if the invoice is already converted.
- fix: Customer and vendor balance summary percentage of column option.
- fix: Remove duplicated details in sales and purchases details drawers.

## [1.5.3] - 03-01-2020

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bigcapital-client",
"version": "1.5.3",
"version": "1.5.8",
"private": true,
"dependencies": {
"@babel/core": "7.8.4",
Expand Down
2 changes: 1 addition & 1 deletion src/components/CommercialDoc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ export const CommercialDocEntriesTable = styled(DataTable)`
`;

export const CommercialDocFooter = styled.div`
margin-top: 25px;
margin-top: 28px;
`;
4 changes: 4 additions & 0 deletions src/components/DialogsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import ReconcileVendorCreditDialog from '../containers/Dialogs/ReconcileVendorCr
import LockingTransactionsDialog from '../containers/Dialogs/LockingTransactionsDialog';
import UnlockingTransactionsDialog from '../containers/Dialogs/UnlockingTransactionsDialog';
import UnlockingPartialTransactionsDialog from '../containers/Dialogs/UnlockingPartialTransactionsDialog';
import CreditNotePdfPreviewDialog from '../containers/Dialogs/CreditNotePdfPreviewDialog';
import PaymentReceivePdfPreviewDialog from '../containers/Dialogs/PaymentReceivePdfPreviewDialog';

/**
* Dialogs container.
Expand Down Expand Up @@ -74,6 +76,8 @@ export default function DialogsContainer() {
<UnlockingPartialTransactionsDialog
dialogName={'unlocking-partial-transactions'}
/>
<CreditNotePdfPreviewDialog dialogName={'credit-note-pdf-preview'} />
<PaymentReceivePdfPreviewDialog dialogName={'payment-pdf-preview'} />
</div>
);
}
67 changes: 67 additions & 0 deletions src/containers/Alerts/Customers/CustomerActivateAlert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React from 'react';
import { FormattedMessage as T } from 'components';
import intl from 'react-intl-universal';
import { Intent, Alert } from '@blueprintjs/core';
import { AppToaster } from 'components';

import { useActivateContact } from 'hooks/query';

import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';

import { compose } from 'utils';

/**
* Customer activate alert.
*/
function CustomerActivateAlert({
name,

// #withAlertStoreConnect
isOpen,
payload: { customerId, service },

// #withAlertActions
closeAlert,
}) {
const { mutateAsync: activateContact, isLoading } = useActivateContact();

// Handle activate constomer alert cancel.
const handleCancelActivateCustomer = () => {
closeAlert(name);
};

// Handle confirm customer activated.
const handleConfirmCustomerActivate = () => {
activateContact(customerId)
.then(() => {
AppToaster.show({
message: intl.get('customer.alert.activated_message'),
intent: Intent.SUCCESS,
});
})
.catch((error) => {})
.finally(() => {
closeAlert(name);
});
};

return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'activate'} />}
intent={Intent.WARNING}
isOpen={isOpen}
onCancel={handleCancelActivateCustomer}
loading={isLoading}
onConfirm={handleConfirmCustomerActivate}
>
<p>{intl.get('customer.alert.are_you_sure_want_to_activate_this_customer')}</p>
</Alert>
);
}

export default compose(
withAlertStoreConnect(),
withAlertActions,
)(CustomerActivateAlert);
69 changes: 69 additions & 0 deletions src/containers/Alerts/Customers/CustomerInactivateAlert.js
Original file line number Diff line number Diff line change
@@ -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 { AppToaster } from 'components';

import { useInactivateContact } from 'hooks/query';

import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';

import { compose } from 'utils';

/**
* customer inactivate alert.
*/
function CustomerInactivateAlert({
name,
// #withAlertStoreConnect
isOpen,
payload: { customerId, service },

// #withAlertActions
closeAlert,
}) {
const { mutateAsync: inactivateContact, isLoading } = useInactivateContact();

// Handle cancel inactivate alert.
const handleCancelInactivateCustomer = () => {
closeAlert(name);
};

// Handle confirm contact Inactive.
const handleConfirmCustomerInactive = () => {
inactivateContact(customerId)
.then(() => {
AppToaster.show({
message: intl.get('the_contact_has_been_inactivated_successfully'),
intent: Intent.SUCCESS,
});
})
.catch((error) => {})
.finally(() => {
closeAlert(name);
});
};

return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'inactivate'} />}
intent={Intent.WARNING}
isOpen={isOpen}
onCancel={handleCancelInactivateCustomer}
onConfirm={handleConfirmCustomerInactive}
loading={isLoading}
>
<p>
{intl.get(
'customer.alert.are_you_sure_want_to_inactivate_this_customer',
)}
</p>
</Alert>
);
}
export default compose(
withAlertStoreConnect(),
withAlertActions,
)(CustomerInactivateAlert);
69 changes: 69 additions & 0 deletions src/containers/Alerts/Vendors/VendorActivateAlert.js
Original file line number Diff line number Diff line change
@@ -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 { AppToaster } from 'components';

import { useActivateContact } from 'hooks/query';

import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';

import { compose } from 'utils';

/**
* Vendor activate alert.
*/
function VendorActivateAlert({
name,

// #withAlertStoreConnect
isOpen,
payload: { vendorId },

// #withAlertActions
closeAlert,
}) {
const { mutateAsync: activateContact, isLoading } = useActivateContact();

// Handle activate vendor alert cancel.
const handleCancelActivateVendor = () => {
closeAlert(name);
};

// Handle confirm vendor activated.
const handleConfirmVendorActivate = () => {
activateContact(vendorId)
.then(() => {
AppToaster.show({
message: intl.get('vendor.alert.activated_message'),
intent: Intent.SUCCESS,
});
})
.catch((error) => {})
.finally(() => {
closeAlert(name);
});
};

return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'activate'} />}
intent={Intent.WARNING}
isOpen={isOpen}
onCancel={handleCancelActivateVendor}
loading={isLoading}
onConfirm={handleConfirmVendorActivate}
>
<p>
{intl.get('vendor.alert.are_you_sure_want_to_activate_this_vendor')}
</p>
</Alert>
);
}

export default compose(
withAlertStoreConnect(),
withAlertActions,
)(VendorActivateAlert);
68 changes: 68 additions & 0 deletions src/containers/Alerts/Vendors/VendorInactivateAlert.js
Original file line number Diff line number Diff line change
@@ -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 { AppToaster } from 'components';

import { useInactivateContact } from 'hooks/query';

import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';

import { compose } from 'utils';

/**
* Vendor inactivate alert.
*/
function VendorInactivateAlert({
name,
// #withAlertStoreConnect
isOpen,
payload: { vendorId },

// #withAlertActions
closeAlert,
}) {
const { mutateAsync: inactivateContact, isLoading } = useInactivateContact();

// Handle cancel inactivate alert.
const handleCancelInactivateVendor = () => {
closeAlert(name);
};

// Handle confirm contact Inactive.
const handleConfirmVendorInactive = () => {
inactivateContact(vendorId)
.then(() => {
AppToaster.show({
message: intl.get('vendor.alert.inactivated_message'),
intent: Intent.SUCCESS,
});
})
.catch((error) => {})
.finally(() => {
closeAlert(name);
});
};

return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'inactivate'} />}
intent={Intent.WARNING}
isOpen={isOpen}
onCancel={handleCancelInactivateVendor}
onConfirm={handleConfirmVendorInactive}
loading={isLoading}
>
<p>
{intl.get('vendor.alert.are_you_sure_want_to_inactivate_this_vendor')}
</p>
</Alert>
);
}

export default compose(
withAlertStoreConnect(),
withAlertActions,
)(VendorInactivateAlert);
12 changes: 6 additions & 6 deletions src/containers/Customers/CustomersAlerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import React from 'react';
const CustomerDeleteAlert = React.lazy(() =>
import('../Alerts/Customers/CustomerDeleteAlert'),
);
const ContactActivateAlert = React.lazy(() =>
import('../Alerts/Contacts/ContactActivateAlert'),
const CustomerActivateAlert = React.lazy(() =>
import('../Alerts/Customers/CustomerActivateAlert'),
);
const ContactInactivateAlert = React.lazy(() =>
import('../Alerts/Contacts/ContactInactivateAlert'),
const CustomerInactivateAlert = React.lazy(() =>
import('../Alerts/Customers/CustomerInactivateAlert'),
);

/**
* Customers alert.
*/
export default [
{ name: 'customer-delete', component: CustomerDeleteAlert },
{ name: 'contact-activate', component: ContactActivateAlert },
{ name: 'contact-inactivate', component: ContactInactivateAlert },
{ name: 'customer-activate', component: CustomerActivateAlert },
{ name: 'customer-inactivate', component: CustomerInactivateAlert },
];
10 changes: 6 additions & 4 deletions src/containers/Customers/CustomersLanding/CustomersTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,17 @@ function CustomersTable({

// Handle cancel/confirm inactive.
const handleInactiveCustomer = ({ id, contact_service }) => {
openAlert('contact-inactivate', {
contactId: id,
service: contact_service,
openAlert('customer-inactivate', {
customerId: id,
});
};

// Handle cancel/confirm activate.
const handleActivateCustomer = ({ id, contact_service }) => {
openAlert('contact-activate', { contactId: id, service: contact_service });
openAlert('customer-activate', {
customerId: id,
service: contact_service,
});
};

// Handle view detail contact.
Expand Down
Loading

0 comments on commit da699a7

Please sign in to comment.