mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add Former dependency
This commit is contained in:
parent
2060d9f9f5
commit
3829a874aa
@ -42,16 +42,14 @@ class InvoiceController extends Controller
|
||||
public function index(InvoiceFilters $filters, Builder $builder)
|
||||
{
|
||||
$invoices = Invoice::filter($filters);
|
||||
Log::error('invoice count = ...');
|
||||
Log::error($invoices->count());
|
||||
|
||||
if (request()->ajax()) {
|
||||
|
||||
return DataTables::of(Invoice::filter($filters))->addColumn('action', function ($invoice) {
|
||||
return '<a href="/client/invoices/'. $invoice->id .'/edit" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>';
|
||||
return '<a href="/client/invoices/'. $invoice->hashed_id .'/edit" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>';
|
||||
})
|
||||
->addColumn('checkbox', function ($invoice){
|
||||
return '<input type="checkbox" name="bulk" value="'. $invoice->id .'"/>';
|
||||
return '<input type="checkbox" name="bulk" value="'. $invoice->hashed_id .'"/>';
|
||||
})
|
||||
->rawColumns(['checkbox', 'action'])
|
||||
->make(true);
|
||||
@ -61,6 +59,7 @@ class InvoiceController extends Controller
|
||||
$builder->addAction();
|
||||
$builder->addCheckbox();
|
||||
|
||||
/**todo this is redundant, but keep in case we want to build this serverside*/
|
||||
$html = $builder->columns([
|
||||
['data' => 'checkbox', 'name' => 'checkbox', 'title' => '', 'searchable' => false, 'orderable' => false],
|
||||
['data' => 'invoice_number', 'name' => 'invoice_number', 'title' => trans('texts.invoice_number'), 'visible'=> true],
|
||||
|
@ -28,6 +28,15 @@ class Invoice extends BaseModel
|
||||
use NumberFormatter;
|
||||
use MakesDates;
|
||||
|
||||
protected $hidden = [
|
||||
'id',
|
||||
'private_notes'
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'hashed_id'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'invoice_number',
|
||||
'discount',
|
||||
@ -80,6 +89,11 @@ class Invoice extends BaseModel
|
||||
const STATUS_UNPAID = -2;
|
||||
const STATUS_REVERSED = -3;
|
||||
|
||||
public function getHashedIdAttribute()
|
||||
{
|
||||
return $this->encodePrimaryKey($this->id);
|
||||
}
|
||||
|
||||
public function company()
|
||||
{
|
||||
return $this->belongsTo(Company::class);
|
||||
|
@ -19,6 +19,7 @@
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": ">=7.3",
|
||||
"anahkiasen/former": "^4.2",
|
||||
"asgrim/ofxparser": "^1.2",
|
||||
"davejamesmiller/laravel-breadcrumbs": "5.x",
|
||||
"fideloper/proxy": "^4.0",
|
||||
|
207
config/former.php
Normal file
207
config/former.php
Normal file
@ -0,0 +1,207 @@
|
||||
<?php return array(
|
||||
|
||||
// Markup
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Whether labels should be automatically computed from name
|
||||
'automatic_label' => true,
|
||||
|
||||
// The default form type
|
||||
'default_form_type' => 'horizontal',
|
||||
|
||||
// Validation
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Whether Former should fetch errors from Session
|
||||
'fetch_errors' => true,
|
||||
|
||||
// Whether Former should try to apply Validator rules as attributes
|
||||
'live_validation' => true,
|
||||
|
||||
// Whether Former should automatically fetch error messages and
|
||||
// display them next to the matching fields
|
||||
'error_messages' => true,
|
||||
|
||||
// Checkables
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Whether checkboxes should always be present in the POST data,
|
||||
// no matter if you checked them or not
|
||||
'push_checkboxes' => false,
|
||||
|
||||
// The value a checkbox will have in the POST array if unchecked
|
||||
'unchecked_value' => 0,
|
||||
|
||||
// Required fields
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
// The class to be added to required fields
|
||||
'required_class' => 'required',
|
||||
|
||||
// A facultative text to append to the labels of required fields
|
||||
'required_text' => '<sup>*</sup>',
|
||||
|
||||
// Translations
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Where Former should look for translations
|
||||
'translate_from' => 'validation.attributes',
|
||||
|
||||
// Whether text that comes out of the translated
|
||||
// should be capitalized (ex: email => Email) automatically
|
||||
'capitalize_translations' => true,
|
||||
|
||||
// An array of attributes to automatically translate
|
||||
'translatable' => array(
|
||||
'help',
|
||||
'inlineHelp',
|
||||
'blockHelp',
|
||||
'placeholder',
|
||||
'data_placeholder',
|
||||
'label',
|
||||
),
|
||||
|
||||
// Framework
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
// The framework to be used by Former
|
||||
'framework' => 'TwitterBootstrap4',
|
||||
|
||||
'TwitterBootstrap4' => array(
|
||||
|
||||
// Map Former-supported viewports to Bootstrap 4 equivalents
|
||||
'viewports' => array(
|
||||
'large' => 'lg',
|
||||
'medium' => 'md',
|
||||
'small' => 'sm',
|
||||
'mini' => 'xs',
|
||||
),
|
||||
// Width of labels for horizontal forms expressed as viewport => grid columns
|
||||
'labelWidths' => array(
|
||||
'large' => 2,
|
||||
'small' => 4,
|
||||
),
|
||||
// HTML markup and classes used by Bootstrap 5 for icons
|
||||
'icon' => array(
|
||||
'tag' => 'i',
|
||||
'set' => 'fa',
|
||||
'prefix' => 'fa',
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
'TwitterBootstrap3' => array(
|
||||
|
||||
// Map Former-supported viewports to Bootstrap 3 equivalents
|
||||
'viewports' => array(
|
||||
'large' => 'lg',
|
||||
'medium' => 'md',
|
||||
'small' => 'sm',
|
||||
'mini' => 'xs',
|
||||
),
|
||||
// Width of labels for horizontal forms expressed as viewport => grid columns
|
||||
'labelWidths' => array(
|
||||
'large' => 2,
|
||||
'small' => 4,
|
||||
),
|
||||
// HTML markup and classes used by Bootstrap 3 for icons
|
||||
'icon' => array(
|
||||
'tag' => 'span',
|
||||
'set' => 'glyphicon',
|
||||
'prefix' => 'glyphicon',
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
'Nude' => array( // No-framework markup
|
||||
'icon' => array(
|
||||
'tag' => 'i',
|
||||
'set' => null,
|
||||
'prefix' => 'icon',
|
||||
),
|
||||
),
|
||||
|
||||
'TwitterBootstrap' => array( // Twitter Bootstrap version 2
|
||||
'icon' => array(
|
||||
'tag' => 'i',
|
||||
'set' => null,
|
||||
'prefix' => 'icon',
|
||||
),
|
||||
),
|
||||
|
||||
'ZurbFoundation5' => array(
|
||||
// Map Former-supported viewports to Foundation 5 equivalents
|
||||
'viewports' => array(
|
||||
'large' => 'large',
|
||||
'medium' => null,
|
||||
'small' => 'small',
|
||||
'mini' => null,
|
||||
),
|
||||
// Width of labels for horizontal forms expressed as viewport => grid columns
|
||||
'labelWidths' => array(
|
||||
'small' => 3,
|
||||
),
|
||||
// Classes to be applied to wrapped labels in horizontal forms
|
||||
'wrappedLabelClasses' => array('right', 'inline'),
|
||||
// HTML markup and classes used by Foundation 5 for icons
|
||||
'icon' => array(
|
||||
'tag' => 'i',
|
||||
'set' => null,
|
||||
'prefix' => 'fi',
|
||||
),
|
||||
// CSS for inline validation errors
|
||||
'error_classes' => array('class' => 'error'),
|
||||
),
|
||||
|
||||
'ZurbFoundation4' => array(
|
||||
// Foundation 4 also has an experimental "medium" breakpoint
|
||||
// explained at http://foundation.zurb.com/docs/components/grid.html
|
||||
'viewports' => array(
|
||||
'large' => 'large',
|
||||
'medium' => null,
|
||||
'small' => 'small',
|
||||
'mini' => null,
|
||||
),
|
||||
// Width of labels for horizontal forms expressed as viewport => grid columns
|
||||
'labelWidths' => array(
|
||||
'small' => 3,
|
||||
),
|
||||
// Classes to be applied to wrapped labels in horizontal forms
|
||||
'wrappedLabelClasses' => array('right', 'inline'),
|
||||
// HTML markup and classes used by Foundation 4 for icons
|
||||
'icon' => array(
|
||||
'tag' => 'i',
|
||||
'set' => 'general',
|
||||
'prefix' => 'foundicon',
|
||||
),
|
||||
// CSS for inline validation errors
|
||||
'error_classes' => array('class' => 'alert-box radius warning'),
|
||||
),
|
||||
|
||||
'ZurbFoundation' => array( // Foundation 3
|
||||
'viewports' => array(
|
||||
'large' => '',
|
||||
'medium' => null,
|
||||
'small' => 'mobile-',
|
||||
'mini' => null,
|
||||
),
|
||||
// Width of labels for horizontal forms expressed as viewport => grid columns
|
||||
'labelWidths' => array(
|
||||
'large' => 2,
|
||||
'small' => 4,
|
||||
),
|
||||
// Classes to be applied to wrapped labels in horizontal forms
|
||||
'wrappedLabelClasses' => array('right', 'inline'),
|
||||
// HTML markup and classes used by Foundation 3 for icons
|
||||
'icon' => array(
|
||||
'tag' => 'i',
|
||||
'set' => null,
|
||||
'prefix' => 'fi',
|
||||
),
|
||||
// CSS for inline validation errors
|
||||
// should work for Zurb 2 and 3
|
||||
'error_classes' => array('class' => 'alert-box alert error'),
|
||||
),
|
||||
|
||||
|
||||
);
|
@ -11,11 +11,18 @@
|
||||
|
||||
<div class="row" style="padding-top: 30px;">
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="col-lg-12" style="padding-bottom: 10px;">
|
||||
|
||||
<div class="pull-left">
|
||||
|
||||
<button class="btn btn-dark">{{ctrans('texts.download')}}</button>
|
||||
<button class="btn btn-success">{{ctrans('texts.pay_now')}}</button>
|
||||
</div>
|
||||
|
||||
<!-- Filters / Buttons in here.-->
|
||||
<div id="top_right_buttons" class="pull-right">
|
||||
<input id="tableFilter_invoice" type="text" style="width:180px;margin-right:17px;background-color: white !important"
|
||||
|
||||
<input id="tableFilter_invoice" type="text" style="width:180px;background-color: white !important"
|
||||
class="form-control pull-left" placeholder="Filter" value=""/>
|
||||
</div>
|
||||
|
||||
@ -27,6 +34,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -58,7 +66,7 @@ $(function() {
|
||||
ajax: '{!! route('client.invoices.index') !!}',
|
||||
columns: [
|
||||
|
||||
{data: 'checkbox', name: 'checkbox', title: '', searchable: false, orderable: false},
|
||||
{data: 'checkbox', name: 'checkbox', title: '<input type="checkbox" class="select_all">', searchable: false, orderable: false},
|
||||
{data: 'invoice_number', name: 'invoice_number', title: '{{trans('texts.invoice_number')}}', visible: true},
|
||||
{data: 'invoice_date', name: 'invoice_date', title: '{{trans('texts.invoice_date')}}', visible: true},
|
||||
{data: 'amount', name: 'amount', title: '{{trans('texts.total')}}', visible: true},
|
||||
@ -70,8 +78,24 @@ $(function() {
|
||||
});
|
||||
});
|
||||
|
||||
$(".dataTables_filter").hide();
|
||||
|
||||
|
||||
|
||||
</script defer>
|
||||
|
||||
<script>
|
||||
|
||||
$('#tableFilter_invoice').on('keyup', function(){
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.select_all').change(function() {
|
||||
$(this).closest('table').find(':checkbox:not(:disabled)').prop('checked', this.checked);
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user