pdf > comments > new comments : show email address if no name
This commit is contained in:
parent
6bffbc1707
commit
ea48094bc7
8 changed files with 52 additions and 43 deletions
|
|
@ -6,31 +6,4 @@ Uuid: s0lNtRA0Z7ybTCWG
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
Template: document
|
Template: document
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
Comments:
|
|
||||||
|
|
||||||
1:
|
|
||||||
m2lmqu2u:
|
|
||||||
text: test
|
|
||||||
username: Adrien Payet
|
|
||||||
date: 2024-10-23T10:46:08+02:00
|
|
||||||
m2lo4obv:
|
|
||||||
text: nouveau commentaire
|
|
||||||
username: Adrien Payet
|
|
||||||
date: 2024-10-23T11:24:53+02:00
|
|
||||||
m2lo6ckw:
|
|
||||||
text: Encore un autre commentaire
|
|
||||||
username: Adrien Payet
|
|
||||||
date: 2024-10-23T11:26:11+02:00
|
|
||||||
2:
|
|
||||||
m2loaj2f:
|
|
||||||
text: Autre commentaire
|
|
||||||
username: Adrien Payet
|
|
||||||
date: 2024-10-23T11:29:26+02:00
|
|
||||||
m2loam7s:
|
|
||||||
text: Autre commentaire
|
|
||||||
username: Adrien Payet
|
|
||||||
date: 2024-10-23T11:29:30+02:00
|
|
||||||
|
|
@ -1 +1,5 @@
|
||||||
title: Admin
|
title: Admin
|
||||||
|
|
||||||
|
fields:
|
||||||
|
notifications:
|
||||||
|
type: hidden
|
||||||
|
|
|
||||||
|
|
@ -8,3 +8,5 @@ fields:
|
||||||
type: pages
|
type: pages
|
||||||
max: 1
|
max: 1
|
||||||
query: page('clients').children
|
query: page('clients').children
|
||||||
|
notifications:
|
||||||
|
type: hidden
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
title:
|
title:
|
||||||
fr: Chef·fe de projet
|
fr: Chef·fe de projet
|
||||||
en: Project Manager
|
en: Project Manager
|
||||||
|
|
||||||
|
fields:
|
||||||
|
notifications:
|
||||||
|
type: hidden
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ return [
|
||||||
|
|
||||||
$comments[$data->targetPage][$data->id] = [
|
$comments[$data->targetPage][$data->id] = [
|
||||||
'text' => $data->text,
|
'text' => $data->text,
|
||||||
'username' => (string) $user->name(),
|
'username' => $user->name()->isNotEmpty() ? (string) $user->name() : (string) $user->email(),
|
||||||
'date' => (string) $data->date,
|
'date' => (string) $data->date,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -27,6 +27,6 @@ return [
|
||||||
'comments' => $comments
|
'comments' => $comments
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $comments;
|
return getFileData($newFile);
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
@ -2,10 +2,7 @@
|
||||||
<aside id="comments-container" aria-labelledby="comments-label">
|
<aside id="comments-container" aria-labelledby="comments-label">
|
||||||
<h2 id="comments-label" class="sr-only">Commentaires</h2>
|
<h2 id="comments-label" class="sr-only">Commentaires</h2>
|
||||||
<div class="comments | flow">
|
<div class="comments | flow">
|
||||||
<div
|
<div v-for="(page, pageIndex) in comments" class="comments__page-group">
|
||||||
v-for="(page, pageIndex) in localComments"
|
|
||||||
class="comments__page-group"
|
|
||||||
>
|
|
||||||
<article
|
<article
|
||||||
v-for="(comment, commentIndex) in Object.values(page)"
|
v-for="(comment, commentIndex) in Object.values(page)"
|
||||||
:key="pageIndex + commentIndex"
|
:key="pageIndex + commentIndex"
|
||||||
|
|
@ -53,7 +50,9 @@
|
||||||
v-model="newCommentText"
|
v-model="newCommentText"
|
||||||
></textarea>
|
></textarea>
|
||||||
<footer class="flex">
|
<footer class="flex">
|
||||||
<button class="btn btn--white-20">Annuler</button>
|
<button class="btn btn--white-20" @click="closeAddField()">
|
||||||
|
Annuler
|
||||||
|
</button>
|
||||||
<input type="submit" class="btn btn--tranparent" />
|
<input type="submit" class="btn btn--tranparent" />
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -80,7 +79,7 @@ const { page } = usePageStore();
|
||||||
|
|
||||||
const newCommentText = ref("");
|
const newCommentText = ref("");
|
||||||
const isAddOpen = ref(false);
|
const isAddOpen = ref(false);
|
||||||
const localComments = ref(comments);
|
const emits = defineEmits(["update:file"]);
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
function addComment(event) {
|
function addComment(event) {
|
||||||
|
|
@ -103,7 +102,11 @@ function addComment(event) {
|
||||||
|
|
||||||
fetch("/add-comment.json", headers)
|
fetch("/add-comment.json", headers)
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((json) => (localComments.value = json))
|
.then((newFile) => {
|
||||||
|
newCommentText.value = "";
|
||||||
|
isAddOpen.value = false;
|
||||||
|
emits("update:file", newFile);
|
||||||
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error("Erreur lors de la sauvegarde :", error);
|
console.error("Erreur lors de la sauvegarde :", error);
|
||||||
});
|
});
|
||||||
|
|
@ -123,4 +126,9 @@ function formatDate(date) {
|
||||||
|
|
||||||
return dayjs(date).format("D MMM YY");
|
return dayjs(date).format("D MMM YY");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeAddField() {
|
||||||
|
isAddOpen.value = false;
|
||||||
|
newCommentText.value = "";
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
:current-page-index="currentPageIndex"
|
:current-page-index="currentPageIndex"
|
||||||
:file="file"
|
:file="file"
|
||||||
:comments="file.comments"
|
:comments="file.comments"
|
||||||
|
@update:file="changeFile"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
@ -49,7 +50,7 @@ const { file } = defineProps({
|
||||||
file: Object,
|
file: Object,
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits("close");
|
const emits = defineEmits(["close", "update:file"]);
|
||||||
|
|
||||||
const licenseKey = import.meta.env.VITE_VPV_LICENSE;
|
const licenseKey = import.meta.env.VITE_VPV_LICENSE;
|
||||||
useLicense({ licenseKey });
|
useLicense({ licenseKey });
|
||||||
|
|
@ -57,7 +58,7 @@ useLicense({ licenseKey });
|
||||||
// Variables
|
// Variables
|
||||||
const isOpen = ref(true);
|
const isOpen = ref(true);
|
||||||
watch(isOpen, (newValue) => {
|
watch(isOpen, (newValue) => {
|
||||||
emit("close");
|
emits("close");
|
||||||
});
|
});
|
||||||
const isCommentsOpen = ref(false);
|
const isCommentsOpen = ref(false);
|
||||||
const currentPageIndex = ref(1);
|
const currentPageIndex = ref(1);
|
||||||
|
|
@ -102,6 +103,10 @@ const onPdfLoaded = () => {
|
||||||
|
|
||||||
observePages();
|
observePages();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function changeFile(newFile) {
|
||||||
|
emits("update:file", newFile);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,12 @@
|
||||||
<Header :title="page.content.title" />
|
<Header :title="page.content.title" />
|
||||||
<!-- Kanban: Status Brief Enrichi -->
|
<!-- Kanban: Status Brief Enrichi -->
|
||||||
|
|
||||||
<PdfViewer v-if="file" :file="file" @close="file = null" />
|
<PdfViewer
|
||||||
|
v-if="file"
|
||||||
|
:file="file"
|
||||||
|
@close="file = null"
|
||||||
|
@update:file="updateFile"
|
||||||
|
/>
|
||||||
|
|
||||||
<div class="kanban">
|
<div class="kanban">
|
||||||
<ProjectStep
|
<ProjectStep
|
||||||
|
|
@ -181,6 +186,14 @@ function setStepStatus(stepName) {
|
||||||
function changeFile(newFile) {
|
function changeFile(newFile) {
|
||||||
file.value = newFile;
|
file.value = newFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateFile(newFile) {
|
||||||
|
page.value.files = [];
|
||||||
|
page.value.files.push(newFile);
|
||||||
|
|
||||||
|
file.value = page.value.files[0];
|
||||||
|
console.log(file.value);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scope>
|
<style scope>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue