fix: danger intent fields.

This commit is contained in:
a.bouhuolia
2021-08-03 14:30:50 +02:00
parent 15bc34d866
commit aab56662a5
13 changed files with 124 additions and 48 deletions

View File

@@ -6,6 +6,7 @@
"@babel/core": "7.8.4", "@babel/core": "7.8.4",
"@blueprintjs/core": "^3.38.1", "@blueprintjs/core": "^3.38.1",
"@blueprintjs/datetime": "^3.15.2", "@blueprintjs/datetime": "^3.15.2",
"@blueprintjs/popover2": "^0.11.1",
"@blueprintjs/select": "^3.11.2", "@blueprintjs/select": "^3.11.2",
"@blueprintjs/table": "^3.8.3", "@blueprintjs/table": "^3.8.3",
"@blueprintjs/timezone": "^3.6.2", "@blueprintjs/timezone": "^3.6.2",
@@ -135,6 +136,7 @@
"@types/node": "^14.14.9", "@types/node": "^14.14.9",
"@types/react": "^17.0.0", "@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0", "@types/react-dom": "^17.0.0",
"@types/react-router-dom": "^5.1.8",
"@welldone-software/why-did-you-render": "^6.0.0-rc.1", "@welldone-software/why-did-you-render": "^6.0.0-rc.1",
"compression-webpack-plugin": "^6.1.0", "compression-webpack-plugin": "^6.1.0",
"http-proxy-middleware": "^1.0.0", "http-proxy-middleware": "^1.0.0",

View File

@@ -28,7 +28,7 @@ const queryConfig = {
function GlobalFetchQuery({ function GlobalFetchQuery({
children children
}) { }) {
window.localStorage.setItem('lang', 'ar-ly'); window.localStorage.setItem('lang', 'en');
return children return children
} }

View File

@@ -25,7 +25,12 @@ function DecrementAdjustmentFields() {
intent={inputIntent({ error, touched })} intent={inputIntent({ error, touched })}
helperText={<ErrorMessage name="quantity_on_hand" />} helperText={<ErrorMessage name="quantity_on_hand" />}
> >
<InputGroup disabled={true} medium={'true'} {...field} /> <InputGroup
disabled={true}
medium={'true'}
intent={inputIntent({ error, touched })}
{...field}
/>
</FormGroup> </FormGroup>
)} )}
</FastField> </FastField>
@@ -66,6 +71,7 @@ function DecrementAdjustmentFields() {
), ),
); );
}} }}
intent={inputIntent({ error, touched })}
/> />
</FormGroup> </FormGroup>
)} )}
@@ -104,6 +110,7 @@ function DecrementAdjustmentFields() {
), ),
); );
}} }}
intent={inputIntent({ error, touched })}
/> />
</FormGroup> </FormGroup>
)} )}

View File

@@ -21,7 +21,12 @@ export default function IncrementAdjustmentFields() {
intent={inputIntent({ error, touched })} intent={inputIntent({ error, touched })}
helperText={<ErrorMessage name="quantity_on_hand" />} helperText={<ErrorMessage name="quantity_on_hand" />}
> >
<InputGroup disabled={true} medium={'true'} {...field} /> <InputGroup
disabled={true}
medium={'true'}
intent={inputIntent({ error, touched })}
{...field}
/>
</FormGroup> </FormGroup>
)} )}
</FastField> </FastField>
@@ -63,6 +68,7 @@ export default function IncrementAdjustmentFields() {
), ),
); );
}} }}
intent={inputIntent({ error, touched })}
/> />
</FormGroup> </FormGroup>
)} )}
@@ -87,6 +93,7 @@ export default function IncrementAdjustmentFields() {
onChange={(value) => { onChange={(value) => {
setFieldValue('cost', value); setFieldValue('cost', value);
}} }}
intent={inputIntent({ error, touched })}
/> />
</FormGroup> </FormGroup>
)} )}
@@ -127,6 +134,7 @@ export default function IncrementAdjustmentFields() {
), ),
); );
}} }}
intent={inputIntent({ error, touched })}
/> />
</FormGroup> </FormGroup>
)} )}

View File

@@ -3,20 +3,18 @@ import intl from 'react-intl-universal';
import { DATATYPES_LENGTH } from 'common/dataTypes'; import { DATATYPES_LENGTH } from 'common/dataTypes';
const Schema = Yup.object().shape({ const Schema = Yup.object().shape({
date: Yup.date() date: Yup.date().required().label(intl.get('date')),
.required()
.label(intl.get('date')),
type: Yup.string().required(), type: Yup.string().required(),
adjustment_account_id: Yup.string().required(), adjustment_account_id: Yup.string()
.required()
.label(intl.get('adjustment_account')),
item_id: Yup.number().required(), item_id: Yup.number().required(),
reason: Yup.string() reason: Yup.string()
.required() .required()
.min(3) .min(3)
.max(DATATYPES_LENGTH.TEXT) .max(DATATYPES_LENGTH.TEXT)
.label(intl.get('reason')), .label(intl.get('reason')),
quantity_on_hand: Yup.number() quantity_on_hand: Yup.number().required().label(intl.get('qty')),
.required()
.label(intl.get('qty')),
quantity: Yup.number().integer().min(1).required(), quantity: Yup.number().integer().min(1).required(),
cost: Yup.number().when(['type'], { cost: Yup.number().when(['type'], {
is: (type) => type === 'increment', is: (type) => type === 'increment',

View File

@@ -38,7 +38,6 @@ export default function InventoryAdjustmentFormDialogFields() {
const { accounts } = useInventoryAdjContext(); const { accounts } = useInventoryAdjContext();
// Intl context. // Intl context.
return ( return (
<div className={Classes.DIALOG_BODY}> <div className={Classes.DIALOG_BODY}>
@@ -65,6 +64,7 @@ export default function InventoryAdjustmentFormDialogFields() {
position: Position.BOTTOM, position: Position.BOTTOM,
minimal: true, minimal: true,
}} }}
intent={inputIntent({ error, touched })}
inputRef={(ref) => (dateFieldRef.current = ref)} inputRef={(ref) => (dateFieldRef.current = ref)}
/> />
</FormGroup> </FormGroup>
@@ -103,6 +103,7 @@ export default function InventoryAdjustmentFormDialogFields() {
selectedItemProp={'value'} selectedItemProp={'value'}
textProp={'name'} textProp={'name'}
popoverProps={{ minimal: true }} popoverProps={{ minimal: true }}
intent={inputIntent({ error, touched })}
/> />
</FormGroup> </FormGroup>
)} )}
@@ -129,6 +130,7 @@ export default function InventoryAdjustmentFormDialogFields() {
} }
inputProps={{ inputProps={{
placeholder: intl.get('select_adjustment_account'), placeholder: intl.get('select_adjustment_account'),
intent: inputIntent({ error, touched }),
}} }}
/> />
</FormGroup> </FormGroup>
@@ -144,7 +146,7 @@ export default function InventoryAdjustmentFormDialogFields() {
helperText={<ErrorMessage name="reference_no" />} helperText={<ErrorMessage name="reference_no" />}
className={'form-group--reference-no'} className={'form-group--reference-no'}
> >
<InputGroup {...field} /> <InputGroup intent={inputIntent({ error, touched })} {...field} />
</FormGroup> </FormGroup>
)} )}
</FastField> </FastField>
@@ -159,7 +161,12 @@ export default function InventoryAdjustmentFormDialogFields() {
intent={inputIntent({ error, touched })} intent={inputIntent({ error, touched })}
helperText={<ErrorMessage name={'reason'} />} helperText={<ErrorMessage name={'reason'} />}
> >
<TextArea growVertically={true} large={true} {...field} /> <TextArea
growVertically={true}
large={true}
intent={inputIntent({ error, touched })}
{...field}
/>
</FormGroup> </FormGroup>
)} )}
</FastField> </FastField>

View File

@@ -29,6 +29,7 @@ export default function ItemCategoryFormFields() {
<InputGroup <InputGroup
medium={true} medium={true}
inputRef={(ref) => (categoryNameFieldRef.current = ref)} inputRef={(ref) => (categoryNameFieldRef.current = ref)}
intent={inputIntent({ error, touched })}
{...field} {...field}
/> />
</FormGroup> </FormGroup>
@@ -45,7 +46,12 @@ export default function ItemCategoryFormFields() {
helperText={<ErrorMessage name="description" />} helperText={<ErrorMessage name="description" />}
inline={true} inline={true}
> >
<TextArea growVertically={true} large={true} {...field} /> <TextArea
growVertically={true}
large={true}
intent={inputIntent({ error, touched })}
{...field}
/>
</FormGroup> </FormGroup>
)} )}
</FastField> </FastField>

View File

@@ -109,6 +109,7 @@ export default function ItemFormPrimarySection() {
<InputGroup <InputGroup
medium={true} medium={true}
{...field} {...field}
intent={inputIntent({ error, touched })}
inputRef={(ref) => (nameFieldRef.current = ref)} inputRef={(ref) => (nameFieldRef.current = ref)}
/> />
</FormGroup> </FormGroup>
@@ -125,7 +126,7 @@ export default function ItemFormPrimarySection() {
helperText={<ErrorMessage name={'code'} />} helperText={<ErrorMessage name={'code'} />}
inline={true} inline={true}
> >
<InputGroup medium={true} {...field} /> <InputGroup medium={true} intent={inputIntent({ error, touched })} {...field} />
</FormGroup> </FormGroup>
)} )}
</FastField> </FastField>

View File

@@ -11,7 +11,9 @@ import {
Classes, Classes,
Intent, Intent,
Switch, Switch,
Alignment,
} from '@blueprintjs/core'; } from '@blueprintjs/core';
import { Tooltip2 } from '@blueprintjs/popover2';
import { FormattedMessage as T } from 'components'; import { FormattedMessage as T } from 'components';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
@@ -19,6 +21,7 @@ import Icon from 'components/Icon';
import { If, DashboardActionViewsList } from 'components'; import { If, DashboardActionViewsList } from 'components';
import { useItemsListContext } from './ItemsListProvider'; import { useItemsListContext } from './ItemsListProvider';
import { useRefreshItems } from 'hooks/query/items';
import withItems from 'containers/Items/withItems'; import withItems from 'containers/Items/withItems';
import withItemsActions from './withItemsActions'; import withItemsActions from './withItemsActions';
@@ -43,7 +46,8 @@ function ItemsActionsBar({
// Items list context. // Items list context.
const { itemsViews } = useItemsListContext(); const { itemsViews } = useItemsListContext();
// React intl. // Items refresh action.
const { refresh } = useRefreshItems();
// History context. // History context.
const history = useHistory(); const history = useHistory();
@@ -69,6 +73,10 @@ function ItemsActionsBar({
setItemsTableState({ inactiveMode: checked }); setItemsTableState({ inactiveMode: checked });
}; };
const handleRefreshBtnClick = () => {
refresh();
};
return ( return (
<DashboardActionsBar> <DashboardActionsBar>
<NavbarGroup> <NavbarGroup>
@@ -125,6 +133,14 @@ function ItemsActionsBar({
onChange={handleInactiveSwitchChange} onChange={handleInactiveSwitchChange}
/> />
</NavbarGroup> </NavbarGroup>
<NavbarGroup align={Alignment.RIGHT}>
<Button
className={Classes.MINIMAL}
icon={<Icon icon="refresh-16" iconSize={14} />}
onClick={handleRefreshBtnClick}
/>
</NavbarGroup>
</DashboardActionsBar> </DashboardActionsBar>
); );
} }

View File

@@ -142,6 +142,16 @@ export function useItems(query, props) {
); );
} }
export function useRefreshItems() {
const queryClient = useQueryClient();
return {
refresh: () => {
queryClient.invalidateQueries(t.ITEMS);
},
}
}
/** /**
* Retrieve details of the given item. * Retrieve details of the given item.
* @param {number} id - Item id. * @param {number} id - Item id.

View File

@@ -5,6 +5,7 @@
// Blueprint framework. // Blueprint framework.
@import '@blueprintjs/core/src/blueprint.scss'; @import '@blueprintjs/core/src/blueprint.scss';
@import '@blueprintjs/datetime/src/blueprint-datetime.scss'; @import '@blueprintjs/datetime/src/blueprint-datetime.scss';
@import "@blueprintjs/popover2";
@import 'basscss'; @import 'basscss';
@@ -325,4 +326,14 @@ html[lang^="ar"] {
} }
.sidebar-overlay-backdrop{ .sidebar-overlay-backdrop{
background-color: rgba(0, 10, 30, 0.15); background-color: rgba(0, 10, 30, 0.15);
}
.bp3-popover2{
box-shadow: 0 0 0;
}
.bp3-tooltip2 .bp3-popover2-arrow:before{
box-shadow: 0 0 0;
} }

View File

@@ -1,4 +1,3 @@
.form { .form {
&__floating-footer { &__floating-footer {
position: fixed; position: fixed;
@@ -14,7 +13,7 @@
} }
} }
// Form // Form form.
label.bp3-label { label.bp3-label {
color: #353535; color: #353535;
font-weight: 400; font-weight: 400;
@@ -31,6 +30,7 @@ label.bp3-label {
} }
} }
// Form input.
.#{$ns}-input { .#{$ns}-input {
box-shadow: 0 0 0 transparent; box-shadow: 0 0 0 transparent;
border: 1px solid #ced4da; border: 1px solid #ced4da;
@@ -44,12 +44,13 @@ label.bp3-label {
box-shadow: 0 0 0 1px #116cd0; box-shadow: 0 0 0 1px #116cd0;
border-color: #116cd0; border-color: #116cd0;
} }
&.bp3-disabled, &.bp3-disabled,
&:disabled { &:disabled {
background: #e9ecef; background: #e9ecef;
} }
.bp3-form-group.bp3-intent-danger > & { .bp3-input-group.bp3-intent-danger & {
box-shadow: 0 0 0 transparent; box-shadow: 0 0 0 transparent;
border-color: #db3737; border-color: #db3737;
@@ -92,6 +93,7 @@ label.bp3-label {
box-shadow: none; box-shadow: none;
border: 1px solid #ced4da; border: 1px solid #ced4da;
} }
&:focus { &:focus {
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
border-color: #80bdff; border-color: #80bdff;
@@ -128,8 +130,9 @@ label.bp3-label {
.bp3-input-group { .bp3-input-group {
flex: 1 1 auto; flex: 1 1 auto;
} }
.bp3-control-group { .bp3-control-group {
> .input-group-prepend:first-child .input-group-text { >.input-group-prepend:first-child .input-group-text {
border-top-right-radius: 0; border-top-right-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
} }
@@ -141,7 +144,9 @@ label.bp3-label {
display: none; display: none;
} }
} }
.bp3-datepicker-caption select { .bp3-datepicker-caption select {
&, &,
&:hover { &:hover {
border-color: transparent; border-color: transparent;
@@ -180,18 +185,20 @@ label.bp3-label {
padding-right: 25px; padding-right: 25px;
justify-content: start; justify-content: start;
&:not([class*="bp3-intent-"]):not(.bp3-minimal){ &:not([class*="bp3-intent-"]):not(.bp3-minimal) {
&, &,
&:hover { &:hover {
outline: none; outline: none;
box-shadow: 0 0 0 transparent; box-shadow: 0 0 0 transparent;
border: 1px solid #ced4da; border: 1px solid #ced4da;
&:not(:disabled) { &:not(:disabled) {
background: #fff; background: #fff;
} }
} }
&:focus{
&:focus {
box-shadow: 0 0 0 1px #116cd0; box-shadow: 0 0 0 1px #116cd0;
border-color: #116cd0; border-color: #116cd0;
} }
@@ -202,12 +209,12 @@ label.bp3-label {
width: 100%; width: 100%;
} }
.bp3-popover-target.bp3-popover-open{ .bp3-popover-target.bp3-popover-open {
.#{$ns}-button { .#{$ns}-button {
&:not([class*="bp3-intent-"]):not(.bp3-minimal):not(:disabled), &:not([class*="bp3-intent-"]):not(.bp3-minimal):not(:disabled),
&:not([class*="bp3-intent-"]):not(.bp3-minimal):hover:not(:disabled){ &:not([class*="bp3-intent-"]):not(.bp3-minimal):hover:not(:disabled) {
background-color: #fafafa; background-color: #fafafa;
} }
} }
@@ -220,7 +227,7 @@ label.bp3-label {
left: 0; left: 0;
margin: 7px; margin: 7px;
+ .bp3-button-text { +.bp3-button-text {
padding-left: 20px; padding-left: 20px;
} }
} }
@@ -252,25 +259,25 @@ label.bp3-label {
} }
@mixin control-checked-colors($selector: ':checked') { @mixin control-checked-colors($selector: ':checked') {
input#{$selector} ~ .#{$ns}-control-indicator { input#{$selector}~.#{$ns}-control-indicator {
box-shadow: none; box-shadow: none;
background-color: $control-checked-background-color; background-color: $control-checked-background-color;
color: $white; color: $white;
} }
&:hover input#{$selector} ~ .#{$ns}-control-indicator { &:hover input#{$selector}~.#{$ns}-control-indicator {
box-shadow: none; box-shadow: none;
background-color: $control-checked-background-color-hover; background-color: $control-checked-background-color-hover;
border-color: $control-checked-background-color-active; border-color: $control-checked-background-color-active;
} }
input:not(:disabled):active#{$selector} ~ .#{$ns}-control-indicator { input:not(:disabled):active#{$selector}~.#{$ns}-control-indicator {
box-shadow: none; box-shadow: none;
background-color: $control-checked-background-color-active; background-color: $control-checked-background-color-active;
border-color: $control-checked-background-color-active; border-color: $control-checked-background-color-active;
} }
input:disabled#{$selector} ~ .#{$ns}-control-indicator { input:disabled#{$selector}~.#{$ns}-control-indicator {
box-shadow: none; box-shadow: none;
background: rgba($control-checked-background-color, 0.5); background: rgba($control-checked-background-color, 0.5);
} }
@@ -278,20 +285,23 @@ label.bp3-label {
///@extend ///@extend
.#{$ns}-control { .#{$ns}-control {
input:checked ~ .#{$ns}-control-indicator { input:checked~.#{$ns}-control-indicator {
box-shadow: none; box-shadow: none;
background-color: transparent; background-color: transparent;
background-image: none; background-image: none;
} }
&:hover input:checked ~ .#{$ns}-control-indicator {
&:hover input:checked~.#{$ns}-control-indicator {
box-shadow: none; box-shadow: none;
background-color: transparent; background-color: transparent;
} }
input:not(:disabled):active:checked ~ .#{$ns}-control-indicator {
input:not(:disabled):active:checked~.#{$ns}-control-indicator {
box-shadow: none; box-shadow: none;
background: transparent; background: transparent;
} }
input:disabled:checked ~ .#{$ns}-control-indicator {
input:disabled:checked~.#{$ns}-control-indicator {
box-shadow: none; box-shadow: none;
background: transparent; background: transparent;
} }
@@ -334,7 +344,7 @@ label.bp3-label {
background-color: transparent; background-color: transparent;
} }
input:not(:disabled):active ~ .#{$ns}-control-indicator { input:not(:disabled):active~.#{$ns}-control-indicator {
box-shadow: 0 0 0 transparent; box-shadow: 0 0 0 transparent;
background: transparent; background: transparent;
} }
@@ -359,7 +369,7 @@ label.bp3-label {
Styleguide checkbox Styleguide checkbox
*/ */
&.#{$ns}-checkbox { &.#{$ns}-checkbox {
&:hover input:indeterminate ~ .#{$ns}-control-indicator { &:hover input:indeterminate~.#{$ns}-control-indicator {
// box-shadow: 0 0 0 transparent; // box-shadow: 0 0 0 transparent;
} }
@@ -371,6 +381,7 @@ label.bp3-label {
width: 100%; width: 100%;
} }
} }
@include control-checked-colors(':checked'); @include control-checked-colors(':checked');
// make :indeterminate look like :checked _for Checkbox only_ // make :indeterminate look like :checked _for Checkbox only_
@@ -381,12 +392,14 @@ label.bp3-label {
border-radius: $pt-border-radius; border-radius: $pt-border-radius;
background-color: #fff; background-color: #fff;
} }
input:checked ~ .#{$ns}-control-indicator {
input:checked~.#{$ns}-control-indicator {
background-image: escape-svg($form-check-input-checked-bg-image); background-image: escape-svg($form-check-input-checked-bg-image);
border-color: $form-check-input-checked-bg-color; border-color: $form-check-input-checked-bg-color;
background-color: $form-check-input-checked-bg-color; background-color: $form-check-input-checked-bg-color;
} }
input:indeterminate ~ .#{$ns}-control-indicator {
input:indeterminate~.#{$ns}-control-indicator {
background-image: escape-svg($form-check-input-indeterminate-bg-image); background-image: escape-svg($form-check-input-indeterminate-bg-image);
border-color: $form-check-input-checked-bg-color; border-color: $form-check-input-checked-bg-color;
background-color: $form-check-input-checked-bg-color; background-color: $form-check-input-checked-bg-color;
@@ -422,29 +435,27 @@ label.bp3-label {
} }
} }
input:checked ~ .#{$ns}-control-indicator { input:checked~.#{$ns}-control-indicator {
border-color: $form-check-input-checked-bg-color; border-color: $form-check-input-checked-bg-color;
&::before { &::before {
background-image: radial-gradient( background-image: radial-gradient($form-check-input-checked-bg-color 40%,
$form-check-input-checked-bg-color 40%, transparent 40%);
transparent 40%
);
} }
} }
input:checked:disabled ~ .#{$ns}-control-indicator::before { input:checked:disabled~.#{$ns}-control-indicator::before {
opacity: 0.5; opacity: 0.5;
} }
input:focus ~ .#{$ns}-control-indicator { input:focus~.#{$ns}-control-indicator {
-moz-outline-radius: $control-indicator-size; -moz-outline-radius: $control-indicator-size;
} }
} }
} }
.bp3-menu-item::before, .bp3-menu-item::before,
.bp3-menu-item > .bp3-icon { .bp3-menu-item>.bp3-icon {
color: #4b5d6b; color: #4b5d6b;
} }
@@ -476,4 +487,4 @@ label.bp3-label {
} }
} }
} }
} }

View File

@@ -181,7 +181,6 @@ $dashboard-views-bar-height: 45px;
} }
.#{$ns}-icon { .#{$ns}-icon {
color: #32304a; color: #32304a;
margin-right: 7px;
} }
&.#{$ns}-minimal.#{$ns}-intent-danger { &.#{$ns}-minimal.#{$ns}-intent-danger {
color: #c23030; color: #c23030;