|  |  | @ -109,16 +109,35 @@ | 
			
		
	
		
			
				
					|  |  |  |     </div> | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     <button | 
			
		
	
		
			
				
					|  |  |  |       @click="openDialog()" | 
			
		
	
		
			
				
					|  |  |  |       @click="openDialog({ name: 'you', did: activeDid })" | 
			
		
	
		
			
				
					|  |  |  |       class="block text-center text-lg font-bold uppercase bg-blue-600 text-white px-2 py-3 rounded-md mb-8" | 
			
		
	
		
			
				
					|  |  |  |     > | 
			
		
	
		
			
				
					|  |  |  |       Given | 
			
		
	
		
			
				
					|  |  |  |       I gave... | 
			
		
	
		
			
				
					|  |  |  |     </button> | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     <div> | 
			
		
	
		
			
				
					|  |  |  |       <p>... or choose a contact who gave:</p> | 
			
		
	
		
			
				
					|  |  |  |       <!-- similar contact selection code is in multiple places --> | 
			
		
	
		
			
				
					|  |  |  |       <div class="px-4"> | 
			
		
	
		
			
				
					|  |  |  |         <button | 
			
		
	
		
			
				
					|  |  |  |           v-for="contact in allContacts" | 
			
		
	
		
			
				
					|  |  |  |           :key="contact.did" | 
			
		
	
		
			
				
					|  |  |  |           @click="openDialog(contact)" | 
			
		
	
		
			
				
					|  |  |  |           class="text-blue-500" | 
			
		
	
		
			
				
					|  |  |  |         > | 
			
		
	
		
			
				
					|  |  |  |            {{ contact.name }}, | 
			
		
	
		
			
				
					|  |  |  |         </button> | 
			
		
	
		
			
				
					|  |  |  |         <span v-if="allContacts.length > 0"> or </span> | 
			
		
	
		
			
				
					|  |  |  |         <button @click="openDialog()" class="text-blue-500"> | 
			
		
	
		
			
				
					|  |  |  |           someone not specified | 
			
		
	
		
			
				
					|  |  |  |         </button> | 
			
		
	
		
			
				
					|  |  |  |       </div> | 
			
		
	
		
			
				
					|  |  |  |     </div> | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     <GiftedDialog | 
			
		
	
		
			
				
					|  |  |  |       ref="customDialog" | 
			
		
	
		
			
				
					|  |  |  |       @dialog-result="handleDialogResult" | 
			
		
	
		
			
				
					|  |  |  |       message="Confirm to publish to the world." | 
			
		
	
		
			
				
					|  |  |  |       message="Received from" | 
			
		
	
		
			
				
					|  |  |  |     > | 
			
		
	
		
			
				
					|  |  |  |     </GiftedDialog> | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -171,6 +190,7 @@ import { Options, Vue } from "vue-class-component"; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import GiftedDialog from "@/components/GiftedDialog.vue"; | 
			
		
	
		
			
				
					|  |  |  | import { accountsDB, db } from "@/db"; | 
			
		
	
		
			
				
					|  |  |  | import { Contact } from "@/db/tables/contacts"; | 
			
		
	
		
			
				
					|  |  |  | import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; | 
			
		
	
		
			
				
					|  |  |  | import { createAndSubmitGive } from "@/libs/endorserServer"; | 
			
		
	
		
			
				
					|  |  |  | import { accessToken } from "@/libs/crypto"; | 
			
		
	
	
		
			
				
					|  |  | @ -181,6 +201,7 @@ import { IIdentifier } from "@veramo/core"; | 
			
		
	
		
			
				
					|  |  |  | }) | 
			
		
	
		
			
				
					|  |  |  | export default class ProjectViewView extends Vue { | 
			
		
	
		
			
				
					|  |  |  |   activeDid = ""; | 
			
		
	
		
			
				
					|  |  |  |   allContacts: Array<Contact> = []; | 
			
		
	
		
			
				
					|  |  |  |   apiServer = ""; | 
			
		
	
		
			
				
					|  |  |  |   expanded = false; | 
			
		
	
		
			
				
					|  |  |  |   name = ""; | 
			
		
	
	
		
			
				
					|  |  | @ -253,6 +274,7 @@ export default class ProjectViewView extends Vue { | 
			
		
	
		
			
				
					|  |  |  |     const settings = await db.settings.get(MASTER_SETTINGS_KEY); | 
			
		
	
		
			
				
					|  |  |  |     this.activeDid = settings?.activeDid || ""; | 
			
		
	
		
			
				
					|  |  |  |     this.apiServer = settings?.apiServer || ""; | 
			
		
	
		
			
				
					|  |  |  |     this.allContacts = await db.contacts.toArray(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     await accountsDB.open(); | 
			
		
	
		
			
				
					|  |  |  |     const num_accounts = await accountsDB.accounts.count(); | 
			
		
	
	
		
			
				
					|  |  | @ -275,21 +297,21 @@ export default class ProjectViewView extends Vue { | 
			
		
	
		
			
				
					|  |  |  |   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 { | 
			
		
	
		
			
				
					|  |  |  |       // action was "cancel" so do nothing | 
			
		
	
		
			
				
					|  |  |  |       // action was not "confirm" so do nothing | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   /** | 
			
		
	
		
			
				
					|  |  |  |    * | 
			
		
	
		
			
				
					|  |  |  |    * @param contact may be null | 
			
		
	
		
			
				
					|  |  |  |    * @param giverDid may be null | 
			
		
	
		
			
				
					|  |  |  |    * @param description may be an empty string | 
			
		
	
		
			
				
					|  |  |  |    * @param hours may be 0 | 
			
		
	
		
			
				
					|  |  |  |    */ | 
			
		
	
		
			
				
					|  |  |  |   async recordGive(contact, description, hours) { | 
			
		
	
		
			
				
					|  |  |  |   async recordGive(giverDid, description, hours) { | 
			
		
	
		
			
				
					|  |  |  |     if (this.activeDid == null) { | 
			
		
	
		
			
				
					|  |  |  |       this.alertTitle = "Error"; | 
			
		
	
		
			
				
					|  |  |  |       this.alertMessage = | 
			
		
	
	
		
			
				
					|  |  | @ -306,7 +328,7 @@ export default class ProjectViewView extends Vue { | 
			
		
	
		
			
				
					|  |  |  |       this.axios, | 
			
		
	
		
			
				
					|  |  |  |       this.apiServer, | 
			
		
	
		
			
				
					|  |  |  |       identity, | 
			
		
	
		
			
				
					|  |  |  |       contact?.did, | 
			
		
	
		
			
				
					|  |  |  |       giverDid, | 
			
		
	
		
			
				
					|  |  |  |       this.activeDid, | 
			
		
	
		
			
				
					|  |  |  |       description, | 
			
		
	
		
			
				
					|  |  |  |       hours, | 
			
		
	
	
		
			
				
					|  |  | 
 |