Browse Source

Merge branch 'dev'

master
Guillaume 3 years ago
parent
commit
854f0c28f0
8 changed files with 72 additions and 32 deletions
  1. +10
    -0
      common/models/Producer.php
  2. +1
    -1
      console/migrations/m210920_060127_add_field_order_online_payment_url.php
  3. +7
    -4
      producer/controllers/OrderController.php
  4. +19
    -16
      producer/views/order/confirm.php
  5. +13
    -6
      producer/views/order/history.php
  6. +1
    -1
      producer/views/order/order.php
  7. +13
    -4
      producer/web/css/screen.css
  8. +8
    -0
      producer/web/sass/order/_confirm.scss

+ 10
- 0
common/models/Producer.php View File

return false; return false;
} }


public function isOnlinePaymentActive()
{
return $this->online_payment || ($this->option_stripe_mode_test && Yii::$app->user->identity->status > 10);
}

public function isOnlinePaymentActiveAndTypeOrder()
{
return $this->isOnlinePaymentActive() && $this->option_online_payment_type == 'order' ;
}

} }

+ 1
- 1
console/migrations/m210920_060127_add_field_order_online_payment_url.php View File

{ {
public function safeUp() public function safeUp()
{ {
$this->addColumn('order', 'online_payment_url', Schema::TYPE_STRING);
$this->addColumn('order', 'online_payment_url', Schema::TYPE_TEXT);
} }


public function safeDown() public function safeDown()

+ 7
- 4
producer/controllers/OrderController.php View File

]) ])
->one(); ->one();


if ($order) {
if ($order && !$order->online_payment_url) {
if ($order->id_point_sale != $posts['Order']['id_point_sale']) { if ($order->id_point_sale != $posts['Order']['id_point_sale']) {
$order->id_point_sale = $posts['Order']['id_point_sale']; $order->id_point_sale = $posts['Order']['id_point_sale'];
$order->date_update = date('Y-m-d H:i:s'); $order->date_update = date('Y-m-d H:i:s');
return ['status' => 'error', 'errors' => $errors]; return ['status' => 'error', 'errors' => $errors];
} }


if (($producer->online_payment || ($producer->option_stripe_mode_test && $user->status > 10))
&& $producer->option_online_payment_type == 'order') {
if ($producer->isOnlinePaymentActiveAndTypeOrder()) {


$order = Order::searchOne([ $order = Order::searchOne([
'id' => $order->id 'id' => $order->id


// Commandes de l'utilisateur // Commandes de l'utilisateur
$ordersUserArray = []; $ordersUserArray = [];
if (User::getCurrentId()) {
if (User::getCurrentId() && !$producer->isOnlinePaymentActiveAndTypeOrder()) {
$conditionsOrdersUser = [ $conditionsOrdersUser = [
'distribution.date > :date' 'distribution.date > :date'
]; ];
} }


$orderUser = Order::searchOne($conditionOrderUser); $orderUser = Order::searchOne($conditionOrderUser);

if($orderUser && $orderUser->online_payment_url) {
$orderUser = false;
}
} }


if ($orderUser) { if ($orderUser) {

+ 19
- 16
producer/views/order/confirm.php View File



<div id="order-success"> <div id="order-success">


<?php if($returnPayment != 'success'): ?>

<?php if($producer->isOnlinePaymentActive() && $returnPayment != 'success'): ?>
<div class="alert alert-danger"> <div class="alert alert-danger">
Le paiement en ligne a échoué.<br />
<strong>Attention</strong>, votre commande sera effective à la réception du paiement.
<h5>Le paiement en ligne a échoué.</h5>
<strong>Attention</strong>, votre commande ne sera effective qu'à la réception du paiement.<br />
<a href="<?= $order->online_payment_url ?>">Cliquez ici</a> pour recommencer votre paiement.
</div>
<?php else: ?>
<div class="alert alert-success">
<span class="glyphicon glyphicon-ok glyphicon-big"></span>
<div class="content">
<h3>Votre commande a bien été prise en compte</h3>
<?php if(!Yii::$app->user->isGuest): ?>
<a href="<?= Yii::$app->urlManagerProducer->createUrl(['order/history']) ?>" class="btn btn-default">
<span class="glyphicon glyphicon-chevron-right"></span>
Voir toutes mes commandes
</a>
<?php endif; ?>
</div>
<div class="clr"></div>
</div> </div>
<?php endif; ?> <?php endif; ?>


<div class="alert alert-success">
<span class="glyphicon glyphicon-ok glyphicon-big"></span>
<div class="content">
<h3>Votre commande a bien été prise en compte</h3>
<?php if(!Yii::$app->user->isGuest): ?>
<a href="<?= Yii::$app->urlManagerProducer->createUrl(['order/history']) ?>" class="btn btn-default">
<span class="glyphicon glyphicon-chevron-right"></span>
Voir toutes mes commandes
</a>
<?php endif; ?>
</div>
<div class="clr"></div>
</div>
<div class="alert alert-info alert-order-summary"> <div class="alert alert-info alert-order-summary">
<span class="glyphicon glyphicon-list-alt glyphicon-big"></span> <span class="glyphicon glyphicon-list-alt glyphicon-big"></span>
<div class="content"> <div class="content">

+ 13
- 6
producer/views/order/history.php View File

use yii\bootstrap\ActiveForm; use yii\bootstrap\ActiveForm;
use common\models\Order ; use common\models\Order ;


$producer = $this->context->getProducer();
$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' => '<span class="glyphicon glyphicon-plus"></span> Ajouter', 'url' => 'order/order', 'class' => 'btn btn-primary']) ;


[ [
'label' => 'Actions', 'label' => 'Actions',
'format' => 'raw', 'format' => 'raw',
'value' => function($c) {
'value' => function($c) use ($producer) {
$html = '' ; $html = '' ;
if($c->getState() == Order::STATE_OPEN) { if($c->getState() == Order::STATE_OPEN) {

$html .= '<a href="'.Yii::$app->urlManager->createUrl(['order/order','id'=>$c->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a> '.
'<a href="'.Yii::$app->urlManager->createUrl(['order/cancel','id'=>$c->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-trash"></span></a> '.
(($c->id_subscription) ? '<a href="'.Yii::$app->urlManagerProducer->createUrl(['subscription/form','id'=>$c->id_subscription]).'" class="btn btn-default"><span class="glyphicon glyphicon-repeat"></span></a>' : '') ;
if ($producer->isOnlinePaymentActiveAndTypeOrder()) {
$paymentStatus = $c->getPaymentStatus();
if($paymentStatus == Order::PAYMENT_UNPAID && $c->online_payment_url) {
$html .= '<a href="'.$c->online_payment_url.'" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Payer en ligne</a>';
}
}
else {
$html .= '<a href="'.Yii::$app->urlManager->createUrl(['order/order','id'=>$c->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a> '.
'<a href="'.Yii::$app->urlManager->createUrl(['order/cancel','id'=>$c->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-trash"></span></a> '.
(($c->id_subscription) ? '<a href="'.Yii::$app->urlManagerProducer->createUrl(['subscription/form','id'=>$c->id_subscription]).'" class="btn btn-default"><span class="glyphicon glyphicon-repeat"></span></a>' : '') ;
}
} }
return $html ; return $html ;
} }

+ 1
- 1
producer/views/order/order.php View File

<span class="glyphicon glyphicon-chevron-right"></span> <span class="glyphicon glyphicon-chevron-right"></span>
<?php if($producer->option_payment_info && strlen($producer->option_payment_info) > 0): ?> <?php if($producer->option_payment_info && strlen($producer->option_payment_info) > 0): ?>
Confirmez votre commande et retrouvez les informations liées au paiement sur la page suivante. Confirmez votre commande et retrouvez les informations liées au paiement sur la page suivante.
<?php elseif($producer->online_payment && $producer->option_online_payment_type == 'order'): ?>
<?php elseif($producer->isOnlinePaymentActiveAndTypeOrder()): ?>
La commande est à payer en ligne lors de l'étape suivante. La commande est à payer en ligne lors de l'étape suivante.
<?php else: ?> <?php else: ?>
La commande sera à régler sur place. La commande sera à régler sur place.

+ 13
- 4
producer/web/css/screen.css View File

padding: 0px; padding: 0px;
} }
/* line 34, ../sass/order/_confirm.scss */ /* line 34, ../sass/order/_confirm.scss */
.order-confirm #main #order-success .alert.alert-danger {
padding: 12px;
}
/* line 36, ../sass/order/_confirm.scss */
.order-confirm #main #order-success .alert.alert-danger h5 {
margin-top: 10px;
margin-bottom: 10px;
}
/* line 42, ../sass/order/_confirm.scss */
.order-confirm #main #order-success .alert strong { .order-confirm #main #order-success .alert strong {
font-weight: bold; font-weight: bold;
} }
/* line 38, ../sass/order/_confirm.scss */
/* line 46, ../sass/order/_confirm.scss */
.order-confirm #main #order-success .alert .glyphicon-big { .order-confirm #main #order-success .alert .glyphicon-big {
font-size: 90px; font-size: 90px;
color: white; color: white;
padding: 30px; padding: 30px;
float: left; float: left;
} }
/* line 45, ../sass/order/_confirm.scss */
/* line 53, ../sass/order/_confirm.scss */
.order-confirm #main #order-success .alert div.content { .order-confirm #main #order-success .alert div.content {
color: #333; color: #333;
padding: 20px; padding: 20px;
margin-left: 151px; margin-left: 151px;
} }
/* line 50, ../sass/order/_confirm.scss */
/* line 58, ../sass/order/_confirm.scss */
.order-confirm #main #order-success .alert div.content h3 { .order-confirm #main #order-success .alert div.content h3 {
font-family: "capsuularegular"; font-family: "capsuularegular";
font-size: 30px; font-size: 30px;
line-height: 35px; line-height: 35px;
text-transform: none; text-transform: none;
} }
/* line 63, ../sass/order/_confirm.scss */
/* line 71, ../sass/order/_confirm.scss */
.order-confirm #main #order-success .alert div.content .locality { .order-confirm #main #order-success .alert div.content .locality {
color: gray; color: gray;
} }

+ 8
- 0
producer/web/sass/order/_confirm.scss View File

.alert { .alert {
padding: 0px ; padding: 0px ;


&.alert-danger {
padding: 12px;
h5 {
margin-top: 10px;
margin-bottom: 10px;
}
}

strong { strong {
font-weight: bold ; font-weight: bold ;
} }

Loading…
Cancel
Save