mirror of
https://github.com/frappe/books.git
synced 2025-02-02 12:08:27 +00:00
chore: format, lint and cleanup PR #521
This commit is contained in:
parent
87c40bc2d1
commit
665e341450
@ -7,16 +7,16 @@ export const DEFAULT_CURRENCY = 'INR';
|
||||
export const DEFAULT_LANGUAGE = 'English';
|
||||
export const DEFAULT_SERIES_START = 1001;
|
||||
export const DEFAULT_USER = 'Admin';
|
||||
export const RTL_LAGNUAGES = [
|
||||
"Arabic",
|
||||
"Aramaic",
|
||||
"Azeri",
|
||||
"Dhivehi",
|
||||
"Maldivian",
|
||||
"Hebrew",
|
||||
"Kurdish",
|
||||
"Sorani",
|
||||
"Persian",
|
||||
"Farsi",
|
||||
"Urdu"
|
||||
];
|
||||
export const RTL_LANGUAGES = [
|
||||
'Arabic',
|
||||
'Aramaic',
|
||||
'Azeri',
|
||||
'Dhivehi',
|
||||
'Maldivian',
|
||||
'Hebrew',
|
||||
'Kurdish',
|
||||
'Sorani',
|
||||
'Persian',
|
||||
'Farsi',
|
||||
'Urdu',
|
||||
];
|
||||
|
13
src/App.vue
13
src/App.vue
@ -2,7 +2,7 @@
|
||||
<div
|
||||
id="app"
|
||||
class="h-screen flex flex-col font-sans overflow-hidden antialiased"
|
||||
:dir="direction"
|
||||
:dir="languageDirection"
|
||||
:language="language"
|
||||
>
|
||||
<WindowsTitleBar
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
<script>
|
||||
import { ConfigKeys } from 'fyo/core/types';
|
||||
import { RTL_LAGNUAGES } from 'fyo/utils/consts';
|
||||
import { RTL_LANGUAGES } from 'fyo/utils/consts';
|
||||
import { ModelNameEnum } from 'models/types';
|
||||
import { computed } from 'vue';
|
||||
import WindowsTitleBar from './components/WindowsTitleBar.vue';
|
||||
@ -69,12 +69,13 @@ export default {
|
||||
companyName: '',
|
||||
searcher: null,
|
||||
shortcuts: null,
|
||||
direction: 'ltr',
|
||||
languageDirection: 'ltr',
|
||||
language: '',
|
||||
};
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
languageDirection: computed(() => this.languageDirection),
|
||||
searcher: computed(() => this.searcher),
|
||||
shortcuts: computed(() => this.shortcuts),
|
||||
keys: computed(() => this.keys),
|
||||
@ -87,8 +88,10 @@ export default {
|
||||
WindowsTitleBar,
|
||||
},
|
||||
async mounted() {
|
||||
this.language = fyo.config.get("language");
|
||||
this.direction = RTL_LAGNUAGES.includes(this.language) ? 'rtl' : 'ltr';
|
||||
this.language = fyo.config.get('language');
|
||||
this.languageDirection = RTL_LANGUAGES.includes(this.language)
|
||||
? 'rtl'
|
||||
: 'ltr';
|
||||
this.shortcuts = new Shortcuts(this.keys);
|
||||
const lastSelectedFilePath = fyo.config.get(
|
||||
ConfigKeys.LastSelectedFilePath,
|
||||
|
@ -87,7 +87,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { Report } from 'reports/Report';
|
||||
import { FieldTypeEnum } from 'schemas/types';
|
||||
import { isNumeric } from 'src/utils';
|
||||
import { defineComponent } from 'vue';
|
||||
import Paginator from '../Paginator.vue';
|
||||
import WithScroll from '../WithScroll.vue';
|
||||
@ -95,8 +95,8 @@ import WithScroll from '../WithScroll.vue';
|
||||
export default defineComponent({
|
||||
props: {
|
||||
report: Report,
|
||||
direction: String,
|
||||
},
|
||||
inject: ['languageDirection'],
|
||||
data() {
|
||||
return {
|
||||
wconst: 8,
|
||||
@ -141,9 +141,14 @@ export default defineComponent({
|
||||
getCellStyle(cell, i) {
|
||||
const styles = {};
|
||||
const width = cell.width ?? 1;
|
||||
// const align = cell.align ?? this.direction == 'rtl' ? 'right' : 'left';
|
||||
|
||||
let align = cell.align ?? 'left';
|
||||
if (this.languageDirection === 'rtl') {
|
||||
align = this.languageDirection === 'rtl' ? 'right' : 'left';
|
||||
}
|
||||
|
||||
styles['width'] = `${width * this.wconst}rem`;
|
||||
styles['text-align'] = this.direction == 'rtl' ? 'right' : 'left';
|
||||
styles['text-align'] = align;
|
||||
|
||||
if (cell.bold) {
|
||||
styles['font-weight'] = 'bold';
|
||||
@ -154,36 +159,29 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
if (i === 0) {
|
||||
if(this.direction == 'rtl'){
|
||||
styles['padding-right'] = '0px';
|
||||
}else{
|
||||
if (this.languageDirection === 'rtl') {
|
||||
styles['padding-right'] = '0px';
|
||||
} else {
|
||||
styles['padding-left'] = '0px';
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!cell.align &&
|
||||
[
|
||||
FieldTypeEnum.Currency,
|
||||
FieldTypeEnum.Int,
|
||||
FieldTypeEnum.Float,
|
||||
].includes(cell.fieldtype)
|
||||
) {
|
||||
styles['text-align'] = this.direction == 'rtl' ? 'right' : 'left';
|
||||
if (!cell.align && isNumeric(cell.fieldtype)) {
|
||||
styles['text-align'] = 'right';
|
||||
}
|
||||
|
||||
if (i === this.report.columns.length - 1) {
|
||||
if(this.direction == 'rtl'){
|
||||
if (this.languageDirection === 'rtl') {
|
||||
styles['padding-left'] = '0px';
|
||||
}else{
|
||||
} else {
|
||||
styles['padding-right'] = '0px';
|
||||
}
|
||||
}
|
||||
|
||||
if (cell.indent) {
|
||||
if(this.direction == 'rtl'){
|
||||
if (this.languageDirection === 'rtl') {
|
||||
styles['padding-right'] = `${cell.indent * 2}rem`;
|
||||
}else{
|
||||
} else {
|
||||
styles['padding-left'] = `${cell.indent * 2}rem`;
|
||||
}
|
||||
}
|
||||
|
@ -196,8 +196,7 @@ import { openLink } from 'src/utils/ipcCalls';
|
||||
import { docsPathMap } from 'src/utils/misc';
|
||||
import { getGroupLabelMap, searchGroups } from 'src/utils/search';
|
||||
import { getModKeyCode } from 'src/utils/vueUtils';
|
||||
import { safeParseInt } from 'utils/index';
|
||||
import { nextTick, watch } from 'vue';
|
||||
import { nextTick } from 'vue';
|
||||
import Button from './Button.vue';
|
||||
import Modal from './Modal.vue';
|
||||
|
||||
|
@ -88,7 +88,7 @@
|
||||
items-center
|
||||
text-base
|
||||
"
|
||||
:style="getGroupStyle(account.level+1)"
|
||||
:style="getGroupStyle(account.level + 1)"
|
||||
:key="account.name + '-adding-account'"
|
||||
>
|
||||
<component
|
||||
@ -146,7 +146,6 @@ import { isCredit } from 'models/helpers';
|
||||
import { ModelNameEnum } from 'models/types';
|
||||
import PageHeader from 'src/components/PageHeader.vue';
|
||||
import { fyo } from 'src/initFyo';
|
||||
import { RTL_LAGNUAGES } from 'fyo/utils/consts';
|
||||
import { docsPathMap } from 'src/utils/misc';
|
||||
import { docsPath, openQuickEdit } from 'src/utils/ui';
|
||||
import { getMapFromList, removeAtIndex } from 'utils/index';
|
||||
@ -170,12 +169,10 @@ export default {
|
||||
insertingAccount: false,
|
||||
totals: {},
|
||||
refetchTotals: false,
|
||||
direction: 'ltr'
|
||||
};
|
||||
},
|
||||
inject: ['languageDirection'],
|
||||
async mounted() {
|
||||
const language = fyo.config.get("language");
|
||||
this.direction = RTL_LAGNUAGES.includes(language) ? 'rtl' : 'ltr';
|
||||
await this.setTotalDebitAndCredit();
|
||||
fyo.doc.observer.on('sync:AccountingLedgerEntry', () => {
|
||||
this.refetchTotals = true;
|
||||
@ -462,28 +459,28 @@ export default {
|
||||
template: icons[account.name] || icon,
|
||||
};
|
||||
},
|
||||
getItemStyle(level){
|
||||
getItemStyle(level) {
|
||||
const styles = {
|
||||
"height": "calc(var(--h-row-mid) + 1px)"
|
||||
height: 'calc(var(--h-row-mid) + 1px)',
|
||||
};
|
||||
if(this.direction == 'rtl'){
|
||||
if (this.languageDirection === 'rtl') {
|
||||
styles['padding-right'] = `calc(1rem + 2rem * ${level})`;
|
||||
}else{
|
||||
} else {
|
||||
styles['padding-left'] = `calc(1rem + 2rem * ${level})`;
|
||||
}
|
||||
return styles
|
||||
return styles;
|
||||
},
|
||||
getGroupStyle(level){
|
||||
getGroupStyle(level) {
|
||||
const styles = {
|
||||
"height": "height: calc(var(--h-row-mid) + 1px)"
|
||||
height: 'height: calc(var(--h-row-mid) + 1px)',
|
||||
};
|
||||
if(this.direction == 'rtl'){
|
||||
if (this.languageDirection === 'rtl') {
|
||||
styles['padding-right'] = `calc(1rem + 2rem * ${level})`;
|
||||
}else{
|
||||
} else {
|
||||
styles['padding-left'] = `calc(1rem + 2rem * ${level})`;
|
||||
}
|
||||
return styles
|
||||
}
|
||||
return styles;
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
allAccounts() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="text-base flex flex-col overflow-y-hidden">
|
||||
<div class="text-base flex flex-col overflow-hidden">
|
||||
<!-- Title Row -->
|
||||
<div
|
||||
class="flex items-center"
|
||||
|
@ -33,7 +33,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Report Body -->
|
||||
<ListReport v-if="report" :report="report" class="" :direction="direction" />
|
||||
<ListReport v-if="report" :report="report" class="" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -45,7 +45,6 @@ import DropdownWithActions from 'src/components/DropdownWithActions.vue';
|
||||
import PageHeader from 'src/components/PageHeader.vue';
|
||||
import ListReport from 'src/components/Report/ListReport.vue';
|
||||
import { fyo } from 'src/initFyo';
|
||||
import { RTL_LAGNUAGES } from 'fyo/utils/consts';
|
||||
import { docsPathMap } from 'src/utils/misc';
|
||||
import { docsPath } from 'src/utils/ui';
|
||||
import { defineComponent } from 'vue';
|
||||
@ -62,7 +61,6 @@ export default defineComponent({
|
||||
return {
|
||||
loading: false,
|
||||
report: null,
|
||||
direction: 'ltr',
|
||||
};
|
||||
},
|
||||
provide() {
|
||||
@ -106,7 +104,7 @@ export default defineComponent({
|
||||
acc[ac.group] ??= {
|
||||
group: ac.group,
|
||||
label: ac.label ?? '',
|
||||
e: ac.type,
|
||||
e: ac.type,
|
||||
actions: [],
|
||||
};
|
||||
|
||||
@ -119,8 +117,6 @@ export default defineComponent({
|
||||
},
|
||||
methods: {
|
||||
async setReportData() {
|
||||
const language = fyo.config.get("language");
|
||||
this.direction = RTL_LAGNUAGES.includes(language) ? 'rtl' : 'ltr';
|
||||
const Report = reports[this.reportClassName];
|
||||
|
||||
if (this.report === null) {
|
||||
|
@ -172,11 +172,11 @@ input[type='number']::-webkit-inner-spin-button {
|
||||
/*
|
||||
RTL
|
||||
*/
|
||||
|
||||
[dir="rtl"] .rtl-rotate-180{
|
||||
|
||||
[dir='rtl'] .rtl-rotate-180 {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
[dir="rtl"] .custom-scroll::-webkit-scrollbar-track:vertical {
|
||||
[dir='rtl'] .custom-scroll::-webkit-scrollbar-track:vertical {
|
||||
border-right: solid 1px theme('colors.gray.200');
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ export function getRouteData({ doc, uiname }: { doc?: Doc; uiname?: string }) {
|
||||
if (doc) {
|
||||
uiname = getUiName(doc);
|
||||
}
|
||||
console.log(uiname);
|
||||
|
||||
if (!uiname) {
|
||||
throw new ValueError(`Doc and uiname not passed to getFilters`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user