Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiritin committed Sep 16, 2024
1 parent 7b87e10 commit e526945
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ public function handle()
}
});

// if cash deposit money to cash register
if ($this->checkout->payment_method === 'cash') {
$this->checkout->machine->wallet->deposit($this->checkout->total);
}

// add money to user wallet to zero out his balance
$this->checkout->user->wallet->deposit($this->checkout->total);

activity()
->performedOn($this->checkout)
->causedBy(auth('machine-user')->user())
Expand Down
7 changes: 6 additions & 1 deletion app/Http/Controllers/POS/AttendeeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Domain\Checkout\Models\Checkout\Checkout;
use App\Http\Controllers\Controller;
use App\Models\Fursuit\States\Rejected;
use App\Models\User;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
Expand All @@ -30,7 +31,11 @@ public function lookupSubmit(Request $request): RedirectResponse
public function show(string $attendeeId, Request $request): Response
{
$user = User::where('attendee_id', $attendeeId)->first();
$badges = $user->badges()->with('fursuit.species')->get();
$badges = $user->badges()
->whereHas('fursuit', function ($query) {
$query->where('status','!=',Rejected::$name);
})
->with('fursuit.species')->get();

return Inertia::render('POS/Attendee/Show', [
'attendee' => $user->load('wallet'),
Expand Down
15 changes: 13 additions & 2 deletions app/Http/Controllers/POS/CheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,21 @@ public function store(Request $request)
$data['badge_ids'] = Badge::whereHas('fursuit.user', function ($query) use ($data) {
$query->where('id', $data['user_id']);
})->where('status', 'unpaid')->pluck('id')->toArray();
} else {

$data['badge_ids'] = Badge::whereHas('fursuit.user', function ($query) use ($data) {
$query->where('id', $data['user_id']);
})->where('status', 'unpaid')
->whereIn('id', $data['badge_ids'])
->pluck('id')->toArray();
}

$badges = Badge::whereIn('id', $data['badge_ids'])->get();
if ($badges->isEmpty()) {
return redirect()->back()->with(['error' => 'No badges found']);
}

$checkout = DB::transaction(function () use ($data) {
$badges = Badge::whereIn('id', $data['badge_ids'])->get();
$checkout = DB::transaction(function () use ($badges, $data) {
$total = $badges->sum('total');
$subtotal = $badges->sum('subtotal');
$tax = $badges->sum('tax');
Expand Down
1 change: 1 addition & 0 deletions resources/js/Components/POS/Attendee/BadgesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function changeHandout(badgeId, undo) {
<Column selectionMode="multiple" headerStyle="width: 3rem"></Column>
<Column field="custom_id" header="ID"></Column>
<Column field="fursuit.name" header="Fursuit"></Column>
<Column field="fursuit.status" header="Fursuit Status"></Column>
<Column field="printed_at" header="Print">
<template #body="slotProps">
{{ (slotProps.data.printed_at) ? dayjs(slotProps.data.printed_at).format('DD.MM.YY') : '-' }}
Expand Down
1 change: 1 addition & 0 deletions resources/js/Components/POS/Attendee/FursuitTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ defineProps({
</template>
</Column>
<Column field="name" header="Name" />
<Column field="status" header="Status" />
<Column field="species.name" header="Species" />
<Column field="catch_em_all" header="Catch em all">
<template #body="slotProps">
Expand Down
4 changes: 2 additions & 2 deletions resources/js/Pages/POS/Checkout/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ function receiptForm(via) {
</div>
<Message :closable="false" :severity="getSeverityFromTransactionStatus(transaction.status)" v-if="transaction">{{ transaction.status }}</Message>
<div class="flex justify-between gap-4 shrink">
<Button :disabled="transaction && transaction.status === 'SUCCESSFUL'" severity="contrast" label="Cancel Transaction" @click="cancel" class="grow"></Button>
<Button :disabled="transaction && transaction.status !== 'FAILED'" :loading="startCardPaymentForm.processing" label="Pay With Card" @click="startCardPayment" class="grow"></Button>
<Button :disabled="checkout.status === 'FINISHED' || (transaction && (transaction.status === 'SUCCESSFUL' || transaction.status === 'PENDING'))" severity="contrast" label="Cancel Transaction" @click="cancel" class="grow"></Button>
<Button :disabled="checkout.status === 'FINISHED' || (transaction && (transaction.status === 'SUCCESSFUL' || transaction.status === 'PENDING'))" :loading="startCardPaymentForm.processing" label="Pay With Card" @click="startCardPayment" class="grow"></Button>
</div>
</div>
</div>
Expand Down

0 comments on commit e526945

Please sign in to comment.