|
|
@@ -1,10 +1,14 @@
|
|
|
+<!--
|
|
|
+Contenu de la page pages/organization.vue
|
|
|
+Contient toutes les informations sur l'organization courante
|
|
|
+-->
|
|
|
<template>
|
|
|
<LayoutContainer>
|
|
|
|
|
|
<UiForm :model="models.Organization" :id="id" :query="repositories.organizationRepository.query()">
|
|
|
<template v-slot:form.input="{entry, updateRepository}">
|
|
|
|
|
|
- <v-expansion-panels :value="panel" focusable accordion >
|
|
|
+ <v-expansion-panels :value="panel" focusable accordion>
|
|
|
|
|
|
<!-- Description -->
|
|
|
<UiExpansionPanel id="description" icon="fa-info">
|
|
|
@@ -305,91 +309,91 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
- import {defineComponent, useContext} from '@nuxtjs/composition-api'
|
|
|
- import {$organizationProfile} from "~/services/profile/organizationProfile";
|
|
|
- import {Organization} from '@/models/Organization/Organization'
|
|
|
- import {OrganizationAddressPostal} from "~/models/Organization/OrganizationAddressPostal";
|
|
|
- import {ContactPoint} from "~/models/Core/ContactPoint";
|
|
|
- import {BankAccount} from "~/models/Core/BankAccount";
|
|
|
- import {repositoryHelper} from "~/services/store/repository";
|
|
|
- import UseChecker from "~/use/form/useChecker";
|
|
|
- import {UseNavigationHelpers} from "~/use/form/useNavigationHelpers";
|
|
|
-
|
|
|
- export default defineComponent({
|
|
|
- name: 'organization_parent',
|
|
|
- setup() {
|
|
|
- const {store, app: {i18n}, $dataProvider} = useContext()
|
|
|
- const organizationProfile = $organizationProfile(store)
|
|
|
- const id:number = store.state.profile.organization.id;
|
|
|
-
|
|
|
- const repositories = getRepositories()
|
|
|
-
|
|
|
- const {siretError, siretErrorMessage, checkSiret} = UseChecker.useHandleSiret(i18n, $dataProvider)
|
|
|
- const checkSiretHook = async (siret:string, field:string, updateRepository:any) => {
|
|
|
- await checkSiret(siret)
|
|
|
- if(!siretError.value)
|
|
|
- updateRepository(siret, field);
|
|
|
- }
|
|
|
-
|
|
|
- const {panel} = UseNavigationHelpers.expansionPanels()
|
|
|
-
|
|
|
- return {
|
|
|
- repositories,
|
|
|
- id,
|
|
|
- organizationProfile,
|
|
|
- models: {Organization, ContactPoint, BankAccount, OrganizationAddressPostal},
|
|
|
- datatableHeaders: getDataTablesHeaders(i18n),
|
|
|
- rules: getRules(i18n),
|
|
|
- siretError,
|
|
|
- siretErrorMessage,
|
|
|
- checkSiretHook,
|
|
|
- panel
|
|
|
- }
|
|
|
- },
|
|
|
- })
|
|
|
-
|
|
|
- function getRules(i18n: any) {
|
|
|
- return {
|
|
|
- nameRules: [
|
|
|
- (nameValue: string) => !!nameValue || i18n.t('required'),
|
|
|
- (nameValue: string) => (nameValue || '').length <= 128 || i18n.t('name_length_rule')
|
|
|
- ],
|
|
|
- siretRule: [
|
|
|
- (siretValue: string) => /^([0-9]{9}|[0-9]{14})$/.test(siretValue) || i18n.t('siret_error')
|
|
|
- ]
|
|
|
+import {defineComponent, useContext} from '@nuxtjs/composition-api'
|
|
|
+import {$organizationProfile} from "~/services/profile/organizationProfile";
|
|
|
+import {Organization} from '@/models/Organization/Organization'
|
|
|
+import {OrganizationAddressPostal} from "~/models/Organization/OrganizationAddressPostal";
|
|
|
+import {ContactPoint} from "~/models/Core/ContactPoint";
|
|
|
+import {BankAccount} from "~/models/Core/BankAccount";
|
|
|
+import {repositoryHelper} from "~/services/store/repository";
|
|
|
+import UseValidator from "~/use/form/useValidator";
|
|
|
+import {UseNavigationHelpers} from "~/use/form/useNavigationHelpers";
|
|
|
+
|
|
|
+export default defineComponent({
|
|
|
+ name: 'OrganizationParent',
|
|
|
+ setup() {
|
|
|
+ const {store, app: {i18n}, $dataProvider} = useContext()
|
|
|
+ const organizationProfile = $organizationProfile(store)
|
|
|
+ const id: number = store.state.profile.organization.id;
|
|
|
+
|
|
|
+ const repositories = getRepositories()
|
|
|
+
|
|
|
+ const {siretError, siretErrorMessage, checkSiret} = UseValidator.useHandleSiret(i18n, $dataProvider)
|
|
|
+ const checkSiretHook = async (siret: string, field: string, updateRepository: any) => {
|
|
|
+ await checkSiret(siret)
|
|
|
+ if(!siretError.value)
|
|
|
+ updateRepository(siret, field);
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- function getDataTablesHeaders(i18n: any) {
|
|
|
- return {
|
|
|
- headersContactPoint: [
|
|
|
- {text: i18n.t('email'), value: 'email'},
|
|
|
- {text: i18n.t('telphone'), value: 'telphone'},
|
|
|
- {text: i18n.t('mobilPhone'), value: 'mobilPhone'},
|
|
|
- {text: i18n.t('actions'), value: 'actions', sortable: false},
|
|
|
- ],
|
|
|
- headersBankAccount: [
|
|
|
- {text: i18n.t('bankName'), value: 'bankName'},
|
|
|
- {text: i18n.t('iban'), value: 'iban'},
|
|
|
- {text: i18n.t('bic'), value: 'bic'},
|
|
|
- {text: i18n.t('actions'), value: 'actions', sortable: false},
|
|
|
- ],
|
|
|
- headersAddressPostal: [
|
|
|
- {text: i18n.t('address_postal_type'), value: 'type'},
|
|
|
- {text: i18n.t('address'), value: 'address'},
|
|
|
- {text: i18n.t('actions'), value: 'actions', sortable: false},
|
|
|
- ]
|
|
|
- }
|
|
|
- }
|
|
|
+ const {panel} = UseNavigationHelpers.expansionPanels()
|
|
|
|
|
|
- function getRepositories() {
|
|
|
return {
|
|
|
- organizationRepository: repositoryHelper.getRepository(Organization),
|
|
|
- contactPointRepository: repositoryHelper.getRepository(ContactPoint),
|
|
|
- bankAccountRepository: repositoryHelper.getRepository(BankAccount),
|
|
|
- addressRepository: repositoryHelper.getRepository(OrganizationAddressPostal)
|
|
|
+ repositories,
|
|
|
+ id,
|
|
|
+ organizationProfile,
|
|
|
+ models: {Organization, ContactPoint, BankAccount, OrganizationAddressPostal},
|
|
|
+ datatableHeaders: getDataTablesHeaders(i18n),
|
|
|
+ rules: getRules(i18n),
|
|
|
+ siretError,
|
|
|
+ siretErrorMessage,
|
|
|
+ checkSiretHook,
|
|
|
+ panel
|
|
|
}
|
|
|
+ },
|
|
|
+})
|
|
|
+
|
|
|
+function getRules(i18n: any) {
|
|
|
+ return {
|
|
|
+ nameRules: [
|
|
|
+ (nameValue: string) => !!nameValue || i18n.t('required'),
|
|
|
+ (nameValue: string) => (nameValue || '').length <= 128 || i18n.t('name_length_rule')
|
|
|
+ ],
|
|
|
+ siretRule: [
|
|
|
+ (siretValue: string) => /^([0-9]{9}|[0-9]{14})$/.test(siretValue) || i18n.t('siret_error')
|
|
|
+ ]
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function getDataTablesHeaders(i18n: any) {
|
|
|
+ return {
|
|
|
+ headersContactPoint: [
|
|
|
+ {text: i18n.t('email'), value: 'email'},
|
|
|
+ {text: i18n.t('telphone'), value: 'telphone'},
|
|
|
+ {text: i18n.t('mobilPhone'), value: 'mobilPhone'},
|
|
|
+ {text: i18n.t('actions'), value: 'actions', sortable: false},
|
|
|
+ ],
|
|
|
+ headersBankAccount: [
|
|
|
+ {text: i18n.t('bankName'), value: 'bankName'},
|
|
|
+ {text: i18n.t('iban'), value: 'iban'},
|
|
|
+ {text: i18n.t('bic'), value: 'bic'},
|
|
|
+ {text: i18n.t('actions'), value: 'actions', sortable: false},
|
|
|
+ ],
|
|
|
+ headersAddressPostal: [
|
|
|
+ {text: i18n.t('address_postal_type'), value: 'type'},
|
|
|
+ {text: i18n.t('address'), value: 'address'},
|
|
|
+ {text: i18n.t('actions'), value: 'actions', sortable: false},
|
|
|
+ ]
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function getRepositories() {
|
|
|
+ return {
|
|
|
+ organizationRepository: repositoryHelper.getRepository(Organization),
|
|
|
+ contactPointRepository: repositoryHelper.getRepository(ContactPoint),
|
|
|
+ bankAccountRepository: repositoryHelper.getRepository(BankAccount),
|
|
|
+ addressRepository: repositoryHelper.getRepository(OrganizationAddressPostal)
|
|
|
}
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|