Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: minor UI/UX fixes and improvements #715

Merged
merged 7 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dummy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export async function setupDummyInstance(
ModelNameEnum.SystemSettings,
'instanceId'
)) as string;
await fyo.singles.SystemSettings?.setAndSync('hideGetStarted', true);

fyo.store.skipTelemetryLogging = false;
return { companyName: options.companyName, instanceId };
Expand Down
13 changes: 1 addition & 12 deletions models/baseModels/InvoiceItem/InvoiceItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,23 +478,12 @@ export abstract class InvoiceItem extends Doc {

static filters: FiltersMap = {
item: (doc: Doc) => {
const itemList = doc.parentdoc!.items as Doc[];
const items = itemList.map((d) => d.item as string).filter(Boolean);

let itemNotFor = 'Sales';
if (doc.isSales) {
itemNotFor = 'Purchases';
}

const baseFilter = { for: ['not in', [itemNotFor]] };
if (items.length <= 0) {
return baseFilter;
}

return {
name: ['not in', items],
...baseFilter,
};
return { for: ['not in', [itemNotFor]] };
},
};

Expand Down
2 changes: 1 addition & 1 deletion models/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export function getMakeReturnDocAction(fyo: Fyo): Action {
doc.isSubmitted &&
!doc.isReturn,
action: async (doc: Doc) => {
const returnDoc = await (doc as StockTransfer).getReturnDoc();
const returnDoc = await (doc as StockTransfer)?.getReturnDoc();
if (!returnDoc || !returnDoc.name) {
return;
}
Expand Down
16 changes: 8 additions & 8 deletions schemas/app/Address.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@
"fieldtype": "Data",
"required": true
},
{
"fieldname": "state",
"label": "State",
"placeholder": "State",
"options": [],
"fieldtype": "AutoComplete"
},
{
"fieldname": "country",
"label": "Country",
Expand All @@ -45,6 +38,13 @@
"options": [],
"required": true
},
{
"fieldname": "state",
"label": "State",
"placeholder": "State",
"options": [],
"fieldtype": "AutoComplete"
},
{
"fieldname": "postalCode",
"label": "Postal Code",
Expand Down Expand Up @@ -83,8 +83,8 @@
"addressLine1",
"addressLine2",
"city",
"state",
"country",
"state",
"postalCode"
],
"linkDisplayField": "addressDisplay"
Expand Down
10 changes: 2 additions & 8 deletions schemas/app/Invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@
"section": "Default"
},
{
"abstract": true,
"fieldname": "party",
"label": "Party",
"fieldtype": "Link",
"target": "Party",
"create": true,
"required": true,
"section": "Default"
},
{
Expand Down Expand Up @@ -167,10 +163,8 @@
"section": "Outstanding"
},
{
"abstract": true,
"fieldname": "stockNotTransferred",
"label": "Stock Not Transferred",
"fieldtype": "Float",
"readOnly": true,
"section": "Outstanding"
},
{
Expand Down
4 changes: 2 additions & 2 deletions schemas/app/Item.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
{
"fieldname": "for",
"label": "For",
"label": "Purpose",
"fieldtype": "Select",
"options": [
{
Expand Down Expand Up @@ -126,7 +126,7 @@
},
{
"fieldname": "trackItem",
"label": "Track Item",
"label": "Track Inventory",
"fieldtype": "Check",
"section": "Inventory",
"default": false
Expand Down
16 changes: 16 additions & 0 deletions schemas/app/PurchaseInvoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
"default": "PINV-",
"section": "Default"
},
{
"fieldname": "party",
"label": "Supplier",
"fieldtype": "Link",
"target": "Party",
"create": true,
"required": true,
"section": "Default"
},
{
"fieldname": "backReference",
"label": "Back Reference",
Expand All @@ -38,6 +47,13 @@
"required": true,
"edit": true,
"section": "Items"
},
{
"fieldname": "stockNotTransferred",
"label": "Stock Not Received",
"fieldtype": "Float",
"readOnly": true,
"section": "Outstanding"
}
],
"keywordFields": ["name", "party"]
Expand Down
16 changes: 16 additions & 0 deletions schemas/app/SalesInvoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
"default": "SINV-",
"section": "Default"
},
{
"fieldname": "party",
"label": "Customer",
"fieldtype": "Link",
"target": "Party",
"create": true,
"required": true,
"section": "Default"
},
{
"fieldname": "backReference",
"label": "Back Reference",
Expand All @@ -38,6 +47,13 @@
"required": true,
"edit": true,
"section": "Items"
},
{
"fieldname": "stockNotTransferred",
"label": "Stock Not Shipped",
"fieldtype": "Float",
"readOnly": true,
"section": "Outstanding"
}
],
"keywordFields": ["name", "party"]
Expand Down
2 changes: 1 addition & 1 deletion schemas/app/Tax.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Tax",
"label": "Tax",
"label": "Tax Template",
"naming": "manual",
"isSingle": false,
"isChild": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/regional/in/Address.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"addressLine1",
"addressLine2",
"city",
"state",
"country",
"state",
"postalCode",
"pos"
]
Expand Down
4 changes: 2 additions & 2 deletions src/components/Toast.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
rounded-lg
border
"
:class="[config.containerBorder]"
style="pointer-events: auto"
>
<feather-icon
Expand Down Expand Up @@ -51,11 +52,10 @@
</Teleport>
</template>
<script lang="ts">
import { getColorClass } from 'src/utils/colors';
import { getIconConfig } from 'src/utils/interactive';
import { ToastDuration, ToastType } from 'src/utils/types';
import { toastDurationMap } from 'src/utils/ui';
import { defineComponent, nextTick, PropType } from 'vue';
import { PropType, defineComponent, nextTick } from 'vue';
import FeatherIcon from './FeatherIcon.vue';

export default defineComponent({
Expand Down
1 change: 1 addition & 0 deletions src/pages/DatabaseSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ export default defineComponent({
await this.setFiles();
this.fyo.telemetry.log(Verb.Created, 'dummy-instance');
this.creatingDemo = false;
this.$emit('file-selected', filePath);
},
async setFiles() {
const dbList = await ipc.getDbList();
Expand Down
6 changes: 5 additions & 1 deletion src/utils/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ export function getBgColorClass(color: string) {
return `bg-${vcolor}-200`;
}

export function getColorClass(color: string, type: 'bg' | 'text', value = 300) {
export function getColorClass(
color: string,
type: 'bg' | 'text' | 'border',
value = 300
) {
return `${type}-${getValidColor(color)}-${value}`;
}

Expand Down
4 changes: 3 additions & 1 deletion src/utils/interactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export function getIconConfig(type: ToastType) {
}[type];

const iconColor = getColorClass(color ?? 'gray', 'text', 400);
const containerBackground = getColorClass(color ?? 'gray', 'bg', 100);
const containerBorder = getColorClass(color ?? 'gray', 'border', 300);

return { iconName, color, iconColor };
return { iconName, color, iconColor, containerBorder, containerBackground };
}
2 changes: 1 addition & 1 deletion src/utils/sidebarConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ function getCompleteSidebar(): SidebarConfig {
route: '/chart-of-accounts',
},
{
label: t`Taxes`,
label: t`Tax Templates`,
name: 'taxes',
route: '/list/Tax',
schemaName: 'Tax',
Expand Down
Loading