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.

680 line
49KB

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