ultimatepos/Modules/IntegrationHub/Resources/views/exports/index.blade.php

104 lines
5.2 KiB
PHP

@extends('layouts.app')
@section('title', __('integrationhub::lang.exports'))
@section('content')
@include('integrationhub::layouts.nav')
<section class="content no-print mt-page">
<div class="mt-page-header">
<h1><i class="fas fa-file-export" style="color:#8b5cf6;margin-left:8px;"></i> @lang('integrationhub::lang.exports')</h1>
</div>
<div class="mt-card">
<div class="mt-card-header"><h3 class="mt-card-title">@lang('integrationhub::lang.new_export')</h3></div>
<div class="mt-card-body">
{!! Form::open(['url' => action([\Modules\IntegrationHub\Http\Controllers\ExportController::class, 'store']), 'method' => 'post']) !!}
<div class="row">
<div class="col-md-4">
<div class="form-group">
{!! Form::label('dataset', __('integrationhub::lang.dataset') . ':') !!}
@php
$datasetOptions = [];
foreach ($datasets as $ds) {
$datasetOptions[$ds] = __('integrationhub::lang.'.$ds);
}
@endphp
{!! Form::select('dataset', $datasetOptions, 'sales_summary', ['class' => 'form-control select2', 'style' => 'width:100%']) !!}
</div>
</div>
<div class="col-md-2">
<div class="form-group">
{!! Form::label('format', __('integrationhub::lang.format') . ':') !!}
{!! Form::select('format', array_combine($formats, array_map('strtoupper', $formats)), 'json', ['class' => 'form-control']) !!}
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{!! Form::label('start_date', __('integrationhub::lang.start_date') . ':') !!}
{!! Form::text('start_date', null, ['class' => 'form-control datepicker', 'readonly']) !!}
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{!! Form::label('end_date', __('integrationhub::lang.end_date') . ':') !!}
{!! Form::text('end_date', null, ['class' => 'form-control datepicker', 'readonly']) !!}
</div>
</div>
</div>
<button type="submit" class="btn btn-primary"><i class="fa fa-download"></i> @lang('integrationhub::lang.new_export')</button>
{!! Form::close() !!}
</div>
</div>
<div class="mt-card">
<div class="mt-card-header"><h3 class="mt-card-title">@lang('integrationhub::lang.export_history')</h3></div>
<div class="mt-card-body">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>#</th>
<th>@lang('integrationhub::lang.dataset')</th>
<th>@lang('integrationhub::lang.format')</th>
<th>@lang('integrationhub::lang.status')</th>
<th>@lang('integrationhub::lang.created_at')</th>
<th>@lang('integrationhub::lang.completed_at')</th>
<th>@lang('integrationhub::lang.action')</th>
</tr>
</thead>
<tbody>
@forelse($jobs as $job)
<tr>
<td>{{ $job->id }}</td>
<td>@lang('integrationhub::lang.'.$job->dataset)</td>
<td>{{ strtoupper($job->format) }}</td>
<td>
<span class="label label-{{ $job->status === 'completed' ? 'success' : ($job->status === 'failed' ? 'danger' : 'warning') }}">
{{ \Modules\IntegrationHub\Utils\IntegrationHubUtil::statusLabel($job->status) }}
</span>
</td>
<td>@format_datetime($job->created_at)</td>
<td>@if($job->completed_at) @format_datetime($job->completed_at) @else @endif</td>
<td>
@if($job->status === 'completed' && $job->file_path)
<a href="{{ action([\Modules\IntegrationHub\Http\Controllers\ExportController::class, 'download'], $job->id) }}" class="btn btn-xs btn-success">
<i class="fa fa-download"></i> @lang('integrationhub::lang.download')
</a>
@endif
</td>
</tr>
@empty
<tr><td colspan="7" class="text-center text-muted">@lang('integrationhub::lang.no_records')</td></tr>
@endforelse
</tbody>
</table>
{{ $jobs->links() }}
</div>
</div>
</section>
@endsection
@section('javascript')
<script>$(function(){ $('.select2').select2(); $('.datepicker').datepicker({ autoclose: true, format: datepicker_date_format }); });</script>
@endsection