|
|
@ -18,12 +18,9 @@ |
|
|
|
<h1 class="text-4xl text-center font-light px-4 mb-4">What Was Given</h1> |
|
|
|
|
|
|
|
<h1 class="text-xl font-bold text-center mb-4"> |
|
|
|
{{ customTitle || message + " " + giverName || "somebody not named" }} |
|
|
|
</h1> |
|
|
|
<div> |
|
|
|
<span>From {{ giverName || "somebody not named" }}</span> |
|
|
|
<span> to {{ recipientName || "somebody not named" }}</span> |
|
|
|
</div> |
|
|
|
</h1> |
|
|
|
<textarea |
|
|
|
class="block w-full rounded border border-slate-400 mb-2 px-3 py-2" |
|
|
|
placeholder="What was received" |
|
|
@ -81,7 +78,7 @@ |
|
|
|
icon="check" |
|
|
|
class="bg-slate-500 text-white h-5 w-5 px-0.5 py-0.5 mr-2 rounded" |
|
|
|
/> |
|
|
|
<label class="text-sm">This is given to a project</label> |
|
|
|
<label class="text-sm">This is given to {{ projectName }}</label> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div v-if="showGivenToUser" class="mt-4"> |
|
|
@ -127,7 +124,7 @@ import QuickNav from "@/components/QuickNav.vue"; |
|
|
|
import TopMessage from "@/components/TopMessage.vue"; |
|
|
|
import { db } from "@/db/index"; |
|
|
|
import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings"; |
|
|
|
import { createAndSubmitGive } from "@/libs/endorserServer"; |
|
|
|
import { createAndSubmitGive, getPlanFromCache } from "@/libs/endorserServer"; |
|
|
|
import * as libsUtil from "@/libs/util"; |
|
|
|
import { accessToken } from "@/libs/crypto"; |
|
|
|
import GiftedPhotoDialog from "@/components/GiftedPhotoDialog.vue"; |
|
|
@ -146,7 +143,6 @@ export default class GiftedDetails extends Vue { |
|
|
|
apiServer = ""; |
|
|
|
|
|
|
|
amountInput = "0"; |
|
|
|
customTitle = ""; |
|
|
|
description = ""; |
|
|
|
givenToUser = false; |
|
|
|
giverDid: string | undefined; |
|
|
@ -156,6 +152,7 @@ export default class GiftedDetails extends Vue { |
|
|
|
message = ""; |
|
|
|
offerId = ""; |
|
|
|
projectId = ""; |
|
|
|
projectName = "a project"; |
|
|
|
recipientDid = ""; |
|
|
|
recipientName = ""; |
|
|
|
showGivenToUser = false; |
|
|
@ -165,7 +162,6 @@ export default class GiftedDetails extends Vue { |
|
|
|
|
|
|
|
async mounted() { |
|
|
|
this.amountInput = this.$route.query.amountInput as string; |
|
|
|
this.customTitle = this.$route.query.customTitle as string; |
|
|
|
this.description = this.$route.query.description as string; |
|
|
|
this.giverDid = this.$route.query.giverDid as string; |
|
|
|
this.giverName = this.$route.query.giverName as string; |
|
|
@ -209,6 +205,21 @@ export default class GiftedDetails extends Vue { |
|
|
|
-1, |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.projectId) { |
|
|
|
console.log("Getting project name from cache", this.projectId); |
|
|
|
const identity = await libsUtil.getIdentity(this.activeDid); |
|
|
|
const project = await getPlanFromCache( |
|
|
|
this.projectId, |
|
|
|
identity, |
|
|
|
this.axios, |
|
|
|
this.apiServer, |
|
|
|
); |
|
|
|
console.log("Got project name from cache", project); |
|
|
|
this.projectName = project?.name |
|
|
|
? "the project " + project.name |
|
|
|
: "a project"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
changeUnitCode() { |
|
|
@ -429,7 +440,7 @@ export default class GiftedDetails extends Vue { |
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
|
} catch (error: any) { |
|
|
|
console.error("Error with give recordation caught:", error); |
|
|
|
const message = |
|
|
|
const errorMessage = |
|
|
|
error.userMessage || |
|
|
|
error.response?.data?.error?.message || |
|
|
|
"There was an error recording the give."; |
|
|
@ -438,7 +449,7 @@ export default class GiftedDetails extends Vue { |
|
|
|
group: "alert", |
|
|
|
type: "danger", |
|
|
|
title: "Error", |
|
|
|
text: message, |
|
|
|
text: errorMessage, |
|
|
|
}, |
|
|
|
-1, |
|
|
|
); |
|
|
|