1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-16 16:13:20 +01:00
invoiceninja/resources/views/accounts/product.blade.php
David Bomba a9f2d0d855
This PR implements Create/View/Edit permissions based on ENTITY TYPE (ie invoice/expense/client). (#2150)
* migration for new permissions schema

* update permissions across data tables

* refactor migrations to prevent duplicate attribute

* update permissions in views

* Product Permissions

* permissions via controllers

* Refactor to use Laravel authorization gate

* Doc Blocks for EntityPolicy

* check permissions conditional on create new client

* Bug Fixes

* Data table permissions

* working on UI

* settings UI/UX finalised

* Datatable permissions

* remove legacy permissions

* permission fix for viewing client

* remove all instances of viewByOwner

* refactor after PR

* Bug fix for Functional test and implementation of Functional tests for Permissions

* fix for tests
2018-06-07 20:08:34 +10:00

97 lines
3.1 KiB
PHP

@extends('header')
@section('content')
@parent
{!! Former::open($url)
->method($method)
->autocomplete('off')
->rules(['product_key' => 'required|max:255'])
->addClass('col-lg-10 col-lg-offset-1 main-form warn-on-exit') !!}
@if ($product)
{{ Former::populate($product) }}
{{ Former::populateField('cost', Utils::roundSignificant($product->cost)) }}
@endif
<span style="display:none">
{!! Former::text('public_id') !!}
{!! Former::text('action') !!}
</span>
<div class="row">
<div class="col-lg-10 col-lg-offset-1">
<div class="panel panel-default">
<div class="panel-body form-padding-right">
{!! Former::text('product_key')->label('texts.product') !!}
{!! Former::textarea('notes')->rows(6) !!}
@include('partials/custom_fields', ['entityType' => ENTITY_PRODUCT])
{!! Former::text('cost') !!}
@if ($account->invoice_item_taxes)
@include('partials.tax_rates')
@endif
</div>
</div>
</div>
</div>
@foreach(Module::getOrdered() as $module)
@if(View::exists($module->alias . '::products.edit'))
<div class="row">
<div class="col-lg-10 col-lg-offset-1">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title in-white">
<i class="fa fa-{{ $module->icon }}"></i>
{{ $module->name }}
</h3>
</div>
<div class="panel-body form-padding-right">
@includeIf($module->alias . '::products.edit')
</div>
</div>
</div>
</div>
@endif
@endforeach
@if((!$product && Auth::user()->can('create', ENTITY_PRODUCT)) || ($product && Auth::user()->can('edit',[ENTITY_PRODUCT, $product])))
<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')) !!}
@if ($product)
{!! DropdownButton::normal(trans('texts.more_actions'))
->withContents($product->present()->moreActions())
->large()
->dropup() !!}
@endif
</center>
@endif
{!! Former::close() !!}
<script type="text/javascript">
$(function() {
$('#product_key').focus();
});
function submitAction(action) {
$('#action').val(action);
$('.main-form').submit();
}
function onDeleteClick() {
sweetConfirm(function() {
submitAction('delete');
});
}
</script>
@stop