feat: landed cost fields & style.

This commit is contained in:
elforjani13
2021-12-02 15:36:29 +02:00
parent 0c4259a05b
commit ba585271b0
4 changed files with 37 additions and 8 deletions

View File

@@ -90,8 +90,10 @@ export default function AllocateLandedCostFormFields() {
selectedItem={value} selectedItem={value}
selectedItemProp={'id'} selectedItemProp={'id'}
textProp={'name'} textProp={'name'}
labelProp={'id'} labelProp={'formatted_unallocated_cost_amount'}
defaultText={intl.get('Select transaction')} defaultText={intl.get(
'landed_cost.dialog.label_select_transaction',
)}
popoverProps={{ minimal: true }} popoverProps={{ minimal: true }}
/> />
</FormGroup> </FormGroup>
@@ -129,7 +131,10 @@ export default function AllocateLandedCostFormFields() {
selectedItem={value} selectedItem={value}
selectedItemProp={'id'} selectedItemProp={'id'}
textProp={'name'} textProp={'name'}
defaultText={intl.get('Select transaction entry')} labelProp={'formatted_unallocated_cost_amount'}
defaultText={intl.get(
'landed_cost.dialog.label_select_transaction_entry',
)}
popoverProps={{ minimal: true }} popoverProps={{ minimal: true }}
/> />
</FormGroup> </FormGroup>

View File

@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import styled from 'styled-components';
import { Intent, MenuItem, Menu } from '@blueprintjs/core'; import { Intent, MenuItem, Menu } from '@blueprintjs/core';
import { safeCallback } from 'utils'; import { safeCallback } from 'utils';
import { Icon } from 'components'; import { Icon } from 'components';
@@ -24,7 +25,7 @@ export function ActionsMenu({ row: { original }, payload: { onDelete } }) {
*/ */
export function FromTransactionCell({ export function FromTransactionCell({
row: { original }, row: { original },
payload: { onFromTranscationClick } payload: { onFromTranscationClick },
}) { }) {
// Handle the link click // Handle the link click
const handleAnchorClick = () => { const handleAnchorClick = () => {
@@ -38,6 +39,18 @@ export function FromTransactionCell({
); );
} }
/**
* Name accessor.
*/
export const NameAccessor = (row) => {
return (
<span className="name">
<LabelName>{row.name}</LabelName>
<LabelDescription>{row.description}</LabelDescription>
</span>
);
};
/** /**
* Retrieve bill located landed cost table columns. * Retrieve bill located landed cost table columns.
*/ */
@@ -46,7 +59,7 @@ export function useLocatedLandedCostColumns() {
() => [ () => [
{ {
Header: intl.get('name'), Header: intl.get('name'),
accessor: 'description', accessor: NameAccessor,
width: 150, width: 150,
className: 'name', className: 'name',
}, },
@@ -65,7 +78,7 @@ export function useLocatedLandedCostColumns() {
}, },
{ {
Header: intl.get('allocation_method'), Header: intl.get('allocation_method'),
accessor: 'allocation_method_formatted', accessor: 'allocation_method',
width: 100, width: 100,
className: 'allocation-method', className: 'allocation-method',
}, },
@@ -73,3 +86,12 @@ export function useLocatedLandedCostColumns() {
[], [],
); );
} }
const LabelName = styled.div``;
const LabelDescription = styled.div`
font-size: 12px;
margin-top: 6px;
display: block;
opacity: 0.75;
`;

View File

@@ -1536,5 +1536,7 @@
"vendor_credit.drawer.label_vendor_credit_date":"Vendor Credit Date", "vendor_credit.drawer.label_vendor_credit_date":"Vendor Credit Date",
"vendor_credit.drawer.label_create_at":"Create at", "vendor_credit.drawer.label_create_at":"Create at",
"vendor_credit.drawer.label_total": "TOTAL", "vendor_credit.drawer.label_total": "TOTAL",
"vendor_credit.drawer.label_subtotal": "Subtotal" "vendor_credit.drawer.label_subtotal": "Subtotal",
"landed_cost.dialog.label_select_transaction":"Select transaction",
"landed_cost.dialog.label_select_transaction_entry":"Select transaction entry"
} }

View File

@@ -8,7 +8,7 @@
} }
.bp3-form-group.bp3-inline { .bp3-form-group.bp3-inline {
.bp3-label { .bp3-label {
min-width: 150px; min-width: 165px;
} }
.bp3-form-content { .bp3-form-content {
width: 300px; width: 300px;