Fixes for contact login

This commit is contained in:
David Bomba 2021-12-07 22:46:29 +11:00
commit 651346fb89
12 changed files with 18 additions and 20 deletions

View File

@ -42,9 +42,7 @@ class ContactLoginController extends Controller
if($request->has('company_key')){
MultiDB::findAndSetDbByCompanyKey($request->input('company_key'));
$company = Company::where('company_key', $request->input('company_key'))->first();
}
if($company){
@ -52,10 +50,7 @@ class ContactLoginController extends Controller
}
elseif (!$company && strpos($request->getHost(), 'invoicing.co') !== false) {
$subdomain = explode('.', $request->getHost())[0];
nlog("subdomain = {$subdomain}");
MultiDB::findAndSetDbByDomain(['subdomain' => $subdomain]);
$company = Company::where('subdomain', $subdomain)->first();
} elseif(Ninja::isHosted()){

View File

@ -25,7 +25,7 @@ class ContactHashLoginController extends Controller
*/
public function login(string $contact_key)
{
if(request()->has('subscription') && $request->subscription == 'true') {
if(request()->has('subscription') && request()->subscription == 'true') {
$recurring_invoice = RecurringInvoice::where('client_id', auth()->guard('contact')->client->id)
->whereNotNull('subscription_id')

View File

@ -43,6 +43,7 @@ class InvoicesTable extends Component
$local_status = [];
$query = Invoice::query()
->with('client.gateway_tokens','company','client.contacts')
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->where('company_id', $this->company->id)
->where('is_deleted', false);
@ -82,6 +83,7 @@ class InvoicesTable extends Component
return render('components.livewire.invoices-table', [
'invoices' => $query,
'gateway_available' => !empty(auth()->user()->client->service()->getPaymentMethods(0)),
]);
}
}

View File

@ -38,6 +38,7 @@ class QuotesTable extends Component
public function render()
{
$query = Quote::query()
->with('client.gateway_tokens','company','client.contacts')
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
if (count($this->status) > 0) {

View File

@ -29,7 +29,7 @@ class CheckClientExistence
public function handle(Request $request, Closure $next)
{
$multiple_contacts = ClientContact::query()
->with('company','client')
->with('client.gateway_tokens')
->where('email', auth('contact')->user()->email)
->whereNotNull('email')
->where('email', '<>', '')

View File

@ -19,10 +19,11 @@ class ContactRegister
*/
public function handle($request, Closure $next)
{
$domain_name = $request->getHost();
if (strpos($request->getHost(), 'invoicing.co') !== false)
if (strpos($domain_name, 'invoicing.co') !== false)
{
$subdomain = explode('.', $request->getHost())[0];
$subdomain = explode('.', $domain_name)[0];
$query = [
'subdomain' => $subdomain,
@ -86,6 +87,6 @@ class ContactRegister
return $next($request);
}
abort(404, 'ContactRegister Middlware');
abort(404, 'ContactRegister Middleware');
}
}

View File

@ -38,10 +38,11 @@ class SetDomainNameDb
if(!config('ninja.db.multi_db_enabled'))
return $next($request);
$domain_name = $request->getHost();
if (strpos($request->getHost(), 'invoicing.co') !== false)
if (strpos($domain_name, 'invoicing.co') !== false)
{
$subdomain = explode('.', $request->getHost())[0];
$subdomain = explode('.', $domain_name)[0];
$query = [
'subdomain' => $subdomain,
@ -86,8 +87,6 @@ class SetDomainNameDb
}
// config(['app.url' => $request->getSchemeAndHttpHost()]);
return $next($request);
}
}

View File

@ -49,7 +49,7 @@ class InvoiceTransformer extends BaseTransformer {
'due_date' => isset( $invoice_data['invoice.due_date'] ) ? date( 'Y-m-d', strtotime( $invoice_data['invoice.due_date'] ) ) : null,
'terms' => $this->getString( $invoice_data, 'invoice.terms' ),
'public_notes' => $this->getString( $invoice_data, 'invoice.public_notes' ),
'is_sent' => $this->getString( $invoice_data, 'invoice.is_sent' ),
// 'is_sent' => $this->getString( $invoice_data, 'invoice.is_sent' ),
'private_notes' => $this->getString( $invoice_data, 'invoice.private_notes' ),
'tax_name1' => $this->getString( $invoice_data, 'invoice.tax_name1' ),
'tax_rate1' => $this->getFloat( $invoice_data, 'invoice.tax_rate1' ),

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"/livewire.js":"/livewire.js?id=21fa1dd78491a49255cd"}
{"/livewire.js":"/livewire.js?id=ece4c4ab4b746f6f1739"}

View File

@ -94,7 +94,7 @@
{!! App\Models\Invoice::badgeForStatus($invoice->status) !!}
</td>
<td class="flex items-center justify-end px-6 py-4 text-sm font-medium leading-5 whitespace-nowrap">
@if($invoice->isPayable() && $invoice->balance > 0 && !empty(auth()->user()->client->service()->getPaymentMethods(0)))
@if($invoice->isPayable() && $invoice->balance > 0 && $gateway_available)
<form action="{{ route('client.invoices.bulk') }}" method="post">
@csrf
<input type="hidden" name="invoices[]" value="{{ $invoice->hashed_id }}">
@ -121,7 +121,7 @@
</div>
</div>
<div class="flex justify-center mt-6 mb-6 md:justify-between">
@if($invoices->total() > 0)
@if($invoices && $invoices->total() > 0)
<span class="hidden text-sm text-gray-700 md:block mr-2">
{{ ctrans('texts.showing_x_of', ['first' => $invoices->firstItem(), 'last' => $invoices->lastItem(), 'total' => $invoices->total()]) }}
</span>