mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 01:28:55 +00:00
feat(places): link an expense to a place, the way bookings already do (#1917)
* feat(places): link an expense to a place, the way bookings already do Recording what a museum ticket or a guided tour cost meant leaving the place, opening the Costs tab and typing it in again — while a booking has had a Costs block in its own form all along. The place form now carries that block. Same component, same flow: with nothing linked it offers Create expense, which saves the place and then opens the Costs editor for a new expense pointing at it; once linked it shows the expense with edit and remove. budget_items gains place_id beside the reservation_id it already had, with the same nullable FK and the same ON DELETE SET NULL. Desktop and phone both, and the mobile editor carries the link through its own save path rather than the desktop one. The expense belongs to the place, not to a day assignment, so a place sitting on five days is not five tickets. Hanging it off the assignment would have meant adding a place to three days quietly creating three expenses and removing a day quietly deleting one. Deleting a place takes its expense with it in the same transaction and announces it, on every path that deletes a place: REST, both MCP tools and the plugin RPC. Closes #1298 * test(places): teach the RPC stubs about linkedExpenseIds The delete paths read the linked expense before the place is gone, so the two hand-built PlacesService stubs threw on the new method instead of reaching the hook, the remove and the broadcast — four failures out of one missing line.
This commit is contained in:
@@ -116,6 +116,9 @@ export const budgetItemSchema = z.object({
|
||||
/** Itemized receipt behind a per-item split, as JSON. Its own column since #1658. */
|
||||
ticket_json: z.string().nullable().optional(),
|
||||
reservation_id: z.number().nullable().optional(),
|
||||
/** Set when the expense was created from a place (#1298) — the same link
|
||||
* reservation_id is for a booking, on the other side of the planner. */
|
||||
place_id: z.number().nullable().optional(),
|
||||
paid_by_user_id: z.number().nullable().optional(),
|
||||
expense_date: z.string().nullable().optional(),
|
||||
sort_order: z.number().optional(),
|
||||
@@ -155,6 +158,9 @@ export const budgetCreateItemRequestSchema = z.object({
|
||||
// Link this expense to a reservation (e.g. created from a booking's
|
||||
// "add expense" flow). The server stores it on budget_items.reservation_id.
|
||||
reservation_id: z.number().optional(),
|
||||
// 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(),
|
||||
});
|
||||
export type BudgetCreateItemRequest = z.infer<typeof budgetCreateItemRequestSchema>;
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'فشل إنشاء الفئة',
|
||||
'places.nameRequired': 'يرجى إدخال اسم',
|
||||
'places.saveError': 'فشل الحفظ',
|
||||
'places.createExpenseHint': 'يحفظ المكان ثم يفتح محرر التكاليف.',
|
||||
'places.duplicateExists': "'{name}' موجود بالفعل في هذه الرحلة.",
|
||||
'places.addAnyway': 'الإضافة على أي حال',
|
||||
'places.enrichOnImport': 'إثراء الأماكن عبر Google',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Falha ao criar categoria',
|
||||
'places.nameRequired': 'Digite um nome',
|
||||
'places.saveError': 'Falha ao salvar',
|
||||
'places.createExpenseHint': 'Salva o local e depois abre o editor de despesas.',
|
||||
'places.duplicateExists': "'{name}' já está nesta viagem.",
|
||||
'places.addAnyway': 'Adicionar mesmo assim',
|
||||
'places.enrichOnImport': 'Enriquecer lugares via Google',
|
||||
|
||||
@@ -113,6 +113,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': "No s'ha pogut crear la categoria",
|
||||
'places.nameRequired': 'Introdueix un nom',
|
||||
'places.saveError': "No s'ha pogut desar",
|
||||
'places.createExpenseHint': 'Desa el lloc i després obre l’editor de despeses.',
|
||||
|
||||
'places.changeCategory': 'Canviar categoria',
|
||||
'places.categoryChanged': '{count} llocs actualitzats',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Nepodařilo se vytvořit kategorii',
|
||||
'places.nameRequired': 'Prosím zadejte název',
|
||||
'places.saveError': 'Uložení se nezdařilo',
|
||||
'places.createExpenseHint': 'Uloží místo a poté otevře editor nákladů.',
|
||||
'places.duplicateExists': "'{name}' už v tomto výletu existuje.",
|
||||
'places.addAnyway': 'Přesto přidat',
|
||||
'places.enrichOnImport': 'Obohatit místa přes Google',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Fehler beim Erstellen der Kategorie',
|
||||
'places.nameRequired': 'Bitte einen Namen eingeben',
|
||||
'places.saveError': 'Fehler beim Speichern',
|
||||
'places.createExpenseHint': 'Speichert den Ort und öffnet dann den Kosten-Editor.',
|
||||
'places.duplicateExists': "'{name}' ist bereits in dieser Reise.",
|
||||
'places.uploadImage': 'Bild hochladen',
|
||||
'places.changeImage': 'Bild ändern',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Failed to create category',
|
||||
'places.nameRequired': 'Please enter a name',
|
||||
'places.saveError': 'Failed to save',
|
||||
'places.createExpenseHint': 'Saves the place, then opens the Costs editor.',
|
||||
'places.duplicateExists': "'{name}' is already in this trip.",
|
||||
'places.addAnyway': 'Add anyway',
|
||||
'places.enrichOnImport': 'Enrich places via Google',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'No se pudo crear la categoría',
|
||||
'places.nameRequired': 'Introduce un nombre',
|
||||
'places.saveError': 'No se pudo guardar',
|
||||
'places.createExpenseHint': 'Guarda el lugar y luego abre el editor de gastos.',
|
||||
'places.duplicateExists': "'{name}' ya está en este viaje.",
|
||||
'places.addAnyway': 'Añadir de todos modos',
|
||||
'places.enrichOnImport': 'Enriquecer lugares con Google',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Impossible de créer la catégorie',
|
||||
'places.nameRequired': 'Veuillez saisir un nom',
|
||||
'places.saveError': "Échec de l'enregistrement",
|
||||
'places.createExpenseHint': 'Enregistre le lieu, puis ouvre l’éditeur de dépenses.',
|
||||
'places.duplicateExists': "'{name}' est déjà dans ce voyage.",
|
||||
'places.addAnyway': 'Ajouter quand même',
|
||||
'places.enrichOnImport': 'Enrichir les lieux via Google',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Αποτυχία δημιουργίας κατηγορίας',
|
||||
'places.nameRequired': 'Παρακαλώ εισαγάγετε ένα όνομα',
|
||||
'places.saveError': 'Αποτυχία αποθήκευσης',
|
||||
'places.createExpenseHint': 'Αποθηκεύει την τοποθεσία και ανοίγει τον επεξεργαστή εξόδων.',
|
||||
'places.duplicateExists': "Το '{name}' υπάρχει ήδη σε αυτό το ταξίδι.",
|
||||
'places.addAnyway': 'Προσθήκη ούτως ή άλλως',
|
||||
'places.enrichOnImport': 'Εμπλουτισμός τόπων μέσω Google',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Nem sikerült létrehozni a kategóriát',
|
||||
'places.nameRequired': 'Kérjük, adj meg egy nevet',
|
||||
'places.saveError': 'Nem sikerült menteni',
|
||||
'places.createExpenseHint': 'Menti a helyet, majd megnyitja a költségszerkesztőt.',
|
||||
'places.duplicateExists': "A(z) '{name}' már szerepel ebben az utazásban.",
|
||||
'places.addAnyway': 'Hozzáadás mindenképp',
|
||||
'places.enrichOnImport': 'Helyek gazdagítása a Google-lel',
|
||||
|
||||
@@ -114,6 +114,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Gagal membuat kategori',
|
||||
'places.nameRequired': 'Harap masukkan nama',
|
||||
'places.saveError': 'Gagal menyimpan',
|
||||
'places.createExpenseHint': 'Menyimpan tempat, lalu membuka editor biaya.',
|
||||
'places.duplicateExists': "'{name}' sudah ada di perjalanan ini.",
|
||||
'places.addAnyway': 'Tetap tambahkan',
|
||||
'places.enrichOnImport': 'Perkaya tempat via Google',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Impossibile creare la categoria',
|
||||
'places.nameRequired': 'Inserisci un nome',
|
||||
'places.saveError': 'Impossibile salvare',
|
||||
'places.createExpenseHint': 'Salva il luogo e poi apre l’editor dei costi.',
|
||||
'places.duplicateExists': "'{name}' è già in questo viaggio.",
|
||||
'places.addAnyway': 'Aggiungi comunque',
|
||||
'places.enrichOnImport': 'Arricchisci i luoghi con Google',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'カテゴリの作成に失敗しました',
|
||||
'places.nameRequired': '名前を入力してください',
|
||||
'places.saveError': '保存に失敗しました',
|
||||
'places.createExpenseHint': '場所を保存してから費用エディタを開きます。',
|
||||
'places.duplicateExists': '「{name}」はすでにこの旅程に含まれています。',
|
||||
'places.addAnyway': 'それでも追加',
|
||||
'places.enrichOnImport': 'Googleで場所を補完',
|
||||
|
||||
@@ -114,6 +114,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': '카테고리 생성 실패',
|
||||
'places.nameRequired': '이름을 입력하세요',
|
||||
'places.saveError': '저장 실패',
|
||||
'places.createExpenseHint': '장소를 저장한 뒤 비용 편집기를 엽니다.',
|
||||
'places.duplicateExists': "'{name}'은(는) 이미 이 여행에 있습니다.",
|
||||
'places.addAnyway': '그래도 추가',
|
||||
'places.enrichOnImport': 'Google로 장소 정보 보강',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Categorie aanmaken mislukt',
|
||||
'places.nameRequired': 'Voer een naam in',
|
||||
'places.saveError': 'Opslaan mislukt',
|
||||
'places.createExpenseHint': 'Slaat de plaats op en opent daarna de kosten-editor.',
|
||||
'places.duplicateExists': "'{name}' staat al in deze reis.",
|
||||
'places.addAnyway': 'Toch toevoegen',
|
||||
'places.enrichOnImport': 'Plaatsen verrijken via Google',
|
||||
|
||||
@@ -106,6 +106,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Nie udało się utworzyć kategorii',
|
||||
'places.nameRequired': 'Proszę podać nazwę',
|
||||
'places.saveError': 'Nie udało się zapisać',
|
||||
'places.createExpenseHint': 'Zapisuje miejsce i otwiera edytor kosztów.',
|
||||
'places.duplicateExists': "'{name}' jest już w tej podróży.",
|
||||
'places.addAnyway': 'Dodaj mimo to',
|
||||
'places.importNaverList': 'Lista Naver',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Не удалось создать категорию',
|
||||
'places.nameRequired': 'Введите название',
|
||||
'places.saveError': 'Ошибка сохранения',
|
||||
'places.createExpenseHint': 'Сохраняет место и открывает редактор расходов.',
|
||||
'places.duplicateExists': "'{name}' уже есть в этой поездке.",
|
||||
'places.addAnyway': 'Всё равно добавить',
|
||||
'places.enrichOnImport': 'Обогатить места через Google',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Det gick inte att skapa kategorin',
|
||||
'places.nameRequired': 'Ange ett namn',
|
||||
'places.saveError': 'Det gick inte att spara',
|
||||
'places.createExpenseHint': 'Sparar platsen och öppnar sedan kostnadsredigeraren.',
|
||||
'places.duplicateExists': "'{name}' ingår redan i resan.",
|
||||
'places.addAnyway': 'Lägg till ändå',
|
||||
'places.enrichOnImport': 'Berika platser via Google',
|
||||
|
||||
@@ -117,6 +117,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Kategori oluşturulamadı',
|
||||
'places.nameRequired': 'Lütfen bir ad girin',
|
||||
'places.saveError': 'Kaydedilemedi',
|
||||
'places.createExpenseHint': 'Yeri kaydeder, sonra masraf düzenleyicisini açar.',
|
||||
'places.duplicateExists': "'{name}' zaten bu gezide var.",
|
||||
'places.addAnyway': 'Yine de ekle',
|
||||
'places.enrichOnImport': 'Yerleri Google ile zenginleştir',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Не вдалося створити категорію',
|
||||
'places.nameRequired': 'Введіть назву',
|
||||
'places.saveError': 'Помилка збереження',
|
||||
'places.createExpenseHint': 'Зберігає місце й відкриває редактор витрат.',
|
||||
'places.duplicateExists': "'{name}' вже є в цій подорожі.",
|
||||
'places.addAnyway': 'Все одно додати',
|
||||
'places.enrichOnImport': 'Збагатити місця через Google',
|
||||
|
||||
@@ -115,6 +115,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': 'Không tạo được danh mục',
|
||||
'places.nameRequired': 'Vui lòng nhập tên',
|
||||
'places.saveError': 'Không lưu được',
|
||||
'places.createExpenseHint': 'Lưu địa điểm rồi mở trình sửa chi phí.',
|
||||
'places.duplicateExists': "'{name}' đã có trong chuyến đi này.",
|
||||
'places.addAnyway': 'Vẫn thêm',
|
||||
'places.enrichOnImport': 'Làm phong phú các địa điểm thông qua Google',
|
||||
|
||||
@@ -113,6 +113,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': '建立分類失敗',
|
||||
'places.nameRequired': '請輸入名稱',
|
||||
'places.saveError': '儲存失敗',
|
||||
'places.createExpenseHint': '先儲存地點,然後開啟費用編輯器。',
|
||||
'places.duplicateExists': "'{name}' 已在此行程中。",
|
||||
'places.addAnyway': '仍要新增',
|
||||
'places.enrichOnImport': '透過 Google 豐富地點資訊',
|
||||
|
||||
@@ -113,6 +113,7 @@ const places: TranslationStrings = {
|
||||
'places.categoryCreateError': '创建分类失败',
|
||||
'places.nameRequired': '请输入名称',
|
||||
'places.saveError': '保存失败',
|
||||
'places.createExpenseHint': '先保存地点,然后打开费用编辑器。',
|
||||
'places.duplicateExists': "'{name}' 已在此行程中。",
|
||||
'places.addAnyway': '仍然添加',
|
||||
'places.enrichOnImport': '通过 Google 丰富地点信息',
|
||||
|
||||
Reference in New Issue
Block a user