GestionCommande affichage Serveur
This commit is contained in:
parent
89fb69f680
commit
e0ab72d41e
76
public/js/GestionCommande/GestionCommande.js
Normal file
76
public/js/GestionCommande/GestionCommande.js
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
document.querySelector('.btn-gestion-commandes').addEventListener('click', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
document.getElementById('container_modal');
|
||||||
|
|
||||||
|
fetch('/commandes')
|
||||||
|
.then(response => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Erreur de chargement de la section Promotions');
|
||||||
|
}
|
||||||
|
return response.text();
|
||||||
|
})
|
||||||
|
.then(html => {
|
||||||
|
// Insérer le HTML dans le conteneur et l'afficher
|
||||||
|
container_modal.innerHTML = html;
|
||||||
|
container_modal.style.display = 'block';
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Erreur:', error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function addCommandes (event) {
|
||||||
|
document.getElementById('container_modal');
|
||||||
|
fetch(`/commandes/new`)
|
||||||
|
.then(response => {
|
||||||
|
return response.text();
|
||||||
|
})
|
||||||
|
.then(html => {
|
||||||
|
// Insérer le HTML dans le conteneur et l'afficher
|
||||||
|
container_modal.innerHTML = html;
|
||||||
|
container_modal.style.display = 'block';
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Erreur:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function updateCommandes (event) {
|
||||||
|
document.getElementById('container_modal');
|
||||||
|
const commandesIdString = event.getAttribute('data-id');
|
||||||
|
let commandesId = parseInt(commandesIdString);
|
||||||
|
|
||||||
|
fetch(`/commandes/${commandesId}/edit`)
|
||||||
|
.then(response => {
|
||||||
|
return response.text();
|
||||||
|
})
|
||||||
|
.then(html => {
|
||||||
|
// Insérer le HTML dans le conteneur et l'afficher
|
||||||
|
container_modal.innerHTML = html;
|
||||||
|
container_modal.style.display = 'block';
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Erreur:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteCommandes (event) {
|
||||||
|
document.getElementById('container_modal');
|
||||||
|
const commandesIdString = event.getAttribute('data-id');
|
||||||
|
let commandesId = parseInt(commandesIdString);
|
||||||
|
|
||||||
|
fetch(`/commandes/${commandesId}`)
|
||||||
|
.then(response => {
|
||||||
|
return response.text();
|
||||||
|
})
|
||||||
|
.then(html => {
|
||||||
|
// Insérer le HTML dans le conteneur et l'afficher
|
||||||
|
container_modal.innerHTML = html;
|
||||||
|
container_modal.style.display = 'block';
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Erreur:', error);
|
||||||
|
});
|
||||||
|
}
|
@ -11,3 +11,6 @@
|
|||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
{% block javascripts %}
|
||||||
|
<script src="{{ asset('js/GestionPromotion/GestionPromotion.js') }}" defer></script>
|
||||||
|
{% endblock %}
|
@ -31,7 +31,7 @@
|
|||||||
{{ include('commandes/_delete_form.html.twig') }}
|
{{ include('commandes/_delete_form.html.twig') }}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<a href="{{ path('app_commandes_edit', {'id': commande.id}) }}">Modifier</a>
|
<button onclick="updateCommandes(this)" data-id="{{ commande.id }}" href="{{ path('app_commandes_edit', {'id': commande.id}) }}">Modifier</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% else %}
|
{% else %}
|
||||||
@ -41,6 +41,5 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<button onclick="addCommandes(this)" href="{{ path('app_commandes_new') }}">Créer une réduction</button>
|
||||||
<a href="{{ path('app_commandes_new') }}">Créer une nouvelle commande</a>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<div class="btn-custom icon-container">
|
<div class="btn-custom btn-gestion-commandes icon-container">
|
||||||
<i class="icon-medium"> {{ ux_icon('icon-park-outline:view-list') }}</i>
|
<i class="icon-medium"> {{ ux_icon('icon-park-outline:view-list') }}</i>
|
||||||
<span>Commande</span>
|
<span>Commande</span>
|
||||||
</div>
|
</div>
|
||||||
@ -132,6 +132,7 @@
|
|||||||
|
|
||||||
{% block javascripts %}
|
{% block javascripts %}
|
||||||
<script src="{{ asset('js/Compte/CompteModal.js') }}" defer></script>
|
<script src="{{ asset('js/Compte/CompteModal.js') }}" defer></script>
|
||||||
|
<script src="{{ asset('js/GestionCommande/GestionCommande.js') }}" defer></script>
|
||||||
<script src="{{ asset('js/GestionUtilisateurs/GestionUtilisateurs.js') }}" defer></script>
|
<script src="{{ asset('js/GestionUtilisateurs/GestionUtilisateurs.js') }}" defer></script>
|
||||||
<script src="{{ asset('js/GestionPromotion/GestionPromotion.js') }}" defer></script>
|
<script src="{{ asset('js/GestionPromotion/GestionPromotion.js') }}" defer></script>
|
||||||
<script src="{{ asset('js/GestionTables/GestionTables.js') }}" defer></script>
|
<script src="{{ asset('js/GestionTables/GestionTables.js') }}" defer></script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user