Merge branch 'develop' of https://github.com/bigcapitalhq/client into develop

This commit is contained in:
a.bouhuolia
2022-03-31 14:07:21 +02:00
13 changed files with 120 additions and 40 deletions

View File

@@ -4,7 +4,12 @@ import { Popover2 } from '@blueprintjs/popover2';
import { useFormikContext } from 'formik';
import intl from 'react-intl-universal';
import { ExchangeRateInputGroup, Icon, Hint, FormattedMessage as T } from 'components';
import {
ExchangeRateInputGroup,
Icon,
Hint,
FormattedMessage as T,
} from 'components';
import {
AccountsListFieldCell,
MoneyFieldCell,
@@ -63,7 +68,10 @@ export const ActionsCellRenderer = ({
};
const exampleMenu = (
<Menu>
<MenuItem onClick={handleClickRemoveRole} text="Remove line" />
<MenuItem
onClick={handleClickRemoveRole}
text={intl.get('make_journal.entries.remove_row')}
/>
</Menu>
);
return (

View File

@@ -1,6 +1,7 @@
import React from 'react';
import { DrawerHeaderContent, DrawerLoading } from 'components';
import { useItem } from 'hooks/query';
import { inactiveStatus } from './utlis';
const ItemDetailDrawerContext = React.createContext();
@@ -27,7 +28,10 @@ function ItemDetailDrawerProvider({ itemId, ...props }) {
return (
<DrawerLoading loading={isItemLoading}>
<DrawerHeaderContent name="item-detail-drawer" title={item?.name} />
<DrawerHeaderContent
name="item-detail-drawer"
title={inactiveStatus(item)}
/>
<ItemDetailDrawerContext.Provider value={provider} {...props} />
</DrawerLoading>
);

View File

@@ -0,0 +1,27 @@
import React from 'react';
import styled from 'styled-components';
import { Intent, Tag } from '@blueprintjs/core';
import { Choose, FormattedMessage as T } from '../../../components';
/**
* items inactive status.
* @returns {React.JSX}
*/
export function inactiveStatus(item) {
return (
<Choose>
<Choose.When condition={!item.active}>
{item.name}
<StatusTag intent={Intent.NONE} minimal={true} round={true}>
<T id={'item.details.inactive'} />
</StatusTag>
</Choose.When>
<Choose.Otherwise>{item.name}</Choose.Otherwise>
</Choose>
);
}
const StatusTag = styled(Tag)`
font-size: 11px;
margin-left: 10px;
`;

View File

@@ -43,7 +43,7 @@ export function ActionsCellRenderer({
const exampleMenu = (
<Menu>
<MenuItem onClick={onRemoveRole} text="Remove line" />
<MenuItem onClick={onRemoveRole} text={'item_entries.remove_row'} />
</Menu>
);

View File

@@ -48,7 +48,10 @@ const ActionsCellRenderer = ({
};
const exampleMenu = (
<Menu>
<MenuItem onClick={handleClickRemoveRole} text="Remove line" />
<MenuItem
onClick={handleClickRemoveRole}
text={intl.get('expense.entries.remove_row')}
/>
</Menu>
);
return (
@@ -163,4 +166,4 @@ export function ExpensesExchangeRateInputField({ ...props }) {
/>
);
}
ExpensesExchangeRateInputField.cellType = CellType.Field;
ExpensesExchangeRateInputField.cellType = CellType.Field;

View File

@@ -50,7 +50,7 @@ function ItemsCategoryTable({
loading={isCategoriesLoading}
headerLoading={isCategoriesLoading}
progressBarLoading={isCategoriesFetching}
expandable={true}
expandable={false}
sticky={true}
selectionColumn={true}
TableLoadingRenderer={TableSkeletonRows}

View File

@@ -1,16 +1,19 @@
import * as Yup from 'yup';
import moment from 'moment';
import intl from 'react-intl-universal';
import { DATATYPES_LENGTH } from 'common/dataTypes';
import { isBlank } from 'utils';
const BillFormSchema = Yup.object().shape({
vendor_id: Yup.number()
.required()
.label(intl.get('vendor_name_')),
bill_date: Yup.date()
.required()
.label(intl.get('bill_date_')),
vendor_id: Yup.number().required().label(intl.get('vendor_name_')),
bill_date: Yup.date().required().label(intl.get('bill_date_')),
due_date: Yup.date()
.min(Yup.ref('bill_date'), ({ path, min }) =>
intl.get('bill.validation.due_date', {
path,
min: moment(min).format('YYYY/MM/DD'),
}),
)
.required()
.label(intl.get('due_date_')),
bill_number: Yup.string()
@@ -25,7 +28,7 @@ const BillFormSchema = Yup.object().shape({
open: Yup.boolean(),
branch_id: Yup.string(),
warehouse_id: Yup.string(),
exchange_rate:Yup.number(),
exchange_rate: Yup.number(),
entries: Yup.array().of(
Yup.object().shape({
quantity: Yup.number()

View File

@@ -2,16 +2,19 @@ import * as Yup from 'yup';
import intl from 'react-intl-universal';
import { DATATYPES_LENGTH } from 'common/dataTypes';
import { isBlank } from 'utils';
import moment from 'moment';
const Schema = Yup.object().shape({
customer_id: Yup.number()
.label(intl.get('customer_name_'))
.required(),
estimate_date: Yup.date()
.required()
.label(intl.get('estimate_date_')),
customer_id: Yup.number().label(intl.get('customer_name_')).required(),
estimate_date: Yup.date().required().label(intl.get('estimate_date_')),
expiration_date: Yup.date()
.required()
.min(Yup.ref('estimate_date'), ({ path, min }) =>
intl.get('estimate.validation.expiration_date', {
path,
min: moment(min).format('YYYY/MM/DD'),
}),
)
.label(intl.get('expiration_date_')),
estimate_number: Yup.string()
.max(DATATYPES_LENGTH.STRING)

View File

@@ -1,4 +1,5 @@
import * as Yup from 'yup';
import moment from 'moment';
import intl from 'react-intl-universal';
import { DATATYPES_LENGTH } from 'common/dataTypes';
import { isBlank } from 'utils';
@@ -7,7 +8,15 @@ const getSchema = () =>
Yup.object().shape({
customer_id: Yup.string().label(intl.get('customer_name_')).required(),
invoice_date: Yup.date().required().label(intl.get('invoice_date_')),
due_date: Yup.date().required().label(intl.get('due_date_')),
due_date: Yup.date()
.min(Yup.ref('invoice_date'), ({ path, min }) =>
intl.get('invoice.validation.due_date', {
path,
min: moment(min).format('YYYY/MM/DD'),
}),
)
.required()
.label(intl.get('due_date_')),
invoice_no: Yup.string()
.max(DATATYPES_LENGTH.STRING)
.label(intl.get('invoice_no_')),

View File

@@ -1,7 +1,7 @@
import React from 'react';
import intl from 'react-intl-universal';
import { Formik, Form } from 'formik';
import { isEmpty } from 'lodash';
import { isEmpty, sumBy } from 'lodash';
import { Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
import { CLASSES } from 'common/classes';
@@ -20,7 +20,7 @@ import WarehouseTransferFormDialog from './WarehouseTransferFormDialog';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import withSettings from 'containers/Settings/withSettings';
import { AppToaster, } from 'components';
import { AppToaster } from 'components';
import { useWarehouseTransferFormContext } from './WarehouseTransferFormProvider';
import { compose, orderingLinesIndexes, transactionNumber } from 'utils';
import { WarehouseTransferObserveItemsCost } from './components';
@@ -72,6 +72,18 @@ function WarehouseTransferForm({
// Handles form submit.
const handleSubmit = (values, { setSubmitting, setErrors, resetForm }) => {
setSubmitting(true);
const totalQuantity = sumBy(values.entries, 'quantity');
if (totalQuantity <= 0) {
AppToaster.show({
message: intl.get(
'warehouse_transfer.quantity_cannot_be_zero_or_empty',
),
intent: Intent.DANGER,
});
return;
}
// Transformes the values of the form to request.
const form = {
...transformValueToRequest(values),
@@ -119,7 +131,7 @@ function WarehouseTransferForm({
.catch(onError);
}
};
return (
<div
className={classNames(
@@ -141,7 +153,7 @@ function WarehouseTransferForm({
<WarehouseTransferFormFooter />
<WarehouseTransferFormDialog />
<WarehouseTransferFloatingActions />
<WarehouseTransferObserveItemsCost />
<WarehouseTransferObserveItemsCost />
</Form>
</Formik>
</div>

View File

@@ -21,7 +21,10 @@ export function ActionsCellRenderer({
const exampleMenu = (
<Menu>
<MenuItem onClick={onRemoveRole} text="Remove line" />
<MenuItem
onClick={onRemoveRole}
text={intl.get('warehouse_transfer.entries.remove_row')}
/>
</Menu>
);

View File

@@ -1361,6 +1361,7 @@
"item.field.sell_account.hint": "أدخل السعر الذي ستبيعه لهذا العنصر.",
"item_entries.products_services.hint": "أدخل المنتجات أو الخدمات التي تبيعها أو تشتريها لتتبع ما قمت ببيعه أو شرائه.",
"item_entries.landed.hint": "يتيح لك هذه الخيار إمكانية إضافة تكلفة اضافية علي فاتورة الشراء متال علي ذلك تكاليف الشحن ، ثم تحديد هذه التكلفة لتحميلها علي فاتورة الشراء.",
"item_entries.remove_row": "حذف الصف",
"invoice.auto_increment.auto": "يتم تعيين أرقام الفواتير على وضع الزيادة التلقائي. هل أنت متأكد من تغيير هذا الإعداد؟",
"invoice.auto_increment.manually": "يتم تعيين أرقام فواتيرك يدوياً. هل أنت متأكد من تغيير هذه الإعدادات؟",
"manual_journals.auto_increment.auto": "يتم تعيين أرقام القيود على وضع الزيادة التلقائي. هل أنت متأكد من تغيير هذا الإعداد؟",
@@ -1847,6 +1848,7 @@
"warehouse_transfer.column.transfer_quantity": "الكمية ",
"warehouse_transfer.column.source_warehouse": "المصدر",
"warehouse_transfer.column.destination_warehouse": "الوجهة",
"warehouse_transfer.column.cost_price": "سعر التكلفة",
"warehouse_transfer.auto_increment.auto": "يتم تعيين أرقام النقل على وضع الزيادة التلقائي. هل أنت متأكد من تغيير هذا الإعداد؟",
"warehouse_transfer.auto_increment.manually": "يتم تعيين أرقام النقل يدوياً. هل أنت متأكد من تغيير هذه الإعدادات؟",
"warehouse_transfer.setting_your_auto_generated_transfer_no": "تعيين رقم النقل الذي تم إنشاؤه تلقائيًا",
@@ -2005,5 +2007,13 @@
"receipt.warehouse_button.label": "المخزن: {label}",
"warehouse_transfer.empty_status.title": "إدارة عمليات النقل بين المستودعات",
"warehouse_transfer.empty_status.description": "غالبًا ماتحتاج الاعمال ذات مستودعات متعددة لطلبات نقل البضائع من مستودع إلى آخر عندما تكون في حاجة ماسة إلى البائعين.",
"item.error.you_could_not_delete_item_has_associated": "لا يمكنك حذف العنصر لديه معاملات مرتبطة به "
"item.error.you_could_not_delete_item_has_associated": "لا يمكنك حذف العنصر لديه معاملات مرتبطة به ",
"warehouse_transfer.quantity_cannot_be_zero_or_empty": "لا يمكن أن تكون الكمية صفراً أو فارغة.",
"invoice.validation.due_date": "يجب أن يكون حقل {path} في وقت لاحق من {min}",
"estimate.validation.expiration_date": "يجب أن يكون حقل {path} في وقت لاحق من {min}",
"make_journal.entries.remove_row": "حذف الصف",
"expense.entries.remove_row": "حذف الصف",
"warehouse_transfer.entries.remove_row": "حذف الصف",
"item.details.inactive": "غير نشط",
"bill.validation.due_date": "يجب أن يكون حقل {path} في وقت لاحق من {min}"
}

View File

@@ -1338,6 +1338,7 @@
"item.field.sell_account.hint": "Enter price which you goint to sell this item.",
"item_entries.products_services.hint": "Enter products or services you sell or buy to keep tracking what your sold or purchased.",
"item_entries.landed.hint": "This options allows you to be able to add additional cost eg. freight then allocate cost to the items in your bills.",
"item_entries.remove_row": "Remove line",
"invoice.auto_increment.auto": "Your invoice numbers are set on auto-increment mode. Are you sure changing this setting?",
"invoice.auto_increment.manually": "Your invoice numbers are set on manual mode. Are you sure chaning this settings?",
"manual_journals.auto_increment.auto": "Your Jouranl numbers are set on auto-increment mode. Are you sure changing this setting?",
@@ -1440,7 +1441,7 @@
"AP_aging_summary.filter_options.label": "Filter vendors",
"item.error.type_cannot_change_with_item_has_transactions": "Cannot change item type to inventory with item has associated transactions.",
"item.error.cannot_change_inventory_account": "Cannot change item inventory account while the item has transactions.",
"item.error.you_could_not_delete_item_has_associated":"You could not delete item that has associated transactions",
"item.error.you_could_not_delete_item_has_associated": "You could not delete item that has associated transactions",
"customer.link.customer_details": "Customer details ({amount})",
"bad_debt.dialog.written_off_amount": "Written-off amount",
"bad_debt.dialog.bad_debt": "Bad debt",
@@ -1776,13 +1777,10 @@
"profit_loss_sheet.percentage_of_row": "% of Row",
"profit_loss_sheet.percentage_of_expense": "% of Expense",
"profit_loss_sheet.percentage_of_income": "% of Income",
"report.balance_sheet_comparison.title": "Balance Sheet Comparison",
"report.balance_sheet_comparison.desc": "Reports a company's assets, liabilities and shareholders' equity compared to previous year.",
"report.profit_loss_sheet_comparison.title": "Profit/Loss Comparison",
"report.profit_loss_sheet_comparison.desc": "Reports the revenues, costs and expenses incurred at a specific point and compared to previous year.",
"the_vendor_has_been_inactivated_successfully": "The contact has been inactivated successfully.",
"vendor.alert.activated_message": "The vendor has been activated successfully.",
"vendor.alert.are_you_sure_want_to_inactivate_this_vendor": "Are you sure want to inactivate this vendor? You will to able to activate it later.",
@@ -1794,7 +1792,6 @@
"customer.alert.are_you_sure_want_to_inactivate_this_customer": "Are you sure want to inactivate this customer? You will to able to activate it later.",
"credit_note_preview.dialog.title": "Credit Note PDF Preview",
"payment_receive_preview.dialog.title": "Payment Receive PDF Preview",
"warehouses.label": "Warehouses",
"warehouses.label.new_warehouse": "New Warehouse",
"warehouse.dialog.label.new_warehouse": "New Warehouse",
@@ -1965,19 +1962,14 @@
"receipt_form.label.payment_amount": "Payment amount",
"receipt_form.label.receipt_message": "Receipt Message",
"receipt_form.receipt_message.placeholder": "This message will be displayed on the receipt.",
"receipt_form.label.terms_conditions": "Terms & Conditions",
"receipt_form.terms_and_conditions.placeholder": "Enter the terms and conditions of your business to be displayed on the receipt.",
"payment_receive_form.label.note": "Note",
"payment_receive_form.internal_note.placeholder": "Internal notes (Not visible to the customer).",
"payment_receive_form.message.label": "Payment Message",
"payment_receive_form.message.placeholder": "This message will be displayed on the payment receipt.",
"payment_receive_form.label.subtotal": "Subtotal",
"payment_receive_form.label.total": "TOTAL",
"bill_form.label.note": "Note",
"bill_form.label.note.placeholder": "Internal note (Not visible to the vendor).",
"bill_form.label.subtotal": "Subtotal",
@@ -2012,10 +2004,16 @@
"estimate.warehouse_button.label": "Warehouse: {label}",
"receipt.branch_button.label": "Branch: {label}",
"receipt.warehouse_button.label": "Warehouse: {label}",
"warehouse_transfer.empty_status.title": "Manage transfer orders between warehouses.",
"warehouse_transfer.empty_status.description": "Business with multiply warehouses often transfers items from on warehouse to another when they are in immediate need of vendors.",
"warehouse_transfer.form.reason.label": "Reason",
"warehouse_transfer.form.reason.placeholder": "Enter the reason behind the transfer order."
"warehouse_transfer.form.reason.placeholder": "Enter the reason behind the transfer order.",
"warehouse_transfer.quantity_cannot_be_zero_or_empty": "Quantity cannot be zero or empty.",
"invoice.validation.due_date": "{path} field must be later than {min}",
"estimate.validation.expiration_date": "{path} field must be later than {min}",
"make_journal.entries.remove_row": "Remove line",
"expense.entries.remove_row": "Remove line",
"warehouse_transfer.entries.remove_row": "Remove line",
"item.details.inactive": "Inactive",
"bill.validation.due_date": "{path} field must be later than {min}"
}