diff --git a/Logs/10.06.2021_13.34.39.log b/Logs/10.06.2021_13.34.39.log deleted file mode 100644 index 4d7184e..0000000 --- a/Logs/10.06.2021_13.34.39.log +++ /dev/null @@ -1 +0,0 @@ -{"status":"success","version":"1.6","file":"http:\/\/portal.hrc.by\/uploads\/modules\/v1\/1.6\/build.zip","name":"v1"} diff --git a/Logs/10.06.2021_16.12.38.log b/Logs/10.06.2021_16.12.38.log deleted file mode 100644 index 4d7184e..0000000 --- a/Logs/10.06.2021_16.12.38.log +++ /dev/null @@ -1 +0,0 @@ -{"status":"success","version":"1.6","file":"http:\/\/portal.hrc.by\/uploads\/modules\/v1\/1.6\/build.zip","name":"v1"} diff --git a/commands/POSTRestoreShift.php b/commands/POSTRestoreShift.php index b778eff..1e1a0d4 100644 --- a/commands/POSTRestoreShift.php +++ b/commands/POSTRestoreShift.php @@ -20,6 +20,7 @@ class POSTRestoreShift extends HRCCommand implements HRCCommandInterface { protected $signature = 'postrestoreshift'; public function command($input, $output = null) { + function dirDel($dir) { $d = opendir($dir); while (($entry = readdir($d)) !== false) { @@ -40,7 +41,41 @@ class POSTRestoreShift extends HRCCommand implements HRCCommandInterface { $nowTime = time(); $update = true; - + $alph = [ + "А", + "Б", + "В", + "Г", + "Д", + "Е", + "Ё", + "Ж", + "З", + "И", + "Й", + "К", + "Л", + "М", + "Н", + "О", + "П", + "Р", + "С", + "Т", + "У", + "Ф", + "Х", + "Ц", + "Ч", + "Ш", + "Щ", + "Ъ", + "Ы", + "Ь", + "Э", + "Ю", + "Я", + ]; $exchange_shifts = ExchangeShifts::where('id', '=', $shift_id)->first(); $exchange_orders = ExchangeOrders::where('shift_id', '=', $shift_id)->get(); $exchange_items = ExchangeItems::where('shift_id', '=', $shift_id)->get(); @@ -106,7 +141,45 @@ class POSTRestoreShift extends HRCCommand implements HRCCommandInterface { $shift_online_order->opened = $exchange_order["opened"]; $shift_online_order->order_sum = $exchange_order["order_sum"]; $shift_online_order->params_code = $exchange_order["params_id"]; - $shift_online_order->place_name = $exchange_order["place_name"]; + + $place_name_bd = $exchange_order["place_name"]; + $place_name_d = mb_convert_encoding($place_name_bd, "CP1251", "UTF-8"); + + foreach ($alph as $key => $letter) { + $haystack = $place_name_d; + $needle = $letter; + $pos = strripos($haystack, $needle); + if ($pos === false) { + $after_conv = false; + } else { + $after_conv = true; + break; + } + } + + if (!$after_conv) { + foreach ($alph as $key => $letter) { + $haystack = $place_name_bd; + $needle = $letter; + $pos = strripos($haystack, $needle); + if ($pos === false) { + $before_conv = false; + } else { + $before_conv = true; + break; + } + } + } + + if ($after_conv) { + $place_name_decoded = $place_name_d; + } elseif ($before_conv) { + $place_name_decoded = $place_name_bd; + } else { + $place_name_decoded = $place_name_bd; + } + + $shift_online_order->place_name = $place_name_decoded; $shift_online_order->presale = $exchange_order["presale"]; $shift_online_order->sale_sum = $exchange_order["sale_sum"]; $shift_online_order->self = $exchange_order["self"]; @@ -176,6 +249,7 @@ class POSTRestoreShift extends HRCCommand implements HRCCommandInterface { $shift_online_deleted_item->units_id = $exchange_deleted_item["units_id"]; $shift_online_deleted_item->save(); } + $exc_time = time(); $diff_time = $exc_time - $nowTime; $terminal_online = TerminalUpdate::where('method', 'online')->where('terminal_id', $exchange_shifts['terminal_id'])->first(); diff --git a/web/controllers/shifts.js b/web/controllers/shifts.js index d08c8c4..a3d903f 100644 --- a/web/controllers/shifts.js +++ b/web/controllers/shifts.js @@ -123,7 +123,7 @@ $scope.total = data.total; $('#report-out').modal(); - } + } }, function (data) { $scope.update(); @@ -131,6 +131,8 @@ }; $scope.restoreShift = function (shift) { + $('#preload-modal').modal(); + Notification.primary('Дождитесь загрузки! Страница обновится автоматически.'); smartRequest.post('v1/restoreshift', { shift_id: shift.id }, function (data) { @@ -138,11 +140,9 @@ $scope.response = data.message; if (data.status == 'success') { Notification.success(data.message); - console.log(data.status); - console.log(data.message); setTimeout(function() { location.reload(); - }, 5000); + }, 1000); } if ($scope.status == 'error') { Notification.error(data.message); diff --git a/web/views/out.html b/web/views/reports/items/out.html similarity index 100% rename from web/views/out.html rename to web/views/reports/items/out.html diff --git a/web/views/shifts/images/350.gif b/web/views/shifts/images/350.gif new file mode 100644 index 0000000..e191307 Binary files /dev/null and b/web/views/shifts/images/350.gif differ diff --git a/web/views/shifts/index.html b/web/views/shifts/index.html index 94ad56d..290f1fd 100644 --- a/web/views/shifts/index.html +++ b/web/views/shifts/index.html @@ -111,9 +111,13 @@