allow details on a give for a providing project (so we can attach a picture)
This commit is contained in:
@@ -106,7 +106,8 @@
|
||||
class="border border-slate-400 h-6 px-2"
|
||||
/>
|
||||
<br />
|
||||
(Everyone likes personalized messages! 😁)
|
||||
(Everyone likes personalized messages! 😁 ... and for a pic:
|
||||
<input type="checkbox" v-model="supplyGiftDetails" />)
|
||||
</span>
|
||||
<!-- This is to match input height to avoid shifting when hiding & showing. -->
|
||||
<span v-else class="h-6">...</span>
|
||||
@@ -179,6 +180,7 @@ export default class QuickActionBvcBeginView extends Vue {
|
||||
description = "breakfast";
|
||||
loadingConfirms = true;
|
||||
someoneGave = false;
|
||||
supplyGiftDetails = false;
|
||||
|
||||
async created() {
|
||||
this.loadingConfirms = true;
|
||||
@@ -262,7 +264,9 @@ export default class QuickActionBvcBeginView extends Vue {
|
||||
|
||||
async record() {
|
||||
try {
|
||||
this.$notify({ group: "alert", type: "toast", title: "Sent..." }, 1000);
|
||||
if (this.claimsToConfirmSelected.length > 0) {
|
||||
this.$notify({ group: "alert", type: "toast", title: "Sent..." }, 1000);
|
||||
}
|
||||
|
||||
// in parallel, make a confirmation for each selected claim and send them all to the server
|
||||
const confirmResults = await Promise.allSettled(
|
||||
@@ -304,13 +308,7 @@ export default class QuickActionBvcBeginView extends Vue {
|
||||
|
||||
// now send the give for the description
|
||||
let giveSucceeded = false;
|
||||
if (this.someoneGave) {
|
||||
const providers: Array<GenericVerifiableCredential> = [
|
||||
{
|
||||
"@type": "PlanAction",
|
||||
identifier: BVC_MEETUPS_PROJECT_CLAIM_ID,
|
||||
},
|
||||
];
|
||||
if (this.someoneGave && !this.supplyGiftDetails) {
|
||||
const giveResult = await createAndSubmitGive(
|
||||
axios,
|
||||
this.apiServer,
|
||||
@@ -324,7 +322,7 @@ export default class QuickActionBvcBeginView extends Vue {
|
||||
undefined,
|
||||
false,
|
||||
undefined,
|
||||
providers,
|
||||
BVC_MEETUPS_PROJECT_CLAIM_ID,
|
||||
);
|
||||
giveSucceeded = giveResult.type === "success";
|
||||
if (!giveSucceeded) {
|
||||
@@ -342,29 +340,61 @@ export default class QuickActionBvcBeginView extends Vue {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (confirmsSucceeded.length > 0 || giveSucceeded) {
|
||||
const confirms =
|
||||
confirmsSucceeded.length === 1 ? "confirmation" : "confirmations";
|
||||
const actions =
|
||||
confirmsSucceeded.length > 0 && giveSucceeded
|
||||
? `Your ${confirms} and that give have been recorded.`
|
||||
: giveSucceeded
|
||||
? "That give has been recorded."
|
||||
: "Your " +
|
||||
confirms +
|
||||
" " +
|
||||
(confirmsSucceeded.length === 1 ? "has" : "have") +
|
||||
" been recorded.";
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "success",
|
||||
title: "Success",
|
||||
text: actions,
|
||||
if (this.someoneGave && this.supplyGiftDetails) {
|
||||
// we'll give a success message for the confirmations and go to the gifted details page
|
||||
if (confirmsSucceeded.length > 0) {
|
||||
const actions =
|
||||
confirmsSucceeded.length === 1
|
||||
? `Your confirmation has been recorded.`
|
||||
: `Your confirmations have been recorded.`;
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "success",
|
||||
title: "Success",
|
||||
text: actions,
|
||||
},
|
||||
3000,
|
||||
);
|
||||
}
|
||||
(this.$router as Router).push({
|
||||
name: "gifted-details",
|
||||
query: {
|
||||
description: this.description,
|
||||
destinationPathAfter: "/",
|
||||
providerProjectId:
|
||||
"https://endorser.ch/entity/01J8XW5SE5NJZ34TQCC10FC18B", //BVC_MEETUPS_PROJECT_CLAIM_ID,
|
||||
recipientDid: this.activeDid,
|
||||
},
|
||||
3000,
|
||||
);
|
||||
});
|
||||
} else {
|
||||
// just go ahead and print a message for all the activity
|
||||
if (confirmsSucceeded.length > 0 || giveSucceeded) {
|
||||
const confirms =
|
||||
confirmsSucceeded.length === 1 ? "confirmation" : "confirmations";
|
||||
const actions =
|
||||
confirmsSucceeded.length > 0 && giveSucceeded
|
||||
? `Your ${confirms} and that give have been recorded.`
|
||||
: giveSucceeded
|
||||
? "That give has been recorded."
|
||||
: "Your " +
|
||||
confirms +
|
||||
" " +
|
||||
(confirmsSucceeded.length === 1 ? "has" : "have") +
|
||||
" been recorded.";
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "success",
|
||||
title: "Success",
|
||||
text: actions,
|
||||
},
|
||||
3000,
|
||||
);
|
||||
(this.$router as Router).push({ path: "/" });
|
||||
} else {
|
||||
// errors should have already shown
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
||||
Reference in New Issue
Block a user