moved folders to common directory

This commit is contained in:
denisdulici
2018-06-10 02:48:51 +03:00
parent 7fa629e8b5
commit b1fd49c507
71 changed files with 719 additions and 647 deletions

View File

@@ -0,0 +1,171 @@
@extends('layouts.admin')
@section('title', trans('general.title.new', ['type' => trans_choice('general.items', 1)]))
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::open(['url' => 'common/items', 'files' => true, 'role' => 'form']) !!}
<div class="box-body">
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
{{ Form::textGroup('sku', trans('items.sku'), 'key') }}
{{ Form::textareaGroup('description', trans('general.description')) }}
{{ Form::textGroup('sale_price', trans('items.sales_price'), 'money') }}
{{ Form::textGroup('purchase_price', trans('items.purchase_price'), 'money') }}
{{ Form::textGroup('quantity', trans_choice('items.quantities', 1), 'cubes', ['required' => 'required'], '1') }}
{{ Form::selectGroup('tax_id', trans_choice('general.taxes', 1), 'percent', $taxes, setting('general.default_tax'), []) }}
<div class="form-group col-md-6 required {{ $errors->has('category_id') ? 'has-error' : ''}}">
{!! Form::label('category_id', trans_choice('general.categories', 1), ['class' => 'control-label']) !!}
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-folder-open-o"></i></div>
{!! Form::select('category_id', $categories, null, array_merge(['class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.categories', 1)])])) !!}
<div class="input-group-btn">
<button type="button" onclick="createCategory();" class="btn btn-default btn-icon"><i class="fa fa-plus"></i></button>
</div>
</div>
{!! $errors->first('category_id', '<p class="help-block">:message</p>') !!}
</div>
{{ Form::fileGroup('picture', trans_choice('general.pictures', 1)) }}
{{ Form::radioGroup('enabled', trans('general.enabled')) }}
</div>
<!-- /.box-body -->
<div class="box-footer">
{{ Form::saveButtons('common/items') }}
</div>
<!-- /.box-footer -->
{!! Form::close() !!}
</div>
@endsection
@push('js')
<script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script>
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/colorpicker/bootstrap-colorpicker.js') }}"></script>
@endpush
@push('css')
<link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/colorpicker/bootstrap-colorpicker.css') }}">
@endpush
@push('scripts')
<script type="text/javascript">
var text_yes = '{{ trans('general.yes') }}';
var text_no = '{{ trans('general.no') }}';
$(document).ready(function(){
$('#enabled_1').trigger('click');
$('#name').focus();
$("#tax_id").select2({
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}"
});
$("#category_id").select2({
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.categories', 1)]) }}"
});
$('#picture').fancyfile({
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
placeholder : '{{ trans('general.form.no_file_selected') }}'
});
});
function createCategory() {
$('#modal-create-category').remove();
modal = '<div class="modal fade" id="modal-create-category" style="display: none;">';
modal += ' <div class="modal-dialog modal-lg">';
modal += ' <div class="modal-content">';
modal += ' <div class="modal-header">';
modal += ' <h4 class="modal-title">{{ trans('general.title.new', ['type' => trans_choice('general.categories', 1)]) }}</h4>';
modal += ' </div>';
modal += ' <div class="modal-body">';
modal += ' {!! Form::open(['id' => 'form-create-category', 'role' => 'form']) !!}';
modal += ' <div class="row">';
modal += ' <div class="form-group col-md-6 required">';
modal += ' <label for="name" class="control-label">{{ trans('general.name') }}</label>';
modal += ' <div class="input-group">';
modal += ' <div class="input-group-addon"><i class="fa fa-id-card-o"></i></div>';
modal += ' <input class="form-control" placeholder="{{ trans('general.name') }}" required="required" name="name" type="text" id="name">';
modal += ' </div>';
modal += ' </div>';
modal += ' <div class="form-group col-md-6 required">';
modal += ' <label for="color" class="control-label">{{ trans('general.color') }}</label>';
modal += ' <div id="category-color-picker" class="input-group colorpicker-component">';
modal += ' <div class="input-group-addon"><i></i></div>';
modal += ' <input class="form-control" value="#00a65a" placeholder="{{ trans('general.color') }}" required="required" name="color" type="text" id="color">';
modal += ' </div>';
modal += ' </div>';
modal += ' {!! Form::hidden('type', 'item', []) !!}';
modal += ' {!! Form::hidden('enabled', '1', []) !!}';
modal += ' </div>';
modal += ' {!! Form::close() !!}';
modal += ' </div>';
modal += ' <div class="modal-footer">';
modal += ' <div class="pull-left">';
modal += ' {!! Form::button('<span class="fa fa-save"></span> &nbsp;' . trans('general.save'), ['type' => 'button', 'id' =>'button-create-category', 'class' => 'btn btn-success']) !!}';
modal += ' <button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-times-circle"></span> &nbsp;{{ trans('general.cancel') }}</button>';
modal += ' </div>';
modal += ' </div>';
modal += ' </div>';
modal += ' </div>';
modal += '</div>';
$('body').append(modal);
$('#category-color-picker').colorpicker();
$('#modal-create-category').modal('show');
}
$(document).on('click', '#button-create-category', function (e) {
$('#modal-create-category .modal-header').before('<span id="span-loading" style="position: absolute; height: 100%; width: 100%; z-index: 99; background: #6da252; opacity: 0.4;"><i class="fa fa-spinner fa-spin" style="font-size: 10em !important;margin-left: 35%;margin-top: 8%;"></i></span>');
$.ajax({
url: '{{ url("settings/categories/category") }}',
type: 'POST',
dataType: 'JSON',
data: $("#form-create-category").serialize(),
beforeSend: function () {
$(".form-group").removeClass("has-error");
$(".help-block").remove();
},
success: function(data) {
$('#span-loading').remove();
$('#modal-create-category').modal('hide');
$("#category_id").append('<option value="' + data.id + '" selected="selected">' + data.name + '</option>');
$("#category_id").select2('refresh');
},
error: function(error, textStatus, errorThrown) {
$('#span-loading').remove();
if (error.responseJSON.name) {
$("input[name='name']").parent().parent().addClass('has-error');
$("input[name='name']").parent().after('<p class="help-block">' + error.responseJSON.name + '</p>');
}
if (error.responseJSON.color) {
$("input[name='color']").parent().parent().addClass('has-error');
$("input[name='color']").parent().after('<p class="help-block">' + error.responseJSON.color + '</p>');
}
}
});
});
</script>
@endpush

View File

@@ -0,0 +1,102 @@
@extends('layouts.admin')
@section('title', trans('general.title.edit', ['type' => trans_choice('general.items', 1)]))
@section('content')
<!-- Default box -->
<div class="box box-success">
{!! Form::model($item, [
'method' => 'PATCH',
'files' => true,
'url' => ['common/items', $item->id],
'role' => 'form'
]) !!}
<div class="box-body">
{{ Form::textGroup('name', trans('general.name'), 'id-card-o') }}
{{ Form::textGroup('sku', trans('items.sku'), 'key') }}
{{ Form::textareaGroup('description', trans('general.description')) }}
{{ Form::textGroup('sale_price', trans('items.sales_price'), 'money') }}
{{ Form::textGroup('purchase_price', trans('items.purchase_price'), 'money') }}
{{ Form::textGroup('quantity', trans_choice('items.quantities', 1), 'cubes') }}
{{ Form::selectGroup('tax_id', trans_choice('general.taxes', 1), 'percent', $taxes, null, []) }}
{{ Form::selectGroup('category_id', trans_choice('general.categories', 1), 'folder-open-o', $categories, null, []) }}
{{ Form::fileGroup('picture', trans_choice('general.pictures', 1)) }}
{{ Form::radioGroup('enabled', trans('general.enabled')) }}
</div>
<!-- /.box-body -->
@permission('update-common-items')
<div class="box-footer">
{{ Form::saveButtons('common/items') }}
</div>
<!-- /.box-footer -->
@endpermission
{!! Form::close() !!}
</div>
@endsection
@push('js')
<script src="{{ asset('public/js/bootstrap-fancyfile.js') }}"></script>
@endpush
@push('css')
<link rel="stylesheet" href="{{ asset('public/css/bootstrap-fancyfile.css') }}">
@endpush
@push('scripts')
<script type="text/javascript">
var text_yes = '{{ trans('general.yes') }}';
var text_no = '{{ trans('general.no') }}';
$(document).ready(function(){
$("#tax_id").select2({
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}"
});
$("#category_id").select2({
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.categories', 1)]) }}"
});
$('#picture').fancyfile({
text : '{{ trans('general.form.select.file') }}',
style : 'btn-default',
@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>
@endpush

View File

@@ -0,0 +1,94 @@
@extends('layouts.admin')
@section('title', trans_choice('general.items', 2))
@permission('create-common-items')
@section('new_button')
<span class="new-button"><a href="{{ url('common/items/create') }}" class="btn btn-success btn-sm"><span class="fa fa-plus"></span> &nbsp;{{ trans('general.add_new') }}</a></span>
<span><a href="{{ url('common/import/common/items') }}" class="btn btn-success btn-sm"><span class="fa fa-download"></span> &nbsp;{{ trans('import.import') }}</a></span>
@endsection
@endpermission
@section('content')
<!-- Default box -->
<div class="box box-success">
<div class="box-header with-border">
{!! Form::open(['url' => 'common/items', 'role' => 'form', 'method' => 'GET']) !!}
<div class="pull-left">
<span class="title-filter hidden-xs">{{ trans('general.search') }}:</span>
{!! Form::text('search', request('search'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('general.search_placeholder')]) !!}
{!! Form::select('category', $categories, request('category'), ['class' => 'form-control input-filter input-sm']) !!}
{!! Form::button('<span class="fa fa-filter"></span> &nbsp;' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
</div>
<div class="pull-right">
<span class="title-filter hidden-xs">{{ trans('general.show') }}:</span>
{!! Form::select('limit', $limits, request('limit', setting('general.list_limit', '25')), ['class' => 'form-control input-filter input-sm', 'onchange' => 'this.form.submit()']) !!}
</div>
{!! Form::close() !!}
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="table table-responsive">
<table class="table table-striped table-hover" id="tbl-items">
<thead>
<tr>
<th class="col-md-1 hidden-xs">{{ trans_choice('general.pictures', 1) }}</th>
<th class="col-md-3">@sortablelink('name', trans('general.name'))</th>
<th class="col-md-1 hidden-xs">@sortablelink('category', trans_choice('general.categories', 1))</th>
<th class="col-md-1 hidden-xs">@sortablelink('quantity', trans_choice('items.quantities', 1))</th>
<th class="col-md-2 text-right amount-space">@sortablelink('sale_price', trans('items.sales_price'))</th>
<th class="col-md-2 hidden-xs text-right amount-space">@sortablelink('purchase_price', trans('items.purchase_price'))</th>
<th class="col-md-1 hidden-xs">@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
<th class="col-md-1 text-center">{{ trans('general.actions') }}</th>
</tr>
</thead>
<tbody>
@foreach($items as $item)
<tr>
<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('common/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->quantity }}</td>
<td class="text-right amount-space">{{ money($item->sale_price, setting('general.default_currency'), true) }}</td>
<td class="hidden-xs text-right amount-space">{{ money($item->purchase_price, setting('general.default_currency'), true) }}</td>
<td class="hidden-xs">
@if ($item->enabled)
<span class="label label-success">{{ trans('general.enabled') }}</span>
@else
<span class="label label-danger">{{ trans('general.disabled') }}</span>
@endif
</td>
<td class="text-center">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" data-toggle-position="left" aria-expanded="false">
<i class="fa fa-ellipsis-h"></i>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="{{ url('common/items/' . $item->id . '/edit') }}">{{ trans('general.edit') }}</a></li>
<li class="divider"></li>
@permission('create-common-items')
<li><a href="{{ url('common/items/' . $item->id . '/duplicate') }}">{{ trans('general.duplicate') }}</a></li>
<li class="divider"></li>
@endpermission
@permission('delete-common-items')
<li>{!! Form::deleteLink($item, 'common/items') !!}</li>
@endpermission
</ul>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
@include('partials.admin.pagination', ['items' => $items, 'type' => 'items'])
</div>
<!-- /.box-footer -->
</div>
<!-- /.box -->
@endsection