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.

673 lines
44KB

  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="pointSaleActive.is_home_delivery">
  427. <label for="deliver-address">Adresse de livraison</label>
  428. <textarea id="deliver-address" v-model="deliveryAddress" class="form-control"
  429. required="required"></textarea>
  430. </div>
  431. </div>
  432. <div class="comment">
  433. <label for="order-comment">Commentaire</label>
  434. <textarea id="order-comment" v-model="comment" class="form-control"></textarea>
  435. </div>
  436. <template
  437. v-if="producer.credit == 1 && pointSaleActive.credit == 1 && (pointSaleActive.credit_functioning == 'mandatory' || (pointSaleActive.credit_functioning == 'user' && user.credit_active)) && !checkCreditLimit(order) ">
  438. <div class="alert alert-danger">
  439. Vous devez
  440. <template v-if="producer.online_payment == 1"><a
  441. href="<?= \Yii::$app->urlManager->createUrl(['credit/add']) ?>">recharger
  442. votre crédit</a></template>
  443. <template v-else>recharger votre crédit</template>
  444. auprès de votre producteur ou supprimer des produits.</span>
  445. Votre producteur n'autorise pas un crédit inférieur
  446. à <strong>{{ formatPrice(producer.credit_limit) }}</strong>.
  447. </div>
  448. <div class="block-actions">
  449. <a class="btn btn-primary"
  450. href="<?= \Yii::$app->urlManager->createUrl(['site/index']) ?>">Retour à
  451. l'accueil</a>
  452. </div>
  453. </template>
  454. <template v-else>
  455. <div class="credit">
  456. <div v-if="user && producer.credit == 1 && pointSaleActive.credit == 1 && (pointSaleActive.credit_functioning != 'user' || (pointSaleActive.credit_functioning == 'user' && user.credit_active))">
  457. <input type="checkbox" id="use-credit" v-model="useCredit" disabled="disabled"
  458. v-if="pointSaleActive.credit_functioning == 'mandatory' || (pointSaleActive.credit_functioning == 'user' && user.credit_active)"/>
  459. <input type="checkbox" id="use-credit" v-model="useCredit" v-else/> <label
  460. for="use-credit">Utiliser mon Crédit ({{ formatPrice(user.credit)
  461. }})</label>
  462. <div class="info" v-if="useCredit">
  463. <template v-if="order == null || order.amount_paid == 0">
  464. <span v-if="checkCreditLimit(order)">{{ priceTotal(true) }} seront débités</span>
  465. <span v-else>
  466. {{ formatPrice(user.credit) }} seront débités. (Limite de crédit à {{ formatPrice(producer.credit_limit) }})<br/>
  467. Restera {{ formatPrice(priceTotal() - user.credit) }} à régler.
  468. </span>
  469. </template>
  470. <template
  471. v-else-if="order != null && order.amount_paid > 0 && order.amount_paid < priceTotal()">
  472. <span v-if="checkCreditLimit(order)">{{ formatPrice(priceTotal() - order.amount_paid) }} seront débités</span>
  473. <span v-else>
  474. {{ formatPrice(user.credit) }} seront débités. (Limite de crédit à {{ formatPrice(producer.credit_limit) }})<br/>
  475. Restera {{ formatPrice(priceTotal() - order.amount_paid - user.credit) }} à régler.
  476. </span>
  477. </template>
  478. <template v-else-if="order != null && order.amount_paid > priceTotal()">
  479. <span>{{ formatPrice(order.amount_paid - priceTotal()) }} seront remboursés</span>
  480. </template>
  481. </div>
  482. </div>
  483. <div v-else>
  484. <span class="glyphicon glyphicon-chevron-right"></span>
  485. <?php if ($producerModule->isOnlinePaymentActiveAndTypeOrder($producer)): ?>
  486. La commande est à payer en ligne lors de l'étape suivante.
  487. <?php elseif ($producer->option_payment_info && strlen($producer->option_payment_info) > 0): ?>
  488. Confirmez votre commande et retrouvez les informations liées au paiement sur la page suivante.
  489. <?php else: ?>
  490. La commande sera à régler sur place.
  491. <?php endif; ?>
  492. </div>
  493. </div>
  494. <div id="signup-guest" v-if="!user && producer.option_allow_order_guest">
  495. <h3>Informations personnelles</h3>
  496. <form action="#">
  497. <div class="form-group field-signupguest-email required">
  498. <label class="control-label" for="signupguest-email">Email</label>
  499. <input type="email" id="signupguest-email" class="form-control"
  500. name="SignupForm[email]">
  501. <p class="help-block help-block-error"></p>
  502. </div>
  503. <!--<div class="form-group field-signupguest-password required">
  504. <label class="control-label" for="signupguest-password">Mot de passe</label>
  505. <input type="password" id="signupguest-password" class="form-control" name="SignupForm[password]">
  506. <p class="help-block help-block-error"></p>
  507. </div>-->
  508. <div class="form-group field-signupguest-firstname required">
  509. <label class="control-label" for="signupguest-firstname">Prénom</label>
  510. <input type="text" id="signupguest-firstname" class="form-control"
  511. name="SignupForm[firstname]">
  512. <p class="help-block help-block-error"></p>
  513. </div>
  514. <div class="form-group field-signupguest-lastname required">
  515. <label class="control-label" for="signupguest-lastname">Nom</label>
  516. <input type="text" id="signupguest-lastname" class="form-control"
  517. name="SignupForm[lastname]">
  518. <p class="help-block help-block-error"></p>
  519. </div>
  520. <div class="form-group field-signupguest-phone required">
  521. <label class="control-label" for="signupguest-phone">Téléphone</label>
  522. <input type="text" id="signupguest-phone" class="form-control"
  523. name="SignupForm[phone]">
  524. <p class="help-block help-block-error"></p>
  525. </div>
  526. </form>
  527. </div>
  528. <div class="block-actions">
  529. <button class="btn btn-primary" disabled="disabled" v-if="disableConfirmButton">Je
  530. confirme ma commande
  531. </button>
  532. <button class="btn btn-primary" v-else @click="confirmClick">Je confirme ma
  533. commande
  534. </button>
  535. </div>
  536. </template>
  537. </div>
  538. </div>
  539. </transition>
  540. </div>
  541. </div>
  542. <div id="infos" v-if="producer != null && producer.order_infos != null && producer.order_infos.length">
  543. <div class="panel panel-default">
  544. <div class="panel-heading">
  545. <i class="glyphicon glyphicon-info-sign"></i> Informations
  546. </div>
  547. <div class="panel-body">
  548. {{ producer.order_infos }}
  549. </div>
  550. </div>
  551. </div>
  552. <div v-if="producer != null && producer.online_payment && producer.option_online_payment_type == 'credit'"
  553. id="credit-online-payment">
  554. <div class="panel panel-default">
  555. <div class="panel-heading">
  556. <i class="glyphicon glyphicon-euro"></i> Paiement en ligne
  557. <a href="<?= \Yii::$app->urlManager->createUrl(['credit/add']) ?>" class="btn btn-sm btn-default"><i
  558. class="glyphicon glyphicon-credit-card"></i> Créditer mon compte</a>
  559. </div>
  560. <div class="panel-body">
  561. Vous utilisez le crédit pour régler vos commandes ? Simplifiez les paiements avec votre producteur
  562. en créditant votre compte par carte bancaire.
  563. </div>
  564. </div>
  565. </div>
  566. <?php
  567. $producer = GlobalParam::getCurrentProducer();
  568. if ($producerModule->hasSpecificDelays($producer)): ?>
  569. <div id="specific-delays" class="panel panel-default">
  570. <div class="panel-heading">
  571. Délais de commande spécifiques
  572. </div>
  573. <div class="panel-body">
  574. <table class="table table-bordered">
  575. <thead>
  576. <tr>
  577. <th>Jour</th>
  578. <th>Délai</th>
  579. </tr>
  580. </thead>
  581. <?php foreach ($producerModule->getSpecificDelays($producer) as $day => $delay): ?>
  582. <?php if ($delay['order_delay'] && $delay['order_deadline']): ?>
  583. <tr>
  584. <td>
  585. <?php
  586. switch ($day) {
  587. case 'monday':
  588. echo 'Lundi';
  589. break;
  590. case 'tuesday':
  591. echo 'Mardi';
  592. break;
  593. case 'wednesday':
  594. echo 'Mercredi';
  595. break;
  596. case 'thursday':
  597. echo 'Jeudi';
  598. break;
  599. case 'friday':
  600. echo 'Vendredi';
  601. break;
  602. case 'saturday':
  603. echo 'Samedi';
  604. break;
  605. case 'sunday':
  606. echo 'Dimanche';
  607. break;
  608. }
  609. ?>
  610. </td>
  611. <td>
  612. <span><?= $delay['order_delay'] ?> jour<?= ($delay['order_delay'] > 1) ? 's' : '' ?></span>
  613. à l'avance,
  614. avant
  615. <span><?= ($delay['order_deadline'] == 24) ? 'minuit' : $delay['order_deadline'] . 'h'; ?></span>
  616. </td>
  617. </tr>
  618. <?php endif; ?>
  619. <?php endforeach; ?>
  620. </table>
  621. </div>
  622. </div>
  623. <?php endif; ?>
  624. </div>
  625. </div>
  626. <script type="text/x-template" id="template-step-date">
  627. <li id="step-date" :class="'col-md-3'+((step == 'date') ? ' active' : '')+(first ? ' first' : '')">
  628. <button @click="changeStep('date')" :class="'btn '+ (step == 'date' ? 'btn-primary' : 'btn-default')"
  629. :disabled="producer && producer.option_order_entry_point == 'point-sale' && !pointSaleActive">
  630. <span class="button-content"><span class="glyphicon glyphicon-time"></span> Date</span></span>
  631. </button>
  632. <div class="info-step" v-if="dateFormat">
  633. {{ dateFormat }}
  634. </div>
  635. </li>
  636. </script>
  637. <script type="text/x-template" id="template-step-point-sale">
  638. <li id="step-point-sale" :class="'col-md-3'+((step == 'point-sale') ? ' active ' : '')+(first ? ' first' : '')">
  639. <button @click="changeStep('point-sale')"
  640. :class="'btn '+ (step == 'point-sale' ? 'btn-primary' : 'btn-default')"
  641. :disabled="producer && (producer.option_order_entry_point == 'date' && step == 'date')">
  642. <span class="button-content"><span
  643. class="glyphicon glyphicon-map-marker"></span> <?= $producerModule->getPointSaleWording($producer); ?></span>
  644. </button>
  645. <div class="info-step" v-if="pointSaleActive">
  646. {{ pointSaleActive.name }}
  647. </div>
  648. </li>
  649. </script>