diff --git a/assets/controllers/organization_controller.js b/assets/controllers/organization_controller.js index 225c662..a1fc967 100644 --- a/assets/controllers/organization_controller.js +++ b/assets/controllers/organization_controller.js @@ -18,7 +18,7 @@ export default class extends Controller { this.loadActivities(); setInterval(() => { this.loadActivities(); - }, 60000); // Refresh every 60 seconds + }, 300000); // Refresh every 5 minutes } if (this.tableValue && this.sadminValue) { this.table(); diff --git a/assets/controllers/project_controller.js b/assets/controllers/project_controller.js new file mode 100644 index 0000000..bcf2e12 --- /dev/null +++ b/assets/controllers/project_controller.js @@ -0,0 +1,235 @@ +import {Controller} from '@hotwired/stimulus'; +import { Modal } from "bootstrap"; +import {TabulatorFull as Tabulator} from 'tabulator-tables'; +import {eyeIconLink, pencilIcon, TABULATOR_FR_LANG, trashIcon} from "../js/global.js"; + + +export default class extends Controller { + static values = { + listProject : Boolean, + orgId: Number, + admin: Boolean + } + static targets = ["modal", "appList", "nameInput", "formTitle"]; + connect(){ + if(this.listProjectValue){ + this.table(); + } + this.modal = new Modal(this.modalTarget); + } + + table(){ + const columns = [ + {title: "ID ", field: "id", visible: false}, + {title: "Nom du projet ", field: "name", headerFilter: "input", widthGrow: 2, vertAlign: "middle"}, + { + title: "Applications", + field: "applications", + headerSort: false, + hozAlign: "left", + formatter: (cell) => { + const apps = cell.getValue(); + if (!apps || apps.length === 0) { + return "Aucune"; + } + + // Wrap everything in a flex container to keep them on one line + const content = apps.map(app => ` +