1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/resources/views/accounts/import_export.blade.php

106 lines
3.5 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">
.contact-file,
.task-file,
.payment-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')
->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') !!}
@foreach (\App\Services\ImportService::$entityTypes as $entityType)
{!! Former::file("{$entityType}_file")
->addGroupClass("{$entityType}-file") !!}
@endforeach
{!! Former::actions( Button::info(trans('texts.upload'))->submit()->large()->appendIcon(Icon::create('open'))) !!}
{!! 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')
->onchange('setEntityTypesVisible()')
->addOption('CSV', 'CSV')
->addOption('XLS', 'XLS')
->addOption('JSON', 'JSON')
->style('max-width: 200px') !!}
{!! Former::checkbox('entity_types')
->label('include')
->addGroupClass('entity-types')
->checkboxes([
trans('texts.clients') => array('name' => ENTITY_CLIENT, 'value' => 1),
trans('texts.tasks') => array('name' => ENTITY_TASK, 'value' => 1),
trans('texts.invoices') => array('name' => ENTITY_INVOICE, 'value' => 1),
trans('texts.payments') => array('name' => ENTITY_PAYMENT, 'value' => 1),
])->check(ENTITY_CLIENT)->check(ENTITY_TASK)->check(ENTITY_INVOICE)->check(ENTITY_PAYMENT) !!}
2015-04-20 16:34:23 +02:00
{!! Former::actions( Button::primary(trans('texts.download'))->submit()->large()->appendIcon(Icon::create('download-alt'))) !!}
</div>
</div>
2015-04-01 21:57:02 +02:00
{!! Former::close() !!}
2015-03-16 22:45:25 +01:00
<script type="text/javascript">
2015-11-12 21:36:28 +01:00
function setEntityTypesVisible() {
var selector = '.entity-types input[type=checkbox]';
if ($('#format').val() === 'JSON') {
$(selector).attr('disabled', true);
} else {
$(selector).removeAttr('disabled');
}
}
2015-11-18 15:40:50 +01:00
function setFileTypesVisible() {
var val = $('#source').val();
@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
}
@endforeach
}
2015-03-16 22:45:25 +01:00
</script>
@stop