Skip to content

Commit b0702b9

Browse files
committed
Fix create attendee
1 parent 5a3e301 commit b0702b9

File tree

10 files changed

+41
-33
lines changed

10 files changed

+41
-33
lines changed

backend/app/Exceptions/NoTicketsAvailableException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Exception;
66

7-
class NoProductsAvailableException extends Exception
7+
class NoTicketsAvailableException extends Exception
88
{
99

1010
}

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

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

55
use HiEvents\DomainObjects\EventDomainObject;
66
use HiEvents\Exceptions\InvalidProductPriceId;
7-
use HiEvents\Exceptions\NoProductsAvailableException;
7+
use HiEvents\Exceptions\NoTicketsAvailableException;
88
use HiEvents\Http\Actions\BaseAction;
99
use HiEvents\Http\Request\Attendee\CreateAttendeeRequest;
1010
use HiEvents\Http\ResponseCodes;
@@ -37,7 +37,7 @@ public function __invoke(CreateAttendeeRequest $request, int $eventId): JsonResp
3737
'event_id' => $eventId,
3838
])
3939
));
40-
} catch (NoProductsAvailableException $exception) {
40+
} catch (NoTicketsAvailableException $exception) {
4141
throw ValidationException::withMessages([
4242
'product_id' => $exception->getMessage(),
4343
]);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace HiEvents\Http\Actions\Attendees;
44

55
use HiEvents\DomainObjects\EventDomainObject;
6-
use HiEvents\Exceptions\NoProductsAvailableException;
6+
use HiEvents\Exceptions\NoTicketsAvailableException;
77
use HiEvents\Http\Actions\BaseAction;
88
use HiEvents\Http\Request\Attendee\EditAttendeeRequest;
99
use HiEvents\Resources\Attendee\AttendeeResource;
@@ -38,7 +38,7 @@ public function __invoke(EditAttendeeRequest $request, int $eventId, int $attend
3838
'event_id' => $eventId,
3939
'attendee_id' => $attendeeId,
4040
]));
41-
} catch (NoProductsAvailableException $exception) {
41+
} catch (NoTicketsAvailableException $exception) {
4242
throw ValidationException::withMessages([
4343
'product_id' => $exception->getMessage(),
4444
]);

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,30 @@
44

55
use Brick\Money\Money;
66
use HiEvents\DomainObjects\AttendeeDomainObject;
7+
use HiEvents\DomainObjects\Enums\ProductType;
78
use HiEvents\DomainObjects\Generated\AttendeeDomainObjectAbstract;
89
use HiEvents\DomainObjects\Generated\OrderDomainObjectAbstract;
910
use HiEvents\DomainObjects\Generated\OrderItemDomainObjectAbstract;
1011
use HiEvents\DomainObjects\Generated\ProductDomainObjectAbstract;
1112
use HiEvents\DomainObjects\OrderDomainObject;
1213
use HiEvents\DomainObjects\OrderItemDomainObject;
14+
use HiEvents\DomainObjects\ProductDomainObject;
15+
use HiEvents\DomainObjects\ProductPriceDomainObject;
1316
use HiEvents\DomainObjects\Status\AttendeeStatus;
1417
use HiEvents\DomainObjects\Status\OrderPaymentStatus;
1518
use HiEvents\DomainObjects\Status\OrderStatus;
16-
use HiEvents\DomainObjects\ProductDomainObject;
17-
use HiEvents\DomainObjects\ProductPriceDomainObject;
1819
use HiEvents\Events\OrderStatusChangedEvent;
1920
use HiEvents\Exceptions\InvalidProductPriceId;
20-
use HiEvents\Exceptions\NoProductsAvailableException;
21+
use HiEvents\Exceptions\NoTicketsAvailableException;
2122
use HiEvents\Helper\IdHelper;
2223
use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface;
2324
use HiEvents\Repository\Interfaces\EventRepositoryInterface;
2425
use HiEvents\Repository\Interfaces\OrderRepositoryInterface;
25-
use HiEvents\Repository\Interfaces\TaxAndFeeRepositoryInterface;
2626
use HiEvents\Repository\Interfaces\ProductRepositoryInterface;
27+
use HiEvents\Repository\Interfaces\TaxAndFeeRepositoryInterface;
2728
use HiEvents\Services\Domain\Order\OrderManagementService;
28-
use HiEvents\Services\Domain\Tax\TaxAndFeeRollupService;
2929
use HiEvents\Services\Domain\Product\ProductQuantityUpdateService;
30+
use HiEvents\Services\Domain\Tax\TaxAndFeeRollupService;
3031
use HiEvents\Services\Handlers\Attendee\DTO\CreateAttendeeDTO;
3132
use HiEvents\Services\Handlers\Attendee\DTO\CreateAttendeeTaxAndFeeDTO;
3233
use Illuminate\Database\DatabaseManager;
@@ -51,7 +52,7 @@ public function __construct(
5152
}
5253

5354
/**
54-
* @throws NoProductsAvailableException
55+
* @throws NoTicketsAvailableException
5556
* @throws Throwable
5657
*/
5758
public function handle(CreateAttendeeDTO $attendeeDTO): AttendeeDomainObject
@@ -67,15 +68,20 @@ public function handle(CreateAttendeeDTO $attendeeDTO): AttendeeDomainObject
6768
->findFirstWhere([
6869
ProductDomainObjectAbstract::ID => $attendeeDTO->product_id,
6970
ProductDomainObjectAbstract::EVENT_ID => $attendeeDTO->event_id,
71+
ProductDomainObjectAbstract::PRODUCT_TYPE => ProductType::TICKET->name,
7072
]);
7173

74+
if (!$product) {
75+
throw new NoTicketsAvailableException(__('This ticket is invalid'));
76+
}
77+
7278
$availableQuantity = $this->productRepository->getQuantityRemainingForProductPrice(
7379
$attendeeDTO->product_id,
7480
$attendeeDTO->product_price_id,
7581
);
7682

7783
if ($availableQuantity <= 0) {
78-
throw new NoProductsAvailableException(__('There are no products available. ' .
84+
throw new NoTicketsAvailableException(__('There are no tickets available. ' .
7985
'If you would like to assign a product to this attendee,' .
8086
' please adjust the product\'s available quantity.'));
8187
}

backend/app/Services/Handlers/Attendee/EditAttendeeHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use HiEvents\DomainObjects\Generated\AttendeeDomainObjectAbstract;
88
use HiEvents\DomainObjects\Generated\ProductDomainObjectAbstract;
99
use HiEvents\DomainObjects\ProductPriceDomainObject;
10-
use HiEvents\Exceptions\NoProductsAvailableException;
10+
use HiEvents\Exceptions\NoTicketsAvailableException;
1111
use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface;
1212
use HiEvents\Repository\Interfaces\ProductRepositoryInterface;
1313
use HiEvents\Services\Domain\Product\ProductQuantityUpdateService;
@@ -66,7 +66,7 @@ private function updateAttendee(EditAttendeeDTO $editAttendeeDTO): AttendeeDomai
6666

6767
/**
6868
* @throws ValidationException
69-
* @throws NoProductsAvailableException
69+
* @throws NoTicketsAvailableException
7070
*/
7171
private function validateProductId(EditAttendeeDTO $editAttendeeDTO): void
7272
{
@@ -90,7 +90,7 @@ private function validateProductId(EditAttendeeDTO $editAttendeeDTO): void
9090
);
9191

9292
if ($availableQuantity <= 0) {
93-
throw new NoProductsAvailableException(
93+
throw new NoTicketsAvailableException(
9494
__('There are no products available. If you would like to assign this product to this attendee, please adjust the product\'s available quantity.')
9595
);
9696
}

frontend/src/components/common/AttendeeTable/index.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {t, Trans} from "@lingui/macro";
1818
import {confirmationDialog} from "../../../utilites/confirmationDialog.tsx";
1919
import {useResendAttendeeTicket} from "../../../mutations/useResendAttendeeTicket.ts";
2020
import {ViewAttendeeModal} from "../../modals/ViewAttendeeModal";
21-
import {ActionMenu} from '../ActionMenu/index.tsx';
21+
import {ActionMenu} from '../ActionMenu';
2222

2323
interface AttendeeTableProps {
2424
attendees: Attendee[];
@@ -42,13 +42,13 @@ export const AttendeeTable = ({attendees, openCreateModal}: AttendeeTableProps)
4242
modal.open();
4343
}
4444

45-
const handleResendProduct = (attendee: Attendee) => {
45+
const handleResendTicket = (attendee: Attendee) => {
4646
resendTicketMutation.mutate({
4747
attendeeId: attendee.id,
4848
eventId: eventId,
4949
}, {
50-
onSuccess: () => showSuccess(t`Product email has been resent to attendee`),
51-
onError: (error: any) => showError(error.response.data.message || t`Failed to resend product email`)
50+
onSuccess: () => showSuccess(t`Ticket email has been resent to attendee`),
51+
onError: (error: any) => showError(error.response.data.message || t`Failed to resend ticket email`)
5252
});
5353
}
5454

@@ -75,7 +75,7 @@ export const AttendeeTable = ({attendees, openCreateModal}: AttendeeTableProps)
7575
const handleCancel = (attendee: Attendee) => {
7676
const message = attendee.status === 'CANCELLED'
7777
? t`Are you sure you want to activate this attendee?`
78-
: t`Are you sure you want to cancel this attendee? This will void their product`
78+
: t`Are you sure you want to cancel this attendee? This will void their ticket`
7979

8080
confirmationDialog(message, () => {
8181
modifyMutation.mutate({
@@ -109,7 +109,7 @@ export const AttendeeTable = ({attendees, openCreateModal}: AttendeeTableProps)
109109
<MantineTable.Th>{t`Name`}</MantineTable.Th>
110110
<MantineTable.Th>{t`Email`}</MantineTable.Th>
111111
<MantineTable.Th>{t`Order`}</MantineTable.Th>
112-
<MantineTable.Th>{t`Product`}</MantineTable.Th>
112+
<MantineTable.Th>{t`Ticket`}</MantineTable.Th>
113113
<MantineTable.Th>{t`Status`}</MantineTable.Th>
114114
<MantineTable.Th></MantineTable.Th>
115115
</MantineTable.Tr>
@@ -176,9 +176,9 @@ export const AttendeeTable = ({attendees, openCreateModal}: AttendeeTableProps)
176176
onClick: () => handleModalClick(attendee, editModal),
177177
},
178178
{
179-
label: t`Resend product email`,
179+
label: t`Resend ticket email`,
180180
icon: <IconMailForward size={14}/>,
181-
onClick: () => handleResendProduct(attendee),
181+
onClick: () => handleResendTicket(attendee),
182182
visible: attendee.status === 'ACTIVE',
183183
},
184184
],
@@ -187,7 +187,7 @@ export const AttendeeTable = ({attendees, openCreateModal}: AttendeeTableProps)
187187
label: t`Danger Zone`,
188188
items: [
189189
{
190-
label: attendee.status === 'CANCELLED' ? t`Activate` : t`Cancel` + ` ` + t`product`,
190+
label: attendee.status === 'CANCELLED' ? t`Activate` : t`Cancel` + ` ` + t`ticket`,
191191
icon: <IconTrash size={14}/>,
192192
onClick: () => handleCancel(attendee),
193193
color: attendee.status === 'CANCELLED' ? 'green' : 'red',

frontend/src/components/common/HomepageInfoMessage/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const HomepageInfoMessage = ({message, link, linkText, iconType = 'info'}
1616
return '/info-icon.svg';
1717
}
1818
if (iconType === 'processing') {
19-
return '/stopwatch-product-icon.svg';
19+
return '/stopwatch-ticket-icon.svg';
2020
}
2121
}
2222

@@ -33,4 +33,4 @@ export const HomepageInfoMessage = ({message, link, linkText, iconType = 'info'}
3333
)}
3434
</div>
3535
);
36-
}
36+
}

frontend/src/components/forms/StripeCheckoutForm/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ export default function StripeCheckoutForm() {
112112
type: "accordion",
113113
defaultCollapsed: false,
114114
radios: true,
115-
},
115+
spacedAccordionItems: true,
116+
}
116117
}
117118

118119
return (

frontend/src/components/modals/CreateAttendeeModal/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Modal} from "../../common/Modal";
2-
import {GenericModalProps, ProductCategory} from "../../../types.ts";
2+
import {GenericModalProps, ProductCategory, ProductType} from "../../../types.ts";
33
import {Button} from "../../common/Button";
44
import {useNavigate, useParams} from "react-router-dom";
55
import {useFormErrorResponseHandler} from "../../../hooks/useFormErrorResponseHandler.tsx";
@@ -103,7 +103,7 @@ export const CreateAttendeeModal = ({onClose}: GenericModalProps) => {
103103
navigate(`/manage/event/${eventId}/products`)
104104
}}
105105
>
106-
{t`Manage products`}
106+
{t`Manage tickets`}
107107
</Button>
108108
</Modal>
109109
)
@@ -147,13 +147,14 @@ export const CreateAttendeeModal = ({onClose}: GenericModalProps) => {
147147
/>
148148

149149
<ProductSelector
150-
placeholder={t`Select Product`}
151-
label={t`Product`}
150+
placeholder={t`Select Ticket`}
151+
label={t`Ticket`}
152152
productCategories={event.product_categories as ProductCategory[]}
153153
form={form}
154154
productFieldName={'product_id'}
155155
multiSelect={false}
156156
showTierSelector={true}
157+
includedProductTypes={[ProductType.Ticket]}
157158
/>
158159

159160
<NumberInput
@@ -188,7 +189,7 @@ export const CreateAttendeeModal = ({onClose}: GenericModalProps) => {
188189

189190
<Switch
190191
mt={20}
191-
label={t`Send order confirmation and product email`}
192+
label={t`Send order confirmation and ticket email`}
192193
{...form.getInputProps('send_confirmation_email', {type: 'checkbox'})}
193194
/>
194195
<Button type="submit" fullWidth mt="xl" disabled={mutation.isPending}>

frontend/src/components/routes/product-widget/Payment/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ const Payment = () => {
6868
);
6969
}
7070

71-
export default Payment;
71+
export default Payment;

0 commit comments

Comments
 (0)