Add User, Companies, Settings picture media manager
This commit is contained in:
parent
e3b736d3e8
commit
43619d1db4
@ -7,11 +7,14 @@ use App\Http\Requests\Auth\User as Request;
|
|||||||
use Illuminate\Http\Request as ARequest;
|
use Illuminate\Http\Request as ARequest;
|
||||||
use App\Models\Auth\User;
|
use App\Models\Auth\User;
|
||||||
use App\Models\Auth\Role;
|
use App\Models\Auth\Role;
|
||||||
|
use App\Traits\Uploads;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
|
|
||||||
class Users extends Controller
|
class Users extends Controller
|
||||||
{
|
{
|
||||||
|
use Uploads;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
@ -34,11 +37,12 @@ class Users extends Controller
|
|||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$roles = Role::all()->reject(function($r) {
|
$roles = Role::all()->reject(function ($r) {
|
||||||
return $r->hasPermission('read-customer-panel');
|
return $r->hasPermission('read-customer-panel');
|
||||||
});
|
});
|
||||||
|
|
||||||
$companies = Auth::user()->companies()->get()->sortBy('name');
|
$companies = Auth::user()->companies()->get()->sortBy('name');
|
||||||
|
|
||||||
foreach ($companies as $company) {
|
foreach ($companies as $company) {
|
||||||
$company->setSettings();
|
$company->setSettings();
|
||||||
}
|
}
|
||||||
@ -55,15 +59,16 @@ class Users extends Controller
|
|||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
// Upload picture
|
|
||||||
$picture = $request->file('picture');
|
|
||||||
if ($picture && $picture->isValid()) {
|
|
||||||
$request['picture'] = $picture->store('uploads/users');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create user
|
// Create user
|
||||||
$user = User::create($request->input());
|
$user = User::create($request->input());
|
||||||
|
|
||||||
|
// Upload picture
|
||||||
|
if ($request->file('picture')) {
|
||||||
|
$media = $this->getMedia($request->file('picture'), 'users');
|
||||||
|
|
||||||
|
$user->attachMedia($media, 'picture');
|
||||||
|
}
|
||||||
|
|
||||||
// Attach roles
|
// Attach roles
|
||||||
$user->roles()->attach($request['roles']);
|
$user->roles()->attach($request['roles']);
|
||||||
|
|
||||||
@ -88,17 +93,18 @@ class Users extends Controller
|
|||||||
{
|
{
|
||||||
if ($user->customer) {
|
if ($user->customer) {
|
||||||
// Show only roles with customer permission
|
// Show only roles with customer permission
|
||||||
$roles = Role::all()->reject(function($r) {
|
$roles = Role::all()->reject(function ($r) {
|
||||||
return !$r->hasPermission('read-customer-panel');
|
return !$r->hasPermission('read-customer-panel');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Don't show roles with customer permission
|
// Don't show roles with customer permission
|
||||||
$roles = Role::all()->reject(function($r) {
|
$roles = Role::all()->reject(function ($r) {
|
||||||
return $r->hasPermission('read-customer-panel');
|
return $r->hasPermission('read-customer-panel');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$companies = Auth::user()->companies()->get()->sortBy('name');
|
$companies = Auth::user()->companies()->get()->sortBy('name');
|
||||||
|
|
||||||
foreach ($companies as $company) {
|
foreach ($companies as $company) {
|
||||||
$company->setSettings();
|
$company->setSettings();
|
||||||
}
|
}
|
||||||
@ -116,12 +122,6 @@ class Users extends Controller
|
|||||||
*/
|
*/
|
||||||
public function update(User $user, Request $request)
|
public function update(User $user, Request $request)
|
||||||
{
|
{
|
||||||
// Upload picture
|
|
||||||
$picture = $request->file('picture');
|
|
||||||
if ($picture && $picture->isValid()) {
|
|
||||||
$request['picture'] = $picture->store('users');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do not reset password if not entered/changed
|
// Do not reset password if not entered/changed
|
||||||
if (empty($request['password'])) {
|
if (empty($request['password'])) {
|
||||||
unset($request['password']);
|
unset($request['password']);
|
||||||
@ -131,6 +131,13 @@ class Users extends Controller
|
|||||||
// Update user
|
// Update user
|
||||||
$user->update($request->input());
|
$user->update($request->input());
|
||||||
|
|
||||||
|
// Upload picture
|
||||||
|
if ($request->file('picture')) {
|
||||||
|
$media = $this->getMedia($request->file('picture'), 'users');
|
||||||
|
|
||||||
|
$user->attachMedia($media, 'picture');
|
||||||
|
}
|
||||||
|
|
||||||
// Sync roles
|
// Sync roles
|
||||||
$user->roles()->sync($request['roles']);
|
$user->roles()->sync($request['roles']);
|
||||||
|
|
||||||
|
@ -65,9 +65,7 @@ class Companies extends Controller
|
|||||||
if ($logo) {
|
if ($logo) {
|
||||||
$company->attachMedia($logo, 'logo');
|
$company->attachMedia($logo, 'logo');
|
||||||
|
|
||||||
$logo_path = $logo->directory . '/' . $logo->basename;
|
setting()->set('general.company_logo', $logo->id);
|
||||||
|
|
||||||
setting()->set('general.company_logo', $logo_path);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,9 +146,7 @@ class Companies extends Controller
|
|||||||
if ($logo) {
|
if ($logo) {
|
||||||
$company->attachMedia($logo, 'logo');
|
$company->attachMedia($logo, 'logo');
|
||||||
|
|
||||||
$logo_path = $logo->directory . '/' . $logo->basename;
|
setting()->set('general.company_logo', $logo->id);
|
||||||
|
|
||||||
setting()->set('general.company_logo', $logo_path);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class Bills extends Controller
|
|||||||
|
|
||||||
// Upload attachment
|
// Upload attachment
|
||||||
if ($request->file('attachment')) {
|
if ($request->file('attachment')) {
|
||||||
$media = $this->getMedia($request->file('attachment'), 'revenues');
|
$media = $this->getMedia($request->file('attachment'), 'bills');
|
||||||
|
|
||||||
$bill->attachMedia($media, 'attachment');
|
$bill->attachMedia($media, 'attachment');
|
||||||
}
|
}
|
||||||
@ -597,13 +597,6 @@ class Bills extends Controller
|
|||||||
|
|
||||||
$bill = Bill::find($request['bill_id']);
|
$bill = Bill::find($request['bill_id']);
|
||||||
|
|
||||||
// Upload attachment
|
|
||||||
if ($request->file('attachment')) {
|
|
||||||
$media = $this->getMedia($request->file('attachment'), 'payments');
|
|
||||||
|
|
||||||
$bill->attachMedia($media, 'attachment');
|
|
||||||
}
|
|
||||||
|
|
||||||
$total_amount = $bill->amount;
|
$total_amount = $bill->amount;
|
||||||
|
|
||||||
$amount = (double) $request['amount'];
|
$amount = (double) $request['amount'];
|
||||||
@ -640,6 +633,13 @@ class Bills extends Controller
|
|||||||
|
|
||||||
$bill_payment = BillPayment::create($request->input());
|
$bill_payment = BillPayment::create($request->input());
|
||||||
|
|
||||||
|
// Upload attachment
|
||||||
|
if ($request->file('attachment')) {
|
||||||
|
$media = $this->getMedia($request->file('attachment'), 'bills');
|
||||||
|
|
||||||
|
$bill_payment->attachMedia($media, 'attachment');
|
||||||
|
}
|
||||||
|
|
||||||
$request['status_code'] = $bill->bill_status_code;
|
$request['status_code'] = $bill->bill_status_code;
|
||||||
$request['notify'] = 0;
|
$request['notify'] = 0;
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class Invoices extends Controller
|
|||||||
|
|
||||||
// Upload attachment
|
// Upload attachment
|
||||||
if ($request->file('attachment')) {
|
if ($request->file('attachment')) {
|
||||||
$media = $this->getMedia($request->file('attachment'), 'revenues');
|
$media = $this->getMedia($request->file('attachment'), 'invoices');
|
||||||
|
|
||||||
$invoice->attachMedia($media, 'attachment');
|
$invoice->attachMedia($media, 'attachment');
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ use App\Models\Banking\Account;
|
|||||||
use App\Models\Company\Company;
|
use App\Models\Company\Company;
|
||||||
use App\Models\Setting\Currency;
|
use App\Models\Setting\Currency;
|
||||||
use App\Models\Setting\Setting;
|
use App\Models\Setting\Setting;
|
||||||
|
use App\Models\Common\Media;
|
||||||
use App\Models\Setting\Tax;
|
use App\Models\Setting\Tax;
|
||||||
use App\Traits\DateTime;
|
use App\Traits\DateTime;
|
||||||
use App\Traits\Uploads;
|
use App\Traits\Uploads;
|
||||||
@ -26,11 +27,20 @@ class Settings extends Controller
|
|||||||
public function edit()
|
public function edit()
|
||||||
{
|
{
|
||||||
/*$setting = Setting::all()->pluck('value', 'key');*/
|
/*$setting = Setting::all()->pluck('value', 'key');*/
|
||||||
$setting = Setting::all()->map(function($s) {
|
$setting = Setting::all()->map(function ($s) {
|
||||||
$s->key = str_replace('general.', '', $s->key);
|
$s->key = str_replace('general.', '', $s->key);
|
||||||
|
|
||||||
return $s;
|
return $s;
|
||||||
})->pluck('value', 'key');
|
})->pluck('value', 'key');
|
||||||
|
|
||||||
|
$company_logo = $setting->pull('company_logo');
|
||||||
|
|
||||||
|
$setting['company_logo'] = Media::find($company_logo);
|
||||||
|
|
||||||
|
$invoice_logo = $setting->pull('invoice_logo');
|
||||||
|
|
||||||
|
$setting['invoice_logo'] = Media::find($invoice_logo);
|
||||||
|
|
||||||
$timezones = $this->getTimezones();
|
$timezones = $this->getTimezones();
|
||||||
|
|
||||||
$accounts = Account::enabled()->pluck('name', 'id');
|
$accounts = Account::enabled()->pluck('name', 'id');
|
||||||
@ -88,7 +98,13 @@ class Settings extends Controller
|
|||||||
{
|
{
|
||||||
$fields = $request->all();
|
$fields = $request->all();
|
||||||
$company_id = $request->get('company_id');
|
$company_id = $request->get('company_id');
|
||||||
|
|
||||||
|
if (empty($company_id)) {
|
||||||
|
$company_id = session('company_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
$company = Company::find($company_id);
|
||||||
|
|
||||||
$skip_keys = ['company_id', '_method', '_token'];
|
$skip_keys = ['company_id', '_method', '_token'];
|
||||||
$file_keys = ['company_logo', 'invoice_logo'];
|
$file_keys = ['company_logo', 'invoice_logo'];
|
||||||
|
|
||||||
@ -102,7 +118,14 @@ class Settings extends Controller
|
|||||||
|
|
||||||
// Process file uploads
|
// Process file uploads
|
||||||
if (in_array($key, $file_keys)) {
|
if (in_array($key, $file_keys)) {
|
||||||
$value = $this->getUploadedFilePath($request->file($key), 'settings');
|
// Upload attachment
|
||||||
|
if ($request->file($key)) {
|
||||||
|
$media = $this->getMedia($request->file($key), 'settings');
|
||||||
|
|
||||||
|
$company->attachMedia($media, $key);
|
||||||
|
|
||||||
|
$value = $media->id;
|
||||||
|
}
|
||||||
|
|
||||||
// Prevent reset
|
// Prevent reset
|
||||||
if (empty($value)) {
|
if (empty($value)) {
|
||||||
@ -133,5 +156,4 @@ class Settings extends Controller
|
|||||||
|
|
||||||
return redirect('settings/settings');
|
return redirect('settings/settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,13 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
|
|||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Laratrust\Traits\LaratrustUserTrait;
|
use Laratrust\Traits\LaratrustUserTrait;
|
||||||
use Kyslik\ColumnSortable\Sortable;
|
use Kyslik\ColumnSortable\Sortable;
|
||||||
|
use Plank\Mediable\Mediable;
|
||||||
use Request;
|
use Request;
|
||||||
use Route;
|
use Route;
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
use Filterable, LaratrustUserTrait, Notifiable, SoftDeletes, Sortable;
|
use Filterable, LaratrustUserTrait, Notifiable, SoftDeletes, Sortable, Mediable;
|
||||||
|
|
||||||
protected $table = 'users';
|
protected $table = 'users';
|
||||||
|
|
||||||
@ -88,7 +89,11 @@ class User extends Authenticatable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
if (!$this->hasMedia('picture')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->getMedia('picture')->last();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,10 +6,11 @@ use App\Models\Model;
|
|||||||
use App\Traits\Currencies;
|
use App\Traits\Currencies;
|
||||||
use Bkwld\Cloner\Cloneable;
|
use Bkwld\Cloner\Cloneable;
|
||||||
use Sofa\Eloquence\Eloquence;
|
use Sofa\Eloquence\Eloquence;
|
||||||
|
use Plank\Mediable\Mediable;
|
||||||
|
|
||||||
class Item extends Model
|
class Item extends Model
|
||||||
{
|
{
|
||||||
use Cloneable, Currencies, Eloquence;
|
use Cloneable, Currencies, Eloquence, Mediable;
|
||||||
|
|
||||||
protected $table = 'items';
|
protected $table = 'items';
|
||||||
|
|
||||||
@ -111,4 +112,18 @@ class Item extends Model
|
|||||||
->orderBy('name', $direction)
|
->orderBy('name', $direction)
|
||||||
->select('items.*');
|
->select('items.*');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current balance.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPictureAttribute()
|
||||||
|
{
|
||||||
|
if (!$this->hasMedia('picture')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->getMedia('picture')->last();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,9 +71,34 @@
|
|||||||
$('#picture').fancyfile({
|
$('#picture').fancyfile({
|
||||||
text : '{{ trans('general.form.select.file') }}',
|
text : '{{ trans('general.form.select.file') }}',
|
||||||
style : 'btn-default',
|
style : 'btn-default',
|
||||||
placeholder : '<?php echo $user->picture; ?>'
|
@if($user->picture)
|
||||||
|
placeholder : '<?php echo $user->picture->basename; ?>'
|
||||||
|
@else
|
||||||
|
placeholder : '{{ trans('general.form.no_file_selected') }}'
|
||||||
|
@endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@if($user->picture)
|
||||||
|
picture_html = '<span class="picture">';
|
||||||
|
picture_html += ' <a href="{{ url('uploads/' . $user->picture->id . '/download') }}">';
|
||||||
|
picture_html += ' <span id="download-picture" class="text-primary">';
|
||||||
|
picture_html += ' <i class="fa fa-file-{{ $user->picture->aggregate_type }}-o"></i> {{ $user->picture->basename }}';
|
||||||
|
picture_html += ' </span>';
|
||||||
|
picture_html += ' </a>';
|
||||||
|
picture_html += ' {!! Form::open(['id' => 'picture-' . $user->picture->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $user->picture->id)], 'style' => 'display:inline']) !!}';
|
||||||
|
picture_html += ' <a id="remove-picture" href="javascript:void();">';
|
||||||
|
picture_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
|
||||||
|
picture_html += ' </a>';
|
||||||
|
picture_html += ' {!! Form::close() !!}';
|
||||||
|
picture_html += '</span>';
|
||||||
|
|
||||||
|
$('.fancy-file .fake-file').append(picture_html);
|
||||||
|
|
||||||
|
$(document).on('click', '#remove-picture', function (e) {
|
||||||
|
confirmDelete("#picture-{!! $user->picture->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $user->picture->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
|
||||||
|
});
|
||||||
|
@endif
|
||||||
|
|
||||||
$('input[type=checkbox]').iCheck({
|
$('input[type=checkbox]').iCheck({
|
||||||
checkboxClass: 'icheckbox_square-green',
|
checkboxClass: 'icheckbox_square-green',
|
||||||
radioClass: 'iradio_square-green',
|
radioClass: 'iradio_square-green',
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<a href="{{ url('auth/users/' . $item->id . '/edit') }}">
|
<a href="{{ url('auth/users/' . $item->id . '/edit') }}">
|
||||||
@if ($item->picture)
|
@if ($item->picture)
|
||||||
<img src="{{ Storage::url($item->picture) }}" class="users-image" alt="{{ $item->name }}" title="{{ $item->name }}">
|
<img src="{{ Storage::url($item->picture->id) }}" class="users-image" alt="{{ $item->name }}" title="{{ $item->name }}">
|
||||||
@endif
|
@endif
|
||||||
{{ $item->name }}
|
{{ $item->name }}
|
||||||
</a>
|
</a>
|
||||||
|
@ -63,6 +63,8 @@
|
|||||||
style : 'btn-default',
|
style : 'btn-default',
|
||||||
@if($company->logo)
|
@if($company->logo)
|
||||||
placeholder : '<?php echo $company->logo->basename; ?>'
|
placeholder : '<?php echo $company->logo->basename; ?>'
|
||||||
|
@else
|
||||||
|
placeholder : '{{ trans('general.form.no_file_selected') }}'
|
||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -62,7 +62,11 @@
|
|||||||
$('#picture').fancyfile({
|
$('#picture').fancyfile({
|
||||||
text : '{{ trans('general.form.select.file') }}',
|
text : '{{ trans('general.form.select.file') }}',
|
||||||
style : 'btn-default',
|
style : 'btn-default',
|
||||||
|
@if($user->picture)
|
||||||
placeholder : '<?php echo $user->picture; ?>'
|
placeholder : '<?php echo $user->picture; ?>'
|
||||||
|
@else
|
||||||
|
placeholder : '{{ trans('general.form.no_file_selected') }}'
|
||||||
|
@endif
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -206,6 +206,8 @@
|
|||||||
style : 'btn-default',
|
style : 'btn-default',
|
||||||
@if($bill->attachment)
|
@if($bill->attachment)
|
||||||
placeholder : '<?php echo $bill->attachment->basename; ?>'
|
placeholder : '<?php echo $bill->attachment->basename; ?>'
|
||||||
|
@else
|
||||||
|
placeholder : '{{ trans('general.form.no_file_selected') }}'
|
||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -94,6 +94,8 @@
|
|||||||
style : 'btn-default',
|
style : 'btn-default',
|
||||||
@if($payment->attachment)
|
@if($payment->attachment)
|
||||||
placeholder : '<?php echo $payment->attachment->basename; ?>'
|
placeholder : '<?php echo $payment->attachment->basename; ?>'
|
||||||
|
@else
|
||||||
|
placeholder : '{{ trans('general.form.no_file_selected') }}'
|
||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -205,6 +205,8 @@
|
|||||||
style : 'btn-default',
|
style : 'btn-default',
|
||||||
@if($invoice->attachment)
|
@if($invoice->attachment)
|
||||||
placeholder : '<?php echo $invoice->attachment->basename; ?>'
|
placeholder : '<?php echo $invoice->attachment->basename; ?>'
|
||||||
|
@else
|
||||||
|
placeholder : '{{ trans('general.form.no_file_selected') }}'
|
||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -94,6 +94,8 @@
|
|||||||
style : 'btn-default',
|
style : 'btn-default',
|
||||||
@if($revenue->attachment)
|
@if($revenue->attachment)
|
||||||
placeholder : '<?php echo $revenue->attachment->basename; ?>'
|
placeholder : '<?php echo $revenue->attachment->basename; ?>'
|
||||||
|
@else
|
||||||
|
placeholder : '{{ trans('general.form.no_file_selected') }}'
|
||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -70,8 +70,33 @@
|
|||||||
$('#picture').fancyfile({
|
$('#picture').fancyfile({
|
||||||
text : '{{ trans('general.form.select.file') }}',
|
text : '{{ trans('general.form.select.file') }}',
|
||||||
style : 'btn-default',
|
style : 'btn-default',
|
||||||
placeholder : '<?php echo $item->picture; ?>'
|
@if($item->picture)
|
||||||
|
placeholder : '<?php echo $item->picture->basename; ?>'
|
||||||
|
@else
|
||||||
|
placeholder : '{{ trans('general.form.no_file_selected') }}'
|
||||||
|
@endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@if($item->picture)
|
||||||
|
picture_html = '<span class="picture">';
|
||||||
|
picture_html += ' <a href="{{ url('uploads/' . $item->picture->id . '/download') }}">';
|
||||||
|
picture_html += ' <span id="download-picture" class="text-primary">';
|
||||||
|
picture_html += ' <i class="fa fa-file-{{ $item->picture->aggregate_type }}-o"></i> {{ $item->picture->basename }}';
|
||||||
|
picture_html += ' </span>';
|
||||||
|
picture_html += ' </a>';
|
||||||
|
picture_html += ' {!! Form::open(['id' => 'picture-' . $item->picture->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $item->picture->id)], 'style' => 'display:inline']) !!}';
|
||||||
|
picture_html += ' <a id="remove-picture" href="javascript:void();">';
|
||||||
|
picture_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
|
||||||
|
picture_html += ' </a>';
|
||||||
|
picture_html += ' {!! Form::close() !!}';
|
||||||
|
picture_html += '</span>';
|
||||||
|
|
||||||
|
$('.fancy-file .fake-file').append(picture_html);
|
||||||
|
|
||||||
|
$(document).on('click', '#remove-picture', function (e) {
|
||||||
|
confirmDelete("#picture-{!! $item->picture->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $item->picture->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
|
||||||
|
});
|
||||||
|
@endif
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@foreach($items as $item)
|
@foreach($items as $item)
|
||||||
<tr>
|
<tr>
|
||||||
<td class="hidden-xs"><img src="{{ $item->picture ? Storage::url($item->picture) : asset('public/img/akaunting-logo-green.png') }}" class="img-thumbnail" width="50" alt="{{ $item->name }}"></td>
|
<td class="hidden-xs"><img src="{{ $item->picture ? Storage::url($item->picture->id) : asset('public/img/akaunting-logo-green.png') }}" class="img-thumbnail" width="50" alt="{{ $item->name }}"></td>
|
||||||
<td><a href="{{ url('items/items/' . $item->id . '/edit') }}">{{ $item->name }}</a></td>
|
<td><a href="{{ url('items/items/' . $item->id . '/edit') }}">{{ $item->name }}</a></td>
|
||||||
<td class="hidden-xs">{{ $item->category ? $item->category->name : trans('general.na') }}</td>
|
<td class="hidden-xs">{{ $item->category ? $item->category->name : trans('general.na') }}</td>
|
||||||
<td class="hidden-xs">{{ $item->quantity }}</td>
|
<td class="hidden-xs">{{ $item->quantity }}</td>
|
||||||
|
@ -166,7 +166,7 @@
|
|||||||
@if (setting('general.use_gravatar', '0') == '1')
|
@if (setting('general.use_gravatar', '0') == '1')
|
||||||
<img src="{{ $user->picture }}" class="user-image" alt="User Image">
|
<img src="{{ $user->picture }}" class="user-image" alt="User Image">
|
||||||
@else
|
@else
|
||||||
<img src="{{ Storage::url($user->picture) }}" class="user-image" alt="User Image">
|
<img src="{{ Storage::url($user->picture->id) }}" class="user-image" alt="User Image">
|
||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
<i class="fa fa-user-o"></i>
|
<i class="fa fa-user-o"></i>
|
||||||
@ -182,7 +182,7 @@
|
|||||||
@if (setting('general.use_gravatar', '0') == '1')
|
@if (setting('general.use_gravatar', '0') == '1')
|
||||||
<img src="{{ $user->picture }}" class="img-circle" alt="User Image">
|
<img src="{{ $user->picture }}" class="img-circle" alt="User Image">
|
||||||
@else
|
@else
|
||||||
<img src="{{ Storage::url($user->picture) }}" class="img-circle" alt="User Image">
|
<img src="{{ Storage::url($user->picture->id) }}" class="img-circle" alt="User Image">
|
||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
<i class="fa fa-4 fa-user-o" style="color: #fff; font-size: 7em;"></i>
|
<i class="fa fa-4 fa-user-o" style="color: #fff; font-size: 7em;"></i>
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
<li class="dropdown user user-menu">
|
<li class="dropdown user user-menu">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||||
@if ($user->picture)
|
@if ($user->picture)
|
||||||
<img src="{{ Storage::url($user->picture) }}" class="user-image" alt="User Image">
|
<img src="{{ Storage::url($user->picture->id) }}" class="user-image" alt="User Image">
|
||||||
@else
|
@else
|
||||||
<i class="fa fa-user-o"></i>
|
<i class="fa fa-user-o"></i>
|
||||||
@endif
|
@endif
|
||||||
@ -72,7 +72,7 @@
|
|||||||
<!-- User image -->
|
<!-- User image -->
|
||||||
<li class="user-header">
|
<li class="user-header">
|
||||||
@if ($user->picture)
|
@if ($user->picture)
|
||||||
<img src="{{ Storage::url($user->picture) }}" class="img-circle" alt="User Image">
|
<img src="{{ Storage::url($user->picture->id) }}" class="img-circle" alt="User Image">
|
||||||
@else
|
@else
|
||||||
<i class="fa fa-4 fa-user-o" style="color: #fff; font-size: 7em;"></i>
|
<i class="fa fa-4 fa-user-o" style="color: #fff; font-size: 7em;"></i>
|
||||||
@endif
|
@endif
|
||||||
|
@ -203,15 +203,64 @@
|
|||||||
$('#company_logo').fancyfile({
|
$('#company_logo').fancyfile({
|
||||||
text : '{{ trans('general.form.select.file') }}',
|
text : '{{ trans('general.form.select.file') }}',
|
||||||
style : 'btn-default',
|
style : 'btn-default',
|
||||||
placeholder : '<?php echo $setting->pull('company_logo'); ?>'
|
@if($setting['company_logo'])
|
||||||
|
placeholder : '<?php echo $setting['company_logo']->basename; ?>'
|
||||||
|
@else
|
||||||
|
placeholder : '{{ trans('general.form.no_file_selected') }}'
|
||||||
|
@endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@if($setting['company_logo'])
|
||||||
|
company_logo_html = '<span class="company_logo">';
|
||||||
|
company_logo_html += ' <a href="{{ url('uploads/' . $setting['company_logo']->id . '/download') }}">';
|
||||||
|
company_logo_html += ' <span id="download-company_logo" class="text-primary">';
|
||||||
|
company_logo_html += ' <i class="fa fa-file-{{ $setting['company_logo']->aggregate_type }}-o"></i> {{ $setting['company_logo']->basename }}';
|
||||||
|
company_logo_html += ' </span>';
|
||||||
|
company_logo_html += ' </a>';
|
||||||
|
company_logo_html += ' {!! Form::open(['id' => 'company_logo-' . $setting['company_logo']->id, 'method' => 'DELETE', 'url' => [url('uploads/' . $setting['company_logo']->id)], 'style' => 'display:inline']) !!}';
|
||||||
|
company_logo_html += ' <a id="remove-company_logo" href="javascript:void();">';
|
||||||
|
company_logo_html += ' <span class="text-danger"><i class="fa fa fa-times"></i></span>';
|
||||||
|
company_logo_html += ' </a>';
|
||||||
|
company_logo_html += ' {!! Form::close() !!}';
|
||||||
|
company_logo_html += '</span>';
|
||||||
|
|
||||||
|
$('#company .fancy-file .fake-file').append(company_logo_html);
|
||||||
|
|
||||||
|
$(document).on('click', '#remove-company_logo', function (e) {
|
||||||
|
confirmDelete("#company_logo-{!! $setting['company_logo']->id !!}", "{!! trans('general.attachment') !!}", "{!! trans('general.delete_confirm', ['name' => '<strong>' . $setting['company_logo']->basename . '</strong>', 'type' => strtolower(trans('general.attachment'))]) !!}", "{!! trans('general.cancel') !!}", "{!! trans('general.delete') !!}");
|
||||||
|
});
|
||||||
|
@endif
|
||||||
|
|
||||||
$('#invoice_logo').fancyfile({
|
$('#invoice_logo').fancyfile({
|
||||||
text : '{{ trans('general.form.select.file') }}',
|
text : '{{ trans('general.form.select.file') }}',
|
||||||
style : 'btn-default',
|
style : 'btn-default',
|
||||||
placeholder : '<?php echo $setting->pull('invoice_logo'); ?>'
|
@if($setting['invoice_logo'])
|
||||||
|
placeholder : '<?php echo $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 += ' {!! 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() {
|
$("select[name='email_protocol']").on('change', function() {
|
||||||
var selection = $(this).val();
|
var selection = $(this).val();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user