Skip to content

Commit

Permalink
Merge pull request #20 from fleetbase/dev-v0.3.5
Browse files Browse the repository at this point in the history
v0.3.5
  • Loading branch information
roncodes authored Mar 12, 2024
2 parents da534ce + 25ed8c2 commit 2fec007
Show file tree
Hide file tree
Showing 10 changed files with 296 additions and 290 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fleetbase/storefront-api",
"version": "0.3.4",
"version": "0.3.5",
"description": "Headless Commerce & Marketplace Extension for Fleetbase",
"keywords": [
"fleetbase-extension",
Expand All @@ -22,8 +22,8 @@
],
"require": {
"php": "^8.0",
"fleetbase/core-api": "^1.4.11",
"fleetbase/fleetops-api": "^0.4.17",
"fleetbase/core-api": "^1.4.12",
"fleetbase/fleetops-api": "^0.4.18",
"geocoder-php/google-maps-places-provider": "^1.4",
"laravel-notification-channels/apn": "^5.0",
"laravel-notification-channels/fcm": "^4.1",
Expand All @@ -44,7 +44,7 @@
"autoload": {
"psr-4": {
"Fleetbase\\Storefront\\": "server/src/",
"Fleetbase\\Storefront\\Seeders\\": "seeders/"
"Fleetbase\\Storefront\\Seeders\\": "server/seeders/"
}
},
"autoload-dev": {
Expand Down
2 changes: 1 addition & 1 deletion extension.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Storefront",
"version": "0.3.4",
"version": "0.3.5",
"description": "Headless Commerce & Marketplace Extension for Fleetbase",
"repository": "https://github.com/fleetbase/storefront",
"license": "MIT",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fleetbase/storefront-engine",
"version": "0.3.4",
"version": "0.3.5",
"description": "Headless Commerce & Marketplace Extension for Fleetbase",
"fleetbase": {
"route": "storefront",
Expand Down Expand Up @@ -43,9 +43,9 @@
"publish:github": "npm config set '@fleetbase:registry' https://npm.pkg.github.com/ && npm publish"
},
"dependencies": {
"@fleetbase/ember-core": "^0.2.5",
"@fleetbase/ember-core": "^0.2.6",
"@fleetbase/ember-ui": "^0.2.11",
"@fleetbase/fleetops-data": "^0.1.12",
"@fleetbase/fleetops-data": "^0.1.13",
"@babel/core": "^7.23.2",
"@fortawesome/ember-fontawesome": "^0.4.1",
"@fortawesome/fontawesome-svg-core": "^6.4.0",
Expand Down
19 changes: 9 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

251 changes: 2 additions & 249 deletions server/seeders/OrderConfigSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

namespace Fleetbase\Storefront\Seeders;

use Fleetbase\FleetOps\Models\OrderConfig;
use Fleetbase\Models\Company;
use Fleetbase\Storefront\Support\Storefront;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;

class OrderConfigSeeder extends Seeder
{
Expand All @@ -18,253 +17,7 @@ public function run()
{
$companies = Company::all();
foreach ($companies as $company) {
static::createStorefrontConfig($company);
Storefront::createStorefrontConfig($company);
}
}

/**
* Creates or retrieves an existing storefront configuration for a given company.
*
* This method checks if a storefront configuration (OrderConfig) already exists for the given company.
* If it exists, the method returns the existing configuration. Otherwise, it creates a new configuration with
* predefined settings for a storefront order process. The configuration includes various stages like 'created',
* 'started', 'canceled', 'completed', etc., each defined with specific attributes like key, code, color, logic,
* events, status, actions, details, and more. These stages help manage the order lifecycle in a storefront context.
*
* @param Company $company The company for which the storefront configuration is being created or retrieved.
* @return OrderConfig The storefront order configuration associated with the specified company.
*/
public static function createStorefrontConfig(Company $company): OrderConfig
{
return OrderConfig::firstOrCreate(
[
'company_uuid' => $company->uuid,
'key' => 'storefront',
'namespace' => 'system:order-config:storefront',
],
[
'name' => 'Storefront',
'key' => 'storefront',
'namespace' => 'system:order-config:storefront',
'description' => 'Storefront order configuration for hyperlocal delivery and pickup',
'core_service' => 1,
'status' => 'private',
'version' => '0.0.1',
'tags' => ['storefront', 'ecommerce', 'hyperlocal'],
'entities' => [],
'meta' => [],
'flow' => [
'created' => [
'key' => 'created',
'code' => 'created',
'color' => '#1f2937',
'logic' => [],
'events' => [],
'status' => 'Order Created',
'actions' => [],
'details' => 'New order was created.',
'options' => [],
'complete' => false,
'entities' => [],
'sequence' => 0,
'activities' => ['dispatched'],
'internalId' => Str::uuid(),
'pod_method' => 'scan',
'require_pod' => false,
],
'started' => [
'key' => 'started',
'code' => 'started',
'color' => '#1f2937',
'logic' => [],
'events' => [],
'status' => 'Order Started',
'actions' => [],
'details' => 'Order has been started',
'options' => [],
'complete' => false,
'entities' => [],
'sequence' => 0,
'activities' => ['canceled', 'preparing'],
'internalId' => Str::uuid(),
'pod_method' => 'scan',
'require_pod' => false,
],
'canceled' => [
'key' => 'canceled',
'code' => 'canceled',
'color' => '#1f2937',
'logic' => [],
'events' => ['order.canceled'],
'status' => 'Order canceled',
'actions' => [],
'details' => 'Order could not be accepted',
'options' => [],
'complete' => false,
'entities' => [],
'sequence' => 0,
'activities' => [],
'internalId' => Str::uuid(),
'pod_method' => 'scan',
'require_pod' => false,
],
'completed' => [
'key' => 'completed',
'code' => 'completed',
'color' => '#1f2937',
'logic' => [],
'events' => [],
'status' => 'Order completed',
'actions' => [],
'details' => 'Driver has completed the order',
'options' => [],
'complete' => true,
'entities' => [],
'sequence' => 0,
'activities' => [],
'internalId' => Str::uuid(),
'pod_method' => 'scan',
'require_pod' => false,
],
'picked_up' => [
'key' => 'completed',
'code' => 'picked_up',
'color' => '#1f2937',
'logic' => [],
'events' => [],
'status' => 'Order picked up',
'actions' => [],
'details' => 'Order has been picked up by customer',
'options' => [],
'complete' => true,
'entities' => [],
'sequence' => 0,
'activities' => [],
'internalId' => Str::uuid(),
'pod_method' => 'scan',
'require_pod' => false,
],
'preparing' => [
'key' => 'preparing',
'code' => 'preparing',
'color' => '#1f2937',
'logic' => [],
'events' => [],
'status' => 'Order is being prepared',
'actions' => [],
'details' => 'Order has been received by {storefront.name} and is being prepared',
'options' => [],
'complete' => false,
'entities' => [],
'sequence' => 0,
'activities' => ['driver_enroute_to_store', 'pickup_ready'],
'internalId' => Str::uuid(),
'pod_method' => 'scan',
'require_pod' => false,
],
'dispatched' => [
'key' => 'dispatched',
'code' => 'dispatched',
'color' => '#1f2937',
'logic' => [],
'events' => [],
'status' => 'Order Dispatched',
'actions' => [],
'details' => 'Order has been dispatched.',
'options' => [],
'complete' => false,
'entities' => [],
'sequence' => 0,
'activities' => ['started'],
'internalId' => Str::uuid(),
'pod_method' => 'scan',
'require_pod' => false,
],
'pickup_ready' => [
'key' => 'ready',
'code' => 'pickup_ready',
'color' => '#1f2937',
'logic' => [
[
'type' => 'if',
'conditions' => [
[
'field' => 'meta.is_pickup',
'value' => 'true',
'operator' => 'equal',
],
],
],
],
'events' => [],
'status' => 'Order is ready for pickup',
'actions' => [],
'details' => 'Order is ready to be picked up by customer',
'options' => [],
'complete' => false,
'entities' => [],
'sequence' => 0,
'activities' => ['picked_up'],
'internalId' => Str::uuid(),
'pod_method' => 'scan',
'require_pod' => false,
],
'driver_enroute' => [
'key' => 'driver_enroute',
'code' => 'driver_enroute',
'color' => '#1f2937',
'logic' => [],
'events' => [],
'status' => 'Driver en-route',
'actions' => [],
'details' => 'Driver is on the way to the customer',
'options' => [],
'complete' => false,
'entities' => [],
'sequence' => 0,
'activities' => ['completed'],
'internalId' => Str::uuid(),
'pod_method' => 'scan',
'require_pod' => false,
],
'driver_picked_up' => [
'key' => 'driver_picked_up',
'code' => 'driver_picked_up',
'color' => '#1f2937',
'logic' => [],
'events' => [],
'status' => 'Driver picked up',
'actions' => [],
'details' => 'Driver has picked up order',
'options' => [],
'complete' => false,
'entities' => [],
'sequence' => 0,
'activities' => ['driver_enroute'],
'internalId' => Str::uuid(),
'pod_method' => 'scan',
'require_pod' => false,
],
'driver_enroute_to_store' => [
'key' => 'driver_enroute',
'code' => 'driver_enroute_to_store',
'color' => '#1f2937',
'logic' => [],
'events' => [],
'status' => 'Driver en-route',
'actions' => [],
'details' => 'Driver en-route to store',
'options' => [],
'complete' => false,
'entities' => [],
'sequence' => 0,
'activities' => ['driver_picked_up'],
'internalId' => Str::uuid(),
'pod_method' => 'scan',
'require_pod' => false,
],
],
]
);
}
}
Loading

0 comments on commit 2fec007

Please sign in to comment.