Compare commits

...

22 Commits

Author SHA1 Message Date
Ahmed Bouhuolia
1f3adf4879 chore(webapp): move components in separate files 2023-06-22 01:30:05 +02:00
Ahmed Bouhuolia
532ad61500 Merge pull request #169 from bigcapitalhq/abouolia-patch-1
Rename writeInvoicesJEntries.ts to WriteInvoicesJEntries.ts
2023-06-19 23:03:25 +02:00
Ahmed Bouhuolia
a44d779670 Rename writeInvoicesJEntries.ts to WriteInvoicesJEntries.ts 2023-06-19 23:00:22 +02:00
Ahmed Bouhuolia
ab5f9f50d0 chore: update CHANGELOG file 2023-06-19 22:58:33 +02:00
Ahmed Bouhuolia
f3f10db6db chore: change the default BASE_URL env var value 2023-06-19 22:56:58 +02:00
Ahmed Bouhuolia
de5694681b Merge pull request #168 from bigcapitalhq/abouhuolia/big-30-create-a-new-warehouse-transfer-broken
fix(webapp): warehouses select component
2023-06-19 22:44:56 +02:00
Ahmed Bouhuolia
b1a997c287 fix(webapp): warehouses select component 2023-06-19 22:43:19 +02:00
Ahmed Bouhuolia
3e36146bce Merge pull request #167 from bigcapitalhq/abouhuolia/big-33-sending-emails-on-reset-password-and-registration
fix(server): sending emails on reset password and registration
2023-06-19 16:04:25 +02:00
Ahmed Bouhuolia
db833888c8 Merge pull request #160 from bigcapitalhq/abouhuolia/big-17-issue-in-manual-journal-placeholder-text
fix(webapp): manual journal placeholder text
2023-06-19 16:02:12 +02:00
Ahmed Bouhuolia
c415e3d693 Merge pull request #161 from bigcapitalhq/abouhuolia/big-32-sidebar
fix(webapp): rename sidebar localization keys names to be keyword path
2023-06-19 16:01:43 +02:00
Ahmed Bouhuolia
e145eabf02 Merge pull request #162 from bigcapitalhq/abouhuolia/big-22-make-the-remove-line-text-to-be-in-red
fix(webapp): change the remove line option text to be red to intent as danger action
2023-06-19 16:00:54 +02:00
Ahmed Bouhuolia
caab21647d Merge pull request #159 from bigcapitalhq/abouhuolia/big-24-adjustment-type-options-do-not-show-up-2
fix(webapp): adjustment type options do not show up
2023-06-19 16:00:20 +02:00
Ahmed Bouhuolia
98528e9e5b Merge pull request #158 from bigcapitalhq/abouhuolia/big-26-add-inventory-adjustment-option-to-the-item-drawer
feat(webapp): add Inventory Adjustment option to the item drawer
2023-06-19 15:59:11 +02:00
Ahmed Bouhuolia
b993fad37f fix(webapp): change the min password length of reset password 2023-06-19 15:55:20 +02:00
Ahmed Bouhuolia
94ea44b58e fix(server): change the reigster min password length 2023-06-19 15:55:06 +02:00
Ahmed Bouhuolia
877a57043a fix(server): sending emails on reset password and registration 2023-06-19 15:36:18 +02:00
Ahmed Bouhuolia
70415d1d63 fix(webapp): change the remove line option text to be red to intent as danger action 2023-06-15 20:49:23 +02:00
Ahmed Bouhuolia
ef2d1977d6 fix(webapp): rename sidebar localization keys names to be keyword path 2023-06-15 20:12:31 +02:00
Ahmed Bouhuolia
46ea26891d fix(webapp): manual journal placeholder text 2023-06-15 20:08:39 +02:00
Ahmed Bouhuolia
f750cede89 fix(webapp): adjustment type options do not show up 2023-06-15 20:00:34 +02:00
Ahmed Bouhuolia
e5d0f16096 feat(webapp): add Inventory Adjustment option to the item drawer 2023-06-15 19:49:23 +02:00
Ahmed Bouhuolia
706694c768 Merge pull request #157 from bigcapitalhq/abouhuolia/big-23-payment-made-details-drawer-does-not-show-up-3
fix(webapp): use all drawers names from common enum object
2023-06-14 21:53:55 +02:00
47 changed files with 953 additions and 1817 deletions

View File

@@ -29,7 +29,7 @@ TENANT_DB_NAME_PERFIX=bigcapital_tenant_
# TENANT_DB_CHARSET=
# Application
BASE_URL=https://bigcapital.ly
BASE_URL=http://example.com
JWT_SECRET=b0JDZW56RnV6aEthb0RGPXVEcUI
# Jobs MongoDB

View File

@@ -2,6 +2,30 @@
All notable changes to Bigcapital server-side will be in this file.
# [0.9.8] - 19-06-2023
`bigcapitalhq/webapp`
* add: Inventory Adjustment option to the item drawer by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/158
* fix: use all drawers names from common enum object by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/157
* fix: adjustment type options do not show up by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/159
* fix: change the remove line text to be red to intent as a danger action by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/162
* fix: rename sidebar localization keys names to be keyword path by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/161
* fix: manual journal placeholder text by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/160
* fix: warehouses select component by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/168
`bigcapitalhq/server`
* fix: sending emails on reset password and registration by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/167
## [0.9.7] - 14-06-2023
`@bigcapital/webapp`
* fix: change the footer links of onboarding pages by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/139
`@bigcapital/server`
* fix: expense transaction journal entries by @abouolia in https://github.com/bigcapitalhq/bigcapital/pull/155
## [0.9.6] - 12-06-2023
`@bigcapital/webapp`

View File

@@ -92,6 +92,7 @@ export default class AuthenticationController extends BaseController {
check('password')
.exists()
.isString()
.isLength({ min: 6 })
.trim()
.escape()
.isLength({ max: DATATYPES_LENGTH.STRING }),
@@ -106,7 +107,7 @@ export default class AuthenticationController extends BaseController {
return [
check('password')
.exists()
.isLength({ min: 5 })
.isLength({ min: 6 })
.custom((value, { req }) => {
if (value !== req.body.confirm_password) {
throw new Error("Passwords don't match");

View File

@@ -95,16 +95,15 @@ module.exports = {
* JWT secret.
*/
jwtSecret: process.env.JWT_SECRET,
/**
*
*/
resetPasswordSeconds: 600,
/**
*
* Application base URL.
*/
customerSuccess: {
email: 'success@bigcapital.ly',
phoneNumber: '(218) 92 791 8381',
},
baseURL: process.env.BASE_URL,
/**
@@ -137,16 +136,6 @@ module.exports = {
},
},
/**
* Users registeration configuration.
*/
registration: {
countries: {
whitelist: ['LY'],
blacklist: [],
},
},
/**
* Sign-up restrictions
*/
@@ -167,8 +156,6 @@ module.exports = {
browserWSEndpoint: process.env.BROWSER_WS_ENDPOINT,
},
protocol: '',
hostname: '',
scheduleComputeItemCost: 'in 5 seconds',
/**

View File

@@ -1,38 +1,34 @@
import { Container, Inject } from 'typedi';
import AuthenticationService from '@/services/Authentication/AuthApplication';
import { Container } from 'typedi';
import AuthenticationMailMesssages from '@/services/Authentication/AuthenticationMailMessages';
export default class WelcomeEmailJob {
export default class ResetPasswordEmailJob {
/**
* Constructor method.
* @param {Agenda} agenda
* @param {Agenda} agenda
*/
constructor(agenda) {
agenda.define(
'reset-password-mail',
{ priority: 'high' },
this.handler.bind(this),
this.handler.bind(this)
);
}
/**
* Handle send welcome mail job.
* @param {Job} job
* @param {Function} done
* @param {Job} job
* @param {Function} done
*/
public async handler(job, done: Function): Promise<void> {
const { data } = job.attrs;
const { user, token } = data;
const Logger = Container.get('logger');
const authService = Container.get(AuthenticationService);
const authService = Container.get(AuthenticationMailMesssages);
Logger.info(`[send_reset_password] started.`, { data });
try {
await authService.mailMessages.sendResetPasswordMessage(user, token);
Logger.info(`[send_reset_password] finished.`, { data });
done()
await authService.sendResetPasswordMessage(user, token);
done();
} catch (error) {
Logger.error(`[send_reset_password] error.`, { data, error });
console.log(error);
done(error);
}
}

View File

@@ -1,22 +0,0 @@
import { Container } from 'typedi';
export default class SmsNotification {
constructor(agenda) {
agenda.define('sms-notification', { priority: 'high' }, this.handler);
}
/**
*
* @param {Job}job
*/
async handler(job) {
const { message, to } = job.attrs.data;
const smsClient = Container.get('SMSClient');
try {
await smsClient.sendMessage(to, message);
} catch (error) {
done(e);
}
}
}

View File

@@ -1,35 +0,0 @@
import { Container, Inject } from 'typedi';
import AuthenticationService from '@/services/Authentication/AuthApplication';
export default class WelcomeSMSJob {
/**
* Constructor method.
* @param {Agenda} agenda
*/
constructor(agenda) {
agenda.define('welcome-sms', { priority: 'high' }, this.handler);
}
/**
* Handle send welcome mail job.
* @param {Job} job
* @param {Function} done
*/
public async handler(job, done: Function): Promise<void> {
const { tenant, user } = job.attrs.data;
const Logger = Container.get('logger');
const authService = Container.get(AuthenticationService);
Logger.info(`[welcome_sms] started: ${job.attrs.data}`);
try {
await authService.smsMessages.sendWelcomeMessage(tenant, user);
Logger.info(`[welcome_sms] finished`, { tenant, user });
done();
} catch (error) {
Logger.info(`[welcome_sms] error`, { error, tenant, user });
done(error);
}
}
}

View File

@@ -1,39 +0,0 @@
import { Container } from 'typedi';
import AuthenticationService from '@/services/Authentication/AuthApplication';
export default class WelcomeEmailJob {
/**
* Constructor method.
* @param {Agenda} agenda -
*/
constructor(agenda) {
// Welcome mail and SMS message.
agenda.define(
'welcome-email',
{ priority: 'high' },
this.handler.bind(this),
);
}
/**
* Handle send welcome mail job.
* @param {Job} job
* @param {Function} done
*/
public async handler(job, done: Function): Promise<void> {
const { organizationId, user } = job.attrs.data;
const Logger: any = Container.get('logger');
const authService = Container.get(AuthenticationService);
Logger.info(`[welcome_mail] started: ${job.attrs.data}`);
try {
await authService.mailMessages.sendWelcomeMessage(user, organizationId);
Logger.info(`[welcome_mail] finished: ${job.attrs.data}`);
done();
} catch (error) {
Logger.error(`[welcome_mail] error: ${job.attrs.data}, error: ${error}`);
done(error);
}
}
}

View File

@@ -31,7 +31,6 @@ import OrgBuildSmsNotificationSubscriber from '@/subscribers/Organization/BuildS
import PurgeUserAbilityCache from '@/services/Users/PurgeUserAbilityCache';
import ResetLoginThrottleSubscriber from '@/subscribers/Authentication/ResetLoginThrottle';
import AuthenticationSubscriber from '@/subscribers/Authentication/SendResetPasswordMail';
import AuthSendWelcomeMailSubscriber from '@/subscribers/Authentication/SendWelcomeMail';
import PurgeAuthorizedUserOnceRoleMutate from '@/services/Roles/PurgeAuthorizedUser';
import SendSmsNotificationToCustomer from '@/subscribers/SaleInvoices/SendSmsNotificationToCustomer';
import SendSmsNotificationSaleReceipt from '@/subscribers/SaleReceipt/SendSmsNotificationToCustomer';
@@ -120,7 +119,6 @@ export const susbcribers = () => {
PurgeUserAbilityCache,
ResetLoginThrottleSubscriber,
AuthenticationSubscriber,
AuthSendWelcomeMailSubscriber,
PurgeAuthorizedUserOnceRoleMutate,
SendSmsNotificationToCustomer,
SendSmsNotificationSaleReceipt,

View File

@@ -1,24 +1,18 @@
import Agenda from 'agenda';
import WelcomeEmailJob from 'jobs/welcomeEmail';
import WelcomeSMSJob from 'jobs/WelcomeSMS';
import ResetPasswordMailJob from 'jobs/ResetPasswordMail';
import ComputeItemCost from 'jobs/ComputeItemCost';
import RewriteInvoicesJournalEntries from 'jobs/writeInvoicesJEntries';
import RewriteInvoicesJournalEntries from 'jobs/WriteInvoicesJEntries';
import UserInviteMailJob from 'jobs/UserInviteMail';
import OrganizationSetupJob from 'jobs/OrganizationSetup';
import OrganizationUpgrade from 'jobs/OrganizationUpgrade';
import SmsNotification from 'jobs/SmsNotification';
export default ({ agenda }: { agenda: Agenda }) => {
new WelcomeEmailJob(agenda);
new ResetPasswordMailJob(agenda);
new WelcomeSMSJob(agenda);
new UserInviteMailJob(agenda);
new ComputeItemCost(agenda);
new RewriteInvoicesJournalEntries(agenda);
new OrganizationSetupJob(agenda);
new OrganizationUpgrade(agenda);
new SmsNotification(agenda);
agenda.start();
};

View File

@@ -5,59 +5,24 @@ import Mail from '@/lib/Mail';
@Service()
export default class AuthenticationMailMesssages {
/**
* Sends welcome message.
* @param {ISystemUser} user - The system user.
* @param {string} organizationName -
* @return {Promise<void>}
*/
async sendWelcomeMessage(
user: ISystemUser,
organizationId: string
): Promise<void> {
const root = __dirname + '/../../../views/images/bigcapital.png';
const mail = new Mail()
.setView('mail/Welcome.html')
.setSubject('Welcome to Bigcapital')
.setTo(user.email)
.setAttachments([
{
filename: 'bigcapital.png',
path: root,
cid: 'bigcapital_logo',
},
])
.setData({
firstName: user.firstName,
organizationId,
successPhoneNumber: config.customerSuccess.phoneNumber,
successEmail: config.customerSuccess.email,
});
await mail.send();
}
/**
* Sends reset password message.
* @param {ISystemUser} user - The system user.
* @param {string} token - Reset password token.
* @return {Promise<void>}
*/
async sendResetPasswordMessage(
public async sendResetPasswordMessage(
user: ISystemUser,
token: string
): Promise<void> {
const root = __dirname + '/../../../views/images/bigcapital.png';
const mail = new Mail()
await new Mail()
.setSubject('Bigcapital - Password Reset')
.setView('mail/ResetPassword.html')
.setTo(user.email)
.setAttachments([
{
filename: 'bigcapital.png',
path: root,
path: `${global.__views_dir}/images/bigcapital.png`,
cid: 'bigcapital_logo',
},
])
@@ -65,9 +30,7 @@ export default class AuthenticationMailMesssages {
resetPasswordUrl: `${config.baseURL}/auth/reset_password/${token}`,
first_name: user.firstName,
last_name: user.lastName,
contact_us_email: config.contactUsMail,
});
await mail.send();
})
.send();
}
}

View File

@@ -1,19 +0,0 @@
import { Service, Inject } from 'typedi';
import { ISystemUser, ITenant } from '@/interfaces';
@Service()
export default class AuthenticationSMSMessages {
@Inject('SMSClient')
smsClient: any;
/**
* Sends welcome sms message.
* @param {ITenant} tenant
* @param {ISystemUser} user
*/
sendWelcomeMessage(tenant: ITenant, user: ISystemUser) {
const message: string = `Hi ${user.firstName}, Welcome to Bigcapital, You've joined the new workspace, if you need any help please don't hesitate to contact us.`;
return this.smsClient.sendMessage(user.phoneNumber, message);
}
}

View File

@@ -4,7 +4,7 @@ import events from '@/subscribers/events';
@Service()
export default class AuthenticationSubscriber {
@Inject('agenda')
agenda: any;
private agenda: any;
/**
* Attaches events with handlers.

View File

@@ -1,28 +0,0 @@
import { Service, Inject } from 'typedi';
import events from '@/subscribers/events';
@Service()
export default class AuthSendWelcomeMailSubscriber {
@Inject('agenda')
agenda: any;
/**
* Attaches events with handlers.
*/
public attach(bus) {
bus.subscribe(events.auth.signUp, this.sendWelcomeEmailOnceUserRegister);
}
/**
* Sends welcome email once the user register.
*/
private sendWelcomeEmailOnceUserRegister = async (payload) => {
const { tenant, user } = payload;
// Send welcome mail to the user.
await this.agenda.now('welcome-email', {
organizationId: tenant.organizationId,
user,
});
};
}

View File

@@ -1,411 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Bigcapital | Reset your password</title>
<style>
/* -------------------------------------
GLOBAL RESETS
------------------------------------- */
/*All the styling goes here*/
img {
border: none;
-ms-interpolation-mode: bicubic;
max-width: 100%;
}
body {
background-color: #f6f6f6;
font-family: sans-serif;
-webkit-font-smoothing: antialiased;
font-size: 14px;
line-height: 1.4;
margin: 0;
padding: 0;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
table {
border-collapse: separate;
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
width: 100%; }
table td {
font-family: sans-serif;
font-size: 14px;
vertical-align: top;
}
/* -------------------------------------
BODY & CONTAINER
------------------------------------- */
.body {
background-color: #f6f6f6;
width: 100%;
}
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
.container {
display: block;
margin: 0 auto !important;
/* makes it centered */
max-width: 580px;
padding: 10px;
width: 580px;
}
/* This should also be a block element, so that it will fill 100% of the .container */
.content {
box-sizing: border-box;
display: block;
margin: 0 auto;
max-width: 580px;
padding: 10px;
}
/* -------------------------------------
HEADER, FOOTER, MAIN
------------------------------------- */
.main {
background: #ffffff;
border-radius: 3px;
width: 100%;
}
.wrapper {
box-sizing: border-box;
padding: 20px;
}
.content-block {
padding-bottom: 10px;
padding-top: 10px;
}
.footer {
clear: both;
margin-top: 10px;
text-align: center;
width: 100%;
}
.footer td,
.footer p,
.footer span,
.footer a {
color: #999999;
font-size: 12px;
text-align: center;
}
/* -------------------------------------
TYPOGRAPHY
------------------------------------- */
h1,
h2,
h3,
h4 {
color: #000000;
font-family: sans-serif;
font-weight: bold;
line-height: 1.4;
margin: 0;
margin-bottom: 0;
}
h1 {
font-size: 35px;
font-weight: 300;
text-align: center;
text-transform: capitalize;
}
p,
ul,
ol {
font-family: sans-serif;
font-size: 14px;
font-weight: normal;
margin: 0;
margin-bottom: 15px;
}
p li,
ul li,
ol li {
list-style-position: inside;
margin-left: 5px;
}
a {
color: #3498db;
text-decoration: underline;
}
/* -------------------------------------
BUTTONS
------------------------------------- */
.btn {
box-sizing: border-box;
width: 100%;
}
.btn > tbody > tr > td {
padding-bottom: 15px; }
.btn table {
width: auto;
}
.btn table td {
background-color: #ffffff;
border-radius: 5px;
text-align: center;
}
.btn a {
background-color: #ffffff;
border: solid 1px #3498db;
border-radius: 5px;
box-sizing: border-box;
color: #3498db;
cursor: pointer;
display: inline-block;
font-size: 14px;
font-weight: bold;
margin: 0;
padding: 12px 25px;
text-decoration: none;
text-transform: capitalize;
}
.btn-primary table td {
background-color: #2d95fd;
}
.btn-primary a {
background-color: #2d95fd;
border-color: #2d95fd;
color: #ffffff;
}
/* -------------------------------------
OTHER STYLES THAT MIGHT BE USEFUL
------------------------------------- */
.last {
margin-bottom: 0;
}
.first {
margin-top: 0;
}
.align-center {
text-align: center;
}
.align-right {
text-align: right;
}
.align-left {
text-align: left;
}
.clear {
clear: both;
}
.mt0 {
margin-top: 0;
}
.mb0 {
margin-bottom: 0;
}
.mb4{
margin-bottom: 4rem;
}
.preheader {
color: transparent;
display: none;
height: 0;
max-height: 0;
max-width: 0;
opacity: 0;
overflow: hidden;
mso-hide: all;
visibility: hidden;
width: 0;
}
.powered-by a {
text-decoration: none;
}
hr {
border: 0;
border-bottom: 1px solid #f6f6f6;
margin: 20px 0;
}
/* -------------------------------------
RESPONSIVE AND MOBILE FRIENDLY STYLES
------------------------------------- */
@media only screen and (max-width: 620px) {
table[class=body] h1 {
font-size: 28px !important;
margin-bottom: 10px !important;
}
table[class=body] p,
table[class=body] ul,
table[class=body] ol,
table[class=body] td,
table[class=body] span,
table[class=body] a {
font-size: 16px !important;
}
table[class=body] .wrapper,
table[class=body] .article {
padding: 10px !important;
}
table[class=body] .content {
padding: 0 !important;
}
table[class=body] .container {
padding: 0 !important;
width: 100% !important;
}
table[class=body] .main {
border-left-width: 0 !important;
border-radius: 0 !important;
border-right-width: 0 !important;
}
table[class=body] .btn table {
width: 100% !important;
}
table[class=body] .btn a {
width: 100% !important;
}
table[class=body] .img-responsive {
height: auto !important;
max-width: 100% !important;
width: auto !important;
}
}
/* -------------------------------------
PRESERVE THESE STYLES IN THE HEAD
------------------------------------- */
@media all {
.ExternalClass {
width: 100%;
}
.ExternalClass,
.ExternalClass p,
.ExternalClass span,
.ExternalClass font,
.ExternalClass td,
.ExternalClass div {
line-height: 100%;
}
.apple-link a {
color: inherit !important;
font-family: inherit !important;
font-size: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
text-decoration: none !important;
}
#MessageViewBody a {
color: inherit;
text-decoration: none;
font-size: inherit;
font-family: inherit;
font-weight: inherit;
line-height: inherit;
}
.btn-primary table td:hover {
background-color: #004dd0 !important;
}
.btn-primary a:hover {
background-color: #004dd0 !important;
border-color: #004dd0 !important;
}
}
[data-icon="bigcapital"] path {
fill: #004dd0;
}
[data-icon='bigcapital'] .path-1,
[data-icon='bigcapital'] .path-13 {
fill: #2d95fd;
}
</style>
</head>
<body class="">
<span class="preheader">This is preheader text. Some clients will show this text as a preview.</span>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="body">
<tr>
<td>&nbsp;</td>
<td class="container">
<div class="content">
<!-- START CENTERED WHITE CONTAINER -->
<table role="presentation" class="main">
<!-- START MAIN CONTENT AREA -->
<tr>
<td class="wrapper">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<p class="align-center">
<svg data-icon="bigcapital" class="bigcapital" width="190" height="37" viewBox="0 0 309.09 42.89"><desc>bigcapital</desc><path d="M56,3.16,61.33,8.5,31.94,37.9l-5.35-5.35Z" class="path-1" fill-rule="evenodd"></path><path d="M29.53,6.94l5.35,5.34L5.49,41.67.14,36.33l15.8-15.8Z" class="path-2" fill-rule="evenodd"></path><path d="M94.36,38.87H79.62v-31H94c6.33,0,10.22,3.15,10.22,8V16a7.22,7.22,0,0,1-4.07,6.69c3.58,1.37,5.8,3.45,5.8,7.61v.09C106,36,101.35,38.87,94.36,38.87Zm3.1-21.81c0-2-1.59-3.19-4.47-3.19H86.26v6.55h6.29c3,0,4.91-1,4.91-3.28Zm1.72,12.39c0-2.08-1.54-3.37-5-3.37H86.26V32.9h8.1c3,0,4.82-1.06,4.82-3.36Z" class="path-3" fill-rule="evenodd"></path><path d="M110.56,12.54v-6h7.08v6Zm.18,26.33V15.15h6.72V38.87Z" class="path-4" fill-rule="evenodd"></path><path d="M134,46a22.55,22.55,0,0,1-10.49-2.47l2.3-5a15.52,15.52,0,0,0,8,2.17c4.61,0,6.78-2.21,6.78-6.46V33.08c-2,2.39-4.16,3.85-7.75,3.85-5.53,0-10.53-4-10.53-11.07v-.09c0-7.08,5.09-11.06,10.53-11.06a9.63,9.63,0,0,1,7.66,3.54v-3.1h6.72V33.52C147.2,42.46,142.78,46,134,46Zm6.6-20.27a5.79,5.79,0,0,0-11.56,0v.09a5.42,5.42,0,0,0,5.76,5.49,5.49,5.49,0,0,0,5.8-5.49Z" class="path-5" fill-rule="evenodd"></path><path d="M164,39.41a12.11,12.11,0,0,1-12.35-12.26v-.09a12.18,12.18,0,0,1,12.44-12.35c4.47,0,7.25,1.5,9.47,4l-4.12,4.43a6.93,6.93,0,0,0-5.4-2.61c-3.36,0-5.75,3-5.75,6.46v.09c0,3.63,2.34,6.55,6,6.55,2.26,0,3.8-1,5.44-2.53l3.94,4A12,12,0,0,1,164,39.41Z" class="path-6" fill-rule="evenodd"></path><path d="M191.51,38.87V36.31a9.15,9.15,0,0,1-7.17,3c-4.47,0-8.15-2.57-8.15-7.26V32c0-5.18,3.94-7.57,9.56-7.57a16.74,16.74,0,0,1,5.8,1V25c0-2.79-1.72-4.34-5.09-4.34a17.57,17.57,0,0,0-6.55,1.28l-1.68-5.13a21,21,0,0,1,9.21-1.9c7.34,0,10.57,3.8,10.57,10.22V38.87Zm.13-9.55a10.3,10.3,0,0,0-4.29-.89c-2.88,0-4.65,1.15-4.65,3.27v.09c0,1.82,1.5,2.88,3.67,2.88,3.15,0,5.27-1.73,5.27-4.16Z" class="path-7" fill-rule="evenodd"></path><path d="M217.49,39.32a9.1,9.1,0,0,1-7.39-3.54V46h-6.73V15.15h6.73v3.41a8.7,8.7,0,0,1,7.39-3.85c5.53,0,10.8,4.34,10.8,12.26v.09C228.29,35,223.11,39.32,217.49,39.32ZM221.56,27c0-3.94-2.66-6.55-5.8-6.55S210,23,210,27v.09c0,3.94,2.61,6.55,5.75,6.55s5.8-2.57,5.8-6.55Z" class="path-8" fill-rule="evenodd"></path><path d="M232.93,12.54v-6H240v6Zm.18,26.33V15.15h6.73V38.87Z" class="path-9" fill-rule="evenodd"></path><path d="M253.73,39.27c-4.11,0-6.9-1.63-6.9-7.12V20.91H244V15.15h2.83V9.09h6.73v6.06h5.57v5.76h-5.57V31c0,1.55.66,2.3,2.16,2.3A6.84,6.84,0,0,0,259,32.5v5.4A9.9,9.9,0,0,1,253.73,39.27Z" class="path-10" fill-rule="evenodd"></path><path d="M277.55,38.87V36.31a9.15,9.15,0,0,1-7.18,3c-4.46,0-8.14-2.57-8.14-7.26V32c0-5.18,3.94-7.57,9.56-7.57a16.74,16.74,0,0,1,5.8,1V25c0-2.79-1.73-4.34-5.09-4.34A17.57,17.57,0,0,0,266,21.92l-1.68-5.13a20.94,20.94,0,0,1,9.2-1.9c7.35,0,10.58,3.8,10.58,10.22V38.87Zm.13-9.55a10.31,10.31,0,0,0-4.3-.89c-2.87,0-4.64,1.15-4.64,3.27v.09c0,1.82,1.5,2.88,3.67,2.88,3.14,0,5.27-1.73,5.27-4.16Z" class="path-11" fill-rule="evenodd"></path><path d="M289.72,38.87V6.57h6.72v32.3Z" class="path-12" fill-rule="evenodd"></path><path d="M302.06,38.87V31.79h7.17v7.08Z" class="path-13" fill-rule="evenodd"></path></svg>
</p>
<hr />
<p class="align-center">
<h3>License Code</h3>
</p>
<p class="mgb-1x">
<h1>{{ licenseCode }}</h1>
</p>
<p class="email-note">
This is an automatically generated email please do not reply to
this email. If you face any issues, please contact us at <a href="mailto:{{ successEmail }}">{{ successEmail }}</a> or call <u>{{ successPhoneNumber }}</u></p>
</td>
</tr>
</table>
</td>
</tr>
<!-- END MAIN CONTENT AREA -->
</table>
<!-- END CENTERED WHITE CONTAINER -->
<!-- START FOOTER -->
<div class="footer">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="content-block powered-by">
Powered by <a href="http://htmlemail.io">Bigcapital.com</a>.
</td>
</tr>
</table>
</div>
<!-- END FOOTER -->
</div>
</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

View File

@@ -391,10 +391,8 @@
</tr>
</tbody>
</table>
<p>If you did not make this request, please contact us or ignore this message.</p>
<p class="email-note">
This is an automatically generated email please do not reply to
this email. If you face any issues, please contact us at {{ contact_us_email }}</p>
<p>If this was a mistake, just ignore this email and nothing will happen.</p>
<p class="email-note">This is an automatically generated email please do not reply to this email.</p>
</td>
</tr>
</table>

View File

@@ -1,407 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Bigcapital | Reset your password</title>
<style>
/* -------------------------------------
GLOBAL RESETS
------------------------------------- */
img {
border: none;
-ms-interpolation-mode: bicubic;
max-width: 100%;
}
body {
background-color: #f6f6f6;
font-family: sans-serif;
-webkit-font-smoothing: antialiased;
font-size: 14px;
line-height: 1.4;
margin: 0;
padding: 0;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
table {
border-collapse: separate;
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
width: 100%; }
table td {
font-family: sans-serif;
font-size: 14px;
vertical-align: top;
}
/* -------------------------------------
BODY & CONTAINER
------------------------------------- */
.body {
background-color: #f6f6f6;
width: 100%;
}
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
.container {
display: block;
margin: 0 auto !important;
/* makes it centered */
max-width: 580px;
padding: 10px;
width: 580px;
}
/* This should also be a block element, so that it will fill 100% of the .container */
.content {
box-sizing: border-box;
display: block;
margin: 0 auto;
max-width: 580px;
padding: 10px;
}
/* -------------------------------------
HEADER, FOOTER, MAIN
------------------------------------- */
.main {
background: #ffffff;
border-radius: 3px;
width: 100%;
}
.wrapper {
box-sizing: border-box;
padding: 20px;
}
.content-block {
padding-bottom: 10px;
padding-top: 10px;
}
.footer {
clear: both;
margin-top: 10px;
text-align: center;
width: 100%;
}
.footer td,
.footer p,
.footer span,
.footer a {
color: #999999;
font-size: 12px;
text-align: center;
}
/* -------------------------------------
TYPOGRAPHY
------------------------------------- */
h1,
h2,
h3,
h4 {
color: #000000;
font-family: sans-serif;
font-weight: bold;
line-height: 1.4;
margin: 0;
margin-bottom: 0;
}
h1 {
font-size: 35px;
font-weight: 300;
text-align: center;
text-transform: capitalize;
}
p,
ul,
ol {
font-family: sans-serif;
font-size: 14px;
font-weight: normal;
margin: 0;
margin-bottom: 15px;
}
p li,
ul li,
ol li {
list-style-position: inside;
margin-left: 5px;
}
a {
color: #3498db;
text-decoration: underline;
}
/* -------------------------------------
BUTTONS
------------------------------------- */
.btn {
box-sizing: border-box;
width: 100%;
}
.btn > tbody > tr > td {
padding-bottom: 15px; }
.btn table {
width: auto;
}
.btn table td {
background-color: #ffffff;
border-radius: 5px;
text-align: center;
}
.btn a {
background-color: #ffffff;
border: solid 1px #3498db;
border-radius: 5px;
box-sizing: border-box;
color: #3498db;
cursor: pointer;
display: inline-block;
font-size: 14px;
font-weight: bold;
margin: 0;
padding: 12px 25px;
text-decoration: none;
text-transform: capitalize;
}
.btn-primary table td {
background-color: #2d95fd;
}
.btn-primary a {
background-color: #2d95fd;
border-color: #2d95fd;
color: #ffffff;
}
/* -------------------------------------
OTHER STYLES THAT MIGHT BE USEFUL
------------------------------------- */
.last {
margin-bottom: 0;
}
.first {
margin-top: 0;
}
.align-center {
text-align: center;
}
.align-right {
text-align: right;
}
.align-left {
text-align: left;
}
.clear {
clear: both;
}
.mt0 {
margin-top: 0;
}
.mb0 {
margin-bottom: 0;
}
.mb4{
margin-bottom: 4rem;
}
.preheader {
color: transparent;
display: none;
height: 0;
max-height: 0;
max-width: 0;
opacity: 0;
overflow: hidden;
mso-hide: all;
visibility: hidden;
width: 0;
}
.powered-by a {
text-decoration: none;
}
hr {
border: 0;
border-bottom: 1px solid #f6f6f6;
margin: 20px 0;
}
/* -------------------------------------
RESPONSIVE AND MOBILE FRIENDLY STYLES
------------------------------------- */
@media only screen and (max-width: 620px) {
table[class=body] h1 {
font-size: 28px !important;
margin-bottom: 10px !important;
}
table[class=body] p,
table[class=body] ul,
table[class=body] ol,
table[class=body] td,
table[class=body] span,
table[class=body] a {
font-size: 16px !important;
}
table[class=body] .wrapper,
table[class=body] .article {
padding: 10px !important;
}
table[class=body] .content {
padding: 0 !important;
}
table[class=body] .container {
padding: 0 !important;
width: 100% !important;
}
table[class=body] .main {
border-left-width: 0 !important;
border-radius: 0 !important;
border-right-width: 0 !important;
}
table[class=body] .btn table {
width: 100% !important;
}
table[class=body] .btn a {
width: 100% !important;
}
table[class=body] .img-responsive {
height: auto !important;
max-width: 100% !important;
width: auto !important;
}
}
/* -------------------------------------
PRESERVE THESE STYLES IN THE HEAD
------------------------------------- */
@media all {
.ExternalClass {
width: 100%;
}
.ExternalClass,
.ExternalClass p,
.ExternalClass span,
.ExternalClass font,
.ExternalClass td,
.ExternalClass div {
line-height: 100%;
}
.apple-link a {
color: inherit !important;
font-family: inherit !important;
font-size: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
text-decoration: none !important;
}
#MessageViewBody a {
color: inherit;
text-decoration: none;
font-size: inherit;
font-family: inherit;
font-weight: inherit;
line-height: inherit;
}
.btn-primary table td:hover {
background-color: #004dd0 !important;
}
.btn-primary a:hover {
background-color: #004dd0 !important;
border-color: #004dd0 !important;
}
}
[data-icon="bigcapital"] path {
fill: #004dd0;
}
[data-icon='bigcapital'] .path-1,
[data-icon='bigcapital'] .path-13 {
fill: #2d95fd;
}
</style>
</head>
<body class="">
<span class="preheader">This is preheader text. Some clients will show this text as a preview.</span>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="body">
<tr>
<td>&nbsp;</td>
<td class="container">
<div class="content">
<!-- START CENTERED WHITE CONTAINER -->
<table role="presentation" class="main">
<!-- START MAIN CONTENT AREA -->
<tr>
<td class="wrapper">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<p class="align-center">
<img src="cid:bigcapital_logo" />
</p>
<hr />
<p class="align-center">
<h3>Hi {{ firstName }}, Welcome to Bigcapital, </h3>
</p>
<p class="mgb-1x">
Your organization Id: <strong>{{ organizationId }}</strong>
</p>
<p class="mgb-1x">We are available to help you get started and answer any questions you may have. You can also email <a href="mailto:{{ successEmail }}">{{ successEmail }}</a> or call <u>{{ successPhoneNumber }}</u> about your set-up questions.</p>
<p class="mgb-2-5x">Thank you for trusting Bigcapital Software for your business needs. We look forward to serving you!</p>
</td>
</tr>
</table>
</td>
</tr>
<!-- END MAIN CONTENT AREA -->
</table>
<!-- END CENTERED WHITE CONTAINER -->
<!-- START FOOTER -->
<div class="footer">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="content-block powered-by">
Made by Bigcapital Technologies, Inc
</td>
</tr>
</table>
</div>
<!-- END FOOTER -->
</div>
</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

View File

@@ -1,75 +1,21 @@
// @ts-nocheck
import React from 'react';
import { MenuItem, Button } from '@blueprintjs/core';
import { FSelect } from '../Forms';
/**
*
* @param {*} query
* @param {*} warehouse
* @param {*} _index
* @param {*} exactMatch
* @returns
*/
const warehouseItemPredicate = (query, warehouse, _index, exactMatch) => {
const normalizedTitle = warehouse.name.toLowerCase();
const normalizedQuery = query.toLowerCase();
if (exactMatch) {
return normalizedTitle === normalizedQuery;
} else {
return (
`${warehouse.code}. ${normalizedTitle}`.indexOf(normalizedQuery) >= 0
);
}
};
/**
*
* @param {*} film
* @param {*} param1
* @returns
*/
const warehouseItemRenderer = (
warehouse,
{ handleClick, modifiers, query },
) => {
const text = `${warehouse.name}`;
return (
<MenuItem
active={modifiers.active}
disabled={modifiers.disabled}
label={warehouse.code}
key={warehouse.id}
onClick={handleClick}
text={text}
/>
);
};
const warehouseSelectProps = {
itemPredicate: warehouseItemPredicate,
itemRenderer: warehouseItemRenderer,
valueAccessor: 'id',
labelAccessor: 'name',
};
/**
*
* Warehouse select field.
* @param {*} param0
* @returns
*/
export function WarehouseSelect({ warehouses, ...rest }) {
return <FSelect {...warehouseSelectProps} {...rest} items={warehouses} />;
}
/**
*
* @param {*} param0
* @returns
*/
export function WarehouseSelectButton({ label, ...rest }) {
return <Button text={label} />;
}
return (
<FSelect
valueAccessor={'id'}
labelAccessor={'code'}
textAccessor={'name'}
popoverProps={{ minimal: true, usePortal: true, inline: false }}
{...rest}
items={warehouses}
/>
);
}

View File

@@ -1,7 +0,0 @@
// @ts-nocheck
import intl from 'react-intl-universal';
export default [
{ name: intl.get('decrement'), value: 'decrement' },
{ name: intl.get('increment'), value: 'increment' },
]

View File

@@ -4,7 +4,6 @@ export * from './tableStyle';
export * from './features';
export * from './cellTypes';
export * from './classes';
export * from './adjustmentType';
export * from './cashflowOptions';
export const Align = { Left: 'left', Right: 'right', Center: 'center' };

View File

@@ -31,7 +31,7 @@ export const SidebarMenu = [
// # Homepage
// ---------------
{
text: <T id={'homepage'} />,
text: <T id={'sidebar.homepage'} />,
type: ISidebarMenuItemType.Link,
disabled: false,
href: '/',
@@ -41,20 +41,20 @@ export const SidebarMenu = [
// # Sales & Inventory
// ---------------
{
text: <T id={'sales_inventory'} />,
text: <T id={'sidebar.sales_inventory'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'items'} />,
text: <T id={'sidebar.items'} />,
type: ISidebarMenuItemType.Overlay,
overlayId: ISidebarMenuOverlayIds.Items,
children: [
{
text: <T id={'items'} />,
text: <T id={'sidebar.items'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'items'} />,
text: <T id={'sidebar.items'} />,
href: '/items',
type: ISidebarMenuItemType.Link,
permission: {
@@ -63,7 +63,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'inventory_adjustments'} />,
text: <T id={'sidebar.inventory_adjustments'} />,
href: '/inventory-adjustments',
type: ISidebarMenuItemType.Link,
permission: {
@@ -71,12 +71,6 @@ export const SidebarMenu = [
ability: InventoryAdjustmentAction.View,
},
},
{
text: <T id={'sidebar_warehouse_transfer'} />,
href: '/warehouses-transfers',
type: ISidebarMenuItemType.Link,
feature: Features.Warehouses,
},
{
text: <T id={'category_list'} />,
href: '/items/categories',
@@ -86,31 +80,20 @@ export const SidebarMenu = [
ability: ItemAction.View,
},
},
],
},
{
text: <T id={'New tasks'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'New inventory item'} />,
href: '/items/new',
type: ISidebarMenuItemType.Link,
permission: {
subject: AbilitySubject.Item,
ability: ItemAction.Create,
},
},
{
text: (
<T id={'warehouse_transfer.label.new_warehouse_transfer'} />
),
href: '/warehouses-transfers/new',
text: <T id={'sidebar.warehouse_transfer'} />,
href: '/warehouses-transfers',
type: ISidebarMenuItemType.Link,
feature: Features.Warehouses,
},
],
},
{
text: <T id={'sidebar.new_tasks'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'New service'} />,
text: <T id={'sidebar.new_inventory_item'} />,
href: '/items/new',
type: ISidebarMenuItemType.Link,
permission: {
@@ -119,7 +102,16 @@ export const SidebarMenu = [
},
},
{
text: <T id={'New item category'} />,
text: <T id={'sidebar.new_service'} />,
href: '/items/new',
type: ISidebarMenuItemType.Link,
permission: {
subject: AbilitySubject.Item,
ability: ItemAction.Create,
},
},
{
text: <T id={'sidebar.new_item_category'} />,
href: '/items/categories/new',
type: ISidebarMenuItemType.Dialog,
dialogName: 'item-category-form',
@@ -128,6 +120,12 @@ export const SidebarMenu = [
ability: ItemAction.Create,
},
},
{
text: <T id={'sidebar.new_warehouse_transfer'} />,
href: '/warehouses-transfers/new',
type: ISidebarMenuItemType.Link,
feature: Features.Warehouses,
},
],
},
],
@@ -138,16 +136,16 @@ export const SidebarMenu = [
// # Sales
// ---------------
{
text: <T id={'sales'} />,
text: <T id={'sidebar.sales'} />,
type: ISidebarMenuItemType.Overlay,
overlayId: ISidebarMenuOverlayIds.Sales,
children: [
{
text: <T id={'sales'} />,
text: <T id={'sidebar.sales'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'estimates'} />,
text: <T id={'sidebar.estimates'} />,
href: '/estimates',
type: ISidebarMenuItemType.Link,
permission: {
@@ -156,7 +154,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'invoices'} />,
text: <T id={'sidebar.invoices'} />,
href: '/invoices',
type: ISidebarMenuItemType.Link,
permission: {
@@ -165,7 +163,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'receipts'} />,
text: <T id={'sidebar.receipts'} />,
href: '/receipts',
type: ISidebarMenuItemType.Link,
permission: {
@@ -174,12 +172,12 @@ export const SidebarMenu = [
},
},
{
text: <T id={'sidebar_credit_note'} />,
text: <T id={'sidebar.credit_notes'} />,
href: '/credit-notes',
type: ISidebarMenuItemType.Link,
},
{
text: <T id={'payment_receives'} />,
text: <T id={'sidebar.payment_receives'} />,
href: '/payment-receives',
type: ISidebarMenuItemType.Link,
permission: {
@@ -190,11 +188,11 @@ export const SidebarMenu = [
],
},
{
text: <T id={'New tasks'} />,
text: <T id={'sidebar.new_tasks'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'new_estimate'} />,
text: <T id={'sidebar.new_estimate'} />,
href: '/estimates/new',
type: ISidebarMenuItemType.Link,
permission: {
@@ -203,7 +201,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'new_invoice'} />,
text: <T id={'sidebar.new_invoice'} />,
href: '/invoices/new',
type: ISidebarMenuItemType.Link,
permission: {
@@ -212,7 +210,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'new_receipt'} />,
text: <T id={'sidebar.new_receipt'} />,
href: '/receipts/new',
type: ISidebarMenuItemType.Link,
permission: {
@@ -221,12 +219,12 @@ export const SidebarMenu = [
},
},
{
text: <T id={'credit_note.label.new_credit_note'} />,
text: <T id={'sidebar.new_credit_note'} />,
href: '/credit-notes/new',
type: ISidebarMenuItemType.Link,
},
{
text: <T id={'new_payment_receive'} />,
text: <T id={'sidebar.new_payment_receive'} />,
href: '/payment-receives/new',
type: ISidebarMenuItemType.Link,
permission: {
@@ -242,12 +240,12 @@ export const SidebarMenu = [
// # Purchases
// ---------------
{
text: <T id={'purchases'} />,
text: <T id={'sidebar.purchases'} />,
type: ISidebarMenuItemType.Overlay,
overlayId: ISidebarMenuOverlayIds.Purchases,
children: [
{
text: <T id={'purchases'} />,
text: <T id={'sidebar.purchases'} />,
type: ISidebarMenuItemType.Group,
children: [
{
@@ -276,11 +274,11 @@ export const SidebarMenu = [
],
},
{
text: <T id={'New tasks'} />,
text: <T id={'sidebar.new_tasks'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'New purchase invoice'} />,
text: <T id={'sidebar.new_purchase_invoice'} />,
href: '/bills/new',
type: ISidebarMenuItemType.Link,
permission: {
@@ -289,7 +287,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'vendor_credits.label.new_vendor_credit'} />,
text: <T id={'sidebar.new_vendor_credit'} />,
href: '/vendor-credits/new',
type: ISidebarMenuItemType.Link,
permission: {
@@ -298,7 +296,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'new_payment_made'} />,
text: <T id={'sidebar.new_payment_made'} />,
href: '/payment-mades/new',
type: ISidebarMenuItemType.Link,
permission: {
@@ -314,16 +312,16 @@ export const SidebarMenu = [
// # Contacts
// ---------------
{
text: <T id={'contacts'} />,
text: <T id={'sidebar.contacts'} />,
type: ISidebarMenuItemType.Overlay,
overlayId: ISidebarMenuOverlayIds.Contacts,
children: [
{
text: <T id={'contacts'} />,
text: <T id={'sidebar.contacts'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'customers'} />,
text: <T id={'sidebar.customers'} />,
href: '/customers',
type: ISidebarMenuItemType.Link,
permission: {
@@ -332,7 +330,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'vendors'} />,
text: <T id={'sidebar.vendors'} />,
href: '/vendors',
type: ISidebarMenuItemType.Link,
permission: {
@@ -343,11 +341,11 @@ export const SidebarMenu = [
],
},
{
text: <T id={'New tasks'} />,
text: <T id={'sidebar.new_tasks'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'new_customer'} />,
text: <T id={'sidebar.new_customer'} />,
href: '/customers/new',
type: ISidebarMenuItemType.Link,
permission: {
@@ -356,7 +354,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'new_vendor'} />,
text: <T id={'sidebar.new_vendor'} />,
href: '/vendors/new',
type: ISidebarMenuItemType.Link,
permission: {
@@ -372,20 +370,20 @@ export const SidebarMenu = [
// # Accounting
// ---------------
{
text: <T id={'accounting'} />,
text: <T id={'sidebar.accounting'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'financial'} />,
text: <T id={'sidebar.financial'} />,
type: ISidebarMenuItemType.Overlay,
overlayId: ISidebarMenuOverlayIds.Financial,
children: [
{
text: <T id={'financial'} />,
text: <T id={'sidebar.financial'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'accounts_chart'} />,
text: <T id={'sidebar.accounts_chart'} />,
href: '/accounts',
type: ISidebarMenuItemType.Link,
permission: {
@@ -394,7 +392,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'manual_journals'} />,
text: <T id={'sidebar.manual_journals'} />,
href: '/manual-journals',
type: ISidebarMenuItemType.Link,
permission: {
@@ -410,11 +408,11 @@ export const SidebarMenu = [
],
},
{
text: <T id={'New tasks'} />,
text: <T id={'sidebar.new_tasks'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'make_journal_entry'} />,
text: <T id={'sidebar.make_journal_entry'} />,
href: '/make-journal-entry',
type: ISidebarMenuItemType.Link,
permission: {
@@ -441,7 +439,7 @@ export const SidebarMenu = [
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'siebar.cashflow.label_cash_and_bank_accounts'} />,
text: <T id={'sidebar.cash_bank_accounts'} />,
href: '/cashflow-accounts',
type: ISidebarMenuItemType.Link,
permission: {
@@ -452,12 +450,12 @@ export const SidebarMenu = [
],
},
{
text: <T id={'New tasks'} />,
text: <T id={'sidebar.new_tasks'} />,
type: ISidebarMenuItemType.Group,
divider: true,
children: [
{
text: <T id={'cash_flow.label.add_money_in'} />,
text: <T id={'sidebar.add_money_in'} />,
href: '/cashflow-accounts',
type: ISidebarMenuItemType.Dialog,
dialogName: 'money-in',
@@ -467,7 +465,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'cash_flow.label.add_money_out'} />,
text: <T id={'sidebar.add_money_out'} />,
href: '/cashflow-accounts',
type: ISidebarMenuItemType.Dialog,
permission: {
@@ -476,7 +474,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'cash_flow.label.add_cash_account'} />,
text: <T id={'sidebar.add_cash_account'} />,
href: '/cashflow-accounts',
type: ISidebarMenuItemType.Dialog,
permission: {
@@ -485,7 +483,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'cash_flow.label.add_bank_account'} />,
text: <T id={'sidebar.add_bank_account'} />,
href: '/cashflow-accounts',
type: ISidebarMenuItemType.Dialog,
permission: {
@@ -501,16 +499,16 @@ export const SidebarMenu = [
// # Expenses
// ---------------
{
text: <T id={'expenses'} />,
text: <T id={'sidebar.expenses'} />,
type: ISidebarMenuItemType.Overlay,
overlayId: ISidebarMenuOverlayIds.Expenses,
children: [
{
text: <T id={'expenses'} />,
text: <T id={'sidebar.expenses'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'expenses'} />,
text: <T id={'sidebar.expenses'} />,
href: '/expenses',
type: ISidebarMenuItemType.Link,
permission: {
@@ -521,11 +519,11 @@ export const SidebarMenu = [
],
},
{
text: <T id={'New tasks'} />,
text: <T id={'sidebar.new_tasks'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'new_expense'} />,
text: <T id={'sidebar.new_expense'} />,
href: '/expenses/new',
type: ISidebarMenuItemType.Link,
permission: {
@@ -541,16 +539,16 @@ export const SidebarMenu = [
// # Projects Management
// ---------------------
// {
// text: 'Projects',
// text: <T id={'sidebar.projects'} />,
// type: ISidebarMenuItemType.Overlay,
// overlayId: ISidebarMenuOverlayIds.Projects,
// children: [
// {
// text: 'Projects',
// text: <T id={'sidebar.projects'} />,
// type: ISidebarMenuItemType.Group,
// children: [
// {
// text: 'Projects',
// text: <T id={'sidebar.projects'} />,
// href: '/projects',
// type: ISidebarMenuItemType.Link,
// permission: {
@@ -561,11 +559,11 @@ export const SidebarMenu = [
// ],
// },
// {
// text: <T id={'New tasks'} />,
// text: <T id={'sidebar.new_tasks'} />,
// type: ISidebarMenuItemType.Group,
// children: [
// {
// text: <T id={'projects.label.new_project'} />,
// text: <T id={'sidebar.new_project'} />,
// type: ISidebarMenuItemType.Dialog,
// dialogName: 'project-form',
// permission: {
@@ -574,18 +572,18 @@ export const SidebarMenu = [
// },
// },
// {
// text: <T id={'projects.label.new_time_entry'} />,
// text: <T id={'sidebar.new_time_entry'} />,
// type: ISidebarMenuItemType.Dialog,
// dialogName: 'project-time-entry-form',
// },
// ],
// },
// {
// text: <T id={'Reports'} />,
// text: <T id={'sidebar.reports'} />,
// type: ISidebarMenuItemType.Group,
// children: [
// {
// text: <T id={'project_profitability_summary'} />,
// text: <T id={'sidebar.project_profitability_summary'} />,
// href: '/financial-reports/project-profitability-summary',
// type: ISidebarMenuItemType.Link,
// },
@@ -597,16 +595,16 @@ export const SidebarMenu = [
// # Reports
// ---------------
{
text: <T id={'Reports'} />,
text: <T id={'sidebar.reports'} />,
type: ISidebarMenuItemType.Overlay,
overlayId: ISidebarMenuOverlayIds.Reports,
children: [
{
text: <T id={'Reports'} />,
text: <T id={'sidebar.reports'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'balance_sheet'} />,
text: <T id={'sidebar.balance_sheet'} />,
href: '/financial-reports/balance-sheet',
type: ISidebarMenuItemType.Link,
permission: {
@@ -615,7 +613,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'trial_balance_sheet'} />,
text: <T id={'sidebar.trial_balance_sheet'} />,
href: '/financial-reports/trial-balance-sheet',
type: ISidebarMenuItemType.Link,
permission: {
@@ -624,7 +622,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'journal'} />,
text: <T id={'sidebar.journal'} />,
href: '/financial-reports/journal-sheet',
type: ISidebarMenuItemType.Link,
permission: {
@@ -633,7 +631,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'general_ledger'} />,
text: <T id={'sidebar.general_ledger'} />,
href: '/financial-reports/general-ledger',
type: ISidebarMenuItemType.Link,
permission: {
@@ -642,7 +640,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'profit_loss_sheet'} />,
text: <T id={'sidebar.profit_loss_sheet'} />,
href: '/financial-reports/profit-loss-sheet',
type: ISidebarMenuItemType.Link,
permission: {
@@ -651,7 +649,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'cash_flow_statement'} />,
text: <T id={'sidebar.cash_flow_statement'} />,
href: '/financial-reports/cash-flow',
type: ISidebarMenuItemType.Link,
permission: {
@@ -660,7 +658,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'AR_Aging_Summary'} />,
text: <T id={'sidebar.ar_aging_Summary'} />,
href: '/financial-reports/receivable-aging-summary',
type: ISidebarMenuItemType.Link,
permission: {
@@ -669,7 +667,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'AP_Aging_Summary'} />,
text: <T id={'sidebar.ap_aging_summary'} />,
href: '/financial-reports/payable-aging-summary',
type: ISidebarMenuItemType.Link,
permission: {
@@ -680,11 +678,11 @@ export const SidebarMenu = [
],
},
{
text: <T id={'Sales/Purchases'} />,
text: <T id={'sidebar.sales_purchases'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'purchases_by_items'} />,
text: <T id={'sidebar.purchases_by_items'} />,
type: ISidebarMenuItemType.Link,
href: '/financial-reports/purchases-by-items',
permission: {
@@ -693,7 +691,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'sales_by_items'} />,
text: <T id={'sidebar.sales_by_items'} />,
href: '/financial-reports/sales-by-items',
type: ISidebarMenuItemType.Link,
permission: {
@@ -702,7 +700,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'customers_transactions'} />,
text: <T id={'sidebar.customers_transactions'} />,
href: '/financial-reports/transactions-by-customers',
type: ISidebarMenuItemType.Link,
permission: {
@@ -711,7 +709,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'vendors_transactions'} />,
text: <T id={'sidebar.vendors_transactions'} />,
href: '/financial-reports/transactions-by-vendors',
type: ISidebarMenuItemType.Link,
permission: {
@@ -720,7 +718,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'customers_balance_summary'} />,
text: <T id={'sidebar.customers_balance_summary'} />,
href: '/financial-reports/customers-balance-summary',
type: ISidebarMenuItemType.Link,
permission: {
@@ -729,7 +727,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'vendors_balance_summary'} />,
text: <T id={'sidebar.vendors_balance_summary'} />,
href: '/financial-reports/vendors-balance-summary',
type: ISidebarMenuItemType.Link,
permission: {
@@ -740,11 +738,11 @@ export const SidebarMenu = [
],
},
{
text: <T id={'inventory'} />,
text: <T id={'sidebar.inventory'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'inventory_item_details'} />,
text: <T id={'sidebar.inventory_item_details'} />,
href: '/financial-reports/inventory-item-details',
type: ISidebarMenuItemType.Link,
permission: {
@@ -753,7 +751,7 @@ export const SidebarMenu = [
},
},
{
text: <T id={'inventory_valuation'} />,
text: <T id={'sidebar.inventory_valuation'} />,
href: '/financial-reports/inventory-valuation',
type: ISidebarMenuItemType.Link,
permission: {
@@ -766,11 +764,11 @@ export const SidebarMenu = [
],
},
{
text: <T id={'system'} />,
text: <T id={'sidebar.system'} />,
type: ISidebarMenuItemType.Group,
children: [
{
text: <T id={'preferences'} />,
text: <T id={'sidebar.preferences'} />,
href: '/preferences',
type: ISidebarMenuItemType.Link,
permission: {

View File

@@ -1,14 +1,8 @@
// @ts-nocheck
import React from 'react';
import {
InputGroup,
FormGroup,
Position,
ControlGroup,
} from '@blueprintjs/core';
import { FastField, ErrorMessage, useFormikContext } from 'formik';
import { InputGroup, FormGroup, Position } from '@blueprintjs/core';
import { FastField, ErrorMessage } from 'formik';
import { DateInput } from '@blueprintjs/datetime';
import * as R from 'ramda';
import classNames from 'classnames';
import { CLASSES } from '@/constants/classes';
@@ -20,99 +14,15 @@ import {
} from '@/utils';
import {
Hint,
FieldHint,
FieldRequiredHint,
Icon,
InputPrependButton,
CurrencySelectList,
FormattedMessage as T,
FInputGroup,
FFormGroup,
} from '@/components';
import { useMakeJournalFormContext } from './MakeJournalProvider';
import { JournalExchangeRateInputField } from './components';
import { currenciesFieldShouldUpdate } from './utils';
import withSettings from '@/containers/Settings/withSettings';
import withDialogActions from '@/containers/Dialog/withDialogActions';
/**
* Journal number field of make journal form.
*/
const MakeJournalTransactionNoField = R.compose(
withDialogActions,
withSettings(({ manualJournalsSettings }) => ({
journalAutoIncrement: manualJournalsSettings?.autoIncrement,
})),
)(
({
// #withDialog
openDialog,
// #withSettings
journalAutoIncrement,
}) => {
const { setFieldValue, values } = useFormikContext();
const handleJournalNumberChange = () => {
openDialog('journal-number-form');
};
const handleJournalNoBlur = (event) => {
const newValue = event.target.value;
if (values.journal_number !== newValue && journalAutoIncrement) {
openDialog('journal-number-form', {
initialFormValues: {
onceManualNumber: newValue,
incrementMode: 'manual-transaction',
},
});
}
if (!journalAutoIncrement) {
setFieldValue('journal_number', newValue);
setFieldValue('journal_number_manually', newValue);
}
};
return (
<FFormGroup
name={'journal_number'}
label={<T id={'journal_no'} />}
labelInfo={
<>
<FieldRequiredHint />
<FieldHint />
</>
}
fill={true}
inline={true}
fastField={true}
>
<ControlGroup fill={true}>
<FInputGroup
name={'journal_number'}
fill={true}
asyncControl={true}
onBlur={handleJournalNoBlur}
fastField={true}
onChange={() => {}}
/>
<InputPrependButton
buttonProps={{
onClick: handleJournalNumberChange,
icon: <Icon icon={'settings-18'} />,
}}
tooltip={true}
tooltipProps={{
content: <T id={'setting_your_auto_generated_journal_number'} />,
position: Position.BOTTOM_LEFT,
}}
/>
</ControlGroup>
</FFormGroup>
);
},
);
import { MakeJournalTransactionNoField } from './MakeJournalTransactionNoField';
/**
* Make journal entries header.

View File

@@ -1,6 +1,7 @@
// @ts-nocheck
import React from 'react';
import styled from 'styled-components';
import intl from 'react-intl-universal';
import { FFormGroup, FEditableText, FormattedMessage as T } from '@/components';
export function MakeJournalFormFooterLeft() {
@@ -13,7 +14,7 @@ export function MakeJournalFormFooterLeft() {
>
<FEditableText
name={'description'}
placeholder={<T id={'make_jorunal.decscrption.placeholder'} />}
placeholder={intl.get('make_jorunal.decscrption.placeholder')}
/>
</DescriptionFormGroup>
</React.Fragment>

View File

@@ -0,0 +1,97 @@
// @ts-nocheck
import React from 'react';
import { Position, ControlGroup } from '@blueprintjs/core';
import { useFormikContext } from 'formik';
import * as R from 'ramda';
import {
FieldHint,
FieldRequiredHint,
Icon,
InputPrependButton,
FormattedMessage as T,
FInputGroup,
FFormGroup,
} from '@/components';
import withSettings from '@/containers/Settings/withSettings';
import withDialogActions from '@/containers/Dialog/withDialogActions';
/**
* Journal number field of make journal form.
*/
export const MakeJournalTransactionNoField = R.compose(
withDialogActions,
withSettings(({ manualJournalsSettings }) => ({
journalAutoIncrement: manualJournalsSettings?.autoIncrement,
})),
)(
({
// #withDialog
openDialog,
// #withSettings
journalAutoIncrement,
}) => {
const { setFieldValue, values } = useFormikContext();
const handleJournalNumberChange = () => {
openDialog('journal-number-form');
};
const handleJournalNoBlur = (event) => {
const newValue = event.target.value;
if (values.journal_number !== newValue && journalAutoIncrement) {
openDialog('journal-number-form', {
initialFormValues: {
onceManualNumber: newValue,
incrementMode: 'manual-transaction',
},
});
}
if (!journalAutoIncrement) {
setFieldValue('journal_number', newValue);
setFieldValue('journal_number_manually', newValue);
}
};
return (
<FFormGroup
name={'journal_number'}
label={<T id={'journal_no'} />}
labelInfo={
<>
<FieldRequiredHint />
<FieldHint />
</>
}
fill={true}
inline={true}
fastField={true}
>
<ControlGroup fill={true}>
<FInputGroup
name={'journal_number'}
fill={true}
asyncControl={true}
onBlur={handleJournalNoBlur}
fastField={true}
onChange={() => {}}
/>
<InputPrependButton
buttonProps={{
onClick: handleJournalNumberChange,
icon: <Icon icon={'settings-18'} />,
}}
tooltip={true}
tooltipProps={{
content: <T id={'setting_your_auto_generated_journal_number'} />,
position: Position.BOTTOM_LEFT,
}}
/>
</ControlGroup>
</FFormGroup>
);
},
);
MakeJournalTransactionNoField.displayName = 'MakeJournalTransactionNoField';

View File

@@ -1,7 +1,7 @@
// @ts-nocheck
import React, { useEffect } from 'react';
import intl from 'react-intl-universal';
import { Menu, MenuItem, Position, Button } from '@blueprintjs/core';
import { Menu, MenuItem, Position, Button, Intent } from '@blueprintjs/core';
import { Popover2 } from '@blueprintjs/popover2';
import { useFormikContext } from 'formik';
import * as R from 'ramda';
@@ -74,6 +74,7 @@ export const ActionsCellRenderer = ({
const exampleMenu = (
<Menu>
<MenuItem
intent={Intent.DANGER}
onClick={handleClickRemoveRole}
text={intl.get('make_journal.entries.remove_row')}
/>

View File

@@ -23,11 +23,11 @@ export const RegisterSchema = Yup.object().shape({
first_name: Yup.string().required().label(intl.get('first_name_')),
last_name: Yup.string().required().label(intl.get('last_name_')),
email: Yup.string().email().required().label(intl.get('email')),
password: Yup.string().min(4).required().label(intl.get('password')),
password: Yup.string().min(6).required().label(intl.get('password')),
});
export const ResetPasswordSchema = Yup.object().shape({
password: Yup.string().min(4).required().label(intl.get('password')),
password: Yup.string().min(6).required().label(intl.get('password')),
confirm_password: Yup.string()
.oneOf([Yup.ref('password'), null])
.required()

View File

@@ -23,7 +23,6 @@ import {
BranchSelect,
WarehouseSelect,
BranchSelectButton,
WarehouseSelectButton,
AccountsSuggestField,
} from '@/components';
import {
@@ -34,16 +33,17 @@ import {
toSafeNumber,
} from '@/utils';
import { Features, CLASSES } from '@/constants';
import adjustmentType from '@/constants/adjustmentType';
import { useInventoryAdjContext } from './InventoryAdjustmentFormProvider';
import { useFeatureCan } from '@/hooks/state';
import InventoryAdjustmentQuantityFields from './InventoryAdjustmentQuantityFields';
import {
diffQuantity,
useSetPrimaryBranchToForm,
useSetPrimaryWarehouseToForm,
useGetAdjustmentTypeOptions,
} from './utils';
import { useFeatureCan } from '@/hooks/state';
import InventoryAdjustmentQuantityFields from './InventoryAdjustmentQuantityFields';
/**
* Inventory adjustment form dialogs fields.
@@ -52,6 +52,9 @@ export default function InventoryAdjustmentFormDialogFields() {
// Features guard.
const { featureCan } = useFeatureCan();
// Retrieves memorized adjustment types options.
const adjustmentTypes = useGetAdjustmentTypeOptions();
const dateFieldRef = useAutofocus();
// Inventory adjustment dialog context.
@@ -90,7 +93,6 @@ export default function InventoryAdjustmentFormDialogFields() {
<WarehouseSelect
name={'warehouse_id'}
warehouses={warehouses}
input={WarehouseSelectButton}
popoverProps={{ minimal: true }}
/>
</FormGroup>
@@ -149,7 +151,7 @@ export default function InventoryAdjustmentFormDialogFields() {
className={classNames(CLASSES.FILL, 'form-group--type')}
>
<ListSelect
items={adjustmentType}
items={adjustmentTypes}
onItemSelect={(type) => {
const result = diffQuantity(
toSafeNumber(values.quantity),

View File

@@ -1,5 +1,6 @@
// @ts-nocheck
import React from 'react';
import React, { useMemo } from 'react';
import intl from 'react-intl-universal';
import { useFormikContext } from 'formik';
import { useInventoryAdjContext } from './InventoryAdjustmentFormProvider';
import { first } from 'lodash';
@@ -48,3 +49,12 @@ export const useSetPrimaryBranchToForm = () => {
}
}, [isBranchesSuccess, setFieldValue, branches]);
};
export const getAdjustmentTypeOptions = () => [
{ name: intl.get('decrement'), value: 'decrement' },
{ name: intl.get('increment'), value: 'increment' },
];
export const useGetAdjustmentTypeOptions = () => {
return useMemo(() => getAdjustmentTypeOptions(), []);
};

View File

@@ -21,6 +21,7 @@ import {
FormattedMessage as T,
Can,
} from '@/components';
import { ItemDetailActionsMoreBtn } from './ItemDetailActionsMoreBtn';
import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers';
@@ -72,6 +73,7 @@ function ItemDetailActionsBar({
onClick={handleDeleteItem}
/>
</Can>
<ItemDetailActionsMoreBtn />
</NavbarGroup>
</DashboardActionsBar>
);

View File

@@ -0,0 +1,64 @@
// @ts-nocheck
import React from 'react';
import * as R from 'ramda';
import { Can, Icon, T } from '@/components';
import {
Button,
Menu,
MenuItem,
Popover,
PopoverInteractionKind,
Position,
} from '@blueprintjs/core';
import {
AbilitySubject,
InventoryAdjustmentAction,
} from '@/constants/abilityOption';
import { useItemDetailDrawerContext } from './ItemDetailDrawerProvider';
import withDialogActions from '@/containers/Dialog/withDialogActions';
/**
* Invoice details more actions menu.
* @returns {React.JSX}
*/
export const ItemDetailActionsMoreBtn = R.compose(withDialogActions)(
({
//#withDialogActions,
openDialog,
}) => {
const { itemId, item } = useItemDetailDrawerContext();
// Cannot continue if the item type is not inventory.
if (item.type !== 'inventory') return null;
const handleInventoryAdjustment = () => {
openDialog('inventory-adjustment', { itemId });
};
return (
<Popover
minimal={true}
interactionKind={PopoverInteractionKind.CLICK}
position={Position.BOTTOM_LEFT}
modifiers={{
offset: { offset: '0, 4' },
}}
content={
<Menu>
<Can
I={InventoryAdjustmentAction.Edit}
a={AbilitySubject.InventoryAdjustment}
>
<MenuItem
text={<T id={'item.view_drawer.make_adjustment'} />}
onClick={handleInventoryAdjustment}
/>
</Can>
</Menu>
}
>
<Button icon={<Icon icon="more-vert" iconSize={16} />} minimal={true} />
</Popover>
);
},
);

View File

@@ -1,7 +1,7 @@
// @ts-nocheck
import React from 'react';
import intl from 'react-intl-universal';
import { MenuItem, Menu, Button, Position } from '@blueprintjs/core';
import { MenuItem, Menu, Button, Position, Intent } from '@blueprintjs/core';
import { Popover2 } from '@blueprintjs/popover2';
import { Align, CellType, Features } from '@/constants';
@@ -47,6 +47,7 @@ export function ActionsCellRenderer({
const exampleMenu = (
<Menu>
<MenuItem
intent={Intent.DANGER}
onClick={onRemoveRole}
text={<T id={'item_entries.remove_row'} />}
/>

View File

@@ -1,7 +1,7 @@
// @ts-nocheck
import React from 'react';
import intl from 'react-intl-universal';
import { Button, Menu, MenuItem } from '@blueprintjs/core';
import { Button, Intent, Menu, MenuItem } from '@blueprintjs/core';
import { Popover2 } from '@blueprintjs/popover2';
import { useFormikContext } from 'formik';
@@ -51,6 +51,7 @@ const ActionsCellRenderer = ({
const exampleMenu = (
<Menu>
<MenuItem
intent={Intent.DANGER}
onClick={handleClickRemoveRole}
text={intl.get('expense.entries.remove_row')}
/>

View File

@@ -1,34 +1,24 @@
// @ts-nocheck
import React from 'react';
import * as R from 'ramda';
import classNames from 'classnames';
import styled from 'styled-components';
import {
FormGroup,
InputGroup,
Position,
ControlGroup,
} from '@blueprintjs/core';
import { FormGroup, InputGroup, Position } from '@blueprintjs/core';
import { DateInput } from '@blueprintjs/datetime';
import { FastField, ErrorMessage, useFormikContext } from 'formik';
import { FastField, ErrorMessage } from 'formik';
import { CLASSES } from '@/constants/classes';
import {
CustomerSelectField,
FieldRequiredHint,
InputPrependButton,
Icon,
FormattedMessage as T,
CustomerDrawerLink,
FFormGroup,
FInputGroup,
} from '@/components';
import { customerNameFieldShouldUpdate } from './utils';
import { useCreditNoteFormContext } from './CreditNoteFormProvider';
import withSettings from '@/containers/Settings/withSettings';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import { CreditNoteExchangeRateInputField } from './components';
import { CreditNoteTransactionNoField } from './CreditNoteTransactionNoField';
import {
momentFormatter,
tansformDateValue,
@@ -36,87 +26,6 @@ import {
handleDateChange,
} from '@/utils';
/**
* Credit note transaction number field.
*/
const CreditNoteTransactionNoField = R.compose(
withDialogActions,
withSettings(({ creditNoteSettings }) => ({
creditAutoIncrement: creditNoteSettings?.autoIncrement,
creditNextNumber: creditNoteSettings?.nextNumber,
creditNumberPrefix: creditNoteSettings?.numberPrefix,
})),
)(
({
// #withDialogActions
openDialog,
// #withSettings
creditAutoIncrement,
}) => {
const { values, setFieldValue } = useFormikContext();
// Handle credit number changing.
const handleCreditNumberChange = () => {
openDialog('credit-number-form');
};
// Handle credit note no. field blur.
const handleCreditNoBlur = (event) => {
const newValue = event.target.value;
// Show the confirmation dialog if the value has changed and auto-increment
// mode is enabled.
if (values.credit_note_no !== newValue && creditAutoIncrement) {
openDialog('credit-number-form', {
initialFormValues: {
onceManualNumber: newValue,
incrementMode: 'manual-transaction',
},
});
}
// Setting the credit note number to the form will be manually in case
// auto-increment is disable.
if (!creditAutoIncrement) {
setFieldValue('credit_note_number', newValue);
setFieldValue('credit_note_number_manually', newValue);
}
};
return (
<FFormGroup
name={'credit_note_number'}
label={<T id={'credit_note.label_credit_note'} />}
labelInfo={<FieldRequiredHint />}
inline={true}
>
<ControlGroup fill={true}>
<FInputGroup
name={'credit_note_number'}
minimal={true}
value={values.credit_note_number}
asyncControl={true}
onBlur={handleCreditNoBlur}
onChange={() => {}}
/>
<InputPrependButton
buttonProps={{
onClick: handleCreditNumberChange,
icon: <Icon icon={'settings-18'} />,
}}
tooltip={true}
tooltipProps={{
content: (
<T id={'setting_your_auto_generated_credit_note_number'} />
),
position: Position.BOTTOM_LEFT,
}}
/>
</ControlGroup>
</FFormGroup>
);
},
);
/**
* Credit note form header fields.
*/

View File

@@ -0,0 +1,98 @@
// @ts-nocheck
import React from 'react';
import * as R from 'ramda';
import { Position, ControlGroup } from '@blueprintjs/core';
import { useFormikContext } from 'formik';
import {
FieldRequiredHint,
InputPrependButton,
Icon,
FormattedMessage as T,
FFormGroup,
FInputGroup,
} from '@/components';
import withSettings from '@/containers/Settings/withSettings';
import withDialogActions from '@/containers/Dialog/withDialogActions';
/**
* Credit note transaction number field.
*/
export const CreditNoteTransactionNoField = R.compose(
withDialogActions,
withSettings(({ creditNoteSettings }) => ({
creditAutoIncrement: creditNoteSettings?.autoIncrement,
creditNextNumber: creditNoteSettings?.nextNumber,
creditNumberPrefix: creditNoteSettings?.numberPrefix,
})),
)(
({
// #withDialogActions
openDialog,
// #withSettings
creditAutoIncrement,
}) => {
const { values, setFieldValue } = useFormikContext();
// Handle credit number changing.
const handleCreditNumberChange = () => {
openDialog('credit-number-form');
};
// Handle credit note no. field blur.
const handleCreditNoBlur = (event) => {
const newValue = event.target.value;
// Show the confirmation dialog if the value has changed and auto-increment
// mode is enabled.
if (values.credit_note_no !== newValue && creditAutoIncrement) {
openDialog('credit-number-form', {
initialFormValues: {
onceManualNumber: newValue,
incrementMode: 'manual-transaction',
},
});
}
// Setting the credit note number to the form will be manually in case
// auto-increment is disable.
if (!creditAutoIncrement) {
setFieldValue('credit_note_number', newValue);
setFieldValue('credit_note_number_manually', newValue);
}
};
return (
<FFormGroup
name={'credit_note_number'}
label={<T id={'credit_note.label_credit_note'} />}
labelInfo={<FieldRequiredHint />}
inline={true}
>
<ControlGroup fill={true}>
<FInputGroup
name={'credit_note_number'}
minimal={true}
value={values.credit_note_number}
asyncControl={true}
onBlur={handleCreditNoBlur}
onChange={() => {}}
/>
<InputPrependButton
buttonProps={{
onClick: handleCreditNumberChange,
icon: <Icon icon={'settings-18'} />,
}}
tooltip={true}
tooltipProps={{
content: (
<T id={'setting_your_auto_generated_credit_note_number'} />
),
position: Position.BOTTOM_LEFT,
}}
/>
</ControlGroup>
</FFormGroup>
);
},
);
CreditNoteTransactionNoField.displayName = 'CreditNoteTransactionNoField';

View File

@@ -0,0 +1,92 @@
// @ts-nocheck
import React from 'react';
import * as R from 'ramda';
import { Position, ControlGroup } from '@blueprintjs/core';
import { useFormikContext } from 'formik';
import {
FFormGroup,
FInputGroup,
FormattedMessage as T,
Icon,
InputPrependButton,
} from '@/components';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withSettings from '@/containers/Settings/withSettings';
/**
* Estimate number field of estimate form.
*/
export const EstimateFormEstimateNumberField = R.compose(
withDialogActions,
withSettings(({ estimatesSettings }) => ({
estimateNextNumber: estimatesSettings?.nextNumber,
estimateNumberPrefix: estimatesSettings?.numberPrefix,
estimateAutoIncrement: estimatesSettings?.autoIncrement,
})),
)(
({
// #withDialogActions
openDialog,
// #withSettings
estimateAutoIncrement,
}) => {
const { values, setFieldValue } = useFormikContext();
const handleEstimateNumberBtnClick = () => {
openDialog('estimate-number-form', {});
};
// Handle estimate no. field blur.
const handleEstimateNoBlur = (event) => {
const newValue = event.target.value;
// Show the confirmation dialog if the value has changed and auto-increment
// mode is enabled.
if (values.estimate_number !== newValue && estimateAutoIncrement) {
openDialog('estimate-number-form', {
initialFormValues: {
onceManualNumber: newValue,
incrementMode: 'manual-transaction',
},
});
}
// Setting the estimate number to the form will be manually in case
// auto-increment is disable.
if (!estimateAutoIncrement) {
setFieldValue('estimate_number', newValue);
setFieldValue('estimate_number_manually', newValue);
}
};
return (
<FFormGroup
name={'estimate_number'}
label={<T id={'estimate'} />}
inline={true}
>
<ControlGroup fill={true}>
<FInputGroup
name={'estimate_number'}
minimal={true}
asyncControl={true}
onBlur={handleEstimateNoBlur}
onChange={() => {}}
/>
<InputPrependButton
buttonProps={{
onClick: handleEstimateNumberBtnClick,
icon: <Icon icon={'settings-18'} />,
}}
tooltip={true}
tooltipProps={{
content: <T id={'setting_your_auto_generated_estimate_number'} />,
position: Position.BOTTOM_LEFT,
}}
/>
</ControlGroup>
</FFormGroup>
);
},
);
EstimateFormEstimateNumberField.displayName = 'EstimateFormEstimateNumberField';

View File

@@ -1,27 +1,18 @@
// @ts-nocheck
import React from 'react';
import * as R from 'ramda';
import styled from 'styled-components';
import classNames from 'classnames';
import {
FormGroup,
InputGroup,
Position,
Classes,
ControlGroup,
} from '@blueprintjs/core';
import { FormGroup, InputGroup, Position, Classes } from '@blueprintjs/core';
import { DateInput } from '@blueprintjs/datetime';
import { FastField, ErrorMessage, useFormikContext } from 'formik';
import { FastField, ErrorMessage } from 'formik';
import {
FeatureCan,
FFormGroup,
FInputGroup,
FormattedMessage as T,
CustomerSelectField,
FieldRequiredHint,
Icon,
InputPrependButton,
CustomerDrawerLink,
} from '@/components';
import {
@@ -34,92 +25,14 @@ import { customersFieldShouldUpdate } from './utils';
import { CLASSES } from '@/constants/classes';
import { Features } from '@/constants';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withSettings from '@/containers/Settings/withSettings';
import { ProjectsSelect } from '@/containers/Projects/components';
import {
EstimateExchangeRateInputField,
EstimateProjectSelectButton,
} from './components';
import { EstimateFormEstimateNumberField } from './EstimateFormEstimateNumberField';
import { useEstimateFormContext } from './EstimateFormProvider';
/**
* Estimate number field of estimate form.
*/
const EstimateFormEstimateNumberField = R.compose(
withDialogActions,
withSettings(({ estimatesSettings }) => ({
estimateNextNumber: estimatesSettings?.nextNumber,
estimateNumberPrefix: estimatesSettings?.numberPrefix,
estimateAutoIncrement: estimatesSettings?.autoIncrement,
})),
)(
({
// #withDialogActions
openDialog,
// #withSettings
estimateAutoIncrement,
}) => {
const { values, setFieldValue } = useFormikContext();
const handleEstimateNumberBtnClick = () => {
openDialog('estimate-number-form', {});
};
// Handle estimate no. field blur.
const handleEstimateNoBlur = (event) => {
const newValue = event.target.value;
// Show the confirmation dialog if the value has changed and auto-increment
// mode is enabled.
if (values.estimate_number !== newValue && estimateAutoIncrement) {
openDialog('estimate-number-form', {
initialFormValues: {
onceManualNumber: newValue,
incrementMode: 'manual-transaction',
},
});
}
// Setting the estimate number to the form will be manually in case
// auto-increment is disable.
if (!estimateAutoIncrement) {
setFieldValue('estimate_number', newValue);
setFieldValue('estimate_number_manually', newValue);
}
};
return (
<FFormGroup
name={'estimate_number'}
label={<T id={'estimate'} />}
inline={true}
>
<ControlGroup fill={true}>
<FInputGroup
name={'estimate_number'}
minimal={true}
asyncControl={true}
onBlur={handleEstimateNoBlur}
onChange={() => {}}
/>
<InputPrependButton
buttonProps={{
onClick: handleEstimateNumberBtnClick,
icon: <Icon icon={'settings-18'} />,
}}
tooltip={true}
tooltipProps={{
content: <T id={'setting_your_auto_generated_estimate_number'} />,
position: Position.BOTTOM_LEFT,
}}
/>
</ControlGroup>
</FFormGroup>
);
},
);
/**
* Estimate form header.
*/

View File

@@ -2,16 +2,9 @@
import React from 'react';
import styled from 'styled-components';
import classNames from 'classnames';
import {
FormGroup,
InputGroup,
Position,
Classes,
ControlGroup,
} from '@blueprintjs/core';
import { FormGroup, InputGroup, Position, Classes } from '@blueprintjs/core';
import { DateInput } from '@blueprintjs/datetime';
import { FastField, ErrorMessage, useFormikContext } from 'formik';
import * as R from 'ramda';
import {
FFormGroup,
@@ -21,10 +14,7 @@ import {
CustomerDrawerLink,
CustomerSelectField,
FieldRequiredHint,
Icon,
InputPrependButton,
FeatureCan,
FInputGroup,
} from '@/components';
import {
momentFormatter,
@@ -40,94 +30,12 @@ import {
InvoiceExchangeRateInputField,
InvoiceProjectSelectButton,
} from './components';
import { InvoiceFormInvoiceNumberField } from './InvoiceFormInvoiceNumberField';
import {
ProjectsSelect,
ProjectBillableEntriesLink,
} from '@/containers/Projects/components';
import { Features } from '@/constants';
import { DialogsName } from '@/constants/dialogs';
import withSettings from '@/containers/Settings/withSettings';
import withDialogActions from '@/containers/Dialog/withDialogActions';
/**
* Invoice number field of invoice form.
*/
const InvoiceFormInvoiceNumberField = R.compose(
withDialogActions,
withSettings(({ invoiceSettings }) => ({
invoiceAutoIncrement: invoiceSettings?.autoIncrement,
})),
)(
({
// #withDialogActions
openDialog,
// #withSettings
invoiceAutoIncrement,
}) => {
// Formik context.
const { values, setFieldValue } = useFormikContext();
// Handle invoice number changing.
const handleInvoiceNumberChange = () => {
openDialog(DialogsName.InvoiceNumberSettings);
};
// Handle invoice no. field blur.
const handleInvoiceNoBlur = (event) => {
const newValue = event.target.value;
// Show the confirmation dialog if the value has changed and auto-increment
// mode is enabled.
if (values.invoice_no !== newValue && invoiceAutoIncrement) {
openDialog(DialogsName.InvoiceNumberSettings, {
initialFormValues: {
onceManualNumber: newValue,
incrementMode: 'manual-transaction',
},
});
}
// Setting the invoice number to the form will be manually in case
// auto-increment is disable.
if (!invoiceAutoIncrement) {
setFieldValue('invoice_no', newValue);
setFieldValue('invoice_no_manually', newValue);
}
};
return (
<FFormGroup
name={'invoice_no'}
label={<T id={'invoice_no'} />}
labelInfo={<FieldRequiredHint />}
inline={true}
fastField={true}
>
<ControlGroup fill={true}>
<FInputGroup
name={'invoice_no'}
minimal={true}
asyncControl={true}
onBlur={handleInvoiceNoBlur}
onChange={() => {}}
/>
<InputPrependButton
buttonProps={{
onClick: handleInvoiceNumberChange,
icon: <Icon icon={'settings-18'} />,
}}
tooltip={true}
tooltipProps={{
content: <T id={'setting_your_auto_generated_invoice_number'} />,
position: Position.BOTTOM_LEFT,
}}
/>
</ControlGroup>
</FFormGroup>
);
},
);
InvoiceFormInvoiceNumberField.displayName = 'InvoiceFormInvoiceNumberField';
/**
* Invoice form header fields.

View File

@@ -0,0 +1,95 @@
// @ts-nocheck
import React from 'react';
import { Position, ControlGroup } from '@blueprintjs/core';
import { useFormikContext } from 'formik';
import * as R from 'ramda';
import {
FFormGroup,
FormattedMessage as T,
FieldRequiredHint,
Icon,
InputPrependButton,
FInputGroup,
} from '@/components';
import { DialogsName } from '@/constants/dialogs';
import withSettings from '@/containers/Settings/withSettings';
import withDialogActions from '@/containers/Dialog/withDialogActions';
/**
* Invoice number field of invoice form.
*/
export const InvoiceFormInvoiceNumberField = R.compose(
withDialogActions,
withSettings(({ invoiceSettings }) => ({
invoiceAutoIncrement: invoiceSettings?.autoIncrement,
})),
)(
({
// #withDialogActions
openDialog,
// #withSettings
invoiceAutoIncrement,
}) => {
// Formik context.
const { values, setFieldValue } = useFormikContext();
// Handle invoice number changing.
const handleInvoiceNumberChange = () => {
openDialog(DialogsName.InvoiceNumberSettings);
};
// Handle invoice no. field blur.
const handleInvoiceNoBlur = (event) => {
const newValue = event.target.value;
// Show the confirmation dialog if the value has changed and auto-increment
// mode is enabled.
if (values.invoice_no !== newValue && invoiceAutoIncrement) {
openDialog(DialogsName.InvoiceNumberSettings, {
initialFormValues: {
onceManualNumber: newValue,
incrementMode: 'manual-transaction',
},
});
}
// Setting the invoice number to the form will be manually in case
// auto-increment is disable.
if (!invoiceAutoIncrement) {
setFieldValue('invoice_no', newValue);
setFieldValue('invoice_no_manually', newValue);
}
};
return (
<FFormGroup
name={'invoice_no'}
label={<T id={'invoice_no'} />}
labelInfo={<FieldRequiredHint />}
inline={true}
fastField={true}
>
<ControlGroup fill={true}>
<FInputGroup
name={'invoice_no'}
minimal={true}
asyncControl={true}
onBlur={handleInvoiceNoBlur}
onChange={() => {}}
/>
<InputPrependButton
buttonProps={{
onClick: handleInvoiceNumberChange,
icon: <Icon icon={'settings-18'} />,
}}
tooltip={true}
tooltipProps={{
content: <T id={'setting_your_auto_generated_invoice_number'} />,
position: Position.BOTTOM_LEFT,
}}
/>
</ControlGroup>
</FFormGroup>
);
},
);
InvoiceFormInvoiceNumberField.displayName = 'InvoiceFormInvoiceNumberField';

View File

@@ -13,9 +13,8 @@ import {
import { DateInput } from '@blueprintjs/datetime';
import { toSafeInteger } from 'lodash';
import { FastField, Field, useFormikContext, ErrorMessage } from 'formik';
import * as R from 'ramda';
import { FInputGroup, FeatureCan, FormattedMessage as T } from '@/components';
import { FeatureCan, FormattedMessage as T } from '@/components';
import { useAutofocus } from '@/hooks';
import { CLASSES } from '@/constants/classes';
import {
@@ -31,7 +30,6 @@ import {
CustomerSelectField,
FieldRequiredHint,
Icon,
InputPrependButton,
MoneyInputGroup,
InputPrependText,
CustomerDrawerLink,
@@ -46,9 +44,6 @@ import {
PaymentReceiveProjectSelectButton,
} from './components';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withSettings from '@/containers/Settings/withSettings';
import {
amountPaymentEntries,
fullAmountPaymentEntries,
@@ -56,87 +51,7 @@ import {
accountsFieldShouldUpdate,
} from './utils';
import { Features } from '@/constants';
/**
* Payment receive number field.
*/
const PaymentReceivePaymentNoField = R.compose(
withSettings(({ paymentReceiveSettings }) => ({
paymentReceiveAutoIncrement: paymentReceiveSettings?.autoIncrement,
})),
withDialogActions,
)(
({
// #withDialogActions
openDialog,
// #withSettings
paymentReceiveAutoIncrement,
}) => {
const { values, setFieldValue } = useFormikContext();
// Handle click open payment receive number dialog.
const handleClickOpenDialog = () => {
openDialog('payment-receive-number-form');
};
// Handle payment number field blur.
const handlePaymentNoBlur = (event) => {
const newValue = event.target.value;
// Show the confirmation dialog if the value has changed and auto-increment
// mode is enabled.
if (
values.payment_receive_no !== newValue &&
paymentReceiveAutoIncrement
) {
openDialog('payment-receive-number-form', {
initialFormValues: {
onceManualNumber: newValue,
incrementMode: 'manual-transaction',
},
});
}
// Setting the payment number to the form will be manually in case
// auto-increment is disable.
if (!paymentReceiveAutoIncrement) {
setFieldValue('payment_receive_no', newValue);
setFieldValue('payment_receive_no_manually', newValue);
}
};
return (
<FFormGroup
name={'payment_receive_no'}
label={<T id={'payment_receive_no'} />}
inline={true}
labelInfo={<FieldRequiredHint />}
>
<ControlGroup fill={true}>
<FInputGroup
name={'payment_receive_no'}
minimal={true}
value={values.payment_receive_no}
asyncControl={true}
onBlur={handlePaymentNoBlur}
onChange={() => {}}
/>
<InputPrependButton
buttonProps={{
onClick: handleClickOpenDialog,
icon: <Icon icon={'settings-18'} />,
}}
tooltip={true}
tooltipProps={{
content: (
<T id={'setting_your_auto_generated_payment_receive_number'} />
),
position: Position.BOTTOM_LEFT,
}}
/>
</ControlGroup>
</FFormGroup>
);
},
);
import { PaymentReceivePaymentNoField } from './PaymentReceivePaymentNoField';
/**
* Payment receive header fields.

View File

@@ -0,0 +1,99 @@
// @ts-nocheck
import React, { useMemo } from 'react';
import { Position, ControlGroup } from '@blueprintjs/core';
import { useFormikContext } from 'formik';
import * as R from 'ramda';
import { FInputGroup, FormattedMessage as T } from '@/components';
import {
FFormGroup,
FieldRequiredHint,
Icon,
InputPrependButton,
} from '@/components';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withSettings from '@/containers/Settings/withSettings';
/**
* Payment receive number field.
*/
export const PaymentReceivePaymentNoField = R.compose(
withSettings(({ paymentReceiveSettings }) => ({
paymentReceiveAutoIncrement: paymentReceiveSettings?.autoIncrement,
})),
withDialogActions,
)(
({
// #withDialogActions
openDialog,
// #withSettings
paymentReceiveAutoIncrement,
}) => {
const { values, setFieldValue } = useFormikContext();
// Handle click open payment receive number dialog.
const handleClickOpenDialog = () => {
openDialog('payment-receive-number-form');
};
// Handle payment number field blur.
const handlePaymentNoBlur = (event) => {
const newValue = event.target.value;
// Show the confirmation dialog if the value has changed and auto-increment
// mode is enabled.
if (
values.payment_receive_no !== newValue &&
paymentReceiveAutoIncrement
) {
openDialog('payment-receive-number-form', {
initialFormValues: {
onceManualNumber: newValue,
incrementMode: 'manual-transaction',
},
});
}
// Setting the payment number to the form will be manually in case
// auto-increment is disable.
if (!paymentReceiveAutoIncrement) {
setFieldValue('payment_receive_no', newValue);
setFieldValue('payment_receive_no_manually', newValue);
}
};
return (
<FFormGroup
name={'payment_receive_no'}
label={<T id={'payment_receive_no'} />}
inline={true}
labelInfo={<FieldRequiredHint />}
>
<ControlGroup fill={true}>
<FInputGroup
name={'payment_receive_no'}
minimal={true}
value={values.payment_receive_no}
asyncControl={true}
onBlur={handlePaymentNoBlur}
onChange={() => {}}
/>
<InputPrependButton
buttonProps={{
onClick: handleClickOpenDialog,
icon: <Icon icon={'settings-18'} />,
}}
tooltip={true}
tooltipProps={{
content: (
<T id={'setting_your_auto_generated_payment_receive_number'} />
),
position: Position.BOTTOM_LEFT,
}}
/>
</ControlGroup>
</FFormGroup>
);
},
);
PaymentReceivePaymentNoField.displayName = 'PaymentReceivePaymentNoField';

View File

@@ -2,16 +2,9 @@
import React, { useCallback } from 'react';
import styled from 'styled-components';
import classNames from 'classnames';
import {
FormGroup,
InputGroup,
Position,
Classes,
ControlGroup,
} from '@blueprintjs/core';
import { FormGroup, InputGroup, Position, Classes } from '@blueprintjs/core';
import { DateInput } from '@blueprintjs/datetime';
import { FastField, ErrorMessage, useFormikContext } from 'formik';
import * as R from 'ramda';
import { FastField, ErrorMessage } from 'formik';
import { CLASSES } from '@/constants/classes';
import { ACCOUNT_TYPE } from '@/constants/accountTypes';
@@ -22,11 +15,9 @@ import {
CustomerSelectField,
FieldRequiredHint,
Icon,
InputPrependButton,
CustomerDrawerLink,
FormattedMessage as T,
FeatureCan,
FInputGroup,
} from '@/components';
import { ProjectsSelect } from '@/containers/Projects/components';
import {
@@ -41,90 +32,7 @@ import {
ReceiptExchangeRateInputField,
ReceiptProjectSelectButton,
} from './components';
import withSettings from '@/containers/Settings/withSettings';
import withDialogActions from '@/containers/Dialog/withDialogActions';
/**
* Receipt number field of receipt form.
*/
const ReceiptFormReceiptNumberField = R.compose(
withDialogActions,
withSettings(({ receiptSettings }) => ({
receiptAutoIncrement: receiptSettings?.autoIncrement,
})),
)(
({
// #withDialogActions
openDialog,
// #withSettings
receiptAutoIncrement,
}) => {
const { values, setFieldValue } = useFormikContext();
const handleReceiptNumberChange = () => {
openDialog('receipt-number-form', {});
};
const handleReceiptNoBlur = (event) => {
const newValue = event.target.value;
// Show the confirmation dialog if the value has changed and auto-increment
// mode is enabled.
if (values.receipt_number !== newValue && receiptAutoIncrement) {
openDialog('receipt-number-form', {
initialFormValues: {
onceManualNumber: newValue,
incrementMode: 'manual-transaction',
},
});
}
// Setting the receipt number to the form will be manually in case
// auto-increment is disable.
if (!receiptAutoIncrement) {
setFieldValue('receipt_number', newValue);
setFieldValue('receipt_number_manually', newValue);
}
};
return (
<FFormGroup
name={'receipt_number'}
label={<T id={'receipt'} />}
inline={true}
labelInfo={<FieldRequiredHint />}
>
<ControlGroup fill={true}>
<FInputGroup
name={'receipt_number'}
minimal={true}
value={values.receipt_number}
asyncControl={true}
onBlur={handleReceiptNoBlur}
onChange={() => {}}
/>
<InputPrependButton
buttonProps={{
onClick: handleReceiptNumberChange,
icon: <Icon icon={'settings-18'} />,
}}
tooltip={true}
tooltipProps={{
content: (
<T id={'setting_your_auto_generated_payment_receive_number'} />
),
position: Position.BOTTOM_LEFT,
}}
inputProps={{
leftIcon: <Icon icon={'date-range'} />,
}}
/>
</ControlGroup>
</FFormGroup>
);
},
);
import { ReceiptFormReceiptNumberField } from './ReceiptFormReceiptNumberField';
/**
* Receipt form header fields.

View File

@@ -0,0 +1,99 @@
// @ts-nocheck
import React from 'react';
import { Position, ControlGroup } from '@blueprintjs/core';
import { useFormikContext } from 'formik';
import * as R from 'ramda';
import {
FFormGroup,
FieldRequiredHint,
Icon,
InputPrependButton,
FormattedMessage as T,
FInputGroup,
} from '@/components';
import withSettings from '@/containers/Settings/withSettings';
import withDialogActions from '@/containers/Dialog/withDialogActions';
/**
* Receipt number field of receipt form.
*/
export const ReceiptFormReceiptNumberField = R.compose(
withDialogActions,
withSettings(({ receiptSettings }) => ({
receiptAutoIncrement: receiptSettings?.autoIncrement,
})),
)(
({
// #withDialogActions
openDialog,
// #withSettings
receiptAutoIncrement,
}) => {
const { values, setFieldValue } = useFormikContext();
const handleReceiptNumberChange = () => {
openDialog('receipt-number-form', {});
};
const handleReceiptNoBlur = (event) => {
const newValue = event.target.value;
// Show the confirmation dialog if the value has changed and auto-increment
// mode is enabled.
if (values.receipt_number !== newValue && receiptAutoIncrement) {
openDialog('receipt-number-form', {
initialFormValues: {
onceManualNumber: newValue,
incrementMode: 'manual-transaction',
},
});
}
// Setting the receipt number to the form will be manually in case
// auto-increment is disable.
if (!receiptAutoIncrement) {
setFieldValue('receipt_number', newValue);
setFieldValue('receipt_number_manually', newValue);
}
};
return (
<FFormGroup
name={'receipt_number'}
label={<T id={'receipt'} />}
inline={true}
labelInfo={<FieldRequiredHint />}
>
<ControlGroup fill={true}>
<FInputGroup
name={'receipt_number'}
minimal={true}
value={values.receipt_number}
asyncControl={true}
onBlur={handleReceiptNoBlur}
onChange={() => {}}
/>
<InputPrependButton
buttonProps={{
onClick: handleReceiptNumberChange,
icon: <Icon icon={'settings-18'} />,
}}
tooltip={true}
tooltipProps={{
content: (
<T id={'setting_your_auto_generated_payment_receive_number'} />
),
position: Position.BOTTOM_LEFT,
}}
inputProps={{
leftIcon: <Icon icon={'date-range'} />,
}}
/>
</ControlGroup>
</FFormGroup>
);
},
);
ReceiptFormReceiptNumberField.displayName = 'ReceiptFormReceiptNumberField';

View File

@@ -6,19 +6,18 @@ import {
Position,
ControlGroup,
} from '@blueprintjs/core';
import { DateInput } from '@blueprintjs/datetime';
import { FastField, Field, ErrorMessage } from 'formik';
import { FFormGroup, FormattedMessage as T } from '@/components';
import { DateInput } from '@blueprintjs/datetime';
import {
FFormGroup,
FormattedMessage as T,
WarehouseSelect,
} from '@/components';
import { momentFormatter, compose, tansformDateValue } from '@/utils';
import classNames from 'classnames';
import { CLASSES } from '@/constants/classes';
import {
AccountsSelect,
FieldRequiredHint,
Icon,
InputPrependButton,
} from '@/components';
import { FieldRequiredHint, Icon, InputPrependButton } from '@/components';
import { inputIntent, handleDateChange } from '@/utils';
import { useWarehouseTransferFormContext } from './WarehouseTransferFormProvider';
import { useObserveTransferNoSettings } from './utils';
@@ -140,9 +139,9 @@ function WarehouseTransferFormHeaderFields({
inline={true}
labelInfo={<FieldRequiredHint />}
>
<AccountsSelect
<WarehouseSelect
name={'from_warehouse_id'}
items={warehouses}
warehouses={warehouses}
placeholder={<T id={'select_warehouse_transfer'} />}
allowCreate={true}
fill={true}
@@ -156,9 +155,9 @@ function WarehouseTransferFormHeaderFields({
inline={true}
labelInfo={<FieldRequiredHint />}
>
<AccountsSelect
<WarehouseSelect
name={'to_warehouse_id'}
items={warehouses}
warehouses={warehouses}
placeholder={<T id={'select_warehouse_transfer'} />}
fill={true}
allowCreate={true}

View File

@@ -12,6 +12,10 @@ const commonInvalidateQueries = (queryClient) => {
// Invalidate item warehouses.
queryClient.invalidateQueries(t.ITEM_WAREHOUSES_LOCATION);
// Invalidate items.
queryClient.invalidateQueries(t.ITEMS);
queryClient.invalidateQueries(t.ITEM);
};
/**

View File

@@ -1193,6 +1193,7 @@
"edit_contact": "Edit {name}",
"item.sell_description": "Sell description",
"item.purchase_description": "Purchase description",
"item.view_drawer.make_adjustment": "Make an adjustment",
"closed_date": "Closed date",
"payment_made.details.payment_number": "Payment #",
"payment_made.details.subtotal": "Subtotal",
@@ -1539,7 +1540,6 @@
"roles.error.you_cannot_delete_predefined_roles": "You cannot delete predefined roles.",
"roles.error.the_submit_role_has_invalid_permissions": "The submit role has invalid permissions.",
"roles.error.you_cannot_delete_role_that_associated_to_users": "You cannot delete role that associated to users",
"sidebar_credit_note": "Credit Notes",
"credit_note.label_create_note_list": "Credit Notes List",
"credit_note.label.new_credit_note": "New Credit Note",
"credit_note.label.edit_credit_note": "Edit Credit Note",
@@ -2049,7 +2049,6 @@
"warehouse_transfer.entries.remove_row": "Remove line",
"item.details.inactive": "Inactive",
"bill.validation.due_date": "{path} field must be later than {min}",
"sidebar.projects": "Projects",
"projects.action.edit_project": "Edit Project",
"projects.action.new_task": "New Task",
"projects.action.delete_project": "Delete Project",
@@ -2232,7 +2231,79 @@
"project_billable_entries.alert.there_is_no_billable_entries": "There is no billable entries for that project.",
"project_billable_entries.billable_type": "Billable {value}",
"add_billable_entries": "Add Billable Entries",
"invite_user.label.email": "Email",
"invite_user.label.role_name": "Role name"
"invite_user.label.role_name": "Role name",
"universl_search.items": "Items",
"sidebar.homepage": "Homepage",
"sidebar.sales_inventory": "Sales & Inventory",
"sidebar.items": "Items",
"sidebar.inventory_adjustments": "Inventory Adjustments",
"sidebar.warehouse_transfer": "Warehouse Transfers",
"sidebar.categories": "Categories",
"sidebar.new_tasks": "New Tasks",
"sidebar.new_inventory_item": "New Inventory Item",
"sidebar.new_warehouse_transfer": "New Warehouse Transfer",
"sidebar.new_service": "New Service",
"sidebar.new_item_category": "New Item Category",
"sidebar.sales": "Sales",
"sidebar.estimates": "Estimates",
"sidebar.invoices": "Invoices",
"sidebar.receipts": "Receipts",
"sidebar.credit_notes": "Credit Notes",
"sidebar.payment_receives": "Payment Receives",
"sidebar.purchases": "Purchases",
"sidebar.bills": "Bills",
"sidebar.vendor_credits": "Vendor Credits",
"sidebar.payment_mades": "Payment Mades",
"sidebar.new_purchase_invoice": "New Purchase Invoice",
"sidebar.new_vendor_credit": "New Vendor Credit",
"sidebar.new_payment_made": "New Payment Made",
"sidebar.vendors": "Vendors",
"sidebar.customers": "Customers",
"sidebar.contacts": "Contacts",
"sidebar.new_customer": "New Customer",
"sidebar.new_vendor": "New Vendor",
"sidebar.new_receipt": "New Receipt",
"sidebar.new_invoice": "New Invoice",
"sidebar.new_estimate": "New Estimate",
"sidebar.new_credit_note": "New Credit Note",
"sidebar.new_payment_receive": "New Payment Receive",
"sidebar.accounting": "Accounting",
"sidebar.financial": "Financial",
"sidebar.accounts_chart": "Accounts Chart",
"sidebar.manual_journals": "Manual Journals",
"sidebar.transactions_locking": "Transactions Locking",
"sidebar.make_journal_entry": "Make Journal Entry",
"sidebar.reports": "Reports",
"sidebar.balance_sheet": "Balance Sheet",
"sidebar.trial_balance_sheet": "Trial Balance Sheet",
"sidebar.journal": "Journal",
"sidebar.general_ledger": "General Ledger",
"sidebar.profit_loss_sheet": "Profit/Loss Sheet",
"sidebar.cash_flow_statement": "Cashflow Statement",
"sidebar.ar_aging_Summary": "A/R Aging Summary",
"sidebar.ap_aging_summary": "A/P Aging Summary",
"sidebar.preferences": "Preferences",
"sidebar.expenses": "Expenses",
"sidebar.new_expense": "New Expense",
"sidebar.cash_bank_accounts": "Cash/Bank Accounts",
"sidebar.add_money_in": "Add Money In",
"sidebar.add_money_out": "Add Money Out",
"sidebar.add_cash_account": "Add Cash Account",
"sidebar.add_bank_account": "Add Bank Account",
"sidebar.purchases_by_items": "Purchases by Items",
"sidebar.sales_by_items": "Sales by Items",
"sidebar.customers_transactions": "Customers Transactions",
"sidebar.vendors_transactions": "Vendors Transactions",
"sidebar.customers_balance_summary": "Customer Balance Summary",
"sidebar.vendors_balance_summary": "Vendor Balance Summary",
"sidebar.inventory": "Inventory",
"sidebar.inventory_item_details": "Inventory Item Details",
"sidebar.inventory_valuation": "Inventory Valuation",
"sidebar.sales_purchases": "Sales/Purchases",
"sidebar.system": "System",
"sidebar.projects": "Projects",
"sidebar.new_project": "New Project",
"sidebar.new_time_entry": "New Time Entry",
"sidebar.project_profitability_summary": "Project Profitability Summary"
}

View File

@@ -1,5 +1,6 @@
// @ts-nocheck
export default {
INVENTORY_ADJUSTMENTS_TABLE_STATE_SET: 'INVENTORY_ADJUSTMENTS/TABLE_STATE_SET',
};
INVENTORY_ADJUSTMENTS_TABLE_STATE_SET:
'INVENTORY_ADJUSTMENTS/TABLE_STATE_SET',
};