Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

535 lines
37KB

  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" class="app-vuejs">
  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="'wrapper-app-vuejs '+(loading ? '' : 'loaded')">
  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 />
  174. <a href="#" class="btn btn-xs btn-default" disabled="disabled" v-if="countOrders == 0">Télécharger (PDF)</a>
  175. <a :href="distribution.url_report" class="btn btn-default">Télécharger (PDF)</a><br />
  176. <a href="#" class="btn btn-xs btn-default" disabled="disabled" v-if="countOrders == 0">Télécharger (CSV)</a>
  177. <a :href="distribution.url_report+'&type=csv'" class="btn btn-default">Télécharger (CSV)</a>
  178. </span>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. <div class="callout callout-info" v-else>
  185. <h4><i class="fa fa-info"></i> Pour commencer</h4>
  186. <p>Veuillez choisir une date de distribution.</p>
  187. </div>
  188. </div>
  189. <div class="clr"></div>
  190. <div id="orders" class="panel panel-default" v-if="date">
  191. <div class="panel-heading">
  192. <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>
  193. </div>
  194. <div class="panel-body">
  195. <button id="btn-add-subscriptions" @click="addSubscriptions" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span> Importer les abonnements</button>
  196. <button id="btn-add-order" @click="showModalFormOrderCreate = true" class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-plus"></span> Ajouter une commande</button>
  197. <order-form
  198. v-if="showModalFormOrderCreate"
  199. :date="date"
  200. :order="orderCreate"
  201. :points-sale="pointsSale"
  202. :users="users"
  203. :products="products"
  204. @close="showModalFormOrderCreate = false"
  205. @ordercreatedupdated="orderCreatedUpdated"
  206. ></order-form>
  207. <div id="wrapper-nav-points-sale">
  208. <ul id="nav-points-sale">
  209. <li data-id-point-sale="0" data-id-point-sale="0" v-if="countActivePointsSale > 1" @click="pointSaleClick">
  210. <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>
  211. <a class="btn btn-default" v-else>Tous <span class="label label-default">{{ orders.length }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a>
  212. </li>
  213. <li v-for="pointSale in pointsSale" :data-id-point-sale="pointSale.id" v-if="pointSale.pointSaleDistribution[0].delivery == 1" @click="pointSaleClick">
  214. <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>
  215. <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>
  216. </li>
  217. </ul>
  218. <div class="clr"></div>
  219. </div>
  220. <table class="table table-condensed table-bordered table-hover" v-if="countOrdersByPointSale[idActivePointSale] > 0 || (idActivePointSale == 0 && orders.length > 0)">
  221. <tbody>
  222. <template v-for="(order, key, index) in orders" v-if="idActivePointSale == 0 || idActivePointSale == order.id_point_sale">
  223. <tr>
  224. <td>
  225. <label class="label label-success" v-if="order.origin == 'user'">client</label>
  226. <label class="label label-default" v-else-if="order.origin == 'auto'">auto</label>
  227. <label class="label label-warning" v-else>admin</label>
  228. </td>
  229. <td>
  230. <span class="label label-danger" v-if="order.date_delete"><span class="glyphicon glyphicon-trash"></span></span>
  231. <span class="label label-warning" v-if="order.date_update"><span class="glyphicon glyphicon-pencil"></span></span>
  232. <span class="label label-success" v-if="!order.date_update && !order.date_delete"><span class="glyphicon glyphicon-check"></span></span>
  233. </td>
  234. <td>
  235. <span v-if="order.user">{{ order.user.lastname+' '+order.user.name }}</span>
  236. <span v-else>{{ order.username }}</span>
  237. <span v-if="order.comment && order.comment.length > 0" class="glyphicon glyphicon-comment"></span>
  238. </td>
  239. <td v-if="idActivePointSale == 0">
  240. {{ order.pointSale.name }}
  241. </td>
  242. <td>{{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+'&nbsp;€' }}</td>
  243. <td class="column-state-payment">
  244. <div class="input-group">
  245. <span class="label label-success input-group-addon" v-if="order.amount_paid == order.amount">payé</span>
  246. <span class="label label-default input-group-addon" v-else-if="order.amount_paid == 0">non réglé</span>
  247. <span class="label label-default input-group-addon" v-else-if="order.amount_paid > order.amount">surplus</span>
  248. <span class="label label-warning input-group-addon" v-else-if="order.amount_paid < order.amount">reste à payer</span>
  249. <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>
  250. </div>
  251. </td>
  252. <td class="column-payment" v-if="producer.credit">
  253. <div class="btn-group" v-if="order.user && !order.date_delete">
  254. <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">
  255. <span class="glyphicon glyphicon-euro"></span> Rembourser
  256. </button>
  257. <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">
  258. <span class="glyphicon glyphicon-euro"></span> Payer
  259. </button>
  260. <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">
  261. <span class="glyphicon glyphicon-euro"></span> Payer
  262. </button>
  263. <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">
  264. <span class="glyphicon glyphicon-euro"></span> Rembourser
  265. </button>
  266. <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  267. <span class="caret"></span>
  268. <span class="sr-only">Toggle Dropdown</span>
  269. </button>
  270. <ul class="dropdown-menu">
  271. <li><a href="javascript:void(0);" @click="orderPaymentModalClick" :data-id-order="order.id">Historique</a></li>
  272. </ul>
  273. </div>
  274. </td>
  275. <td class="column-actions">
  276. <span v-if="order.oneProductUnactivated" class="glyphicon glyphicon-warning-sign" title="Contient un produit non activé"></span>
  277. <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>
  278. <button class="btn btn-default" :data-id-order="order.id" @click="updateOrderClick"><span class="glyphicon glyphicon-pencil"></span></button>
  279. <button class="btn btn-default" :data-id-order="order.id" @click="deleteOrderClick"><span class="glyphicon glyphicon-trash"></span></button>
  280. <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>
  281. <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>
  282. <order-form
  283. v-if="showModalFormOrderUpdate && idOrderUpdate == order.id"
  284. :date="date"
  285. :id-point-sale="idActivePointSale"
  286. :points-sale="pointsSale"
  287. :users="users"
  288. :products="products"
  289. :order="ordersUpdate[key]"
  290. @close="showModalFormOrderUpdate = false"
  291. @ordercreatedupdated="orderCreatedUpdated"
  292. ></order-form>
  293. <modal v-if="showModalPayment && idOrderPayment == order.id" class="modal-payment" @close="showModalPayment = false">
  294. <h3 slot="header">
  295. Commande du <strong>{{ dateFormat }}</strong> &gt;
  296. <strong><span v-if="order.user">{{ order.user.name +' '+order.user.lastname }}</span>
  297. <span v-else>{{ order.username }}</span></strong>
  298. </h3>
  299. <div slot="body">
  300. <div class="col-md-4">
  301. <div class="info-box">
  302. <span :class="'info-box-icon ' +((order.amount_paid == order.amount) ? 'bg-green' : 'bg-red')"><i class="fa fa-check"></i></span>
  303. <div class="info-box-content">
  304. <span class="info-box-text">Montant</span>
  305. <span class="info-box-number">{{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}</span>
  306. <span class="info-box-text">
  307. Statut<br />
  308. <span class="label label-success" v-if="order.amount_paid == order.amount">payé</span>
  309. <span class="label label-default" v-else-if="order.amount_paid == 0">non réglé</span>
  310. <span class="label label-default" v-else-if="order.amount_paid > order.amount">surplus</span>
  311. <span class="label label-warning" v-else-if="order.amount_paid < order.amount">reste à payer</span>
  312. </span>
  313. </div>
  314. </div>
  315. <div class="info-box">
  316. <span :class="'info-box-icon ' +((order.user.credit > 0) ? 'bg-green' : 'bg-red')"><i class="fa fa-user"></i></span>
  317. <div class="info-box-content">
  318. <span class="info-box-text">Crédit utilisateur</span>
  319. <span class="info-box-number">{{ order.user.credit.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}</span>
  320. </div>
  321. </div>
  322. <button v-if="order.amount_paid == order.amount"
  323. class="btn btn-default"
  324. :data-amount="order.amount"
  325. data-type="refund"
  326. @click="orderPaymentClick" >
  327. <span class="glyphicon glyphicon-chevron-right"></span>
  328. Rembourser {{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
  329. </button>
  330. <button v-else-if="order.amount_paid == 0"
  331. class="btn btn-default"
  332. :data-amount="order.amount"
  333. data-type="payment"
  334. @click="orderPaymentClick">
  335. <span class="glyphicon glyphicon-chevron-right"></span>
  336. Payer {{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
  337. </button>
  338. <button v-else-if="order.amount_paid > order.amount"
  339. class="btn btn-default"
  340. :data-amount="order.amount_surplus"
  341. data-type="refund"
  342. @click="orderPaymentClick">
  343. <span class="glyphicon glyphicon-chevron-right"></span>
  344. Rembourser {{ order.amount_surplus.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
  345. </button>
  346. <button v-else-if="order.amount_paid < order.amount"
  347. class="btn btn-default"
  348. :data-amount="order.amount_remaining"
  349. data-type="payment"
  350. @click="orderPaymentClick">
  351. <span class="glyphicon glyphicon-chevron-right"></span>
  352. Payer le restant {{ order.amount_remaining.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}
  353. </button>
  354. </div>
  355. <div class="col-md-8">
  356. <h4>Historique paiement</h4>
  357. <table class="table table-condensed table-bordered table-hover">
  358. <thead>
  359. <tr>
  360. <td>Date</td>
  361. <td>Utilisateur</td>
  362. <td>Action</td>
  363. <td>- Débit</td>
  364. <td>+ Crédit</td>
  365. </tr>
  366. </thead>
  367. <tbody>
  368. <tr v-for="creditHistory in order.creditHistory">
  369. <td>{{ creditHistory.date }}</td>
  370. <td>{{ creditHistory.user_action }}</td>
  371. <td v-html="creditHistory.wording"></td>
  372. <td v-html="creditHistory.debit"></td>
  373. <td v-html="creditHistory.credit"></td>
  374. </tr>
  375. </tbody>
  376. </table>
  377. </div>
  378. </div>
  379. </modal>
  380. </td>
  381. </tr>
  382. <tr class="view" v-if="showViewProduct && idOrderView == order.id">
  383. <td colspan="6">
  384. <strong><span class="glyphicon glyphicon-menu-right"></span> Produits</strong>
  385. <ul>
  386. <li v-for="product in products" v-if="order.productOrder[product.id] > 0">
  387. {{ 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>
  388. </li>
  389. </ul>
  390. <div v-if="order.comment && order.comment.length > 0" class="comment">
  391. <strong><span class="glyphicon glyphicon-menu-right"></span> Commentaire</strong><br />
  392. {{ order.comment }}
  393. </div>
  394. </td>
  395. </tr>
  396. </template>
  397. </tbody>
  398. </table>
  399. <div class="alert alert-warning" v-else>
  400. Aucune commande
  401. </div>
  402. </div>
  403. </div>
  404. </div>
  405. </div>
  406. <!-- template for the order-form component -->
  407. <script type="text/x-template" id="order-form-template">
  408. <modal class="modal-form-order" @close="$emit('close')">
  409. <h3 slot="header">Ajouter une commande</h3>
  410. <div slot="body">
  411. <div class="callout callout-warning" v-if="errors.length">
  412. <ul>
  413. <li v-for="error in errors">{{ error }}</li>
  414. </ul>
  415. </div>
  416. <div class="col-md-4">
  417. <div class="form-group">
  418. <label class="control-label" for="select-id-point-sale">Point de vente</label>
  419. <select class="form-control" id="select-id-point-sale" v-model="order.id_point_sale">
  420. <option v-for="pointSale in pointsSale" v-if="pointSale.pointSaleDistribution[0].delivery == 1" :value="pointSale.id">{{ pointSale.name }}</option>
  421. </select>
  422. </div>
  423. <div class="form-group">
  424. <label class="control-label" for="select-id-user">Utilisateur</label>
  425. <select class="form-control" v-model="order.id_user">
  426. <option v-for="user in users" :value="user.id_user">{{ user.lastname +' '+ user.name }}</option>
  427. </select>
  428. <input v-model="order.username" type="text" class="form-control" placeholder="Ou saisissez ici le nom de l'utilisateur" />
  429. </div>
  430. <div class="form-group">
  431. <label class="control-label" for="textarea-comment">Commentaire</label>
  432. <textarea class="form-control" id="textarea-comment" v-model="order.comment"></textarea>
  433. </div>
  434. </div>
  435. <div class="col-md-8">
  436. <label class="control-label">Produits</label>
  437. <table class="table table-condensed table-bordered table-hover table-products">
  438. <tbody>
  439. <tr v-for="product in products" :class="(order.productOrder[product.id] > 0) ? 'product-ordered' : ''">
  440. <td>
  441. <span class="label label-success" v-if="product.productDistribution[0].active == 1">Actif</span>
  442. <span class="label label-danger" v-else>Inactif</span>
  443. </td>
  444. <td>{{ product.name }}</td>
  445. <td class="quantity">
  446. <div class="input-group">
  447. <span class="input-group-btn">
  448. <button class="btn btn-default btn-moins" type="button" @click="productQuantityClick(product.id, -1)"><span class="glyphicon glyphicon-minus"></span></button>
  449. </span>
  450. <input type="text" v-model="order.productOrder[product.id]" class="form-control" />
  451. <span class="input-group-btn">
  452. <button class="btn btn-default btn-plus" type="button" @click="productQuantityClick(product.id, 1)"><span class="glyphicon glyphicon-plus"></span></button>
  453. </span>
  454. </div>
  455. </td>
  456. <td class="quantity-remaining">/ {{ product.quantity_remaining }}</td>
  457. </tr>
  458. </tbody>
  459. </table>
  460. </div>
  461. </div>
  462. <div slot="footer">
  463. <div class="actions-form">
  464. <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>
  465. <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>
  466. <button class="modal-default-button btn btn-primary" @click="submitFormUpdate" v-if="order.id">Modifier</button>
  467. <button class="modal-default-button btn btn-primary" @click="submitFormCreate" v-else>Créer</button>
  468. <button class="modal-default-button btn btn-default" @click="$emit('close')">Annuler</button>
  469. </div>
  470. </div>
  471. </modal>
  472. </script>
  473. <!-- template for the modal component -->
  474. <script type="text/x-template" id="modal-template">
  475. <transition name="modal">
  476. <div class="modal-mask">
  477. <div class="modal-wrapper">
  478. <div class="modal-container">
  479. <div class="modal-header">
  480. <slot name="header"></slot>
  481. </div>
  482. <div class="modal-body">
  483. <slot name="body"></slot>
  484. </div>
  485. <div class="modal-footer">
  486. <slot name="footer">
  487. <button class="modal-default-button btn btn-default" @click="$emit('close')">Fermer</button>
  488. </slot>
  489. </div>
  490. </div>
  491. </div>
  492. </div>
  493. </transition>
  494. </script>