Add settings page pinned to sidebar footer like other Ladill apps.
Deploy Ladill Woo Manager / deploy (push) Successful in 38s
Deploy Ladill Woo Manager / deploy (push) Successful in 38s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Woo;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class SettingsController extends Controller
|
||||||
|
{
|
||||||
|
public function edit(): View
|
||||||
|
{
|
||||||
|
return view('woo.settings');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,4 +26,14 @@
|
|||||||
</a>
|
</a>
|
||||||
@endforeach
|
@endforeach
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<div class="shrink-0 border-t border-slate-200 px-3 py-3">
|
||||||
|
<a href="{{ route('woo.settings') }}"
|
||||||
|
class="group flex items-center gap-3 rounded-lg px-3 py-2 text-[13px] transition {{ request()->routeIs('woo.settings') ? 'bg-indigo-50 text-indigo-700 font-semibold' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900' }}">
|
||||||
|
<svg class="h-[18px] w-[18px] shrink-0 {{ request()->routeIs('woo.settings') ? 'text-indigo-600' : 'text-slate-400' }}" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.241.437-.613.43-.992a7.723 7.723 0 0 1 0-.255c.007-.378-.138-.75-.43-.991l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
|
||||||
|
</svg>
|
||||||
|
<span>Settings</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<x-user-layout>
|
||||||
|
<x-slot name="title">Settings</x-slot>
|
||||||
|
|
||||||
|
<x-settings.page description="Account links and preferences for Woo Manager.">
|
||||||
|
<x-settings.card title="Stores & sync">
|
||||||
|
<p class="text-sm text-slate-600">Connect WooCommerce stores from the WordPress plugin, then manage them here.</p>
|
||||||
|
<a href="{{ route('woo.stores.index') }}"
|
||||||
|
class="mt-4 inline-flex items-center gap-2 text-sm font-medium text-indigo-600 hover:text-indigo-800">
|
||||||
|
Manage connected stores
|
||||||
|
<span aria-hidden="true">→</span>
|
||||||
|
</a>
|
||||||
|
</x-settings.card>
|
||||||
|
|
||||||
|
<x-settings.card title="Account">
|
||||||
|
<ul class="space-y-3">
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('woo.wallet') }}"
|
||||||
|
class="flex items-center justify-between rounded-xl border border-slate-100 bg-slate-50 px-4 py-3 text-sm text-slate-700 hover:text-indigo-700">
|
||||||
|
<span>Wallet & payouts</span>
|
||||||
|
<span class="text-slate-400">→</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('account.team') }}"
|
||||||
|
class="flex items-center justify-between rounded-xl border border-slate-100 bg-slate-50 px-4 py-3 text-sm text-slate-700 hover:text-indigo-700">
|
||||||
|
<span>Team & access</span>
|
||||||
|
<span class="text-slate-400">→</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ ladill_account_url('account-settings') }}"
|
||||||
|
class="flex items-center justify-between rounded-xl border border-slate-100 bg-slate-50 px-4 py-3 text-sm text-slate-700 hover:text-indigo-700">
|
||||||
|
<span>Account settings</span>
|
||||||
|
<span class="text-slate-400">→</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</x-settings.card>
|
||||||
|
|
||||||
|
<x-settings.card title="Sign out">
|
||||||
|
<form method="POST" action="{{ route('logout') }}">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="text-sm font-medium text-red-600 hover:text-red-800">Sign out</button>
|
||||||
|
</form>
|
||||||
|
</x-settings.card>
|
||||||
|
</x-settings.page>
|
||||||
|
</x-user-layout>
|
||||||
@@ -9,6 +9,7 @@ use App\Http\Controllers\Woo\ConnectWordPressController;
|
|||||||
use App\Http\Controllers\Woo\DashboardController;
|
use App\Http\Controllers\Woo\DashboardController;
|
||||||
use App\Http\Controllers\Woo\OrderController;
|
use App\Http\Controllers\Woo\OrderController;
|
||||||
use App\Http\Controllers\Woo\ProductController;
|
use App\Http\Controllers\Woo\ProductController;
|
||||||
|
use App\Http\Controllers\Woo\SettingsController;
|
||||||
use App\Http\Controllers\Woo\StoreController;
|
use App\Http\Controllers\Woo\StoreController;
|
||||||
use App\Http\Controllers\WooWebhookController;
|
use App\Http\Controllers\WooWebhookController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
@@ -56,6 +57,7 @@ Route::middleware(['auth', 'platform.session'])->group(function () {
|
|||||||
Route::post('/categories/sync', [CategoryController::class, 'sync'])->name('woo.categories.sync');
|
Route::post('/categories/sync', [CategoryController::class, 'sync'])->name('woo.categories.sync');
|
||||||
Route::get('/stores', [StoreController::class, 'index'])->name('woo.stores.index');
|
Route::get('/stores', [StoreController::class, 'index'])->name('woo.stores.index');
|
||||||
Route::delete('/stores/{store}', [StoreController::class, 'destroy'])->name('woo.stores.destroy');
|
Route::delete('/stores/{store}', [StoreController::class, 'destroy'])->name('woo.stores.destroy');
|
||||||
|
Route::get('/settings', [SettingsController::class, 'edit'])->name('woo.settings');
|
||||||
|
|
||||||
Route::get('/wallet', fn () => redirect()->away(ladill_account_url('/wallet')))->name('woo.wallet');
|
Route::get('/wallet', fn () => redirect()->away(ladill_account_url('/wallet')))->name('woo.wallet');
|
||||||
Route::get('/team', fn () => redirect()->away(ladill_account_url('/account/team')))->name('account.team');
|
Route::get('/team', fn () => redirect()->away(ladill_account_url('/account/team')))->name('account.team');
|
||||||
|
|||||||
@@ -219,6 +219,17 @@ class WooWebTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_authenticated_user_can_view_settings(): void
|
||||||
|
{
|
||||||
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
$this->actingAs($user)
|
||||||
|
->get(route('woo.settings'))
|
||||||
|
->assertOk()
|
||||||
|
->assertSee('Settings')
|
||||||
|
->assertSee('Manage connected stores');
|
||||||
|
}
|
||||||
|
|
||||||
public function test_merchant_can_view_products_page(): void
|
public function test_merchant_can_view_products_page(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|||||||
Reference in New Issue
Block a user