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>
<Row
:ratio="ratio"
class="w-full px-2 group flex items-center justify-center h-row-mid"
:class="readOnly ? '' : 'hover:bg-gray-25 dark:hover:bg-gray-900'"
>
<!-- Index or Remove button -->
<div class="flex items-center ps-2 text-gray-600 dark:text-gray-400">
<span class="hidden" :class="{ 'group-hover:inline-block': !readOnly }">
<feather-icon
name="x"
class="w-4 h-4 -ms-1 cursor-pointer"
:button="true"
@click="$emit('remove')"
/>
</span>
<span :class="{ 'group-hover:hidden': !readOnly }">
{{ row.idx + 1 }}
</span>
</div>
<!-- Data Input Form Control -->
<FormControl
v-for="df in tableFields"
:key="df.fieldname"
:size="size"
:df="df"
:value="row[df.fieldname]"
@change="(value) => onChange(df, value)"
/>
<Button
v-if="canEditRow"
:icon="true"
:padding="false"
:background="false"
@click="openRowQuickEdit"
>
<feather-icon
name="edit"
class="w-4 h-4 text-gray-600 dark:text-gray-400"
/>
</Button>
<!-- Error Display -->
<div
v-if="hasErrors"
class="text-xs text-red-600 ps-2 col-span-full relative"
style="bottom: 0.75rem; height: 0px"
>
{{ getErrorString() }}
</div>
</Row>
</template>
<script>
import { Doc } from 'fyo/model/doc';
import Row from 'src/components/Row.vue';
import { getErrorMessage } from 'src/utils';
import { computed, nextTick } from 'vue';
import Button from '../Button.vue';
import FormControl from './FormControl.vue';
export default {
name: 'TableRow',
components: {
Row,
FormControl,
Button,
},
provide() {
return {
doc: computed(() => this.row),
};
},
props: {
row: Doc,
tableFields: Array,
size: String,
ratio: Array,
isNumeric: Function,
readOnly: Boolean,
canEditRow: {
type: Boolean,
default: false,
},
},
emits: ['remove', 'change'],
data: () => ({ hovering: false, errors: {} }),
computed: {
hasErrors() {
return Object.values(this.errors).filter(Boolean).length;
},
},
beforeCreate() {
this.$options.components.FormControl = FormControl;
},
methods: {
async onChange(df, value) {
const fieldname = df.fieldname;
this.errors[fieldname] = null;
const oldValue = this.row[fieldname];
try {
await this.row.set(fieldname, value);
this.$emit('change', df, value);
} catch (e) {
this.errors[fieldname] = getErrorMessage(e, this.row);
this.row[fieldname] = '';
nextTick(() => (this.row[fieldname] = oldValue));
}
},
getErrorString() {
return Object.values(this.errors).filter(Boolean).join(' ');
},
openRowQuickEdit() {
if (!this.row) {
return;
}
this.$parent.$emit('editrow', this.row);
},
},
};
</script>
|
2302_79757062/books
|
src/components/Controls/TableRow.vue
|
Vue
|
agpl-3.0
| 2,984
|
<template>
<div>
<div v-if="showLabel" :class="labelClasses">
{{ df.label }}
</div>
<div :class="showMandatory ? 'show-mandatory' : ''">
<textarea
ref="input"
:rows="rows"
:class="['resize-none bg-transparent', inputClasses, containerClasses]"
:value="value"
:placeholder="inputPlaceholder"
style="vertical-align: top"
:readonly="isReadOnly"
:tabindex="isReadOnly ? '-1' : '0'"
@blur="(e) => triggerChange(e.target.value)"
@focus="(e) => $emit('focus', e)"
@input="(e) => $emit('input', e)"
></textarea>
</div>
</div>
</template>
<script>
import Base from './Base.vue';
export default {
name: 'Text',
extends: Base,
props: { rows: { type: Number, default: 3 } },
emits: ['focus', 'input'],
};
</script>
|
2302_79757062/books
|
src/components/Controls/Text.vue
|
Vue
|
agpl-3.0
| 839
|
<template>
<Teleport to="body">
<Transition>
<!-- Backdrop -->
<div v-if="open" class="backdrop z-20 flex justify-center items-center">
<!-- Dialog -->
<div
class="
bg-white
dark:bg-gray-850
border
dark:border-gray-800
rounded-lg
text-gray-900
dark:text-gray-25
p-4
shadow-2xl
w-dialog
flex flex-col
gap-4
inner
"
>
<div class="flex justify-between items-center">
<h1 class="font-semibold">{{ title }}</h1>
<FeatherIcon
:name="config.iconName"
class="w-6 h-6"
:class="config.iconColor"
/>
</div>
<template v-if="detail">
<p v-if="typeof detail === 'string'" class="text-base">
{{ detail }}
</p>
<div v-else v-for="d of detail">
<p class="text-base">{{ d }}</p>
</div>
</template>
<div class="flex justify-end gap-4 mt-4">
<Button
v-for="(b, index) of buttons"
:ref="b.isPrimary ? 'primary' : 'secondary'"
:key="b.label"
style="min-width: 5rem"
:type="b.isPrimary ? 'primary' : 'secondary'"
@click="() => handleClick(index)"
>
{{ b.label }}
</Button>
</div>
</div>
</div>
</Transition>
</Teleport>
</template>
<script lang="ts">
import { getIconConfig } from 'src/utils/interactive';
import { DialogButton, ToastType } from 'src/utils/types';
import { defineComponent, nextTick, PropType, ref } from 'vue';
import Button from './Button.vue';
import FeatherIcon from './FeatherIcon.vue';
export default defineComponent({
components: { Button, FeatherIcon },
props: {
type: { type: String as PropType<ToastType>, default: 'info' },
title: { type: String, required: true },
detail: {
type: [String, Array] as PropType<string | string[]>,
required: false,
},
buttons: {
type: Array as PropType<DialogButton[]>,
required: true,
},
},
setup() {
return {
primary: ref<InstanceType<typeof Button>[] | null>(null),
secondary: ref<InstanceType<typeof Button>[] | null>(null),
};
},
data() {
return { open: false };
},
computed: {
config() {
return getIconConfig(this.type);
},
},
watch: {
open(value) {
if (value) {
document.addEventListener('keydown', this.handleEscape);
} else {
document.removeEventListener('keydown', this.handleEscape);
}
},
},
async mounted() {
await nextTick(() => {
this.open = true;
});
this.focusButton();
},
methods: {
focusButton() {
let button = this.primary?.[0];
if (!button) {
button = this.secondary?.[0];
}
if (!button) {
return;
}
button.$el.focus();
},
handleEscape(event: KeyboardEvent) {
if (event.code !== 'Escape') {
return;
}
event.preventDefault();
event.stopPropagation();
if (this.buttons.length === 1) {
return this.handleClick(0);
}
const index = this.buttons.findIndex(({ isEscape }) => isEscape);
if (index === -1) {
return;
}
return this.handleClick(index);
},
handleClick(index: number) {
const button = this.buttons[index];
button.action();
this.open = false;
},
},
});
</script>
<style scoped>
.v-enter-active,
.v-leave-active {
transition: all 100ms ease-out;
}
.inner {
transition: all 150ms ease-out;
}
.v-enter-from,
.v-leave-to {
opacity: 0;
}
.v-enter-from .inner,
.v-leave-to .inner {
transform: translateY(-50px);
}
.v-enter-to .inner,
.v-leave-from .inner {
transform: translateY(0px);
}
</style>
|
2302_79757062/books
|
src/components/Dialog.vue
|
Vue
|
agpl-3.0
| 4,013
|
<template>
<Popover
:show-popup="isShown"
:hide-arrow="true"
:placement="right ? 'bottom-end' : 'bottom-start'"
>
<template #target>
<div v-on-outside-click="() => (isShown = false)" class="h-full">
<slot
:toggle-dropdown="toggleDropdown"
:highlight-item-up="highlightItemUp"
:highlight-item-down="highlightItemDown"
:select-highlighted-item="selectHighlightedItem"
></slot>
</div>
</template>
<template #content>
<div
class="
bg-white
dark:bg-gray-850 dark:text-white
rounded
w-full
min-w-40
overflow-hidden
"
>
<div
class="
p-1
max-h-64
overflow-auto
custom-scroll custom-scroll-thumb2
text-sm
"
>
<div
v-if="isLoading"
class="p-2 text-gray-600 dark:text-gray-400 italic"
>
{{ t`Loading...` }}
</div>
<div
v-else-if="dropdownItems.length === 0"
class="p-2 text-gray-600 dark:text-gray-400 italic"
>
{{ getEmptyMessage() }}
</div>
<template v-else>
<div
v-for="(d, index) in dropdownItems"
:key="`key-${index}`"
ref="items"
>
<div
v-if="d.isGroup"
class="
px-2
pt-3
pb-1
text-xs
uppercase
text-gray-700
dark:text-gray-400
font-semibold
tracking-wider
"
>
{{ d.label }}
</div>
<a
v-else
class="
block
p-2
rounded-md
mt-1
first:mt-0
cursor-pointer
truncate
"
:class="
index === highlightedIndex
? 'bg-gray-100 dark:bg-gray-875'
: ''
"
@mouseenter="highlightedIndex = index"
@mousedown.prevent
@click="selectItem(d)"
>
<component :is="d.component" v-if="d.component" />
<template v-else>{{ d.label }}</template>
</a>
</div>
</template>
</div>
</div>
</template>
</Popover>
</template>
<script lang="ts">
import { Doc } from 'fyo/model/doc';
import { Field } from 'schemas/types';
import { fyo } from 'src/initFyo';
import { DropdownItem } from 'src/utils/types';
import { defineComponent, PropType } from 'vue';
import Popover from './Popover.vue';
export default defineComponent({
name: 'Dropdown',
components: {
Popover,
},
props: {
items: {
type: Array as PropType<DropdownItem[]>,
default: () => [],
},
right: {
type: Boolean,
default: false,
},
isLoading: {
type: Boolean,
default: false,
},
df: {
type: Object as PropType<Field | null>,
default: null,
},
doc: {
type: Object as PropType<Doc | null>,
default: null,
},
},
data() {
return {
isShown: false,
highlightedIndex: -1,
};
},
computed: {
dropdownItems(): DropdownItem[] {
const groupedItems = getGroupedItems(this.items ?? []);
const groupNames = Object.keys(groupedItems).filter(Boolean).sort();
const items: DropdownItem[] = groupedItems[''] ?? [];
for (let group of groupNames) {
items.push({
label: group,
isGroup: true,
});
const grouped = groupedItems[group] ?? [];
items.push(...grouped);
}
return items;
},
},
watch: {
highlightedIndex() {
this.scrollToHighlighted();
},
dropdownItems() {
const maxed = Math.max(this.highlightedIndex, -1);
this.highlightedIndex = Math.min(maxed, this.dropdownItems.length - 1);
},
},
methods: {
getEmptyMessage(): string {
const { schemaName, fieldname } = this.df ?? {};
if (!schemaName || !fieldname || !this.doc) {
return this.t`Empty`;
}
const emptyMessage = fyo.models[schemaName]?.emptyMessages[fieldname]?.(
this.doc
);
if (!emptyMessage) {
return this.t`Empty`;
}
return emptyMessage;
},
async selectItem(d?: DropdownItem): Promise<void> {
if (!d || !d?.action) {
return;
}
if (this.doc) {
return await d.action(this.doc, this.$router);
}
await d.action();
},
toggleDropdown(flag?: boolean): void {
if (typeof flag !== 'boolean') {
flag = !this.isShown;
}
this.isShown = flag;
},
async selectHighlightedItem(): Promise<void> {
let item = this.items[this.highlightedIndex];
if (!item && this.dropdownItems.length === 1) {
item = this.dropdownItems[0];
}
return await this.selectItem(item);
},
highlightItemUp(e?: Event): void {
e?.preventDefault();
this.highlightedIndex = Math.max(0, this.highlightedIndex - 1);
},
highlightItemDown(e?: Event): void {
e?.preventDefault();
this.highlightedIndex = Math.min(
this.dropdownItems.length - 1,
this.highlightedIndex + 1
);
},
scrollToHighlighted(): void {
const elems = this.$refs.items;
if (!Array.isArray(elems)) {
return;
}
const highlightedElement = elems[this.highlightedIndex];
if (!(highlightedElement instanceof Element)) {
return;
}
highlightedElement.scrollIntoView({ block: 'nearest' });
},
},
});
function getGroupedItems(
items: DropdownItem[]
): Record<string, DropdownItem[]> {
const groupedItems: Record<string, DropdownItem[]> = {};
for (let item of items) {
const group = item.group ?? '';
groupedItems[group] ??= [];
groupedItems[group].push(item);
}
return groupedItems;
}
</script>
|
2302_79757062/books
|
src/components/Dropdown.vue
|
Vue
|
agpl-3.0
| 6,298
|
<template>
<Dropdown
v-if="actions && actions.length"
class="text-xs"
:items="items"
:doc="doc"
right
>
<template #default="{ toggleDropdown }">
<Button :type="type" :icon="icon" @click="toggleDropdown()">
<slot>
<feather-icon name="more-horizontal" class="w-4 h-4" />
</slot>
</Button>
</template>
</Dropdown>
</template>
<script lang="ts">
import { Doc } from 'fyo/model/doc';
import { Action } from 'fyo/model/types';
import Button from 'src/components/Button.vue';
import Dropdown from 'src/components/Dropdown.vue';
import { DropdownItem } from 'src/utils/types';
import { defineComponent, PropType } from 'vue';
export default defineComponent({
name: 'DropdownWithActions',
components: {
Dropdown,
Button,
},
inject: {
injectedDoc: {
from: 'doc',
default: undefined,
},
},
props: {
actions: { type: Array as PropType<Action[]>, default: () => [] },
type: { type: String, default: 'secondary' },
icon: { type: Boolean, default: true },
},
computed: {
doc() {
// @ts-ignore
const doc = this.injectedDoc;
if (doc instanceof Doc) {
return doc;
}
return undefined;
},
items(): DropdownItem[] {
return this.actions.map(({ label, group, component, action }) => ({
label,
group,
action,
component,
}));
},
},
});
</script>
|
2302_79757062/books
|
src/components/DropdownWithActions.vue
|
Vue
|
agpl-3.0
| 1,452
|
<template>
<slot></slot>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
props: { propagate: { type: Boolean, default: true } },
emits: ['error-captured'],
errorCaptured(error) {
this.$emit('error-captured', error);
return this.propagate;
},
});
</script>
|
2302_79757062/books
|
src/components/ErrorBoundary.vue
|
Vue
|
agpl-3.0
| 329
|
<template>
<div>
<!-- Export Wizard Header -->
<FormHeader :form-title="label" :form-sub-title="t`Export Wizard`" />
<hr class="dark:border-gray-800" />
<!-- Export Config -->
<div class="grid grid-cols-3 p-4 gap-4">
<Check
v-if="configFields.useListFilters && Object.keys(listFilters).length"
:df="configFields.useListFilters"
:space-between="true"
:show-label="true"
:label-right="false"
:value="useListFilters"
:border="true"
@change="(value: boolean) => (useListFilters = value)"
/>
<Select
v-if="configFields.exportFormat"
:df="configFields.exportFormat"
:value="exportFormat"
:border="true"
@change="(value: ExportFormat) => (exportFormat = value)"
/>
<Int
v-if="configFields.limit"
:df="configFields.limit"
:value="limit ?? undefined"
:border="true"
@change="(value: number) => (limit = value)"
/>
</div>
<hr class="dark:border-gray-800" />
<!-- Fields Selection -->
<div class="max-h-80 overflow-auto custom-scroll custom-scroll-thumb2">
<!-- Main Fields -->
<div class="p-4">
<h2 class="text-sm font-semibold text-gray-800 dark:text-gray-300">
{{ fyo.schemaMap[schemaName]?.label ?? schemaName }}
</h2>
<div class="grid grid-cols-3 border dark:border-gray-800 rounded mt-1">
<Check
v-for="ef of fields"
:key="ef.fieldname"
:label-class="
ef.fieldtype === 'Table'
? 'text-sm text-gray-600 dark:text-gray-300 font-semibold'
: 'text-sm text-gray-600 dark:text-gray-400'
"
:df="getField(ef)"
:show-label="true"
:value="ef.export"
@change="(value: boolean) => setExportFieldValue(ef, value)"
/>
</div>
</div>
<!-- Table Fields -->
<div v-for="efs of filteredTableFields" :key="efs.fieldname" class="p-4">
<h2 class="text-sm font-semibold text-gray-800 dark:text-gray-300">
{{ fyo.schemaMap[efs.target]?.label ?? schemaName }}
</h2>
<div class="grid grid-cols-3 border dark:border-gray-800 rounded mt-1">
<Check
v-for="ef of efs.fields"
:key="ef.fieldname"
label-class="text-gray-600 dark:text-gray-300"
:df="getField(ef)"
:show-label="true"
:value="ef.export"
@change="(value: boolean) => setExportFieldValue(ef, value, efs.target)"
/>
</div>
</div>
</div>
<!-- Export Button -->
<hr class="dark:border-gray-800" />
<div class="p-4 flex justify-between items-center">
<p class="text-sm text-gray-600 dark:text-gray-400">
{{ t`${numSelected} fields selected` }}
</p>
<Button type="primary" @click="exportData">{{ t`Export` }}</Button>
</div>
</div>
</template>
<script lang="ts">
import { t } from 'fyo';
import { Verb } from 'fyo/telemetry/types';
import { Field, FieldTypeEnum } from 'schemas/types';
import { fyo } from 'src/initFyo';
import {
getCsvExportData,
getExportFields,
getExportTableFields,
getJsonExportData,
} from 'src/utils/export';
import { ExportField, ExportFormat, ExportTableField } from 'src/utils/types';
import { getSavePath, showExportInFolder } from 'src/utils/ui';
import { QueryFilter } from 'utils/db/types';
import { PropType, defineComponent } from 'vue';
import Button from './Button.vue';
import Check from './Controls/Check.vue';
import Int from './Controls/Int.vue';
import Select from './Controls/Select.vue';
import FormHeader from './FormHeader.vue';
interface ExportWizardData {
useListFilters: boolean;
exportFormat: ExportFormat;
fields: ExportField[];
limit: number | null;
tableFields: ExportTableField[];
numUnfilteredEntries: number;
}
export default defineComponent({
components: { FormHeader, Check, Select, Button, Int },
props: {
schemaName: { type: String, required: true },
listFilters: { type: Object as PropType<QueryFilter>, default: () => {} },
pageTitle: String,
},
data() {
const fields = fyo.schemaMap[this.schemaName]?.fields ?? [];
const exportFields = getExportFields(fields);
const exportTableFields = getExportTableFields(fields, fyo);
return {
limit: null,
useListFilters: true,
exportFormat: 'csv',
fields: exportFields,
tableFields: exportTableFields,
} as ExportWizardData;
},
computed: {
label() {
if (this.pageTitle) {
return this.pageTitle;
}
return fyo.schemaMap?.[this.schemaName]?.label ?? '';
},
filteredTableFields() {
return this.tableFields.filter((f) => {
const ef = this.getExportField(f.fieldname);
return !!ef?.export;
});
},
numSelected() {
return (
this.filteredTableFields.reduce(
(acc, f) => f.fields.filter((f) => f.export).length + acc,
0
) +
this.fields.filter(
(f) => f.fieldtype !== FieldTypeEnum.Table && f.export
).length
);
},
configFields() {
return {
useListFilters: {
fieldtype: 'Check',
label: t`Use List Filters`,
fieldname: 'useListFilters',
} as Field,
limit: {
placeholder: 'Limit number of rows',
fieldtype: 'Int',
label: t`Limit`,
fieldname: 'limit',
} as Field,
exportFormat: {
fieldtype: 'Select',
label: t`Export Format`,
fieldname: 'exportFormat',
options: [
{ value: 'json', label: 'JSON' },
{ value: 'csv', label: 'CSV' },
],
} as Field,
};
},
},
methods: {
getField(ef: ExportField): Field {
return {
fieldtype: 'Check',
label: ef.label,
fieldname: ef.fieldname,
};
},
getExportField(
fieldname: string,
target?: string
): ExportField | undefined {
let fields: ExportField[] | undefined;
if (!target) {
fields = this.fields;
} else {
fields = this.tableFields.find((f) => f.target === target)?.fields;
}
if (!fields) {
return undefined;
}
return fields.find((f) => f.fieldname === fieldname);
},
setExportFieldValue(ef: ExportField, value: boolean, target?: string) {
const field = this.getExportField(ef.fieldname, target);
if (!field) {
return;
}
field.export = value;
},
async exportData() {
const filters = JSON.parse(
JSON.stringify(this.useListFilters ? this.listFilters : {})
);
let data: string;
if (this.exportFormat === 'json') {
data = await getJsonExportData(
this.schemaName,
this.fields,
this.tableFields,
this.limit,
filters,
fyo
);
} else {
data = await getCsvExportData(
this.schemaName,
this.fields,
this.tableFields,
this.limit,
filters,
fyo
);
}
await this.saveExportData(data);
},
async saveExportData(data: string) {
const fileName = this.getFileName();
const { canceled, filePath } = await getSavePath(
fileName,
this.exportFormat
);
if (canceled || !filePath) {
return;
}
await ipc.saveData(data, filePath);
this.fyo.telemetry.log(Verb.Exported, this.schemaName, {
extension: this.exportFormat,
});
showExportInFolder(fyo.t`Export Successful`, filePath);
},
getFileName() {
const fileName = this.label.toLowerCase().replace(/\s/g, '-');
const dateString = new Date().toISOString().split('T')[0];
return `${fileName}_${dateString}`;
},
},
});
</script>
|
2302_79757062/books
|
src/components/ExportWizard.vue
|
Vue
|
agpl-3.0
| 8,025
|
<script>
import feather from 'feather-icons';
import { h } from 'vue';
const validIcons = Object.keys(feather.icons);
export default {
props: {
name: {
type: String,
required: true,
validator: (value) => validIcons.includes(value),
},
},
render() {
const icon = feather.icons[this.name];
const svg = h('svg', {
...Object.assign({}, icon.attrs, {
fill: 'none',
stroke: 'currentColor',
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
'stroke-width': 1.5,
width: null,
height: null,
}),
class: [icon.attrs.class],
innerHTML: icon.contents,
});
return svg;
},
};
</script>
|
2302_79757062/books
|
src/components/FeatherIcon.vue
|
Vue
|
agpl-3.0
| 709
|
<template>
<Popover
v-if="fields.length"
placement="bottom-end"
@close="emitFilterChange"
>
<template #target="{ togglePopover }">
<Button :icon="true" @click="togglePopover()">
<span class="flex items-center">
<Icon
name="filter"
size="12"
class="stroke-current text-gray-700 dark:text-gray-400"
/>
<span class="ms-1">
<template v-if="activeFilterCount > 0">
{{ filterAppliedMessage }}
</template>
<template v-else>
{{ t`Filter` }}
</template>
</span>
</span>
</Button>
</template>
<template #content>
<div>
<div class="p-2">
<template v-if="explicitFilters.length">
<div class="flex flex-col gap-2">
<div
v-for="(filter, i) in explicitFilters"
:key="filter.fieldname + getRandomString()"
class="flex items-center justify-between text-base gap-2"
>
<div
class="
cursor-pointer
w-4
h-4
flex
items-center
justify-center
text-gray-600
dark:text-gray-400
hover:text-gray-800
dark:hover:text-gray-300
rounded-md
group
"
>
<span class="hidden group-hover:inline-block">
<feather-icon
name="x"
class="w-4 h-4 cursor-pointer"
:button="true"
@click="removeFilter(filter)"
/>
</span>
<span class="group-hover:hidden">
{{ i + 1 }}
</span>
</div>
<Select
:border="true"
size="small"
class="w-24"
:df="{
label: t`Field`,
placeholder: t`Field`,
fieldname: 'fieldname',
fieldtype: 'Select',
options: fieldOptions,
}"
:value="filter.fieldname"
@change="(value) => (filter.fieldname = value)"
/>
<Select
:border="true"
size="small"
class="w-24"
:df="{
label: t`Condition`,
placeholder: t`Condition`,
fieldname: 'condition',
fieldtype: 'Select',
options: conditions,
}"
:value="filter.condition"
@change="(value) => (filter.condition = value)"
/>
<Data
:border="true"
size="small"
class="w-24"
:df="{
label: t`Value`,
placeholder: t`Value`,
fieldname: 'value',
fieldtype: 'Data',
}"
:value="String(filter.value)"
@change="(value) => (filter.value = value)"
/>
</div>
</div>
</template>
<template v-else>
<span class="text-base text-gray-600 dark:text-gray-500">{{
t`No filters selected`
}}</span>
</template>
</div>
<div
class="
text-base
border-t
dark:border-gray-800
p-2
flex
items-center
text-gray-600
dark:text-gray-500
cursor-pointer
hover:bg-gray-100
dark:hover:bg-gray-875
"
@click="addNewFilter"
>
<feather-icon name="plus" class="w-4 h-4" />
<span class="ms-2">{{ t`Add a filter` }}</span>
</div>
</div>
</template>
</Popover>
</template>
<script lang="ts">
import { t } from 'fyo';
import { Field, FieldTypeEnum } from 'schemas/types';
import { fyo } from 'src/initFyo';
import { getRandomString } from 'utils';
import { defineComponent } from 'vue';
import Button from './Button.vue';
import Data from './Controls/Data.vue';
import Select from './Controls/Select.vue';
import Icon from './Icon.vue';
import Popover from './Popover.vue';
import { QueryFilter } from 'utils/db/types';
const conditions = [
{ label: t`Is`, value: '=' },
{ label: t`Is Not`, value: '!=' },
{ label: t`Contains`, value: 'like' },
{ label: t`Does Not Contain`, value: 'not like' },
{ label: t`Greater Than`, value: '>' },
{ label: t`Less Than`, value: '<' },
{ label: t`Is Empty`, value: 'is null' },
{ label: t`Is Not Empty`, value: 'is not null' },
] as const;
type Condition = typeof conditions[number]['value'];
type Filter = {
fieldname: string;
condition: Condition;
value: QueryFilter[string];
implicit: boolean;
};
export default defineComponent({
name: 'FilterDropdown',
components: {
Popover,
Button,
Icon,
Select,
Data,
},
props: { schemaName: { type: String, required: true } },
emits: ['change'],
data() {
return {
filters: [],
} as { filters: Filter[] };
},
computed: {
fields(): Field[] {
const excludedFieldsTypes: string[] = [
FieldTypeEnum.Table,
FieldTypeEnum.Attachment,
FieldTypeEnum.AttachImage,
];
const fields = fyo.schemaMap[this.schemaName]?.fields ?? [];
return fields.filter((f) => {
if (f.filter) {
return true;
}
if (excludedFieldsTypes.includes(f.fieldtype)) {
return false;
}
if (f.computed || f.meta || f.readOnly) {
return false;
}
return true;
});
},
fieldOptions(): { label: string; value: string }[] {
return this.fields.map((df) => ({
label: df.label,
value: df.fieldname,
}));
},
conditions(): { label: string; value: string }[] {
return [...conditions];
},
explicitFilters(): Filter[] {
return this.filters.filter((f) => !f.implicit);
},
activeFilterCount(): number {
return this.explicitFilters.filter((filter) => filter.value).length;
},
filterAppliedMessage(): string {
if (this.activeFilterCount === 1) {
return this.t`1 filter applied`;
}
return this.t`${this.activeFilterCount} filters applied`;
},
},
created() {
this.addNewFilter();
},
methods: {
getRandomString,
addNewFilter(): void {
const df = this.fields[0];
if (!df) {
return;
}
this.addFilter(df.fieldname, 'like', '', false);
},
addFilter(
fieldname: string,
condition: Condition,
value: Filter['value'],
implicit?: boolean
): void {
this.filters.push({ fieldname, condition, value, implicit: !!implicit });
},
removeFilter(filter: Filter): void {
this.filters = this.filters.filter((f) => f !== filter);
},
setFilter(filters: QueryFilter, implicit?: boolean): void {
this.filters = [];
Object.keys(filters).map((fieldname) => {
let parts = filters[fieldname];
let condition: Condition;
let value: Filter['value'];
if (Array.isArray(parts)) {
condition = parts[0] as Condition;
value = parts[1] as Filter['value'];
} else {
condition = '=';
value = parts;
}
this.addFilter(fieldname, condition, value, implicit);
});
this.emitFilterChange();
},
emitFilterChange(): void {
const filters: Record<string, [Condition, Filter['value']]> = {};
for (const { condition, value, fieldname } of this.filters) {
if (value === '' && condition) {
continue;
}
filters[fieldname] = [condition, value];
}
this.$emit('change', filters);
},
},
});
</script>
|
2302_79757062/books
|
src/components/FilterDropdown.vue
|
Vue
|
agpl-3.0
| 8,311
|
<template>
<div
class="
flex
bg-gray-25
dark:bg-gray-875
overflow-x-auto
custom-scroll custom-scroll-thumb1
"
>
<div class="flex flex-1 flex-col">
<!-- Page Header (Title, Buttons, etc) -->
<PageHeader
v-if="showHeader"
:title="title"
:border="false"
:searchborder="searchborder"
>
<template #left>
<slot name="header-left" />
</template>
<slot name="header" />
</PageHeader>
<!-- Common Form -->
<div
class="
flex flex-col
self-center
h-full
overflow-auto
bg-white
dark:bg-gray-890
"
:class="
useFullWidth
? 'w-full border-t dark:border-gray-800'
: 'w-form border dark:border-gray-800 rounded-lg shadow-lg mb-4 mx-4'
"
>
<slot name="body" />
</div>
</div>
<!-- Invoice Quick Edit -->
<slot name="quickedit" />
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import PageHeader from './PageHeader.vue';
export default defineComponent({
components: { PageHeader },
props: {
title: { type: String, default: '' },
useFullWidth: { type: Boolean, default: false },
showHeader: { type: Boolean, default: true },
searchborder: { type: Boolean, default: true },
},
});
</script>
|
2302_79757062/books
|
src/components/FormContainer.vue
|
Vue
|
agpl-3.0
| 1,432
|
<template>
<div
class="
px-4
text-xl
font-semibold
flex
justify-between
h-row-large
items-center
flex-shrink-0
"
>
<h1 v-if="formTitle" class="dark:text-gray-25">{{ formTitle }}</h1>
<slot />
<p v-if="formSubTitle" class="text-gray-600 dark:text-gray-400">
{{ formSubTitle }}
</p>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
props: {
formTitle: { type: String, default: '' },
formSubTitle: { type: String, default: '' },
},
});
</script>
|
2302_79757062/books
|
src/components/FormHeader.vue
|
Vue
|
agpl-3.0
| 601
|
<template>
<div
ref="hr"
class="
h-full
bg-gray-300
dark:bg-gray-700
transition-opacity
hover:opacity-100
"
:class="resizing ? 'opacity-100' : 'opacity-0'"
style="width: 3px; cursor: col-resize; margin-left: -3px"
@mousedown="onMouseDown"
>
<MouseFollower
:show="resizing"
placement="left"
class="
px-1
py-0.5
border
dark:border-gray-800
rounded-md
shadow
text-sm text-center
bg-gray-900
text-gray-100
"
style="min-width: 2rem"
>
{{ value }}
</MouseFollower>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import MouseFollower from './MouseFollower.vue';
export default defineComponent({
components: { MouseFollower },
props: {
initialX: { type: Number, required: true },
minX: Number,
maxX: Number,
},
emits: ['resize'],
data() {
return {
x: 0,
delta: 0,
xOnMouseDown: 0,
resizing: false,
listener: null,
};
},
computed: {
value() {
let value = this.delta + this.xOnMouseDown;
if (typeof this.minX === 'number') {
value = Math.max(this.minX, value);
}
if (typeof this.maxX === 'number') {
value = Math.min(this.maxX, value);
}
return value;
},
minDelta() {
if (typeof this.minX !== 'number') {
return null;
}
return this.initialX - this.minX;
},
maxDelta() {
if (typeof this.maxX !== 'number') {
return null;
}
return this.maxX - this.initialX;
},
},
methods: {
onMouseDown(e: MouseEvent) {
e.preventDefault();
this.x = e.clientX;
this.xOnMouseDown = this.initialX;
this.setResizing(true);
document.addEventListener('mousemove', this.mouseMoveListener);
document.addEventListener('mouseup', this.mouseUpListener);
},
mouseUpListener(e: MouseEvent) {
e.preventDefault();
this.x = e.clientX;
this.setResizing(false);
this.$emit('resize', this.value);
this.removeListeners();
},
mouseMoveListener(e: MouseEvent) {
e.preventDefault();
this.delta = this.x - e.clientX;
this.$emit('resize', this.value);
},
removeListeners() {
document.removeEventListener('mousemove', this.mouseMoveListener);
document.removeEventListener('mouseup', this.mouseUpListener);
},
setResizing(value: boolean) {
this.resizing = value;
if (value) {
this.delta = 0;
document.body.style.cursor = 'col-resize';
} else {
document.body.style.cursor = '';
}
},
},
});
</script>
|
2302_79757062/books
|
src/components/HorizontalResizer.vue
|
Vue
|
agpl-3.0
| 2,746
|
<template>
<button class="flex items-center z-10" @click="openHelpLink">
<p class="me-1"><slot></slot></p>
<FeatherIcon
v-if="icon"
class="h-5 w-5 ms-3 text-blue-400"
name="help-circle"
/>
</button>
</template>
<script>
import FeatherIcon from './FeatherIcon.vue';
export default {
components: { FeatherIcon },
props: {
link: String,
icon: {
default: true,
type: Boolean,
},
},
methods: {
openHelpLink() {
ipc.openLink(this.link);
},
},
};
</script>
|
2302_79757062/books
|
src/components/HowTo.vue
|
Vue
|
agpl-3.0
| 533
|
<template>
<component
v-bind="$attrs"
:is="iconComponent"
:class="iconClasses"
:active="active"
:darkMode="darkMode"
/>
</template>
<script lang="ts">
import icons12 from './Icons/12';
import icons18 from './Icons/18';
import icons24 from './Icons/24';
import icons8 from './Icons/8';
const components = {
8: icons8,
12: icons12,
18: icons18,
24: icons24,
} as const;
type IconSize = '8' | '12' | '18' | '24';
export default {
name: 'Icon',
props: {
name: { type: String, required: true },
active: { type: Boolean, default: false },
darkMode: { type: Boolean, default: false },
size: {
type: String,
required: true,
},
height: Number,
},
computed: {
iconComponent() {
const map = components[this.size as IconSize];
return map[this.name as keyof typeof map] ?? null;
},
iconClasses() {
let sizeClass = {
8: 'w-2 h-2',
12: 'w-3 h-3',
16: 'w-4 h-4',
18: 'w-5 h-5',
24: 'w-6 h-6',
}[this.size];
if (this.height) {
sizeClass = `w-${this.height} h-${this.height}`;
}
return [sizeClass, 'fill-current'];
},
},
};
</script>
|
2302_79757062/books
|
src/components/Icon.vue
|
Vue
|
agpl-3.0
| 1,205
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 11">
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M2.25 2.25L9 2.25 2.25 2.25 2.25 4.5 0 2.25 2.25 0 2.25 2.25zM8.75 7.875L2 7.875 8.75 7.875 8.75 5.625 11 7.875 8.75 10.125 8.75 7.875z"
transform="translate(.5)"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/12/arrow-left-right.vue
|
Vue
|
agpl-3.0
| 349
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 10">
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M11.2 1.5L.8 1.5M3 5.75L9 5.75M5 10.5L7 10.5"
transform="translate(0 -2)"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/12/filter.vue
|
Vue
|
agpl-3.0
| 260
|
import ArrowLeftRight from './arrow-left-right.vue';
import DragHandle from './drag-handle.vue';
import Filter from './filter.vue';
import List from './list.vue';
import Select from './select.vue';
import Sidebar from './sidebar.vue';
// prettier-ignore
export default {
'arrow-left-right': ArrowLeftRight,
'drag-handle': DragHandle,
'filter': Filter,
'list': List,
'select': Select,
'sidebar': Sidebar,
};
|
2302_79757062/books
|
src/components/Icons/12/index.ts
|
TypeScript
|
agpl-3.0
| 420
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 10">
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M1.5,0.5 L10.5,0.5 C11.0522847,0.5 11.5,0.94771525 11.5,1.5 L11.5,8.5 C11.5,9.05228475 11.0522847,9.5 10.5,9.5 L1.5,9.5 C0.94771525,9.5 0.5,9.05228475 0.5,8.5 L0.5,1.5 C0.5,0.94771525 0.94771525,0.5 1.5,0.5 Z M7.5,0.5 L7.5,9.5"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/12/list.vue
|
Vue
|
agpl-3.0
| 408
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 5 10">
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M4,3.63636364 L5.63636364,2 L7.27272727,3.63636364 M4,8.36363636 L5.63636364,10 L7.27272727,8.36363636"
transform="translate(-3 -1)"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/12/select.vue
|
Vue
|
agpl-3.0
| 318
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 10">
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M1.5,0.5 L10.5,0.5 C11.0522847,0.5 11.5,0.94771525 11.5,1.5 L11.5,8.5 C11.5,9.05228475 11.0522847,9.5 10.5,9.5 L1.5,9.5 C0.94771525,9.5 0.5,9.05228475 0.5,8.5 L0.5,1.5 C0.5,0.94771525 0.94771525,0.5 1.5,0.5 Z"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/12/sidebar.vue
|
Vue
|
agpl-3.0
| 390
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 12">
<g
fill="none"
fill-rule="evenodd"
stroke-linecap="round"
stroke-linejoin="round"
transform="translate(0 1)"
>
<g transform="rotate(180 4.5 3.5)">
<polyline points="0 2 2 0 4 2" />
<path d="M2,0 L2,7" />
</g>
<path
d="M3.5,1.5 L1.5,1.5 C0.94771525,1.5 0.5,1.94771525 0.5,2.5 L0.5,9.5 C0.5,10.0522847 0.94771525,10.5 1.5,10.5 L12.5,10.5 C13.0522847,10.5 13.5,10.0522847 13.5,9.5 L13.5,2.5 C13.5,1.94771525 13.0522847,1.5 12.5,1.5 L10.5,1.5"
/>
</g>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/account-in.vue
|
Vue
|
agpl-3.0
| 633
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 16">
<path
fill="#415668"
d="M8.04916643,0 C4.12177371,0 1,3.09516381 1,6.98907956 C1,8.88611544 1.70491664,10.6833073 3.11474993,11.9812793 C3.21545231,12.0811232 7.24354741,15.675507 7.34424979,15.775351 C7.7470593,16.074883 8.35127356,16.074883 8.6533807,15.775351 C8.75408308,15.675507 12.8828806,12.0811232 12.8828806,11.9812793 C14.2927138,10.6833073 14.9976305,8.88611544 14.9976305,6.98907956 C15.0983329,3.09516381 11.9765592,0 8.04916643,0 Z M8,9 C6.9,9 6,8.1 6,7 C6,5.9 6.9,5 8,5 C9.1,5 10,5.9 10,7 C10,8.1 9.1,9 8,9 Z"
transform="translate(-1)"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/address.vue
|
Vue
|
agpl-3.0
| 676
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<path
fill="#415668"
fill-rule="nonzero"
d="M15.3333333,5.33333333 L0.666666667,5.33333333 C0.298666667,5.33333333 0,5.632 0,6 L0,15.3333333 C0,15.7013333 0.298666667,16 0.666666667,16 L15.3333333,16 C15.7013333,16 16,15.7013333 16,15.3333333 L16,6 C16,5.632 15.7013333,5.33333333 15.3333333,5.33333333 Z M8,12.6666667 C6.89533333,12.6666667 6,11.7713333 6,10.6666667 C6,9.562 6.89533333,8.66666667 8,8.66666667 C9.10466667,8.66666667 10,9.562 10,10.6666667 C10,11.7713333 9.10466667,12.6666667 8,12.6666667 Z"
/>
<path
fill="#A1ABB4"
d="M2,2.66666667 L14,2.66666667 L14,4 L2,4 L2,2.66666667 Z M4.66666667,1.51767487e-13 L11.3333333,1.51767487e-13 L11.3333333,1.33333333 L4.66666667,1.33333333 L4.66666667,1.51767487e-13 Z"
/>
</g>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/assets.vue
|
Vue
|
agpl-3.0
| 935
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 12">
<g fill="none" fill-rule="evenodd" transform="translate(.5 -1.5)">
<path
d="M.5 5.5L.5 10.4361148C.5 11.1734491.553979991 11.4529804.708039303 11.7410463.835746496 11.979838 1.02016204 12.1642535 1.25895373 12.2919607 1.54701959 12.44602 1.82655093 12.5 2.5638852 12.5L10.4361148 12.5C11.1734491 12.5 11.4529804 12.44602 11.7410463 12.2919607 11.979838 12.1642535 12.1642535 11.979838 12.2919607 11.7410463 12.44602 11.4529804 12.5 11.1734491 12.5 10.4361148L12.5 5.5.5 5.5zM.5 5.5L12.5 5.5 12.5 4.5638852C12.5 3.82655093 12.44602 3.54701959 12.2919607 3.25895373 12.1642535 3.02016204 11.979838 2.8357465 11.7410463 2.7080393 11.4529804 2.55397999 11.1734491 2.5 10.4361148 2.5L2.5638852 2.5C1.82655093 2.5 1.54701959 2.55397999 1.25895373 2.7080393 1.02016204 2.8357465.835746496 3.02016204.708039303 3.25895373.553979991 3.54701959.5 3.82655093.5 4.5638852L.5 5.5z"
/>
<path />
<path />
</g>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/calendar.vue
|
Vue
|
agpl-3.0
| 1,030
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8">
<circle cx="8" cy="8" r="3.5" fill="none" transform="translate(-4 -4)" />
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/circle.vue
|
Vue
|
agpl-3.0
| 171
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 4">
<polyline
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
points="4 6 8 10 12 6"
transform="translate(-3 -6)"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/down-small.vue
|
Vue
|
agpl-3.0
| 256
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 9">
<polyline
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="1.5"
points="1 5 8 12 15 5"
transform="translate(0 -4)"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/down.vue
|
Vue
|
agpl-3.0
| 280
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 16">
<path
fill="#415668"
d="M12.0016667,2 L14.6683333,0 L14.6683333,15.3333333 C14.6683333,15.702 14.3696667,16 14.0016667,16 L2.00166667,16 C1.63366667,16 1.335,15.702 1.335,15.3333333 L1.335,0 L4.00166667,2 L6.00166667,0 L8.00166667,2 L10.0016667,0 L12.0016667,2 Z M10.9599376,6.36932491 L9.74971145,6.36932491 C9.68579106,5.97727983 9.54090483,5.62358698 9.31931413,5.32529181 L10.6616424,5.33381453 L10.9641989,4.272736 L5.38607925,4.272736 L5.075,5.40625765 L6.69431664,5.40625765 C7.62755438,5.40625765 8.16874705,5.76847321 8.36476959,6.36932491 L5.37329517,6.36932491 L5.075,7.42188072 L8.39886047,7.42188072 C8.22414472,8.09517554 7.63181574,8.46591382 6.69431664,8.46591382 L5.18153399,8.46591382 L5.19005671,9.29687894 L8.24119016,13.0000004 L9.79658641,13.0000004 L9.79658641,12.9275573 L7.00965725,9.51420827 C8.76107603,9.40767428 9.58351843,8.57244781 9.75823417,7.42188072 L10.6616424,7.42188072 L10.9599376,6.36932491 Z"
transform="translate(-1)"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/expenses.vue
|
Vue
|
agpl-3.0
| 1,084
|
import AccountIn from './account-in.vue';
import Address from './address.vue';
import Assets from './assets.vue';
import Calendar from './calendar.vue';
import Circle from './circle.vue';
import DownSmall from './down-small.vue';
import Down from './down.vue';
import Expenses from './expenses.vue';
import Income from './income.vue';
import Items from './items.vue';
import Liabilities from './liabilities.vue';
import Mail from './mail.vue';
import Normal from './normal.vue';
import Opened from './opened.vue';
import Phone from './phone.vue';
import Plus from './plus.vue';
import Search from './search.vue';
// prettier-ignore
export default {
'account-in': AccountIn,
'address': Address,
'assets': Assets,
'calendar': Calendar,
'circle': Circle,
'down-small': DownSmall,
'down': Down,
'expenses': Expenses,
'income': Income,
'items': Items,
'liabilities': Liabilities,
'mail': Mail,
'normal': Normal,
'opened': Opened,
'phone': Phone,
'plus': Plus,
'search': Search,
}
|
2302_79757062/books
|
src/components/Icons/16/index.ts
|
TypeScript
|
agpl-3.0
| 1,010
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<path
fill="#A1ABB4"
d="M15.3333333,0.5 L0.666666667,0.5 C0.298666667,0.5 0,0.798666667 0,1.16666667 L0,3.83333333 C0,4.20133333 0.298666667,4.5 0.666666667,4.5 L15.3333333,4.5 C15.7013333,4.5 16,4.20133333 16,3.83333333 L16,1.16666667 C16,0.798666667 15.7013333,0.5 15.3333333,0.5 Z"
/>
<path
fill="#415668"
fill-rule="nonzero"
d="M14.6666667,5.83333333 L1.33333333,5.83333333 L1.33333333,14.5 C1.33333333,14.868 1.632,15.1666667 2,15.1666667 L14,15.1666667 C14.368,15.1666667 14.6666667,14.868 14.6666667,14.5 L14.6666667,5.83333333 Z M10.6666667,11.1666667 L5.33333333,11.1666667 L5.33333333,8.5 L10.6666667,8.5 L10.6666667,11.1666667 Z"
/>
</g>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/items.vue
|
Vue
|
agpl-3.0
| 852
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd" transform="translate(.665)">
<path
fill="#415668"
fill-rule="nonzero"
d="M6.66666667,11.3593333 L11.3333333,7.626 L13.3333333,9.226 L13.3333333,0.666666667 C13.3333333,0.298476833 13.0348565,2.2545125e-17 12.6666667,0 L0.666666667,0 C0.298476833,-2.2545125e-17 3.0375702e-13,0.298476833 3.0375702e-13,0.666666667 L3.0375702e-13,15.3333333 C3.0375702e-13,15.7015232 0.298476833,16 0.666666667,16 L6.66666667,16 L6.66666667,11.3593333 Z M2.66666667,4 L10.6353333,4 L10.6353333,5.33333333 L2.66666667,5.33333333 L2.66666667,4 Z M5.33333333,12 L2.66666667,12 L2.66666667,10.6666667 L5.33333333,10.6666667 L5.33333333,12 Z M2.66666667,8.66666667 L2.66666667,7.33333333 L8,7.33333333 L8,8.66666667 L2.66666667,8.66666667 Z"
/>
<path
fill="#A1ABB4"
d="M14.6666667,12 L11.3333333,9.33333333 L8,12 L8,15.3333333 C8,15.7015232 8.29847683,16 8.66666667,16 L10.6666667,16 L10.6666667,14 L12,14 L12,16 L14,16 C14.3681898,16 14.6666667,15.7015232 14.6666667,15.3333333 L14.6666667,12 Z"
/>
</g>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/liabilities.vue
|
Vue
|
agpl-3.0
| 1,183
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 14">
<g fill="none" fill-rule="evenodd">
<path
fill="#A1ABB4"
d="M15,0 L1,0 C0.4,0 0,0.4 0,1 L0,2.4 L8,6.9 L16,2.5 L16,1 C16,0.4 15.6,0 15,0 Z"
/>
<path
fill="#415668"
fill-rule="nonzero"
d="M7.5,8.9 L0,4.7 L0,13 C0,13.6 0.4,14 1,14 L15,14 C15.6,14 16,13.6 16,13 L16,4.7 L8.5,8.9 C8.22,9.04 7.78,9.04 7.5,8.9 Z"
/>
</g>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/mail.vue
|
Vue
|
agpl-3.0
| 482
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path
fill="#415668"
d="M8.33333333,2.66666667 L6.33333333,0 L0.666666667,0 C0.298476833,0 4.50902501e-17,0.298476833 0,0.666666667 L0,12.6666667 C1.3527075e-16,13.7712362 0.8954305,14.6666667 2,14.6666667 L14,14.6666667 C15.1045695,14.6666667 16,13.7712362 16,12.6666667 L16,3.33333333 C16,2.9651435 15.7015232,2.66666667 15.3333333,2.66666667 L8.33333333,2.66666667 Z"
transform="translate(0 .7)"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/normal.vue
|
Vue
|
agpl-3.0
| 523
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path
fill="#415668"
d="M15.87,4.93733333 C15.7442388,4.76701257 15.5450526,4.66655343 15.3333333,4.66666667 L3.33333333,4.66666667 C3.04059338,4.66660971 2.78206554,4.85753089 2.696,5.13733333 L1.33333333,9.566 L1.33333333,1.33333333 L4.97666667,1.33333333 L6.11,3.03666667 C6.23407563,3.22263727 6.44310609,3.33403674 6.66666667,3.33333333 L12,3.33333333 L12,4 L13.3333333,4 L13.3333333,2.66666667 C13.3333333,2.29847683 13.0348565,2 12.6666667,2 L7.02333333,2 L5.89,0.296666667 C5.76592437,0.110696061 5.55689391,-0.000703403422 5.33333333,4.44088363e-16 L0.666666667,4.44088363e-16 C0.298476833,4.44088363e-16 4.50902501e-17,0.298476833 0,0.666666667 L0,14 L0.0166666667,14 C0.0107575763,14.1407672 0.0505118079,14.2796731 0.13,14.396 C0.255761209,14.5663208 0.454947439,14.6667799 0.666666667,14.6666667 L12.6666667,14.6666667 C12.9594066,14.6667236 13.2179345,14.4758024 13.304,14.196 L15.9706667,5.52933333 C16.0329159,5.32720357 15.995561,5.1075269 15.87,4.93733333 Z"
transform="translate(0 .7)"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/opened.vue
|
Vue
|
agpl-3.0
| 1,129
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<path
fill="#415668"
fill-rule="nonzero"
d="M15.285,12.305 L12.707,9.711 C12.317,9.318 11.682,9.318 11.291,9.709 L9,12 L4,7 L6.294,4.706 C6.684,4.316 6.685,3.683 6.295,3.292 L3.715,0.708 C3.324,0.317 2.691,0.317 2.3,0.708 L0.004,3.003 L0,3 C0,10.18 5.82,16 13,16 L15.283,13.717 C15.673,13.327 15.674,12.696 15.285,12.305 Z"
/>
<path
fill="#A1ABB4"
d="M16,8 L14,8 C14,4.691 11.309,2 8,2 L8,0 C12.411,0 16,3.589 16,8 Z M12,8 L10,8 C10,6.897 9.103,6 8,6 L8,4 C10.206,4 12,5.794 12,8 Z"
/>
</g>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/phone.vue
|
Vue
|
agpl-3.0
| 694
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path
fill="#112B42"
d="M15,7 L9,7 L9,1 C9,0.4 8.6,0 8,0 C7.4,0 7,0.4 7,1 L7,7 L1,7 C0.4,7 0,7.4 0,8 C0,8.6 0.4,9 1,9 L7,9 L7,15 C7,15.6 7.4,16 8,16 C8.6,16 9,15.6 9,15 L9,9 L15,9 C15.6,9 16,8.6 16,8 C16,7.4 15.6,7 15,7 Z"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/plus.vue
|
Vue
|
agpl-3.0
| 341
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 15">
<path
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
d="M7,13 C10.3137085,13 13,10.3137085 13,7 C13,3.6862915 10.3137085,1 7,1 C3.6862915,1 1,3.6862915 1,7 C1,10.3137085 3.6862915,13 7,13 Z M15,15 L11.242,11.242"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/16/search.vue
|
Vue
|
agpl-3.0
| 355
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18">
<g fill="none" fill-rule="evenodd">
<path
fill="#92D336"
fill-rule="nonzero"
d="M9,0 C4.02943725,-3.04359188e-16 6.08718376e-16,4.02943725 0,9 C-6.08718376e-16,13.9705627 4.02943725,18 9,18 C13.9705627,18 18,13.9705627 18,9 C17.985583,4.03542125 13.9645788,0.0144170383 9,0 Z"
/>
<polyline
stroke="#FFF"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="1.5"
points="5 9.733 7.222 12.133 13 6"
/>
</g>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/check.vue
|
Vue
|
agpl-3.0
| 692
|
<template>
<svg
width="18"
height="18"
viewBox="0 0 18 18"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M1.28577 0.728572C1.28577 0.326193 1.61196 0 2.01434 0H15.5572C15.9596 0 16.2858 0.326193 16.2858 0.728571V8.78571H12.1V12.5317H8.50592L12.9132 18H2.01434C1.61196 18 1.28577 17.6738 1.28577 17.2714V0.728572ZM13.5001 5.89286H4.71434V4.39286H13.5001V5.89286ZM4.71434 9.75H10.7143V8.25H4.71434V9.75ZM7.28577 13.6071H4.71434V12.1071H7.28577V13.6071Z"
:fill="darkColor"
/>
<path
d="M16.2858 13.7317V15.6992L14.4429 17.9857L11.0143 13.7317H13.3V9.98571H15.5857V13.7317H16.2858Z"
:fill="darkColor"
/>
<path
d="M13.3 13.7317V9.98572H14.4429H15.5857V13.7317H17.8714L14.4429 17.9857L11.0143 13.7317H13.3Z"
:fill="lightColor"
/>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconPurchase',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/common-entries.vue
|
Vue
|
agpl-3.0
| 1,004
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18">
<path
fill="#FED73A"
fill-rule="evenodd"
d="M13.8000002,0 L0.600000009,0 C0.268800004,0 0,0.268800004 0,0.600000009 L0,13.8000002 C0,14.1312002 0.268800004,14.4000002 0.600000009,14.4000002 L13.8000002,14.4000002 C14.1312002,14.4000002 14.4000002,14.1312002 14.4000002,13.8000002 L14.4000002,0.600000009 C14.4000002,0.268800004 14.1312002,0 13.8000002,0 Z M4.80000007,4.80000007 C4.80000007,3.47460005 5.87460009,2.40000004 7.20000011,2.40000004 C8.52540013,2.40000004 9.60000014,3.47460005 9.60000014,4.80000007 L9.60000014,5.40000008 C9.60000014,6.7254001 8.52540013,7.80000012 7.20000011,7.80000012 C5.87460009,7.80000012 4.80000007,6.7254001 4.80000007,5.40000008 L4.80000007,4.80000007 Z M10.8000002,12.6000002 L3.60000005,12.6000002 C3.26880005,12.6000002 3.00000004,12.3312002 3.00000004,12.0000002 C3.00000004,10.3434002 4.34340006,9.00000013 6.00000009,9.00000013 L8.40000013,9.00000013 C10.0566001,9.00000013 11.4000002,10.3434002 11.4000002,12.0000002 C11.4000002,12.3312002 11.1312002,12.6000002 10.8000002,12.6000002 Z"
transform="translate(2 2)"
/>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/customer.vue
|
Vue
|
agpl-3.0
| 1,278
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd" transform="translate(.7)">
<path
:fill="lightColor"
d="M6,9.33333333 L0.666666667,9.33333333 C0.298666667,9.33333333 1.95399252e-14,9.03466667 1.95399252e-14,8.66666667 L1.95399252e-14,0.666666667 C1.95399252e-14,0.298666667 0.298666667,0 0.666666667,0 L6,0 C6.368,0 6.66666667,0.298666667 6.66666667,0.666666667 L6.66666667,8.66666667 C6.66666667,9.03466667 6.368,9.33333333 6,9.33333333 Z M14,5.33333333 L8.66666667,5.33333333 C8.29866667,5.33333333 8,5.03466667 8,4.66666667 L8,0.666666667 C8,0.298666667 8.29866667,-4.4408921e-16 8.66666667,-4.4408921e-16 L14,-4.4408921e-16 C14.368,-4.4408921e-16 14.6666667,0.298666667 14.6666667,0.666666667 L14.6666667,4.66666667 C14.6666667,5.03466667 14.368,5.33333333 14,5.33333333 Z"
/>
<path
:fill="darkColor"
fill-rule="nonzero"
d="M6,16 L0.666666667,16 C0.298666667,16 1.95399252e-14,15.7013333 1.95399252e-14,15.3333333 L1.95399252e-14,11.3333333 C1.95399252e-14,10.9653333 0.298666667,10.6666667 0.666666667,10.6666667 L6,10.6666667 C6.368,10.6666667 6.66666667,10.9653333 6.66666667,11.3333333 L6.66666667,15.3333333 C6.66666667,15.7013333 6.368,16 6,16 Z M14,16 L8.66666667,16 C8.29866667,16 8,15.7013333 8,15.3333333 L8,7.33333333 C8,6.96533333 8.29866667,6.66666667 8.66666667,6.66666667 L14,6.66666667 C14.368,6.66666667 14.6666667,6.96533333 14.6666667,7.33333333 L14.6666667,15.3333333 C14.6666667,15.7013333 14.368,16 14,16 Z"
/>
</g>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconDashboard',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/dashboard.vue
|
Vue
|
agpl-3.0
| 1,708
|
<template>
<svg
width="18"
height="18"
viewBox="0 0 18 18"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M6.81398 5.75342L5.67204 6.73249L3.9698 5.03025L3.00005 6L5.09165e-05 3L3.00005 0L6.00005 3L5.0303 3.96975L6.81398 5.75342ZM14.2051 10.455L17.2238 13.473C18.2596 14.5088 18.2596 16.1873 17.2238 17.223C16.1881 18.2588 14.5096 18.2588 13.4738 17.223L10.0853 13.8345L12.8161 10.4602C13.0441 10.4865 13.2713 10.5 13.5001 10.5C13.7386 10.5 13.9733 10.482 14.2051 10.455Z"
:fill="lightColor"
/>
<path
d="M15.2033 5.07825L12.9218 2.79675L15.3278 0.39075C14.7691 0.14175 14.1518 0 13.5001 0C11.0146 0 9.00005 2.0145 9.00005 4.5C9.00005 4.9455 9.0668 5.3745 9.18755 5.781L1.0958 12.3285C0.427551 12.9187 0.0285509 13.7678 0.00155092 14.658C-0.0261991 15.549 0.319551 16.4212 0.949551 17.0505C1.56155 17.6632 2.3753 18 3.2408 18C4.17005 18 5.05655 17.601 5.67155 16.9042L12.2191 8.8125C12.6256 8.93325 13.0546 9 13.5001 9C15.9856 9 18.0001 6.9855 18.0001 4.5C18.0001 3.84825 17.8583 3.231 17.6093 2.6715L15.2033 5.07825Z"
:fill="lightColor"
/>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconGeneral',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/general.vue
|
Vue
|
agpl-3.0
| 1,299
|
<template>
<svg
width="18"
height="18"
viewBox="0 0 18 18"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M2 1C0.895431 1 0 1.89543 0 3V15C0 16.1046 0.89543 17 2 17H16C17.1046 17 18 16.1046 18 15V3C18 1.89543 17.1046 1 16 1H2ZM8.58582 13.4571V11.64H6.95725V13.5429C6.95725 14.0229 7.10582 14.4114 7.40297 14.7086C7.70011 14.9943 8.08868 15.1371 8.56868 15.1371H9.46011C9.94011 15.1371 10.3287 14.9943 10.6258 14.7086C10.923 14.4114 11.0715 14.0229 11.0715 13.5429V10.1314C11.0715 9.83429 10.9973 9.6 10.8487 9.42857C10.7115 9.25714 10.5515 9.13143 10.3687 9.05143C10.1858 8.97143 10.043 8.90857 9.94011 8.86286L8.58582 8.26286V4.68C8.58582 4.62286 8.61439 4.59429 8.67154 4.59429H9.35725C9.41439 4.59429 9.44297 4.62286 9.44297 4.68V6.99429L11.0715 7.13143V4.59429C11.0715 4.11429 10.923 3.73143 10.6258 3.44571C10.3287 3.14857 9.94011 3 9.46011 3H8.56868C8.08868 3 7.70011 3.14857 7.40297 3.44571C7.10582 3.73143 6.95725 4.11429 6.95725 4.59429V8.50286C6.95725 8.8 7.02582 9.03429 7.16297 9.20571C7.31154 9.37714 7.47725 9.50857 7.66011 9.6C7.84297 9.68 7.98582 9.73714 8.08868 9.77143L9.44297 10.3714V13.4571C9.44297 13.5143 9.41439 13.5429 9.35725 13.5429H8.67154C8.61439 13.5429 8.58582 13.5143 8.58582 13.4571ZM12.0715 4.59429V3H16.7858V4.59429H15.2429V15H13.6144V4.59429H12.0715ZM5.51153 14.5714C5.80867 14.2743 5.95724 13.8857 5.95724 13.4057V8.17714H3.79724L3.6601 9.77143H4.32867V13.32C4.32867 13.3771 4.3001 13.4057 4.24295 13.4057H3.21438C3.15724 13.4057 3.12867 13.3771 3.12867 13.32V4.68C3.12867 4.62286 3.15724 4.59429 3.21438 4.59429H4.24295C4.3001 4.59429 4.32867 4.62286 4.32867 4.68V7.33714H5.95724V4.59429C5.95724 4.11429 5.80867 3.73143 5.51153 3.44571C5.21438 3.14857 4.82581 3 4.34581 3H3.11153C2.63153 3 2.24295 3.14857 1.94581 3.44571C1.64867 3.73143 1.5001 4.11429 1.5001 4.59429V13.4057C1.5001 13.8857 1.64867 14.2743 1.94581 14.5714C2.24295 14.8571 2.63153 15 3.11153 15H4.34581C4.82581 15 5.21438 14.8571 5.51153 14.5714Z"
:fill="darkColor"
/>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconGST',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/gst.vue
|
Vue
|
agpl-3.0
| 2,207
|
import Check from './check.vue';
import CommonEntries from './common-entries.vue';
import Customer from './customer.vue';
import Dashboard from './dashboard.vue';
import Fb from './fb.vue';
import General from './general.vue';
import Gst from './gst.vue';
import Inventory from './inventory.vue';
import Invoice from './invoice.vue';
import Item from './item.vue';
import Mail from './mail.vue';
import POS from './pos.vue';
import OpeningAc from './opening-ac.vue';
import Percentage from './percentage.vue';
import Property from './property.vue';
import PurchaseInvoice from './purchase-invoice.vue';
import Purchase from './purchase.vue';
import Reports from './reports.vue';
import ReviewAc from './review-ac.vue';
import SalesInvoice from './sales-invoice.vue';
import Sales from './sales.vue';
import Settings from './settings.vue';
import Start from './start.vue';
import Supplier from './supplier.vue';
import System from './system.vue';
// prettier-ignore
export default {
'check': Check,
'common-entries': CommonEntries,
'customer': Customer,
'dashboard': Dashboard,
'fb': Fb,
'general': General,
'gst': Gst,
'inventory': Inventory,
'invoice': Invoice,
'item': Item,
'mail': Mail,
'pos': POS,
'opening-ac': OpeningAc,
'percentage': Percentage,
'property': Property,
'purchase-invoice': PurchaseInvoice,
'purchase': Purchase,
'reports': Reports,
'review-ac': ReviewAc,
'sales-invoice': SalesInvoice,
'sales': Sales,
'settings': Settings,
'start': Start,
'supplier': Supplier,
'system': System,
}
|
2302_79757062/books
|
src/components/Icons/18/index.ts
|
TypeScript
|
agpl-3.0
| 1,556
|
<template>
<svg
width="20"
height="20"
viewBox="0 0 18 18"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.4943 0.151836C7.88385 -0.0506121 8.33973 -0.0506121 8.72928 0.151836L17.0957 4.49986L14.7724 5.70728L5.78847 1.03835L7.4943 0.151836Z"
:fill="lightColor"
/>
<path
d="M9.88794 8.24572L0.904053 3.57679L4.11554 1.90778L13.0994 6.57671L9.88794 8.24572Z"
:fill="lightColor"
/>
<path
d="M10.6569 9.58498L17.9952 5.77127C17.9984 5.81193 18 5.85301 18 5.89441V12.453C18 12.9868 17.7304 13.4692 17.3093 13.7319L10.6569 17.8806L10.6569 9.58498Z"
:fill="darkColor"
/>
<path
d="M9.11923 9.58498L9.11923 18L0.78452 13.6684C0.313082 13.4234 0 12.9121 0 12.336V4.97134C0 4.92994 0.00161725 4.88887 0.00479439 4.84821L9.11923 9.58498Z"
:fill="darkColor"
/>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconInventory',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/inventory.vue
|
Vue
|
agpl-3.0
| 999
|
<template>
<svg
width="18"
height="18"
viewBox="0 0 18 18"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M2.475 6.3L0.3375 4.1625C-0.1125 3.7125 -0.1125 3.0375 0.3375 2.5875L2.5875 0.3375C3.0375 -0.1125 3.7125 -0.1125 4.1625 0.3375L6.3 2.475L2.475 6.3ZM15.525 11.7L17.6625 13.8375C17.8875 14.0625 18 14.2875 18 14.625V18H14.625C14.2875 18 14.0625 17.8875 13.8375 17.6625L11.7 15.525L15.525 11.7Z"
:fill="lightColor"
/>
<path
d="M17.6625 4.8375L13.1625 0.3375C12.7125 -0.1125 12.0375 -0.1125 11.5875 0.3375L10.125 1.8L12.0375 3.7125L10.4625 5.2875L8.55 3.375L6.75 5.175L8.6625 7.0875L7.0875 8.6625L5.175 6.75L3.375 8.55L5.2875 10.4625L3.7125 12.0375L1.8 10.125L0.3375 11.5875C-0.1125 12.0375 -0.1125 12.7125 0.3375 13.1625L4.8375 17.6625C5.2875 18.1125 5.9625 18.1125 6.4125 17.6625L17.6625 6.4125C18.1125 5.9625 18.1125 5.2875 17.6625 4.8375Z"
:fill="lightColor"
/>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconInvoice',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/invoice.vue
|
Vue
|
agpl-3.0
| 1,126
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18">
<path
fill="#F46181"
d="M13.7999992,0 C14.1311992,0 14.3999991,0.268799984 14.3999991,0.599999964 L14.3999991,2.99999982 C14.3999991,3.3311998 14.1311992,3.59999979 13.7999992,3.59999979 L0.599999964,3.59999979 C0.268799984,3.59999979 0,3.3311998 0,2.99999982 L0,0.599999964 C0,0.268799984 0.268799984,0 0.599999964,0 L13.7999992,0 Z M13.1999992,4.79999971 L13.1999992,12.5999992 C13.1999992,12.9311992 12.9311992,13.1999992 12.5999992,13.1999992 L1.79999989,13.1999992 C1.46879991,13.1999992 1.19999993,12.9311992 1.19999993,12.5999992 L1.19999993,4.79999971 L13.1999992,4.79999971 Z M9.59999943,9.59999943 L9.59999943,7.19999957 L4.79999971,7.19999957 L4.79999971,9.59999943 L9.59999943,9.59999943 Z"
transform="translate(2 2.2)"
/>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/item.vue
|
Vue
|
agpl-3.0
| 944
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18">
<path
fill="#6881DF"
d="M10.05,9.45 L18,5.175 L18,12.75 C18,13.9926407 16.9926407,15 15.75,15 L2.25,15 C1.00735931,15 -8.42477746e-13,13.9926407 -8.42629924e-13,12.75 L-8.42629924e-13,5.175 L7.95,9.45 C8.25827686,9.66106884 8.62674743,9.76634614 9,9.75 C9.37325257,9.76634614 9.74172314,9.66106884 10.05,9.45 Z M15.75,-5.55111512e-16 C16.9926407,1.44328993e-15 18,1.00735931 18,2.25 L18,3 C18.0014575,3.27504919 17.8593023,3.53092845 17.625,3.675 L9.375,8.175 C9.25984373,8.23562752 9.12961637,8.261673 9,8.25 C8.87038363,8.261673 8.74015627,8.23562752 8.625,8.175 L0.375,3.675 C0.140697691,3.53092845 -0.00145745239,3.27504919 -1.08668614e-12,3 L-1.08668614e-12,2.25 C-1.08653396e-12,1.00735931 1.00735931,-8.8817842e-16 2.25,-5.55111512e-16 L15.75,-5.55111512e-16 Z"
transform="translate(0 2)"
/>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/mail.vue
|
Vue
|
agpl-3.0
| 1,008
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18">
<path
fill="#FD9E64"
d="M17.25,3 L3,3 L2.25,3 C1.83675,3 1.5,2.66325 1.5,2.25 C1.5,1.83675 1.83675,1.5 2.25,1.5 L13.5,1.5 L13.5,2.25 L15,2.25 L15,0.75 C15,0.336 14.664,0 14.25,0 L2.25,0 C1.00725,0 0,1.00725 0,2.25 L0,15 C0,16.65675 1.34325,18 3,18 L17.25,18 C17.664,18 18,17.664 18,17.25 L18,3.75 C18,3.336 17.664,3 17.25,3 Z M13.5,12 C12.67125,12 12,11.32875 12,10.5 C12,9.67125 12.67125,9 13.5,9 C14.32875,9 15,9.67125 15,10.5 C15,11.32875 14.32875,12 13.5,12 Z"
/>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/opening-ac.vue
|
Vue
|
agpl-3.0
| 671
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18">
<path
fill="#D279E6"
fill-rule="evenodd"
d="M9,0 C4.03725,0 0,4.03725 0,9 C0,13.96275 4.03725,18 9,18 C13.96275,18 18,13.96275 18,9 C18,4.03725 13.96275,0 9,0 Z M4.5,6 C4.5,5.17125 5.17125,4.5 6,4.5 C6.82875,4.5 7.5,5.17125 7.5,6 C7.5,6.82875 6.82875,7.5 6,7.5 C5.17125,7.5 4.5,6.82875 4.5,6 Z M6,13.0605 L4.9395,12 L12,4.9395 L13.0605,6 L6,13.0605 Z M12,13.5 C11.17125,13.5 10.5,12.82875 10.5,12 C10.5,11.17125 11.17125,10.5 12,10.5 C12.82875,10.5 13.5,11.17125 13.5,12 C13.5,12.82875 12.82875,13.5 12,13.5 Z"
/>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/percentage.vue
|
Vue
|
agpl-3.0
| 723
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="none" d="M0 0h24v24H0z"></path>
<path
:fill="darkColor"
d="M21 13V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V13H2V11L3 6H21L22 11V13H21ZM5 13V19H19V13H5ZM6 14H14V17H6V14ZM3 3H21V5H3V3Z"
></path>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/pos.vue
|
Vue
|
agpl-3.0
| 430
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18">
<path
fill="#4ADAFC"
d="M14.25,0 L0.75,0 C0.336,0 0,0.33525 0,0.75 L0,18 L3,15.75 L5.25,18 L7.5,15.75 L9.75,18 L12,15.75 L15,18 L15,0.75 C15,0.33525 14.664,0 14.25,0 Z M8.25,12 L3,12 L3,10.5 L8.25,10.5 L8.25,12 Z M8.25,9 L3,9 L3,7.5 L8.25,7.5 L8.25,9 Z M8.25,6 L3,6 L3,4.5 L8.25,4.5 L8.25,6 Z M12,12 L9.75,12 L9.75,10.5 L12,10.5 L12,12 Z M12,9 L9.75,9 L9.75,7.5 L12,7.5 L12,9 Z M12,6 L9.75,6 L9.75,4.5 L12,4.5 L12,6 Z"
transform="translate(1.5)"
/>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/purchase-invoice.vue
|
Vue
|
agpl-3.0
| 658
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 18">
<g fill="none" fill-rule="evenodd" transform="translate(0 .5)">
<path
:fill="darkColor"
fill-rule="nonzero"
d="M0,4.3972168 L16,4.3972168 L16,15 C16,16.1045695 15.1045695,17 14,17 L2,17 C0.8954305,17 1.3527075e-16,16.1045695 0,15 L0,4.3972168 Z M8,12.2222222 C10.4,12.2222222 12.3636364,10.2722222 12.3636364,7.88888889 C12.3636364,7.45555556 12.0727273,7.16666667 11.6363636,7.16666667 C11.2,7.16666667 10.9090909,7.45555556 10.9090909,7.88888889 C10.9090909,9.47777778 9.6,10.7777778 8,10.7777778 C6.4,10.7777778 5.09090909,9.47777778 5.09090909,7.88888889 C5.09090909,7.45555556 4.8,7.16666667 4.36363636,7.16666667 C3.92727273,7.16666667 3.63636364,7.45555556 3.63636364,7.88888889 C3.63636364,10.2722222 5.6,12.2222222 8,12.2222222 Z"
/>
<path
:fill="lightColor"
d="M0,3 L1.49222874,1.12925513 C2.06146543,0.415626854 2.92465315,1.0558663e-15 3.83750348,8.8817842e-16 L12.1683182,-4.4408921e-16 C13.0831751,-6.12145698e-16 13.9480333,0.417447486 14.5171563,1.13373106 L16,3 L0,3 Z"
/>
</g>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconPurchase',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/purchase.vue
|
Vue
|
agpl-3.0
| 1,274
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 16">
<g fill-rule="evenodd">
<path
:fill="lightColor"
d="M16.2857143,2.5 L16.2857143,7.26902668 L11.9220779,7.26902668 C11.7032818,7.26906827 11.4982329,7.36737803 11.3613275,7.53318731 L11.2988052,7.62157447 L9.87116883,10 L7.50680519,4.09173512 C7.40433373,3.83523222 7.16527403,3.6589327 6.88983266,3.63673596 C6.64882146,3.61731381 6.41639286,3.71881295 6.26674592,3.90311574 L6.2078961,3.98706113 L4.23771429,7.26902668 L0.285714286,7.26902668 L0.285714286,2.5 C0.285714286,1.11928813 1.40500241,2.53632657e-16 2.78571429,0 L13.7857143,0 C15.1664262,-1.47995115e-15 16.2857143,1.11928813 16.2857143,2.5 Z"
/>
<path
:fill="darkColor"
d="M0.285714286,13.5 L0.285714286,8.73097332 L4.64935065,8.73097332 C4.86814675,8.73093173 5.07319563,8.63262197 5.2101011,8.46681269 L5.27262338,8.37842553 L6.70025974,6 L9.06462338,11.9104456 C9.15434161,12.1350283 9.34876191,12.2981168 9.58061609,12.3501369 L9.68207792,12.3654867 L9.74025974,12.3654867 C9.95905584,12.3654451 10.1641047,12.2671353 10.3010102,12.101326 L10.3635325,12.0129389 L12.3337143,8.73097332 L16.2857143,8.73097332 L16.2857143,13.5 C16.2857143,14.8807119 15.1664262,16 13.7857143,16 L2.78571429,16 C1.40500241,16 0.285714286,14.8807119 0.285714286,13.5 Z"
/>
</g>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconReports',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/reports.vue
|
Vue
|
agpl-3.0
| 1,494
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18">
<path
fill="#126FE1"
d="M7.125,9.75 C6.08946609,9.75 5.25,8.91053391 5.25,7.875 C5.25,6.83946609 6.08946609,6 7.125,6 C8.16053391,6 9,6.83946609 9,7.875 C9,8.91053391 8.16053391,9.75 7.125,9.75 Z M14.25,0 C14.6642136,2.53632657e-17 15,0.335786438 15,0.75 L15,17.25 C15,17.6642136 14.6642136,18 14.25,18 L0.75,18 C0.335786438,18 0,17.6642136 0,17.25 L0,0.75 C0,0.335786438 0.335786438,-2.53632657e-17 0.75,0 L14.25,0 Z M11.25,13.0605 L12.3105,12 L9.975,9.6645 C10.3162196,9.12988339 10.4983068,8.50922619 10.5,7.875 C10.5,6.01103897 8.98896103,4.5 7.125,4.5 C5.26103897,4.5 3.75,6.01103897 3.75,7.875 C3.75,9.73896103 5.26103897,11.25 7.125,11.25 C7.75922619,11.2483068 8.37988339,11.0662196 8.9145,10.725 L11.25,13.0605 Z"
transform="translate(1.5)"
/>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/review-ac.vue
|
Vue
|
agpl-3.0
| 962
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18">
<path
fill="#36D3B1"
d="M14.25,0 L0.75,0 C0.335786438,-2.53632657e-17 0,0.335786438 0,0.75 L0,17.901 L3,15.9 L5.25,17.4 L7.5,15.9 L9.75,17.4 L12,15.9 L15,17.8995 L15,0.75 C15,0.335786438 14.6642136,2.53632657e-17 14.25,0 Z M8.25,11.25 L3,11.25 L3,9.75 L8.25,9.75 L8.25,11.25 Z M7.5,7.5 C6.25735931,7.5 5.25,6.49264069 5.25,5.25 C5.25,4.00735931 6.25735931,3 7.5,3 C8.74264069,3 9.75,4.00735931 9.75,5.25 C9.75,5.8467371 9.51294711,6.41903341 9.09099026,6.84099026 C8.66903341,7.26294711 8.0967371,7.5 7.5,7.5 Z M12,11.25 L9.75,11.25 L9.75,9.75 L12,9.75 L12,11.25 Z"
transform="translate(1.5)"
/>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/sales-invoice.vue
|
Vue
|
agpl-3.0
| 805
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 14">
<g fill="none" fill-rule="evenodd">
<path
:fill="darkColor"
d="M0,5.11230469 L16,5.11230469 L16,12 C16,13.1045695 15.1045695,14 14,14 L2,14 C0.8954305,14 1.3527075e-16,13.1045695 0,12 L0,5.11230469 Z M8.5,10 C8.22385763,10 8,10.2238576 8,10.5 C8,10.7761424 8.22385763,11 8.5,11 L12.5,11 C12.7761424,11 13,10.7761424 13,10.5 C13,10.2238576 12.7761424,10 12.5,10 L8.5,10 Z"
/>
<path
:fill="lightColor"
d="M2,0 L14,0 C15.1045695,-2.02906125e-16 16,0.8954305 16,2 L16,3.64526367 L0,3.64526367 L0,2 C-1.3527075e-16,0.8954305 0.8954305,2.02906125e-16 2,0 Z"
/>
</g>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconSales',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/sales.vue
|
Vue
|
agpl-3.0
| 828
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 18">
<g fill="none" fill-rule="evenodd" transform="translate(0 .5)">
<path
:fill="lightColor"
d="M4,8 L12,8 C14.1818182,8 16,6.18181818 16,4 C16,1.81818182 14.1818182,0 12,0 L4,0 C1.81818182,0 0,1.81818182 0,4 C0,6.18181818 1.81818182,8 4,8 Z M4,1.45454545 C5.38181818,1.45454545 6.54545455,2.61818182 6.54545455,4 C6.54545455,5.38181818 5.38181818,6.54545455 4,6.54545455 C2.61818182,6.54545455 1.45454545,5.38181818 1.45454545,4 C1.45454545,2.61818182 2.61818182,1.45454545 4,1.45454545 Z"
/>
<path
:fill="darkColor"
d="M12,9 L4,9 C1.81818182,9 0,10.8181818 0,13 C0,15.1818182 1.81818182,17 4,17 L12,17 C14.1818182,17 16,15.1818182 16,13 C16,10.8181818 14.1818182,9 12,9 Z M12,15.5454545 C10.6181818,15.5454545 9.45454545,14.3818182 9.45454545,13 C9.45454545,11.6181818 10.6181818,10.4545455 12,10.4545455 C13.3818182,10.4545455 14.5454545,11.6181818 14.5454545,13 C14.5454545,14.3818182 13.3818182,15.5454545 12,15.5454545 Z"
/>
</g>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconSettings',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/settings.vue
|
Vue
|
agpl-3.0
| 1,203
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18">
<g fill="none" fill-rule="evenodd" transform="translate(0 .35)">
<path
fill="#A1ABB4"
d="M6.54141662,5.52328734 L5.44516019,6.46319093 L3.81100888,4.82904 L2.88004888,5.76 L4.8879784e-05,2.88 L2.88004888,-2.5903612e-12 L5.76004888,2.88 L4.82908888,3.81096 L6.54141662,5.52328734 Z M13.6368489,10.0368 L16.5348489,12.93408 C17.5291689,13.9284 17.5291689,15.53976 16.5348489,16.53408 C15.5405289,17.5284 13.9291689,17.5284 12.9348489,16.53408 L9.68188888,13.28112 L12.3034089,10.04184 C12.5222889,10.06704 12.7404489,10.08 12.9600489,10.08 C13.1890089,10.08 13.4143689,10.06272 13.6368489,10.0368 Z"
/>
<path
fill="#415668"
fill-rule="nonzero"
d="M14.5951689,4.87512 L12.4049289,2.68488 L14.7146889,0.37512 C14.1782889,0.13608 13.5857289,-1.77635684e-14 12.9600489,-1.77635684e-14 C10.5739689,-1.77635684e-14 8.64004888,1.93392 8.64004888,4.32 C8.64004888,4.74768 8.70412888,5.15952 8.82004888,5.54976 L1.05196888,11.83536 C0.41044888,12.402 0.0274088798,13.21704 0.00148887978,14.07168 C-0.0251511202,14.92704 0.30676888,15.7644 0.91156888,16.36848 C1.49908888,16.95672 2.28028888,17.28 3.11116888,17.28 C4.00324888,17.28 4.85428888,16.89696 5.44468888,16.22808 L11.7302889,8.46 C12.1205289,8.57592 12.5323689,8.64 12.9600489,8.64 C15.3461289,8.64 17.2800489,6.70608 17.2800489,4.32 C17.2800489,3.69432 17.1439689,3.10176 16.9049289,2.56464 L14.5951689,4.87512 Z"
/>
</g>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/18/start.vue
|
Vue
|
agpl-3.0
| 1,626
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g fill="none" fill-rule="evenodd">
<path
:fill="lightColor"
d="M9.08530087,7.67123242 L7.56272248,8.97665406 L5.29306789,6.707 L4.00006789,8 L6.78885887e-05,4 L4.00006789,-3.55351234e-12 L8.00006789,4 L6.70706789,5.293 L9.08530087,7.67123242 Z M18.9400679,13.94 L22.9650679,17.964 C24.3460679,19.345 24.3460679,21.583 22.9650679,22.964 C21.5840679,24.345 19.3460679,24.345 17.9650679,22.964 L13.4470679,18.446 L17.0880679,13.947 C17.3920679,13.982 17.6950679,14 18.0000679,14 C18.3180679,14 18.6310679,13.976 18.9400679,13.94 Z"
/>
<path
:fill="darkColor"
fill-rule="nonzero"
d="M20.2710679,6.771 L17.2290679,3.729 L20.4370679,0.521 C19.6920679,0.189 18.8690679,-1.77635684e-14 18.0000679,-1.77635684e-14 C14.6860679,-1.77635684e-14 12.0000679,2.686 12.0000679,6 C12.0000679,6.594 12.0890679,7.166 12.2500679,7.708 L1.46106789,16.438 C0.570067889,17.225 0.0380678886,18.357 0.00206788859,19.544 C-0.0349321114,20.732 0.426067889,21.895 1.26606789,22.734 C2.08206789,23.551 3.16706789,24 4.32106789,24 C5.56006789,24 6.74206789,23.468 7.56206789,22.539 L16.2920679,11.75 C16.8340679,11.911 17.4060679,12 18.0000679,12 C21.3140679,12 24.0000679,9.314 24.0000679,6 C24.0000679,5.131 23.8110679,4.308 23.4790679,3.562 L20.2710679,6.771 Z"
/>
</g>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconGeneral',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/24/general.vue
|
Vue
|
agpl-3.0
| 1,522
|
<template>
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd">
<path
d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12C23.98 5.38 18.62.02 12 0z"
fill="#92D336"
fill-rule="nonzero"
/>
<path
stroke="#FFF"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
d="M8 12.756l2.222 2.4L16 9.022"
/>
</g>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconGreenCheck',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/24/green-check.vue
|
Vue
|
agpl-3.0
| 602
|
import General from './general.vue';
import GreenCheck from './green-check.vue';
import Invoice from './invoice.vue';
import Mail from './mail.vue';
import Privacy from './privacy.vue';
import System from './system.vue';
// prettier-ignore
export default {
'general': General,
'green-check': GreenCheck,
'invoice': Invoice,
'mail': Mail,
'privacy': Privacy,
'system': System,
}
|
2302_79757062/books
|
src/components/Icons/24/index.ts
|
TypeScript
|
agpl-3.0
| 392
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g fill="none" fill-rule="evenodd">
<path
:fill="lightColor"
d="M3.3,8.4 L0.45,5.55 C-0.15,4.95 -0.15,4.05 0.45,3.45 L3.45,0.45 C4.05,-0.15 4.95,-0.15 5.55,0.45 L8.4,3.3 L3.3,8.4 Z M20.7,15.6 L23.55,18.45 C23.85,18.75 24,19.05 24,19.5 L24,24 L19.5,24 C19.05,24 18.75,23.85 18.45,23.55 L15.6,20.7 L20.7,15.6 Z"
/>
<path
:fill="darkColor"
fill-rule="nonzero"
d="M23.55,6.45 L17.55,0.45 C16.95,-0.15 16.05,-0.15 15.45,0.45 L13.5,2.4 L16.05,4.95 L13.95,7.05 L11.4,4.5 L9,6.9 L11.55,9.45 L9.45,11.55 L6.9,9 L4.5,11.4 L7.05,13.95 L4.95,16.05 L2.4,13.5 L0.45,15.45 C-0.15,16.05 -0.15,16.95 0.45,17.55 L6.45,23.55 C7.05,24.15 7.95,24.15 8.55,23.55 L23.55,8.55 C24.15,7.95 24.15,7.05 23.55,6.45 Z"
/>
</g>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconInvoice',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/24/invoice.vue
|
Vue
|
agpl-3.0
| 975
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 20">
<g fill="none" fill-rule="evenodd">
<path
:fill="lightColor"
fill-rule="nonzero"
d="M13.4,12.6 C12.9889642,12.8814251 12.4976701,13.0217949 12,13 C11.5023299,13.0217949 11.0110358,12.8814251 10.6,12.6 L0,6.9 L0,17 C2.02906125e-16,18.6568542 1.34314575,20 3,20 L21,20 C22.6568542,20 24,18.6568542 24,17 L24,6.9 L13.4,12.6 Z"
/>
<path
:fill="darkColor"
d="M21,-4.4408921e-16 L3,-4.4408921e-16 C1.34314575,-8.8817842e-16 4.60042228e-16,1.34314575 2.57135486e-16,3 L2.57135486e-16,4 C-0.00194326986,4.36673226 0.187596922,4.7079046 0.5,4.9 L11.5,10.9 C11.6535417,10.9808367 11.8271782,11.015564 12,11 C12.1728218,11.015564 12.3464583,10.9808367 12.5,10.9 L23.5,4.9 C23.8124031,4.7079046 24.0019433,4.36673226 24,4 L24,3 C24,1.34314575 22.6568542,2.22044605e-15 21,-4.4408921e-16 Z"
/>
</g>
</svg>
</template>
<script>
import Base from '../base.vue';
export default {
name: 'IconMail',
extends: Base,
};
</script>
|
2302_79757062/books
|
src/components/Icons/24/mail.vue
|
Vue
|
agpl-3.0
| 1,061
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 7">
<g fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
<path d="M6.8 4.002L.8 4M4.6 1.335l2.667 2.667L4.6 6.668" />
</g>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/8/arrow-right.vue
|
Vue
|
agpl-3.0
| 244
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 10">
<path
d="M4.75 8.5L1.25 5l3.5-3.5"
stroke-width="1.5"
fill-rule="evenodd"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/8/chevron-left.vue
|
Vue
|
agpl-3.0
| 256
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 8">
<path
d="M1.25 7.75l3.5-3.5-3.5-3.5"
fill-rule="evenodd"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/8/chevron-right.vue
|
Vue
|
agpl-3.0
| 232
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8">
<circle cx="4" cy="4" r="3.5" fill-rule="evenodd" />
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/8/circle.vue
|
Vue
|
agpl-3.0
| 150
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 2">
<path
d="M1.633 1.033a.833.833 0 11-1.666 0 .833.833 0 011.666 0zm3.2 0a.833.833 0 11-1.666 0 .833.833 0 011.666 0zm3.2 0a.833.833 0 11-1.666 0 .833.833 0 011.666 0z"
fill-rule="nonzero"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/8/dot-horizontal.vue
|
Vue
|
agpl-3.0
| 303
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 9">
<path
d="M1 6.4a.833.833 0 110 1.667A.833.833 0 011 6.4zm0-3.2a.833.833 0 110 1.667A.833.833 0 011 3.2zM1 0a.833.833 0 110 1.667A.833.833 0 011 0z"
fill-rule="nonzero"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/8/dot-vertical.vue
|
Vue
|
agpl-3.0
| 284
|
import ArrowRight from './arrow-right.vue';
import ChevronLeft from './chevron-left.vue';
import ChevronRight from './chevron-right.vue';
import Circle from './circle.vue';
import DotHorizontal from './dot-horizontal.vue';
import DotVertical from './dot-vertical.vue';
import Pencil from './pencil.vue';
import Plus from './plus.vue';
import Up from './up.vue';
import X from './x.vue';
// prettier-ignore
export default {
'arrow-right': ArrowRight,
'chevron-left': ChevronLeft,
'chevron-right': ChevronRight,
'circle': Circle,
'dot-horizontal': DotHorizontal,
'dot-vertical': DotVertical,
'pencil': Pencil,
'plus': Plus,
'up': Up,
'x': X,
}
|
2302_79757062/books
|
src/components/Icons/8/index.ts
|
TypeScript
|
agpl-3.0
| 663
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
<path
d="M7 1.4L8.6 3 3.8 7.8l-2.4.8.8-2.4z"
fill-rule="evenodd"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/8/pencil.vue
|
Vue
|
agpl-3.0
| 242
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8">
<path
d="M4 .8v6.4M7.2 4H.8"
fill-rule="evenodd"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/8/plus.vue
|
Vue
|
agpl-3.0
| 224
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 8">
<g fill-rule="nonzero">
<path d="M0 3h6L3 0z" />
<path opacity=".5" d="M3 8l3-3H0z" />
</g>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/8/up.vue
|
Vue
|
agpl-3.0
| 205
|
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8">
<path
d="M7.2.8L.8 7.2m6.4 0L.8.8"
fill-rule="evenodd"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</template>
|
2302_79757062/books
|
src/components/Icons/8/x.vue
|
Vue
|
agpl-3.0
| 230
|
<script lang="ts">
import { uicolors } from 'src/utils/colors';
export default {
name: 'IconBase',
props: {
active: Boolean,
darkMode: { type: Boolean, default: false },
},
computed: {
lightColor(): string {
const activeGray = this.darkMode
? uicolors.gray['500']
: uicolors.gray['600'];
const passiveGray = this.darkMode
? uicolors.gray['700']
: uicolors.gray['400'];
return this.active ? activeGray : passiveGray;
},
darkColor(): string {
const activeGray = this.darkMode
? uicolors.gray['200']
: uicolors.gray['800'];
const passiveGray = this.darkMode
? uicolors.gray['500']
: uicolors.gray['600'];
return this.active ? activeGray : passiveGray;
},
bgColor(): string {
return this.darkMode ? uicolors.gray['900'] : uicolors.gray['100'];
},
},
};
</script>
|
2302_79757062/books
|
src/components/Icons/base.vue
|
Vue
|
agpl-3.0
| 908
|
<template>
<div
v-if="open && !close"
class="absolute bottom-0 flex justify-end pb-6 pe-6"
:style="{ width: fullWidth ? '100%' : 'calc(100% - 12rem)' }"
>
<!-- Loading Continer -->
<div
class="
border
dark:border-gray-800
text-gray-900
dark:text-gray-100
shadow-lg
px-3
py-3
items-center
w-96
z-10
bg-white
dark:bg-gray-900
rounded-lg
"
>
<!-- Message -->
<p
v-if="message?.length"
class="text-base text-gray-600 dark:text-gray-400 pb-2"
>
{{ message }}
</p>
<!-- Loading Bar Container -->
<div class="w-full flex flex-row items-center">
<!-- Loading Bar BG -->
<div
class="w-full h-3 me-2 rounded"
:class="
percent >= 0
? 'bg-gray-200 dark:bg-gray-800'
: 'bg-gray-300 dark:bg-gray-700'
"
>
<!-- Loading Bar -->
<div
v-if="percent >= 0"
class="h-3 rounded bg-gray-800 dark:bg-gray-200"
:style="{ width: `${percent * 100}%` }"
></div>
</div>
<!-- Close Icon -->
<feather-icon
v-if="showX"
name="x"
class="
w-4
h-4
ms-auto
text-gray-600
dark:text-gray-400
cursor-pointer
hover:text-gray-800
dark:hover:text-gray-200
"
@click="closeToast"
/>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
open: { type: Boolean, default: false },
percent: { type: Number, default: 0.5 },
message: { type: String, default: '' },
fullWidth: { type: Boolean, default: false },
showX: { type: Boolean, default: true },
},
data() {
return {
close: false,
};
},
mounted() {
window.l = this;
},
methods: {
closeToast() {
this.close = true;
},
},
};
</script>
|
2302_79757062/books
|
src/components/Loading.vue
|
Vue
|
agpl-3.0
| 2,077
|
<template>
<Transition>
<div
v-if="openModal"
class="backdrop z-20 flex justify-center items-center"
@click="$emit('closemodal')"
>
<div
class="
bg-white
dark:bg-gray-850
rounded-lg
shadow-2xl
border
dark:border-gray-800
overflow-hidden
inner
"
v-bind="$attrs"
@click.stop
>
<slot></slot>
</div>
</div>
</Transition>
</template>
<script lang="ts">
import { shortcutsKey } from 'src/utils/injectionKeys';
import { defineComponent, inject } from 'vue';
export default defineComponent({
props: {
openModal: {
default: false,
type: Boolean,
},
},
emits: ['closemodal'],
setup() {
const context = `Modal-` + Math.random().toString(36).slice(2, 6);
return { shortcuts: inject(shortcutsKey), context };
},
watch: {
openModal(value: boolean) {
if (value) {
this.shortcuts?.set(this.context, ['Escape'], () => {
this.$emit('closemodal');
});
} else {
this.shortcuts?.delete(this.context);
}
},
},
});
</script>
<style scoped>
.v-enter-active,
.v-leave-active {
transition: all 100ms ease-out;
}
.inner {
transition: all 150ms ease-out;
}
.v-enter-from,
.v-leave-to {
opacity: 0;
}
.v-enter-from .inner,
.v-leave-to .inner {
transform: translateY(-50px);
}
.v-enter-to .inner,
.v-leave-from .inner {
transform: translateY(0px);
}
</style>
|
2302_79757062/books
|
src/components/Modal.vue
|
Vue
|
agpl-3.0
| 1,519
|
<template>
<Tooltip ref="tooltip"><slot></slot></Tooltip>
</template>
<script>
import { defineComponent } from 'vue';
import Tooltip from './Tooltip.vue';
export default defineComponent({
components: { Tooltip },
props: { show: { type: Boolean, default: false } },
watch: {
show(val) {
if (val) {
this.$refs.tooltip.create();
this.setListeners();
} else {
this.$refs.tooltip.destroy();
this.removeListener();
}
},
},
methods: {
mousemoveListener(e) {
this.$refs.tooltip.update(e);
},
setListeners() {
window.addEventListener('mousemove', this.mousemoveListener);
},
removeListener() {
window.removeEventListener('mousemove', this.mousemoveListener);
},
},
});
</script>
|
2302_79757062/books
|
src/components/MouseFollower.vue
|
Vue
|
agpl-3.0
| 786
|
<template>
<div class="relative">
<input
:type="inputType"
:class="[inputClasses, size === 'large' ? 'text-lg' : 'text-sm']"
:value="round(value)"
:max="isNumeric(df) ? df.maxvalue : undefined"
:min="isNumeric(df) ? df.minvalue : undefined"
:readonly="isReadOnly"
:tabindex="isReadOnly ? '-1' : '0'"
@blur="onBlur"
class="
block
px-2.5
pb-2.5
pt-4
w-full
font-medium
text-gray-900
dark:text-gray-100
bg-gray-25
dark:bg-gray-850
rounded-lg
border border-gray-200
dark:border-gray-800
appearance-none
focus:outline-none focus:ring-0
peer
"
/>
<label
for="floating_outlined"
:class="size === 'large' ? 'text-xl' : 'text-md'"
class="
absolute
font-medium
text-gray-500
duration-300
transform
-translate-y-4
scale-75
top-8
z-10
origin-[0]
bg-white2
px-2
peer-focus:px-2 peer-focus:text-blue-600
peer-placeholder-shown:scale-100
peer-placeholder-shown:-translate-y-1/2
peer-placeholder-shown:top-1/2
peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4
left-1
"
>{{ currency ? fyo.currencySymbols[currency] : undefined }}</label
>
<label
for="floating_outlined"
:class="size === 'large' ? 'text-xl' : 'text-md'"
class="
absolute
font-medium
text-gray-500
duration-300
transform
-translate-y-4
scale-75
top-1
z-10
origin-[0]
bg-white2
px-2
peer-focus:px-2 peer-focus:text-blue-600
peer-placeholder-shown:scale-100
peer-placeholder-shown:-translate-y-1/2
peer-placeholder-shown:top-1/2
peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4
left-1
"
>{{ df.label }}</label
>
</div>
</template>
<script lang="ts">
import FloatingLabelInputBase from './FloatingLabelInputBase.vue';
import { safeParsePesa } from 'utils/index';
import { isPesa } from 'fyo/utils';
import { fyo } from 'src/initFyo';
import { defineComponent } from 'vue';
import { Money } from 'pesa';
export default defineComponent({
name: 'FloatingLabelCurrencyInput',
extends: FloatingLabelInputBase,
computed: {
currency(): string | undefined {
if (this.value) {
return (this.value as Money).getCurrency();
}
},
},
methods: {
round(v: unknown) {
if (!isPesa(v)) {
v = this.parse(v);
}
if (isPesa(v)) {
return v.round();
}
return fyo.pesa(0).round();
},
parse(value: unknown): Money {
return safeParsePesa(value, this.fyo);
},
},
});
</script>
|
2302_79757062/books
|
src/components/POS/FloatingLabelCurrencyInput.vue
|
Vue
|
agpl-3.0
| 2,896
|
<script lang="ts">
import { defineComponent } from 'vue';
import FloatingLabelInputBase from './FloatingLabelInputBase.vue';
export default defineComponent({
name: 'FloatingLabelFloatInput',
extends: FloatingLabelInputBase,
computed: {
inputType() {
return 'number';
},
},
});
</script>
|
2302_79757062/books
|
src/components/POS/FloatingLabelFloatInput.vue
|
Vue
|
agpl-3.0
| 310
|
<template>
<div class="relative">
<input
:type="inputType"
:class="[inputClasses, size === 'large' ? 'text-lg' : 'text-sm']"
:value="value"
:max="isNumeric(df) ? df.maxvalue : undefined"
:min="isNumeric(df) ? df.minvalue : undefined"
:readonly="isReadOnly"
:tabindex="isReadOnly ? '-1' : '0'"
@blur="onBlur"
class="
block
px-2.5
pb-2.5
pt-4
w-full
font-medium
text-gray-900
dark:text-gray-100
bg-gray-25
dark:bg-gray-850
rounded-lg
border border-gray-200
dark:border-gray-800
appearance-none
focus:outline-none focus:ring-0
peer
"
/>
<label
for="floating_outlined"
:class="size === 'large' ? 'text-xl' : 'text-md'"
class="
absolute
font-medium
text-gray-500
duration-300
transform
-translate-y-4
scale-75
top-1
z-10
origin-[0]
bg-white2
px-2
peer-focus:px-2 peer-focus:text-blue-600 peer-focus:dark:text-blue-500
peer-placeholder-shown:scale-100
peer-placeholder-shown:-translate-y-1/2
peer-placeholder-shown:top-1/2
peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4
left-1
"
>{{ df.label }}</label
>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import Base from '../Controls/Base.vue';
export default defineComponent({
name: 'FloatingLabelInputBase',
extends: Base,
});
</script>
|
2302_79757062/books
|
src/components/POS/FloatingLabelInputBase.vue
|
Vue
|
agpl-3.0
| 1,613
|
<template>
<Row
:ratio="ratio"
class="
border
dark:border-gray-800
flex
items-center
mt-4
px-2
rounded-t-md
text-gray-600
dark:text-gray-400
w-full
"
>
<div
v-for="df in tableFields"
:key="df.fieldname"
class="flex items-center px-2 py-2 text-lg"
:class="{
'ms-auto': isNumeric(df as Field),
}"
:style="{
height: ``,
}"
>
{{ df.label }}
</div>
</Row>
<div class="overflow-y-auto" style="height: 72.5vh">
<Row
v-if="items"
v-for="row in items"
:ratio="ratio"
:border="true"
class="
border-b border-l border-r
dark:border-gray-800
flex
group
h-row-mid
hover:bg-gray-25
dark:bg-gray-890
items-center
justify-center
px-2
w-full
"
@click="handleChange(row as POSItem)"
>
<FormControl
v-for="df in tableFields"
:key="df.fieldname"
size="large"
class=""
:df="df"
:value="row[df.fieldname]"
:readOnly="true"
/>
</Row>
</div>
</template>
<script lang="ts">
import FormControl from '../Controls/FormControl.vue';
import Row from 'src/components/Row.vue';
import { isNumeric } from 'src/utils';
import { inject } from 'vue';
import { fyo } from 'src/initFyo';
import { defineComponent } from 'vue';
import { ModelNameEnum } from 'models/types';
import { Field } from 'schemas/types';
import { ItemQtyMap } from './types';
import { Item } from 'models/baseModels/Item/Item';
import { POSItem } from './types';
import { Money } from 'pesa';
export default defineComponent({
name: 'ItemsTable',
components: { FormControl, Row },
emits: ['addItem', 'updateValues'],
setup() {
return {
itemQtyMap: inject('itemQtyMap') as ItemQtyMap,
};
},
data() {
return {
items: [] as POSItem[],
};
},
computed: {
ratio() {
return [1, 1, 1, 0.7];
},
tableFields() {
return [
{
fieldname: 'name',
fieldtype: 'Data',
label: 'Item',
placeholder: 'Item',
readOnly: true,
},
{
fieldname: 'rate',
label: 'Rate',
placeholder: 'Rate',
fieldtype: 'Currency',
readOnly: true,
},
{
fieldname: 'availableQty',
label: 'Available Qty',
placeholder: 'Available Qty',
fieldtype: 'Float',
readOnly: true,
},
{
fieldname: 'unit',
label: 'Unit',
placeholder: 'Unit',
fieldtype: 'Data',
target: 'UOM',
readOnly: true,
},
] as Field[];
},
},
watch: {
itemQtyMap: {
async handler() {
this.setItems();
},
deep: true,
},
},
async activated() {
await this.setItems();
},
methods: {
async setItems() {
const items = (await fyo.db.getAll(ModelNameEnum.Item, {
fields: [],
filters: { trackItem: true },
})) as Item[];
this.items = [] as POSItem[];
for (const item of items) {
let availableQty = 0;
if (!!this.itemQtyMap[item.name as string]) {
availableQty = this.itemQtyMap[item.name as string].availableQty;
}
if (!item.name) {
return;
}
this.items.push({
availableQty,
name: item.name,
rate: item.rate as Money,
unit: item.unit as string,
hasBatch: !!item.hasBatch,
hasSerialNumber: !!item.hasSerialNumber,
});
}
},
handleChange(value: POSItem) {
this.$emit('addItem', value);
this.$emit('updateValues');
},
isNumeric,
},
});
</script>
|
2302_79757062/books
|
src/components/POS/ItemsTable.vue
|
Vue
|
agpl-3.0
| 3,874
|
<template>
<feather-icon
:name="isExapanded ? 'chevron-up' : 'chevron-down'"
class="w-4 h-4 inline-flex"
@click="isExapanded = !isExapanded"
/>
<div class="relative">
<Link
class="pt-2"
:df="{
fieldname: 'item',
fieldtype: 'Data',
label: 'item',
}"
size="small"
:border="false"
:value="row.item"
:read-only="true"
/>
<p
v-if="row.isFreeItem"
class="absolute flex top-0 font-medium text-xs ml-2 text-green-800"
style="font-size: 0.6rem"
>
{{ row.pricingRule }}
</p>
</div>
<Int
:df="{
fieldname: 'quantity',
fieldtype: 'Int',
label: 'Quantity',
}"
size="small"
:border="false"
:value="row.quantity"
:read-only="true"
/>
<Link
:df="{
fieldname: 'unit',
fieldtype: 'Data',
label: 'Unit',
}"
size="small"
:border="false"
:value="row.unit"
:read-only="true"
/>
<Currency
:df="{
fieldtype: 'Currency',
fieldname: 'rate',
label: 'rate',
}"
size="small"
:border="false"
:value="row.rate"
:read-only="true"
/>
<Currency
:df="{
fieldtype: 'Currency',
fieldname: 'amount',
label: 'Amount',
}"
size="small"
:border="false"
:value="row.amount"
:read-only="true"
/>
<div class="px-4">
<feather-icon
name="trash"
class="w-4 text-xl text-red-500"
@click="removeAddedItem(row)"
/>
</div>
<div></div>
<template v-if="isExapanded">
<div class="px-4 pt-6 col-span-1">
<Float
:df="{
fieldname: 'quantity',
fieldtype: 'Float',
label: 'Quantity',
}"
size="medium"
:min="0"
:border="true"
:show-label="true"
:value="row.quantity"
@change="(value:number) => setQuantity((row.quantity = value))"
:read-only="isReadOnly"
/>
</div>
<div class="px-4 pt-6 col-span-2 flex">
<Link
v-if="isUOMConversionEnabled"
:df="{
fieldname: 'transferUnit',
fieldtype: 'Link',
target: 'UOM',
label: t`Transfer Unit`,
}"
class="flex-1"
:show-label="true"
:border="true"
:value="row.transferUnit"
@change="(value:string) => row.set('transferUnit', value)"
:read-only="isReadOnly"
/>
<feather-icon
v-if="isUOMConversionEnabled"
name="refresh-ccw"
class="w-3.5 ml-2 mt-4 text-blue-500"
@click="row.transferUnit = row.unit"
:read-only="isReadOnly"
/>
</div>
<div class="px-4 pt-6 col-span-2">
<Int
v-if="isUOMConversionEnabled"
:df="{
fieldtype: 'Int',
fieldname: 'transferQuantity',
label: 'Transfer Quantity',
}"
size="medium"
:border="true"
:show-label="true"
:value="row.transferQuantity"
@change="(value:string) => row.set('transferQuantity', value)"
:read-only="isReadOnly"
/>
</div>
<div></div>
<div></div>
<div class="px-4 pt-6 flex">
<Currency
:df="{
fieldtype: 'Currency',
fieldname: 'rate',
label: 'Rate',
}"
size="medium"
:show-label="true"
:border="true"
:value="row.rate"
:read-only="isReadOnly"
@change="(value:Money) => setRate((row.rate = value))"
/>
<feather-icon
name="refresh-ccw"
class="w-3.5 ml-2 mt-5 text-blue-500 flex-none"
@click="row.rate= (defaultRate as Money)"
/>
</div>
<div class="px-6 pt-6 col-span-2">
<Currency
v-if="isDiscountingEnabled"
:df="{
fieldtype: 'Currency',
fieldname: 'discountAmount',
label: 'Discount Amount',
}"
class="col-span-2"
size="medium"
:show-label="true"
:border="true"
:value="row.itemDiscountAmount"
:read-only="row.itemDiscountPercent as number > 0 || isReadOnly"
@change="(value:number) => setItemDiscount('amount', value)"
/>
</div>
<div class="px-4 pt-6 col-span-2">
<Float
v-if="isDiscountingEnabled"
:df="{
fieldtype: 'Float',
fieldname: 'itemDiscountPercent',
label: 'Discount Percent',
}"
size="medium"
:show-label="true"
:border="true"
:value="row.itemDiscountPercent"
:read-only="!row.itemDiscountAmount?.isZero() || isReadOnly"
@change="(value:number) => setItemDiscount('percent', value)"
/>
</div>
<div class=""></div>
<div
v-if="row.links?.item && row.links?.item.hasBatch"
class="pl-6 px-4 pt-6 col-span-2"
>
<Link
:df="{
fieldname: 'batch',
fieldtype: 'Link',
target: 'Batch',
label: t`Batch`,
}"
:value="row.batch"
:border="true"
:show-label="true"
:read-only="false"
@change="(value:string) => setBatch(value)"
/>
</div>
<div
v-if="row.links?.item && row.links?.item.hasBatch"
class="px-2 pt-6 col-span-2"
>
<Float
:df="{
fieldname: 'availableQtyInBatch',
fieldtype: 'Float',
label: t`Qty in Batch`,
}"
size="medium"
:min="0"
:value="availableQtyInBatch"
:show-label="true"
:border="true"
:read-only="true"
:text-right="true"
/>
</div>
<div v-if="hasSerialNumber" class="px-2 pt-8 col-span-2">
<Text
:df="{
label: t`Serial Number`,
fieldtype: 'Text',
fieldname: 'serialNumber',
}"
:value="row.serialNumber"
:show-label="true"
:border="true"
:required="hasSerialNumber"
@change="(value:string)=> setSerialNumber(value)"
/>
</div>
</template>
</template>
<script lang="ts">
import Currency from '../Controls/Currency.vue';
import Data from '../Controls/Data.vue';
import Float from '../Controls/Float.vue';
import Int from '../Controls/Int.vue';
import Link from '../Controls/Link.vue';
import Text from '../Controls/Text.vue';
import { inject } from 'vue';
import { fyo } from 'src/initFyo';
import { defineComponent } from 'vue';
import { SalesInvoiceItem } from 'models/baseModels/SalesInvoiceItem/SalesInvoiceItem';
import { Money } from 'pesa';
import { DiscountType } from './types';
import { t } from 'fyo';
import { validateSerialNumberCount } from 'src/utils/pos';
import { ApplicablePricingRules } from 'models/baseModels/Invoice/types';
export default defineComponent({
name: 'SelectedItemRow',
components: { Currency, Data, Float, Int, Link, Text },
props: {
row: { type: SalesInvoiceItem, required: true },
},
emits: ['runSinvFormulas', 'setItemSerialNumbers', 'addItem'],
setup() {
return {
isDiscountingEnabled: inject('isDiscountingEnabled') as boolean,
itemSerialNumbers: inject('itemSerialNumbers') as {
[item: string]: string;
},
};
},
data() {
return {
isExapanded: false,
batches: [] as string[],
availableQtyInBatch: 0,
defaultRate: this.row.rate as Money,
};
},
computed: {
isUOMConversionEnabled(): boolean {
return !!fyo.singles.InventorySettings?.enableUomConversions;
},
hasSerialNumber(): boolean {
return !!(this.row.links?.item && this.row.links?.item.hasSerialNumber);
},
isReadOnly() {
return this.row.isFreeItem;
},
},
methods: {
async getAvailableQtyInBatch(): Promise<number> {
if (!this.row.batch) {
return 0;
}
return (
(await fyo.db.getStockQuantity(
this.row.item as string,
undefined,
undefined,
undefined,
this.row.batch
)) ?? 0
);
},
async setBatch(batch: string) {
this.row.set('batch', batch);
this.availableQtyInBatch = await this.getAvailableQtyInBatch();
},
setSerialNumber(serialNumber: string) {
if (!serialNumber) {
return;
}
this.itemSerialNumbers[this.row.item as string] = serialNumber;
validateSerialNumberCount(
serialNumber,
this.row.quantity ?? 0,
this.row.item!
);
},
setItemDiscount(type: DiscountType, value: Money | number) {
if (type === 'percent') {
this.row.set('setItemDiscountAmount', false);
this.row.set('itemDiscountPercent', value as number);
return;
}
this.row.set('setItemDiscountAmount', true);
this.row.set('itemDiscountAmount', value as Money);
},
setRate(rate: Money) {
this.row.setRate = rate;
this.$emit('runSinvFormulas');
},
async setQuantity(quantity: number) {
this.row.set('quantity', quantity);
if (!this.row.isFreeItem) {
await this.updatePricingRuleItem();
this.$emit('runSinvFormulas');
}
},
async removeAddedItem(row: SalesInvoiceItem) {
this.row.parentdoc?.remove('items', row?.idx as number);
if (!row.isFreeItem) {
await this.updatePricingRuleItem();
}
},
async updatePricingRuleItem() {
const pricingRule =
(await this.row.parentdoc?.getPricingRule()) as ApplicablePricingRules[];
let appliedPricingRuleCount: number;
setTimeout(async () => {
if (appliedPricingRuleCount !== pricingRule?.length) {
appliedPricingRuleCount = pricingRule?.length;
await this.row.parentdoc?.appendPricingRuleDetail(pricingRule);
await this.row.parentdoc?.applyProductDiscount();
}
}, 1);
},
},
});
</script>
|
2302_79757062/books
|
src/components/POS/SelectedItemRow.vue
|
Vue
|
agpl-3.0
| 9,874
|
<template>
<Row
:ratio="ratio"
class="
border
dark:border-gray-800
rounded-t
px-2
text-gray-600
dark:text-gray-400
w-full
flex
items-center
mt-4
"
>
<div
v-if="tableFields"
v-for="df in tableFields"
:key="df.fieldname"
class="items-center text-lg flex px-2 py-2"
:class="{
'ms-auto': isNumeric(df as Field),
}"
:style="{
height: ``,
}"
>
{{ df.label }}
</div>
</Row>
<div class="overflow-y-auto" style="height: 50vh">
<Row
v-for="row in sinvDoc.items"
:ratio="ratio"
class="
border
dark:border-gray-800
w-full
px-2
py-2
group
flex
items-center
justify-center
hover:bg-gray-25
dark:bg-gray-890
"
>
<SelectedItemRow
:row="(row as SalesInvoiceItem)"
@run-sinv-formulas="runSinvFormulas"
/>
</Row>
</div>
</template>
<script lang="ts">
import FormContainer from '../FormContainer.vue';
import FormControl from '../Controls/FormControl.vue';
import Link from '../Controls/Link.vue';
import Row from '../Row.vue';
import RowEditForm from 'src/pages/CommonForm/RowEditForm.vue';
import SelectedItemRow from './SelectedItemRow.vue';
import { isNumeric } from 'src/utils';
import { inject } from 'vue';
import { defineComponent } from 'vue';
import { SalesInvoiceItem } from 'models/baseModels/SalesInvoiceItem/SalesInvoiceItem';
import { SalesInvoice } from 'models/baseModels/SalesInvoice/SalesInvoice';
import { Field } from 'schemas/types';
export default defineComponent({
name: 'SelectedItemTable',
components: {
FormContainer,
FormControl,
Link,
Row,
RowEditForm,
SelectedItemRow,
},
setup() {
return {
sinvDoc: inject('sinvDoc') as SalesInvoice,
};
},
data() {
return {
isExapanded: false,
};
},
computed: {
ratio() {
return [0.1, 1, 0.8, 0.8, 0.8, 0.8, 0.2];
},
tableFields() {
return [
{
fieldname: 'toggler',
fieldtype: 'Link',
label: ' ',
},
{
fieldname: 'item',
fieldtype: 'Link',
label: 'Item',
placeholder: 'Item',
required: true,
schemaName: 'Item',
},
{
fieldname: 'quantity',
label: 'Quantity',
placeholder: 'Quantity',
fieldtype: 'Int',
required: true,
schemaName: '',
},
{
fieldname: 'unit',
label: 'Stock Unit',
placeholder: 'Unit',
fieldtype: 'Link',
required: true,
schemaName: 'UOM',
},
{
fieldname: 'rate',
label: 'Rate',
placeholder: 'Rate',
fieldtype: 'Currency',
required: true,
schemaName: '',
},
{
fieldname: 'amount',
label: 'Amount',
placeholder: 'Amount',
fieldtype: 'Currency',
required: true,
schemaName: '',
},
{
fieldname: 'removeItem',
fieldtype: 'Link',
label: ' ',
},
];
},
},
methods: {
async runSinvFormulas() {
await this.sinvDoc.runFormulas();
},
isNumeric,
},
});
</script>
|
2302_79757062/books
|
src/components/POS/SelectedItemTable.vue
|
Vue
|
agpl-3.0
| 3,423
|
import { Money } from "pesa";
export type ItemQtyMap = {
[item: string]: { availableQty: number;[batch: string]: number };
}
export type ItemSerialNumbers = { [item: string]: string };
export type DiscountType = "percent" | "amount";
export type ModalName = 'ShiftOpen' | 'ShiftClose' | 'Payment'
export interface POSItem {
name: string,
rate: Money,
availableQty: number,
unit: string,
hasBatch: boolean,
hasSerialNumber: boolean,
}
|
2302_79757062/books
|
src/components/POS/types.ts
|
TypeScript
|
agpl-3.0
| 466
|
<template>
<div
class="
px-4
flex
justify-between
items-center
h-row-largest
flex-shrink-0
dark:bg-gray-875
"
:class="[
border ? 'border-b dark:border-gray-800' : '',
platform !== 'Windows' ? 'window-drag' : '',
]"
>
<Transition name="spacer">
<div
v-if="!showSidebar && platform === 'Mac' && languageDirection !== 'rtl'"
class="h-full"
:class="spacerClass"
/>
</Transition>
<div
class="flex items-center window-no-drag gap-4 me-auto"
:class="platform === 'Mac' && languageDirection === 'rtl' ? 'me-18' : ''"
>
<!-- Nav Group -->
<PageHeaderNavGroup />
<h1
v-if="title"
class="
text-xl
font-semibold
select-none
whitespace-nowrap
dark:text-white
"
>
{{ title }}
</h1>
<!-- Left Slot -->
<div class="flex items-stretch window-no-drag gap-4">
<slot name="left" />
</div>
</div>
<!-- Right (regular) Slot -->
<div
class="flex items-stretch window-no-drag gap-2 ms-auto"
:class="platform === 'Mac' && languageDirection === 'rtl' ? 'me-18' : ''"
>
<slot />
</div>
</div>
</template>
<script lang="ts">
import { languageDirectionKey } from 'src/utils/injectionKeys';
import { showSidebar } from 'src/utils/refs';
import { defineComponent, inject, Transition } from 'vue';
import PageHeaderNavGroup from './PageHeaderNavGroup.vue';
export default defineComponent({
components: { Transition, PageHeaderNavGroup },
props: {
title: { type: String, default: '' },
border: { type: Boolean, default: true },
searchborder: { type: Boolean, default: true },
},
setup() {
return { showSidebar, languageDirection: inject(languageDirectionKey) };
},
computed: {
showBorder() {
return !!this.$slots.default && this.searchborder;
},
spacerClass() {
if (this.showSidebar) {
return '';
}
if (this.border) {
return 'w-tl me-4 border-e';
}
return 'w-tl me-4';
},
},
});
</script>
<style scoped>
.w-tl {
width: var(--w-trafficlights);
}
.spacer-enter-from,
.spacer-leave-to {
opacity: 0;
width: 0px;
margin-right: 0px;
border-right-width: 0px;
}
.spacer-enter-to,
.spacer-leave-from {
opacity: 1;
width: var(--w-trafficlights);
margin-right: 1rem;
border-right-width: 1px;
}
.spacer-enter-active,
.spacer-leave-active {
transition: all 150ms ease-out;
}
</style>
|
2302_79757062/books
|
src/components/PageHeader.vue
|
Vue
|
agpl-3.0
| 2,581
|
<template>
<div class="flex">
<SearchBar />
<!-- Back Button -->
<a
ref="backlink"
class="
nav-link
border-l border-r border-white
dark:border-gray-850 dark:bg-gray-900
"
:class="
historyState.back
? 'text-gray-700 dark:text-gray-300 cursor-pointer'
: 'text-gray-400 dark:text-gray-700'
"
@click="$router.back()"
>
<feather-icon name="chevron-left" class="w-4 h-4" />
</a>
<!-- Forward Button -->
<a
class="nav-link rounded-md rounded-l-none dark:bg-gray-900"
:class="
historyState.forward
? 'text-gray-700 dark:text-gray-400 cursor-pointer'
: 'text-gray-400 dark:text-gray-700'
"
@click="$router.forward()"
>
<feather-icon name="chevron-right" class="w-4 h-4" />
</a>
</div>
</template>
<script lang="ts">
import { shortcutsKey } from 'src/utils/injectionKeys';
import { ref, inject } from 'vue';
import { defineComponent } from 'vue';
import SearchBar from './SearchBar.vue';
import { historyState } from 'src/utils/refs';
const COMPONENT_NAME = 'PageHeaderNavGroup';
export default defineComponent({
components: { SearchBar },
setup() {
return {
historyState,
backlink: ref<HTMLAnchorElement | null>(null),
shortcuts: inject(shortcutsKey),
};
},
computed: {
hasBack() {
return !!history.back;
},
hasForward() {
return !!history.forward;
},
},
activated() {
this.shortcuts?.shift.set(COMPONENT_NAME, ['Backspace'], () => {
this.backlink?.click();
});
// @ts-ignore
window.ng = this;
},
deactivated() {
this.shortcuts?.delete(COMPONENT_NAME);
},
});
</script>
<style scoped>
.nav-link {
@apply flex items-center bg-gray-200 px-3;
}
</style>
|
2302_79757062/books
|
src/components/PageHeaderNavGroup.vue
|
Vue
|
agpl-3.0
| 1,837
|
<template>
<div
class="
grid grid-cols-3
text-gray-800
dark:text-gray-100
text-sm
select-none
items-center
"
style="height: 50px"
>
<!-- Length Display -->
<div class="justify-self-start">
{{
`${(pageNo - 1) * count + 1} - ${Math.min(pageNo * count, itemCount)}`
}}
</div>
<!-- Pagination Selector -->
<div class="flex gap-1 items-center justify-self-center">
<feather-icon
name="chevron-left"
class="w-4 h-4 rtl-rotate-180"
:class="
pageNo > 1
? 'text-gray-600 dark:text-gray-500 cursor-pointer'
: 'text-transparent'
"
@click="() => setPageNo(Math.max(1, pageNo - 1))"
/>
<div class="flex gap-1 bg-gray-100 dark:bg-gray-890 rounded">
<input
type="number"
class="
w-7
text-end
outline-none
bg-transparent
focus:text-gray-900
dark:focus:text-gray-25
"
:value="pageNo"
min="1"
:max="maxPages"
@change="(e) => setPageNo(e.target.value)"
@input="(e) => setPageNo(e.target.value)"
/>
<p class="text-gray-600">/</p>
<p class="w-7">
{{ maxPages }}
</p>
</div>
<feather-icon
name="chevron-right"
class="w-4 h-4 rtl-rotate-180"
:class="
pageNo < maxPages
? 'text-gray-600 dark:text-gray-500 cursor-pointer'
: 'text-transparent'
"
@click="() => setPageNo(Math.min(maxPages, pageNo + 1))"
/>
</div>
<!-- Count Selector -->
<div
v-if="filteredCounts.length"
class="
border border-gray-100
dark:border-gray-800
rounded
flex
justify-self-end
"
>
<template v-for="c in filteredCounts" :key="c + '-count'">
<button
class="w-9"
:class="
count === c || (count === itemCount && c === -1)
? 'rounded bg-gray-100 dark:bg-gray-890'
: ''
"
@click="setCount(c)"
>
{{ c === -1 ? t`All` : c }}
</button>
</template>
</div>
</div>
</template>
<script>
import { defineComponent } from 'vue';
export default defineComponent({
props: {
itemCount: { type: Number, default: 0 },
allowedCounts: { type: Array, default: () => [50, 100, 500, -1] },
},
emits: ['index-change'],
data() {
return {
pageNo: 1,
count: 0,
};
},
computed: {
maxPages() {
return Math.ceil(this.itemCount / this.count);
},
filteredCounts() {
return this.allowedCounts.filter(this.filterCount);
},
},
mounted() {
this.count = this.allowedCounts[0];
this.emitIndices();
},
methods: {
filterCount(count) {
if (count !== -1 && this.itemCount < count) {
return false;
}
if (count === -1 && this.itemCount < this.allowedCounts[0]) {
return false;
}
return true;
},
setPageNo(value) {
value = parseInt(value);
if (isNaN(value)) {
return;
}
this.pageNo = Math.min(Math.max(1, value), this.maxPages);
this.emitIndices();
},
setCount(count) {
this.pageNo = 1;
if (count === -1) {
count = this.itemCount;
}
this.count = count;
this.emitIndices();
},
emitIndices() {
const indices = this.getSliceIndices();
this.$emit('index-change', indices);
},
getSliceIndices() {
const start = (this.pageNo - 1) * this.count;
const end = this.pageNo * this.count;
return { start, end };
},
},
});
</script>
|
2302_79757062/books
|
src/components/Paginator.vue
|
Vue
|
agpl-3.0
| 3,789
|
<template>
<div ref="reference">
<div class="h-full">
<slot
name="target"
:toggle-popover="togglePopover"
:handle-blur="handleBlur"
></slot>
</div>
<Transition>
<div
v-show="isOpen"
ref="popover"
:class="popoverClass"
class="
bg-white
dark:bg-gray-850
rounded-md
border
dark:border-gray-875
shadow-lg
popover-container
relative
z-10
"
:style="{ 'transition-delay': `${isOpen ? entryDelay : exitDelay}ms` }"
>
<slot name="content" :toggle-popover="togglePopover"></slot>
</div>
</Transition>
</div>
</template>
<script>
import { createPopper } from '@popperjs/core';
import { nextTick } from 'vue';
export default {
name: 'Popover',
props: {
showPopup: {
type: [Boolean, null],
default: null,
},
right: Boolean,
entryDelay: { type: Number, default: 0 },
exitDelay: { type: Number, default: 0 },
placement: {
type: String,
default: 'bottom-start',
},
popoverClass: [String, Object, Array],
},
emits: ['open', 'close'],
data() {
return {
isOpen: false,
};
},
watch: {
showPopup(value) {
if (value === true) {
this.open();
}
if (value === false) {
this.close();
}
},
},
mounted() {
this.listener = (e) => {
let $els = [this.$refs.reference, this.$refs.popover];
let insideClick = $els.some(
($el) => $el && (e.target === $el || $el.contains(e.target))
);
if (insideClick) {
return;
}
this.close();
};
if (this.show == null) {
document.addEventListener('click', this.listener);
}
},
beforeUnmount() {
this.popper && this.popper.destroy();
if (this.listener) {
document.removeEventListener('click', this.listener);
delete this.listener;
}
},
methods: {
setupPopper() {
if (!this.popper) {
this.popper = createPopper(this.$refs.reference, this.$refs.popover, {
placement: this.placement,
modifiers: [{ name: 'offset', options: { offset: [0, 8] } }],
});
} else {
this.popper.update();
}
},
togglePopover(flag) {
if (flag == null) {
flag = !this.isOpen;
}
flag = Boolean(flag);
if (flag) {
this.open();
} else {
this.close();
}
},
open() {
if (this.isOpen) {
return;
}
this.isOpen = true;
nextTick(() => {
this.setupPopper();
});
this.$emit('open');
},
close() {
if (!this.isOpen) {
return;
}
this.isOpen = false;
this.$emit('close');
},
handleBlur({ relatedTarget }) {
relatedTarget && this.close();
},
},
};
</script>
<style scoped>
.v-enter-active,
.v-leave-active {
transition: opacity 150ms ease-out;
}
.v-enter-from,
.v-leave-to {
opacity: 0;
}
</style>
|
2302_79757062/books
|
src/components/Popover.vue
|
Vue
|
agpl-3.0
| 3,076
|
<template>
<div style="min-width: 192px; max-width: 300px">
<div
class="p-2 flex justify-between"
:class="values.length ? 'border-b dark:border-gray-800' : ''"
>
<p
v-if="schema?.naming !== 'random' && !schema?.isChild"
class="font-semibold text-base text-gray-900 dark:text-gray-25"
>
{{ name }}
</p>
<p class="font-semibold text-base text-gray-600 dark:text-gray-400">
{{ schema?.label ?? '' }}
</p>
</div>
<div v-if="values.length" class="flex gap-2 p-2 flex-wrap">
<p
v-for="v of values"
:key="v.label"
class="pill bg-gray-200 dark:bg-gray-800"
>
<span class="text-gray-600 dark:text-gray-500">{{ v.label }}</span>
<span class="text-gray-800 dark:text-gray-300 ml-1.5">{{
v.value
}}</span>
</p>
</div>
</div>
</template>
<script lang="ts">
import { isFalsy } from 'fyo/utils';
import { Field } from 'schemas/types';
import { defineComponent } from 'vue';
export default defineComponent({
props: {
schemaName: { type: String, required: true },
name: { type: String, required: true },
},
data() {
return { values: [] } as { values: { label: string; value: string }[] };
},
computed: {
schema() {
return this.fyo.schemaMap[this.schemaName];
},
},
watch: {
async name(v1, v2) {
if (v1 === v2) {
return;
}
await this.setValues();
},
},
async mounted() {
await this.setValues();
},
methods: {
async setValues() {
const fields: Field[] = (this.schema?.fields ?? []).filter(
(f) =>
f &&
f.fieldtype !== 'Table' &&
f.fieldtype !== 'AttachImage' &&
f.fieldtype !== 'Attachment' &&
f.fieldname !== 'name' &&
!f.hidden &&
!f.meta &&
!f.abstract &&
!f.computed
);
const data = (
await this.fyo.db.getAll(this.schemaName, {
fields: fields.map((f) => f.fieldname),
filters: { name: this.name },
})
)[0];
if (!data) {
return;
}
this.values = fields
.map((f) => {
const value = data[f.fieldname];
if (isFalsy(value)) {
return { value: '', label: '' };
}
return {
value: this.fyo.format(data[f.fieldname], f),
label: f.label,
};
})
.filter((i) => !!i.value);
},
},
});
</script>
|
2302_79757062/books
|
src/components/QuickView.vue
|
Vue
|
agpl-3.0
| 2,535
|
<template>
<div class="overflow-hidden flex flex-col h-full">
<!-- Report Outer Container -->
<div v-if="dataSlice.length" class="overflow-hidden">
<!--Title Row -->
<div
ref="titlerow"
class="
w-full
overflow-x-hidden
flex
items-center
dark:text-gray-25
border-b
dark:border-gray-800
px-4
"
:style="{
height: `${hconst}px`,
paddingRight: 'calc(var(--w-scrollbar) + 1rem)',
}"
>
<div
v-for="(col, c) in report.columns"
:key="c + '-col'"
:style="getCellStyle(col, c)"
class="
text-base
px-3
flex-shrink-0
overflow-x-auto
whitespace-nowrap
no-scrollbar
"
>
{{ col.label }}
</div>
</div>
<WithScroll
class="overflow-auto w-full"
style="height: calc(100% - 49px)"
@scroll="scroll"
>
<!-- Report Rows -->
<template v-for="(row, r) in dataSlice" :key="r + '-row'">
<div
v-if="!row.folded"
class="flex items-center w-max px-4"
:style="{
height: `${hconst}px`,
minWidth: `calc(var(--w-desk) - var(--w-scrollbar))`,
}"
:class="[
r !== pageEnd - 1 ? 'border-b dark:border-gray-800' : '',
row.isGroup
? 'hover:bg-gray-50 dark:hover:bg-gray-890 cursor-pointer'
: '',
]"
@click="() => onRowClick(row, r)"
>
<!-- Report Cell -->
<div
v-for="(cell, c) in row.cells"
:key="`${c}-${r}-cell`"
:style="getCellStyle(cell, c)"
class="
text-base
px-3
flex-shrink-0
overflow-x-auto
whitespace-nowrap
no-scrollbar
"
:class="[getCellColorClass(cell)]"
>
{{ cell.value }}
</div>
</div>
</template>
</WithScroll>
<!-- Report Rows Container -->
</div>
<p
v-else
class="
w-full
text-center
mt-20
text-gray-800
dark:text-gray-100
text-base
"
>
{{ report.loading ? t`Loading Report...` : t`No Values to be Displayed` }}
</p>
<!-- Pagination Footer -->
<div v-if="report.usePagination" class="mt-auto flex-shrink-0">
<Paginator
:item-count="report?.reportData?.length ?? 0"
class="px-4"
@index-change="setPageIndices"
/>
</div>
<div v-else class="h-4" />
</div>
</template>
<script>
import { Report } from 'reports/Report';
import { isNumeric } from 'src/utils';
import { languageDirectionKey } from 'src/utils/injectionKeys';
import { defineComponent } from 'vue';
import Paginator from '../Paginator.vue';
import WithScroll from '../WithScroll.vue';
import { inject } from 'vue';
export default defineComponent({
components: { Paginator, WithScroll },
props: {
report: Report,
},
setup() {
return {
languageDirection: inject(languageDirectionKey),
};
},
data() {
return {
wconst: 8,
hconst: 48,
pageStart: 0,
pageEnd: 0,
};
},
computed: {
dataSlice() {
if (this.report?.usePagination) {
return this.report.reportData.slice(this.pageStart, this.pageEnd);
}
return this.report.reportData;
},
},
methods: {
scroll({ scrollLeft }) {
this.$refs.titlerow.scrollLeft = scrollLeft;
},
setPageIndices({ start, end }) {
this.pageStart = start;
this.pageEnd = end;
},
onRowClick(clickedRow, r) {
if (!clickedRow.isGroup) {
return;
}
r += 1;
clickedRow.foldedBelow = !clickedRow.foldedBelow;
const folded = clickedRow.foldedBelow;
let row = this.dataSlice[r];
while (row && row.level > clickedRow.level) {
row.folded = folded;
r += 1;
row = this.dataSlice[r];
}
},
getCellStyle(cell, i) {
const styles = {};
const width = cell.width ?? 1;
let align = cell.align ?? 'left';
if (this.languageDirection === 'rtl') {
align = this.languageDirection === 'rtl' ? 'right' : 'left';
}
styles['width'] = `${width * this.wconst}rem`;
styles['text-align'] = align;
if (cell.bold) {
styles['font-weight'] = 'bold';
}
if (cell.italics) {
styles['font-style'] = 'oblique 15deg';
}
if (i === 0) {
if (this.languageDirection === 'rtl') {
styles['padding-right'] = '0px';
} else {
styles['padding-left'] = '0px';
}
}
if (!cell.align && isNumeric(cell.fieldtype)) {
styles['text-align'] = 'right';
}
if (i === this.report.columns.length - 1) {
if (this.languageDirection === 'rtl') {
styles['padding-left'] = '0px';
} else {
styles['padding-right'] = '0px';
}
}
if (cell.indent) {
if (this.languageDirection === 'rtl') {
styles['padding-right'] = `${cell.indent * 2}rem`;
} else {
styles['padding-left'] = `${cell.indent * 2}rem`;
}
}
return styles;
},
getCellColorClass(cell) {
if (cell.color === 'red') {
return 'text-red-600';
} else if (cell.color === 'green') {
return 'text-green-600';
}
if (!cell.rawValue) {
return 'text-gray-600 dark:text-gray-400';
}
if (typeof cell.rawValue !== 'number') {
return 'text-gray-900 dark:text-gray-100';
}
if (cell.rawValue === 0) {
return 'text-gray-600 dark:text-gray-400';
}
const prec = this.fyo?.singles?.displayPrecision ?? 2;
if (Number(cell.rawValue.toFixed(prec)) === 0) {
return 'text-gray-600 dark:text-gray-500';
}
return 'text-gray-900 dark:text-gray-300';
},
},
});
</script>
|
2302_79757062/books
|
src/components/Report/ListReport.vue
|
Vue
|
agpl-3.0
| 6,232
|
<template>
<div class="inline-grid" :style="style" v-bind="$attrs">
<slot></slot>
</div>
</template>
<script>
export default {
name: 'Row',
props: {
columnWidth: {
type: String,
default: '1fr',
},
columnCount: {
type: Number,
default: 0,
},
ratio: {
type: Array,
default: () => [],
},
gridTemplateColumns: {
type: String,
default: null,
},
gap: String,
},
computed: {
style() {
let obj = {};
if (this.columnCount) {
// prettier-ignore
obj['grid-template-columns'] = `repeat(${this.columnCount}, ${this.columnWidth})`;
}
if (this.ratio.length) {
obj['grid-template-columns'] = this.ratio
.map((r) => `minmax(0, ${r}fr)`)
.join(' ');
}
if (this.gridTemplateColumns) {
obj['grid-template-columns'] = this.gridTemplateColumns;
}
if (this.gap) {
obj['grid-gap'] = this.gap;
}
return obj;
},
},
};
</script>
|
2302_79757062/books
|
src/components/Row.vue
|
Vue
|
agpl-3.0
| 1,033
|
<template>
<div>
<!-- Search Bar Button -->
<Button
class="px-3 py-2 rounded-r-none dark:bg-gray-900"
:padding="false"
@click="open"
>
<feather-icon
name="search"
class="w-4 h-4 text-gray-700 dark:text-gray-300"
/>
</Button>
</div>
<!-- Search Modal -->
<Modal
:open-modal="openModal"
:set-close-listener="false"
@closemodal="close"
>
<div class="w-form">
<!-- Search Input -->
<div class="p-1">
<input
ref="input"
v-model="inputValue"
type="search"
autocomplete="off"
spellcheck="false"
:placeholder="t`Type to search...`"
class="
bg-gray-100
dark:bg-gray-800
text-2xl
focus:outline-none
w-full
placeholder-gray-500
text-gray-900
dark:text-gray-100
rounded-md
p-3
"
@keydown.up="up"
@keydown.down="down"
@keydown.enter="() => select()"
@keydown.esc="close"
/>
</div>
<hr v-if="suggestions.length" class="dark:border-gray-800" />
<!-- Search List -->
<div
:style="`max-height: ${49 * 6 - 1}px`"
class="overflow-auto custom-scroll custom-scroll-thumb2"
>
<div
v-for="(si, i) in suggestions"
:key="`${i}-${si.label}`"
:data-index="`search-suggestion-${i}`"
class="hover:bg-gray-50 dark:hover:bg-gray-875 cursor-pointer"
:class="
idx === i
? 'border-gray-700 dark:border-gray-200 bg-gray-50 dark:bg-gray-875 border-s-4'
: ''
"
@click="select(i)"
>
<!-- Search List Item -->
<div
class="flex w-full justify-between px-3 items-center"
style="height: var(--h-row-mid)"
>
<div class="flex items-center">
<p
:class="
idx === i
? 'text-gray-900 dark:text-gray-100'
: 'text-gray-700 dark:text-gray-400'
"
:style="idx === i ? 'margin-left: -4px' : ''"
>
{{ si.label }}
</p>
<p
v-if="si.group === 'Docs'"
class="text-gray-600 dark:text-gray-400 text-sm ms-3"
>
{{ si.more.filter(Boolean).join(', ') }}
</p>
</div>
<p
class="text-sm text-end justify-self-end"
:class="`text-${groupColorMap[si.group]}-500`"
>
{{
si.group === 'Docs' ? si.schemaLabel : groupLabelMap[si.group]
}}
</p>
</div>
<hr
v-if="i !== suggestions.length - 1"
class="dark:border-gray-800"
/>
</div>
</div>
<!-- Footer -->
<hr class="dark:border-gray-800" />
<div class="m-1 flex justify-between flex-col gap-2 text-sm select-none">
<!-- Group Filters -->
<div class="flex justify-between">
<div class="flex gap-1">
<button
v-for="g in searchGroups"
:key="g"
class="border dark:border-gray-800 px-1 py-0.5 rounded-lg"
:class="getGroupFilterButtonClass(g)"
@click="searcher!.set(g, !searcher!.filters.groupFilters[g])"
>
{{ groupLabelMap[g] }}
</button>
</div>
<button
class="
hover:text-gray-900
dark:hover:text-gray-25
py-0.5
rounded
text-gray-700
dark:text-gray-300
"
@click="showMore = !showMore"
>
{{ showMore ? t`Less Filters` : t`More Filters` }}
</button>
</div>
<!-- Additional Filters -->
<div v-if="showMore" class="-mt-1">
<!-- Group Skip Filters -->
<div class="flex gap-1 text-gray-800 dark:text-gray-200">
<button
v-for="s in ['skipTables', 'skipTransactions'] as const"
:key="s"
class="border dark:border-gray-800 px-1 py-0.5 rounded-lg"
:class="{ 'bg-gray-200': searcher?.filters[s] }"
@click="searcher?.set(s, !searcher?.filters[s])"
>
{{
s === 'skipTables' ? t`Skip Child Tables` : t`Skip Transactions`
}}
</button>
</div>
<!-- Schema Name Filters -->
<div
class="flex mt-1 gap-1 text-blue-500 dark:text-blue-100 flex-wrap"
>
<button
v-for="sf in schemaFilters"
:key="sf.value"
class="
border
px-1
py-0.5
rounded-lg
border-blue-100
dark:border-blue-800
whitespace-nowrap
"
:class="{
'bg-blue-100 dark:bg-blue-800':
searcher?.filters.schemaFilters[sf.value],
}"
@click="
searcher?.set(
sf.value,
!searcher?.filters.schemaFilters[sf.value]
)
"
>
{{ sf.label }}
</button>
</div>
</div>
<!-- Keybindings Help -->
<div class="flex text-sm text-gray-500 justify-between items-baseline">
<div class="flex gap-4">
<p>↑↓ {{ t`Navigate` }}</p>
<p>↩ {{ t`Select` }}</p>
<p><span class="tracking-tighter">esc</span> {{ t`Close` }}</p>
<button
class="
flex
items-center
hover:text-gray-800
dark:hover:text-gray-300
"
@click="openDocs"
>
<feather-icon name="help-circle" class="w-4 h-4 me-1" />
{{ t`Help` }}
</button>
</div>
<p v-if="searcher?.numSearches" class="ms-auto">
{{ t`${suggestions.length} out of ${searcher.numSearches}` }}
</p>
<div
v-if="(searcher?.numSearches ?? 0) > 50"
class="
border border-gray-100
dark:border-gray-875
rounded
flex
justify-self-end
ms-2
"
>
<template
v-for="c in allowedLimits.filter(
(c) => c < (searcher?.numSearches ?? 0) || c === -1
)"
:key="c + '-count'"
>
<button
class="w-9"
:class="
limit === c ? 'bg-gray-100 dark:bg-gray-875 rounded' : ''
"
@click="limit = Number(c)"
>
{{ c === -1 ? t`All` : c }}
</button>
</template>
</div>
</div>
</div>
</div>
</Modal>
</template>
<script lang="ts">
import { fyo } from 'src/initFyo';
import { getBgTextColorClass } from 'src/utils/colors';
import { searcherKey, shortcutsKey } from 'src/utils/injectionKeys';
import { docsPathMap } from 'src/utils/misc';
import {
SearchGroup,
SearchItems,
getGroupLabelMap,
searchGroups,
} from 'src/utils/search';
import { defineComponent, inject, nextTick } from 'vue';
import Button from './Button.vue';
import Modal from './Modal.vue';
const COMPONENT_NAME = 'SearchBar';
type SchemaFilters = { value: string; label: string; index: number }[];
export default defineComponent({
components: { Modal, Button },
setup() {
return {
searcher: inject(searcherKey),
shortcuts: inject(shortcutsKey),
};
},
data() {
return {
idx: 0,
searchGroups,
openModal: false,
inputValue: '',
showMore: false,
limit: 50,
allowedLimits: [50, 100, 500, -1],
};
},
computed: {
groupLabelMap(): Record<SearchGroup, string> {
return getGroupLabelMap();
},
schemaFilters(): SchemaFilters {
const searchables = this.searcher?.searchables ?? {};
const schemaNames = Object.keys(searchables);
const filters = schemaNames
.map((value) => {
const schema = fyo.schemaMap[value];
if (!schema) {
return;
}
let index = 1;
if (schema.isSubmittable) {
index = 0;
} else if (schema.isChild) {
index = 2;
}
return { value, label: schema.label, index };
})
.filter(Boolean) as SchemaFilters;
return filters.sort((a, b) => a.index - b.index);
},
groupColorMap(): Record<SearchGroup, string> {
return {
Docs: 'blue',
Create: 'green',
List: 'teal',
Report: 'yellow',
Page: 'orange',
};
},
groupColorClassMap(): Record<SearchGroup, string> {
return searchGroups.reduce((map, g) => {
map[g] = getBgTextColorClass(this.groupColorMap[g]);
return map;
}, {} as Record<SearchGroup, string>);
},
suggestions(): SearchItems {
if (!this.searcher) {
return [];
}
const suggestions = this.searcher.search(this.inputValue);
if (this.limit === -1) {
return suggestions;
}
return suggestions.slice(0, this.limit);
},
},
async mounted() {
if (fyo.store.isDevelopment) {
// @ts-ignore
window.search = this;
}
this.openModal = false;
},
activated() {
this.setShortcuts();
this.openModal = false;
},
deactivated() {
this.shortcuts?.delete(COMPONENT_NAME);
},
methods: {
openDocs() {
ipc.openLink('https://docs.frappe.io/' + docsPathMap.Search);
},
getShortcuts() {
const ifOpen = (cb: Function) => () => this.openModal && cb();
const ifClose = (cb: Function) => () => !this.openModal && cb();
const shortcuts = [
{
shortcut: 'KeyK',
callback: ifClose(() => this.open()),
},
];
for (const i in searchGroups) {
shortcuts.push({
shortcut: `Digit${Number(i) + 1}`,
callback: ifOpen(() => {
const group = searchGroups[i];
if (!this.searcher) {
return;
}
const value = this.searcher.filters.groupFilters[group];
if (typeof value !== 'boolean') {
return;
}
this.searcher.set(group, !value);
}),
});
}
return shortcuts;
},
setShortcuts() {
for (const { shortcut, callback } of this.getShortcuts()) {
this.shortcuts!.pmod.set(COMPONENT_NAME, [shortcut], callback);
}
},
open(): void {
this.openModal = true;
this.searcher?.updateKeywords();
nextTick(() => {
(this.$refs.input as HTMLInputElement)?.focus();
});
},
close(): void {
this.openModal = false;
this.reset();
},
reset(): void {
this.inputValue = '';
},
up(): void {
this.idx = Math.max(this.idx - 1, 0);
this.scrollToHighlighted();
},
down(): void {
this.idx = Math.max(
Math.min(this.idx + 1, this.suggestions.length - 1),
0
);
this.scrollToHighlighted();
},
select(idx?: number): void {
this.idx = idx ?? this.idx;
this.suggestions[this.idx]?.action?.();
this.close();
},
scrollToHighlighted(): void {
const query = `[data-index="search-suggestion-${this.idx}"]`;
const element = document.querySelectorAll(query)?.[0];
element?.scrollIntoView({ block: 'nearest' });
},
getGroupFilterButtonClass(g: SearchGroup): string {
if (!this.searcher) {
return '';
}
const isOn = this.searcher.filters.groupFilters[g];
const color = this.groupColorMap[g];
if (isOn) {
return `${getBgTextColorClass(
color
)} border-${color}-100 dark:border-${color}-800`;
}
return `text-${color}-600 dark:text-${color}-400 border-${color}-100 dark:border-${color}-800`;
},
},
});
</script>
<style scoped>
input[type='search']::-webkit-search-decoration,
input[type='search']::-webkit-search-cancel-button,
input[type='search']::-webkit-search-results-button,
input[type='search']::-webkit-search-results-decoration {
display: none;
}
</style>
|
2302_79757062/books
|
src/components/SearchBar.vue
|
Vue
|
agpl-3.0
| 12,759
|
<template>
<div class="flex-shrink-0 flex items-center gap-2" style="width: fit-content">
<kbd
v-for="k in keys"
:key="k"
class="key-common"
:class="{ 'key-styling': !simple }"
>{{ keyMap[k] ?? k }}</kbd
>
</div>
</template>
<script lang="ts">
import { getShortcutKeyMap } from 'src/utils/ui';
import { defineComponent, PropType } from 'vue';
export default defineComponent({
props: {
keys: { type: Array as PropType<string[]>, required: true },
simple: { type: Boolean, default: false },
},
method() {},
computed: {
keyMap(): Record<string, string> {
return getShortcutKeyMap(this.platform);
},
},
});
</script>
<style scoped>
.key-common {
font-family: monospace;
font-weight: 600;
@apply rounded-md px-1.5 py-0.5 bg-gray-200 text-gray-700
tracking-tighter;
}
.key-styling {
@apply border-b-4 border-gray-400 shadow-md;
}
</style>
|
2302_79757062/books
|
src/components/ShortcutKeys.vue
|
Vue
|
agpl-3.0
| 920
|
<template>
<div>
<FormHeader :form-title="t`Shortcuts`" />
<hr class="dark:border-gray-800" />
<div
class="
h-96
overflow-y-auto
custom-scroll custom-scroll-thumb2
text-gray-900
dark:text-gray-100
"
>
<template v-for="g in groups" :key="g.label">
<div class="p-4 w-full">
<!-- Shortcut Group Header -->
<div class="cursor-pointer mb-4" @click="g.collapsed = !g.collapsed">
<div class="font-semibold">
{{ g.label }}
</div>
<div class="text-base">
{{ g.description }}
</div>
</div>
<!-- Shortcuts -->
<div v-if="!g.collapsed" class="flex flex-col gap-4">
<div
v-for="(s, i) in g.shortcuts"
:key="g.label + ' ' + i"
class="grid gap-4 items-start"
style="grid-template-columns: 8rem auto"
>
<ShortcutKeys class="text-base" :keys="s.shortcut" />
<div class="whitespace-normal text-base">{{ s.description }}</div>
</div>
</div>
<!-- Shortcut count if collapsed -->
<div v-else class="text-base text-gray-600 dark:text-gray-400">
{{ t`${g.shortcuts.length} shortcuts` }}
</div>
</div>
<hr class="dark:border-gray-800" />
</template>
<div class="p-4 text-base text-gray-600 dark:text-gray-400">
{{ t`More shortcuts will be added soon.` }}
</div>
</div>
</div>
</template>
<script lang="ts">
import { t } from 'fyo';
import { ShortcutKey } from 'src/utils/ui';
import { defineComponent } from 'vue';
import FormHeader from './FormHeader.vue';
import ShortcutKeys from './ShortcutKeys.vue';
type Group = {
label: string;
description: string;
collapsed: boolean;
shortcuts: { shortcut: string[]; description: string }[];
};
export default defineComponent({
components: { FormHeader, ShortcutKeys },
data() {
return { groups: [] } as { groups: Group[] };
},
mounted() {
this.groups = [
{
label: t`Global`,
description: t`Applicable anywhere in Frappe Books`,
collapsed: false,
shortcuts: [
{
shortcut: [ShortcutKey.pmod, 'K'],
description: t`Open Quick Search`,
},
{
shortcut: [ShortcutKey.shift, ShortcutKey.delete],
description: t`Go back to the previous page`,
},
{
shortcut: [ShortcutKey.shift, 'H'],
description: t`Toggle sidebar`,
},
{
shortcut: ['F1'],
description: t`Open Documentation`,
},
],
},
{
label: t`Entry`,
description: t`Applicable when a entry is open in the Form view or Quick Edit view`,
collapsed: false,
shortcuts: [
{
shortcut: [ShortcutKey.pmod, 'S'],
description: [
t`Save or Submit an entry.`,
t`An entry is submitted only if it is submittable and is in the saved state.`,
].join(' '),
},
{
shortcut: [ShortcutKey.pmod, ShortcutKey.delete],
description: [
t`Cancel or Delete an entry.`,
t`An entry is cancelled only if it is in the submitted state.`,
t`A submittable entry is deleted only if it is in the cancelled state.`,
].join(' '),
},
{
shortcut: [ShortcutKey.pmod, 'P'],
description: t`Open Print View if Print is available.`,
},
{
shortcut: [ShortcutKey.pmod, 'L'],
description: t`Toggle Linked Entries widget, not available in Quick Edit view.`,
},
],
},
{
label: t`List View`,
description: t`Applicable when the List View of an entry type is open`,
collapsed: false,
shortcuts: [
{
shortcut: [ShortcutKey.pmod, 'N'],
description: t`Create a new entry of the same type as the List View`,
},
{
shortcut: [ShortcutKey.pmod, 'E'],
description: t`Open the Export Wizard modal`,
},
],
},
{
label: t`Quick Search`,
description: t`Applicable when Quick Search is open`,
collapsed: false,
shortcuts: [
{ shortcut: [ShortcutKey.esc], description: t`Close Quick Search` },
{
shortcut: [ShortcutKey.pmod, '1'],
description: t`Toggle the Docs filter`,
},
{
shortcut: [ShortcutKey.pmod, '2'],
description: t`Toggle the List filter`,
},
{
shortcut: [ShortcutKey.pmod, '3'],
description: t`Toggle the Create filter`,
},
{
shortcut: [ShortcutKey.pmod, '4'],
description: t`Toggle the Report filter`,
},
{
shortcut: [ShortcutKey.pmod, '5'],
description: t`Toggle the Page filter`,
},
],
},
{
label: t`Template Builder`,
description: t`Applicable when Template Builder is open`,
collapsed: false,
shortcuts: [
{
shortcut: [ShortcutKey.ctrl, ShortcutKey.enter],
description: t`Apply and view changes made to the print template`,
},
{
shortcut: [ShortcutKey.ctrl, 'E'],
description: t`Toggle Edit Mode`,
},
{
shortcut: [ShortcutKey.ctrl, 'H'],
description: t`Toggle Key Hints`,
},
{
shortcut: [ShortcutKey.ctrl, '+'],
description: t`Increase print template display scale`,
},
{
shortcut: [ShortcutKey.ctrl, '-'],
description: t`Decrease print template display scale`,
},
],
},
];
},
});
</script>
|
2302_79757062/books
|
src/components/ShortcutsHelper.vue
|
Vue
|
agpl-3.0
| 6,106
|
<template>
<div
class="
py-2
h-full
flex
justify-between
flex-col
bg-gray-25
dark:bg-gray-900
relative
"
:class="{
'window-drag': platform !== 'Windows',
}"
>
<div>
<!-- Company name -->
<div
class="px-4 flex flex-row items-center justify-between mb-4"
:class="
platform === 'Mac' && languageDirection === 'ltr' ? 'mt-10' : 'mt-2'
"
>
<h6
data-testid="company-name"
class="
font-semibold
dark:text-gray-200
whitespace-nowrap
overflow-auto
no-scrollbar
select-none
"
>
{{ companyName }}
</h6>
</div>
<!-- Sidebar Items -->
<div v-for="group in groups" :key="group.label">
<div
class="
px-4
flex
items-center
cursor-pointer
hover:bg-gray-100
dark:hover:bg-gray-875
h-10
"
:class="
isGroupActive(group) && !group.items
? 'bg-gray-100 dark:bg-gray-875 border-s-4 border-gray-800 dark:border-gray-100'
: ''
"
@click="routeToSidebarItem(group)"
>
<Icon
class="flex-shrink-0"
:name="group.icon"
:size="group.iconSize || '18'"
:height="group.iconHeight ?? 0"
:active="!!isGroupActive(group)"
:darkMode="darkMode"
:class="isGroupActive(group) && !group.items ? '-ms-1' : ''"
/>
<div
class="ms-2 text-lg text-gray-700"
:class="
isGroupActive(group) && !group.items
? 'text-gray-900 dark:text-gray-25'
: 'dark:text-gray-300'
"
>
{{ group.label }}
</div>
</div>
<!-- Expanded Group -->
<div v-if="group.items && isGroupActive(group)">
<div
v-for="item in group.items"
:key="item.label"
class="
text-base
h-10
ps-10
cursor-pointer
flex
items-center
hover:bg-gray-100
dark:hover:bg-gray-875
"
:class="
isItemActive(item)
? 'bg-gray-100 dark:bg-gray-875 text-gray-900 dark:text-gray-100 border-s-4 border-gray-800 dark:border-gray-100'
: 'text-gray-700 dark:text-gray-400'
"
@click="routeToSidebarItem(item)"
>
<p :style="isItemActive(item) ? 'margin-left: -4px' : ''">
{{ item.label }}
</p>
</div>
</div>
</div>
</div>
<!-- Report Issue and DB Switcher -->
<div class="window-no-drag flex flex-col gap-2 py-2 px-4">
<button
class="
flex
text-sm text-gray-600
dark:text-gray-500
hover:text-gray-800
dark:hover:text-gray-400
gap-1
items-center
"
@click="openDocumentation"
>
<feather-icon name="help-circle" class="h-4 w-4 flex-shrink-0" />
<p>
{{ t`Help` }}
</p>
</button>
<button
class="
flex
text-sm text-gray-600
dark:text-gray-500
hover:text-gray-800
dark:hover:text-gray-400
gap-1
items-center
"
@click="viewShortcuts = true"
>
<feather-icon name="command" class="h-4 w-4 flex-shrink-0" />
<p>{{ t`Shortcuts` }}</p>
</button>
<button
data-testid="change-db"
class="
flex
text-sm text-gray-600
dark:text-gray-500
hover:text-gray-800
dark:hover:text-gray-400
gap-1
items-center
"
@click="$emit('change-db-file')"
>
<feather-icon name="database" class="h-4 w-4 flex-shrink-0" />
<p>{{ t`Change DB` }}</p>
</button>
<button
class="
flex
text-sm text-gray-600
dark:text-gray-500
hover:text-gray-800
dark:hover:text-gray-400
gap-1
items-center
"
@click="() => reportIssue()"
>
<feather-icon name="flag" class="h-4 w-4 flex-shrink-0" />
<p>
{{ t`Report Issue` }}
</p>
</button>
<p
v-if="showDevMode"
class="text-xs text-gray-500 select-none cursor-pointer"
@click="showDevMode = false"
title="Open dev tools with Ctrl+Shift+I"
>
dev mode
</p>
</div>
<!-- Hide Sidebar Button -->
<button
class="
absolute
bottom-0
end-0
text-gray-600
dark:text-gray-500
hover:bg-gray-100
dark:hover:bg-gray-875
rounded
p-1
m-4
rtl-rotate-180
"
@click="() => toggleSidebar()"
>
<feather-icon name="chevrons-left" class="w-4 h-4" />
</button>
<Modal :open-modal="viewShortcuts" @closemodal="viewShortcuts = false">
<ShortcutsHelper class="w-form" />
</Modal>
</div>
</template>
<script lang="ts">
import { reportIssue } from 'src/errorHandling';
import { fyo } from 'src/initFyo';
import { languageDirectionKey, shortcutsKey } from 'src/utils/injectionKeys';
import { docsPathRef } from 'src/utils/refs';
import { getSidebarConfig } from 'src/utils/sidebarConfig';
import { SidebarConfig, SidebarItem, SidebarRoot } from 'src/utils/types';
import { routeTo, toggleSidebar } from 'src/utils/ui';
import { defineComponent, inject } from 'vue';
import router from '../router';
import Icon from './Icon.vue';
import Modal from './Modal.vue';
import ShortcutsHelper from './ShortcutsHelper.vue';
const COMPONENT_NAME = 'Sidebar';
export default defineComponent({
components: {
Icon,
Modal,
ShortcutsHelper,
},
props: {
darkMode: { type: Boolean, default: false },
},
emits: ['change-db-file', 'toggle-darkmode'],
setup() {
return {
languageDirection: inject(languageDirectionKey),
shortcuts: inject(shortcutsKey),
};
},
data() {
return {
companyName: '',
groups: [],
viewShortcuts: false,
activeGroup: null,
showDevMode: false,
} as {
companyName: string;
groups: SidebarConfig;
viewShortcuts: boolean;
activeGroup: null | SidebarRoot;
showDevMode: boolean;
};
},
computed: {
appVersion() {
return fyo.store.appVersion;
},
},
async mounted() {
const { companyName } = await fyo.doc.getDoc('AccountingSettings');
this.companyName = companyName as string;
this.groups = await getSidebarConfig();
this.setActiveGroup();
router.afterEach(() => {
this.setActiveGroup();
});
this.shortcuts?.shift.set(COMPONENT_NAME, ['KeyH'], () => {
if (document.body === document.activeElement) {
this.toggleSidebar();
}
});
this.shortcuts?.set(COMPONENT_NAME, ['F1'], () => this.openDocumentation());
this.showDevMode = this.fyo.store.isDevelopment;
},
unmounted() {
this.shortcuts?.delete(COMPONENT_NAME);
},
methods: {
routeTo,
reportIssue,
toggleSidebar,
openDocumentation() {
ipc.openLink('https://docs.frappe.io/' + docsPathRef.value);
},
setActiveGroup() {
const { fullPath } = this.$router.currentRoute.value;
const fallBackGroup = this.activeGroup;
this.activeGroup =
this.groups.find((g) => {
if (fullPath.startsWith(g.route) && g.route !== '/') {
return true;
}
if (g.route === fullPath) {
return true;
}
if (g.items) {
let activeItem = g.items.filter(
({ route }) => route === fullPath || fullPath.startsWith(route)
);
if (activeItem.length) {
return true;
}
}
}) ??
fallBackGroup ??
this.groups[0];
},
isItemActive(item: SidebarItem) {
const { path: currentRoute, params } = this.$route;
const routeMatch = currentRoute === item.route;
const schemaNameMatch =
item.schemaName && params.schemaName === item.schemaName;
const isMatch = routeMatch || schemaNameMatch;
if (params.name && item.schemaName && !isMatch) {
return currentRoute.includes(`${item.schemaName}/${params.name}`);
}
return isMatch;
},
isGroupActive(group: SidebarRoot) {
return this.activeGroup && group.label === this.activeGroup.label;
},
routeToSidebarItem(item: SidebarItem | SidebarRoot) {
routeTo(this.getPath(item));
},
getPath(item: SidebarItem | SidebarRoot) {
const { route: path, filters } = item;
if (!filters) {
return path;
}
return { path, query: { filters: JSON.stringify(filters) } };
},
},
});
</script>
|
2302_79757062/books
|
src/components/Sidebar.vue
|
Vue
|
agpl-3.0
| 9,190
|
<template>
<p class="pill font-medium" :class="styleClass">{{ text }}</p>
</template>
<script lang="ts">
import { Doc } from 'fyo/model/doc';
import { isPesa } from 'fyo/utils';
import { Invoice } from 'models/baseModels/Invoice/Invoice';
import { Party } from 'models/baseModels/Party/Party';
import { getBgTextColorClass } from 'src/utils/colors';
import { defineComponent } from 'vue';
type Status = ReturnType<typeof getStatus>;
type UIColors = 'gray' | 'orange' | 'red' | 'green' | 'blue';
export default defineComponent({
props: { doc: { type: Doc, required: true } },
computed: {
styleClass(): string {
return getBgTextColorClass(this.color);
},
status(): Status {
return getStatus(this.doc);
},
text() {
const hasOutstanding = isPesa(this.doc.outstandingAmount);
if (hasOutstanding && this.status === 'Outstanding') {
const amt = this.fyo.format(this.doc.outstandingAmount, 'Currency');
return this.t`Unpaid ${amt}`;
}
if (this.doc instanceof Invoice && this.status === 'NotTransferred') {
const amt = this.fyo.format(this.doc.stockNotTransferred, 'Float');
return this.t`Pending Qty. ${amt}`;
}
return {
Draft: this.t`Draft`,
Cancelled: this.t`Cancelled`,
Outstanding: this.t`Outstanding`,
NotTransferred: this.t`Not Transferred`,
NotSaved: this.t`Not Saved`,
NotSubmitted: this.t`Not Submitted`,
Paid: this.t`Paid`,
Saved: this.t`Saved`,
Submitted: this.t`Submitted`,
Return: this.t`Return`,
ReturnIssued: this.t`Return Issued`,
}[this.status];
},
color(): UIColors {
return statusColorMap[this.status];
},
},
});
const statusColorMap: Record<Status, UIColors> = {
Draft: 'gray',
Cancelled: 'red',
Outstanding: 'orange',
NotTransferred: 'orange',
NotSaved: 'orange',
NotSubmitted: 'orange',
Paid: 'green',
Saved: 'blue',
Submitted: 'blue',
Return: 'green',
ReturnIssued: 'green',
};
function getStatus(doc: Doc) {
if (doc.notInserted) {
return 'Draft';
}
if (doc.dirty) {
return 'NotSaved';
}
if (doc instanceof Party && doc.outstandingAmount?.isZero() !== true) {
return 'Outstanding';
}
if (doc.schema.isSubmittable) {
return getSubmittableStatus(doc);
}
return 'Saved';
}
function getSubmittableStatus(doc: Doc) {
if (doc.isCancelled) {
return 'Cancelled';
}
if (doc.returnAgainst && doc.isSubmitted) {
return 'Return';
}
if (doc.isReturned && doc.isSubmitted) {
return 'ReturnIssued';
}
const isInvoice = doc instanceof Invoice;
if (
doc.isSubmitted &&
isInvoice &&
doc.outstandingAmount?.isZero() !== true
) {
return 'Outstanding';
}
if (doc.isSubmitted && isInvoice && (doc.stockNotTransferred ?? 0) > 0) {
return 'NotTransferred';
}
if (
doc.isSubmitted &&
isInvoice &&
doc.outstandingAmount?.isZero() === true
) {
return 'Paid';
}
if (doc.isSubmitted) {
return 'Submitted';
}
return 'NotSubmitted';
}
</script>
|
2302_79757062/books
|
src/components/StatusPill.vue
|
Vue
|
agpl-3.0
| 3,111
|
<template>
<Teleport to="#toast-container">
<Transition>
<div
v-if="open"
class="
inner
text-gray-900
dark:text-gray-25
shadow-lg
px-3
py-2
flex
items-center
mb-3
w-toast
z-30
bg-white
dark:bg-gray-850
rounded-lg
border
"
:class="[config.containerBorder]"
style="pointer-events: auto"
>
<feather-icon
:name="config.iconName"
class="w-6 h-6 me-3"
:class="config.iconColor"
/>
<div :class="actionText ? 'cursor-pointer' : ''" @click="actionClicked">
<p class="text-base">{{ message }}</p>
<button
v-if="actionText"
class="
text-sm text-gray-700
dark:text-gray-300
hover:text-gray-800
dark:hover:text-gray-200
"
>
{{ actionText }}
</button>
</div>
<feather-icon
name="x"
class="
w-4
h-4
ms-auto
text-gray-600
dark:text-gray-400
cursor-pointer
hover:text-gray-800
dark:hover:text-gray-200
"
@click="closeToast"
/>
</div>
</Transition>
</Teleport>
</template>
<script lang="ts">
import { getIconConfig } from 'src/utils/interactive';
import { ToastDuration, ToastType } from 'src/utils/types';
import { toastDurationMap } from 'src/utils/ui';
import { PropType, defineComponent, nextTick } from 'vue';
import FeatherIcon from './FeatherIcon.vue';
export default defineComponent({
components: {
FeatherIcon,
},
props: {
message: { type: String, required: true },
action: { type: Function, default: () => {} },
actionText: { type: String, default: '' },
type: { type: String as PropType<ToastType>, default: 'info' },
duration: { type: String as PropType<ToastDuration>, default: 'long' },
},
data() {
return {
open: false,
};
},
computed: {
config() {
return getIconConfig(this.type);
},
},
async mounted() {
const duration = toastDurationMap[this.duration];
await nextTick(() => (this.open = true));
setTimeout(this.closeToast, duration);
},
methods: {
actionClicked() {
this.action();
this.closeToast();
},
closeToast() {
this.open = false;
},
},
});
</script>
<style scoped>
.v-enter-active,
.v-leave-active {
transition: all 150ms ease-out;
}
.v-enter-from,
.v-leave-to {
opacity: 0;
}
.v-enter-to,
.v-leave-from {
opacity: 1;
}
</style>
|
2302_79757062/books
|
src/components/Toast.vue
|
Vue
|
agpl-3.0
| 2,745
|
<template>
<div
id="tooltip"
ref="tooltip"
style="transition: opacity 100ms ease-in"
:style="{ opacity }"
>
<slot></slot>
</div>
</template>
<script>
import flip from '@popperjs/core/lib/modifiers/flip';
import offset from '@popperjs/core/lib/modifiers/offset';
import preventOverflow from '@popperjs/core/lib/modifiers/preventOverflow';
import { createPopper } from '@popperjs/core/lib/popper-lite';
function generateGetBoundingClientRect(x = 0, y = 0) {
return () => ({
width: 0,
height: 0,
top: y,
right: x,
bottom: y,
left: x,
});
}
export default {
props: {
offset: { type: Number, default: 10 },
placement: { type: String, default: 'auto' },
},
data() {
return { popper: null, virtualElement: null, opacity: 0 };
},
methods: {
create() {
if (this.popper) {
this.opacity = 1;
return;
}
this.$refs.tooltip.setAttribute('data-show', '');
this.virtualElement = {
getBoundingClientRect: generateGetBoundingClientRect(-1000, -1000),
};
this.popper = createPopper(this.virtualElement, this.$refs.tooltip, {
placement: this.placement,
modifiers: [
flip,
preventOverflow,
Object.assign(offset, { options: { offset: [0, this.offset] } }),
],
});
this.opacity = 1;
},
update({ clientX, clientY }) {
if (!this.popper || !this.virtualElement) {
return;
}
this.virtualElement.getBoundingClientRect = generateGetBoundingClientRect(
clientX,
clientY
);
this.popper.update();
},
destroy() {
this.opacity = 0;
this.$refs.tooltip.removeAttribute('data-show');
this.popper?.destroy();
this.virtualElement = null;
this.popper = null;
},
},
};
</script>
<style scoped>
#tooltip {
display: none;
}
#tooltip[data-show] {
display: block;
}
</style>
|
2302_79757062/books
|
src/components/Tooltip.vue
|
Vue
|
agpl-3.0
| 1,952
|