diff --git a/cli/dbbackup.php b/cli/dbbackup.php new file mode 100755 index 000000000..736f1fb0e --- /dev/null +++ b/cli/dbbackup.php @@ -0,0 +1,30 @@ +#!/usr/local/bin/php +db->{c::app()->env()}; + +$cmd[] = 'rm '.$file; +$cmd[] = $dump.' -q -u '.$connect->user.' -p'.$connect->pass.' '.$connect->db.' > '.$file; +$cmd[] = 'sed "s/\`devin\`@\`%\`/\`root\`@\`localhost\`/g" '.$file.' > '.$file.'tmp'; +$cmd[] = 'mv '.$file.'tmp '.$file; + +foreach ($cmd as $c) { + echo $c; + exec($c); +} + diff --git a/cli/dbbackup.sh b/cli/dbbackup.sh new file mode 100755 index 000000000..2972d9bdd --- /dev/null +++ b/cli/dbbackup.sh @@ -0,0 +1,3 @@ +#!/bin/sh +cd /home/cockpit.crunchbutton/cli && /home/cockpit.crunchbutton/cli/dbbackup.php -e=live +mv /home/cockpit.crunchbutton/db/backup.sql /home/backup/latest.sql diff --git a/include/config/config.xml b/include/config/config.xml index 1de9ec2c5..a1c4cd7b8 100755 --- a/include/config/config.xml +++ b/include/config/config.xml @@ -13,14 +13,14 @@ ***REMOVED*** ***REMOVED*** crunchbutton - localhost + _DOMAIN_ ***REMOVED*** ***REMOVED*** crunchbutton_dev - localhost + _DOMAIN_ diff --git a/include/controllers/default/cockpit/drivers/index.php b/include/controllers/default/cockpit/drivers/index.php index 167f5c274..18e01fc54 100644 --- a/include/controllers/default/cockpit/drivers/index.php +++ b/include/controllers/default/cockpit/drivers/index.php @@ -24,6 +24,8 @@ class Controller_drivers extends Crunchbutton_Controller_Account { if ( c::admin()->permission()->check( [ 'global','drivers-all', 'drivers-page' ] ) ) { c::view()->page = 'drivers'; c::view()->display( 'drivers/index' ); + } else { + c::view()->display( 'home/index' ); } break; } diff --git a/include/controllers/default/cockpit2/api/driverorders/index.php b/include/controllers/default/cockpit2/api/driverorders/index.php new file mode 100644 index 000000000..83dd1adcb --- /dev/null +++ b/include/controllers/default/cockpit2/api/driverorders/index.php @@ -0,0 +1,34 @@ + $order->id_order, + 'lastStatus' => $order->deliveryLastStatus(), + 'name' => $order->name, + 'phone' => $order->phone, + 'date' => $order->date(), + 'restaurant' => $order->restaurant()->name, + ]); + } + +// if( !$justMineOrders || ( $justMineOrders && $order->lastStatus[ 'id_admin' ] == c::admin()->id_admin ) ){ + + usort($exports, function($a, $b) { + if ($a->lastStatus['status'] == $b->lastStatus['status']) { + return $a->id_order < $b->id_order; + } + return ($a->lastStatus['order'] > $b->lastStatus['order']); + }); + + echo json_encode($exports); + + } +} \ No newline at end of file diff --git a/include/controllers/default/cockpit2/api/orders/index.php b/include/controllers/default/cockpit2/api/orders/index.php deleted file mode 100644 index 6f51e1fec..000000000 --- a/include/controllers/default/cockpit2/api/orders/index.php +++ /dev/null @@ -1,7 +0,0 @@ -escape($email).'" + AND pass="'.c::db()->escape($password).'" + AND active=1 + LIMIT 1'; return Admin::q($query)->get(0); diff --git a/include/library/Crunchbutton/App.php b/include/library/Crunchbutton/App.php index 1ae885d19..9d1bad9ac 100755 --- a/include/library/Crunchbutton/App.php +++ b/include/library/Crunchbutton/App.php @@ -35,6 +35,8 @@ class Crunchbutton_App extends Cana_App { case 'cockpit.crunchr.co': case 'cockpit._DOMAIN_': case 'cbtn.io': + case 'cockpit.la': + case 'dispatch.la': $env = 'live'; break; case 'wenzel.beta.crunchr.co': @@ -65,6 +67,8 @@ class Crunchbutton_App extends Cana_App { case '_DOMAIN_': case 'staging._DOMAIN_': case 'spicywithdelivery.com': + case 'cockpit.la': + case 'dispatch.la': $isStaging = true; $params['env'] = 'live'; break; @@ -110,6 +114,11 @@ class Crunchbutton_App extends Cana_App { $_SERVER['SERVER_NAME'] = '_DOMAIN_'; $host_callback = 'staging.crunchr.co'; break; + case '/Users/arzynik/Sites/crunchbutton/include/library/Crunchbutton': + $params['env'] = 'local'; + $_SERVER['SERVER_NAME'] = 'crunchbutton.localhost'; + $host_callback = 'crunchbutton.localhost'; + break; default: if (getenv('TRAVIS')) { $params['env'] = 'travis'; @@ -182,13 +191,11 @@ class Crunchbutton_App extends Cana_App { $config = $this->config(); $config->site = Crunchbutton_Site::byDomain(); - - if ($config->site->name == 'redirect' && $config->site->theme) { header('Location: '.$config->site->theme.$_SERVER['REQUEST_URI']); exit; } - + if ($config->site->name == 'Cockpit' || $config->site->name == 'Cockpit2') { array_unshift($GLOBALS['config']['libraries'], 'Cockpit'); } @@ -219,7 +226,7 @@ class Crunchbutton_App extends Cana_App { $this->buildAuth($this->db()); - if ($params['env'] != 'local' && $_SERVER['SERVER_NAME'] != 'dev.crunchr.co') { + if ($params['env'] != 'local' && $_SERVER['SERVER_NAME'] != 'dev.crunchr.co' && $_SERVER['SERVER_NAME'] != 'cockpit.la') { $config->bundle = true; } diff --git a/include/views/default/cockpit2/bundle/js.phtml b/include/views/default/cockpit2/bundle/js.phtml index 87230f773..027ca4ee2 100644 --- a/include/views/default/cockpit2/bundle/js.phtml +++ b/include/views/default/cockpit2/bundle/js.phtml @@ -38,4 +38,5 @@ - \ No newline at end of file + + diff --git a/include/views/default/cockpit2/frontend/drivers-orders.phtml b/include/views/default/cockpit2/frontend/drivers-orders.phtml new file mode 100644 index 000000000..fd7506e73 --- /dev/null +++ b/include/views/default/cockpit2/frontend/drivers-orders.phtml @@ -0,0 +1,49 @@ +
+ +
+
+ In order to receive payment for orders that you deliver, you MUST confirm all orders that you've delivered. + Make sure your orders are confirmed and delivered! +
+ +
Last Updated: just now
+ +
+
+
+ + Delivered by {{order.lastStatus.name}} + Picked up by {{order.lastStatus.name}} + Accepted by {{order.lastStatus.name}} + + + +
+ + + +
+ +
+
{{order.date.date | date:'M/d'}}
+
{{order.date.date | date:'h/m'}}
+
{{order.date.date | date:'a'}}
+
+
+
+ {{order.restaurant}} +
+
+ {{order.name}} +
+
+
+
+
+ +
+ You currently have no orders to deliver. +
+
+ +
diff --git a/include/views/default/cockpit2/frontend/drivers-shifts.phtml b/include/views/default/cockpit2/frontend/drivers-shifts.phtml new file mode 100644 index 000000000..0de16e0b1 --- /dev/null +++ b/include/views/default/cockpit2/frontend/drivers-shifts.phtml @@ -0,0 +1,4 @@ +
+ + +shifts \ No newline at end of file diff --git a/include/views/default/cockpit2/layout/html.body.phtml b/include/views/default/cockpit2/layout/html.body.phtml index bffdc3a8d..e864621a9 100644 --- a/include/views/default/cockpit2/layout/html.body.phtml +++ b/include/views/default/cockpit2/layout/html.body.phtml @@ -1,7 +1,23 @@ -{{navigation.page}}
    +
  • + + + + + +
    Orders
    +
  • +
  • + + + + + +
    Shifts
    +
  • + @@ -66,10 +82,11 @@
    + */ ?>
  • - +
    Sign Out
    @@ -77,7 +94,13 @@
-
+
+
+

We will soon have a chat feature that goes to support here. Until then, text us at:

(646) 783-1444 +

+
+ +
@@ -87,10 +110,27 @@
@@ -112,31 +152,32 @@