This commit is contained in:
2020-04-22 18:57:24 +00:00
parent be738c5d75
commit 6c0ffcad0f
3 changed files with 36 additions and 96 deletions

View File

@@ -215,7 +215,7 @@ export default {
}
},
//https://gist.github.com/colemanw/9c9a12aae16a4bfe2678de86b661d922
getFontAwesomeIconFromMIME: function(mimeType) {
iconForMIMEType: function(mimeType) {
// List of official MIME Types: http://www.iana.org/assignments/media-types/media-types.xhtml
var icon_classes = {
// Media

View File

@@ -3,7 +3,7 @@
<span class="v-label v-label--active theme--light">
{{ $ay.t("Attachments") }}
</span>
{{ attachedFileListDisplay() }}
<v-tabs v-model="tab" color="primary">
<v-tabs-slider></v-tabs-slider>
<v-tab key="list"><v-icon>fa-folder</v-icon></v-tab>
@@ -13,9 +13,9 @@
<div class="mt-4" :style="cardTextStyle()">
<v-list color="grey lighten-5" three-line>
<v-list-item
v-for="item in attachedFiles"
v-for="item in attachedFileListDisplay()"
:key="item.id"
@click="download(item)"
@click="download(item.id)"
>
<v-list-item-avatar>
<v-icon v-text="item.icon"></v-icon>
@@ -46,7 +46,6 @@
</v-tab-item>
<v-tab-item key="attach">
<div class="mt-8">
{{ uploadFiles }}
<v-file-input
v-model="uploadFiles"
:label="$ay.t('AttachFile')"
@@ -73,31 +72,7 @@ export default {
data() {
return {
height: 300,
attachedFiles: [
{
id: 1,
icon: "fa-file-image",
name: "drawings.pdf",
date: "2020-01-09",
notes:
"Notes, here are some notes, notes notes notes.\n Secondary line text Lorem ipsum dolor sit amet, consectetur adipiscing elit.Notes, here are some notes, notes notes notes.\n Secondary line text Lorem ipsum dolor sit amet, consectetur adipiscing elit.Notes, here are some notes, notes notes notes.\n Secondary line text Lorem ipsum dolor sit amet, consectetur adipiscing elit.Notes, here are some notes, notes notes notes.\n Secondary line text Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
},
{
id: 2,
icon: "fa-file-image",
name: "drawings.pdf",
date: "2020-01-09",
notes:
"Notes, here are some notes, notes notes notes.\n Secondary line text Lorem ipsum dolor sit amet, consectetur adipiscing elit.Notes, here are some notes, notes notes notes.\n Secondary line text Lorem ipsum dolor sit amet, consectetur adipiscing elit.Notes, here are some notes, notes notes notes.\n Secondary line text Lorem ipsum dolor sit amet, consectetur adipiscing elit.Notes, here are some notes, notes notes notes.\n Secondary line text Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
},
{
id: 3,
icon: "fa-file-image",
name: "drawings.pdf",
date: "2020-01-09",
notes: null
}
],
attachedFiles: [],
notes: null,
tab: null,
uploadFiles: []
@@ -108,7 +83,7 @@ export default {
ayaId: Number,
readonly: Boolean
},
computed: {},
methods: {
onResize() {
this.height = window.innerHeight * 0.8;
@@ -130,9 +105,9 @@ export default {
// vm.formState.serverError = res.error;
// window.$gz.form.setErrorBoxErrors(vm);
} else {
console.log("SUCCESS");
this.attachedFiles = res.data;
}
});
}); //todo: popup message box on error seems best way to handle this for now
// .catch(function handleSubmitError(error) {
// vm.formState.loading = false;
// window.$gz.errorHandler.handleFormError(error, vm);
@@ -145,70 +120,31 @@ export default {
},
download(item) {
console.log("CLICK", item);
},
attachedFileListDisplay() {
//{"data":[{"id":1,"concurrencyToken":7733332,"contentType":"image/png","displayFileName":"Screen Shot 2020-01-09 at 10.50.24.png","lastModified":"0001-01-01T00:00:00Z","notes":"Here are notes"},{"id":4,"concurrencyToken":7733354,"contentType":"text/plain","displayFileName":"TNT log file ayanova.txt","lastModified":"0001-01-01T00:00:00Z","notes":"Here are notes"},{"id":2,"concurrencyToken":7733342,"contentType":"text/plain","displayFileName":"stack.txt","lastModified":"0001-01-01T00:00:00Z","notes":"Here are notes"},{"id":3,"concurrencyToken":7733348,"contentType":"image/jpeg","displayFileName":"t2cx6sloffk41.jpg","lastModified":"0001-01-01T00:00:00Z","notes":"Here are notes"}]}
let timeZoneName = window.$gz.locale.getBrowserTimeZoneName();
let languageName = window.$gz.locale.getBrowserLanguages();
let hour12 = window.$gz.store.state.locale.hour12;
let ret = [];
for (let i = 0; i < this.attachedFiles; i++) {
let o = this.attachedFiles[i];
ret.push({
id: o.id,
name: o.displayFileName,
date: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
o.lastModified,
timeZoneName,
languageName,
hour12
),
notes: o.notes,
icon: window.$gz.util.iconForMIMEType(o.contentType)
});
}
return ret;
}
}
/**[
{
icon: "fa-file-image",
title: "drawings.pdf",
subtitle: "2020-01-09"
},
{
icon: "fa-image",
title: "Recipes",
subtitle: "Jan 17, 2014"
},
{
icon: "fa-pen",
title: "Work",
subtitle: "Jan 28, 2014"
},
{
icon: "fa-file",
title: "2drawings.pdf",
subtitle: "2020-01-09"
},
{
icon: "fa-image",
title: "2Recipes",
subtitle: "Jan 17, 2014"
},
{
icon: "fa-pen",
title: "2Work",
subtitle: "Jan 28, 2014"
},
{
icon: "fa-file",
title: "3drawings.pdf",
subtitle: "2020-01-09"
},
{
icon: "fa-image",
title: "3Recipes",
subtitle: "Jan 17, 2014"
}
// {
// icon: "fa-pen",
// title: "3Work",
// subtitle: "Jan 28, 2014"
// },
// {
// icon: "fa-file",
// title: "4drawings.pdf",
// subtitle: "2020-01-09"
// },
// {
// icon: "fa-image",
// title: "4Recipes",
// subtitle: "Jan 17, 2014"
// },
// {
// icon: "fa-pen",
// title: "4Work",
// subtitle: "Jan 28, 2014"
// }
], */
};
</script>