Add multi-branch POS with team roles and branch-scoped cashiers.
Deploy Ladill POS / deploy (push) Successful in 1m58s
Deploy Ladill POS / deploy (push) Successful in 1m58s
Pro and Business users can manage branches, invite cashiers with branch assignment, and switch registers; sales and register flows respect acting location. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -30,7 +30,7 @@ class RegisterController extends Controller
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$owner = $this->ownerRef($request);
|
||||
$location = $this->locations->ensureDefault($owner);
|
||||
$location = $this->location($request);
|
||||
|
||||
return view('pos.register', [
|
||||
'products' => $this->registerProducts($owner, $location),
|
||||
@@ -47,7 +47,7 @@ class RegisterController extends Controller
|
||||
]);
|
||||
|
||||
$owner = $this->ownerRef($request);
|
||||
$location = $this->locations->ensureDefault($owner);
|
||||
$location = $this->location($request);
|
||||
$product = $this->barcodes->lookup($owner, $location, $data['code']);
|
||||
|
||||
if (! $product || $product['price_minor'] <= 0 || $product['name'] === '') {
|
||||
@@ -66,7 +66,14 @@ class RegisterController extends Controller
|
||||
private function registerProducts(string $owner, PosLocation $location): array
|
||||
{
|
||||
if ($location->isRestaurant()) {
|
||||
return PosProduct::owned($owner)->active()->orderBy('name')->get()
|
||||
return PosProduct::owned($owner)
|
||||
->active()
|
||||
->where(function ($query) use ($location) {
|
||||
$query->where('location_id', $location->id)
|
||||
->orWhereNull('location_id');
|
||||
})
|
||||
->orderBy('name')
|
||||
->get()
|
||||
->map(fn (PosProduct $p) => [
|
||||
'id' => $p->id,
|
||||
'name' => $p->name,
|
||||
@@ -99,7 +106,7 @@ class RegisterController extends Controller
|
||||
{
|
||||
$data = $request->validate(['style' => ['required', 'in:retail,restaurant']]);
|
||||
|
||||
$location = $this->locations->ensureDefault($this->ownerRef($request));
|
||||
$location = $this->location($request);
|
||||
$location->update(['service_style' => $data['style']]);
|
||||
|
||||
if ($data['style'] === PosLocation::STYLE_RESTAURANT) {
|
||||
@@ -135,7 +142,7 @@ class RegisterController extends Controller
|
||||
]);
|
||||
|
||||
$merchant = ladill_account() ?? $request->user();
|
||||
$location = $this->locations->ensureDefault($this->ownerRef($request));
|
||||
$location = $this->location($request);
|
||||
|
||||
$lines = $data['lines'];
|
||||
if (! $location->isRestaurant()) {
|
||||
|
||||
Reference in New Issue
Block a user