mirror of
https://github.com/frappe/books.git
synced 2024-11-08 14:50:56 +00:00
fix: templatebuilder readonly
- rename variable in evaluateFieldMeta - add action to templatebuilder
This commit is contained in:
parent
e63f24751c
commit
0d3541fcb7
@ -25,9 +25,9 @@ export class PrintTemplate extends Doc {
|
||||
}
|
||||
|
||||
readOnly: ReadOnlyMap = {
|
||||
name: () => !!this.isCustom,
|
||||
type: () => !!this.isCustom,
|
||||
template: () => !!this.isCustom,
|
||||
name: () => !this.isCustom,
|
||||
type: () => !this.isCustom,
|
||||
template: () => !this.isCustom,
|
||||
};
|
||||
|
||||
static lists: ListsMap = {
|
||||
|
@ -157,6 +157,7 @@
|
||||
@change="
|
||||
async (e: Event) => await doc?.set('template', (e.target as HTMLTextAreaElement).value)
|
||||
"
|
||||
:disabled="!doc?.isCustom"
|
||||
/>
|
||||
<button
|
||||
class="bg-gray-200 p-0.5 rounded absolute bottom-4 left-2"
|
||||
@ -223,6 +224,7 @@
|
||||
@change="
|
||||
async (e: Event) => await doc?.set('template', (e.target as HTMLTextAreaElement).value)
|
||||
"
|
||||
:disabled="!doc?.isCustom"
|
||||
></textarea>
|
||||
</div>
|
||||
</div>
|
||||
@ -246,7 +248,11 @@ import {
|
||||
getPrintTemplatePropValues,
|
||||
} from 'src/utils/printTemplates';
|
||||
import { PrintValues } from 'src/utils/types';
|
||||
import { getActionsForDoc, getDocFromNameIfExistsElseNew } from 'src/utils/ui';
|
||||
import {
|
||||
getActionsForDoc,
|
||||
getDocFromNameIfExistsElseNew,
|
||||
openSettings,
|
||||
} from 'src/utils/ui';
|
||||
import { getMapFromList } from 'utils/index';
|
||||
import { computed, defineComponent } from 'vue';
|
||||
import PrintContainer from './PrintContainer.vue';
|
||||
@ -380,7 +386,16 @@ export default defineComponent({
|
||||
return [];
|
||||
}
|
||||
|
||||
return getActionsForDoc(this.doc as Doc);
|
||||
const actions = getActionsForDoc(this.doc as Doc);
|
||||
actions.push({
|
||||
label: this.t`Print Settings`,
|
||||
group: this.t`View`,
|
||||
async action() {
|
||||
await openSettings(ModelNameEnum.PrintSettings);
|
||||
},
|
||||
});
|
||||
|
||||
return actions;
|
||||
},
|
||||
fields(): Record<string, Field> {
|
||||
return getMapFromList(
|
||||
|
@ -47,9 +47,9 @@ function evaluateFieldMeta(
|
||||
return value;
|
||||
}
|
||||
|
||||
const hiddenFunction = doc?.[meta]?.[field.fieldname];
|
||||
if (hiddenFunction !== undefined) {
|
||||
return hiddenFunction();
|
||||
const evalFunction = doc?.[meta]?.[field.fieldname];
|
||||
if (evalFunction !== undefined) {
|
||||
return evalFunction();
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
|
Loading…
Reference in New Issue
Block a user