support pasting amount from clipboard on mobile version
This commit is contained in:
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "Überweisungsbetrag (Eingang)",
|
||||
"Transfer In Account Name": "Transfer In Account Name",
|
||||
"Transfer In Currency": "Transfer In Currency",
|
||||
"Paste Amount": "Paste Amount",
|
||||
"Paste Destination Amount": "Paste Destination Amount",
|
||||
"Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
|
||||
"Unable to read clipboard text": "Unable to read clipboard text",
|
||||
"Show Amount": "Betrag anzeigen",
|
||||
"Hide Amount": "Betrag verbergen",
|
||||
"Swap Account": "Konto tauschen",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "Transfer In Amount",
|
||||
"Transfer In Account Name": "Transfer In Account Name",
|
||||
"Transfer In Currency": "Transfer In Currency",
|
||||
"Paste Amount": "Paste Amount",
|
||||
"Paste Destination Amount": "Paste Destination Amount",
|
||||
"Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
|
||||
"Unable to read clipboard text": "Unable to read clipboard text",
|
||||
"Show Amount": "Show Amount",
|
||||
"Hide Amount": "Hide Amount",
|
||||
"Swap Account": "Swap Account",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "Importe de transferencias recibidas",
|
||||
"Transfer In Account Name": "Transfer In Account Name",
|
||||
"Transfer In Currency": "Transfer In Currency",
|
||||
"Paste Amount": "Paste Amount",
|
||||
"Paste Destination Amount": "Paste Destination Amount",
|
||||
"Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
|
||||
"Unable to read clipboard text": "Unable to read clipboard text",
|
||||
"Show Amount": "Mostrar importe",
|
||||
"Hide Amount": "Ocultar importe",
|
||||
"Swap Account": "Intercambiar cuenta",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "Montant de virement entrant",
|
||||
"Transfer In Account Name": "Nom du compte de virement entrant",
|
||||
"Transfer In Currency": "Devise de virement entrant",
|
||||
"Paste Amount": "Paste Amount",
|
||||
"Paste Destination Amount": "Paste Destination Amount",
|
||||
"Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
|
||||
"Unable to read clipboard text": "Unable to read clipboard text",
|
||||
"Show Amount": "Afficher le montant",
|
||||
"Hide Amount": "Masquer le montant",
|
||||
"Swap Account": "Échanger le compte",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "Importo trasferimento in entrata",
|
||||
"Transfer In Account Name": "Nome account trasferimento in entrata",
|
||||
"Transfer In Currency": "Valuta trasferimento in entrata",
|
||||
"Paste Amount": "Paste Amount",
|
||||
"Paste Destination Amount": "Paste Destination Amount",
|
||||
"Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
|
||||
"Unable to read clipboard text": "Unable to read clipboard text",
|
||||
"Show Amount": "Mostra importo",
|
||||
"Hide Amount": "Nascondi importo",
|
||||
"Swap Account": "Scambia account",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "振込金額",
|
||||
"Transfer In Account Name": "振替口座名",
|
||||
"Transfer In Currency": "振替通貨",
|
||||
"Paste Amount": "Paste Amount",
|
||||
"Paste Destination Amount": "Paste Destination Amount",
|
||||
"Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
|
||||
"Unable to read clipboard text": "Unable to read clipboard text",
|
||||
"Show Amount": "金額を表示",
|
||||
"Hide Amount": "金額を非表示",
|
||||
"Swap Account": "口座のスワップ",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "이체 입금 금액",
|
||||
"Transfer In Account Name": "이체 입금 계좌명",
|
||||
"Transfer In Currency": "이체 입금 통화",
|
||||
"Paste Amount": "Paste Amount",
|
||||
"Paste Destination Amount": "Paste Destination Amount",
|
||||
"Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
|
||||
"Unable to read clipboard text": "Unable to read clipboard text",
|
||||
"Show Amount": "금액 표시",
|
||||
"Hide Amount": "금액 숨기기",
|
||||
"Swap Account": "계좌 교체",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "Inkomend bedrag",
|
||||
"Transfer In Account Name": "Naam inkomende rekening",
|
||||
"Transfer In Currency": "Valuta inkomende rekening",
|
||||
"Paste Amount": "Paste Amount",
|
||||
"Paste Destination Amount": "Paste Destination Amount",
|
||||
"Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
|
||||
"Unable to read clipboard text": "Unable to read clipboard text",
|
||||
"Show Amount": "Bedrag tonen",
|
||||
"Hide Amount": "Bedrag verbergen",
|
||||
"Swap Account": "Rekening omwisselen",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "Valor da Transferência Entrada",
|
||||
"Transfer In Account Name": "Nome da Conta de Transferência Entrada",
|
||||
"Transfer In Currency": "Moeda da Transferência Entrada",
|
||||
"Paste Amount": "Paste Amount",
|
||||
"Paste Destination Amount": "Paste Destination Amount",
|
||||
"Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
|
||||
"Unable to read clipboard text": "Unable to read clipboard text",
|
||||
"Show Amount": "Mostrar Valor",
|
||||
"Hide Amount": "Ocultar Quantia",
|
||||
"Swap Account": "Trocar Conta",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "Сумма перевода (входящий)",
|
||||
"Transfer In Account Name": "Transfer In Account Name",
|
||||
"Transfer In Currency": "Transfer In Currency",
|
||||
"Paste Amount": "Paste Amount",
|
||||
"Paste Destination Amount": "Paste Destination Amount",
|
||||
"Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
|
||||
"Unable to read clipboard text": "Unable to read clipboard text",
|
||||
"Show Amount": "Показать сумму",
|
||||
"Hide Amount": "Скрыть сумму",
|
||||
"Swap Account": "Поменять счет",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "จำนวนโอนเข้า",
|
||||
"Transfer In Account Name": "ชื่อบัญชีรับโอน",
|
||||
"Transfer In Currency": "สกุลเงินรับโอน",
|
||||
"Paste Amount": "Paste Amount",
|
||||
"Paste Destination Amount": "Paste Destination Amount",
|
||||
"Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
|
||||
"Unable to read clipboard text": "Unable to read clipboard text",
|
||||
"Show Amount": "แสดงจำนวน",
|
||||
"Hide Amount": "ซ่อนจำนวน",
|
||||
"Swap Account": "สลับบัญชี",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "Сума переказу (вхідна)",
|
||||
"Transfer In Account Name": "Назва рахунку для вхідного переказу",
|
||||
"Transfer In Currency": "Валюта вхідного переказу",
|
||||
"Paste Amount": "Paste Amount",
|
||||
"Paste Destination Amount": "Paste Destination Amount",
|
||||
"Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
|
||||
"Unable to read clipboard text": "Unable to read clipboard text",
|
||||
"Show Amount": "Показати суму",
|
||||
"Hide Amount": "Сховати суму",
|
||||
"Swap Account": "Поміняти рахунки",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "Số tiền chuyển vào",
|
||||
"Transfer In Account Name": "Transfer In Account Name",
|
||||
"Transfer In Currency": "Transfer In Currency",
|
||||
"Paste Amount": "Paste Amount",
|
||||
"Paste Destination Amount": "Paste Destination Amount",
|
||||
"Cannot parse amount from clipboard": "Cannot parse amount from clipboard",
|
||||
"Unable to read clipboard text": "Unable to read clipboard text",
|
||||
"Show Amount": "Hiển thị số tiền",
|
||||
"Hide Amount": "Ẩn số tiền",
|
||||
"Swap Account": "Hoán đổi tài khoản",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "转入金额",
|
||||
"Transfer In Account Name": "转入账户名",
|
||||
"Transfer In Currency": "转入货币",
|
||||
"Paste Amount": "粘贴金额",
|
||||
"Paste Destination Amount": "粘贴目标金额",
|
||||
"Cannot parse amount from clipboard": "无法从剪贴板解析金额",
|
||||
"Unable to read clipboard text": "无法读取剪贴板文本",
|
||||
"Show Amount": "显示金额",
|
||||
"Hide Amount": "隐藏金额",
|
||||
"Swap Account": "交换账户",
|
||||
|
||||
@@ -1769,6 +1769,10 @@
|
||||
"Transfer In Amount": "轉入金額",
|
||||
"Transfer In Account Name": "轉入帳戶名稱",
|
||||
"Transfer In Currency": "轉入貨幣",
|
||||
"Paste Amount": "貼上金額",
|
||||
"Paste Destination Amount": "貼上目標金額",
|
||||
"Cannot parse amount from clipboard": "無法從剪貼簿解析金額",
|
||||
"Unable to read clipboard text": "無法讀取剪貼簿文字",
|
||||
"Show Amount": "顯示金額",
|
||||
"Hide Amount": "隱藏金額",
|
||||
"Swap Account": "交換帳戶",
|
||||
|
||||
@@ -447,6 +447,8 @@
|
||||
<f7-actions-button @click="swapTransactionData(true, true)">{{ tt('Swap Account and Amount') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
<f7-actions-group v-if="mode !== TransactionEditPageMode.View">
|
||||
<f7-actions-button v-if="isSupportClipboard" @click="pasteAmount('sourceAmount')">{{ tt('Paste Amount') }}</f7-actions-button>
|
||||
<f7-actions-button v-if="isSupportClipboard && transaction.type === TransactionType.Transfer" @click="pasteAmount('destinationAmount')">{{ tt('Paste Destination Amount') }}</f7-actions-button>
|
||||
<f7-actions-button v-if="transaction.hideAmount" @click="transaction.hideAmount = false">{{ tt('Show Amount') }}</f7-actions-button>
|
||||
<f7-actions-button v-if="!transaction.hideAmount" @click="transaction.hideAmount = true">{{ tt('Hide Amount') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
@@ -537,7 +539,8 @@ const {
|
||||
getMultiWeekdayLongNames,
|
||||
formatUnixTimeToLongDate,
|
||||
formatUnixTimeToLongTime,
|
||||
formatGregorianTextualYearMonthDayToLongDate
|
||||
formatGregorianTextualYearMonthDayToLongDate,
|
||||
parseAmountFromLocalizedNumerals
|
||||
} = useI18n();
|
||||
const { showAlert, showConfirm, showToast, routeBackOnError } = useI18nUIComponents();
|
||||
|
||||
@@ -604,6 +607,8 @@ const transactionTemplatesStore = useTransactionTemplatesStore();
|
||||
const pictureBrowser = useTemplateRef<PhotoBrowser.PhotoBrowser>('pictureBrowser');
|
||||
const pictureInput = useTemplateRef<HTMLInputElement>('pictureInput');
|
||||
|
||||
const isSupportClipboard = !!navigator.clipboard;
|
||||
|
||||
const loadingError = ref<unknown | null>(null);
|
||||
const submitted = ref<boolean>(false);
|
||||
const removingPictureId = ref<string | null>(null);
|
||||
@@ -1095,6 +1100,39 @@ function save(): void {
|
||||
}
|
||||
}
|
||||
|
||||
function pasteAmount(type: 'sourceAmount' | 'destinationAmount'): void {
|
||||
if (mode.value === TransactionEditPageMode.View || !isSupportClipboard) {
|
||||
return;
|
||||
}
|
||||
|
||||
navigator.clipboard.readText().then(text => {
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
|
||||
const parsedAmount = parseAmountFromLocalizedNumerals(text);
|
||||
|
||||
if (Number.isNaN(parsedAmount) || !Number.isFinite(parsedAmount)) {
|
||||
showToast('Cannot parse amount from clipboard');
|
||||
return;
|
||||
}
|
||||
|
||||
if (parsedAmount < TRANSACTION_MIN_AMOUNT || parsedAmount > TRANSACTION_MAX_AMOUNT) {
|
||||
showToast('Numeric Overflow');
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === 'sourceAmount') {
|
||||
transaction.value.sourceAmount = parsedAmount;
|
||||
} else if (type === 'destinationAmount') {
|
||||
transaction.value.destinationAmount = parsedAmount;
|
||||
}
|
||||
}).catch(error => {
|
||||
logger.error('failed to read clipboard text', error);
|
||||
showToast('Unable to read clipboard text');
|
||||
});
|
||||
}
|
||||
|
||||
function updateGeoLocation(forceUpdate: boolean): void {
|
||||
if (!isSupportGeoLocation) {
|
||||
logger.warn('this browser does not support geo location');
|
||||
|
||||
Reference in New Issue
Block a user