|
@ -52,12 +52,23 @@ |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="flex justify-center mb-4 mt-4"> |
|
|
<div class="flex justify-center mb-4 mt-4"> |
|
|
|
|
|
<span v-if="imageUrl"> |
|
|
|
|
|
Includes Image: |
|
|
|
|
|
<a :href="imageUrl" target="_blank" class="text-blue-500 ml-4">View</a> |
|
|
|
|
|
<fa |
|
|
|
|
|
icon="trash-can" |
|
|
|
|
|
@click="confirmDeleteImage" |
|
|
|
|
|
class="text-red-500 fa-fw ml-8" |
|
|
|
|
|
/> |
|
|
|
|
|
</span> |
|
|
|
|
|
<span v-else> |
|
|
<router-link |
|
|
<router-link |
|
|
:to="{ name: 'gifted-photo' }" |
|
|
:to="{ name: 'gifted-photo' }" |
|
|
class="bg-blue-500 text-white px-1.5 py-1 rounded-md" |
|
|
class="bg-blue-500 text-white px-1.5 py-1 rounded-md" |
|
|
> |
|
|
> |
|
|
<fa icon="camera" class="fa-fw" /> |
|
|
<fa icon="camera" class="fa-fw" /> |
|
|
</router-link> |
|
|
</router-link> |
|
|
|
|
|
</span> |
|
|
</div> |
|
|
</div> |
|
|
<div class="mt-4"> |
|
|
<div class="mt-4"> |
|
|
<input type="checkbox" class="h-6 w-6 mr-2" v-model="givenToUser" /> |
|
|
<input type="checkbox" class="h-6 w-6 mr-2" v-model="givenToUser" /> |
|
@ -88,13 +99,14 @@ |
|
|
<script lang="ts"> |
|
|
<script lang="ts"> |
|
|
import { Component, Vue } from "vue-facing-decorator"; |
|
|
import { Component, Vue } from "vue-facing-decorator"; |
|
|
|
|
|
|
|
|
import { NotificationIface } from "@/constants/app"; |
|
|
import { DEFAULT_IMAGE_API_SERVER, NotificationIface } from "@/constants/app"; |
|
|
import QuickNav from "@/components/QuickNav.vue"; |
|
|
import QuickNav from "@/components/QuickNav.vue"; |
|
|
import TopMessage from "@/components/TopMessage.vue"; |
|
|
import TopMessage from "@/components/TopMessage.vue"; |
|
|
import { db } from "@/db/index"; |
|
|
import { db } from "@/db/index"; |
|
|
import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings"; |
|
|
import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings"; |
|
|
import { createAndSubmitGive } from "@/libs/endorserServer"; |
|
|
import { createAndSubmitGive } from "@/libs/endorserServer"; |
|
|
import * as libsUtil from "@/libs/util"; |
|
|
import * as libsUtil from "@/libs/util"; |
|
|
|
|
|
import { accessToken } from "@/libs/crypto"; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
components: { |
|
|
components: { |
|
@ -113,6 +125,7 @@ export default class GiftedDetails extends Vue { |
|
|
givenToUser = false; |
|
|
givenToUser = false; |
|
|
giverDid: string | undefined; |
|
|
giverDid: string | undefined; |
|
|
giverName = ""; |
|
|
giverName = ""; |
|
|
|
|
|
imageUrl = ""; |
|
|
isTrade = false; |
|
|
isTrade = false; |
|
|
message = ""; |
|
|
message = ""; |
|
|
offerId = ""; |
|
|
offerId = ""; |
|
@ -126,6 +139,7 @@ export default class GiftedDetails extends Vue { |
|
|
this.description = this.$route.query.description as string; |
|
|
this.description = this.$route.query.description as string; |
|
|
this.giverDid = this.$route.query.giverDid as string; |
|
|
this.giverDid = this.$route.query.giverDid as string; |
|
|
this.giverName = this.$route.query.giverName as string; |
|
|
this.giverName = this.$route.query.giverName as string; |
|
|
|
|
|
this.imageUrl = localStorage.getItem("imageUrl") || ""; |
|
|
this.message = this.$route.query.message as string; |
|
|
this.message = this.$route.query.message as string; |
|
|
this.offerId = this.$route.query.offerId as string; |
|
|
this.offerId = this.$route.query.offerId as string; |
|
|
this.projectId = this.$route.query.projectId as string; |
|
|
this.projectId = this.$route.query.projectId as string; |
|
@ -173,6 +187,57 @@ export default class GiftedDetails extends Vue { |
|
|
this.$router.back(); |
|
|
this.$router.back(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
confirmDeleteImage() { |
|
|
|
|
|
this.$notify( |
|
|
|
|
|
{ |
|
|
|
|
|
group: "modal", |
|
|
|
|
|
type: "confirm", |
|
|
|
|
|
title: "Are you sure you want to delete the image?", |
|
|
|
|
|
text: "", |
|
|
|
|
|
onYes: this.deleteImage, |
|
|
|
|
|
}, |
|
|
|
|
|
-1, |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async deleteImage() { |
|
|
|
|
|
const identity = await libsUtil.getIdentity(this.activeDid); |
|
|
|
|
|
const token = await accessToken(identity); |
|
|
|
|
|
const response = await this.axios.delete( |
|
|
|
|
|
DEFAULT_IMAGE_API_SERVER + "/image/" + encodeURIComponent(this.imageUrl), |
|
|
|
|
|
{ |
|
|
|
|
|
headers: { |
|
|
|
|
|
Authorization: `Bearer ${token}`, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
if (response.status === 204) { |
|
|
|
|
|
this.$notify( |
|
|
|
|
|
{ |
|
|
|
|
|
group: "alert", |
|
|
|
|
|
type: "success", |
|
|
|
|
|
title: "Deleted", |
|
|
|
|
|
text: "That image record was deleted.", |
|
|
|
|
|
}, |
|
|
|
|
|
5000, |
|
|
|
|
|
); |
|
|
|
|
|
} else { |
|
|
|
|
|
console.error("Error deleting image:", response); |
|
|
|
|
|
this.$notify( |
|
|
|
|
|
{ |
|
|
|
|
|
group: "alert", |
|
|
|
|
|
type: "danger", |
|
|
|
|
|
title: "Error", |
|
|
|
|
|
text: "There was an error deleting the image.", |
|
|
|
|
|
}, |
|
|
|
|
|
5000, |
|
|
|
|
|
); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
localStorage.removeItem("imageUrl"); |
|
|
|
|
|
this.imageUrl = ""; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
async confirm() { |
|
|
async confirm() { |
|
|
this.$notify( |
|
|
this.$notify( |
|
|
{ |
|
|
{ |
|
|