소스 검색

[Administration] Distributions > Tiller : affichage du montant total des commandes à synchroniser

develop
Guillaume Bourgeois 3 주 전
부모
커밋
1d472392e4
4개의 변경된 파일34개의 추가작업 그리고 1개의 파일을 삭제
  1. +1
    -0
      backend/controllers/DistributionController.php
  2. +8
    -1
      backend/views/distribution/index.php
  3. +2
    -0
      backend/web/js/vuejs/distribution-index.js
  4. +23
    -0
      domain/Order/Order/TillerManager.php

+ 1
- 0
backend/controllers/DistributionController.php 파일 보기

@@ -134,6 +134,7 @@ class DistributionController extends BackendController
$json['tiller_is_synchro'] = $this->buildAjaxInfosResponseTiller($producer, $date);
$json['tiller_is_authenticated'] = $this->getOrderModule()->getTillerManager()->isAuthenticated();
$json['tiller_url_authorize_code'] = $this->getOrderModule()->getTillerManager()->getUrlAuthorizeCode();
$json['tiller_total_amount_orders'] = $this->getOrderModule()->getTillerManager()->getTotalAmountOrdersByDate($date, true);
$json['missing_subscriptions'] = $this->buildAjaxInfosResponseMissingSubscriptions($date, $distribution, $ordersArrayObject);
}


+ 8
- 1
backend/views/distribution/index.php 파일 보기

@@ -321,7 +321,10 @@ $this->setPageTitle('Distributions') ;
<button id="btn-tiller" class="btn btn-xs btn-default" disabled><span class="glyphicon glyphicon-refresh"></span> Synchroniser avec Tiller</button>
</span>
</template>
<button v-else id="btn-tiller" class="btn btn-xs btn-default" @click="synchroTiller"><span class="glyphicon glyphicon-refresh"></span> Synchroniser avec Tiller</button>
<button v-else id="btn-tiller" class="btn btn-xs btn-default" @click="synchroTiller">
<span class="glyphicon glyphicon-refresh"></span>
Synchroniser avec Tiller
</button>
</template>
<template v-else>
<a :href="tillerUrlAuthorizeCode" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-refresh"></span> Connexion Tiller</a>
@@ -344,6 +347,10 @@ $this->setPageTitle('Distributions') ;
</span>
</div>

<div class="alert alert-info" v-if="producer && producer.tiller == true && orders.length > 0 && tillerTotalAmountOrders">
Montant total commandes Tiller : {{ tillerTotalAmountOrders }}
</div>

<div class="alert alert-danger" v-if="distribution && !distribution.active && orders && orders.length > 0">
Attention, ce jour de distribution n'est pas activé et vous avez quand même des commandes enregistrées.
</div>

+ 2
- 0
backend/web/js/vuejs/distribution-index.js 파일 보기

@@ -79,6 +79,7 @@ if($(selector).length) {
tillerIsAuthenticated: false,
tillerUrlAuthorizeCode: '#',
tillerIsSynchro: false,
tillerTotalAmountOrders: false,
checkboxSelectAllOrders: false,
messageGenerateDeliveryNoteDisplayed: false,
missingSubscriptions: false,
@@ -211,6 +212,7 @@ if($(selector).length) {
app.tillerUrlAuthorizeCode = response.data.tiller_url_authorize_code;
app.tillerIsAuthenticated = response.data.tiller_is_authenticated;
app.tillerIsSynchro = response.data.tiller_is_synchro;
app.tillerTotalAmountOrders = response.data.tiller_total_amount_orders;

app.calendar.attrs = [];
var distributions = response.data.distributions;

+ 23
- 0
domain/Order/Order/TillerManager.php 파일 보기

@@ -41,6 +41,7 @@ use common\components\Tiller\TillerClientInterface;
use common\components\Tiller\TillerClientV2;
use common\components\Tiller\TillerClientV3;
use common\helpers\MeanPayment;
use common\helpers\Price;
use domain\Order\OrderStatus\OrderStatus;
use domain\Order\ProductOrder\ProductOrderSolver;
use domain\Producer\Producer\ProducerSolver;
@@ -308,4 +309,26 @@ class TillerManager extends AbstractManager

return false;
}

public function getTotalAmountOrdersByDate(string $date, bool $format = false)
{
$totalAmount = 0;
$ordersArray = Order::searchAll([
'distribution.date' => $date,
'order.tiller_synchronization' => 1,
], [
'conditions' => OrderRepositoryQuery::getSqlFilterIsValid()
]);

foreach($ordersArray as $order) {
$this->orderBuilder->initOrder($order);
$totalAmount += $this->orderSolver->getOrderAmountWithTax($order);
}

if($format) {
return Price::format($totalAmount);
}

return $totalAmount;
}
}

Loading…
취소
저장