Add Ladill POS v1 — register, Pay checkout, and commerce links.
Deploy Ladill Mini / deploy (push) Successful in 23s
Deploy Ladill Mini / deploy (push) Successful in 23s
Staff-facing counter register at pos.ladill.com with catalog cart, cash and MoMo/card checkout via Ladill Pay, CRM timeline/import, invoice prefill, and Merchant catalog import. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Pos;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Pos\Concerns\ScopesToAccount;
|
||||
use App\Services\Import\CrmProductImportService;
|
||||
use App\Services\Import\MerchantCatalogImportService;
|
||||
use App\Services\Pos\PosLocationService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
use RuntimeException;
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
use ScopesToAccount;
|
||||
|
||||
public function __construct(private PosLocationService $locations) {}
|
||||
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$location = $this->locations->ensureDefault($this->ownerRef($request));
|
||||
|
||||
return view('pos.settings', [
|
||||
'location' => $location,
|
||||
'merchantImportEnabled' => (bool) config('pos.merchant_import_enabled', true),
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(Request $request): RedirectResponse
|
||||
{
|
||||
$data = $request->validate([
|
||||
'name' => ['required', 'string', 'max:120'],
|
||||
'currency' => ['required', 'string', 'size:3'],
|
||||
'receipt_footer' => ['nullable', 'string', 'max:1000'],
|
||||
]);
|
||||
|
||||
$location = $this->locations->ensureDefault($this->ownerRef($request));
|
||||
$location->update([
|
||||
'name' => $data['name'],
|
||||
'currency' => strtoupper($data['currency']),
|
||||
'receipt_footer' => $data['receipt_footer'] ?? null,
|
||||
]);
|
||||
|
||||
return back()->with('success', 'Settings saved.');
|
||||
}
|
||||
|
||||
public function importCrm(Request $request, CrmProductImportService $import): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$result = $import->import($this->ownerRef($request));
|
||||
|
||||
return back()->with('success', "Imported {$result['imported']} product(s), updated {$result['updated']}.");
|
||||
} catch (RuntimeException $e) {
|
||||
return back()->with('error', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function importMerchant(Request $request, MerchantCatalogImportService $import): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$result = $import->import($this->ownerRef($request));
|
||||
|
||||
return back()->with('success', "Imported {$result['imported']} item(s) from {$result['storefronts']} storefront(s), updated {$result['updated']}.");
|
||||
} catch (RuntimeException $e) {
|
||||
return back()->with('error', $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user