From f1cf8b41fdef52c24047be2b549e93d26d9af2ed Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Pasquier <contact@jbpasquier.eu>
Date: Thu, 15 Apr 2021 15:57:17 +0200
Subject: [PATCH] minor: integrate invoices

---
 README.md                                     | 30 +++++++++++++++++++
 src/views/page-circle.pug                     | 18 +++++------
 src/views/page-project.pug                    | 17 +++++++++++
 .../project/page-project-invoices.pug         |  5 ++++
 4 files changed, 61 insertions(+), 9 deletions(-)
 create mode 100644 src/views/partials/project/page-project-invoices.pug

diff --git a/README.md b/README.md
index 2d707d18..8e5861c5 100644
--- a/README.md
+++ b/README.md
@@ -424,6 +424,36 @@ Where:
 
 Setting custom langs will not allow user to choose their own lang.
 
+### Invoices
+
+Invoices allow your Projects to manage invoices
+
+Project is mandatory.
+
+You'll need:
+
+On Server: `djangoldp_invoice` packages
+
+Module declaration, on `config.json`:
+
+```json
+    {
+      "type": "projects",
+      "extensions": [
+        {
+          "type": "invoices",
+          "endpoints": {
+            "uploads": "http://server.url/upload/"
+          }
+        }
+      ]
+    }
+```
+
+Where:
+
+* `xmpp` is your [Prosody](https://prosody.im/) with [appropriate modules](https://git.startinblox.com/infra/prosody-modules/) configured on.
+
 ### Job Offers
 
 Job Offers includes a job board with conversation. To activate them
diff --git a/src/views/page-circle.pug b/src/views/page-circle.pug
index f2ecede8..f52c76c4 100644
--- a/src/views/page-circle.pug
+++ b/src/views/page-circle.pug
@@ -18,25 +18,25 @@
       for extension of component.extensions
         if extension.type == 'events'
           div(
-            id=`${component.route}-events`
+            id=`${extension.route}-events`
             hidden
-            data-view=`${component.route}-events`
+            data-view=`${extension.route}-events`
             no-render
           )
             include partials/circle/page-circle-events.pug
         if extension.type == 'resources'
           div(
-            id=`${component.route}-resources`
+            id=`${extension.route}-resources`
             hidden
-            data-view=`${component.route}-resources`
+            data-view=`${extension.route}-resources`
             no-render
           )
             include partials/circle/page-circle-resources.pug
         if extension.type == 'polls'
           div(
-            id=`${component.route}-polls`
+            id=`${extension.route}-polls`
             hidden
-            data-view=`${component.route}-polls`
+            data-view=`${extension.route}-polls`
             no-render
           )
             include partials/circle/page-circle-polls.pug
@@ -60,17 +60,17 @@ nav.jsRightMenu.text-disable-selection.sidebar.whitespace-normal(role='navigatio
       if component.extensions
         for extension of component.extensions
           if extension.type == 'resources'
-            solid-route.segment.full(name=`${component.route}-resources` use-id)
+            solid-route.segment.full(name=`${extension.route}-resources` use-id)
               li.segment.full.padding-medium
                 span.icon.ci-file.icon-xlarge.margin-right-medium
                 a(data-trans='circle.menuRight.resources')
           if extension.type == 'events'
-            solid-route.segment.full(name=`${component.route}-events` use-id)
+            solid-route.segment.full(name=`${extension.route}-events` use-id)
               li.segment.full.padding-medium
                 span.icon.ci-appointment.icon-xlarge.margin-right-medium
                 a(data-trans='circle.menuRight.events')
           if extension.type == 'polls'
-            solid-route.segment.full(name=`${component.route}-polls` use-id)
+            solid-route.segment.full(name=`${extension.route}-polls` use-id)
               li.segment.full.padding-medium
                 span.icon.ci-list.icon-xlarge.margin-right-medium
                 a(data-trans='circle.menuRight.polls')    
diff --git a/src/views/page-project.pug b/src/views/page-project.pug
index b79b4e9b..eacb5780 100644
--- a/src/views/page-project.pug
+++ b/src/views/page-project.pug
@@ -21,6 +21,16 @@
       no-render
     )
       include partials/project/page-project-picture.pug
+    if component.extensions
+      for extension of component.extensions
+        if extension.type == 'invoices'
+          div(
+            id=`${extension.route}-invoices`
+            hidden
+            data-view=`${extension.route}-invoices`
+            no-render
+          )
+            include partials/project/page-project-invoices.pug
 
 nav.jsRightMenu.text-disable-selection.sidebar.whitespace-normal(role='navigation')
   solid-router.segment.whitespace-normal.text-color-heading.text-bold(default-route=`${component.route}-chat`)
@@ -39,3 +49,10 @@ nav.jsRightMenu.text-disable-selection.sidebar.whitespace-normal(role='navigatio
           span.icon.ci-information.icon-xlarge.margin-right-medium
           a(data-trans='project.menuRight.information')
       solid-route(name=`${component.route}-picture` use-id)
+      if component.extensions
+        for extension of component.extensions
+          if extension.type == 'invoices'
+            solid-route.segment.full(name=`${extension.route}-invoices` use-id)
+              li.segment.full.padding-medium
+                span.icon.ci-list.icon-xlarge.margin-right-medium
+                a(data-trans='circle.menuRight.invoices')    
diff --git a/src/views/partials/project/page-project-invoices.pug b/src/views/partials/project/page-project-invoices.pug
new file mode 100644
index 00000000..63eb05e6
--- /dev/null
+++ b/src/views/partials/project/page-project-invoices.pug
@@ -0,0 +1,5 @@
+solid-invoicing(
+  bind-resources
+  upload-dir=`${extension.endpoints.uploads}`
+  uniq=extension.uniq
+)
\ No newline at end of file
-- 
GitLab