v.2.24
1. Редактор карты зала.
This commit is contained in:
@@ -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