2
0
mirror of https://github.com/frappe/books.git synced 2024-12-31 22:11:48 +00:00

fix(ui): No empty required selects, set placeholders everywhere

This commit is contained in:
18alantom 2021-12-16 16:45:31 +05:30 committed by Alan
parent ea5e0c9f6e
commit 1fd616fb0d
13 changed files with 139 additions and 142 deletions

View File

@ -14,14 +14,15 @@ export default {
fieldname: 'name',
label: 'Account Name',
fieldtype: 'Data',
required: 1
required: 1,
},
{
fieldname: 'rootType',
label: 'Root Type',
fieldtype: 'Select',
options: ['', 'Asset', 'Liability', 'Equity', 'Income', 'Expense'],
required: 1
placeholder: 'Root Type',
options: ['Asset', 'Liability', 'Equity', 'Income', 'Expense'],
required: 1,
},
{
fieldname: 'parentAccount',
@ -30,18 +31,18 @@ export default {
target: 'Account',
getFilters: (query, doc) => {
const filter = {
isGroup: 1
isGroup: 1,
};
doc.rootType ? (filter.rootType = doc.rootType) : '';
return filter;
}
},
},
{
fieldname: 'accountType',
label: 'Account Type',
placeholder: 'Account Type',
fieldtype: 'Select',
options: [
'',
'Accumulated Depreciation',
'Bank',
'Cash',
@ -60,21 +61,21 @@ export default {
'Stock Adjustment',
'Stock Received But Not Billed',
'Tax',
'Temporary'
]
'Temporary',
],
},
{
fieldname: 'balance',
label: 'Balance',
fieldtype: 'Currency',
default: '0',
readOnly: 1
readOnly: 1,
},
{
fieldname: 'isGroup',
label: 'Is Group',
fieldtype: 'Check'
}
fieldtype: 'Check',
},
],
quickEditFields: [
@ -82,7 +83,7 @@ export default {
'rootType',
'parentAccount',
'accountType',
'isGroup'
'isGroup',
],
treeSettings: {
@ -90,6 +91,6 @@ export default {
async getRootLabel() {
let accountingSettings = await frappe.getSingle('AccountingSettings');
return accountingSettings.companyName;
}
}
},
},
};

View File

@ -10,34 +10,34 @@ export default {
fieldname: 'name',
label: 'Currency Name',
fieldtype: 'Data',
required: 1
required: 1,
},
{
fieldname: 'fraction',
label: 'Fraction',
fieldtype: 'Data'
fieldtype: 'Data',
},
{
fieldname: 'fractionUnits',
label: 'Fraction Units',
fieldtype: 'Int'
fieldtype: 'Int',
},
{
label: 'Smallest Currency Fraction Value',
fieldname: 'smallestValue',
fieldtype: 'Currency'
fieldtype: 'Currency',
},
{
label: 'Symbol',
fieldname: 'symbol',
fieldtype: 'Data'
fieldtype: 'Data',
},
{
fieldname: 'numberFormat',
fieldtype: 'Select',
label: 'Number Format',
placeholder: 'Number Format',
options: [
'',
'#,###.##',
'#.###,##',
'# ###.##',
@ -47,8 +47,8 @@ export default {
'#,##,###.##',
'#,###.###',
'#.###',
'#,###'
]
}
]
'#,###',
],
},
],
};

View File

@ -1,5 +1,5 @@
import frappe from 'frappejs';
import GSTR3B from './GSTR3BDocument.js';
import GSTR3B from './GSTR3BDocument.js';
export default {
name: 'GSTR3B',
@ -7,7 +7,7 @@ export default {
doctype: 'DocType',
documentClass: GSTR3B,
print: {
printFormat: 'GSTR3B Print Format'
printFormat: 'GSTR3B Print Format',
},
keywordFields: ['name', 'month', 'year'],
fields: [
@ -15,14 +15,14 @@ export default {
fieldname: 'year',
label: 'Year',
fieldtype: 'Data',
required: 1
required: 1,
},
{
fieldname: 'month',
label: 'Month',
placeholder: 'Month',
fieldtype: 'Select',
options: [
'',
'January',
'February',
'March',
@ -34,45 +34,45 @@ export default {
'September',
'October',
'November',
'December'
'December',
],
required: 1
required: 1,
},
{
fieldname: 'jsonData',
label: 'JSON Data',
fieldtype: 'Code',
formula: doc => doc.getJson(),
formula: (doc) => doc.getJson(),
required: 1,
readOnly: 1,
rows: 15
}
rows: 15,
},
],
layout: [
{
columns: [{ fields: ['year', 'month', 'jsonData'] }]
}
columns: [{ fields: ['year', 'month', 'jsonData'] }],
},
],
links: [
{
label: 'Print PDF',
condition: form => !form.doc._notInserted,
action: async form => {
condition: (form) => !form.doc._notInserted,
action: async (form) => {
form.$router.push({
path: `/print/GSTR3B/${form.doc.name}`
path: `/print/GSTR3B/${form.doc.name}`,
});
}
},
},
{
label: 'Delete',
condition: form => !form.doc._notInserted,
action: async form => {
condition: (form) => !form.doc._notInserted,
action: async (form) => {
const doc = await frappe.getDoc('GSTR3B', form.doc.name);
await doc.delete();
form.$router.push({
path: `/list/GSTR3B`
path: `/list/GSTR3B`,
});
}
}
]
},
},
],
};

View File

@ -29,13 +29,14 @@ export default {
fieldname: 'unit',
label: 'Unit Type',
fieldtype: 'Select',
placeholder: 'Unit Type',
default: 'Unit',
options: ['Unit', 'Kg', 'Gram', 'Hour', 'Day'],
},
{
fieldname: 'itemType',
label: 'Type',
placeholder: 'Sales',
placeholder: 'Type',
fieldtype: 'Select',
default: 'Product',
options: ['Product', 'Service'],
@ -45,7 +46,7 @@ export default {
label: 'Income',
fieldtype: 'Link',
target: 'Account',
placeholder: 'Sales',
placeholder: 'Income',
required: 1,
disableCreation: true,
getFilters: () => {
@ -70,7 +71,7 @@ export default {
label: 'Expense',
fieldtype: 'Link',
target: 'Account',
placeholder: 'Select Account',
placeholder: 'Expense',
required: 1,
disableCreation: true,
getFilters: () => {
@ -96,7 +97,7 @@ export default {
label: 'Tax',
fieldtype: 'Link',
target: 'Tax',
placeholder: 'GST',
placeholder: 'Tax',
},
{
fieldname: 'rate',

View File

@ -22,6 +22,7 @@ export default function getAugmentedParty({ country }) {
{
fieldname: 'gstType',
label: 'GST Registration',
placeholder: 'GST Registration',
fieldtype: 'Select',
default: gstTypes[0],
options: gstTypes,

View File

@ -48,7 +48,8 @@ export default {
fieldname: 'paymentType',
label: 'Payment Type',
fieldtype: 'Select',
options: ['', 'Receive', 'Pay'],
placeholder: 'Payment Type',
options: ['Receive', 'Pay'],
required: 1,
},
{
@ -78,7 +79,7 @@ export default {
label: 'Payment Method',
placeholder: 'Payment Method',
fieldtype: 'Select',
options: ['', 'Cash', 'Cheque', 'Transfer'],
options: ['Cash', 'Cheque', 'Transfer'],
default: 'Cash',
required: 1,
},

View File

@ -9,6 +9,7 @@ export default {
{
fieldname: 'referenceType',
label: 'Reference Type',
placeholder: 'Type',
fieldtype: 'Select',
options: ['SalesInvoice', 'PurchaseInvoice'],
map: { SalesInvoice: 'Invoice', PurchaseInvoice: 'Bill' },
@ -19,6 +20,7 @@ export default {
label: 'Reference Name',
fieldtype: 'DynamicLink',
references: 'referenceType',
placeholder: 'Name',
getFilters() {
return {
outstandingAmount: ['>', 0],
@ -30,6 +32,7 @@ export default {
fieldname: 'amount',
label: 'Amount',
fieldtype: 'Currency',
placeholder: '0.00',
formula: (row, doc) => {
return doc.getFrom(
row.referenceType,

View File

@ -8,12 +8,12 @@ export default {
{
fieldname: 'logo',
label: 'Logo',
fieldtype: 'AttachImage'
fieldtype: 'AttachImage',
},
{
fieldname: 'companyName',
label: 'Company Name',
fieldtype: 'Data'
fieldtype: 'Data',
},
{
fieldname: 'email',
@ -21,13 +21,13 @@ export default {
fieldtype: 'Data',
placeholder: 'john@doe.com',
validate: {
type: 'email'
}
type: 'email',
},
},
{
fieldname: 'displayLogo',
label: 'Display Logo in Invoice',
fieldtype: 'Check'
fieldtype: 'Check',
},
{
fieldname: 'phone',
@ -35,8 +35,8 @@ export default {
fieldtype: 'Data',
placeholder: '9888900000',
validate: {
type: 'phone'
}
type: 'phone',
},
},
{
fieldname: 'address',
@ -44,20 +44,21 @@ export default {
fieldtype: 'Link',
target: 'Address',
placeholder: 'Click to create',
inline: true
inline: true,
},
{
fieldname: 'gstin',
label: 'GSTIN',
fieldtype: 'Data',
placeholder: '27AAAAA0000A1Z5'
placeholder: '27AAAAA0000A1Z5',
},
{
fieldname: 'template',
label: 'Template',
placeholder: 'Template',
fieldtype: 'Select',
options: ['Basic', 'Minimal', 'Business'],
default: 'Basic'
default: 'Basic',
},
{
fieldname: 'color',
@ -73,32 +74,28 @@ export default {
'blue',
'indigo',
'purple',
'pink'
'pink',
]
.map(color => {
.map((color) => {
let label = color[0].toUpperCase() + color.slice(1);
return {
label,
value: theme.colors[color]['500']
value: theme.colors[color]['500'],
};
})
.concat({
label: 'Black',
value: theme.colors['black']
})
value: theme.colors['black'],
}),
},
{
fieldname: 'font',
label: 'Font',
placeholder: 'Font',
fieldtype: 'Select',
options: [
'Inter',
'Times New Roman',
'Arial',
'Courier'
],
default: 'Inter'
}
options: ['Inter', 'Times New Roman', 'Arial', 'Courier'],
default: 'Inter',
},
],
quickEditFields: [
'logo',
@ -109,6 +106,6 @@ export default {
'email',
'phone',
'address',
'gstin'
]
'gstin',
],
};

View File

@ -12,23 +12,25 @@ export default {
fieldtype: 'Link',
target: 'NumberSeries',
required: 1,
default: 'SINV'
default: 'SINV',
},
{
fieldname: 'template',
label: 'Template',
placeholder: 'Template',
fieldtype: 'Select',
options: ['Basic I', 'Basic II', 'Modern'],
required: 1,
default: 'Basic I'
default: 'Basic I',
},
{
fieldname: 'font',
label: 'Font',
placeholder: 'Font',
fieldtype: 'Select',
options: ['Montserrat', 'Open Sans', 'Oxygen', 'Merriweather'],
required: 1,
default: 'Montserrat'
default: 'Montserrat',
},
{
fieldname: 'themeColor',
@ -36,7 +38,7 @@ export default {
fieldtype: 'Data',
required: 1,
default: '#000000',
hidden: 1
}
]
hidden: 1,
},
],
};

View File

@ -13,39 +13,34 @@ export default {
required: 1,
default: async () => {
return (await frappe.getSingle('AccountingSettings')).fiscalYearEnd;
}
},
},
{
fieldtype: 'Select',
placeholder: 'Select Period',
size: 'small',
options: [
'Select Period...',
'Monthly',
'Quarterly',
'Half Yearly',
'Yearly'
],
options: ['Monthly', 'Quarterly', 'Half Yearly', 'Yearly'],
label: 'Periodicity',
fieldname: 'periodicity',
default: 'Monthly'
}
default: 'Monthly',
},
],
getColumns(data) {
const columns = [
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 2 }
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 2 },
];
if (data && data.columns) {
const currencyColumns = data.columns;
const columnDefs = currencyColumns.map(name => ({
const columnDefs = currencyColumns.map((name) => ({
label: name,
fieldname: name,
fieldtype: 'Currency'
fieldtype: 'Currency',
}));
columns.push(...columnDefs);
}
return columns;
}
},
};

View File

@ -5,78 +5,79 @@ export default {
{
fieldtype: 'Select',
label: 'Transfer Type',
placeholder: 'Transfer Type',
fieldname: 'transferType',
options: [
'',
'B2B',
'B2C-Large',
'B2C-Small',
'Nil Rated, Exempted and Non GST supplies'
'Nil Rated, Exempted and Non GST supplies',
],
size: 'small'
size: 'small',
},
{
fieldtype: 'Data',
label: 'Place',
size: 'small',
placeholder: 'Place',
fieldname: 'place'
fieldname: 'place',
},
{
fieldtype: 'Date',
label: 'From Date',
size: 'small',
placeholder: 'From Date',
fieldname: 'fromDate'
fieldname: 'fromDate',
},
{
fieldtype: 'Date',
label: 'To Date',
size: 'small',
placeholder: 'To Date',
fieldname: 'toDate'
}
fieldname: 'toDate',
},
],
linkFields: [
{
label: 'Export',
type: 'primary',
action: async report => {
action: async (report) => {
async function getReportDetails() {
let [rows, columns] = await report.getReportData(
report.currentFilters
);
let columnData = columns.map(column => {
let columnData = columns.map((column) => {
return {
id: column.id,
content: column.content,
checked: true
checked: true,
};
});
return {
title: title,
rows: rows,
columnData: columnData
columnData: columnData,
};
}
report.$modal.show({
modalProps: {
title: `Export ${title}`,
noFooter: true
noFooter: true,
},
component: ExportWizard,
props: await getReportDetails()
props: await getReportDetails(),
});
}
},
},
{
label: 'Clear Filters',
type: 'secondary',
action: async report => {
action: async (report) => {
await report.getReportData({});
report.usedToReRender += 1;
}
}
},
},
],
getColumns() {
@ -85,74 +86,74 @@ export default {
label: 'GSTIN No.',
fieldname: 'gstin',
fieldtype: 'Data',
width: 100
width: 100,
},
{
fieldtype: 'Data',
fieldname: 'partyName',
label: 'Party',
width: 100
width: 100,
},
{
label: 'Invoice No.',
fieldname: 'invNo',
fieldtype: 'Data',
width: 100
width: 100,
},
{
label: 'Invoice Value',
fieldname: 'invAmt',
fieldtype: 'Currency',
width: 100
width: 100,
},
{
label: 'Invoice Date',
fieldname: 'invDate',
fieldtype: 'Date',
width: 100
width: 100,
},
{
label: 'Place of supply',
fieldname: 'place',
fieldtype: 'Data',
width: 100
width: 100,
},
{
label: 'Rate',
fieldname: 'rate',
fieldtype: 'Data',
width: 80
width: 80,
},
{
label: 'Taxable Value',
fieldname: 'taxVal',
fieldtype: 'Currency',
width: 100
width: 100,
},
{
label: 'Reverse Chrg.',
fieldname: 'reverseCharge',
fieldtype: 'Data',
width: 80
width: 80,
},
{
label: 'Intergrated Tax',
fieldname: 'igstAmt',
fieldtype: 'Currency',
width: 100
width: 100,
},
{
label: 'Central Tax',
fieldname: 'cgstAmt',
fieldtype: 'Currency',
width: 100
width: 100,
},
{
label: 'State Tax',
fieldname: 'sgstAmt',
fieldtype: 'Currency',
width: 100
}
width: 100,
},
];
}
},
};

View File

@ -16,7 +16,7 @@ export default {
required: 1,
default: async () => {
return (await frappe.getSingle('AccountingSettings')).fiscalYearStart;
}
},
},
{
fieldtype: 'Date',
@ -27,39 +27,34 @@ export default {
required: 1,
default: async () => {
return (await frappe.getSingle('AccountingSettings')).fiscalYearEnd;
}
},
},
{
fieldtype: 'Select',
size: 'small',
options: [
'Select Period...',
'Monthly',
'Quarterly',
'Half Yearly',
'Yearly'
],
options: ['Monthly', 'Quarterly', 'Half Yearly', 'Yearly'],
default: 'Monthly',
label: 'Periodicity',
fieldname: 'periodicity'
}
placeholder: 'Select Period...',
fieldname: 'periodicity',
},
],
getColumns(data) {
const columns = [
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 2 }
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 2 },
];
if (data && data.columns) {
const currencyColumns = data.columns;
const columnDefs = currencyColumns.map(name => ({
const columnDefs = currencyColumns.map((name) => ({
label: name,
fieldname: name,
fieldtype: 'Currency'
fieldtype: 'Currency',
}));
columns.push(...columnDefs);
}
return columns;
}
},
};

View File

@ -63,7 +63,7 @@ export default {
return this.getInputClassesFromProp(classes);
},
inputPlaceholder() {
return this.placeholder || this.df.placeholder;
return this.placeholder || this.df.placeholder || this.df.label;
},
isReadOnly() {
if (this.readOnly != null) {