EV3-377 Egy ternék belistázása
This commit is contained in:
parent
29a534757a
commit
7bcabca031
@ -85,9 +85,32 @@ public function index(): View
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create(): Response|JsonResponse
|
||||
public function create(Request $request): View
|
||||
{
|
||||
return response()->noContent();
|
||||
$supplierId = $request->integer('supplierId');
|
||||
|
||||
$ProductGroup = new \App\Models\ProductGroup;
|
||||
$productGroupArray = $ProductGroup->allWithParents(3);
|
||||
|
||||
$Product = new Product();
|
||||
$Product->supplier_id = $supplierId;
|
||||
$Product->setAttribute('price', 0);
|
||||
$supplier = Supplier::find($supplierId);
|
||||
$Product->setRelation('Supplier', $supplier);
|
||||
$Product->setRelation('supplier', $supplier);
|
||||
|
||||
$Producer = [];
|
||||
foreach (Producer::orderBy('name')->get() as $producer) {
|
||||
$Producer[] = ['id' => $producer->id, 'name' => $producer->name];
|
||||
}
|
||||
|
||||
return view('admin.product.edit')->with([
|
||||
'Product' => $Product,
|
||||
'productGroup' => $productGroupArray,
|
||||
'productUnit' => BasicUnitEnum::getValues(),
|
||||
'sellerUnit' => ProductUnitEnum::getValues(),
|
||||
'producer' => $Producer,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -95,10 +118,41 @@ public function create(): Response|JsonResponse
|
||||
*/
|
||||
public function store(Request $request): Response|JsonResponse
|
||||
{
|
||||
$ret = ['status' => 'ok', 'message' => 'Product save successfully!'];
|
||||
$validated = $request->validate($this->productValidationRules());
|
||||
$validated = $this->transformValidated($validated);
|
||||
|
||||
return \response()->json($ret);
|
||||
// return \response(json_encode(['status'=>'ok','message'=>'Product save successfully!']),200);
|
||||
$price = $validated['price'];
|
||||
unset($validated['price']);
|
||||
|
||||
$productId = $this->service->add($validated);
|
||||
|
||||
if (! $productId) {
|
||||
return \response()->json([
|
||||
'success' => false,
|
||||
'errors' => ['create' => 'Nem sikerült a termék létrehozása!'],
|
||||
])->setStatusCode(422);
|
||||
}
|
||||
|
||||
$supplierId = $validated['supplier_id'];
|
||||
$today = \Carbon\Carbon::today()->format('Y-m-d');
|
||||
|
||||
$priceList = \App\Models\PriceList::where('supplier_id', $supplierId)
|
||||
->where('available', '<=', $today)
|
||||
->whereNull('deleted_at')
|
||||
->orderBy('available', 'desc')
|
||||
->orderBy('id', 'asc')
|
||||
->first();
|
||||
|
||||
if ($priceList) {
|
||||
$priceList->products()->attach($productId, ['price' => $price]);
|
||||
}
|
||||
|
||||
return \response()->json([
|
||||
'status' => 'ok',
|
||||
'message' => 'Product created successfully!',
|
||||
'success' => true,
|
||||
'id' => $productId,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -170,44 +224,12 @@ public function edit(int $ProductId): View
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
*/
|
||||
public function update(Request $request, int $ProductId): Response|JsonResponse
|
||||
{
|
||||
// $Product=Product::with(['Supplier','Producer','ProductGroup','picture','specification'])->find($ProductId);
|
||||
// dd($request->all(),$ProductId);
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'supplierId' => 'required|integer|exists:suppliers,id',
|
||||
'producer' => 'required|exists:producers,id',
|
||||
'packaging' => 'required|numeric|min:0',
|
||||
'unitValue' => 'required|numeric|min:0',
|
||||
'productUnit' => 'required|string|in:'.implode(',', BasicUnitEnum::getValues()),
|
||||
'sellerUnit' => 'required|string|in:'.implode(',', ProductUnitEnum::getValues()),
|
||||
'unitMultiplier' => 'required|numeric|min:0',
|
||||
'amountUnit' => 'required|string|in:'.implode(',', ProductUnitEnum::getValues()),
|
||||
'vat' => 'required|numeric|min:0',
|
||||
'supplierProductNumber' => 'nullable|string|max:255',
|
||||
'buyerProductName'=>'required|string|max:255',
|
||||
'productGroup' => 'required|exists:product_groups,id',
|
||||
'hooreycaId' => 'nullable|string|max:255',
|
||||
'HooreycaUnit' => 'nullable|string|max:255',
|
||||
'HooreycaMultiplier' => 'nullable|numeric|min:0',
|
||||
'note' => 'nullable|string',
|
||||
'canSee' => 'boolean',
|
||||
'krel' => 'boolean',
|
||||
'specialOffer' => 'boolean',
|
||||
'price' => 'required|numeric|min:0',
|
||||
]);
|
||||
// $request->merge(['canSee'=>$request->has('canSee')]);
|
||||
// $request->merge(['krel'=>$request->has('krel')]);
|
||||
// $request->merge(['specialOffer'=>$request->has('specialOffer')]);
|
||||
$validated['producer_id'] = $validated['producer'][0];
|
||||
unset($validated['producer']);
|
||||
$validated['product_group_id'] = $validated['productGroup'][0];
|
||||
unset($validated['productGroup']);
|
||||
$validated['note'] = str_replace("\r\n", "\n", $validated['note']);
|
||||
// dd($validated,$request->all());
|
||||
$validated = $request->validate($this->productValidationRules());
|
||||
$validated = $this->transformValidated($validated);
|
||||
|
||||
$ret = [];
|
||||
if (! $this->service->update($ProductId, $validated)) {
|
||||
if ($this->service->hasError()) {
|
||||
@ -239,6 +261,52 @@ public function update(Request $request, int $ProductId): Response|JsonResponse
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function productValidationRules(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'supplierId' => 'required|integer|exists:suppliers,id',
|
||||
'producer' => 'required|exists:producers,id',
|
||||
'packaging' => 'required|numeric|min:0',
|
||||
'unitValue' => 'required|numeric|min:0',
|
||||
'productUnit' => 'required|string|in:'.implode(',', BasicUnitEnum::getValues()),
|
||||
'sellerUnit' => 'required|string|in:'.implode(',', ProductUnitEnum::getValues()),
|
||||
'unitMultiplier' => 'required|numeric|min:0',
|
||||
'amountUnit' => 'required|string|in:'.implode(',', ProductUnitEnum::getValues()),
|
||||
'vat' => 'required|numeric|min:0',
|
||||
'supplierProductNumber' => 'nullable|string|max:255',
|
||||
'buyerProductName' => 'nullable|string|max:255',
|
||||
'productGroup' => 'required|exists:product_groups,id',
|
||||
'hooreycaId' => 'nullable|string|max:255',
|
||||
'HooreycaUnit' => 'nullable|string|max:255',
|
||||
'HooreycaMultiplier' => 'nullable|numeric|min:0',
|
||||
'note' => 'nullable|string',
|
||||
'canSee' => 'boolean',
|
||||
'krel' => 'boolean',
|
||||
'specialOffer' => 'boolean',
|
||||
'price' => 'required|numeric|min:0',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $validated
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
protected function transformValidated(array $validated): array
|
||||
{
|
||||
$validated['producer_id'] = $validated['producer'][0];
|
||||
$validated['product_group_id'] = $validated['productGroup'][0];
|
||||
$validated['supplier_id'] = $validated['supplierId'];
|
||||
$validated['packing'] = $validated['packaging'];
|
||||
unset($validated['producer'], $validated['productGroup'], $validated['supplierId'], $validated['packaging']);
|
||||
$validated['note'] = str_replace("\r\n", "\n", $validated['note'] ?? '');
|
||||
|
||||
return $validated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,8 +1,8 @@
|
||||
{
|
||||
"/js/app.js": "/js/app.js?id=9656e746371b15d28c4e4f8f816f8fc1",
|
||||
"/js/app.js.map": "/js/app.js.map?id=5e840a79ad0112917eec1908319f0c8e",
|
||||
"/js/admin.js": "/js/admin.js?id=cd52a43f6016a6d671a1c0719e1386c3",
|
||||
"/js/admin.js.map": "/js/admin.js.map?id=9c2a1d66ed94420158282276be1df958",
|
||||
"/js/admin.js": "/js/admin.js?id=484795f7b608d4df52022e48d85b7d27",
|
||||
"/js/admin.js.map": "/js/admin.js.map?id=f9e92457c9affea79c7c6a0e8b8a09d4",
|
||||
"/js/module.js": "/js/module.js?id=378a05902533f9964348d11f3598ebe7",
|
||||
"/js/module.js.map": "/js/module.js.map?id=5280840a9916b3c3f516286796bdeb49",
|
||||
"/js/components.js": "/js/components.js?id=aac1b5221c918d1afb98a34e79620cde",
|
||||
@ -10,20 +10,6 @@
|
||||
"/css/app.css": "/css/app.css?id=56d48ae2ee54edb4fc49a67b8f0115c5",
|
||||
"/fonts/vendor/bootstrap-icons/bootstrap-icons.woff2?92ea18a81d737146ff044ddb52010366": "/fonts/vendor/bootstrap-icons/bootstrap-icons.woff2?92ea18a81d737146ff044ddb52010366?id=9ad5aa740d7d5e6a0191b309b9b1986c",
|
||||
"/fonts/vendor/bootstrap-icons/bootstrap-icons.woff?1295669cd4e305c97f2cfc16d56614b8": "/fonts/vendor/bootstrap-icons/bootstrap-icons.woff?1295669cd4e305c97f2cfc16d56614b8?id=d1af9af6052c51b169be6c628ae99bb5",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_10_eceadf_60x60.png?fcf8539b586ee18bcdea1755486148fb": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_10_eceadf_60x60.png?fcf8539b586ee18bcdea1755486148fb?id=7296ac90a70836a72af140e0346fc932",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_15_ffffff_60x60.png?c514e7ba7589d0f49ac63c298fcdae5e": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_15_ffffff_60x60.png?c514e7ba7589d0f49ac63c298fcdae5e?id=3c8a4c2c86890f38eb35a7a4f17108ac",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_10_f8f7f6_60x60.png?2999b2509cfc0da9d2638ce9f892d541": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_10_f8f7f6_60x60.png?2999b2509cfc0da9d2638ce9f892d541?id=42fbd9c28ff43250024032714111e992",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_65_654b24_60x60.png?6a53536235d962916651e5ade810be9c": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_65_654b24_60x60.png?6a53536235d962916651e5ade810be9c?id=0351aa2b5ee6d5c4a7e2eea67afd9a94",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_15_eceadf_60x60.png?bb99362eb46ac5b5824fabbfe6271e29": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_15_eceadf_60x60.png?bb99362eb46ac5b5824fabbfe6271e29?id=396642d988742f9ee3b73d239a417f59",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_15_f7f3de_60x60.png?9d1facfcb89e21b78242e2eb8cbd491c": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_15_f7f3de_60x60.png?9d1facfcb89e21b78242e2eb8cbd491c?id=425506cc6819db6ad5b01352df235653",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_68_b83400_60x60.png?f786ff5070a9c8cde4f9b567fc84e004": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_68_b83400_60x60.png?f786ff5070a9c8cde4f9b567fc84e004?id=98eb208ad7450212818f3a70f09729d6",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_222222_256x240.png?bcf1cdc9c7d1486173cc9aaa8b1fc77b": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_222222_256x240.png?bcf1cdc9c7d1486173cc9aaa8b1fc77b?id=5eb1d32635db28ba94d9d35ab363c70e",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_b83400_256x240.png?f481d1b47a462e74eed1e20ae7ac7824": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_b83400_256x240.png?f481d1b47a462e74eed1e20ae7ac7824?id=9ac73e8431d4dda3af9e6eb6d29f88ea",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_ffffff_256x240.png?fc616163e14c52dba5af7fdb573d2e64": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_ffffff_256x240.png?fc616163e14c52dba5af7fdb573d2e64?id=c0ac47f58e9e9e4b679101073a3f010a",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_8c291d_256x240.png?faf8dac1c3a19fa71b3349936071548b": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_8c291d_256x240.png?faf8dac1c3a19fa71b3349936071548b?id=732d736a3d70c5279a5ce1b837da69d1",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_3572ac_256x240.png?6b15e6e5507d972be2e15634d0f7bc82": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_3572ac_256x240.png?6b15e6e5507d972be2e15634d0f7bc82?id=beeb872e16251574c55cf3627f9978e1",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_fbdb93_256x240.png?aca518e5efefaf76c067ffb0e2438334": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_fbdb93_256x240.png?aca518e5efefaf76c067ffb0e2438334?id=f5de1bb077a39c0d29d38e6dccaecf4b",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_diagonal-maze_20_6e4f1c_10x10.png?bde4cdb5c33f6a9c1c25419a4732ad98": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_diagonal-maze_20_6e4f1c_10x10.png?bde4cdb5c33f6a9c1c25419a4732ad98?id=bff005db4cfc39e962fdd98eb8a0ef33",
|
||||
"/fonts/vendor/@fortawesome/fontawesome-free/webfa-brands-400.eot?23f19bb08961f37aaf692ff943823453": "/fonts/vendor/@fortawesome/fontawesome-free/webfa-brands-400.eot?23f19bb08961f37aaf692ff943823453?id=0868992b7c56298026b76b22c534eab9",
|
||||
"/fonts/vendor/@fortawesome/fontawesome-free/webfa-brands-400.woff2?d878b0a6a1144760244ff0665888404c": "/fonts/vendor/@fortawesome/fontawesome-free/webfa-brands-400.woff2?d878b0a6a1144760244ff0665888404c?id=4ec8652aef2ce3e636bf32c24dd5ce86",
|
||||
"/fonts/vendor/@fortawesome/fontawesome-free/webfa-brands-400.woff?2285773e6b4b172f07d9b777c81b0775": "/fonts/vendor/@fortawesome/fontawesome-free/webfa-brands-400.woff?2285773e6b4b172f07d9b777c81b0775?id=66ea863732752673548b3b6537b6465b",
|
||||
@ -39,6 +25,20 @@
|
||||
"/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.woff?eeccf4f66002c6f2ba24d3d22f2434c2": "/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.woff?eeccf4f66002c6f2ba24d3d22f2434c2?id=26f963f67e793d91cc76426d43836849",
|
||||
"/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.ttf?be9ee23c0c6390141475d519c2c5fb8f": "/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.ttf?be9ee23c0c6390141475d519c2c5fb8f?id=d44877cb1fa07af67d56e4d86d39dd96",
|
||||
"/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.svg?7a8b4f130182d19a2d7c67d80c090397": "/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.svg?7a8b4f130182d19a2d7c67d80c090397?id=37bc7099f6f1ba80236164f22e905837",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_10_eceadf_60x60.png?fcf8539b586ee18bcdea1755486148fb": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_10_eceadf_60x60.png?fcf8539b586ee18bcdea1755486148fb?id=7296ac90a70836a72af140e0346fc932",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_15_ffffff_60x60.png?c514e7ba7589d0f49ac63c298fcdae5e": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_15_ffffff_60x60.png?c514e7ba7589d0f49ac63c298fcdae5e?id=3c8a4c2c86890f38eb35a7a4f17108ac",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_10_f8f7f6_60x60.png?2999b2509cfc0da9d2638ce9f892d541": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_10_f8f7f6_60x60.png?2999b2509cfc0da9d2638ce9f892d541?id=42fbd9c28ff43250024032714111e992",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_65_654b24_60x60.png?6a53536235d962916651e5ade810be9c": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_65_654b24_60x60.png?6a53536235d962916651e5ade810be9c?id=0351aa2b5ee6d5c4a7e2eea67afd9a94",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_15_eceadf_60x60.png?bb99362eb46ac5b5824fabbfe6271e29": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_15_eceadf_60x60.png?bb99362eb46ac5b5824fabbfe6271e29?id=396642d988742f9ee3b73d239a417f59",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_15_f7f3de_60x60.png?9d1facfcb89e21b78242e2eb8cbd491c": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_15_f7f3de_60x60.png?9d1facfcb89e21b78242e2eb8cbd491c?id=425506cc6819db6ad5b01352df235653",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_68_b83400_60x60.png?f786ff5070a9c8cde4f9b567fc84e004": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_fine-grain_68_b83400_60x60.png?f786ff5070a9c8cde4f9b567fc84e004?id=98eb208ad7450212818f3a70f09729d6",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_222222_256x240.png?bcf1cdc9c7d1486173cc9aaa8b1fc77b": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_222222_256x240.png?bcf1cdc9c7d1486173cc9aaa8b1fc77b?id=5eb1d32635db28ba94d9d35ab363c70e",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_b83400_256x240.png?f481d1b47a462e74eed1e20ae7ac7824": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_b83400_256x240.png?f481d1b47a462e74eed1e20ae7ac7824?id=9ac73e8431d4dda3af9e6eb6d29f88ea",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_ffffff_256x240.png?fc616163e14c52dba5af7fdb573d2e64": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_ffffff_256x240.png?fc616163e14c52dba5af7fdb573d2e64?id=c0ac47f58e9e9e4b679101073a3f010a",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_8c291d_256x240.png?faf8dac1c3a19fa71b3349936071548b": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_8c291d_256x240.png?faf8dac1c3a19fa71b3349936071548b?id=732d736a3d70c5279a5ce1b837da69d1",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_3572ac_256x240.png?6b15e6e5507d972be2e15634d0f7bc82": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_3572ac_256x240.png?6b15e6e5507d972be2e15634d0f7bc82?id=beeb872e16251574c55cf3627f9978e1",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_fbdb93_256x240.png?aca518e5efefaf76c067ffb0e2438334": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-icons_fbdb93_256x240.png?aca518e5efefaf76c067ffb0e2438334?id=f5de1bb077a39c0d29d38e6dccaecf4b",
|
||||
"/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_diagonal-maze_20_6e4f1c_10x10.png?bde4cdb5c33f6a9c1c25419a4732ad98": "/images/vendor/jquery-ui-themes/themes/pepper-grinder/ui-bg_diagonal-maze_20_6e4f1c_10x10.png?bde4cdb5c33f6a9c1c25419a4732ad98?id=bff005db4cfc39e962fdd98eb8a0ef33",
|
||||
"/images/vendor/jquery-ui/themes/base/ui-icons_444444_256x240.png?d1b818587c3bc65058fe43800e4a191c": "/images/vendor/jquery-ui/themes/base/ui-icons_444444_256x240.png?d1b818587c3bc65058fe43800e4a191c?id=bed10eb948aa66a924e32f2022f0b7c1",
|
||||
"/images/vendor/jquery-ui/themes/base/ui-icons_555555_256x240.png?35d57320d9df28ec0d0d8bd1b5c75983": "/images/vendor/jquery-ui/themes/base/ui-icons_555555_256x240.png?35d57320d9df28ec0d0d8bd1b5c75983?id=d927e3a7feaea813b9bd0fd242e90de2",
|
||||
"/images/vendor/jquery-ui/themes/base/ui-icons_ffffff_256x240.png?92bef7e45fed3caba8dc9348edef4df2": "/images/vendor/jquery-ui/themes/base/ui-icons_ffffff_256x240.png?92bef7e45fed3caba8dc9348edef4df2?id=1e1f6219e7b6c134d1955b8db1907af5",
|
||||
|
||||
@ -200,6 +200,13 @@ window.ProductAdmin=function (options,ProductItem) {
|
||||
root.loadingResultContainer();
|
||||
root.requestProducts();
|
||||
});
|
||||
|
||||
let newProductButton=root.container.find('#NewProductButton');
|
||||
newProductButton.off('click');
|
||||
newProductButton.on('click',function (){
|
||||
root.newProduct();
|
||||
});
|
||||
|
||||
root.setVisibleFilters('Product');
|
||||
|
||||
if (root.loadFiltersFromLocalStorage()) {
|
||||
@ -543,6 +550,21 @@ window.ProductAdmin=function (options,ProductItem) {
|
||||
|
||||
}
|
||||
|
||||
this.newProduct=function () {
|
||||
let selectedSuppliers=root.container.find('select.supplierSelect').val();
|
||||
if (!selectedSuppliers || selectedSuppliers.length === 0) {
|
||||
Toast.create({ title: "Hiányzó beszállító!", message: "Kérjük válasszon ki pontosan 1 beszállítót az új termék létrehozásához!", status: TOAST_STATUS.DANGER, timeout: 5000 });
|
||||
return;
|
||||
}
|
||||
if (selectedSuppliers.length > 1) {
|
||||
Toast.create({ title: "Túl sok beszállító!", message: "Kérjük pontosan 1 beszállítót válasszon ki (jelenleg " + selectedSuppliers.length + " van kiválasztva)!", status: TOAST_STATUS.DANGER, timeout: 5000 });
|
||||
return;
|
||||
}
|
||||
let supplierId = selectedSuppliers[0];
|
||||
let createUrl = Opts.URL.create + '?supplierId=' + supplierId;
|
||||
APP.loadMainContent(createUrl, root.initViewDetails);
|
||||
}
|
||||
|
||||
this.clickSaveButton=function (event) {
|
||||
debug('Save clicked');
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<label for="productSupplierName" class="col-sm-2 col-form-label">Beszálllító néve:</label>
|
||||
<div class="col-sm-10">
|
||||
<span class="font-weight-bold">{{$Product->supplier->name}}</span>
|
||||
<input type="hidden" name="supplierId" value="12">
|
||||
<input type="hidden" name="supplierId" value="{{$Product->supplier_id}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -72,7 +72,7 @@
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" >Eladási Egység:</span>
|
||||
</div>
|
||||
<select class="productUnit" style="width: 5em; height: 2em;" name="sellerUnit">
|
||||
<select class="productUnit" name="sellerUnit" style="width: 8em;">
|
||||
@foreach($sellerUnit as $unitName)
|
||||
<option value="{{$unitName}}"
|
||||
@if ($unitName==$Product->sellerUnit)
|
||||
@ -80,7 +80,6 @@
|
||||
@endif
|
||||
>{{$unitName}}</option>
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" >Egységszorzó.</span>
|
||||
@ -89,7 +88,15 @@
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" >MennyiségiEgység.</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" placeholder="" name="amountUnit" value="{{$Product->amountUnit}}">
|
||||
<select class="productUnit" name="amountUnit" style="width: 8em;">
|
||||
@foreach($sellerUnit as $unitName)
|
||||
<option value="{{$unitName}}"
|
||||
@if ($unitName==$Product->amountUnit)
|
||||
selected
|
||||
@endif
|
||||
>{{$unitName}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@ -26,8 +26,9 @@
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-10">
|
||||
<div class="col-12 d-flex justify-content-between">
|
||||
<button type="button" class="btn btn-success FormSendButton" inputmode="text" value="">Lekérdezés inditása</button>
|
||||
<button type="button" class="btn btn-primary" id="NewProductButton">Új termék</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user