Procházet zdrojové kódy

Merge branch 'dev'

master
Guillaume Bourgeois před 5 roky
rodič
revize
b534ca8bad
5 změnil soubory, kde provedl 109 přidání a 33 odebrání
  1. +28
    -3
      backend/controllers/SubscriptionController.php
  2. +36
    -9
      backend/views/distribution/index.php
  3. +31
    -20
      backend/web/css/screen.css
  4. +4
    -1
      backend/web/js/vuejs/distribution-index.js
  5. +10
    -0
      backend/web/sass/distribution/_index.scss

+ 28
- 3
backend/controllers/SubscriptionController.php Zobrazit soubor

@@ -37,6 +37,8 @@ termes.

namespace backend\controllers;

use common\models\Order ;

class SubscriptionController extends BackendController
{
var $enableCsrfValidation = false;
@@ -80,16 +82,39 @@ class SubscriptionController extends BackendController
}

/**
* Crée une commande récurrente.
* Crée un abonnement.
*
* @return string
*/
public function actionCreate()
public function actionCreate($idOrder = 0)
{
// form
$model = new SubscriptionForm;
$model->id_producer = Producer::getId();

if($idOrder) {
$order = Order::searchOne(['id' => $idOrder]);
if ($order) {
$model->id_user = $order->id_user;
$model->username = $order->username;
$model->id_point_sale = $order->id_point_sale;
$model->date_begin = date('d/m/Y') ;
$dateDay = strtolower(date('l',strtotime($order->distribution->date))) ;
$model->$dateDay = 1 ;
$model->week_frequency = 1 ;
if($model->id_user && Producer::getConfig('credit')) {
$model->auto_payment = 1 ;
}
// produits
foreach ($order->productOrder as $productOrder) {
$model->products['product_' . $productOrder->id_product] = $productOrder->quantity;
}
} else {
throw new NotFoundHttpException('La commande est introuvable.', 404);
}
}
// produits
$productsArray = Product::searchAll() ;
@@ -115,7 +140,7 @@ class SubscriptionController extends BackendController
}

/**
* Modifie une commande récurrente.
* Modifie un abonnement.
*
* @param integer $id
* @return string

+ 36
- 9
backend/views/distribution/index.php Zobrazit soubor

@@ -241,6 +241,11 @@ $this->setPageTitle('Distributions') ;
<label class="label label-default" v-else-if="order.origin == 'auto'">auto</label>
<label class="label label-warning" v-else>admin</label>
</td>
<td>
<span class="label label-danger" v-if="order.date_delete"><span class="glyphicon glyphicon-trash"></span></span>
<span class="label label-warning" v-if="order.date_update"><span class="glyphicon glyphicon-pencil"></span></span>
<span class="label label-success" v-if="!order.date_update && !order.date_delete"><span class="glyphicon glyphicon-check"></span></span>
</td>
<td>
<span v-if="order.user">{{ order.user.lastname+' '+order.user.name }}</span>
<span v-else>{{ order.username }}</span>
@@ -251,22 +256,44 @@ $this->setPageTitle('Distributions') ;
</td>
<td>{{ order.amount.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}</td>
<td>
<span class="label label-success" v-if="order.amount_paid == order.amount">payé</span>
<span class="label label-default" v-else-if="order.amount_paid == 0">non réglé</span>
<span class="label label-default" v-else-if="order.amount_paid > order.amount">surplus</span>
<span class="label label-warning" v-else-if="order.amount_paid < order.amount">reste à payer</span>
<div class="input-group">
<span class="label label-success input-group-addon" v-if="order.amount_paid == order.amount">payé</span>
<span class="label label-default input-group-addon" v-else-if="order.amount_paid == 0">non réglé</span>
<span class="label label-default input-group-addon" v-else-if="order.amount_paid > order.amount">surplus</span>
<span class="label label-warning input-group-addon" v-else-if="order.amount_paid < order.amount">reste à payer</span>
</div>
</td>
<td>
<span class="label label-danger" v-if="order.date_delete">annulée</span>
<span class="label label-warning" v-if="order.date_update">modifiée</span>
<div class="btn-group" v-if="order.user">
<button class="btn btn-xs btn-default" v-if="order.amount_paid == order.amount" @click="orderPaymentClick" :data-id-order="order.id" data-type="refund" :data-amount="order.amount">
<span class="glyphicon glyphicon-euro"></span> Rembourser
</button>
<button class="btn btn-xs btn-default" v-else-if="order.amount_paid == 0" @click="orderPaymentClick" :data-id-order="order.id" data-type="payment" :data-amount="order.amount">
<span class="glyphicon glyphicon-euro"></span> Payer
</button>
<button class="btn btn-xs btn-default" v-else-if="order.amount_paid < order.amount" @click="orderPaymentClick" :data-id-order="order.id" data-type="payment" :data-amount="order.amount_remaining">
<span class="glyphicon glyphicon-euro"></span> Payer
</button>
<button class="btn btn-xs btn-default" v-else-if="order.amount_paid > order.amount" @click="orderPaymentClick" :data-id-order="order.id" data-type="refund" :data-amount="order.amount_surplus">
<span class="glyphicon glyphicon-euro"></span> Rembourser
</button>
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a href="javascript:void(0);" @click="orderPaymentModalClick" :data-id-order="order.id">Historique</a></li>
</ul>
</div>
</td>
<td class="column-actions">
<a class="btn btn-default" :href="baseUrl+'/subscription/update?id='+order.id_subscription" v-if="order.id_subscription > 0"><span class="glyphicon glyphicon-repeat"></span></a>
<button class="btn btn-default" :data-id-order="order.id" @click="orderViewClick"><span :class="'glyphicon ' + ((showViewProduct && idOrderView == order.id) ? 'glyphicon-eye-close' : 'glyphicon-eye-open')"></span></button>
<button class="btn btn-default" :data-id-order="order.id" @click="orderPaymentModalClick" v-show="order.user"><span class="glyphicon glyphicon-euro"></span></button>
<button class="btn btn-default" :data-id-order="order.id" @click="updateOrderClick"><span class="glyphicon glyphicon-pencil"></span></button>
<button class="btn btn-default" :data-id-order="order.id" @click="deleteOrderClick"><span class="glyphicon glyphicon-trash"></span></button>

<a class="btn btn-default" :href="baseUrl+'/subscription/update?id='+order.id_subscription" v-if="order.id_subscription > 0"><span class="glyphicon glyphicon-repeat"></span></a>
<a class="btn btn-default add-subscription" :href="baseUrl+'/subscription/create?idOrder='+order.id" v-else><span class="glyphicon glyphicon-plus"></span><span class="glyphicon glyphicon-repeat"></span></a>
<order-form
v-if="showModalFormOrderUpdate && idOrderUpdate == order.id"
:date="date"

+ 31
- 20
backend/web/css/screen.css Zobrazit soubor

@@ -1829,55 +1829,66 @@ termes.
.distribution-index #orders table td.column-actions .modal-payment {
text-align: left;
}
/* line 229, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .add-subscription {
position: relative;
}
/* line 231, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .add-subscription .glyphicon-plus {
position: absolute;
top: 4px;
right: 4px;
font-size: 7px;
}
/* line 241, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view ul {
list-style-type: none;
margin-left: 0px;
padding-left: 15px;
}
/* line 240, ../sass/distribution/_index.scss */
/* line 250, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view .comment {
margin-top: 20px;
}
/* line 251, ../sass/distribution/_index.scss */
/* line 261, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products .product-ordered td {
background-color: #e9e9e9;
}
/* line 255, ../sass/distribution/_index.scss */
/* line 265, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products .product-ordered input {
font-size: 16px;
font-weight: bold;
}
/* line 261, ../sass/distribution/_index.scss */
/* line 271, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity {
width: 150px;
}
/* line 264, ../sass/distribution/_index.scss */
/* line 274, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity input {
text-align: center;
color: gray;
}
/* line 270, ../sass/distribution/_index.scss */
/* line 280, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining {
text-align: right;
}
/* line 276, ../sass/distribution/_index.scss */
/* line 286, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .actions-form button {
margin-left: 15px;
}
/* line 284, ../sass/distribution/_index.scss */
/* line 294, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon {
width: 50px;
}
/* line 286, ../sass/distribution/_index.scss */
/* line 296, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon i {
font-size: 30px;
}
/* line 290, ../sass/distribution/_index.scss */
/* line 300, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-content {
margin-left: 50px;
}
/* line 296, ../sass/distribution/_index.scss */
/* line 306, ../sass/distribution/_index.scss */
.distribution-index .modal-mask {
position: fixed;
z-index: 9998;
@@ -1889,12 +1900,12 @@ termes.
display: table;
transition: opacity .3s ease;
}
/* line 308, ../sass/distribution/_index.scss */
/* line 318, ../sass/distribution/_index.scss */
.distribution-index .modal-wrapper {
display: table-cell;
vertical-align: middle;
}
/* line 313, ../sass/distribution/_index.scss */
/* line 323, ../sass/distribution/_index.scss */
.distribution-index .modal-container {
width: 70%;
margin: 0px auto;
@@ -1905,37 +1916,37 @@ termes.
transition: all .3s ease;
font-family: Helvetica, Arial, sans-serif;
}
/* line 324, ../sass/distribution/_index.scss */
/* line 334, ../sass/distribution/_index.scss */
.distribution-index .modal-header {
padding-bottom: 0px;
}
/* line 326, ../sass/distribution/_index.scss */
/* line 336, ../sass/distribution/_index.scss */
.distribution-index .modal-header h3 {
margin-top: 0;
color: #333;
text-transform: uppercase;
margin-bottom: 0px;
}
/* line 334, ../sass/distribution/_index.scss */
/* line 344, ../sass/distribution/_index.scss */
.distribution-index .modal-body {
margin: 20px 0;
max-height: 300px;
height: 300px;
overflow-y: scroll;
}
/* line 341, ../sass/distribution/_index.scss */
/* line 351, ../sass/distribution/_index.scss */
.distribution-index .modal-default-button {
float: right;
}
/* line 354, ../sass/distribution/_index.scss */
/* line 364, ../sass/distribution/_index.scss */
.distribution-index .modal-enter {
opacity: 0;
}
/* line 358, ../sass/distribution/_index.scss */
/* line 368, ../sass/distribution/_index.scss */
.distribution-index .modal-leave-active {
opacity: 0;
}
/* line 362, ../sass/distribution/_index.scss */
/* line 372, ../sass/distribution/_index.scss */
.distribution-index .modal-enter .modal-container,
.distribution-index .modal-leave-active .modal-container {
-webkit-transform: scale(1.1);

+ 4
- 1
backend/web/js/vuejs/distribution-index.js Zobrazit soubor

@@ -313,8 +313,11 @@ var app = new Vue({
orderPaymentClick: function(event) {
var app = this ;
var idOrder = event.currentTarget.getAttribute('data-id-order') ;
if(!idOrder) {
idOrder = this.idOrderPayment ;
}
axios.get(UrlManager.getBaseUrlAbsolute()+"order/ajax-payment",{params: {
idOrder: this.idOrderPayment,
idOrder: idOrder,
type: event.currentTarget.getAttribute('data-type'),
amount: event.currentTarget.getAttribute('data-amount')
}})

+ 10
- 0
backend/web/sass/distribution/_index.scss Zobrazit soubor

@@ -225,6 +225,16 @@ termes.
.modal-payment {
text-align: left ;
}
.add-subscription {
position: relative ;
.glyphicon-plus {
position: absolute ;
top: 4px ;
right: 4px ;
font-size: 7px ;
}
}
}
tr.view {

Načítá se…
Zrušit
Uložit