Skip to content

Commit

Permalink
bug fix when rendering in 'submit report'
Browse files Browse the repository at this point in the history
  • Loading branch information
LocalNewsTV committed Nov 6, 2023
1 parent de7909a commit 1ae6ffe
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,37 @@ Licensed under the Apache License, Version 2.0 (the "License");
</div>
</b-col>
</b-row>
<b-table
hover
:fields="['well_number', 'well_label', 'date_of_action', 'document_status', 'uploaded_document', 'delete']"
striped
:items="[...uploadedFiles.public, ...uploadedFiles.private]"
>
<template v-slot:cell(well_label)="data">
{{ callLongFormLabel(data.item.well_label) }}
</template>
<template v-slot:cell(date_of_action)="data">
{{ data.item.date_of_action !== -1 ? new Date(data.item.date_of_action).toLocaleDateString() : "Date Unknown" }}
</template>
<template v-slot:cell(uploaded_document)="data">
<a :href="data.item.url" target="_blank">{{ data.item.name }}</a>
</template>
<template v-slot:cell(document_status)="data">
<p v-if="data.item.document_status">Private Document</p>
<p v-else>Public Document</p>
</template>
<template v-slot:cell(delete)="data">
<a
class="fa fa-trash fa-lg"
variant="primary"
style="margin-left: .5em"
href="#"
@click="handleFileDelete(data.item.name, data.item.document_status, $event)"
/>
</template>
</b-table>
<div class="table-responsive" id="attachmentsTable">
<div v-if="uploadedFiles && uploadedFiles.private && uploadedFiles.public" class="table-responsive">
<b-table
hover
:fields="['well_number', 'well_label', 'date_of_action', 'document_status', 'uploaded_document', 'delete']"
striped
:items="[...uploadedFiles.public, ...uploadedFiles.private]"
>
<template v-slot:cell(well_label)="data">
{{ callLongFormLabel(data.item.well_label) }}
</template>
<template v-slot:cell(date_of_action)="data">
{{ data.item.date_of_action !== -1 ? new Date(data.item.date_of_action).toLocaleDateString() : "Date Unknown" }}
</template>
<template v-slot:cell(uploaded_document)="data">
<a :href="data.item.url" :download="data.item.name" target="_blank">{{ data.item.name }}</a>
</template>
<template v-slot:cell(document_status)="data">
<p v-if="data.item.document_status">Private Document</p>
<p v-else>Public Document</p>
</template>
<template v-slot:cell(delete)="data">
<a
class="fa fa-trash fa-lg"
variant="primary"
style="margin-left: .5em"
href="#"
@click="handleFileDelete(data.item.name, data.item.document_status, $event)"></a>
</template>
</b-table>
</div>
<div class="table-responsive" id="attachmentsTable" v-if="attachmentsData">
<table class="table table-sm" aria-describedby="attachmentsDetails">
<thead>
<tr>
Expand Down Expand Up @@ -203,7 +204,8 @@ export default {
},
uploadedFiles: {
type: Object,
isInput: false
isInput: false,
default: {},
},
showDocuments: {
type: Boolean,
Expand Down Expand Up @@ -287,7 +289,7 @@ export default {
let tag = this.form.well && isNaN(this.form.well) ? this.form.well.well_tag_number : this.form.well
let encodedFileName = encodeURIComponent(value)
if(confirm(`Are you sure you want to delete file: \n${value}`)){
ApiService.deleteFile(`wells/${tag}/delete_document?filename=${encodedFileName}&private=${doc_status}}`)
ApiService.deleteFile(`wells/${tag}/delete_document?filename=${encodedFileName}&private=${doc_status}`)
.then(() => {
console.log('File deleted')
this.$emit('fetchFiles')
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/src/wells/components/Documents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{{ data.item.date_of_action !== -1 ? new Date(data.item.date_of_action).toLocaleDateString() : "Date Unknown" }}
</template>
<template v-slot:cell(uploaded_document)="data">
<a :href="data.item.url" target="_blank" @click="handleDownloadEvent(data.item.name)">{{ data.item.name }}</a>
<a :href="data.item.url" :download="data.item.name" target="_blank" @click="handleDownloadEvent(data.item.name)">{{ data.item.name }}</a>
</template>
<template v-slot:cell(document_status)="data">
<p v-if="data.item.document_status">Private Document</p>
Expand Down

0 comments on commit 1ae6ffe

Please sign in to comment.