|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534 |
- <?php
-
- /**
- Copyright distrib (2018)
-
- contact@opendistrib.net
-
- Ce logiciel est un programme informatique servant à aider les producteurs
- à distribuer leur production en circuits courts.
-
- Ce logiciel est régi par la licence CeCILL soumise au droit français et
- respectant les principes de diffusion des logiciels libres. Vous pouvez
- utiliser, modifier et/ou redistribuer ce programme sous les conditions
- de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
- sur le site "http://www.cecill.info".
-
- En contrepartie de l'accessibilité au code source et des droits de copie,
- de modification et de redistribution accordés par cette licence, il n'est
- offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
- seule une responsabilité restreinte pèse sur l'auteur du programme, le
- titulaire des droits patrimoniaux et les concédants successifs.
-
- A cet égard l'attention de l'utilisateur est attirée sur les risques
- associés au chargement, à l'utilisation, à la modification et/ou au
- développement et à la reproduction du logiciel par l'utilisateur étant
- donné sa spécificité de logiciel libre, qui peut le rendre complexe à
- manipuler et qui le réserve donc à des développeurs et des professionnels
- avertis possédant des connaissances informatiques approfondies. Les
- utilisateurs sont donc invités à charger et tester l'adéquation du
- logiciel à leurs besoins dans des conditions permettant d'assurer la
- sécurité de leurs systèmes et ou de leurs données et, plus généralement,
- à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
-
- Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
- pris connaissance de la licence CeCILL, et que vous en avez accepté les
- termes.
- */
-
- \backend\assets\VuejsDistributionIndexAsset::register($this);
-
- $this->setTitle('Distributions') ;
- $this->setPageTitle('Distributions') ;
-
- ?>
- <div id="app-distribution-index" class="app-vuejs">
- <?php if(strlen($date)): ?>
- <span id="distribution-date"><?= $date; ?></span>
- <?php endif; ?>
- <div id="loading" v-if="showLoading">
- <img src="<?= Yii::$app->urlManagerBackend->getBaseUrl(); ?>/img/loader.gif" alt="Chargement ..." />
- </div>
- <div id="wrapper-app-distribution-index" :class="'wrapper-app-vuejs '+(loading ? '' : 'loaded')">
- <div class="col-md-4">
- <div id="calendar">
- <v-date-picker
- is-inline
- is-expanded
- v-model="date"
- popover-visibility="hidden"
- firstDayOfWeek="1"
- :mode="calendar.mode"
- :formats="calendar.formats"
- :theme-styles="calendar.themeStyles"
- :attributes="calendar.attrs"
- @dayclick='dayClicked'>
- ></v-date-picker>
- </div>
- <div class="clr"></div>
- </div>
- <div class="col-md-8">
- <div v-if="date">
- <div id="infos-top">
- <div class="col-md-12">
- <div class="info-box" id="info-box-distribution">
- <span :class="'info-box-icon '+(distribution.active ? 'bg-green' : 'bg-red')"><i :class="'fa '+(distribution.active ? 'fa-check' : 'fa-remove')"></i></span>
- <div class="info-box-content">
- <span class="info-box-text">
- <h4>Distribution du <strong>{{ dateFormat }}</strong></h4>
- <a @click="activeWeekDistribution" data-active="0" class="btn btn-default btn-active-week" v-if="oneDistributionWeekActive">Désactiver cette semaine</a>
- <a @click="activeWeekDistribution" data-active="1" class="btn btn-default btn-active-week" v-else>Activer cette semaine</a>
-
- <a @click="activeDistribution" data-active="0" class="btn btn-default" v-if="distribution.active">Désactiver ce jour</a>
- <a @click="activeDistribution" data-active="1" class="btn btn-default" v-else>Activer ce jour</a>
- </span>
- </div>
- </div>
- </div>
-
- <!-- produits -->
- <div class="col-md-6">
- <div class="info-box col-md-4">
- <span class="info-box-icon bg-yellow"><i class="fa fa-clone"></i></span>
- <div class="info-box-content">
- <span class="info-box-text">
- {{ countActiveProducts }} Produits<br /><br />
- <button class="btn btn-default" @click="showModalProducts = true">Configurer</button>
- </span>
- </div>
- </div>
- </div>
- <modal v-if="showModalProducts" id="modal-products" @close="showModalProducts = false">
- <h3 slot="header">Produits</h3>
- <div slot="body">
- <table class="table table-condensed table-bordered table-hover">
- <thead>
- <tr>
- <td>Actif</td>
- <td>Nom</td>
- <td class="quantity-ordered">Commandé</td>
- <td class="quantity-max">Maximum</td>
- </tr>
- </thead>
- <tbody>
- <tr v-for="product in products">
- <td>
- <button class="btn btn-success" v-if="product.productDistribution[0].active == 1"><span class="glyphicon glyphicon-ok"></span></button>
- <button class="btn btn-default" v-else data-active-product="1" :data-id-product="product.id" @click="productActiveClick"><span class="glyphicon glyphicon-ok"></span></button>
- <button class="btn btn-danger" v-if="product.productDistribution[0].active == 0"><span class="glyphicon glyphicon-remove"></span></button>
- <button class="btn btn-default" v-else data-active-product="0" :data-id-product="product.id" @click="productActiveClick"><span class="glyphicon glyphicon-remove"></span></button>
- </td>
- <td>{{ product.name }}</td>
- <td class="quantity-ordered">{{ product.quantity_ordered ? product.quantity_ordered : '-' }}</td>
- <td class="quantity-max"><input type="text" class="form-control quantity-max" placeholder="∞" :data-id-product="product.id" v-model="product.productDistribution[0].quantity_max" @keyup="productQuantityMaxChange" /></td>
- </tr>
- </tbody>
- </table>
- </div>
- <div slot="footer">
- <div class="actions-form">
- <button class="modal-default-button btn btn-default" @click="closeModalProducts">Fermer</button>
- </div>
- </div>
- </modal>
-
- <div class="col-md-6">
- <div class="info-box col-md-4">
- <span class="info-box-icon bg-yellow"><i class="fa fa-map-marker"></i></span>
- <div class="info-box-content">
- <span class="info-box-text">
- {{ countActivePointsSale }} Points de vente<br /><br />
- <button class="btn btn-default" @click="showModalPointsSale = true">Configurer</button>
- </span>
- </div>
- </div>
- </div>
- <modal v-if="showModalPointsSale" id="modal-points-sale" @close="showModalPointsSale = false">
- <h3 slot="header">Points de vente</h3>
- <div slot="body">
- <table class="table table-condensed table-bordered table-hover">
- <thead>
- <tr>
- <td>Actif</td>
- <td>Nom</td>
- </tr>
- </thead>
- <tbody>
- <tr v-for="pointSale in pointsSale">
- <td>
- <button class="btn btn-success" v-if="pointSale.pointSaleDistribution[0].delivery == 1"><span class="glyphicon glyphicon-ok"></span></button>
- <button class="btn btn-default" v-else data-delivery-point-sale="1" :data-id-point-sale="pointSale.id" @click="pointSaleActiveClick"><span class="glyphicon glyphicon-ok"></span></button>
- <button class="btn btn-danger" v-if="pointSale.pointSaleDistribution[0].delivery == 0"><span class="glyphicon glyphicon-remove"></span></button>
- <button class="btn btn-default" v-else data-delivery-point-sale="0" :data-id-point-sale="pointSale.id" @click="pointSaleActiveClick"><span class="glyphicon glyphicon-remove"></span></button>
- </td>
- <td>{{ pointSale.name }}</td>
- </tr>
- </tbody>
- </table>
- </div>
- </modal>
-
- <div class="col-md-6">
- <div id="summary-ca-weight" class="info-box col-md-4">
- <span class="info-box-icon bg-yellow"><i class="fa fa-euro"></i></span>
- <div class="info-box-content">
- <span class="info-box-text">CA</span>
- <span class="info-box-number">{{ distribution.revenues }} <span class="normal" v-if="distribution.potential_revenues != '0.00 €'">/ {{ distribution.potential_revenues }}</span></span>
- <span class="info-box-text">Poids</span>
- <span class="info-box-number">{{ distribution.weight }} kg <span class="normal" v-if="distribution.potential_weight > 0">/ {{ distribution.potential_weight }} kg</span></span>
- </div>
- </div>
- </div>
- <div class="col-md-6">
- <div class="info-box col-md-4">
- <span class="info-box-icon bg-yellow"><i class="fa fa-download"></i></span>
- <div class="info-box-content">
- <span class="info-box-text">
- {{ countOrders }} Commande<span v-if="countOrders > 1">s</span><br />
-
- <a href="#" class="btn btn-xs btn-default" disabled="disabled" v-if="countOrders == 0">Télécharger (PDF)</a>
- <a :href="distribution.url_report" class="btn btn-default">Télécharger (PDF)</a><br />
-
- <a href="#" class="btn btn-xs btn-default" disabled="disabled" v-if="countOrders == 0">Télécharger (CSV)</a>
- <a :href="distribution.url_report+'&type=csv'" class="btn btn-default">Télécharger (CSV)</a>
- </span>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <div class="callout callout-info" v-else>
- <h4><i class="fa fa-info"></i> Pour commencer</h4>
- <p>Veuillez choisir une date de distribution.</p>
- </div>
- </div>
-
- <div class="clr"></div>
-
- <div id="orders" class="panel panel-default" v-if="date">
- <div class="panel-heading">
- <h3 class="panel-title">Commandes <label class="label label-success" v-if="orders.length">{{ orders.length }}</label><label class="label label-danger" v-else>0</label></h3>
- </div>
- <div class="panel-body">
- <button id="btn-add-subscriptions" @click="addSubscriptions" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span> Importer les abonnements</button>
- <button id="btn-add-order" @click="showModalFormOrderCreate = true" class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-plus"></span> Ajouter une commande</button>
- <order-form
- v-if="showModalFormOrderCreate"
- :date="date"
- :order="orderCreate"
- :points-sale="pointsSale"
- :users="users"
- :products="products"
- @close="showModalFormOrderCreate = false"
- @ordercreatedupdated="orderCreatedUpdated"
- ></order-form>
-
- <div id="wrapper-nav-points-sale">
- <ul id="nav-points-sale">
- <li data-id-point-sale="0" data-id-point-sale="0" v-if="countActivePointsSale > 1" @click="pointSaleClick">
- <a class="btn btn-default btn-primary" v-if="idActivePointSale == 0">Tous <span class="label label-default">{{ orders.length }}</span> <span class="glyphicon glyphicon-triangle-bottom"></span></a>
- <a class="btn btn-default" v-else>Tous <span class="label label-default">{{ orders.length }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a>
- </li>
- <li v-for="pointSale in pointsSale" :data-id-point-sale="pointSale.id" v-if="pointSale.pointSaleDistribution[0].delivery == 1" @click="pointSaleClick">
- <a class="btn btn-default btn-primary" v-if="idActivePointSale == pointSale.id">{{ pointSale.name }} <span class="label label-default">{{ countOrdersByPointSale[pointSale.id] }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a>
- <a class="btn btn-default" v-else>{{ pointSale.name }} <span class="label label-default">{{ countOrdersByPointSale[pointSale.id] }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a>
- </li>
- </ul>
- <div class="clr"></div>
- </div>
- <table class="table table-condensed table-bordered table-hover" v-if="countOrdersByPointSale[idActivePointSale] > 0 || (idActivePointSale == 0 && orders.length > 0)">
- <tbody>
- <template v-for="(order, key, index) in orders" v-if="idActivePointSale == 0 || idActivePointSale == order.id_point_sale">
- <tr>
- <td>
- <label class="label label-success" v-if="order.origin == 'user'">client</label>
- <label class="label label-default" v-else-if="order.origin == 'auto'">auto</label>
- <label class="label label-warning" v-else>admin</label>
- </td>
- <td>
- <span class="label label-danger" v-if="order.date_delete"><span class="glyphicon glyphicon-trash"></span></span>
- <span class="label label-warning" v-if="order.date_update"><span class="glyphicon glyphicon-pencil"></span></span>
- <span class="label label-success" v-if="!order.date_update && !order.date_delete"><span class="glyphicon glyphicon-check"></span></span>
- </td>
- <td>
- <span v-if="order.user">{{ order.user.lastname+' '+order.user.name }}</span>
- <span v-else>{{ order.username }}</span>
- <span v-if="order.comment && order.comment.length > 0" class="glyphicon glyphicon-comment"></span>
- </td>
- <td v-if="idActivePointSale == 0">
- {{ order.pointSale.name }}
- </td>
- <td>{{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}</td>
- <td class="column-state-payment">
- <div class="input-group">
- <span class="label label-success input-group-addon" v-if="order.amount_paid == order.amount">payé</span>
- <span class="label label-default input-group-addon" v-else-if="order.amount_paid == 0">non réglé</span>
- <span class="label label-default input-group-addon" v-else-if="order.amount_paid > order.amount">surplus</span>
- <span class="label label-warning input-group-addon" v-else-if="order.amount_paid < order.amount">reste à payer</span>
-
- <span class="glyphicon glyphicon-time" title="Paiement automatique" v-if="order.auto_payment && producer.credit && (order.amount_paid == 0 || order.amount_paid < order.amount)"></span>
- </div>
- </td>
- <td class="column-payment" v-if="producer.credit">
- <div class="btn-group" v-if="order.user && !order.date_delete">
- <button class="btn btn-xs btn-default" v-if="order.amount_paid == order.amount" @click="orderPaymentClick" :data-id-order="order.id" data-type="refund" :data-amount="order.amount">
- <span class="glyphicon glyphicon-euro"></span> Rembourser
- </button>
- <button class="btn btn-xs btn-default" v-else-if="order.amount_paid == 0" @click="orderPaymentClick" :data-id-order="order.id" data-type="payment" :data-amount="order.amount">
- <span class="glyphicon glyphicon-euro"></span> Payer
- </button>
- <button class="btn btn-xs btn-default" v-else-if="order.amount_paid < order.amount" @click="orderPaymentClick" :data-id-order="order.id" data-type="payment" :data-amount="order.amount_remaining">
- <span class="glyphicon glyphicon-euro"></span> Payer
- </button>
- <button class="btn btn-xs btn-default" v-else-if="order.amount_paid > order.amount" @click="orderPaymentClick" :data-id-order="order.id" data-type="refund" :data-amount="order.amount_surplus">
- <span class="glyphicon glyphicon-euro"></span> Rembourser
- </button>
-
- <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
- <span class="caret"></span>
- <span class="sr-only">Toggle Dropdown</span>
- </button>
- <ul class="dropdown-menu">
- <li><a href="javascript:void(0);" @click="orderPaymentModalClick" :data-id-order="order.id">Historique</a></li>
- </ul>
- </div>
- </td>
- <td class="column-actions">
- <span v-if="order.oneProductUnactivated" class="glyphicon glyphicon-warning-sign" title="Contient un produit non activé"></span>
- <button class="btn btn-default" :data-id-order="order.id" @click="orderViewClick"><span :class="'glyphicon ' + ((showViewProduct && idOrderView == order.id) ? 'glyphicon-eye-close' : 'glyphicon-eye-open')"></span></button>
- <button class="btn btn-default" :data-id-order="order.id" @click="updateOrderClick"><span class="glyphicon glyphicon-pencil"></span></button>
- <button class="btn btn-default" :data-id-order="order.id" @click="deleteOrderClick"><span class="glyphicon glyphicon-trash"></span></button>
- <a class="btn btn-default" :href="baseUrl+'/subscription/update?id='+order.id_subscription" v-if="order.id_subscription > 0"><span class="glyphicon glyphicon-repeat"></span></a>
- <a class="btn btn-default add-subscription" :href="baseUrl+'/subscription/create?idOrder='+order.id" v-else><span class="glyphicon glyphicon-plus"></span><span class="glyphicon glyphicon-repeat"></span></a>
-
- <order-form
- v-if="showModalFormOrderUpdate && idOrderUpdate == order.id"
- :date="date"
- :id-point-sale="idActivePointSale"
- :points-sale="pointsSale"
- :users="users"
- :products="products"
- :order="ordersUpdate[key]"
- @close="showModalFormOrderUpdate = false"
- @ordercreatedupdated="orderCreatedUpdated"
- ></order-form>
-
- <modal v-if="showModalPayment && idOrderPayment == order.id" class="modal-payment" @close="showModalPayment = false">
- <h3 slot="header">
- Commande du <strong>{{ dateFormat }}</strong> >
- <strong><span v-if="order.user">{{ order.user.name +' '+order.user.lastname }}</span>
- <span v-else>{{ order.username }}</span></strong>
- </h3>
- <div slot="body">
- <div class="col-md-4">
- <div class="info-box">
- <span :class="'info-box-icon ' +((order.amount_paid == order.amount) ? 'bg-green' : 'bg-red')"><i class="fa fa-check"></i></span>
- <div class="info-box-content">
- <span class="info-box-text">Montant</span>
- <span class="info-box-number">{{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}</span>
- <span class="info-box-text">
- Statut<br />
- <span class="label label-success" v-if="order.amount_paid == order.amount">payé</span>
- <span class="label label-default" v-else-if="order.amount_paid == 0">non réglé</span>
- <span class="label label-default" v-else-if="order.amount_paid > order.amount">surplus</span>
- <span class="label label-warning" v-else-if="order.amount_paid < order.amount">reste à payer</span>
- </span>
- </div>
- </div>
-
- <div class="info-box">
- <span :class="'info-box-icon ' +((order.user.credit > 0) ? 'bg-green' : 'bg-red')"><i class="fa fa-user"></i></span>
- <div class="info-box-content">
- <span class="info-box-text">Crédit utilisateur</span>
- <span class="info-box-number">{{ order.user.credit.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}</span>
- </div>
- </div>
-
- <button v-if="order.amount_paid == order.amount"
- class="btn btn-default"
- :data-amount="order.amount"
- data-type="refund"
- @click="orderPaymentClick" >
- <span class="glyphicon glyphicon-chevron-right"></span>
- Rembourser {{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
- </button>
-
- <button v-else-if="order.amount_paid == 0"
- class="btn btn-default"
- :data-amount="order.amount"
- data-type="payment"
- @click="orderPaymentClick">
- <span class="glyphicon glyphicon-chevron-right"></span>
- Payer {{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
- </button>
-
- <button v-else-if="order.amount_paid > order.amount"
- class="btn btn-default"
- :data-amount="order.amount_surplus"
- data-type="refund"
- @click="orderPaymentClick">
- <span class="glyphicon glyphicon-chevron-right"></span>
- Rembourser {{ order.amount_surplus.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
- </button>
-
- <button v-else-if="order.amount_paid < order.amount"
- class="btn btn-default"
- :data-amount="order.amount_remaining"
- data-type="payment"
- @click="orderPaymentClick">
- <span class="glyphicon glyphicon-chevron-right"></span>
- Payer le restant {{ order.amount_remaining.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
- </button>
- </div>
-
- <div class="col-md-8">
- <h4>Historique paiement</h4>
- <table class="table table-condensed table-bordered table-hover">
- <thead>
- <tr>
- <td>Date</td>
- <td>Utilisateur</td>
- <td>Action</td>
- <td>- Débit</td>
- <td>+ Crédit</td>
- </tr>
- </thead>
- <tbody>
- <tr v-for="creditHistory in order.creditHistory">
- <td>{{ creditHistory.date }}</td>
- <td>{{ creditHistory.user_action }}</td>
- <td v-html="creditHistory.wording"></td>
- <td v-html="creditHistory.debit"></td>
- <td v-html="creditHistory.credit"></td>
- </tr>
- </tbody>
- </table>
- </div>
-
- </div>
- </modal>
-
- </td>
- </tr>
- <tr class="view" v-if="showViewProduct && idOrderView == order.id">
- <td colspan="6">
- <strong><span class="glyphicon glyphicon-menu-right"></span> Produits</strong>
- <ul>
- <li v-for="product in products" v-if="order.productOrder[product.id] > 0">
- {{ order.productOrder[product.id] }} x {{ product.name }} <span v-if="product.productDistribution[0].active == 0" class="glyphicon glyphicon-warning-sign" title="Ce produit n'est pas activé"></span>
- </li>
- </ul>
- <div v-if="order.comment && order.comment.length > 0" class="comment">
- <strong><span class="glyphicon glyphicon-menu-right"></span> Commentaire</strong><br />
- {{ order.comment }}
- </div>
- </td>
- </tr>
- </template>
- </tbody>
- </table>
- <div class="alert alert-warning" v-else>
- Aucune commande
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <!-- template for the order-form component -->
- <script type="text/x-template" id="order-form-template">
- <modal class="modal-form-order" @close="$emit('close')">
- <h3 slot="header">Ajouter une commande</h3>
- <div slot="body">
- <div class="callout callout-warning" v-if="errors.length">
- <ul>
- <li v-for="error in errors">{{ error }}</li>
- </ul>
- </div>
- <div class="col-md-4">
- <div class="form-group">
- <label class="control-label" for="select-id-point-sale">Point de vente</label>
- <select class="form-control" id="select-id-point-sale" v-model="order.id_point_sale">
- <option v-for="pointSale in pointsSale" v-if="pointSale.pointSaleDistribution[0].delivery == 1" :value="pointSale.id">{{ pointSale.name }}</option>
- </select>
- </div>
- <div class="form-group">
- <label class="control-label" for="select-id-user">Utilisateur</label>
- <select class="form-control" v-model="order.id_user">
- <option v-for="user in users" :value="user.id_user">{{ user.lastname +' '+ user.name }}</option>
- </select>
- <input v-model="order.username" type="text" class="form-control" placeholder="Ou saisissez ici le nom de l'utilisateur" />
- </div>
- <div class="form-group">
- <label class="control-label" for="textarea-comment">Commentaire</label>
- <textarea class="form-control" id="textarea-comment" v-model="order.comment"></textarea>
- </div>
- </div>
- <div class="col-md-8">
- <label class="control-label">Produits</label>
- <table class="table table-condensed table-bordered table-hover table-products">
- <tbody>
- <tr v-for="product in products" :class="(order.productOrder[product.id] > 0) ? 'product-ordered' : ''">
- <td>
- <span class="label label-success" v-if="product.productDistribution[0].active == 1">Actif</span>
- <span class="label label-danger" v-else>Inactif</span>
- </td>
- <td>{{ product.name }}</td>
- <td class="quantity">
- <div class="input-group">
- <span class="input-group-btn">
- <button class="btn btn-default btn-moins" type="button" @click="productQuantityClick(product.id, -1)"><span class="glyphicon glyphicon-minus"></span></button>
- </span>
- <input type="text" v-model="order.productOrder[product.id]" class="form-control" />
- <span class="input-group-btn">
- <button class="btn btn-default btn-plus" type="button" @click="productQuantityClick(product.id, 1)"><span class="glyphicon glyphicon-plus"></span></button>
- </span>
- </div>
- </td>
- <td class="quantity-remaining">/ {{ product.quantity_remaining }}</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div slot="footer">
- <div class="actions-form">
- <button class="modal-default-button btn btn-primary" @click="submitFormCreate" v-if="!order.id && order.id_user" data-process-credit="1">Créer et payer</button>
- <button class="modal-default-button btn btn-primary" @click="submitFormUpdate" v-if="order.id && order.id_user" data-process-credit="1">Modifier et payer</button>
-
- <button class="modal-default-button btn btn-primary" @click="submitFormUpdate" v-if="order.id">Modifier</button>
- <button class="modal-default-button btn btn-primary" @click="submitFormCreate" v-else>Créer</button>
-
- <button class="modal-default-button btn btn-default" @click="$emit('close')">Annuler</button>
- </div>
- </div>
- </modal>
- </script>
-
- <!-- template for the modal component -->
- <script type="text/x-template" id="modal-template">
- <transition name="modal">
- <div class="modal-mask">
- <div class="modal-wrapper">
- <div class="modal-container">
-
- <div class="modal-header">
- <slot name="header"></slot>
- </div>
-
- <div class="modal-body">
- <slot name="body"></slot>
- </div>
-
- <div class="modal-footer">
- <slot name="footer">
- <button class="modal-default-button btn btn-default" @click="$emit('close')">Fermer</button>
- </slot>
- </div>
- </div>
- </div>
- </div>
- </transition>
- </script>
-
|