|
|
@ -48,24 +48,12 @@ |
|
|
|
placeholder="What was received" |
|
|
|
/> |
|
|
|
<div class="flex mb-4"> |
|
|
|
<button |
|
|
|
class="rounded-s border border-e-0 border-slate-400 bg-slate-200 px-4 py-2" |
|
|
|
@click="amountInput === '0' ? null : decrement()" |
|
|
|
> |
|
|
|
<font-awesome icon="chevron-left" /> |
|
|
|
</button> |
|
|
|
<input |
|
|
|
id="inputGivenAmount" |
|
|
|
v-model="amountInput" |
|
|
|
type="number" |
|
|
|
class="flex-1 border border-e-0 border-slate-400 px-2 py-2 text-center w-[1px]" |
|
|
|
<AmountInput |
|
|
|
:value="parseFloat(amountInput) || 0" |
|
|
|
:min="0" |
|
|
|
input-id="inputGivenAmount" |
|
|
|
:on-update-value="handleAmountChange" |
|
|
|
/> |
|
|
|
<button |
|
|
|
class="rounded-e border border-slate-400 bg-slate-200 px-4 py-2" |
|
|
|
@click="increment()" |
|
|
|
> |
|
|
|
<font-awesome icon="chevron-right" /> |
|
|
|
</button> |
|
|
|
|
|
|
|
<select |
|
|
|
v-model="unitCode" |
|
|
@ -275,6 +263,7 @@ import { RouteLocationNormalizedLoaded, Router } from "vue-router"; |
|
|
|
import ImageMethodDialog from "../components/ImageMethodDialog.vue"; |
|
|
|
import QuickNav from "../components/QuickNav.vue"; |
|
|
|
import TopMessage from "../components/TopMessage.vue"; |
|
|
|
import AmountInput from "../components/AmountInput.vue"; |
|
|
|
import { DEFAULT_IMAGE_API_SERVER, NotificationIface } from "../constants/app"; |
|
|
|
import { GenericCredWrapper, GiveActionClaim } from "../interfaces"; |
|
|
|
import { |
|
|
@ -296,9 +285,11 @@ import { |
|
|
|
NOTIFY_GIFTED_DETAILS_DELETE_IMAGE_CONFIRM, |
|
|
|
NOTIFY_GIFTED_DETAILS_DELETE_IMAGE_ERROR, |
|
|
|
NOTIFY_GIFTED_DETAILS_NO_IDENTIFIER, |
|
|
|
NOTIFY_GIFT_ERROR_NEGATIVE_AMOUNT, |
|
|
|
NOTIFY_GIFTED_DETAILS_RECORDING_GIVE, |
|
|
|
NOTIFY_GIFTED_DETAILS_CREATE_GIVE_ERROR, |
|
|
|
NOTIFY_GIFTED_DETAILS_GIFT_RECORDED, |
|
|
|
NOTIFY_GIFT_ERROR_NO_DESCRIPTION, |
|
|
|
} from "@/constants/notifications"; |
|
|
|
|
|
|
|
@Component({ |
|
|
@ -306,6 +297,7 @@ import { |
|
|
|
ImageMethodDialog, |
|
|
|
QuickNav, |
|
|
|
TopMessage, |
|
|
|
AmountInput, |
|
|
|
}, |
|
|
|
mixins: [PlatformServiceMixin], |
|
|
|
}) |
|
|
@ -528,6 +520,10 @@ export default class GiftedDetails extends Vue { |
|
|
|
)}`; |
|
|
|
} |
|
|
|
|
|
|
|
handleAmountChange(value: number): void { |
|
|
|
this.amountInput = value.toString(); |
|
|
|
} |
|
|
|
|
|
|
|
cancel() { |
|
|
|
this.deleteImage(); // not awaiting, so they'll go back immediately |
|
|
|
if (this.destinationPathAfter) { |
|
|
@ -609,14 +605,17 @@ export default class GiftedDetails extends Vue { |
|
|
|
} |
|
|
|
if (parseFloat(this.amountInput) < 0) { |
|
|
|
this.notify.error( |
|
|
|
NOTIFY_GIFTED_DETAILS_NO_IDENTIFIER.message, |
|
|
|
NOTIFY_GIFT_ERROR_NEGATIVE_AMOUNT.message, |
|
|
|
TIMEOUTS.SHORT, |
|
|
|
); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.description && !parseFloat(this.amountInput)) { |
|
|
|
this.notify.error( |
|
|
|
NOTIFY_GIFTED_DETAILS_NO_IDENTIFIER.message, |
|
|
|
NOTIFY_GIFT_ERROR_NO_DESCRIPTION.message.replace( |
|
|
|
"{unit}", |
|
|
|
this.libsUtil.UNIT_SHORT[this.unitCode] || this.unitCode, |
|
|
|
), |
|
|
|
TIMEOUTS.SHORT, |
|
|
|
); |
|
|
|
return; |
|
|
@ -625,7 +624,7 @@ export default class GiftedDetails extends Vue { |
|
|
|
this.notify.toast( |
|
|
|
NOTIFY_GIFTED_DETAILS_RECORDING_GIVE.message, |
|
|
|
undefined, |
|
|
|
TIMEOUTS.SHORT, |
|
|
|
TIMEOUTS.BRIEF, |
|
|
|
); |
|
|
|
|
|
|
|
// this is asynchronous, but we don't need to wait for it to complete |
|
|
|