mirror of
https://github.com/frappe/books.git
synced 2024-11-08 14:50:56 +00:00
add enabeld state in listview
This commit is contained in:
parent
ff61e1b4c7
commit
bed66cb67a
@ -1,7 +1,7 @@
|
||||
import { Doc } from 'fyo/model/doc';
|
||||
import { ListViewSettings } from 'fyo/model/types';
|
||||
import { ItemPrice } from '../ItemPrice/ItemPrice';
|
||||
import { getPriceListStatusColumn } from 'models/helpers';
|
||||
import { getPriceListEnabledColumn, getPriceListStatusColumn } from 'models/helpers';
|
||||
|
||||
export class PriceList extends Doc {
|
||||
enabled?: boolean;
|
||||
@ -12,7 +12,7 @@ export class PriceList extends Doc {
|
||||
|
||||
static getListViewSettings(): ListViewSettings {
|
||||
return {
|
||||
columns: ['name', getPriceListStatusColumn()],
|
||||
columns: ['name', getPriceListEnabledColumn(), getPriceListStatusColumn()],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -354,6 +354,26 @@ export function getPriceListStatusColumn(): ColumnConfig {
|
||||
};
|
||||
}
|
||||
|
||||
export function getPriceListEnabledColumn(): ColumnConfig {
|
||||
return {
|
||||
label: t`Enabled`,
|
||||
fieldname: 'enabled',
|
||||
fieldtype: 'Data',
|
||||
render(doc) {
|
||||
let status = t`Unenabled`;
|
||||
let color = 'orange';
|
||||
if (doc.enabled) {
|
||||
status = t`Enabled`;
|
||||
color = 'green';
|
||||
}
|
||||
|
||||
return {
|
||||
template: `<Badge class="text-xs" color="${color}">${status}</Badge>`,
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export async function getItemPrice(
|
||||
doc: InvoiceItem | ItemPrice,
|
||||
validFrom?: Date,
|
||||
|
Loading…
Reference in New Issue
Block a user