|
|
@ -66,6 +66,10 @@ |
|
|
|
: "Unconfirmed" |
|
|
|
}} |
|
|
|
</button> |
|
|
|
<br /> |
|
|
|
(Only hours shown) |
|
|
|
<br /> |
|
|
|
(Only recent shown) |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
@ -135,7 +139,10 @@ |
|
|
|
<fa icon="trash-can" class="fa-fw" /> |
|
|
|
</button> |
|
|
|
|
|
|
|
<div v-if="showGiveNumbers" class="ml-auto flex gap-1.5"> |
|
|
|
<div |
|
|
|
v-if="showGiveNumbers && contact.did != activeDid" |
|
|
|
class="ml-auto flex gap-1.5" |
|
|
|
> |
|
|
|
<button |
|
|
|
class="text-sm uppercase bg-blue-600 text-white px-2 py-1.5 rounded-md" |
|
|
|
@click="onClickAddGive(activeDid, contact.did)" |
|
|
@ -294,20 +301,27 @@ export default class ContactsView extends Vue { |
|
|
|
} |
|
|
|
|
|
|
|
async loadGives() { |
|
|
|
const handleResponse = (resp, descriptions, confirmed, unconfirmed) => { |
|
|
|
const handleResponse = ( |
|
|
|
resp, |
|
|
|
descriptions, |
|
|
|
confirmed, |
|
|
|
unconfirmed, |
|
|
|
useRecipient, |
|
|
|
) => { |
|
|
|
if (resp.status === 200) { |
|
|
|
const allData = resp.data.data; |
|
|
|
for (const give of allData) { |
|
|
|
const otherDid = useRecipient ? give.recipientDid : give.agentDid; |
|
|
|
if (give.unit === "HUR") { |
|
|
|
if (give.amountConfirmed) { |
|
|
|
const prevAmount = confirmed[give.agentDid] || 0; |
|
|
|
confirmed[give.agentDid] = prevAmount + give.amount; |
|
|
|
const prevAmount = confirmed[otherDid] || 0; |
|
|
|
confirmed[otherDid] = prevAmount + give.amount; |
|
|
|
} else { |
|
|
|
const prevAmount = unconfirmed[give.agentDid] || 0; |
|
|
|
unconfirmed[give.agentDid] = prevAmount + give.amount; |
|
|
|
const prevAmount = unconfirmed[otherDid] || 0; |
|
|
|
unconfirmed[otherDid] = prevAmount + give.amount; |
|
|
|
} |
|
|
|
if (!descriptions[give.agentDid] && give.description) { |
|
|
|
descriptions[give.agentDid] = give.description; |
|
|
|
if (!descriptions[otherDid] && give.description) { |
|
|
|
descriptions[otherDid] = give.description; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -334,17 +348,15 @@ export default class ContactsView extends Vue { |
|
|
|
}; |
|
|
|
|
|
|
|
try { |
|
|
|
const { headers, identity } = await this.getHeadersAndIdentity( |
|
|
|
this.activeDid, |
|
|
|
); |
|
|
|
const { headers } = await this.getHeadersAndIdentity(this.activeDid); |
|
|
|
const givenByUrl = |
|
|
|
this.apiServer + |
|
|
|
"/api/v2/report/gives?agentDid=" + |
|
|
|
encodeURIComponent(identity.did); |
|
|
|
encodeURIComponent(this.activeDid); |
|
|
|
const givenToUrl = |
|
|
|
this.apiServer + |
|
|
|
"/api/v2/report/gives?recipientDid=" + |
|
|
|
encodeURIComponent(identity.did); |
|
|
|
encodeURIComponent(this.activeDid); |
|
|
|
|
|
|
|
const [givenByMeResp, givenToMeResp] = await Promise.all([ |
|
|
|
this.axios.get(givenByUrl, { headers }), |
|
|
@ -359,6 +371,7 @@ export default class ContactsView extends Vue { |
|
|
|
givenByMeDescriptions, |
|
|
|
givenByMeConfirmed, |
|
|
|
givenByMeUnconfirmed, |
|
|
|
true, |
|
|
|
); |
|
|
|
this.givenByMeDescriptions = givenByMeDescriptions; |
|
|
|
this.givenByMeConfirmed = givenByMeConfirmed; |
|
|
@ -372,6 +385,7 @@ export default class ContactsView extends Vue { |
|
|
|
givenToMeDescriptions, |
|
|
|
givenToMeConfirmed, |
|
|
|
givenToMeUnconfirmed, |
|
|
|
false, |
|
|
|
); |
|
|
|
this.givenToMeDescriptions = givenToMeDescriptions; |
|
|
|
this.givenToMeConfirmed = givenToMeConfirmed; |
|
|
|