Vendor Portal stubs

This commit is contained in:
David Bomba 2022-06-13 20:34:40 +10:00
parent 6674424244
commit 31054c8a13
8 changed files with 38 additions and 11 deletions

View File

@ -53,7 +53,7 @@ class PurchaseOrderController extends Controller
public function index(ShowPurchaseOrdersRequest $request)
{
return $this->render('purchase_orders.index');
return $this->render('purchase_orders.index', ['company' => auth()->user()->company, 'settings' => auth()->user()->company->settings, 'sidebar' => $this->sidebarMenu()]);
}
/**

View File

@ -76,13 +76,13 @@ class PurchaseOrdersTable extends Component
// }
$query = $query
->where('vendor_id', auth()->guard('vendor')->user()->client_id)
->where('vendor_id', auth()->guard('vendor')->user()->vendor_id)
// ->where('status_id', '<>', Invoice::STATUS_DRAFT)
// ->where('status_id', '<>', Invoice::STATUS_CANCELLED)
->withTrashed()
->paginate($this->per_page);
return render('components.livewire.purchase_orders-table', [
return render('components.livewire.purchase-orders-table', [
'purchase_orders' => $query
]);
}

View File

@ -123,6 +123,30 @@ class PurchaseOrder extends BaseModel
break;
}
}
public static function badgeForStatus(int $status)
{
switch ($status) {
case self::STATUS_DRAFT:
return '<h5><span class="badge badge-light">'.ctrans('texts.draft').'</span></h5>';
break;
case self::STATUS_SENT:
return '<h5><span class="badge badge-primary">'.ctrans('texts.sent').'</span></h5>';
break;
case self::STATUS_APPROVED:
return '<h5><span class="badge badge-primary">'.ctrans('texts.approved').'</span></h5>';
break;
case self::STATUS_CANCELLED:
return '<h5><span class="badge badge-secondary">'.ctrans('texts.cancelled').'</span></h5>';
break;
default:
// code...
break;
}
}
public function assigned_user()
{
return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed();

View File

@ -245,7 +245,7 @@ class GoCardlessPaymentDriver extends BaseDriver
sleep(1);
foreach ($request->events as $event) {
if ($event['action'] === 'confirmed' || $event['action'] === 'paid_out' || $event['action'] === 'paid') {
if ($event['action'] === 'confirmed' || $event['action'] === 'paid_out') {
nlog("Searching for transaction reference");

View File

@ -4627,6 +4627,8 @@ $LANG = array(
'notification_purchase_order_viewed' => 'The following vendor :client viewed Purchase Order :invoice for :amount.',
'purchase_order_date' => 'Purchase Order Date',
'purchase_orders' => 'Purchase Orders',
'purchase_order_number_placeholder' => 'Purchase Order # :purchase_order',
);
return $LANG;

View File

@ -79,19 +79,19 @@
{{ $purchase_order->number }}
</td>
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
{{ $purchase_order->translateDate($purchase_order->date, $invoice->company->date_format(), $invoice->company->locale()) }}
{{ $purchase_order->translateDate($purchase_order->date, $purchase_order->company->date_format(), $purchase_order->company->locale()) }}
</td>
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
{{ App\Utils\Number::formatMoney($purchase_order->amount, $purchase_order->company) }}
</td>
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
{{ App\Utils\Number::formatMoney($purchase_order->balance, $invoice->company) }}
{{ App\Utils\Number::formatMoney($purchase_order->balance, $purchase_order->company) }}
</td>
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
{{ $purchase_order->translateDate($purchase_order->due_date, $invoice->company->date_format(), $purchase_order->company->locale()) }}
{{ $purchase_order->translateDate($purchase_order->due_date, $purchase_order->company->date_format(), $purchase_order->company->locale()) }}
</td>
<td class="px-6 py-4 text-sm leading-5 text-gray-500 whitespace-nowrap">
{!! App\Models\PurchaseOrder::badgeForStatus($purchase_order->status) !!}
{!! App\Models\PurchaseOrder::badgeForStatus($purchase_order->status_id) !!}
</td>
<td class="flex items-center justify-end px-6 py-4 text-sm font-medium leading-5 whitespace-nowrap">
<a href="{{ route('vendor.purchase_order.show', $purchase_order->hashed_id) }}" class="button-link text-primary">
@ -111,7 +111,7 @@
</div>
</div>
<div class="flex justify-center mt-6 mb-6 md:justify-between">
@if($invoices && $invoices->total() > 0)
@if($purchase_orders && $purchase_orders->total() > 0)
<span class="hidden text-sm text-gray-700 md:block mr-2">
{{ ctrans('texts.showing_x_of', ['first' => $purchase_orders->firstItem(), 'last' => $purchase_orders->lastItem(), 'total' => $purchase_orders->total()]) }}
</span>

View File

@ -1,4 +1,4 @@
@extends('portal.ninja2020.layout.app')
@extends('portal.ninja2020.layout.vendor_app')
@section('meta_title', ctrans('texts.purchase_orders'))
@section('header')
@ -20,6 +20,6 @@
</form>
</div>
<div class="flex flex-col mt-4">
@livewire('purchase_orders-table', ['company' => $company])
@livewire('purchase-orders-table', ['company' => $company])
</div>
@endsection

View File

@ -29,5 +29,6 @@ Route::group(['middleware' => ['auth:vendor', 'vendor_locale', 'domain_db'], 'pr
Route::get('purchase_orders/{purchase_order}', [PurchaseOrderController::class, 'show'])->name('purchase_order.show');
Route::get('profile/{vendor_contact}/edit', [PurchaseOrderController::class, 'index'])->name('profile.edit');
Route::post('invoices/payment', [PurchaseOrderController::class, 'bulk'])->name('purchase_orders.bulk');
});