Fix TypeScript errors
This commit is contained in:
parent
42ba33c45c
commit
af47021e4f
@ -39,7 +39,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { db } from '../db.ts';
|
||||
import { DynamicReport } from '../reports/base.ts';
|
||||
import DynamicReportEntryComponent from './DynamicReportEntryComponent.vue';
|
||||
|
||||
|
@ -11,28 +11,29 @@
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
import { db } from '../db.ts';
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<template>
|
||||
<template v-if="entry.LiteralRow">
|
||||
<tr :class="entry.LiteralRow.bordered ? 'border-y border-gray-300' : null">
|
||||
<component :is="entry.LiteralRow.heading ? 'th' : 'td'" class="py-0.5 pr-1 text-gray-900 text-start" :class="{ 'font-semibold': entry.LiteralRow.heading }">
|
||||
<a :href="entry.LiteralRow.link" class="hover:text-blue-700 hover:underline" v-if="entry.LiteralRow.link !== null">{{ entry.LiteralRow.text }}</a>
|
||||
<template v-if="entry.LiteralRow.link === null">{{ entry.LiteralRow.text }}</template>
|
||||
<template v-if="literalRow">
|
||||
<tr :class="literalRow.bordered ? 'border-y border-gray-300' : null">
|
||||
<component :is="literalRow.heading ? 'th' : 'td'" class="py-0.5 pr-1 text-gray-900 text-start" :class="{ 'font-semibold': literalRow.heading }">
|
||||
<a :href="literalRow.link as string" class="hover:text-blue-700 hover:underline" v-if="literalRow.link !== null">{{ literalRow.text }}</a>
|
||||
<template v-if="literalRow.link === null">{{ literalRow.text }}</template>
|
||||
</component>
|
||||
<component :is="entry.LiteralRow.heading ? 'th' : 'td'" class="py-0.5 pl-1 text-gray-900 text-end" :class="{ 'font-semibold': entry.LiteralRow.heading }" v-html="(cell !== 0 || entry.LiteralRow.heading) ? ppBracketed(cell, entry.LiteralRow.link ?? undefined) : ''" v-for="cell of entry.LiteralRow.quantity">
|
||||
<component :is="literalRow.heading ? 'th' : 'td'" class="py-0.5 pl-1 text-gray-900 text-end" :class="{ 'font-semibold': literalRow.heading }" v-html="(cell !== 0 || literalRow.heading) ? ppBracketed(cell, literalRow.link ?? undefined) : ''" v-for="cell of literalRow.quantity">
|
||||
</component>
|
||||
</tr>
|
||||
</template>
|
||||
<template v-if="entry.Section">
|
||||
<tr v-if="entry.Section.text !== null">
|
||||
<th class="py-0.5 pr-1 text-gray-900 font-semibold text-start">{{ entry.Section.text }}</th>
|
||||
<template v-if="section">
|
||||
<tr v-if="section.text !== null">
|
||||
<th class="py-0.5 pr-1 text-gray-900 font-semibold text-start">{{ section.text }}</th>
|
||||
<th></th><!-- FIXME: Have correct colspan -->
|
||||
</tr>
|
||||
<DynamicReportEntryComponent :entry="child" v-for="child of entry.Section.entries" />
|
||||
<DynamicReportEntryComponent :entry="child" v-for="child of section.entries" />
|
||||
</template>
|
||||
<template v-if="entry == 'Spacer'">
|
||||
<tr><td colspan="2" class="py-0.5"> </td></tr><!-- FIXME: Have correct colspan -->
|
||||
@ -40,8 +41,17 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { ppBracketed } from '../display.ts';
|
||||
import { DynamicReportEntry } from '../reports/base.ts';
|
||||
import { DynamicReportEntry, LiteralRow, Section } from '../reports/base.ts';
|
||||
|
||||
const { entry } = defineProps<{ entry: DynamicReportEntry }>();
|
||||
|
||||
const literalRow = computed(function() {
|
||||
return (entry as { LiteralRow: LiteralRow }).LiteralRow;
|
||||
});
|
||||
const section = computed(function() {
|
||||
return (entry as { Section: Section }).Section;
|
||||
});
|
||||
</script>
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
import { ExclamationCircleIcon } from '@heroicons/vue/20/solid';
|
||||
|
||||
import { DynamicReport, reportEntryById } from './base.ts';
|
||||
import { DynamicReport, LiteralRow, reportEntryById } from './base.ts';
|
||||
import { db } from '../db.ts';
|
||||
import DynamicReportComponent from '../components/DynamicReportComponent.vue';
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
const compareUnit = ref('years');
|
||||
|
||||
async function load() {
|
||||
const session = await db.load();
|
||||
await db.load();
|
||||
|
||||
dt.value = db.metadata.eofy_date;
|
||||
|
||||
@ -103,9 +103,13 @@
|
||||
}
|
||||
|
||||
const doesBalance = computed(function() {
|
||||
const totalAssets = reportEntryById(report.value, 'total_assets').LiteralRow.quantity;
|
||||
const totalLiabilities = reportEntryById(report.value, 'total_liabilities').LiteralRow.quantity;
|
||||
const totalEquity = reportEntryById(report.value, 'total_equity').LiteralRow.quantity;
|
||||
if (report.value === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const totalAssets = (reportEntryById(report.value, 'total_assets') as { LiteralRow: LiteralRow }).LiteralRow.quantity;
|
||||
const totalLiabilities = (reportEntryById(report.value, 'total_liabilities') as { LiteralRow: LiteralRow }).LiteralRow.quantity;
|
||||
const totalEquity = (reportEntryById(report.value, 'total_equity') as { LiteralRow: LiteralRow }).LiteralRow.quantity;
|
||||
|
||||
let doesBalance = true;
|
||||
for (let column = 0; column < report.value.columns.length; column++) {
|
||||
|
@ -56,7 +56,7 @@
|
||||
const compareUnit = ref('years');
|
||||
|
||||
async function load() {
|
||||
const session = await db.load();
|
||||
await db.load();
|
||||
|
||||
dt.value = db.metadata.eofy_date;
|
||||
dtStart.value = dayjs(db.metadata.eofy_date).subtract(1, 'year').add(1, 'day').format('YYYY-MM-DD');
|
||||
|
Loading…
x
Reference in New Issue
Block a user