mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 00:20:07 +00:00
feat(budget): attach receipts and invoices to expenses
This commit is contained in:
@@ -97,10 +97,20 @@ export const budgetItemPayerSchema = z.object({
|
||||
});
|
||||
export type BudgetItemPayer = z.infer<typeof budgetItemPayerSchema>;
|
||||
|
||||
export const budgetItemReceiptSchema = z.object({
|
||||
id: z.number(),
|
||||
filename: z.string(),
|
||||
original_name: z.string(),
|
||||
file_size: z.number().nullable().optional(),
|
||||
mime_type: z.string().nullable().optional(),
|
||||
url: z.string(),
|
||||
});
|
||||
export type BudgetItemReceipt = z.infer<typeof budgetItemReceiptSchema>;
|
||||
|
||||
/**
|
||||
* Budget item entity as returned by the budget list/create/update endpoints
|
||||
* (server/src/services/budgetService.ts). Columns of the `budget_items` table
|
||||
* plus the embedded `members` (equal-split participants) and `payers` arrays.
|
||||
* plus the embedded `members` (equal-split participants), `payers` and `receipts` arrays.
|
||||
* total_price is the sum of payer amounts in `currency`; `exchange_rate` converts
|
||||
* that to the trip base currency (NULL currency + rate 1 = base currency).
|
||||
*/
|
||||
@@ -127,6 +137,7 @@ export const budgetItemSchema = z.object({
|
||||
created_at: z.string().optional(),
|
||||
members: z.array(budgetItemMemberSchema).optional(),
|
||||
payers: z.array(budgetItemPayerSchema).optional(),
|
||||
receipts: z.array(budgetItemReceiptSchema).optional(),
|
||||
});
|
||||
export type BudgetItem = z.infer<typeof budgetItemSchema>;
|
||||
|
||||
@@ -163,6 +174,8 @@ export const budgetCreateItemRequestSchema = z.object({
|
||||
// The same for a place: the place form's "add expense" flow saves the place
|
||||
// first, then creates the expense against it (#1298).
|
||||
place_id: z.number().optional(),
|
||||
// Receipt files to link to this expense
|
||||
receipt_file_ids: z.array(z.number()).optional(),
|
||||
});
|
||||
export type BudgetCreateItemRequest = z.infer<typeof budgetCreateItemRequestSchema>;
|
||||
|
||||
@@ -181,6 +194,7 @@ export const budgetUpdateItemRequestSchema = z.object({
|
||||
note: z.string().nullable().optional(),
|
||||
ticket_json: z.string().nullable().optional(),
|
||||
expense_date: z.string().nullable().optional(),
|
||||
receipt_file_ids: z.array(z.number()).optional(),
|
||||
});
|
||||
export type BudgetUpdateItemRequest = z.infer<typeof budgetUpdateItemRequestSchema>;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ export const fileUploadRequestSchema = z.object({
|
||||
place_id: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
reservation_id: z.string().optional(),
|
||||
budget_item_id: z.string().optional(),
|
||||
});
|
||||
export type FileUploadRequest = z.infer<typeof fileUploadRequestSchema>;
|
||||
|
||||
@@ -29,6 +30,7 @@ export const fileUpdateRequestSchema = z.object({
|
||||
description: z.string().optional(),
|
||||
place_id: nullableIdField,
|
||||
reservation_id: nullableIdField,
|
||||
budget_item_id: nullableIdField,
|
||||
});
|
||||
export type FileUpdateRequest = z.infer<typeof fileUpdateRequestSchema>;
|
||||
|
||||
@@ -36,6 +38,7 @@ export const fileLinkRequestSchema = z.object({
|
||||
reservation_id: nullableIdField,
|
||||
assignment_id: nullableIdField,
|
||||
place_id: nullableIdField,
|
||||
budget_item_id: nullableIdField,
|
||||
});
|
||||
export type FileLinkRequest = z.infer<typeof fileLinkRequestSchema>;
|
||||
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'مجموع الحصص: {sum} من {total} (ناقص {diff})',
|
||||
'costs.splitSumOver': 'مجموع الحصص: {sum} من {total} (زائد {diff})',
|
||||
'costs.toggleSign': 'التبديل بين المصروف والاسترداد',
|
||||
'costs.receipts': 'الإيصالات',
|
||||
'costs.receiptsTitle': 'الإيصالات والفواتير',
|
||||
'costs.attachReceipt': 'إرفاق إيصال / فاتورة',
|
||||
'costs.noReceipts': 'لا توجد إيصالات مرفقة',
|
||||
'costs.deleteReceipt': 'حذف الإيصال',
|
||||
'costs.viewReceipt': 'عرض الإيصال',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Soma das partes: {sum} de {total} (faltam {diff})',
|
||||
'costs.splitSumOver': 'Soma das partes: {sum} de {total} (sobram {diff})',
|
||||
'costs.toggleSign': 'Alternar entre despesa e reembolso',
|
||||
'costs.receipts': 'Comprovantes',
|
||||
'costs.receiptsTitle': 'Comprovantes e notas',
|
||||
'costs.attachReceipt': 'Anexar comprovante / nota',
|
||||
'costs.noReceipts': 'Nenhum comprovante anexado',
|
||||
'costs.deleteReceipt': 'Remover comprovante',
|
||||
'costs.viewReceipt': 'Ver comprovante',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,6 +147,12 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Suma de les parts: {sum} de {total} (en falten {diff})',
|
||||
'costs.splitSumOver': 'Suma de les parts: {sum} de {total} ({diff} de més)',
|
||||
'costs.toggleSign': 'Alterna entre despesa i devolució',
|
||||
'costs.receipts': 'Rebuts',
|
||||
'costs.receiptsTitle': 'Rebuts i factures',
|
||||
'costs.attachReceipt': 'Adjuntar rebut / factura',
|
||||
'costs.noReceipts': 'Cap rebut adjunt',
|
||||
'costs.deleteReceipt': 'Eliminar rebut',
|
||||
'costs.viewReceipt': 'Veure rebut',
|
||||
};
|
||||
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Součet podílů: {sum} z {total} (chybí {diff})',
|
||||
'costs.splitSumOver': 'Součet podílů: {sum} z {total} (o {diff} více)',
|
||||
'costs.toggleSign': 'Přepnout mezi výdajem a vratkou',
|
||||
'costs.receipts': 'Účtenky',
|
||||
'costs.receiptsTitle': 'Účtenky a faktury',
|
||||
'costs.attachReceipt': 'Připojit účtenku / fakturu',
|
||||
'costs.noReceipts': 'Žádné připojené účtenky',
|
||||
'costs.deleteReceipt': 'Odebrat účtenku',
|
||||
'costs.viewReceipt': 'Zobrazit účtenku',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Summe der Anteile: {sum} von {total} (es fehlen {diff})',
|
||||
'costs.splitSumOver': 'Summe der Anteile: {sum} von {total} ({diff} zu viel)',
|
||||
'costs.toggleSign': 'Zwischen Ausgabe und Erstattung wechseln',
|
||||
'costs.receipts': 'Belege',
|
||||
'costs.receiptsTitle': 'Belege & Rechnungen',
|
||||
'costs.attachReceipt': 'Beleg / Rechnung anhängen',
|
||||
'costs.noReceipts': 'Keine Belege angehängt',
|
||||
'costs.deleteReceipt': 'Beleg entfernen',
|
||||
'costs.viewReceipt': 'Beleg ansehen',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,6 +147,12 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Sum of splits: {sum} of {total} (under by {diff})',
|
||||
'costs.splitSumOver': 'Sum of splits: {sum} of {total} (over by {diff})',
|
||||
'costs.toggleSign': 'Switch between expense and refund',
|
||||
'costs.receipts': 'Receipts',
|
||||
'costs.receiptsTitle': 'Receipts & Invoices',
|
||||
'costs.attachReceipt': 'Attach receipt / invoice',
|
||||
'costs.noReceipts': 'No receipts attached',
|
||||
'costs.deleteReceipt': 'Remove receipt',
|
||||
'costs.viewReceipt': 'View receipt',
|
||||
};
|
||||
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Suma de las partes: {sum} de {total} (faltan {diff})',
|
||||
'costs.splitSumOver': 'Suma de las partes: {sum} de {total} (sobran {diff})',
|
||||
'costs.toggleSign': 'Cambiar entre gasto y reembolso',
|
||||
'costs.receipts': 'Recibos',
|
||||
'costs.receiptsTitle': 'Recibos y facturas',
|
||||
'costs.attachReceipt': 'Adjuntar recibo / factura',
|
||||
'costs.noReceipts': 'No hay recibos adjuntos',
|
||||
'costs.deleteReceipt': 'Eliminar recibo',
|
||||
'costs.viewReceipt': 'Ver recibo',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Somme des parts : {sum} sur {total} (il manque {diff})',
|
||||
'costs.splitSumOver': 'Somme des parts : {sum} sur {total} ({diff} de trop)',
|
||||
'costs.toggleSign': 'Basculer entre dépense et remboursement',
|
||||
'costs.receipts': 'Reçus',
|
||||
'costs.receiptsTitle': 'Reçus et factures',
|
||||
'costs.attachReceipt': 'Joindre un reçu / une facture',
|
||||
'costs.noReceipts': 'Aucun reçu joint',
|
||||
'costs.deleteReceipt': 'Supprimer le reçu',
|
||||
'costs.viewReceipt': 'Voir le reçu',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -148,5 +148,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Άθροισμα μεριδίων: {sum} από {total} (λείπουν {diff})',
|
||||
'costs.splitSumOver': 'Άθροισμα μεριδίων: {sum} από {total} ({diff} παραπάνω)',
|
||||
'costs.toggleSign': 'Εναλλαγή μεταξύ εξόδου και επιστροφής',
|
||||
'costs.receipts': 'Αποδείξεις',
|
||||
'costs.receiptsTitle': 'Αποδείξεις & Τιμολόγια',
|
||||
'costs.attachReceipt': 'Επισύναψη απόδειξης / τιμολογίου',
|
||||
'costs.noReceipts': 'Δεν υπάρχουν συνημμένες αποδείξεις',
|
||||
'costs.deleteReceipt': 'Αφαίρεση απόδειξης',
|
||||
'costs.viewReceipt': 'Προβολή απόδειξης',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'A részek összege: {sum} / {total} (hiányzik {diff})',
|
||||
'costs.splitSumOver': 'A részek összege: {sum} / {total} ({diff} a többlet)',
|
||||
'costs.toggleSign': 'Váltás kiadás és visszatérítés között',
|
||||
'costs.receipts': 'Nyugták',
|
||||
'costs.receiptsTitle': 'Nyugták és számlák',
|
||||
'costs.attachReceipt': 'Nyugta / számla csatolása',
|
||||
'costs.noReceipts': 'Nincsenek csatolt nyugták',
|
||||
'costs.deleteReceipt': 'Nyugta eltávolítása',
|
||||
'costs.viewReceipt': 'Nyugta megtekintése',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Jumlah bagian: {sum} dari {total} (kurang {diff})',
|
||||
'costs.splitSumOver': 'Jumlah bagian: {sum} dari {total} (lebih {diff})',
|
||||
'costs.toggleSign': 'Beralih antara pengeluaran dan pengembalian dana',
|
||||
'costs.receipts': 'Kuitansi',
|
||||
'costs.receiptsTitle': 'Kuitansi & Faktur',
|
||||
'costs.attachReceipt': 'Lampirkan kuitansi / faktur',
|
||||
'costs.noReceipts': 'Tidak ada kuitansi terlampir',
|
||||
'costs.deleteReceipt': 'Hapus kuitansi',
|
||||
'costs.viewReceipt': 'Lihat kuitansi',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Somma delle quote: {sum} di {total} (mancano {diff})',
|
||||
'costs.splitSumOver': 'Somma delle quote: {sum} di {total} ({diff} in più)',
|
||||
'costs.toggleSign': 'Passa da spesa a rimborso',
|
||||
'costs.receipts': 'Ricevute',
|
||||
'costs.receiptsTitle': 'Ricevute e fatture',
|
||||
'costs.attachReceipt': 'Allega ricevuta / fattura',
|
||||
'costs.noReceipts': 'Nessuna ricevuta allegata',
|
||||
'costs.deleteReceipt': 'Rimuovi ricevuta',
|
||||
'costs.viewReceipt': 'Visualizza ricevuta',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': '分割の合計: {total} のうち {sum}({diff} 不足)',
|
||||
'costs.splitSumOver': '分割の合計: {total} のうち {sum}({diff} 超過)',
|
||||
'costs.toggleSign': '支出と返金を切り替える',
|
||||
'costs.receipts': 'レシート',
|
||||
'costs.receiptsTitle': 'レシート・請求書',
|
||||
'costs.attachReceipt': 'レシート・請求書を添付',
|
||||
'costs.noReceipts': '添付されたレシートはありません',
|
||||
'costs.deleteReceipt': 'レシートを削除',
|
||||
'costs.viewReceipt': 'レシートを表示',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': '분할 합계: {total} 중 {sum} ({diff} 부족)',
|
||||
'costs.splitSumOver': '분할 합계: {total} 중 {sum} ({diff} 초과)',
|
||||
'costs.toggleSign': '지출과 환불 전환',
|
||||
'costs.receipts': '영수증',
|
||||
'costs.receiptsTitle': '영수증 및 청구서',
|
||||
'costs.attachReceipt': '영수증 / 청구서 첨부',
|
||||
'costs.noReceipts': '첨부된 영수증 없음',
|
||||
'costs.deleteReceipt': '영수증 삭제',
|
||||
'costs.viewReceipt': '영수증 보기',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Som van de delen: {sum} van {total} ({diff} te weinig)',
|
||||
'costs.splitSumOver': 'Som van de delen: {sum} van {total} ({diff} te veel)',
|
||||
'costs.toggleSign': 'Wisselen tussen uitgave en terugbetaling',
|
||||
'costs.receipts': 'Bonnetjes',
|
||||
'costs.receiptsTitle': 'Bonnetjes & facturen',
|
||||
'costs.attachReceipt': 'Bon / factuur bijvoegen',
|
||||
'costs.noReceipts': 'Geen bonnetjes bijgevoegd',
|
||||
'costs.deleteReceipt': 'Bonnetje verwijderen',
|
||||
'costs.viewReceipt': 'Bonnetje bekijken',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Suma podziałów: {sum} z {total} (brakuje {diff})',
|
||||
'costs.splitSumOver': 'Suma podziałów: {sum} z {total} (o {diff} za dużo)',
|
||||
'costs.toggleSign': 'Przełącz między wydatkiem a zwrotem',
|
||||
'costs.receipts': 'Paragony',
|
||||
'costs.receiptsTitle': 'Paragony i faktury',
|
||||
'costs.attachReceipt': 'Załącz paragon / fakturę',
|
||||
'costs.noReceipts': 'Brak załączonych paragonów',
|
||||
'costs.deleteReceipt': 'Usuń paragon',
|
||||
'costs.viewReceipt': 'Zobacz paragon',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Сумма долей: {sum} из {total} (не хватает {diff})',
|
||||
'costs.splitSumOver': 'Сумма долей: {sum} из {total} (больше на {diff})',
|
||||
'costs.toggleSign': 'Переключить между расходом и возвратом',
|
||||
'costs.receipts': 'Чеки',
|
||||
'costs.receiptsTitle': 'Чеки и счета',
|
||||
'costs.attachReceipt': 'Прикрепить чек / счет',
|
||||
'costs.noReceipts': 'Нет прикрепленных чеков',
|
||||
'costs.deleteReceipt': 'Удалить чек',
|
||||
'costs.viewReceipt': 'Просмотреть чек',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Summan av delarna: {sum} av {total} ({diff} saknas)',
|
||||
'costs.splitSumOver': 'Summan av delarna: {sum} av {total} ({diff} för mycket)',
|
||||
'costs.toggleSign': 'Växla mellan utgift och återbetalning',
|
||||
'costs.receipts': 'Kvitton',
|
||||
'costs.receiptsTitle': 'Kvitton & fakturor',
|
||||
'costs.attachReceipt': 'Bifoga kvitto / faktura',
|
||||
'costs.noReceipts': 'Inga bifogade kvitton',
|
||||
'costs.deleteReceipt': 'Ta bort kvitto',
|
||||
'costs.viewReceipt': 'Visa kvitto',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Payların toplamı: {total} tutarın {sum} kadarı ({diff} eksik)',
|
||||
'costs.splitSumOver': 'Payların toplamı: {total} tutarın {sum} kadarı ({diff} fazla)',
|
||||
'costs.toggleSign': 'Gider ve iade arasında geçiş yap',
|
||||
'costs.receipts': 'Fişler',
|
||||
'costs.receiptsTitle': 'Fişler ve Faturalar',
|
||||
'costs.attachReceipt': 'Fiş / fatura ekle',
|
||||
'costs.noReceipts': 'Ekli fiş yok',
|
||||
'costs.deleteReceipt': 'Fişi kaldır',
|
||||
'costs.viewReceipt': 'Fişi görüntüle',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,5 +147,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Сума часток: {sum} з {total} (бракує {diff})',
|
||||
'costs.splitSumOver': 'Сума часток: {sum} з {total} (більше на {diff})',
|
||||
'costs.toggleSign': 'Перемкнути між витратою та поверненням',
|
||||
'costs.receipts': 'Чеки',
|
||||
'costs.receiptsTitle': 'Чеки та рахунки',
|
||||
'costs.attachReceipt': 'Додати чек / рахунок',
|
||||
'costs.noReceipts': 'Немає доданих чеків',
|
||||
'costs.deleteReceipt': 'Видалити чек',
|
||||
'costs.viewReceipt': 'Переглянути чек',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -147,6 +147,12 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': 'Tổng các phần: {sum} trên {total} (thiếu {diff})',
|
||||
'costs.splitSumOver': 'Tổng các phần: {sum} trên {total} (thừa {diff})',
|
||||
'costs.toggleSign': 'Chuyển giữa khoản chi và khoản hoàn',
|
||||
'costs.receipts': 'Hóa đơn',
|
||||
'costs.receiptsTitle': 'Hóa đơn & Biên lai',
|
||||
'costs.attachReceipt': 'Đính kèm hóa đơn / biên lai',
|
||||
'costs.noReceipts': 'Chưa đính kèm hóa đơn nào',
|
||||
'costs.deleteReceipt': 'Xóa hóa đơn',
|
||||
'costs.viewReceipt': 'Xem hóa đơn',
|
||||
};
|
||||
|
||||
export default budget;
|
||||
|
||||
@@ -146,5 +146,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': '分攤合計:{total} 中的 {sum}(少 {diff})',
|
||||
'costs.splitSumOver': '分攤合計:{total} 中的 {sum}(多 {diff})',
|
||||
'costs.toggleSign': '在支出與退款之間切換',
|
||||
'costs.receipts': '收據',
|
||||
'costs.receiptsTitle': '收據與發票',
|
||||
'costs.attachReceipt': '附加收據/發票',
|
||||
'costs.noReceipts': '未附加收據',
|
||||
'costs.deleteReceipt': '刪除收據',
|
||||
'costs.viewReceipt': '查看收據',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
@@ -146,5 +146,11 @@ const budget: TranslationStrings = {
|
||||
'costs.splitSumUnder': '分摊合计:{total} 中的 {sum}(少 {diff})',
|
||||
'costs.splitSumOver': '分摊合计:{total} 中的 {sum}(多 {diff})',
|
||||
'costs.toggleSign': '在支出和退款之间切换',
|
||||
'costs.receipts': '收据',
|
||||
'costs.receiptsTitle': '收据与发票',
|
||||
'costs.attachReceipt': '附加收据/发票',
|
||||
'costs.noReceipts': '未附加收据',
|
||||
'costs.deleteReceipt': '删除收据',
|
||||
'costs.viewReceipt': '查看收据',
|
||||
};
|
||||
export default budget;
|
||||
|
||||
Reference in New Issue
Block a user