Small fix
This commit is contained in:
miroman-afk
2022-01-20 12:03:19 +03:00
parent 104017ed96
commit cf997da7ec
10 changed files with 166 additions and 12 deletions

View File

@@ -52,7 +52,7 @@ class POSTRestoreShift extends HRCCommand implements HRCCommandInterface {
$old_date = date_create($terminal_online['next_at']); $old_date = date_create($terminal_online['next_at']);
date_modify($old_date, '+1 hour'); date_modify($old_date, '+1 hour');
$new_date = date_format($old_date, 'Y-m-d H:i:s'); $new_date = date_format($old_date, 'Y-m-d H:i:s');
if (($nowTime + 3600) >= $baseTime) { if (($nowTime + ($terminal_online['period']*60) >= $baseTime) {
$new_terminal_online = TerminalUpdate::find($terminal_online['id']); $new_terminal_online = TerminalUpdate::find($terminal_online['id']);
$new_terminal_online->next_at = $new_date; $new_terminal_online->next_at = $new_date;
$new_terminal_online->save(); $new_terminal_online->save();
@@ -128,7 +128,11 @@ class POSTRestoreShift extends HRCCommand implements HRCCommandInterface {
$shift_online_item->count_return = $exchange_item["count_return"]; $shift_online_item->count_return = $exchange_item["count_return"];
$shift_online_item->dish_code = $exchange_item["dishes_code"]; $shift_online_item->dish_code = $exchange_item["dishes_code"];
$shift_online_item->menu_code = $exchange_item["menu_code"]; $shift_online_item->menu_code = $exchange_item["menu_code"];
$shift_online_item->modificator_code = $exchange_item["modificator_code"]; if ($exchange_item["modificator_code"] > 0) {
$shift_online_item->modificator_code = 1;
} else {
$shift_online_item->modificator_code = 0;
}
$shift_online_item->order_code = $exchange_item["order_code"]; $shift_online_item->order_code = $exchange_item["order_code"];
$shift_online_item->parent_id = $exchange_item["parent_id"]; $shift_online_item->parent_id = $exchange_item["parent_id"];
$shift_online_item->real_price = $exchange_item["real_price"]; $shift_online_item->real_price = $exchange_item["real_price"];
@@ -173,9 +177,10 @@ class POSTRestoreShift extends HRCCommand implements HRCCommandInterface {
} }
$exc_time = time(); $exc_time = time();
$diff_time = $exc_time - $nowTime; $diff_time = $exc_time - $nowTime;
$terminal_online = TerminalUpdate::where('method', 'online')->where('terminal_id', $exchange_shifts['terminal_id'])->first();
return [ return [
'status' => 'success', 'status' => 'success',
'message' => 'Смена восстановлена за ' . $diff_time . ' сек', 'message' => 'Данные автоматически синхронизируются с POS-системой ' . $terminal_online['next_at'],
]; ];
} else { } else {
return [ return [

View File

@@ -1,6 +1,6 @@
{ {
"name": "hrc-admin/hello-world", "name": "hrc-admin/hello-world",
"version": "2.4", "version": "2.6",
"require": { "require": {
"horeca/admin-php-module-core": "dev-master" "horeca/admin-php-module-core": "dev-master"
}, },

View File

@@ -10,12 +10,10 @@ class AddValueToExchangeActionsTable extends Migration {
* @return void * @return void
*/ */
public function up() { public function up() {
if (!Schema::hasColumn('exchange_actions', 'value')) {
Schema::table('exchange_actions', function (Blueprint $table) { Schema::table('exchange_actions', function (Blueprint $table) {
$table->string('value', 255)->nullable()->change(); $table->string('value', 255)->nullable()->change();
}); });
} }
}
/** /**
* Reverse the migrations. * Reverse the migrations.

View File

@@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Log;
class DeleteFrontendFolders extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up() {
function dirDel($dir) {
$d = opendir($dir);
while (($entry = readdir($d)) !== false) {
if ($entry != "." && $entry != "..") {
if (is_dir($dir . "/" . $entry)) {
dirDel($dir . "/" . $entry);
} else {
unlink($dir . "/" . $entry);
}
}
}
closedir($d);
rmdir($dir);
}
if (file_exists(CORE_PATH . '/../Client/web/')) {
dirDel(CORE_PATH . '/../Client/web/');
} else {
Log::debug('Client frontend already deleted!');
}
if (file_exists(CORE_PATH . '/../Shift/web/')) {
dirDel(CORE_PATH . '/../Shift/web/');
} else {
Log::debug('Shift frontend already deleted!');
}
if (file_exists(CORE_PATH . '/../Report/web/')) {
dirDel(CORE_PATH . '/../Report/web/');
} else {
Log::debug('Report frontend already deleted!');
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down() {
//
}
}

View File

@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateValueInShiftOnlineActions extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up() {
Schema::table('shift_online_actions', function (Blueprint $table) {
$table->string('value', 255)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down() {
Schema::table('shift_online_actions', function (Blueprint $table) {
$table->string('value', 50)->nullable()->change();
});
}
}

View File

@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateMoreInShiftOnlineActions extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up() {
Schema::table('shift_online_actions', function (Blueprint $table) {
$table->string('more', 255)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down() {
Schema::table('shift_online_actions', function (Blueprint $table) {
$table->string('more', 50)->nullable()->change();
});
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateShiftOnlineModificatorsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up() {
if (!Schema::hasTable('shift_online_modificators')) {
Schema::create('shift_online_modificators', function (Blueprint $table) {
$table->id();
$table->integer('code')->nullable();
$table->string('name', 255)->nullable();
$table->integer('item_id')->nullable();
$table->integer('shift_id')->nullable();
$table->integer('terminal_id')->nullable();
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down() {
Schema::table('shift_online_modificators', function (Blueprint $table) {
//
});
}
}

View File

@@ -1,5 +1,5 @@
[info] [info]
name=V1 name=V1
version=2.4 version=2.6
[build] [build]
version=2.4 version=2.6

View File

@@ -278,6 +278,9 @@
}; };
$scope.update = function () { $scope.update = function () {
smartRequest.get('dashboard/online/updatetime', function (data) {
$scope.update_time = data.updated;
});
smartRequest.get('dashboard/online/updatetime', function (data) { smartRequest.get('dashboard/online/updatetime', function (data) {
$scope.update_time = data.updated; $scope.update_time = data.updated;

View File

@@ -142,7 +142,7 @@
console.log(data.message); console.log(data.message);
setTimeout(function() { setTimeout(function() {
location.reload(); location.reload();
}, 20000); }, 5000);
} }
if ($scope.status == 'error') { if ($scope.status == 'error') {
Notification.error(data.message); Notification.error(data.message);