| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import { baseOrganizationState, organizationState } from '~/types/interfaces'
- import {defineStore} from "pinia";
- export const useProfileOrganizationStore = defineStore('profileOrganization', {
- state: (): organizationState => {
- return {
- id: null,
- parametersId: null,
- name: null,
- product: null,
- currentActivityYear: null,
- modules: [],
- hasChildren: false,
- legalStatus: null,
- showAdherentList: false,
- networks: [],
- website: null,
- parents: []
- }
- },
- actions : {
- setProfile (profile: any) {
- this.id = profile.id
- this.parametersId = profile.parametersId
- this.name = profile.name
- this.product = profile.product
- this.currentActivityYear = profile.currentYear
- this.website = profile.website
- this.modules = profile.modules
- this.hasChildren = profile.hasChildren
- this.legalStatus = profile.legalStatus
- this.showAdherentList = profile.showAdherentList
- this.networks = profile.networks
- useEach(profile.parents, (parent) => {
- const p: baseOrganizationState = {
- id: parent.id,
- name: parent.name,
- website: parent.website
- }
- this.parents.push(p)
- })
- },
- refreshProfile (profile: any) {
- this.name = profile.name
- this.currentActivityYear = profile.currentYear
- this.website = profile.website
- this.legalStatus = profile.legalStatus
- }
- }
- })
|