Skip to content

Commit

Permalink
close #596 Fixed: Settings Invoice logo attachment is passive
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Nov 5, 2018
1 parent e97c305 commit 2da5ad8
Showing 1 changed file with 44 additions and 35 deletions.
79 changes: 44 additions & 35 deletions resources/views/settings/settings/edit.blade.php
Expand Up @@ -252,39 +252,50 @@
});
@endif
$('#invoice_logo').fancyfile({
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
@if($setting['invoice_logo'])
placeholder : '{{ $setting['invoice_logo']->basename }}',
@else
placeholder : '{{ trans('general.form.no_file_selected') }}',
@endif
var invoice_file = false;
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = $(e.target).attr("href");
if (target == '#invoice' && !invoice_file) {
$(target + ' #invoice_logo').fancyfile({
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
@if($setting['invoice_logo'])
placeholder : '{{ $setting['invoice_logo']->basename }}',
@else
placeholder : '{{ trans('general.form.no_file_selected') }}',
@endif
});
@if($setting['invoice_logo'])
invoice_logo_html = '<span class="invoice_logo">';
invoice_logo_html += ' <a href="{{ url('uploads/' . $setting['invoice_logo']->id . '/download') }}">';
invoice_logo_html += ' <span id="download-invoice_logo" class="text-primary">';
invoice_logo_html += ' <i class="fa fa-file-{{ $setting['invoice_logo']->aggregate_type }}-o"></i> {{ $setting['invoice_logo']->basename }}';
invoice_logo_html += ' </span>';
invoice_logo_html += ' </a>';
invoice_logo_html += ' {!! Form::open(['id' => 'invoice_logo-' . $setting['invoice_logo']->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $setting['invoice_logo']->id)], 'style' => 'display:inline']) !!}';
invoice_logo_html += ' <a id="remove-invoice_logo" href="javascript:void();">';
invoice_logo_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
invoice_logo_html += ' </a>';
invoice_logo_html += ' <input type="hidden" name="page" value="setting" />';
invoice_logo_html += ' <input type="hidden" name="key" value="general.invoice_logo" />';
invoice_logo_html += ' <input type="hidden" name="value" value="{{ $setting['invoice_logo']->id }}" />';
invoice_logo_html += ' {!! Form::close() !!}';
invoice_logo_html += '</span>';
$(target + ' .fancy-file .fake-file').append(invoice_logo_html);
$(document).on('click', '#remove-invoice_logo', function (e) {
confirmDelete("#invoice_logo-{!! $setting['invoice_logo']->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $setting['invoice_logo']->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endif
invoice_file = true;
}
});
@if($setting['invoice_logo'])
invoice_logo_html = '<span class="invoice_logo">';
invoice_logo_html += ' <a href="{{ url('uploads/' . $setting['invoice_logo']->id . '/download') }}">';
invoice_logo_html += ' <span id="download-invoice_logo" class="text-primary">';
invoice_logo_html += ' <i class="fa fa-file-{{ $setting['invoice_logo']->aggregate_type }}-o"></i> {{ $setting['invoice_logo']->basename }}';
invoice_logo_html += ' </span>';
invoice_logo_html += ' </a>';
invoice_logo_html += ' {!! Form::open(['id' => 'invoice_logo-' . $setting['invoice_logo']->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $setting['invoice_logo']->id)], 'style' => 'display:inline']) !!}';
invoice_logo_html += ' <a id="remove-invoice_logo" href="javascript:void();">';
invoice_logo_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
invoice_logo_html += ' </a>';
invoice_logo_html += ' <input type="hidden" name="page" value="setting" />';
invoice_logo_html += ' <input type="hidden" name="key" value="general.invoice_logo" />';
invoice_logo_html += ' <input type="hidden" name="value" value="{{ $setting['invoice_logo']->id }}" />';
invoice_logo_html += ' {!! Form::close() !!}';
invoice_logo_html += '</span>';
$('#invoice .fancy-file .fake-file').append(invoice_logo_html);
$(document).on('click', '#remove-invoice_logo', function (e) {
confirmDelete("#invoice_logo-{!! $setting['invoice_logo']->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $setting['invoice_logo']->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
});
@endif
$("select[name='email_protocol']").on('change', function() {
var selection = $(this).val();
Expand All @@ -295,16 +306,14 @@
$("input[name='email_smtp_password']").prop('disabled', true);
$("input[name='email_smtp_port']").prop('disabled', true);
$("select[name='email_smtp_encryption']").prop('disabled', true);
}
else if(selection == 'sendmail') {
} else if(selection == 'sendmail') {
$("input[name='email_sendmail_path']").prop('disabled', false);
$("input[name='email_smtp_host']").prop('disabled', true);
$("input[name='email_smtp_username']").prop('disabled', true);
$("input[name='email_smtp_password']").prop('disabled', true);
$("input[name='email_smtp_port']").prop('disabled', true);
$("select[name='email_smtp_encryption']").prop('disabled', true);
}
else if (selection == 'smtp') {
} else if (selection == 'smtp') {
$("input[name='email_sendmail_path']").prop('disabled', true);
$("input[name='email_smtp_host']").prop('disabled', false);
$("input[name='email_smtp_username']").prop('disabled', false);
Expand Down

0 comments on commit 2da5ad8

Please sign in to comment.