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