code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
<template>
<div class="text-sm">
<template v-for="df in formFields">
<!-- Table Field Form (Eg: PaymentFor) -->
<Table
v-if="df.fieldtype === 'Table'"
:key="`${df.fieldname}-table`"
ref="controls"
size="small"
:df="df"
:value="(doc[df.fieldname] ?? []) a... | 2302_79757062/books | src/components/TwoColumnForm.vue | Vue | agpl-3.0 | 3,956 |
<template>
<div
class="
relative
window-drag
flex
items-center
border-b
dark:bg-gray-900
text-gray-900
dark:text-gray-100
border-gray-100
dark:border-gray-800
"
style="height: 28px"
>
<Fb class="ms-2" />
<p v-if="companyName && dbPath" ... | 2302_79757062/books | src/components/WindowsTitleBar.vue | Vue | agpl-3.0 | 3,215 |
<template>
<div class="custom-scroll custom-scroll-thumb1">
<slot></slot>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
name: 'WithScroll',
emits: ['scroll'],
data() {
return { listener: undefined } as { listener?: () => void };
},
m... | 2302_79757062/books | src/components/WithScroll.vue | Vue | agpl-3.0 | 701 |
import { t } from 'fyo';
import type { Doc } from 'fyo/model/doc';
import { BaseError } from 'fyo/utils/errors';
import { ErrorLog } from 'fyo/utils/types';
import { truncate } from 'lodash';
import { showDialog } from 'src/utils/interactive';
import { fyo } from './initFyo';
import router from './router';
import { get... | 2302_79757062/books | src/errorHandling.ts | TypeScript | agpl-3.0 | 6,909 |
import { Fyo } from 'fyo';
import { Converter } from 'fyo/core/converter';
import { DocValue, DocValueMap } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc';
import { getEmptyValuesByFieldTypes } from 'fyo/utils';
import { ValidationError } from 'fyo/utils/errors';
import {
Field,
FieldType,
FieldTypeEn... | 2302_79757062/books | src/importer.ts | TypeScript | agpl-3.0 | 16,443 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Frappe Books</title>
</head>
<body></body>
<script type="module" src="./renderer.ts"></script>
... | 2302_79757062/books | src/index.html | HTML | agpl-3.0 | 328 |
import { Fyo } from 'fyo';
/**
* Global fyo: this is meant to be used only by the app. For
* testing purposes a separate instance of fyo should be initialized.
*/
export const fyo = new Fyo({ isTest: false, isElectron: true });
| 2302_79757062/books | src/initFyo.ts | TypeScript | agpl-3.0 | 233 |
<template>
<div class="flex flex-col h-full">
<PageHeader :title="t`Chart of Accounts`">
<Button v-if="!isAllExpanded" @click="expand">{{ t`Expand` }}</Button>
<Button v-if="!isAllCollapsed" @click="collapse">{{
t`Collapse`
}}</Button>
</PageHeader>
<!-- Chart of Accounts -->
... | 2302_79757062/books | src/pages/ChartOfAccounts.vue | Vue | agpl-3.0 | 20,869 |
<template>
<FormContainer :use-full-width="useFullWidth">
<template v-if="hasDoc" #header-left>
<Barcode
v-if="canShowBarcode"
class="h-8"
@item-selected="(name:string) => {
// @ts-ignore
doc?.addItem(name);
}"
/>
<ExchangeRate
v-if="ca... | 2302_79757062/books | src/pages/CommonForm/CommonForm.vue | Vue | agpl-3.0 | 13,296 |
<template>
<div v-if="(fields ?? []).length > 0">
<div
v-if="showTitle && title"
class="flex justify-between items-center select-none"
:class="[collapsed ? '' : 'mb-4', collapsible ? 'cursor-pointer' : '']"
@click="toggleCollapsed"
>
<h2 class="text-base text-gray-900 dark:text-g... | 2302_79757062/books | src/pages/CommonForm/CommonFormSection.vue | Vue | agpl-3.0 | 3,523 |
<template>
<div
class="
w-quick-edit
bg-white
dark:bg-gray-850
border-l
dark:border-gray-800
overflow-y-auto
custom-scroll custom-scroll-thumb2
"
>
<!-- Page Header -->
<div
class="
flex
items-center
justify-between
px-4... | 2302_79757062/books | src/pages/CommonForm/LinkedEntries.vue | Vue | agpl-3.0 | 9,693 |
<template>
<div
class="
border-s
dark:border-gray-800
h-full
overflow-auto
w-quick-edit
bg-white
dark:bg-gray-890
custom-scroll custom-scroll-thumb2
"
>
<!-- Row Edit Tool bar -->
<div
class="
sticky
top-0
border-b
... | 2302_79757062/books | src/pages/CommonForm/RowEditForm.vue | Vue | agpl-3.0 | 3,501 |
<template>
<div>
<PageHeader :title="t`Customize Form`">
<DropdownWithActions :actions="[]" :disabled="false" :title="t`More`" />
<Button :title="t`Save Customizations`" type="primary">
{{ t`Save` }}
</Button>
</PageHeader>
<div class="flex text-base w-full flex-col">
<!-- ... | 2302_79757062/books | src/pages/CustomizeForm/CustomizeForm.vue | Vue | agpl-3.0 | 2,787 |
<script lang="ts">
import { PeriodKey } from 'src/utils/types';
import { PropType } from 'vue';
import { defineComponent } from 'vue';
export default defineComponent({
props: {
commonPeriod: { type: String as PropType<PeriodKey>, default: 'This Year' },
},
emits: ['period-change'],
data() {
return {
... | 2302_79757062/books | src/pages/Dashboard/BaseDashboardChart.vue | Vue | agpl-3.0 | 889 |
<template>
<div>
<!-- Title and Period Selector -->
<div class="flex items-center justify-between">
<div class="font-semibold text-base dark:text-white">
{{ t`Cashflow` }}
</div>
<!-- Chart Legend -->
<div v-if="hasData" class="flex text-base gap-8">
<div class="flex i... | 2302_79757062/books | src/pages/Dashboard/Cashflow.vue | Vue | agpl-3.0 | 5,250 |
<template>
<div class="h-screen" style="width: var(--w-desk)">
<PageHeader :title="t`Dashboard`">
<div
class="
border
dark:border-gray-900
rounded
bg-gray-50
dark:bg-gray-890
focus-within:bg-gray-100
dark:focus-within:bg-gray-900
... | 2302_79757062/books | src/pages/Dashboard/Dashboard.vue | Vue | agpl-3.0 | 2,989 |
<template>
<div class="flex flex-col h-full">
<SectionHeader>
<template #title>{{ t`Top Expenses` }}</template>
<template #action>
<PeriodSelector :value="period" @change="(value) => (period = value)" />
</template>
</SectionHeader>
<div v-show="hasData" class="flex relative">
... | 2302_79757062/books | src/pages/Dashboard/Expenses.vue | Vue | agpl-3.0 | 4,678 |
<template>
<Dropdown ref="dropdown" class="text-sm" :items="periodOptions" right>
<template
#default="{
toggleDropdown,
highlightItemUp,
highlightItemDown,
selectHighlightedItem,
}"
>
<div
class="
text-sm
flex
focus:outlin... | 2302_79757062/books | src/pages/Dashboard/PeriodSelector.vue | Vue | agpl-3.0 | 2,447 |
<template>
<div class="flex flex-col h-full">
<SectionHeader>
<template #title>{{ t`Profit and Loss` }}</template>
<template #action>
<PeriodSelector
:value="period"
:options="periodOptions"
@change="(value) => (period = value)"
/>
</template>
</... | 2302_79757062/books | src/pages/Dashboard/ProfitAndLoss.vue | Vue | agpl-3.0 | 3,653 |
<template>
<div class="flex items-baseline justify-between dark:text-white">
<span class="font-semibold text-base"><slot name="title"></slot></span>
<slot name="action"></slot>
</div>
</template>
| 2302_79757062/books | src/pages/Dashboard/SectionHeader.vue | Vue | agpl-3.0 | 208 |
<template>
<div class="flex-col justify-between w-full p-4">
<!-- Title and Period Selector -->
<SectionHeader>
<template #title>{{ title }}</template>
<template #action>
<PeriodSelector :value="period" @change="(value) => (period = value)" />
</template>
</SectionHeader>
<!... | 2302_79757062/books | src/pages/Dashboard/UnpaidInvoices.vue | Vue | agpl-3.0 | 7,422 |
<template>
<div
class="flex-1 flex justify-center items-center bg-gray-25 dark:bg-gray-900"
:class="{
'pointer-events-none': loadingDatabase,
'window-drag': platform !== 'Windows',
}"
>
<div
class="
w-full w-form
shadow-lg
rounded-lg
border
d... | 2302_79757062/books | src/pages/DatabaseSelector.vue | Vue | agpl-3.0 | 12,554 |
<script setup lang="ts">
import { showSidebar } from 'src/utils/refs';
import { toggleSidebar } from 'src/utils/ui';
</script>
<template>
<div class="flex overflow-hidden">
<Transition name="sidebar">
<!-- eslint-disable vue/require-explicit-emits -->
<Sidebar
v-show="showSidebar"
clas... | 2302_79757062/books | src/pages/Desk.vue | Vue | agpl-3.0 | 2,647 |
<template>
<div class="flex flex-col overflow-y-hidden">
<PageHeader :title="t`Set Up Your Workspace`" />
<div
class="
flex-1
overflow-y-auto overflow-x-hidden
custom-scroll custom-scroll-thumb1
"
>
<div
v-for="section in sections"
:key="section.la... | 2302_79757062/books | src/pages/GetStarted.vue | Vue | agpl-3.0 | 7,304 |
<template>
<div class="flex flex-col overflow-hidden w-full">
<!-- Header -->
<PageHeader :title="t`Import Wizard`">
<DropdownWithActions
v-if="hasImporter"
:actions="actions"
:disabled="isMakingEntries"
:title="t`More`"
/>
<Button
v-if="hasImporter"
... | 2302_79757062/books | src/pages/ImportWizard.vue | Vue | agpl-3.0 | 28,773 |
<template>
<div class="text-base flex flex-col overflow-hidden">
<!-- Title Row -->
<div
class="flex items-center"
:style="{
paddingRight: dataSlice.length > 13 ? 'var(--w-scrollbar)' : '',
}"
>
<p class="w-8 text-end me-4 text-gray-700 dark:text-gray-400">#</p>
<Row
... | 2302_79757062/books | src/pages/ListView/List.vue | Vue | agpl-3.0 | 6,349 |
<template>
<div class="flex items-center truncate" :class="cellClass">
<span v-if="!customRenderer" class="truncate">{{ columnValue }}</span>
<component :is="(customRenderer as {})" v-else />
</div>
</template>
<script lang="ts">
import { ColumnConfig, RenderData } from 'fyo/model/types';
import { Field } f... | 2302_79757062/books | src/pages/ListView/ListCell.vue | Vue | agpl-3.0 | 1,428 |
<template>
<div class="flex flex-col">
<PageHeader :title="title">
<Button ref="exportButton" :icon="false" @click="openExportModal = true">
{{ t`Export` }}
</Button>
<FilterDropdown
ref="filterDropdown"
:schema-name="schemaName"
@change="applyFilter"
/>
... | 2302_79757062/books | src/pages/ListView/ListView.vue | Vue | agpl-3.0 | 4,930 |
<template>
<Modal :open-modal="openModal" class="w-3/6 p-4">
<h1 class="text-xl font-semibold text-center dark:text-gray-100 pb-4">
Close POS Shift
</h1>
<h2 class="mt-4 mb-2 text-lg font-medium dark:text-gray-100">
Closing Cash
</h2>
<Table
v-if="isValuesSeeded"
class="te... | 2302_79757062/books | src/pages/POS/ClosePOSShiftModal.vue | Vue | agpl-3.0 | 5,851 |
<template>
<Modal class="w-3/6 p-4">
<h1 class="text-xl font-semibold text-center dark:text-gray-100 pb-4">
Open POS Shift
</h1>
<div class="grid grid-cols-12 gap-6">
<div class="col-span-6">
<h2 class="text-lg font-medium dark:text-gray-100">
Cash In Denominations
<... | 2302_79757062/books | src/pages/POS/OpenPOSShiftModal.vue | Vue | agpl-3.0 | 6,192 |
<template>
<div class="">
<PageHeader :title="t`Point of Sale`">
<slot>
<Button
class="bg-red-500 dark:bg-red-700"
@click="toggleModal('ShiftClose')"
>
<span class="font-medium text-white">{{ t`Close POS Shift ` }}</span>
</Button>
</slot>
</Pa... | 2302_79757062/books | src/pages/POS/POS.vue | Vue | agpl-3.0 | 19,147 |
<template>
<Modal class="w-2/6 ml-auto mr-3.5" :set-close-listener="false">
<div v-if="sinvDoc.fieldMap" class="px-4 py-6 grid" style="height: 95vh">
<div class="grid grid-cols-2 gap-6">
<Currency
:df="fyo.fieldMap.PaymentFor.amount"
:read-only="!transferAmount.isZero()"
... | 2302_79757062/books | src/pages/POS/PaymentModal.vue | Vue | agpl-3.0 | 8,931 |
<template>
<div class="flex flex-col flex-1 bg-gray-25 dark:bg-gray-875">
<PageHeader :border="true" :title="t`Print View`">
<AutoComplete
v-if="templateList.length"
:df="{
fieldtype: 'AutoComplete',
fieldname: 'templateName',
label: t`Template Name`,
... | 2302_79757062/books | src/pages/PrintView/PrintView.vue | Vue | agpl-3.0 | 7,600 |
<template>
<div class="flex flex-col w-full h-full">
<PageHeader :title="t`Print ${title}`">
<Button class="text-xs" type="primary" @click="savePDF">
{{ t`Save as PDF` }}
</Button>
</PageHeader>
<div
class="outer-container overflow-y-auto custom-scroll custom-scroll-thumb1"
... | 2302_79757062/books | src/pages/PrintView/ReportPrintView.vue | Vue | agpl-3.0 | 9,629 |
<template>
<div
class="
border-s
dark:border-gray-800
h-full
overflow-auto
w-quick-edit
bg-white
dark:bg-gray-850
"
>
<!-- Quick edit Tool bar -->
<div
class="
flex
items-center
justify-between
px-4
h-row-largest... | 2302_79757062/books | src/pages/QuickEditForm.vue | Vue | agpl-3.0 | 6,458 |
<template>
<div class="flex flex-col w-full h-full">
<PageHeader :title="title">
<DropdownWithActions
v-for="group of groupedActions"
:key="group.label"
:icon="false"
:type="group.type"
:actions="group.actions"
class="text-xs"
>
{{ group.group }}... | 2302_79757062/books | src/pages/Report.vue | Vue | agpl-3.0 | 4,553 |
<template>
<FormContainer>
<template #header>
<Button v-if="canSave" type="primary" @click="sync">
{{ t`Save` }}
</Button>
</template>
<template #body>
<FormHeader
:form-title="tabLabels[activeTab] ?? ''"
:form-sub-title="t`Settings`"
class="
sti... | 2302_79757062/books | src/pages/Settings/Settings.vue | Vue | agpl-3.0 | 8,777 |
<template>
<FormContainer
:show-header="false"
class="justify-content items-center h-full"
:class="{ 'window-drag': platform !== 'Windows' }"
>
<template #body>
<FormHeader
:form-title="t`Set up your organization`"
class="
sticky
top-0
bg-white
... | 2302_79757062/books | src/pages/SetupWizard/SetupWizard.vue | Vue | agpl-3.0 | 6,049 |
<template>
<ScaledContainer
ref="scaledContainer"
:scale="Math.max(scale, 0.1)"
:width="width"
:height="height"
class="mx-auto shadow-lg border"
>
<ErrorBoundary
v-if="!error"
:propagate="false"
@error-captured="handleErrorCaptured"
>
<!-- Template -->
<comp... | 2302_79757062/books | src/pages/TemplateBuilder/PrintContainer.vue | Vue | agpl-3.0 | 5,112 |
<template>
<div class="overflow-hidden" :style="outerContainerStyle">
<div
:style="innerContainerStyle"
:class="showOverflow ? 'overflow-auto no-scrollbar' : ''"
>
<slot></slot>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
/**
* This Component i... | 2302_79757062/books | src/pages/TemplateBuilder/ScaledContainer.vue | Vue | agpl-3.0 | 1,531 |
<template>
<div class="w-form">
<FormHeader :form-title="t`Set Print Size`" />
<hr class="dark:border-gray-800" />
<div class="p-4 w-full flex flex-col gap-4">
<p class="text-base text-gray-900 dark:text-gray-100">
{{
t`Select a pre-defined page size, or set a custom page size for ... | 2302_79757062/books | src/pages/TemplateBuilder/SetPrintSize.vue | Vue | agpl-3.0 | 3,061 |
<template>
<div class="w-form">
<FormHeader :form-title="t`Set Print Size`" />
<hr class="dark:border-gray-800" />
<div class="p-4 w-full flex flex-col gap-4">
<p class="text-base text-gray-900 dark:text-gray-100">
{{ t`Select the template type.` }}
</p>
<Select
:df="df"
... | 2302_79757062/books | src/pages/TemplateBuilder/SetType.vue | Vue | agpl-3.0 | 1,751 |
<template>
<div>
<PageHeader :title="doc && doc.inserted ? doc.name : ''">
<!-- Template Name -->
<template v-if="doc && !doc.inserted" #left>
<FormControl
ref="nameField"
class="w-60 flex-shrink-0"
size="small"
:input-class="['font-semibold text-xl']"
... | 2302_79757062/books | src/pages/TemplateBuilder/TemplateBuilder.vue | Vue | agpl-3.0 | 21,177 |
<template>
<div :class="level > 0 ? 'ms-2 ps-2 border-l dark:border-gray-800' : ''">
<template v-for="r of rows" :key="r.key">
<div
class="
flex
gap-2
text-sm text-gray-600
dark:text-gray-400
whitespace-nowrap
overflow-auto
no-scr... | 2302_79757062/books | src/pages/TemplateBuilder/TemplateBuilderHint.vue | Vue | agpl-3.0 | 3,092 |
<template>
<div
ref="container"
class="bg-white dark:bg-gray-875 text-gray-900 dark:text-gray-100"
></div>
</template>
<script lang="ts">
import { autocompletion, CompletionContext } from '@codemirror/autocomplete';
import { vue } from '@codemirror/lang-vue';
import {
HighlightStyle,
syntaxHighlighting,... | 2302_79757062/books | src/pages/TemplateBuilder/TemplateEditor.vue | Vue | agpl-3.0 | 6,494 |
import { Fyo } from 'fyo';
export type TaxType = 'GST' | 'IGST' | 'Exempt-GST' | 'Exempt-IGST';
export async function createIndianRecords(fyo: Fyo) {
await createTaxes(fyo);
}
async function createTaxes(fyo: Fyo) {
const GSTs = {
GST: [28, 18, 12, 6, 5, 3, 0.25, 0],
IGST: [28, 18, 12, 6, 5, 3, 0.25, 0],
... | 2302_79757062/books | src/regional/in/in.ts | TypeScript | agpl-3.0 | 1,019 |
import { Fyo } from 'fyo';
import { createIndianRecords } from './in/in';
export async function createRegionalRecords(country: string, fyo: Fyo) {
if (country === 'India') {
await createIndianRecords(fyo);
}
return;
}
| 2302_79757062/books | src/regional/index.ts | TypeScript | agpl-3.0 | 230 |
import { Directive } from 'vue';
type OutsideClickCallback = (e: Event) => void;
const instanceMap: Map<HTMLElement, OutsideClickCallback> = new Map();
export const outsideClickDirective: Directive<
HTMLElement,
OutsideClickCallback
> = {
beforeMount(el, binding) {
const clickHandler = function (e: Event) {... | 2302_79757062/books | src/renderer/helpers.ts | TypeScript | agpl-3.0 | 963 |
import { handleError } from 'src/errorHandling';
import { fyo } from 'src/initFyo';
export default function registerIpcRendererListeners() {
ipc.registerMainProcessErrorListener(
(_, error: unknown, more?: Record<string, unknown>) => {
if (!(error instanceof Error)) {
throw error;
}
if... | 2302_79757062/books | src/renderer/registerIpcRendererListeners.ts | TypeScript | agpl-3.0 | 1,252 |
import { CUSTOM_EVENTS } from 'utils/messages';
import { UnexpectedLogObject } from 'utils/types';
import { App as VueApp, createApp } from 'vue';
import App from './App.vue';
import Badge from './components/Badge.vue';
import FeatherIcon from './components/FeatherIcon.vue';
import { handleError, sendError } from './er... | 2302_79757062/books | src/renderer.ts | TypeScript | agpl-3.0 | 3,576 |
import ChartOfAccounts from 'src/pages/ChartOfAccounts.vue';
import CommonForm from 'src/pages/CommonForm/CommonForm.vue';
import Dashboard from 'src/pages/Dashboard/Dashboard.vue';
import GetStarted from 'src/pages/GetStarted.vue';
import ImportWizard from 'src/pages/ImportWizard.vue';
import ListView from 'src/pages/... | 2302_79757062/books | src/router.ts | TypeScript | agpl-3.0 | 3,767 |
import { Fyo } from 'fyo';
import {
AccountRootType,
COAChildAccount,
COARootAccount,
COATree,
} from 'models/baseModels/Account/types';
import { getCOAList } from 'models/baseModels/SetupWizard/SetupWizard';
import { getStandardCOA } from './standardCOA';
const accountFields = ['accountType', 'accountNumber',... | 2302_79757062/books | src/setup/createCOA.ts | TypeScript | agpl-3.0 | 2,777 |
import { Fyo } from 'fyo';
import { DocValueMap } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc';
import { createNumberSeries } from 'fyo/model/naming';
import {
DEFAULT_CURRENCY,
DEFAULT_LOCALE,
DEFAULT_SERIES_START,
} from 'fyo/utils/consts';
import {
AccountRootTypeEnum,
AccountTypeEnum,
} from... | 2302_79757062/books | src/setup/setupInstance.ts | TypeScript | agpl-3.0 | 10,481 |
import { t } from 'fyo';
import { COATree } from 'models/baseModels/Account/types';
export function getStandardCOA(): COATree {
return {
[t`Application of Funds (Assets)`]: {
[t`Current Assets`]: {
[t`Accounts Receivable`]: {
[t`Debtors`]: {
accountType: 'Receivable',
... | 2302_79757062/books | src/setup/standardCOA.ts | TypeScript | agpl-3.0 | 4,624 |
export interface SetupWizardOptions {
logo: string | null;
companyName: string;
country: string;
fullname: string;
email: string;
bankName: string;
currency: string;
fiscalYearStart: string;
fiscalYearEnd: string;
chartOfAccounts: string;
}
| 2302_79757062/books | src/setup/types.ts | TypeScript | agpl-3.0 | 261 |
@font-face {
font-family: 'Inter';
font-weight: 100 900;
font-display: swap;
font-style: oblique 0deg 10deg;
src: url('../assets/fonts/Inter.var.woff2') format('woff2');
}
* {
outline-color: theme('colors.pink.400');
font-variation-settings: 'slnt' 0deg;
}
.italic {
font-variation-settings: 'slnt' 10de... | 2302_79757062/books | src/styles/index.css | CSS | agpl-3.0 | 4,668 |
import { DateTime } from 'luxon';
export function prefixFormat(value: number): string {
/*
1,000000,000,000,000,000 = 1 P (Pentillion)
1000,000,000,000,000 = 1 Q (Quadrillion)
1000,000,000,000 = 1 T (Trillion)
1000,000,000 = 1 B (Billion)
1000,000 = 1 M (Million)
... | 2302_79757062/books | src/utils/chart.ts | TypeScript | agpl-3.0 | 1,738 |
import colors from '../../colors.json';
export const uicolors = colors;
export const indicators = {
GRAY: 'grey',
GREY: 'grey',
BLUE: 'blue',
RED: 'red',
GREEN: 'green',
ORANGE: 'orange',
PURPLE: 'purple',
YELLOW: 'yellow',
BLACK: 'black',
};
const getValidColor = (color: string) => {
const isVali... | 2302_79757062/books | src/utils/colors.ts | TypeScript | agpl-3.0 | 1,198 |
import { Fyo, t } from 'fyo';
type Conn = {
countryCode: string;
error?: Error;
actionSymbol?: typeof dbErrorActionSymbols[keyof typeof dbErrorActionSymbols];
};
export const dbErrorActionSymbols = {
SelectFile: Symbol('select-file'),
CancelSelection: Symbol('cancel-selection'),
} as const;
const dbErrors ... | 2302_79757062/books | src/utils/db.ts | TypeScript | agpl-3.0 | 2,238 |
import { Doc } from 'fyo/model/doc';
import { DynamicLinkField, Field, TargetField } from 'schemas/types';
import { GetAllOptions } from 'utils/db/types';
export function evaluateReadOnly(field: Field, doc?: Doc) {
if (doc?.inserted && field.fieldname === 'numberSeries') {
return true;
}
if (
field.fiel... | 2302_79757062/books | src/utils/doc.ts | TypeScript | agpl-3.0 | 4,070 |
import { Fyo } from 'fyo';
import { RawValueMap } from 'fyo/core/types';
import {
Field,
FieldType,
FieldTypeEnum,
RawValue,
TargetField,
} from 'schemas/types';
import { generateCSV } from 'utils/csvParser';
import { GetAllOptions, QueryFilter } from 'utils/db/types';
import { getMapFromList, safeParseFloat ... | 2302_79757062/books | src/utils/export.ts | TypeScript | agpl-3.0 | 8,480 |
import { ModelNameEnum } from 'models/types';
export const routeFilters = {
SalesItems: { for: ['in', ['Sales', 'Both']] },
PurchaseItems: { for: ['in', ['Purchases', 'Both']] },
Items: { for: 'Both' },
PurchasePayments: {
referenceType: ModelNameEnum.PurchaseInvoice,
},
SalesPayments: {
referenceT... | 2302_79757062/books | src/utils/filters.ts | TypeScript | agpl-3.0 | 812 |
import { t } from 'fyo';
import { ModelNameEnum } from 'models/types';
import { openSettings, routeTo } from './ui';
import { GetStartedConfigItem } from './types';
export function getGetStartedConfig(): GetStartedConfigItem[] {
/* eslint-disable @typescript-eslint/no-misused-promises */
return [
{
label... | 2302_79757062/books | src/utils/getStartedConfig.ts | TypeScript | agpl-3.0 | 5,405 |
/**
* General purpose utils used by the frontend.
*/
import { t } from 'fyo';
import { Doc } from 'fyo/model/doc';
import { isPesa } from 'fyo/utils';
import {
BaseError,
DuplicateEntryError,
LinkValidationError,
} from 'fyo/utils/errors';
import { Field, FieldType, FieldTypeEnum, NumberField } from 'schemas/ty... | 2302_79757062/books | src/utils/index.ts | TypeScript | agpl-3.0 | 3,405 |
import { Fyo } from 'fyo';
import { ConfigFile } from 'fyo/core/types';
import { getRegionalModels, models } from 'models/index';
import { ModelNameEnum } from 'models/types';
import { TargetField } from 'schemas/types';
import {
getMapFromList,
getRandomString,
getValueMapFromList,
} from 'utils/index';
export ... | 2302_79757062/books | src/utils/initialization.ts | TypeScript | agpl-3.0 | 4,969 |
import type { InjectionKey, Ref } from 'vue';
import type { Search } from './search';
import type { Shortcuts } from './shortcuts';
import type { useKeys } from './vueUtils';
export const languageDirectionKey = Symbol('languageDirection') as InjectionKey<
Ref<'ltr' | 'rtl'>
>;
export const keysKey = Symbol('keys') ... | 2302_79757062/books | src/utils/injectionKeys.ts | TypeScript | agpl-3.0 | 534 |
import { t } from 'fyo';
import Dialog from 'src/components/Dialog.vue';
import Toast from 'src/components/Toast.vue';
import { App, createApp, h } from 'vue';
import { getColorClass } from './colors';
import { DialogButton, DialogOptions, ToastOptions, ToastType } from './types';
export async function showDialog<DO e... | 2302_79757062/books | src/utils/interactive.ts | TypeScript | agpl-3.0 | 2,013 |
import { DEFAULT_LANGUAGE } from 'fyo/utils/consts';
import { setLanguageMapOnTranslationString } from 'fyo/utils/translation';
import { fyo } from 'src/initFyo';
import { systemLanguageRef } from './refs';
// Language: Language Code in books/translations
export const languageCodeMap: Record<string, string> = {
Arab... | 2302_79757062/books | src/utils/language.ts | TypeScript | agpl-3.0 | 1,995 |
import { Fyo } from 'fyo';
import { ConfigFile } from 'fyo/core/types';
import { translateSchema } from 'fyo/utils/translation';
import { cloneDeep } from 'lodash';
import { DateTime } from 'luxon';
import { SetupWizard } from 'models/baseModels/SetupWizard/SetupWizard';
import { ModelNameEnum } from 'models/types';
im... | 2302_79757062/books | src/utils/misc.ts | TypeScript | agpl-3.0 | 5,702 |
import { Fyo, t } from 'fyo';
import { ValidationError } from 'fyo/utils/errors';
import { AccountTypeEnum } from 'models/baseModels/Account/types';
import { Item } from 'models/baseModels/Item/Item';
import { SalesInvoice } from 'models/baseModels/SalesInvoice/SalesInvoice';
import { SalesInvoiceItem } from 'models/ba... | 2302_79757062/books | src/utils/pos.ts | TypeScript | agpl-3.0 | 8,064 |
import { Fyo, t } from 'fyo';
import { Doc } from 'fyo/model/doc';
import { Invoice } from 'models/baseModels/Invoice/Invoice';
import { ModelNameEnum } from 'models/types';
import { FieldTypeEnum, Schema, TargetField } from 'schemas/types';
import { getValueMapFromList } from 'utils/index';
import { TemplateFile } fro... | 2302_79757062/books | src/utils/printTemplates.ts | TypeScript | agpl-3.0 | 10,224 |
import { reactive, ref } from 'vue';
import type { HistoryState } from 'vue-router';
export const showSidebar = ref(true);
export const docsPathRef = ref<string>('');
export const systemLanguageRef = ref<string>('');
export const historyState = reactive({
forward: !!(history.state as HistoryState)?.forward,
back: ... | 2302_79757062/books | src/utils/refs.ts | TypeScript | agpl-3.0 | 365 |
import { Fyo, t } from 'fyo';
import { RawValueMap } from 'fyo/core/types';
import { groupBy } from 'lodash';
import { ModelNameEnum } from 'models/types';
import { reports } from 'reports';
import { OptionField } from 'schemas/types';
import { createFilters, routeFilters } from 'src/utils/filters';
import { GetAllOpti... | 2302_79757062/books | src/utils/search.ts | TypeScript | agpl-3.0 | 22,934 |
import { Keys } from 'utils/types';
import { watch } from 'vue';
import { getIsMac } from './misc';
interface ModMap {
alt: boolean;
ctrl: boolean;
meta: boolean;
shift: boolean;
repeat: boolean;
}
type Mod = keyof ModMap;
type Context = unknown;
type ShortcutFunction = () => unknown;
type ShortcutConfig = ... | 2302_79757062/books | src/utils/shortcuts.ts | TypeScript | agpl-3.0 | 5,689 |
import { t } from 'fyo';
import { routeFilters } from 'src/utils/filters';
import { fyo } from '../initFyo';
import { SidebarConfig, SidebarItem, SidebarRoot } from './types';
export function getSidebarConfig(): SidebarConfig {
const sideBar = getCompleteSidebar();
return getFilteredSidebar(sideBar);
}
function g... | 2302_79757062/books | src/utils/sidebarConfig.ts | TypeScript | agpl-3.0 | 8,522 |
export function setDarkMode(darkMode: boolean): void {
if (darkMode) {
document.documentElement.classList.add(
'dark',
'custom-scroll',
'custom-scroll-thumb1'
);
return;
}
document.documentElement.classList.remove('dark');
}
| 2302_79757062/books | src/utils/theme.ts | TypeScript | agpl-3.0 | 261 |
import type { Doc } from 'fyo/model/doc';
import type { Action } from 'fyo/model/types';
import type { ModelNameEnum } from 'models/types';
import type { Field, FieldType } from 'schemas/types';
import type { QueryFilter } from 'utils/db/types';
import type { Ref } from 'vue';
import type { toastDurationMap } from './u... | 2302_79757062/books | src/utils/types.ts | TypeScript | agpl-3.0 | 2,942 |
/**
* Utils to do UI stuff such as opening dialogs, toasts, etc.
* Basically anything that may directly or indirectly import a Vue file.
*/
import { t } from 'fyo';
import type { Doc } from 'fyo/model/doc';
import { Action } from 'fyo/model/types';
import { getActions } from 'fyo/utils';
import {
BaseError,
getD... | 2302_79757062/books | src/utils/ui.ts | TypeScript | agpl-3.0 | 21,966 |
import { Keys } from 'utils/types';
import {
onActivated,
onDeactivated,
onMounted,
onUnmounted,
reactive,
ref,
} from 'vue';
import { getIsMac } from './misc';
import { Shortcuts } from './shortcuts';
import { DocRef } from './types';
import {
commonDocCancel,
commonDocSubmit,
commonDocSync,
common... | 2302_79757062/books | src/utils/vueUtils.ts | TypeScript | agpl-3.0 | 3,944 |
const fs = require('fs');
const colors = JSON.parse(
fs.readFileSync('colors.json', { encoding: 'utf-8' })
);
module.exports = {
darkMode: 'class',
purge: false,
theme: {
fontFamily: {
sans: ['Inter', 'sans-serif'],
},
screens: {
sm: '640px',
md: '768px',
lg: '1024px',
... | 2302_79757062/books | tailwind.config.js | JavaScript | agpl-3.0 | 1,796 |
<main class="bg-white h-full px-6" :style="{ 'font-family': print.font }">
<!-- Invoice Header -->
<header class="py-6 flex text-sm text-gray-900 border-b">
<!-- Company Logo & Name -->
<section class="w-1/3">
<img
v-if="print.displayLogo"
class="h-12 max-w-32 object-contain"
:... | 2302_79757062/books | templates/Basic.template.html | HTML | agpl-3.0 | 4,338 |
<main class="bg-white h-full" :style="{ 'font-family': print.font }">
<!-- Invoice Header -->
<header class="bg-gray-100 px-12 py-10">
<!-- Company Details -->
<section class="flex items-center">
<img
v-if="print.displayLogo"
class="h-12 max-w-32 object-contain mr-4"
:src="prin... | 2302_79757062/books | templates/Business.template.html | HTML | agpl-3.0 | 4,296 |
<main class="h-full" :style="{ 'font-family': print.font }">
<!-- Invoice Header -->
<header class="flex items-center justify-between w-full border-b px-12 py-10">
<!-- Left Section -->
<section class="flex items-center">
<img
v-if="print.displayLogo"
class="h-12 max-w-32 object-contai... | 2302_79757062/books | templates/Minimal.template.html | HTML | agpl-3.0 | 4,898 |
import { DatabaseManager } from 'backend/database/manager';
import { config } from 'dotenv';
import { Fyo } from 'fyo';
import { DummyAuthDemux } from 'fyo/tests/helpers';
import { DateTime } from 'luxon';
import path from 'path';
import setupInstance from 'src/setup/setupInstance';
import { SetupWizardOptions } from '... | 2302_79757062/books | tests/helpers.ts | TypeScript | agpl-3.0 | 2,213 |
import path from 'path';
import { _electron } from 'playwright';
import { fileURLToPath } from 'url';
import test from 'tape';
const dirname = path.dirname(fileURLToPath(import.meta.url));
const root = path.join(dirname, '..');
const appSourcePath = path.join(root, 'dist_electron', 'build', 'main.js');
(async functio... | 2302_79757062/books | uitest/index.mjs | JavaScript | agpl-3.0 | 2,742 |
import { Creds } from 'utils/types';
export abstract class AuthDemuxBase {
abstract getCreds(): Promise<Creds>;
}
| 2302_79757062/books | utils/auth/types.ts | TypeScript | agpl-3.0 | 117 |
import Store from 'electron-store';
import type { ConfigMap } from 'fyo/core/types';
const config = new Store<ConfigMap>();
export default config;
| 2302_79757062/books | utils/config.ts | TypeScript | agpl-3.0 | 148 |
export function parseCSV(text: string): string[][] {
// Works on RFC 4180 csv
let rows = splitCsvBlock(text);
if (rows.length === 1) {
rows = splitCsvBlock(text, '\n');
}
return rows.map(splitCsvLine);
}
export function generateCSV(matrix: unknown[][]): string {
// Generates RFC 4180 csv
const forma... | 2302_79757062/books | utils/csvParser.ts | TypeScript | agpl-3.0 | 2,823 |
/**
* The types in this file will be used by the main db class (core.ts) in the
* backend process and the the frontend db class (dbHandler.ts).
*
* DatabaseBase is an abstract class so that the function signatures
* match on both ends i.e. DatabaseCore and DatabaseHandler.
*/
import { SchemaMap } from 'schemas/t... | 2302_79757062/books | utils/db/types.ts | TypeScript | agpl-3.0 | 3,011 |
import { Fyo } from 'fyo';
export function getDefaultUOMs(fyo: Fyo) {
return [
{
name: fyo.t`Unit`,
isWhole: true,
},
{
name: fyo.t`Kg`,
isWhole: false,
},
{
name: fyo.t`Gram`,
isWhole: false,
},
{
name: fyo.t`Meter`,
isWhole: false,
},
... | 2302_79757062/books | utils/defaults.ts | TypeScript | agpl-3.0 | 533 |
import type { Fyo } from 'fyo';
import { Money } from 'pesa';
/**
* And so should not contain and platforma specific imports.
*/
export function getValueMapFromList<T, K extends keyof T, V extends keyof T>(
list: T[],
key: K,
valueKey: V,
filterUndefined = true
): Record<string, T[V]> {
if (filterUndefined... | 2302_79757062/books | utils/index.ts | TypeScript | agpl-3.0 | 5,766 |
export interface BackendResponse {
data?: unknown;
error?: { message: string; name: string; stack?: string; code?: string };
}
| 2302_79757062/books | utils/ipc/types.ts | TypeScript | agpl-3.0 | 131 |
// ipcRenderer.send(...)
export enum IPC_MESSAGES {
OPEN_MENU = 'open-menu',
OPEN_SETTINGS = 'open-settings',
OPEN_EXTERNAL = 'open-external',
SHOW_ITEM_IN_FOLDER = 'show-item-in-folder',
RELOAD_MAIN_WINDOW = 'reload-main-window',
MINIMIZE_MAIN_WINDOW = 'minimize-main-window',
MAXIMIZE_MAIN_WINDOW = 'maxi... | 2302_79757062/books | utils/messages.ts | TypeScript | agpl-3.0 | 1,774 |
import { DateTime } from 'luxon';
import countryInfo from '../fixtures/countryInfo.json';
import { CUSTOM_EVENTS } from './messages';
import { CountryInfoMap, UnexpectedLogObject } from './types';
export function getCountryInfo(): CountryInfoMap {
// @ts-ignore
return countryInfo as CountryInfoMap;
}
export funct... | 2302_79757062/books | utils/misc.ts | TypeScript | agpl-3.0 | 1,516 |
/**
* Properties of a schema which are to be translated,
* irrespective of nesting.
*/
export const schemaTranslateables = [
'label',
'description',
'placeholder',
'section',
'tab',
];
export function getIndexFormat(inp: string | string[] | unknown) {
/**
* converts:
* ['This is an ', ,' interpola... | 2302_79757062/books | utils/translationHelpers.ts | TypeScript | agpl-3.0 | 1,659 |
import type { ConfigFile } from 'fyo/core/types';
export type UnknownMap = Record<string, unknown>;
export type Translation = { translation: string; context?: string };
export type LanguageMap = Record<string, Translation>;
export type CountryInfoMap = Record<string, CountryInfo | undefined>;
export interface Country... | 2302_79757062/books | utils/types.ts | TypeScript | agpl-3.0 | 1,673 |
import { VersionParts } from './types';
export class Version {
/**
* comparators for version strings of the form
* x.x.x[-beta.x]
*/
static gte(a: string, b: string) {
let valid = false;
return compare(a, b, (c) => {
if (c === 0) {
return false;
}
valid ||= c > 0;
... | 2302_79757062/books | utils/version.ts | TypeScript | agpl-3.0 | 2,135 |
import vue from '@vitejs/plugin-vue';
import path from 'path';
import { defineConfig } from 'vite';
/**
* This vite config file is used only for dev mode, i.e.
* to create a serve build modules of the source code
* which will be rendered by electron.
*
* For building the project, vite is used programmatically
* ... | 2302_79757062/books | vite.config.ts | TypeScript | agpl-3.0 | 1,328 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//写一个函数用于找三个数中的最大值;并实际调用函数,比较23,124,-8764中的最大值;
//同时要判断传进来的参数是否都是数字型,只要其中一个参数不是数字型,就提前返回NaN。
... | 2302_79957586/JavaScript | 1.html | HTML | unknown | 795 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//编写一个getArrMax函数,利用该函数求数组[13,68,79, 92, 83]中的最大值。
function getArrMax(){
let max=arg... | 2302_79957586/JavaScript | 2.html | HTML | unknown | 606 |