您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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