Skip to content

Commit

Permalink
Checkout agreements in the global slideover (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
indykoning authored Dec 13, 2024
1 parent 0868229 commit 36d2ebf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 37 deletions.
1 change: 1 addition & 0 deletions resources/views/checkout/pages/onestep.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
@include('rapidez::checkout.steps.payment_method')
</div>
<div>
@include('rapidez::checkout.steps.agreements')
@include('rapidez::checkout.steps.place_order')
</div>
</form>
Expand Down
61 changes: 24 additions & 37 deletions resources/views/checkout/steps/agreements.blade.php
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
@php($checkoutAgreements ??= \Rapidez\Core\Models\CheckoutAgreement::all())
@return(!$checkoutAgreements->count())

@foreach ($checkoutAgreements as $agreement)
<x-rapidez::slideover position="right" id="{{ $agreement->agreement_id }}_agreement">
<x-slot name="title">
{{ $agreement->name }}
</x-slot>

@if ($agreement->is_html)
<div class="p-3">
{!! $agreement->content !!}
</div>
@else
<div class="whitespace-pre-line p-3">
{{ $agreement->content }}
</div>
@endif
</x-rapidez::slideover>

@if ($agreement->mode == 'AUTO')
<label class="text text-sm cursor-pointer underline hover:no-underline" for="{{ $agreement->agreement_id }}_agreement">
{{ $agreement->checkbox_text }}
</label>
@else
<div>
<x-rapidez::input.checkbox.base
name="agreement_ids[]"
:value="$agreement->agreement_id"
dusk="agreements"
required
/>
<label class="text text-sm cursor-pointer underline hover:no-underline" for="{{ $agreement->agreement_id }}_agreement">
{{ $agreement->checkbox_text }}
</label>
<graphql query="{ checkoutAgreements { agreement_id name checkbox_text content is_html mode } }" cache="checkout.agreements" v-cloak>
<div slot-scope="{ data }" v-if="data">
<div v-for="agreement in data.checkoutAgreements" :key="agreement.agreement_id">
<global-slideover :title="agreement.name" :content="'<div class=&quot;p-3' + (!agreement.is_html ? ' whitespace-pre-line' : '') + '&quot;>' + agreement.content + '</div>'" v-slot="slideover">
<template v-if="agreement.mode == 'AUTO'">
<label class="text-gray-700 cursor-pointer underline hover:no-underline" v-on:click="slideover.open">
@{{ agreement.checkbox_text }}
</label>
</template>
<div v-else>
<x-rapidez::input.checkbox
name="agreement_ids[]"
v-bind:value="agreement.agreement_id"
dusk="agreements"
required
>
<label class="text-gray-700 cursor-pointer underline hover:no-underline" v-on:click="slideover.open">
@{{ agreement.checkbox_text }}
</label>
</x-rapidez::input.checkbox>
</div>
</global-slideover>
</div>
@endif
@endforeach
</div>
</graphql>

0 comments on commit 36d2ebf

Please sign in to comment.