1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

More Livewire v3 tweaks

This commit is contained in:
Jason Beggs 2023-12-14 20:29:47 -05:00
parent 3ad837a517
commit 032648f18b
9 changed files with 26 additions and 29 deletions

View File

@ -251,7 +251,7 @@ class BillingPortalPurchase extends Component
$company = $this->subscription->company; $company = $this->subscription->company;
$user = $this->subscription->user; $user = $this->subscription->user;
$user->setCompany($company); $user->setCompany($company);
$client_repo = new ClientRepository(new ClientContactRepository()); $client_repo = new ClientRepository(new ClientContactRepository());
$data = [ $data = [
@ -432,7 +432,7 @@ class BillingPortalPurchase extends Component
public function handlePaymentNotRequired() public function handlePaymentNotRequired()
{ {
$is_eligible = $this->subscription->service()->isEligible($this->contact); $is_eligible = $this->subscription->service()->isEligible($this->contact);
if ($is_eligible['status_code'] != 200) { if ($is_eligible['status_code'] != 200) {
$this->steps['not_eligible'] = true; $this->steps['not_eligible'] = true;
$this->steps['not_eligible_message'] = $is_eligible['message']; $this->steps['not_eligible_message'] = $is_eligible['message'];

View File

@ -190,9 +190,10 @@ class RequiredClientInfo extends Component
} }
if ($this->updateClientDetails($data)) { if ($this->updateClientDetails($data)) {
$this->emit('passed-required-fields-check', [ $this->dispatch(
'client_postal_code' => $this->contact->client->postal_code, 'passed-required-fields-check',
]); client_postal_code: $this->contact->client->postal_code
);
//if stripe is enabled, we want to update the customer at this point. //if stripe is enabled, we want to update the customer at this point.
@ -258,7 +259,6 @@ class RequiredClientInfo extends Component
} }
if (Str::startsWith($field['name'], 'contact_')) { if (Str::startsWith($field['name'], 'contact_')) {
if (empty($this->contact->{$_field}) || is_null($this->contact->{$_field}) || str_contains($this->contact->{$_field}, '@example.com')) { if (empty($this->contact->{$_field}) || is_null($this->contact->{$_field}) || str_contains($this->contact->{$_field}, '@example.com')) {
$this->show_form = true; $this->show_form = true;
} else { } else {
@ -289,14 +289,15 @@ class RequiredClientInfo extends Component
public function handleCopyBilling(): void public function handleCopyBilling(): void
{ {
$this->emit('update-shipping-data', [ $this->dispatch(
'client_shipping_address_line_1' => $this->contact->client->address1, 'update-shipping-data',
'client_shipping_address_line_2' => $this->contact->client->address2, client_shipping_address_line_1: $this->contact->client->address1,
'client_shipping_city' => $this->contact->client->city, client_shipping_address_line_2: $this->contact->client->address2,
'client_shipping_state' => $this->contact->client->state, client_shipping_city: $this->contact->client->city,
'client_shipping_postal_code' => $this->contact->client->postal_code, client_shipping_state: $this->contact->client->state,
'client_shipping_country_id' => $this->contact->client->country_id, client_shipping_postal_code: $this->contact->client->postal_code,
]); client_shipping_country_id: $this->contact->client->country_id,
);
} }
public function render() public function render()

View File

@ -100,7 +100,7 @@ return [
| |
*/ */
'legacy_model_binding' => false, 'legacy_model_binding' => true,
/* /*
|--------------------------------------------------------------------------- |---------------------------------------------------------------------------

View File

@ -49,7 +49,6 @@
<!-- Scripts --> <!-- Scripts -->
@vite('resources/js/app.js') @vite('resources/js/app.js')
<script src="{{ asset('vendor/alpinejs@2.8.2/alpine.js') }}" defer></script>
<!-- Fonts --> <!-- Fonts -->
{{-- <link rel="dns-prefetch" href="https://fonts.gstatic.com"> --}} {{-- <link rel="dns-prefetch" href="https://fonts.gstatic.com"> --}}

View File

@ -10,7 +10,7 @@
</p> </p>
</div> </div>
<form id="required-client-info-form" wire:submit="handleSubmit(Object.fromEntries(new FormData(document.getElementById('required-client-info-form'))))"> <form id="required-client-info-form" x-on:submit.prevent="$wire.handleSubmit(Object.fromEntries(new FormData(document.getElementById('required-client-info-form'))))">
@foreach($fields as $field) @foreach($fields as $field)
@if(!array_key_exists('filled', $field)) @if(!array_key_exists('filled', $field))
@component('portal.ninja2020.components.general.card-element', ['title' => $field['label']]) @component('portal.ninja2020.components.general.card-element', ['title' => $field['label']])
@ -48,16 +48,16 @@
@if($show_terms) @if($show_terms)
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.terms_of_service') ]) @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.terms_of_service') ])
<div x-data="{ open: false }"> <div x-data="{ open: false }">
<input <input
wire:click="toggleTermsAccepted()" wire:click="toggleTermsAccepted()"
id="terms" id="terms"
name="terms_accepted" name="terms_accepted"
type="checkbox" type="checkbox"
class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500" class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
/> />
<a href="#" class="group relative inline-block ml-4 text-blue-500 hover:text-red-500 duration-300 no-underline" @click="open = true">{{ ctrans('texts.agree_to_terms', ['terms' => ctrans('texts.terms')]) }}</a> <a href="#" class="group relative inline-block ml-4 text-blue-500 hover:text-red-500 duration-300 no-underline" @click="open = true">{{ ctrans('texts.agree_to_terms', ['terms' => ctrans('texts.terms')]) }}</a>
<div x-show="open" class="fixed bottom-0 inset-x-0 px-4 pb-4 sm:inset-0 sm:flex sm:items-center sm:justify-center z-50" <div x-show="open" class="fixed bottom-0 inset-x-0 px-4 pb-4 sm:inset-0 sm:flex sm:items-center sm:justify-center z-50"
@ -102,7 +102,7 @@
</div> </div>
@endcomponent @endcomponent

View File

@ -1,4 +1,4 @@
<div x-data="{ open: false }" style="display: none;" id="displaySignatureModal" class="fixed bottom-0 inset-x-0 px-4 pb-4 sm:inset-0 sm:flex sm:items-center sm:justify-center" x-data="{ open: false }"> <div style="display: none;" id="displaySignatureModal" class="fixed bottom-0 inset-x-0 px-4 pb-4 sm:inset-0 sm:flex sm:items-center sm:justify-center" x-data="{ open: true }">
<div x-show="open" x-transition:enter="ease-out duration-300" x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100" x-transition:leave="ease-in duration-200" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" class="fixed inset-0 transition-opacity"> <div x-show="open" x-transition:enter="ease-out duration-300" x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100" x-transition:leave="ease-in duration-200" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" class="fixed inset-0 transition-opacity">
<div class="absolute inset-0 bg-gray-500 opacity-75"></div> <div class="absolute inset-0 bg-gray-500 opacity-75"></div>
</div> </div>

View File

@ -66,7 +66,6 @@
@else @else
<script src="{{ str_replace("setup", "", Request::url())}}js/app.js" defer></script> <script src="{{ str_replace("setup", "", Request::url())}}js/app.js" defer></script>
@endif @endif
<script src="{{ asset('vendor/alpinejs@2.8.2/alpine.js') }}" defer></script>
<!-- Fonts --> <!-- Fonts -->
{{-- <link rel="dns-prefetch" href="https://fonts.gstatic.com"> --}} {{-- <link rel="dns-prefetch" href="https://fonts.gstatic.com"> --}}
@ -89,7 +88,7 @@
@else @else
<link href="{{ str_replace("setup", "", Request::url())}}css/app.css" rel="stylesheet"> <link href="{{ str_replace("setup", "", Request::url())}}css/app.css" rel="stylesheet">
@endif @endif
@if(auth()->guard('contact')->user() && !auth()->guard('contact')->user()->user->account->isPaid()) @if(auth()->guard('contact')->user() && !auth()->guard('contact')->user()->user->account->isPaid())
{{-- <link href="{{ mix('favicon.png') }}" rel="shortcut icon" type="image/png"> --}} {{-- <link href="{{ mix('favicon.png') }}" rel="shortcut icon" type="image/png"> --}}
@endif @endif

View File

@ -65,7 +65,6 @@
<!-- Scripts --> <!-- Scripts -->
@vite('resources/js/app.js') @vite('resources/js/app.js')
<script src="{{ asset('vendor/alpinejs@2.8.2/alpine.js') }}" defer></script>
<!-- Fonts --> <!-- Fonts -->
{{-- <link rel="dns-prefetch" href="https://fonts.gstatic.com"> --}} {{-- <link rel="dns-prefetch" href="https://fonts.gstatic.com"> --}}

View File

@ -1,4 +1,4 @@
<form action="{{ route('client.quotes.bulk') }}" method="post" id="approve-form" /> <form action="{{ route('client.quotes.bulk') }}" method="post" id="approve-form">
@csrf @csrf
<input type="hidden" name="action" value="approve"> <input type="hidden" name="action" value="approve">
@ -11,18 +11,17 @@
<div class="px-4 py-5 sm:p-6"> <div class="px-4 py-5 sm:p-6">
<div class="sm:flex sm:items-start sm:justify-between"> <div class="sm:flex sm:items-start sm:justify-between">
<div> <div>
<h3 class="text-lg leading-6 font-medium text-gray-900"> <h3 class="text-lg leading-6 font-medium text-gray-900">
{{ ctrans('texts.approve') }} {{ ctrans('texts.approve') }}
</h3> </h3>
<div class="btn hidden md:block" data-clipboard-text="{{url("client/quote/{$key}")}}" aria-label="Copied!"> <div class="btn hidden md:block" data-clipboard-text="{{url("client/quote/{$key}")}}" aria-label="Copied!">
<div class="flex text-sm leading-6 font-medium text-gray-500"> <div class="flex text-sm leading-6 font-medium text-gray-500">
<p class="mr-2">{{url("client/quote/{$key}")}}</p> <p class="mr-2">{{url("client/quote/{$key}")}}</p>
<p><img class="h-5 w-5" src="{{ asset('assets/clippy.svg') }}" alt="Copy to clipboard"></p> <p><img class="h-5 w-5" src="{{ asset('assets/clippy.svg') }}" alt="Copy to clipboard"></p>
</div> </div>
</div> </div>
</div> </div>
<div class="mt-5 sm:mt-0 sm:ml-6 sm:flex-shrink-0 sm:flex sm:items-center"> <div class="mt-5 sm:mt-0 sm:ml-6 sm:flex-shrink-0 sm:flex sm:items-center">