border: solid 1px #f4efe8; | border: solid 1px #f4efe8; | ||||
} | } | ||||
/* line 32, ../sass/_common.scss */ | /* line 32, ../sass/_common.scss */ | ||||
#main .btn-secondary:hover, #main .btn-secondary:focus, #main .btn-secondary.active { | |||||
#main .btn-secondary:hover, #main .btn-secondary.active { | |||||
background-color: #ece4d8; | background-color: #ece4d8; | ||||
border: solid 1px #ece4d8; | border: solid 1px #ece4d8; | ||||
color: black; | color: black; | ||||
.block-date .day { | .block-date .day { | ||||
text-transform: capitalize; | text-transform: capitalize; | ||||
line-height: 15px; | line-height: 15px; | ||||
font-size: 13px; | |||||
font-size: 15px; | |||||
text-transform: uppercase; | text-transform: uppercase; | ||||
} | } | ||||
/* line 331, ../sass/_common.scss */ | /* line 331, ../sass/_common.scss */ | ||||
.block-date .month { | .block-date .month { | ||||
text-transform: uppercase; | text-transform: uppercase; | ||||
line-height: 15px; | line-height: 15px; | ||||
font-size: 13px; | |||||
font-size: 15px; | |||||
color: #ec5d2b; | color: #ec5d2b; | ||||
} | } | ||||
background-color: $color-gray-light; | background-color: $color-gray-light; | ||||
border: solid 1px $color-gray-light; | border: solid 1px $color-gray-light; | ||||
&:hover, &:focus, &.active { | |||||
&:hover, &.active { | |||||
background-color: $color-gray; | background-color: $color-gray; | ||||
border: solid 1px $color-gray; | border: solid 1px $color-gray; | ||||
color: black; | color: black; | ||||
.day { | .day { | ||||
text-transform: capitalize; | text-transform: capitalize; | ||||
line-height: 15px; | line-height: 15px; | ||||
font-size: 13px; | |||||
font-size: 15px; | |||||
text-transform: uppercase; | text-transform: uppercase; | ||||
} | } | ||||
.month { | .month { | ||||
text-transform: uppercase; | text-transform: uppercase; | ||||
line-height: 15px; | line-height: 15px; | ||||
font-size: 13px; | |||||
font-size: 15px; | |||||
color: darken($color-primary, 5); | color: darken($color-primary, 5); | ||||
} | } | ||||
} | } |
* Retourne le résumé du paiement (montant, statut). | * Retourne le résumé du paiement (montant, statut). | ||||
* @TODO : à déplacer dans OrderSolver | * @TODO : à déplacer dans OrderSolver | ||||
*/ | */ | ||||
public function getAmountSummary(Order $order): string | |||||
public function getAmountSummary(Order $order, string $context = 'admin'): string | |||||
{ | { | ||||
$html = ''; | $html = ''; | ||||
$html .= $this->orderSolver->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL, true); | $html .= $this->orderSolver->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL, true); | ||||
$html .= '<br />'.$this->getPaymentLabelShort($order); | |||||
$html .= '<br />'.$this->getPaymentLabelShort($order, $context); | |||||
return $html; | return $html; | ||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
public function getPaymentLabelShort(Order $order): string | |||||
public function getPaymentLabelShort(Order $order, string $context = 'admin'): string | |||||
{ | { | ||||
$isOrderPaid = $this->isOrderPaid($order); | $isOrderPaid = $this->isOrderPaid($order); | ||||
$amountPaid = $this->orderSolver->getOrderAmountPaid($order); | $amountPaid = $this->orderSolver->getOrderAmountPaid($order); | ||||
$orderPaymentStatus = $this->orderSolver->getPaymentStatus($order); | $orderPaymentStatus = $this->orderSolver->getPaymentStatus($order); | ||||
if($amountPaid > -0.01 && $amountPaid < 0.01 && !$isOrderPaid) { | if($amountPaid > -0.01 && $amountPaid < 0.01 && !$isOrderPaid) { | ||||
$classLabel = 'default'; | |||||
$classLabel = ($context == 'admin') ? 'default' : 'secondary'; | |||||
} | } | ||||
elseif($orderPaymentStatus == Order::PAYMENT_SURPLUS) { | elseif($orderPaymentStatus == Order::PAYMENT_SURPLUS) { | ||||
$classLabel = 'warning'; | $classLabel = 'warning'; | ||||
$titleLabel = 'Paiement partiel '.$amountPaid; | $titleLabel = 'Paiement partiel '.$amountPaid; | ||||
} | } | ||||
$labelHtml = '<span class="label label-'.$classLabel.'" title="'.$titleLabel.'">'.$label.'</span>'; | |||||
$prefixClassLabel = ($context == 'admin') ? 'label label-' : 'small text-'; | |||||
$labelHtml = '<span class="'.$prefixClassLabel . $classLabel.'" title="'.$titleLabel.'">'.$label.'</span>'; | |||||
if($amountPaid) { | if($amountPaid) { | ||||
$labelHtml .= $this->orderSolver->getPaymentLabelAmountRemainingSurplus($order); | $labelHtml .= $this->orderSolver->getPaymentLabelAmountRemainingSurplus($order); |
foreach($subscription->productSubscription as $productSubscription) | foreach($subscription->productSubscription as $productSubscription) | ||||
{ | { | ||||
if(isset($productSubscription->product) && $productSubscription->product) { | if(isset($productSubscription->product) && $productSubscription->product) { | ||||
$html .= Html::encode($productSubscription->product->name).' ('.($productSubscription->quantity * Product::$unitsArray[$productSubscription->product->unit]['coefficient']) . ' '. $this->productSolver->strUnit($productSubscription->product, 'wording_short').')<br />' ; | |||||
$html .= '<strong>'.($productSubscription->quantity * Product::$unitsArray[$productSubscription->product->unit]['coefficient']) . ' '. $this->productSolver->strUnit($productSubscription->product, 'wording_short') . '</strong> ' . Html::encode($productSubscription->product->name). '<br />' ; | |||||
} | } | ||||
else { | else { | ||||
$html .= 'Produit non défini<br />' ; | $html .= 'Produit non défini<br />' ; | ||||
if(!count($subscription->productSubscription)) | if(!count($subscription->productSubscription)) | ||||
{ | { | ||||
$html .= '<span class="glyphicon glyphicon-warning-sign"></span> Aucun produit' ; | |||||
$html .= '<i class="bi bi-exclamation-triangle"></i> Aucun produit' ; | |||||
} | } | ||||
return $html ; | return $html ; |
{ | { | ||||
return [ | return [ | ||||
'order_infos' => nl2br($producer->order_infos), | 'order_infos' => nl2br($producer->order_infos), | ||||
'payment_infos' => nl2br($producer->option_payment_info), | |||||
'credit' => $producer->credit, | 'credit' => $producer->credit, | ||||
'credit_functioning' => $producer->credit_functioning, | 'credit_functioning' => $producer->credit_functioning, | ||||
'use_credit_checked_default' => $producer->use_credit_checked_default, | 'use_credit_checked_default' => $producer->use_credit_checked_default, | ||||
'option_order_entry_point' => $producer->option_order_entry_point, | 'option_order_entry_point' => $producer->option_order_entry_point, | ||||
'option_delivery' => $producer->option_delivery, | 'option_delivery' => $producer->option_delivery, | ||||
'online_payment' => $producer->online_payment, | 'online_payment' => $producer->online_payment, | ||||
'option_online_payment_type' => $producer->online_payment | |||||
'option_online_payment_type' => $producer->online_payment, | |||||
'has_specific_delays' => $this->getProducerModule()->getSolver()->hasSpecificDelays($producer) | |||||
]; | ]; | ||||
} | } | ||||
->updateOrdersIncomingDistributionsFromSubscription($subscription, $isUpdate); | ->updateOrdersIncomingDistributionsFromSubscription($subscription, $isUpdate); | ||||
if ($isUpdate) { | if ($isUpdate) { | ||||
$this->setFlash('success', 'Abonnement modifié'); | |||||
$this->setFlash('success', "L'abonnement a bien été modifié"); | |||||
} else { | } else { | ||||
$this->setFlash('success', 'Abonnement ajouté'); | |||||
$this->setFlash('success', "L'abonnement a bien été ajouté"); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
if($id) { | if($id) { | ||||
$subscription = $subscriptionModule->getRepository()->findOneSubscriptionById($id); | $subscription = $subscriptionModule->getRepository()->findOneSubscriptionById($id); | ||||
if(!$subscription) { | if(!$subscription) { | ||||
$this->setFlash('error', 'Abonnement introuvable'); | |||||
$this->setFlash('error', "L'abonnement est introuvable"); | |||||
return $this->redirect(['subscription/index']); | return $this->redirect(['subscription/index']); | ||||
} | } | ||||
} | } | ||||
$this->getSubscriptionModule()->getOrderManager() | $this->getSubscriptionModule()->getOrderManager() | ||||
->deleteOrdersIncomingDistributionsFromSubscription($subscription); | ->deleteOrdersIncomingDistributionsFromSubscription($subscription); | ||||
$this->setFlash('success', 'Abonnement supprimé'); | |||||
$this->setFlash('success', "L'abonnement a bien été modifié"); | |||||
} | } | ||||
else { | else { | ||||
$this->setFlash('error', 'Abonnement introuvable'); | $this->setFlash('error', 'Abonnement introuvable'); |
#content a, | #content a, | ||||
.credit-history #credit-user, | .credit-history #credit-user, | ||||
.credit-history #content .table span.payment-positive, | .credit-history #content .table span.payment-positive, | ||||
.order-order #main #app-order-order #steps ul li .info-step { | |||||
.order-order #main #app-order-order #steps ul li .info-step, | |||||
.block-date .month { | |||||
color: <?= $mainColor ?> | color: <?= $mainColor ?> | ||||
} | } | ||||
#header nav#main-nav ul li.active a, | #header nav#main-nav ul li.active a, | ||||
#header nav#main-nav ul li a:hover, | #header nav#main-nav ul li a:hover, | ||||
#header nav#main-nav ul li a span.label-success, | #header nav#main-nav ul li a span.label-success, | ||||
#main .btn-primary, | #main .btn-primary, | ||||
.order-order #main #app-order-order #steps ul li .btn.btn-primary { | |||||
.order-order #main #app-order-order #steps ul li .btn.btn-primary, | |||||
ul.pagination li.active a, ul.pagination li a:hover, ul.pagination li a:focus, ul.pagination li a:active { | |||||
background-color: <?= $mainColor ?>; | background-color: <?= $mainColor ?>; | ||||
} | } | ||||
#header nav#main-nav { | #header nav#main-nav { | ||||
'label' => '<i class="bi bi-arrow-repeat"></i> Abonnements <span class="label label-' . $labelSubscription . '">' . $countSubcriptions . '</span>', | 'label' => '<i class="bi bi-arrow-repeat"></i> Abonnements <span class="label label-' . $labelSubscription . '">' . $countSubcriptions . '</span>', | ||||
'url' => $this->getUrlManagerProducer()->createUrl(['subscription/index']), | 'url' => $this->getUrlManagerProducer()->createUrl(['subscription/index']), | ||||
'visible' => !Yii::$app->user->isGuest && $producer->user_manage_subscription, | 'visible' => !Yii::$app->user->isGuest && $producer->user_manage_subscription, | ||||
'active' => $this->getControllerAction() == 'subscription/index', | |||||
'active' => in_array($this->getControllerAction(), ['subscription/index', 'subscription/form']), | |||||
], | ], | ||||
[ | [ | ||||
'label' => '<i class="bi bi-piggy-bank"></i> Cagnotte' . $credit, | 'label' => '<i class="bi bi-piggy-bank"></i> Cagnotte' . $credit, |
<?php | |||||
use common\helpers\GlobalParam; | |||||
use domain\Producer\Producer\ProducerModule; | |||||
use yii\helpers\Html; | |||||
$producerModule = ProducerModule::getInstance(); | |||||
$producer = GlobalParam::getCurrentProducer(); | |||||
$countBlockInfos = 0; | |||||
if($producer->order_infos && strlen($producer->order_infos)) { | |||||
$countBlockInfos ++; | |||||
} | |||||
if($producer->option_payment_info && strlen($producer->option_payment_info)) { | |||||
$countBlockInfos ++; | |||||
} | |||||
if($producerModule->hasSpecificDelays($producer)) { | |||||
$countBlockInfos ++; | |||||
} | |||||
$classColumn = $countBlockInfos ? 'col-lg-'.(12 / $countBlockInfos) : 'col-lg-12'; | |||||
?> | |||||
<?php if($countBlockInfos): ?> | |||||
<div class="row" id="block-infos"> | |||||
<?php if($producer->order_infos && strlen($producer->order_infos)): ?> | |||||
<div class="<?= $classColumn ?> col-md-12"> | |||||
<div class="card"> | |||||
<div class="card-body"> | |||||
<h5 class="card-title"> | |||||
<i class="bi bi-info-circle"></i> | |||||
Infos | |||||
</h5> | |||||
<div class="card-text"> | |||||
<?= nl2br(Html::encode($producer->order_infos)); ?> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<?php endif; ?> | |||||
<?php if($producer->option_payment_info && strlen($producer->option_payment_info)): ?> | |||||
<div class="<?= $classColumn ?> col-md-12"> | |||||
<div class="card"> | |||||
<div class="card-body"> | |||||
<h5 class="card-title"> | |||||
<i class="bi bi-wallet2"></i> | |||||
Paiement | |||||
</h5> | |||||
<div class="card-text"> | |||||
<?= nl2br(Html::encode($producer->option_payment_info)); ?> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<?php endif; ?> | |||||
<?php | |||||
if ($producerModule->hasSpecificDelays($producer)): ?> | |||||
<div class="<?= $classColumn ?> col-md-12"> | |||||
<div class="card"> | |||||
<div class="card-body"> | |||||
<h5 class="card-title"> | |||||
<i class="bi bi-clock"></i> | |||||
Délais de commande | |||||
</h5> | |||||
<table class="table table-bordered"> | |||||
<?php foreach ($producerModule->getSpecificDelays($producer) as $day => $delay): ?> | |||||
<?php if ($delay['order_delay'] && $delay['order_deadline']): ?> | |||||
<tr> | |||||
<td> | |||||
<?php | |||||
switch ($day) { | |||||
case 'monday': | |||||
echo 'Lundi'; | |||||
break; | |||||
case 'tuesday': | |||||
echo 'Mardi'; | |||||
break; | |||||
case 'wednesday': | |||||
echo 'Mercredi'; | |||||
break; | |||||
case 'thursday': | |||||
echo 'Jeudi'; | |||||
break; | |||||
case 'friday': | |||||
echo 'Vendredi'; | |||||
break; | |||||
case 'saturday': | |||||
echo 'Samedi'; | |||||
break; | |||||
case 'sunday': | |||||
echo 'Dimanche'; | |||||
break; | |||||
} | |||||
?> | |||||
</td> | |||||
<td> | |||||
<span><?= $delay['order_delay'] ?> jour<?= ($delay['order_delay'] > 1) ? 's' : '' ?></span> | |||||
à l'avance, | |||||
avant | |||||
<span><?= ($delay['order_deadline'] == 24) ? 'minuit' : $delay['order_deadline'] . 'h'; ?></span> | |||||
</td> | |||||
</tr> | |||||
<?php endif; ?> | |||||
<?php endforeach; ?> | |||||
</table> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<?php endif; ?> | |||||
</div> | |||||
<?php endif; ?> |
</div> | </div> | ||||
</div> | </div> | ||||
<?php if($producer->option_payment_info && strlen($producer->option_payment_info) > 0): ?> | |||||
<div class="card card-payment-infos"> | |||||
<div class="card-body"> | |||||
<h5 class="card-title"> | |||||
<i class="bi bi-wallet2"></i> | |||||
Paiement de votre commande | |||||
</h5> | |||||
<?= nl2br($producer->option_payment_info); ?> | |||||
</div> | |||||
</div> | |||||
<?php endif; ?> | |||||
<?php if ($producer->order_infos && strlen($producer->order_infos) > 0): ?> | |||||
<div class="card card-infos"> | |||||
<div class="card-body"> | |||||
<h5 class="card-title"> | |||||
<i class="bi bi-info-circle"></i> | |||||
Informations | |||||
</h5> | |||||
<?= nl2br($producer->order_infos); ?> | |||||
</div> | |||||
</div> | |||||
<?php endif; ?> | |||||
<?= $this->render('_block_infos'); ?> | |||||
</div> | </div> |
$producerModule = ProducerModule::getInstance(); | $producerModule = ProducerModule::getInstance(); | ||||
$producer = $this->context->getProducerCurrent(); | $producer = $this->context->getProducerCurrent(); | ||||
$this->setTitle('Mes commandes') ; | $this->setTitle('Mes commandes') ; | ||||
$this->addButton(['label' => '<span class="glyphicon glyphicon-plus"></span> Ajouter', 'url' => 'order/order', 'class' => 'btn btn-primary']) ; | |||||
//$this->addButton(['label' => '<i class="bi bi-pencil-square"></i> Ajouter', 'url' => 'order/order', 'class' => 'btn btn-primary']) ; | |||||
?> | ?> | ||||
<li class="nav-item"> | <li class="nav-item"> | ||||
<a class="nav-link<?php if($type == 'incoming'): ?> active<?php endif; ?>" href="<?= \Yii::$app->urlManagerProducer->createUrl(['order/history', 'type' => 'incoming']); ?>"> | <a class="nav-link<?php if($type == 'incoming'): ?> active<?php endif; ?>" href="<?= \Yii::$app->urlManagerProducer->createUrl(['order/history', 'type' => 'incoming']); ?>"> | ||||
À venir | À venir | ||||
<span class="label <?php if($countIncoming): ?>label-success<?php else: ?>label-default<?php endif; ?>"><?= $countIncoming ?></span> | |||||
<span class="badge <?php if($countIncoming): ?>text-bg-success<?php else: ?>text-bg-secondary<?php endif; ?>"><?= $countIncoming ?></span> | |||||
</a> | </a> | ||||
</li> | </li> | ||||
<li class="nav-item"> | <li class="nav-item"> | ||||
<a class="nav-link<?php if($type == 'passed'): ?> active<?php endif; ?>" href="<?= \Yii::$app->urlManagerProducer->createUrl(['order/history', 'type' => 'passed']); ?>"> | <a class="nav-link<?php if($type == 'passed'): ?> active<?php endif; ?>" href="<?= \Yii::$app->urlManagerProducer->createUrl(['order/history', 'type' => 'passed']); ?>"> | ||||
Passées | Passées | ||||
<span class="label label-default"><?= $countPassed ?></span> | |||||
<span class="badge text-bg-secondary"><?= $countPassed ?></span> | |||||
</a> | </a> | ||||
</li> | </li> | ||||
</ul> | </ul> | ||||
<?= | |||||
GridView::widget([ | |||||
<?php if($dataProviderOrders->getTotalCount()): ?> | |||||
<?= GridView::widget([ | |||||
'dataProvider' => $dataProviderOrders, | 'dataProvider' => $dataProviderOrders, | ||||
'summary' => '', | 'summary' => '', | ||||
'beforeRow' => function($order) use ($orderModule) { | 'beforeRow' => function($order) use ($orderModule) { | ||||
'columns' => [ | 'columns' => [ | ||||
[ | [ | ||||
'attribute' => 'distribution.date', | 'attribute' => 'distribution.date', | ||||
'label' => 'Date de livraison', | |||||
'label' => 'Date de distribution', | |||||
'format' => 'raw', | 'format' => 'raw', | ||||
'value' => function($order) use ($orderModule) { | 'value' => function($order) use ($orderModule) { | ||||
return $orderModule->getDateAsHtml($order) ; | return $orderModule->getDateAsHtml($order) ; | ||||
} | } | ||||
], | ], | ||||
[ | [ | ||||
'label' => 'Résumé', | |||||
'label' => 'Produits', | |||||
'format' => 'raw', | 'format' => 'raw', | ||||
'value' => function($order) use ($orderModule) { | 'value' => function($order) use ($orderModule) { | ||||
return $orderModule->getCartSummary($order); | return $orderModule->getCartSummary($order); | ||||
'label' => 'Montant', | 'label' => 'Montant', | ||||
'format' => 'raw', | 'format' => 'raw', | ||||
'value' => function($order) use ($orderModule) { | 'value' => function($order) use ($orderModule) { | ||||
return $orderModule->getAmountSummary($order); | |||||
return $orderModule->getAmountSummary($order, 'producer'); | |||||
} | } | ||||
], | ], | ||||
[ | [ | ||||
$html = '' ; | $html = '' ; | ||||
if($order->date_delete) { | if($order->date_delete) { | ||||
$html .= '<span class="label label-danger">Annulée</span><br />' ; | |||||
$html .= '<span class="badge text-bg-danger">Annulée</span>' ; | |||||
} | } | ||||
else { | else { | ||||
if($orderModule->getState($order) == Order::STATE_DELIVERED) { | if($orderModule->getState($order) == Order::STATE_DELIVERED) { | ||||
$html .= '<span class="label label-success">Livrée</span>' ; | |||||
$html .= '<span class="badge text-bg-success">Livrée</span>' ; | |||||
} | } | ||||
elseif($orderModule->getState($order) == Order::STATE_PREPARATION) { | elseif($orderModule->getState($order) == Order::STATE_PREPARATION) { | ||||
$html .= '<span class="label label-warning">En préparation</span>' ; | |||||
$html .= '<span class="badge text-bg-warning">En préparation</span>' ; | |||||
} | } | ||||
elseif($orderModule->getState($order) == Order::STATE_OPEN) { | elseif($orderModule->getState($order) == Order::STATE_OPEN) { | ||||
$html .= '<span class="label label-secondary">À venir</span>' ; | |||||
//$html .= '<span class="badge text-bg-secondary">À venir</span>' ; | |||||
$html .= '<span class="badge text-bg-secondary">À venir</span>' ; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
else { | else { | ||||
$html .= '<a href="'.Yii::$app->urlManager->createUrl(['order/order','id'=>$order->id]).'" class="btn btn-secondary"><i class="bi bi-pencil"></i></a> '. | |||||
'<a href="'.Yii::$app->urlManager->createUrl(['order/cancel','id'=>$order->id]).'" class="btn btn-secondary"><i class="bi bi-trash"></i></a> '. | |||||
(($order->id_subscription) ? '<a href="'.Yii::$app->urlManagerProducer->createUrl(['subscription/form','id'=>$order->id_subscription]).'" class="btn btn-secondary"><i class="bi bi-arrow-repeat"></i></a>' : '') ; | |||||
$html .= '<a data-bs-toggle="tooltip" data-bs-placement="top" title="Modifier" href="'.Yii::$app->urlManager->createUrl(['order/order','id'=>$order->id]).'" class="btn btn-secondary"><i class="bi bi-pencil"></i></a> '. | |||||
'<a data-bs-toggle="tooltip" data-bs-placement="top" title="Annuler" href="'.Yii::$app->urlManager->createUrl(['order/cancel','id'=>$order->id]).'" class="btn btn-secondary"><i class="bi bi-trash"></i></a> '. | |||||
(($order->id_subscription) ? '<a data-bs-toggle="tooltip" data-bs-placement="top" title="Modifier l\'abonnement associé" href="'.Yii::$app->urlManagerProducer->createUrl(['subscription/form','id'=>$order->id_subscription]).'" class="btn btn-secondary"><i class="bi bi-arrow-repeat"></i></a>' : '') ; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
] | ] | ||||
] | ] | ||||
]); | |||||
?> | |||||
]); ?> | |||||
<?php else: ?> | |||||
<div class="alert alert-dark">Aucun résultat n'a été trouvé.</div> | |||||
<?php endif; ?> |
use domain\Distribution\PointSaleDistribution\PointSaleDistribution; | use domain\Distribution\PointSaleDistribution\PointSaleDistribution; | ||||
use domain\Producer\Producer\Producer; | use domain\Producer\Producer\Producer; | ||||
use domain\Producer\Producer\ProducerModule; | use domain\Producer\Producer\ProducerModule; | ||||
use yii\helpers\Html; | |||||
\producer\assets\VuejsOrderOrderAsset::register($this); | \producer\assets\VuejsOrderOrderAsset::register($this); | ||||
type="button" | type="button" | ||||
@click="productQuantityClick(product, product.unit == 'piece' ? -1 : -parseFloat(product.step))" | @click="productQuantityClick(product, product.unit == 'piece' ? -1 : -parseFloat(product.step))" | ||||
:disabled="product.quantity_form == 0"> | :disabled="product.quantity_form == 0"> | ||||
<i class="bi bi-dash"></i></button> | |||||
<i class="bi bi-dash-lg"></i></button> | |||||
</span> | </span> | ||||
<input type="text" v-model="product.quantity_form" | <input type="text" v-model="product.quantity_form" | ||||
class="form-control quantity" readonly="readonly"/> | class="form-control quantity" readonly="readonly"/> | ||||
type="button" | type="button" | ||||
@click="productQuantityClick(product, product.unit == 'piece' ? 1 : parseFloat(product.step))" | @click="productQuantityClick(product, product.unit == 'piece' ? 1 : parseFloat(product.step))" | ||||
:disabled="product.quantity_form == product.quantity_remaining && product.quantity_max > 0"> | :disabled="product.quantity_form == product.quantity_remaining && product.quantity_max > 0"> | ||||
<i class="bi bi-plus"></i></button> | |||||
<i class="bi bi-plus-lg"></i></button> | |||||
</span> | </span> | ||||
</div> | </div> | ||||
</template> | </template> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<div id="infos" class="card" v-if="producer != null && producer.order_infos != null && producer.order_infos.length"> | |||||
<div class="card-body"> | |||||
<h5 class="card-title"> | |||||
<i class="bi bi-info-circle"></i> | |||||
Informations | |||||
</h5> | |||||
<div class="card-text" v-html="producer.order_infos"></div> | |||||
</div> | |||||
</div> | |||||
<div v-if="producer != null && producer.online_payment && producer.option_online_payment_type == 'credit'" | |||||
<!--<div v-if="producer != null && producer.online_payment && producer.option_online_payment_type == 'credit'" | |||||
id="credit-online-payment"> | id="credit-online-payment"> | ||||
<div class="panel panel-default"> | <div class="panel panel-default"> | ||||
<div class="panel-heading"> | <div class="panel-heading"> | ||||
en créditant votre compte par carte bancaire. | en créditant votre compte par carte bancaire. | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | |||||
</div>--> | |||||
<?php | |||||
$producer = GlobalParam::getCurrentProducer(); | |||||
if ($producerModule->hasSpecificDelays($producer)): ?> | |||||
<div id="specific-delays" class="card"> | |||||
<div class="card-body"> | |||||
<h5 class="card-title"> | |||||
<i class="bi bi-clock"></i> | |||||
Délais de commande spécifiques | |||||
</h5> | |||||
<table class="table table-bordered"> | |||||
<?php foreach ($producerModule->getSpecificDelays($producer) as $day => $delay): ?> | |||||
<?php if ($delay['order_delay'] && $delay['order_deadline']): ?> | |||||
<tr> | |||||
<td> | |||||
<?php | |||||
switch ($day) { | |||||
case 'monday': | |||||
echo 'Lundi'; | |||||
break; | |||||
case 'tuesday': | |||||
echo 'Mardi'; | |||||
break; | |||||
case 'wednesday': | |||||
echo 'Mercredi'; | |||||
break; | |||||
case 'thursday': | |||||
echo 'Jeudi'; | |||||
break; | |||||
case 'friday': | |||||
echo 'Vendredi'; | |||||
break; | |||||
case 'saturday': | |||||
echo 'Samedi'; | |||||
break; | |||||
case 'sunday': | |||||
echo 'Dimanche'; | |||||
break; | |||||
} | |||||
?> | |||||
</td> | |||||
<td> | |||||
<span><?= $delay['order_delay'] ?> jour<?= ($delay['order_delay'] > 1) ? 's' : '' ?></span> | |||||
à l'avance, | |||||
avant | |||||
<span><?= ($delay['order_deadline'] == 24) ? 'minuit' : $delay['order_deadline'] . 'h'; ?></span> | |||||
</td> | |||||
</tr> | |||||
<?php endif; ?> | |||||
<?php endforeach; ?> | |||||
</table> | |||||
</div> | |||||
</div> | |||||
<?php endif; ?> | |||||
<?= $this->render('_block_infos'); ?> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
<?php | |||||
<?php | |||||
/** | |||||
Copyright distrib (2018) | |||||
contact@opendistrib.net | |||||
Ce logiciel est un programme informatique servant à aider les producteurs | |||||
à distribuer leur production en circuits courts. | |||||
Ce logiciel est régi par la licence CeCILL soumise au droit français et | |||||
respectant les principes de diffusion des logiciels libres. Vous pouvez | |||||
utiliser, modifier et/ou redistribuer ce programme sous les conditions | |||||
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA | |||||
sur le site "http://www.cecill.info". | |||||
En contrepartie de l'accessibilité au code source et des droits de copie, | |||||
de modification et de redistribution accordés par cette licence, il n'est | |||||
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, | |||||
seule une responsabilité restreinte pèse sur l'auteur du programme, le | |||||
titulaire des droits patrimoniaux et les concédants successifs. | |||||
A cet égard l'attention de l'utilisateur est attirée sur les risques | |||||
associés au chargement, à l'utilisation, à la modification et/ou au | |||||
développement et à la reproduction du logiciel par l'utilisateur étant | |||||
donné sa spécificité de logiciel libre, qui peut le rendre complexe à | |||||
manipuler et qui le réserve donc à des développeurs et des professionnels | |||||
avertis possédant des connaissances informatiques approfondies. Les | |||||
utilisateurs sont donc invités à charger et tester l'adéquation du | |||||
logiciel à leurs besoins dans des conditions permettant d'assurer la | |||||
sécurité de leurs systèmes et ou de leurs données et, plus généralement, | |||||
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. | |||||
Le fait que vous puissiez accéder à cet en-tête signifie que vous avez | |||||
pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||||
termes. | |||||
*/ | |||||
/** | |||||
* Copyright distrib (2018) | |||||
* | |||||
* contact@opendistrib.net | |||||
* | |||||
* Ce logiciel est un programme informatique servant à aider les producteurs | |||||
* à distribuer leur production en circuits courts. | |||||
* | |||||
* Ce logiciel est régi par la licence CeCILL soumise au droit français et | |||||
* respectant les principes de diffusion des logiciels libres. Vous pouvez | |||||
* utiliser, modifier et/ou redistribuer ce programme sous les conditions | |||||
* de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA | |||||
* sur le site "http://www.cecill.info". | |||||
* | |||||
* En contrepartie de l'accessibilité au code source et des droits de copie, | |||||
* de modification et de redistribution accordés par cette licence, il n'est | |||||
* offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, | |||||
* seule une responsabilité restreinte pèse sur l'auteur du programme, le | |||||
* titulaire des droits patrimoniaux et les concédants successifs. | |||||
* | |||||
* A cet égard l'attention de l'utilisateur est attirée sur les risques | |||||
* associés au chargement, à l'utilisation, à la modification et/ou au | |||||
* développement et à la reproduction du logiciel par l'utilisateur étant | |||||
* donné sa spécificité de logiciel libre, qui peut le rendre complexe à | |||||
* manipuler et qui le réserve donc à des développeurs et des professionnels | |||||
* avertis possédant des connaissances informatiques approfondies. Les | |||||
* utilisateurs sont donc invités à charger et tester l'adéquation du | |||||
* logiciel à leurs besoins dans des conditions permettant d'assurer la | |||||
* sécurité de leurs systèmes et ou de leurs données et, plus généralement, | |||||
* à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. | |||||
* | |||||
* Le fait que vous puissiez accéder à cet en-tête signifie que vous avez | |||||
* pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||||
* termes. | |||||
*/ | |||||
use domain\Order\Order\OrderModule; | use domain\Order\Order\OrderModule; | ||||
use domain\Producer\Producer\ProducerModule; | use domain\Producer\Producer\ProducerModule; | ||||
$subscriptionModule = SubscriptionModule::getInstance(); | $subscriptionModule = SubscriptionModule::getInstance(); | ||||
$orderModule = OrderModule::getInstance(); | $orderModule = OrderModule::getInstance(); | ||||
\producer\assets\VuejsSubscriptionFormAsset::register($this) ; | |||||
\producer\assets\VuejsSubscriptionFormAsset::register($this); | |||||
?> | ?> | ||||
<div class="subscription-form" id="app-subscription-form" :class="{'loaded': !loading}"> | <div class="subscription-form" id="app-subscription-form" :class="{'loaded': !loading}"> | ||||
<form @submit.prevent="formSubmit()" v-show="loading == false"> | <form @submit.prevent="formSubmit()" v-show="loading == false"> | ||||
<input type="hidden" id="subscription-id" value="<?= $idSubscription; ?>" /> | |||||
<div class="alert alert-danger" v-if="errors.length"> | |||||
<ul> | |||||
<li v-for="error in errors"> | |||||
{{ error }} | |||||
</li> | |||||
</ul> | |||||
</div> | |||||
<div class="points-sale"> | |||||
<h3><span>Point de vente</span></h3> | |||||
<table class="table table-bordered table-hovered" v-if="pointsSale.length"> | |||||
<thead> | |||||
<input type="hidden" id="subscription-id" value="<?= $idSubscription; ?>"/> | |||||
<div class="alert alert-danger" v-if="errors.length"> | |||||
<ul> | |||||
<li v-for="error in errors"> | |||||
{{ error }} | |||||
</li> | |||||
</ul> | |||||
</div> | |||||
<div class="block points-sale"> | |||||
<h3><span>Point de vente</span></h3> | |||||
<table class="table table-striped" v-if="pointsSale.length"> | |||||
<thead> | |||||
<tr> | <tr> | ||||
<th>Nom</th> | <th>Nom</th> | ||||
<th>Localité</th> | <th>Localité</th> | ||||
<th></th> | <th></th> | ||||
</tr> | </tr> | ||||
</thead> | |||||
<tbody> | |||||
<tr v-for="pointSale in pointsSale" v-if="pointSale" :class="(pointSaleActive && pointSale.id == pointSaleActive.id) ? 'selected' : ''"> | |||||
</thead> | |||||
<tbody> | |||||
<tr v-for="pointSale in pointsSale" v-if="pointSale" | |||||
:class="(pointSaleActive && pointSale.id == pointSaleActive.id) ? 'selected' : ''"> | |||||
<td class="name"> | <td class="name"> | ||||
<span class="the-name">{{ pointSale.name }}</span> | <span class="the-name">{{ pointSale.name }}</span> | ||||
<div class="comment" v-if="pointSale.userPointSale"> | <div class="comment" v-if="pointSale.userPointSale"> | ||||
<div :class="'form-group' + (pointSale.invalid_code ? ' has-error' : '')"> | <div :class="'form-group' + (pointSale.invalid_code ? ' has-error' : '')"> | ||||
<div class="input-group" v-if="pointSale.code && pointSale.code.length > 0"> | <div class="input-group" v-if="pointSale.code && pointSale.code.length > 0"> | ||||
<span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span> | <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span> | ||||
<input v-model="pointsSaleCodes[pointSale.id]" type="password" placeholder="Code" class="form-control input-code" /> | |||||
<input v-model="pointsSaleCodes[pointSale.id]" type="password" placeholder="Code" | |||||
class="form-control input-code"/> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
<button class="btn btn-primary" @click.prevent="pointSaleClick" :data-code="pointSale.code && pointSale.code.length > 0" :data-id-point-sale="pointSale.id"> | |||||
<button class="btn btn-primary" @click.prevent="pointSaleClick" | |||||
:data-code="pointSale.code && pointSale.code.length > 0" | |||||
:data-id-point-sale="pointSale.id"> | |||||
<span class="glyphicon glyphicon-map-marker"></span> | <span class="glyphicon glyphicon-map-marker"></span> | ||||
Choisir | |||||
Choisir | |||||
</button> | </button> | ||||
</td> | </td> | ||||
</tr> | </tr> | ||||
</tbody> | |||||
</table> | |||||
</div> | |||||
<h3 id="step-date"><span>Dates</span></h3> | |||||
<div class="row"> | |||||
<div class="col-md-4"> | |||||
<div class="form-group"> | |||||
<label>Date de début</label> | |||||
<v-date-picker | |||||
mode="single" | |||||
v-model="dateBegin" | |||||
:input-props='{class: "form-control", placeholder: "" }'> | |||||
</v-date-picker> | |||||
</tbody> | |||||
</table> | |||||
</div> | |||||
<div class="block dates"> | |||||
<h3 id="step-date"><span>Dates</span></h3> | |||||
<div class="row"> | |||||
<div class="col-md-4"> | |||||
<div class="form-group"> | |||||
<label>Date de début</label> | |||||
<v-date-picker | |||||
mode="single" | |||||
v-model="dateBegin" | |||||
:input-props='{class: "form-control", placeholder: "" }'> | |||||
</v-date-picker> | |||||
</div> | |||||
</div> | |||||
<div class="col-md-4"> | |||||
<div class="form-group"> | |||||
<label>Date de fin</label> | |||||
<v-date-picker | |||||
mode="single" | |||||
v-model="dateEnd" | |||||
:min-date="dateBegin" | |||||
:input-props='{class: "form-control", placeholder: ""}'> | |||||
</v-date-picker> | |||||
<div class="hint-block">Laisser vide pour une durée indéterminée</div> | |||||
</div> | |||||
</div> | |||||
</div> | </div> | ||||
<div class="clr"></div> | |||||
</div> | </div> | ||||
<div class="col-md-4"> | |||||
<div class="form-group"> | |||||
<label>Date de fin</label> | |||||
<v-date-picker | |||||
mode="single" | |||||
v-model="dateEnd" | |||||
:min-date="dateBegin" | |||||
:input-props='{class: "form-control", placeholder: ""}'> | |||||
</v-date-picker> | |||||
<div class="hint-block">Laisser vide pour une durée indéterminée</div> | |||||
<div class="row block week-frequency"> | |||||
<div class="col-md-4"> | |||||
<label for="subscriptionform-week_frequency"> | |||||
<h3>Périodicité</h3> | |||||
</label> | |||||
<select id="subscriptionform-week_frequency" class="form-control" v-model="weekFrequency"> | |||||
<option value="1">Toutes les semaines</option> | |||||
<option value="2">Toutes les 2 semaines</option> | |||||
<option value="3">Toutes les 3 semaines</option> | |||||
<option value="4">Tous les mois</option> | |||||
</select> | |||||
</div> | </div> | ||||
<div class="clr"></div> | |||||
</div> | </div> | ||||
</div> | |||||
<div class="clr"></div> | |||||
<div class="col-md-4"> | |||||
<label for="subscriptionform-week_frequency">Périodicité</label> | |||||
<select id="subscriptionform-week_frequency" class="form-control" v-model="weekFrequency"> | |||||
<option value="1">Toutes les semaines</option> | |||||
<option value="2">Toutes les 2 semaines</option> | |||||
<option value="3">Toutes les 3 semaines</option> | |||||
<option value="4">Tous les mois</option> | |||||
</select> | |||||
</div> | |||||
<div class="clr"></div> | |||||
<!--<h3><span>Paiement</span></h3> | |||||
<?php if($producerModule->getConfig('credit')): ?> | |||||
<!--<h3><span>Paiement</span></h3> | |||||
<?php if ($producerModule->getConfig('credit')): ?> | |||||
<div class="form-group field-subscriptionform-auto_payment"> | <div class="form-group field-subscriptionform-auto_payment"> | ||||
<label><input type="checkbox" id="subscriptionform-auto_payment" name="SubscriptionForm[auto_payment]" v-model="autoPayment"> Paiement automatique</label> | <label><input type="checkbox" id="subscriptionform-auto_payment" name="SubscriptionForm[auto_payment]" v-model="autoPayment"> Paiement automatique</label> | ||||
<div class="hint-block">Cochez cette case si vous souhaitez que votre Crédit soit automatiquement débité.</div> | <div class="hint-block">Cochez cette case si vous souhaitez que votre Crédit soit automatiquement débité.</div> | ||||
<div class="help-block"></div> | <div class="help-block"></div> | ||||
</div> | </div> | ||||
<?php endif; ?>--> | <?php endif; ?>--> | ||||
<div class="days" v-if="pointSaleActive"> | |||||
<h3 id="step-days"><span>Jours</span></h3> | |||||
<div v-if="pointSaleActive.delivery_monday == true"> | |||||
<div class="form-group field-subscriptionform-monday"> | |||||
<label><input type="checkbox" id="subscriptionform-monday" v-model="monday" @change="dayChange"> Lundi</label> | |||||
<div class="block days" v-if="pointSaleActive"> | |||||
<h3 id="step-days"><span>Jours</span></h3> | |||||
<div v-if="pointSaleActive.delivery_monday == true"> | |||||
<div class="form-group field-subscriptionform-monday"> | |||||
<label><input type="checkbox" id="subscriptionform-monday" v-model="monday" @change="dayChange"> | |||||
Lundi</label> | |||||
</div> | |||||
</div> | </div> | ||||
</div> | |||||
<div v-if="pointSaleActive.delivery_tuesday == true"> | |||||
<div class="form-group field-subscriptionform-monday"> | |||||
<label><input type="checkbox" id="subscriptionform-tuesday" v-model="tuesday" @change="dayChange"> Mardi</label> | |||||
<div v-if="pointSaleActive.delivery_tuesday == true"> | |||||
<div class="form-group field-subscriptionform-monday"> | |||||
<label><input type="checkbox" id="subscriptionform-tuesday" v-model="tuesday" @change="dayChange"> | |||||
Mardi</label> | |||||
</div> | |||||
</div> | </div> | ||||
</div> | |||||
<div v-if="pointSaleActive.delivery_wednesday == true"> | |||||
<div class="form-group field-subscriptionform-wednesday"> | |||||
<label><input type="checkbox" id="subscriptionform-wednesday" v-model="wednesday" @change="dayChange"> Mercredi</label> | |||||
<div v-if="pointSaleActive.delivery_wednesday == true"> | |||||
<div class="form-group field-subscriptionform-wednesday"> | |||||
<label><input type="checkbox" id="subscriptionform-wednesday" v-model="wednesday" | |||||
@change="dayChange"> Mercredi</label> | |||||
</div> | |||||
</div> | </div> | ||||
</div> | |||||
<div v-if="pointSaleActive.delivery_thursday == true"> | |||||
<div class="form-group field-subscriptionform-thursday"> | |||||
<label><input type="checkbox" id="subscriptionform-thursday" v-model="thursday" @change="dayChange"> Jeudi</label> | |||||
<div v-if="pointSaleActive.delivery_thursday == true"> | |||||
<div class="form-group field-subscriptionform-thursday"> | |||||
<label><input type="checkbox" id="subscriptionform-thursday" v-model="thursday" @change="dayChange"> | |||||
Jeudi</label> | |||||
</div> | |||||
</div> | </div> | ||||
</div> | |||||
<div v-if="pointSaleActive.delivery_friday == true"> | |||||
<div class="form-group field-subscriptionform-friday"> | |||||
<label><input type="checkbox" id="subscriptionform-friday" v-model="friday" @change="dayChange"> Vendredi</label> | |||||
<div v-if="pointSaleActive.delivery_friday == true"> | |||||
<div class="form-group field-subscriptionform-friday"> | |||||
<label><input type="checkbox" id="subscriptionform-friday" v-model="friday" @change="dayChange"> | |||||
Vendredi</label> | |||||
</div> | |||||
</div> | </div> | ||||
</div> | |||||
<div v-if="pointSaleActive.delivery_saturday == true"> | |||||
<div class="form-group field-subscriptionform-saturday"> | |||||
<label><input type="checkbox" id="subscriptionform-saturday" v-model="saturday" @change="dayChange"> Samedi</label> | |||||
<div v-if="pointSaleActive.delivery_saturday == true"> | |||||
<div class="form-group field-subscriptionform-saturday"> | |||||
<label><input type="checkbox" id="subscriptionform-saturday" v-model="saturday" @change="dayChange"> | |||||
Samedi</label> | |||||
</div> | |||||
</div> | </div> | ||||
</div> | |||||
<div v-if="pointSaleActive.delivery_sunday == true"> | |||||
<div class="form-group field-subscriptionform-sunday"> | |||||
<label><input type="checkbox" id="subscriptionform-sunday" v-model="sunday" @change="dayChange"> Dimanche</label> | |||||
<div v-if="pointSaleActive.delivery_sunday == true"> | |||||
<div class="form-group field-subscriptionform-sunday"> | |||||
<label><input type="checkbox" id="subscriptionform-sunday" v-model="sunday" @change="dayChange"> | |||||
Dimanche</label> | |||||
</div> | |||||
</div> | </div> | ||||
</div> | |||||
<div class="alert alert-warning" v-if="!pointSaleActive.delivery_monday && !pointSaleActive.delivery_tuesday && !pointSaleActive.delivery_wednesday && !pointSaleActive.delivery_thursday && !pointSaleActive.delivery_friday && !pointSaleActive.delivery_saturday && !pointSaleActive.delivery_sunday"> | |||||
Aucun jour de distribution disponible pour ce point de vente. | |||||
<div class="alert alert-warning" | |||||
v-if="!pointSaleActive.delivery_monday && !pointSaleActive.delivery_tuesday && !pointSaleActive.delivery_wednesday && !pointSaleActive.delivery_thursday && !pointSaleActive.delivery_friday && !pointSaleActive.delivery_saturday && !pointSaleActive.delivery_sunday"> | |||||
Aucun jour de distribution disponible pour ce point de vente. | |||||
</div> | |||||
<div class="clr"></div> | |||||
</div> | </div> | ||||
</div> | |||||
<div class="clr"></div> | |||||
<div class="products" v-if="(monday || tuesday || wednesday || thursday || friday || saturday || sunday) && checkOneProductAvailable()"> | |||||
<h3><span>Produits</span></h3> | |||||
<?php if(isset($model->errors['products']) && count($model->errors['products'])) | |||||
{ | |||||
echo '<div class="alert alert-danger">'.$model->errors['products'][0].'</div>' ; | |||||
} | |||||
?> | |||||
<table :class="'table table-bordered table-condensed table-hover' + (monday ? ' monday-active' : '') + (tuesday ? ' tuesday-active' : '') + (wednesday ? ' wednesday-active' : '') + (thursday ? ' thursday-active' : '') + (friday ? ' friday-active' : '') + (saturday ? ' saturday-active' : '') + (sunday ? ' sunday-active' : '')"> | |||||
<thead> | |||||
<div class="block products" | |||||
v-if="(monday || tuesday || wednesday || thursday || friday || saturday || sunday) && checkOneProductAvailable()"> | |||||
<h3><span>Produits</span></h3> | |||||
<?php if (isset($model->errors['products']) && count($model->errors['products'])) { | |||||
echo '<div class="alert alert-danger">' . $model->errors['products'][0] . '</div>'; | |||||
} | |||||
?> | |||||
<table :class="'table table-bordered table-condensed table-hover' + (monday ? ' monday-active' : '') + (tuesday ? ' tuesday-active' : '') + (wednesday ? ' wednesday-active' : '') + (thursday ? ' thursday-active' : '') + (friday ? ' friday-active' : '') + (saturday ? ' saturday-active' : '') + (sunday ? ' sunday-active' : '')"> | |||||
<thead> | |||||
<tr> | <tr> | ||||
<th>Nom</th> | <th>Nom</th> | ||||
<th>Prix unitaire</th> | <th>Prix unitaire</th> | ||||
<th>Quantité</th> | <th>Quantité</th> | ||||
<th>Total</th> | <th>Total</th> | ||||
</tr> | </tr> | ||||
</thead> | |||||
<tbody> | |||||
</thead> | |||||
<tbody> | |||||
<tr v-for="product in products" v-if="checkProductAvailable(product)"> | <tr v-for="product in products" v-if="checkProductAvailable(product)"> | ||||
<td> | <td> | ||||
<span class="name">{{ product.name }}</span> | |||||
<span class="name">{{ product.name }}</span> | |||||
<span class="other"> | <span class="other"> | ||||
<span v-if="product.description.length">/</span> | <span v-if="product.description.length">/</span> | ||||
<span class="description">{{ product.description }}</span> | <span class="description">{{ product.description }}</span> | ||||
<div class="recipe" v-if="product.recipe.length">{{ product.recipe }}</div> | <div class="recipe" v-if="product.recipe.length">{{ product.recipe }}</div> | ||||
</td> | </td> | ||||
<td class="price-unit"> | <td class="price-unit"> | ||||
{{ formatPrice(product.price_with_tax) }}<br /><span class="unit">{{ product.wording_unit }}</span> | |||||
{{ formatPrice(product.price_with_tax) }}<br/><span | |||||
class="unit">{{ product.wording_unit }}</span> | |||||
</td> | </td> | ||||
<td class="quantity"> | <td class="quantity"> | ||||
<div class="input-group"> | <div class="input-group"> | ||||
<input type="hidden" :value="product.step" :name="'product_step_'+product.step" /> | |||||
<input type="hidden" :value="product.unit" :name="'product_unit_'+product.unit" /> | |||||
<input type="hidden" :value="product.step" :name="'product_step_'+product.step"/> | |||||
<input type="hidden" :value="product.unit" :name="'product_unit_'+product.unit"/> | |||||
<span class="input-group-btn"> | <span class="input-group-btn"> | ||||
<button class="btn btn-default" type="button" @click="productQuantityClick(product, -product.step)"><span class="glyphicon glyphicon-minus"></span></button> | |||||
<button class="btn btn-secondary" type="button" | |||||
@click="productQuantityClick(product, -product.step)"><span | |||||
class="bi bi-dash-lg"></span></button> | |||||
</span> | </span> | ||||
<input type="text" v-model="product.quantity_form" :class="'form-control '+((product.quantity_form > 0) ? 'has-quantity' : '')"> | |||||
<span class="input-group-addon">{{ product.wording_short }}</span> | |||||
<input type="text" v-model="product.quantity_form" | |||||
:class="'form-control '+((product.quantity_form > 0) ? 'has-quantity' : '')"> | |||||
<span class="input-group-text">{{ product.wording_short }}</span> | |||||
<span class="input-group-btn"> | <span class="input-group-btn"> | ||||
<button class="btn btn-default" type="button" @click="productQuantityClick(product, product.step)"><span class="glyphicon glyphicon-plus"></span></button> | |||||
<button class="btn btn-secondary" type="button" | |||||
@click="productQuantityClick(product, product.step)"><span | |||||
class="bi bi-plus-lg"></span></button> | |||||
</span> | </span> | ||||
</div> | </div> | ||||
</td> | </td> | ||||
<td colspan="3"></td> | <td colspan="3"></td> | ||||
<td class="price-total">{{ priceTotal(true) }}</td> | <td class="price-total">{{ priceTotal(true) }}</td> | ||||
</tr> | </tr> | ||||
</tbody> | |||||
</table> | |||||
<div v-if="!checkOneProductAvailable()" class="alert alert-warning"> | |||||
Aucun produit n'est disponible pour les jours de distribution sélectionnés. | |||||
</tbody> | |||||
</table> | |||||
<div v-if="!checkOneProductAvailable()" class="alert alert-warning"> | |||||
Aucun produit n'est disponible pour les jours de distribution sélectionnés. | |||||
</div> | |||||
</div> | </div> | ||||
</div> | |||||
<div class="clr"></div> | |||||
<div> | |||||
<h3><span>Commentaire</span></h3> | |||||
<div class="form-group"> | |||||
<textarea id="subscriptionform-comment" class="form-control comment-textarea" v-model="comment"></textarea> | |||||
</div> | |||||
</div> | |||||
<div class="clr"></div> | |||||
<div class="block comments"> | |||||
<h3><span>Commentaire</span></h3> | |||||
<div class="form-group"> | |||||
<textarea id="subscriptionform-comment" class="form-control comment-textarea" | |||||
v-model="comment"></textarea> | |||||
</div> | |||||
</div> | |||||
<?php if($idSubscription): ?> | |||||
<?php | |||||
<?php if ($idSubscription): ?> | |||||
<?php | |||||
$subscription = $subscriptionModule->findOneSubscriptionById($idSubscription); | $subscription = $subscriptionModule->findOneSubscriptionById($idSubscription); | ||||
$ordersIncomingSubscriptionArray = $subscription ? $orderModule->findOrdersIncomingBySubscription($subscription) : null; | $ordersIncomingSubscriptionArray = $subscription ? $orderModule->findOrdersIncomingBySubscription($subscription) : null; | ||||
?> | |||||
<?php if($subscription && $ordersIncomingSubscriptionArray): ?> | |||||
<div class="alert alert-warning"> | |||||
<span class="glyphicon glyphicon-alert"></span> | |||||
Attention, en modifiant votre abonnement, vos <?= count($ordersIncomingSubscriptionArray) ?> commande(s) à venir vont être re-générées. | |||||
</div> | |||||
?> | |||||
<?php if ($subscription && $ordersIncomingSubscriptionArray): ?> | |||||
<div class="alert alert-warning"> | |||||
<span class="glyphicon glyphicon-alert"></span> | |||||
Attention, en modifiant votre abonnement, vos <?= count($ordersIncomingSubscriptionArray) ?> | |||||
commande(s) à venir vont être re-générées. | |||||
</div> | |||||
<?php endif; ?> | |||||
<?php endif; ?> | <?php endif; ?> | ||||
<?php endif; ?> | |||||
<button class="btn btn-primary" disabled="disabled" v-if="disableSubmitButton">Enregistrer</button> | |||||
<button class="btn btn-primary" v-else>Enregistrer</button> | |||||
</form> | |||||
<div class="form-buttons"> | |||||
<button class="btn btn-primary" disabled="disabled" v-if="disableSubmitButton">Enregistrer</button> | |||||
<button class="btn btn-primary" v-else>Enregistrer</button> | |||||
</div> | |||||
</form> | |||||
</div> | </div> |
$this->setTitle('Modifier un abonnement') ; | $this->setTitle('Modifier un abonnement') ; | ||||
} | } | ||||
else { | else { | ||||
$this->setTitle('Ajouter un abonnement') ; | |||||
$this->setTitle('Créer un abonnement') ; | |||||
} | } | ||||
?> | ?> | ||||
<?php | <?php | ||||
/** | |||||
Copyright distrib (2018) | |||||
contact@opendistrib.net | |||||
Ce logiciel est un programme informatique servant à aider les producteurs | |||||
à distribuer leur production en circuits courts. | |||||
Ce logiciel est régi par la licence CeCILL soumise au droit français et | |||||
respectant les principes de diffusion des logiciels libres. Vous pouvez | |||||
utiliser, modifier et/ou redistribuer ce programme sous les conditions | |||||
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA | |||||
sur le site "http://www.cecill.info". | |||||
En contrepartie de l'accessibilité au code source et des droits de copie, | |||||
de modification et de redistribution accordés par cette licence, il n'est | |||||
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, | |||||
seule une responsabilité restreinte pèse sur l'auteur du programme, le | |||||
titulaire des droits patrimoniaux et les concédants successifs. | |||||
A cet égard l'attention de l'utilisateur est attirée sur les risques | |||||
associés au chargement, à l'utilisation, à la modification et/ou au | |||||
développement et à la reproduction du logiciel par l'utilisateur étant | |||||
donné sa spécificité de logiciel libre, qui peut le rendre complexe à | |||||
manipuler et qui le réserve donc à des développeurs et des professionnels | |||||
avertis possédant des connaissances informatiques approfondies. Les | |||||
utilisateurs sont donc invités à charger et tester l'adéquation du | |||||
logiciel à leurs besoins dans des conditions permettant d'assurer la | |||||
sécurité de leurs systèmes et ou de leurs données et, plus généralement, | |||||
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. | |||||
Le fait que vous puissiez accéder à cet en-tête signifie que vous avez | |||||
pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||||
termes. | |||||
*/ | |||||
/** | |||||
* Copyright distrib (2018) | |||||
* | |||||
* contact@opendistrib.net | |||||
* | |||||
* Ce logiciel est un programme informatique servant à aider les producteurs | |||||
* à distribuer leur production en circuits courts. | |||||
* | |||||
* Ce logiciel est régi par la licence CeCILL soumise au droit français et | |||||
* respectant les principes de diffusion des logiciels libres. Vous pouvez | |||||
* utiliser, modifier et/ou redistribuer ce programme sous les conditions | |||||
* de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA | |||||
* sur le site "http://www.cecill.info". | |||||
* | |||||
* En contrepartie de l'accessibilité au code source et des droits de copie, | |||||
* de modification et de redistribution accordés par cette licence, il n'est | |||||
* offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, | |||||
* seule une responsabilité restreinte pèse sur l'auteur du programme, le | |||||
* titulaire des droits patrimoniaux et les concédants successifs. | |||||
* | |||||
* A cet égard l'attention de l'utilisateur est attirée sur les risques | |||||
* associés au chargement, à l'utilisation, à la modification et/ou au | |||||
* développement et à la reproduction du logiciel par l'utilisateur étant | |||||
* donné sa spécificité de logiciel libre, qui peut le rendre complexe à | |||||
* manipuler et qui le réserve donc à des développeurs et des professionnels | |||||
* avertis possédant des connaissances informatiques approfondies. Les | |||||
* utilisateurs sont donc invités à charger et tester l'adéquation du | |||||
* logiciel à leurs besoins dans des conditions permettant d'assurer la | |||||
* sécurité de leurs systèmes et ou de leurs données et, plus généralement, | |||||
* à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. | |||||
* | |||||
* Le fait que vous puissiez accéder à cet en-tête signifie que vous avez | |||||
* pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||||
* termes. | |||||
*/ | |||||
use common\helpers\GlobalParam; | use common\helpers\GlobalParam; | ||||
use domain\PointSale\PointSale\PointSale; | use domain\PointSale\PointSale\PointSale; | ||||
$productModule = ProductModule::getInstance(); | $productModule = ProductModule::getInstance(); | ||||
$subscriptionModule = SubscriptionModule::getInstance(); | $subscriptionModule = SubscriptionModule::getInstance(); | ||||
$this->setTitle('Abonnements') ; | |||||
$this->addButton(['label' => '<span class="glyphicon glyphicon-plus"></span> Ajouter', 'url' => 'subscription/form', 'class' => 'btn btn-primary']) ; | |||||
$this->setTitle('Abonnements'); | |||||
$this->addButton(['label' => '<i class="bi bi-plus-lg"></i> Créer', 'url' => 'subscription/form', 'class' => 'btn btn-primary']); | |||||
$columns = [ | $columns = [ | ||||
[ | |||||
'attribute' => 'product_name', | |||||
'label' => 'Produits', | |||||
'format' => 'raw', | |||||
'value' => function($subscription) use ($subscriptionModule) { | |||||
return $subscriptionModule->getProductsListAsHtml($subscription); | |||||
} | |||||
], | |||||
[ | [ | ||||
'label' => 'Point de vente', | 'label' => 'Point de vente', | ||||
'format' => 'raw', | 'format' => 'raw', | ||||
'filter' => ArrayHelper::map(PointSale::find()->where(['id_producer' => GlobalParam::getCurrentProducerId()])->asArray()->all(), 'id', 'name'), | 'filter' => ArrayHelper::map(PointSale::find()->where(['id_producer' => GlobalParam::getCurrentProducerId()])->asArray()->all(), 'id', 'name'), | ||||
'value' => function($model) { | |||||
if($model->pointSale) { | |||||
return Html::encode($model->pointSale->name) ; | |||||
'value' => function ($model) { | |||||
if ($model->pointSale) { | |||||
return Html::encode($model->pointSale->name); | |||||
} | } | ||||
return ''; | return ''; | ||||
} | } | ||||
], | ], | ||||
[ | [ | ||||
'attribute' => 'week_frequency', | |||||
'filter' => [ | |||||
1 => 'Toutes les semaines', | |||||
2 => 'Toutes les 2 semaines', | |||||
3 => 'Toutes les 3 semaines', | |||||
4 => 'Tous les mois'], | |||||
'value' => function($model) { | |||||
if($model->week_frequency == 1) { | |||||
return 'Toutes les semaines' ; | |||||
} | |||||
else { | |||||
return 'Toutes les '.$model->week_frequency.' semaines' ; | |||||
} | |||||
'attribute' => 'product_name', | |||||
'label' => 'Produits', | |||||
'format' => 'raw', | |||||
'value' => function ($subscription) use ($subscriptionModule) { | |||||
return $subscriptionModule->getProductsListAsHtml($subscription); | |||||
} | } | ||||
], | ], | ||||
[ | [ | ||||
'sunday' => 'Dimanche', | 'sunday' => 'Dimanche', | ||||
], | ], | ||||
'contentOptions' => ['class' => 'text-small'], | 'contentOptions' => ['class' => 'text-small'], | ||||
'value' => function($model) { | |||||
$html = '' ; | |||||
if($model->monday) { | |||||
$html .= 'lundi, ' ; | |||||
'value' => function ($model) { | |||||
$html = ''; | |||||
if ($model->monday) { | |||||
$html .= 'lundi, '; | |||||
} | } | ||||
if($model->tuesday) { | |||||
$html .= 'mardi, ' ; | |||||
if ($model->tuesday) { | |||||
$html .= 'mardi, '; | |||||
} | } | ||||
if($model->wednesday) { | |||||
$html .= 'mercredi, ' ; | |||||
if ($model->wednesday) { | |||||
$html .= 'mercredi, '; | |||||
} | } | ||||
if($model->thursday) { | |||||
$html .= 'jeudi, ' ; | |||||
if ($model->thursday) { | |||||
$html .= 'jeudi, '; | |||||
} | } | ||||
if($model->friday) { | |||||
$html .= 'vendredi, ' ; | |||||
if ($model->friday) { | |||||
$html .= 'vendredi, '; | |||||
} | } | ||||
if($model->saturday) { | |||||
$html .= 'samedi, ' ; | |||||
if ($model->saturday) { | |||||
$html .= 'samedi, '; | |||||
} | } | ||||
if($model->sunday) { | |||||
$html .= 'dimanche, ' ; | |||||
if ($model->sunday) { | |||||
$html .= 'dimanche, '; | |||||
} | } | ||||
if(strlen($html)) { | |||||
return substr ($html, 0, strlen($html) - 2) ; | |||||
if (strlen($html)) { | |||||
return substr($html, 0, strlen($html) - 2); | |||||
} else { | |||||
return '<i class="bi bi-exclamation-triangle"></i> Aucun jour'; | |||||
} | } | ||||
else { | |||||
return '<span class="glyphicon glyphicon-warning-sign"></span> Aucun jour' ; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'week_frequency', | |||||
'filter' => [ | |||||
1 => 'Toutes les semaines', | |||||
2 => 'Toutes les 2 semaines', | |||||
3 => 'Toutes les 3 semaines', | |||||
4 => 'Tous les mois'], | |||||
'value' => function ($model) { | |||||
if ($model->week_frequency == 1) { | |||||
return 'Toutes les semaines'; | |||||
} else { | |||||
return 'Toutes les ' . $model->week_frequency . ' semaines'; | |||||
} | } | ||||
} | } | ||||
], | ], | ||||
[ | [ | ||||
'attribute' => 'date_begin', | 'attribute' => 'date_begin', | ||||
'label' => 'Date de début', | 'label' => 'Date de début', | ||||
'format' => 'raw', | 'format' => 'raw', | ||||
'value' => function($model) { | |||||
$html = date('d/m/Y',strtotime($model->date_begin)) ; | |||||
return $html ; | |||||
'value' => function ($model) { | |||||
$html = date('d/m/Y', strtotime($model->date_begin)); | |||||
return $html; | |||||
} | } | ||||
], | ], | ||||
] ; | |||||
]; | |||||
/*if($producerModule->getConfig('credit')) { | /*if($producerModule->getConfig('credit')) { | ||||
$columns[] = [ | $columns[] = [ | ||||
'format' => 'raw', | 'format' => 'raw', | ||||
} | } | ||||
] ; | ] ; | ||||
}*/ | }*/ | ||||
$columns[] = [ | $columns[] = [ | ||||
'class' => 'yii\grid\ActionColumn', | 'class' => 'yii\grid\ActionColumn', | ||||
'template' => '{form} {delete}', | 'template' => '{form} {delete}', | ||||
'contentOptions' => ['class' => 'column-actions'], | 'contentOptions' => ['class' => 'column-actions'], | ||||
'buttons' => [ | 'buttons' => [ | ||||
'form' => function ($url, $model) { | 'form' => function ($url, $model) { | ||||
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [ | |||||
'title' => 'Modifier', 'class' => 'btn btn-default' | |||||
return Html::a('<i class="bi bi-pencil"></i>', $url, [ | |||||
'title' => 'Modifier', | |||||
'class' => 'btn btn-secondary', | |||||
'data-bs-toggle' => 'tooltip', | |||||
'data-bs-placement' => 'top', | |||||
'title' => 'Modifier' | |||||
]); | ]); | ||||
}, | }, | ||||
'delete' => function ($url, $model) { | 'delete' => function ($url, $model) { | ||||
return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [ | |||||
'title' => 'Supprimer', 'class' => 'btn btn-default' | |||||
return Html::a('<i class="bi bi-trash"></i>', $url, [ | |||||
'title' => 'Supprimer', | |||||
'class' => 'btn btn-secondary', | |||||
'data-bs-toggle' => 'tooltip', | |||||
'data-bs-placement' => 'top', | |||||
'title' => 'Supprimer' | |||||
]); | ]); | ||||
} | } | ||||
], | ], | ||||
] ; | |||||
]; | |||||
?> | ?> | ||||
<div class="subscription-index"> | <div class="subscription-index"> | ||||
<?php if($dataProvider->getCount()): ?> | |||||
<?php if ($dataProvider->getCount()): ?> | |||||
<?= GridView::widget([ | <?= GridView::widget([ | ||||
'dataProvider' => $dataProvider, | 'dataProvider' => $dataProvider, | ||||
'columns' => $columns, | 'columns' => $columns, | ||||
'summary' => '' | |||||
]); ?> | ]); ?> | ||||
<?php else: ?> | <?php else: ?> | ||||
<div class="alert alert-info"> | |||||
Vous n'avez encore aucun abonnement chez ce producteur. | |||||
<div class="alert alert-dark"> | |||||
Vous n'avez aucun abonnement chez ce producteur. | |||||
</div> | </div> | ||||
<?php endif; ?> | <?php endif; ?> | ||||
</div> | </div> |
position: relative ; | position: relative ; | ||||
} | } | ||||
#main .alert { | |||||
background-image: none; | |||||
background-color: white ; | |||||
border-bottom-width: 3px ; | |||||
} | |||||
ul.pagination { | |||||
text-align: center; | |||||
display: block; | |||||
margin-top: 50px; | |||||
li { | |||||
display: inline-block; | |||||
margin-left: 4px; | |||||
margin-right: 4px; | |||||
.alert { | |||||
&.alert-warning { | |||||
a { | a { | ||||
color: #8a6d3b ; | |||||
text-decoration: underline ; | |||||
font-family: 'worksans_semibold'; | |||||
font-size: 1.5em; | |||||
display: inline-block; | |||||
padding: 3px 15px; | |||||
text-decoration: none; | |||||
@include border-radius(15px); | |||||
background-color: $color-gray-dark; | |||||
color: white !important; | |||||
} | } | ||||
} | |||||
&.alert-danger { | |||||
a { | |||||
color: #a94442 ; | |||||
text-decoration: underline ; | |||||
&.active a, | |||||
a:hover, | |||||
a:focus, | |||||
a:active { | |||||
background-color: $color-primary; | |||||
color: white !important; | |||||
} | } | ||||
} | |||||
} | |||||
ul.pagination { | |||||
li { | |||||
&.active { | |||||
a { | |||||
background-color: $color-primary ; | |||||
border: solid 1px $color-primary ; | |||||
&:hover { | |||||
background-color: white ; | |||||
border: solid 1px white ; | |||||
color: $color-primary ; | |||||
} | |||||
} | |||||
&.disabled { | |||||
display: none; | |||||
} | } | ||||
a { | |||||
color: $color-primary ; | |||||
&:hover, &:focus, &:active { | |||||
background-color: white ; | |||||
border: solid 1px white ; | |||||
color: $color-primary ; | |||||
&.prev, &.next { | |||||
a { | |||||
border: solid 1px $color-gray-dark; | |||||
color: $color-gray-dark !important; | |||||
background-color: white !important; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
h1, h2, h3, h4, h5, h6 { | h1, h2, h3, h4, h5, h6 { | ||||
font-family: 'worksans_bold' ; | font-family: 'worksans_bold' ; | ||||
margin-bottom: 20px ; | margin-bottom: 20px ; | ||||
color: black; | |||||
&.first { | &.first { | ||||
margin-top: 0px ; | margin-top: 0px ; |
margin-bottom: 20px ; | margin-bottom: 20px ; | ||||
li { | li { | ||||
a { | |||||
color: $color-primary ; | |||||
} | |||||
&.active a { | |||||
color: #333 ; | |||||
a, &.active a { | |||||
color: black; | |||||
} | } | ||||
} | } | ||||
} | } |
.order-order, .order-confirm { | |||||
#block-infos { | |||||
margin-top: 50px; | |||||
} | |||||
} | |||||
.order-order #main { | .order-order #main { | ||||
#app-order-order { | #app-order-order { | ||||
display: block ; | display: block ; | ||||
.input-group-text { | .input-group-text { | ||||
border: 0px none; | border: 0px none; | ||||
padding-right: 10px ; | padding-right: 10px ; | ||||
padding-left: 0px; | |||||
margin: 0px ; | margin: 0px ; | ||||
} | } | ||||
.input-group-btn { | .input-group-btn { | ||||
button { | button { | ||||
padding: 5px; | |||||
padding: 4px 5px 0px 5px; | |||||
.bi { | .bi { | ||||
font-size: 1.7em; | |||||
font-size: 1.5em; | |||||
font-weight: bold; | font-weight: bold; | ||||
margin: 0px; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
#specific-delays { | |||||
margin-top: 30px; | |||||
} | |||||
#infos { | |||||
margin-top: 30px ; | |||||
} | |||||
} | } | ||||
} | } | ||||
&.loaded { | &.loaded { | ||||
display: block ; | display: block ; | ||||
} | } | ||||
.block { | |||||
margin-bottom: 40px; | |||||
h3 { | |||||
margin-bottom: 20px; | |||||
} | |||||
} | |||||
.points-sale { | .points-sale { | ||||
.locality { | .locality { | ||||
color: gray ; | color: gray ; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
.dates { | |||||
label { | |||||
display: block; | |||||
} | |||||
} | |||||
.comment-textarea { | .comment-textarea { | ||||
width: 100% ; | width: 100% ; | ||||
input { | input { | ||||
text-align: center ; | text-align: center ; | ||||
border-right: 0px none ; | |||||
border: 0px none !important; | |||||
&.has-quantity { | &.has-quantity { | ||||
font-weight: bold ; | |||||
font-weight: bold; | |||||
} | } | ||||
} | } | ||||
.input-group-text { | .input-group-text { | ||||
background-color: white ; | |||||
padding-left: 0px ; | |||||
border-left: 0px none ; | |||||
background-color: white; | |||||
padding-left: 0px; | |||||
border: 0px none; | |||||
} | } | ||||
} | } | ||||