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.

order.php 49KB

8 kuukautta sitten
1 vuosi sitten
6 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
6 vuotta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
6 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
6 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
6 vuotta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
6 vuotta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
8 kuukautta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  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 ?>
  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">
  352. {{ product.recipe }}
  353. </div>
  354. </div>
  355. </td>
  356. <td class="price-unit">
  357. <template v-if="productHasPrice(product)">
  358. <div>
  359. {{ formatPrice(getBestProductPrice(product.id,
  360. product.quantity_form)) }}<br/>
  361. <span class="price-infos">{{ product.wording_unit }}</span>
  362. <template v-if="product.unit == 'piece' && product.weight">
  363. <br />
  364. <span class="price-infos">
  365. {{ formatPrice(product.price_unit_ref) }} / kg
  366. </span>
  367. </template>
  368. </div>
  369. <div v-if="productHasPriceWithFromQuantity(product)"
  370. class="alert alert-info decreasing-prices">
  371. <ul>
  372. <li v-for="price in product.prices"
  373. v-if="price.from_quantity > 0">
  374. <strong>{{ formatPrice(price.price_with_tax)
  375. }}</strong><br/>à partir de {{
  376. price.from_quantity }} {{ product.wording_unit_ref
  377. }}
  378. </li>
  379. </ul>
  380. </div>
  381. </template>
  382. </td>
  383. <td class="td-quantity">
  384. <template v-if="productHasPrice(product)">
  385. <div class="input-group">
  386. <span class="input-group-btn">
  387. <button class="btn btn-secondary btn-moins"
  388. type="button"
  389. @click="productQuantityClick(product, product.unit == 'piece' ? -1 : -parseFloat(product.step))"
  390. :disabled="product.quantity_form == 0 || loadingProducts">
  391. <i class="bi bi-dash-lg"></i></button>
  392. </span>
  393. <input type="text" v-model="product.quantity_form"
  394. class="form-control quantity" readonly="readonly"/>
  395. <span class="input-group-text">{{ product.unit == 'piece' ? 'p.' : product.unit }}</span>
  396. <span class="input-group-btn">
  397. <button class="btn btn-secondary btn-plus"
  398. type="button"
  399. @click="productQuantityClick(product, product.unit == 'piece' ? 1 : parseFloat(product.step))"
  400. :disabled="loadingProducts || (product.quantity_remaining != null && product.quantity_remaining <= 0) || (product.quantity_max != null && product.quantity_form >= product.quantity_max * product.coefficient_unit)">
  401. <i class="bi bi-plus-lg"></i></button>
  402. </span>
  403. </div>
  404. </template>
  405. </td>
  406. <td class="price-total">
  407. <template
  408. v-if="productHasPrice(product) && product.quantity_form > 0">
  409. {{ formatPrice(getBestProductPrice(product.id,
  410. product.quantity_form) * (product.quantity_form /
  411. product.coefficient_unit )) }}
  412. </template>
  413. </td>
  414. </tr>
  415. </template>
  416. </template>
  417. <tr class="total">
  418. <td class="summary" colspan="4">
  419. <template v-if="priceTotal() > 0">
  420. <h3>Résumé</h3>
  421. <ul>
  422. <li v-for="product in products" v-if="product.quantity_form > 0">
  423. <span class="quantity">{{ product.quantity_form }} {{ product.unit == 'piece' ? 'p.' : product.unit }}</span>
  424. <span class="name">{{ product.name }}</span>
  425. <!--<span class="other">
  426. <span v-if="product.description.length">/</span>
  427. <span class="description">{{ product.description }}</span>-->
  428. <span class="other">
  429. <span v-if="product.weight">({{ product.weight }}&nbsp;g)</span>
  430. </span>
  431. </li>
  432. </ul>
  433. </template>
  434. </td>
  435. <td class="price-total">
  436. <span>{{ priceTotal(true) }}</span>
  437. </td>
  438. </tr>
  439. </tbody>
  440. </table>
  441. <div id="content-step-payment">
  442. <div>
  443. <div class="card delivery" v-if="pointSaleActive.is_home_delivery">
  444. <div class="card-body">
  445. <h5 class="card-title">
  446. <label for="order-comment">
  447. <i class="bi bi-truck"></i>
  448. Adresse de livraison
  449. </label>
  450. </h5>
  451. <div class="card-text">
  452. <form>
  453. <textarea id="deliver-address" v-model="deliveryAddress" class="form-control" required="required"></textarea>
  454. </form>
  455. </div>
  456. </div>
  457. </div>
  458. <div class="card comment">
  459. <div class="card-body">
  460. <h5 class="card-title">
  461. <label for="order-comment">
  462. <i class="bi bi-chat-left"></i>
  463. Commentaire
  464. </label>
  465. </h5>
  466. <div class="card-text">
  467. <form>
  468. <textarea id="order-comment" v-model="comment" class="form-control"></textarea>
  469. </form>
  470. </div>
  471. </div>
  472. </div>
  473. <div id="payment-methods" class="card" v-if="pointSaleActive.payment_method_onsite || pointSaleActive.payment_method_credit || pointSaleActive.payment_method_online">
  474. <div class="card-body">
  475. <h5 class="card-title">
  476. <i class="bi bi-currency-euro"></i>
  477. Paiement
  478. </h5>
  479. <div class="card-text">
  480. <div class="row">
  481. <div class="col-md-4" v-if="isPaymentMethodOnsiteActive()">
  482. <input v-model="paymentMethod" type="radio" class="btn-check" name="payment_method" value="onsite" id="payment-method-onsite" autocomplete="off">
  483. <label class="btn btn-outline-success" for="payment-method-onsite">
  484. <i class="bi bi-wallet2"></i>
  485. Sur place
  486. </label>
  487. </div>
  488. <div class="col-md-4" v-if="isPaymentMethodCreditActive()">
  489. <template v-if="errorCreditMandatoryAndLimit()">
  490. <div class="alert alert-danger">
  491. <i class="bi bi-piggy-bank"></i>
  492. Vous devez
  493. <template v-if="producer.online_payment == 1">
  494. <a href="<?= \Yii::$app->urlManager->createUrl(['credit/add']) ?>">
  495. recharger votre cagnotte</a>
  496. </template>
  497. <template v-else>recharger votre cagnotte</template>
  498. auprès de votre producteur ou supprimer des produits.</span>
  499. Votre producteur n'autorise pas une cagnotte avec un montant inférieur
  500. à {{ formatPrice(producer.credit_limit) }}.<br />
  501. Montant de votre cagnotte : {{ formatPrice(user.credit) }}<br />
  502. Montant de votre commande : {{ priceTotal(true) }}
  503. </div>
  504. </template>
  505. <template v-else>
  506. <input v-model="paymentMethod" type="radio" class="btn-check" name="payment_method" value="credit" id="payment-method-credit" autocomplete="off">
  507. <label class="btn btn-outline-success" for="payment-method-credit">
  508. <i class="bi bi-piggy-bank"></i>
  509. Cagnotte
  510. </label>
  511. <div class="infos">
  512. Montant de ma cagnotte : {{ formatPrice(user.credit) }}<br />
  513. <template v-if="paymentMethod == 'credit'">
  514. <template v-if="order == null || order.amount_paid == 0">
  515. <span v-if="checkCreditLimit(order)">{{ priceTotal(true) }} seront débités</span>
  516. <span v-else>
  517. {{ formatPrice(user.credit) }} seront débités. (Limite de cagnotte à {{ formatPrice(producer.credit_limit) }})<br/>
  518. Restera {{ formatPrice(priceTotal() - user.credit) }} à régler.
  519. </span>
  520. </template>
  521. <template v-else-if="order != null && order.amount_paid > 0 && order.amount_paid < priceTotal()">
  522. <span v-if="checkCreditLimit(order)">{{ formatPrice(priceTotal() - order.amount_paid) }} seront débités</span>
  523. <span v-else>
  524. {{ formatPrice(user.credit) }} seront débités. (Limite de cagnotte à {{ formatPrice(producer.credit_limit) }})<br/>
  525. Restera {{ formatPrice(priceTotal() - order.amount_paid - user.credit) }} à régler.
  526. </span>
  527. </template>
  528. <template v-else-if="order != null && order.amount_paid > priceTotal()">
  529. <span>{{ formatPrice(order.amount_paid - priceTotal()) }} seront remboursés</span>
  530. </template>
  531. </template>
  532. </div>
  533. </template>
  534. </div>
  535. <div class="col-md-4" v-if="isPaymentMethodCreditActiveFunctioningUser(false)">
  536. <input v-model="paymentMethod" type="radio" class="btn-check" name="payment_method" value="credit" id="payment-method-credit" autocomplete="off" disabled>
  537. <label class="btn btn-outline-success" for="payment-method-credit">
  538. <i class="bi bi-piggy-bank"></i>
  539. Cagnotte
  540. </label>
  541. <div class="infos">
  542. Sur demande, vous pouvez payer vos commandes via votre
  543. cagnotte sur ce point de vente. N'hésitez pas à en
  544. parler à votre producteur.
  545. </div>
  546. </div>
  547. <div class="col-md-4" v-if="isPaymentMethodOnlineActive()">
  548. <input v-model="paymentMethod" type="radio" class="btn-check" name="payment_method" value="online" id="payment-method-online" autocomplete="off">
  549. <label class="btn btn-outline-success" for="payment-method-online">
  550. <i class="bi bi-credit-card"></i>
  551. Carte bancaire
  552. </label>
  553. <div class="infos">
  554. Paiement sécurisé via la plateforme Stripe.
  555. </div>
  556. </div>
  557. </div>
  558. </div>
  559. </div>
  560. </div>
  561. <template>
  562. <div id="signup-guest" class="card" v-if="!user && producer.option_allow_order_guest">
  563. <div class="card-body">
  564. <h5 class="card-title">
  565. <i class="bi bi-person"></i>
  566. Informations personnelles
  567. </h5>
  568. <div class="card-text">
  569. <form action="#">
  570. <div class="form-group field-signupguest-email required">
  571. <label class="control-label" for="signupguest-email">Email</label>
  572. <input type="email" id="signupguest-email" class="form-control"
  573. name="SignupForm[email]">
  574. <p class="help-block help-block-error"></p>
  575. </div>
  576. <div class="form-group field-signupguest-firstname required">
  577. <label class="control-label" for="signupguest-firstname">Prénom</label>
  578. <input type="text" id="signupguest-firstname" class="form-control"
  579. name="SignupForm[firstname]">
  580. <p class="help-block help-block-error"></p>
  581. </div>
  582. <div class="form-group field-signupguest-lastname required">
  583. <label class="control-label" for="signupguest-lastname">Nom</label>
  584. <input type="text" id="signupguest-lastname" class="form-control"
  585. name="SignupForm[lastname]">
  586. <p class="help-block help-block-error"></p>
  587. </div>
  588. <div class="form-group field-signupguest-phone required">
  589. <label class="control-label" for="signupguest-phone">Téléphone</label>
  590. <input type="text" id="signupguest-phone" class="form-control"
  591. name="SignupForm[phone]">
  592. <p class="help-block help-block-error"></p>
  593. </div>
  594. </form>
  595. </div>
  596. </div>
  597. </div>
  598. <div class="block-actions">
  599. <button class="btn btn-primary" disabled="disabled" v-if="disableConfirmButton || errorCreditMandatoryAndLimit() || !oneProductOrdered()">
  600. <span v-if="disableConfirmButton" class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
  601. Je confirme ma commande
  602. </button>
  603. <button class="btn btn-primary" v-else @click="confirmClick">
  604. Je confirme ma commande
  605. </button>
  606. </div>
  607. </template>
  608. </div>
  609. </div>
  610. </div>
  611. <div class="alert alert-warning" v-else>
  612. Aucun produit disponible
  613. </div>
  614. </div>
  615. </div>
  616. </transition>
  617. <transition name="slide">
  618. </transition>
  619. </div>
  620. </div>
  621. <!--<div v-if="producer != null && producer.online_payment && producer.option_online_payment_type == 'credit'"
  622. id="credit-online-payment">
  623. <div class="panel panel-default">
  624. <div class="panel-heading">
  625. <i class="glyphicon glyphicon-euro"></i> Paiement en ligne
  626. <a href="<?= \Yii::$app->urlManager->createUrl(['credit/add']) ?>" class="btn btn-sm btn-secondary"><i
  627. class="glyphicon glyphicon-credit-card"></i> Créditer mon compte</a>
  628. </div>
  629. <div class="panel-body">
  630. Vous utilisez le crédit pour régler vos commandes ? Simplifiez les paiements avec votre producteur
  631. en créditant votre compte par carte bancaire.
  632. </div>
  633. </div>
  634. </div>-->
  635. <?= $this->render('_block_infos'); ?>
  636. </div>
  637. </div>
  638. <script type="text/x-template" id="template-step-date">
  639. <li id="step-date" :class="'col-md-4'+((step == 'date') ? ' active' : '')+(first ? ' first' : '')">
  640. <button @click="changeStep('date')" :class="'btn '+ (step == 'date' ? 'btn-primary' : 'btn-secondary')"
  641. :disabled="producer && producer.option_order_entry_point == 'point-sale' && !pointSaleActive">
  642. <span class="button-content"><span class="glyphicon glyphicon-time"></span> Date</span></span>
  643. </button>
  644. <div class="info-step" v-if="dateFormat">
  645. {{ dateFormat }}
  646. </div>
  647. </li>
  648. </script>
  649. <script type="text/x-template" id="template-step-point-sale">
  650. <li id="step-point-sale" :class="'col-md-4'+((step == 'point-sale') ? ' active ' : '')+(first ? ' first' : '')">
  651. <button @click="changeStep('point-sale')"
  652. :class="'btn '+ (step == 'point-sale' ? 'btn-primary' : 'btn-secondary')"
  653. :disabled="producer && (producer.option_order_entry_point == 'date' && step == 'date')">
  654. <span class="button-content"><span
  655. class="glyphicon glyphicon-map-marker"></span> <?= $producerModule->getPointSaleWording($producer); ?></span>
  656. </button>
  657. <div class="info-step" v-if="pointSaleActive">
  658. {{ pointSaleActive.name }}
  659. </div>
  660. </li>
  661. </script>