Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

[CI-1222]: Fix asset paths #25

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/Modules
/node_modules
/public/build/assets/
/public/build/manifest.json
/public/storage
/public/hot
/storage/*.key
Expand Down
60 changes: 39 additions & 21 deletions app/Http/Controllers/V1/Admin/Settings/CompanyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,41 +56,59 @@ public function updateCompany(CompanyRequest $request)

return new CompanyResource($company);
}
/**
* Upload the company logo to storage.
*
* @param \Crater\Http\Requests\CompanyLogoRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function uploadCompanyLogo(CompanyLogoRequest $request)
{
$company = Company::find($request->header('company'));
$this->authorize('manage company', $company);

/**
* Upload the company logo to storage.
*
* @param \Crater\Http\Requests\CompanyLogoRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function uploadCompanyLogo(CompanyLogoRequest $request)
{
$company = Company::find($request->header('company'));
$data = json_decode($request->company_logo);

$this->authorize('manage company', $company);
if (isset($request->is_company_logo_removed) && (bool) $request->is_company_logo_removed) {
$company->clearMediaCollection('logo');
}

$data = json_decode($request->company_logo);
if ($data) {
$company = Company::find($request->header('company'));

if (isset($request->is_company_logo_removed) && (bool) $request->is_company_logo_removed) {
$company->clearMediaCollection('logo');
}
if ($data) {
$company = Company::find($request->header('company'));
if ($company) {
// Extract the file extension from the filename
$fileExtension = pathinfo($data->name, PATHINFO_EXTENSION);

if ($company) {
// Define an array of allowed extensions
$allowedExtensions = ['gif', 'png', 'jpeg'];

// Check if the file extension is allowed
if (in_array($fileExtension, $allowedExtensions)) {
$company->clearMediaCollection('logo');

$company->addMediaFromBase64($data->data)
->usingFileName($data->name)
->toMediaCollection('logo');

return response()->json([
'success' => true,
]);
} else {
// File extension is not allowed
return response()->json([
'error' => 'Only .gif, .png, and .jpeg file extensions are allowed.',
], 400);
}
}

return response()->json([
'success' => true,
]);
}

return response()->json([
'success' => true,
]);
}


/**
* Upload the Admin Avatar to public storage.
*
Expand Down
3 changes: 2 additions & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@

'url' => env('APP_URL', 'http://localhost'),

'asset_url' => env('ASSET_URL'),

/*
|--------------------------------------------------------------------------
| Application Timezone
Expand Down Expand Up @@ -169,7 +171,6 @@
Crater\Providers\RouteServiceProvider::class,
Crater\Providers\DropboxServiceProvider::class,
Crater\Providers\ViewServiceProvider::class,
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
],

/*
Expand Down
32 changes: 32 additions & 0 deletions database/migrations/2023_05_25_225047_taxes_amount_as_signed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class TaxesAmountAsSigned extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('taxes', function (Blueprint $table) {
$table->bigInteger('amount')->change();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('taxes', function (Blueprint $table) {
$table->unsignedBigInteger('amount')->change();
});
}
}
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"build": "vite build --target=es2020",
"serve": "vite preview",
"test": "eslint ./resources/scripts --ext .js,.vue"
},
Expand All @@ -24,16 +24,17 @@
"sass": "^1.32.12",
"tailwind-scrollbar": "^1.3.1",
"tailwindcss": "^3.0.6",
"vite": "^2.6.1"
"vite": "^2.5"
},
"dependencies": {
"@headlessui/vue": "^1.4.0",
"@headlessui/vue": "^1.5.0",
"@heroicons/vue": "^1.0.1",
"@popperjs/core": "^2.9.2",
"@stripe/stripe-js": "^1.21.2",
"@tailwindcss/line-clamp": "^0.3.0",
"@tiptap/core": "^2.0.0-beta.85",
"@tiptap/extension-text-align": "^2.0.0-beta.29",
"@tiptap/pm": "^2.0.0-beta.220",
"@tiptap/starter-kit": "^2.0.0-beta.81",
"@tiptap/vue-3": "^2.0.0-beta.38",
"@vuelidate/components": "^1.1.12",
Expand All @@ -48,11 +49,12 @@
"mini-svg-data-uri": "^1.3.3",
"moment": "^2.29.1",
"pinia": "^2.0.4",
"v-money3": "^3.13.5",
"v-calendar": "3.0.0-alpha.8",
"v-money3": "3.16.1",
"v-tooltip": "^4.0.0-alpha.1",
"vue": "^3.2.0-beta.5",
"vue": "^3.2",
"vue-flatpickr-component": "^9.0.3",
"vue-i18n": "^9.1.7",
"vue-i18n": "9.1",
"vue-router": "^4.0.8",
"vue3-colorpicker": "^1.0.5",
"vuedraggable": "^4.1.0"
Expand Down
1 change: 0 additions & 1 deletion public/build/assets/404.e81599b7.js

This file was deleted.

1 change: 0 additions & 1 deletion public/build/assets/AccountSetting.7f3b69b7.js

This file was deleted.

1 change: 0 additions & 1 deletion public/build/assets/AddressInformation.7455dbc9.js

This file was deleted.

Loading