diff --git a/pkg/models/user_app_cloud_setting.go b/pkg/models/user_app_cloud_setting.go index 8f0601d0..e34760ca 100644 --- a/pkg/models/user_app_cloud_setting.go +++ b/pkg/models/user_app_cloud_setting.go @@ -29,6 +29,7 @@ var ALL_ALLOWED_CLOUD_SYNC_APP_SETTING_KEY_TYPES = map[string]UserApplicationClo "showTotalAmountInTransactionListPage": USER_APPLICATION_CLOUD_SETTING_TYPE_BOOLEAN, "showTagInTransactionListPage": USER_APPLICATION_CLOUD_SETTING_TYPE_BOOLEAN, // Transaction Edit Page + "quickAddButtonActionInMobileTransactionEditPage": USER_APPLICATION_CLOUD_SETTING_TYPE_NUMBER, "autoSaveTransactionDraft": USER_APPLICATION_CLOUD_SETTING_TYPE_STRING, "autoGetCurrentGeoLocation": USER_APPLICATION_CLOUD_SETTING_TYPE_BOOLEAN, "alwaysShowTransactionPicturesInMobileTransactionEditPage": USER_APPLICATION_CLOUD_SETTING_TYPE_BOOLEAN, diff --git a/src/core/setting.ts b/src/core/setting.ts index bec8d320..b3a3d379 100644 --- a/src/core/setting.ts +++ b/src/core/setting.ts @@ -1,6 +1,7 @@ import { type WeekDayValue, WeekDay } from './datetime.ts'; import { TimezoneTypeForStatistics } from './timezone.ts'; import { CurrencySortingType } from './currency.ts'; +import { TransactionQuickAddButtonActionType } from './transaction.ts'; import { CategoricalChartType, TrendChartType, @@ -43,6 +44,7 @@ export interface ApplicationSettings extends BaseApplicationSetting { overviewAccountFilterInHomePage: Record; overviewTransactionCategoryFilterInHomePage: Record; // Transaction List Page + quickAddButtonActionInMobileTransactionEditPage: number; itemsCountInTransactionListPage: number; showTotalAmountInTransactionListPage: boolean; showTagInTransactionListPage: boolean; @@ -123,6 +125,7 @@ export const ALL_ALLOWED_CLOUD_SYNC_APP_SETTING_KEY_TYPES: Record = {}; + + public static readonly SaveAndGoBack = new TransactionQuickAddButtonActionType(0, 'Save'); + public static readonly OpenMenu = new TransactionQuickAddButtonActionType(1, 'Open Menu'); + public static readonly SaveAndAddNewTransaction = new TransactionQuickAddButtonActionType(2, 'Save & New'); + public static readonly SaveAndKeepCurrentData = new TransactionQuickAddButtonActionType(3, 'Save & Duplicate'); + + public static readonly Default = TransactionQuickAddButtonActionType.SaveAndGoBack; + + public readonly type: number; + public readonly name: string; + + private constructor(type: number, name: string) { + this.type = type; + this.name = name; + + TransactionQuickAddButtonActionType.allInstances.push(this); + TransactionQuickAddButtonActionType.allInstancesByType[type] = this; + } + + public static values(): TransactionQuickAddButtonActionType[] { + return TransactionQuickAddButtonActionType.allInstances; + } + + public static valueOf(type: number): TransactionQuickAddButtonActionType | undefined { + return TransactionQuickAddButtonActionType.allInstancesByType[type]; + } +} diff --git a/src/locales/de.json b/src/locales/de.json index 6613a75c..aeac5434 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -1495,6 +1495,7 @@ "Remove": "Entfernen", "Delete": "Löschen", "Duplicate": "Duplizieren", + "Open Menu": "Open Menu", "Sort": "Sortieren", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "Konto tauschen", "Swap Amount": "Betrag tauschen", "Swap Account and Amount": "Konto und Betrag tauschen", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "Duplicate (With Time)", "Duplicate (With Geographic Location)": "Duplicate (With Geographic Location)", "Duplicate (With Time and Geographic Location)": "Duplicate (With Time and Geographic Location)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "Monatlichen Gesamtbetrag anzeigen", "Show Transaction Tags": "Transaktions-Tag anzeigen", "Transaction Edit Page": "Transaktionsbearbeitungsseite", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "Entwurf automatisch speichern", "Always Show Confirmation": "Bestätigung jedes mal anzeigen", "Automatically Add Geolocation": "Geolocation automatisch hinzufügen", diff --git a/src/locales/en.json b/src/locales/en.json index de2867da..35dc4f58 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1495,6 +1495,7 @@ "Remove": "Remove", "Delete": "Delete", "Duplicate": "Duplicate", + "Open Menu": "Open Menu", "Sort": "Sort", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "Swap Account", "Swap Amount": "Swap Amount", "Swap Account and Amount": "Swap Account and Amount", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "Duplicate (With Time)", "Duplicate (With Geographic Location)": "Duplicate (With Geographic Location)", "Duplicate (With Time and Geographic Location)": "Duplicate (With Time and Geographic Location)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "Show Monthly Total Amount", "Show Transaction Tags": "Show Transaction Tags", "Transaction Edit Page": "Transaction Edit Page", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "Automatically Save Draft", "Always Show Confirmation": "Always Show Confirmation", "Automatically Add Geolocation": "Automatically Add Geolocation", diff --git a/src/locales/es.json b/src/locales/es.json index ff5e230a..46aa1c08 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -1495,6 +1495,7 @@ "Remove": "Eliminar", "Delete": "Borrar", "Duplicate": "Duplicar", + "Open Menu": "Open Menu", "Sort": "Ordenar", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "Intercambiar Cuenta", "Swap Amount": "Intercambiar Importe", "Swap Account and Amount": "Intercambiar Cuenta e Importe", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "Duplicar (Con Tiempo)", "Duplicate (With Geographic Location)": "Duplicar (con Ubicación Geográfica)", "Duplicate (With Time and Geographic Location)": "Duplicado (con Hora y Ubicación Geográfica)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "Mostrar Importe Total Mensual", "Show Transaction Tags": "Mostrar Etiqueta de Transacción", "Transaction Edit Page": "Página de Edición de Transacciones", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "Guardar Borrador Automáticamente", "Always Show Confirmation": "Mostrar Confirmación Cada Vez", "Automatically Add Geolocation": "Agregar Geolocalización Automáticamente", diff --git a/src/locales/fr.json b/src/locales/fr.json index a18d92c9..fea9a98f 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -1495,6 +1495,7 @@ "Remove": "Supprimer", "Delete": "Supprimer", "Duplicate": "Dupliquer", + "Open Menu": "Open Menu", "Sort": "Trier", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "Échanger le compte", "Swap Amount": "Échanger le montant", "Swap Account and Amount": "Échanger le compte et le montant", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "Dupliquer (avec heure)", "Duplicate (With Geographic Location)": "Dupliquer (avec localisation géographique)", "Duplicate (With Time and Geographic Location)": "Dupliquer (avec heure et localisation géographique)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "Afficher le montant total mensuel", "Show Transaction Tags": "Afficher l'étiquette de transaction", "Transaction Edit Page": "Page de modification de transaction", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "Enregistrer automatiquement le brouillon", "Always Show Confirmation": "Afficher la confirmation à chaque fois", "Automatically Add Geolocation": "Ajouter automatiquement la géolocalisation", diff --git a/src/locales/helpers.ts b/src/locales/helpers.ts index 8f4d5079..7e9f73f9 100644 --- a/src/locales/helpers.ts +++ b/src/locales/helpers.ts @@ -128,7 +128,8 @@ import { } from '@/core/category.ts'; import { - TransactionEditScopeType + TransactionEditScopeType, + TransactionQuickAddButtonActionType } from '@/core/transaction.ts'; import { @@ -2433,6 +2434,7 @@ export function useI18n() { getAllStatisticsDateAggregationTypes: (analysisType: StatisticsAnalysisType) => getLocalizedChartDateAggregationTypeAndDisplayName(analysisType, true), getAllStatisticsDateAggregationTypesWithShortName: (analysisType: StatisticsAnalysisType) => getLocalizedChartDateAggregationTypeAndDisplayName(analysisType, false), getAllTransactionEditScopeTypes: () => getLocalizedDisplayNameAndType(TransactionEditScopeType.values()), + getAllTransactionQuickAddButtonActionTypes: () => getLocalizedDisplayNameAndType(TransactionQuickAddButtonActionType.values()), getAllTransactionScheduledFrequencyTypes: () => getLocalizedDisplayNameAndType(ScheduledTemplateFrequencyType.values()), getAllImportTransactionColumnTypes: () => getLocalizedDisplayNameAndType(ImportTransactionColumnType.values()), getAllTransactionDefaultCategories, diff --git a/src/locales/it.json b/src/locales/it.json index 4f3531bb..d970f41d 100644 --- a/src/locales/it.json +++ b/src/locales/it.json @@ -1495,6 +1495,7 @@ "Remove": "Rimuovi", "Delete": "Elimina", "Duplicate": "Duplica", + "Open Menu": "Open Menu", "Sort": "Ordina", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "Scambia account", "Swap Amount": "Scambia importo", "Swap Account and Amount": "Scambia account e importo", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "Duplica (con ora)", "Duplicate (With Geographic Location)": "Duplica (con posizione geografica)", "Duplicate (With Time and Geographic Location)": "Duplica (con ora e posizione geografica)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "Mostra importo totale mensile", "Show Transaction Tags": "Mostra tag transazione", "Transaction Edit Page": "Pagina modifica transazione", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "Salva automaticamente bozza", "Always Show Confirmation": "Mostra conferma ogni volta", "Automatically Add Geolocation": "Aggiungi automaticamente geolocalizzazione", diff --git a/src/locales/ja.json b/src/locales/ja.json index ad096602..60690650 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -1495,6 +1495,7 @@ "Remove": "削除", "Delete": "削除", "Duplicate": "複製", + "Open Menu": "Open Menu", "Sort": "並べ替え", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "口座のスワップ", "Swap Amount": "金額のスワップ", "Swap Account and Amount": "口座と金額をスワップ", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "複製(時間含む)", "Duplicate (With Geographic Location)": "複製(地理座標を含む)", "Duplicate (With Time and Geographic Location)": "複製(時間と地理座標を含む)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "毎月の合計金額を表示", "Show Transaction Tags": "取引タグを表示", "Transaction Edit Page": "取引編集ページ", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "下書きの自動保存", "Always Show Confirmation": "確認を毎回表示", "Automatically Add Geolocation": "座標を自動的に追加", diff --git a/src/locales/kn.json b/src/locales/kn.json index 5fac012f..df3f2fa7 100644 --- a/src/locales/kn.json +++ b/src/locales/kn.json @@ -1495,6 +1495,7 @@ "Remove": "ತೆಗೆದುಹಾಕು", "Delete": "ಅಳಿಸು", "Duplicate": "ನಕಲು ಮಾಡು", + "Open Menu": "Open Menu", "Sort": "ವಿಂಗಡಿಸು", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "ಖಾತೆ ಬದಲಾಯಿಸಿ", "Swap Amount": "ಮೊತ್ತ ಬದಲಾಯಿಸಿ", "Swap Account and Amount": "ಖಾತೆ ಮತ್ತು ಮೊತ್ತ ಬದಲಾಯಿಸಿ", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "ನಕಲು (ಸಮಯ ಸಹಿತ)", "Duplicate (With Geographic Location)": "ನಕಲು (ಭೌಗೋಳಿಕ ಸ್ಥಳ ಸಹಿತ)", "Duplicate (With Time and Geographic Location)": "ನಕಲು (ಸಮಯ ಮತ್ತು ಭೌಗೋಳಿಕ ಸ್ಥಳ ಸಹಿತ)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "ಮಾಸಿಕ ಒಟ್ಟು ಮೊತ್ತ ತೋರಿಸಿ", "Show Transaction Tags": "ವಹಿವಾಟು ಟ್ಯಾಗ್ ತೋರಿಸಿ", "Transaction Edit Page": "ವಹಿವಾಟು ಸಂಪಾದನೆ ಪುಟ", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "ಕರಡು ಸ್ವಯಂ ಉಳಿಸಿ", "Always Show Confirmation": "ಪ್ರತಿ ಬಾರಿ ದೃಢೀಕರಣ ತೋರಿಸಿ", "Automatically Add Geolocation": "ಭೌಗೋಳಿಕ ಸ್ಥಾನವನ್ನು ಸ್ವಯಂ ಸೇರಿಸಿ", diff --git a/src/locales/ko.json b/src/locales/ko.json index 50e9c875..5676c542 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -1495,6 +1495,7 @@ "Remove": "제거", "Delete": "삭제", "Duplicate": "복제", + "Open Menu": "Open Menu", "Sort": "정렬", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "계좌 교체", "Swap Amount": "금액 교체", "Swap Account and Amount": "계좌 및 금액 교체", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "복제 (시간 포함)", "Duplicate (With Geographic Location)": "복제 (위치 포함)", "Duplicate (With Time and Geographic Location)": "복제 (시간 및 위치 포함)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "월별 총 금액 표시", "Show Transaction Tags": "거래 태그 표시", "Transaction Edit Page": "거래 편집 페이지", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "초안 자동 저장", "Always Show Confirmation": "매번 확인 표시", "Automatically Add Geolocation": "지리적 위치 자동 추가", diff --git a/src/locales/nl.json b/src/locales/nl.json index 3d7f2c1d..3fa81c75 100644 --- a/src/locales/nl.json +++ b/src/locales/nl.json @@ -1495,6 +1495,7 @@ "Remove": "Verwijderen", "Delete": "Verwijderen", "Duplicate": "Dupliceren", + "Open Menu": "Open Menu", "Sort": "Sorteren", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "Rekening omwisselen", "Swap Amount": "Bedrag omwisselen", "Swap Account and Amount": "Rekening en bedrag omwisselen", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "Dupliceren (met tijd)", "Duplicate (With Geographic Location)": "Dupliceren (met geografische locatie)", "Duplicate (With Time and Geographic Location)": "Dupliceren (met tijd en locatie)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "Maandelijks totaalbedrag tonen", "Show Transaction Tags": "Transactietag tonen", "Transaction Edit Page": "Transactiebewerkingspagina", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "Concept automatisch opslaan", "Always Show Confirmation": "Elke keer bevestiging tonen", "Automatically Add Geolocation": "Geolocatie automatisch toevoegen", diff --git a/src/locales/pt_BR.json b/src/locales/pt_BR.json index 136b3414..7b58b17c 100644 --- a/src/locales/pt_BR.json +++ b/src/locales/pt_BR.json @@ -1495,6 +1495,7 @@ "Remove": "Remover", "Delete": "Excluir", "Duplicate": "Duplicar", + "Open Menu": "Open Menu", "Sort": "Classificar", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "Trocar Conta", "Swap Amount": "Trocar Quantia", "Swap Account and Amount": "Trocar Conta e Quantia", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "Duplicar (Com Tempo)", "Duplicate (With Geographic Location)": "Duplicar (Com Localização Geográfica)", "Duplicate (With Time and Geographic Location)": "Duplicar (Com Tempo e Localização Geográfica)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "Mostrar Valor Total Mensal", "Show Transaction Tags": "Mostrar Tag da Transação", "Transaction Edit Page": "Página de Edição de Transação", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "Salvar Rascunho Automaticamente", "Always Show Confirmation": "Mostrar Confirmação Toda Vez", "Automatically Add Geolocation": "Adicionar Geolocalização Automaticamente", diff --git a/src/locales/ru.json b/src/locales/ru.json index 01b9ba5e..6f6a1e4a 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -1495,6 +1495,7 @@ "Remove": "Удалить", "Delete": "Удалить", "Duplicate": "Дублировать", + "Open Menu": "Open Menu", "Sort": "Сортировать", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "Поменять счет", "Swap Amount": "Поменять сумму", "Swap Account and Amount": "Поменять счет и сумму", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "Дублировать (со временем)", "Duplicate (With Geographic Location)": "Дублировать (с местом положения)", "Duplicate (With Time and Geographic Location)": "Дублировать (со временем и местом положения)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "Показать общую сумму за месяц", "Show Transaction Tags": "Показать тег транзакции", "Transaction Edit Page": "Страница редактирования транзакции", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "Автоматически сохранять черновик", "Always Show Confirmation": "Показывать подтверждение каждый раз", "Automatically Add Geolocation": "Автоматически добавлять геолокацию", diff --git a/src/locales/sl.json b/src/locales/sl.json index 0ccde5da..32187b85 100644 --- a/src/locales/sl.json +++ b/src/locales/sl.json @@ -1495,6 +1495,7 @@ "Remove": "Odstrani", "Delete": "Izbriši", "Duplicate": "Podvoji", + "Open Menu": "Open Menu", "Sort": "Razvrsti", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "Zamenjaj račun", "Swap Amount": "Zamenjaj znesek", "Swap Account and Amount": "Zamenjaj račun in znesek", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "Podvoji (s časom)", "Duplicate (With Geographic Location)": "Podvoji (z geografsko lokacijo)", "Duplicate (With Time and Geographic Location)": "Podvoji (s časom in geografsko lokacijo)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "Prikaži mesečni skupni znesek", "Show Transaction Tags": "Prikaži oznako transakcije", "Transaction Edit Page": "Stran za urejanje transakcij", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "Samodejno shrani osnutek", "Always Show Confirmation": "Vsakič prikaži potrditev", "Automatically Add Geolocation": "Samodejno dodaj geolokacijo", diff --git a/src/locales/ta.json b/src/locales/ta.json index 3fd3af85..0055e503 100644 --- a/src/locales/ta.json +++ b/src/locales/ta.json @@ -1495,6 +1495,7 @@ "Remove": "அகற்று", "Delete": "நீக்கு", "Duplicate": "நகலெடு", + "Open Menu": "Open Menu", "Sort": "வரிசைப்படுத்து", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "கணக்கு மாற்று", "Swap Amount": "தொகை மாற்று", "Swap Account and Amount": "கணக்கு மற்றும் தொகை மாற்று", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "நகலெடு (நேரம் உடன்)", "Duplicate (With Geographic Location)": "நகலெடு (புவியியல் இருப்பிடம் உடன்)", "Duplicate (With Time and Geographic Location)": "நகலெடு (நேரம் மற்றும் புவியியல் இருப்பிடம் உடன்)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "மாதாந்திர மொத்தம் தொகை காட்டு", "Show Transaction Tags": "பரிவர்த்தனை குறிச்சொல் காட்டு", "Transaction Edit Page": "பரிவர்த்தனை திருத்தம் பக்கம்", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "வரைவு தானியங்கி சேமி", "Always Show Confirmation": "ஒவ்வொரு முறை அங்கீகாரம் காட்டு", "Automatically Add Geolocation": "புவியியல் நிலையை தானியங்கி சேர்", diff --git a/src/locales/th.json b/src/locales/th.json index 171b669c..e9cd8e5d 100644 --- a/src/locales/th.json +++ b/src/locales/th.json @@ -1495,6 +1495,7 @@ "Remove": "เอาออก", "Delete": "ลบ", "Duplicate": "ทำสำเนา", + "Open Menu": "Open Menu", "Sort": "จัดเรียง", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "สลับบัญชี", "Swap Amount": "สลับจำนวน", "Swap Account and Amount": "สลับบัญชีและจำนวน", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "ทำสำเนา (พร้อมเวลา)", "Duplicate (With Geographic Location)": "ทำสำเนา (พร้อมตำแหน่งที่ตั้ง)", "Duplicate (With Time and Geographic Location)": "ทำสำเนา (พร้อมเวลาและตำแหน่งที่ตั้ง)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "แสดงจำนวนเงินรวมรายเดือน", "Show Transaction Tags": "แสดงแท็กรายการ", "Transaction Edit Page": "หน้าการแก้ไขรายการ", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "บันทึกร่างอัตโนมัติ", "Always Show Confirmation": "แสดงการยืนยันทุกครั้ง", "Automatically Add Geolocation": "เพิ่มตำแหน่งทางภูมิศาสตร์อัตโนมัติ", diff --git a/src/locales/tr.json b/src/locales/tr.json index 3a9e5f02..d1759e1b 100644 --- a/src/locales/tr.json +++ b/src/locales/tr.json @@ -1495,6 +1495,7 @@ "Remove": "Kaldır", "Delete": "Sil", "Duplicate": "Çoğalt", + "Open Menu": "Open Menu", "Sort": "Sırala", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "Hesabı Değiştir", "Swap Amount": "Tutarı Değiştir", "Swap Account and Amount": "Hesabı ve Tutarı Değiştir", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "Çoğalt (Zaman ile)", "Duplicate (With Geographic Location)": "Çoğalt (Coğrafi Konum ile)", "Duplicate (With Time and Geographic Location)": "Çoğalt (Zaman ve Coğrafi Konum ile)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "Aylık Toplam Tutarı Göster", "Show Transaction Tags": "İşlem Etiketini Göster", "Transaction Edit Page": "İşlem Düzenleme Sayfası", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "Taslağı Otomatik Kaydet", "Always Show Confirmation": "Her Seferinde Onay Göster", "Automatically Add Geolocation": "Otomatik Olarak Konum Ekle", diff --git a/src/locales/uk.json b/src/locales/uk.json index 8ebf85a3..f1f9e3cd 100644 --- a/src/locales/uk.json +++ b/src/locales/uk.json @@ -1495,6 +1495,7 @@ "Remove": "Видалити", "Delete": "Видалити", "Duplicate": "Дублювати", + "Open Menu": "Open Menu", "Sort": "Сортувати", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "Поміняти рахунки", "Swap Amount": "Поміняти суми", "Swap Account and Amount": "Поміняти рахунки та суми", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "Дублювати (з часом)", "Duplicate (With Geographic Location)": "Дублювати (з геолокацією)", "Duplicate (With Time and Geographic Location)": "Дублювати (з часом і геолокацією)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "Показати місячну загальну суму", "Show Transaction Tags": "Показати тег транзакції", "Transaction Edit Page": "Сторінка редагування транзакції", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "Автоматично зберігати чернетку", "Always Show Confirmation": "Показувати підтвердження щоразу", "Automatically Add Geolocation": "Автоматично додавати геолокацію", diff --git a/src/locales/vi.json b/src/locales/vi.json index 2a42d31a..41f5f3d4 100644 --- a/src/locales/vi.json +++ b/src/locales/vi.json @@ -1495,6 +1495,7 @@ "Remove": "Xóa", "Delete": "Xóa", "Duplicate": "Nhân đôi", + "Open Menu": "Open Menu", "Sort": "Sắp xếp", "Sort by Name (A to Z)": "Sort by Name (A to Z)", "Sort by Name (Z to A)": "Sort by Name (Z to A)", @@ -1901,6 +1902,8 @@ "Swap Account": "Hoán đổi tài khoản", "Swap Amount": "Hoán đổi số tiền", "Swap Account and Amount": "Hoán đổi tài khoản và số tiền", + "Save & New": "Save & New", + "Save & Duplicate": "Save & Duplicate", "Duplicate (With Time)": "Duplicate (With Time)", "Duplicate (With Geographic Location)": "Duplicate (With Geographic Location)", "Duplicate (With Time and Geographic Location)": "Duplicate (With Time and Geographic Location)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "Hiển thị tổng số tiền hàng tháng", "Show Transaction Tags": "Hiển thị thẻ giao dịch", "Transaction Edit Page": "Trang chỉnh sửa giao dịch", + "Quick Add Button Action": "Quick Add Button Action", "Automatically Save Draft": "Tự động lưu bản nháp", "Always Show Confirmation": "Hiển thị xác nhận mỗi lần", "Automatically Add Geolocation": "Tự động thêm vị trí địa lý", diff --git a/src/locales/zh_Hans.json b/src/locales/zh_Hans.json index 398132a4..37124153 100644 --- a/src/locales/zh_Hans.json +++ b/src/locales/zh_Hans.json @@ -1495,6 +1495,7 @@ "Remove": "移除", "Delete": "删除", "Duplicate": "复制", + "Open Menu": "打开菜单", "Sort": "排序", "Sort by Name (A to Z)": "按名称排序(正序)", "Sort by Name (Z to A)": "按名称排序(倒序)", @@ -1901,6 +1902,8 @@ "Swap Account": "交换账户", "Swap Amount": "交换金额", "Swap Account and Amount": "交换账户和金额", + "Save & New": "保存并新建", + "Save & Duplicate": "保存并复制", "Duplicate (With Time)": "复制 (含时间)", "Duplicate (With Geographic Location)": "复制 (含地理位置)", "Duplicate (With Time and Geographic Location)": "复制 (含时间和地理位置)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "显示月度总金额", "Show Transaction Tags": "显示交易标签", "Transaction Edit Page": "交易编辑页面", + "Quick Add Button Action": "快速添加按钮操作", "Automatically Save Draft": "自动保存草稿", "Always Show Confirmation": "每次提示确认", "Automatically Add Geolocation": "自动添加地理位置", diff --git a/src/locales/zh_Hant.json b/src/locales/zh_Hant.json index d7eb4385..1deb7a3c 100644 --- a/src/locales/zh_Hant.json +++ b/src/locales/zh_Hant.json @@ -1495,6 +1495,7 @@ "Remove": "移除", "Delete": "刪除", "Duplicate": "複製", + "Open Menu": "打開選單", "Sort": "排序", "Sort by Name (A to Z)": "依名稱排序(正序)", "Sort by Name (Z to A)": "依名稱排序(倒序)", @@ -1901,6 +1902,8 @@ "Swap Account": "交換帳戶", "Swap Amount": "交換金額", "Swap Account and Amount": "交換帳戶和金額", + "Save & New": "儲存並新增", + "Save & Duplicate": "儲存并複製", "Duplicate (With Time)": "複製 (含時間)", "Duplicate (With Geographic Location)": "複製 (含地理位置)", "Duplicate (With Time and Geographic Location)": "複製 (含時間和地理位置)", @@ -2231,6 +2234,7 @@ "Show Monthly Total Amount": "顯示月度總金額", "Show Transaction Tags": "顯示交易標籤", "Transaction Edit Page": "交易編輯頁面", + "Quick Add Button Action": "快速新增按鈕動作", "Automatically Save Draft": "自動儲存草稿", "Always Show Confirmation": "每次提示確認", "Automatically Add Geolocation": "自動新增地理位置", diff --git a/src/stores/setting.ts b/src/stores/setting.ts index 069952a6..94aa5707 100644 --- a/src/stores/setting.ts +++ b/src/stores/setting.ts @@ -234,6 +234,12 @@ export const useSettingsStore = defineStore('settings', () => { } // Transaction Edit Page + function setQuickAddButtonActionInMobileTransactionEditPage(value: number): void { + updateApplicationSettingsValue('quickAddButtonActionInMobileTransactionEditPage', value); + appSettings.value.quickAddButtonActionInMobileTransactionEditPage = value; + updateUserApplicationCloudSettingValue('quickAddButtonActionInMobileTransactionEditPage', value); + } + function setAutoSaveTransactionDraft(value: string): void { updateApplicationSettingsValue('autoSaveTransactionDraft', value); appSettings.value.autoSaveTransactionDraft = value; @@ -531,6 +537,7 @@ export const useSettingsStore = defineStore('settings', () => { setShowTotalAmountInTransactionListPage, setShowTagInTransactionListPage, // -- Transaction Edit Page + setQuickAddButtonActionInMobileTransactionEditPage, setAutoSaveTransactionDraft, setAutoGetCurrentGeoLocation, setAlwaysShowTransactionPicturesInMobileTransactionEditPage, diff --git a/src/views/base/settings/AppCloudSyncPageBase.ts b/src/views/base/settings/AppCloudSyncPageBase.ts index 4c586310..ce4771f0 100644 --- a/src/views/base/settings/AppCloudSyncPageBase.ts +++ b/src/views/base/settings/AppCloudSyncPageBase.ts @@ -53,6 +53,7 @@ export const ALL_APPLICATION_CLOUD_SETTINGS: CategorizedApplicationCloudSettingI { categoryName: 'Transaction Edit Page', items: [ + { settingKey: 'quickAddButtonActionInMobileTransactionEditPage', settingName: 'Quick Add Button Action', mobile: true, desktop: false }, { settingKey: 'autoSaveTransactionDraft', settingName: 'Automatically Save Draft', mobile: true, desktop: true }, { settingKey: 'autoGetCurrentGeoLocation', settingName: 'Automatically Add Geolocation', mobile: true, desktop: true }, { settingKey: 'alwaysShowTransactionPicturesInMobileTransactionEditPage', settingName: 'Always Show Transaction Pictures', mobile: true, desktop: false } diff --git a/src/views/base/transactions/TransactionEditPageBase.ts b/src/views/base/transactions/TransactionEditPageBase.ts index fa291c7a..8938a117 100644 --- a/src/views/base/transactions/TransactionEditPageBase.ts +++ b/src/views/base/transactions/TransactionEditPageBase.ts @@ -13,7 +13,7 @@ import { useExchangeRatesStore } from '@/stores/exchangeRates.ts'; import type { NumeralSystem } from '@/core/numeral.ts'; import type { WeekDayValue } from '@/core/datetime.ts'; import type { LocalizedTimezoneInfo } from '@/core/timezone.ts'; -import { TransactionType } from '@/core/transaction.ts'; +import { TransactionType, TransactionQuickAddButtonActionType } from '@/core/transaction.ts'; import { TemplateType } from '@/core/template.ts'; import { DISPLAY_HIDDEN_AMOUNT } from '@/consts/numeral.ts'; import { TRANSACTION_MAX_PICTURE_COUNT } from '@/consts/transaction.ts'; @@ -64,6 +64,12 @@ export enum GeoLocationStatus { Error = 'error' } +export enum AfterSaveAction { + GoBack = 'goBack', + StayWithNewTransaction = 'stayWithNewTransaction', + StayWithCurrentTransaction = 'stayWithCurrentTransaction' +} + export function useTransactionEditPageBase(type: TransactionEditPageType, initMode?: TransactionEditPageMode, transactionDefaultType?: number) { const { tt, @@ -93,6 +99,7 @@ export function useTransactionEditPageBase(type: TransactionEditPageType, initMo const clientSessionId = ref(''); const loading = ref(true); const submitting = ref(false); + const submitted = ref(false); const uploadingPicture = ref(false); const geoLocationStatus = ref(null); const setGeoLocationByClickMap = ref(false); @@ -170,6 +177,20 @@ export function useTransactionEditPageBase(type: TransactionEditPageType, initMo } }); + const quickSaveButtonTitle = computed(() => { + if (mode.value === TransactionEditPageMode.Add) { + const quickAddActionType = TransactionQuickAddButtonActionType.valueOf(settingsStore.appSettings.quickAddButtonActionInMobileTransactionEditPage); + + if (quickAddActionType && quickAddActionType.type !== TransactionQuickAddButtonActionType.OpenMenu.type) { + return quickAddActionType.name; + } else { + return 'Add'; + } + } else { + return 'Save'; + } + }); + const cancelButtonTitle = computed(() => { if (mode.value === TransactionEditPageMode.View) { return 'Close'; @@ -395,6 +416,16 @@ export function useTransactionEditPageBase(type: TransactionEditPageType, initMo ); } + function updateTransactionModelByAfterSaveAction(afterSaveAction: AfterSaveAction, initOptions?: SetTransactionOptions): void { + if (afterSaveAction === AfterSaveAction.StayWithNewTransaction) { + transaction.value = createNewTransactionModel(transactionDefaultType); + setTransactionModel(null, initOptions, true); + geoLocationStatus.value = null; + } else if (afterSaveAction === AfterSaveAction.StayWithCurrentTransaction) { + transaction.value.clearPictures(); + } + } + function updateTransactionTime(newTime: number): void { transaction.value.time = newTime; updateTransactionTimezone(transaction.value.timeZone ?? ''); @@ -489,6 +520,7 @@ export function useTransactionEditPageBase(type: TransactionEditPageType, initMo clientSessionId, loading, submitting, + submitted, uploadingPicture, geoLocationStatus, setGeoLocationByClickMap, @@ -516,6 +548,7 @@ export function useTransactionEditPageBase(type: TransactionEditPageType, initMo canAddTransactionPicture, title, saveButtonTitle, + quickSaveButtonTitle, cancelButtonTitle, sourceAmountName, sourceAmountTitle, @@ -533,6 +566,7 @@ export function useTransactionEditPageBase(type: TransactionEditPageType, initMo // functions createNewTransactionModel, setTransactionModel, + updateTransactionModelByAfterSaveAction, updateTransactionTime, updateTransactionTimezone, swapTransactionData, diff --git a/src/views/desktop/transactions/list/dialogs/EditDialog.vue b/src/views/desktop/transactions/list/dialogs/EditDialog.vue index 3d7a53c4..5876b26a 100644 --- a/src/views/desktop/transactions/list/dialogs/EditDialog.vue +++ b/src/views/desktop/transactions/list/dialogs/EditDialog.vue @@ -414,11 +414,25 @@ @@ -474,6 +488,7 @@ import { TransactionEditPageMode, TransactionEditPageType, GeoLocationStatus, + AfterSaveAction, useTransactionEditPageBase } from '@/views/base/transactions/TransactionEditPageBase.ts'; @@ -487,7 +502,7 @@ import { useTransactionTemplatesStore } from '@/stores/transactionTemplate.ts'; import type { Coordinate } from '@/core/coordinate.ts'; import { CategoryType } from '@/core/category.ts'; -import { TransactionType, TransactionEditScopeType } from '@/core/transaction.ts'; +import { TransactionType, TransactionEditScopeType, TransactionQuickAddButtonActionType } from '@/core/transaction.ts'; import { TemplateType, ScheduledTemplateFrequencyType } from '@/core/template.ts'; import { KnownErrorCode } from '@/consts/api.ts'; import { SUPPORTED_IMAGE_EXTENSIONS } from '@/consts/file.ts'; @@ -563,6 +578,7 @@ const { clientSessionId, loading, submitting, + submitted, uploadingPicture, geoLocationStatus, setGeoLocationByClickMap, @@ -596,6 +612,7 @@ const { inputIsEmpty, createNewTransactionModel, setTransactionModel, + updateTransactionModelByAfterSaveAction, updateTransactionTime, updateTransactionTimezone, swapTransactionData, @@ -656,6 +673,7 @@ function open(options: TransactionEditOptions): Promise { submitting.value = false; - - if (resolveFunc) { - if (mode.value === TransactionEditPageMode.Add) { - resolveFunc({ - message: 'You have added a new transaction' - }); - } else if (mode.value === TransactionEditPageMode.Edit) { - resolveFunc({ - message: 'You have saved this transaction' - }); - } - } + submitted.value = true; if (mode.value === TransactionEditPageMode.Add && !noTransactionDraft.value && !addByTemplateId.value && !duplicateFromId.value) { transactionsStore.clearTransactionDraft(); } - showState.value = false; + if (mode.value === TransactionEditPageMode.Add && (afterAction === AfterSaveAction.StayWithNewTransaction || afterAction === AfterSaveAction.StayWithCurrentTransaction)) { + snackbar.value?.showMessage('You have added a new transaction'); + updateTransactionModelByAfterSaveAction(afterAction, initOptions.value); + clientSessionId.value = generateRandomUUID(); + } else { + if (resolveFunc) { + if (mode.value === TransactionEditPageMode.Add) { + resolveFunc({ + message: 'You have added a new transaction' + }); + } else if (mode.value === TransactionEditPageMode.Edit) { + resolveFunc({ + message: 'You have saved this transaction' + }); + } + } + + showState.value = false; + } }).catch(error => { submitting.value = false; @@ -903,6 +928,7 @@ function duplicate(withTime?: boolean, withGeoLocation?: boolean): void { editId.value = null; duplicateFromId.value = transaction.value.id; clientSessionId.value = generateRandomUUID(); + submitted.value = false; activeTab.value = 'basicInfo'; transaction.value.id = ''; @@ -958,7 +984,11 @@ function remove(): void { function cancel(): void { const doClose = function () { - if (rejectFunc) { + if (props.type === TransactionEditPageType.Transaction && mode.value === TransactionEditPageMode.Add && submitted.value && resolveFunc) { + resolveFunc({ + message: 'You have added a new transaction' + }); + } else if (rejectFunc) { rejectFunc(); } diff --git a/src/views/mobile/settings/PageSettingsPage.vue b/src/views/mobile/settings/PageSettingsPage.vue index a3485a34..7ce56d0b 100644 --- a/src/views/mobile/settings/PageSettingsPage.vue +++ b/src/views/mobile/settings/PageSettingsPage.vue @@ -71,7 +71,7 @@ {{ tt('Transaction List Page') }} - +