mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
create OnTheFly rootComponent structure, and twig include template to insert it
This commit is contained in:
parent
db9a203df0
commit
1dc01fa8e2
@ -0,0 +1,49 @@
|
|||||||
|
<template>
|
||||||
|
<on-the-fly
|
||||||
|
action="action"
|
||||||
|
:type="type"
|
||||||
|
:id="id"
|
||||||
|
@saveFormOnTheFly="saveFormOnTheFly">
|
||||||
|
</on-the-fly>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import OnTheFly from './components/OnTheFly.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "App",
|
||||||
|
components: [
|
||||||
|
'OnTheFly'
|
||||||
|
],
|
||||||
|
props: ['onTheFly'],
|
||||||
|
computed: {
|
||||||
|
context() {
|
||||||
|
return this.onTheFly.context;
|
||||||
|
},
|
||||||
|
options() {
|
||||||
|
return this.onTheFly.options;
|
||||||
|
},
|
||||||
|
// temp
|
||||||
|
action() {
|
||||||
|
return 'show'; // 'edit', 'create'
|
||||||
|
},
|
||||||
|
type() {
|
||||||
|
return 'person'; // 'thirdparty'
|
||||||
|
},
|
||||||
|
id() {
|
||||||
|
return 1613
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
console.log('OnTheFly mounted');
|
||||||
|
console.log('OnTheFly: data context', this.context);
|
||||||
|
console.log('OnTheFly: data options', this.options);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
saveFormOnTheFly(payload) {
|
||||||
|
console.log('saveFormOnTheFly', payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
const ontheflyMessages = {
|
||||||
|
fr: {
|
||||||
|
onthefly: {
|
||||||
|
show: {
|
||||||
|
person: "Détails de l'usager",
|
||||||
|
thirdparty: "Détails du tiers",
|
||||||
|
file_person: "Ouvrir la fiche de l'usager",
|
||||||
|
file_thirdparty: "Voir le Tiers",
|
||||||
|
},
|
||||||
|
edit: {
|
||||||
|
person: "Modifier un usager",
|
||||||
|
thirdparty: "Modifier un tiers"
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
button: "Créer \"{q}\"",
|
||||||
|
title: "Création d'un nouvel usager ou d'un tiers professionnel",
|
||||||
|
person: "un nouvel usager",
|
||||||
|
thirdparty: "un nouveau tiers professionnel"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export { ontheflyMessages };
|
@ -0,0 +1,28 @@
|
|||||||
|
import { createApp } from "vue";
|
||||||
|
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
|
||||||
|
import { ontheflyMessages } from './i18n.js';
|
||||||
|
import App from "./App.vue";
|
||||||
|
|
||||||
|
const i18n = _createI18n( ontheflyMessages );
|
||||||
|
|
||||||
|
let containers = document.querySelectorAll('.onthefly-container');
|
||||||
|
|
||||||
|
containers.forEach((container) => {
|
||||||
|
|
||||||
|
const app = createApp({
|
||||||
|
template: `<app :onTheFly="this.onTheFly" ></app>`,
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
onTheFly: {
|
||||||
|
context: {},
|
||||||
|
options: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.use(i18n)
|
||||||
|
.component('app', App)
|
||||||
|
.mount(container);
|
||||||
|
|
||||||
|
console.log('container dataset', container.dataset);
|
||||||
|
});
|
@ -53,24 +53,6 @@ const messages = {
|
|||||||
top: "Haut",
|
top: "Haut",
|
||||||
bottom: "Bas",
|
bottom: "Bas",
|
||||||
},
|
},
|
||||||
onthefly: {
|
|
||||||
show: {
|
|
||||||
person: "Détails de l'usager",
|
|
||||||
thirdparty: "Détails du tiers",
|
|
||||||
file_person: "Ouvrir la fiche de l'usager",
|
|
||||||
file_thirdparty: "Voir le Tiers",
|
|
||||||
},
|
|
||||||
edit: {
|
|
||||||
person: "Modifier un usager",
|
|
||||||
thirdparty: "Modifier un tiers"
|
|
||||||
},
|
|
||||||
create: {
|
|
||||||
button: "Créer \"{q}\"",
|
|
||||||
title: "Création d'un nouvel usager ou d'un tiers professionnel",
|
|
||||||
person: "un nouvel usager",
|
|
||||||
thirdparty: "un nouveau tiers professionnel"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
renderbox: {
|
renderbox: {
|
||||||
person: "Usager",
|
person: "Usager",
|
||||||
birthday: {
|
birthday: {
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
{#
|
||||||
|
This Twig template include load vue_onthefly component.
|
||||||
|
It push all variables from context in OnTheFly/App.vue.
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
*
|
||||||
|
#}
|
||||||
|
<div class="onthefly-container"
|
||||||
|
|
||||||
|
></div>
|
||||||
|
|
||||||
|
{{ encore_entry_script_tags('vue_onthefly') }}
|
||||||
|
{{ encore_entry_link_tags('vue_onthefly') }}
|
@ -61,5 +61,6 @@ module.exports = function(encore, entries)
|
|||||||
|
|
||||||
// Vue entrypoints
|
// Vue entrypoints
|
||||||
encore.addEntry('vue_address', __dirname + '/Resources/public/vuejs/Address/index.js');
|
encore.addEntry('vue_address', __dirname + '/Resources/public/vuejs/Address/index.js');
|
||||||
|
encore.addEntry('vue_onthefly', __dirname + '/Resources/public/vuejs/OnTheFly/index.js');
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n';
|
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n';
|
||||||
import { thirdpartyMessages } from 'ChillThirdPartyAssets/vuejs/_js/i18n';
|
import { thirdpartyMessages } from 'ChillThirdPartyAssets/vuejs/_js/i18n';
|
||||||
import { addressMessages } from 'ChillMainAssets/vuejs/Address/i18n';
|
import { addressMessages } from 'ChillMainAssets/vuejs/Address/i18n';
|
||||||
|
import { ontheflyMessages } from 'ChillMainAssets/vuejs/OnTheFly/i18n';
|
||||||
|
|
||||||
const appMessages = {
|
const appMessages = {
|
||||||
fr: {
|
fr: {
|
||||||
@ -142,7 +143,7 @@ const appMessages = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.assign(appMessages.fr, personMessages.fr, thirdpartyMessages.fr, addressMessages.fr);
|
Object.assign(appMessages.fr, personMessages.fr, thirdpartyMessages.fr, addressMessages.fr, ontheflyMessages.fr);
|
||||||
|
|
||||||
export {
|
export {
|
||||||
appMessages
|
appMessages
|
||||||
|
Loading…
x
Reference in New Issue
Block a user