fix some bugs
This commit is contained in:
@@ -117,6 +117,8 @@ class ProductController extends SuperController
|
|||||||
$data = $this->filterProductData($request->all());
|
$data = $this->filterProductData($request->all());
|
||||||
|
|
||||||
$product = Product::create($data);
|
$product = Product::create($data);
|
||||||
|
$this->broadcastPricesAfterResponse(true);
|
||||||
|
|
||||||
return $this->resultCreate($product->id);
|
return $this->resultCreate($product->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,6 +174,7 @@ class ProductController extends SuperController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$product->update($data);
|
$product->update($data);
|
||||||
|
$this->broadcastPricesAfterResponse(true);
|
||||||
|
|
||||||
return response()->json(true);
|
return response()->json(true);
|
||||||
}
|
}
|
||||||
@@ -497,10 +500,10 @@ class ProductController extends SuperController
|
|||||||
return response()->json(['message' => 'نمایش محصولات طبق ساعات بهروز شد.']);
|
return response()->json(['message' => 'نمایش محصولات طبق ساعات بهروز شد.']);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function broadcastPricesAfterResponse(): void
|
private function broadcastPricesAfterResponse(bool $force = false): void
|
||||||
{
|
{
|
||||||
dispatch(function () {
|
dispatch(function () use ($force) {
|
||||||
app(PriceBroadcastService::class)->broadcastAfterPriceUpdate();
|
app(PriceBroadcastService::class)->broadcastAfterPriceUpdate(null, $force);
|
||||||
})->afterResponse();
|
})->afterResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1180,7 +1180,7 @@ class SingleOrderController extends Controller
|
|||||||
{
|
{
|
||||||
$display = app(ProductDisplayPriceService::class);
|
$display = app(ProductDisplayPriceService::class);
|
||||||
|
|
||||||
if ($display->usesFlaggedAppPrice($product)) {
|
if ($display->usesAppPrice($product)) {
|
||||||
return (int) round($display->resolveOrderBasePrice($product));
|
return (int) round($display->resolveOrderBasePrice($product));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -176,6 +176,12 @@ class PriceBroadcastService
|
|||||||
'id' => (int) ($product['id'] ?? 0),
|
'id' => (int) ($product['id'] ?? 0),
|
||||||
'price' => (int) ($product['price'] ?? 0),
|
'price' => (int) ($product['price'] ?? 0),
|
||||||
'price_profit' => (int) ($product['price_profit'] ?? 0),
|
'price_profit' => (int) ($product['price_profit'] ?? 0),
|
||||||
|
'amount' => (float) ($product['amount'] ?? 0),
|
||||||
|
'app_price' => (bool) ($product['app_price'] ?? false),
|
||||||
|
'trade_by_quantity' => (bool) ($product['trade_by_quantity'] ?? false),
|
||||||
|
'direct_price' => (int) ($product['direct_price'] ?? 0),
|
||||||
|
'reading_method' => (string) ($product['reading_method'] ?? ''),
|
||||||
|
'price_offset_percent' => (float) ($product['price_offset_percent'] ?? 0),
|
||||||
'show' => (bool) ($product['show'] ?? true),
|
'show' => (bool) ($product['show'] ?? true),
|
||||||
'active' => (bool) ($product['active'] ?? true),
|
'active' => (bool) ($product['active'] ?? true),
|
||||||
'reference_provider_active' => (bool) ($product['reference_provider_active'] ?? false),
|
'reference_provider_active' => (bool) ($product['reference_provider_active'] ?? false),
|
||||||
|
|||||||
Reference in New Issue
Block a user