@ -71,17 +71,17 @@
< textarea
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 px-3 py-2"
rows = "5"
v - model = "fullClaim.description"
maxlength = "5000"
> < / textarea >
< div class = "text-xs text-slate-500 italic -mt-3 mb-4 " >
< div class = "text-xs text-slate-500 italic" >
If you want to be contacted , be sure to include your contact information
-- just remember that this information is public and saved in a public
history .
< / div >
< div class = "text-xs text-slate-500 italic -mt-3 mb-4 " >
< div class = "text-xs text-slate-500 italic" >
{ { fullClaim . description ? . length } } / 5000 max . characters
< / div >
@ -89,28 +89,55 @@
v - model = "fullClaim.url"
placeholder = "Website"
autocapitalize = "none"
class = "block w-full rounded border border-slate-400 mb -4 px-3 py-2"
class = "block w-full rounded border border-slate-400 mt -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"
placeholder = "Start Time"
v - model = "startTimeInput"
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 mt-4" >
< span class = "mr-2" > Starts At < / span >
< input
v - model = "startDateInput"
placeholder = "Start Date"
type = "date"
class = "rounded border border-slate-400 px-3 py-2"
/ >
< input
: disabled = "!startDateInput"
placeholder = "Start Time"
v - model = "startTimeInput"
type = "time"
class = "rounded border border-slate-400 ml-2 px-3 py-2"
/ >
< / div >
< div class = "flex w-full justify-end items-center" >
< span class = "w-full flex justify-end items-center" >
{ { zoneName } } time zone
< / span >
< / div >
< div class = "flex items-center" >
< div class = "mr-2" >
< span > Ends at < / span >
< / div >
< input
v - model = "endDateInput"
placeholder = "End Date"
type = "date"
class = "ml-2 rounded border border-slate-400 px-3 py-2"
/ >
< input
: disabled = "!endDateInput"
placeholder = "End Time"
v - model = "endTimeInput"
type = "time"
class = "rounded border border-slate-400 ml-2 px-3 py-2"
/ >
< / div >
< / div >
< div
class = "flex items-center mb-4"
class = "flex items-center mt -4"
@ click = "includeLocation = !includeLocation"
>
< input type = "checkbox" class = "mr-2" v -model = " includeLocation " / >
@ -203,17 +230,7 @@ import "leaflet/dist/leaflet.css";
import { AxiosError , AxiosRequestHeaders } from "axios" ;
import { DateTime } from "luxon" ;
import { hexToBytes } from "@noble/hashes/utils" ;
/ / t h e s e c o r e i m p o r t s c o u l d a l s o b e i n c l u d e d a s " i m p o r t t y p e . . . "
import {
EventTemplate ,
UnsignedEvent ,
VerifiedEvent ,
} from "nostr-tools/lib/types/core" ;
import {
accountFromExtendedKey ,
extendedKeysFromSeedWords ,
} from "nostr-tools/nip06" ;
import { finalizeEvent , serializeEvent } from "nostr-tools/pure" ;
import { finalizeEvent , serializeEvent } from "nostr-tools" ;
import { Component , Vue } from "vue-facing-decorator" ;
import { LMap , LMarker , LTileLayer } from "@vue-leaflet/vue-leaflet" ;
import { RouteLocationNormalizedLoaded , Router } from "vue-router" ;
@ -251,6 +268,8 @@ export default class NewEditProjectView extends Vue {
activeDid = "" ;
agentDid = "" ;
apiServer = "" ;
endDateInput ? : string ;
endTimeInput ? : string ;
errorMessage = "" ;
fullClaim : PlanVerifiableCredential = {
"@context" : "https://schema.org" ,
@ -325,6 +344,13 @@ export default class NewEditProjectView extends Vue {
this . startDateInput = localDateTime . toFormat ( "yyyy-MM-dd" ) ;
this . startTimeInput = localDateTime . toFormat ( "HH:mm" ) ;
}
if ( this . fullClaim . endTime ) {
const localDateTime = DateTime . fromISO (
this . fullClaim . endTime as string ,
) . toLocal ( ) ;
this . endDateInput = localDateTime . toFormat ( "yyyy-MM-dd" ) ;
this . endTimeInput = localDateTime . toFormat ( "HH:mm" ) ;
}
}
} catch ( error ) {
console . error ( "Got error retrieving that project" , error ) ;
@ -460,7 +486,7 @@ export default class NewEditProjectView extends Vue {
group : "alert" ,
type : "danger" ,
title : "Date Error" ,
text : "The date was invalid so it was not set." ,
text : "The start date was invalid so it was not set." ,
} ,
5000 ,
) ;
@ -468,6 +494,28 @@ export default class NewEditProjectView extends Vue {
} else {
delete vcClaim . startTime ;
}
if ( this . endDateInput ) {
try {
const endTimeFull = this . endTimeInput || "23:59:59" ;
const fullTimeString = this . endDateInput + " " + endTimeFull ;
/ / t h r o w a n e r r o r o n a n i n v a l i d d a t e o r t i m e s t r i n g
vcClaim . endTime = new Date ( fullTimeString ) . toISOString ( ) ; / / e n s u r e t i m e z o n e i s p a r t o f i t
} catch {
/ / i t ' s n o t a v a l i d d a t e s o e r a s e i t a n d t e l l t h e u s e r
delete vcClaim . endTime ;
this . $notify (
{
group : "alert" ,
type : "danger" ,
title : "Date Error" ,
text : "The end date was invalid so it was not set." ,
} ,
5000 ,
) ;
}
} else {
delete vcClaim . endTime ;
}
const vcJwt = await createEndorserJwtVcFromClaim ( this . activeDid , vcClaim ) ;
/ / M a k e t h e x h r r e q u e s t p a y l o a d