Skip to content

Instantly share code, notes, and snippets.

@jongravois
Created October 26, 2020 16:26
Show Gist options
  • Save jongravois/70ebbefb3956a13befcb359a4297b4a3 to your computer and use it in GitHub Desktop.
Save jongravois/70ebbefb3956a13befcb359a4297b4a3 to your computer and use it in GitHub Desktop.
@push('pagetitle', 'Manifest Modeler')
<div>
<div class="relative p-4">
<x-page.header title="Manifest Modeler">
<div>
<a href="/modeler/creator">
<x-buttons.header-button
btnSize="inline"
type="button">
@svg('solid/plus', 'mr-2 h-4 w-4')
New Model
</x-buttons.header-button>
</a>
</div>
</x-page.header>
<div class="px-8 py-4 space-y-4">
<!-- Top Bar -->
<div class="flex justify-between">
<div class="w-1/3 flex items-center space-x-4">
<x-input.search
wire:model="search"
placeholder="Filter ..."/>
</div>
<div class="space-x-4 flex items-center">
<span class="flex items-center space-x-4">
<span class="cursor-pointer"
data-wenk="active"
wire:click="changeStatus('active')">
@if($this->status === 'active')
@svg('solid/check-circle', 'text-green h-4 w-4')
@else
@svg('solid/check-circle', 'text-gray-500 h-4 w-4')
@endif
</span>
<span class="cursor-pointer"
data-wenk="locked"
wire:click="changeStatus('locked')">
@if($this->status === 'locked')
@svg('solid/lock', 'text-gold h-4 w-4')
@else
@svg('solid/lock', 'text-gray-500 h-4 w-4')
@endif
</span>
<span class="cursor-pointer"
data-wenk="archived"
wire:click="changeStatus('archived')">
@if($this->status === 'archived')
@svg('solid/archive', 'text-red h-4 w-4')
@else
@svg('solid/archive', 'text-gray-500 h-4 w-4')
@endif
</span>
</span>
<x-dropdown label="Show/Hide">
<div class="p-4 bg-white space-y-2">
@foreach($columns as $col)
<div class="flex items-center">
<x-input.checkbox :label="$col['label']"
wire:model="columns.{{$col['field']}}.visible"/>
</div>
@endforeach
</div>
</x-dropdown>
<x-buttons.secondary wire:click="export">
<span class="flex">
@svg('solid/file-excel', 'mr-2 text-green h-4 w-4')
Export
</span>
</x-buttons.secondary>
</div>
</div>
<!-- Table -->
<div class="flex-col min-h-1/2 space-y-4">
<x-table>
<x-slot name="head">
<x-table.heading class="pr-0 w-8" />
@foreach($columns as $col)
@if($col['visible'])
<x-table.heading sortable multi-column
wire:click="sortBy({{$col['field']}})"
:direction="$sorts[$col['field']] ?? null">
{{$col['label']}}
</x-table.heading>
@endif
@endforeach
<!-- CONTROLS -->
<x-table.heading class="pr-2 w-16">
Count: {{strtoupper($status)}}: {{$models->count()}}
</x-table.heading>
</x-slot>
<x-slot name="body">
@forelse ($models as $model)
<x-table.row wire:loading.class.delay="opacity-50"
wire:key="row-{{ $model->id }}">
<x-table.cell class="pr-0 z-10">
{{-- <livewire:modeler.runner-modal--}}
{{-- :model="$model" />--}}
</x-table.cell>
@if($columns['title']['visible'])
<x-table.text-cell :value="$model->title" />
@endif
@if($columns['aircraft']['visible'])
<x-table.text-cell :value="$model->aircraft" />
@endif
<x-table.cell class="flex items-center justify-center">
<span class="pointer-cursor"
data-wenk="Full AC"
wire:click="toggleAirframe({{$model->id}})">
@if($model->is_full_airframe)
@svg('solid/plane', 'text-blue h-4 w-4')
@else
@svg('solid/plane', 'text-gray-500 h-4 w-4')
@endif
</span>
</x-table.cell>
@if($columns['serial_no']['visible'])
<x-table.text-cell :value="$model->serial_no" />
@endif
@if($columns['line_no']['visible'])
<x-table.text-cell :value="$model->line_no" />
@endif
@if($columns['apu']['visible'])
<x-table.text-cell :value="$model->apu" />
@endif
@if($columns['engines']['visible'])
<x-table.text-cell :value="$model->engines" />
@endif
@if($columns['total_count']['visible'])
<x-table.integer-cell :value="$model->total_count" />
@endif
@if($columns['total_value']['visible'])
<x-table.currency-cell :value="$model->total_value" />
@endif
@if($columns['cat1_sum']['visible'])
<x-table.currency-cell :value="$model->cat1_sum" />
@endif
@if($columns['cat2_sum']['visible'])
<x-table.currency-cell :value="$model->cat2_sum" />
@endif
@if($columns['cat3_sum']['visible'])
<x-table.currency-cell :value="$model->cat3_sum" />
@endif
@if($columns['owner']['visible'])
<x-table.text-center-cell :value="$model->owner" />
@endif
@if($columns['model_date']['visible'])
<x-table.text-cell :value="$model->modeledBy()" />
@endif
<!-- CONTROLS -->
<x-table.cell class="pr-2 flex items-center space-x-2">
{{-- VIEW --}}
<span class="cursor-pointer pr-4"
data-wenk="View"
wire:click="view({{ $model->id }})">
@svg('solid/eye', 'text-eagles h-4 w-4')
</span>
{{-- RESET OCCM --}}
@if($model->was_uploaded)
<livewire:modeler.reset-manifest
:id="$model->id"
wire:key="{{$model->id}}" />
@else
{{-- UPLOAD OCCM --}}
<livewire:modeler.import-manifest
:id="$model->id"
wire:key="{{$model->id}}" />
@endif
{{-- INVENTORY --}}
@if($model->status === 'locked')
@svg('solid/lock', 'text-red h-4 w-4')
@else
<span class="cursor-pointer"
data-wenk="Inventory Control"
wire:click="sendToIC({{ $model->id }})">
@svg('solid/unlock', 'text-gray-500 h-4 w-4')
</span>
@endif
{{-- ARCHIVE --}}
@if($model->status === 'archived')
<span class="cursor-pointer"
data-wenk="UN-ARCHIVE"
data-wenk-pos="left"
wire:click="unarchive({{ $model->id }})">
@svg('solid/archive', 'text-red h-4 w-4')
</span>
@else
<span class="cursor-pointer"
data-wenk="ARCHIVE"
data-wenk-pos="left"
wire:click="archive({{ $model->id }})">
@svg('solid/archive', 'text-gray-500 h-4 w-4')
</span>
@endif
{{-- EDIT --}}
<span class="pl-4 cursor-pointer"
data-wenk="edit"
wire:click="edit({{ $model->id }})">
@svg('solid/pencil-alt', 'text-blue h-4 w-4')
</span>
{{-- DELETE --}}
<x-modals.delete-confirm
tooltip="delete"
action="delete({{$model->id}})" />
</x-table.cell>
</x-table.row>
@empty
<x-table.row>
<x-table.cell colspan="6">
<div class="flex justify-center items-center space-x-2">
<x-icon.inbox class="h-8 w-8 text-gray-400"/>
<span class="font-medium py-8 text-gray-400 text-xl">
No models found...
</span>
</div>
</x-table.cell>
</x-table.row>
@endforelse
</x-slot>
</x-table>
</div>
<div>
{{ $models->links() }}
</div>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment