From 10e70230baefbbd73312a56080d55d007c0dceec Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Fri, 29 Jan 2021 17:26:48 -0800 Subject: [PATCH] Added working days to scheduling IO-153 --- bodyshop_translations.babel | 168 ++++++++++++++++++ .../jobs-detail-header-actions.component.jsx | 3 + .../schedule-calendar-header.component.js | 37 +++- .../schedule-job-modal.component.jsx | 4 +- .../shop-info/shop-info.component.jsx | 51 ++++++ client/src/graphql/bodyshop.queries.js | 2 + .../pages/manage/manage.page.component.jsx | 2 +- client/src/translations/en_us/common.json | 10 +- client/src/translations/es/common.json | 10 +- client/src/translations/fr/common.json | 10 +- client/src/utils/TemplateConstants.js | 19 +- .../down.yaml | 5 + .../up.yaml | 6 + .../down.yaml | 76 ++++++++ .../up.yaml | 77 ++++++++ .../down.yaml | 69 +++++++ .../up.yaml | 70 ++++++++ hasura/migrations/metadata.yaml | 2 + server/graphql-client/queries.js | 1 + server/scheduling/scheduling-job.js | 36 +++- 20 files changed, 638 insertions(+), 20 deletions(-) create mode 100644 hasura/migrations/1611941041657_alter_table_public_bodyshops_add_column_workingdays/down.yaml create mode 100644 hasura/migrations/1611941041657_alter_table_public_bodyshops_add_column_workingdays/up.yaml create mode 100644 hasura/migrations/1611941052239_update_permission_user_public_table_bodyshops/down.yaml create mode 100644 hasura/migrations/1611941052239_update_permission_user_public_table_bodyshops/up.yaml create mode 100644 hasura/migrations/1611941063164_update_permission_user_public_table_bodyshops/down.yaml create mode 100644 hasura/migrations/1611941063164_update_permission_user_public_table_bodyshops/up.yaml diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index f56f62374..4d88bb5ae 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -6184,6 +6184,27 @@ + + workingdays + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + @@ -10413,6 +10434,27 @@ + + friday + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + hours false @@ -10581,6 +10623,27 @@ + + monday + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + na false @@ -10770,6 +10833,27 @@ + + saturday + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + search false @@ -10854,6 +10938,27 @@ + + sunday + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + text false @@ -10875,6 +10980,27 @@ + + thursday + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + totals false @@ -10896,6 +11022,27 @@ + + tuesday + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + unknown false @@ -10959,6 +11106,27 @@ + + wednesday + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + yes false diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx index 28cc4cf20..9f782b6ab 100644 --- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx +++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx @@ -184,6 +184,9 @@ export function JobsDetailHeaderActions({ { defaultOpenStatus: bodyshop.md_ro_statuses.default_imported }, (newJobId) => { history.push(`/manage/jobs/${newJobId}`); + notification["success"]({ + message: t("jobs.successes.duplicated"), + }); } ) } diff --git a/client/src/components/schedule-calendar-wrapper/schedule-calendar-header.component.js b/client/src/components/schedule-calendar-wrapper/schedule-calendar-header.component.js index 20dbeb33b..e3f3c2ce7 100644 --- a/client/src/components/schedule-calendar-wrapper/schedule-calendar-header.component.js +++ b/client/src/components/schedule-calendar-wrapper/schedule-calendar-header.component.js @@ -8,13 +8,14 @@ import { Link } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { selectScheduleLoad, - selectScheduleLoadCalculating + selectScheduleLoadCalculating, } from "../../redux/application/application.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors"; import { DateTimeFormatter } from "../../utils/DateFormatter"; import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component"; import ScheduleBlockDay from "../schedule-block-day/schedule-block-day.component"; import ScheduleCalendarHeaderGraph from "./schedule-calendar-header-graph.component"; +import moment from "moment"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -124,10 +125,42 @@ export function ScheduleCalendarHeaderComponent({ ) : null; + const isShopOpen = (date) => { + let day; + switch (moment(date).day()) { + case 0: + day = "sunday"; + break; + case 1: + day = "monday"; + break; + case 2: + day = "tuesday"; + break; + case 3: + day = "wednesday"; + break; + case 4: + day = "thursday"; + break; + case 5: + day = "friday"; + break; + case 6: + day = "saturday"; + break; + default: + day = "sunday"; + break; + } + + return bodyshop.workingdays[day]; + }; + return (
-
+
{label} {calculating ? : LoadComponent}
diff --git a/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx b/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx index c208d43b3..647add47e 100644 --- a/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx +++ b/client/src/components/schedule-job-modal/schedule-job-modal.component.jsx @@ -31,7 +31,7 @@ export function ScheduleJobModalComponent({ const [loading, setLoading] = useState(false); const [smartOptions, setSmartOptions] = useState([]); - const handleAuto = async () => { + const handleSmartScheduling = async () => { setLoading(true); try { const response = await axios.post("/scheduling/job", { @@ -92,7 +92,7 @@ export function ScheduleJobModalComponent({ - {smartOptions.length > 0 && ( diff --git a/client/src/components/shop-info/shop-info.component.jsx b/client/src/components/shop-info/shop-info.component.jsx index c6cc3d7c4..c9fc8c88c 100644 --- a/client/src/components/shop-info/shop-info.component.jsx +++ b/client/src/components/shop-info/shop-info.component.jsx @@ -193,6 +193,57 @@ export default function ShopInfoComponent({ form, saveLoading }) { + + + + + + + + + + + + + + + + + + + + + + +
- {`ImEX Online V.${process.env.NODE_ENV}-${process.env.REACT_APP_GIT_SHA}`}{" "} + {`ImEX Online V.${process.env.NODE_ENV}-${process.env.REACT_APP_GIT_SHA}`}
Disclaimer diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 5185b410b..75525217b 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -393,7 +393,8 @@ }, "scheduling": "SMART Scheduling", "shopinfo": "Shop Information", - "speedprint": "Speed Print Configuration" + "speedprint": "Speed Print Configuration", + "workingdays": "Working Days" }, "successes": { "save": "Shop configuration saved successfully. " @@ -687,6 +688,7 @@ "email": "Email", "errors": "Errors", "exceptiontitle": "An error has occurred.", + "friday": "Friday", "hours": "hrs", "in": "In", "instanceconflictext": "Your $t(titles.app) account can only be used on one device at any given time. Refresh your session to take control.", @@ -695,6 +697,7 @@ "loadingapp": "Loading $t(titles.app)", "loadingshop": "Loading shop data...", "loggingin": "Authorizing...", + "monday": "Monday", "na": "N/A", "no": "No", "out": "Out", @@ -704,15 +707,20 @@ "passwordsdonotmatch": "The passwords you have entered do not match.", "print": "Print", "required": "Required", + "saturday": "Saturday", "search": "Search...", "selectdate": "Select date...", "sendagain": "Send Again", "sendby": "Send By", + "sunday": "Sunday", "text": "Text", + "thursday": "Thursday", "totals": "Totals", + "tuesday": "Tuesday", "unknown": "Unknown", "username": "Username", "view": "View", + "wednesday": "Wednesday", "yes": "Yes" }, "languages": { diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index ffacc4680..da79d2f79 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -393,7 +393,8 @@ }, "scheduling": "", "shopinfo": "", - "speedprint": "" + "speedprint": "", + "workingdays": "" }, "successes": { "save": "" @@ -687,6 +688,7 @@ "email": "", "errors": "", "exceptiontitle": "", + "friday": "", "hours": "", "in": "en", "instanceconflictext": "", @@ -695,6 +697,7 @@ "loadingapp": "Cargando $t(titles.app)", "loadingshop": "Cargando datos de la tienda ...", "loggingin": "Iniciando sesión ...", + "monday": "", "na": "N / A", "no": "", "out": "Afuera", @@ -704,15 +707,20 @@ "passwordsdonotmatch": "", "print": "", "required": "", + "saturday": "", "search": "Buscar...", "selectdate": "", "sendagain": "", "sendby": "", + "sunday": "", "text": "", + "thursday": "", "totals": "", + "tuesday": "", "unknown": "Desconocido", "username": "", "view": "", + "wednesday": "", "yes": "" }, "languages": { diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 4f9a43179..785609a2f 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -393,7 +393,8 @@ }, "scheduling": "", "shopinfo": "", - "speedprint": "" + "speedprint": "", + "workingdays": "" }, "successes": { "save": "" @@ -687,6 +688,7 @@ "email": "", "errors": "", "exceptiontitle": "", + "friday": "", "hours": "", "in": "dans", "instanceconflictext": "", @@ -695,6 +697,7 @@ "loadingapp": "Chargement de $t(titles.app)", "loadingshop": "Chargement des données de la boutique ...", "loggingin": "Vous connecter ...", + "monday": "", "na": "N / A", "no": "", "out": "En dehors", @@ -704,15 +707,20 @@ "passwordsdonotmatch": "", "print": "", "required": "", + "saturday": "", "search": "Chercher...", "selectdate": "", "sendagain": "", "sendby": "", + "sunday": "", "text": "", + "thursday": "", "totals": "", + "tuesday": "", "unknown": "Inconnu", "username": "", "view": "", + "wednesday": "", "yes": "" }, "languages": { diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index 697664d0c..c3d9c400c 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -16,7 +16,7 @@ export const TemplateList = (type, context) => { title: i18n.t("printcenter.jobs.estimate_detail"), description: "Est Detail", subject: `${i18n.t("printcenter.jobs.estimate_detail")} - ${ - context.job.ro_number + context && context.job && context.job.ro_number }`, key: "estimate_detail", disabled: false, @@ -25,7 +25,7 @@ export const TemplateList = (type, context) => { title: i18n.t("printcenter.jobs.casl_authorization"), description: "CASL Authorization", subject: `${i18n.t("printcenter.jobs.casl_authorization")} - ${ - context.job.ro_number + context && context.job && context.job.ro_number }`, key: "casl_authorization", disabled: false, @@ -35,7 +35,7 @@ export const TemplateList = (type, context) => { description: "Diagnostic Authorization", subject: `${i18n.t( "printcenter.jobs.diagnostic_authorization" - )} - ${context.job.ro_number}`, + )} - ${context && context.job && context.job.ro_number}`, key: "diagnostic_authorization", disabled: false, }, @@ -43,7 +43,7 @@ export const TemplateList = (type, context) => { title: i18n.t("printcenter.jobs.job_notes"), description: "All Jobs Notes", subject: `${i18n.t("printcenter.jobs.job_notes")} - ${ - context.job.ro_number + context && context.job && context.job.ro_number }`, key: "job_notes", disabled: false, @@ -57,7 +57,7 @@ export const TemplateList = (type, context) => { description: "Appointment Confirmation", subject: `${i18n.t( "printcenter.appointments.appointment_confirmation" - )} - ${context.job.ro_number}`, + )} - ${context && context.job && context.job.ro_number}`, key: "appointment_confirmation", disabled: false, }, @@ -70,7 +70,14 @@ export const TemplateList = (type, context) => { description: "Parts Order", key: "parts_order_confirmation", subject: `${bodyshop.shopname} Parts Order ${ - (context && context.job && context.job.ro_number) || "" + (context && + context && + context.job && + context.job && + context && + context.job && + context.job.ro_number) || + "" }`, disabled: false, }, diff --git a/hasura/migrations/1611941041657_alter_table_public_bodyshops_add_column_workingdays/down.yaml b/hasura/migrations/1611941041657_alter_table_public_bodyshops_add_column_workingdays/down.yaml new file mode 100644 index 000000000..fe9cc76ca --- /dev/null +++ b/hasura/migrations/1611941041657_alter_table_public_bodyshops_add_column_workingdays/down.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."bodyshops" DROP COLUMN "workingdays"; + type: run_sql diff --git a/hasura/migrations/1611941041657_alter_table_public_bodyshops_add_column_workingdays/up.yaml b/hasura/migrations/1611941041657_alter_table_public_bodyshops_add_column_workingdays/up.yaml new file mode 100644 index 000000000..8e2eb5a32 --- /dev/null +++ b/hasura/migrations/1611941041657_alter_table_public_bodyshops_add_column_workingdays/up.yaml @@ -0,0 +1,6 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."bodyshops" ADD COLUMN "workingdays" jsonb NOT NULL + DEFAULT jsonb_build_object(); + type: run_sql diff --git a/hasura/migrations/1611941052239_update_permission_user_public_table_bodyshops/down.yaml b/hasura/migrations/1611941052239_update_permission_user_public_table_bodyshops/down.yaml new file mode 100644 index 000000000..c49b55fed --- /dev/null +++ b/hasura/migrations/1611941052239_update_permission_user_public_table_bodyshops/down.yaml @@ -0,0 +1,76 @@ +- args: + role: user + table: + name: bodyshops + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - accountingconfig + - address1 + - address2 + - appt_alt_transport + - appt_colors + - appt_length + - bill_tax_rates + - city + - country + - created_at + - default_adjustment_rate + - deliverchecklist + - email + - enforce_class + - federal_tax_id + - id + - imexshopid + - inhousevendorid + - insurance_vendor_id + - intakechecklist + - logo_img_path + - md_categories + - md_classes + - md_ins_cos + - md_labor_rates + - md_messaging_presets + - md_notes_presets + - md_order_statuses + - md_parts_locations + - md_rbac + - md_referral_sources + - md_responsibility_centers + - md_ro_statuses + - messagingservicesid + - phone + - prodtargethrs + - production_config + - region_config + - schedule_end_time + - schedule_start_time + - scoreboard_target + - shopname + - shoprates + - speedprint + - ssbuckets + - state + - state_tax_id + - stripe_acct_id + - target_touchtime + - template_header + - textid + - updated_at + - zip_post + computed_fields: [] + filter: + associations: + bodyshop: + associations: + user: + authid: + _eq: X-Hasura-User-Id + role: user + table: + name: bodyshops + schema: public + type: create_select_permission diff --git a/hasura/migrations/1611941052239_update_permission_user_public_table_bodyshops/up.yaml b/hasura/migrations/1611941052239_update_permission_user_public_table_bodyshops/up.yaml new file mode 100644 index 000000000..c80b7fd81 --- /dev/null +++ b/hasura/migrations/1611941052239_update_permission_user_public_table_bodyshops/up.yaml @@ -0,0 +1,77 @@ +- args: + role: user + table: + name: bodyshops + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - accountingconfig + - address1 + - address2 + - appt_alt_transport + - appt_colors + - appt_length + - bill_tax_rates + - city + - country + - created_at + - default_adjustment_rate + - deliverchecklist + - email + - enforce_class + - federal_tax_id + - id + - imexshopid + - inhousevendorid + - insurance_vendor_id + - intakechecklist + - logo_img_path + - md_categories + - md_classes + - md_ins_cos + - md_labor_rates + - md_messaging_presets + - md_notes_presets + - md_order_statuses + - md_parts_locations + - md_rbac + - md_referral_sources + - md_responsibility_centers + - md_ro_statuses + - messagingservicesid + - phone + - prodtargethrs + - production_config + - region_config + - schedule_end_time + - schedule_start_time + - scoreboard_target + - shopname + - shoprates + - speedprint + - ssbuckets + - state + - state_tax_id + - stripe_acct_id + - target_touchtime + - template_header + - textid + - updated_at + - workingdays + - zip_post + computed_fields: [] + filter: + associations: + bodyshop: + associations: + user: + authid: + _eq: X-Hasura-User-Id + role: user + table: + name: bodyshops + schema: public + type: create_select_permission diff --git a/hasura/migrations/1611941063164_update_permission_user_public_table_bodyshops/down.yaml b/hasura/migrations/1611941063164_update_permission_user_public_table_bodyshops/down.yaml new file mode 100644 index 000000000..ef19e6f61 --- /dev/null +++ b/hasura/migrations/1611941063164_update_permission_user_public_table_bodyshops/down.yaml @@ -0,0 +1,69 @@ +- args: + role: user + table: + name: bodyshops + schema: public + type: drop_update_permission +- args: + permission: + columns: + - accountingconfig + - address1 + - address2 + - appt_alt_transport + - appt_colors + - appt_length + - bill_tax_rates + - city + - country + - created_at + - default_adjustment_rate + - deliverchecklist + - email + - enforce_class + - federal_tax_id + - id + - inhousevendorid + - insurance_vendor_id + - intakechecklist + - logo_img_path + - md_categories + - md_classes + - md_ins_cos + - md_labor_rates + - md_messaging_presets + - md_notes_presets + - md_order_statuses + - md_parts_locations + - md_rbac + - md_referral_sources + - md_responsibility_centers + - md_ro_statuses + - phone + - prodtargethrs + - production_config + - schedule_end_time + - schedule_start_time + - scoreboard_target + - shopname + - shoprates + - speedprint + - ssbuckets + - state + - state_tax_id + - target_touchtime + - updated_at + - zip_post + filter: + associations: + bodyshop: + associations: + user: + authid: + _eq: X-Hasura-User-Id + set: {} + role: user + table: + name: bodyshops + schema: public + type: create_update_permission diff --git a/hasura/migrations/1611941063164_update_permission_user_public_table_bodyshops/up.yaml b/hasura/migrations/1611941063164_update_permission_user_public_table_bodyshops/up.yaml new file mode 100644 index 000000000..f8bd313df --- /dev/null +++ b/hasura/migrations/1611941063164_update_permission_user_public_table_bodyshops/up.yaml @@ -0,0 +1,70 @@ +- args: + role: user + table: + name: bodyshops + schema: public + type: drop_update_permission +- args: + permission: + columns: + - accountingconfig + - address1 + - address2 + - appt_alt_transport + - appt_colors + - appt_length + - bill_tax_rates + - city + - country + - created_at + - default_adjustment_rate + - deliverchecklist + - email + - enforce_class + - federal_tax_id + - id + - inhousevendorid + - insurance_vendor_id + - intakechecklist + - logo_img_path + - md_categories + - md_classes + - md_ins_cos + - md_labor_rates + - md_messaging_presets + - md_notes_presets + - md_order_statuses + - md_parts_locations + - md_rbac + - md_referral_sources + - md_responsibility_centers + - md_ro_statuses + - phone + - prodtargethrs + - production_config + - schedule_end_time + - schedule_start_time + - scoreboard_target + - shopname + - shoprates + - speedprint + - ssbuckets + - state + - state_tax_id + - target_touchtime + - updated_at + - workingdays + - zip_post + filter: + associations: + bodyshop: + associations: + user: + authid: + _eq: X-Hasura-User-Id + set: {} + role: user + table: + name: bodyshops + schema: public + type: create_update_permission diff --git a/hasura/migrations/metadata.yaml b/hasura/migrations/metadata.yaml index 687bcfc13..94d4e2e97 100644 --- a/hasura/migrations/metadata.yaml +++ b/hasura/migrations/metadata.yaml @@ -768,6 +768,7 @@ tables: - template_header - textid - updated_at + - workingdays - zip_post filter: associations: @@ -826,6 +827,7 @@ tables: - state_tax_id - target_touchtime - updated_at + - workingdays - zip_post filter: associations: diff --git a/server/graphql-client/queries.js b/server/graphql-client/queries.js index 2c827858b..79eb13924 100644 --- a/server/graphql-client/queries.js +++ b/server/graphql-client/queries.js @@ -186,6 +186,7 @@ query QUERY_UPCOMING_APPOINTMENTS($now: timestamptz!, $jobId: uuid!) { bodyshop { ssbuckets target_touchtime + workingdays } jobhrs: joblines_aggregate { aggregate { diff --git a/server/scheduling/scheduling-job.js b/server/scheduling/scheduling-job.js index 490884ac4..1bb8e9461 100644 --- a/server/scheduling/scheduling-job.js +++ b/server/scheduling/scheduling-job.js @@ -31,7 +31,7 @@ exports.job = async (req, res) => { }); const { appointments, jobs } = result; - const { ssbuckets } = result.jobs_by_pk.bodyshop; + const { ssbuckets, workingdays } = result.jobs_by_pk.bodyshop; const jobHrs = result.jobs_by_pk.jobhrs.aggregate.sum.mod_lb_hrs; const JobBucket = ssbuckets.filter( @@ -40,14 +40,14 @@ exports.job = async (req, res) => { )[0]; const bucketMatrix = {}; - + const yesterday = moment().subtract(1, "day"); //Get latest date + add 5 days to allow for back end adding.. const totalMatrixDays = moment .max([ ...appointments.map((a) => moment(a.start)), ...jobs .map((p) => moment(p.scheduled_completion)) - .filter((p) => p.isValid()), + .filter((p) => p.isValid() && p.isAfter(yesterday)), ]) .add("5", "days") .diff(moment(), "days"); @@ -102,6 +102,7 @@ exports.job = async (req, res) => { (bucket) => bucket.gte <= jobHrs && (!!bucket.lt ? bucket.lt > jobHrs : true) )[0]; + console.log(pjobBucket.id, JobBucket.id, pjobBucket.id === JobBucket.id); if (pjobBucket.id === JobBucket.id) { //Theyre the same classification. Add it to the matrix. const compDate = moment(pjob.scheduled_completion); @@ -112,7 +113,6 @@ exports.job = async (req, res) => { ? compDate.format("yyyy-MM-DD") : todayIsoString : todayIsoString; - console.log("bucketMatrix", bucketMatrix); bucketMatrix[dateToUse] = { ...bucketMatrix[dateToUse], out: (bucketMatrix[dateToUse].out || 0) + 1, @@ -125,13 +125,37 @@ exports.job = async (req, res) => { const possibleDates = []; const bucketMatrixKeys = Object.keys(bucketMatrix); bucketMatrixKeys.forEach((bmkey) => { - if (JobBucket.target > bucketMatrix[bmkey].in - bucketMatrix[bmkey].out) + const isShopOpen = workingdays[dayOfWeekMapper(moment(bmkey).day())]; + + if ( + JobBucket.target > bucketMatrix[bmkey].in - bucketMatrix[bmkey].out && + isShopOpen + ) possibleDates.push(new Date(bmkey).toISOString().substr(0, 10)); }); - + console.log("possibleDates", possibleDates, "bucketMatrix", bucketMatrix); res.json(possibleDates); } catch (error) { console.log("error", error); res.status(400).send(error); } }; + +const dayOfWeekMapper = (numberOfDay) => { + switch (numberOfDay) { + case 0: + return "sunday"; + case 1: + return "monday"; + case 2: + return "tuesday"; + case 3: + return "wednesday"; + case 4: + return "thursday"; + case 5: + return "friday"; + case 6: + return "saturday"; + } +};