Browse Source

Merge branch 'develop'

master
Guillaume Bourgeois 4 months ago
parent
commit
86f2cba4d7
5 changed files with 93 additions and 45 deletions
  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 View File

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



+ 54
- 43
backend/web/js/vuejs/distribution-index.js View File

messageGenerateDeliveryNoteDisplayed: false, messageGenerateDeliveryNoteDisplayed: false,
missingSubscriptions: false, missingSubscriptions: false,
loadingUpdateProductOrder: false, loadingUpdateProductOrder: false,
timerAjaxUpdateProductOrder: null,
xhr: null,
units: [], units: [],
calendar: { calendar: {
mode: 'single', mode: 'single',
} }
return JSON.stringify(productOrderArrayRequest); return JSON.stringify(productOrderArrayRequest);
}, },
updateProductOrders: function (updatePricesOnUpdateOrder) {
updateProductOrders: function (updatePrices) {
var app = this; var app = this;
app.loadingUpdateProductOrder = true; app.loadingUpdateProductOrder = true;
var order = null; var order = null;
} }


if (order) { 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 () { updateInvoicePrices: function () {

+ 28
- 0
console/migrations/m240704_071250_create_foreign_keys_product_accessory.php View File

<?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 View File

} }
} }
} }

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

return $accessory->delete();
}
} }

+ 1
- 1
frontend/views/site/service.php View File

<?= block_feature("credit-card", "Paiement en ligne via la plateforme <strong>Stripe</strong> pour le paiement des commandes ou l'alimentation des cagnottes *"); ?> <?= 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>
<div class="row"> <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"); ?> <?= block_feature("file-earmark-text", "Génération de bons de livraison, factures & devis"); ?>
</div> </div>
<div class="row"> <div class="row">

Loading…
Cancel
Save