diff --git a/public/config.sample.json b/public/config.sample.json index 37e1cc55..a488063f 100644 --- a/public/config.sample.json +++ b/public/config.sample.json @@ -77,5 +77,6 @@ "accountsRefreshInterval": 90, "transactionsRefreshInterval": 47, "disableReconversion": false, - "disableTopUp": false + "disableTopUp": false, + "disableSplitMemo": false } diff --git a/src/components/MoneyRequestModal.vue b/src/components/MoneyRequestModal.vue index cf041794..542eae31 100644 --- a/src/components/MoneyRequestModal.vue +++ b/src/components/MoneyRequestModal.vue @@ -16,7 +16,8 @@ :selectedRecipient="selectedRecipient" :config="config" @update:amount="(x) => (amount = x)" - @update:message="(x) => (message = x)" + @update:senderMemo="(x) => (senderMemo = x)" + @update:recipientMemo="(x) => (recipientMemo = x)" @update:isValid="(x) => (isValid = x)" /> @@ -72,7 +73,8 @@ rp: userProfile.id, rpb: $modal.args.value[0].account.id, amount: amount, - message: message, + senderMemo: senderMemo, + recipientMemo: recipientMemo, }) " /> @@ -119,7 +121,8 @@ data() { return { amount: null, - message: null, + senderMemo: null, + recipientMemo: null, isValid: false, config: {}, } @@ -128,9 +131,14 @@ ...mapModuleState("lokapi", ["userProfile"]), }, watch: { - message: { + senderMemo: { handler(newVal, oldVal) { - this.config.message = newVal + this.config.senderMemo = newVal + }, + }, + recipientMemo: { + handler(newVal, oldVal) { + this.config.recipientMemo = newVal }, }, amount: { diff --git a/src/components/MoneyTransaction.vue b/src/components/MoneyTransaction.vue index ace95d70..26a68ea1 100644 --- a/src/components/MoneyTransaction.vue +++ b/src/components/MoneyTransaction.vue @@ -16,7 +16,7 @@ -
+

{{ $gettext("To") }}

@@ -31,7 +31,7 @@ ref="amountRequested" type="number" min="0" - class="input is-custom" + class="input is-custom mb-2" id="send-amount-input" :placeholder="$gettext('e.g. 50')" :class="{ @@ -50,21 +50,68 @@
{{ parentErrors }}
- -
- {{ errors.message }} +
+ +
+ {{ errors.senderMemo }} +
+
+
+ +
+
+ {{ $gettext("Use the same memo for the recipient") }} +
+
+
+ +
+ {{ errors.recipientMemo }} +
+
@@ -81,23 +128,32 @@ RecipientItem, BankAccountItem, }, - emits: ["update:amount", "update:message", "update:isValid"], + emits: [ + "update:amount", + "update:senderMemo", + "update:recipientMemo", + "update:isValid", + ], props: { account: Object, selectedRecipient: Object, directionTransfer: String, config: Object, parentErrors: String, - isReconversion: Boolean, + transactionType: String, }, data() { return { amount: null, - message: null, + senderMomo: null, + recipientMemo: null, + isCopyMemo: true, + backend: null, errors: { amountLength: true, amount: false, - message: false, + senderMomo: false, + recipientMemo: false, }, } }, @@ -105,9 +161,18 @@ this.setFocus("amountRequested") if (this.config?.amount) { this.amount = this.config?.amount - this.message = this.config?.message + this.senderMemo = this.config?.senderMemo + this.recipientMemo = this.config?.recipientMemo this.errors.amountLength = this.amount?.length === 0 } + if (this.transactionType === "requestPay") { + this.isCopyMemo = false + } + if (this.account._obj?.getTransactions) { + this.backend = this.account._obj.parent + } else { + this.backend = this.account._obj.parent.parent + } }, computed: { isValid() { @@ -177,15 +242,30 @@ this.$emit("update:amount", parseFloat(this.amount).toFixed(2)) this.errors.amount = false }, - handleMessageInput() { - if (this.message.length > 50) { - this.errors.message = this.$gettext( + handleSenderMemoInput() { + if (this.senderMemo.length > 50) { + this.errors.senderMemo = this.$gettext( "the message description is too long" ) return } - this.$emit("update:message", this.message) - this.errors.message = false + if (this.isCopyMemo) { + this.recipientMemo = this.senderMemo + } + this.$emit("update:senderMemo", this.senderMemo) + this.$emit("update:recipientMemo", this.recipientMemo) + this.errors.senderMemo = false + }, + handleRecipientMemoInput() { + if (this.recipientMemo.length > 50) { + this.errors.recipientMemo = this.$gettext( + "the message description is too long" + ) + return + } + this.$emit("update:recipientMemo", this.recipientMemo) + this.$emit("update:senderMemo", this.senderMemo) + this.errors.recipientMemo = false }, setFocus(refLabel: string) { this.$nextTick(() => { @@ -194,12 +274,26 @@ ref.select() }) }, + handleSwitch(event: any) { + this.isCopyMemo = event.target.checked + if (this.isCopyMemo) { + this.recipientMemo = this.senderMemo + this.errors.recipientMemo = false + this.setFocus("sendertMemo") + } else { + this.recipientMemo = null + this.setFocus("recipientMemo") + } + this.$emit("update:recipientMemo", this.recipientMemo) + this.$emit("update:senderMemo", this.senderMemo) + }, }, }) export default class MoneyTransaction extends Vue {} diff --git a/src/components/MoneyTransferModal.vue b/src/components/MoneyTransferModal.vue index 6f277e34..52cebe48 100644 --- a/src/components/MoneyTransferModal.vue +++ b/src/components/MoneyTransferModal.vue @@ -118,7 +118,7 @@