v.2.24
1. Редактор карты зала.
This commit is contained in:
@@ -10,25 +10,36 @@ use App\Component\Models\Tasks;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class Bot extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getbot';
|
||||
class Bot extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getbot';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$settings = Settings::where('code', '=', 5)->where('value', '=', 1)->get();
|
||||
if (isset($settings['0']['value'])) {
|
||||
$dishes = Dishes::where('is_bot_export', '=', 0)->update(['is_bot_export' => 1]);
|
||||
$folders = Folders::where('is_bot_export', '=', 0)->update(['is_bot_export' => 1]);
|
||||
}
|
||||
$ordersinfo = Tasks::where('method', '=', 'orderinfo')->get();
|
||||
$delete_params = ['closed', 'deleted'];
|
||||
foreach ($ordersinfo as $more) {
|
||||
$order = OrderBot::where('id', '=', $more['more'])->whereIn('status', $delete_params)->get();
|
||||
foreach ($order as $value) {
|
||||
$delete = Tasks::where('method', '=', 'orderinfo')->where('more', '=', $value['id'])->delete();
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
];
|
||||
}
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
$settings = Settings::where('code', 5)
|
||||
->where('value', 1)
|
||||
->get();
|
||||
if (isset($settings['0']['value'])) {
|
||||
Dishes::where('is_bot_export', '=', 0)
|
||||
->update(['is_bot_export' => 1]);
|
||||
Folders::where('is_bot_export', '=', 0)
|
||||
->update(['is_bot_export' => 1]);
|
||||
}
|
||||
$ordersinfo = Tasks::where('method', 'orderinfo')
|
||||
->get();
|
||||
$delete_params = ['closed', 'deleted'];
|
||||
foreach ($ordersinfo as $more) {
|
||||
$order = OrderBot::where('id', intval($more['more']))
|
||||
->whereIn('status', $delete_params)
|
||||
->get();
|
||||
foreach ($order as $value) {
|
||||
Tasks::where('method', 'orderinfo')
|
||||
->where('more', $value['id'])
|
||||
->delete();
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -126,31 +126,21 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
return $retval;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
$reportType = $input['type'];
|
||||
//merge, slice, move
|
||||
if (isset($reportType)) {
|
||||
//merge
|
||||
if ($reportType == 'merge') {
|
||||
$merged_order_items = [];
|
||||
$orders = ExchangeActions::select('order_code')->where('shift_id', $input['shift_id'])->groupBy('order_code')->get();
|
||||
$orders = ExchangeActions::select('order_code')
|
||||
->where('shift_id', $input['shift_id'])
|
||||
->groupBy('order_code')
|
||||
->get();
|
||||
foreach ($orders as $key => $order) {
|
||||
$actions = ExchangeActions::where('order_code', $order['order_code'])->where('shift_id', $input['shift_id'])->orderBy('time', 'asc')->get();
|
||||
$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 = intval($item['value']);
|
||||
@@ -174,44 +164,69 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
$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,
|
||||
$merge_items_before[] = array(
|
||||
'id' => $key + 1,
|
||||
'code' => $merge_order_item_before['id'],
|
||||
'name' => $merge_order_item_before['name'],
|
||||
'count' => $merge_order_item_before['count'],
|
||||
'sale_price' => $merge_order_item_before['sale_price']);
|
||||
'sale_price' => $merge_order_item_before['sale_price']
|
||||
);
|
||||
}
|
||||
foreach ($merge_order_items_after as $key => $merge_order_item_after) {
|
||||
$merge_items_after[] = array('id' => $key + 1,
|
||||
$merge_items_after[] = array(
|
||||
'id' => $key + 1,
|
||||
'code' => $merge_order_item_after['id'],
|
||||
'name' => $merge_order_item_after['name'],
|
||||
'count' => $merge_order_item_after['count'],
|
||||
'sale_price' => $merge_order_item_after['sale_price']);
|
||||
'sale_price' => $merge_order_item_after['sale_price']
|
||||
);
|
||||
}
|
||||
foreach ($merge_order_items_after as $key => $merge_order_item_after) {
|
||||
if (!in_array(array('id' => $key + 1,
|
||||
if (!in_array(array(
|
||||
'id' => $key + 1,
|
||||
'code' => $merge_order_item_after['id'],
|
||||
'name' => $merge_order_item_after['name'],
|
||||
'count' => $merge_order_item_after['count'],
|
||||
'sale_price' => $merge_order_item_after['sale_price']), $merge_items_before, true)) {
|
||||
$merged_items[] = array('code' => $merge_order_item_after['id'],
|
||||
'sale_price' => $merge_order_item_after['sale_price']), $merge_items_before, true)
|
||||
) {
|
||||
$merged_items[] = array(
|
||||
'code' => $merge_order_item_after['id'],
|
||||
'name' => $merge_order_item_after['name'],
|
||||
'count' => $merge_order_item_after['count'],
|
||||
'sale_price' => $merge_order_item_after['sale_price']);
|
||||
'sale_price' => $merge_order_item_after['sale_price']
|
||||
);
|
||||
}
|
||||
}
|
||||
foreach ($merged_items as $key => $merged_item) {
|
||||
$merge_items[] = array('id' => $key + 1,
|
||||
$merge_items[] = array(
|
||||
'id' => $key + 1,
|
||||
'code' => $merged_item['code'],
|
||||
'name' => $merged_item['name'],
|
||||
'count' => $merged_item['count'],
|
||||
'sale_price' => $merged_item['sale_price']);
|
||||
'sale_price' => $merged_item['sale_price']
|
||||
);
|
||||
}
|
||||
$staff_name = staffName($item['who']);
|
||||
$start_order_place = ExchangeActions::where('order_code', $item['order_code'])->where('action_type', 45)->where('shift_id', $input['shift_id'])->first();
|
||||
$staff_name = Staff::getName($item['who']);
|
||||
$start_order_place = ExchangeActions::where('order_code', $item['order_code'])
|
||||
->where('action_type', 45)
|
||||
->where('shift_id', $input['shift_id'])
|
||||
->first();
|
||||
$start_order_place = data_decode($start_order_place['value']);
|
||||
$end_order_place = ExchangeActions::where('order_code', $merge_order + 0)->where('action_type', 45)->where('shift_id', $input['shift_id'])->first();
|
||||
$end_order_place = ExchangeActions::where('order_code', $merge_order)
|
||||
->where('action_type', 45)
|
||||
->where('shift_id', $input['shift_id'])
|
||||
->first();
|
||||
$end_order_place = data_decode($end_order_place['value']);
|
||||
$merged_order_items[] = array('start_order' => $item['order_code'], 'end_order' => $merge_order + 0, 'time' => date('d.m.Y H:i:s', strtotime($item['time'])), 'staff' => $staff_name, 'start_order_place' => $start_order_place, 'end_order_place' => $end_order_place, 'merge_order_items' => $merge_order_items, 'items' => $merge_items);
|
||||
$merged_order_items[] = array(
|
||||
'start_order' => $item['order_code'],
|
||||
'end_order' => $merge_order,
|
||||
'time' => date('d.m.Y H:i:s', strtotime($item['time'])),
|
||||
'staff' => $staff_name,
|
||||
'start_order_place' => $start_order_place,
|
||||
'end_order_place' => $end_order_place,
|
||||
'merge_order_items' => $merge_order_items,
|
||||
'items' => $merge_items
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,11 +242,20 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
//slice
|
||||
if ($reportType == 'slice') {
|
||||
$sliced_order_data = [];
|
||||
$orders = ExchangeActions::select('order_code')->where('shift_id', $input['shift_id'])->groupBy('order_code')->get();
|
||||
$action_count = ExchangeActions::where('shift_id', $input['shift_id'])->where('action_type', 35)->count();
|
||||
$orders = ExchangeActions::select('order_code')
|
||||
->where('shift_id', $input['shift_id'])
|
||||
->groupBy('order_code')
|
||||
->get();
|
||||
$action_count = ExchangeActions::where('shift_id', $input['shift_id'])
|
||||
->where('action_type', 35)
|
||||
->count();
|
||||
if ($action_count > 0) {
|
||||
foreach ($orders as $key => $order) {
|
||||
$actions = ExchangeActions::where('order_code', $order['order_code'])->where('shift_id', $input['shift_id'])->where('action_type', 35)->orderBy('time', 'asc')->get();
|
||||
$actions = ExchangeActions::where('order_code', $order['order_code'])
|
||||
->where('shift_id', $input['shift_id'])
|
||||
->where('action_type', 35)
|
||||
->orderBy('time', 'asc')
|
||||
->get();
|
||||
foreach ($actions as $key => $action) {
|
||||
$value = $action['value'];
|
||||
$codeOrder = $action['order_code'];
|
||||
@@ -240,19 +264,38 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
} else {
|
||||
$moved_items = json_decode(utf8_encode(base64_decode($action['more'], TRUE)), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
}
|
||||
$from_place = ExchangeActions::where('order_code', $codeOrder)->where('action_type', 45)->where('shift_id', $input['shift_id'])->first();
|
||||
$from_place = ExchangeActions::where('order_code', $codeOrder)
|
||||
->where('action_type', 45)
|
||||
->where('shift_id', $input['shift_id'])
|
||||
->first();
|
||||
$from_place = data_decode($from_place['value']);
|
||||
$to_place = ExchangeActions::where('order_code', $value)->where('action_type', 45)->where('shift_id', $input['shift_id'])->first();
|
||||
$to_place = ExchangeActions::where('order_code', $value)
|
||||
->where('action_type', 45)
|
||||
->where('shift_id', $input['shift_id'])
|
||||
->first();
|
||||
$to_place = data_decode($to_place['value']);
|
||||
$to_action = ExchangeActions::where('value', $codeOrder)->where('order_code', $value)->where('action_type', 34)->where('shift_id', $input['shift_id'])->first();
|
||||
$to_action = ExchangeActions::where('value', $codeOrder)
|
||||
->where('order_code', $value)
|
||||
->where('action_type', 34)
|
||||
->where('shift_id', $input['shift_id'])
|
||||
->first();
|
||||
if (validate_json($to_action['more'])) {
|
||||
$start_data = json_decode(utf8_encode($to_action['more']), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
} else {
|
||||
$start_data = json_decode(utf8_encode(base64_decode($to_action['more'], TRUE)), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
}
|
||||
$staff_name = staffName($action['who']);
|
||||
$staff_name = Staff::getName($action['who']);
|
||||
$time = date('d.m.Y H:i:s', strtotime($action['time']));
|
||||
$sliced_order_data[] = array('from_order' => $codeOrder, 'from_place' => $from_place, 'staff' => $staff_name, 'time' => $time, 'start_data' => $start_data, 'to_order' => $value, 'to_place' => $to_place, 'moved_items' => $moved_items);
|
||||
$sliced_order_data[] = array(
|
||||
'from_order' => $codeOrder,
|
||||
'from_place' => $from_place,
|
||||
'staff' => $staff_name,
|
||||
'time' => $time,
|
||||
'start_data' => $start_data,
|
||||
'to_order' => $value,
|
||||
'to_place' => $to_place,
|
||||
'moved_items' => $moved_items
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -265,18 +308,35 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
}
|
||||
|
||||
if ($reportType == 'move') {
|
||||
$orders = ExchangeActions::select('order_code')->where('shift_id', $input['shift_id'])->groupBy('order_code')->get();
|
||||
$orders = ExchangeActions::select('order_code')
|
||||
->where('shift_id', $input['shift_id'])
|
||||
->groupBy('order_code')
|
||||
->get();
|
||||
foreach ($orders as $key => $order) {
|
||||
$actions = ExchangeActions::where('order_code', $order['order_code'])->where('shift_id', $input['shift_id'])->orderBy('time', 'asc')->get();
|
||||
$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']);
|
||||
$staff_name_to = Staff::getName($item['who']);
|
||||
$time_to = date('d.m.Y H:i:s', strtotime($item['time']));
|
||||
$data_from = ExchangeActions::where('order_code', $item['order_code'])->where('shift_id', $input['shift_id'])->where('action_type', 45)->first();
|
||||
$staff_name_from = staffName($data_from['who']);
|
||||
$data_from = ExchangeActions::where('order_code', $item['order_code'])
|
||||
->where('shift_id', $input['shift_id'])
|
||||
->where('action_type', 45)
|
||||
->first();
|
||||
$staff_name_from = Staff::getName($data_from['who']);
|
||||
$time_from = date('d.m.Y H:i:s', strtotime($data_from['time']));
|
||||
$moved_order_data[] = array('order' => $item['order_code'], 'move_from' => data_decode($data_from['value']), 'move_from_staff' => $staff_name_from, 'move_from_time' => $time_from, 'move_to' => data_decode($item['value']), 'move_to_staff' => $staff_name_to, 'move_to_time' => $time_to);
|
||||
$moved_order_data[] = array(
|
||||
'order' => $item['order_code'],
|
||||
'move_from' => data_decode($data_from['value']),
|
||||
'move_from_staff' => $staff_name_from,
|
||||
'move_from_time' => $time_from,
|
||||
'move_to' => data_decode($item['value']),
|
||||
'move_to_staff' => $staff_name_to,
|
||||
'move_to_time' => $time_to
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,8 +369,8 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
}
|
||||
$staff = array_unique($staff);
|
||||
foreach ($staff as $key => $value) {
|
||||
$staffId = $value + 0;
|
||||
$name = staffName($staffId);
|
||||
$staffId = intval($value);
|
||||
$name = Staff::getName($staffId);
|
||||
$code = $staffId;
|
||||
$countOpened = ExchangeOrders::where('who_open', $staffId)
|
||||
->where('shift_id', $input['shift_id'])
|
||||
@@ -398,11 +458,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' => $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,
|
||||
@@ -412,7 +472,8 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
'return_count' => $returnCount,
|
||||
'return_sum' => round($returnSum, 2),
|
||||
'deleted_count' => $deletedCount,
|
||||
'deleted_sum' => $deletedSum);
|
||||
'deleted_sum' => $deletedSum
|
||||
);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
@@ -448,8 +509,8 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
}
|
||||
$staff = array_unique($staff);
|
||||
foreach ($staff as $key => $value) {
|
||||
$staffId = $value + 0;
|
||||
$name = staffName($staffId);
|
||||
$staffId = intval($value);
|
||||
$name = Staff::getName($staffId);
|
||||
$code = $staffId;
|
||||
$countOpened = ExchangeOrders::where('who_open', $staffId)
|
||||
->whereIn('shift_id', $shifts)
|
||||
@@ -534,7 +595,7 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
}
|
||||
$staff_data[] = array(
|
||||
'name' => $name,
|
||||
'code' => intval($code),
|
||||
'code' => $code,
|
||||
'opened_count' => intval($countOpened),
|
||||
'closed_count' => intval($countClosed),
|
||||
'opened_sum' => floatval($sumOpened),
|
||||
@@ -548,7 +609,8 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
'return_count' => $returnCount,
|
||||
'return_sum' => round($returnSum, 2),
|
||||
'deleted_count' => $deletedCount,
|
||||
'deleted_sum' => $deletedSum);
|
||||
'deleted_sum' => $deletedSum
|
||||
);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
@@ -562,14 +624,23 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
$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();
|
||||
$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();
|
||||
$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();
|
||||
$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']);
|
||||
@@ -579,24 +650,52 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
$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));
|
||||
$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);
|
||||
$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();
|
||||
$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();
|
||||
$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();
|
||||
$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();
|
||||
$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']);
|
||||
@@ -606,9 +705,22 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
$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));
|
||||
$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);
|
||||
$deleted[] = array(
|
||||
'order_code' => $order_id,
|
||||
'shift_id' => $shift_id,
|
||||
'items' => $items
|
||||
);
|
||||
}
|
||||
}
|
||||
$report = new Report;
|
||||
|
||||
@@ -37,7 +37,7 @@ class GETOrder extends HRCCommand implements HRCCommandInterface {
|
||||
if (isset($orderItems)) {
|
||||
foreach ($orderItems as $key => $item) {
|
||||
$itemName = Dishes::getName($item['item_id']);
|
||||
$is_real = Dishes::isReal($item['item_id']);
|
||||
$is_serving = Dishes::isServing($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) {
|
||||
@@ -54,7 +54,7 @@ class GETOrder extends HRCCommand implements HRCCommandInterface {
|
||||
'item_name' => $itemName,
|
||||
'item_count' => round($item['item_count'], 3),
|
||||
'item_price' => round($item['item_price'], 2),
|
||||
'is_real' => $is_real,
|
||||
'is_serving' => $is_serving,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -7,11 +7,13 @@ use App\Component\Models\Tables;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETRoomMap extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getroommap';
|
||||
class GETRoomMap extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getroommap';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
if (isset($input['type'])) {
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if (isset($input['type'])) {
|
||||
$roommap = [];
|
||||
if ($input['type'] == 'places') {
|
||||
$places = Places::all();
|
||||
@@ -22,7 +24,8 @@ class GETRoomMap extends HRCCommand implements HRCCommandInterface {
|
||||
}
|
||||
if ($input['type'] == 'place' && isset($input['id'])) {
|
||||
$place_name = Places::getName($input['id']);
|
||||
$tables = Tables::where('place_id', $input['id'])->get();
|
||||
$tables = Tables::where('place_id', $input['id'])
|
||||
->get();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'place_id' => $input['id'],
|
||||
@@ -33,19 +36,24 @@ class GETRoomMap extends HRCCommand implements HRCCommandInterface {
|
||||
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);
|
||||
$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' => 'Ошибка данных запроса',
|
||||
];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Ошибка данных запроса',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,12 @@ use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class GETRoomMapFile extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getroommapfile';
|
||||
class GETRoomMapFile extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getroommapfile';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
|
||||
$terminal = Terminal::where('soft', '=', 1)->where('is_active', '=', 1)->first();
|
||||
$files = [];
|
||||
@@ -31,10 +33,14 @@ class GETRoomMapFile extends HRCCommand implements HRCCommandInterface {
|
||||
foreach ($response_files->json()['files'] as $response) {
|
||||
$filename = $response['filename'];
|
||||
$basename = $response['basename'];
|
||||
$files[$response['timestamp']] = array('filename' => $filename, 'basename' => $basename);
|
||||
$files[$response['timestamp']] = array(
|
||||
'filename' => $filename,
|
||||
'basename' => $basename
|
||||
);
|
||||
}
|
||||
if (count($files) == 0) {
|
||||
return ['status' => 'success',
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Файлы не найдены'
|
||||
];
|
||||
}
|
||||
@@ -63,25 +69,51 @@ class GETRoomMapFile extends HRCCommand implements HRCCommandInterface {
|
||||
}
|
||||
$places_file = $dirname . $basename;
|
||||
} else {
|
||||
return ['status' => 'success',
|
||||
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'];
|
||||
if (count($xmlPlaces['Place']) > 2) {
|
||||
foreach ($xmlPlaces['Place'] as $xmlPlace) {
|
||||
$newPlace = new Places;
|
||||
$newPlace->name = $xmlPlace['@attributes']['name'];
|
||||
$newPlace->save();
|
||||
$tables = $xmlPlace['Table'];
|
||||
foreach ($tables 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'];
|
||||
if (isset($table['@attributes']['type'])) {
|
||||
$newTable->type = intval($table['@attributes']['type']);
|
||||
} else {
|
||||
$newTable->type = 0;
|
||||
}
|
||||
$newTable->save();
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'places' => $xmlPlaces
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$newPlace = new Places;
|
||||
$newPlace->name = $place_name;
|
||||
$newPlace->name = $xmlPlaces['Place']['@attributes']['name'];
|
||||
$newPlace->save();
|
||||
foreach ($xmlPlace['Table'] as $table) {
|
||||
$tables = $xmlPlaces['Place']['Table'];
|
||||
foreach ($tables as $table) {
|
||||
$newTable = new Tables;
|
||||
$newTable->name = $table['@attributes']['text'];
|
||||
$newTable->table_id = intval($table['@attributes']['number']);
|
||||
@@ -90,12 +122,18 @@ class GETRoomMapFile extends HRCCommand implements HRCCommandInterface {
|
||||
$newTable->height = $table['@attributes']['height'];
|
||||
$newTable->x = $table['@attributes']['y'];
|
||||
$newTable->y = $table['@attributes']['x'];
|
||||
if (isset($table['@attributes']['type'])) {
|
||||
$newTable->type = intval($table['@attributes']['type']);
|
||||
} else {
|
||||
$newTable->type = 0;
|
||||
}
|
||||
$newTable->save();
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'places' => $xmlPlaces
|
||||
];
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'places' => $xmlPlaces
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,30 +6,33 @@ use App\Component\Models\Settings;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETSettings extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getsettings';
|
||||
class GETSettings extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getsettings';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
if (isset($input['code'])) {
|
||||
$setting = Settings::where('code', $input['code'])->first();
|
||||
if ($setting) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'code' => $setting['code'],
|
||||
'value' => $setting['value'],
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'more' => 'Setting not found',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$settings = Settings::all();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'settings' => $settings,
|
||||
];
|
||||
}
|
||||
}
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if (isset($input['code'])) {
|
||||
$setting = Settings::where('code', $input['code'])
|
||||
->first();
|
||||
if ($setting) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'code' => $setting['code'],
|
||||
'value' => $setting['value'],
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'more' => 'Setting not found',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$settings = Settings::all();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'settings' => $settings,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,8 @@ class POSTRoomMap extends HRCCommand implements HRCCommandInterface
|
||||
isset($input['width']) &&
|
||||
isset($input['height']) &&
|
||||
isset($input['x']) &&
|
||||
isset($input['y'])) {
|
||||
isset($input['y']) &&
|
||||
isset($input['type'])) {
|
||||
$table = Tables::where('place_id', $input['place_id'])->where('table_id', $input['table_id'])->where('name', $input['name'])->first();
|
||||
if (isset($table)) {
|
||||
return [
|
||||
@@ -124,6 +125,7 @@ class POSTRoomMap extends HRCCommand implements HRCCommandInterface
|
||||
$table_height = $input['height'];
|
||||
$table_x = $input['x'];
|
||||
$table_y = $input['y'];
|
||||
$table_type = $input['type'];
|
||||
$newTable = new Tables;
|
||||
$newTable->name = $table_name;
|
||||
$newTable->table_id = $table_id;
|
||||
@@ -132,6 +134,7 @@ class POSTRoomMap extends HRCCommand implements HRCCommandInterface
|
||||
$newTable->height = $table_height;
|
||||
$newTable->x = $table_x;
|
||||
$newTable->y = $table_y;
|
||||
$newTable->type = $table_type;
|
||||
$newTable->save();
|
||||
return [
|
||||
'status' => 'success',
|
||||
@@ -147,7 +150,8 @@ class POSTRoomMap extends HRCCommand implements HRCCommandInterface
|
||||
isset($input['width']) &&
|
||||
isset($input['height']) &&
|
||||
isset($input['x']) &&
|
||||
isset($input['y'])) {
|
||||
isset($input['y']) &&
|
||||
isset($input['type'])) {
|
||||
$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'];
|
||||
@@ -156,6 +160,7 @@ class POSTRoomMap extends HRCCommand implements HRCCommandInterface
|
||||
$table_height = $input['height'];
|
||||
$table_x = $input['x'];
|
||||
$table_y = $input['y'];
|
||||
$table_type = $input['type'];
|
||||
$table = Tables::find($table['id']);
|
||||
$table->name = $table_name;
|
||||
$table->table_id = $table_id;
|
||||
@@ -164,6 +169,7 @@ class POSTRoomMap extends HRCCommand implements HRCCommandInterface
|
||||
$table->height = $table_height;
|
||||
$table->x = $table_x;
|
||||
$table->y = $table_y;
|
||||
$table->type = $table_type;
|
||||
$table->save();
|
||||
return [
|
||||
'status' => 'success',
|
||||
@@ -196,6 +202,7 @@ class POSTRoomMap extends HRCCommand implements HRCCommandInterface
|
||||
$table_height = $item['height'];
|
||||
$table_x = $item['x'];
|
||||
$table_y = $item['y'];
|
||||
$table_type = $item['type'];
|
||||
$newTable = new Tables;
|
||||
$newTable->name = $table_name;
|
||||
$newTable->table_id = $table_id;
|
||||
@@ -204,6 +211,7 @@ class POSTRoomMap extends HRCCommand implements HRCCommandInterface
|
||||
$newTable->height = $table_height;
|
||||
$newTable->x = $table_x;
|
||||
$newTable->y = $table_y;
|
||||
$newTable->type = $table_type;
|
||||
$newTable->save();
|
||||
}
|
||||
return [
|
||||
|
||||
@@ -65,16 +65,12 @@ class TopDishes extends HRCCommand implements HRCCommandInterface {
|
||||
'status' => 'success',
|
||||
'dishes' => $sorted,
|
||||
'terminal' => $terminalKey,
|
||||
// 'test' => $dishes,
|
||||
// 'count' => $dishCount,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'dishes' => [],
|
||||
'terminal' => $terminalKey,
|
||||
// 'test' => $dishes,
|
||||
// 'count' => $dishCount,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hrc-admin/hello-world",
|
||||
"version": "2.23",
|
||||
"version": "2.24",
|
||||
"require": {
|
||||
"horeca/admin-php-module-core": "dev-master",
|
||||
"guzzlehttp/guzzle": "^7.4",
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTypeColumnInPlaceTables extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
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::table('place_tables', function (Blueprint $table) {
|
||||
$table->dropColumn('type');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -43,4 +43,20 @@ class Dishes extends Model {
|
||||
}
|
||||
return $isReal;
|
||||
}
|
||||
|
||||
public static function isServing($data) {
|
||||
$dish_isServing = Dishes::where('code', $data)->where('is_history', 0)->first();
|
||||
$isServing = 0;
|
||||
if ($dish_isServing) {
|
||||
$isServing = intval($dish_isServing['is_serving']);
|
||||
} else {
|
||||
$dish_isServing = Dishes::where('code', $data)->where('is_history', 1)->first();
|
||||
if ($dish_isServing) {
|
||||
$isServing = intval($dish_isServing['is_serving']);
|
||||
} else {
|
||||
$isServing = 0;
|
||||
}
|
||||
}
|
||||
return $isServing;
|
||||
}
|
||||
}
|
||||
@@ -4,15 +4,21 @@ namespace App\Component\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Staff extends Model {
|
||||
protected $table = 'staffs';
|
||||
class Staff extends Model
|
||||
{
|
||||
protected $table = 'staffs';
|
||||
|
||||
public static function getName($data) {
|
||||
$staff_name = Staff::where('code', intval($data))->where('is_history', 0)->first();
|
||||
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();
|
||||
$staff_name = Staff::where('code', intval($data))
|
||||
->where('is_history', 1)
|
||||
->first();
|
||||
if ($staff_name) {
|
||||
$staff_name = $staff_name['name'];
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[info]
|
||||
name=V1
|
||||
version=2.23
|
||||
version=2.24
|
||||
[build]
|
||||
version=2.23
|
||||
version=2.24
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
RoommapCtrl.$inject = ['$scope', 'smartRequest', 'Notification', '$http'];
|
||||
|
||||
function RoommapCtrl($scope, smartRequest, Notification, $http) {
|
||||
function RoommapCtrl($scope, smartRequest, Notification) {
|
||||
$scope.places = [];
|
||||
$scope.tables = [];
|
||||
$scope.newTables = [];
|
||||
@@ -28,7 +28,6 @@
|
||||
$('#save_tables').hide();
|
||||
$('#save_places').hide();
|
||||
$scope.roommap = data.roommap;
|
||||
Notification.success(data.status);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -98,7 +97,6 @@
|
||||
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;
|
||||
@@ -141,7 +139,7 @@
|
||||
return $scope.tables;
|
||||
};
|
||||
|
||||
$scope.duplicateTable = function (index, place) {
|
||||
$scope.duplicateTable = function (index) {
|
||||
$scope.newTable = {};
|
||||
$scope.lastEl = $scope.tables.length;
|
||||
$scope.newTable.id = $scope.tables[$scope.lastEl - 1].id + 1,
|
||||
@@ -151,7 +149,8 @@
|
||||
$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.newTable.y = $scope.tables[index].y + 50,
|
||||
$scope.newTable.type = $scope.tables[index].type;
|
||||
$scope.tables.push($scope.newTable);
|
||||
$('#save_tables').show();
|
||||
return $scope.tables;
|
||||
@@ -163,17 +162,19 @@
|
||||
$scope.tableHeight = table.height;
|
||||
$scope.tableName = table.name;
|
||||
$scope.tableId = table.table_id;
|
||||
$scope.tableType = table.type.toString();
|
||||
$scope.tableIndex = $index;
|
||||
|
||||
console.log($scope.tableIndex);
|
||||
$('#save_tables').show();
|
||||
return $scope.tables;
|
||||
};
|
||||
|
||||
$scope.saveTable = function (index, id, name, width, height) {
|
||||
$scope.saveTable = function (index, id, name, width, height, type) {
|
||||
$('#table-edit').modal('toggle');
|
||||
$scope.tables[index].width = width,
|
||||
$scope.tables[index].height = height,
|
||||
$scope.tables[index].name = name,
|
||||
$scope.tables[index].type = parseInt(type),
|
||||
$scope.tables[index].table_id = id;
|
||||
|
||||
$('#save_tables').show();
|
||||
@@ -205,6 +206,35 @@
|
||||
});
|
||||
};
|
||||
|
||||
$scope.createTable = function (place_id) {
|
||||
$scope.editPlaceTableId = place_id;
|
||||
$('#table-create').modal('show');
|
||||
};
|
||||
|
||||
$scope.saveNewTable = function (place_id, name, type) {
|
||||
$scope.newTable = {};
|
||||
$scope.lastEl = parseInt($scope.tables.length);
|
||||
if ($scope.lastEl == 0) {
|
||||
$scope.newTableID = 1;
|
||||
$scope.newTableTableID = 1;
|
||||
} else {
|
||||
$scope.newTableID = $scope.tables[$scope.lastEl - 1].id + 1;
|
||||
$scope.newTableTableID = $scope.tables[$scope.lastEl - 1].table_id + 1;
|
||||
}
|
||||
$scope.newTable.id = $scope.newTableID,
|
||||
$scope.newTable.place_id = place_id,
|
||||
$scope.newTable.table_id = $scope.newTableTableID,
|
||||
$scope.newTable.name = name,
|
||||
$scope.newTable.width = 100,
|
||||
$scope.newTable.height = 100,
|
||||
$scope.newTable.x = 100,
|
||||
$scope.newTable.y = 100,
|
||||
$scope.newTable.type = parseInt(type);
|
||||
$scope.tables.push($scope.newTable);
|
||||
$('#table-create').modal('toggle');
|
||||
$('#save_tables').show();
|
||||
}
|
||||
|
||||
$scope.deletePlace = function (index) {
|
||||
console.log(index);
|
||||
delete $scope.roommap.splice(index, 1);
|
||||
@@ -212,12 +242,39 @@
|
||||
return $scope.roommap;
|
||||
};
|
||||
|
||||
$scope.editPlace = function (index) {
|
||||
|
||||
$scope.editPlace = function (id, place) {
|
||||
$scope.editPlaceId = id;
|
||||
$scope.editPlaceName = place;
|
||||
$('#place-edit').modal('show');
|
||||
};
|
||||
|
||||
$scope.savePlace = function (index) {
|
||||
$scope.updatePlace = function (id, place) {
|
||||
$('#place-edit').modal('toggle');
|
||||
smartRequest.post('v1/roommap', {
|
||||
type: 'place',
|
||||
action: 'update',
|
||||
id: id,
|
||||
name: place,
|
||||
}, function (data) {
|
||||
Notification.success(data.message);
|
||||
$scope.getRoomMap();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.createPlace = function () {
|
||||
$('#place-create').modal('show');
|
||||
};
|
||||
|
||||
$scope.savePlace = function (place) {
|
||||
$('#place-create').modal('toggle');
|
||||
smartRequest.post('v1/roommap', {
|
||||
type: 'place',
|
||||
action: 'create',
|
||||
name: place,
|
||||
}, function (data) {
|
||||
Notification.success(data.message);
|
||||
$scope.getRoomMap();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.savePlaces = function (places) {
|
||||
@@ -227,6 +284,7 @@
|
||||
action: 'saveplaces',
|
||||
places: JSON.stringify(places),
|
||||
}, function (data) {
|
||||
$('#save_places').hide();
|
||||
Notification.success(data.message);
|
||||
/*$scope.getRoomMap();*/
|
||||
});
|
||||
|
||||
@@ -71,12 +71,12 @@
|
||||
<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" 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>
|
||||
<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_serving == 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_serving == 1" hidden>-</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm" ng-model="item.item_count" ng-if="item.is_serving == 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_serving == 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_serving == 0">+</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm" ng-click="inOrderIncrement(item, item.item_count)" ng-if="item.is_serving == 1" hidden>+</button>
|
||||
</div>
|
||||
</td>
|
||||
<td>{{ (item.item_price * item.item_count) | curr }} BYN</td>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<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="create_place" type="button" class="btn info btn-outline b-info" ng-click="createPlace()">Добавить зал</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="create_table" type="button" class="btn info btn-outline b-info" ng-click="createTable(place_id)">Добавить стол</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>
|
||||
@@ -49,7 +49,7 @@
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li>
|
||||
<a class="pointer" role="menuitem" tabindex="1"
|
||||
ng-click="editPlace($index, place)">
|
||||
ng-click="editPlace(place.place_id, place.place_name)">
|
||||
Редактировать
|
||||
</a>
|
||||
<a class="pointer" role="menuitem" tabindex="1"
|
||||
@@ -83,14 +83,27 @@
|
||||
</div>
|
||||
<div ng-repeat="table in tables" ng-model="tables" context-menu>
|
||||
|
||||
<div id="{{ 'table_' + $index }}" class="demo-div" draggable resize context-menu
|
||||
<div ng-if="table.type == 0" 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>
|
||||
style="position: fixed;cursor: default;font-family: sans-serif;text-align: center;background-color: #FFFFFF;border: 2px solid #183147; z-index: 1; border-radius: 5%">
|
||||
|
||||
<div class="box-header">
|
||||
<small>{{table.name}}</small>
|
||||
<small>{{table.table_id}}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="table.type == 1" 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; border-radius: 50%">
|
||||
|
||||
<div class="box-header">
|
||||
<small>{{table.name}}</small>
|
||||
<small>{{table.table_id}}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown" id="table-{{ $index }}" style="position: fixed; z-index: 2;">
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
@@ -120,7 +133,16 @@
|
||||
|
||||
|
||||
<div class="modal fade" id="table-edit" data-backdrop="true">
|
||||
<div ui-include="'../views/roommap/items/edit.html'"></div>
|
||||
<div ui-include="'../views/roommap/items/edit-table.html'"></div>
|
||||
</div>
|
||||
<div class="modal fade" id="table-create" data-backdrop="true">
|
||||
<div ui-include="'../views/roommap/items/create-table.html'"></div>
|
||||
</div>
|
||||
<div class="modal fade" id="place-create" data-backdrop="true">
|
||||
<div ui-include="'../views/roommap/items/create-place.html'"></div>
|
||||
</div>
|
||||
<div class="modal fade" id="place-edit" data-backdrop="true">
|
||||
<div ui-include="'../views/roommap/items/edit-place.html'"></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/libs/js/moment/locale/ru.js"></script>
|
||||
35
web/views/roommap/items/create-place.html
Normal file
35
web/views/roommap/items/create-place.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<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-divider m-0"></div>
|
||||
<div class="box-body">
|
||||
<form role="form">
|
||||
<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="placeName"
|
||||
placeholder="{{placeName}}"/>
|
||||
</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="savePlace(placeName)">Сохранить
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div><!-- /.modal-content -->
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="/libs/js/moment/locale/ru.js"></script>
|
||||
51
web/views/roommap/items/create-table.html
Normal file
51
web/views/roommap/items/create-table.html
Normal file
@@ -0,0 +1,51 @@
|
||||
<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>Высота и ширина стола должны быть не меньше 80px.</small>
|
||||
</div>
|
||||
<div class="box-divider m-0"></div>
|
||||
<div class="box-body">
|
||||
<form role="form">
|
||||
<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"
|
||||
ng-model="editPlaceTableId"
|
||||
placeholder="{{editPlaceTableId}}" hidden/>
|
||||
<input type="text" class="form-control" id="inputName"
|
||||
ng-model="tableName"
|
||||
placeholder="{{tableName}}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="inputType" class="col-sm-2 form-control-label">Вид стола</label>
|
||||
<div class="col-sm-10">
|
||||
<select id="inputType" class="form-control c-select" ng-model="tableType">
|
||||
<option value="0">Прямоугольный</option>
|
||||
<option value="1">Круглый</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="saveNewTable(editPlaceTableId, tableName, tableType)">Сохранить
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div><!-- /.modal-content -->
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="/libs/js/moment/locale/ru.js"></script>
|
||||
38
web/views/roommap/items/edit-place.html
Normal file
38
web/views/roommap/items/edit-place.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<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-divider m-0"></div>
|
||||
<div class="box-body">
|
||||
<form role="form">
|
||||
<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="inputId"
|
||||
ng-model="editPlaceId"
|
||||
placeholder="{{editPlaceId}}" hidden/>
|
||||
<input type="text" class="form-control" id="inputName"
|
||||
ng-model="editPlaceName"
|
||||
placeholder="{{editPlaceName}}"/>
|
||||
</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="updatePlace(editPlaceId,editPlaceName)">Сохранить
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div><!-- /.modal-content -->
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="/libs/js/moment/locale/ru.js"></script>
|
||||
@@ -46,9 +46,9 @@
|
||||
<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 id="inputType" class="form-control c-select" ng-model="tableType">
|
||||
<option value="0">Прямоугольный</option>
|
||||
<option value="1">Круглый</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -59,7 +59,7 @@
|
||||
<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)">Сохранить
|
||||
ng-click="saveTable(tableIndex, tableId, tableName, tableWidth, tableHeight, tableType)">Сохранить
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</td>
|
||||
<td>{{ shift.sum | curr}}</td>
|
||||
<td>
|
||||
<div class="dropdown inline" style="margin-top: -5px; position: relative;">
|
||||
<div class="dropdown inline" style="margin-top: -5px; position: absolute;">
|
||||
<button class="btn white dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="padding: 0.2rem 0.4rem">
|
||||
<i class="material-icons"></i>
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user