Skip to content

Commit

Permalink
chore: refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
AbleKSaju committed Oct 30, 2024
1 parent 88c03ee commit 0320d8c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 30 deletions.
43 changes: 22 additions & 21 deletions models/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
import { Fyo, t } from 'fyo';
import { Doc } from 'fyo/model/doc';
import {
AccountRootType,
AccountRootTypeEnum,
} from './baseModels/Account/types';
import {
Action,
ColumnConfig,
DocStatus,
LeadStatus,
RenderData,
} from 'fyo/model/types';
import { Fyo, t } from 'fyo';
import { InvoiceStatus, ModelNameEnum } from './types';

import { ApplicablePricingRules } from './baseModels/Invoice/types';
import { AppliedCouponCodes } from './baseModels/AppliedCouponCodes/AppliedCouponCodes';
import { CollectionRulesItems } from './baseModels/CollectionRulesItems/CollectionRulesItems';
import { CouponCode } from './baseModels/CouponCode/CouponCode';
import { DateTime } from 'luxon';
import { Money } from 'pesa';
import { safeParseFloat } from 'utils/index';
import { Router } from 'vue-router';
import {
AccountRootType,
AccountRootTypeEnum,
} from './baseModels/Account/types';
import { numberSeriesDefaultsMap } from './baseModels/Defaults/Defaults';
import { Doc } from 'fyo/model/doc';
import { Invoice } from './baseModels/Invoice/Invoice';
import { SalesQuote } from './baseModels/SalesQuote/SalesQuote';
import { StockMovement } from './inventory/StockMovement';
import { StockTransfer } from './inventory/StockTransfer';
import { InvoiceStatus, ModelNameEnum } from './types';
import { Lead } from './baseModels/Lead/Lead';
import { PricingRule } from './baseModels/PricingRule/PricingRule';
import { ApplicablePricingRules } from './baseModels/Invoice/types';
import { LoyaltyProgram } from './baseModels/LoyaltyProgram/LoyaltyProgram';
import { CollectionRulesItems } from './baseModels/CollectionRulesItems/CollectionRulesItems';
import { isPesa } from 'fyo/utils';
import { Money } from 'pesa';
import { Party } from './baseModels/Party/Party';
import { CouponCode } from './baseModels/CouponCode/CouponCode';
import { PricingRule } from './baseModels/PricingRule/PricingRule';
import { Router } from 'vue-router';
import { SalesInvoice } from './baseModels/SalesInvoice/SalesInvoice';
import { AppliedCouponCodes } from './baseModels/AppliedCouponCodes/AppliedCouponCodes';
import { SalesQuote } from './baseModels/SalesQuote/SalesQuote';
import { StockMovement } from './inventory/StockMovement';
import { StockTransfer } from './inventory/StockTransfer';
import { ValidationError } from 'fyo/utils/errors';
import { isPesa } from 'fyo/utils';
import { numberSeriesDefaultsMap } from './baseModels/Defaults/Defaults';
import { safeParseFloat } from 'utils/index';

export function getQuoteActions(
fyo: Fyo,
Expand Down Expand Up @@ -1201,7 +1202,7 @@ export async function updatePricingRule(sinvDoc: SalesInvoice) {
).length;

setTimeout(() => {
(async () => {
void (async () => {
if (appliedPricingRuleCount !== applicablePricingRuleNames?.length) {
await sinvDoc.appendPricingRuleDetail(applicablePricingRuleNames);
await sinvDoc.applyProductDiscount();
Expand Down
6 changes: 3 additions & 3 deletions schemas/app/inventory/Point of Sale/POSSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"options": [
{
"value": "Classic",
"label": "POS1"
"label": "Classic"
},
{
"value": "Modern",
"label": "POS2"
"label": "Modern"
}
],
"default": "POS1",
"default": "Classic",
"required": true,
"section": "Default"
}
Expand Down
11 changes: 11 additions & 0 deletions src/components/POS/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@ export type ModalName =
| 'RouteToInvoiceList'
| 'CouponCode';

export type ModernPosModalName =
| 'Keyboard'
| 'ShiftOpen'
| 'ShiftClose'
| 'Payment'
| 'LoyaltyProgram'
| 'SavedInvoice'
| 'RouteToInvoiceList'
| 'CouponCode';

export interface POSItem {
id?: number;
image?: string;
name: string;
rate: Money;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/POS/AlertModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default defineComponent({
Modal,
Button,
},
emits: ['toggleModal', 'selectedInvoiceName'],
emits: ['toggleModal'],
methods: {
routeTo,
},
Expand Down
6 changes: 1 addition & 5 deletions src/utils/sidebarConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,12 @@ function getInventorySidebar(): SidebarRoot[] {
}

function getPOSSidebar() {
const isPOSEnabled = !!fyo.singles.InventorySettings?.enablePointOfSale;
if (!isPOSEnabled) {
return [];
}

return {
label: t`POS`,
name: 'pos',
route: '/pos',
icon: 'pos',
hidden: () => !fyo.singles.InventorySettings?.enablePointOfSale,
};
}

Expand Down

0 comments on commit 0320d8c

Please sign in to comment.