admin side for now | 🔄 started FE

This commit is contained in:
user
2025-10-21 13:11:31 +03:00
parent 3232542de1
commit 5f4e9fc7fc
65 changed files with 3605 additions and 1508 deletions

View File

@@ -0,0 +1,7 @@
import { getProductUseCases } from "$lib/domains/product/usecases";
import type { PageServerLoad } from "./$types";
export const load: PageServerLoad = async ({ params }) => {
const pid = params.pageid;
return await getProductUseCases().getProductByLinkId(pid);
};

View File

@@ -1,4 +1,23 @@
<script lang="ts">
import { onMount } from "svelte";
import { toast } from "svelte-sonner";
import type { PageData } from "./$types";
let { data }: { data: PageData } = $props();
onMount(() => {
toast("Do the check here to then either redirect or show the error");
setTimeout(() => {
toast("redirect to checkout naw");
}, 3000);
});
</script>
<span>Show the thing to do the thing about the thing around the thing</span>
{#if data.data}
<span>
Either show the user the product as being valid and redirecting them to
the checkout
</span>
{:else}
<span>Show the user an error around "page not found" or "expired link"</span>
{/if}

View File

@@ -1,41 +1,27 @@
<script lang="ts">
import { onDestroy, onMount } from "svelte";
import type { PageData } from "./$types";
import Icon from "$lib/components/atoms/icon.svelte";
import Title from "$lib/components/atoms/title.svelte";
import Button from "$lib/components/ui/button/button.svelte";
import SearchIcon from "~icons/solar/magnifer-linear";
import { toast } from "svelte-sonner";
import { ticketCheckoutVM } from "$lib/domains/ticket/view/checkout/flight-checkout.vm.svelte";
import { CheckoutStep } from "$lib/domains/ticket/data/entities/index";
import InitialInfoSection from "$lib/domains/ticket/view/checkout/initial-info-section.svelte";
import { flightTicketStore } from "$lib/domains/ticket/data/store";
import CheckoutLoadingSection from "$lib/domains/ticket/view/checkout/checkout-loading-section.svelte";
import CheckoutConfirmationSection from "$lib/domains/ticket/view/checkout/checkout-confirmation-section.svelte";
import CheckoutStepsIndicator from "$lib/domains/ticket/view/checkout/checkout-steps-indicator.svelte";
import PaymentInfoSection from "$lib/domains/ticket/view/checkout/payment-info-section/index.svelte";
import PaymentVerificationSection from "$lib/domains/ticket/view/checkout/payment-verification-section.svelte";
import PaymentSummary from "$lib/domains/ticket/view/checkout/payment-summary.svelte";
import MaxWidthWrapper from "$lib/components/molecules/max-width-wrapper.svelte";
import Button from "$lib/components/ui/button/button.svelte";
import { ckFlowVM } from "$lib/domains/ckflow/view/ckflow.vm.svelte";
import { CheckoutStep } from "$lib/domains/order/data/entities";
import { flightTicketStore } from "$lib/domains/ticket/data/store";
import CheckoutConfirmationSection from "$lib/domains/ticket/view/checkout/checkout-confirmation-section.svelte";
import CheckoutLoadingSection from "$lib/domains/ticket/view/checkout/checkout-loading-section.svelte";
import CheckoutStepsIndicator from "$lib/domains/ticket/view/checkout/checkout-steps-indicator.svelte";
import { checkoutVM } from "$lib/domains/ticket/view/checkout/checkout.vm.svelte";
import InitialInfoSection from "$lib/domains/ticket/view/checkout/initial-info-section.svelte";
import PaymentInfoSection from "$lib/domains/ticket/view/checkout/payment-info-section/index.svelte";
import PaymentSummary from "$lib/domains/ticket/view/checkout/payment-summary.svelte";
import PaymentVerificationSection from "$lib/domains/ticket/view/checkout/payment-verification-section.svelte";
import UpdatePriceDialog from "$lib/domains/ticket/view/checkout/update-price-dialog.svelte";
import { onDestroy, onMount } from "svelte";
import { toast } from "svelte-sonner";
import SearchIcon from "~icons/solar/magnifer-linear";
import type { PageData } from "./$types";
let { data: pageData }: { data: PageData } = $props();
function trackConversion() {
console.log("ct-ing");
let callback = function () {
console.log("ct-ed");
};
// window.gtag("event", "conversion", {
// send_to: "AW-17085207253/ZFAVCLD6tMkaENWl7tI_",
// value: 1.0,
// currency: "USD",
// event_callback: callback,
// });
return false;
}
onMount(() => {
if (pageData.error) {
toast.error(pageData.error.message, {
@@ -47,17 +33,16 @@
return;
}
flightTicketStore.set(pageData.data);
ticketCheckoutVM.loading = false;
ticketCheckoutVM.setupPinger();
checkoutVM.loading = false;
checkoutVM.setupPinger();
setTimeout(async () => {
await ckFlowVM.initFlow();
trackConversion();
}, 2000);
});
onDestroy(() => {
ticketCheckoutVM.reset();
checkoutVM.reset();
});
</script>
@@ -75,7 +60,7 @@
</Button>
</div>
</div>
{:else if ticketCheckoutVM.checkoutStep === CheckoutStep.Confirmation}
{:else if checkoutVM.checkoutStep === CheckoutStep.Confirmation}
<div class="grid w-full place-items-center p-4 py-32">
<CheckoutConfirmationSection />
</div>
@@ -84,13 +69,13 @@
<div class="flex w-full flex-col gap-8 lg:flex-row">
<div class="flex w-full flex-col">
<div class="flex w-full flex-col gap-12">
{#if ticketCheckoutVM.loading}
{#if checkoutVM.loading}
<CheckoutLoadingSection />
{:else if ticketCheckoutVM.checkoutStep === CheckoutStep.Initial}
{:else if checkoutVM.checkoutStep === CheckoutStep.Initial}
<InitialInfoSection />
{:else if ticketCheckoutVM.checkoutStep === CheckoutStep.Payment}
{:else if checkoutVM.checkoutStep === CheckoutStep.Payment}
<PaymentInfoSection />
{:else if ticketCheckoutVM.checkoutStep === CheckoutStep.Verification}
{:else if checkoutVM.checkoutStep === CheckoutStep.Verification}
<PaymentVerificationSection />
{/if}
</div>

View File

@@ -1,49 +0,0 @@
<script lang="ts">
import { page } from "$app/stores";
import MaxWidthWrapper from "$lib/components/molecules/max-width-wrapper.svelte";
import SearchedTicketsList from "$lib/domains/ticket/view/searched-tickets-list.svelte";
import TicketFiltersSelect from "$lib/domains/ticket/view/ticket-filters-select.svelte";
import TicketSearchInput from "$lib/domains/ticket/view/ticket-search-input.svelte";
import { flightTicketVM } from "$lib/domains/ticket/view/ticket.vm.svelte";
import { onMount } from "svelte";
import { toast } from "svelte-sonner";
function onSubmit() {
const out = flightTicketVM.setURLParams();
if (out.data) {
flightTicketVM.searchForTickets();
}
if (out.error) {
toast.error(out.error.message, { description: out.error.userHint });
}
}
onMount(() => {
flightTicketVM.loadStore($page.url.searchParams);
flightTicketVM.searching = true;
setTimeout(() => flightTicketVM.searchForTickets());
});
</script>
<div class="grid h-full min-h-[70vh] w-full place-items-center">
<section class="max-w-8xl flex w-full flex-col items-center gap-8 p-4 md:p-8">
<MaxWidthWrapper cls="flex w-full flex-col items-center gap-2">
<div
class="hidden w-full rounded-lg bg-white p-4 drop-shadow-lg lg:block"
>
<TicketSearchInput rowify {onSubmit} />
</div>
</MaxWidthWrapper>
<MaxWidthWrapper cls="flex gap-8 w-full h-full">
{#if flightTicketVM.tickets.length > 0}
<div
class="hidden h-max w-full max-w-sm flex-col rounded-lg bg-white p-8 shadow-lg lg:flex"
>
<TicketFiltersSelect />
</div>
{/if}
<SearchedTicketsList />
</MaxWidthWrapper>
</section>
</div>