%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/storage/framework/views/
Upload File :
Create Path :
Current File : //var/www/html/storage/framework/views/dbc19a74f962527c9bc4441e6e0797864f2260ac.php

<!-- Modal add commande-->
<div class="modal fade" id="editCommandeModal" tabindex="-1" role="dialog" aria-labelledby="editCommandeModalLabel"
    aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="editCommandeModalLabel">J2HB | Modifier Commande</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <form method="POST" action="<?php echo e(route('store_commande')); ?>">
                <?php echo csrf_field(); ?>
                <div class="modal-body">
                    <div class="container-fluid">
                        <div class="row col-12">
                            <div id="product-array-edit" class="col-12">
                                <div class="form-group mb-3 product-array">
                                    <input type="hidden" name="id[]">
                                    <div class="input-group">
                                        <select name="product_id[]" class="form-control form-control-user">
                                            <option value="0">Sélectionnez le produit :</option>
                                            <?php $__currentLoopData = $produits; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <optgroup label="<?php echo e($product->name_prod); ?>">
                                                    <?php $__currentLoopData = $product->references; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $reference): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($reference->id); ?>" data-product-price="<?php echo e($reference->prixvente); ?>" <?php if(!$reference->in_stock): ?> disabled <?php endif; ?>><?php echo e($reference->parent->name_prod); ?> | <?php echo e($reference->marque->marque); ?> | <?php echo e($reference->prixvente); ?>DH</option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if($product->prod_type == 'Abonnement' || $product->prod_type == 'Service'): ?>
                                                        <option value="<?php echo e($product->id); ?>" data-product-price="<?php echo e($product->prixvente); ?>"><?php echo e($product->prod_type); ?> | <?php echo e($product->name_prod); ?> | <?php echo e($product->prixvente); ?>DH</option>
                                                    <?php endif; ?>
                                                </optgroup>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                        <span class="input-group-text product-price">0DH</span>
                                        <input type="number" class="form-control form-control-user" name="remise[]"
                                            placeholder="remise" value="0">
                                        <span class="input-group-text product-final">0DH</span>
                                        <button type="button" class="btn btn-primary product-array-add"><i
                                                class="fa fa-plus" aria-hidden="true"></i><i class="fa fa-times"
                                                aria-hidden="true"></i></button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row col-12">
                            <div class="col-12">
                                <div class="form-group mb-3">
                                    <select name="livreur" id="edit_livreur" class="form-control form-control-user">
                                        <option value="CTM"> CTM </option>
                                        <option value="Amana">Amana</option>
                                        <option value="J2HB">J2HB</option>
                                        <option value="wataniya">wataniya</option>
                                        <option value="Autres">Autres</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="row col-12" data-livr-type="Autres">
                            <div class="col-12">
                                <div class="form-group mb-3">
                                    <input type="text" class="form-control form-control-user" id="edit_autre_livraison" name="autre_livraison"
                                        placeholder="Autre livreur">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row col-12 justify-content-center">
                        <button type="submit" class="btn btn-primary btn-user">Modifier</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- Modal add -->
<script>
    $(document).ready(function() {
        var prod_array = $('#product-array-edit .product-array').clone();
        $(document).on('click', '.product-array-add', function() {
            $(this).removeClass('product-array-add');
            $(this).addClass('product-array-remove');
            prod_array = $("#product-array").append(prod_array).find('.product-array');
            prod_array = prod_array.eq(prod_array.length - 1).clone();
        });
        $(document).on('click', '.product-array-remove', function() {
            $(this).parents('.product-array').remove();
        });
        $(document).on('change', '[name="product_id[]"]', function(e) {
            var p = $(this).find('option:selected').attr('data-product-price');
            if( !p )
                return false;
            var r = $(this).next('.product-price').text(p + 'DH').next('[name="remise[]"]').val();
            var f = p - r;
            if( f < 0 ) {
                f = p;
                $(this).next('.product-price').next('[name="remise[]"]').val(0);
            }
            $(this).next('.product-price').next('[name="remise[]"]').next('.product-final').text(f == 0 ? 'Gratuit' : f + 'DH');
        });
        $(document).on('input', '[name="remise[]"]', function() {
            var p = $(this).siblings('[name="product_id[]"]').trigger('change');
        });
        $('#edit_livreur').on('change', function() {
            var type = $(this).val();
            $('[data-livr-type]').addClass('d-none');
            $('[data-livr-type=' + type + ']').removeClass('d-none');
        }).trigger('change');
        $(document).on('click', '[data-commande-object]', function () {
            var commande = JSON.parse($(this).attr('data-commande-object'));
            $('#edit_livreur').val(commande.livreur).trigger('change');
            $('#edit_autre_livraison').val(commande.autre_livraison);
            $('#product-array-edit .product-array').not('#product-array-edit .product-array:last').remove();
            $.each(commande.commande_products, function (index, comm) {
                $("#product-array-edit").prepend(prod_array);
                $(prod_array).find('.product-array-add').removeClass('product-array-add').addClass('product-array-remove');
                prod_array.find('[name="product_id[]"]').val(comm.product.id);
                prod_array.find('[name="remise[]"]').val(comm.remise);
                prod_array.find('[name="id[]"]').val(comm.id);
                prod_array = $('#product-array-edit .product-array:last').clone();
            });
            $(document).find('[name="product_id[]"]').trigger('change');
            $('#editCommandeModal').modal('show');
        });
    });
</script><?php /**PATH C:\xampp\htdocs\gestionstock\resources\views/components/edit-commande-modal.blade.php ENDPATH**/ ?>

Zerion Mini Shell 1.0