You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

677 lines
45KB

  1. <?php
  2. /**
  3. * Copyright distrib (2018)
  4. *
  5. * contact@opendistrib.net
  6. *
  7. * Ce logiciel est un programme informatique servant à aider les producteurs
  8. * à distribuer leur production en circuits courts.
  9. *
  10. * Ce logiciel est régi par la licence CeCILL soumise au droit français et
  11. * respectant les principes de diffusion des logiciels libres. Vous pouvez
  12. * utiliser, modifier et/ou redistribuer ce programme sous les conditions
  13. * de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
  14. * sur le site "http://www.cecill.info".
  15. *
  16. * En contrepartie de l'accessibilité au code source et des droits de copie,
  17. * de modification et de redistribution accordés par cette licence, il n'est
  18. * offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
  19. * seule une responsabilité restreinte pèse sur l'auteur du programme, le
  20. * titulaire des droits patrimoniaux et les concédants successifs.
  21. *
  22. * A cet égard l'attention de l'utilisateur est attirée sur les risques
  23. * associés au chargement, à l'utilisation, à la modification et/ou au
  24. * développement et à la reproduction du logiciel par l'utilisateur étant
  25. * donné sa spécificité de logiciel libre, qui peut le rendre complexe à
  26. * manipuler et qui le réserve donc à des développeurs et des professionnels
  27. * avertis possédant des connaissances informatiques approfondies. Les
  28. * utilisateurs sont donc invités à charger et tester l'adéquation du
  29. * logiciel à leurs besoins dans des conditions permettant d'assurer la
  30. * sécurité de leurs systèmes et ou de leurs données et, plus généralement,
  31. * à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
  32. *
  33. * Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
  34. * pris connaissance de la licence CeCILL, et que vous en avez accepté les
  35. * termes.
  36. */
  37. use common\helpers\GlobalParam;
  38. use common\logic\Distribution\Distribution\Module\DistributionModule;
  39. use common\logic\Distribution\PointSaleDistribution\Model\PointSaleDistribution;
  40. use common\logic\Producer\Producer\Model\Producer;
  41. use common\logic\Producer\Producer\Module\ProducerModule;
  42. \producer\assets\VuejsOrderOrderAsset::register($this);
  43. $distributionModule =DistributionModule::getInstance();
  44. $producerModule = ProducerModule::getInstance();
  45. $producer = $this->context->getProducerCurrent();
  46. $this->setTitle('Commander');
  47. ?>
  48. <script>
  49. var appInitValues = {
  50. urlLogin: '<?= \Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/producer', 'id' => $this->context->getProducerCurrent()->id, 'return_url' => \Yii::$app->urlManagerProducer->createAbsoluteUrl(['order/order', 'slug_producer' => $this->context->getProducerCurrent()->slug])]) ?>',
  51. producerOptionOrderEntryPoint: '<?= $producer->option_order_entry_point ?>',
  52. <?php if (isset($order)): ?>pointSaleActiveId: <?= $order->id_point_sale ?><?php endif; ?>
  53. };
  54. </script>
  55. <div id="app-order-order" :class="{'loaded': !loadingInit}">
  56. <?php if (isset($order)): ?>
  57. <span id="order-distribution-date"><?= $order->distribution->date; ?></span>
  58. <?php endif; ?>
  59. <?php if (isset($date)): ?>
  60. <span id="distribution-date"><?= $date; ?></span>
  61. <?php endif; ?>
  62. <div v-if="loadingInit">
  63. Chargement ...
  64. </div>
  65. <div class="wrapper">
  66. <div v-if="!loadingInit && distributions.length == 0" class="alert alert-warning">
  67. Aucune distribution à venir chez ce producteur.
  68. </div>
  69. <div v-else>
  70. <div id="steps">
  71. <ul>
  72. <?php if ($producer->option_order_entry_point == Producer::ORDER_ENTRY_POINT_DATE): ?>
  73. <step-date
  74. first="true"
  75. :step="step"
  76. :point-sale-active="pointSaleActive"
  77. :date-format="dateFormat"
  78. :change-step="changeStep"
  79. :producer="producer"
  80. ></step-date>
  81. <step-point-sale
  82. :step="step"
  83. :point-sale-active="pointSaleActive"
  84. :change-step="changeStep"
  85. :producer="producer"
  86. ></step-point-sale>
  87. <?php else: ?>
  88. <step-point-sale
  89. first="true"
  90. :step="step"
  91. :point-sale-active="pointSaleActive"
  92. :change-step="changeStep"
  93. :producer="producer"
  94. ></step-point-sale>
  95. <step-date
  96. :step="step"
  97. :point-sale-active="pointSaleActive"
  98. :date-format="dateFormat"
  99. :change-step="changeStep"
  100. :producer="producer"
  101. ></step-date>
  102. <?php endif; ?>
  103. <li id="step-products" :class="'col-md-3 '+((step == 'products') ? 'active ' : '')">
  104. <button @click="changeStep('products')"
  105. :class="'btn '+ (step == 'products' ? 'btn-primary' : 'btn-default')"
  106. :disabled="step == 'date' || step == 'point-sale'">
  107. <span class="button-content"><span
  108. class="glyphicon glyphicon-th-list"></span> Produits</span>
  109. </button>
  110. <div class="info-step" v-if="oneProductOrdered()">
  111. {{ countProductOrdered() }} produit{{ (countProductOrdered() > 1) ? 's' : '' }}
  112. </div>
  113. </li>
  114. <li id="step-payment" :class="'col-md-3 '+((step == 'payment') ? 'active' : '')">
  115. <button @click="changeStep('payment')"
  116. :class="'btn '+ (step == 'payment' ? 'btn-primary' : 'btn-default')"
  117. :disabled="step == 'date' || step == 'point-sale' || step == 'products'">
  118. <span class="button-content"><span
  119. class="glyphicon glyphicon-ok"></span> Confirmation</span>
  120. </button>
  121. </li>
  122. </ul>
  123. <div class="clr"></div>
  124. </div>
  125. <div class="content">
  126. <div v-if="errors && errors.length" class="alert alert-danger">
  127. <ul>
  128. <li v-for="error in errors">
  129. <div v-html="error"></div>
  130. </li>
  131. </ul>
  132. </div>
  133. <div v-else-if="loading && step != 'payment'">
  134. Chargement ...
  135. </div>
  136. <transition name="slide">
  137. <div id="content-step-date" v-if="step == 'date'">
  138. <div v-if="!loading">
  139. <?php if ($producer->behavior_order_select_distribution == Producer::BEHAVIOR_ORDER_SELECT_DISTRIBUTION_LIST): ?>
  140. <div style="display:none ;">
  141. <?php endif; ?>
  142. <div id="legend">
  143. <div><span id="distribution-date-color"></span> Prochains jours de distribution
  144. </div>
  145. <div><span id="order-date-color"></span> Vos commandes déjà enregistrées</div>
  146. </div>
  147. <div id="calendar">
  148. <v-calendar
  149. is-inline
  150. is-expanded
  151. v-model="date"
  152. mode="single"
  153. color="green"
  154. :columns="calendar.columns"
  155. :formats="calendar.formats"
  156. :theme-styles="calendar.themeStyles"
  157. :attributes="calendar.attrs"
  158. :available-dates="calendar.availableDates"
  159. @dayclick='dayClick'
  160. ></v-calendar>
  161. </div>
  162. <?php if ($producer->behavior_order_select_distribution == Producer::BEHAVIOR_ORDER_SELECT_DISTRIBUTION_LIST): ?>
  163. </div>
  164. <?php endif; ?>
  165. <?php if ($producer->behavior_order_select_distribution == Producer::BEHAVIOR_ORDER_SELECT_DISTRIBUTION_LIST): ?>
  166. <div id="distributions-list">
  167. <?php $incomingDistributions = $distributionModule->findDistributionsIncoming(); ?>
  168. <?php foreach ($incomingDistributions as $distribution): ?>
  169. <?php
  170. $pointSaleDistributions = PointSaleDistribution::searchAll([
  171. 'id_distribution' => $distribution->id,
  172. 'delivery' => 1
  173. ], []);
  174. ?>
  175. <div class="panel panel-default">
  176. <div class="panel-body">
  177. <button class="btn btn-primary" @click="dayClickList"
  178. data-distribution-date="<?= $distribution->date . ' 00:00:00' ?>">
  179. Sélectionner cette distribution
  180. </button>
  181. <span class="date"><?= ucfirst(strftime('%A %d %B', strtotime($distribution->date))); ?></span>
  182. <?php
  183. if ($pointSaleDistributions && count($pointSaleDistributions) > 0) {
  184. echo '<div class="point-sales">';
  185. foreach ($pointSaleDistributions as $pointSaleDistribution) {
  186. if ($pointSaleDistribution->pointSale->status == 1) {
  187. echo $pointSaleDistribution->pointSale->name . '';
  188. if (strlen($pointSaleDistribution->pointSale->locality)) {
  189. echo ' (' . $pointSaleDistribution->pointSale->locality . ')';
  190. }
  191. echo '<br />';
  192. }
  193. }
  194. echo '</div>';
  195. }
  196. ?>
  197. </div>
  198. </div>
  199. <?php endforeach; ?>
  200. </div>
  201. <?php endif; ?>
  202. </div>
  203. </div>
  204. </transition>
  205. <transition name="slide">
  206. <div id="content-step-point-sale" v-if="step == 'point-sale'">
  207. <div v-if="!loading">
  208. <h3>Où souhaitez-vous récupérer votre commande ?</h3>
  209. <table id="points-sale" class="table table-bordered" v-if="pointsSale.length">
  210. <thead>
  211. <tr>
  212. <th>Nom</th>
  213. <th>Localité</th>
  214. <th></th>
  215. </tr>
  216. </thead>
  217. <tbody>
  218. <tr v-for="pointSale in orderedPointsSale"
  219. v-if="pointSale && (producer.option_order_entry_point == 'point-sale' || (producer.option_order_entry_point == 'date' && pointSale.pointSaleDistribution.delivery))"
  220. :class="(pointSaleActive && pointSale.id == pointSaleActive.id) ? 'selected' : ''">
  221. <td class="name">
  222. <span class="the-name">{{ pointSale.name }}</span>
  223. <div class="comment" v-if="pointSale.userPointSale">
  224. {{ pointSale.userPointSale.comment }}
  225. </div>
  226. <div class="comment" v-if="pointSale.infos && pointSale.infos.length > 0"
  227. v-html="pointSale.infos"></div>
  228. </td>
  229. <td class="locality">{{ pointSale.locality }}</td>
  230. <td class="actions">
  231. <template
  232. v-if="(order == null || order.id_point_sale != pointSale.id) && pointSale.maximum_number_orders && pointSale.count_orders && pointSale.count_orders >= pointSale.maximum_number_orders">
  233. <span class="label label-default">
  234. <template v-if="pointSale.is_bread_box">
  235. Déjà réservée
  236. </template>
  237. <template v-else>
  238. Maximum de commande atteint
  239. </template>
  240. </span>
  241. </template>
  242. <template v-else>
  243. <div :class="'form-group' + (pointSale.invalid_code ? ' has-error' : '')">
  244. <div class="input-group"
  245. v-if="pointSale.code && pointSale.code.length > 0">
  246. <span class="input-group-addon"><span
  247. class="glyphicon glyphicon-lock"></span></span>
  248. <input v-model="pointsSaleCodes[pointSale.id]" type="password"
  249. placeholder="Code" class="form-control input-code"/>
  250. </div>
  251. </div>
  252. <div v-if="!user && producer.credit == 1 && pointSale.credit == 1">
  253. <a :href="urlLogin" class="btn btn-default">
  254. <span class="glyphicon glyphicon-log-in"></span>
  255. Connexion obligatoire
  256. </a>
  257. </div>
  258. <div v-else>
  259. <button class="btn btn-primary" @click="pointSaleClick"
  260. :data-code="pointSale.code && pointSale.code.length > 0"
  261. :data-id-point-sale="pointSale.id">
  262. <span class="glyphicon glyphicon-map-marker"></span>
  263. Choisir
  264. </button>
  265. </div>
  266. </template>
  267. </td>
  268. </tr>
  269. </tbody>
  270. </table>
  271. <div class="alert alert-warning" v-else>
  272. Aucun point de vente disponible pour ce jour de distribution.
  273. </div>
  274. </div>
  275. </div>
  276. </transition>
  277. <transition name="slide">
  278. <div id="content-step-products" v-if="step == 'products'">
  279. <div v-if="!loading">
  280. <div v-if="products.length">
  281. <table id="products" class="table table-bordered">
  282. <thead>
  283. <tr>
  284. <th class="photo">Photo</th>
  285. <th class="name">Nom</th>
  286. <th class="price">Prix unitaire</th>
  287. <th class="quantity">Quantité</th>
  288. <th class="total">Total</th>
  289. </tr>
  290. </thead>
  291. <tbody>
  292. <template v-for="category in categories">
  293. <tr v-if="category.id && countProductsByCategory(category)">
  294. <td class="category-name" colspan="5" @click="setCategoryCurrent(category)">
  295. <span v-if="categoryCurrent && categoryCurrent.id == category.id"
  296. class="glyphicon glyphicon-triangle-bottom"></span>
  297. <span v-else class="glyphicon glyphicon-triangle-right"></span>
  298. {{ category.name }}
  299. <span class="label label-default">{{ countProductsByCategory(category) }} produit<template
  300. v-if="countProductsByCategory(category) > 1">s</template></span>
  301. <span v-if="countSelectedProductsByCategory(category) > 0"
  302. class="label label-success">{{ countSelectedProductsByCategory(category) }} produit<template
  303. v-if="countSelectedProductsByCategory(category) > 1">s</template> sélectionné<template
  304. v-if="countSelectedProductsByCategory(category) > 1">s</template></span>
  305. </td>
  306. </tr>
  307. <template
  308. v-if="(categoryCurrent && categoryCurrent.id == category.id) || category.id == null">
  309. <tr v-for="product in products"
  310. v-if="product.id_product_category == category.id && product.productDistribution && product.productDistribution[0] && product.productDistribution[0].active == 1">
  311. <td class="photo">
  312. <img v-if="product.photo.length" class="photo-product"
  313. :src="product.photo"/>
  314. </td>
  315. <td class="name product-name-description-block">
  316. <span class="name">{{ product.name }}</span>
  317. <span class="other">
  318. <span v-if="product.weight">({{ product.weight }}&nbsp;g)</span>
  319. </span>
  320. <div>
  321. <span v-if="product.quantity_max > 0 && ((product.quantity_form / product.coefficient_unit == product.quantity_remaining) || ((product.quantity_remaining * product.coefficient_unit) - product.quantity_form) < product.step)"
  322. class="label label-danger">Épuisé</span>
  323. </div>
  324. <div class="description" v-if="product.description.length">
  325. {{ product.description }}
  326. </div>
  327. <div class="description-long" v-if="product.recipe.length">
  328. <a href="javascript:void(0);" class="show-more-link">En savoir
  329. plus</a>
  330. <div class="content">
  331. {{ product.recipe }}
  332. </div>
  333. </div>
  334. </td>
  335. <td class="price-unit">
  336. <template v-if="productHasPrice(product)">
  337. <div>
  338. {{ formatPrice(getBestProductPrice(product.id,
  339. product.quantity_form)) }}<br/>
  340. <span class="unit">{{ product.wording_unit }}</span>
  341. </div>
  342. <div v-if="productHasPriceWithFromQuantity(product)"
  343. class="alert alert-info decreasing-prices">
  344. <ul>
  345. <li v-for="price in product.prices"
  346. v-if="price.from_quantity > 0">
  347. <strong>{{ formatPrice(price.price_with_tax)
  348. }}</strong><br/>à partir de {{
  349. price.from_quantity }} {{ product.wording_unit_ref
  350. }}
  351. </li>
  352. </ul>
  353. </div>
  354. </template>
  355. </td>
  356. <td class="td-quantity">
  357. <template v-if="productHasPrice(product)">
  358. <div class="input-group">
  359. <span class="input-group-btn">
  360. <button class="btn btn-default btn-moins"
  361. type="button"
  362. @click="productQuantityClick(product, product.unit == 'piece' ? -1 : -parseFloat(product.step))"
  363. :disabled="product.quantity_form == 0"><span
  364. class="glyphicon glyphicon-minus"></span></button>
  365. </span>
  366. <input type="text" v-model="product.quantity_form"
  367. class="form-control quantity" readonly="readonly"/>
  368. <span class="input-group-addon">{{ product.unit == 'piece' ? 'p.' : product.unit }}</span>
  369. <span class="input-group-btn">
  370. <button class="btn btn-default btn-plus"
  371. type="button"
  372. @click="productQuantityClick(product, product.unit == 'piece' ? 1 : parseFloat(product.step))"
  373. :disabled="product.quantity_form == product.quantity_remaining && product.quantity_max > 0"><span
  374. class="glyphicon glyphicon-plus"></span></button>
  375. </span>
  376. </div>
  377. </template>
  378. </td>
  379. <td class="price-total">
  380. <template
  381. v-if="productHasPrice(product) && product.quantity_form > 0">
  382. {{ formatPrice(getBestProductPrice(product.id,
  383. product.quantity_form) * (product.quantity_form /
  384. product.coefficient_unit )) }}
  385. </template>
  386. </td>
  387. </tr>
  388. </template>
  389. </template>
  390. <tr class="total">
  391. <td class="summary" colspan="4">
  392. <template v-if="priceTotal() > 0">
  393. <h3>&gt; Résumé</h3>
  394. <ul>
  395. <li v-for="product in products" v-if="product.quantity_form > 0">
  396. <span class="quantity">{{ product.quantity_form }} {{ product.unit == 'piece' ? 'p.' : product.unit }} x</span>
  397. <span class="name">{{ product.name }}</span>
  398. <!--<span class="other">
  399. <span v-if="product.description.length">/</span>
  400. <span class="description">{{ product.description }}</span>-->
  401. <span class="other">
  402. <span v-if="product.weight">({{ product.weight }}&nbsp;g)</span>
  403. </span>
  404. </li>
  405. </ul>
  406. </template>
  407. </td>
  408. <td class="price-total">{{ priceTotal(true) }}</td>
  409. </tr>
  410. </tbody>
  411. </table>
  412. <div class="block-actions">
  413. <button class="btn btn-primary" @click="changeStep('payment')">Valider</button>
  414. </div>
  415. </div>
  416. <div class="alert alert-warning" v-else>
  417. Aucun produit disponible
  418. </div>
  419. </div>
  420. </div>
  421. </transition>
  422. <transition name="slide">
  423. <div id="content-step-payment" v-if="step == 'payment'">
  424. <div>
  425. <div class="delivery">
  426. <div class="delivery-home" v-if="producer.option_delivery">
  427. <input type="checkbox" name="delivery" id="delivery" v-model="delivery"/>
  428. <label for="delivery">Je souhaite être livré à domicile</label>
  429. </div>
  430. <div class="delivery-address" v-if="delivery">
  431. <label for="deliver-address">Adresse de livraison</label>
  432. <textarea id="deliver-address" v-model="deliveryAddress" class="form-control"
  433. required="required"></textarea>
  434. </div>
  435. </div>
  436. <div class="comment">
  437. <label for="order-comment">Commentaire</label>
  438. <textarea id="order-comment" v-model="comment" class="form-control"></textarea>
  439. </div>
  440. <template
  441. v-if="producer.credit == 1 && pointSaleActive.credit == 1 && (pointSaleActive.credit_functioning == 'mandatory' || (pointSaleActive.credit_functioning == 'user' && user.credit_active)) && !checkCreditLimit(order) ">
  442. <div class="alert alert-danger">
  443. Vous devez
  444. <template v-if="producer.online_payment == 1"><a
  445. href="<?= \Yii::$app->urlManager->createUrl(['credit/add']) ?>">recharger
  446. votre crédit</a></template>
  447. <template v-else>recharger votre crédit</template>
  448. auprès de votre producteur ou supprimer des produits.</span>
  449. Votre producteur n'autorise pas un crédit inférieur
  450. à <strong>{{ formatPrice(producer.credit_limit) }}</strong>.
  451. </div>
  452. <div class="block-actions">
  453. <a class="btn btn-primary"
  454. href="<?= \Yii::$app->urlManager->createUrl(['site/index']) ?>">Retour à
  455. l'accueil</a>
  456. </div>
  457. </template>
  458. <template v-else>
  459. <div class="credit">
  460. <div v-if="user && producer.credit == 1 && pointSaleActive.credit == 1 && (pointSaleActive.credit_functioning != 'user' || (pointSaleActive.credit_functioning == 'user' && user.credit_active))">
  461. <input type="checkbox" id="use-credit" v-model="useCredit" disabled="disabled"
  462. v-if="pointSaleActive.credit_functioning == 'mandatory' || (pointSaleActive.credit_functioning == 'user' && user.credit_active)"/>
  463. <input type="checkbox" id="use-credit" v-model="useCredit" v-else/> <label
  464. for="use-credit">Utiliser mon Crédit ({{ formatPrice(user.credit)
  465. }})</label>
  466. <div class="info" v-if="useCredit">
  467. <template v-if="order == null || order.amount_paid == 0">
  468. <span v-if="checkCreditLimit(order)">{{ priceTotal(true) }} seront débités</span>
  469. <span v-else>
  470. {{ formatPrice(user.credit) }} seront débités. (Limite de crédit à {{ formatPrice(producer.credit_limit) }})<br/>
  471. Restera {{ formatPrice(priceTotal() - user.credit) }} à régler.
  472. </span>
  473. </template>
  474. <template
  475. v-else-if="order != null && order.amount_paid > 0 && order.amount_paid < priceTotal()">
  476. <span v-if="checkCreditLimit(order)">{{ formatPrice(priceTotal() - order.amount_paid) }} seront débités</span>
  477. <span v-else>
  478. {{ formatPrice(user.credit) }} seront débités. (Limite de crédit à {{ formatPrice(producer.credit_limit) }})<br/>
  479. Restera {{ formatPrice(priceTotal() - order.amount_paid - user.credit) }} à régler.
  480. </span>
  481. </template>
  482. <template v-else-if="order != null && order.amount_paid > priceTotal()">
  483. <span>{{ formatPrice(order.amount_paid - priceTotal()) }} seront remboursés</span>
  484. </template>
  485. </div>
  486. </div>
  487. <div v-else>
  488. <span class="glyphicon glyphicon-chevron-right"></span>
  489. <?php if ($producerModule->isOnlinePaymentActiveAndTypeOrder($producer)): ?>
  490. La commande est à payer en ligne lors de l'étape suivante.
  491. <?php elseif ($producer->option_payment_info && strlen($producer->option_payment_info) > 0): ?>
  492. Confirmez votre commande et retrouvez les informations liées au paiement sur la page suivante.
  493. <?php else: ?>
  494. La commande sera à régler sur place.
  495. <?php endif; ?>
  496. </div>
  497. </div>
  498. <div id="signup-guest" v-if="!user && producer.option_allow_order_guest">
  499. <h3>Informations personnelles</h3>
  500. <form action="#">
  501. <div class="form-group field-signupguest-email required">
  502. <label class="control-label" for="signupguest-email">Email</label>
  503. <input type="email" id="signupguest-email" class="form-control"
  504. name="SignupForm[email]">
  505. <p class="help-block help-block-error"></p>
  506. </div>
  507. <!--<div class="form-group field-signupguest-password required">
  508. <label class="control-label" for="signupguest-password">Mot de passe</label>
  509. <input type="password" id="signupguest-password" class="form-control" name="SignupForm[password]">
  510. <p class="help-block help-block-error"></p>
  511. </div>-->
  512. <div class="form-group field-signupguest-firstname required">
  513. <label class="control-label" for="signupguest-firstname">Prénom</label>
  514. <input type="text" id="signupguest-firstname" class="form-control"
  515. name="SignupForm[firstname]">
  516. <p class="help-block help-block-error"></p>
  517. </div>
  518. <div class="form-group field-signupguest-lastname required">
  519. <label class="control-label" for="signupguest-lastname">Nom</label>
  520. <input type="text" id="signupguest-lastname" class="form-control"
  521. name="SignupForm[lastname]">
  522. <p class="help-block help-block-error"></p>
  523. </div>
  524. <div class="form-group field-signupguest-phone required">
  525. <label class="control-label" for="signupguest-phone">Téléphone</label>
  526. <input type="text" id="signupguest-phone" class="form-control"
  527. name="SignupForm[phone]">
  528. <p class="help-block help-block-error"></p>
  529. </div>
  530. </form>
  531. </div>
  532. <div class="block-actions">
  533. <button class="btn btn-primary" disabled="disabled" v-if="disableConfirmButton">Je
  534. confirme ma commande
  535. </button>
  536. <button class="btn btn-primary" v-else @click="confirmClick">Je confirme ma
  537. commande
  538. </button>
  539. </div>
  540. </template>
  541. </div>
  542. </div>
  543. </transition>
  544. </div>
  545. </div>
  546. <div id="infos" v-if="producer != null && producer.order_infos != null && producer.order_infos.length">
  547. <div class="panel panel-default">
  548. <div class="panel-heading">
  549. <i class="glyphicon glyphicon-info-sign"></i> Informations
  550. </div>
  551. <div class="panel-body">
  552. {{ producer.order_infos }}
  553. </div>
  554. </div>
  555. </div>
  556. <div v-if="producer != null && producer.online_payment && producer.option_online_payment_type == 'credit'"
  557. id="credit-online-payment">
  558. <div class="panel panel-default">
  559. <div class="panel-heading">
  560. <i class="glyphicon glyphicon-euro"></i> Paiement en ligne
  561. <a href="<?= \Yii::$app->urlManager->createUrl(['credit/add']) ?>" class="btn btn-sm btn-default"><i
  562. class="glyphicon glyphicon-credit-card"></i> Créditer mon compte</a>
  563. </div>
  564. <div class="panel-body">
  565. Vous utilisez le crédit pour régler vos commandes ? Simplifiez les paiements avec votre producteur
  566. en créditant votre compte par carte bancaire.
  567. </div>
  568. </div>
  569. </div>
  570. <?php
  571. $producer = GlobalParam::getCurrentProducer();
  572. if ($producerModule->hasSpecificDelays($producer)): ?>
  573. <div id="specific-delays" class="panel panel-default">
  574. <div class="panel-heading">
  575. Délais de commande spécifiques
  576. </div>
  577. <div class="panel-body">
  578. <table class="table table-bordered">
  579. <thead>
  580. <tr>
  581. <th>Jour</th>
  582. <th>Délai</th>
  583. </tr>
  584. </thead>
  585. <?php foreach ($producerModule->getSpecificDelays($producer) as $day => $delay): ?>
  586. <?php if ($delay['order_delay'] && $delay['order_deadline']): ?>
  587. <tr>
  588. <td>
  589. <?php
  590. switch ($day) {
  591. case 'monday':
  592. echo 'Lundi';
  593. break;
  594. case 'tuesday':
  595. echo 'Mardi';
  596. break;
  597. case 'wednesday':
  598. echo 'Mercredi';
  599. break;
  600. case 'thursday':
  601. echo 'Jeudi';
  602. break;
  603. case 'friday':
  604. echo 'Vendredi';
  605. break;
  606. case 'saturday':
  607. echo 'Samedi';
  608. break;
  609. case 'sunday':
  610. echo 'Dimanche';
  611. break;
  612. }
  613. ?>
  614. </td>
  615. <td>
  616. <span><?= $delay['order_delay'] ?> jour<?= ($delay['order_delay'] > 1) ? 's' : '' ?></span>
  617. à l'avance,
  618. avant
  619. <span><?= ($delay['order_deadline'] == 24) ? 'minuit' : $delay['order_deadline'] . 'h'; ?></span>
  620. </td>
  621. </tr>
  622. <?php endif; ?>
  623. <?php endforeach; ?>
  624. </table>
  625. </div>
  626. </div>
  627. <?php endif; ?>
  628. </div>
  629. </div>
  630. <script type="text/x-template" id="template-step-date">
  631. <li id="step-date" :class="'col-md-3'+((step == 'date') ? ' active' : '')+(first ? ' first' : '')">
  632. <button @click="changeStep('date')" :class="'btn '+ (step == 'date' ? 'btn-primary' : 'btn-default')"
  633. :disabled="producer && producer.option_order_entry_point == 'point-sale' && !pointSaleActive">
  634. <span class="button-content"><span class="glyphicon glyphicon-time"></span> Date</span></span>
  635. </button>
  636. <div class="info-step" v-if="dateFormat">
  637. {{ dateFormat }}
  638. </div>
  639. </li>
  640. </script>
  641. <script type="text/x-template" id="template-step-point-sale">
  642. <li id="step-point-sale" :class="'col-md-3'+((step == 'point-sale') ? ' active ' : '')+(first ? ' first' : '')">
  643. <button @click="changeStep('point-sale')"
  644. :class="'btn '+ (step == 'point-sale' ? 'btn-primary' : 'btn-default')"
  645. :disabled="producer && (producer.option_order_entry_point == 'date' && step == 'date')">
  646. <span class="button-content"><span
  647. class="glyphicon glyphicon-map-marker"></span> <?= $producerModule->getPointSaleWording($producer); ?></span>
  648. </button>
  649. <div class="info-step" v-if="pointSaleActive">
  650. {{ pointSaleActive.name }}
  651. </div>
  652. </li>
  653. </script>