94 lines
4.1 KiB
PHP
Raw Normal View History

2017-09-14 22:21:00 +03:00
@extends('layouts.admin')
@section('title', trans('general.title.edit', ['type' => trans_choice('general.companies', 1)]))
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::model($company, [
'method' => 'PATCH',
2018-06-10 02:48:51 +03:00
'url' => ['common/companies', $company->id],
2017-09-14 22:21:00 +03:00
'files' => true,
'role' => 'form'
]) !!}
<div class="box-body">
{{ Form::textGroup('company_name', trans('general.name'), 'id-card-o') }}
{{ Form::textGroup('domain', trans('companies.domain'), 'globe') }}
{{ Form::emailGroup('company_email', trans('general.email'), 'envelope') }}
{{ Form::selectGroup('default_currency', trans_choice('general.currencies', 1), 'money', $currencies) }}
{{ Form::textareaGroup('company_address', trans('general.address')) }}
{{ Form::fileGroup('company_logo', trans('companies.logo')) }}
2017-10-07 23:52:34 +03:00
{{ Form::radioGroup('enabled', trans('general.enabled')) }}
2017-09-14 22:21:00 +03:00
</div>
<!-- /.box-body -->
2018-06-10 02:48:51 +03:00
@permission('update-common-companies')
2017-09-14 22:21:00 +03:00
<div class="box-footer">
2018-06-10 02:48:51 +03:00
{{ Form::saveButtons('common/companies') }}
2017-09-14 22:21:00 +03:00
</div>
<!-- /.box-footer -->
@endpermission
{!! Form::close() !!}
</div>
@endsection
2017-11-13 21:55:15 +03:00
@push('js')
2017-09-14 22:21:00 +03:00
<script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script>
2017-11-13 21:55:15 +03:00
@endpush
2017-09-14 22:21:00 +03:00
2017-11-13 21:55:15 +03:00
@push('css')
2017-09-14 22:21:00 +03:00
<link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
2017-11-13 21:55:15 +03:00
@endpush
2017-09-14 22:21:00 +03:00
2017-11-13 21:55:15 +03:00
@push('scripts')
2017-09-14 22:21:00 +03:00
<script type="text/javascript">
2017-10-07 23:52:34 +03:00
var text_yes = '{{ trans('general.yes') }}';
var text_no = '{{ trans('general.no') }}';
2017-09-14 22:21:00 +03:00
$(document).ready(function(){
$("#default_currency").select2({
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.currencies', 1)]) }}"
});
$('#company_logo').fancyfile({
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
@if($company->company_logo)
placeholder : '<?php echo $company->company_logo->basename; ?>'
@else
placeholder : '{{ trans('general.form.no_file_selected') }}'
2018-01-02 19:00:07 +03:00
@endif
2017-09-14 22:21:00 +03:00
});
2018-01-02 19:00:07 +03:00
@if($company->company_logo)
2018-01-02 19:00:07 +03:00
attachment_html = '<span class="attachment">';
attachment_html += ' <a href="{{ url('uploads/' . $company->company_logo->id . '/download') }}">';
2018-01-02 19:00:07 +03:00
attachment_html += ' <span id="download-attachment" class="text-primary">';
attachment_html += ' <i class="fa fa-file-{{ $company->company_logo->aggregate_type }}-o"></i> {{ $company->company_logo->basename }}';
2018-01-02 19:00:07 +03:00
attachment_html += ' </span>';
attachment_html += ' </a>';
attachment_html += ' {!! Form::open(['id' => 'attachment-' . $company->company_logo->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $company->company_logo->id)], 'style' => 'display:inline']) !!}';
2018-01-02 19:00:07 +03:00
attachment_html += ' <a id="remove-attachment" href="javascript:void();">';
attachment_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
attachment_html += ' </a>';
attachment_html += ' {!! Form::close() !!}';
attachment_html += '</span>';
$('.fancy-file .fake-file').append(attachment_html);
$(document).on('click', '#remove-attachment', function (e) {
confirmDelete("#attachment-{!! $company->company_logo->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $company->company_logo->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
2018-01-02 19:00:07 +03:00
});
@endif
2017-09-14 22:21:00 +03:00
});
</script>
2017-11-13 21:55:15 +03:00
@endpush