|
|
@ -64,6 +64,23 @@ |
|
|
|
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2" |
|
|
|
/> |
|
|
|
|
|
|
|
<div class="flex mb-4 columns-3 w-full"> |
|
|
|
<input |
|
|
|
v-model="startDateInput" |
|
|
|
placeholder="Start Date" |
|
|
|
type="date" |
|
|
|
class="col-span-1 w-full rounded border border-slate-400 px-3 py-2" |
|
|
|
/> |
|
|
|
<input |
|
|
|
:disabled="!startDateInput" |
|
|
|
v-model="startTimeInput" |
|
|
|
placeholder="Start Time" |
|
|
|
type="time" |
|
|
|
class="col-span-1 w-full rounded border border-slate-400 ml-2 px-3 py-2" |
|
|
|
/> |
|
|
|
<span class="col-span-1 w-full flex justify-center">{{ zoneName }}</span> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="flex items-center mb-4"> |
|
|
|
<input |
|
|
|
type="checkbox" |
|
|
@ -137,6 +154,7 @@ |
|
|
|
import "leaflet/dist/leaflet.css"; |
|
|
|
import { AxiosError } from "axios"; |
|
|
|
import * as didJwt from "did-jwt"; |
|
|
|
import { DateTime } from "luxon"; |
|
|
|
import { Component, Vue } from "vue-facing-decorator"; |
|
|
|
import { LMap, LMarker, LTileLayer } from "@vue-leaflet/vue-leaflet"; |
|
|
|
|
|
|
@ -174,6 +192,9 @@ export default class NewEditProjectView extends Vue { |
|
|
|
numAccounts = 0; |
|
|
|
projectId = localStorage.getItem("projectId") || ""; |
|
|
|
projectIssuerDid = ""; |
|
|
|
startDateInput?: string; |
|
|
|
startTimeInput?: string; |
|
|
|
zoneName = DateTime.local().zoneName; |
|
|
|
zoom = 2; |
|
|
|
|
|
|
|
async beforeCreate() { |
|
|
@ -252,6 +273,13 @@ export default class NewEditProjectView extends Vue { |
|
|
|
if (this.fullClaim?.agent?.identifier) { |
|
|
|
this.agentDid = this.fullClaim.agent.identifier; |
|
|
|
} |
|
|
|
if (this.fullClaim.startTime) { |
|
|
|
const localDateTime = DateTime.fromISO( |
|
|
|
this.fullClaim.startTime as string, |
|
|
|
).toLocal(); |
|
|
|
this.startDateInput = localDateTime.toFormat("yyyy-MM-dd"); |
|
|
|
this.startTimeInput = localDateTime.toFormat("HH:mm"); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error("Got error retrieving that project", error); |
|
|
@ -282,6 +310,28 @@ export default class NewEditProjectView extends Vue { |
|
|
|
} else { |
|
|
|
delete vcClaim.location; |
|
|
|
} |
|
|
|
if (this.startDateInput) { |
|
|
|
try { |
|
|
|
const startTimeFull = this.startTimeInput || "00:00:00"; |
|
|
|
const fullTimeString = this.startDateInput + " " + startTimeFull; |
|
|
|
// throw an error on an invalid date or time string |
|
|
|
vcClaim.startTime = new Date(fullTimeString).toISOString(); // ensure timezone is part of it |
|
|
|
} catch { |
|
|
|
// it's not a valid date so erase it and tell the user |
|
|
|
delete vcClaim.startTime; |
|
|
|
this.$notify( |
|
|
|
{ |
|
|
|
group: "alert", |
|
|
|
type: "danger", |
|
|
|
title: "Error", |
|
|
|
text: "The date was invalid so it was not set.", |
|
|
|
}, |
|
|
|
5000, |
|
|
|
); |
|
|
|
} |
|
|
|
} else { |
|
|
|
delete vcClaim.startTime; |
|
|
|
} |
|
|
|
// Make a payload for the claim |
|
|
|
const vcPayload = { |
|
|
|
vc: { |
|
|
|