ultimatepos/Modules/Maintenance/Resources/views/preventive_schedules/index.blade.php

72 lines
3.2 KiB
PHP

@extends('layouts.app')
@section('title', __('maintenance::lang.preventive_schedules'))
@section('content')
@include('maintenance::layouts.nav')
<section class="content no-print mt-page">
<div class="mt-page-header">
<h1><i class="fas fa-calendar-check" style="color:#14b8a6;margin-left:8px;"></i> @lang('maintenance::lang.preventive_schedules')</h1>
@can('maintenance.preventive.create')
<a href="{{ action([\Modules\Maintenance\Http\Controllers\PreventiveScheduleController::class, 'create']) }}" class="mt-btn-primary btn">
<i class="fa fa-plus"></i> @lang('maintenance::lang.add')
</a>
@endcan
</div>
<div class="mt-card">
<div class="mt-card-header"><h3 class="mt-card-title">@lang('maintenance::lang.all_schedules')</h3></div>
<div class="mt-card-body">
@include('maintenance::partials.scope_filters', ['projects' => $projects, 'equipment' => $equipment])
<div class="checkbox" style="margin-bottom:12px;">
<label><input type="checkbox" class="mm-due-soon-filter" value="1"> @lang('maintenance::lang.due_soon')</label>
</div>
<div class="table-responsive">
<table class="table table-bordered table-striped" id="mm_preventive_table" style="width:100%">
<thead>
<tr>
<th>@lang('maintenance::lang.title')</th>
<th>@lang('maintenance::lang.equipment')</th>
<th>@lang('maintenance::lang.frequency_type')</th>
<th>@lang('maintenance::lang.next_due_at')</th>
<th>@lang('maintenance::lang.assigned_user')</th>
<th>@lang('maintenance::lang.is_active')</th>
<th>@lang('maintenance::lang.action')</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</section>
@endsection
@section('javascript')
<script type="text/javascript">
$(document).ready(function() {
$('.select2').select2();
var table = $('#mm_preventive_table').DataTable({
processing: true, serverSide: true,
ajax: {
url: '{{ action([\Modules\Maintenance\Http\Controllers\PreventiveScheduleController::class, "index"]) }}',
data: function(d) {
d.project_id = $('.mm-filter-project').val();
d.equipment_id = $('.mm-filter-equipment').val();
d.due_soon = $('.mm-due-soon-filter').is(':checked') ? 1 : 0;
}
},
columns: [
{ data: 'title', name: 'title' },
{ data: 'equipment_name', name: 'equipment_name', orderable: false },
{ data: 'frequency_type', name: 'frequency_type' },
{ data: 'next_due_at', name: 'next_due_at' },
{ data: 'assignee_name', name: 'assignee_name', orderable: false },
{ data: 'is_active', name: 'is_active' },
{ data: 'action', name: 'action', orderable: false, searchable: false }
]
});
$('.mm-apply-filters, .mm-due-soon-filter').on('click change', function() { table.ajax.reload(); });
});
</script>
@endsection