Skip to content

Commit

Permalink
Merge pull request #300 from Blair2004/v4.5.x
Browse files Browse the repository at this point in the history
V4.5.3
  • Loading branch information
Blair2004 committed Sep 13, 2021
2 parents f6b39ac + 3ad2bd2 commit a724e1e
Show file tree
Hide file tree
Showing 16 changed files with 89 additions and 48 deletions.
20 changes: 20 additions & 0 deletions .do/deploy.template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
spec:
name: nexopos
databases:
- name: nexopos
engine: MYSQL
production: true
cluster_name: ns
services:
- environment_slug: php
name: nexopos
git:
repo_clone_url: https://github.com/blair2004/NexoPOS-4x
branch: master
build_command:
npm install
composer install
cp .env.example .env
php artisan key:generate
php artisan storage:link
run_command: heroku-php-apache2 public/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[![Latest Stable Version](https://poser.pugx.org/blair2004/nexopos/v)](//packagist.org/packages/blair2004/nexopos) [![Total Downloads](https://poser.pugx.org/blair2004/nexopos/downloads)](//packagist.org/packages/blair2004/nexopos) [![Latest Unstable Version](https://poser.pugx.org/blair2004/nexopos/v/unstable)](//packagist.org/packages/blair2004/nexopos) [![License](https://poser.pugx.org/blair2004/nexopos/license)](//packagist.org/packages/blair2004/nexopos)

[![Deploy to DO](https://www.deploytodo.com/do-btn-blue.svg)](https://cloud.digitalocean.com/apps/new?repo=https://github.com/blair2004/NexoPOS-4x/tree/v4.5.x&refcode=ebdb80cb0ec7)

# About NexoPOS 4.x
NexoPOS 4 is a free point of sale system build using Laravel, TailwindCSS, Vue and other open-source resources. This POS System focuses on utilities and functionalities to offer for most businesses all the tools they need to manage better their store. NexoPOS 4.x include a responsive and beautiful dashboard that ease the interaction either on a smartphone, tables or desktops.

Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/GenerateModuleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class GenerateModuleCommand extends Command
*
* @var string
*/
protected $description = 'Create a new Tendoo module';
protected $description = 'Create a new NexoPOS 4.x module';

/**
* Create a new command instance.
Expand All @@ -52,7 +52,7 @@ public function handle()
if ( ns()->installed() ) {
$this->askInformations();
} else {
$this->info( 'Tendoo is not yet installed.' );
$this->info( 'NexoPOS 4.x is not yet installed.' );
}
}

Expand Down
3 changes: 2 additions & 1 deletion app/Crud/CustomerCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use App\Models\CustomerBillingAddress;
use App\Models\CustomerGroup;
use App\Models\CustomerShippingAddress;
use App\Services\Users;
use Exception;
use TorMorten\Eventy\Facades\Events as Hook;

Expand Down Expand Up @@ -565,7 +566,7 @@ public function bulkAction( Request $request )
* Deleting licence is only allowed for admin
* and supervisor.
*/
$user = app()->make( 'Tendoo\Core\Services\Users' );
$user = app()->make( Users::class );
if ( ! $user->is([ 'admin', 'supervisor' ]) ) {
return response()->json([
'status' => 'failed',
Expand Down
1 change: 1 addition & 0 deletions app/Crud/ProductCategoryCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ public function bulkAction( Request $request )
* and supervisor.
*/
$user = app()->make( Users::class );

if ( ! $user->is([ 'admin', 'supervisor' ]) ) {
return response()->json([
'status' => 'failed',
Expand Down
12 changes: 6 additions & 6 deletions app/Http/Controllers/Dashboard/CrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public function crudBulkActions( String $namespace, Request $request )
* assuming we're bulk deleting
* but the action might be different later
*/
$response = $resource->bulkAction( $request );
$response = Hook::filter( get_class( $resource ) . '@bulkAction', $resource->bulkAction( $request ), $request );

return [
'status' => 'success',
Expand Down Expand Up @@ -462,9 +462,9 @@ public function getConfig( string $namespace )
get_class( $resource ) . '@getColumns',
$resource->getColumns()
),
'labels' => $resource->getLabels(),
'links' => $resource->getLinks() ?? [],
'bulkActions' => $resource->getBulkActions(),
'labels' => Hook::filter( get_class( $resource ) . '@getLabels', $resource->getLabels() ),
'links' => Hook::filter( get_class( $resource ) . '@getLinks', $resource->getLinks() ?? [] ),
'bulkActions' => Hook::filter( get_class( $resource ) . '@getBulkActions', $resource->getBulkActions() ),
'namespace' => $namespace,
];
}
Expand Down Expand Up @@ -499,8 +499,8 @@ public function getFormConfig( string $namespace, $id = null )
$form = Hook::filter( get_class( $resource )::method( 'getForm' ), $resource->getForm( $model ), compact( 'model' ) );
$config = [
'form' => $form,
'labels' => $resource->getLabels(),
'links' => @$resource->getLinks(),
'labels' => Hook::filter( get_class( $resource ) . '@getLabels', $resource->getLabels() ),
'links' => Hook::filter( get_class( $resource ) . '@getLinks', $resource->getLinks() ),
'namespace' => $namespace,
];

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Dashboard/CustomersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public function getCustomersRewards( Customer $customer )
public function editCustomerReward( Customer $customer, CustomerReward $reward )
{
return CustomerRewardCrud::form( $reward, [
'returnUrl' => ns()->route( 'ns.dashboard.customers-rewards', [ 'customer' => $customer->id ]),
'returnUrl' => ns()->route( 'ns.dashboard.customers-rewards-list', [ 'customer' => $customer->id ]),
'queryParams' => [
'customer_id' => $customer->id
]
Expand Down
1 change: 1 addition & 0 deletions app/Services/AuthService.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ public function lostPasswordUnsecured( $fields )
/**
* Check recaptcha using predefined
* values as POST data
* @deprecated
* @return void
*/
public function checkReCaptcha( $data = [])
Expand Down
12 changes: 12 additions & 0 deletions app/Services/CoreService.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,18 @@ public function url( $url )
return url( Hook::filter( 'ns-url', $url ) );
}

/**
* Returns a filtred URL to which
* apply the filter "ns-url" hook.
*
* @param string $url
* @return string $url
*/
public function asset( $url )
{
return url( Hook::filter( 'ns-asset', $url ) );
}

/**
* check if a use is allowed to
* access a page or trigger an error. This should not be used
Expand Down
5 changes: 1 addition & 4 deletions app/Services/OrdersService.php
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,7 @@ public function __checkDiscountVality( $fields )
})->sum();

if ( $fields['discount'] > $productsTotal ) {
throw new NotAllowedException([
'status' => 'failed',
'message' => __('A discount cannot exceed the sub total value of an order.')
]);
throw new NotAllowedException( __('A discount cannot exceed the sub total value of an order.') );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion config/nexopos.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
return [
'version' => '4.5.2',
'version' => '4.5.3',
'languages' => [
'en' => 'English',
'fr' => 'Français',
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"private": true,
"engines": {
"node": "14.x"
},
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
Expand Down
20 changes: 11 additions & 9 deletions resources/ts/components/ns-crud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,20 @@ const nsCrud = Vue.component( 'ns-crud', {
bulkDo() {
if ( this.bulkAction ) {
if ( this.selectedEntries.length > 0 ) {
console.log( this.getSelectedAction );
if ( confirm( this.getSelectedAction.confirm || this.$slots[ 'error-bulk-confirmation' ] || __( 'No bulk confirmation message provided on the CRUD class.' ) ) ) {
if ( confirm( this.getSelectedAction.confirm || this.$slots[ 'error-bulk-confirmation' ] || __( 'Would you like to perform the selected bulk action on the selected entries ?' ) ) ) {
return nsHttpClient.post( `${this.src}/bulk-actions`, {
action: this.bulkAction,
entries: this.selectedEntries.map( r => r.$id )
}).subscribe( (result: HttpStatusResponse ) => {
nsSnackBar.info( result.message ).subscribe();
this.selectedEntries = [];
this.refresh();
}, ( error ) => {
nsSnackBar.error( error.message )
.subscribe();
}).subscribe({
next: (result: HttpStatusResponse ) => {
nsSnackBar.info( result.message ).subscribe();
this.selectedEntries = [];
this.refresh();
},
error: ( error ) => {
nsSnackBar.error( error.message )
.subscribe();
}
})
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
<span>@{{ item.selectedUnitQuantity.sale_price | currency }}</span>
</div>
<div class="flex justify-center flex-col py-1">
<img :style="{ height: form.barcode_height + 'px' }" :src="'{{ asset( 'storage/products/barcodes' ) }}/' + item.selectedUnitQuantity.barcode + '.png'" :alt="item.selectedUnitQuantity.barcode">
<img :style="{ height: form.barcode_height + 'px' }" :src="'{{ ns()->asset( 'storage/products/barcodes' ) }}/' + item.selectedUnitQuantity.barcode + '.png'" :alt="item.selectedUnitQuantity.barcode">
<div class="flex justify-center w-full">
<span class="-mt-4 bg-white inline-block p-1">@{{ item.selectedUnitQuantity.barcode }}</span>
</div>
Expand Down
36 changes: 18 additions & 18 deletions routes/web/customers.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
use App\Http\Controllers\Dashboard\RewardsSystemController;
use Illuminate\Support\Facades\Route;

Route::get( '/customers', [ CustomersController::class, 'listCustomers' ]);
Route::get( '/customers/create', [ CustomersController::class, 'createCustomer' ]);
Route::get( '/customers/edit/{customer}', [ CustomersController::class, 'editCustomer' ]);
Route::get( '/customers/{customer}/rewards', [ CustomersController::class, 'getCustomersRewards' ])->name( ns()->routeName( 'ns.dashboard.customers-rewards' ) );
Route::get( '/customers/{customer}/rewards/edit/{reward}', [ CustomersController::class, 'editCustomerReward' ]);
Route::get( '/customers/{customer}/orders', [ CustomersController::class, 'getCustomersOrders' ]);
Route::get( '/customers/{customer}/coupons', [ CustomersController::class, 'getCustomersCoupons' ]);
Route::get( '/customers/{customer}/account-history', [ CustomersController::class, 'getCustomerAccountHistory' ]);
Route::get( '/customers/{customer}/account-history/create', [ CustomersController::class, 'createCustomerAccountHistory' ]);
Route::get( '/customers/{customer}/account-history/edit/{customerAccountHistory}', [ CustomersController::class, 'editCustomerAccountHistory' ]);
Route::get( '/customers/groups', [ CustomersGroupsController::class, 'listCustomersGroups' ]);
Route::get( '/customers/groups/create', [ CustomersGroupsController::class, 'createCustomerGroup' ]);
Route::get( '/customers/groups/edit/{group}', [ CustomersGroupsController::class, 'editCustomerGroup' ]);
Route::get( '/customers/rewards-system', [ RewardsSystemController::class, 'list' ]);
Route::get( '/customers/rewards-system/create', [ RewardsSystemController::class, 'create' ]);
Route::get( '/customers', [ CustomersController::class, 'listCustomers' ])->name( ns()->routeName( 'ns.dashboard.customers-list' ) );
Route::get( '/customers/create', [ CustomersController::class, 'createCustomer' ])->name( ns()->routeName( 'ns.dashboard.customers-create' ) );
Route::get( '/customers/edit/{customer}', [ CustomersController::class, 'editCustomer' ])->name( ns()->routeName( 'ns.dashboard.customers-edit' ) );
Route::get( '/customers/{customer}/rewards', [ CustomersController::class, 'getCustomersRewards' ])->name( ns()->routeName( 'ns.dashboard.customers-rewards-list' ) );
Route::get( '/customers/{customer}/rewards/edit/{reward}', [ CustomersController::class, 'editCustomerReward' ])->name( ns()->routeName( 'ns.dashboard.customers-rewards-edit' ) );
Route::get( '/customers/{customer}/orders', [ CustomersController::class, 'getCustomersOrders' ])->name( ns()->routeName( 'ns.dashboard.customers-orders-list' ) );
Route::get( '/customers/{customer}/coupons', [ CustomersController::class, 'getCustomersCoupons' ])->name( ns()->routeName( 'ns.dashboard.customers-coupons-list' ) );
Route::get( '/customers/{customer}/account-history', [ CustomersController::class, 'getCustomerAccountHistory' ])->name( ns()->routeName( 'ns.dashboard.customers-account-history-list' ) );
Route::get( '/customers/{customer}/account-history/create', [ CustomersController::class, 'createCustomerAccountHistory' ])->name( ns()->routeName( 'ns.dashboard.customers-account-history-create' ) );
Route::get( '/customers/{customer}/account-history/edit/{customerAccountHistory}', [ CustomersController::class, 'editCustomerAccountHistory' ])->name( ns()->routeName( 'ns.dashboard.customers-account-history-edit' ) );
Route::get( '/customers/groups', [ CustomersGroupsController::class, 'listCustomersGroups' ])->name( ns()->routeName( 'ns.dashboard.customersgroups-list' ) );
Route::get( '/customers/groups/create', [ CustomersGroupsController::class, 'createCustomerGroup' ])->name( ns()->routeName( 'ns.dashboard.customersgroups-create' ) );
Route::get( '/customers/groups/edit/{group}', [ CustomersGroupsController::class, 'editCustomerGroup' ])->name( ns()->routeName( 'ns.dashboard.customersgroups-edit' ) );
Route::get( '/customers/rewards-system', [ RewardsSystemController::class, 'list' ])->name( ns()->routeName( 'ns.dashboard.rewards-list' ) );
Route::get( '/customers/rewards-system/create', [ RewardsSystemController::class, 'create' ])->name( ns()->routeName( 'ns.dashboard.rewards-create' ) );
Route::get( '/customers/rewards-system/edit/{reward}', [ RewardsSystemController::class, 'edit' ])->name( ns()->routeName( 'ns.dashboard.rewards-edit' ) );
Route::get( '/customers/coupons', [ CustomersController::class, 'listCoupons' ]);
Route::get( '/customers/coupons/create', [ CustomersController::class, 'createCoupon' ]);
Route::get( '/customers/coupons/edit/{coupon}', [ CustomersController::class, 'editCoupon' ]);
Route::get( '/customers/coupons', [ CustomersController::class, 'listCoupons' ])->name( ns()->routeName( 'ns.dashboard.customers-coupons-list' ) );
Route::get( '/customers/coupons/create', [ CustomersController::class, 'createCoupon' ])->name( ns()->routeName( 'ns.dashboard.customers-coupons-create' ) );
Route::get( '/customers/coupons/edit/{coupon}', [ CustomersController::class, 'editCoupon' ])->name( ns()->routeName( 'ns.dashboard.customers-coupons-edit' ) );
12 changes: 7 additions & 5 deletions tests/Feature/CreateOrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,13 @@ public function processOrders( $currentDate, $callback )
* Let's test wether the cash
* flow has been created for this sale
*/
$this->assertTrue(
CashFlow::where( 'order_id', $responseData[ 'data' ][ 'order' ][ 'id' ] )->first()
instanceof CashFlow,
__( 'No cash flow were created for this order.' )
);
if ( $responseData[ 'data' ][ 'order' ][ 'payment_status' ] !== 'unpaid' ) {
$this->assertTrue(
CashFlow::where( 'order_id', $responseData[ 'data' ][ 'order' ][ 'id' ] )->first()
instanceof CashFlow,
__( 'No cash flow were created for this order.' )
);
}

/**
* if a custom callback is provided
Expand Down

0 comments on commit a724e1e

Please sign in to comment.