選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

677 行
46KB

  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-4 '+((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. <div class="minimum-order-amount" v-if="pointSale.minimum_order_amount">
  229. Montant minimum de commande : {{ formatPrice(pointSale.minimum_order_amount) }}
  230. </div>
  231. </td>
  232. <td class="locality">{{ pointSale.locality }}</td>
  233. <td class="actions">
  234. <template
  235. v-if="(order == null || order.id_point_sale != pointSale.id) && pointSale.maximum_number_orders && pointSale.count_orders && pointSale.count_orders >= pointSale.maximum_number_orders">
  236. <span class="label label-default">
  237. <template v-if="pointSale.is_bread_box">
  238. Déjà réservée
  239. </template>
  240. <template v-else>
  241. Maximum de commande atteint
  242. </template>
  243. </span>
  244. </template>
  245. <template v-else>
  246. <div :class="'form-group' + (pointSale.invalid_code ? ' has-error' : '')">
  247. <div class="input-group"
  248. v-if="pointSale.code && pointSale.code.length > 0">
  249. <span class="input-group-addon"><span
  250. class="glyphicon glyphicon-lock"></span></span>
  251. <input v-model="pointsSaleCodes[pointSale.id]" type="password"
  252. placeholder="Code" class="form-control input-code"/>
  253. </div>
  254. </div>
  255. <div v-if="!user && producer.credit == 1 && pointSale.credit == 1">
  256. <a :href="urlLogin" class="btn btn-default">
  257. <span class="glyphicon glyphicon-log-in"></span>
  258. Connexion obligatoire
  259. </a>
  260. </div>
  261. <div v-else>
  262. <button class="btn btn-primary" @click="pointSaleClick"
  263. :data-code="pointSale.code && pointSale.code.length > 0"
  264. :data-id-point-sale="pointSale.id">
  265. <span class="glyphicon glyphicon-map-marker"></span>
  266. Choisir
  267. </button>
  268. </div>
  269. </template>
  270. </td>
  271. </tr>
  272. </tbody>
  273. </table>
  274. <div class="alert alert-warning" v-else>
  275. Aucun point de vente disponible pour ce jour de distribution.
  276. </div>
  277. </div>
  278. </div>
  279. </transition>
  280. <transition name="slide">
  281. <div id="content-step-products" v-if="step == 'products'">
  282. <div v-if="!loading">
  283. <div v-if="products.length">
  284. <table id="products" class="table table-bordered">
  285. <thead>
  286. <tr>
  287. <th class="photo">Photo</th>
  288. <th class="name">Nom</th>
  289. <th class="price">Prix unitaire</th>
  290. <th class="quantity">Quantité</th>
  291. <th class="total">Total</th>
  292. </tr>
  293. </thead>
  294. <tbody>
  295. <template v-for="category in categories">
  296. <tr v-if="category.id && countProductsByCategory(category)">
  297. <td class="category-name" colspan="5" @click="setCategoryCurrent(category)">
  298. <span v-if="categoryCurrent && categoryCurrent.id == category.id"
  299. class="glyphicon glyphicon-triangle-bottom"></span>
  300. <span v-else class="glyphicon glyphicon-triangle-right"></span>
  301. {{ category.name }}
  302. <span class="label label-default">{{ countProductsByCategory(category) }} produit<template
  303. v-if="countProductsByCategory(category) > 1">s</template></span>
  304. <span v-if="countSelectedProductsByCategory(category) > 0"
  305. class="label label-success">{{ countSelectedProductsByCategory(category) }} produit<template
  306. v-if="countSelectedProductsByCategory(category) > 1">s</template> sélectionné<template
  307. v-if="countSelectedProductsByCategory(category) > 1">s</template></span>
  308. </td>
  309. </tr>
  310. <template v-if="(categoryCurrent && categoryCurrent.id == category.id) || category.id == null">
  311. <tr v-for="product in products"
  312. v-if="product.id_product_category == category.id && isProductAvailable(product)">
  313. <td class="photo">
  314. <a class="product-photo" :href="product.photo_big" :title="product.name">
  315. <img v-if="product.photo.length" class="photo-product" :src="product.photo"/>
  316. </a>
  317. </td>
  318. <td class="name product-name-description-block">
  319. <span class="name">{{ product.name }}</span>
  320. <span class="other">
  321. <span v-if="product.weight">({{ product.weight }}&nbsp;g)</span>
  322. </span>
  323. <div>
  324. <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)"
  325. class="label label-danger">Épuisé</span>
  326. </div>
  327. <div class="description" v-if="product.description.length">
  328. {{ product.description }}
  329. </div>
  330. <div class="description-long" v-if="product.recipe.length">
  331. <a href="javascript:void(0);" class="show-more-link">En savoir
  332. plus</a>
  333. <div class="content">
  334. {{ product.recipe }}
  335. </div>
  336. </div>
  337. </td>
  338. <td class="price-unit">
  339. <template v-if="productHasPrice(product)">
  340. <div>
  341. {{ formatPrice(getBestProductPrice(product.id,
  342. product.quantity_form)) }}<br/>
  343. <span class="price-infos">{{ product.wording_unit }}</span>
  344. <template v-if="product.unit == 'piece' && product.weight">
  345. <br />
  346. <span class="price-infos">
  347. {{ formatPrice(product.price_unit_ref) }} / kg
  348. </span>
  349. </template>
  350. </div>
  351. <div v-if="productHasPriceWithFromQuantity(product)"
  352. class="alert alert-info decreasing-prices">
  353. <ul>
  354. <li v-for="price in product.prices"
  355. v-if="price.from_quantity > 0">
  356. <strong>{{ formatPrice(price.price_with_tax)
  357. }}</strong><br/>à partir de {{
  358. price.from_quantity }} {{ product.wording_unit_ref
  359. }}
  360. </li>
  361. </ul>
  362. </div>
  363. </template>
  364. </td>
  365. <td class="td-quantity">
  366. <template v-if="productHasPrice(product)">
  367. <div class="input-group">
  368. <span class="input-group-btn">
  369. <button class="btn btn-default btn-moins"
  370. type="button"
  371. @click="productQuantityClick(product, product.unit == 'piece' ? -1 : -parseFloat(product.step))"
  372. :disabled="product.quantity_form == 0"><span
  373. class="glyphicon glyphicon-minus"></span></button>
  374. </span>
  375. <input type="text" v-model="product.quantity_form"
  376. class="form-control quantity" readonly="readonly"/>
  377. <span class="input-group-addon">{{ product.unit == 'piece' ? 'p.' : product.unit }}</span>
  378. <span class="input-group-btn">
  379. <button class="btn btn-default btn-plus"
  380. type="button"
  381. @click="productQuantityClick(product, product.unit == 'piece' ? 1 : parseFloat(product.step))"
  382. :disabled="product.quantity_form == product.quantity_remaining && product.quantity_max > 0"><span
  383. class="glyphicon glyphicon-plus"></span></button>
  384. </span>
  385. </div>
  386. </template>
  387. </td>
  388. <td class="price-total">
  389. <template
  390. v-if="productHasPrice(product) && product.quantity_form > 0">
  391. {{ formatPrice(getBestProductPrice(product.id,
  392. product.quantity_form) * (product.quantity_form /
  393. product.coefficient_unit )) }}
  394. </template>
  395. </td>
  396. </tr>
  397. </template>
  398. </template>
  399. <tr class="total">
  400. <td class="summary" colspan="4">
  401. <template v-if="priceTotal() > 0">
  402. <h3>&gt; Résumé</h3>
  403. <ul>
  404. <li v-for="product in products" v-if="product.quantity_form > 0">
  405. <span class="quantity">{{ product.quantity_form }} {{ product.unit == 'piece' ? 'p.' : product.unit }} x</span>
  406. <span class="name">{{ product.name }}</span>
  407. <!--<span class="other">
  408. <span v-if="product.description.length">/</span>
  409. <span class="description">{{ product.description }}</span>-->
  410. <span class="other">
  411. <span v-if="product.weight">({{ product.weight }}&nbsp;g)</span>
  412. </span>
  413. </li>
  414. </ul>
  415. </template>
  416. </td>
  417. <td class="price-total">{{ priceTotal(true) }}</td>
  418. </tr>
  419. </tbody>
  420. </table>
  421. <div id="content-step-payment">
  422. <div>
  423. <div class="delivery">
  424. <div class="delivery-home" v-if="pointSaleActive.is_home_delivery">
  425. <label for="deliver-address">Adresse de livraison</label>
  426. <textarea id="deliver-address" v-model="deliveryAddress" class="form-control"
  427. required="required"></textarea>
  428. </div>
  429. </div>
  430. <div class="comment">
  431. <label for="order-comment">Commentaire</label>
  432. <textarea id="order-comment" v-model="comment" class="form-control"></textarea>
  433. </div>
  434. <template
  435. v-if="producer.credit == 1 && pointSaleActive.credit == 1 && (pointSaleActive.credit_functioning == 'mandatory' || (pointSaleActive.credit_functioning == 'user' && user.credit_active)) && !checkCreditLimit(order) ">
  436. <div class="alert alert-danger">
  437. Vous devez
  438. <template v-if="producer.online_payment == 1"><a
  439. href="<?= \Yii::$app->urlManager->createUrl(['credit/add']) ?>">recharger
  440. votre crédit</a></template>
  441. <template v-else>recharger votre crédit</template>
  442. auprès de votre producteur ou supprimer des produits.</span>
  443. Votre producteur n'autorise pas un crédit inférieur
  444. à <strong>{{ formatPrice(producer.credit_limit) }}</strong>.
  445. </div>
  446. <div class="block-actions">
  447. <a class="btn btn-primary"
  448. href="<?= \Yii::$app->urlManager->createUrl(['site/index']) ?>">Retour à
  449. l'accueil</a>
  450. </div>
  451. </template>
  452. <template v-else>
  453. <div class="credit">
  454. <div v-if="user && producer.credit == 1 && pointSaleActive.credit == 1 && (pointSaleActive.credit_functioning != 'user' || (pointSaleActive.credit_functioning == 'user' && user.credit_active))">
  455. <input type="checkbox" id="use-credit" v-model="useCredit" disabled="disabled"
  456. v-if="pointSaleActive.credit_functioning == 'mandatory' || (pointSaleActive.credit_functioning == 'user' && user.credit_active)"/>
  457. <input type="checkbox" id="use-credit" v-model="useCredit" v-else/> <label
  458. for="use-credit">Utiliser mon Crédit ({{ formatPrice(user.credit)
  459. }})</label>
  460. <div class="info" v-if="useCredit">
  461. <template v-if="order == null || order.amount_paid == 0">
  462. <span v-if="checkCreditLimit(order)">{{ priceTotal(true) }} seront débités</span>
  463. <span v-else>
  464. {{ formatPrice(user.credit) }} seront débités. (Limite de crédit à {{ formatPrice(producer.credit_limit) }})<br/>
  465. Restera {{ formatPrice(priceTotal() - user.credit) }} à régler.
  466. </span>
  467. </template>
  468. <template
  469. v-else-if="order != null && order.amount_paid > 0 && order.amount_paid < priceTotal()">
  470. <span v-if="checkCreditLimit(order)">{{ formatPrice(priceTotal() - order.amount_paid) }} seront débités</span>
  471. <span v-else>
  472. {{ formatPrice(user.credit) }} seront débités. (Limite de crédit à {{ formatPrice(producer.credit_limit) }})<br/>
  473. Restera {{ formatPrice(priceTotal() - order.amount_paid - user.credit) }} à régler.
  474. </span>
  475. </template>
  476. <template v-else-if="order != null && order.amount_paid > priceTotal()">
  477. <span>{{ formatPrice(order.amount_paid - priceTotal()) }} seront remboursés</span>
  478. </template>
  479. </div>
  480. </div>
  481. <div v-else>
  482. <span class="glyphicon glyphicon-chevron-right"></span>
  483. <?php if ($producerModule->isOnlinePaymentActiveAndTypeOrder($producer)): ?>
  484. La commande est à payer en ligne lors de l'étape suivante.
  485. <?php elseif ($producer->option_payment_info && strlen($producer->option_payment_info) > 0): ?>
  486. Confirmez votre commande et retrouvez les informations liées au paiement sur la page suivante.
  487. <?php else: ?>
  488. La commande sera à régler sur place.
  489. <?php endif; ?>
  490. </div>
  491. </div>
  492. <div id="signup-guest" v-if="!user && producer.option_allow_order_guest">
  493. <h3>Informations personnelles</h3>
  494. <form action="#">
  495. <div class="form-group field-signupguest-email required">
  496. <label class="control-label" for="signupguest-email">Email</label>
  497. <input type="email" id="signupguest-email" class="form-control"
  498. name="SignupForm[email]">
  499. <p class="help-block help-block-error"></p>
  500. </div>
  501. <div class="form-group field-signupguest-firstname required">
  502. <label class="control-label" for="signupguest-firstname">Prénom</label>
  503. <input type="text" id="signupguest-firstname" class="form-control"
  504. name="SignupForm[firstname]">
  505. <p class="help-block help-block-error"></p>
  506. </div>
  507. <div class="form-group field-signupguest-lastname required">
  508. <label class="control-label" for="signupguest-lastname">Nom</label>
  509. <input type="text" id="signupguest-lastname" class="form-control"
  510. name="SignupForm[lastname]">
  511. <p class="help-block help-block-error"></p>
  512. </div>
  513. <div class="form-group field-signupguest-phone required">
  514. <label class="control-label" for="signupguest-phone">Téléphone</label>
  515. <input type="text" id="signupguest-phone" class="form-control"
  516. name="SignupForm[phone]">
  517. <p class="help-block help-block-error"></p>
  518. </div>
  519. </form>
  520. </div>
  521. <div class="block-actions">
  522. <button class="btn btn-primary" disabled="disabled" v-if="disableConfirmButton || !oneProductOrdered()">Je
  523. confirme ma commande
  524. </button>
  525. <button class="btn btn-primary" v-else @click="confirmClick">Je confirme ma
  526. commande
  527. </button>
  528. </div>
  529. </template>
  530. </div>
  531. </div>
  532. </div>
  533. <div class="alert alert-warning" v-else>
  534. Aucun produit disponible
  535. </div>
  536. </div>
  537. </div>
  538. </transition>
  539. <transition name="slide">
  540. </transition>
  541. </div>
  542. </div>
  543. <div id="infos" v-if="producer != null && producer.order_infos != null && producer.order_infos.length">
  544. <div class="panel panel-default">
  545. <div class="panel-heading">
  546. <i class="glyphicon glyphicon-info-sign"></i> Informations
  547. </div>
  548. <div class="panel-body">
  549. {{ producer.order_infos }}
  550. </div>
  551. </div>
  552. </div>
  553. <div v-if="producer != null && producer.online_payment && producer.option_online_payment_type == 'credit'"
  554. id="credit-online-payment">
  555. <div class="panel panel-default">
  556. <div class="panel-heading">
  557. <i class="glyphicon glyphicon-euro"></i> Paiement en ligne
  558. <a href="<?= \Yii::$app->urlManager->createUrl(['credit/add']) ?>" class="btn btn-sm btn-default"><i
  559. class="glyphicon glyphicon-credit-card"></i> Créditer mon compte</a>
  560. </div>
  561. <div class="panel-body">
  562. Vous utilisez le crédit pour régler vos commandes ? Simplifiez les paiements avec votre producteur
  563. en créditant votre compte par carte bancaire.
  564. </div>
  565. </div>
  566. </div>
  567. <?php
  568. $producer = GlobalParam::getCurrentProducer();
  569. if ($producerModule->hasSpecificDelays($producer)): ?>
  570. <div id="specific-delays" class="panel panel-default">
  571. <div class="panel-heading">
  572. Délais de commande spécifiques
  573. </div>
  574. <div class="panel-body">
  575. <table class="table table-bordered">
  576. <thead>
  577. <tr>
  578. <th>Jour</th>
  579. <th>Délai</th>
  580. </tr>
  581. </thead>
  582. <?php foreach ($producerModule->getSpecificDelays($producer) as $day => $delay): ?>
  583. <?php if ($delay['order_delay'] && $delay['order_deadline']): ?>
  584. <tr>
  585. <td>
  586. <?php
  587. switch ($day) {
  588. case 'monday':
  589. echo 'Lundi';
  590. break;
  591. case 'tuesday':
  592. echo 'Mardi';
  593. break;
  594. case 'wednesday':
  595. echo 'Mercredi';
  596. break;
  597. case 'thursday':
  598. echo 'Jeudi';
  599. break;
  600. case 'friday':
  601. echo 'Vendredi';
  602. break;
  603. case 'saturday':
  604. echo 'Samedi';
  605. break;
  606. case 'sunday':
  607. echo 'Dimanche';
  608. break;
  609. }
  610. ?>
  611. </td>
  612. <td>
  613. <span><?= $delay['order_delay'] ?> jour<?= ($delay['order_delay'] > 1) ? 's' : '' ?></span>
  614. à l'avance,
  615. avant
  616. <span><?= ($delay['order_deadline'] == 24) ? 'minuit' : $delay['order_deadline'] . 'h'; ?></span>
  617. </td>
  618. </tr>
  619. <?php endif; ?>
  620. <?php endforeach; ?>
  621. </table>
  622. </div>
  623. </div>
  624. <?php endif; ?>
  625. </div>
  626. </div>
  627. <script type="text/x-template" id="template-step-date">
  628. <li id="step-date" :class="'col-md-4'+((step == 'date') ? ' active' : '')+(first ? ' first' : '')">
  629. <button @click="changeStep('date')" :class="'btn '+ (step == 'date' ? 'btn-primary' : 'btn-default')"
  630. :disabled="producer && producer.option_order_entry_point == 'point-sale' && !pointSaleActive">
  631. <span class="button-content"><span class="glyphicon glyphicon-time"></span> Date</span></span>
  632. </button>
  633. <div class="info-step" v-if="dateFormat">
  634. {{ dateFormat }}
  635. </div>
  636. </li>
  637. </script>
  638. <script type="text/x-template" id="template-step-point-sale">
  639. <li id="step-point-sale" :class="'col-md-4'+((step == 'point-sale') ? ' active ' : '')+(first ? ' first' : '')">
  640. <button @click="changeStep('point-sale')"
  641. :class="'btn '+ (step == 'point-sale' ? 'btn-primary' : 'btn-default')"
  642. :disabled="producer && (producer.option_order_entry_point == 'date' && step == 'date')">
  643. <span class="button-content"><span
  644. class="glyphicon glyphicon-map-marker"></span> <?= $producerModule->getPointSaleWording($producer); ?></span>
  645. </button>
  646. <div class="info-step" v-if="pointSaleActive">
  647. {{ pointSaleActive.name }}
  648. </div>
  649. </li>
  650. </script>