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.

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