diff --git a/schemas/app/PurchaseInvoice.json b/schemas/app/PurchaseInvoice.json index 89bf5e4e..afc0a6cd 100644 --- a/schemas/app/PurchaseInvoice.json +++ b/schemas/app/PurchaseInvoice.json @@ -53,7 +53,8 @@ "label": "Items", "fieldtype": "Table", "target": "PurchaseInvoiceItem", - "required": true + "required": true, + "edit": true }, { "fieldname": "netTotal", diff --git a/schemas/app/PurchaseInvoiceItem.json b/schemas/app/PurchaseInvoiceItem.json index 27cc5c2c..4276b724 100644 --- a/schemas/app/PurchaseInvoiceItem.json +++ b/schemas/app/PurchaseInvoiceItem.json @@ -85,5 +85,15 @@ } ], "tableFields": ["item", "tax", "quantity", "rate", "amount"], - "keywordFields": ["item", "tax"] + "keywordFields": ["item", "tax"], + "quickEditFields": [ + "item", + "description", + "hsnCode", + "tax", + "quantity", + "rate", + "itemDiscountAmount", + "itemDiscountPercent" + ] } diff --git a/schemas/app/SalesInvoice.json b/schemas/app/SalesInvoice.json index c7125b19..b2fd81d3 100644 --- a/schemas/app/SalesInvoice.json +++ b/schemas/app/SalesInvoice.json @@ -52,7 +52,8 @@ "label": "Items", "fieldtype": "Table", "target": "SalesInvoiceItem", - "required": true + "required": true, + "edit": true }, { "fieldname": "netTotal", diff --git a/schemas/app/SalesInvoiceItem.json b/schemas/app/SalesInvoiceItem.json index 4f484241..857c6b4e 100644 --- a/schemas/app/SalesInvoiceItem.json +++ b/schemas/app/SalesInvoiceItem.json @@ -86,5 +86,15 @@ } ], "tableFields": ["item", "tax", "quantity", "rate", "amount"], - "keywordFields": ["item", "tax"] + "keywordFields": ["item", "tax"], + "quickEditFields": [ + "item", + "description", + "hsnCode", + "tax", + "quantity", + "rate", + "itemDiscountAmount", + "itemDiscountPercent" + ] } diff --git a/schemas/types.ts b/schemas/types.ts index 7954852f..484f4c9c 100644 --- a/schemas/types.ts +++ b/schemas/types.ts @@ -50,6 +50,7 @@ export interface TargetField extends BaseField { fieldtype: FieldTypeEnum.Table | FieldTypeEnum.Link; target: string; // Name of the table or group of tables to fetch values create?: boolean; // Whether to show Create in the dropdown + edit?: boolean; // Whether the Table has quick editable columns } export interface DynamicLinkField extends BaseField { diff --git a/src/components/Button.vue b/src/components/Button.vue index 5dfc9410..014ca3fb 100644 --- a/src/components/Button.vue +++ b/src/components/Button.vue @@ -6,7 +6,6 @@ flex justify-center items-center - h-8 text-sm " :class="_class" @@ -35,15 +34,20 @@ export default { type: Boolean, default: true, }, + background: { + type: Boolean, + default: true, + }, }, computed: { _class() { return { 'opacity-50 cursor-not-allowed pointer-events-none': this.disabled, 'text-white': this.type === 'primary', - 'bg-blue-500': this.type === 'primary', + 'bg-blue-500': this.type === 'primary' && this.background, 'text-gray-700': this.type !== 'primary', - 'bg-gray-200': this.type !== 'primary', + 'bg-gray-200': this.type !== 'primary' && this.background, + 'h-8': this.background, 'px-3': this.padding && this.icon, 'px-6': this.padding && !this.icon, }; diff --git a/src/components/Controls/Table.vue b/src/components/Controls/Table.vue index de509527..c6d9ade9 100644 --- a/src/components/Controls/Table.vue +++ b/src/components/Controls/Table.vue @@ -38,6 +38,7 @@ v-bind="{ row, tableFields, size, ratio, isNumeric }" :read-only="isReadOnly" @remove="removeRow(row)" + :can-edit-row="canEditRow" /> @@ -169,8 +170,17 @@ export default { } return 2; }, + canEditRow() { + return !this.doc?.isSubmitted && this.df.edit; + }, ratio() { - return [0.3].concat(this.tableFields.map(() => 1)); + const ratio = [0.3].concat(this.tableFields.map(() => 1)); + + if (this.canEditRow) { + return ratio.concat(0.3); + } + + return ratio; }, tableFields() { const fields = fyo.schemaMap[this.df.target].tableFields ?? []; diff --git a/src/components/Controls/TableRow.vue b/src/components/Controls/TableRow.vue index 885e2c71..c2e305a3 100644 --- a/src/components/Controls/TableRow.vue +++ b/src/components/Controls/TableRow.vue @@ -19,6 +19,7 @@ @@ -39,6 +40,18 @@ @change="(value) => onChange(df, value)" @new-doc="(doc) => row.set(df.fieldname, doc.name)" /> +
({ hovering: false, errors: {} }), beforeCreate() { @@ -95,6 +115,16 @@ export default { getErrorString() { return Object.values(this.errors).filter(Boolean).join(' '); }, + openRowQuickEdit() { + if (!this.row) { + return; + } + + openQuickEdit({ + schemaName: this.row.schemaName, + name: this.row.name, + }); + }, }, }; diff --git a/src/pages/QuickEditForm.vue b/src/pages/QuickEditForm.vue index 361d0051..a7dff7c9 100644 --- a/src/pages/QuickEditForm.vue +++ b/src/pages/QuickEditForm.vue @@ -4,7 +4,10 @@ :class="white ? 'bg-white' : 'bg-gray-25'" > -
+