Skip to content

Commit cfb811b

Browse files
authored
Merge pull request #56 from eurofurence/remove-double-sided-option
Remove Double-Sided Option from Badge creator
2 parents 0989483 + 141c49b commit cfb811b

8 files changed

Lines changed: 8 additions & 98 deletions

File tree

app/Http/Controllers/BadgeController.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public function store(BadgeCreateRequest $request)
7575

7676
// Returns in cents
7777
$total = BadgeCalculationService::calculate(
78-
doubleSided: $validated['upgrades']['doubleSided'],
7978
isFreeBadge: $isFreeBadge,
8079
isLate: $event->preorder_ends_at->isPast(),
8180
);
@@ -90,7 +89,7 @@ public function store(BadgeCreateRequest $request)
9089
'tax_rate' => 0.19,
9190
'tax' => round($tax),
9291
'total' => round($total),
93-
'dual_side_print' => $validated['upgrades']['doubleSided'],
92+
'dual_side_print' => true,
9493
'is_free_badge' => $isFreeBadge,
9594
'apply_late_fee' => $event->preorder_ends_at->isPast(),
9695
]);
@@ -165,10 +164,8 @@ public function update(BadgeUpdateRequest $request, Badge $badge)
165164
/**
166165
* Badge
167166
*/
168-
$badge->dual_side_print = $validated['upgrades']['doubleSided'];
169167
$previousTotal = $badge->total;
170168
$total = BadgeCalculationService::calculate(
171-
doubleSided: $badge->dual_side_print,
172169
isFreeBadge: $badge->is_free_badge,
173170
isLate: $badge->apply_late_fee,
174171
);
@@ -183,10 +180,6 @@ public function update(BadgeUpdateRequest $request, Badge $badge)
183180
if ($previousTotal !== $total) {
184181
$request->user()->forcePay($badge);
185182
}
186-
// Update Extra Copy doulbe sided print
187-
Badge::where('extra_copy_of', $badge->id)->update([
188-
'dual_side_print' => $validated['upgrades']['doubleSided'],
189-
]);
190183
return $badge;
191184
});
192185
return redirect()->route('badges.index');

app/Http/Requests/BadgeCreateRequest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public function rules(): array
2222
'catchEmAll' => ['required','boolean'],
2323
'publish' => ['required','boolean'],
2424
'tos' => ['required','accepted'],
25-
'upgrades.doubleSided' => ['required', 'boolean'],
2625
'upgrades.spareCopy' => ['required', 'boolean'],
2726
];
2827
}

app/Http/Requests/BadgeUpdateRequest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public function rules(): array
2121
],
2222
'catchEmAll' => ['required','boolean'],
2323
'publish' => ['required','boolean'],
24-
'upgrades.doubleSided' => ['required', 'boolean'],
2524
];
2625
}
2726
}

app/Models/Badge/Badge.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class Badge extends Model implements ProductInterface
2929
'printed_at' => 'datetime',
3030
'ready_for_pickup_at' => 'datetime',
3131
'picked_up_at' => 'datetime',
32+
'is_free_badge' => 'boolean',
3233
];
3334

3435
public function fursuit(): BelongsTo

app/Services/BadgeCalculationService.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ class BadgeCalculationService
1010
* Returns the badge fee in cents
1111
*/
1212
public static function calculate(
13-
bool $doubleSided = false,
1413
bool $isSpareCopy = false,
1514
bool $isFreeBadge = false,
1615
bool $isLate = false
@@ -24,9 +23,6 @@ public static function calculate(
2423
if ($isLate) {
2524
$baseFee += 200;
2625
}
27-
if ($doubleSided) {
28-
$baseFee += 100;
29-
}
3026
return $baseFee;
3127
}
3228
}

resources/js/Components/BadgeListItem.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,6 @@ function getBadgeTooltipText(status) {
112112
<Tag severity="info" value="Discounted Extra Copy"></Tag>
113113
</div>
114114
</div>
115-
<div v-if="badge.dual_side_print" class="flex flex-col justify-center px-4 pb-1 md:p-4 gap-2">
116-
<!-- dual_side_print, extra_copy badges -->
117-
<div class="flex justify-center items-center gap-2">
118-
<Tag value="Dual Side Print"></Tag>
119-
</div>
120-
</div>
121115
<!-- Total Price -->
122116
<div class="flex flex-col justify-center p-4">
123117
<p class="text-lg font-semibold font-main">{{ formatEuroFromCents(badge.total) }}</p>

resources/js/Pages/Badges/BadgesCreate.vue

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<script setup>
22
import Layout from "@/Layouts/Layout.vue";
3-
import {Link, Head, usePage} from '@inertiajs/vue3'
4-
import Steps from 'primevue/steps';
5-
import Fieldset from 'primevue/fieldset';
3+
import {Head, usePage} from '@inertiajs/vue3'
64
import InputText from "primevue/inputtext";
75
import Dropdown from "primevue/dropdown";
86
import Dialog from 'primevue/dialog';
@@ -37,7 +35,6 @@ const form = useForm('post', route('badges.store'), {
3735
publish: false,
3836
tos: false,
3937
upgrades: {
40-
doubleSided: false,
4138
spareCopy: false
4239
}
4340
})
@@ -72,9 +69,6 @@ const latePrice = computed(() => {
7269
7370
const total = computed(() => {
7471
let total = basePrice.value + latePrice.value;
75-
if (form.upgrades.doubleSided) {
76-
total += 1;
77-
}
7872
if (form.upgrades.spareCopy) {
7973
total += 2;
8074
}
@@ -194,24 +188,9 @@ const total = computed(() => {
194188
<div class="">
195189
<div class="mb-8 ">
196190
<h2 class="text-lg font-semibold">Upgrades</h2>
197-
<p>Get a spare copy or get an exclusive double printed badge!</p>
191+
<p>Get a spare copy of your printed badge!</p>
198192
</div>
199193
<div class="space-y-3">
200-
<div class="flex flex-col md:flex-row gap-8 w-full">
201-
<div class="flex gap-3">
202-
<div class="flex flex-row gap-2 mt-3">
203-
<InputSwitch v-model="form.upgrades.doubleSided" id="extra1"
204-
aria-describedby="extra1-help"/>
205-
</div>
206-
<div>
207-
<label class="font-semibold block" for="extra1">Double Sided Badge
208-
<Tag value="+1,00 €"></Tag>
209-
</label>
210-
<small
211-
id="extra1-help">By default our Badges are only Printed on one side. If you want to have a double sided badge, please select this option.</small>
212-
</div>
213-
</div>
214-
</div>
215194
<div class="flex flex-col md:flex-row gap-8 w-full">
216195
<div class="flex gap-3">
217196
<div class="flex flex-row gap-2 mt-3">
@@ -267,11 +246,6 @@ const total = computed(() => {
267246
</div>
268247
<small>Orders placed after the Preorder Deadline will be charged a late fee.</small>
269248
</div>
270-
<div v-if="form.upgrades.doubleSided"
271-
class="flex justify-between border-b border-dotted border-gray-900">
272-
<span>Double Sided Badge</span>
273-
<span>1,00 €</span>
274-
</div>
275249
<div v-if="form.upgrades.spareCopy"
276250
class="flex justify-between mb-4 border-b border-dotted border-gray-900">
277251
<span>Spare Copy</span>

resources/js/Pages/Badges/BadgesEdit.vue

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<script setup>
22
import Layout from "@/Layouts/Layout.vue";
3-
import {Link, Head, usePage, router} from '@inertiajs/vue3'
4-
import Steps from 'primevue/steps';
5-
import Fieldset from 'primevue/fieldset';
3+
import {Link, Head, router} from '@inertiajs/vue3'
64
import InputText from "primevue/inputtext";
75
import Dropdown from "primevue/dropdown";
86
import Dialog from 'primevue/dialog';
@@ -12,11 +10,8 @@ import {computed, onMounted, reactive, ref} from "vue";
1210
import Button from 'primevue/button';
1311
import ImageUpload from "@/Components/BadgeCreator/ImageUpload.vue";
1412
import Panel from 'primevue/panel';
15-
import Tag from 'primevue/tag';
16-
import dayjs from "dayjs";
1713
import InputError from "@/Components/InputError.vue";
1814
import Message from 'primevue/message';
19-
import ConfirmDialog from "primevue/confirmdialog";
2015
2116
const deleteModalOpen = ref(null)
2217
@@ -53,9 +48,6 @@ const form = useForm('post', route('badges.update',{badge: props.badge.id}), {
5348
image: null,
5449
catchEmAll: props.badge.fursuit.catch_em_all,
5550
publish: props.badge.fursuit.published,
56-
upgrades: {
57-
doubleSided: props.badge.dual_side_print
58-
}
5951
},{
6052
forceFormData: true,
6153
})
@@ -78,7 +70,7 @@ function imageUpdatedEvent(image) {
7870
7971
const basePrice = computed(() => {
8072
let price = 0;
81-
if (props.badge.is_free_badge === false) {
73+
if (props.badge.is_free_badge === false && !props.badge.extra_copy_of) {
8274
price += 2;
8375
}
8476
return price;
@@ -95,11 +87,7 @@ const total = computed(() => {
9587
if (props.badge.extra_copy_of) {
9688
return 2;
9789
}
98-
let total = basePrice.value + latePrice.value;
99-
if (form.upgrades.doubleSided && !props.badge.extra_copy_of) {
100-
total += 1;
101-
}
102-
return total;
90+
return basePrice.value + latePrice.value;
10391
})
10492
10593
function openImageModal() {
@@ -260,35 +248,6 @@ function openImageModal() {
260248
<!-- End Publish -->
261249
</div>
262250
<!-- End Group 2 -->
263-
<!-- Paid Extras -->
264-
<div>
265-
<div class="">
266-
<div class="mb-8 ">
267-
<h2 class="text-lg font-semibold">Upgrades</h2>
268-
<p>Get a double printed badge!</p>
269-
</div>
270-
<div class="space-y-3">
271-
<div class="flex flex-col md:flex-row gap-8 w-full">
272-
<div class="flex gap-3">
273-
<div class="flex flex-row gap-2 mt-3">
274-
<InputSwitch v-model="form.upgrades.doubleSided"
275-
:disabled="!canEdit"
276-
id="extra1"
277-
aria-describedby="extra1-help"/>
278-
</div>
279-
<div>
280-
<label class="font-semibold block" for="extra1">Double Sided Badge
281-
<Tag value="+1,00 €" v-if="!props.badge.extra_copy_of"></Tag>
282-
</label>
283-
<small
284-
id="extra1-help">By default our Badges are only Printed on one side. If you want to have a double sided badge, please select this option.</small>
285-
</div>
286-
</div>
287-
</div>
288-
</div>
289-
</div>
290-
<!-- End Paid Extras -->
291-
</div>
292251
<Panel header="Checkout">
293252
<template #header>
294253
<div class="flex items-center gap-2">
@@ -311,12 +270,7 @@ function openImageModal() {
311270
<span>Late Fee</span>
312271
<span>{{ latePrice }},00 €</span>
313272
</div>
314-
<div v-if="form.upgrades.doubleSided && !props.badge.extra_copy_of"
315-
class="flex justify-between border-b border-dotted border-gray-900">
316-
<span>Double Sided Badge</span>
317-
<span>1,00 €</span>
318-
</div>
319-
<div v-if="form.upgrades.spareCopy || props.badge.extra_copy_of"
273+
<div v-if="props.badge.extra_copy_of"
320274
class="flex justify-between mb-4 border-b border-dotted border-gray-900">
321275
<span>Spare Copy</span>
322276
<span>2,00 €</span>

0 commit comments

Comments
 (0)