diff --git a/public/i18n/de.json b/public/i18n/de.json index 6fd6667..c3ea143 100644 --- a/public/i18n/de.json +++ b/public/i18n/de.json @@ -1,4 +1,10 @@ { + "SUCCESS": "Erfolgreich!", + "SUCCESS_SUB": "Deine Bestellung wurde aufgegeben.", + + "CANCEL": "Abgebrochen", + "CANCEL_SUB": "Deine Bestellung wurde abgebrochen.", + "NAV_ABOUT": "Über", "NAV_SERVICES": "Leistungen", @@ -27,6 +33,10 @@ "SERVS_CONTACT": "Kontaktiere mich", "SERVICES": { + "PTERO_NAME": "Pterodactyl Panel Setup", + "PTERO_BASIC": "Base Service: €40
I will set up Pterodactyl Panel for you on a Server you provide", + "PTERO_ADVANCED": "Base Service: €40
I will set up Pterodactyl Panel for you on a Server you provide", + "SUPPORT_NAME": "Support & Wartung", "SUPPORT_BASIC": "Wartungsservice
Je nach verwendeter Software flexible Basis ab ca. 35-90€/Monat.
Kontaktieren Sie mich für eine genaue Schätzung.

Support-Service
Je nach verwendeter Software flexible Basis ab ca. 50-75€/Stunde.
Pauschalpreis: 60-130€ für kleinere Probleme (bis zu 2,5 Stunden, abhängig von der Komplexität, kontaktieren Sie mich für eine genaue Schätzung)", "SUPPORT_ADVANCED": "Wartungsservice
Je nach verwendeter Software flexible Basis ab ca. 35-90€/Monat.
Kontaktieren Sie mich für eine genaue Schätzung.

Support-Service
Je nach verwendeter Software flexible Basis ab ca. 50-75€/Stunde.
Pauschalpreis: 60-130€ für kleinere Probleme (bis zu 2,5 Stunden, abhängig von der Komplexität, kontaktieren Sie mich für eine genaue Schätzung)", diff --git a/public/i18n/en.json b/public/i18n/en.json index 15ed55c..5238d44 100644 --- a/public/i18n/en.json +++ b/public/i18n/en.json @@ -1,4 +1,10 @@ { + "SUCCESS": "Success!", + "SUCCESS_SUB": "Your order has been placed.", + + "CANCEL": "Cancelled", + "CANCEL_SUB": "Your order has been cancelled.", + "NAV_ABOUT": "About", "NAV_SERVICES": "Services", @@ -28,6 +34,10 @@ "SERVS_CONTACT": "Contact me", "SERVICES": { + "PTERO_NAME": "Pterodactyl Panel Setup", + "PTERO_BASIC": "Base Service: €40
I will set up Pterodactyl Panel for you on a Server you provide", + "PTERO_ADVANCED": "Base Service: €40
I will set up Pterodactyl Panel for you on a Server you provide", + "SUPPORT_NAME": "Support & Maintenance", "SUPPORT_BASIC": "Maintenance Service
Depending on the software(s) in use, flexible baseline ~€35-90+/month.
Contact me for a precise estimate.

Support Service
Depending on the software(s) in use, flexible baseline ~€50-75+/hour.
Flat Rate: €60-130 for minor issues (up to 2.5 hours, depends on complexity, contact me for a precise estimate)", "SUPPORT_ADVANCED": "Maintenance Service
Depending on the software(s) in use, flexible baseline ~€35-90+/month.
Contact me for a precise estimate.

Support Service
Depending on the software(s) in use, flexible baseline ~€50-75+/hour.
Flat Rate: €60-130 for minor issues (up to 2.5 hours, depends on complexity, contact me for a precise estimate)", diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index abb6a99..699a75a 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -12,6 +12,8 @@ import {TosComponent} from './tos/tos.component'; import {ImprintComponent} from './imprint/imprint.component'; import {ShortenerComponent} from './shortener/shortener.component'; import {PrivacyComponent} from './privacy/privacy.component'; +import {SuccessComponent} from './checkout/success/success.component'; +import {CancelComponent} from './checkout/cancel/cancel.component'; export const routes: Routes = [ { path: '', component: AboutComponent }, @@ -27,5 +29,7 @@ export const routes: Routes = [ { path: 'imprint', component: ImprintComponent }, { path: 'blog/:slug', component: ArticlePageComponent }, { path: 'shortener', component: ShortenerComponent }, + { path: 'checkout/success', pathMatch: 'full', component: SuccessComponent }, + { path: 'checkout/cancel', pathMatch: 'full', component: CancelComponent }, { path: '**', pathMatch: 'full', component: NotFoundComponent } ]; diff --git a/src/app/checkout/cancel/cancel.component.css b/src/app/checkout/cancel/cancel.component.css new file mode 100644 index 0000000..b423430 --- /dev/null +++ b/src/app/checkout/cancel/cancel.component.css @@ -0,0 +1,41 @@ +@keyframes fadeIn { + 0% { + opacity: 0; + visibility: hidden; + } + 100% { + opacity: 1; + visibility: visible; + } +} + +#vanta-cancel-bg { + animation: fadeIn 1s ease-out; + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + z-index: -100; +} + +.cancel-container { + position: relative; + color: white; + padding-bottom: 60px; + max-width: 960px; + margin: 160px auto 80px auto; + font-family: 'Roboto', sans-serif; + text-align: center; +} + +.height-container { + min-height: 100vh; + align-content: center; +} + +.privacy-content { + font-weight: 400; + margin-bottom: 10px; + font-family: Roboto, sans-serif; +} diff --git a/src/app/checkout/cancel/cancel.component.html b/src/app/checkout/cancel/cancel.component.html new file mode 100644 index 0000000..39c9860 --- /dev/null +++ b/src/app/checkout/cancel/cancel.component.html @@ -0,0 +1,7 @@ +
+
+
+

{{ 'CANCEL' | translate }}

+

{{ 'CANCEL_SUB' | translate }}

+
+
diff --git a/src/app/checkout/cancel/cancel.component.ts b/src/app/checkout/cancel/cancel.component.ts new file mode 100644 index 0000000..cc61489 --- /dev/null +++ b/src/app/checkout/cancel/cancel.component.ts @@ -0,0 +1,51 @@ +import {AfterViewInit, Component, Inject, OnDestroy, OnInit, PLATFORM_ID} from '@angular/core'; +import {TranslatePipe} from "@ngx-translate/core"; +import {VantaBackgroundService} from '../../shared/services/vanta-background.service'; +import {DeviceDetectorService} from '../../shared/services/device-detector.service'; +import {Title} from '@angular/platform-browser'; +import {isPlatformBrowser} from '@angular/common'; + +@Component({ + selector: 'app-cancel', + imports: [ + TranslatePipe + ], + templateUrl: './cancel.component.html', + styleUrl: './cancel.component.css' +}) +export class CancelComponent implements OnInit, OnDestroy, AfterViewInit { + private readonly elementId = 'vanta-cancel-bg'; + isMobile: boolean = false; + + constructor( + private vantaService: VantaBackgroundService, + private deviceService: DeviceDetectorService, + private titleService: Title, + @Inject(PLATFORM_ID) private platformId: Object + ) {} + + ngOnInit() { + this.titleService.setTitle('Checkout | itzMiney'); + this.isMobile = this.deviceService.isMobile; + if (isPlatformBrowser(this.platformId)) { + window.addEventListener('resize', this.onResize.bind(this)); + } + } + + ngAfterViewInit() { + this.vantaService.initVanta(this.elementId, { + color: 0x5b417a, + backgroundColor: 0x41e3c + }); + } + ngOnDestroy() { + this.vantaService.destroyVanta(this.elementId); + if (isPlatformBrowser(this.platformId)) { + window.removeEventListener('resize', this.onResize); + } + } + + onResize() { + this.vantaService.resizeVanta(this.elementId); + } +} diff --git a/src/app/checkout/success/success.component.css b/src/app/checkout/success/success.component.css new file mode 100644 index 0000000..bb32fa7 --- /dev/null +++ b/src/app/checkout/success/success.component.css @@ -0,0 +1,41 @@ +@keyframes fadeIn { + 0% { + opacity: 0; + visibility: hidden; + } + 100% { + opacity: 1; + visibility: visible; + } +} + +#vanta-success-bg { + animation: fadeIn 1s ease-out; + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + z-index: -100; +} + +.success-container { + position: relative; + color: white; + padding-bottom: 60px; + max-width: 960px; + margin: 160px auto 80px auto; + font-family: 'Roboto', sans-serif; + text-align: center; +} + +.height-container { + min-height: 100vh; + align-content: center; +} + +.privacy-content { + font-weight: 400; + margin-bottom: 10px; + font-family: Roboto, sans-serif; +} diff --git a/src/app/checkout/success/success.component.html b/src/app/checkout/success/success.component.html new file mode 100644 index 0000000..dd855c4 --- /dev/null +++ b/src/app/checkout/success/success.component.html @@ -0,0 +1,7 @@ +
+
+
+

{{ 'SUCCESS' | translate }}

+

{{ 'SUCCESS_SUB' | translate }}

+
+
diff --git a/src/app/checkout/success/success.component.ts b/src/app/checkout/success/success.component.ts new file mode 100644 index 0000000..3c2ce0c --- /dev/null +++ b/src/app/checkout/success/success.component.ts @@ -0,0 +1,51 @@ +import {AfterViewInit, Component, Inject, OnDestroy, OnInit, PLATFORM_ID} from '@angular/core'; +import {isPlatformBrowser} from '@angular/common'; +import {TranslatePipe} from '@ngx-translate/core'; +import {VantaBackgroundService} from '../../shared/services/vanta-background.service'; +import {DeviceDetectorService} from '../../shared/services/device-detector.service'; +import {Title} from '@angular/platform-browser'; + +@Component({ + selector: 'app-success', + imports: [ + TranslatePipe + ], + templateUrl: './success.component.html', + styleUrl: './success.component.css' +}) +export class SuccessComponent implements OnInit, OnDestroy, AfterViewInit { + private readonly elementId = 'vanta-success-bg'; + isMobile: boolean = false; + + constructor( + private vantaService: VantaBackgroundService, + private deviceService: DeviceDetectorService, + private titleService: Title, + @Inject(PLATFORM_ID) private platformId: Object + ) {} + + ngOnInit() { + this.titleService.setTitle('Checkout | itzMiney'); + this.isMobile = this.deviceService.isMobile; + if (isPlatformBrowser(this.platformId)) { + window.addEventListener('resize', this.onResize.bind(this)); + } + } + + ngAfterViewInit() { + this.vantaService.initVanta(this.elementId, { + color: 0x5b417a, + backgroundColor: 0x41e3c + }); + } + ngOnDestroy() { + this.vantaService.destroyVanta(this.elementId); + if (isPlatformBrowser(this.platformId)) { + window.removeEventListener('resize', this.onResize); + } + } + + onResize() { + this.vantaService.resizeVanta(this.elementId); + } +} diff --git a/src/app/services/services.component.css b/src/app/services/services.component.css index 8fe4d9b..66f648f 100644 --- a/src/app/services/services.component.css +++ b/src/app/services/services.component.css @@ -116,6 +116,24 @@ color: #ffffff; } +.buy-button { + background-color: rgba(187, 107, 209, 0.5); + border: none; + border-radius: 25px; + color: white; + padding: 10px; + margin-inline: 15px; + margin-top: 20px; + font-size: 1rem; + cursor: pointer; + width: 110px; + display: inline-block; +} + +.buy-button:hover { + background-color: rgba(187, 107, 209, 0.62); +} + .tab-content { margin-top: 10px; font-size: 0.9rem; diff --git a/src/app/services/services.component.html b/src/app/services/services.component.html index 6b7af94..2ae7417 100644 --- a/src/app/services/services.component.html +++ b/src/app/services/services.component.html @@ -22,16 +22,23 @@ + (click)="switchTab(i, 'basic')"> + Basic + - -
-
-
+ (click)="switchTab(i, 'advanced')"> + Advanced +
+
+ diff --git a/src/app/services/services.component.ts b/src/app/services/services.component.ts index 797a309..52e305f 100644 --- a/src/app/services/services.component.ts +++ b/src/app/services/services.component.ts @@ -22,7 +22,13 @@ export class ServicesComponent implements OnInit, OnDestroy, AfterViewInit { isMobile: boolean = false; activeTab: string[] = []; - services: { name: string; basic: string; advanced: string }[] = []; + services: { + name: string; + basic: string; + advanced: string; + basicPriceId: string; + advancedPriceId: string; + }[] = []; constructor( private vantaService: VantaBackgroundService, @@ -48,6 +54,9 @@ export class ServicesComponent implements OnInit, OnDestroy, AfterViewInit { loadServices(): void { this.translate.get([ + 'SERVICES.PTERO_NAME', + 'SERVICES.PTERO_BASIC', + 'SERVICES.PTERO_ADVANCED', 'SERVICES.SUPPORT_NAME', 'SERVICES.SUPPORT_BASIC', 'SERVICES.SUPPORT_ADVANCED', @@ -68,35 +77,54 @@ export class ServicesComponent implements OnInit, OnDestroy, AfterViewInit { 'SERVICES.SERVER_SETUP_ADVANCED' ]).subscribe(translations => { this.services = [ + { + name: translations['SERVICES.PTERO_NAME'], + basic: translations['SERVICES.PTERO_BASIC'], + advanced: translations['SERVICES.PTERO_ADVANCED'], + basicPriceId: 'price_1RscMR2LT0gYeSqcQ7SDj6gG', + advancedPriceId: 'price_1RscMR2LT0gYeSqcQ7SDj6gG' + }, { name: translations['SERVICES.SUPPORT_NAME'], basic: translations['SERVICES.SUPPORT_BASIC'], - advanced: translations['SERVICES.SUPPORT_ADVANCED'] + advanced: translations['SERVICES.SUPPORT_ADVANCED'], + basicPriceId: '', + advancedPriceId: '' }, { name: translations['SERVICES.WP_FILES_NAME'], basic: translations['SERVICES.WP_FILES_BASIC'], - advanced: translations['SERVICES.WP_FILES_ADVANCED'] + advanced: translations['SERVICES.WP_FILES_ADVANCED'], + basicPriceId: '', + advancedPriceId: '' }, { name: translations['SERVICES.WP_SETUP_NAME'], basic: translations['SERVICES.WP_SETUP_BASIC'], - advanced: translations['SERVICES.WP_SETUP_ADVANCED'] + advanced: translations['SERVICES.WP_SETUP_ADVANCED'], + basicPriceId: '', + advancedPriceId: '' }, { name: translations['SERVICES.ANGULAR_FILES_NAME'], basic: translations['SERVICES.ANGULAR_FILES_BASIC'], - advanced: translations['SERVICES.ANGULAR_FILES_ADVANCED'] + advanced: translations['SERVICES.ANGULAR_FILES_ADVANCED'], + basicPriceId: '', + advancedPriceId: '' }, { name: translations['SERVICES.ANGULAR_SETUP_NAME'], basic: translations['SERVICES.ANGULAR_SETUP_BASIC'], - advanced: translations['SERVICES.ANGULAR_SETUP_ADVANCED'] + advanced: translations['SERVICES.ANGULAR_SETUP_ADVANCED'], + basicPriceId: '', + advancedPriceId: '' }, { name: translations['SERVICES.SERVER_SETUP_NAME'], basic: translations['SERVICES.SERVER_SETUP_BASIC'], - advanced: translations['SERVICES.SERVER_SETUP_ADVANCED'] + advanced: translations['SERVICES.SERVER_SETUP_ADVANCED'], + basicPriceId: '', + advancedPriceId: '' } ]; @@ -121,4 +149,29 @@ export class ServicesComponent implements OnInit, OnDestroy, AfterViewInit { // Update the minHeight and minWidth when the window is resized this.vantaService.resizeVanta(this.elementId); } + + checkout(priceId: string): void { + fetch('http://localhost:7020/api/stripe/create-checkout-session', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ priceId }) + }) + .then(res => res.json()) + .then(data => { + if (data.url) { + window.location.href = data.url; + } else { + alert('Checkout session failed.'); + } + }) + .catch(err => { + console.error('Stripe error:', err); + alert('Error creating checkout session.'); + }); + } + + getActivePriceId(service: any, activeTab: string): string | null { + const priceId = activeTab === 'basic' ? service.basicPriceId : service.advancedPriceId; + return priceId?.trim() || null; + } }