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