mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Working on Javascript front end
This commit is contained in:
parent
3829a874aa
commit
df5778c3c5
@ -49,7 +49,7 @@ class InvoiceController extends Controller
|
||||
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->hashed_id .'"/>';
|
||||
return '<input type="checkbox" name="hashed_ids[]" value="'. $invoice->hashed_id .'"/>';
|
||||
})
|
||||
->rawColumns(['checkbox', 'action'])
|
||||
->make(true);
|
||||
|
@ -14,6 +14,7 @@ namespace App\Models;
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Filters\QueryFilters;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\UserSessionAttributes;
|
||||
use Hashids\Hashids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@ -22,6 +23,7 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
class BaseModel extends Model
|
||||
{
|
||||
use MakesHash;
|
||||
use UserSessionAttributes;
|
||||
use SoftDeletes;
|
||||
|
||||
@ -29,8 +31,18 @@ class BaseModel extends Model
|
||||
///const CREATED_AT = 'creation_date';
|
||||
//const UPDATED_AT = 'last_update';
|
||||
|
||||
protected $appends = [
|
||||
'hashed_id'
|
||||
];
|
||||
|
||||
protected $dateFormat = 'Y-m-d H:i:s.u';
|
||||
|
||||
public function getHashedIdAttribute()
|
||||
{
|
||||
return $this->encodePrimaryKey($this->id);
|
||||
}
|
||||
|
||||
|
||||
public function __call($method, $params)
|
||||
{
|
||||
$entity = strtolower(class_basename($this));
|
||||
|
@ -37,22 +37,17 @@ class Client extends BaseModel
|
||||
|
||||
protected $presenter = 'App\Models\Presenters\ClientPresenter';
|
||||
|
||||
protected $appends = [
|
||||
];
|
||||
/*
|
||||
protected $guarded = [
|
||||
|
||||
protected $hidden = [
|
||||
'id',
|
||||
'updated_at',
|
||||
'created_at',
|
||||
'deleted_at',
|
||||
'contacts',
|
||||
'primary_contact',
|
||||
'q',
|
||||
'company',
|
||||
'country',
|
||||
'shipping_country'
|
||||
'private_notes',
|
||||
'user_id',
|
||||
'company_id',
|
||||
'backup',
|
||||
'settings',
|
||||
'last_login',
|
||||
'private_notes'
|
||||
];
|
||||
*/
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
|
@ -60,7 +60,14 @@ class Company extends BaseModel
|
||||
'settings',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
protected $hidden = [
|
||||
'id',
|
||||
'settings',
|
||||
'account_id',
|
||||
'company_key',
|
||||
'db',
|
||||
'domain',
|
||||
'ip',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
|
@ -14,7 +14,6 @@ namespace App\Models;
|
||||
use App\Models\Currency;
|
||||
use App\Models\Filterable;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\NumberFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
@ -22,7 +21,6 @@ use Illuminate\Support\Carbon;
|
||||
|
||||
class Invoice extends BaseModel
|
||||
{
|
||||
use MakesHash;
|
||||
use SoftDeletes;
|
||||
use Filterable;
|
||||
use NumberFormatter;
|
||||
@ -30,11 +28,12 @@ class Invoice extends BaseModel
|
||||
|
||||
protected $hidden = [
|
||||
'id',
|
||||
'private_notes'
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'hashed_id'
|
||||
'private_notes',
|
||||
'user_id',
|
||||
'client_id',
|
||||
'company_id',
|
||||
'backup',
|
||||
'settings',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
@ -89,11 +88,6 @@ 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);
|
||||
|
@ -6,7 +6,7 @@ use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Models\Invoice::class, function (Faker $faker) {
|
||||
return [
|
||||
'status_id' => App\Models\Invoice::STATUS_DRAFT,
|
||||
'status_id' => App\Models\Invoice::STATUS_SENT,
|
||||
'invoice_number' => $faker->text(256),
|
||||
'discount' => $faker->numberBetween(1,10),
|
||||
'is_amount_discount' => $faker->boolean(),
|
||||
|
@ -15,21 +15,22 @@
|
||||
|
||||
<div class="pull-left">
|
||||
|
||||
<button class="btn btn-dark">{{ctrans('texts.download')}}</button>
|
||||
<button class="btn btn-success">{{ctrans('texts.pay_now')}}</button>
|
||||
{!! Former::dark_button(ctrans('texts.download'))->addClass('download_invoices') !!}
|
||||
{!! Former::success_button(ctrans('texts.pay_now'))->addClass('pay_invoices') !!}
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Filters / Buttons in here.-->
|
||||
<div id="top_right_buttons" class="pull-right">
|
||||
|
||||
<input id="tableFilter_invoice" type="text" style="width:180px;background-color: white !important"
|
||||
<input id="table_filter" type="text" style="width:180px;background-color: white !important"
|
||||
class="form-control pull-left" placeholder="Filter" value=""/>
|
||||
</div>
|
||||
|
||||
<div class="animated fadeIn">
|
||||
<div class="col-md-12 card">
|
||||
|
||||
{!! $html->table(['class' => 'table table-hover table-striped', 'id' => 'invoice-table'], true) !!}
|
||||
{!! $html->table(['class' => 'table table-hover table-striped', 'id' => 'datatable'], true) !!}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -49,8 +50,12 @@
|
||||
|
||||
@section('footer')
|
||||
<script>
|
||||
|
||||
var data;
|
||||
|
||||
$(function() {
|
||||
$('#invoice-table').DataTable({
|
||||
|
||||
$('#datatable').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
searching: false,
|
||||
@ -64,6 +69,11 @@ $(function() {
|
||||
zeroRecords: "{{ trans('texts.no_records_found') }}"
|
||||
},
|
||||
ajax: '{!! route('client.invoices.index') !!}',
|
||||
drawCallback: function(settings){
|
||||
|
||||
data = this.api().ajax.json().data;
|
||||
|
||||
},
|
||||
columns: [
|
||||
|
||||
{data: 'checkbox', name: 'checkbox', title: '<input type="checkbox" class="select_all">', searchable: false, orderable: false},
|
||||
@ -78,24 +88,38 @@ $(function() {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
</script defer>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
$('#tableFilter_invoice').on('keyup', function(){
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#datatable").on('change', 'input[type=checkbox]', function() {
|
||||
var selected = [];
|
||||
$.each($("input[name='hashed_ids[]']:checked"), function(){
|
||||
selected.push($(this).val());
|
||||
});
|
||||
alert("Selected hashed_ids: " + selected.join(", "));
|
||||
});
|
||||
|
||||
$('#table_filter').on('keyup', function(){
|
||||
alert('filter');
|
||||
});
|
||||
|
||||
$('.select_all').change(function() {
|
||||
$(this).closest('table').find(':checkbox:not(:disabled)').prop('checked', this.checked);
|
||||
});
|
||||
|
||||
$('.pay_invoices').click(function() {
|
||||
alert('pay');
|
||||
});
|
||||
|
||||
$('.download_invoices').click(function() {
|
||||
alert('download');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user