mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-25 17:19:48 +00:00
Compare commits
5 Commits
fix/credit
...
v0.24.13
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88ff5db0f3 | ||
|
|
f35e85c3d2 | ||
|
|
29decf9c5a | ||
|
|
f149ff43b4 | ||
|
|
fb05af8c00 |
@@ -10,7 +10,7 @@ export interface IContactAddress {
|
||||
billingAddressCity: string;
|
||||
billingAddressCountry: string;
|
||||
billingAddressEmail: string;
|
||||
billingAddressZipcode: string;
|
||||
billingAddressPostcode: string;
|
||||
billingAddressPhone: string;
|
||||
billingAddressState: string;
|
||||
|
||||
@@ -19,7 +19,7 @@ export interface IContactAddress {
|
||||
shippingAddressCity: string;
|
||||
shippingAddressCountry: string;
|
||||
shippingAddressEmail: string;
|
||||
shippingAddressZipcode: string;
|
||||
shippingAddressPostcode: string;
|
||||
shippingAddressPhone: string;
|
||||
shippingAddressState: string;
|
||||
}
|
||||
@@ -29,7 +29,7 @@ export interface IContactAddressDTO {
|
||||
billingAddressCity?: string;
|
||||
billingAddressCountry?: string;
|
||||
billingAddressEmail?: string;
|
||||
billingAddressZipcode?: string;
|
||||
billingAddressPostcode?: string;
|
||||
billingAddressPhone?: string;
|
||||
billingAddressState?: string;
|
||||
|
||||
@@ -38,7 +38,7 @@ export interface IContactAddressDTO {
|
||||
shippingAddressCity?: string;
|
||||
shippingAddressCountry?: string;
|
||||
shippingAddressEmail?: string;
|
||||
shippingAddressZipcode?: string;
|
||||
shippingAddressPostcode?: string;
|
||||
shippingAddressPhone?: string;
|
||||
shippingAddressState?: string;
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ export class ContactAddressDto {
|
||||
@IsEmail()
|
||||
billingAddressEmail?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Billing address zipcode' })
|
||||
@ApiProperty({ required: false, description: 'Billing address postcode' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
billingAddressZipcode?: string;
|
||||
billingAddressPostcode?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Billing address phone' })
|
||||
@IsOptional()
|
||||
@@ -67,10 +67,10 @@ export class ContactAddressDto {
|
||||
@IsEmail()
|
||||
shippingAddressEmail?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Shipping address zipcode' })
|
||||
@ApiProperty({ required: false, description: 'Shipping address postcode' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
shippingAddressZipcode?: string;
|
||||
shippingAddressPostcode?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Shipping address phone' })
|
||||
@IsOptional()
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
import currencies from 'js-money/lib/currency';
|
||||
|
||||
export const DATE_FORMATS = [
|
||||
'MM.dd.yy',
|
||||
'dd.MM.yy',
|
||||
'yy.MM.dd',
|
||||
'MM.dd.yyyy',
|
||||
'dd.MM.yyyy',
|
||||
'yyyy.MM.dd',
|
||||
'MM/DD/YYYY',
|
||||
'M/D/YYYY',
|
||||
'dd MMM YYYY',
|
||||
'dd MMMM YYYY',
|
||||
'MMMM dd, YYYY',
|
||||
'EEE, MMMM dd, YYYY',
|
||||
'MM/DD/YY',
|
||||
'DD/MM/YY',
|
||||
'YY/MM/DD',
|
||||
'MM/DD/yyyy',
|
||||
'DD/MM/yyyy',
|
||||
'yyyy/MM/DD',
|
||||
'DD MMM YYYY',
|
||||
'DD MMMM YYYY',
|
||||
'MMMM DD, YYYY',
|
||||
];
|
||||
export const MONTHS = [
|
||||
'january',
|
||||
|
||||
@@ -12,6 +12,6 @@ export const transformBuildDto = (
|
||||
): BuildOrganizationDto => {
|
||||
return {
|
||||
...buildDTO,
|
||||
dateFormat: defaultTo(buildDTO.dateFormat, 'DD MMM yyyy'),
|
||||
dateFormat: defaultTo(buildDTO.dateFormat, 'DD MMM YYYY'),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -48,7 +48,10 @@ export class EditVendorDto extends ContactAddressDto {
|
||||
@IsString()
|
||||
personalPhone?: string;
|
||||
|
||||
@ApiProperty({ required: false, description: 'Additional notes about the vendor' })
|
||||
@ApiProperty({
|
||||
required: false,
|
||||
description: 'Additional notes about the vendor',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
note?: string;
|
||||
|
||||
@@ -27,20 +27,20 @@ const CustomerBillingAddress = ({}) => {
|
||||
|
||||
{/*------------ Billing Address 1 -----------*/}
|
||||
<FFormGroup
|
||||
name={'billing_address_1'}
|
||||
name={'billing_address1'}
|
||||
label={<T id={'address_line_1'} />}
|
||||
inline={true}
|
||||
>
|
||||
<FTextArea name={'billing_address_1'} />
|
||||
<FTextArea name={'billing_address1'} />
|
||||
</FFormGroup>
|
||||
|
||||
{/*------------ Billing Address 2 -----------*/}
|
||||
<FFormGroup
|
||||
name={'billing_address_2'}
|
||||
name={'billing_address2'}
|
||||
label={<T id={'address_line_2'} />}
|
||||
inline={true}
|
||||
>
|
||||
<FTextArea name={'billing_address_2'} />
|
||||
<FTextArea name={'billing_address2'} />
|
||||
</FFormGroup>
|
||||
{/*------------ Billing Address city -----------*/}
|
||||
<FFormGroup
|
||||
@@ -93,20 +93,20 @@ const CustomerBillingAddress = ({}) => {
|
||||
|
||||
{/*------------ Shipping Address 1 -----------*/}
|
||||
<FFormGroup
|
||||
name={'shipping_address_1'}
|
||||
name={'shipping_address1'}
|
||||
label={<T id={'address_line_1'} />}
|
||||
inline={true}
|
||||
>
|
||||
<FTextArea name={'shipping_address_1'} />
|
||||
<FTextArea name={'shipping_address1'} />
|
||||
</FFormGroup>
|
||||
|
||||
{/*------------ Shipping Address 2 -----------*/}
|
||||
<FFormGroup
|
||||
name={'shipping_address_2'}
|
||||
name={'shipping_address2'}
|
||||
label={<T id={'address_line_2'} />}
|
||||
inline={true}
|
||||
>
|
||||
<FTextArea name={'shipping_address_2'} />
|
||||
<FTextArea name={'shipping_address2'} />
|
||||
</FFormGroup>
|
||||
|
||||
{/*------------ Shipping Address city -----------*/}
|
||||
|
||||
@@ -25,16 +25,16 @@ const Schema = Yup.object().shape({
|
||||
note: Yup.string().trim(),
|
||||
|
||||
billing_address_country: Yup.string().trim(),
|
||||
billing_address_1: Yup.string().trim(),
|
||||
billing_address_2: Yup.string().trim(),
|
||||
billing_address1: Yup.string().trim(),
|
||||
billing_address2: Yup.string().trim(),
|
||||
billing_address_city: Yup.string().trim(),
|
||||
billing_address_state: Yup.string().trim(),
|
||||
billing_address_postcode: Yup.string().nullable(),
|
||||
billing_address_phone: Yup.string().nullable(),
|
||||
|
||||
shipping_address_country: Yup.string().trim(),
|
||||
shipping_address_1: Yup.string().trim(),
|
||||
shipping_address_2: Yup.string().trim(),
|
||||
shipping_address1: Yup.string().trim(),
|
||||
shipping_address2: Yup.string().trim(),
|
||||
shipping_address_city: Yup.string().trim(),
|
||||
shipping_address_state: Yup.string().trim(),
|
||||
shipping_address_postcode: Yup.string().nullable(),
|
||||
|
||||
@@ -8,7 +8,7 @@ import styled from 'styled-components';
|
||||
|
||||
import { CLASSES } from '@/constants/classes';
|
||||
import { CreateCustomerForm, EditCustomerForm } from './CustomerForm.schema';
|
||||
import { compose, transformToForm, saveInvoke } from '@/utils';
|
||||
import { compose, transformToForm, saveInvoke, parseBoolean } from '@/utils';
|
||||
import { useCustomerFormContext } from './CustomerFormProvider';
|
||||
import { defaultInitialValues } from './utils';
|
||||
|
||||
@@ -60,7 +60,10 @@ function CustomerFormFormik({
|
||||
// Handles the form submit.
|
||||
const handleFormSubmit = (values, formArgs) => {
|
||||
const { setSubmitting, resetForm } = formArgs;
|
||||
const formValues = { ...values };
|
||||
const formValues = {
|
||||
...values,
|
||||
active: parseBoolean(values.active, true),
|
||||
};
|
||||
|
||||
const onSuccess = (res) => {
|
||||
AppToaster.show({
|
||||
|
||||
@@ -55,7 +55,7 @@ export default function CustomerFormPrimarySection({}) {
|
||||
label={<T id={'company_name'} />}
|
||||
inline={true}
|
||||
>
|
||||
<InputGroup name={'company_name'} />
|
||||
<FInputGroup name={'company_name'} />
|
||||
</FFormGroup>
|
||||
|
||||
{/*----------- Display Name -----------*/}
|
||||
|
||||
@@ -23,16 +23,16 @@ export const defaultInitialValues = {
|
||||
active: true,
|
||||
|
||||
billing_address_country: '',
|
||||
billing_address_1: '',
|
||||
billing_address_2: '',
|
||||
billing_address1: '',
|
||||
billing_address2: '',
|
||||
billing_address_city: '',
|
||||
billing_address_state: '',
|
||||
billing_address_postcode: '',
|
||||
billing_address_phone: '',
|
||||
|
||||
shipping_address_country: '',
|
||||
shipping_address_1: '',
|
||||
shipping_address_2: '',
|
||||
shipping_address1: '',
|
||||
shipping_address2: '',
|
||||
shipping_address_city: '',
|
||||
shipping_address_state: '',
|
||||
shipping_address_postcode: '',
|
||||
|
||||
@@ -111,12 +111,12 @@ export default function PreferencesGeneralForm({ isSubmitting }) {
|
||||
>
|
||||
<Stack>
|
||||
<FInputGroup
|
||||
name={'address.address_1'}
|
||||
name={'address.address1'}
|
||||
placeholder={'Address 1'}
|
||||
fastField
|
||||
/>
|
||||
<FInputGroup
|
||||
name={'address.address_2'}
|
||||
name={'address.address2'}
|
||||
placeholder={'Address 2'}
|
||||
fastField
|
||||
/>
|
||||
|
||||
@@ -18,16 +18,16 @@ const Schema = Yup.object().shape({
|
||||
note: Yup.string().trim(),
|
||||
|
||||
billing_address_country: Yup.string().trim(),
|
||||
billing_address_1: Yup.string().trim(),
|
||||
billing_address_2: Yup.string().trim(),
|
||||
billing_address1: Yup.string().trim(),
|
||||
billing_address2: Yup.string().trim(),
|
||||
billing_address_city: Yup.string().trim(),
|
||||
billing_address_state: Yup.string().trim(),
|
||||
billing_address_postcode: Yup.string().nullable(),
|
||||
billing_address_phone: Yup.string().nullable(),
|
||||
|
||||
shipping_address_country: Yup.string().trim(),
|
||||
shipping_address_1: Yup.string().trim(),
|
||||
shipping_address_2: Yup.string().trim(),
|
||||
shipping_address1: Yup.string().trim(),
|
||||
shipping_address2: Yup.string().trim(),
|
||||
shipping_address_city: Yup.string().trim(),
|
||||
shipping_address_state: Yup.string().trim(),
|
||||
shipping_address_postcode: Yup.string().nullable(),
|
||||
|
||||
@@ -21,7 +21,7 @@ import VendorFloatingActions from './VendorFloatingActions';
|
||||
import { withCurrentOrganization } from '@/containers/Organization/withCurrentOrganization';
|
||||
|
||||
import { useVendorFormContext } from './VendorFormProvider';
|
||||
import { compose, transformToForm, safeInvoke } from '@/utils';
|
||||
import { compose, transformToForm, safeInvoke, parseBoolean } from '@/utils';
|
||||
import { defaultInitialValues } from './utils';
|
||||
|
||||
import '@/style/pages/Vendors/Form.scss';
|
||||
@@ -69,7 +69,10 @@ function VendorFormFormik({
|
||||
// Handles the form submit.
|
||||
const handleFormSubmit = (values, form) => {
|
||||
const { setSubmitting, resetForm } = form;
|
||||
const requestForm = { ...values };
|
||||
const requestForm = {
|
||||
...values,
|
||||
active: parseBoolean(values.active, true),
|
||||
};
|
||||
|
||||
setSubmitting(true);
|
||||
|
||||
|
||||
@@ -22,16 +22,16 @@ export const defaultInitialValues = {
|
||||
active: true,
|
||||
|
||||
billing_address_country: '',
|
||||
billing_address_1: '',
|
||||
billing_address_2: '',
|
||||
billing_address1: '',
|
||||
billing_address2: '',
|
||||
billing_address_city: '',
|
||||
billing_address_state: '',
|
||||
billing_address_postcode: '',
|
||||
billing_address_phone: '',
|
||||
|
||||
shipping_address_country: '',
|
||||
shipping_address_1: '',
|
||||
shipping_address_2: '',
|
||||
shipping_address1: '',
|
||||
shipping_address2: '',
|
||||
shipping_address_city: '',
|
||||
shipping_address_state: '',
|
||||
shipping_address_postcode: '',
|
||||
|
||||
@@ -84,6 +84,20 @@ export const handleBooleanChange = (handler) => {
|
||||
return (event) => handler(event.target.checked);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a value to boolean (handles 1, 0, '1', '0', true, false).
|
||||
* @param {*} value
|
||||
* @param {boolean} defaultValue - value when empty/unknown
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export const parseBoolean = (value, defaultValue = false) => {
|
||||
if (typeof value === 'boolean') return value;
|
||||
if (value === 1 || value === '1') return true;
|
||||
if (value === 0 || value === '0') return false;
|
||||
if (value == null || value === '') return defaultValue;
|
||||
return Boolean(value);
|
||||
};
|
||||
|
||||
/** Event handler that exposes the target element's value as a string. */
|
||||
export const handleStringChange = (handler) => {
|
||||
return (event) => handler(event.target.value);
|
||||
|
||||
Reference in New Issue
Block a user