Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions resources/views/cart/content.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
@include('rapidez-ct::cart.partials.cart-title')

<x-rapidez-ct::alert v-if="!canOrder.value" class="mt-5">
<template v-if="cart.value.items.filter(item => !item.is_available || item.errors?.length).length > 1">
@lang(':count items need your attention before you can check out.', ['count' => '@{{ cart.value.items.filter(item => !item.is_available || item.errors?.length).length }}'])
</template>
<template v-else>
@lang('1 item needs your attention before you can check out.')
</template>
</x-rapidez-ct::alert>

<x-rapidez-ct::layout class="mt-5">
@include('rapidez-ct::cart.cart')
<x-slot:sidebar>
Expand Down
30 changes: 16 additions & 14 deletions resources/views/cart/partials/product/alert.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<div
class="flex self-start items-center rounded-sm gap-x-1 font-medium text-primary border border-yellow-300 bg-yellow-100 text-xs w-fit max-xl:absolute max-xl:top-2 max-xl:right-0 py-0.5"
v-if="item.qty_backordered"
>
<x-heroicon-o-exclamation-circle class="text-yellow-500 mt-px w-5" />
<span>
<template v-if="item.qty_backordered < item.qty">
@lang(':count of the requested quantity will be backordered', ['count' => '@{{ item.qty_backordered }}'])
</template>
<template v-else>
@lang('This product will be backordered')
</template>
</span>
</div>
<x-rapidez-ct::alert class="self-start max-xl:absolute max-xl:top-2 max-xl:right-0" v-if="item.qty_backordered">
<template v-if="item.qty_backordered < item.qty">
@lang(':count of the requested quantity will be backordered', ['count' => '@{{ item.qty_backordered }}'])
</template>
<template v-else>
@lang('This product will be backordered')
</template>
</x-rapidez-ct::alert>
<x-rapidez-ct::alert v-if="!item.is_available" class="my-2 max-w-sm">
@lang('This product is out of stock, remove it to continue your order.')
</x-rapidez-ct::alert>
<template v-else v-for="error in item.errors ?? []">
<x-rapidez-ct::alert class="my-2 max-w-sm">
@{{ error.message }}
</x-rapidez-ct::alert>
</template>
5 changes: 1 addition & 4 deletions resources/views/cart/partials/product/description.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<td class="flex max-md:w-1/2 md:table-cell">
@include('rapidez-ct::cart.partials.product.alert')
<div class="flex flex-col items-start">
<div>
<a :href="window.url(item.product.url_key + item.product.url_suffix)" data-testid="cart-item-name">@{{ item.product.name }}</a>
Expand All @@ -9,9 +8,7 @@
<div v-for="option in item.customizable_options">
@{{ option.label }}: @{{ option.values[0].label || option.values[0].value }}
</div>
<div v-if="!item.is_available" class="text-ct-error text-balance bg-ct-error/5 my-2 max-w-sm p-2">
@lang('This product is out of stock, remove it to continue your order.')
</div>
@include('rapidez-ct::cart.partials.product.alert')
<div v-for="option in config.cart_attributes">
<template v-if="item.product.attribute_values?.[option] && typeof item.product.attribute_values[option] === 'object'">
@{{ option }}: <span v-html="item.product.attribute_values[option]?.join(', ')"></span>
Expand Down
7 changes: 6 additions & 1 deletion resources/views/cart/partials/sidebar/summary.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@
</div>
</x-rapidez-ct::separated-listing>

<x-rapidez::button.conversion :href="route('checkout')" class="flex w-full items-center justify-center gap-1 mt-6" data-testid="checkout">
<x-rapidez::button.conversion
class="flex w-full items-center justify-center gap-1 mt-6"
v-bind:disabled="!canOrder.value || loading.value"
v-on:click="window.Turbo.visit(window.url('{{ route('checkout') }}'))"
data-testid="checkout"
>
@lang('To checkout')
<x-heroicon-o-arrow-right class="size-4" />
</x-rapidez::button.conversion>
Expand Down
4 changes: 4 additions & 0 deletions resources/views/components/alert.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div {{ $attributes->class('flex items-start rounded-sm gap-x-1 font-medium text-yellow-800 border border-yellow-300 bg-yellow-100 text-xs w-fit px-2 py-1') }}>
<x-heroicon-o-exclamation-circle class="w-5 shrink-0" />
<span class="mt-0.5">{{ $slot }}</span>
</div>
Loading