forked from trent_larson/crowd-funder-for-time-pwa
allow an agent to edit a project
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TimeSafari_Test",
|
"name": "TimeSafari_Test",
|
||||||
"version": "0.2.7",
|
"version": "0.2.8-beta",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
- allow agent to edit a project
|
- choose an agent - make a contact chooser
|
||||||
|
- remove fullIri
|
||||||
|
- eliminate setTimeout calls (like we did in NewEditProjectView.vue)
|
||||||
- make set-name request yellow
|
- make set-name request yellow
|
||||||
- make the "give" on contact screen work like other give (allowing donation vs current blank)
|
- make the "give" on contact screen work like other give (allowing donation vs current blank)
|
||||||
- create an identifier automatically, with a message that they can import a different one
|
- create an identifier automatically, with a message that they can import a different one
|
||||||
|
|||||||
@@ -116,7 +116,8 @@ export interface PlanVerifiableCredential {
|
|||||||
"@context": "https://schema.org";
|
"@context": "https://schema.org";
|
||||||
"@type": "PlanAction";
|
"@type": "PlanAction";
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
agent?: { identifier: string };
|
||||||
|
description?: string;
|
||||||
identifier?: string;
|
identifier?: string;
|
||||||
location?: {
|
location?: {
|
||||||
geo: { "@type": "GeoCoordinates"; latitude: number; longitude: number };
|
geo: { "@type": "GeoCoordinates"; latitude: number; longitude: number };
|
||||||
|
|||||||
@@ -232,6 +232,13 @@
|
|||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<h2 class="text-xl font-semibold">
|
||||||
|
How do I get higher limits?
|
||||||
|
</h2>
|
||||||
|
<p>
|
||||||
|
Let's talk. Contact us (below).
|
||||||
|
</p>
|
||||||
|
|
||||||
<h2 class="text-xl font-semibold">
|
<h2 class="text-xl font-semibold">
|
||||||
How do I access even more functionality?
|
How do I access even more functionality?
|
||||||
</h2>
|
</h2>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2"
|
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2"
|
||||||
v-model="mnemonic"
|
v-model="mnemonic"
|
||||||
/>
|
/>
|
||||||
{{ mnemonic }}
|
|
||||||
<h3
|
<h3
|
||||||
class="text-sm uppercase font-semibold mb-3"
|
class="text-sm uppercase font-semibold mb-3"
|
||||||
@click="showAdvanced = !showAdvanced"
|
@click="showAdvanced = !showAdvanced"
|
||||||
|
|||||||
@@ -29,6 +29,23 @@
|
|||||||
v-model="fullClaim.name"
|
v-model="fullClaim.name"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="Other Authorized Representative"
|
||||||
|
class="block w-full rounded border border-slate-400 px-3 py-2"
|
||||||
|
v-model="agentDid"
|
||||||
|
/>
|
||||||
|
<div class="mb-4">
|
||||||
|
<p v-if="activeDid != projectIssuerDid && agentDid != projectIssuerDid">
|
||||||
|
<span class="text-red-500">Beware!</span>
|
||||||
|
If you save this, the original project owner will no longer be able to
|
||||||
|
edit it.
|
||||||
|
<button @click="agentDid = projectIssuerDid" class="text-blue-500">
|
||||||
|
Click here to make the original owner an authorized representative.
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<textarea
|
<textarea
|
||||||
placeholder="Description"
|
placeholder="Description"
|
||||||
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2"
|
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2"
|
||||||
@@ -57,8 +74,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="includeLocation" style="height: 600px; width: 800px">
|
<div v-if="includeLocation" style="height: 600px; width: 800px">
|
||||||
<div class="px-2 py-2">
|
<div class="px-2 py-2">
|
||||||
For your security, we recommend you choose a location nearby but not
|
For your security, choose a location nearby but not exactly at the
|
||||||
exactly at the place.
|
place.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<l-map
|
<l-map
|
||||||
@@ -98,7 +115,7 @@
|
|||||||
<span :class="{ hidden: isHiddenSpinner }">
|
<span :class="{ hidden: isHiddenSpinner }">
|
||||||
<!-- icon no worky? -->
|
<!-- icon no worky? -->
|
||||||
<i class="fa-solid fa-spinner fa-spin-pulse"></i>
|
<i class="fa-solid fa-spinner fa-spin-pulse"></i>
|
||||||
Saving…</span
|
Saving...</span
|
||||||
>
|
>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
@@ -141,6 +158,7 @@ export default class NewEditProjectView extends Vue {
|
|||||||
$notify!: (notification: Notification, timeout?: number) => void;
|
$notify!: (notification: Notification, timeout?: number) => void;
|
||||||
|
|
||||||
activeDid = "";
|
activeDid = "";
|
||||||
|
agentDid = "";
|
||||||
apiServer = "";
|
apiServer = "";
|
||||||
errorMessage = "";
|
errorMessage = "";
|
||||||
fullClaim: PlanVerifiableCredential = {
|
fullClaim: PlanVerifiableCredential = {
|
||||||
@@ -153,6 +171,7 @@ export default class NewEditProjectView extends Vue {
|
|||||||
latitude = 0;
|
latitude = 0;
|
||||||
longitude = 0;
|
longitude = 0;
|
||||||
numAccounts = 0;
|
numAccounts = 0;
|
||||||
|
projectIssuerDid = "";
|
||||||
zoom = 2;
|
zoom = 2;
|
||||||
|
|
||||||
async beforeCreate() {
|
async beforeCreate() {
|
||||||
@@ -224,12 +243,16 @@ export default class NewEditProjectView extends Vue {
|
|||||||
try {
|
try {
|
||||||
const resp = await this.axios.get(url, { headers });
|
const resp = await this.axios.get(url, { headers });
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
|
this.projectIssuerDid = resp.data.issuer;
|
||||||
this.fullClaim = resp.data.claim;
|
this.fullClaim = resp.data.claim;
|
||||||
if (this.fullClaim?.location) {
|
if (this.fullClaim?.location) {
|
||||||
this.includeLocation = true;
|
this.includeLocation = true;
|
||||||
this.latitude = this.fullClaim.location.geo.latitude;
|
this.latitude = this.fullClaim.location.geo.latitude;
|
||||||
this.longitude = this.fullClaim.location.geo.longitude;
|
this.longitude = this.fullClaim.location.geo.longitude;
|
||||||
}
|
}
|
||||||
|
if (this.fullClaim?.agent?.identifier) {
|
||||||
|
this.agentDid = this.fullClaim.agent.identifier;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Got error retrieving that project", error);
|
console.error("Got error retrieving that project", error);
|
||||||
@@ -242,6 +265,11 @@ export default class NewEditProjectView extends Vue {
|
|||||||
if (this.projectId) {
|
if (this.projectId) {
|
||||||
vcClaim.identifier = this.projectId;
|
vcClaim.identifier = this.projectId;
|
||||||
}
|
}
|
||||||
|
if (this.agentDid) {
|
||||||
|
vcClaim.agent = {
|
||||||
|
identifier: this.agentDid,
|
||||||
|
};
|
||||||
|
}
|
||||||
if (this.includeLocation) {
|
if (this.includeLocation) {
|
||||||
vcClaim.location = {
|
vcClaim.location = {
|
||||||
geo: {
|
geo: {
|
||||||
@@ -290,18 +318,15 @@ export default class NewEditProjectView extends Vue {
|
|||||||
|
|
||||||
// handleId is new in server v release-1.6.0; remove fullIri when that
|
// handleId is new in server v release-1.6.0; remove fullIri when that
|
||||||
// version shows up here: https://api.endorser.ch/api-docs/
|
// version shows up here: https://api.endorser.ch/api-docs/
|
||||||
useAppStore().setProjectId(
|
useAppStore()
|
||||||
|
.setProjectId(
|
||||||
resp.data.success.handleId || resp.data.success.fullIri,
|
resp.data.success.handleId || resp.data.success.fullIri,
|
||||||
);
|
)
|
||||||
setTimeout(
|
.then(() => {
|
||||||
function (that: NewEditProjectView) {
|
this.$router.push({ name: "project" });
|
||||||
that.$router.push({ name: "project" });
|
});
|
||||||
},
|
|
||||||
2000,
|
|
||||||
this,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.error(
|
||||||
"Got unexpected 'data' inside response from server",
|
"Got unexpected 'data' inside response from server",
|
||||||
resp,
|
resp,
|
||||||
);
|
);
|
||||||
@@ -321,7 +346,7 @@ export default class NewEditProjectView extends Vue {
|
|||||||
error?: { message?: string };
|
error?: { message?: string };
|
||||||
}>;
|
}>;
|
||||||
if (serverError) {
|
if (serverError) {
|
||||||
console.log("Got error from server", serverError);
|
console.error("Got error from server", serverError);
|
||||||
if (Object.prototype.hasOwnProperty.call(serverError, "message")) {
|
if (Object.prototype.hasOwnProperty.call(serverError, "message")) {
|
||||||
userMessage = serverError.response?.data?.error?.message || ""; // This is info for the user.
|
userMessage = serverError.response?.data?.error?.message || ""; // This is info for the user.
|
||||||
this.$notify(
|
this.$notify(
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
v-if="issuer == activeDid"
|
v-if="activeDid === issuer || activeDid === agentDid"
|
||||||
type="button"
|
type="button"
|
||||||
class="block w-full text-center text-md uppercase bg-slate-500 text-white px-1.5 py-2 rounded-md"
|
class="block w-full text-center text-md uppercase bg-slate-500 text-white px-1.5 py-2 rounded-md"
|
||||||
@click="onEditClick()"
|
@click="onEditClick()"
|
||||||
@@ -318,6 +318,7 @@ export default class ProjectViewView extends Vue {
|
|||||||
$notify!: (notification: Notification, timeout?: number) => void;
|
$notify!: (notification: Notification, timeout?: number) => void;
|
||||||
|
|
||||||
activeDid = "";
|
activeDid = "";
|
||||||
|
agentDid = "";
|
||||||
allMyDids: Array<string> = [];
|
allMyDids: Array<string> = [];
|
||||||
allContacts: Array<Contact> = [];
|
allContacts: Array<Contact> = [];
|
||||||
apiServer = "";
|
apiServer = "";
|
||||||
@@ -425,6 +426,7 @@ export default class ProjectViewView extends Vue {
|
|||||||
const now = moment.now();
|
const now = moment.now();
|
||||||
this.timeSince = moment.utc(now).to(eventDate);
|
this.timeSince = moment.utc(now).to(eventDate);
|
||||||
}
|
}
|
||||||
|
this.agentDid = resp.data.claim?.agent?.identifier;
|
||||||
this.issuer = resp.data.issuer;
|
this.issuer = resp.data.issuer;
|
||||||
this.name = resp.data.claim?.name || "(no name)";
|
this.name = resp.data.claim?.name || "(no name)";
|
||||||
this.description = resp.data.claim?.description || "(no description)";
|
this.description = resp.data.claim?.description || "(no description)";
|
||||||
|
|||||||
Reference in New Issue
Block a user