Commit 7d6245c3 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Fix bouton de gestion des sous-structures

Message de debug
parent b441c3a0
Loading
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -388,7 +388,13 @@ return array(
                ////////////////////////////////////////////////////////////////
                [
                    'controller' => 'Organization',
                    'action' => ['delete', 'index', 'search', 'suborganization', 'fiche'],
                    'action' => [
                        'delete',
                        'fiche',
                        'index',
                        'search',
                        'suborganization',
                    ],
                    'roles' => ['user']

                ],
+149 −112
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
 *
 * @copyright Certic (c) 2015
 */

namespace Oscar\Controller;

use BjyAuthorize\Exception\UnAuthorizedException;
@@ -36,7 +37,8 @@ use Laminas\Http\PhpEnvironment\Request;
use Laminas\View\Model\JsonModel;
use Laminas\View\Model\ViewModel;

class OrganizationController extends AbstractOscarController implements UseOrganizationService, UseProjectService, UseProjectGrantService, UseActivityLogService
class OrganizationController extends AbstractOscarController implements UseOrganizationService, UseProjectService,
                                                                        UseProjectGrantService, UseActivityLogService
{
    use UseOrganizationServiceTrait, UseProjectServiceTrait, UseProjectGrantServiceTrait, UseActivityLogServiceTrait;

@@ -61,8 +63,8 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
        return $this;
    }

    public function deleteAction(){

    public function deleteAction()
    {
        $this->getOscarUserContextService()->check(Privileges::ORGANIZATION_DELETE);

        $id = $this->params()->fromRoute('id');
@@ -77,10 +79,13 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
                    $this->getOrganizationService()->deleteOrganization($id);
                    $this->redirect()->toRoute("organization");
                } catch (ForeignKeyConstraintViolationException $e) {
                    throw new OscarException("Vous devez supprimer cette organisation des activités et supprimer ces membres avant de la supprimer.", 0, $e);
                    throw new OscarException(
                        "Vous devez supprimer cette organisation des activités et supprimer ces membres avant de la supprimer.",
                        0,
                        $e
                    );
                }
            }

        } else {
            $token = $this->getSessionService()->createToken();
        }
@@ -98,7 +103,6 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
     */
    public function indexAction()
    {

        $format = $this->getRequestFormat();
        $allow = false;
        $justXHR = true;
@@ -139,7 +143,6 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
        }



        if ($this->getRequest()->isXmlHttpRequest() || $this->params()->fromQuery('f') === 'json') {
            // test : return $this->getResponseUnauthorized("nop");
            $result = ['datas' => []];
@@ -186,12 +189,31 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
        $filename = uniqid('oscar_export_organization_') . '.csv';
        $handler = fopen('/tmp/' . $filename, 'w');

        $headers = ['ID','NomCourt','NomLong','Code','Email','URL','rue1','rue2','rue3','CP','BP','ville','Pays','CodePays','Téléphone','SIFAC','SIRET','Type','TVA'];
        $headers = [
            'ID',
            'NomCourt',
            'NomLong',
            'Code',
            'Email',
            'URL',
            'rue1',
            'rue2',
            'rue3',
            'CP',
            'BP',
            'ville',
            'Pays',
            'CodePays',
            'Téléphone',
            'SIFAC',
            'SIRET',
            'Type',
            'TVA'
        ];

        fputcsv($handler, $headers);



        $i = 0;
        /** @var Organization $organization */
        foreach ($organizations as $organization) {
@@ -247,13 +269,14 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
     */
    public function searchAction()
    {

        if (
            !$this->getOscarUserContextService()->hasPrivilegeDeep(Privileges::PROJECT_ORGANIZATION_MANAGE) &&
            !$this->getOscarUserContextService()->hasPrivilegeDeep(Privileges::ACTIVITY_ORGANIZATION_MANAGE) &&
            !$this->getOscarUserContextService()->hasPrivilegeDeep(Privileges::ACTIVITY_INDEX)
        ) {
            return $this->getResponseUnauthorized("Vous n'avez pas l'authorisation d'accéder à la  liste des organisations");
            return $this->getResponseUnauthorized(
                "Vous n'avez pas l'authorisation d'accéder à la  liste des organisations"
            );
        }

        $page = (int)$this->params()->fromQuery('page', 1);
@@ -359,8 +382,7 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
                        $this->getEntityManager()->persist($newPartner);
                        $newPartner->setRoleObj($organizationPerson->getRoleObj())
                            ->setOrganization($newOrganization)
                            ->setPerson($organizationPerson->getPerson())
                            ;
                            ->setPerson($organizationPerson->getPerson());
                        $this->getEntityManager()->remove($organizationPerson);
                    }
                    $this->getEntityManager()->remove($organization);
@@ -428,10 +450,12 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
                        );
                    }
                    $output['organizations'] = $subStructures;
                    $output['manage'] = $this->getOscarUserContextService()->hasPrivileges(Privileges::ORGANIZATION_EDIT);
                    return $this->jsonOutput($output);
                    break;

                case 'POST':
                    $this->getOscarUserContextService()->check(Privileges::ORGANIZATION_EDIT);
                    $idSubStructure = $this->getRequest()->getPost('idSubStructure');
                    if (!$idSubStructure) {
                        return $this->getResponseBadRequest("Vous devez selectionner une organisation");
@@ -441,6 +465,7 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
                    break;

                case 'DELETE':
                    $this->getOscarUserContextService()->check(Privileges::ORGANIZATION_EDIT);
                    $idSubStructure = $this->getRequest()->getQuery('idsubstructure');
                    if (!$idSubStructure) {
                        return $this->getResponseBadRequest("Données manquante");
@@ -452,7 +477,6 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
                default:
                    return $this->getResponseBadRequest();
            }

        } catch (\Exception $e) {
            return $this->getResponseInternalError("Erreur : " . $e->getMessage());
        }
@@ -487,7 +511,6 @@ class OrganizationController extends AbstractOscarController implements UseOrgan

    public function showAction()
    {

        // TODO
        // Gérer les accès à cette partie pour la gestion des structures
        // de recherche.
@@ -499,7 +522,9 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
            'organization' => $this->getOrganizationService()->getOrganization($organizationId),
            'ancestors' => $this->getOrganizationService()->getAncestors($organizationId),
            'subStructures' => $this->getOrganizationService()->getSubStructure($organizationId),
            'projects' => new UnicaenDoctrinePaginator($this->getProjectService()->getProjectOrganization($organizationId), $page),
            'projects' => new UnicaenDoctrinePaginator(
                $this->getProjectService()->getProjectOrganization($organizationId), $page
            ),
            'activities' => $this->getProjectGrantService()->byOrganizationWithoutProject($organizationId, true),
        ];

@@ -508,7 +533,10 @@ class OrganizationController extends AbstractOscarController implements UseOrgan

    public function newAction()
    {
        $form = new OrganizationIdentificationForm($this->getOrganizationService(), $this->getOrganizationService()->getOrganizationTypesObject());
        $form = new OrganizationIdentificationForm(
            $this->getOrganizationService(),
            $this->getOrganizationService()->getOrganizationTypesObject()
        );
        $entity = new Organization();
        $form->init();
        $form->bind($entity);
@@ -536,7 +564,8 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
        return $view;
    }

    public function synchronizeConnectorAction(){
    public function synchronizeConnectorAction()
    {
        $idOrganization = $this->params()->fromRoute('id');
        $connector = $this->params()->fromRoute('connector');

@@ -553,15 +582,16 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
                $organization = $connector->syncOrganization($organization);
                $this->getEntityManager()->flush($organization);

                return $this->redirect()->toRoute('organization/show',
                    ['id' => $organization->getId()]);
                return $this->redirect()->toRoute(
                    'organization/show',
                    ['id' => $organization->getId()]
                );
            } catch (\Exception $e) {
                throw $e;
            }
        } else {
            die('Bad connector ' . $connector);
        }

    }

    public function scissionAction()
@@ -595,10 +625,12 @@ class OrganizationController extends AbstractOscarController implements UseOrgan


        if ($request->isPost()) {

            if ($this->params()->fromPost('etape', 1) == 3) {
                die('DO');
                if( isset($_SESSION['fusion_hash']) && $_SESSION['fusion_hash'] == $this->params()->fromPost('hash', '') ){
                if (isset($_SESSION['fusion_hash']) && $_SESSION['fusion_hash'] == $this->params()->fromPost(
                        'hash',
                        ''
                    )) {
                    if (!isset($_SESSION['fusion_data'])) {
                        $this->flashMessenger()->addErrorMessage("Erreur de transmission des données.");
                        $this->redirect()->toRoute('organization/fusion');
@@ -611,7 +643,9 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
                            ->getQuery()
                            ->getResult();

                        $to = $this->getEntityManager()->getRepository(Organization::class)->find($_SESSION['fusion_data']['to']);
                        $to = $this->getEntityManager()->getRepository(Organization::class)->find(
                            $_SESSION['fusion_data']['to']
                        );

                        $date = $_SESSION['fusion_data']['at'];

@@ -629,14 +663,12 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
                        $this->getEntityManager()->flush();
                        $this->flashMessenger()->addSuccessMessage("Fusion des organisations réussie.");
                        $this->redirect()->toRoute('organization/show', ['id' => $to->getId()]);

                    }
                } else {
                    $this->flashMessenger()->addErrorMessage("La procédure de fusion a été interrompue.");
                    $this->redirect()->toRoute('organization/fusion');
                    return;
                }

            } else {
                $etape = 2;
                $hash = uniqid('fusion_');
@@ -672,7 +704,9 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
                $_SESSION['fusion_data'] = $fusionDatas;
                $activities = [];

                $organisationsTo = $this->getEntityManager()->getRepository(Organization::class)->createQueryBuilder('a')->where('a.id IN (:ids)')
                $organisationsTo = $this->getEntityManager()->getRepository(Organization::class)->createQueryBuilder(
                    'a'
                )->where('a.id IN (:ids)')
                    ->setParameter('ids', $to)
                    ->getQuery()
                    ->getResult();
@@ -683,7 +717,6 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
                foreach ($organisationFrom->getActivities() as $activity) {
                    $activities[$activity->getActivity()->getId()] = $activity;
                }

            }
        }
        return [
@@ -725,9 +758,11 @@ class OrganizationController extends AbstractOscarController implements UseOrgan


        if ($request->isPost()) {

            if ($this->params()->fromPost('etape', 1) == 3) {
                if( isset($_SESSION['fusion_hash']) && $_SESSION['fusion_hash'] == $this->params()->fromPost('hash', '') ){
                if (isset($_SESSION['fusion_hash']) && $_SESSION['fusion_hash'] == $this->params()->fromPost(
                        'hash',
                        ''
                    )) {
                    if (!isset($_SESSION['fusion_data'])) {
                        $this->flashMessenger()->addErrorMessage("Erreur de transmission des données.");
                        $this->redirect()->toRoute('organization/fusion');
@@ -740,7 +775,9 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
                            ->getQuery()
                            ->getResult();

                        $to = $this->getEntityManager()->getRepository(Organization::class)->find($_SESSION['fusion_data']['to']);
                        $to = $this->getEntityManager()->getRepository(Organization::class)->find(
                            $_SESSION['fusion_data']['to']
                        );

                        $date = $_SESSION['fusion_data']['at'];

@@ -763,19 +800,16 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
                                $newPartner = $projectPartner->fusionTo($to, $date);
                                $this->getEntityManager()->persist($newPartner);
                            }

                        }
                        $this->getEntityManager()->flush();
                        $this->flashMessenger()->addSuccessMessage("Fusion des organisations réussie.");
                        $this->redirect()->toRoute('organization/show', ['id' => $to->getId()]);

                    }
                } else {
                    $this->flashMessenger()->addErrorMessage("La procédure de fusion a été interrompue.");
                    $this->redirect()->toRoute('organization/fusion');
                    return;
                }

            } else {
                $etape = 2;
                $hash = uniqid('fusion_');
@@ -811,7 +845,9 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
                $_SESSION['fusion_data'] = $fusionDatas;
                $activities = [];

                $organisations = $this->getEntityManager()->getRepository(Organization::class)->createQueryBuilder('a')->where('a.id IN (:ids)')
                $organisations = $this->getEntityManager()->getRepository(Organization::class)->createQueryBuilder(
                    'a'
                )->where('a.id IN (:ids)')
                    ->setParameter('ids', $from)
                    ->getQuery()
                    ->getResult();
@@ -854,7 +890,6 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
        $referer = $this->getRequest()->getHeader('referer');
        header('Location: ' . $_SERVER['HTTP_REFERER']);
        die();

    }

    /**
@@ -876,20 +911,22 @@ class OrganizationController extends AbstractOscarController implements UseOrgan
            $entity = $result->getQuery()->getSingleResult();
        }

        $form = new OrganizationIdentificationForm($this->getOrganizationService(), $this->getOrganizationService()->getOrganizationTypesObject());
        $form = new OrganizationIdentificationForm(
            $this->getOrganizationService(),
            $this->getOrganizationService()->getOrganizationTypesObject()
        );
        $form->init();
        $form->bind($entity);



        if ($this->getRequest()->isPost()) {

            $form->setData($this->getRequest()->getPost());
            if ($form->isValid()) {
                $this->getEntityManager()->flush($entity);
                $this->getActivityLogService()->addUserInfo(
                    sprintf('a modifié les informations pour %s', $entity->log()),
                    $this->getDefaultContext(), $entity->getId(),
                    $this->getDefaultContext(),
                    $entity->getId(),
                    LogActivity::LEVEL_INCHARGE
                );
                $em->flush($entity);
+1 −0
Original line number Diff line number Diff line
import{d as v,o as i,c as o,a as s,b as c,t as h,h as u,g as f,m as y,k as w,l as O,F as _,r as b,n as V,i as S,e as k,f as z,j as I}from"../vendor.js";import{_ as x}from"../vendor2.js";import{O as L}from"../vendor4.js";const M={props:{value:{default:null}},emits:["update:value"],components:{},data(){return{options:[],lastUpdatedSearch:0,delay:null,preloadedValue:!1,selectedValue:null,selectedLabel:"",displayClosed:!1,showSelector:!1,searchFor:"",latency:null,highlightedIndex:null,loading:!1,inside:!1,displayValue:!1,error:"",hideOff:!1}},computed:{filteredOptions(){let t=[];return this.displayClosed?this.options:(this.options.forEach(e=>{e.closed||t.push(e)}),t)},optionsFiltered(){if(this.hideOff)return this.options;{let t=[];return this.options.forEach(e=>{e.closed||t.push(e)}),t}}},mounted(){document.addEventListener("click",this.handlerGlobalClick,!0),this.value},methods:{handlerGlobalClick(t){this.inside?(this.displayValue=!1,this.showSelector=!0):(this.showSelector=!1,this.displayValue=!0)},handlerMouseLeave(){this.inside=!1},handlerMouseEnter(){this.inside=!0},handlerClick(t){this.displayValue=!1},handlerUnselect(){this.selectedValue=null,this.selectedLabel="",this.showSelector=!1,this.displayValue=!1,this.$emit("change",null),this.$emit("update:value",null),this.$emit("input",null)},handlerSelectIndex(t){this.options.forEach(e=>{e.id==t&&(this.selectedValue=e.id,this.selectedLabel=e.label,this.showSelector=!1,this.displayValue=!0)}),this.$emit("change",{id:this.selectedValue,label:this.selectedLabel}),this.$emit("update:value",this.selectedValue),this.$emit("input",this.selectedValue)},handlerSelectPrev(t=!1){if(this.highlightedIndex==0&&(this.showSelector=!1),this.highlightedIndex>0&&(this.showSelector||(this.showSelector=!0),this.highlightedIndex--),t==!0){let e="#item_"+this.highlightedIndex,d=this.$el.querySelector(e),g=this.$el.querySelectorAll(".options")[0];g.scrollTop=d.offsetTop,console.log("SCROLL",g.scrollTop),console.log("ITEM",e,d)}},handlerSelectNext(t=!1){if(this.showSelector?this.highlightedIndex<this.options.length-1&&this.highlightedIndex++:this.showSelector=!0,t==!0){let e="#item_"+this.highlightedIndex,d=this.$el.querySelector(e),g=this.$el.querySelectorAll(".options")[0];g.scrollTop=d.offsetTop,console.log("SCROLL",g.scrollTop),console.log("ITEM",e,d)}},updateSelectedDate(){},handlerKeyUp(t){switch(t.code){case"ArrowUp":this.handlerSelectPrev(!0);break;case"ArrowDown":this.handlerSelectNext(!0);break;case"ArrowLeft":case"ArrowRight":break;case"Enter":t.preventDefault(),this.handlerSelectIndex(this.highlightedIndex);break;default:this.searchFor&&this.searchFor.length>1&&this.handlerChange()}},handlerChange(t){this.latency!=null&&clearTimeout(this.latency);let e=function(){this.search(),clearTimeout(this.latency)}.bind(this);this.latency=setTimeout(e,1e3)},search(){this.loading=!0,this.showSelector=!1,v.get("/organization?f=json&l=m&q="+encodeURI(this.searchFor)).then(t=>{this.options=t.data.datas,this.options.length>0&&(this.highlightedIndex=0,this.showSelector=!0)},t=>{switch(console.log(t),t.status){case 401:case 403:this.error="Vous avez été déconnecté (actualisé votre page pour vous reconnecter)";break;case 500:this.error="La recherche a provoqué une erreur";break;default:this.error="Un problème inconnu est survenu"}}).then(t=>{this.loading=!1})},setSelected(t){console.log("setSelected",t),this.value=t,this.$emit("change",this.value),this.$emit("input",this.value)},handlerSearchOrganisation(t,e){if(t.length){e(!0);let d=function(){this.searchOrganization(e,t,this),this.delay=null}.bind(this);this.delay!=null&&clearTimeout(this.delay),this.delay=setTimeout(d,1e3)}}}},T={class:"input-group",style:{position:"relative"}},F={key:0,class:"displayed-value text-danger",style:{}},U=s("i",{class:"icon-attention-1"},null,-1),E={key:1,class:"displayed-value",style:{}},A={class:"input-group-addon"},D={class:"icon-spinner animate-spin"},N={class:"icon-building-filled"},R={class:"options"},q={for:"hidder"},j=["onMouseover","onClick","id"],K={class:"option-title"},B={class:"cartouche code"},P={class:"fullname"},G={key:0},H={key:0,class:"option-infos"},J=s("i",{class:"icon-location"},null,-1);function Q(t,e,d,g,l,r){return i(),o("div",{class:"oscar-selector organization-selector",onClick:e[5]||(e[5]=(...n)=>r.handlerClick&&r.handlerClick(...n)),onMouseleave:e[6]||(e[6]=(...n)=>r.handlerMouseLeave&&r.handlerMouseLeave(...n)),onMouseenter:e[7]||(e[7]=(...n)=>r.handlerMouseEnter&&r.handlerMouseEnter(...n))},[s("div",T,[l.error?(i(),o("div",F,[U,c(" "+h(l.error)+" ",1),s("i",{onClick:e[0]||(e[0]=n=>l.error=""),class:"icon-cancel-circled-outline button-cancel-value"})])):u("",!0),l.displayValue?(i(),o("div",E,[c(h(l.selectedLabel)+" ",1),l.selectedValue?(i(),o("i",{key:0,onClick:e[1]||(e[1]=(...n)=>r.handlerUnselect&&r.handlerUnselect(...n)),class:"icon-cancel-circled-outline button-cancel-value"})):u("",!0)])):u("",!0),s("span",A,[f(s("i",D,null,512),[[y,l.loading]]),f(s("i",N,null,512),[[y,!l.loading]])]),f(s("input",{type:"text","onUpdate:modelValue":e[2]||(e[2]=n=>l.searchFor=n),onKeyup:e[3]||(e[3]=(...n)=>r.handlerKeyUp&&r.handlerKeyUp(...n)),placeholder:"Rechercher une organisation...",class:"form-control"},null,544),[[w,l.searchFor]])]),f(s("div",R,[s("header",null,[c(" Résultat(s) : "+h(l.options.length)+" / ",1),s("label",q,[c(" Afficher les structures fermées "),f(s("input",{type:"checkbox",id:"hidder",value:"on","onUpdate:modelValue":e[4]||(e[4]=n=>l.hideOff=n)},null,512),[[O,l.hideOff]])])]),(i(!0),o(_,null,b(r.optionsFiltered,(n,m)=>(i(),o("div",{class:V(["option",{active:m==l.highlightedIndex,selected:n.id==l.selectedValue,closed:n.closed}]),onMouseover:a=>l.highlightedIndex=m,onClick:S(a=>r.handlerSelectIndex(n.id),["prevent","stop"]),id:"item_"+m},[s("div",K,[s("em",B,h(n.code),1),s("span",P,[s("strong",null,h(n.shortname),1),s("em",null,h(n.longname),1)]),n.type?(i(),o("span",G," ("+h(n.type)+") ",1)):u("",!0)]),n.city||n.country?(i(),o("div",H,[s("small",null,[J,c(" "+h(n.city)+" - "+h(n.country),1)])])):u("",!0)],42,j))),256))],512),[[y,l.showSelector&&l.options.length]])],32)}const W=x(M,[["render",Q]]);const X={props:{url:{require:!0}},components:{OrganizationAutoComplete:W,OscarDialog:L},data(){return{selectedId:null,remote:"Initialisation",error:"",organizations:[],dialogDelete:null,manage:!1,manageSubOragnization:null}},methods:{fetch(){this.remote="Chargement des sous-structures",v.get(this.url).then(t=>{this.remote="",this.organizations=t.data.organizations,this.manage=t.data.manage},t=>{this.remote="",this.error="Impossible de charger les sous-structures : "+t.response.data})},handlerNew(){this.manageSubOragnization={idOrganization:null}},handlerRemoveSubStructure(t){this.remote="Suppression de la sous-structure",this.dialogDelete={dispayed:!0,title:"Suppression de la sous-structure",message:"Retirer '"+t.label+"' des sous-structures ?",onSuccess:()=>{console.log("sub structure",t),this.remote="Suppression de la sous-structure",v.delete(this.url+"?idsubstructure="+t.id).then(e=>{this.remote="",this.fetch()},e=>{this.remote="",this.error="Impossible de supprimer la sous-structure : "+e.response.data}).finally(e=>{this.manageSubOragnization=null})}}},handlerChange(t){this.manageSubOragnization.idOrganization=t.id},handlerSave(){this.remote="Chargement des sous-structures";let t=new FormData;t.append("idSubStructure",this.manageSubOragnization.idOrganization),v.post(this.url,t).then(e=>{this.remote="",this.fetch()},e=>{this.remote="",this.error=e.response.data}).finally(e=>{this.manageSubOragnization=null})}},mounted(){this.fetch()}},Y={key:0},Z={key:1,class:"overlay"},$={class:"overlay-content",style:{overflow:"visible"}},ee=s("h2",null,"Nouvelle sous-structure",-1),te={class:"buttons-bar"},se=s("i",{class:"icon-cancel-circled"},null,-1),le=s("i",{class:"icon-floppy"},null,-1),ne={key:2,class:"alert alert-danger"},ie=s("hr",null,null,-1),oe={class:"suborganizations"},re={class:"card suborganization"},ae={class:"card-title"},he={class:"organization-code code"},ue={class:"organization-shortname"},ce={class:"card-title-subsection"},de={class:"organization-longname"},ge={key:0,class:"card-content"},pe=s("h4",null," Personnel ",-1),me=s("i",{class:"icon-user"},null,-1),fe={key:0},_e={key:1,class:"card-content suborganizations"},ve=s("h4",null," Sous-structure ",-1),be=s("i",{class:"icon-building"},null,-1),ye={class:"card-footer buttons-bar"},Se=["href"],ke=s("i",{class:"icon-link-outline"},null,-1),ze=["onClick"],Ce=s("i",{class:"icon-trash"},null,-1);function xe(t,e,d,g,l,r){const n=k("oscar-dialog"),m=k("organization-auto-complete");return i(),o(_,null,[l.remote?(i(),o("div",Y," Chargement ")):u("",!0),z(n,{options:l.dialogDelete},null,8,["options"]),l.manageSubOragnization?(i(),o("div",Z,[s("div",$,[ee,z(m,{modelValue:l.manageSubOragnization.selectedId,"onUpdate:modelValue":e[0]||(e[0]=a=>l.manageSubOragnization.selectedId=a),onChange:r.handlerChange},null,8,["modelValue","onChange"]),s("div",te,[s("button",{class:"btn btn-danger",onClick:e[1]||(e[1]=a=>l.manageSubOragnization=null)},[se,c(" Annuler ")]),s("button",{class:"btn btn-success",onClick:e[2]||(e[2]=(...a)=>r.handlerSave&&r.handlerSave(...a))},[le,c(" Enregistrer ")])])])])):u("",!0),l.error?(i(),o("div",ne,[c(h(l.error)+" ",1),ie,s("a",{href:"#",onClick:e[3]||(e[3]=S(a=>l.error="",["prevent"]))},"Fermer")])):u("",!0),s("section",oe,[(i(!0),o(_,null,b(l.organizations,a=>(i(),o("article",re,[s("h2",ae,[s("code",he,h(a.code),1),s("strong",ue,h(a.shortname),1),s("div",ce,[s("i",de,h(a.longname),1)])]),a.persons.length!=0?(i(),o("section",ge,[pe,(i(!0),o(_,null,b(a.persons,p=>(i(),o("div",null,[me,s("strong",null,h(p.label),1),p.roles.length?(i(),o("em",fe," ("+h(p.roles.join(", "))+") ",1)):u("",!0)]))),256))])):u("",!0),a.organizations.length!=0?(i(),o("section",_e,[ve,(i(!0),o(_,null,b(a.organizations,p=>(i(),o("div",null,[be,s("strong",null,h(p.shortname),1),c("   "),s("em",null,h(p.longname),1)]))),256))])):u("",!0),s("nav",ye,[s("a",{href:a.show,class:"btn btn-info btn-xs"},[ke,c(" Voir la fiche ")],8,Se),l.manage?(i(),o("a",{key:0,href:"#",class:"btn btn-danger btn-xs",onClick:S(p=>r.handlerRemoveSubStructure(a),["prevent"])},[Ce,c(" Retirer ")],8,ze)):u("",!0)])]))),256))]),l.manage?(i(),o("button",{key:3,class:"btn btn-primary",onClick:e[4]||(e[4]=(...a)=>r.handlerNew&&r.handlerNew(...a))}," Ajouter une sous-structure ")):u("",!0)],64)}const we=x(X,[["render",xe]]);let C=document.querySelector("#suborganizations");const Oe=I(we,{url:C.dataset.url,manage:C.dataset.manage});Oe.mount("#suborganizations");
+0 −1

File deleted.

Preview size limit exceeded, changes collapsed.

+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

Loading