mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-10 16:55:00 +00:00
Compare commits
3 Commits
fix-compil
...
vue3-test0
Author | SHA1 | Date | |
---|---|---|---|
3e7c79d6ce | |||
bc1f624e14 | |||
f73d3bf320 |
@@ -1,7 +0,0 @@
|
|||||||
import Vue from 'vue'
|
|
||||||
import App from 'ChillPersonAssets/js/AccompanyingCourse.vue'
|
|
||||||
|
|
||||||
new Vue({
|
|
||||||
el: '#app',
|
|
||||||
render: h => h(App)
|
|
||||||
})
|
|
@@ -56,7 +56,7 @@ module.exports = function(encore, entries)
|
|||||||
// Chill2 new assets
|
// Chill2 new assets
|
||||||
encore.addEntry('forkawesome', __dirname + '/Resources/public/modules/forkawesome/index.js');
|
encore.addEntry('forkawesome', __dirname + '/Resources/public/modules/forkawesome/index.js');
|
||||||
encore.addEntry('bootstrap', __dirname + '/Resources/public/modules/bootstrap/index.js');
|
encore.addEntry('bootstrap', __dirname + '/Resources/public/modules/bootstrap/index.js');
|
||||||
encore.addEntry('vuejs', __dirname + '/Resources/public/modules/vue/index.js');
|
//encore.addEntry('vuejs', __dirname + '/Resources/public/modules/vue/index.js');
|
||||||
|
|
||||||
// CKEditor5
|
// CKEditor5
|
||||||
buildCKEditor(encore);
|
buildCKEditor(encore);
|
||||||
|
@@ -96,18 +96,21 @@ class AccompanyingCourseController extends Controller
|
|||||||
$data = [
|
$data = [
|
||||||
'id' => $accompanyingCourse->getId(),
|
'id' => $accompanyingCourse->getId(),
|
||||||
'remark' => $accompanyingCourse->getRemark(),
|
'remark' => $accompanyingCourse->getRemark(),
|
||||||
'closing_motive' => $accompanyingCourse->getClosingMotive()->getName()['fr'],
|
'closing_motive' => $accompanyingCourse->getClosingMotive() ? $accompanyingCourse->getClosingMotive()->getName()['fr'] : null,
|
||||||
'opening_date' => ($accompanyingCourse->getOpeningDate()) ? $accompanyingCourse->getOpeningDate()->format('Y-m-d') : null,
|
'opening_date' => ($accompanyingCourse->getOpeningDate()) ? $accompanyingCourse->getOpeningDate()->format('Y-m-d') : null,
|
||||||
'closing_date' => ($accompanyingCourse->getClosingDate()) ? $accompanyingCourse->getClosingDate()->format('Y-m-d') : null,
|
'closing_date' => ($accompanyingCourse->getClosingDate()) ? $accompanyingCourse->getClosingDate()->format('Y-m-d') : null,
|
||||||
'persons' => $persons
|
'persons' => $persons
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
$normalizer = [new ObjectNormalizer()];
|
$normalizer = [new ObjectNormalizer()];
|
||||||
$encoder = [new JsonEncoder()];
|
$encoder = [new JsonEncoder()];
|
||||||
|
|
||||||
$serializer = new Serializer($normalizer, $encoder);
|
$serializer = new Serializer($normalizer, $encoder);
|
||||||
$serialized = $serializer->serialize($data,'json', []);
|
$serialized = $serializer->serialize($data,'json', []);
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$serialized = \json_encode($data);
|
||||||
$response = new Response($serialized);
|
$response = new Response($serialized);
|
||||||
$response->headers->set('Content-Type', 'application/json');
|
$response->headers->set('Content-Type', 'application/json');
|
||||||
return $response;
|
return $response;
|
||||||
|
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
import Vue from 'vue';
|
||||||
|
|
||||||
|
const AccompanyingCourseComponent = {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
id: 7,
|
||||||
|
persons_associated: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let app = Vue.CreateApp({
|
||||||
|
delimiters: ['${', '}']
|
||||||
|
})
|
||||||
|
.component(AccompanyingCourseComponent)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
app.mount('#app');
|
@@ -1,19 +1,105 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="kkk">
|
||||||
<persons_associated></persons_associated>
|
<h3>Usagers concernés</h3>
|
||||||
</div>
|
<dl>
|
||||||
|
<dt>id</dt>
|
||||||
|
<dd>{{ course.id }}</dd>
|
||||||
|
<dt>opening_date</dt>
|
||||||
|
<dd>{{ course.opening_date }}</dd>
|
||||||
|
<dt>closing_date</dt>
|
||||||
|
<dd>{{ course.closing_date }}</dd>
|
||||||
|
<dt>remarkzzzzz</dt>
|
||||||
|
<dd>{{ course.remark }}</dd>
|
||||||
|
<dt>closing_motive</dt>
|
||||||
|
<dd>{{ course.closing_motive }}</dd>
|
||||||
|
</dl>
|
||||||
|
<label>{{counter}} usagers concernés</label>
|
||||||
|
<table class="rounded">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="chill-orange">firstname</th>
|
||||||
|
<th class="chill-orange">lastname</th>
|
||||||
|
<th class="chill-orange">startdate</th>
|
||||||
|
<th class="chill-orange">enddate</th>
|
||||||
|
<th class="chill-orange">actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="person in course.persons">
|
||||||
|
<td>{{ person.firstname }}</td>
|
||||||
|
<td>{{ person.lastname }}</td>
|
||||||
|
<td>{{ person.startdate }}</td>
|
||||||
|
<td>{{ person.enddate }}</td>
|
||||||
|
<td>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li><a class="sc-button bt-show"></a></li>
|
||||||
|
<li><a class="sc-button bt-update"></a></li>
|
||||||
|
<li><a class="sc-button bt-delete"></a></li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<button class="sc-button bt-create" @click="addPerson">Add Person</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import persons_associated from './components/PersonsAssociated.vue'
|
import { createApp } from 'vue';
|
||||||
|
|
||||||
export default {
|
const App = {
|
||||||
name: 'app',
|
name: 'AppAccompanyingCourse',
|
||||||
components: {
|
//delimiters: ['${', '}'], works only for template "in browser", not for template in vue files
|
||||||
persons_associated,
|
data() {
|
||||||
|
return { course:
|
||||||
|
{
|
||||||
|
id: 50,
|
||||||
|
opening_date: null,
|
||||||
|
closing_date: null,
|
||||||
|
remark: 'bim',
|
||||||
|
closing_motive: 'bam',
|
||||||
|
counter: 0,
|
||||||
|
persons: []
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
courseId() {
|
||||||
|
return window.courseId;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async mounted() {
|
||||||
|
console.log('mounted');
|
||||||
|
console.log(this.data);
|
||||||
|
console.log(this.courseId);
|
||||||
|
await this.getCourse();
|
||||||
|
console.log(this.data);
|
||||||
|
console.log('mounted stop');
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getCourse() {
|
||||||
|
console.log('get course start');
|
||||||
|
console.log(this);
|
||||||
|
courseId = this.courseId;
|
||||||
|
let data_;
|
||||||
|
return fetch(`/fr/api/parcours/${courseId}/show`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
console.log(data);
|
||||||
|
console.log(this);
|
||||||
|
this.$data.course = data;
|
||||||
|
console.log(this.data);
|
||||||
|
console.log('get course finish');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export default App;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style></style>
|
||||||
</style>
|
|
||||||
|
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
import Vue from 'vue'
|
||||||
|
import VueResource from 'vue-resource'
|
||||||
|
|
||||||
|
Vue.use(VueResource);
|
||||||
|
|
||||||
|
export default {
|
||||||
|
template: '#vue-usagers',
|
||||||
|
delimiters: ['${', '}'],
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
persons_associated: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
root: 'http://localhost:8001/fr/api'
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
addPerson(){
|
||||||
|
this.persons_associated.persons.push({"firstname": "Lisa", "lastname": "Simpson", "startdate": "1975-09-15", "enddate": "2021-04-20" })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
counter() {
|
||||||
|
return this.persons_associated.persons.length;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.$resource('parcours/270/show').get().then((response) => {
|
||||||
|
this.persons_associated = response.data
|
||||||
|
}, (response) => {
|
||||||
|
console.log('erreur', response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
@@ -1,60 +1,12 @@
|
|||||||
<template>
|
|
||||||
<div class="vue-component">
|
|
||||||
<h3>Usagers concernés</h3>
|
|
||||||
<dl>
|
|
||||||
<dt>id</dt>
|
|
||||||
<dd>{{ persons_associated.id }}</dd>
|
|
||||||
<dt>opening_date</dt>
|
|
||||||
<dd>{{ persons_associated.opening_date }}</dd>
|
|
||||||
<dt>closing_date</dt>
|
|
||||||
<dd>{{ persons_associated.closing_date }}</dd>
|
|
||||||
<dt>remark</dt>
|
|
||||||
<dd>{{ persons_associated.remark }}</dd>
|
|
||||||
<dt>closing_motive</dt>
|
|
||||||
<dd>{{ persons_associated.closing_motive }}</dd>
|
|
||||||
</dl>
|
|
||||||
<label>{{counter}} usagers concernés</label>
|
|
||||||
<table class="rounded">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="chill-orange">firstname</th>
|
|
||||||
<th class="chill-orange">lastname</th>
|
|
||||||
<th class="chill-orange">startdate</th>
|
|
||||||
<th class="chill-orange">enddate</th>
|
|
||||||
<th class="chill-orange">actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr v-for="person in persons_associated.persons">
|
|
||||||
<td>{{ person.firstname }}</td>
|
|
||||||
<td>{{ person.lastname }}</td>
|
|
||||||
<td>{{ person.startdate }}</td>
|
|
||||||
<td>{{ person.enddate }}</td>
|
|
||||||
<td>
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li><a class="sc-button bt-show"></a></li>
|
|
||||||
<li><a class="sc-button bt-update"></a></li>
|
|
||||||
<li><a class="sc-button bt-delete"></a></li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<button class="sc-button bt-create" @click="addPerson">Add Person</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import VueResource from 'vue-resource'
|
import VueResource from 'vue-resource'
|
||||||
|
|
||||||
Vue.use(VueResource)
|
Vue.use(VueResource)
|
||||||
|
|
||||||
export default{
|
export default {
|
||||||
|
template: '#vue-usagers',
|
||||||
|
delimiters: ['${', '}'],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
persons_associated: []
|
persons_associated: []
|
||||||
@@ -74,15 +26,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.$resource('parcours/861/show').get().then((response) => {
|
this.$resource('parcours/270/show').get().then((response) => {
|
||||||
this.persons_associated = response.data
|
this.persons_associated = response.data
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
console.log('erreur', response);
|
console.log('erreur', response);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
10
src/Bundle/ChillPersonBundle/Resources/public/js/index.js
Normal file
10
src/Bundle/ChillPersonBundle/Resources/public/js/index.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import AccompanyingCourseComponent from './AccompanyingCourse.vue';
|
||||||
|
import { createApp } from 'vue';
|
||||||
|
|
||||||
|
|
||||||
|
const app = createApp({
|
||||||
|
name: 'AccCourseGlobal',
|
||||||
|
template: '<div class="abcde"><accompanying-course></accompanying-course></div>',
|
||||||
|
})
|
||||||
|
.component('accompanying-course', AccompanyingCourseComponent)
|
||||||
|
.mount('#app');
|
@@ -8,24 +8,14 @@
|
|||||||
|
|
||||||
<h1>{{ block('title') }}</h1>
|
<h1>{{ block('title') }}</h1>
|
||||||
|
|
||||||
{#
|
<script type="text/javascript">
|
||||||
<pre>
|
window.courseId = {{ accompanyingCourse.id|e('js') }};
|
||||||
{{ accompanyingCourse.id }}
|
console.log(window.courseId);
|
||||||
{{ accompanyingCourse.openingDate|format_date('short') }}
|
</script>
|
||||||
{{ accompanyingCourse.closingDate|format_date('short') }}
|
|
||||||
{{ accompanyingCourse.closingMotive|chill_entity_render_box }}
|
|
||||||
{{ accompanyingCourse.remark|raw }}
|
<div id="app"></div>
|
||||||
{{ accompanyingCourse.user }}
|
|
||||||
usagers:
|
{{ encore_entry_script_tags('accompanying_course') }}
|
||||||
{% for p in accompanyingCourse.participations %}
|
|
||||||
{{ p.person.id }} | <a href="{{ path('chill_person_accompanying_period_list', { person_id: p.person.id }) }}">{{ p.person.fullnamecanonical }}</a> | {{ p.startdate|format_date('short') }} | {{ p.enddate|format_date('short') }}
|
|
||||||
{% endfor %}
|
|
||||||
</pre>
|
|
||||||
{{ dump() }}
|
|
||||||
{% verbatim %}{% endverbatim %}
|
|
||||||
#}
|
|
||||||
|
|
||||||
<div id="app" data-name="{{ accompanyingCourse.id }}"></div>
|
|
||||||
{{ encore_entry_script_tags('vuejs') }}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -7,4 +7,7 @@ module.exports = function(encore, entries)
|
|||||||
encore.addAliases({
|
encore.addAliases({
|
||||||
ChillPersonAssets: __dirname + '/Resources/public'
|
ChillPersonAssets: __dirname + '/Resources/public'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
encore.addEntry('accompanying_course', __dirname + '/Resources/public/js/index.js');
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user