-
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
829 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
69
src/containers/Alerts/Customers/CustomerInactivateAlert.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.