Преглед на файлове

Merge branch 'develop'

master
Guillaume Bourgeois преди 4 месеца
родител
ревизия
86f2cba4d7
променени са 5 файла, в които са добавени 93 реда и са изтрити 45 реда
  1. +1
    -1
      backend/controllers/AccessoryController.php
  2. +54
    -43
      backend/web/js/vuejs/distribution-index.js
  3. +28
    -0
      console/migrations/m240704_071250_create_foreign_keys_product_accessory.php
  4. +9
    -0
      domain/Product/Accessory/AccessoryManager.php
  5. +1
    -1
      frontend/views/site/service.php

+ 1
- 1
backend/controllers/AccessoryController.php Целия файл

@@ -122,7 +122,7 @@ class AccessoryController extends BackendController
public function actionDelete(int $id): Response
{
$accessory = $this->findAccessory($id);
if($accessory->delete()) {
if($this->getAccessoryModule()->getManager()->deleteAccessory($accessory)) {
$this->setFlash('success', "Accessoire supprimé");
}


+ 54
- 43
backend/web/js/vuejs/distribution-index.js Целия файл

@@ -83,6 +83,8 @@ if($(selector).length) {
messageGenerateDeliveryNoteDisplayed: false,
missingSubscriptions: false,
loadingUpdateProductOrder: false,
timerAjaxUpdateProductOrder: null,
xhr: null,
units: [],
calendar: {
mode: 'single',
@@ -858,7 +860,7 @@ if($(selector).length) {
}
return JSON.stringify(productOrderArrayRequest);
},
updateProductOrders: function (updatePricesOnUpdateOrder) {
updateProductOrders: function (updatePrices) {
var app = this;
app.loadingUpdateProductOrder = true;
var order = null;
@@ -876,57 +878,66 @@ if($(selector).length) {
}

if (order) {
axios.get(UrlManager.getBaseUrlAbsolute() + "distribution/ajax-update-product-order", {
params: {
idDistribution: app.distribution.id,
idUser: order.id_user,
idPointSale: order.id_point_sale,
idOrder: order.id,
productOrderFormArray: app.getProductOrderArrayRequest(order)
if (app.timerAjaxUpdateProductOrder) {
clearTimeout(app.timerAjaxUpdateProductOrder);
}
app.timerAjaxUpdateProductOrder = setTimeout(function(app) {
if(app.xhr) {
app.xhr.abort();
}
})
.then(function (response) {
if (response.data) {
for (idProduct in response.data) {

if (app.showModalFormOrderCreate) {
Vue.set(app.orderCreate.productOrder[idProduct], 'quantity_remaining', response.data[idProduct].quantity_remaining);
Vue.set(app.orderCreate.productOrder[idProduct], 'prices', response.data[idProduct].prices);
Vue.set(app.orderCreate.productOrder[idProduct], 'active', response.data[idProduct].active);
Vue.set(app.orderCreate.productOrder[idProduct], 'price', app.getBestProductPrice(app.orderCreate, idProduct, app.orderCreate.productOrder[idProduct].quantity, false));
Vue.set(app.orderCreate.productOrder[idProduct], 'price_with_tax', app.getBestProductPrice(app.orderCreate, idProduct, app.orderCreate.productOrder[idProduct].quantity, true));
}
app.xhr = $.get(UrlManager.getBaseUrlAbsolute() + "distribution/ajax-update-product-order", {
idDistribution: app.distribution.id,
idUser: order.id_user,
idPointSale: order.id_point_sale,
idOrder: order.id,
productOrderFormArray: app.getProductOrderArrayRequest(order)
}, function (response) {
if (response) {
for (idProduct in response) {

if (app.showModalFormOrderCreate) {
Vue.set(app.orderCreate.productOrder[idProduct], 'quantity_remaining', response[idProduct].quantity_remaining);
Vue.set(app.orderCreate.productOrder[idProduct], 'prices', response[idProduct].prices);
Vue.set(app.orderCreate.productOrder[idProduct], 'active', response[idProduct].active);

if(updatePrices) {
Vue.set(app.orderCreate.productOrder[idProduct], 'price', app.getBestProductPrice(app.orderCreate, idProduct, app.orderCreate.productOrder[idProduct].quantity, false));
Vue.set(app.orderCreate.productOrder[idProduct], 'price_with_tax', app.getBestProductPrice(app.orderCreate, idProduct, app.orderCreate.productOrder[idProduct].quantity, true));
}
}

if (app.showModalFormOrderUpdate && app.idOrderUpdate) {
for (keyOrderUpdate in app.ordersUpdate) {
if (order.id == app.idOrderUpdate) {
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'quantity_remaining', response.data[idProduct].quantity_remaining);
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'prices', response.data[idProduct].prices);
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'active', response.data[idProduct].active);
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'invoice_price', response.data[idProduct].invoice_price);

if (updatePricesOnUpdateOrder) {
Vue.set(
app.ordersUpdate[keyOrderUpdate].productOrder[idProduct],
'price',
app.getBestProductPrice(app.ordersUpdate[keyOrderUpdate], idProduct, app.ordersUpdate[keyOrderUpdate].productOrder[idProduct].quantity, false));
Vue.set(
app.ordersUpdate[keyOrderUpdate].productOrder[idProduct],
'price_with_tax',
app.getBestProductPrice(app.ordersUpdate[keyOrderUpdate], idProduct, app.ordersUpdate[keyOrderUpdate].productOrder[idProduct].quantity, true));
if (app.showModalFormOrderUpdate && app.idOrderUpdate) {
for (keyOrderUpdate in app.ordersUpdate) {
if (order.id == app.idOrderUpdate) {
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'quantity_remaining', response[idProduct].quantity_remaining);
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'prices', response[idProduct].prices);
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'active', response[idProduct].active);
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'invoice_price', response[idProduct].invoice_price);

if (updatePrices) {
Vue.set(
app.ordersUpdate[keyOrderUpdate].productOrder[idProduct],
'price',
app.getBestProductPrice(app.ordersUpdate[keyOrderUpdate], idProduct, app.ordersUpdate[keyOrderUpdate].productOrder[idProduct].quantity, false));
Vue.set(
app.ordersUpdate[keyOrderUpdate].productOrder[idProduct],
'price_with_tax',
app.getBestProductPrice(app.ordersUpdate[keyOrderUpdate], idProduct, app.ordersUpdate[keyOrderUpdate].productOrder[idProduct].quantity, true));
}
}
}
}
}
}

if (updatePricesOnUpdateOrder) {
appAlerts.alert('info', 'Prix rechargés');
if (updatePrices) {
appAlerts.alert('info', 'Prix rechargés');
}
}
}

app.loadingUpdateProductOrder = false;
});
app.loadingUpdateProductOrder = false;
}, 'json');
}.bind(this, app), 300);
}
},
updateInvoicePrices: function () {

+ 28
- 0
console/migrations/m240704_071250_create_foreign_keys_product_accessory.php Целия файл

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

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

/**
* Class m240704_071250_create_foreign_keys_product_accessory
*/
class m240704_071250_create_foreign_keys_product_accessory extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addForeignKey('product_accessory_fk_id_product', 'product_accessory', 'id_product', 'product', 'id');
$this->addForeignKey('product_accessory_fk_id_accessory', 'product_accessory', 'id_accessory', 'accessory', 'id');
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropForeignKey('product_accessory_fk_id_product', 'product_accessory');
$this->dropForeignKey('product_accessory_fk_id_accessory', 'product_accessory');
}
}

+ 9
- 0
domain/Product/Accessory/AccessoryManager.php Целия файл

@@ -42,4 +42,13 @@ class AccessoryManager extends AbstractManager
}
}
}

public function deleteAccessory(Accessory $accessory): bool
{
foreach($accessory->getProductAccessories() as $productAccessory) {
$productAccessory->delete();
}

return $accessory->delete();
}
}

+ 1
- 1
frontend/views/site/service.php Целия файл

@@ -80,7 +80,7 @@ $this->setMeta('description', "Découvrez les fonctionnalités du logiciel, les
<?= block_feature("credit-card", "Paiement en ligne via la plateforme <strong>Stripe</strong> pour le paiement des commandes ou l'alimentation des cagnottes *"); ?>
</div>
<div class="row">
<?= block_feature("megaphone", "Communication facilitée avec les clients via l'envoi d'emails en masse"); ?>
<?= block_feature("megaphone", "Envoi d'emails en masse<br />Emails automatiques programmables pour les prises de commande *"); ?>
<?= block_feature("file-earmark-text", "Génération de bons de livraison, factures & devis"); ?>
</div>
<div class="row">

Loading…
Отказ
Запис