-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed: layout issue with the permissions - Added: new permissions to control the pos features - Added: new filter
- Loading branch information
Showing
11 changed files
with
156 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
42 changes: 42 additions & 0 deletions
42
database/migrations/schema-updates/2021_08_05_165210_update_add_new_permissions__aug5.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
use App\Models\Permission; | ||
use App\Models\Role; | ||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class UpdateAddNewPermissionsAug5 extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
include( dirname( __FILE__ ) . '/../../permissions/pos.php' ); | ||
|
||
Role::namespace( 'admin' ) | ||
->addPermissions( Permission::includes( '.pos' ) | ||
->get()->map( fn( $permission ) => $permission->namespace ) ); | ||
|
||
Role::namespace( 'nexopos.store.administrator' ) | ||
->addPermissions( Permission::includes( '.pos' ) | ||
->get()->map( fn( $permission ) => $permission->namespace ) ); | ||
|
||
Role::namespace( 'nexopos.store.cashier' ) | ||
->addPermissions( Permission::includes( '.pos' ) | ||
->get()->map( fn( $permission ) => $permission->namespace ) ); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
use App\Models\Permission; | ||
|
||
if ( ! Permission::namespace( 'nexopos.pos.edit-purchase-price' ) instanceof Permission ) { | ||
$pos = new Permission(); | ||
$pos->name = __( 'Edit Purchase Price' ); | ||
$pos->namespace = 'nexopos.pos.edit-purchase-price'; | ||
$pos->description = __( 'Let the user edit the purchase price of products.' ); | ||
$pos->save(); | ||
} | ||
|
||
if ( ! Permission::namespace( 'nexopos.pos.edit-settings' ) instanceof Permission ) { | ||
$pos = new Permission(); | ||
$pos->name = __( 'Edit Order Settings' ); | ||
$pos->namespace = 'nexopos.pos.edit-settings'; | ||
$pos->description = __( 'Let the user edit the order settings.' ); | ||
$pos->save(); | ||
} | ||
|
||
if ( ! Permission::namespace( 'nexopos.pos.products-discount' ) instanceof Permission ) { | ||
$pos = new Permission(); | ||
$pos->name = __( 'Edit Product Discounts' ); | ||
$pos->namespace = 'nexopos.pos.products-discount'; | ||
$pos->description = __( 'Let the user add discount on products.' ); | ||
$pos->save(); | ||
} | ||
|
||
if ( ! Permission::namespace( 'nexopos.pos.cart-discount' ) instanceof Permission ) { | ||
$pos = new Permission(); | ||
$pos->name = __( 'Edit Cart Discounts' ); | ||
$pos->namespace = 'nexopos.pos.cart-discount'; | ||
$pos->description = __( 'Let the user add discount on cart.' ); | ||
$pos->save(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { nsAbbreviate } from './abbreviate'; | ||
import { nsCurrency, nsRawCurrency } from './currency'; | ||
import { nsTruncate } from './truncate'; | ||
|
||
export { nsCurrency, nsAbbreviate, nsRawCurrency }; | ||
export { nsCurrency, nsAbbreviate, nsRawCurrency, nsTruncate }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Vue from 'vue'; | ||
|
||
const nsTruncate = Vue.filter('truncate', function (value, length) { | ||
if ( !value ) { | ||
return ''; | ||
} | ||
|
||
value = value.toString(); | ||
|
||
if( value.length > length ){ | ||
return value.substring(0, length) + "..." | ||
} else { | ||
return value | ||
} | ||
}) | ||
|
||
|
||
export { nsTruncate }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters