From 661e048206287b5622a3c3c92e6ee0c9124c77b2 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Tue, 16 Jun 2020 03:58:39 +0000 Subject: [PATCH 1/2] Add checking for rider availability when saving JO. #422 --- src/Service/JobOrderHandler/CMBJobOrderHandler.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Service/JobOrderHandler/CMBJobOrderHandler.php b/src/Service/JobOrderHandler/CMBJobOrderHandler.php index 862d431b..03f84e44 100644 --- a/src/Service/JobOrderHandler/CMBJobOrderHandler.php +++ b/src/Service/JobOrderHandler/CMBJobOrderHandler.php @@ -544,6 +544,10 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface if (empty($rider)) { $error_array['rider'] = 'Invalid rider specified.'; + } else { + // check if rider is still available + if (!($rider->isAvailable())) + $error_array['rider'] = 'Selected rider is unavailable.'; } } } From 0a06a7ad31b9b17f93dcefb622813ade74064267 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Wed, 17 Jun 2020 08:49:52 +0000 Subject: [PATCH 2/2] Add command to copy the config and messages files. #426 --- composer.lock | 14 +- resq_settings/cmb/menu.yaml | 179 +++++++++++++++++++ resq_settings/cmb/messages.en.yaml | 27 +++ resq_settings/cmb/services.yaml | 246 +++++++++++++++++++++++++++ resq_settings/resq/menu.yaml | 186 ++++++++++++++++++++ resq_settings/resq/messages.en.yaml | 27 +++ resq_settings/resq/services.yaml | 244 ++++++++++++++++++++++++++ src/Command/ConfigureResqCommand.php | 55 ++++++ 8 files changed, 971 insertions(+), 7 deletions(-) create mode 100644 resq_settings/cmb/menu.yaml create mode 100644 resq_settings/cmb/messages.en.yaml create mode 100644 resq_settings/cmb/services.yaml create mode 100644 resq_settings/resq/menu.yaml create mode 100644 resq_settings/resq/messages.en.yaml create mode 100644 resq_settings/resq/services.yaml create mode 100644 src/Command/ConfigureResqCommand.php diff --git a/composer.lock b/composer.lock index 1e76e914..3d02c0bb 100644 --- a/composer.lock +++ b/composer.lock @@ -1,7 +1,7 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], "content-hash": "f03b92d48946e8b2ee19466f931c826f", @@ -3214,20 +3214,20 @@ }, { "name": "symfony/filesystem", - "version": "v4.4.4", + "version": "v4.4.10", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "266c9540b475f26122b61ef8b23dd9198f5d1cfd" + "reference": "b27f491309db5757816db672b256ea2e03677d30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/266c9540b475f26122b61ef8b23dd9198f5d1cfd", - "reference": "266c9540b475f26122b61ef8b23dd9198f5d1cfd", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b27f491309db5757816db672b256ea2e03677d30", + "reference": "b27f491309db5757816db672b256ea2e03677d30", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": ">=7.1.3", "symfony/polyfill-ctype": "~1.8" }, "type": "library", @@ -3260,7 +3260,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2020-01-21T08:20:44+00:00" + "time": "2020-05-30T18:50:54+00:00" }, { "name": "symfony/finder", diff --git a/resq_settings/cmb/menu.yaml b/resq_settings/cmb/menu.yaml new file mode 100644 index 00000000..9f28b315 --- /dev/null +++ b/resq_settings/cmb/menu.yaml @@ -0,0 +1,179 @@ +main_menu: + - id: home + acl: dashboard.menu + label: Dashboard + icon: flaticon-line-graph + - id: user + acl: user.menu + label: User + icon: flaticon-users + - id: user_list + acl: user.list + label: Users + parent: user + - id: role_list + acl: role.list + label: Roles + parent: user + + - id: apiuser + acl: apiuser.menu + label: API User + icon: flaticon-users + - id: api_user_list + acl: apiuser.list + label: API Users + parent: apiuser + - id: api_role_list + acl: apirole.list + label: API Roles + parent: apiuser + + - id: logistics + acl: logistics.menu + label: Logistics + icon: fa fa-truck + - id: rider_list + acl: rider.list + label: Riders + parent: logistics + - id: service_charge_list + acl: service_charge.list + label: Service Charges + parent: logistics + + - id: battery + acl: battery.menu + label: Battery + icon: fa fa-battery-3 + - id: battery_list + acl: battery.list + label: Batteries + parent: battery + - id: bmfg_list + acl: bmfg.list + label: Manufacturers + parent: battery + - id: bmodel_list + acl: bmodel.list + label: Models + parent: battery + - id: bsize_list + acl: bsize.list + label: Sizes + parent: battery + - id: promo_list + acl: promo.list + label: Promos + parent: battery + + - id: vehicle + acl: vehicle.menu + label: Vehicle + icon: fa fa-car + - id: vehicle_list + acl: vehicle.list + label: Vehicles + parent: vehicle + - id: vmfg_list + acl: vmfg.list + label: Manufacturers + parent: vehicle + + - id: location + acl: location.menu + label: Location + icon: fa fa-home + - id: outlet_list + acl: outlet.menu + label: Outlet + parent: location + - id: hub_list + acl: hub.menu + label: Hub + parent: location + - id: geofence_list + acl: geofence.menu + label: Geofence + parent: location + + + - id: joborder + acl: joborder.menu + label: Job Order + icon: flaticon-calendar-3 + - id: jo_onestep_form + acl: jo_onestep.form + label: One-step Process + parent: joborder + - id: jo_walkin_form + acl: jo_walkin.form + label: Walk-in + parent: joborder + - id: jo_open + acl: jo_open.list + label: Open + parent: joborder + - id: jo_all + acl: jo_all.list + label: View All + parent: joborder + + - id: support + acl: support.menu + label: Customer Support + icon: flaticon-support + - id: customer_list + acl: customer.list + label: Customers + parent: support + - id: ticket_list + acl: ticket.list + label: Tickets + parent: support + - id: general_search + acl: general.search + label: Search + parent: support + - id: warranty_search + acl: warranty.search + label: Customer Battery Search + parent: support + - id: privacy_policy_list + acl: privacy_policy.list + label: Privacy Policy + parent: support + - id: warranty_list + acl: warranty.list + label: Warranty + parent: support + - id: warranty_upload + acl: warranty.upload + label: Warranty Upload + parent: support + - id: static_content_list + acl: static_content.list + label: Static Content + parent: support + + - id: service + acl: service.menu + label: Other Services + icon: flaticon-squares + - id: service_list + acl: service.list + label: Services + parent: service + + - id: partner + acl: partner.menu + label: Partners + icon: flaticon-network + - id: partner_list + acl: partner.list + label: Partners + parent: partner + - id: review_list + acl: review.list + label: Reviews + parent: partner diff --git a/resq_settings/cmb/messages.en.yaml b/resq_settings/cmb/messages.en.yaml new file mode 100644 index 00000000..3e12543b --- /dev/null +++ b/resq_settings/cmb/messages.en.yaml @@ -0,0 +1,27 @@ +# text +title_login: Res-Q for CMB | Login +block_title: Res-Q for CMB +control_panel_sign_in: Sign-in to Control Panel +alt_image_logo_login: Res-Q for CMB +alt_image_dashboard: Res-Q for CMB +copyright: Res-Q for CMB +battery_size_tradein_brand: Trade-in Motolite +battery_size_tradein_premium: Trade-in Premium +battery_size_tradein_other: Trade-in Other +add_cust_vehicle_battery_info: This vehicle is using a Motolite battery +jo_title_pdf: Res-Q for CMB Job Order +country_code_prefix: '+60' +delivery_instructions_label: 'CarFix Details' + +# images +image_logo_login: /assets/images/black-text-logo-01.png +icon_login: /assets/images/battery-assist-bm-logo-32x32.png +icon_base_32x32: /assets/images/black-text-logo-01-32x32.png +icon_base_16x16: /assets/images/black-text-logo-01-16x16.png +image_dashboard: /assets/images/century_logo.png +image_jo_pdf: /public/assets/images/black-text-logo-01-115x115.png + +# default point for maps +default_lat: 3.084216 +default_long: 101.6129996 +default_region: my diff --git a/resq_settings/cmb/services.yaml b/resq_settings/cmb/services.yaml new file mode 100644 index 00000000..3d9fd7a3 --- /dev/null +++ b/resq_settings/cmb/services.yaml @@ -0,0 +1,246 @@ +# Put parameters here that don't need to change on each machine where the app is deployed +# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration +parameters: + map_default: + latitude: 14.6091 + longitude: 121.0223 + image_upload_directory: '%kernel.project_dir%/public/uploads' + jo_extra_upload_directory: '%kernel.project_dir%/public/uploads/jo_extra' + job_order_refresh_interval: 300000 + api_acl_file: 'api_acl.yaml' + api_access_key: 'api_access_keys' + app_acl_file: 'acl.yaml' + app_access_key: 'access_keys' + cvu_brand_id: "%env(CVU_BRAND_ID)%" + country_code: "%env(COUNTRY_CODE)%" + api_version: "%env(API_VERSION)%" + +services: + # default configuration for services in *this* file + _defaults: + autowire: true # Automatically injects dependencies in your services. + autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. + public: false # Allows optimizing the container by removing unused services; this also means + # fetching services directly from the container via $container->get() won't work. + # The best practice is to be explicit about your dependencies anyway. + + # makes classes in src/ available to be used as services + # this creates a service per class whose id is the fully-qualified class name + App\: + resource: '../src/*' + exclude: '../src/{Entity,Migrations,Tests,Menu,Access}' + + # controllers are imported separately to make sure services can be injected + # as action arguments even if you don't extend any base controller class + App\Controller\: + resource: '../src/Controller' + tags: ['controller.service_arguments'] + + # add more service definitions when explicit configuration is needed + # please note that last definitions always *replace* previous ones + App\Menu\Generator: + arguments: + $router: "@router.default" + $cache_dir: "%kernel.cache_dir%" + $config_dir: "%kernel.root_dir%/../config" + + Catalyst\AuthBundle\Service\ACLGenerator: + arguments: + $router: "@router.default" + $cache_dir: "%kernel.cache_dir%" + $config_dir: "%kernel.root_dir%/../config" + $acl_file: "%app_acl_file%" + + Catalyst\AuthBundle\Service\ACLVoter: + arguments: + $user_class: "App\\Entity\\User" + tags: ['security.voter'] + + Catalyst\AuthBundle\Service\UserChecker: + + App\Service\FileUploader: + arguments: + $target_dir: '%image_upload_directory%' + + App\Service\MapTools: + arguments: + $em: "@doctrine.orm.entity_manager" + $gmaps_api_key: "%env(GMAPS_API_KEY)%" + $cust_dist_limit: "%env(CUST_DISTANCE_LIMIT)%" + + App\Service\RisingTideGateway: + arguments: + $em: "@doctrine.orm.entity_manager" + $user: "%env(RT_USER)%" + $pass: "%env(RT_PASS)%" + $usage_type: "%env(RT_USAGE_TYPE)%" + $shortcode: "%env(RT_SHORTCODE)%" + $dr_url: "https://resqaws.jankstudio.com/sms/delivery_receipt" + + App\Service\MQTTClient: + arguments: + $redis_client: "@App\\Service\\RedisClientProvider" + $key: "mqtt_events" + + App\Service\APNSClient: + arguments: + $redis_client: "@App\\Service\\RedisClientProvider" + + App\Service\RedisClientProvider: + arguments: + $scheme: "%env(REDIS_CLIENT_SCHEME)%" + $host: "%env(REDIS_CLIENT_HOST)%" + $port: "%env(REDIS_CLIENT_PORT)%" + $password: "%env(REDIS_CLIENT_PASSWORD)%" + + App\Service\GeofenceTracker: + arguments: + $geofence_flag: "%env(GEOFENCE_ENABLE)%" + + App\Service\WarrantyHandler: + arguments: + $em: "@doctrine.orm.entity_manager" + + App\Command\SetCustomerPrivacyPolicyCommand: + arguments: + $policy_promo: "%env(POLICY_PROMO)%" + $policy_third_party: "%env(POLICY_THIRD_PARTY)%" + $policy_mobile: "%env(POLICY_MOBILE)%" + + App\Command\CreateCustomerFromWarrantyCommand: + arguments: + $cvu_mfg_id: "%env(CVU_MFG_ID)%" + $cvu_brand_id: "%env(CVU_BRAND_ID)%" + + # rider tracker service + App\Service\RiderTracker: + arguments: + $redis_client: "@App\\Service\\RedisClientProvider" + + Catalyst\APIBundle\Security\APIKeyUserProvider: + arguments: + $em: "@doctrine.orm.entity_manager" + + Catalyst\APIBundle\Security\APIKeyAuthenticator: + arguments: + $em: "@doctrine.orm.entity_manager" + + Catalyst\APIBundle\Command\UserCreateCommand: + arguments: + $em: "@doctrine.orm.entity_manager" + tags: ['console.command'] + + Catalyst\APIBundle\Command\TestCommand: + tags: ['console.command'] + + Catalyst\APIBundle\Command\TestAPICommand: + tags: ['console.command'] + + Catalyst\APIBundle\Access\Voter: + arguments: + $acl_gen: "@Catalyst\\APIBundle\\Access\\Generator" + $user_class: "Catalyst\\APIBundle\\Entity\\User" + tags: ['security.voter'] + + Catalyst\APIBundle\Access\Generator: + arguments: + $router: "@router.default" + $cache_dir: "%kernel.cache_dir%" + $config_dir: "%kernel.root_dir%/../config" + $acl_file: "%api_acl_file%" + + Catalyst\MenuBundle\Menu\Generator: + arguments: + $router: "@router.default" + $cache_dir: "%kernel.cache_dir%" + $config_dir: "%kernel.root_dir%/../config" + + Catalyst\MenuBundle\Listener\MenuAnnotationListener: + arguments: + $menu_name: "main_menu" + tags: + - { name: kernel.event_listener, event: kernel.controller, method: onKernelController } + + # invoice generator + App\Service\InvoiceGenerator\CMBInvoiceGenerator: ~ + + # invoice generator interface + App\Service\InvoiceGeneratorInterface: "@App\\Service\\InvoiceGenerator\\CMBInvoiceGenerator" + + # job order generator + App\Service\JobOrderHandler\CMBJobOrderHandler: + arguments: + $country_code: "%env(COUNTRY_CODE)%" + + #job order generator interface + App\Service\JobOrderHandlerInterface: "@App\\Service\\JobOrderHandler\\CMBJobOrderHandler" + + # customer generator + App\Service\CustomerHandler\CMBCustomerHandler: + arguments: + $country_code: "%env(COUNTRY_CODE)%" + + # customer generator interface + App\Service\CustomerHandlerInterface: "@App\\Service\\CustomerHandler\\CMBCustomerHandler" + + # rider assignment + App\Service\RiderAssignmentHandler\CMBRiderAssignmentHandler: ~ + + # rider assignment interface + App\Service\RiderAssignmentHandlerInterface: "@App\\Service\\RiderAssignmentHandler\\CMBRiderAssignmentHandler" + + # rider API service + App\Service\RiderAPIHandler\CMBRiderAPIHandler: + arguments: + $country_code: "%env(COUNTRY_CODE)%" + $upload_dir: "%jo_extra_upload_directory%" + + App\Service\RiderAPIHandlerInterface: "@App\\Service\\RiderAPIHandler\\CMBRiderAPIHandler" + + # map manager + #App\Service\GISManager\Bing: ~ + App\Service\GISManager\OpenStreet: ~ + #App\Service\GISManager\Google: ~ + + #App\Service\GISManagerInterface: "@App\\Service\\GISManager\\Bing" + App\Service\GISManagerInterface: "@App\\Service\\GISManager\\OpenStreet" + #App\Service\GISManagerInterface: "@App\\Service\\GISManager\\Google" + + App\EventListener\JobOrderActiveCacheListener: + arguments: + $jo_cache: "@App\\Service\\JobOrderCache" + $mqtt: "@App\\Service\\MQTTClient" + tags: + - name: 'doctrine.orm.entity_listener' + event: 'postUpdate' + entity: 'App\Entity\JobOrder' + - name: 'doctrine.orm.entity_listener' + event: 'postRemove' + entity: 'App\Entity\JobOrder' + - name: 'doctrine.orm.entity_listener' + event: 'postPersist' + entity: 'App\Entity\JobOrder' + + App\Service\JobOrderCache: + arguments: + $redis_prov: "@App\\Service\\RedisClientProvider" + $active_jo_key: "%env(LOCATION_JO_ACTIVE_KEY)%" + + App\Service\RiderCache: + arguments: + $redis_prov: "@App\\Service\\RedisClientProvider" + $loc_key: "%env(LOCATION_RIDER_ACTIVE_KEY)%" + $status_key: "%env(STATUS_RIDER_KEY)%" + + # inventory manager + App\Service\InventoryManager: + arguments: + $api_url: "%env(INVENTORY_API_URL)%" + $api_ocp_key: "%env(INVENTORY_API_OCP)%" + $api_auth_prefix: "%env(INVENTORY_API_AUTH_TOKEN_PREFIX)%" + $api_auth_token: "%env(INVENTORY_API_AUTH_TOKEN)%" + + # API logging + App\EventSubscriber\LogSubscriber: + arguments: + $api_log_flag: "%env(API_LOGGING)%" diff --git a/resq_settings/resq/menu.yaml b/resq_settings/resq/menu.yaml new file mode 100644 index 00000000..69f0b806 --- /dev/null +++ b/resq_settings/resq/menu.yaml @@ -0,0 +1,186 @@ +main_menu: + - id: home + acl: dashboard.menu + label: Dashboard + icon: flaticon-line-graph + - id: user + acl: user.menu + label: User + icon: flaticon-users + - id: user_list + acl: user.list + label: Users + parent: user + - id: role_list + acl: role.list + label: Roles + parent: user + + - id: apiuser + acl: apiuser.menu + label: API User + icon: flaticon-users + - id: api_user_list + acl: apiuser.list + label: API Users + parent: apiuser + - id: api_role_list + acl: apirole.list + label: API Roles + parent: apiuser + + - id: logistics + acl: logistics.menu + label: Logistics + icon: fa fa-truck + - id: rider_list + acl: rider.list + label: Riders + parent: logistics + + - id: battery + acl: battery.menu + label: Battery + icon: fa fa-battery-3 + - id: battery_list + acl: battery.list + label: Batteries + parent: battery + - id: bmfg_list + acl: bmfg.list + label: Manufacturers + parent: battery + - id: bmodel_list + acl: bmodel.list + label: Models + parent: battery + - id: bsize_list + acl: bsize.list + label: Sizes + parent: battery + - id: promo_list + acl: promo.list + label: Promos + parent: battery + + - id: vehicle + acl: vehicle.menu + label: Vehicle + icon: fa fa-car + - id: vehicle_list + acl: vehicle.list + label: Vehicles + parent: vehicle + - id: vmfg_list + acl: vmfg.list + label: Manufacturers + parent: vehicle + + - id: location + acl: location.menu + label: Location + icon: fa fa-home + - id: outlet_list + acl: outlet.menu + label: Outlet + parent: location + - id: hub_list + acl: hub.menu + label: Hub + parent: location + - id: geofence_list + acl: geofence.menu + label: Geofence + parent: location + + + - id: joborder + acl: joborder.menu + label: Job Order + icon: flaticon-calendar-3 + - id: jo_in + acl: jo_in.list + label: Incoming + parent: joborder + - id: jo_proc + acl: jo_proc.list + label: Dispatch + parent: joborder + - id: jo_assign + acl: jo_assign.list + label: Rider Assignment + parent: joborder + - id: jo_fulfill + acl: jo_fulfill.list + label: Fulfillment + parent: joborder + - id: jo_open + acl: jo_open.list + label: Open + parent: joborder + - id: jo_all + acl: jo_all.list + label: View All + parent: joborder + - id: jo_hub.view + label: Hub View + parent: joborder + + - id: support + acl: support.menu + label: Customer Support + icon: flaticon-support + - id: customer_list + acl: customer.list + label: Customers + parent: support + - id: ticket_list + acl: ticket.list + label: Tickets + parent: support + - id: general_search + acl: general.search + label: Search + parent: support + - id: warranty_search + acl: warranty.search + label: Customer Battery Search + parent: support + - id: privacy_policy_list + acl: privacy_policy.list + label: Privacy Policy + parent: support + - id: warranty_list + acl: warranty.list + label: Warranty + parent: support + - id: warranty_upload + acl: warranty.upload + label: Warranty Upload + parent: support + - id: static_content_list + acl: static_content.list + label: Static Content + parent: support + + - id: service + acl: service.menu + label: Other Services + icon: flaticon-squares + - id: service_list + acl: service.list + label: Services + parent: service + + - id: partner + acl: partner.menu + label: Partners + icon: flaticon-network + - id: partner_list + acl: partner.list + label: Partners + parent: partner + - id: review_list + acl: review.list + label: Reviews + parent: partner diff --git a/resq_settings/resq/messages.en.yaml b/resq_settings/resq/messages.en.yaml new file mode 100644 index 00000000..c0fb8ca1 --- /dev/null +++ b/resq_settings/resq/messages.en.yaml @@ -0,0 +1,27 @@ +# text +title_login: Motolite Res-Q | Login +block_title: Motolite Res-Q +control_panel_sign_in: Sign-in to Control Panel +alt_image_logo_login: Res-Q +alt_image_dashboard: Motolite +copyright: Motolite Res-Q +battery_size_tradein_brand: Trade-in Motolite +battery_size_tradein_premium: Trade-in Premium +battery_size_tradein_other: Trade-in Other +add_cust_vehicle_battery_info: This vehicle is using a Motolite battery +jo_title_pdf: Motolite Res-Q Job Order +country_code_prefix: '+63' +delivery_instructions_label: Delivery Instructions + +# images +image_logo_login: /assets/images/logo-resq.png +icon_login: /assets/demo/default/media/img/logo/favicon.ico +icon_base_32x32: /assets/images/favicon/favicon-32x32.png +icon_base_16x16: /assets/images/favicon/favicon-16x16.png +image_dashboard: /assets/images/logo-motolite.png +image_jo_pdf: /public/assets/images/logo-resq.png + +# default point for maps +default_lat: 14.6091 +default_long: 121.0223 +default_region: ph diff --git a/resq_settings/resq/services.yaml b/resq_settings/resq/services.yaml new file mode 100644 index 00000000..7f568033 --- /dev/null +++ b/resq_settings/resq/services.yaml @@ -0,0 +1,244 @@ +# Put parameters here that don't need to change on each machine where the app is deployed +# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration +parameters: + map_default: + latitude: 14.6091 + longitude: 121.0223 + image_upload_directory: '%kernel.project_dir%/public/uploads' + job_order_refresh_interval: 300000 + api_acl_file: 'api_acl.yaml' + api_access_key: 'api_access_keys' + app_acl_file: 'acl.yaml' + app_access_key: 'access_keys' + cvu_brand_id: "%env(CVU_BRAND_ID)%" + country_code: "%env(COUNTRY_CODE)%" + api_version: "%env(API_VERSION)%" + +services: + # default configuration for services in *this* file + _defaults: + autowire: true # Automatically injects dependencies in your services. + autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. + public: false # Allows optimizing the container by removing unused services; this also means + # fetching services directly from the container via $container->get() won't work. + # The best practice is to be explicit about your dependencies anyway. + + # makes classes in src/ available to be used as services + # this creates a service per class whose id is the fully-qualified class name + App\: + resource: '../src/*' + exclude: '../src/{Entity,Migrations,Tests,Menu,Access}' + + # controllers are imported separately to make sure services can be injected + # as action arguments even if you don't extend any base controller class + App\Controller\: + resource: '../src/Controller' + tags: ['controller.service_arguments'] + + # add more service definitions when explicit configuration is needed + # please note that last definitions always *replace* previous ones + App\Menu\Generator: + arguments: + $router: "@router.default" + $cache_dir: "%kernel.cache_dir%" + $config_dir: "%kernel.root_dir%/../config" + + Catalyst\AuthBundle\Service\ACLGenerator: + arguments: + $router: "@router.default" + $cache_dir: "%kernel.cache_dir%" + $config_dir: "%kernel.root_dir%/../config" + $acl_file: "%app_acl_file%" + + Catalyst\AuthBundle\Service\ACLVoter: + arguments: + $user_class: "App\\Entity\\User" + tags: ['security.voter'] + + Catalyst\AuthBundle\Service\UserChecker: + + App\Service\FileUploader: + arguments: + $target_dir: '%image_upload_directory%' + + App\Service\MapTools: + arguments: + $em: "@doctrine.orm.entity_manager" + $gmaps_api_key: "%env(GMAPS_API_KEY)%" + $cust_dist_limit: "%env(CUST_DISTANCE_LIMIT)%" + + App\Service\RisingTideGateway: + arguments: + $em: "@doctrine.orm.entity_manager" + $user: "%env(RT_USER)%" + $pass: "%env(RT_PASS)%" + $usage_type: "%env(RT_USAGE_TYPE)%" + $shortcode: "%env(RT_SHORTCODE)%" + $dr_url: "https://resqaws.jankstudio.com/sms/delivery_receipt" + + App\Service\MQTTClient: + arguments: + $redis_client: "@App\\Service\\RedisClientProvider" + $key: "mqtt_events" + + App\Service\APNSClient: + arguments: + $redis_client: "@App\\Service\\RedisClientProvider" + + App\Service\RedisClientProvider: + arguments: + $scheme: "%env(REDIS_CLIENT_SCHEME)%" + $host: "%env(REDIS_CLIENT_HOST)%" + $port: "%env(REDIS_CLIENT_PORT)%" + $password: "%env(REDIS_CLIENT_PASSWORD)%" + + App\Service\GeofenceTracker: + arguments: + $geofence_flag: "%env(GEOFENCE_ENABLE)%" + + App\Service\WarrantyHandler: + arguments: + $em: "@doctrine.orm.entity_manager" + + App\Command\SetCustomerPrivacyPolicyCommand: + arguments: + $policy_promo: "%env(POLICY_PROMO)%" + $policy_third_party: "%env(POLICY_THIRD_PARTY)%" + $policy_mobile: "%env(POLICY_MOBILE)%" + + App\Command\CreateCustomerFromWarrantyCommand: + arguments: + $cvu_mfg_id: "%env(CVU_MFG_ID)%" + $cvu_brand_id: "%env(CVU_BRAND_ID)%" + + # rider tracker service + App\Service\RiderTracker: + arguments: + $redis_client: "@App\\Service\\RedisClientProvider" + + Catalyst\APIBundle\Security\APIKeyUserProvider: + arguments: + $em: "@doctrine.orm.entity_manager" + + Catalyst\APIBundle\Security\APIKeyAuthenticator: + arguments: + $em: "@doctrine.orm.entity_manager" + + Catalyst\APIBundle\Command\UserCreateCommand: + arguments: + $em: "@doctrine.orm.entity_manager" + tags: ['console.command'] + + Catalyst\APIBundle\Command\TestCommand: + tags: ['console.command'] + + Catalyst\APIBundle\Command\TestAPICommand: + tags: ['console.command'] + + Catalyst\APIBundle\Access\Voter: + arguments: + $acl_gen: "@Catalyst\\APIBundle\\Access\\Generator" + $user_class: "Catalyst\\APIBundle\\Entity\\User" + tags: ['security.voter'] + + Catalyst\APIBundle\Access\Generator: + arguments: + $router: "@router.default" + $cache_dir: "%kernel.cache_dir%" + $config_dir: "%kernel.root_dir%/../config" + $acl_file: "%api_acl_file%" + + Catalyst\MenuBundle\Menu\Generator: + arguments: + $router: "@router.default" + $cache_dir: "%kernel.cache_dir%" + $config_dir: "%kernel.root_dir%/../config" + + Catalyst\MenuBundle\Listener\MenuAnnotationListener: + arguments: + $menu_name: "main_menu" + tags: + - { name: kernel.event_listener, event: kernel.controller, method: onKernelController } + + # invoice generator + App\Service\InvoiceGenerator\ResqInvoiceGenerator: ~ + + # invoice generator interface + App\Service\InvoiceGeneratorInterface: "@App\\Service\\InvoiceGenerator\\ResqInvoiceGenerator" + + # job order generator + App\Service\JobOrderHandler\ResqJobOrderHandler: + arguments: + $country_code: "%env(COUNTRY_CODE)%" + + #job order generator interface + App\Service\JobOrderHandlerInterface: "@App\\Service\\JobOrderHandler\\ResqJobOrderHandler" + + # customer generator + App\Service\CustomerHandler\ResqCustomerHandler: + arguments: + $country_code: "%env(COUNTRY_CODE)%" + + # customer generator interface + App\Service\CustomerHandlerInterface: "@App\\Service\\CustomerHandler\\ResqCustomerHandler" + + # rider assignment + App\Service\RiderAssignmentHandler\ResqRiderAssignmentHandler: ~ + + # rider assignment interface + App\Service\RiderAssignmentHandlerInterface: "@App\\Service\\RiderAssignmentHandler\\ResqRiderAssignmentHandler" + + # rider API service + App\Service\RiderAPIHandler\ResqRiderAPIHandler: + arguments: + $country_code: "%env(COUNTRY_CODE)%" + + App\Service\RiderAPIHandlerInterface: "@App\\Service\\RiderAPIHandler\\ResqRiderAPIHandler" + + # map manager + #App\Service\GISManager\Bing: ~ + App\Service\GISManager\OpenStreet: ~ + #App\Service\GISManager\Google: ~ + + #App\Service\GISManagerInterface: "@App\\Service\\GISManager\\Bing" + App\Service\GISManagerInterface: "@App\\Service\\GISManager\\OpenStreet" + #App\Service\GISManagerInterface: "@App\\Service\\GISManager\\Google" + + App\EventListener\JobOrderActiveCacheListener: + arguments: + $jo_cache: "@App\\Service\\JobOrderCache" + $mqtt: "@App\\Service\\MQTTClient" + tags: + - name: 'doctrine.orm.entity_listener' + event: 'postUpdate' + entity: 'App\Entity\JobOrder' + - name: 'doctrine.orm.entity_listener' + event: 'postRemove' + entity: 'App\Entity\JobOrder' + - name: 'doctrine.orm.entity_listener' + event: 'postPersist' + entity: 'App\Entity\JobOrder' + + App\Service\JobOrderCache: + arguments: + $redis_prov: "@App\\Service\\RedisClientProvider" + $active_jo_key: "%env(LOCATION_JO_ACTIVE_KEY)%" + + App\Service\RiderCache: + arguments: + $redis_prov: "@App\\Service\\RedisClientProvider" + $loc_key: "%env(LOCATION_RIDER_ACTIVE_KEY)%" + $status_key: "%env(STATUS_RIDER_KEY)%" + + # inventory manager + App\Service\InventoryManager: + arguments: + $api_url: "%env(INVENTORY_API_URL)%" + $api_ocp_key: "%env(INVENTORY_API_OCP)%" + $api_auth_prefix: "%env(INVENTORY_API_AUTH_TOKEN_PREFIX)%" + $api_auth_token: "%env(INVENTORY_API_AUTH_TOKEN)%" + + # API logging + App\EventSubscriber\LogSubscriber: + arguments: + $api_log_flag: "%env(API_LOGGING)%" diff --git a/src/Command/ConfigureResqCommand.php b/src/Command/ConfigureResqCommand.php new file mode 100644 index 00000000..f4316056 --- /dev/null +++ b/src/Command/ConfigureResqCommand.php @@ -0,0 +1,55 @@ +setName('resq:configure') + ->setDescription('Copies the configuration files, depending on environment.') + ->setHelp('Copies the configuration files, depending on environment.') + ->addArgument('dir_name', InputArgument::REQUIRED, 'Name of source subdirectory.'); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $dir_name = $input->getArgument('dir_name'); + + $filesystem = new Filesystem(); + $current_dir = getcwd(); + + $source_dir = $current_dir . '/resq_settings/' . $dir_name . '/'; + $config_dir = $current_dir . '/config/'; + $translations_dir = $current_dir . '/translations/'; + + // copy services.yaml file + error_log('Copying services.yaml file...'); + $filesystem->copy($source_dir . 'services.yaml', $config_dir . 'services.yaml', true); + + // copy menu.yaml file + error_log('Copying menu.yaml file...'); + $filesystem->copy($source_dir . 'menu.yaml', $config_dir . 'menu.yaml', true); + + // copy messages.en.yaml file + error_log('Copying messages.en.yaml file...'); + $filesystem->copy($source_dir . 'messages.en.yaml', $translations_dir . 'messages.en.yaml', true); + + error_log('Done copying files.'); + + return 0; + } +}