Редактор карты зала
Электронные заказы
Отчет по удалениям
This commit is contained in:
miroman-afk
2022-09-22 16:34:02 +03:00
parent 1af2b267f5
commit dcd0e72d1f
43 changed files with 2481 additions and 727 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
temp/
vendor/
build.zip
places.xml

View File

@@ -2,18 +2,23 @@
namespace App\Commands;
use App\Component\Models\Dishes;
use App\Component\Models\ExchangeActions;
use App\Component\Models\ExchangeDeleted;
use App\Component\Models\ExchangeOrders;
use App\Component\Models\ExchangeShifts;
use App\Component\Models\Reasons;
use App\Component\Models\Report;
use App\Component\Models\Staff;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class GETDataReport extends HRCCommand implements HRCCommandInterface {
class GETDataReport extends HRCCommand implements HRCCommandInterface
{
protected $signature = 'getdatareport';
public function command($input, $output = null) {
public function command($input, $output = null)
{
function validate_json($string)
{
@@ -66,7 +71,8 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface {
return true;
}
function data_decode($data) {
function data_decode($data)
{
$alph = [
"А", "Б", "В", "Г", "Д",
"Е", "Ё", "Ж", "З", "И",
@@ -120,7 +126,8 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface {
return $retval;
}
function staffName($data) {
function staffName($data)
{
$staff_name = Staff::where('code', $data)->where('is_history', 0)->first();
if ($staff_name) {
$staff_name = $staff_name['name'];
@@ -146,16 +153,19 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface {
$actions = ExchangeActions::where('order_code', $order['order_code'])->where('shift_id', $input['shift_id'])->orderBy('time', 'asc')->get();
foreach ($actions as $key => $item) {
if ($item['action_type'] == 31) {
$merge_order = $item['value'];
$item_actions = ExchangeActions::where('order_code', $item['value'] + 0)
->where('shift_id', $input['shift_id'])
$merge_order = intval($item['value']);
$item_actions = ExchangeActions::where('order_code', $merge_order)
->where('shift_id', intval($input['shift_id']))
->where('action_type', 32)
->get();
foreach ($item_actions as $key => $item_action) {
if ($item_action['more']) {
$merge_trigger = 1;
$merge_items_before = $merge_items_after = $merge_items = $merge_order_item_before = $merge_order_item_after = $merged_items = [];
if (validate_json($item['more'])) {
if (validate_json($item_action['more'])) {
$merge_order_items = json_decode(utf8_encode($item_action['more']), true, JSON_INVALID_UTF8_SUBSTITUTE);
} else {
$merge_order_items = json_decode(utf8_encode(base64_decode($item_action['more'], TRUE)), true, JSON_INVALID_UTF8_SUBSTITUTE);
@@ -259,6 +269,7 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface {
foreach ($orders as $key => $order) {
$actions = ExchangeActions::where('order_code', $order['order_code'])->where('shift_id', $input['shift_id'])->orderBy('time', 'asc')->get();
foreach ($actions as $key => $item) {
$moved_order_data = [];
if ($item['action_type'] == 39) {
$staff_name_to = staffName($item['who']);
$time_to = date('d.m.Y H:i:s', strtotime($item['time']));
@@ -275,6 +286,7 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface {
'data' => $moved_order_data,
];
}
if ($reportType == 'staff') {
if (isset($input['shift_id'])) {
$staff = $staff_data = [];
@@ -522,11 +534,11 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface {
}
$staff_data[] = array(
'name' => $name,
'code' => $code + 0,
'opened_count' => $countOpened + 0,
'closed_count' => $countClosed,
'opened_sum' => $sumOpened + 0,
'closed_sum' => $sumClosed + 0,
'code' => intval($code),
'opened_count' => intval($countOpened),
'closed_count' => intval($countClosed),
'opened_sum' => floatval($sumOpened),
'closed_sum' => floatval($sumClosed),
'input_count' => $inputCount,
'output_count' => $outputCount,
'input_sum' => $inputSum,
@@ -545,6 +557,76 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface {
}
}
if ($reportType == 'deleted') {
$total_count = $total_sum = 0;
$deleted = [];
if (isset($input['shift_id'])) {
$shift_id = $input['shift_id'];
$deleted_from_orders = ExchangeActions::select('order_code')->where('action_type', 5)->where('shift_id', $shift_id)->groupBy('order_code')->get();
foreach ($deleted_from_orders as $deleted_from_order) {
$items = [];
$order_id = $deleted_from_order['order_code'];
//$count = ExchangeActions::where('action_type', 5)->where('shift_id', $shift_id)->where('order_code', $deleted_from_order['order_code'])->count();
$deleted_items = ExchangeDeleted::where('shift_id', $shift_id)->where('order_code', $order_id)->get();
foreach ($deleted_items as $deleted_item) {
$item_info = ExchangeActions::where('shift_id', $shift_id)->where('order_code', $deleted_item['order_code'])->where('action_type', 5)->where('order_position', $deleted_item['item_id'])->first();
$time = $item_info['time'];
$who = Staff::getName($item_info['who']);
$reason = Reasons::getName($item_info['reason']);
$approved = Staff::getName($item_info['more']);
$item_count = $deleted_item['count'];
$item_price = $deleted_item['sale_price'];
$item_name = Dishes::getName($deleted_item['menu_code']);
$total_count += $item_count;
$total_sum += $item_count * $item_price;
$items[] = array('dish_name' => $item_name, 'who' => $who, 'approved' => $approved, 'reason' => $reason, 'time' => $time, 'count' => $item_count, 'price' => $item_price, 'sum' => floatval($item_price * $item_count));
}
$deleted[] = array('order_code' => $order_id, 'shift_id' => $shift_id, 'items' => $items);
}
}
if (isset($input['start_date']) && isset($input['end_date'])) {
$end_date = date('Y-m-d H:i:s', strtotime($input['end_date']));
$start_date = date('Y-m-d H:i:s', strtotime($input['start_date']));
$deletedShifts = ExchangeActions::select('shift_id')->where('action_type', 5)->where('time', '>', $start_date)->where('time', '<', $end_date)->groupBy('shift_id')->get();
foreach ($deletedShifts as $deletedShift) {
$shift_id = intval($deletedShift['shift_id']);
$deleted_from_orders = ExchangeActions::select('order_code')->where('action_type', 5)->where('shift_id', $shift_id)->groupBy('order_code')->get();
foreach ($deleted_from_orders as $deleted_from_order) {
$items = [];
$order_id = $deleted_from_order['order_code'];
$deleted_items = ExchangeDeleted::where('shift_id', $shift_id)->where('order_code', $order_id)->get();
foreach ($deleted_items as $deleted_item) {
$item_info = ExchangeActions::where('shift_id', $shift_id)->where('order_code', $deleted_item['order_code'])->where('action_type', 5)->where('order_position', $deleted_item['item_id'])->first();
$time = $item_info['time'];
$who = Staff::getName($item_info['who']);
$reason = Reasons::getName($item_info['reason']);
$approved = Staff::getName($item_info['more']);
$item_count = $deleted_item['count'];
$item_price = $deleted_item['sale_price'];
$item_name = Dishes::getName($deleted_item['menu_code']);
$total_count += $item_count;
$total_sum += $item_count * $item_price;
$items[] = array('dish_name' => $item_name, 'who' => $who, 'approved' => $approved, 'reason' => $reason, 'time' => $time, 'count' => $item_count, 'price' => $item_price, 'sum' => floatval($item_price * $item_count));
}
$deleted[] = array('order_code' => $order_id, 'shift_id' => $shift_id, 'items' => $items);
}
}
$report = new Report;
$report->user_id = intval($input['admin_user_id']);
$report->name = 'Отчет по удалениям';
$report->shift_id = 0;
$report->start_date = $start_date;
$report->end_date = $end_date;
$report->report_type = 'deleted';
$report->save();
}
return [
'status' => 'success',
'total_count' => strval($total_count),
'total_sum' => $total_sum,
'deleted' => $deleted
];
}
} else {
return [
'status' => 'success',

View File

@@ -26,6 +26,9 @@ class GETDiscountItems extends HRCCommand implements HRCCommandInterface {
$discount = 0;
}
$dish = Dishes::where('code', $item['dish_code'])->where('is_history', 0)->first();
if (!isset($dish)) {
$dish = Dishes::where('legacy_code', $item['dish_code'])->where('is_history', 0)->first();
}
$items[] = array('name' => $dish['name'], 'discount' => round($discount, 0), 'count' => $item['count'], 'sale_price' => $salePrice, 'sum' => round($realPrice, 2));
}

View File

@@ -18,42 +18,43 @@ class GETOrder extends HRCCommand implements HRCCommandInterface {
if (isset($input['task'])) {
if ($input['task'] == 'single' && isset($input['order_id'])) {
$order = Orders::where('id', '=', $input['order_id'])->first();
$order = Orders::where('id', intval($input['order_id']))->first();
if (isset($order->client_id) && $order->client_id !== null && $order->client_id !== '') {
$client = Client::where('user_code', '=', $order->client_id)->first();
$client = $client->name;
$client_phone = ClientsPhone::where('client_guid', '=', $order->client_id)->first();
$client_phone = $client_phone->phone;
$client_address = ClientsAddress::where('client_guid', '=', $order->client_id)->first();
$client_address = $client_address->address;
if (isset($order['client_id']) && $order['client_id'] !== null && $order['client_id'] !== '') {
$client = Client::where('user_code', $order['client_id'])->first();
$client = $client['name'];
$client_phone = ClientsPhone::where('client_guid', $order['client_id'])->first();
$client_phone = $client_phone['phone'];
$client_address = ClientsAddress::where('client_guid', $order['client_id'])->first();
$client_address = $client_address['address'];
} else {
$client = '';
$client_phone = '';
$client_address = '';
}
$orderItems = OrderItems::where('order_id', '=', $order->id)->whereNull('modifier_id')->get();
$orderItems = OrderItems::where('order_id', $order['id'])->whereNull('modifier_id')->get();
if (isset($orderItems)) {
foreach ($orderItems as $key => $item) {
$itemName = Dishes::where('code', '=', $item->item_id)->first();
$itemName = $itemName->name;
$itemModifiers = OrderItems::where('order_id', '=', $order->id)->where('parent_id', '=', $item->id)->whereNotNull('modifier_id')->get();
$itemName = Dishes::getName($item['item_id']);
$is_real = Dishes::isReal($item['item_id']);
$itemModifiers = OrderItems::where('order_id', $order['id'])->where('parent_id', $item['id'])->whereNotNull('modifier_id')->get();
if (isset($itemModifiers)) {
foreach ($itemModifiers as $key => $itemModifier) {
$modifier = Modifier::where('code', '=', $itemModifier->modifier_id)->first();
if ($modifier->dish_code == 0 && $modifier->unit_id == 0) {
$modOut[] = array('id' => $modifier->code, 'name' => $modifier->name, 'price' => '*');
$modifier = Modifier::where('code', $itemModifier['modifier_id'])->first();
if ($modifier['dish_code'] == 0 && $modifier['unit_id'] == 0) {
$modOut[] = array('id' => $modifier['code'], 'name' => $modifier['name'], 'price' => '*');
}
}
}
$output[] = array('id' => $item->id,
$output[] = array('id' => $item['id'],
'num' => $key + 1,
'order_id' => $item->order_id,
'item_id' => $item->item_id,
'order_id' => $item['order_id'],
'item_id' => $item['item_id'],
'item_name' => $itemName,
'item_count' => $item->item_count,
'item_price' => $item->item_price,
'item_count' => round($item['item_count'], 3),
'item_price' => round($item['item_price'], 2),
'is_real' => $is_real,
);
}
} else {
@@ -62,27 +63,41 @@ class GETOrder extends HRCCommand implements HRCCommandInterface {
return [
'status' => 'success',
'message' => 'Заказ №' . $order->id,
'message' => 'Заказ №' . $order['id'],
'order' => $order,
'orderItems' => $output,
'client_name' => $client,
'client_phone' => $client_phone,
'client_address' => $client_address,
'totalCount' => $order->total_count,
'totalPrice' => $order->total_price,
'totalCount' => $order['total_count'],
'totalPrice' => round($order['total_price'], 2),
];
}
if ($input['task'] == 'list') {
$orders = Orders::all();
foreach ($orders as $key => $order) {
$client = Client::where('user_code', '=', $order->client_id)->first();
$client_phone = ClientsPhone::where('client_guid', '=', $order->client_id)->first();
$client_address = ClientsAddress::where('client_guid', '=', $order->client_id)->first();
$client = Client::where('user_code', $order['client_id'])->first();
$client_phone = ClientsPhone::where('client_guid', $order['client_id'])->first();
$client_address = ClientsAddress::where('client_guid', $order['client_id'])->first();
if (isset($client)) {
$output[] = array('id' => $order->id, 'client_name' => $client->name, 'client_phone' => $client_phone->phone, 'client_address' => $client_address->address, 'total_count' => $order->total_count, 'total_price' => $order->total_price, 'is_send' => $order->is_send);
$output[] = array('id' => $order['id'],
'client_name' => $client['name'],
'client_phone' => $client_phone['phone'],
'client_address' => $client_address['address'],
'total_count' => $order['total_count'],
'total_price' => $order['total_price'],
'is_send' => $order['is_send']
);
} else {
$output[] = array('id' => $order->id, 'client_name' => '', 'client_phone' => '', 'client_address' => '', 'total_count' => $order->total_count, 'total_price' => $order->total_price, 'is_send' => $order->is_send);
$output[] = array('id' => $order['id'],
'client_name' => '',
'client_phone' => '',
'client_address' => '',
'total_count' => $order['total_count'],
'total_price' => $order['total_price'],
'is_send' => $order['is_send']
);
}
}
return [
@@ -98,12 +113,16 @@ class GETOrder extends HRCCommand implements HRCCommandInterface {
$clients = ClientsPhone::where('phone', '=', $phone)->get();
if (isset($clients)) {
foreach ($clients as $key => $client) {
$client_name = Client::where('user_code', '=', $client->client_guid)->first();
$client_name = $client_name->name;
$client_address = ClientsAddress::where('client_guid', '=', $client->client_guid)->first();
$client_phone = $client->phone;
$client_guid = $client->client_guid;
$output[] = array('guid' => $client_guid, 'name' => $client_name, 'phone' => $client_phone, 'address' => $client_address->address);
$client_name = Client::where('user_code', $client['client_guid'])->first();
$client_name = $client_name['name'];
$client_address = ClientsAddress::where('client_guid', $client['client_guid'])->first();
$client_phone = $client['phone'];
$client_guid = $client['client_guid'];
$output[] = array('guid' => $client_guid,
'name' => $client_name,
'phone' => $client_phone,
'address' => $client_address['address']
);
}
}

View File

@@ -78,35 +78,6 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
return true;
}
function dishName($data) {
$dish_name = Dishes::where('code', $data)->where('is_history', 0)->first();
if ($dish_name) {
$dish_name = $dish_name['name'];
} else {
$dish_name = Dishes::where('code', $data)->where('is_history', 1)->first();
if ($dish_name) {
$dish_name = $dish_name['name'];
} else {
$dish_name = 'Связанный товар удален';
}
}
return $dish_name;
}
function staffName($data) {
$staff_name = Staff::where('code', $data)->where('is_history', 0)->first();
if ($staff_name) {
$staff_name = $staff_name['name'];
} else {
$staff_name = Staff::where('code', $data)->where('is_history', 1)->first();
if ($staff_name) {
$staff_name = $staff_name['name'];
} else {
$staff_name = 'Связанный персонал не найден';
}
}
return $staff_name;
}
function data_decode($data) {
$alph = [
@@ -166,7 +137,7 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
foreach ($order as $key => $item) {
$action_type = ActionTypes::where('type_id', $item['type_action'])->first();
$action_name = $action_type['name'];
$staff_name = staffName($item['who']);
$staff_name = Staff::getName($item['who']);
if ($item['type_action'] == 1) {
$action_name = 'Заказ создан';
@@ -181,7 +152,7 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
} else {
$unit_name = 'шт';
}
$dish = dishName($item['more']);
$dish = Dishes::getName($item['more']);
$action_name = $action_name . ': ' . $dish . ' в количестве ' . $item['value'] . ' ' . $unit_name;
}
@@ -195,7 +166,7 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
$unit_name = 'шт';
}
$dish = dishName($shiftOnlineDeletedItem['dishes_code']);
$dish = Dishes::getName($shiftOnlineDeletedItem['dishes_code']);
$action_name = $action_name . ': ' . $dish . ' в количестве ' . $item['value'] . ' ' . $unit_name;
}
@@ -220,7 +191,7 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
}
if ($item['type_action'] == 22) {
$dish = dishName($item['order_position']);
$dish = Dishes::getName($item['order_position']);
$action_name = 'Отменена позиции: ' . $dish . ' в количестве ' . $item['value'];
}
@@ -263,13 +234,12 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
} else {
$slice_order_items = json_decode(utf8_encode(base64_decode($item['more'], TRUE)), true, JSON_INVALID_UTF8_SUBSTITUTE);
}
//$slice_order_items = json_decode(utf8_encode($item['more']), true, JSON_INVALID_UTF8_SUBSTITUTE);
$slice_order_items = $slice_order_items['items'];
$slice_order = $item['value'];
foreach ($slice_order_items as $key => $slice_order_item) {
$slice_items[] = array('id' => $key + 1, 'name' => $slice_order_item['name'], 'count' => $slice_order_item['count']);
}
$staff_name = staffName($item['who']);
$staff_name = Staff::getName($item['who']);
$sliced_order_items[] = array('order' => $slice_order, 'time' => date('d.m.Y H:i:s', strtotime($item['time'])), 'staff' => $staff_name, 'items' => $slice_items);
$slice_trigger = 1;
}
@@ -282,16 +252,18 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
->where('type_action', 32)
->get();
foreach ($item_actions as $key => $item_action) {
if ($item_action['more']) {
if ($item_action['more'] != '') {
$merge_items_before = $merge_items_after = $merge_items = $merge_order_item_before = $merge_order_item_after = $merged_items = [];
if (json_validate($item['more'])) {
if (json_validate($item_action['more'])) {
$merge_order_items = json_decode(utf8_encode($item_action['more']), true, JSON_INVALID_UTF8_SUBSTITUTE);
} else {
$merge_order_items = json_decode(utf8_encode(base64_decode($item_action['more'])), true, JSON_INVALID_UTF8_SUBSTITUTE);
$merge_order_items = json_decode(base64_decode($item_action['more']), true);
}
//$merge_order_items = json_decode(utf8_encode($item_action['more']), true, JSON_INVALID_UTF8_SUBSTITUTE);
$merge_order_items_before = $merge_order_items['before']['items'];
$merge_order_items_after = $merge_order_items['after']['items'];
foreach ($merge_order_items_before as $key => $merge_order_item_before) {
$merge_items_before[] = array('id' => $key + 1,
'code' => $merge_order_item_before['id'],
@@ -320,7 +292,7 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
'name' => $merged_item['name'],
'count' => $merged_item['count']);
}
$staff_name = staffName($item['who']);
$staff_name = Staff::getName($item['who']);
$merged_order_items[] = array('order' => $merge_order, 'time' => date('d.m.Y H:i:s', strtotime($item['time'])), 'staff' => $staff_name, 'items' => $merge_items);
$merge_trigger = 1;
}
@@ -332,7 +304,7 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
->where('type_action', 39)
->get();
foreach ($order_data as $key => $data) {
$staff_name = staffName($data['who']);
$staff_name = Staff::getName($data['who']);
$moved_order_data[] = array('staff_name' => $staff_name, 'time' => date('d.m.Y H:i:s', strtotime($data['time'])), 'data' => data_decode($data['value']));
$move_trigger = 1;
}

51
commands/GETRoomMap.php Normal file
View File

@@ -0,0 +1,51 @@
<?php
namespace App\Commands;
use App\Component\Models\Places;
use App\Component\Models\Tables;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class GETRoomMap extends HRCCommand implements HRCCommandInterface {
protected $signature = 'getroommap';
public function command($input, $output = null) {
if (isset($input['type'])) {
$roommap = [];
if ($input['type'] == 'places') {
$places = Places::all();
return [
'status' => 'success',
'places' => $places,
];
}
if ($input['type'] == 'place' && isset($input['id'])) {
$place_name = Places::getName($input['id']);
$tables = Tables::where('place_id', $input['id'])->get();
return [
'status' => 'success',
'place_id' => $input['id'],
'place' => $place_name,
'tables' => $tables,
];
}
if ($input['type'] == 'full') {
$places = Places::all();
foreach ($places as $place) {
$tables = Tables::where('place_id', $place['id'])->get();
$roommap[] = array('place_id' => $place['id'], 'place_name' => $place['name'], 'tables' => $tables);
}
return [
'status' => 'success',
'roommap' => $roommap,
];
}
} else {
return [
'status' => 'success',
'message' => 'Ошибка данных запроса',
];
}
}
}

101
commands/GETRoomMapFile.php Normal file
View File

@@ -0,0 +1,101 @@
<?php
namespace App\Commands;
use App\Component\Models\Places;
use App\Component\Models\Tables;
use App\Component\Models\Terminal;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
class GETRoomMapFile extends HRCCommand implements HRCCommandInterface {
protected $signature = 'getroommapfile';
public function command($input, $output = null) {
$terminal = Terminal::where('soft', '=', 1)->where('is_active', '=', 1)->first();
$files = [];
$dirname = __DIR__ . "\\..\\..\\..\\Exchange\\" . $terminal['key'] . "\\places\\";
Http::post('https://portal.hrc.by/api/cloud/folder', [
'code' => $terminal['key'],
'folder' => 'places',
'project_code' => 'hrc',
'api' => '2.0',
]);
$response_files = Http::get('https://portal.hrc.by/api/cloud/list?api=2.0&project_code=hrc&code=' . $terminal['key'] . '&folder=places');
if (count($response_files->json()['files']) > 0) {
foreach ($response_files->json()['files'] as $response) {
$filename = $response['filename'];
$basename = $response['basename'];
$files[$response['timestamp']] = array('filename' => $filename, 'basename' => $basename);
}
if (count($files) == 0) {
return ['status' => 'success',
'message' => 'Файлы не найдены'
];
}
$iMaxArrayIndex = max(array_keys($files));
$basename = $files[$iMaxArrayIndex]['basename'];
$download_files = Http::get('https://portal.hrc.by/api/cloud/download?api=2.0&project_code=hrc&code=' . $terminal['key'] . '&path=/places/' . $basename);
$file = base64_decode($download_files->json()['content']);
if (!is_dir($dirname)) {
mkdir($dirname, 0755, 'w+');
}
if (file_exists($dirname . $basename)) {
unlink($dirname . $basename);
}
$handle = fopen($dirname . $basename, 'w+');
fputs($handle, chr(0xEF) . chr(0xBB) . chr(0xBF)); // BOM
file_put_contents($dirname . $basename, $file);
fclose($handle);
foreach ($files as $file) {
Http::delete('https://portal.hrc.by/api/cloud/file', [
'code' => $terminal['key'],
'name' => $file['basename'],
'folder' => 'places',
'project_code' => 'hrc',
'api' => '2.0',
]);
}
$places_file = $dirname . $basename;
} else {
return ['status' => 'success',
'message' => 'Файлы не найдены'
];
}
$objXmlDocument = simplexml_load_file($places_file);
$objJsonDocument = json_encode($objXmlDocument);
$xmlPlaces = json_decode($objJsonDocument, TRUE);
Schema::disableForeignKeyConstraints();
DB::table('place_tables')->truncate();
DB::table('places')->truncate();
Schema::enableForeignKeyConstraints();
foreach ($xmlPlaces['Place'] as $xmlPlace) {
$place_name = $xmlPlace['@attributes']['name'];
$newPlace = new Places;
$newPlace->name = $place_name;
$newPlace->save();
foreach ($xmlPlace['Table'] as $table) {
$newTable = new Tables;
$newTable->name = $table['@attributes']['text'];
$newTable->table_id = intval($table['@attributes']['number']);
$newTable->place_id = $newPlace['id'];
$newTable->width = $table['@attributes']['width'];
$newTable->height = $table['@attributes']['height'];
$newTable->x = $table['@attributes']['y'];
$newTable->y = $table['@attributes']['x'];
$newTable->save();
}
}
return [
'status' => 'success',
'places' => $xmlPlaces
];
}
}

View File

@@ -65,10 +65,10 @@ class POSTOrderItem extends HRCCommand implements HRCCommandInterface {
$totalCount = 0;
$totalPrice = 0;
foreach ($orderItems as $key => $item) {
$totalCount = $totalCount + $item->item_count;
//$totalCount = $totalCount + $item->item_count;
$totalPrice = $totalPrice + $item->item_count * $item->item_price;
}
$order->total_count = $totalCount;
$order->total_count = count($orderItems);
$order->total_price = $totalPrice;
$order->save();
return [

221
commands/POSTRoomMap.php Normal file
View File

@@ -0,0 +1,221 @@
<?php
namespace App\Commands;
use App\Component\Models\Places;
use App\Component\Models\Tables;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
use Illuminate\Support\Facades\DB;
class POSTRoomMap extends HRCCommand implements HRCCommandInterface
{
protected $signature = 'postroommap';
public function command($input, $output = null)
{
if (isset($input['type']) && $input['type'] == 'place') {
if ($input['action'] == 'create' && isset($input['name'])) {
$max_id = Places::max('id');
$place = new Places;
$place->id = $max_id + 1;
$place->name = urldecode($input['name']);
$place->save();
return [
'status' => 'success',
'message' => 'Зал успешно добавлен',
'place' => $place
];
}
if ($input['action'] == 'update' && isset($input['id']) && isset($input['name'])) {
$place = Places::find($input['id']);
$place->name = urldecode($input['name']);
$place->save();
return [
'status' => 'success',
'message' => 'Зал успешно обновлен',
'place' => $place
];
}
if ($input['action'] == 'delete' && isset($input['id'])) {
$place = Places::find($input['id']);
$place->delete();
return [
'status' => 'success',
'message' => 'Зал успешно удален'
];
}
if ($input['action'] == 'saveplaces' && isset($input['places'])) {
DB::statement("SET foreign_key_checks=0");
Tables::truncate();
Places::truncate();
DB::statement("SET foreign_key_checks=1");
$input['places'] = json_decode(urldecode($input['places']), TRUE);
foreach ($input['places'] as $place_items) {
$place_name = urldecode($place_items['place_name']);
$newPlace = new Places;
$newPlace->name = $place_name;
$newPlace->save();
foreach ($place_items['tables'] as $table_item) {
$table_id = $table_item['table_id'];
$table_place_id = $place_items['place_id'];
$table_name = urldecode($table_item['name']);
$table_width = $table_item['width'];
$table_height = $table_item['height'];
$table_x = $table_item['x'];
$table_y = $table_item['y'];
$newTable = new Tables;
$newTable->name = $table_name;
$newTable->table_id = $table_id;
$newTable->place_id = $table_place_id;
$newTable->width = $table_width;
$newTable->height = $table_height;
$newTable->x = $table_x;
$newTable->y = $table_y;
$newTable->save();
}
}
$places = Places::all();
foreach ($places as $place) {
$tables = Tables::where('place_id', $place['id'])->get();
$roommap[] = array('place_id' => $place['id'], 'place_name' => $place['name'], 'tables' => $tables);
}
return [
'status' => 'success',
'message' => 'Карта успешно обновлена',
'roommap' => $roommap,
];
}
return [
'status' => 'success',
'error_message' => 'Проверьте введенные данные',
];
}
if (isset($input['type']) && $input['type'] == 'table') {
if ($input['action'] == 'create' &&
isset($input['place_id']) &&
isset($input['table_id']) &&
isset($input['name']) &&
isset($input['width']) &&
isset($input['height']) &&
isset($input['x']) &&
isset($input['y'])) {
$table = Tables::where('place_id', $input['place_id'])->where('table_id', $input['table_id'])->where('name', $input['name'])->first();
if (isset($table)) {
return [
'status' => 'success',
'error_message' => 'Стол уже существует',
];
}
$table_id = $input['table_id'];
$table_place_id = $input['place_id'];
$table_name = urldecode($input['name']);
$table_width = $input['width'];
$table_height = $input['height'];
$table_x = $input['x'];
$table_y = $input['y'];
$newTable = new Tables;
$newTable->name = $table_name;
$newTable->table_id = $table_id;
$newTable->place_id = $table_place_id;
$newTable->width = $table_width;
$newTable->height = $table_height;
$newTable->x = $table_x;
$newTable->y = $table_y;
$newTable->save();
return [
'status' => 'success',
'message' => 'Стол успешно добавлен',
'table' => $newTable
];
}
if ($input['action'] == 'update' &&
isset($input['place_id']) &&
isset($input['table_id']) &&
isset($input['name']) &&
isset($input['width']) &&
isset($input['height']) &&
isset($input['x']) &&
isset($input['y'])) {
$table = Tables::where('place_id', $input['place_id'])->where('table_id', $input['table_id'])->first();
$table_id = $input['table_id'];
$table_place_id = $input['place_id'];
$table_name = urldecode($input['name']);
$table_width = $input['width'];
$table_height = $input['height'];
$table_x = $input['x'];
$table_y = $input['y'];
$table = Tables::find($table['id']);
$table->name = $table_name;
$table->table_id = $table_id;
$table->place_id = $table_place_id;
$table->width = $table_width;
$table->height = $table_height;
$table->x = $table_x;
$table->y = $table_y;
$table->save();
return [
'status' => 'success',
'message' => 'Стол успешно обновлен',
'table' => $table
];
}
if ($input['action'] == 'delete' &&
isset($input['place_id']) &&
isset($input['table_id'])) {
$table = Tables::where('place_id', $input['place_id'])->where('table_id', $input['table_id'])->first();
$table = Tables::find($table['id']);
$table->delete();
}
if ($input['action'] == 'savetables' && isset($input['tables']) && isset($input['place_id'])) {
$input['tables'] = json_decode(urldecode($input['tables']), TRUE);
$tables = Tables::where('place_id', intval($input['place_id']))->get();
foreach ($tables as $table) {
$del_table = Tables::find($table['id']);
$del_table->delete();
}
foreach ($input['tables'] as $item) {
$table_id = $item['table_id'];
$table_place_id = $item['place_id'];
$table_name = urldecode($item['name']);
$table_width = $item['width'];
$table_height = $item['height'];
$table_x = $item['x'];
$table_y = $item['y'];
$newTable = new Tables;
$newTable->name = $table_name;
$newTable->table_id = $table_id;
$newTable->place_id = $table_place_id;
$newTable->width = $table_width;
$newTable->height = $table_height;
$newTable->x = $table_x;
$newTable->y = $table_y;
$newTable->save();
}
return [
'status' => 'success',
'message' => 'Зал успешно обновлен'
];
}
}
return [
'status' => 'success',
'error_message' => 'Проверьте введенные данные',
];
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "hrc-admin/hello-world",
"version": "2.21",
"version": "2.22",
"require": {
"horeca/admin-php-module-core": "dev-master",
"guzzlehttp/guzzle": "^7.4"

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddColumnsToOrderItem extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up() {
if (!Schema::hasColumn('order_items', 'is_deleted')) {
Schema::table('order_items', function (Blueprint $table) {
$table->tinyInteger('is_deleted')->nullable()->default(0);
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down() {
Schema::table('order_items', function (Blueprint $table) {
$table->dropColumn('is_deleted');
});
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateItemCountAndItemPriceInOrderItemsToFloat extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up() {
if (!Schema::hasColumn('order_items', 'item_price')) {
Schema::table('order_items', function (Blueprint $table) {
$table->decimal('item_price', $precision = 16, $scale = 3)->nullable();
});
}
if (!Schema::hasColumn('order_items', 'item_count')) {
Schema::table('order_items', function (Blueprint $table) {
$table->decimal('item_count', $precision = 16, $scale = 2)->nullable();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down() {
Schema::table('order_items', function (Blueprint $table) {
$table->integer('item_price')->nullable()->change();
});
Schema::table('order_items', function (Blueprint $table) {
$table->integer('item_count')->nullable()->change();
});
}
}

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateTotalPriceInOrdersToFloat extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up() {
if (!Schema::hasColumn('orders', 'total_price')) {
Schema::table('orders', function (Blueprint $table) {
$table->decimal('total_price', $precision = 16, $scale = 2)->nullable();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down() {
Schema::table('orders', function (Blueprint $table) {
$table->integer('total_price')->nullable()->change();
});
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePlacesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasTable('places')) {
Schema::create('places', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->integer('place_id');
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('places');
}
}

View File

@@ -0,0 +1,67 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePlaceTablesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasTable('place_tables')) {
Schema::create('place_tables', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('place_id')->unsigned();
$table->foreign('place_id')->references('id')->on('places')->onDelete('cascade');
$table->string('name');
$table->timestamps();
});
}
if (!Schema::hasColumn('place_tables', 'table_id')) {
Schema::table('place_tables', function (Blueprint $table) {
$table->integer('table_id')->nullable();
});
}
if (!Schema::hasColumn('place_tables', 'width')) {
Schema::table('place_tables', function (Blueprint $table) {
$table->decimal('width', $precision = 10, $scale = 6)->nullable();
});
}
if (!Schema::hasColumn('place_tables', 'height')) {
Schema::table('place_tables', function (Blueprint $table) {
$table->decimal('height', $precision = 10, $scale = 6)->nullable();
});
}
if (!Schema::hasColumn('place_tables', 'x')) {
Schema::table('place_tables', function (Blueprint $table) {
$table->decimal('x', $precision = 10, $scale = 6)->nullable();
});
}
if (!Schema::hasColumn('place_tables', 'y')) {
Schema::table('place_tables', function (Blueprint $table) {
$table->decimal('y', $precision = 10, $scale = 6)->nullable();
});
}
if (!Schema::hasColumn('place_tables', 'type')) {
Schema::table('place_tables', function (Blueprint $table) {
$table->integer('type')->nullable();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('place_tables');
}
}

View File

@@ -0,0 +1,64 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateCoreInterface extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
function deleteFolder($dir) {
$d = opendir($dir);
while (($entry = readdir($d)) !== false) {
if ($entry != "." && $entry != "..") {
if (is_dir($dir . "/" . $entry)) {
deleteFolder($dir . "/" . $entry);
} else {
unlink($dir . "/" . $entry);
}
}
}
closedir($d);
rmdir($dir);
}
$directivesUpd = CORE_PATH . '/../V1/forUpdate/toDirectives/';
$indexUpd = CORE_PATH . '/../V1/forUpdate/toWebApp/';
if (is_dir($directivesUpd)) {
$files = array_diff(scandir($directivesUpd), array('.', '..'));
foreach ($files as $file) {
if (file_exists(CORE_PATH . '/../../web/app/scripts/directives/' . $file)) {
copy(CORE_PATH . '/../../web/app/scripts/directives/' . $file, CORE_PATH . '/../../web/app/scripts/directives/' . $file . '.bak');
}
copy($directivesUpd . $file, CORE_PATH . '/../../web/app/scripts/directives/' . $file);
}
}
if (is_dir($indexUpd)) {
$files = array_diff(scandir($indexUpd), array('.', '..'));
foreach ($files as $file) {
if (file_exists(CORE_PATH . '/../../web/app/' . $file)) {
copy(CORE_PATH . '/../../web/app/' . $file, CORE_PATH . '/../../web/app/' . $file . '.bak');
}
copy($indexUpd . $file, CORE_PATH . '/../../web/app/' . $file);
}
}
if (file_exists(CORE_PATH . '/../V1/forUpdate/')) {
deleteFolder(CORE_PATH . '/../V1/forUpdate/');
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Database\Component\Seeders;
use App\Component\Models\Right;
use Illuminate\Database\Seeder;
class AddStaffRights extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
if (Right::where('code', 'clean')->count() == 0) {
Right::add('clean', 'Обрезка базы');
}
if (Right::where('code', 'marketplace')->count() == 0) {
Right::add('marketplace', 'Маркетплейс');
}
if (Right::where('code', 'update')->count() == 0) {
Right::add('update', 'Обновления');
}
if (Right::where('code', 'roommap')->count() == 0) {
Right::add('roommap', 'Карта залов');
}
if (Right::where('code', 'eorders')->count() == 0) {
Right::add('eorders', 'Онлайн заказы');
}
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Database\Component\Seeders;
use App\Component\Models\StaffRights;
use Illuminate\Database\Seeder;
class AddUserRights extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
if (StaffRights::where('code', 'RIGHT_57')->count() == 0) {
StaffRights::add('RIGHT_57', 'Доставка');
}
if (StaffRights::where('code', 'RIGHT_58')->count() == 0) {
StaffRights::add('RIGHT_58', 'Электронный чек');
}
if (StaffRights::where('code', 'RIGHT_59')->count() == 0) {
StaffRights::add('RIGHT_59', 'Отображение заказов в журнале');
}
if (StaffRights::where('code', 'RIGHT_60')->count() == 0) {
StaffRights::add('RIGHT_60', 'Отображение отчетов смены');
}
if (StaffRights::where('code', 'RIGHT_61')->count() == 0) {
StaffRights::add('RIGHT_61', 'Печать копии чека из журнала заказов');
}
}
}

View File

@@ -0,0 +1,187 @@
(function () {
'use strict';
angular.module('angular.drag.resize', [])
.provider('adrConfig', function adrConfigProvider() {
//defaults
var defaultConfig = {
iconPosition: [0, 0],
mode: 'all',
modes: ['all', 'horizontal', 'vertical']
};
var config = angular.extend({}, defaultConfig);
this.$get = [function () {
return {
iconPosition: config.iconPosition,
mode: config.mode,
modes: config.modes
};
}];
})
.directive('resize', ['adrConfig', '$document', function (adrConfig, $document) {
return {
restrict: 'A',
link: function (scope, element, attr) {
var dimension = {};
var iconPosition = adrConfig.iconPosition;
var mode = attr.resize && adrConfig.modes.indexOf(attr.resize) > -1 ? attr.resize : adrConfig.mode;
var position = {};
var doc = {};
var el = {};
//create button for resizing
var btn = document.createElement("span");
btn.style.width = '15px';
btn.style.height = '15px';
btn.innerHTML =
"<i class='fa fa-expand fa-rotate-90'></i>"
;
btn.style.bottom = iconPosition[0] + 6 + 'px';
btn.style.right = iconPosition[1] + 5 + 'px';
btn.style.position = 'absolute';
btn.style.visibility = 'hidden';
if (mode == 'horizontal') {
btn.style.cursor = 'ew-resize';
} else if (mode == 'vertical') {
btn.style.cursor = 'ns-resize';
} else {
btn.style.cursor = 'nwse-resize';
}
//bind resize function to button;
btn.onmousedown = function ($event) {
switch ($event.which) {
case 1:
$event.stopImmediatePropagation();
doc.left = element[0].parentNode.parentNode.getBoundingClientRect().left;
doc.top = element[0].parentNode.parentNode.getBoundingClientRect().top;
doc.bottom = element[0].parentNode.parentNode.getBoundingClientRect().bottom;
doc.right = element[0].parentNode.parentNode.getBoundingClientRect().right;
el.width = element[0].getBoundingClientRect().width;
el.height = element[0].getBoundingClientRect().height;
console.log('doc.left: ' + doc.left);
console.log('doc.top: ' + doc.top);
console.log('doc.bottom: ' + doc.bottom);
console.log('doc.right: ' + doc.right);
position.x = $event.clientX;
position.y = $event.clientY;
dimension.width = element.prop('offsetWidth');
dimension.height = element.prop('offsetHeight');
console.log('dimension.width: ' + dimension.width);
console.log('dimension.height: ' + dimension.height);
$document.bind('mousemove', mousemove);
$document.bind('mouseup', mouseup);
return false;
break;
}
};
function mousemove($event) {
switch ($event.which) {
case 1:
if ($event.clientX < doc.right && $event.clientY < doc.bottom) {
var deltaWidth = dimension.width - (position.x - $event.clientX);
var deltaHeight = dimension.height - (position.y - $event.clientY);
} else {
var deltaWidth = el.width;
var deltaHeight = el.height;
}
/* console.log('deltaWidth: ' + deltaWidth);
console.log('deltaHeight: ' + deltaHeight);
console.log('position.x: ' + position.x);
console.log('position.y: ' + position.y);*/
var newDimensions = {};
if (mode == 'horizontal') {
newDimensions = {
width: deltaWidth + 'px'
};
} else if (mode == 'vertical') {
newDimensions = {
height: deltaHeight + 'px'
};
} else {
newDimensions = {
width: deltaWidth + 'px',
height: deltaHeight + 'px'
};
}
element.css(newDimensions);
return false;
break;
}
}
function mouseup() {
$document.unbind('mousemove', mousemove);
$document.unbind('mouseup', mouseup);
}
element.append(btn);
//show button on hover
element.bind('mouseover', function () {
btn.style.visibility = 'visible';
});
element.bind('mouseout', function () {
btn.style.visibility = 'hidden';
});
}
};
}])
.directive('draggable', ['$document', function ($document) {
return {
restrict: 'A',
link: function (scope, element) {
var position = {};
var doc = {};
element.bind('mousedown', function ($event) {
switch ($event.which) {
case 1:
element.css({position: 'fixed'});
doc.left = element[0].parentNode.parentNode.getBoundingClientRect().left;
doc.top = element[0].parentNode.parentNode.getBoundingClientRect().top;
doc.bottom = element[0].parentNode.parentNode.getBoundingClientRect().bottom;
doc.right = element[0].parentNode.parentNode.getBoundingClientRect().right;
position.x = element[0].getBoundingClientRect().left;
position.y = element[0].getBoundingClientRect().top;
position.initialMouseX = $event.clientX;
position.initialMouseY = $event.clientY;
$document.bind('mousemove', mousemove);
$document.bind('mouseup', mouseup);
return false;
break;
}
});
function mousemove($event) {
switch ($event.which) {
case 1:
var dx = $event.clientX - position.initialMouseX;
var dy = $event.clientY - position.initialMouseY;
var posdy = position.y + dy;
var posdx = position.x + dx;
if (posdy > doc.top && posdx > doc.left && (posdx + element[0].getBoundingClientRect().width) < doc.right && (posdy + element[0].getBoundingClientRect().height) < doc.bottom) {
element.css({
top: posdy + 'px',
left: posdx + 'px'
});
} else {
element.css({
top: position.y + 'px',
left: position.x + 'px'
});
}
return false;
break;
}
}
function mouseup() {
$document.unbind('mousemove', mousemove);
$document.unbind('mouseup', mouseup);
}
}
};
}]);
})();

View File

@@ -0,0 +1,144 @@
/**
* ng-context-menu - v1.1.0 - An AngularJS directive to display a context menu
* when a right-click event is triggered
*
* @author Ian Kennington Walter (http://ianvonwalter.com)
*/
(function(angular) {
'use strict';
angular
.module('ng-context-menu', [])
.factory('ContextMenuService', function() {
return {
element: null,
menuElement: null
};
})
.directive('contextMenu', [
'$document',
'ContextMenuService',
function($document, ContextMenuService) {
return {
restrict: 'A',
scope: {
'callback': '&contextMenu',
'disabled': '&contextMenuDisabled',
'closeCallback': '&contextMenuClose',
'marginBottom': '@contextMenuMarginBottom',
'marginLeft': '@contextMenuMarginLeft'
},
link: function($scope, $element, $attrs) {
var opened = false;
function open(event, menuElement) {
menuElement.addClass('open');
var doc = $document[0].documentElement;
var docLeft = (window.pageXOffset || doc.scrollLeft) -
(doc.clientLeft || 0),
docTop = (window.pageYOffset || doc.scrollTop) -
(doc.clientTop || 0),
elementWidth = menuElement[0].scrollWidth,
elementHeight = menuElement[0].scrollHeight;
var pageX;
var pageY;
// browser compatibility fix for the click location
if (event.pageX || event.pageY) {
// use pageX and pageY when available (modern browsers)
pageX = event.pageX;
pageY = event.pageY;
} else {
// calculate pageX and pageY when they do not exist
// (IE8 and generated events in later versions of IE)
var docBody = $document[0].body;
pageX = event.clientX + docBody.scrollLeft + doc.scrollLeft;
pageY = event.clientY + docBody.scrollTop + doc.scrollTop;
}
var docWidth = doc.clientWidth + docLeft,
docHeight = doc.clientHeight + docTop,
totalWidth = elementWidth + pageX,
totalHeight = elementHeight + pageY,
left = Math.max(pageX - docLeft, 0),
top = Math.max(pageY - docTop, 0);
if (totalWidth > docWidth) {
var marginLeft = $scope.marginLeft || 0;
left = left - (totalWidth - docWidth) - marginLeft;
}
if (totalHeight > docHeight) {
var marginBottom = $scope.marginBottom || 0;
top = top - (totalHeight - docHeight) - marginBottom;
}
menuElement.css('top', top + 'px');
menuElement.css('left', left + 'px');
opened = true;
}
function close(menuElement) {
menuElement.removeClass('open');
if (opened) {
$scope.closeCallback();
}
opened = false;
}
$element.bind('contextmenu', function(event) {
if (!$scope.disabled()) {
if (ContextMenuService.menuElement !== null) {
close(ContextMenuService.menuElement);
}
ContextMenuService.menuElement = angular.element(
document.getElementById($attrs.target)
);
ContextMenuService.element = event.target;
event.preventDefault();
event.stopPropagation();
$scope.$apply(function() {
$scope.callback({ $event: event });
});
$scope.$apply(function() {
open(event, ContextMenuService.menuElement);
});
}
});
function handleKeyUpEvent(event) {
if (opened && event.keyCode === 27) {
$scope.$apply(function() {
close(ContextMenuService.menuElement);
});
}
}
function handleClickEvent(event) {
if (opened &&
(event.button !== 2 ||
event.target !== ContextMenuService.element)) {
$scope.$apply(function() {
close(ContextMenuService.menuElement);
});
}
}
$document.bind('keyup', handleKeyUpEvent);
// Firefox treats a right-click as a click and a contextmenu event
// while other browsers just treat it as a contextmenu event
$document.bind('click', handleClickEvent);
$document.bind('contextmenu', handleClickEvent);
$scope.$on('$destroy', function() {
$document.unbind('keyup', handleKeyUpEvent);
$document.unbind('click', handleClickEvent);
$document.unbind('contextmenu', handleClickEvent);
});
}
};
}
]);
})(angular);

View File

@@ -0,0 +1,121 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="ru">
<head>
<meta charset="utf-8" />
<title>Административная панель | HRC</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimal-ui" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-barstyle" content="black-translucent">
<link rel="apple-touch-icon" href="../assets/images/logo.png">
<meta name="apple-mobile-web-app-title" content="HRC Панель">
<meta name="mobile-web-app-capable" content="yes">
<link rel="shortcut icon" sizes="196x196" href="../assets/images/logo.png">
<link rel="stylesheet" href="../assets/animate.css/animate.min.css" type="text/css" />
<link rel="stylesheet" href="../assets/glyphicons/glyphicons.css" type="text/css" />
<link rel="stylesheet" href="../assets/font-awesome/css/font-awesome.min.css" type="text/css" />
<link rel="stylesheet" href="../assets/material-design-icons/material-design-icons.css" type="text/css" />
<link rel="stylesheet" href="../libs/angular/angular-ui-notification/dist/angular-ui-notification.min.css" />
<link rel="stylesheet" href="../assets/bootstrap/dist/css/bootstrap.min.css" type="text/css" />
<!-- build:css ../assets/styles/app.min.css -->
<link rel="stylesheet" href="../assets/styles/app.css" type="text/css" />
<!-- endbuild -->
<link rel="stylesheet" href="../assets/styles/font.css" type="text/css" />
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//analytics.hrc.by/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
</head>
<body ng-app="app" ng-controller="AppCtrl" class="{{app.setting.bg}}" ng-class="{'container': app.setting.boxed, 'ie': isIE,'smart': isSmart}">
<div class="app" ui-view></div>
<!-- build:js scripts/app.angular.js -->
<!-- jQuery -->
<script src="../libs/jquery/jquery/dist/jquery.js"></script>
<!-- Bootstrap -->
<script src="scripts/config.js"></script>
<script type="text/javascript" src="routes.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script src="../libs/jquery/tether/dist/js/tether.min.js"></script>
<script src="../libs/jquery/bootstrap/dist/js/bootstrap.js"></script>
<script src="../libs/jquery/PACE/pace.min.js"></script>
<script src="../libs/jquery/jquery.nicescroll/jquery.nicescroll.min.js"></script>
<!-- Angular -->
<script src="../libs/angular/angular/angular.js"></script>
<script src="../libs/angular/angular-animate/angular-animate.js"></script>
<script src="../libs/angular/angular-resource/angular-resource.js"></script>
<script src="../libs/angular/angular-sanitize/angular-sanitize.js"></script>
<script src="../libs/angular/angular-touch/angular-touch.js"></script>
<script src="../libs/angular/angular-cookies/angular-cookies.js"></script>
<script src="../libs/angular/angular-nicescroll/angular-nicescroll.js"></script>
<script src="scripts/moments.js"></script>
<script src="../libs/angular/chart.js/dist/Chart.js"></script>
<script src="../libs/angular/angular-ui-notification/dist/angular-ui-notification.min.js"></script>
<!-- router -->
<script src="../libs/angular/angular-ui-router/release/angular-ui-router.js"></script>
<script src="../libs/angular/ui-router-extras/release/ct-ui-router-extras.min.js"></script>
<!-- storage -->
<script src="../libs/angular/ngstorage/ngStorage.js"></script>
<!-- utils -->
<script src="../libs/angular/angular-ui-utils/ui-utils.js"></script>
<!-- lazyload -->
<script src="../libs/angular/oclazyload/dist/ocLazyLoad.js"></script>
<!-- App -->
<script src="scripts/app.js"></script>
<script src="scripts/config.lazyload.js"></script>
<script src="scripts/config.router.js"></script>
<script src="scripts/app.ctrl.js"></script>
<script src="scripts/onload.js"></script>
<script src="scripts/directives/ui-jp.js"></script>
<script src="scripts/directives/ui-nav.js"></script>
<script src="scripts/directives/ui-fullscreen.js"></script>
<script src="scripts/directives/ui-scroll-to.js"></script>
<script src="scripts/directives/ui-toggle-class.js"></script>
<script src="scripts/directives/ui-include.js"></script>
<script src="scripts/directives/ui-single-clicks.js"></script>
<script src="scripts/directives/ios-dblclick.js"></script>
<script src="scripts/directives/angular-drag-resize.js"></script>
<script src="scripts/directives/context-menu.js"></script>
<script src="scripts/filters/fromnow.js"></script>
<script src="scripts/services/ngstore.js"></script>
<script src="scripts/services/ui-load.js"></script>
<script src="scripts/services/palette.js"></script>
<script src="scripts/services/smart-request.js"></script>
<script src="scripts/services/acl.js"></script>
<script src="scripts/ui/ui-nav.js"></script>
<!-- endbuild -->
<!-- custom -->
<script src="scripts/ui/number-polyfill.js"></script>
</body>
</html>

View File

@@ -12,4 +12,35 @@ class Dishes extends Model {
* @var array
*/
protected $guarded = [];
public static function getName($data) {
$dish_name = Dishes::where('code', $data)->where('is_history', 0)->first();
if ($dish_name) {
$dish_name = $dish_name['name'];
} else {
$dish_name = Dishes::where('code', $data)->where('is_history', 1)->first();
if ($dish_name) {
$dish_name = $dish_name['name'];
} else {
$dish_name = 'Связанный товар удален';
}
}
return $dish_name;
}
public static function isReal($data) {
$dish_isReal = Dishes::where('code', $data)->where('is_history', 0)->first();
$isReal = 0;
if ($dish_isReal) {
$isReal = intval($dish_isReal['real_count']);
} else {
$dish_isReal = Dishes::where('code', $data)->where('is_history', 1)->first();
if ($dish_isReal) {
$isReal = intval($dish_isReal['real_count']);
} else {
$isReal = 0;
}
}
return $isReal;
}
}

22
models/Places.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
namespace App\Component\Models;
use Illuminate\Database\Eloquent\Model;
class Places extends Model {
protected $table = 'places';
public static function getName($data) {
$places = Places::where('id', $data)->first();
if ($places) {
$place_name = $places['name'];
} else {
$place_name = 'Связанный зал не найден';
}
return $place_name;
}
}

24
models/Reasons.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
namespace App\Component\Models;
use Illuminate\Database\Eloquent\Model;
class Reasons extends Model {
protected $table = 'reasons';
public static function getName($data) {
$reason_name = Reasons::where('code', intval($data))->where('is_history', 0)->first();
if ($reason_name) {
$reason_name = $reason_name['name'];
} else {
$reason_name = Reasons::where('code', intval($data))->where('is_history', 1)->first();
if ($reason_name) {
$reason_name = $reason_name['name'];
} else {
$reason_name = 'Связанная причина удаления не найдена';
}
}
return $reason_name;
}
}

View File

@@ -6,4 +6,19 @@ use Illuminate\Database\Eloquent\Model;
class Staff extends Model {
protected $table = 'staffs';
public static function getName($data) {
$staff_name = Staff::where('code', intval($data))->where('is_history', 0)->first();
if ($staff_name) {
$staff_name = $staff_name['name'];
} else {
$staff_name = Staff::where('code', intval($data))->where('is_history', 1)->first();
if ($staff_name) {
$staff_name = $staff_name['name'];
} else {
$staff_name = 'Связанный персонал не найден';
}
}
return $staff_name;
}
}

19
models/StaffRights.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
namespace App\Component\Models;
use Illuminate\Database\Eloquent\Model;
class StaffRights extends Model {
protected $table = 'staff_rights';
public static function add($code, $name) {
if (StaffRights::where('code', $code)->count() == 0) {
$staffRight = new StaffRights([
'code' => $code,
'name' => $name,
]);
$staffRight->save();
}
}
}

22
models/Tables.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
namespace App\Component\Models;
use Illuminate\Database\Eloquent\Model;
class Tables extends Model
{
protected $table = 'place_tables';
public static function getName($id)
{
$table = Tables::where('id', $id)->first();
if ($table) {
$table_name = $table['name'];
} else {
$table_name = 'Связанный стол не найден';
}
return $table_name;
}
}

View File

@@ -1,5 +1,5 @@
[info]
name=V1
version=2.21
version=2.22
[build]
version=2.21
version=2.22

View File

@@ -200,10 +200,25 @@
$scope.selectedMenuElement = {};
$scope.selectMenuNavigationStack = [];
$scope.enterCount = function(orderId, itemId) {
$('#edit-selectmenuitem').modal('hide');
$scope.enterCount = function(item, orderId, itemId) {
$('#edit-item-count').modal('toggle');
$scope.itemId = itemId;
$scope.itemId = item.id;
$scope.orderId = orderId;
console.log(item);
};
$scope.updateCount = function(item, count) {
item.item_count = parseFloat(count);
smartRequest.post('v1/orderitem', {
task: 'update',
id: $scope.itemId,
order_id: $scope.orderId,
item_count: item.item_count
}, function(data) {
$scope.update();
$scope.getOrder($scope.orderId);
});
};
$scope.getOrder = function(orderId, newOrder) {

View File

@@ -57,7 +57,7 @@
};
$scope.reportDelete = function() {
smartRequest.get('report/deleted?start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function(data) {
smartRequest.get('v1/datareport?type=deleted&start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function(data) {
$scope.report_delete = data.deleted;
$scope.report_delete.total_sum = data.total_sum;
$scope.report_delete.total_count = data.total_count;

235
web/controllers/roommap.js Normal file
View File

@@ -0,0 +1,235 @@
(function () {
'use strict';
angular
.module('app', ['angular.drag.resize', 'ng-context-menu'])
.controller('RoommapCtrl', RoommapCtrl);
RoommapCtrl.$inject = ['$scope', 'smartRequest', 'Notification', '$http'];
function RoommapCtrl($scope, smartRequest, Notification, $http) {
$scope.places = [];
$scope.tables = [];
$scope.newTables = [];
$scope.newTables2 = [];
$scope.roommap = [];
$scope.newElement = 0;
$('#create_table').hide();
$('#create_place').show();
$('#places').show();
$('#background').hide();
$('#save_tables').hide();
$('#save_places').hide();
$('#back').hide();
$scope.getRoomMap = function () {
smartRequest.get('v1/roommap?type=full', function (data) {
$('#back').hide();
$('#save_tables').hide();
$('#save_places').hide();
$scope.roommap = data.roommap;
Notification.success(data.status);
});
};
$scope.getRoomMap();
$scope.alignTables = function () {
$scope.tables.forEach(function (table) {
var newArr = [];
var goal = table.x;
$scope.tables.forEach(function (el) {
var middle = Math.abs(goal - el.x);
if (middle <= 15) {
newArr.push(el);
}
});
let xSum = 0;
const len = newArr.length;
let item = null;
for (let i = 0; i < len; i++) {
item = newArr[i];
xSum = item.x + xSum;
}
const averageX = Math.round(xSum / len);
newArr.forEach(function (el) {
$scope.tables.forEach((elem) => elem.id === el.id ? elem.x = averageX : elem.x = elem.x);
});
});
$scope.tables.forEach(function (table) {
var newArr = [];
var goal = table.y;
$scope.tables.forEach(function (el) {
var middle = Math.abs(goal - el.y);
if (middle <= 15) {
newArr.push(el);
}
});
let ySum = 0;
const len = newArr.length;
let item = null;
for (let i = 0; i < len; i++) {
item = newArr[i];
ySum = item.y + ySum;
}
const averageY = Math.round(ySum / len);
newArr.forEach(function (el) {
$scope.tables.forEach((elem) => elem.id === el.id ? elem.y = averageY : elem.y = elem.y);
});
});
$('#save_tables').show();
$('#back').show();
return $scope.tables;
};
$scope.getTables = function (place_id) {
$('#places').hide();
$('#background').show();
$('#create_table').show();
$('#create_place').hide();
$('#back').show();
$scope.maxWidth = 1024;
$scope.windowHeight = window.innerHeight - (document.getElementById('view').clientHeight - document.getElementById('tables').clientHeight);
$scope.screenHeight = screen.height;
$scope.windowWidth = window.innerWidth;
$scope.screenWidth = 69;
smartRequest.get('v1/roommap?type=place&id=' + place_id, function (data) {
$scope.place = data.place;
$scope.place_id = data.place_id;
Notification.success(data.status);
$scope.left = document.getElementById('tables').getBoundingClientRect().left;
$scope.top = parseInt(document.getElementById('view').clientHeight) - parseInt(document.getElementById('background_1').offsetHeight) - 2;
$scope.percentWidth = document.getElementById('tables').clientWidth / 1024;
$scope.percentHeight = document.getElementById('tables').clientHeight / 768;
$scope.tables = data.tables;
console.log($scope.tables);
});
};
$scope.getCoords = function ($event, $index, table_id, place) {
switch ($event.which) {
case 1:
var id = '#table_' + $index;
$scope.element = $(id);
$scope.parentOffset = $scope.element.offset();
var parentPos = document.getElementById('tables').getBoundingClientRect(),
childrenPos = document.getElementById('table_' + $index).getBoundingClientRect(),
relativePos = {};
relativePos.top = childrenPos.top - parentPos.top,
relativePos.right = childrenPos.right - parentPos.right,
relativePos.bottom = childrenPos.bottom - parentPos.bottom,
relativePos.left = childrenPos.left - parentPos.left;
$('#save_tables').show();
$scope.tables[$index].width = Math.round(document.getElementById('table_' + $index).offsetWidth / $scope.percentWidth),
$scope.tables[$index].height = Math.round(document.getElementById('table_' + $index).offsetHeight / $scope.percentHeight),
$scope.tables[$index].x = Math.round(relativePos.top / $scope.percentHeight),
$scope.tables[$index].y = Math.round(relativePos.left / $scope.percentWidth);
break;
}
};
$scope.deleteTable = function (table_id) {
delete $scope.tables.splice(table_id, 1);
$('#save_tables').show();
return $scope.tables;
};
$scope.duplicateTable = function (index, place) {
$scope.newTable = {};
$scope.lastEl = $scope.tables.length;
$scope.newTable.id = $scope.tables[$scope.lastEl - 1].id + 1,
$scope.newTable.place_id = $scope.tables[index].place_id,
$scope.newTable.table_id = $scope.tables[$scope.lastEl - 1].table_id + 1,
$scope.newTable.name = $scope.tables[index].name,
$scope.newTable.width = $scope.tables[index].width,
$scope.newTable.height = $scope.tables[index].height,
$scope.newTable.x = $scope.tables[index].x + 50,
$scope.newTable.y = $scope.tables[index].y + 50;
$scope.tables.push($scope.newTable);
$('#save_tables').show();
return $scope.tables;
};
$scope.editTable = function ($index, table) {
$('#table-edit').modal('show');
$scope.tableWidth = table.width;
$scope.tableHeight = table.height;
$scope.tableName = table.name;
$scope.tableId = table.table_id;
$scope.tableIndex = $index;
$('#save_tables').show();
return $scope.tables;
};
$scope.saveTable = function (index, id, name, width, height) {
$('#table-edit').modal('toggle');
$scope.tables[index].width = width,
$scope.tables[index].height = height,
$scope.tables[index].name = name,
$scope.tables[index].table_id = id;
$('#save_tables').show();
return $scope.tables;
};
$scope.back = function () {
$('#places').show();
$('#background').hide();
$('#create_table').hide();
$('#create_place').show();
$('#save_tables').hide();
$('#back').hide();
$scope.tables = [];
};
$scope.saveTables = function (place_id, tables) {
console.log(tables);
smartRequest.post('v1/roommap', {
type: 'table',
action: 'savetables',
place_id: place_id,
tables: JSON.stringify(tables),
}, function (data) {
$scope.tables = [];
Notification.success(data.message);
$scope.back();
});
};
$scope.deletePlace = function (index) {
console.log(index);
delete $scope.roommap.splice(index, 1);
$('#save_places').show();
return $scope.roommap;
};
$scope.editPlace = function (index) {
};
$scope.savePlace = function (index) {
};
$scope.savePlaces = function (places) {
console.log(places);
smartRequest.post('v1/roommap', {
type: 'place',
action: 'saveplaces',
places: JSON.stringify(places),
}, function (data) {
Notification.success(data.message);
/*$scope.getRoomMap();*/
});
};
}
})();

View File

@@ -111,7 +111,7 @@
};
$scope.reportDelete = function (shift) {
smartRequest.get('report/deleted?shift_id=' + shift.id, function (data) {
smartRequest.get('v1/datareport?type=deleted&shift_id=' + shift.id, function (data) {
$scope.report_delete = data.deleted;
$scope.report_delete.total_sum = data.total_sum;
$scope.report_delete.total_count = data.total_count;

View File

@@ -7,12 +7,19 @@ item: [
order: 0
},
{
name: 'Eorders',
name: 'Eorders (dev)',
acl: 'eorders',
url: 'app.orders',
icon: 'dashboard',
order: 0
},
{
name: 'RoomMap (dev)',
acl: 'roommap',
url: 'app.roommap',
icon: 'dashboard',
order: 0
},
{
name: 'Гости',
acl: 'clients',

View File

@@ -22,6 +22,14 @@
controller: 'OrdersCtrl',
resolve: ['scripts/controllers/orders.js']
},
{
code: 'app.roommap',
url: '/v1/roommap',
templateUrl: '../views/roommap/index.html',
data: { title : 'RoomMap' },
controller: 'RoommapCtrl',
resolve: ['scripts/controllers/roommap.js']
},
{
code: 'app.clients',
url: '/clients',

View File

@@ -7,16 +7,16 @@
<form role="form" class="ng-pristine ng-valid container">
<div class="form-group row">
<div class="col-sm-6">
<input placeholder="Имя" ng-model="client_name" class="form-control"></input>
<input placeholder="Имя" ng-model="client_name" class="form-control">
<p>
</div>
<div class="col-sm-6">
<input ng-model="inputSearch" class="form-control" ui-mask="+375 (99) 999-99-99"></input>
<input ng-model="inputSearch" class="form-control" ui-mask="+375 (99) 999-99-99">
<p>
</div>
<br>
<div class="col-sm-12">
<input placeholder="Адрес" ng-model="client_address" class="form-control"></input>
<input placeholder="Адрес" ng-model="client_address" class="form-control">
<p>
</div>
</div>

View File

@@ -56,7 +56,7 @@
<thead>
<tr>
<th>Наимен.</th>
<th style="width: 120px; text-align: center">Количество</th>
<th style="width: 125px; text-align: center">Количество</th>
<th style="width: 80px; text-align: center">Итог</th>
<th style="width: 20px; text-align: center">#</th>
</tr>
@@ -71,12 +71,15 @@
<td>
<div class="btn-group" role="group">
<button type="button" class="btn btn-secondary btn-sm" ng-click="inOrderDecrement(item, item.item_count)" ng-disabled="item.item_count<=1">-</button>
<button type="button" class="btn btn-secondary btn-sm" ng-model="item.item_count" disabled>{{item.item_count}}</button>
<button type="button" class="btn btn-secondary btn-sm" ng-click="inOrderIncrement(item, item.item_count)">+</button>
<button type="button" class="btn btn-secondary btn-sm" ng-click="inOrderDecrement(item, item.item_count)" ng-disabled="item.item_count<=1" ng-if="item.is_real == 0">-</button>
<button type="button" class="btn btn-secondary btn-sm" ng-click="inOrderDecrement(item, item.item_count)" ng-disabled="item.item_count<=1" ng-if="item.is_real == 1" hidden>-</button>
<button type="button" class="btn btn-secondary btn-sm" ng-model="item.item_count" ng-if="item.is_real == 1" ng-click="enterCount(item, orderId, item.item_id)">{{item.item_count}}</button>
<button type="button" class="btn btn-secondary btn-sm" ng-model="item.item_count" ng-if="item.is_real == 0" disabled>{{item.item_count}}</button>
<button type="button" class="btn btn-secondary btn-sm" ng-click="inOrderIncrement(item, item.item_count)" ng-if="item.is_real == 0">+</button>
<button type="button" class="btn btn-secondary btn-sm" ng-click="inOrderIncrement(item, item.item_count)" ng-if="item.is_real == 1" hidden>+</button>
</div>
</td>
<td>{{ item.item_price * item.item_count }} BYN</td>
<td>{{ (item.item_price * item.item_count) | curr }} BYN</td>
<td>
<button type="button" class="btn danger btn-sm" ng-model="item" ng-click="deleteItem(item)">
<i class="material-icons">&#xE872;</i>
@@ -90,7 +93,6 @@
</div>
</div>
<div class="form-group row">
<div ng-if="totalCount" class="col">Количество товаров: {{totalCount}}</div>
<div ng-if="totalPrice" class="col">Итоговая сумма заказа: {{totalPrice}} BYN</div>
</div>
</form>

View File

@@ -94,3 +94,6 @@
<div class="modal fade" id="edit-selectmenuitem" data-backdrop="true" style="z-index: 1052">
<div ui-include="'../views/orders/selectmenuitem.html'"></div>
</div>
<div class="modal fade" id="edit-item-count" data-backdrop="true" style="z-index: 1052">
<div ui-include="'../views/orders/selectitemcount.html'"></div>
</div>

View File

@@ -1,4 +1,6 @@
<div class="modal-dialog">
<div class="row-col h-v">
<div class="row-cell v-m">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Укажите количество</h5>
@@ -6,15 +8,21 @@
<div class="modal-body text-center p-lg">
<form role="form" class="ng-pristine ng-valid container">
<div class="form-group row">
<div class="col-sm-6">
<input class="form-control" placeholder="Количество" type="text" ng-model="item.count">
<div class="col-sm-12">
<div class="input-group m-b">
<input type="number" class="form-control" placeholder="Количество" ng-model="item.count">
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn success p-x-md" ng-model="itemId" ng-click="addItem(orderId, itemId, item.count)" data-dismiss="modal">Сохранить</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn success p-x-md" ng-model="itemId"
ng-click="updateCount(item, item.count)" data-dismiss="modal">Сохранить
</button>
</div>
</div><!-- /.modal-content -->
</div>
</div>
</div>

View File

@@ -1,104 +0,0 @@
<div class="modal-dialog modal-list">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Выбор элемента меню</h5>
</div>
<div class="modal-body p-lg">
<div ng-if="selectMenuItemParams.currentMenu > 0">
<div class="list-item pointer no_selection" ios-dblclick="upMenuItem()">
<div class="list-left">
<span class="w-30">
<i class="material-icons" style="font-size: 30px;">&#xE2C7;</i>
</span>
</div>
<div class="list-body" style="line-height: 30px">...</div>
</div>
</div>
<div ng-if="selectMenuItemParams.currentMenu == 0">
<div class="list inset" ng-repeat="menu in selectMenuItemParams.menus">
<div class="list-item pointer no_selection" ios-dblclick="openMenuItem(menu)"
sglclick="selectItem(menu.id, 'menu', menu.name)"
ng-class="menu.id == selectedElement.value && selectedElement.type == 'menu' ? 'active' : ''">
<div class="list-left">
<span class="w-30">
<i class="material-icons" style="font-size: 30px;">&#xE2C7;</i>
</span>
</div>
<div class="list-body" style="line-height: 30px">
{{ menu.name }}
</div>
</div>
</div>
</div>
<div ng-if="selectMenuItemParams.currentMenu > 0">
<div class="list inset" ng-repeat="folder in selectMenuItemParams.folders">
<div class="list-item pointer no_selection" ios-dblclick="openFolderItem(folder)"
sglclick="selectItem(folder.id, 'folder', folder.name)"
ng-class="folder.id == selectedElement.value && selectedElement.type == 'folder' ? 'active' : ''">
<div class="list-left">
<span class="w-30">
<i class="material-icons" style="font-size: 30px;">&#xE2C7;</i>
</span>
</div>
<div class="list-body" style="line-height: 30px">
{{ folder.name }}
</div>
</div>
</div>
</div>
<div ng-if="selectMenuItemParams.currentMenu > 0">
<div class="list inset" ng-repeat="item in selectMenuItemParams.items">
<li class="list-item pointer no_selection" ng-click="selectItem(item.id, 'item', item.name)">
<div class="list-left">
<span class="w-30">
<i class="material-icons" style="font-size: 30px;">&#xE893;</i>
</span>
</div>
<div class="list-body">
<div class="container">
<div class="row justify-content-around">
<div class="col-6 col-sm-3">
{{ item.name }} <span class="text-muted">#{{ item.code }}</span>
<small class="block text-muted">{{ item.cosht | curr }} BYN</small>
</div>
<div ng-if="item.realCount" class="col-6 col-sm-4">
<div class="btn-group" role="group">
<button type="button" class="btn btn-secondary" ng-click="decrement(item, item.realCount)" ng-disabled="realCount<=0">-</button>
<button type="button" class="btn btn-secondary" ng-model="item.realCount" disabled>{{item.realCount}}</button>
<button type="button" class="btn btn-secondary" ng-click="increment(item, item.realCount)">+</button>
</div>
</div>
<div ng-if="!item.realCount" class="col-6 col-sm-4">
<div class="btn-group" role="group">
<button type="button" class="btn btn-secondary" ng-click="decrement(item, defaultCount)" ng-disabled="defaultCount<=0">-</button>
<button type="button" class="btn btn-secondary" ng-model="defaultCount" disabled>{{defaultCount}}</button>
<button type="button" class="btn btn-secondary" ng-click="increment(item, defaultCount)">+</button>
</div>
</div>
<div class="col-6 col-sm-3">
<button ng-if="!item.realCount" type="button" class="btn btn btn-success p-x-md" ng-model="orderId" ng-click="addItem(orderId, item.code, defaultCount)">+</button>
<button ng-if="item.realCount" type="button" class="btn btn btn-success p-x-md" ng-model="orderId" ng-click="addItem(orderId, item.code, item.realCount)">+</button>
</div>
</div>
</div>
</div>
<hr>
</li>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Закрыть</button>
</div>
</div>
</div>

View File

@@ -53,18 +53,27 @@
</div>
</div>
<div class="container">
<div class="row justify-content-center inset" ng-if="selectMenuItemParams.currentMenu > 0">
<div class="col-xs-6" ng-repeat="item in selectMenuItemParams.items">
<button ng-if="!item.realCount" type="button" class="btn btn-secondary" ng-model="orderId" ng-click="addItem(orderId, item.code, defaultCount)" style="width: 160px; height: 130px; white-space: unset;">
<p>
<div style="word-wrap: break-word;">{{ item.name }}</div>
</p>
<p>
<small class="block text-muted">{{ item.cosht | curr }} BYN</small>
</p>
</button>
<p> </p>
<div class="row m-b" ng-if="selectMenuItemParams.currentMenu > 0" >
<div class="col-sm-4 col-xs-4" ng-repeat="item in selectMenuItemParams.items">
<div class="box">
<div class="box-header primary">
<h3>{{ item.cosht | curr }} BYN</h3>
<div class="box-tool">
<ul class="nav">
<li class="nav-item inline">
<a class="nav-link" ng-if="!item.realCount" type="button" class="btn btn-secondary" ng-model="orderId"
ng-click="addItem(orderId, item.code, defaultCount)">
<i class="material-icons md-18">&#xe854;</i>
</a>
</li>
</ul>
</div>
</div>
<div class="box-body">
<p class="m-0 text-left text-break" style="word-break: break-word;">{{ item.name }}</p>
</div>
</div>
</div>
</div>

View File

@@ -13,7 +13,7 @@
<div class="table-responsive" ng-if="report_delete.length > 0">
<table class="table table-bordered" ng-repeat="report in report_delete">
<thead>
<th>Смена#{{ report.shift_id }} Заказ #{{ report.order_code }}. {{ report.time }}</th>
<th>Смена#{{ report.shift_id }} Заказ #{{ report.order_code }}</th>
</thead>
<tbody>
@@ -21,8 +21,10 @@
<td>
<h6>{{ item.dish_name }}
<small>
(<strong>{{ item.count }}</strong> на сумму
<strong>{{ item.sum | curr }} BYN</strong>)
<p>Время удаления: <strong>{{item.time}}</strong></p>
<p>Цена товара: <strong>{{item.price}} BYN</strong></p>
<p>Количество: <strong>{{item.count}} шт</strong></p>
<p>На сумму: <strong>{{item.sum}} BYN</strong></p>
</small>
</h6>
@@ -37,9 +39,10 @@
</td>
</tr>
</tbody>
<hr>
</table>
<hr/>
<hr>
<table class="table table-bordered">
<tbody>

View File

@@ -0,0 +1,126 @@
<div id="container-places" style="bottom: 20px; right: 20px; position: fixed;">
<div class="m-b">
<div class="btn-group">
<button id="create_place" type="button" class="btn info btn-outline b-info">Добавить зал</button>
<button id="back" type="button" class="btn info p-x-md pull-left" data-toggle="modal" data-target="#back_places">Назад</button>
<button id="create_table" type="button" class="btn info btn-outline b-info">Добавить стол</button>
<button id="save_tables" type="button" class="btn info btn-outline b-info" ng-click="saveTables(place_id, tables)">Сохранить</button>
<button id="save_places" type="button" class="btn info btn-outline b-info" ng-click="savePlaces(roommap)">Сохранить</button>
</div>
</div>
</div>
<div id="back_places" class="modal confirm-box" data-backdrop="true" style="z-index: 1052">
<div class="bottom white b-b" style="height: 90px">
<div class="confirm-box-body p-lg">
<p>Сохранить изменения в текущем зале?</p>
</div>
<div class="confirm-box-footer">
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal" ng-click="back()">Нет</button>
<button type="button" class="btn danger p-x-md" ng-model="tables" data-dismiss="modal" ng-click="saveTables(place_id, tables)">Да</button>
</div>
</div>
</div>
<div class="padding" id="places">
<div class="box">
<div class="padding">
<h4>Список залов
<ul class="nav pull-right">
<li class="nav-item ">
<span bs-tooltip="" title="FAQ" class="text-muted inline p-a-xs m-r-sm ng-scope">
<h5><i class="fa fa-question"></i></h5>
</span>
</li>
</ul>
</h4>
<hr/>
<div class="table-responsive">
<table class="table table-bordered m-a-0">
<thead>
<th ng-repeat="place in roommap">
<button type="button" class="btn info btn-block" sglclick="getTables(place.place_id)"
ios-dblclick="editPlace(place.place_id)" context-menu
data-target="place-{{ place.place_id }}">{{place.place_name}}
</button>
<div class="dropdown" id="place-{{ place.place_id }}" style="position: fixed; z-index: 2;">
<ul class="dropdown-menu" role="menu">
<li>
<a class="pointer" role="menuitem" tabindex="1"
ng-click="editPlace($index, place)">
Редактировать
</a>
<a class="pointer" role="menuitem" tabindex="1"
ng-click="deletePlace($index)">
Удалить
</a>
</li>
</ul>
</div>
</th>
</thead>
</table>
</div>
</div>
</div>
</div>
<div class="padding" id="background_1" ng-style="{'max-width':(maxWidth) + 'px', 'width':(screenWidth) + 'vw'}">
<div class="box">
<div class="padding" id="background" >
<!--<div id="tables" class="box" ng-style="{'height':(windowHeight) + 'px'}">-->
<div id="tables" class="box" ng-style="{'height':(windowHeight) + 'px'}" data-target="tables_editor" context-menu>
<div class="dropdown" id="tables_editor" style="position: fixed; z-index: 2;">
<ul class="dropdown-menu" role="menu">
<li>
<a class="pointer" role="menuitem" tabindex="1"
ng-click="alignTables()">
Выровнять по сетке
</a>
</li>
</ul>
</div>
<div ng-repeat="table in tables" ng-model="tables" context-menu>
<div id="{{ 'table_' + $index }}" class="demo-div" draggable resize context-menu
data-target="table-{{ $index }}"
ng-mouseup="getCoords($event, $index, table.table_id, table.place_id)"
ng-style="{'width':'' + table.width * percentWidth + 'px', 'height':'' + table.height * percentHeight + 'px', 'top':'calc(' + top + 'px + ' + table.x * percentHeight + 'px)', 'left': 'calc(' + left + 'px + ' + table.y * percentWidth + 'px)'}"
style="position: fixed;cursor: default;font-family: sans-serif;text-align: center;background-color: #FFFFFF;border: 2px solid #183147; z-index: 1;">
<span class="demo-text">
{{table.name}} {{table.table_id}}
</span>
</div>
<div class="dropdown" id="table-{{ $index }}" style="position: fixed; z-index: 2;">
<ul class="dropdown-menu" role="menu">
<li>
<a class="pointer" role="menuitem" tabindex="1"
ng-click="duplicateTable($index, table.place_id)">
Дублировать
</a>
<a class="pointer" role="menuitem" tabindex="2"
ng-click="editTable($index, table)">
Редактировать
</a>
<a class="pointer" role="menuitem" tabindex="3"
ng-click="deleteTable($index)">
Удалить
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="table-edit" data-backdrop="true">
<div ui-include="'../views/roommap/items/edit.html'"></div>
</div>
<script type="text/javascript" src="/libs/js/moment/locale/ru.js"></script>

View File

@@ -0,0 +1,70 @@
<div class="modal-dialog" id="animate" ui-class="fade-down-big">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Редактирование стола</h5>
</div>
<div class="modal-body text-center p-lg">
<div class="box">
<div class="box-header">
<small>Номер стола должен отличаться от существующих.</small>
<small>Высота и ширина стола должны быть не меньше 80px.</small>
</div>
<div class="box-divider m-0"></div>
<div class="box-body">
<form role="form">
<div class="form-group row">
<label for="inputNumber" class="col-sm-2 form-control-label">Номер</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputNumber" placeholder="{{tableId}}"
ng-model="tableId"/>
</div>
</div>
<div class="form-group row">
<label for="inputName" class="col-sm-2 form-control-label">Имя</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputName"
ng-model="tableName"
placeholder="{{tableName}}"/>
</div>
</div>
<div class="form-group row">
<label for="inputWidth" class="col-sm-2 form-control-label">Ширина</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputWidth" placeholder="{{tableWidth}}"
ng-model="tableWidth"/>
</div>
</div>
<div class="form-group row">
<label for="inputHeight" class="col-sm-2 form-control-label">Высота</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputHeight" placeholder="{{tableHeight}}"
ng-model="tableHeight"/>
</div>
</div>
<div class="form-group row">
<label for="inputType" class="col-sm-2 form-control-label">Вид стола</label>
<div class="col-sm-10">
<select class="form-control c-select">
<option>Прямоугольный</option>
<option>Круглый</option>
</select>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal">Отмена</button>
<button type="button" class="btn danger p-x-md" data-dismiss="modal"
ng-click="saveTable(tableIndex, tableId, tableName, tableWidth, tableHeight)">Сохранить
</button>
</div>
</div><!-- /.modal-content -->
</div>
<script type="text/javascript" src="/libs/js/moment/locale/ru.js"></script>