1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/resources/views/accounts/import_export.blade.php

191 lines
6.6 KiB
PHP
Raw Normal View History

2015-10-14 16:15:39 +02:00
@extends('header')
2015-03-16 22:45:25 +01:00
2015-11-18 15:40:50 +01:00
@section('head')
@parent
<style type="text/css">
2016-05-31 22:15:55 +02:00
.import-file {
2015-11-18 15:40:50 +01:00
display: none;
}
</style>
@stop
2015-03-16 22:45:25 +01:00
@section('content')
@parent
2015-10-14 16:15:39 +02:00
@include('accounts.nav', ['selected' => ACCOUNT_IMPORT_EXPORT])
2015-04-20 16:34:23 +02:00
<div class="panel panel-default">
<div class="panel-heading">
2015-11-18 15:40:50 +01:00
<h3 class="panel-title">{!! trans('texts.import_data') !!}</h3>
2015-04-20 16:34:23 +02:00
</div>
<div class="panel-body">
2015-03-16 22:45:25 +01:00
{!! Former::open_for_files('/import')
->onsubmit('return onFormSubmit(event)')
->addClass('warn-on-exit') !!}
2015-11-18 15:40:50 +01:00
{!! Former::select('source')
->onchange('setFileTypesVisible()')
->options(array_combine(\App\Services\ImportService::$sources, \App\Services\ImportService::$sources))
->style('width: 200px') !!}
2017-03-22 10:50:55 +01:00
<br/>
2015-11-18 15:40:50 +01:00
@foreach (\App\Services\ImportService::$entityTypes as $entityType)
2017-04-02 15:54:07 +02:00
{!! Former::file($entityType)
->addGroupClass("import-file {$entityType}-file")
->label(Utils::pluralizeEntityType($entityType)) !!}
2015-11-18 15:40:50 +01:00
@endforeach
2017-03-22 10:50:55 +01:00
<div id="jsonIncludes" style="display:none">
{!! Former::checkboxes('json_include_radio')
->label(trans('texts.include'))
->checkboxes([
trans('texts.data') => 'data',
trans('texts.settings') => 'settings',
]) !!}
</div>
2017-07-27 12:43:41 +02:00
<div id="notInovicePlaneImport">
{!! Former::plaintext(' ')->help(trans('texts.use_english_version')) !!}
</div>
<div id="inovicePlaneImport" style="display:none">
{!! Former::plaintext(' ')->help(trans('texts.invoiceplane_import', ['link' => link_to(INVOICEPLANE_IMPORT, 'turbo124/Plane2Ninja', ['target' => '_blank'])])) !!}
</div>
2017-03-22 10:50:55 +01:00
<br/>
{!! Former::actions( Button::info(trans('texts.upload'))->withAttributes(['id' => 'uploadButton'])->submit()->large()->appendIcon(Icon::create('open'))) !!}
2015-11-18 15:40:50 +01:00
{!! Former::close() !!}
</div>
2015-11-17 14:53:14 +01:00
</div>
2015-04-20 16:34:23 +02:00
2015-11-12 21:36:28 +01:00
{!! Former::open('/export') !!}
2015-04-20 16:34:23 +02:00
<div class="panel panel-default">
<div class="panel-heading">
2015-11-12 21:36:28 +01:00
<h3 class="panel-title">{!! trans('texts.export_data') !!}</h3>
2015-04-20 16:34:23 +02:00
</div>
<div class="panel-body">
2015-11-12 21:36:28 +01:00
{!! Former::select('format')
2016-09-13 15:12:27 +02:00
->onchange('setCheckboxesEnabled()')
2015-11-12 21:36:28 +01:00
->addOption('CSV', 'CSV')
->addOption('XLS', 'XLS')
->addOption('JSON', 'JSON')
2016-06-02 21:03:59 +02:00
->style('max-width: 200px')
2016-11-27 14:46:45 +01:00
->help('<br/>' . trans('texts.export_help')) !!}
2015-11-12 21:36:28 +01:00
2016-07-05 15:09:52 +02:00
2017-03-22 10:50:55 +01:00
<div id="csvIncludes">
{!! Former::inline_radios('include_radio')
->onchange('setCheckboxesEnabled()')
->label(trans('texts.include'))
->radios([
trans('texts.all') . ' &nbsp; ' => ['value' => 'all', 'name' => 'include'],
trans('texts.selected') => ['value' => 'selected', 'name' => 'include'],
])->check('all') !!}
<div class="form-group entity-types">
<label class="control-label col-lg-4 col-sm-4"></label>
<div class="col-lg-2 col-sm-2">
@include('partials/checkbox', ['field' => 'clients'])
@include('partials/checkbox', ['field' => 'contacts'])
@include('partials/checkbox', ['field' => 'credits'])
@include('partials/checkbox', ['field' => 'tasks'])
</div>
<div class="col-lg-2 col-sm-2">
@include('partials/checkbox', ['field' => 'invoices'])
@include('partials/checkbox', ['field' => 'quotes'])
@include('partials/checkbox', ['field' => 'recurring'])
@include('partials/checkbox', ['field' => 'payments'])
</div>
<div class="col-lg-3 col-sm-3">
@include('partials/checkbox', ['field' => 'products'])
@include('partials/checkbox', ['field' => 'expenses'])
@include('partials/checkbox', ['field' => 'vendors'])
@include('partials/checkbox', ['field' => 'vendor_contacts'])
</div>
2016-07-05 15:09:52 +02:00
</div>
2016-12-05 19:56:57 +01:00
</div><br/>
2015-11-12 21:36:28 +01:00
2016-05-31 22:15:55 +02:00
{!! Former::actions( Button::primary(trans('texts.download'))->submit()->large()->appendIcon(Icon::create('download-alt'))) !!}
2015-04-20 16:34:23 +02:00
</div>
</div>
2015-04-01 21:57:02 +02:00
{!! Former::close() !!}
2015-03-16 22:45:25 +01:00
<script type="text/javascript">
2016-05-31 22:15:55 +02:00
$(function() {
2016-09-25 20:13:14 +02:00
setFileTypesVisible();
2016-09-13 15:12:27 +02:00
setCheckboxesEnabled();
2016-05-31 22:15:55 +02:00
});
function onFormSubmit() {
$('#uploadButton').attr('disabled', true);
return true;
}
2016-09-13 15:12:27 +02:00
function setCheckboxesEnabled() {
2017-03-22 10:50:55 +01:00
var $checkboxes = $('.entity-types input[type=checkbox]');
2016-09-13 15:12:27 +02:00
var include = $('input[name=include]:checked').val()
var format = $('#format').val();
2017-03-22 10:50:55 +01:00
if (include === 'all') {
2016-09-13 15:12:27 +02:00
$checkboxes.attr('disabled', true);
} else {
$checkboxes.removeAttr('disabled');
}
2017-03-22 10:50:55 +01:00
if (format === 'JSON') {
$('#csvIncludes').hide();
} else {
$('#csvIncludes').show();
}
2015-11-12 21:36:28 +01:00
}
2015-11-18 15:40:50 +01:00
function setFileTypesVisible() {
var val = $('#source').val();
2017-03-22 10:50:55 +01:00
if (val === 'JSON') {
$('#jsonIncludes').show();
} else {
$('#jsonIncludes').hide();
}
2015-11-18 15:40:50 +01:00
@foreach (\App\Services\ImportService::$entityTypes as $entityType)
$('.{{ $entityType }}-file').hide();
@endforeach
@foreach (\App\Services\ImportService::$sources as $source)
if (val === '{{ $source }}') {
2015-11-24 20:45:38 +01:00
@foreach (\App\Services\ImportService::$entityTypes as $entityType)
@if ($source != IMPORT_WAVE && $entityType == ENTITY_PAYMENT)
// do nothing
@elseif (class_exists(\App\Services\ImportService::getTransformerClassName($source, $entityType)))
2015-11-24 20:45:38 +01:00
$('.{{ $entityType }}-file').show();
@endif
@endforeach
2015-11-18 15:40:50 +01:00
}
2016-06-02 21:03:59 +02:00
@if ($source === IMPORT_JSON)
if (val === '{{ $source }}') {
$('.JSON-file').show();
}
@endif
2017-07-27 12:43:41 +02:00
if (val === '{{ IMPORT_JSON }}') {
$('#uploadButton').show();
$('#inovicePlaneImport').hide();
$('#notInovicePlaneImport').hide();
} else if (val === '{{ IMPORT_INVOICEPLANE }}') {
2017-05-22 09:46:37 +02:00
$('#uploadButton').hide();
$('#inovicePlaneImport').show();
2017-07-27 12:43:41 +02:00
$('#notInovicePlaneImport').hide();
2017-05-22 09:46:37 +02:00
} else {
$('#uploadButton').show();
$('#inovicePlaneImport').hide();
2017-07-27 12:43:41 +02:00
$('#notInovicePlaneImport').show();
2017-05-22 09:46:37 +02:00
}
2015-11-18 15:40:50 +01:00
@endforeach
}
2015-03-16 22:45:25 +01:00
</script>
2016-05-31 22:15:55 +02:00
@stop