Quellcode durchsuchen

Merge branch 'dev'

master
Guillaume Bourgeois vor 5 Jahren
Ursprung
Commit
9db0209a43
13 geänderte Dateien mit 281 neuen und 188 gelöschten Zeilen
  1. +5
    -1
      backend/controllers/SubscriptionController.php
  2. +3
    -0
      backend/views/site/index.php
  3. +2
    -0
      backend/views/subscription/_form.php
  4. +180
    -168
      backend/web/css/screen.css
  5. +1
    -1
      backend/web/js/vuejs/subscription-form.js
  6. +12
    -0
      backend/web/sass/screen.scss
  7. +20
    -3
      common/models/Subscription.php
  8. +5
    -2
      common/models/SubscriptionForm.php
  9. +17
    -0
      console/migrations/m190806_084324_ajout_champs_comment_subscription.php
  10. +9
    -0
      producer/views/subscription/_form.php
  11. +18
    -12
      producer/web/css/screen.css
  12. +4
    -1
      producer/web/js/vuejs/subscription-form.js
  13. +5
    -0
      producer/web/sass/subscription/_form.scss

+ 5
- 1
backend/controllers/SubscriptionController.php Datei anzeigen

@@ -153,6 +153,7 @@ class SubscriptionController extends BackendController
$model = new SubscriptionForm;
$model->isAdmin = true ;
$subscription = Subscription::findOne($id);
if ($subscription) {
$model->id = $id;
$model->id_producer = $subscription->id_producer;
@@ -163,7 +164,7 @@ class SubscriptionController extends BackendController
if (strlen($subscription->date_end)) {
$model->date_end = date('d/m/Y', strtotime($subscription->date_end));
}
$model->monday = $subscription->monday;
$model->tuesday = $subscription->tuesday;
$model->wednesday = $subscription->wednesday;
@@ -173,6 +174,9 @@ class SubscriptionController extends BackendController
$model->sunday = $subscription->sunday;
$model->auto_payment = $subscription->auto_payment;
$model->week_frequency = $subscription->week_frequency;
if(strlen($subscription->comment)) {
$model->comment = $subscription->comment ;
}

// produits
$arrayProductsSubscription = ProductSubscription::searchAll([

+ 3
- 0
backend/views/site/index.php Datei anzeigen

@@ -168,6 +168,9 @@ $this->title = 'Tableau de bord';
</td>
<td>
<?= $order->getStrUser(); ?><br />
<?php if(strlen($order->comment)): ?>
<div class="comment"><span class="glyphicon glyphicon-comment"></span> <?= nl2br(Html::encode($order->comment)) ; ?></div>
<?php endif; ?>
</td>
<td><?= $order->getCartSummary() ; ?></td>
<td><?= $order->getPointSaleSummary() ; ?></td>

+ 2
- 0
backend/views/subscription/_form.php Datei anzeigen

@@ -127,6 +127,8 @@ use common\models\PointSale ;
</table>
</div>
<?= $form->field($model, 'comment')->textarea(['rows' => 6]) ?>
<?= Html::submitButton('Enregistrer' , ['class' => 'btn btn-primary']) ?>
<?php ActiveForm::end(); ?>
</div>

+ 180
- 168
backend/web/css/screen.css
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 1
- 1
backend/web/js/vuejs/subscription-form.js Datei anzeigen

@@ -75,7 +75,7 @@ var app = new Vue({
}
},
changeQuantityProductSubscription: function(increase, product) {
var step = parseFloat(product.step) ;
var step = step ? parseFloat(product.step) : 1 ;
if(!product.quantity) product.quantity = 0 ;
var quantity = parseFloat(product.quantity) ;
if(!increase) {

+ 12
- 0
backend/web/sass/screen.scss Datei anzeigen

@@ -431,6 +431,18 @@ a.btn, button.btn {
.date {
text-align: center ;
}
.comment {
position: relative ;
margin-top: 4px ;
padding-left: 20px ;
font-style: italic ;
.glyphicon {
position: absolute ;
left: 0px ;
}
}
}
}


+ 20
- 3
common/models/Subscription.php Datei anzeigen

@@ -66,6 +66,7 @@ use common\models\User ;
* @property integer $week_frequency
* @property string $username
* @property string $auto_payment
* @property string $comment
*/
class Subscription extends ActiveRecordCommon
{
@@ -87,7 +88,7 @@ class Subscription extends ActiveRecordCommon
[['id_user', 'id_producer', 'id_point_sale', 'monday', 'tuesday',
'wednesday', 'thursday', 'friday', 'saturday', 'sunday', 'week_frequency'], 'integer'],
[['auto_payment'], 'boolean'],
[['date_begin', 'date_end', 'username'], 'safe'],
[['date_begin', 'date_end', 'username','comment'], 'safe'],
];
}

@@ -111,7 +112,8 @@ class Subscription extends ActiveRecordCommon
'saturday' => 'Samedi',
'sunday' => 'Dimanche',
'week_frequency' => 'Périodicité',
'auto_payment' => 'Paiement automatique'
'auto_payment' => 'Paiement automatique',
'comment' => 'Commentaire'
];
}

@@ -190,6 +192,9 @@ class Subscription extends ActiveRecordCommon
$order->id_point_sale = $this->id_point_sale;
$order->id_distribution = $distribution->id;
$order->id_subscription = $this->id;
if(strlen($this->comment)) {
$order->comment = $this->comment ;
}
$pointSale = PointSale::findOne($this->id_point_sale) ;
$creditFunctioning = $pointSale->getCreditFunctioning() ;
@@ -404,10 +409,21 @@ class Subscription extends ActiveRecordCommon
':id_subscription' => $this->id
];
$orderDeadline = Producer::getConfig('order_deadline') ;
$hour = date('G') ;
if($hour >= $orderDeadline) {
$conditionDistributionDate = 'distribution.date > :date_today' ;
}
else {
$conditionDistributionDate = 'distribution.date >= :date_today' ;
}
$orders = Order::find()
->joinWith('distribution')
->where('distribution.id_producer = :id_producer')
->andWhere('distribution.date >= :date_today')
->andWhere($conditionDistributionDate)
->andWhere('distribution.date >= :date_begin')
->andWhere('order.id_subscription = :id_subscription') ;
@@ -425,6 +441,7 @@ class Subscription extends ActiveRecordCommon
foreach($ordersArray as $order) {
$theOrder = Order::searchOne(['id' => $order->id]) ;

// remboursement de la commande
if ($theOrder->id_user && $theOrder->getAmount(Order::AMOUNT_PAID) && $configCredit) {
$theOrder->saveCreditHistory(

+ 5
- 2
common/models/SubscriptionForm.php Datei anzeigen

@@ -66,6 +66,7 @@ class SubscriptionForm extends Model
public $week_frequency;
public $products;
public $auto_payment;
public $comment ;

/**
* @inheritdoc
@@ -77,7 +78,7 @@ class SubscriptionForm extends Model
[['date_begin', 'date_end'], 'date', 'format' => 'php:d/m/Y'],
[['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday', 'auto_payment'], 'boolean'],
[['id_point_sale', 'id_producer', 'date_begin'], 'required', 'message' => 'Champs obligatoire'],
[['products', 'id_user', 'username'], 'safe'],
[['products', 'id_user', 'username','comment'], 'safe'],
['id_user', function ($attribute, $params) {
if (!$this->id_user && !strlen($this->username)) {
$this->addError($attribute, 'Vous devez sélectionner ou saisir un utilisateur.');
@@ -104,7 +105,8 @@ class SubscriptionForm extends Model
'sunday' => 'Dimanche',
'week_frequency' => 'Périodicité (semaines)',
'username' => 'Nom d\'utilisateur',
'auto_payment' => 'Paiement automatique'
'auto_payment' => 'Paiement automatique',
'comment' => 'Commentaire'
];
}

@@ -146,6 +148,7 @@ class SubscriptionForm extends Model
$subscription->sunday = $this->sunday;
$subscription->week_frequency = $this->week_frequency;
$subscription->auto_payment = $this->auto_payment;
$subscription->comment = $this->comment;

$subscription->save();


+ 17
- 0
console/migrations/m190806_084324_ajout_champs_comment_subscription.php Datei anzeigen

@@ -0,0 +1,17 @@
<?php

use yii\db\Migration;
use yii\db\mysql\Schema;

class m190806_084324_ajout_champs_comment_subscription extends Migration
{
public function up()
{
$this->addColumn('subscription', 'comment', Schema::TYPE_TEXT) ;
}

public function down()
{
$this->dropColumn('subscription', 'comment') ;
}
}

+ 9
- 0
producer/views/subscription/_form.php Datei anzeigen

@@ -246,6 +246,15 @@ use common\models\PointSale ;
</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>
<button class="btn btn-primary" disabled="disabled" v-if="disableSubmitButton">Enregistrer</button>
<button class="btn btn-primary" v-else>Enregistrer</button>
</form>

+ 18
- 12
producer/web/css/screen.css Datei anzeigen

@@ -1644,7 +1644,13 @@ termes.
width: 100%;
display: block;
}
/* line 58, ../sass/subscription/_form.scss */
/* line 57, ../sass/subscription/_form.scss */
.subscription-create .subscription-form .comment-textarea,
.subscription-update .subscription-form .comment-textarea {
width: 100%;
height: 100px;
}
/* line 63, ../sass/subscription/_form.scss */
.subscription-create .subscription-form .products .monday, .subscription-create .subscription-form .products .tuesday, .subscription-create .subscription-form .products .wednesday, .subscription-create .subscription-form .products .thursday,
.subscription-create .subscription-form .products .friday, .subscription-create .subscription-form .products .saturday, .subscription-create .subscription-form .products .sunday, .subscription-create .subscription-form .products .no-day,
.subscription-update .subscription-form .products .monday,
@@ -1657,7 +1663,7 @@ termes.
.subscription-update .subscription-form .products .no-day {
display: none;
}
/* line 63, ../sass/subscription/_form.scss */
/* line 68, ../sass/subscription/_form.scss */
.subscription-create .subscription-form .products .monday-active .monday,
.subscription-create .subscription-form .products .tuesday-active .tuesday,
.subscription-create .subscription-form .products .wednesday-active .wednesday,
@@ -1674,60 +1680,60 @@ termes.
.subscription-update .subscription-form .products .sunday-active .sunday {
display: block;
}
/* line 73, ../sass/subscription/_form.scss */
/* line 78, ../sass/subscription/_form.scss */
.subscription-create .subscription-form .products td.quantity,
.subscription-update .subscription-form .products td.quantity {
width: 180px;
}
/* line 76, ../sass/subscription/_form.scss */
/* line 81, ../sass/subscription/_form.scss */
.subscription-create .subscription-form .products td.quantity input,
.subscription-update .subscription-form .products td.quantity input {
text-align: center;
border-right: 0px none;
}
/* line 79, ../sass/subscription/_form.scss */
/* line 84, ../sass/subscription/_form.scss */
.subscription-create .subscription-form .products td.quantity input.has-quantity,
.subscription-update .subscription-form .products td.quantity input.has-quantity {
font-weight: bold;
}
/* line 84, ../sass/subscription/_form.scss */
/* line 89, ../sass/subscription/_form.scss */
.subscription-create .subscription-form .products td.quantity .input-group-addon,
.subscription-update .subscription-form .products td.quantity .input-group-addon {
background-color: white;
padding-left: 0px;
border-left: 0px none;
}
/* line 91, ../sass/subscription/_form.scss */
/* line 96, ../sass/subscription/_form.scss */
.subscription-create .subscription-form .products .name,
.subscription-update .subscription-form .products .name {
font-family: "capsuularegular";
font-size: 20px;
color: black;
}
/* line 97, ../sass/subscription/_form.scss */
/* line 102, ../sass/subscription/_form.scss */
.subscription-create .subscription-form .products .description,
.subscription-update .subscription-form .products .description {
font-style: italic;
}
/* line 101, ../sass/subscription/_form.scss */
/* line 106, ../sass/subscription/_form.scss */
.subscription-create .subscription-form .products .recipe,
.subscription-update .subscription-form .products .recipe {
font-size: 12px;
}
/* line 105, ../sass/subscription/_form.scss */
/* line 110, ../sass/subscription/_form.scss */
.subscription-create .subscription-form .products .price-unit, .subscription-create .subscription-form .products .price-total,
.subscription-update .subscription-form .products .price-unit,
.subscription-update .subscription-form .products .price-total {
text-align: center;
width: 150px;
}
/* line 110, ../sass/subscription/_form.scss */
/* line 115, ../sass/subscription/_form.scss */
.subscription-create .subscription-form .products .unit,
.subscription-update .subscription-form .products .unit {
color: gray;
font-size: 13px;
}
/* line 115, ../sass/subscription/_form.scss */
/* line 120, ../sass/subscription/_form.scss */
.subscription-create .subscription-form .products tr.total .price-total,
.subscription-update .subscription-form .products tr.total .price-total {
text-align: center;

+ 4
- 1
producer/web/js/vuejs/subscription-form.js Datei anzeigen

@@ -23,6 +23,7 @@ var app = new Vue({
errors: [],
disableSubmitButton: false,
lastCountDays: 0,
comment: ''
},
mounted: function() {
this.init();
@@ -59,6 +60,7 @@ var app = new Vue({
app.friday = response.data.friday ;
app.saturday = response.data.saturday ;
app.sunday = response.data.sunday ;
app.comment = response.data.comment ;
}
app.loading = false ;
@@ -218,7 +220,8 @@ var app = new Vue({
friday: this.friday == true ? 1 : 0,
saturday: this.saturday == true ? 1 : 0,
sunday: this.sunday == true ? 1 : 0,
products: productsArray
products: productsArray,
comment: this.comment
}
}).then(function(response) {
window.location.href = opendistrib_base_url(true)+'subscription/index' ;

+ 5
- 0
producer/web/sass/subscription/_form.scss Datei anzeigen

@@ -54,6 +54,11 @@
}
}
.comment-textarea {
width: 100% ;
height: 100px ;
}
.products {
.monday, .tuesday, .wednesday, .thursday,
.friday, .saturday, .sunday, .no-day {

Laden…
Abbrechen
Speichern