mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Add bulk invoice button to products
This commit is contained in:
parent
d5411e3f08
commit
a5f4a369ab
@ -159,7 +159,16 @@ class ProductController extends BaseController
|
||||
{
|
||||
$action = Input::get('action');
|
||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
||||
|
||||
if ($action == 'invoice') {
|
||||
$products = Product::scope($ids)->get();
|
||||
foreach ($products as $product) {
|
||||
$data[] = $product->product_key;
|
||||
}
|
||||
return redirect("invoices/create")->with('selectedProducts', $data);
|
||||
} else {
|
||||
$count = $this->productService->bulk($ids, $action);
|
||||
}
|
||||
|
||||
$message = Utils::pluralize($action.'d_product', $count);
|
||||
Session::flash('message', $message);
|
||||
|
@ -16,7 +16,7 @@ class ActivityDatatable extends EntityDatatable
|
||||
function ($model) {
|
||||
$str = Utils::timestampToDateTimeString(strtotime($model->created_at));
|
||||
|
||||
if ($model->contact_id && $model->ip != '127.0.0.1') {
|
||||
if ($model->contact_id && ! in_array($model->ip, ['127.0.0.1', '192.168.255.33'])) {
|
||||
$ipLookUpLink = IP_LOOKUP_URL . $model->ip;
|
||||
$str .= sprintf(' <i class="fa fa-globe" style="cursor:pointer" title="%s" onclick="openUrl(\'%s\', \'IP Lookup\')"></i>', $model->ip, $ipLookUpLink);
|
||||
}
|
||||
|
2
public/css/built.css
vendored
2
public/css/built.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
resources/assets/css/style.css
vendored
2
resources/assets/css/style.css
vendored
@ -28,7 +28,7 @@ border-bottom: 1px solid #dfe0e1;
|
||||
.redlink:hover { color:#c13b25; }
|
||||
|
||||
.buttons { margin: 25px 0; }
|
||||
.buttons .btn { margin: 0 6px; }
|
||||
.buttons .btn { margin: 0 4px; }
|
||||
|
||||
/*forms*/
|
||||
.form-group {
|
||||
|
@ -179,41 +179,40 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p/> <p/>
|
||||
|
||||
@if (Auth::user()->hasFeature(FEATURE_EXPENSES))
|
||||
{!! Former::actions(
|
||||
count(Cache::get('banks')) > 0 ?
|
||||
<center class="buttons">
|
||||
{!! count(Cache::get('banks')) > 0 ?
|
||||
Button::normal(trans('texts.cancel'))
|
||||
->withAttributes([
|
||||
'data-bind' => 'visible: !importResults()',
|
||||
])
|
||||
->large()
|
||||
->asLinkTo(URL::to('/settings/bank_accounts'))
|
||||
->appendIcon(Icon::create('remove-circle')) : false,
|
||||
Button::success(trans('texts.validate'))
|
||||
->appendIcon(Icon::create('remove-circle')) : false !!}
|
||||
{!! Button::success(trans('texts.validate'))
|
||||
->withAttributes([
|
||||
'data-bind' => 'css: {disabled: disableValidate}, visible: page() == "login"',
|
||||
'onclick' => 'validate()'
|
||||
])
|
||||
->large()
|
||||
->appendIcon(Icon::create('lock')),
|
||||
Button::success(trans('texts.save'))
|
||||
->appendIcon(Icon::create('lock')) !!}
|
||||
{!! Button::success(trans('texts.save'))
|
||||
->withAttributes([
|
||||
'data-bind' => 'css: {disabled: disableSave}, visible: page() == "setup"',
|
||||
'style' => 'display:none',
|
||||
'onclick' => 'save()'
|
||||
])
|
||||
->large()
|
||||
->appendIcon(Icon::create('floppy-disk')) ,
|
||||
Button::success(trans('texts.import'))
|
||||
->appendIcon(Icon::create('floppy-disk')) !!}
|
||||
{!! Button::success(trans('texts.import'))
|
||||
->withAttributes([
|
||||
'data-bind' => 'css: {disabled: disableSaveExpenses}, visible: page() == "import"',
|
||||
'style' => 'display:none',
|
||||
'onclick' => 'saveExpenses()'
|
||||
])
|
||||
->large()
|
||||
->appendIcon(Icon::create('floppy-disk'))) !!}
|
||||
->appendIcon(Icon::create('floppy-disk')) !!}
|
||||
</center>
|
||||
@endif
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
@ -305,25 +305,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<br/>
|
||||
{!! Former::actions(
|
||||
$account->getCustomDesign(CUSTOM_DESIGN1) ?
|
||||
<center class="buttons">
|
||||
{!! $account->getCustomDesign(CUSTOM_DESIGN1) ?
|
||||
DropdownButton::primary(trans('texts.customize'))
|
||||
->withContents($account->present()->customDesigns)
|
||||
->large() :
|
||||
Button::primary(trans('texts.customize'))
|
||||
->appendIcon(Icon::create('edit'))
|
||||
->asLinkTo(URL::to('/settings/customize_design') . '?design_id=' . CUSTOM_DESIGN1)
|
||||
->large(),
|
||||
Auth::user()->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN) ?
|
||||
->large() !!}
|
||||
{!! Auth::user()->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN) ?
|
||||
Button::success(trans('texts.save'))
|
||||
->submit()->large()
|
||||
->appendIcon(Icon::create('floppy-disk'))
|
||||
->withAttributes(['class' => 'save-button']) :
|
||||
false
|
||||
) !!}
|
||||
<br/>
|
||||
false !!}
|
||||
</center>
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
||||
|
@ -55,10 +55,11 @@
|
||||
</div>
|
||||
|
||||
|
||||
{!! Former::actions(
|
||||
Button::success(trans('texts.save'))
|
||||
<center class="buttons">
|
||||
{!! Button::success(trans('texts.save'))
|
||||
->submit()->large()
|
||||
->appendIcon(Icon::create('floppy-disk'))) !!}
|
||||
->appendIcon(Icon::create('floppy-disk')) !!}
|
||||
</center>
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
||||
|
@ -3,11 +3,11 @@
|
||||
@section('content')
|
||||
@parent
|
||||
|
||||
{!! Former::open($url)->method($method)
|
||||
{!! Former::open($url)
|
||||
->method($method)
|
||||
->rules(['product_key' => 'required|max:255'])
|
||||
->addClass('col-md-10 col-md-offset-1 warn-on-exit') !!}
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">{!! $title !!}</h3>
|
||||
@ -40,10 +40,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!! Former::actions(
|
||||
Button::normal(trans('texts.cancel'))->large()->asLinkTo(HTMLUtils::previousUrl('/products'))->appendIcon(Icon::create('remove-circle')),
|
||||
Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk'))
|
||||
) !!}
|
||||
<center class="buttons">
|
||||
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(HTMLUtils::previousUrl('/products'))->appendIcon(Icon::create('remove-circle')) !!}
|
||||
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
|
||||
</center>
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
||||
|
@ -39,10 +39,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!! Former::actions(
|
||||
Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/settings/tax_rates'))->appendIcon(Icon::create('remove-circle')),
|
||||
Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk'))
|
||||
) !!}
|
||||
<center class="buttons">
|
||||
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/settings/tax_rates'))->appendIcon(Icon::create('remove-circle')) !!}
|
||||
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
|
||||
</center>
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
||||
|
@ -24,10 +24,10 @@
|
||||
</div>
|
||||
|
||||
@if (Auth::user()->hasFeature(FEATURE_API))
|
||||
{!! Former::actions(
|
||||
Button::normal(trans('texts.cancel'))->asLinkTo(URL::to('/settings/api_tokens'))->appendIcon(Icon::create('remove-circle'))->large(),
|
||||
Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk'))
|
||||
) !!}
|
||||
<center class="buttons">
|
||||
{!! Button::normal(trans('texts.cancel'))->asLinkTo(URL::to('/settings/api_tokens'))->appendIcon(Icon::create('remove-circle'))->large() !!}
|
||||
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
|
||||
</center>
|
||||
@else
|
||||
<script>
|
||||
$(function() {
|
||||
|
@ -96,7 +96,7 @@
|
||||
@include('accounts.partials.notifications')
|
||||
@endif
|
||||
|
||||
<center>
|
||||
<center class="buttons">
|
||||
@if (Auth::user()->confirmed)
|
||||
{!! Button::primary(trans('texts.change_password'))
|
||||
->appendIcon(Icon::create('lock'))
|
||||
|
@ -503,8 +503,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
<div class="form-actions">
|
||||
<center class="buttons">
|
||||
|
||||
<div style="display:none">
|
||||
{!! Former::populateField('entityType', $entityType) !!}
|
||||
@ -565,8 +564,7 @@
|
||||
@endif
|
||||
@endif
|
||||
|
||||
</div>
|
||||
<p> </p>
|
||||
</center>
|
||||
|
||||
@include('invoices.pdf', ['account' => Auth::user()->account, 'hide_pdf' => ! Auth::user()->account->live_preview])
|
||||
|
||||
@ -913,6 +911,7 @@
|
||||
item.task_public_id(task.publicId);
|
||||
}
|
||||
model.invoice().has_tasks(true);
|
||||
NINJA.formIsChanged = true;
|
||||
@endif
|
||||
|
||||
@if (isset($expenses) && $expenses)
|
||||
@ -937,6 +936,29 @@
|
||||
}
|
||||
model.invoice().invoice_items_without_tasks.push(blank);
|
||||
model.invoice().has_expenses(true);
|
||||
NINJA.formIsChanged = true;
|
||||
@endif
|
||||
|
||||
@if ($selectedProducts = session('selectedProducts'))
|
||||
// move the blank invoice line item to the end
|
||||
var blank = model.invoice().invoice_items_without_tasks.pop();
|
||||
var productMap = {};
|
||||
for (var i=0; i<products.length; i++) {
|
||||
var product = products[i];
|
||||
productMap[product.product_key] = product;
|
||||
}
|
||||
var selectedProducts = {!! json_encode($selectedProducts) !!}
|
||||
for (var i=0; i<selectedProducts.length; i++) {
|
||||
var productKey = selectedProducts[i];
|
||||
product = productMap[productKey];
|
||||
if (product) {
|
||||
var item = model.invoice().addItem();
|
||||
item.loadData(product);
|
||||
item.qty(1);
|
||||
}
|
||||
}
|
||||
model.invoice().invoice_items_without_tasks.push(blank);
|
||||
NINJA.formIsChanged = true;
|
||||
@endif
|
||||
|
||||
@endif
|
||||
|
@ -864,7 +864,7 @@ function ItemModel(data) {
|
||||
owner: this
|
||||
});
|
||||
|
||||
if (data) {
|
||||
self.loadData = function(data) {
|
||||
ko.mapping.fromJS(data, {}, this);
|
||||
var precision = getPrecision(this.cost());
|
||||
var cost = parseFloat(this.cost());
|
||||
@ -876,6 +876,10 @@ function ItemModel(data) {
|
||||
this.qty(roundSignificant(this.qty()));
|
||||
}
|
||||
|
||||
if (data) {
|
||||
self.loadData(data);
|
||||
}
|
||||
|
||||
this.totals = ko.observable();
|
||||
|
||||
this.totals.rawTotal = ko.computed(function() {
|
||||
|
@ -8,14 +8,11 @@
|
||||
</div>
|
||||
|
||||
<div class="pull-left">
|
||||
@if (in_array($entityType, [ENTITY_TASK, ENTITY_INVOICE, ENTITY_PRODUCT]))
|
||||
@can('create', 'invoice')
|
||||
@if ($entityType == ENTITY_TASK)
|
||||
{!! Button::primary(trans('texts.invoice'))->withAttributes(['class'=>'invoice', 'onclick' =>'submitForm_'.$entityType.'("invoice")'])->appendIcon(Icon::create('check')) !!}
|
||||
@endif
|
||||
@if ($entityType == ENTITY_EXPENSE)
|
||||
{!! Button::primary(trans('texts.invoice'))->withAttributes(['class'=>'invoice', 'onclick' =>'submitForm_'.$entityType.'("invoice")'])->appendIcon(Icon::create('check')) !!}
|
||||
@endif
|
||||
@endcan
|
||||
@endif
|
||||
|
||||
{!! DropdownButton::normal(trans('texts.archive'))
|
||||
->withContents($datatable->bulkActions())
|
||||
|
@ -171,7 +171,7 @@
|
||||
@endif
|
||||
|
||||
|
||||
<center>
|
||||
<center class="buttons">
|
||||
{!! DropdownButton::primary(trans('texts.export'))
|
||||
->large()
|
||||
->withAttributes(array('id' => 'export-button'))
|
||||
@ -185,8 +185,7 @@
|
||||
->submit()
|
||||
->appendIcon(Icon::create('play'))
|
||||
->large() !!}
|
||||
</center><br/>
|
||||
|
||||
</center>
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
||||
|
@ -77,11 +77,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!! Former::actions(
|
||||
Button::normal(trans('texts.cancel'))->asLinkTo(URL::to('/settings/user_management'))->appendIcon(Icon::create('remove-circle'))->large(),
|
||||
($user) ? Button::success(trans('texts.save'))->withAttributes(['onclick' => 'submitAction("save")'])->large()->appendIcon(Icon::create('floppy-disk')) : false,
|
||||
(! $user || ! $user->confirmed) ? Button::info(trans($user ? 'texts.resend_invite' : 'texts.send_invite'))->withAttributes(['onclick' => 'submitAction("email")'])->large()->appendIcon(Icon::create('send')) : false
|
||||
)!!}
|
||||
<center class="buttons">
|
||||
{!! Button::normal(trans('texts.cancel'))->asLinkTo(URL::to('/settings/user_management'))->appendIcon(Icon::create('remove-circle'))->large() !!}
|
||||
{!! ($user) ? Button::success(trans('texts.save'))->withAttributes(['onclick' => 'submitAction("save")'])->large()->appendIcon(Icon::create('floppy-disk')) : false !!}
|
||||
{!! (! $user || ! $user->confirmed) ? Button::info(trans($user ? 'texts.resend_invite' : 'texts.send_invite'))->withAttributes(['onclick' => 'submitAction("email")'])->large()->appendIcon(Icon::create('send')) : false !!}
|
||||
</center>
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user