diff --git a/include/controllers/default/cockpit2/api/restaurant/edit/index.php b/include/controllers/default/cockpit2/api/restaurant/edit/index.php index 33b428b61..996462dcd 100644 --- a/include/controllers/default/cockpit2/api/restaurant/edit/index.php +++ b/include/controllers/default/cockpit2/api/restaurant/edit/index.php @@ -28,6 +28,9 @@ class Controller_api_restaurant_edit extends Crunchbutton_Controller_RestAccount case 'notifications': $this->_notifications(); break; + case 'menu': + $this->_menu(); + break; } } @@ -86,6 +89,17 @@ class Controller_api_restaurant_edit extends Crunchbutton_Controller_RestAccount } } + private function _menu(){ + switch ( $this->method() ) { + case 'post': + // $this->_menuSave(); + break; + case 'get': + $this->_menuExport(); + break; + } + } + private function _basicExport(){ $community = $this->restaurant->community()->get( 0 ); @@ -165,6 +179,15 @@ class Controller_api_restaurant_edit extends Crunchbutton_Controller_RestAccount $this->_return( $out ); } + private function _menuExport(){ + $out = [ 'id_restaurant' => $this->restaurant->id_restaurant, 'permalink' => $this->restaurant->permalink ]; + $out['categories'] = []; + foreach ( $this->restaurant->categories( ) as $category ) { + $out['categories'][] = $category->exports(); + } + $this->_return( $out ); + } + private function _return( $out ){ foreach( $out as $key => $val ){ if( is_numeric( $val ) ){ diff --git a/include/library/Cockpit/Category.php b/include/library/Cockpit/Category.php new file mode 100644 index 000000000..52fd57476 --- /dev/null +++ b/include/library/Cockpit/Category.php @@ -0,0 +1,5 @@ + $value ) { + if( is_numeric( $value ) ){ + $out[ $key ] = floatval( $value ); + } + } + return $out; + } +} \ No newline at end of file diff --git a/include/library/Cockpit/Option.php b/include/library/Cockpit/Option.php new file mode 100644 index 000000000..8732c016f --- /dev/null +++ b/include/library/Cockpit/Option.php @@ -0,0 +1,13 @@ +properties(); + $out['price'] = floatval( $out['price'] ); + $out['prices'] = []; + foreach ($this->prices() as $price) { + $out['prices'][$price->id_option_price] = $price->exports(); + } + return $out; + } +} \ No newline at end of file diff --git a/include/library/Cockpit/Restaurant.php b/include/library/Cockpit/Restaurant.php index 1edaf833d..72a9b1e74 100644 --- a/include/library/Cockpit/Restaurant.php +++ b/include/library/Cockpit/Restaurant.php @@ -46,7 +46,7 @@ class Cockpit_Restaurant extends Crunchbutton_Restaurant { WHERE o.id_restaurant = ? ' . $interval . ' )'; $keys[] = $this->id_restaurant; $keys[] = $this->id_restaurant; - + } else { $query = 'SELECT COUNT(*) AS total FROM `order` o @@ -61,7 +61,7 @@ class Cockpit_Restaurant extends Crunchbutton_Restaurant { ORDER BY oa.id_order_action) actions ON actions.id_order = o.id_order AND actions.id_order_action = oa.id_order_action WHERE o.id_restaurant = ? ' . $interval; - + $keys[] = $status; $keys[] = $this->id_restaurant; } diff --git a/include/library/Crunchbutton/Dish.php b/include/library/Crunchbutton/Dish.php index e454c39fa..4def43926 100644 --- a/include/library/Crunchbutton/Dish.php +++ b/include/library/Crunchbutton/Dish.php @@ -9,7 +9,7 @@ class Crunchbutton_Dish extends Cana_Table_Trackchange { if( floatval( $option->price ) > 0 ){ $out['changeable_price'] = true; } - + $opts = $option->exports(); $opts['default'] = $opts['default'] ? true : false; $out['_options'][] = $opts; diff --git a/include/views/default/cockpit2/frontend/listview/listview-restaurants.phtml b/include/views/default/cockpit2/frontend/listview/listview-restaurants.phtml index 5bd554b9f..7d51c17af 100644 --- a/include/views/default/cockpit2/frontend/listview/listview-restaurants.phtml +++ b/include/views/default/cockpit2/frontend/listview/listview-restaurants.phtml @@ -68,11 +68,11 @@ - edit - +
+ edit (working in progress) diff --git a/include/views/default/cockpit2/frontend/restaurants/restaurants-edit-menu.phtml b/include/views/default/cockpit2/frontend/restaurants/restaurants-edit-menu.phtml new file mode 100644 index 000000000..7c36e3195 --- /dev/null +++ b/include/views/default/cockpit2/frontend/restaurants/restaurants-edit-menu.phtml @@ -0,0 +1,175 @@ +
+ +
+ +
+
+

Menu

+
+
+ +
+
+
+
+
+ +
+
+
+

+ {{category.name}} + New Category +

+
+
+ + + + +
+
+
+
+ +
+ +
    + +
  • +
    +
    + Required. +
    +
  • + +
  • +
    +
    + Required. +
    +
  • + +
  • +
    + +
    +
    + Required. +
    +
  • + +
  • + + + + + + +
  • +
+ +
+ +
    + +
  • +
    +
    + Required. +
    +
    60 characters
    +
  • +
  • +
    Expanded view when added to cart
    +
    + +
    +
    + Required. +
    +
    + For when you want the user to see options, like sizes and pizza toppings +
    +
  • +
  • +
    Show star
    +
    + +
    +
    + Required. +
    +
    + Usually just for items in the first category on the menu +
    +
  • +
+
+ +
+ + + +
    + +
  • +
    +
    + Required. +
    +
  • + +
  • +
    +
    + Required. +
    +
  • + +
  • +
    + +
    +
    + Required. +
    +
  • + +
  • + + + + + + +
  • + +
+
+
+
+
+ + +
+
+ +
+
+ +
+ +
+
+
    +
  • + +
  • +
  • + +
  • +
+
+
+
diff --git a/include/views/default/cockpit2/frontend/restaurants/restaurants-edit-notifications.phtml b/include/views/default/cockpit2/frontend/restaurants/restaurants-edit-notifications.phtml index 0a9a6ae6c..ad3e52167 100644 --- a/include/views/default/cockpit2/frontend/restaurants/restaurants-edit-notifications.phtml +++ b/include/views/default/cockpit2/frontend/restaurants/restaurants-edit-notifications.phtml @@ -4,8 +4,6 @@
- -

Notifications

@@ -29,7 +27,6 @@ Required.
-
diff --git a/include/views/default/cockpit2/frontend/restaurants/restaurants-edit.phtml b/include/views/default/cockpit2/frontend/restaurants/restaurants-edit.phtml index 2840b06c3..ff310ad95 100644 --- a/include/views/default/cockpit2/frontend/restaurants/restaurants-edit.phtml +++ b/include/views/default/cockpit2/frontend/restaurants/restaurants-edit.phtml @@ -9,11 +9,12 @@
- + +
diff --git a/www/assets/cockpit/js/controllers.restaurant.js b/www/assets/cockpit/js/controllers.restaurant.js index 339758e70..a57a81640 100644 --- a/www/assets/cockpit/js/controllers.restaurant.js +++ b/www/assets/cockpit/js/controllers.restaurant.js @@ -456,6 +456,7 @@ NGApp.controller('RestaurantEditCtrl', function ( $scope, $rootScope, $routePara $scope.editDelivery = function(){}; $scope.editNotes = function(){}; $scope.editNotifications = function(){}; + $scope.editMenu = function(){}; reset(); @@ -517,6 +518,39 @@ NGApp.controller('RestaurantEditNotificationsCtrl', function ( $scope, Restauran }); +NGApp.controller('RestaurantEditMenuCtrl', function ( $scope, RestaurantEditService ) { + + $scope.yesNo = RestaurantEditService.yesNo(); + $scope.active = RestaurantEditService.active(); + + var load = function(){ + + RestaurantEditService.load.menu( RestaurantEditService.permalink, function( json ) { + $scope.restaurant = json; + $scope.loading = false; + } ); + } + + $scope.save = function(){ + if( $scope.restaurant.id_restaurant ){ + + } else { + App.alert( 'Something wrong!' ); + } + } + + $scope.addNotification = function(){ + if( $scope.restaurant.id_restaurant ){ + if( !$scope.restaurant.menu ){ + $scope.restaurant.menu = []; + } + $scope.restaurant.menu.push( { type: 'sms', value: null, active: true } ); + } + } + + load(); + +}); NGApp.controller('RestaurantEditDeliveryCtrl', function ( $scope, RestaurantEditService ) { diff --git a/www/assets/cockpit/js/service.restaurant.js b/www/assets/cockpit/js/service.restaurant.js index 9556bcfbf..2f29d8865 100644 --- a/www/assets/cockpit/js/service.restaurant.js +++ b/www/assets/cockpit/js/service.restaurant.js @@ -369,6 +369,11 @@ NGApp.factory( 'RestaurantEditService', function( $rootScope, $resource, $routeP load.get( { 'permalink': permalink, 'action': 'notifications' }, function( data ){ callback( data ); } ); + }, + menu : function( permalink, callback ){ + load.get( { 'permalink': permalink, 'action': 'menu' }, function( data ){ + callback( data ); + } ); } } @@ -379,6 +384,13 @@ NGApp.factory( 'RestaurantEditService', function( $rootScope, $resource, $routeP return options; } + service.active = function(){ + var options = []; + options.push( { value: true, label: 'Active' } ); + options.push( { value: false, label: 'Inactive' } ); + return options; + } + service.timezones = function(){ var timezones = []; timezones.push( { value: 'America/New_York', label: 'Eastern' } ); diff --git a/www/assets/cockpit/scss/cockpit.scss b/www/assets/cockpit/scss/cockpit.scss index 48ca799ee..3cafd9570 100644 --- a/www/assets/cockpit/scss/cockpit.scss +++ b/www/assets/cockpit/scss/cockpit.scss @@ -1089,6 +1089,17 @@ input { color: #5d5f63; margin-top: 1em; } + .inputs-group-dish .li-input-dish{ + width:22%; + float:left; + margin-right:1em; + } + + .dish-option-group{ + margin-left:2em; + border-left: 3px solid #CCC; + padding-left:1em; + } .li-input-disabled input[type="checkbox"].switch + div { background: #CCC !important;