allow to deselect the giver & refactor dialog to group giver vs recipient
This commit is contained in:
@@ -95,73 +95,127 @@
|
|||||||
</div>
|
</div>
|
||||||
<ImageMethodDialog ref="imageDialog" />
|
<ImageMethodDialog ref="imageDialog" />
|
||||||
|
|
||||||
<div class="h-7 mt-4 flex">
|
<div class="mt-4 flex justify-between gap-2">
|
||||||
<input
|
<!-- First Column for Giver -->
|
||||||
v-if="providerProjectId && !providedByGiver"
|
<div class="flex-grow border border-slate-400 p-2 rounded-md">
|
||||||
type="checkbox"
|
<div class="flex">
|
||||||
class="h-6 w-6 mr-2"
|
<input
|
||||||
v-model="providedByProject"
|
v-if="giverDid && !providedByProject"
|
||||||
/>
|
type="checkbox"
|
||||||
<fa
|
class="h-6 w-6 mr-2"
|
||||||
v-else
|
v-model="providedByGiver"
|
||||||
icon="square"
|
/>
|
||||||
class="bg-slate-500 text-slate-500 h-5 w-5 px-0.5 py-0.5 mr-2 rounded"
|
<fa
|
||||||
@click="notifyUserOfProvidingProject()"
|
v-else
|
||||||
/>
|
icon="square"
|
||||||
<label class="text-sm mt-1">
|
class="mr-2 bg-white text-white h-5 w-5 px-0.5 py-0.5 rounded-sm"
|
||||||
{{
|
/>
|
||||||
providerProjectId
|
<label class="text-sm mt-1">
|
||||||
? "This was provided by " + providerProjectName
|
{{
|
||||||
: "This was not provided by a project"
|
giverDid
|
||||||
}}
|
? "This was provided by " + giverName
|
||||||
</label>
|
: "No individual gave"
|
||||||
|
}}
|
||||||
|
</label>
|
||||||
|
<fa
|
||||||
|
v-if="!giverDid || providedByProject"
|
||||||
|
icon="info-circle"
|
||||||
|
class="-mt-1 bg-white text-slate-500 h-5 w-5 px-0.5 py-0.5 rounded-sm"
|
||||||
|
@click="notifyUserOfGiver()"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex">
|
||||||
|
<input
|
||||||
|
v-if="providerProjectId && !providedByGiver"
|
||||||
|
type="checkbox"
|
||||||
|
class="h-6 w-6 mr-2"
|
||||||
|
v-model="providedByProject"
|
||||||
|
/>
|
||||||
|
<fa
|
||||||
|
v-else
|
||||||
|
icon="square"
|
||||||
|
class="mr-2 bg-white text-white h-5 w-5 px-0.5 py-0.5 rounded-sm"
|
||||||
|
/>
|
||||||
|
<label class="text-sm mt-1">
|
||||||
|
{{
|
||||||
|
providerProjectId
|
||||||
|
? "This was provided by " + providerProjectName
|
||||||
|
: "This was not provided by a project"
|
||||||
|
}}
|
||||||
|
</label>
|
||||||
|
<fa
|
||||||
|
v-if="!providerProjectId || providedByGiver"
|
||||||
|
icon="info-circle"
|
||||||
|
class="-mt-1 bg-white text-slate-500 h-5 w-5 px-0.5 py-0.5 rounded-sm"
|
||||||
|
@click="notifyUserOfProvidingProject()"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex-shrink flex justify-center items-center">
|
||||||
|
<fa icon="arrow-right" class="fa-fw h-7" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Third Column for Recipient -->
|
||||||
|
<div class="flex-grow border border-slate-400 p-2 rounded-md">
|
||||||
|
<div class="flex">
|
||||||
|
<input
|
||||||
|
v-if="recipientDid && !givenToProject"
|
||||||
|
type="checkbox"
|
||||||
|
class="h-6 w-6 mr-2"
|
||||||
|
v-model="givenToRecipient"
|
||||||
|
/>
|
||||||
|
<fa
|
||||||
|
v-else
|
||||||
|
icon="square"
|
||||||
|
class="mr-2 bg-white text-white h-5 w-5 px-0.5 py-0.5 rounded-sm"
|
||||||
|
/>
|
||||||
|
<label class="text-sm mt-1">
|
||||||
|
{{
|
||||||
|
recipientDid
|
||||||
|
? "This was given to " + recipientName
|
||||||
|
: "No individual benefitted"
|
||||||
|
}}
|
||||||
|
</label>
|
||||||
|
<fa
|
||||||
|
v-if="!recipientDid || givenToProject"
|
||||||
|
icon="info-circle"
|
||||||
|
class="-mt-1 bg-white text-slate-500 h-5 w-5 px-0.5 py-0.5 rounded-sm"
|
||||||
|
@click="notifyUserOfRecipient()"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex">
|
||||||
|
<input
|
||||||
|
v-if="fulfillsProjectId && !givenToRecipient"
|
||||||
|
type="checkbox"
|
||||||
|
class="h-6 w-6 mr-2"
|
||||||
|
v-model="givenToProject"
|
||||||
|
/>
|
||||||
|
<fa
|
||||||
|
v-else
|
||||||
|
icon="square"
|
||||||
|
class="mr-2 bg-white text-white h-5 w-5 px-0.5 py-0.5 rounded-sm"
|
||||||
|
/>
|
||||||
|
<label class="text-sm mt-1">
|
||||||
|
{{
|
||||||
|
fulfillsProjectId
|
||||||
|
? "This was given to " + fulfillsProjectName
|
||||||
|
: "No project benefitted"
|
||||||
|
}}
|
||||||
|
</label>
|
||||||
|
<fa
|
||||||
|
v-if="!fulfillsProjectId || givenToRecipient"
|
||||||
|
icon="info-circle"
|
||||||
|
class="-mt-1 bg-white text-slate-500 h-5 w-5 px-0.5 py-0.5 rounded-sm"
|
||||||
|
@click="notifyUserFulfillsProject()"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="h-7 mt-4 flex">
|
<div class="mt-8 flex">
|
||||||
<input
|
|
||||||
v-if="fulfillsProjectId && !givenToRecipient"
|
|
||||||
type="checkbox"
|
|
||||||
class="h-6 w-6 mr-2"
|
|
||||||
v-model="givenToProject"
|
|
||||||
/>
|
|
||||||
<fa
|
|
||||||
v-else
|
|
||||||
icon="square"
|
|
||||||
class="bg-slate-500 text-slate-500 h-5 w-5 px-0.5 py-0.5 mr-2 rounded"
|
|
||||||
@click="notifyUserFulfillsProject()"
|
|
||||||
/>
|
|
||||||
<label class="text-sm mt-1">
|
|
||||||
{{
|
|
||||||
fulfillsProjectId
|
|
||||||
? "This was given to " + fulfillsProjectName
|
|
||||||
: "No recipient project was chosen"
|
|
||||||
}}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="h-7 mt-4 flex">
|
|
||||||
<input
|
|
||||||
v-if="recipientDid && !givenToProject"
|
|
||||||
type="checkbox"
|
|
||||||
class="h-6 w-6 mr-2"
|
|
||||||
v-model="givenToRecipient"
|
|
||||||
/>
|
|
||||||
<fa
|
|
||||||
v-else
|
|
||||||
icon="square"
|
|
||||||
class="bg-slate-500 text-slate-500 h-5 w-5 px-0.5 py-0.5 mr-2 rounded"
|
|
||||||
@click="notifyUserOfRecipient()"
|
|
||||||
/>
|
|
||||||
<label class="text-sm mt-1">
|
|
||||||
{{
|
|
||||||
recipientDid
|
|
||||||
? "This was given to " + recipientName
|
|
||||||
: "No recipient was chosen."
|
|
||||||
}}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-4 flex">
|
|
||||||
<input type="checkbox" class="h-6 w-6 mr-2" v-model="isTrade" />
|
<input type="checkbox" class="h-6 w-6 mr-2" v-model="isTrade" />
|
||||||
<label class="text-sm mt-1">This was a trade (not a gift)</label>
|
<label class="text-sm mt-1">This was a trade (not a gift)</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -176,7 +230,7 @@
|
|||||||
}"
|
}"
|
||||||
class="text-blue-500"
|
class="text-blue-500"
|
||||||
>
|
>
|
||||||
Edit & Submit Raw
|
Edit Raw Data
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -247,7 +301,7 @@ export default class GiftedDetails extends Vue {
|
|||||||
fulfillsProjectName = "a project";
|
fulfillsProjectName = "a project";
|
||||||
givenToProject = false; // basically static, based on input; if we allow changing then let's fix things (see below)
|
givenToProject = false; // basically static, based on input; if we allow changing then let's fix things (see below)
|
||||||
givenToRecipient = false; // basically static, based on input; if we allow changing then let's fix things (see below)
|
givenToRecipient = false; // basically static, based on input; if we allow changing then let's fix things (see below)
|
||||||
giverDid: string | undefined;
|
giverDid = "";
|
||||||
giverName = "";
|
giverName = "";
|
||||||
hideBackButton = false;
|
hideBackButton = false;
|
||||||
imageUrl = "";
|
imageUrl = "";
|
||||||
@@ -602,6 +656,55 @@ export default class GiftedDetails extends Vue {
|
|||||||
await this.recordGive();
|
await this.recordGive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notifyUserOfGiver() {
|
||||||
|
if (!this.giverDid) {
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "alert",
|
||||||
|
type: "warning",
|
||||||
|
title: "Go To The Contacts Page",
|
||||||
|
text: "To assign a giver, you must open this page from a contact.",
|
||||||
|
},
|
||||||
|
3000,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "alert",
|
||||||
|
type: "warning",
|
||||||
|
title: "Unavailable",
|
||||||
|
text: "You cannot assign both a giver and a project.",
|
||||||
|
},
|
||||||
|
3000,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
notifyUserOfRecipient() {
|
||||||
|
if (!this.recipientDid) {
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "alert",
|
||||||
|
type: "warning",
|
||||||
|
title: "Go To The Contacts Page",
|
||||||
|
text: "To assign to a recipient, you must open this page from a contact.",
|
||||||
|
},
|
||||||
|
3000,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// must be because givenToProject is true
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "alert",
|
||||||
|
type: "warning",
|
||||||
|
title: "Unavailable",
|
||||||
|
text: "You cannot assign both to a recipient and to a project.",
|
||||||
|
},
|
||||||
|
3000,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
notifyUserOfProvidingProject() {
|
notifyUserOfProvidingProject() {
|
||||||
// we're here because they clicked and either there is no provider project or there is a giver chosen
|
// we're here because they clicked and either there is no provider project or there is a giver chosen
|
||||||
if (!this.providerProjectId) {
|
if (!this.providerProjectId) {
|
||||||
@@ -609,7 +712,7 @@ export default class GiftedDetails extends Vue {
|
|||||||
{
|
{
|
||||||
group: "alert",
|
group: "alert",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
title: "Error",
|
title: "Go To The Project Page",
|
||||||
text: "To select a project as a provider, you must open this page through a project.",
|
text: "To select a project as a provider, you must open this page through a project.",
|
||||||
},
|
},
|
||||||
3000,
|
3000,
|
||||||
@@ -620,7 +723,7 @@ export default class GiftedDetails extends Vue {
|
|||||||
{
|
{
|
||||||
group: "alert",
|
group: "alert",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
title: "Error",
|
title: "Unavailable",
|
||||||
text: "You cannot select both a giving project and person.",
|
text: "You cannot select both a giving project and person.",
|
||||||
},
|
},
|
||||||
3000,
|
3000,
|
||||||
@@ -635,7 +738,7 @@ export default class GiftedDetails extends Vue {
|
|||||||
{
|
{
|
||||||
group: "alert",
|
group: "alert",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
title: "Error",
|
title: "Go To The Project Page",
|
||||||
text: "To assign to a project, you must open this page through a project.",
|
text: "To assign to a project, you must open this page through a project.",
|
||||||
},
|
},
|
||||||
3000,
|
3000,
|
||||||
@@ -646,7 +749,7 @@ export default class GiftedDetails extends Vue {
|
|||||||
{
|
{
|
||||||
group: "alert",
|
group: "alert",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
title: "Error",
|
title: "Unavailable",
|
||||||
text: "You cannot assign both to a project and to a recipient.",
|
text: "You cannot assign both to a project and to a recipient.",
|
||||||
},
|
},
|
||||||
3000,
|
3000,
|
||||||
@@ -654,31 +757,6 @@ export default class GiftedDetails extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyUserOfRecipient() {
|
|
||||||
if (!this.recipientDid) {
|
|
||||||
this.$notify(
|
|
||||||
{
|
|
||||||
group: "alert",
|
|
||||||
type: "warning",
|
|
||||||
title: "Error",
|
|
||||||
text: "To assign to a recipient, you must open this page from a contact.",
|
|
||||||
},
|
|
||||||
3000,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// must be because givenToProject is true
|
|
||||||
this.$notify(
|
|
||||||
{
|
|
||||||
group: "alert",
|
|
||||||
type: "warning",
|
|
||||||
title: "Error",
|
|
||||||
text: "You cannot assign both to a recipient and to a project.",
|
|
||||||
},
|
|
||||||
3000,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param giverDid may be null
|
* @param giverDid may be null
|
||||||
@@ -688,6 +766,7 @@ export default class GiftedDetails extends Vue {
|
|||||||
*/
|
*/
|
||||||
public async recordGive() {
|
public async recordGive() {
|
||||||
try {
|
try {
|
||||||
|
const giverDid = this.providedByGiver ? this.giverDid : undefined;
|
||||||
const recipientDid = this.givenToRecipient
|
const recipientDid = this.givenToRecipient
|
||||||
? this.recipientDid
|
? this.recipientDid
|
||||||
: undefined;
|
: undefined;
|
||||||
@@ -702,7 +781,7 @@ export default class GiftedDetails extends Vue {
|
|||||||
this.apiServer,
|
this.apiServer,
|
||||||
this.prevCredToEdit,
|
this.prevCredToEdit,
|
||||||
this.activeDid,
|
this.activeDid,
|
||||||
this.giverDid,
|
giverDid,
|
||||||
recipientDid,
|
recipientDid,
|
||||||
this.description,
|
this.description,
|
||||||
parseFloat(this.amountInput),
|
parseFloat(this.amountInput),
|
||||||
@@ -718,7 +797,7 @@ export default class GiftedDetails extends Vue {
|
|||||||
this.axios,
|
this.axios,
|
||||||
this.apiServer,
|
this.apiServer,
|
||||||
this.activeDid,
|
this.activeDid,
|
||||||
this.giverDid,
|
giverDid,
|
||||||
recipientDid,
|
recipientDid,
|
||||||
this.description,
|
this.description,
|
||||||
parseFloat(this.amountInput),
|
parseFloat(this.amountInput),
|
||||||
@@ -783,13 +862,14 @@ export default class GiftedDetails extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructGiveParam() {
|
constructGiveParam() {
|
||||||
|
const giverDid = this.providedByGiver ? this.giverDid : undefined;
|
||||||
const recipientDid = this.givenToRecipient ? this.recipientDid : undefined;
|
const recipientDid = this.givenToRecipient ? this.recipientDid : undefined;
|
||||||
const fulfillsProjectId = this.givenToProject
|
const fulfillsProjectId = this.givenToProject
|
||||||
? this.fulfillsProjectId
|
? this.fulfillsProjectId
|
||||||
: undefined;
|
: undefined;
|
||||||
const giveClaim = hydrateGive(
|
const giveClaim = hydrateGive(
|
||||||
this.prevCredToEdit?.claim as GiveVerifiableCredential,
|
this.prevCredToEdit?.claim as GiveVerifiableCredential,
|
||||||
this.giverDid,
|
giverDid,
|
||||||
recipientDid,
|
recipientDid,
|
||||||
this.description,
|
this.description,
|
||||||
parseFloat(this.amountInput),
|
parseFloat(this.amountInput),
|
||||||
|
|||||||
@@ -224,7 +224,7 @@
|
|||||||
<button
|
<button
|
||||||
data-testId="offerButton"
|
data-testId="offerButton"
|
||||||
@click="openOfferDialog()"
|
@click="openOfferDialog()"
|
||||||
class="block w-full bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white rounded-md"
|
class="block w-full bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1 rounded-md"
|
||||||
>
|
>
|
||||||
Offer to this (maybe with conditions)...
|
Offer to this (maybe with conditions)...
|
||||||
</button>
|
</button>
|
||||||
@@ -305,7 +305,7 @@
|
|||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<button
|
<button
|
||||||
@click="openGiftDialogToProject()"
|
@click="openGiftDialogToProject()"
|
||||||
class="block w-full bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white rounded-md"
|
class="block w-full bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1rounded-md"
|
||||||
>
|
>
|
||||||
Given To This...
|
Given To This...
|
||||||
</button>
|
</button>
|
||||||
@@ -392,7 +392,7 @@
|
|||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<button
|
<button
|
||||||
@click="openGiftDialogFromProject()"
|
@click="openGiftDialogFromProject()"
|
||||||
class="block w-full bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white rounded-md"
|
class="block w-full bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1 rounded-md"
|
||||||
>
|
>
|
||||||
Given By This...
|
Given By This...
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ test('Record item given from image-share', async ({ page }) => {
|
|||||||
await page.getByPlaceholder('What was received').fill(finalTitle);
|
await page.getByPlaceholder('What was received').fill(finalTitle);
|
||||||
await page.getByRole('spinbutton').fill('2');
|
await page.getByRole('spinbutton').fill('2');
|
||||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||||
|
|
||||||
|
// we end up on a page with the onboarding info
|
||||||
|
await page.getByTestId('closeOnboardingAndFinish').click();
|
||||||
|
|
||||||
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
||||||
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user