refactor to remove fields that cache & duplicate some functions
This commit is contained in:
@@ -31,10 +31,10 @@
|
||||
<div class="truncate">
|
||||
From
|
||||
{{
|
||||
givenByProjectFunction()
|
||||
givenByProject()
|
||||
? providerProjectName
|
||||
: // check for DID because name could be "Unnamed"
|
||||
givenByPersonFunction() && giverDid
|
||||
givenByPerson() && giverDid
|
||||
? giverName
|
||||
: "someone not named"
|
||||
}}
|
||||
@@ -42,9 +42,10 @@
|
||||
<div class="truncate">
|
||||
to
|
||||
{{
|
||||
givenToProject
|
||||
givenToProject()
|
||||
? fulfillsProjectName
|
||||
: givenToRecipient
|
||||
: // check for DID because name could be "Unnamed"
|
||||
givenToPerson() && recipientDid
|
||||
? recipientName
|
||||
: "someone not named"
|
||||
}}
|
||||
@@ -114,9 +115,9 @@
|
||||
<div class="flex items-center">
|
||||
<label class="text-sm flex-1">
|
||||
{{
|
||||
givenByProjectFunction() && providerProjectName
|
||||
givenByProject() && providerProjectName
|
||||
? "From " + providerProjectName
|
||||
: givenByPersonFunction() && giverName
|
||||
: givenByPerson() && giverName
|
||||
? "From " + giverName
|
||||
: "Unnamed giver"
|
||||
}}
|
||||
@@ -169,9 +170,9 @@
|
||||
<div class="flex items-center">
|
||||
<label class="text-sm flex-1">
|
||||
{{
|
||||
givenToProjectFunction() && fulfillsProjectName
|
||||
givenToProject() && fulfillsProjectName
|
||||
? "To " + fulfillsProjectName
|
||||
: givenToPersonFunction() && recipientName
|
||||
: givenToPerson() && recipientName
|
||||
? "To " + recipientName
|
||||
: "Unnamed recipient"
|
||||
}}
|
||||
@@ -309,8 +310,6 @@ export default class GiftedDetails extends Vue {
|
||||
destinationPathAfter = "";
|
||||
fulfillsProjectId = "";
|
||||
fulfillsProjectName = "a project";
|
||||
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)
|
||||
giverDid = "";
|
||||
giverName = "";
|
||||
hideBackButton = false;
|
||||
@@ -468,9 +467,6 @@ export default class GiftedDetails extends Vue {
|
||||
);
|
||||
}
|
||||
}
|
||||
// these should be functions but something's wrong with the syntax in the <> conditional
|
||||
this.givenToProject = !!this.fulfillsProjectId;
|
||||
this.givenToRecipient = !this.givenToProject && !!this.recipientDid;
|
||||
|
||||
this.showGeneralAdvanced = !!settings.showGeneralAdvanced;
|
||||
|
||||
@@ -498,19 +494,19 @@ export default class GiftedDetails extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
givenByPersonFunction() {
|
||||
givenByPerson() {
|
||||
return !!this.giverDid;
|
||||
}
|
||||
|
||||
givenByProjectFunction() {
|
||||
givenByProject() {
|
||||
return !!this.providerProjectId;
|
||||
}
|
||||
|
||||
givenToPersonFunction() {
|
||||
givenToPerson() {
|
||||
return !!this.recipientDid;
|
||||
}
|
||||
|
||||
givenToProjectFunction() {
|
||||
givenToProject() {
|
||||
return !!this.fulfillsProjectId;
|
||||
}
|
||||
|
||||
@@ -660,7 +656,7 @@ export default class GiftedDetails extends Vue {
|
||||
TIMEOUTS.SHORT,
|
||||
);
|
||||
} else {
|
||||
// must be because givenToProject is true
|
||||
// must be because givenToProject() is true
|
||||
this.notify.warning(
|
||||
"You cannot assign both to a recipient and to a project.",
|
||||
TIMEOUTS.SHORT,
|
||||
@@ -837,12 +833,12 @@ export default class GiftedDetails extends Vue {
|
||||
* Computed property for current receiver entity data
|
||||
*/
|
||||
get currentReceiver() {
|
||||
if (this.givenToProject && this.fulfillsProjectId) {
|
||||
if (this.givenToProject() && this.fulfillsProjectId) {
|
||||
return {
|
||||
handleId: this.fulfillsProjectId,
|
||||
name: this.fulfillsProjectName,
|
||||
};
|
||||
} else if (this.givenToRecipient && this.recipientDid) {
|
||||
} else if (this.givenToPerson() && this.recipientDid) {
|
||||
return {
|
||||
did: this.recipientDid,
|
||||
name: this.recipientName,
|
||||
|
||||
Reference in New Issue
Block a user