users / notifications : temporary disabled notifications system
This commit is contained in:
parent
9167519388
commit
ef6375f4cc
15 changed files with 302 additions and 113 deletions
|
|
@ -28,8 +28,8 @@ Comments:
|
||||||
url: file://s0lNtRA0Z7ybTCWG
|
url: file://s0lNtRA0Z7ybTCWG
|
||||||
position:
|
position:
|
||||||
pageIndex: 1
|
pageIndex: 1
|
||||||
x: "32.518325137231"
|
x: "64.481176977282"
|
||||||
y: "20.46332046332"
|
y: "14.478764478764"
|
||||||
replies: [ ]
|
replies: [ ]
|
||||||
text: test
|
text: test
|
||||||
author:
|
author:
|
||||||
|
|
@ -37,8 +37,8 @@ Comments:
|
||||||
email: adrien.payet@outlook.com
|
email: adrien.payet@outlook.com
|
||||||
uuid: user://WWjXgPWk
|
uuid: user://WWjXgPWk
|
||||||
role: admin
|
role: admin
|
||||||
date: 2024-11-18T11:59:06+01:00
|
date: 2024-11-21T19:18:40+01:00
|
||||||
id: m3mwxzuo
|
id: m3rmytqk
|
||||||
type: comment
|
type: comment
|
||||||
isRead: false
|
isRead: false
|
||||||
-
|
-
|
||||||
|
|
@ -57,66 +57,8 @@ Comments:
|
||||||
url: file://s0lNtRA0Z7ybTCWG
|
url: file://s0lNtRA0Z7ybTCWG
|
||||||
position:
|
position:
|
||||||
pageIndex: 1
|
pageIndex: 1
|
||||||
x: "60.383371825251"
|
x: "64.481176977282"
|
||||||
y: "50.772200772201"
|
y: "14.478764478764"
|
||||||
replies: [ ]
|
|
||||||
text: Test 2
|
|
||||||
author:
|
|
||||||
name: Adrien Payet
|
|
||||||
email: adrien.payet@outlook.com
|
|
||||||
uuid: user://WWjXgPWk
|
|
||||||
role: admin
|
|
||||||
date: 2024-11-18T14:05:32+01:00
|
|
||||||
id: m3n1gl8u
|
|
||||||
type: comment
|
|
||||||
isRead: false
|
|
||||||
-
|
|
||||||
location:
|
|
||||||
page:
|
|
||||||
uri: >
|
|
||||||
projects/miss-dior-blooming-bouquet/client-brief
|
|
||||||
title: Brief client
|
|
||||||
href: >
|
|
||||||
/projects/miss-dior-blooming-bouquet?dialog=client-brief
|
|
||||||
project:
|
|
||||||
title: Miss Dior Blooming Bouquet
|
|
||||||
uri: projects/miss-dior-blooming-bouquet
|
|
||||||
file:
|
|
||||||
uuid: file://s0lNtRA0Z7ybTCWG
|
|
||||||
url: file://s0lNtRA0Z7ybTCWG
|
|
||||||
position:
|
|
||||||
pageIndex: 1
|
|
||||||
x: "20.771295651105"
|
|
||||||
y: "66.409266409266"
|
|
||||||
replies: [ ]
|
|
||||||
text: Test 3
|
|
||||||
author:
|
|
||||||
name: Adrien Payet
|
|
||||||
email: adrien.payet@outlook.com
|
|
||||||
uuid: user://WWjXgPWk
|
|
||||||
role: admin
|
|
||||||
date: 2024-11-18T14:05:45+01:00
|
|
||||||
id: m3n1gupx
|
|
||||||
type: comment
|
|
||||||
isRead: false
|
|
||||||
-
|
|
||||||
location:
|
|
||||||
page:
|
|
||||||
uri: >
|
|
||||||
projects/miss-dior-blooming-bouquet/client-brief
|
|
||||||
title: Brief client
|
|
||||||
href: >
|
|
||||||
/projects/miss-dior-blooming-bouquet?dialog=client-brief
|
|
||||||
project:
|
|
||||||
title: Miss Dior Blooming Bouquet
|
|
||||||
uri: projects/miss-dior-blooming-bouquet
|
|
||||||
file:
|
|
||||||
uuid: file://s0lNtRA0Z7ybTCWG
|
|
||||||
url: file://s0lNtRA0Z7ybTCWG
|
|
||||||
position:
|
|
||||||
pageIndex: 1
|
|
||||||
x: '79.506443081734'
|
|
||||||
y: '74.131274131274'
|
|
||||||
replies: [ ]
|
replies: [ ]
|
||||||
text: test
|
text: test
|
||||||
author:
|
author:
|
||||||
|
|
@ -124,7 +66,152 @@ Comments:
|
||||||
email: adrien.payet@outlook.com
|
email: adrien.payet@outlook.com
|
||||||
uuid: user://WWjXgPWk
|
uuid: user://WWjXgPWk
|
||||||
role: admin
|
role: admin
|
||||||
date: 2024-11-20T08:49:31+01:00
|
date: 2024-11-21T19:19:27+01:00
|
||||||
id: m3pl1vn7
|
id: m3rmzu2u
|
||||||
|
type: comment
|
||||||
|
isRead: false
|
||||||
|
-
|
||||||
|
location:
|
||||||
|
page:
|
||||||
|
uri: >
|
||||||
|
projects/miss-dior-blooming-bouquet/client-brief
|
||||||
|
title: Brief client
|
||||||
|
href: >
|
||||||
|
/projects/miss-dior-blooming-bouquet?dialog=client-brief
|
||||||
|
project:
|
||||||
|
title: Miss Dior Blooming Bouquet
|
||||||
|
uri: projects/miss-dior-blooming-bouquet
|
||||||
|
file:
|
||||||
|
uuid: file://s0lNtRA0Z7ybTCWG
|
||||||
|
url: file://s0lNtRA0Z7ybTCWG
|
||||||
|
position:
|
||||||
|
pageIndex: 1
|
||||||
|
x: "64.481176977282"
|
||||||
|
y: "14.478764478764"
|
||||||
|
replies: [ ]
|
||||||
|
text: test
|
||||||
|
author:
|
||||||
|
name: Adrien Payet
|
||||||
|
email: adrien.payet@outlook.com
|
||||||
|
uuid: user://WWjXgPWk
|
||||||
|
role: admin
|
||||||
|
date: 2024-11-21T19:19:33+01:00
|
||||||
|
id: m3rmzyl9
|
||||||
|
type: comment
|
||||||
|
isRead: false
|
||||||
|
-
|
||||||
|
location:
|
||||||
|
page:
|
||||||
|
uri: >
|
||||||
|
projects/miss-dior-blooming-bouquet/client-brief
|
||||||
|
title: Brief client
|
||||||
|
href: >
|
||||||
|
/projects/miss-dior-blooming-bouquet?dialog=client-brief
|
||||||
|
project:
|
||||||
|
title: Miss Dior Blooming Bouquet
|
||||||
|
uri: projects/miss-dior-blooming-bouquet
|
||||||
|
file:
|
||||||
|
uuid: file://s0lNtRA0Z7ybTCWG
|
||||||
|
url: file://s0lNtRA0Z7ybTCWG
|
||||||
|
position:
|
||||||
|
pageIndex: 1
|
||||||
|
x: "64.481176977282"
|
||||||
|
y: "14.478764478764"
|
||||||
|
replies: [ ]
|
||||||
|
text: test
|
||||||
|
author:
|
||||||
|
name: Adrien Payet
|
||||||
|
email: adrien.payet@outlook.com
|
||||||
|
uuid: user://WWjXgPWk
|
||||||
|
role: admin
|
||||||
|
date: 2024-11-21T19:19:44+01:00
|
||||||
|
id: m3rn07nl
|
||||||
|
type: comment
|
||||||
|
isRead: false
|
||||||
|
-
|
||||||
|
location:
|
||||||
|
page:
|
||||||
|
uri: >
|
||||||
|
projects/miss-dior-blooming-bouquet/client-brief
|
||||||
|
title: Brief client
|
||||||
|
href: >
|
||||||
|
/projects/miss-dior-blooming-bouquet?dialog=client-brief
|
||||||
|
project:
|
||||||
|
title: Miss Dior Blooming Bouquet
|
||||||
|
uri: projects/miss-dior-blooming-bouquet
|
||||||
|
file:
|
||||||
|
uuid: file://s0lNtRA0Z7ybTCWG
|
||||||
|
url: file://s0lNtRA0Z7ybTCWG
|
||||||
|
position:
|
||||||
|
pageIndex: 1
|
||||||
|
x: "64.481176977282"
|
||||||
|
y: "14.478764478764"
|
||||||
|
replies: [ ]
|
||||||
|
text: test
|
||||||
|
author:
|
||||||
|
name: Adrien Payet
|
||||||
|
email: adrien.payet@outlook.com
|
||||||
|
uuid: user://WWjXgPWk
|
||||||
|
role: admin
|
||||||
|
date: 2024-11-21T19:20:04+01:00
|
||||||
|
id: m3rn0mf4
|
||||||
|
type: comment
|
||||||
|
isRead: false
|
||||||
|
-
|
||||||
|
location:
|
||||||
|
page:
|
||||||
|
uri: >
|
||||||
|
projects/miss-dior-blooming-bouquet/client-brief
|
||||||
|
title: Brief client
|
||||||
|
href: >
|
||||||
|
/projects/miss-dior-blooming-bouquet?dialog=client-brief
|
||||||
|
project:
|
||||||
|
title: Miss Dior Blooming Bouquet
|
||||||
|
uri: projects/miss-dior-blooming-bouquet
|
||||||
|
file:
|
||||||
|
uuid: file://s0lNtRA0Z7ybTCWG
|
||||||
|
url: file://s0lNtRA0Z7ybTCWG
|
||||||
|
position:
|
||||||
|
pageIndex: 1
|
||||||
|
x: "60.383375993749"
|
||||||
|
y: "31.660231660232"
|
||||||
|
replies: [ ]
|
||||||
|
text: test
|
||||||
|
author:
|
||||||
|
name: Adrien Payet
|
||||||
|
email: adrien.payet@outlook.com
|
||||||
|
uuid: user://WWjXgPWk
|
||||||
|
role: admin
|
||||||
|
date: 2024-11-21T19:35:48+01:00
|
||||||
|
id: m3rnkvcn
|
||||||
|
type: comment
|
||||||
|
isRead: false
|
||||||
|
-
|
||||||
|
location:
|
||||||
|
page:
|
||||||
|
uri: >
|
||||||
|
projects/miss-dior-blooming-bouquet/client-brief
|
||||||
|
title: Brief client
|
||||||
|
href: >
|
||||||
|
/projects/miss-dior-blooming-bouquet?dialog=client-brief
|
||||||
|
project:
|
||||||
|
title: Miss Dior Blooming Bouquet
|
||||||
|
uri: projects/miss-dior-blooming-bouquet
|
||||||
|
file:
|
||||||
|
uuid: file://s0lNtRA0Z7ybTCWG
|
||||||
|
url: file://s0lNtRA0Z7ybTCWG
|
||||||
|
position:
|
||||||
|
pageIndex: 1
|
||||||
|
x: '64.481176977282'
|
||||||
|
y: '50.772200772201'
|
||||||
|
replies: [ ]
|
||||||
|
text: test
|
||||||
|
author:
|
||||||
|
name: Adrien Payet
|
||||||
|
email: adrien.payet@outlook.com
|
||||||
|
uuid: user://WWjXgPWk
|
||||||
|
role: admin
|
||||||
|
date: 2024-11-21T19:36:11+01:00
|
||||||
|
id: m3rnld52
|
||||||
type: comment
|
type: comment
|
||||||
isRead: false
|
isRead: false
|
||||||
|
|
@ -22,4 +22,8 @@ Stepindex: 1
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
Uuid: glE28vWGearnAmxw
|
Uuid: glE28vWGearnAmxw
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
Isvalidated: true
|
||||||
|
|
@ -23,7 +23,8 @@ tabs:
|
||||||
fields:
|
fields:
|
||||||
stepName:
|
stepName:
|
||||||
type: hidden
|
type: hidden
|
||||||
value: test
|
isSent:
|
||||||
|
type: hidden
|
||||||
pdf:
|
pdf:
|
||||||
label: PDF
|
label: PDF
|
||||||
type: files
|
type: files
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,6 @@ tabs:
|
||||||
label: Contenu
|
label: Contenu
|
||||||
columns:
|
columns:
|
||||||
- width: 1/1
|
- width: 1/1
|
||||||
sections:
|
|
||||||
listed:
|
|
||||||
extends: sections/projects
|
|
||||||
headline: En cours
|
|
||||||
status: listed
|
|
||||||
sortBy: modified desc
|
|
||||||
- width: 1/2
|
|
||||||
sections:
|
sections:
|
||||||
drafts:
|
drafts:
|
||||||
extends: sections/projects
|
extends: sections/projects
|
||||||
|
|
@ -23,17 +16,24 @@ tabs:
|
||||||
extends: sections/projects
|
extends: sections/projects
|
||||||
headline: Archivés
|
headline: Archivés
|
||||||
status: unlisted
|
status: unlisted
|
||||||
- width: 1/1
|
- width: 1/2
|
||||||
sections:
|
sections:
|
||||||
yourProjects:
|
listed:
|
||||||
label: Tous vos projets
|
extends: sections/projects
|
||||||
type: pages
|
headline: En cours
|
||||||
query: user.projects
|
status: listed
|
||||||
sortBy: modified desc
|
sortBy: modified desc
|
||||||
create: false
|
# - width: 1/1
|
||||||
search: true
|
# sections:
|
||||||
image:
|
# yourProjects:
|
||||||
query: page.client.toPage.logo.toFile
|
# label: Tous vos projets
|
||||||
|
# type: pages
|
||||||
|
# query: user.projects
|
||||||
|
# sortBy: modified desc
|
||||||
|
# create: false
|
||||||
|
# search: true
|
||||||
|
# image:
|
||||||
|
# query: page.client.toPage.logo.toFile
|
||||||
|
|
||||||
settings:
|
settings:
|
||||||
label: Réglages
|
label: Réglages
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ tabs:
|
||||||
yourProjects:
|
yourProjects:
|
||||||
label: Vos projets
|
label: Vos projets
|
||||||
type: pages
|
type: pages
|
||||||
query: user.projects
|
|
||||||
help: Projets pour lesquels vous êtes nommé chef de projet.
|
help: Projets pour lesquels vous êtes nommé chef de projet.
|
||||||
image:
|
image:
|
||||||
query: page.client.toPage.logo.toFile
|
query: page.client.toPage.logo.toFile
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ return [
|
||||||
require(__DIR__ . '/routes/save-file.php'),
|
require(__DIR__ . '/routes/save-file.php'),
|
||||||
require(__DIR__ . '/routes/remove-file.php'),
|
require(__DIR__ . '/routes/remove-file.php'),
|
||||||
require(__DIR__ . '/routes/upload-pdf.php'),
|
require(__DIR__ . '/routes/upload-pdf.php'),
|
||||||
|
require(__DIR__ . '/routes/validate-brief.php'),
|
||||||
],
|
],
|
||||||
'hooks' => [
|
'hooks' => [
|
||||||
'page.create:after' => require_once(__DIR__ . '/hooks/create-steps.php'),
|
'page.create:after' => require_once(__DIR__ . '/hooks/create-steps.php'),
|
||||||
|
|
|
||||||
32
public/site/config/routes/validate-brief.php
Normal file
32
public/site/config/routes/validate-brief.php
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'pattern' => '(:all)validate-brief.json',
|
||||||
|
'method' => 'POST',
|
||||||
|
'action' => function () {
|
||||||
|
$json = file_get_contents('php://input');
|
||||||
|
$data = json_decode($json);
|
||||||
|
|
||||||
|
$page = page($data->pageUri);
|
||||||
|
try {
|
||||||
|
$newPage = $page->update([
|
||||||
|
'isValidated' => 'true'
|
||||||
|
]);
|
||||||
|
echo json_encode([
|
||||||
|
"success" => "'" . $newPage->title()->value() . "' brief validated."
|
||||||
|
]);
|
||||||
|
|
||||||
|
kirby()->user()->sendNotification($newPage->parent(), [
|
||||||
|
'date' => $newPage->modified('YYYY-MM-DD'),
|
||||||
|
'author' => kirby()->user()->name()->isNotEmpty() ? kirby()->user()->name() : kirby()->user()->email(),
|
||||||
|
'url' => $newPage->url(),
|
||||||
|
'type' => 'content'
|
||||||
|
]);
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return [
|
||||||
|
"error" => "Can't validate '" . $page->title()->value() . "' brief.",
|
||||||
|
'details' => $th->getMessage()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
@ -35,6 +35,7 @@ class ProjectPage extends Page {
|
||||||
'slug' => $child->slug(),
|
'slug' => $child->slug(),
|
||||||
'index' => intval($child->stepIndex()->value()),
|
'index' => intval($child->stepIndex()->value()),
|
||||||
'modified' => $child->modified('Y-MM-dd'),
|
'modified' => $child->modified('Y-MM-dd'),
|
||||||
|
'isValidated' => $child->isValidated()->value() ?? false,
|
||||||
'uri' => $uri,
|
'uri' => $uri,
|
||||||
'files' => $files,
|
'files' => $files,
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,9 @@ return [
|
||||||
echo json_encode(getFileData($newFile));
|
echo json_encode(getFileData($newFile));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$user->sendNotification($page->parent()->uri(), $newComment->toArray());
|
$user->sendNotification($page->parent(), $newComment->toArray());
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
throw new Exception($th->getMessage(), 1);
|
return $th->getMessage() . " in " . $th->getFile() . " line " . $th->getLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ return [
|
||||||
'comments' => $comments
|
'comments' => $comments
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user->sendNotification($page->parent()->uri(), $newReply->toArray());
|
$user->sendNotification($page->parent(), $newReply->toArray());
|
||||||
|
|
||||||
return getFileData($newFile);
|
return getFileData($newFile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,23 @@
|
||||||
* @throws Exception If an error occurs while updating a user's notifications.
|
* @throws Exception If an error occurs while updating a user's notifications.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return function ($projectUri, $notificationData) {
|
return function ($project, $notificationData) {
|
||||||
$recipients = page($projectUri)->managers()->toUsers()->not($this);
|
$recipients = kirby()->users()->filter(function($user) use ($project) {
|
||||||
|
if ($user === $this || $user->projects()->isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
throw new Exception(json_encode($user->name()), 1);
|
||||||
|
|
||||||
|
$projects = $user->projects();
|
||||||
|
if ($projects && ($user->role() == 'admin' || $projects->has($project))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// $recipients = page($projectUri)->managers()->toUsers()->not($this);
|
||||||
|
|
||||||
if (!$recipients) return;
|
if (!$recipients) return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
Kirby::plugin('adrienpayet/pdc-your-projects', [
|
Kirby::plugin('adrienpayet/pdc-your-projects', [
|
||||||
'userMethods' => [
|
'userMethods' => []
|
||||||
'projects' => function() {
|
|
||||||
$allProjects = page('projects')->children();
|
|
||||||
|
|
||||||
$managedProjects = $allProjects->filter(
|
|
||||||
fn ($project) => $project->managers()->toUsers()->has($this)
|
|
||||||
);
|
|
||||||
|
|
||||||
return $managedProjects;
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,24 @@
|
||||||
stroke-linecap="round"
|
stroke-linecap="round"
|
||||||
stroke-linejoin="round"
|
stroke-linejoin="round"
|
||||||
>
|
>
|
||||||
<path d="M92.8571 46.4292H64.2857C62.3133 46.4292 60.7143 48.0282 60.7143 50.0006V92.8577C60.7143 94.8302 62.3133 96.4292 64.2857 96.4292H92.8571C94.8296 96.4292 96.4286 94.8302 96.4286 92.8577V50.0006C96.4286 48.0282 94.8296 46.4292 92.8571 46.4292Z"/>
|
<path
|
||||||
<path d="M92.8571 3.57202H64.2857C62.3133 3.57202 60.7143 5.171 60.7143 7.14345V21.5006C60.7143 23.473 62.3133 25.072 64.2857 25.072H92.8571C94.8296 25.072 96.4286 23.473 96.4286 21.5006V7.14345C96.4286 5.171 94.8296 3.57202 92.8571 3.57202Z"/>
|
d="M92.8571 46.4292H64.2857C62.3133 46.4292 60.7143 48.0282 60.7143 50.0006V92.8577C60.7143 94.8302 62.3133 96.4292 64.2857 96.4292H92.8571C94.8296 96.4292 96.4286 94.8302 96.4286 92.8577V50.0006C96.4286 48.0282 94.8296 46.4292 92.8571 46.4292Z"
|
||||||
<path d="M35.7143 3.57202H7.14284C5.17039 3.57202 3.57141 5.171 3.57141 7.14345V50.0006C3.57141 51.973 5.17039 53.572 7.14284 53.572H35.7143C37.6867 53.572 39.2857 51.973 39.2857 50.0006V7.14345C39.2857 5.171 37.6867 3.57202 35.7143 3.57202Z"/>
|
/>
|
||||||
<path d="M35.7143 74.9291H7.14284C5.17039 74.9291 3.57141 76.5281 3.57141 78.5005V92.8577C3.57141 94.8301 5.17039 96.4291 7.14284 96.4291H35.7143C37.6867 96.4291 39.2857 94.8301 39.2857 92.8577V78.5005C39.2857 76.5281 37.6867 74.9291 35.7143 74.9291Z"/>
|
<path
|
||||||
|
d="M92.8571 3.57202H64.2857C62.3133 3.57202 60.7143 5.171 60.7143 7.14345V21.5006C60.7143 23.473 62.3133 25.072 64.2857 25.072H92.8571C94.8296 25.072 96.4286 23.473 96.4286 21.5006V7.14345C96.4286 5.171 94.8296 3.57202 92.8571 3.57202Z"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M35.7143 3.57202H7.14284C5.17039 3.57202 3.57141 5.171 3.57141 7.14345V50.0006C3.57141 51.973 5.17039 53.572 7.14284 53.572H35.7143C37.6867 53.572 39.2857 51.973 39.2857 50.0006V7.14345C39.2857 5.171 37.6867 3.57202 35.7143 3.57202Z"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M35.7143 74.9291H7.14284C5.17039 74.9291 3.57141 76.5281 3.57141 78.5005V92.8577C3.57141 94.8301 5.17039 96.4291 7.14284 96.4291H35.7143C37.6867 96.4291 39.2857 94.8301 39.2857 92.8577V78.5005C39.2857 76.5281 37.6867 74.9291 35.7143 74.9291Z"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
<h2 class="font-serif text-lg">Créer via la plateforme</h2>
|
<h2 class="font-serif text-lg">Créer via la plateforme</h2>
|
||||||
<p class="text-sm text-grey-700">Ajouter différents éléments tels que des images et du texte sur la plateforme afin de créer votre brief.</p>
|
<p class="text-sm text-grey-700">
|
||||||
|
Ajouter différents éléments tels que des images et du texte sur la
|
||||||
|
plateforme afin de créer votre brief.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|
@ -46,7 +57,9 @@
|
||||||
stroke-linecap="round"
|
stroke-linecap="round"
|
||||||
stroke-linejoin="round"
|
stroke-linejoin="round"
|
||||||
>
|
>
|
||||||
<path d="M3.57153 75.0001V82.143C3.57153 85.9318 5.07663 89.5654 7.75572 92.2445C10.4348 94.9236 14.0684 96.4287 17.8572 96.4287H82.143C85.9318 96.4287 89.5654 94.9236 92.2445 92.2445C94.9236 89.5654 96.4287 85.9318 96.4287 82.143V75.0001M28.5715 28.5715L50.0001 3.57153M50.0001 3.57153L71.4287 28.5715M50.0001 3.57153V67.8573"/>
|
<path
|
||||||
|
d="M3.57153 75.0001V82.143C3.57153 85.9318 5.07663 89.5654 7.75572 92.2445C10.4348 94.9236 14.0684 96.4287 17.8572 96.4287H82.143C85.9318 96.4287 89.5654 94.9236 92.2445 92.2445C94.9236 89.5654 96.4287 85.9318 96.4287 82.143V75.0001M28.5715 28.5715L50.0001 3.57153M50.0001 3.57153L71.4287 28.5715M50.0001 3.57153V67.8573"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
<label class="font-serif text-lg" for="upload-pdf">
|
<label class="font-serif text-lg" for="upload-pdf">
|
||||||
Ajouter un PDF
|
Ajouter un PDF
|
||||||
|
|
@ -59,7 +72,10 @@
|
||||||
hidden
|
hidden
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<p class="text-sm text-grey-700">Vous avez déjà constitué votre brief en amont et souhaitez directement l’importer.</p>
|
<p class="text-sm text-grey-700">
|
||||||
|
Vous avez déjà constitué votre brief en amont et souhaitez directement
|
||||||
|
l’importer.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -107,7 +123,8 @@ async function addPdf(event) {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
console.log("File uploaded successfully.");
|
console.log("File uploaded successfully.");
|
||||||
page.value = result;
|
page.value = result;
|
||||||
location.href = location.origin + "/" + page.value.parent;
|
location.href =
|
||||||
|
location.origin + "/" + page.value.parent + "?dialog=client-brief";
|
||||||
} else {
|
} else {
|
||||||
console.error("Error uploading file:", result.error);
|
console.error("Error uploading file:", result.error);
|
||||||
}
|
}
|
||||||
|
|
@ -122,7 +139,7 @@ async function addPdf(event) {
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
label[for="upload-pdf"]::after {
|
label[for="upload-pdf"]::after {
|
||||||
content: '';
|
content: "";
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,19 @@
|
||||||
:closeOnEscape="true"
|
:closeOnEscape="true"
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<a class="btn">Valider et envoyer le brief</a>
|
<button
|
||||||
<h2 class="font-serif text-lg" :title="openedFile?.label.length ? openedFile.label : openedFile.name">
|
v-if="
|
||||||
|
dialog.content.id === 'clientBrief' && !dialog.content?.isValidated
|
||||||
|
"
|
||||||
|
class="btn"
|
||||||
|
@click="validate()"
|
||||||
|
>
|
||||||
|
Valider et envoyer le brief
|
||||||
|
</button>
|
||||||
|
<h2
|
||||||
|
class="font-serif text-lg"
|
||||||
|
:title="openedFile?.label.length ? openedFile.label : openedFile.name"
|
||||||
|
>
|
||||||
{{ openedFile?.label.length ? openedFile.label : openedFile.name }}
|
{{ openedFile?.label.length ? openedFile.label : openedFile.name }}
|
||||||
</h2>
|
</h2>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -45,11 +56,13 @@ import { ref, watch } from "vue";
|
||||||
import { useDialogStore } from "../../../stores/dialog";
|
import { useDialogStore } from "../../../stores/dialog";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
|
import { useApiStore } from "../../../stores/api";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const dialog = useDialogStore();
|
const dialog = useDialogStore();
|
||||||
|
const api = useApiStore();
|
||||||
const { openedFile, comments } = storeToRefs(useDialogStore());
|
const { openedFile, comments } = storeToRefs(useDialogStore());
|
||||||
|
|
||||||
openedFile.value = route.query.fileIndex
|
openedFile.value = route.query.fileIndex
|
||||||
|
|
@ -176,6 +189,11 @@ function showDraftMarker(draftComment) {
|
||||||
|
|
||||||
container.appendChild(bubble);
|
container.appendChild(bubble);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function validate() {
|
||||||
|
const response = await api.validateBrief(route.path + "/client-brief");
|
||||||
|
dialog.content.isValidated = true;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
@ -191,5 +209,5 @@ function showDraftMarker(draftComment) {
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@import '../../../assets/css/src/2.blocks.pdf-viewer.css';
|
@import "../../../assets/css/src/2.blocks.pdf-viewer.css";
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -212,6 +212,29 @@ export const useApiStore = defineStore("api", () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function validateBrief(briefUri) {
|
||||||
|
const headers = {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({
|
||||||
|
pageUri: briefUri,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const response = await fetch("/validate-brief.json", headers);
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
if (data.error) {
|
||||||
|
throw new Error(data);
|
||||||
|
} else {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function readAllNotifications() {
|
async function readAllNotifications() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch("/read-all-notifications.json");
|
const response = await fetch("/read-all-notifications.json");
|
||||||
|
|
@ -239,5 +262,6 @@ export const useApiStore = defineStore("api", () => {
|
||||||
replyComment,
|
replyComment,
|
||||||
readNotification,
|
readNotification,
|
||||||
readAllNotifications,
|
readAllNotifications,
|
||||||
|
validateBrief,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue