|
|
@ -51,16 +51,9 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script lang="ts"> |
|
|
|
import { Vue, Component, Prop, Emit } from "vue-facing-decorator"; |
|
|
|
import { |
|
|
|
createAndSubmitGive, |
|
|
|
CreateAndSubmitGiveResult, |
|
|
|
ErrorResult, |
|
|
|
GiverInputInfo, |
|
|
|
GiverOutputInfo, |
|
|
|
} from "@/libs/endorserServer"; |
|
|
|
import { Vue, Component, Prop } from "vue-facing-decorator"; |
|
|
|
import { createAndSubmitGive, GiverInputInfo } from "@/libs/endorserServer"; |
|
|
|
import { accountsDB, db } from "@/db/index"; |
|
|
|
import { Contact } from "@/db/tables/contacts"; |
|
|
|
import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings"; |
|
|
|
import { Account } from "@/db/tables/accounts"; |
|
|
|
|
|
|
@ -76,6 +69,7 @@ export default class GiftedDialog extends Vue { |
|
|
|
$notify!: (notification: Notification, timeout?: number) => void; |
|
|
|
|
|
|
|
@Prop message = ""; |
|
|
|
@Prop projectId = ""; |
|
|
|
|
|
|
|
activeDid = ""; |
|
|
|
apiServer = ""; |
|
|
@ -93,7 +87,7 @@ export default class GiftedDialog extends Vue { |
|
|
|
this.activeDid = settings?.activeDid || ""; |
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
|
} catch (err: any) { |
|
|
|
console.log("Error retrieving settings from database.", err); |
|
|
|
console.log("Error retrieving settings from database:", err); |
|
|
|
this.$notify( |
|
|
|
{ |
|
|
|
group: "alert", |
|
|
@ -125,27 +119,34 @@ export default class GiftedDialog extends Vue { |
|
|
|
this.hours = `${Math.max(0, (parseFloat(this.hours) || 1) - 1)}`; |
|
|
|
} |
|
|
|
|
|
|
|
@Emit("dialog-result") |
|
|
|
cancel(): GiverOutputInfo { |
|
|
|
cancel() { |
|
|
|
this.close(); |
|
|
|
this.description = ""; |
|
|
|
this.giver = undefined; |
|
|
|
this.hours = "0"; |
|
|
|
return { action: "cancel" }; |
|
|
|
} |
|
|
|
|
|
|
|
@Emit("dialog-result") |
|
|
|
async confirm() { |
|
|
|
await this.recordGive( |
|
|
|
this.close(); |
|
|
|
this.$notify( |
|
|
|
{ |
|
|
|
group: "alert", |
|
|
|
type: "toast", |
|
|
|
text: "Recording the give...", |
|
|
|
title: "", |
|
|
|
}, |
|
|
|
1000, |
|
|
|
); |
|
|
|
// this is asynchronous, but we don't need to wait for it to complete |
|
|
|
this.recordGive( |
|
|
|
this.giver?.did as string | undefined, |
|
|
|
this.description, |
|
|
|
parseFloat(this.hours), |
|
|
|
); |
|
|
|
this.close(); |
|
|
|
this.description = ""; |
|
|
|
this.giver = undefined; |
|
|
|
this.hours = "0"; |
|
|
|
return { action: "confirm" }; |
|
|
|
).then(() => { |
|
|
|
this.description = ""; |
|
|
|
this.giver = undefined; |
|
|
|
this.hours = "0"; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public async getIdentity(activeDid: string) { |
|
|
@ -211,6 +212,7 @@ export default class GiftedDialog extends Vue { |
|
|
|
this.activeDid, |
|
|
|
description, |
|
|
|
hours, |
|
|
|
this.projectId, |
|
|
|
); |
|
|
|
|
|
|
|
if ( |
|
|
@ -236,7 +238,7 @@ export default class GiftedDialog extends Vue { |
|
|
|
title: "Success", |
|
|
|
text: "That gift was recorded.", |
|
|
|
}, |
|
|
|
-1, |
|
|
|
10000, |
|
|
|
); |
|
|
|
} |
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
|