forked from jsnbuchanan/crowd-funder-for-time-pwa
finish contact selection for gives
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
<div>
|
||||
<h1 class="text-2xl">Quick Action</h1>
|
||||
<p>Choose a contact to whom to show appreciation:</p>
|
||||
<!-- similar contact selection code is in multiple places -->
|
||||
<div class="px-4">
|
||||
<button
|
||||
v-for="contact in allContacts"
|
||||
@@ -63,7 +64,7 @@
|
||||
</button>
|
||||
<span v-if="allContacts.length > 0"> or </span>
|
||||
<button @click="openDialog()" class="text-blue-500">
|
||||
nobody in particular
|
||||
someone not specified
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -71,7 +72,7 @@
|
||||
<GiftedDialog
|
||||
ref="customDialog"
|
||||
@dialog-result="handleDialogResult"
|
||||
message="Confirm to publish to the world."
|
||||
message="Received from"
|
||||
>
|
||||
</GiftedDialog>
|
||||
|
||||
@@ -268,13 +269,13 @@ export default class HomeView extends Vue {
|
||||
return unitCode === "HUR" ? (single ? "hour" : "hours") : unitCode;
|
||||
}
|
||||
|
||||
openDialog(contact) {
|
||||
this.$refs.customDialog.open(contact);
|
||||
openDialog(giver) {
|
||||
this.$refs.customDialog.open(giver);
|
||||
}
|
||||
handleDialogResult(result) {
|
||||
if (result.action === "confirm") {
|
||||
return new Promise((resolve) => {
|
||||
this.recordGive(result.contact, result.description, result.hours);
|
||||
this.recordGive(result.contact?.did, result.description, result.hours);
|
||||
resolve();
|
||||
});
|
||||
} else {
|
||||
@@ -284,11 +285,11 @@ export default class HomeView extends Vue {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param contact may be null
|
||||
* @param giverDid may be null
|
||||
* @param description may be an empty string
|
||||
* @param hours may be 0
|
||||
*/
|
||||
recordGive(contact, description, hours) {
|
||||
recordGive(giverDid, description, hours) {
|
||||
if (this.activeDid == null) {
|
||||
this.alertTitle = "Error";
|
||||
this.alertMessage =
|
||||
@@ -308,7 +309,7 @@ export default class HomeView extends Vue {
|
||||
this.axios,
|
||||
this.apiServer,
|
||||
identity,
|
||||
contact?.did,
|
||||
giverDid,
|
||||
this.activeDid,
|
||||
description,
|
||||
hours
|
||||
|
||||
Reference in New Issue
Block a user