1.9 KiB
1.9 KiB
Fix Public Page Configuration
Objective
Ensure that "General Settings" in the Dashboard (Page Title, Subtitle, Phone, Primary Color) are correctly reflected in the Public Booking Page (CaptainBooking).
Context
The user reported that changing settings in the dashboard had no effect on the public page. The public page was using hardcoded values.
Steps Taken
-
Backend:
- Identified that
phone_numbercolumn was missing incaptain_configurationstable. - Created migration
AddPhoneNumberToCaptainConfigurations. - Updated
Api::V1::Accounts::Captain::ConfigurationsControllerto permitphone_numberparam. - Verified
Public::Api::V1::Captain::MasterDataControllerreturns thecaptain_configurationdata.
- Identified that
-
Frontend (
App.vue):- Updated
fetchMasterDatato consumeapp_configfrom the API response. - Made
appConfigreactive to the fetched data (title,subtitle,phone_number,primary_color,secondary_color). - Added dynamic background gradient using
primary_colorandsecondary_color. - Added "Suporte: [Phone]" display in the header/subtitle area if a phone number is set.
- Updated
-
Backend Fix (Part 2):
- Addressed
PG::UndefinedTableerror by explicitly settingself.table_name = 'captain_configurations'inCaptain::Configurationmodel. - Addressed
ActionController::ParameterMissingby updating frontend payload structure.
- Addressed
Files Changed
db/migrate/20260114101014_add_phone_number_to_captain_configurations.rb(New)enterprise/app/controllers/api/v1/accounts/captain/configurations_controller.rbenterprise/app/models/captain/configuration.rb(Added table_name)app/javascript/captain_booking/App.vueapp/javascript/dashboard/routes/dashboard/captain/configurations/Index.vue
Validation
- Dashboard UI (
configurations/Index.vue) already supported sendingphone_number. App.vuenow dynamically updates its UI based on the API response.