mirror of
https://github.com/frappe/books.git
synced 2024-11-08 23:00:56 +00:00
fix: colour selection is a color picker
- report 0s are faded - group Item actions
This commit is contained in:
parent
67235bfb3f
commit
66cfd2efd9
@ -78,7 +78,8 @@ export class Item extends Doc {
|
||||
static getActions(fyo: Fyo): Action[] {
|
||||
return [
|
||||
{
|
||||
label: fyo.t`New Sale`,
|
||||
group: fyo.t`Create`,
|
||||
label: fyo.t`Sales Invoice`,
|
||||
condition: (doc) => !doc.notInserted && doc.for !== 'Purchases',
|
||||
action: async (doc, router) => {
|
||||
const invoice = await fyo.doc.getNewDoc('SalesInvoice');
|
||||
@ -91,7 +92,8 @@ export class Item extends Doc {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: fyo.t`New Purchase`,
|
||||
group: fyo.t`Create`,
|
||||
label: fyo.t`Purchase Invoice`,
|
||||
condition: (doc) => !doc.notInserted && doc.for !== 'Sales',
|
||||
action: async (doc, router) => {
|
||||
const invoice = await fyo.doc.getNewDoc('PurchaseInvoice');
|
||||
|
@ -40,7 +40,7 @@
|
||||
</div>
|
||||
<div class="mt-3 w-28">
|
||||
<input
|
||||
type="text"
|
||||
type="color"
|
||||
:placeholder="t`Custom Hex`"
|
||||
:class="[inputClasses, containerClasses]"
|
||||
:value="value"
|
||||
|
@ -231,11 +231,8 @@ export default {
|
||||
if (this.highlightedIndex < 0) {
|
||||
this.highlightedIndex = 0;
|
||||
}
|
||||
|
||||
nextTick(() => {
|
||||
let index = this.highlightedIndex;
|
||||
if (index !== 0) {
|
||||
index -= 1;
|
||||
}
|
||||
this.scrollToHighlighted();
|
||||
});
|
||||
},
|
||||
|
@ -16,7 +16,7 @@
|
||||
:key="c + '-col'"
|
||||
:style="getCellStyle(col, c)"
|
||||
class="
|
||||
text-gray-600 text-base
|
||||
text-base
|
||||
px-3
|
||||
flex-shrink-0
|
||||
overflow-x-auto
|
||||
@ -54,13 +54,14 @@
|
||||
:key="`${c}-${r}-cell`"
|
||||
:style="getCellStyle(cell, c)"
|
||||
class="
|
||||
text-gray-900 text-base
|
||||
text-base
|
||||
px-3
|
||||
flex-shrink-0
|
||||
overflow-x-auto
|
||||
whitespace-nowrap
|
||||
no-scrollbar
|
||||
"
|
||||
:class="[getCellColorClass(cell)]"
|
||||
>
|
||||
{{ cell.value }}
|
||||
</div>
|
||||
@ -174,13 +175,33 @@ export default defineComponent({
|
||||
styles['padding-left'] = `${cell.indent * 2}rem`;
|
||||
}
|
||||
|
||||
return styles;
|
||||
},
|
||||
getCellColorClass(cell) {
|
||||
if (cell.color === 'red') {
|
||||
styles['color'] = '#e53e3e';
|
||||
return 'text-red-600';
|
||||
} else if (cell.color === 'green') {
|
||||
styles['color'] = '#38a169';
|
||||
return 'text-green-600';
|
||||
}
|
||||
|
||||
return styles;
|
||||
if (!cell.rawValue) {
|
||||
return 'text-gray-600';
|
||||
}
|
||||
|
||||
if (typeof cell.rawValue !== 'number') {
|
||||
return 'text-gray-900';
|
||||
}
|
||||
|
||||
if (cell.rawValue === 0) {
|
||||
return 'text-gray-600';
|
||||
}
|
||||
|
||||
const prec = this.fyo?.singles?.displayPrecision ?? 2;
|
||||
if (Number(cell.rawValue.toFixed(prec)) === 0) {
|
||||
return 'text-gray-600';
|
||||
}
|
||||
|
||||
return 'text-gray-900';
|
||||
},
|
||||
},
|
||||
components: { Paginator, WithScroll },
|
||||
|
Loading…
Reference in New Issue
Block a user