Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

528 lines
36KB

  1. <?php
  2. /**
  3. Copyright distrib (2018)
  4. contact@opendistrib.net
  5. Ce logiciel est un programme informatique servant à aider les producteurs
  6. à distribuer leur production en circuits courts.
  7. Ce logiciel est régi par la licence CeCILL soumise au droit français et
  8. respectant les principes de diffusion des logiciels libres. Vous pouvez
  9. utiliser, modifier et/ou redistribuer ce programme sous les conditions
  10. de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
  11. sur le site "http://www.cecill.info".
  12. En contrepartie de l'accessibilité au code source et des droits de copie,
  13. de modification et de redistribution accordés par cette licence, il n'est
  14. offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
  15. seule une responsabilité restreinte pèse sur l'auteur du programme, le
  16. titulaire des droits patrimoniaux et les concédants successifs.
  17. A cet égard l'attention de l'utilisateur est attirée sur les risques
  18. associés au chargement, à l'utilisation, à la modification et/ou au
  19. développement et à la reproduction du logiciel par l'utilisateur étant
  20. donné sa spécificité de logiciel libre, qui peut le rendre complexe à
  21. manipuler et qui le réserve donc à des développeurs et des professionnels
  22. avertis possédant des connaissances informatiques approfondies. Les
  23. utilisateurs sont donc invités à charger et tester l'adéquation du
  24. logiciel à leurs besoins dans des conditions permettant d'assurer la
  25. sécurité de leurs systèmes et ou de leurs données et, plus généralement,
  26. à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
  27. Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
  28. pris connaissance de la licence CeCILL, et que vous en avez accepté les
  29. termes.
  30. */
  31. \backend\assets\VuejsDistributionIndexAsset::register($this);
  32. $this->setTitle('Distributions') ;
  33. $this->setPageTitle('Distributions') ;
  34. ?>
  35. <div id="app-distribution-index">
  36. <?php if(strlen($date)): ?>
  37. <span id="distribution-date"><?= $date; ?></span>
  38. <?php endif; ?>
  39. <div id="loading" v-if="showLoading">
  40. <img src="<?= Yii::$app->urlManagerBackend->getBaseUrl(); ?>/img/loader.gif" alt="Chargement ..." />
  41. </div>
  42. <div id="wrapper-app-distribution-index" :class="{'loaded': !loading}">
  43. <div class="col-md-4">
  44. <div id="calendar">
  45. <v-date-picker
  46. is-inline
  47. is-expanded
  48. v-model="date"
  49. popover-visibility="hidden"
  50. firstDayOfWeek="1"
  51. :mode="calendar.mode"
  52. :formats="calendar.formats"
  53. :theme-styles="calendar.themeStyles"
  54. :attributes="calendar.attrs"
  55. @dayclick='dayClicked'>
  56. ></v-date-picker>
  57. </div>
  58. <div class="clr"></div>
  59. </div>
  60. <div class="col-md-8">
  61. <div v-if="date">
  62. <div id="infos-top">
  63. <div class="col-md-12">
  64. <div class="info-box" id="info-box-distribution">
  65. <span :class="'info-box-icon '+(distribution.active ? 'bg-green' : 'bg-red')"><i :class="'fa '+(distribution.active ? 'fa-check' : 'fa-remove')"></i></span>
  66. <div class="info-box-content">
  67. <span class="info-box-text">
  68. <h4>Distribution du <strong>{{ dateFormat }}</strong></h4>
  69. <a @click="activeWeekDistribution" data-active="0" class="btn btn-default btn-active-week" v-if="oneDistributionWeekActive">Désactiver cette semaine</a>
  70. <a @click="activeWeekDistribution" data-active="1" class="btn btn-default btn-active-week" v-else>Activer cette semaine</a>
  71. <a @click="activeDistribution" data-active="0" class="btn btn-default" v-if="distribution.active">Désactiver ce jour</a>
  72. <a @click="activeDistribution" data-active="1" class="btn btn-default" v-else>Activer ce jour</a>
  73. </span>
  74. </div>
  75. </div>
  76. </div>
  77. <!-- produits -->
  78. <div class="col-md-6">
  79. <div class="info-box col-md-4">
  80. <span class="info-box-icon bg-yellow"><i class="fa fa-clone"></i></span>
  81. <div class="info-box-content">
  82. <span class="info-box-text">
  83. {{ countActiveProducts }} Produits<br /><br />
  84. <button class="btn btn-default" @click="showModalProducts = true">Configurer</button>
  85. </span>
  86. </div>
  87. </div>
  88. </div>
  89. <modal v-if="showModalProducts" id="modal-products" @close="showModalProducts = false">
  90. <h3 slot="header">Produits</h3>
  91. <div slot="body">
  92. <table class="table table-condensed table-bordered table-hover">
  93. <thead>
  94. <tr>
  95. <td>Actif</td>
  96. <td>Nom</td>
  97. <td class="quantity-ordered">Commandé</td>
  98. <td class="quantity-max">Maximum</td>
  99. </tr>
  100. </thead>
  101. <tbody>
  102. <tr v-for="product in products">
  103. <td>
  104. <button class="btn btn-success" v-if="product.productDistribution[0].active == 1"><span class="glyphicon glyphicon-ok"></span></button>
  105. <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>
  106. <button class="btn btn-danger" v-if="product.productDistribution[0].active == 0"><span class="glyphicon glyphicon-remove"></span></button>
  107. <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>
  108. </td>
  109. <td>{{ product.name }}</td>
  110. <td class="quantity-ordered">{{ product.quantity_ordered ? product.quantity_ordered : '-' }}</td>
  111. <td class="quantity-max"><input type="text" class="form-control quantity-max" placeholder="&infin;" :data-id-product="product.id" v-model="product.productDistribution[0].quantity_max" @keyup="productQuantityMaxChange" /></td>
  112. </tr>
  113. </tbody>
  114. </table>
  115. </div>
  116. <div slot="footer">
  117. <div class="actions-form">
  118. <button class="modal-default-button btn btn-default" @click="closeModalProducts">Fermer</button>
  119. </div>
  120. </div>
  121. </modal>
  122. <div class="col-md-6">
  123. <div class="info-box col-md-4">
  124. <span class="info-box-icon bg-yellow"><i class="fa fa-map-marker"></i></span>
  125. <div class="info-box-content">
  126. <span class="info-box-text">
  127. {{ countActivePointsSale }} Points de vente<br /><br />
  128. <button class="btn btn-default" @click="showModalPointsSale = true">Configurer</button>
  129. </span>
  130. </div>
  131. </div>
  132. </div>
  133. <modal v-if="showModalPointsSale" id="modal-points-sale" @close="showModalPointsSale = false">
  134. <h3 slot="header">Points de vente</h3>
  135. <div slot="body">
  136. <table class="table table-condensed table-bordered table-hover">
  137. <thead>
  138. <tr>
  139. <td>Actif</td>
  140. <td>Nom</td>
  141. </tr>
  142. </thead>
  143. <tbody>
  144. <tr v-for="pointSale in pointsSale">
  145. <td>
  146. <button class="btn btn-success" v-if="pointSale.pointSaleDistribution[0].delivery == 1"><span class="glyphicon glyphicon-ok"></span></button>
  147. <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>
  148. <button class="btn btn-danger" v-if="pointSale.pointSaleDistribution[0].delivery == 0"><span class="glyphicon glyphicon-remove"></span></button>
  149. <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>
  150. </td>
  151. <td>{{ pointSale.name }}</td>
  152. </tr>
  153. </tbody>
  154. </table>
  155. </div>
  156. </modal>
  157. <div class="col-md-6">
  158. <div id="summary-ca-weight" class="info-box col-md-4">
  159. <span class="info-box-icon bg-yellow"><i class="fa fa-euro"></i></span>
  160. <div class="info-box-content">
  161. <span class="info-box-text">CA</span>
  162. <span class="info-box-number">{{ distribution.revenues }} <span class="normal" v-if="distribution.potential_revenues != '0.00 €'">/ {{ distribution.potential_revenues }}</span></span>
  163. <span class="info-box-text">Poids</span>
  164. <span class="info-box-number">{{ distribution.weight }} kg <span class="normal" v-if="distribution.potential_weight > 0">/ {{ distribution.potential_weight }} kg</span></span>
  165. </div>
  166. </div>
  167. </div>
  168. <div class="col-md-6">
  169. <div class="info-box col-md-4">
  170. <span class="info-box-icon bg-yellow"><i class="fa fa-download"></i></span>
  171. <div class="info-box-content">
  172. <span class="info-box-text">
  173. {{ countOrders }} Commande<span v-if="countOrders > 1">s</span><br /><br />
  174. <a href="#" class="btn btn-default" disabled="disabled" v-if="countOrders == 0">Télécharger (PDF)</a>
  175. <a :href="distribution.url_report" class="btn btn-default" v-else>Télécharger (PDF)</a>
  176. </span>
  177. </div>
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. <div class="callout callout-info" v-else>
  183. <h4><i class="fa fa-info"></i> Pour commencer</h4>
  184. <p>Veuillez choisir une date de distribution.</p>
  185. </div>
  186. </div>
  187. <div class="clr"></div>
  188. <div id="orders" class="panel panel-default" v-if="date">
  189. <div class="panel-heading">
  190. <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>
  191. </div>
  192. <div class="panel-body">
  193. <button id="btn-add-order" @click="showModalFormOrderCreate = true" class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-plus"></span> Ajouter une commande</button>
  194. <order-form
  195. v-if="showModalFormOrderCreate"
  196. :date="date"
  197. :order="orderCreate"
  198. :points-sale="pointsSale"
  199. :users="users"
  200. :products="products"
  201. @close="showModalFormOrderCreate = false"
  202. @ordercreatedupdated="orderCreatedUpdated"
  203. ></order-form>
  204. <div id="wrapper-nav-points-sale">
  205. <ul id="nav-points-sale">
  206. <li data-id-point-sale="0" data-id-point-sale="0" v-if="countActivePointsSale > 1" @click="pointSaleClick">
  207. <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>
  208. <a class="btn btn-default" v-else>Tous <span class="label label-default">{{ orders.length }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a>
  209. </li>
  210. <li v-for="pointSale in pointsSale" :data-id-point-sale="pointSale.id" v-if="pointSale.pointSaleDistribution[0].delivery == 1" @click="pointSaleClick">
  211. <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>
  212. <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>
  213. </li>
  214. </ul>
  215. <div class="clr"></div>
  216. </div>
  217. <table class="table table-condensed table-bordered table-hover" v-if="countOrdersByPointSale[idActivePointSale] > 0 || (idActivePointSale == 0 && orders.length > 0)">
  218. <tbody>
  219. <template v-for="(order, key, index) in orders" v-if="idActivePointSale == 0 || idActivePointSale == order.id_point_sale">
  220. <tr>
  221. <td>
  222. <label class="label label-success" v-if="order.origin == 'user'">client</label>
  223. <label class="label label-default" v-else-if="order.origin == 'auto'">auto</label>
  224. <label class="label label-warning" v-else>admin</label>
  225. </td>
  226. <td>
  227. <span class="label label-danger" v-if="order.date_delete"><span class="glyphicon glyphicon-trash"></span></span>
  228. <span class="label label-warning" v-if="order.date_update"><span class="glyphicon glyphicon-pencil"></span></span>
  229. <span class="label label-success" v-if="!order.date_update && !order.date_delete"><span class="glyphicon glyphicon-check"></span></span>
  230. </td>
  231. <td>
  232. <span v-if="order.user">{{ order.user.lastname+' '+order.user.name }}</span>
  233. <span v-else>{{ order.username }}</span>
  234. <span v-if="order.comment && order.comment.length > 0" class="glyphicon glyphicon-comment"></span>
  235. </td>
  236. <td v-if="idActivePointSale == 0">
  237. {{ order.pointSale.name }}
  238. </td>
  239. <td>{{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+'&nbsp;€' }}</td>
  240. <td>
  241. <div class="input-group">
  242. <span class="label label-success input-group-addon" v-if="order.amount_paid == order.amount">payé</span>
  243. <span class="label label-default input-group-addon" v-else-if="order.amount_paid == 0">non réglé</span>
  244. <span class="label label-default input-group-addon" v-else-if="order.amount_paid > order.amount">surplus</span>
  245. <span class="label label-warning input-group-addon" v-else-if="order.amount_paid < order.amount">reste à payer</span>
  246. </div>
  247. </td>
  248. <td class="column-payment">
  249. <div class="btn-group" v-if="order.user && !order.date_delete">
  250. <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">
  251. <span class="glyphicon glyphicon-euro"></span> Rembourser
  252. </button>
  253. <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">
  254. <span class="glyphicon glyphicon-euro"></span> Payer
  255. </button>
  256. <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">
  257. <span class="glyphicon glyphicon-euro"></span> Payer
  258. </button>
  259. <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">
  260. <span class="glyphicon glyphicon-euro"></span> Rembourser
  261. </button>
  262. <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  263. <span class="caret"></span>
  264. <span class="sr-only">Toggle Dropdown</span>
  265. </button>
  266. <ul class="dropdown-menu">
  267. <li><a href="javascript:void(0);" @click="orderPaymentModalClick" :data-id-order="order.id">Historique</a></li>
  268. </ul>
  269. </div>
  270. </td>
  271. <td class="column-actions">
  272. <span v-if="order.oneProductUnactivated" class="glyphicon glyphicon-warning-sign" title="Contient un produit non activé"></span>
  273. <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>
  274. <button class="btn btn-default" :data-id-order="order.id" @click="updateOrderClick"><span class="glyphicon glyphicon-pencil"></span></button>
  275. <button class="btn btn-default" :data-id-order="order.id" @click="deleteOrderClick"><span class="glyphicon glyphicon-trash"></span></button>
  276. <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>
  277. <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>
  278. <order-form
  279. v-if="showModalFormOrderUpdate && idOrderUpdate == order.id"
  280. :date="date"
  281. :id-point-sale="idActivePointSale"
  282. :points-sale="pointsSale"
  283. :users="users"
  284. :products="products"
  285. :order="ordersUpdate[key]"
  286. @close="showModalFormOrderUpdate = false"
  287. @ordercreatedupdated="orderCreatedUpdated"
  288. ></order-form>
  289. <modal v-if="showModalPayment && idOrderPayment == order.id" class="modal-payment" @close="showModalPayment = false">
  290. <h3 slot="header">
  291. Commande du <strong>{{ dateFormat }}</strong> &gt;
  292. <strong><span v-if="order.user">{{ order.user.name +' '+order.user.lastname }}</span>
  293. <span v-else>{{ order.username }}</span></strong>
  294. </h3>
  295. <div slot="body">
  296. <div class="col-md-4">
  297. <div class="info-box">
  298. <span :class="'info-box-icon ' +((order.amount_paid == order.amount) ? 'bg-green' : 'bg-red')"><i class="fa fa-check"></i></span>
  299. <div class="info-box-content">
  300. <span class="info-box-text">Montant</span>
  301. <span class="info-box-number">{{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}</span>
  302. <span class="info-box-text">
  303. Statut<br />
  304. <span class="label label-success" v-if="order.amount_paid == order.amount">payé</span>
  305. <span class="label label-default" v-else-if="order.amount_paid == 0">non réglé</span>
  306. <span class="label label-default" v-else-if="order.amount_paid > order.amount">surplus</span>
  307. <span class="label label-warning" v-else-if="order.amount_paid < order.amount">reste à payer</span>
  308. </span>
  309. </div>
  310. </div>
  311. <div class="info-box">
  312. <span :class="'info-box-icon ' +((order.user.credit > 0) ? 'bg-green' : 'bg-red')"><i class="fa fa-user"></i></span>
  313. <div class="info-box-content">
  314. <span class="info-box-text">Crédit utilisateur</span>
  315. <span class="info-box-number">{{ order.user.credit.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}</span>
  316. </div>
  317. </div>
  318. <button v-if="order.amount_paid == order.amount"
  319. class="btn btn-default"
  320. :data-amount="order.amount"
  321. data-type="refund"
  322. @click="orderPaymentClick" >
  323. <span class="glyphicon glyphicon-chevron-right"></span>
  324. Rembourser {{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
  325. </button>
  326. <button v-else-if="order.amount_paid == 0"
  327. class="btn btn-default"
  328. :data-amount="order.amount"
  329. data-type="payment"
  330. @click="orderPaymentClick">
  331. <span class="glyphicon glyphicon-chevron-right"></span>
  332. Payer {{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
  333. </button>
  334. <button v-else-if="order.amount_paid > order.amount"
  335. class="btn btn-default"
  336. :data-amount="order.amount_surplus"
  337. data-type="refund"
  338. @click="orderPaymentClick">
  339. <span class="glyphicon glyphicon-chevron-right"></span>
  340. Rembourser {{ order.amount_surplus.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
  341. </button>
  342. <button v-else-if="order.amount_paid < order.amount"
  343. class="btn btn-default"
  344. :data-amount="order.amount_remaining"
  345. data-type="payment"
  346. @click="orderPaymentClick">
  347. <span class="glyphicon glyphicon-chevron-right"></span>
  348. Payer le restant {{ order.amount_remaining.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
  349. </button>
  350. </div>
  351. <div class="col-md-8">
  352. <h4>Historique paiement</h4>
  353. <table class="table table-condensed table-bordered table-hover">
  354. <thead>
  355. <tr>
  356. <td>Date</td>
  357. <td>Utilisateur</td>
  358. <td>Action</td>
  359. <td>- Débit</td>
  360. <td>+ Crédit</td>
  361. </tr>
  362. </thead>
  363. <tbody>
  364. <tr v-for="creditHistory in order.creditHistory">
  365. <td>{{ creditHistory.date }}</td>
  366. <td>{{ creditHistory.user_action }}</td>
  367. <td v-html="creditHistory.wording"></td>
  368. <td v-html="creditHistory.debit"></td>
  369. <td v-html="creditHistory.credit"></td>
  370. </tr>
  371. </tbody>
  372. </table>
  373. </div>
  374. </div>
  375. </modal>
  376. </td>
  377. </tr>
  378. <tr class="view" v-if="showViewProduct && idOrderView == order.id">
  379. <td colspan="6">
  380. <strong><span class="glyphicon glyphicon-menu-right"></span> Produits</strong>
  381. <ul>
  382. <li v-for="product in products" v-if="order.productOrder[product.id] > 0">
  383. {{ 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>
  384. </li>
  385. </ul>
  386. <div v-if="order.comment && order.comment.length > 0" class="comment">
  387. <strong><span class="glyphicon glyphicon-menu-right"></span> Commentaire</strong><br />
  388. {{ order.comment }}
  389. </div>
  390. </td>
  391. </tr>
  392. </template>
  393. </tbody>
  394. </table>
  395. <div class="alert alert-warning" v-else>
  396. Aucune commande
  397. </div>
  398. </div>
  399. </div>
  400. </div>
  401. </div>
  402. <!-- template for the order-form component -->
  403. <script type="text/x-template" id="order-form-template">
  404. <modal class="modal-form-order" @close="$emit('close')">
  405. <h3 slot="header">Ajouter une commande</h3>
  406. <div slot="body">
  407. <div class="callout callout-warning" v-if="errors.length">
  408. <ul>
  409. <li v-for="error in errors">{{ error }}</li>
  410. </ul>
  411. </div>
  412. <div class="col-md-4">
  413. <div class="form-group">
  414. <label class="control-label" for="select-id-point-sale">Point de vente</label>
  415. <select class="form-control" id="select-id-point-sale" v-model="order.id_point_sale">
  416. <option v-for="pointSale in pointsSale" v-if="pointSale.pointSaleDistribution[0].delivery == 1" :value="pointSale.id">{{ pointSale.name }}</option>
  417. </select>
  418. </div>
  419. <div class="form-group">
  420. <label class="control-label" for="select-id-user">Utilisateur</label>
  421. <select class="form-control" v-model="order.id_user">
  422. <option v-for="user in users" :value="user.id_user">{{ user.lastname +' '+ user.name }}</option>
  423. </select>
  424. <input v-model="order.username" type="text" class="form-control" placeholder="Ou saisissez ici le nom de l'utilisateur" />
  425. </div>
  426. <div class="form-group">
  427. <label class="control-label" for="textarea-comment">Commentaire</label>
  428. <textarea class="form-control" id="textarea-comment" v-model="order.comment"></textarea>
  429. </div>
  430. </div>
  431. <div class="col-md-8">
  432. <label class="control-label">Produits</label>
  433. <table class="table table-condensed table-bordered table-hover table-products">
  434. <tbody>
  435. <tr v-for="product in products" :class="(order.productOrder[product.id] > 0) ? 'product-ordered' : ''">
  436. <td>
  437. <span class="label label-success" v-if="product.productDistribution[0].active == 1">Actif</span>
  438. <span class="label label-danger" v-else>Inactif</span>
  439. </td>
  440. <td>{{ product.name }}</td>
  441. <td class="quantity">
  442. <div class="input-group">
  443. <span class="input-group-btn">
  444. <button class="btn btn-default btn-moins" type="button" @click="productQuantityClick(product.id, -1)"><span class="glyphicon glyphicon-minus"></span></button>
  445. </span>
  446. <input type="text" v-model="order.productOrder[product.id]" class="form-control" />
  447. <span class="input-group-btn">
  448. <button class="btn btn-default btn-plus" type="button" @click="productQuantityClick(product.id, 1)"><span class="glyphicon glyphicon-plus"></span></button>
  449. </span>
  450. </div>
  451. </td>
  452. <td class="quantity-remaining">/ {{ product.quantity_remaining }}</td>
  453. </tr>
  454. </tbody>
  455. </table>
  456. </div>
  457. </div>
  458. <div slot="footer">
  459. <div class="actions-form">
  460. <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>
  461. <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>
  462. <button class="modal-default-button btn btn-primary" @click="submitFormUpdate" v-if="order.id">Modifier</button>
  463. <button class="modal-default-button btn btn-primary" @click="submitFormCreate" v-else>Créer</button>
  464. <button class="modal-default-button btn btn-default" @click="$emit('close')">Annuler</button>
  465. </div>
  466. </div>
  467. </modal>
  468. </script>
  469. <!-- template for the modal component -->
  470. <script type="text/x-template" id="modal-template">
  471. <transition name="modal">
  472. <div class="modal-mask">
  473. <div class="modal-wrapper">
  474. <div class="modal-container">
  475. <div class="modal-header">
  476. <slot name="header"></slot>
  477. </div>
  478. <div class="modal-body">
  479. <slot name="body"></slot>
  480. </div>
  481. <div class="modal-footer">
  482. <slot name="footer">
  483. <button class="modal-default-button btn btn-default" @click="$emit('close')">Fermer</button>
  484. </slot>
  485. </div>
  486. </div>
  487. </div>
  488. </div>
  489. </transition>
  490. </script>