diff --git a/commands/POSTRestoreShift.php b/commands/POSTRestoreShift.php index 7616e00..7d6274b 100644 --- a/commands/POSTRestoreShift.php +++ b/commands/POSTRestoreShift.php @@ -52,7 +52,7 @@ class POSTRestoreShift extends HRCCommand implements HRCCommandInterface { $old_date = date_create($terminal_online['next_at']); date_modify($old_date, '+1 hour'); $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->next_at = $new_date; $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->dish_code = $exchange_item["dishes_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->parent_id = $exchange_item["parent_id"]; $shift_online_item->real_price = $exchange_item["real_price"]; @@ -173,9 +177,10 @@ class POSTRestoreShift extends HRCCommand implements HRCCommandInterface { } $exc_time = time(); $diff_time = $exc_time - $nowTime; + $terminal_online = TerminalUpdate::where('method', 'online')->where('terminal_id', $exchange_shifts['terminal_id'])->first(); return [ 'status' => 'success', - 'message' => 'Смена восстановлена за ' . $diff_time . ' сек', + 'message' => 'Данные автоматически синхронизируются с POS-системой ' . $terminal_online['next_at'], ]; } else { return [ diff --git a/composer.json b/composer.json index 1a52be1..7e2bd38 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "hrc-admin/hello-world", - "version": "2.4", + "version": "2.6", "require": { "horeca/admin-php-module-core": "dev-master" }, diff --git a/database/migrations/2021_02_25_144800_add_value_to_exchange_actions_table.php b/database/migrations/2021_02_25_144800_add_value_to_exchange_actions_table.php index fbdc1ee..8fa417b 100644 --- a/database/migrations/2021_02_25_144800_add_value_to_exchange_actions_table.php +++ b/database/migrations/2021_02_25_144800_add_value_to_exchange_actions_table.php @@ -10,11 +10,9 @@ class AddValueToExchangeActionsTable extends Migration { * @return void */ public function up() { - if (!Schema::hasColumn('exchange_actions', 'value')) { - Schema::table('exchange_actions', function (Blueprint $table) { - $table->string('value', 255)->nullable()->change(); - }); - } + Schema::table('exchange_actions', function (Blueprint $table) { + $table->string('value', 255)->nullable()->change(); + }); } /** diff --git a/database/migrations/2022_01_14_143043_delete_frontend_folders.php b/database/migrations/2022_01_14_143043_delete_frontend_folders.php new file mode 100644 index 0000000..ea66a71 --- /dev/null +++ b/database/migrations/2022_01_14_143043_delete_frontend_folders.php @@ -0,0 +1,53 @@ +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(); + }); + } +} diff --git a/database/migrations/2022_01_19_124519_update_more_in_shift_online_actions.php b/database/migrations/2022_01_19_124519_update_more_in_shift_online_actions.php new file mode 100644 index 0000000..7688261 --- /dev/null +++ b/database/migrations/2022_01_19_124519_update_more_in_shift_online_actions.php @@ -0,0 +1,29 @@ +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(); + }); + } +} diff --git a/database/migrations/2022_01_19_130722_create_shift_online_modificators_table.php b/database/migrations/2022_01_19_130722_create_shift_online_modificators_table.php new file mode 100644 index 0000000..6fa666d --- /dev/null +++ b/database/migrations/2022_01_19_130722_create_shift_online_modificators_table.php @@ -0,0 +1,37 @@ +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) { + // + }); + } +} diff --git a/module.ini b/module.ini index 195fbde..9cf92d2 100644 --- a/module.ini +++ b/module.ini @@ -1,5 +1,5 @@ [info] name=V1 -version=2.4 +version=2.6 [build] -version=2.4 +version=2.6 diff --git a/web/controllers/dashboard.js b/web/controllers/dashboard.js index 5f35f9e..40520b5 100644 --- a/web/controllers/dashboard.js +++ b/web/controllers/dashboard.js @@ -278,6 +278,9 @@ }; $scope.update = function () { + smartRequest.get('dashboard/online/updatetime', function (data) { + $scope.update_time = data.updated; + }); smartRequest.get('dashboard/online/updatetime', function (data) { $scope.update_time = data.updated; diff --git a/web/controllers/shifts.js b/web/controllers/shifts.js index a977636..d08c8c4 100644 --- a/web/controllers/shifts.js +++ b/web/controllers/shifts.js @@ -142,7 +142,7 @@ console.log(data.message); setTimeout(function() { location.reload(); - }, 20000); + }, 5000); } if ($scope.status == 'error') { Notification.error(data.message);