Affichage des dossiers associés dans la page groupe de travail
This commit is contained in:
parent
19f0c8e0a4
commit
f032e83e71
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
import { DecisionSupportFile, DecisionSupportFileStatus } from '../../types/decision';
|
||||
import { ItemPanel, TabDefinition, Item } from './ItemPanel';
|
||||
import { ItemPanel, TabDefinition, Item } from '../ItemPanel';
|
||||
import { useUserProfile } from '../../gql/queries/profile';
|
||||
import { inWorkgroup } from '../../types/workgroup';
|
||||
import { useDecisionSupportFiles } from '../../gql/queries/dsf';
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { } from 'react';
|
|||
import { Workgroup, inWorkgroup } from '../../types/workgroup';
|
||||
import { useWorkgroups } from '../../gql/queries/workgroups';
|
||||
import { useUserProfile } from '../../gql/queries/profile';
|
||||
import { ItemPanel, Item } from './ItemPanel';
|
||||
import { ItemPanel, Item } from '../ItemPanel';
|
||||
|
||||
export function WorkgroupsPanel() {
|
||||
const { workgroups } = useWorkgroups();
|
||||
|
|
|
@ -4,7 +4,7 @@ import { useWorkgroups } from "../gql/queries/workgroups";
|
|||
import { useDecisionSupportFiles } from "../gql/queries/dsf";
|
||||
|
||||
export interface DecisioSupportFileLinkProps {
|
||||
decisionSupportFileId: number
|
||||
decisionSupportFileId: number|string
|
||||
}
|
||||
|
||||
export const DecisionSupportFileLink: FunctionComponent<DecisioSupportFileLinkProps> = ({ decisionSupportFileId }) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { FunctionComponent, useState, useEffect } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { WithLoader } from "../WithLoader";
|
||||
import { WithLoader } from "./WithLoader";
|
||||
|
||||
export interface Item {
|
||||
id: string
|
|
@ -0,0 +1,48 @@
|
|||
import React, { FunctionComponent } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useDecisionSupportFiles } from '../../gql/queries/dsf';
|
||||
import { DecisionSupportFile } from '../../types/decision';
|
||||
import { User } from '../../types/user';
|
||||
import { DecisionSupportFileLink } from '../DecisionSupportFileLink';
|
||||
import { WorkgroupLink } from '../WorkgroupLink';
|
||||
|
||||
export interface DecisionSupportFilePanelProps {
|
||||
workgroupId: string
|
||||
}
|
||||
|
||||
export const DecisionSupportFilePanel: FunctionComponent<DecisionSupportFilePanelProps> = ({ workgroupId }) => {
|
||||
const { decisionSupportFiles } = useDecisionSupportFiles({
|
||||
variables: {
|
||||
filter: {
|
||||
workgroups: [workgroupId],
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<nav className="panel">
|
||||
<p className="panel-heading">
|
||||
Dossiers d'aide à la décision
|
||||
</p>
|
||||
{
|
||||
decisionSupportFiles.map((dsf: DecisionSupportFile) => {
|
||||
return (
|
||||
<Link to={`/decisions/${dsf.id}`} key={`dsf-${dsf.id}`} className="panel-block">
|
||||
<span className="panel-icon">
|
||||
<i className="fas fa-file" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>{dsf.title}</span>
|
||||
</Link>
|
||||
);
|
||||
})
|
||||
}
|
||||
{
|
||||
decisionSupportFiles.length === 0 ?
|
||||
<a className="panel-block has-text-centered is-block">
|
||||
<p className="is-italic">Aucun dossier pour l'instant.</p>
|
||||
</a> :
|
||||
null
|
||||
}
|
||||
</nav>
|
||||
);
|
||||
}
|
|
@ -1,18 +1,18 @@
|
|||
import React, { useEffect, useState, Fragment } from 'react';
|
||||
import { Page } from '../Page';
|
||||
import { WithLoader } from '../WithLoader';
|
||||
import { useParams } from 'react-router';
|
||||
import { useWorkgroupsQuery, useWorkgroups } from '../../gql/queries/workgroups';
|
||||
import { useUserProfileQuery, useUserProfile } from '../../gql/queries/profile';
|
||||
import { useWorkgroups } from '../../gql/queries/workgroups';
|
||||
import { useUserProfile } from '../../gql/queries/profile';
|
||||
import { MembersPanel } from './MembersPanel';
|
||||
import { User } from '../../types/user';
|
||||
import { InfoPanel } from './InfoPanel';
|
||||
import { Workgroup } from '../../types/workgroup';
|
||||
import { useJoinWorkgroupMutation, useLeaveWorkgroupMutation, useCloseWorkgroupMutation } from '../../gql/mutations/workgroups';
|
||||
import { TimelinePanel } from './TimelinePanel';
|
||||
import { DecisionSupportFilePanel } from './DecisionSupportFilePanel';
|
||||
|
||||
export function WorkgroupPage() {
|
||||
const { id } = useParams();
|
||||
const { id } = useParams<any>();
|
||||
const { workgroups } = useWorkgroups({
|
||||
variables:{
|
||||
filter: {
|
||||
|
@ -140,6 +140,7 @@ export function WorkgroupPage() {
|
|||
</div>
|
||||
<div className="column is-4">
|
||||
<MembersPanel users={state.workgroup.members as User[]} />
|
||||
<DecisionSupportFilePanel workgroupId={state.workgroup.id} />
|
||||
</div>
|
||||
<div className="column is-4">
|
||||
<TimelinePanel workgroup={state.workgroup} />
|
||||
|
|
|
@ -46,6 +46,7 @@ type DecisionSupportFile {
|
|||
|
||||
input DecisionSupportFileFilter {
|
||||
ids: [ID]
|
||||
workgroups: [ID]
|
||||
}
|
||||
|
||||
input AuthorizationObject {
|
||||
|
|
|
@ -108,6 +108,10 @@ func (r *DSFRepository) Search(ctx context.Context, filter *DecisionSupportFileF
|
|||
if filter.Ids != nil {
|
||||
query = query.Where("id in (?)", filter.Ids)
|
||||
}
|
||||
|
||||
if filter.Workgroups != nil {
|
||||
query = query.Where("workgroup_id in (?)", filter.Workgroups)
|
||||
}
|
||||
}
|
||||
|
||||
dsfs := make([]*DecisionSupportFile, 0)
|
||||
|
|
Loading…
Reference in New Issue