diff --git a/packages/server/resources/locales/ar.json b/packages/server/resources/locales/ar.json index a52b13d51..5d51e1e82 100644 --- a/packages/server/resources/locales/ar.json +++ b/packages/server/resources/locales/ar.json @@ -242,7 +242,7 @@ "account.field.normal.credit": "دائن", "account.field.normal.debit": "مدين", "account.field.type": "نوع الحساب", - "account.field.active": "Activity", + "account.field.active": "Active", "account.field.balance": "الرصيد", "account.field.created_at": "أنشئت في", "item.field.type": "نوع الصنف", diff --git a/packages/server/resources/locales/en.json b/packages/server/resources/locales/en.json index d63edebaf..c878c0576 100644 --- a/packages/server/resources/locales/en.json +++ b/packages/server/resources/locales/en.json @@ -241,7 +241,8 @@ "account.field.normal.credit": "Credit", "account.field.normal.debit": "Debit", "account.field.type": "Type", - "account.field.active": "Activity", + "account.field.active": "Active", + "account.field.currency": "Currency", "account.field.balance": "Balance", "account.field.created_at": "Created at", "item.field.type": "Item type", diff --git a/packages/server/src/services/Accounts/AccountsImportable.SampleData.ts b/packages/server/src/services/Accounts/AccountsImportable.SampleData.ts new file mode 100644 index 000000000..1757bd498 --- /dev/null +++ b/packages/server/src/services/Accounts/AccountsImportable.SampleData.ts @@ -0,0 +1,50 @@ +export const AccountsSampleData = [ + { + 'Account Name': 'Utilities Expense', + 'Account Code': 9000, + Type: 'Expense', + Description: 'Omnis voluptatum consequatur.', + Active: 'T', + 'Currency Code': '', + }, + { + 'Account Name': 'Unearned Revenue', + 'Account Code': 9010, + Type: 'Long Term Liability', + Description: 'Autem odit voluptas nihil unde.', + Active: 'T', + 'Currency Code': '', + }, + { + 'Account Name': 'Long-Term Debt', + 'Account Code': 9020, + Type: 'Long Term Liability', + Description: 'In voluptas cumque exercitationem.', + Active: 'T', + 'Currency Code': '', + }, + { + 'Account Name': 'Salaries and Wages Expense', + 'Account Code': 9030, + Type: 'Expense', + Description: 'Assumenda aspernatur soluta aliquid perspiciatis quasi.', + Active: 'T', + 'Currency Code': '', + }, + { + 'Account Name': 'Rental Income', + 'Account Code': 9040, + Type: 'Income', + Description: 'Omnis possimus amet occaecati inventore.', + Active: 'T', + 'Currency Code': '', + }, + { + 'Account Name': 'Paypal', + 'Account Code': 9050, + Type: 'Bank', + Description: 'In voluptas cumque exercitationem.', + Active: 'T', + 'Currency Code': '', + }, +]; diff --git a/packages/server/src/services/Accounts/AccountsImportable.ts b/packages/server/src/services/Accounts/AccountsImportable.ts index 93ab2cb8c..28a7a18a3 100644 --- a/packages/server/src/services/Accounts/AccountsImportable.ts +++ b/packages/server/src/services/Accounts/AccountsImportable.ts @@ -3,6 +3,7 @@ import { Knex } from 'knex'; import { IAccountCreateDTO } from '@/interfaces'; import { CreateAccount } from './CreateAccount'; import { Importable } from '../Import/Importable'; +import { AccountsSampleData } from './AccountsImportable.SampleData'; @Service() export class AccountsImportable extends Importable { @@ -35,11 +36,10 @@ export class AccountsImportable extends Importable { return 1; } - public public sampleData(): any[] { - return [ - { - - } - ] + /** + * Retrieves the sample data that used to download accounts sample sheet. + */ + public sampleData(): any[] { + return AccountsSampleData; } } diff --git a/packages/server/src/services/Cashflow/UncategorizedTransactionsImportable.ts b/packages/server/src/services/Cashflow/UncategorizedTransactionsImportable.ts index a34605842..a08a27f07 100644 --- a/packages/server/src/services/Cashflow/UncategorizedTransactionsImportable.ts +++ b/packages/server/src/services/Cashflow/UncategorizedTransactionsImportable.ts @@ -6,7 +6,7 @@ import { CreateUncategorizedTransaction } from './CreateUncategorizedTransaction import { CreateUncategorizedTransactionDTO } from '@/interfaces'; import { ImportableContext } from '../Import/interfaces'; import HasTenancyService from '../Tenancy/TenancyService'; -import { ImportSampleData } from './constants'; +import { BankTransactionsSampleData } from './constants'; @Service() export class UncategorizedTransactionsImportable extends Importable { @@ -32,8 +32,8 @@ export class UncategorizedTransactionsImportable extends Importable { /** * Transformes the DTO before validating and importing. - * @param {CreateUncategorizedTransactionDTO} createDTO - * @param {ImportableContext} context + * @param {CreateUncategorizedTransactionDTO} createDTO + * @param {ImportableContext} context * @returns {CreateUncategorizedTransactionDTO} */ public transform( @@ -51,7 +51,7 @@ export class UncategorizedTransactionsImportable extends Importable { * @returns {Record[]} */ public sampleData(): Record[] { - return ImportSampleData; + return BankTransactionsSampleData; } /** @@ -76,9 +76,7 @@ export class UncategorizedTransactionsImportable extends Importable { const { Account } = this.tenancy.models(tenantId); if (params.accountId) { - await Account.query() - .findById(params.accountId) - .throwIfNotFound({}); + await Account.query().findById(params.accountId).throwIfNotFound({}); } } -} \ No newline at end of file +} diff --git a/packages/server/src/services/Cashflow/constants.ts b/packages/server/src/services/Cashflow/constants.ts index dd66a17ed..c77c45f69 100644 --- a/packages/server/src/services/Cashflow/constants.ts +++ b/packages/server/src/services/Cashflow/constants.ts @@ -11,8 +11,10 @@ export const ERRORS = { ACCOUNT_HAS_ASSOCIATED_TRANSACTIONS: 'account_has_associated_transactions', TRANSACTION_ALREADY_CATEGORIZED: 'TRANSACTION_ALREADY_CATEGORIZED', TRANSACTION_ALREADY_UNCATEGORIZED: 'TRANSACTION_ALREADY_UNCATEGORIZED', - UNCATEGORIZED_TRANSACTION_TYPE_INVALID: 'UNCATEGORIZED_TRANSACTION_TYPE_INVALID', - CANNOT_DELETE_TRANSACTION_CONVERTED_FROM_UNCATEGORIZED: 'CANNOT_DELETE_TRANSACTION_CONVERTED_FROM_UNCATEGORIZED' + UNCATEGORIZED_TRANSACTION_TYPE_INVALID: + 'UNCATEGORIZED_TRANSACTION_TYPE_INVALID', + CANNOT_DELETE_TRANSACTION_CONVERTED_FROM_UNCATEGORIZED: + 'CANNOT_DELETE_TRANSACTION_CONVERTED_FROM_UNCATEGORIZED', }; export enum CASHFLOW_DIRECTION { @@ -76,24 +78,28 @@ export interface ICashflowTransactionTypeMeta { creditType: string[]; } - -export const ImportSampleData = [ - { - Amount: 5000, - Date: '2024-01-01', - Payee: 'John Roberts', - Description: 'Cheque deposit', - }, - { - Amount: 5000, - Date: '2024-01-01', - Payee: 'John Roberts', - Description: 'Cheque deposit', - }, - { - Amount: 5000, - Date: '2024-01-01', - Payee: 'John Roberts', - Description: 'Cheque deposit', - }, -] \ No newline at end of file +export const BankTransactionsSampleData = [ + [ + { + Amount: '6,410.19', + Date: '2024-03-26', + Payee: 'MacGyver and Sons', + 'Reference No.': 'REF-1', + Description: 'Commodi quo labore.', + }, + { + Amount: '8,914.17', + Date: '2024-01-05', + Payee: 'Eichmann - Bergnaum', + 'Reference No.': 'REF-1', + Description: 'Quia enim et.', + }, + { + Amount: '6,200.88', + Date: '2024-02-17', + Payee: 'Luettgen, Mraz and Legros', + 'Reference No.': 'REF-1', + Description: 'Occaecati consequuntur cum impedit illo.', + }, + ], +];