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.

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