From d260defb056a71bd19608e7ec7f410a9aa16ff92 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Tue, 5 Nov 2024 19:03:12 -0700 Subject: [PATCH] add pages to see all the offers to user and offers to user's projects --- src/libs/endorserServer.ts | 25 +++- src/router/index.ts | 10 ++ src/views/DIDView.vue | 4 +- src/views/HomeView.vue | 7 +- src/views/NewActivityView.vue | 80 +++++----- src/views/RecentOffersToUserProjectsView.vue | 150 +++++++++++++++++++ src/views/RecentOffersToUserView.vue | 146 ++++++++++++++++++ 7 files changed, 374 insertions(+), 48 deletions(-) create mode 100644 src/views/RecentOffersToUserProjectsView.vue create mode 100644 src/views/RecentOffersToUserView.vue diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts index f1f362d..f10bd3f 100644 --- a/src/libs/endorserServer.ts +++ b/src/libs/endorserServer.ts @@ -593,17 +593,21 @@ export async function setPlanInCache( /** * - * @returns { data: Array, hitLimit: boolean } + * @returns { data: Array, hitLimit: boolean true if maximum was hit and there may be more } */ export async function getNewOffersToUser( axios: Axios, apiServer: string, activeDid: string, - lastAckedOfferToUserJwtId?: string, + afterOfferJwtId?: string, + beforeOfferJwtId?: string, ) { let url = `${apiServer}/api/v2/report/offers?recipientDid=${activeDid}`; - if (lastAckedOfferToUserJwtId) { - url += "&afterId=" + lastAckedOfferToUserJwtId; + if (afterOfferJwtId) { + url += "&afterId=" + afterOfferJwtId; + } + if (beforeOfferJwtId) { + url += "&beforeId=" + beforeOfferJwtId; } const headers = await getHeaders(activeDid); const response = await axios.get(url, { headers }); @@ -611,17 +615,22 @@ export async function getNewOffersToUser( } /** * - * @returns { data: Array, hitLimit: boolean } + * @returns { data: Array, hitLimit: boolean true if maximum was hit and there may be more } */ export async function getNewOffersToUserProjects( axios: Axios, apiServer: string, activeDid: string, - lastAckedOfferToUserProjectsJwtId?: string, + afterOfferJwtId?: string, + beforeOfferJwtId?: string, ) { let url = `${apiServer}/api/v2/report/offersToPlansOwnedByMe`; - if (lastAckedOfferToUserProjectsJwtId) { - url += "?afterId=" + lastAckedOfferToUserProjectsJwtId; + if (afterOfferJwtId) { + url += "?afterId=" + afterOfferJwtId; + } + if (beforeOfferJwtId) { + url += afterOfferJwtId ? "&" : "?"; + url += "beforeId=" + beforeOfferJwtId; } const headers = await getHeaders(activeDid); const response = await axios.get(url, { headers }); diff --git a/src/router/index.ts b/src/router/index.ts index 9b81a14..f56db47 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -184,6 +184,16 @@ const routes: Array = [ name: "quick-action-bvc-end", component: () => import("../views/QuickActionBvcEndView.vue"), }, + { + path: "/recent-offers-to-user", + name: "recent-offers-to-user", + component: () => import("../views/RecentOffersToUserView.vue"), + }, + { + path: "/recent-offers-to-user-projects", + name: "recent-offers-to-user-projects", + component: () => import("../views/RecentOffersToUserProjectsView.vue"), + }, { path: "/scan-contact", name: "scan-contact", diff --git a/src/views/DIDView.vue b/src/views/DIDView.vue index aac5913..f53d5cd 100644 --- a/src/views/DIDView.vue +++ b/src/views/DIDView.vue @@ -41,8 +41,8 @@ class="ml-2 mr-2 mt-4" > Details - - + +
 
       
@@ -212,7 +211,9 @@ > {{ numNewOffersToUser }}{{ newOffersToUserHitLimit ? "+" : "" }} -

new offer{{ numNewOffersToUser === 1 ? "" : "s" }} to you

+

+ new offer{{ numNewOffersToUser === 1 ? "" : "s" }} to you +

-

+

new offer{{ numNewOffersToUserProjects === 1 ? "" : "s" }} to your projects

diff --git a/src/views/NewActivityView.vue b/src/views/NewActivityView.vue index 26d089a..c0b74fd 100644 --- a/src/views/NewActivityView.vue +++ b/src/views/NewActivityView.vue @@ -16,21 +16,26 @@
-
- {{ newOffersToUser.length - }}{{ newOffersToUserHitLimit ? "+" : "" }} - New Offer{{ newOffersToUser.length === 1 ? "" : "s" }} To You - +
+
+ {{ newOffersToUser.length + }}{{ newOffersToUserHitLimit ? "+" : "" }} + New Offer{{ newOffersToUser.length === 1 ? "" : "s" }} To You + +
+ + See all +
@@ -43,7 +48,7 @@ {{ didInfo(offer.offeredByDid, activeDid, allMyDids, allContacts) }} - offers + offered {{ offer.objectDescription }} -
- {{ newOffersToUserProjects.length - }}{{ newOffersToUserProjectsHitLimit ? "+" : "" }} - New Offer{{ newOffersToUserProjects.length === 1 ? "" : "s" }} To Your - Projects - +
+
+ {{ newOffersToUserProjects.length + }}{{ newOffersToUserProjectsHitLimit ? "+" : "" }} + New Offer{{ newOffersToUserProjects.length === 1 ? "" : "s" }} To + Your Projects + +
+ + See all +
@@ -100,7 +110,7 @@ {{ didInfo(offer.offeredByDid, activeDid, allMyDids, allContacts) }} - offers + offered {{ offer.objectDescription }} + + +
+ +
+

+ + + Offers to Your Projects +

+
+ + +
    +
  • +
    + You've already seen all the following +
    + + {{ + didInfo(offer.offeredByDid, activeDid, allMyDids, allContacts) + }} + offered + {{ + offer.objectDescription + }}{{ offer.objectDescription && offer.amount ? ", and " : "" }} + {{ + displayAmount(offer.unit, offer.amount) + }} + to + {{ offer.planName }} + + + +
  • +
+
+
+ + + diff --git a/src/views/RecentOffersToUserView.vue b/src/views/RecentOffersToUserView.vue new file mode 100644 index 0000000..74faaf6 --- /dev/null +++ b/src/views/RecentOffersToUserView.vue @@ -0,0 +1,146 @@ + + +