Skip to content

Commit 960d9c4

Browse files
committed
Merge branch 'develop' into v1.0.0-alpha
# Conflicts: # backend/app/Exports/AttendeesExport.php # backend/app/Http/Actions/Attendees/GetAttendeeAction.php # backend/app/Http/Request/Attendee/CreateAttendeeRequest.php # backend/app/Resources/Attendee/AttendeeResource.php # backend/app/Services/Application/Handlers/Attendee/CreateAttendeeHandler.php # backend/app/Services/Domain/Order/OrderCancelService.php # backend/app/Services/Handlers/Attendee/EditAttendeeHandler.php # frontend/src/components/forms/CapaciyAssigmentForm/index.tsx # frontend/src/components/modals/CreateCapacityAssignmentModal/index.tsx # frontend/src/components/modals/EditAttendeeModal/index.tsx # frontend/src/components/modals/EditCapacityAssignmentModal/index.tsx # frontend/src/locales/de.js # frontend/src/locales/de.po # frontend/src/locales/en.js # frontend/src/locales/en.po # frontend/src/locales/es.js # frontend/src/locales/es.po # frontend/src/locales/fr.js # frontend/src/locales/fr.po # frontend/src/locales/pt-br.js # frontend/src/locales/pt-br.po # frontend/src/locales/pt.js # frontend/src/locales/pt.po # frontend/src/locales/ru.js # frontend/src/locales/ru.po # frontend/src/locales/zh-cn.js # frontend/src/locales/zh-cn.po
2 parents 927cbf0 + 3c09cc2 commit 960d9c4

File tree

14 files changed

+106
-29
lines changed

14 files changed

+106
-29
lines changed

backend/app/Exports/AttendeesExport.php

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
namespace HiEvents\Exports;
44

55
use Carbon\Carbon;
6+
use HiEvents\DomainObjects\AttendeeDomainObject;
7+
use HiEvents\DomainObjects\Enums\ProductPriceType;
68
use HiEvents\DomainObjects\Enums\QuestionTypeEnum;
9+
use HiEvents\DomainObjects\ProductDomainObject;
10+
use HiEvents\DomainObjects\ProductPriceDomainObject;
711
use HiEvents\DomainObjects\QuestionDomainObject;
812
use HiEvents\Resources\Attendee\AttendeeResource;
913
use HiEvents\Services\Domain\Question\QuestionAnswerFormatter;
@@ -50,6 +54,7 @@ public function headings(): array
5054
'Is Checked In',
5155
'Checked In At',
5256
'Product ID',
57+
'Product Name',
5358
'Event ID',
5459
'Public ID',
5560
'Short ID',
@@ -58,6 +63,10 @@ public function headings(): array
5863
], $questionTitles);
5964
}
6065

66+
/**
67+
* @param AttendeeDomainObject $attendee
68+
* @return array
69+
*/
6170
public function map($attendee): array
6271
{
6372
$answers = $this->questions->map(function (QuestionDomainObject $question) use ($attendee) {
@@ -70,17 +79,28 @@ public function map($attendee): array
7079
);
7180
});
7281

82+
/** @var ProductDomainObject $ticket */
83+
$ticket = $attendee->getProduct();
84+
$ticketName = $ticket->getTitle();
85+
if ($ticket->getType() === ProductPriceType::TIERED->name) {
86+
$ticketName .= ' - ' . $ticket
87+
->getProductPrices()
88+
->first(fn(ProductPriceDomainObject $tp) => $tp->getId() === $attendee->getProductPriceId())
89+
->getLabel();
90+
}
91+
7392
return array_merge([
7493
$attendee->getId(),
7594
$attendee->getFirstName(),
7695
$attendee->getLastName(),
7796
$attendee->getEmail(),
7897
$attendee->getStatus(),
79-
$attendee->getCheckedInAt() ? 'Yes' : 'No',
80-
$attendee->getCheckedInAt()
81-
? Carbon::parse($attendee->getCheckedInAt())->format('Y-m-d H:i:s')
98+
$attendee->getCheckIn() ? 'Yes' : 'No',
99+
$attendee->getCheckIn()
100+
? Carbon::parse($attendee->getCheckIn()->getCreatedAt())->format('Y-m-d H:i:s')
82101
: '',
83102
$attendee->getProductId(),
103+
$ticketName,
84104
$attendee->getEventId(),
85105
$attendee->getPublicId(),
86106
$attendee->getShortId(),

backend/app/Http/Actions/Attendees/ExportAttendeesAction.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
namespace HiEvents\Http\Actions\Attendees;
44

5+
use HiEvents\DomainObjects\AttendeeCheckInDomainObject;
56
use HiEvents\DomainObjects\Enums\QuestionBelongsTo;
67
use HiEvents\DomainObjects\EventDomainObject;
78
use HiEvents\DomainObjects\QuestionAndAnswerViewDomainObject;
9+
use HiEvents\DomainObjects\TicketDomainObject;
10+
use HiEvents\DomainObjects\TicketPriceDomainObject;
811
use HiEvents\Exports\AttendeesExport;
912
use HiEvents\Http\Actions\BaseAction;
13+
use HiEvents\Repository\Eloquent\Value\Relationship;
1014
use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface;
1115
use HiEvents\Repository\Interfaces\QuestionRepositoryInterface;
1216
use Maatwebsite\Excel\Facades\Excel;
@@ -31,6 +35,19 @@ public function __invoke(int $eventId): BinaryFileResponse
3135

3236
$attendees = $this->attendeeRepository
3337
->loadRelation(QuestionAndAnswerViewDomainObject::class)
38+
->loadRelation(new Relationship(
39+
domainObject: AttendeeCheckInDomainObject::class,
40+
name: 'check_in',
41+
))
42+
->loadRelation(new Relationship(
43+
domainObject: TicketDomainObject::class,
44+
nested: [
45+
new Relationship(
46+
domainObject: TicketPriceDomainObject::class,
47+
),
48+
],
49+
name: 'ticket'
50+
))
3451
->findByEventIdForExport($eventId);
3552

3653
$questions = $this->questionRepository->findWhere([

backend/app/Http/Actions/Attendees/GetAttendeeAction.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
namespace HiEvents\Http\Actions\Attendees;
44

5+
use HiEvents\DomainObjects\AttendeeCheckInDomainObject;
56
use HiEvents\DomainObjects\EventDomainObject;
6-
use HiEvents\DomainObjects\QuestionAndAnswerViewDomainObject;
77
use HiEvents\DomainObjects\ProductDomainObject;
88
use HiEvents\DomainObjects\ProductPriceDomainObject;
9+
use HiEvents\DomainObjects\QuestionAndAnswerViewDomainObject;
910
use HiEvents\Http\Actions\BaseAction;
1011
use HiEvents\Repository\Eloquent\Value\Relationship;
1112
use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface;
@@ -27,14 +28,18 @@ public function __invoke(int $eventId, int $attendeeId): Response|JsonResponse
2728
$this->isActionAuthorized($eventId, EventDomainObject::class);
2829

2930
$attendee = $this->attendeeRepository
30-
->loadRelation(QuestionAndAnswerViewDomainObject::class)
31+
->loadRelation(relationship: QuestionAndAnswerViewDomainObject::class)
3132
->loadRelation(new Relationship(
3233
domainObject: ProductDomainObject::class,
3334
nested: [
3435
new Relationship(
3536
domainObject: ProductPriceDomainObject::class,
3637
),
3738
], name: 'product'))
39+
->loadRelation(new Relationship(
40+
domainObject: AttendeeCheckInDomainObject::class,
41+
name: 'check_in',
42+
))
3843
->findFirstWhere([
3944
'id' => $attendeeId,
4045
'event_id' => $eventId,

backend/app/Http/Request/Attendee/CreateAttendeeRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function rules(): array
1313
{
1414
return [
1515
'product_id' => ['int', 'required'],
16-
'product_price_id' => ['int', 'nullable'],
16+
'product_price_id' => ['int', 'nullable', 'required'],
1717
'email' => ['required', 'email'],
1818
'first_name' => 'string|required',
1919
'last_name' => 'string',

backend/app/Repository/Eloquent/CheckInListRepository.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function getCheckedInAttendeeCountById(int $checkInListId): CheckedInAtte
4141
JOIN product_check_in_lists tcil ON a.product_id = tcil.product_id
4242
WHERE a.deleted_at IS NULL
4343
AND tcil.deleted_at IS NULL
44+
AND a.status = 'ACTIVE'
4445
)
4546
SELECT
4647
cil.id AS check_in_list_id,

backend/app/Resources/Attendee/AttendeeResource.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use HiEvents\DomainObjects\AttendeeDomainObject;
66
use HiEvents\DomainObjects\Enums\QuestionBelongsTo;
7+
use HiEvents\Resources\CheckInList\AttendeeCheckInResource;
78
use HiEvents\Resources\Order\OrderResource;
89
use HiEvents\Resources\Question\QuestionAnswerViewResource;
910
use HiEvents\Resources\Product\ProductResource;
@@ -35,18 +36,21 @@ public function toArray(Request $request): array
3536
!is_null($this->getProduct()),
3637
fn() => new ProductResource($this->getProduct()),
3738
),
39+
'check_in' => $this->when(
40+
condition: $this->getCheckIn() !== null,
41+
value: fn() => new AttendeeCheckInResource($this->getCheckIn()),
42+
),
3843
'order' => $this->when(
39-
!is_null($this->getOrder()),
40-
fn() => new OrderResource($this->getOrder())
44+
condition: !is_null($this->getOrder()),
45+
value: fn() => new OrderResource($this->getOrder())
4146
),
4247
'question_answers' => $this->when(
43-
$this->getQuestionAndAnswerViews() !== null,
44-
fn() => QuestionAnswerViewResource::collection(
48+
condition: $this->getQuestionAndAnswerViews() !== null,
49+
value: fn() => QuestionAnswerViewResource::collection(
4550
$this->getQuestionAndAnswerViews()
4651
?->filter(fn($qav) => $qav->getBelongsTo() === QuestionBelongsTo::PRODUCT->name)
4752
)
4853
),
49-
5054
'created_at' => $this->getCreatedAt(),
5155
'updated_at' => $this->getUpdatedAt(),
5256
];
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace HiEvents\Resources\CheckInList;
4+
5+
use HiEvents\DomainObjects\AttendeeCheckInDomainObject;
6+
use Illuminate\Http\Resources\Json\JsonResource;
7+
8+
/**
9+
* @mixin AttendeeCheckInDomainObject
10+
*/
11+
class AttendeeCheckInResource extends JsonResource
12+
{
13+
public function toArray($request): array
14+
{
15+
return [
16+
'id' => $this->getId(),
17+
'attendee_id' => $this->getAttendeeId(),
18+
'check_in_list_id' => $this->getCheckInListId(),
19+
'ticket_id' => $this->getTicketId(),
20+
'event_id' => $this->getEventId(),
21+
'short_id' => $this->getShortId(),
22+
'created_at' => $this->getCreatedAt(),
23+
];
24+
}
25+
}

backend/app/Services/Application/Handlers/Attendee/CreateAttendeeHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ public function handle(CreateAttendeeDTO $attendeeDTO): AttendeeDomainObject
7575
throw new NoTicketsAvailableException(__('This ticket is invalid'));
7676
}
7777

78+
$productPriceId = $this->getProductPriceId($attendeeDTO, $product);
79+
7880
$availableQuantity = $this->productRepository->getQuantityRemainingForProductPrice(
7981
$attendeeDTO->product_id,
80-
$attendeeDTO->product_price_id,
82+
$productPriceId,
8183
);
8284

8385
if ($availableQuantity <= 0) {

backend/app/Services/Domain/Order/OrderCancelService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public function __construct(
3535
public function cancelOrder(OrderDomainObject $order): void
3636
{
3737
$this->databaseManager->transaction(function () use ($order) {
38-
$this->cancelAttendees($order);
3938
$this->adjustProductQuantities($order);
39+
$this->cancelAttendees($order);
4040
$this->updateOrderStatus($order);
4141

4242
$event = $this->eventRepository

frontend/src/api/check-in.client.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import {publicApi} from "./public-client";
22
import {
33
Attendee,
4-
CheckIn,
54
CheckInList,
65
GenericDataResponse,
76
GenericPaginatedResponse,
8-
IdParam,
7+
IdParam, PublicCheckIn,
98
QueryFilters,
109
} from "../types";
1110
import {queryParamsHelper} from "../utilites/queryParamsHelper";
@@ -20,13 +19,13 @@ export const publicCheckInClient = {
2019
return response.data;
2120
},
2221
createCheckIn: async (checkInListShortId: IdParam, attendeePublicId: IdParam) => {
23-
const response = await publicApi.post<GenericDataResponse<CheckIn[]>>(`/check-in-lists/${checkInListShortId}/check-ins`, {
22+
const response = await publicApi.post<GenericDataResponse<PublicCheckIn[]>>(`/check-in-lists/${checkInListShortId}/check-ins`, {
2423
"attendee_public_ids": [attendeePublicId],
2524
});
2625
return response.data;
2726
},
2827
deleteCheckIn: async (checkInListShortId: IdParam, checkInShortId: IdParam) => {
29-
const response = await publicApi.delete<GenericDataResponse<CheckIn>>(`/check-in-lists/${checkInListShortId}/check-ins/${checkInShortId}`);
28+
const response = await publicApi.delete<GenericDataResponse<PublicCheckIn>>(`/check-in-lists/${checkInListShortId}/check-ins/${checkInShortId}`);
3029
return response.data;
3130
},
3231
};

0 commit comments

Comments
 (0)