Skip to content

Commit

Permalink
photo edit on products
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciframa committed Dec 24, 2024
1 parent a790133 commit 208e0f1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
43 changes: 21 additions & 22 deletions Fitmo_backend/routes/api.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\CategoryController;
use App\Http\Controllers\RatingController;
use App\Http\Controllers\FonkoController;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\ProductController;
use App\Http\Controllers\PaymentTypeController;
use App\Http\Controllers\CategoryController;
use App\Http\Controllers\DeliveryTypeController;
use App\Http\Controllers\FonkoController;
use App\Http\Controllers\OrderController;
use App\Http\Controllers\PaymentTypeController;
use App\Http\Controllers\ProductController;
use App\Http\Controllers\RatingController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -58,28 +57,28 @@
Route::post('/register', [AuthController::class, 'register']);

Route::prefix('/category')->group(function () {
Route::post('/store', [CategoryController::class, 'store']);
Route::delete('/{id}', [CategoryController::class, 'delete']);
Route::post('/{id}', [CategoryController::class, 'update']);
Route::post('/store', [CategoryController::class, 'store']);
Route::delete('/{id}', [CategoryController::class, 'delete']);
Route::post('/{id}', [CategoryController::class, 'update']);
});
Route::prefix('/product')->group(function () {
Route::post('/store', [ProductController::class, 'store']);
Route::delete('/{id}', [ProductController::class, 'delete']);
Route::put('/{id}', [ProductController::class, 'update']);
Route::put('/{id}/hide', [ProductController::class, 'hideProduct']);
Route::post('/{id}/template/store', [ProductController::class, 'storeTemplate']);
Route::get('{id}/getTemplates/', [ProductController::class, 'getTemplates']);
Route::delete('{id}/template/{templateId}', [ProductController::class, 'deleteTemplate']);

Route::get('/{product_url_name}', [ProductController::class, 'getSingleProduct']);
Route::post('/store', [ProductController::class, 'store']);
Route::delete('/{id}', [ProductController::class, 'delete']);
Route::post('/{id}', [ProductController::class, 'update']);
Route::put('/{id}/hide', [ProductController::class, 'hideProduct']);
Route::post('/{id}/template/store', [ProductController::class, 'storeTemplate']);
Route::get('{id}/getTemplates/', [ProductController::class, 'getTemplates']);
Route::delete('{id}/template/{templateId}', [ProductController::class, 'deleteTemplate']);

Route::get('/{product_url_name}', [ProductController::class, 'getSingleProduct']);
});

Route::get('/orders', [OrderController::class, 'index']);

Route::prefix('/order')->group(function () {
Route::post('/store', [OrderController::class, 'store']);
Route::get('/{id}', [OrderController::class, 'getOrderById']);
Route::post('/updateStates', [OrderController::class, 'updateState']);
Route::post('/store', [OrderController::class, 'store']);
Route::get('/{id}', [OrderController::class, 'getOrderById']);
Route::post('/updateStates', [OrderController::class, 'updateState']);
});


Expand Down
13 changes: 7 additions & 6 deletions Fitmo_frontend/src/views/admin/ProductEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ export default {
categoriesSelects: [],
categories: [],
fileCropping: false,
isNewProduct: {},
groupedCategories: [],
imagesBasePath: `https://be.fitmo.cz/products/`,
// imagesBasePath: `http://localhost:8000/products/`,
Expand All @@ -476,10 +475,6 @@ export default {
return JSON.parse(sessionStorage.getItem("user"));
},
addPhoto2(event) {
if (!this.product.isNewProduct) {
this.product.isNewProduct = new FormData();
}
const uploadedFile = event.target.files[0]; // Get the selected file
if (uploadedFile) {
var reader = new FileReader();
Expand Down Expand Up @@ -529,6 +524,7 @@ export default {
image_path: imageName,
tentativePath: this.imageReview,
isMain: false,
state: "added",
};
this.product?.photos?.push(newProduct);
}, "image/png");
Expand Down Expand Up @@ -735,7 +731,12 @@ export default {
},
async editProduct() {
await axios
.put("/api/product/" + this.product.id, this.product)
.post("/api/product/" + this.product.id, this.product, {
headers: {
// Authorization: this.tokenData.data.token,
"Content-Type": "multipart/form-data",
},
})
.then((response) => {
if (response.status == 200) {
this.$snackbar.add({
Expand Down

0 comments on commit 208e0f1

Please sign in to comment.