diff --git a/config/models.persistentmodels b/config/models.persistentmodels index b6ebe86..366d2a0 100644 --- a/config/models.persistentmodels +++ b/config/models.persistentmodels @@ -111,6 +111,7 @@ Brand ContactUs business BusinessId OnDeleteCascade + showSchedule Bool html Html UniqueContactUs business diff --git a/messages/en.msg b/messages/en.msg index a820098..56d4cef 100644 --- a/messages/en.msg +++ b/messages/en.msg @@ -1,3 +1,4 @@ +ShowSchedule: Show schedule NumberOfOrders: Number of orders ValueOfOrders: Value of orders TotalOrderValue: Total order value diff --git a/messages/fr.msg b/messages/fr.msg index 8173ea5..59bbe83 100644 --- a/messages/fr.msg +++ b/messages/fr.msg @@ -1,3 +1,4 @@ +ShowSchedule: Afficher l'horaire de travail NumberOfOrders: Nombre de commandes ValueOfOrders: Valeur des commandes TotalOrderValue: Valeur totale des commandes diff --git a/messages/ro.msg b/messages/ro.msg index 32bdcfd..29fa665 100644 --- a/messages/ro.msg +++ b/messages/ro.msg @@ -1,3 +1,4 @@ +ShowSchedule: Afișează programul de lucru NumberOfOrders: Numărul de comenzi ValueOfOrders: Valoarea comenzilor TotalOrderValue: Valoarea totală a comenzilor diff --git a/messages/ru.msg b/messages/ru.msg index 93f82b1..7ac0c68 100644 --- a/messages/ru.msg +++ b/messages/ru.msg @@ -1,3 +1,4 @@ +ShowSchedule: Показать график работы NumberOfOrders: Количество заказов ValueOfOrders: Стоимость заказов TotalOrderValue: Общая стоимость заказов diff --git a/src/Admin/Business.hs b/src/Admin/Business.hs index 1eac137..07655cd 100644 --- a/src/Admin/Business.hs +++ b/src/Admin/Business.hs @@ -75,7 +75,7 @@ import Yesod.Core.Widget (setTitleI, whamlet) import Yesod.Form.Input (runInputGet, iopt) import Yesod.Form.Fields ( textField, emailField, textareaField, intField, dayField, timeField - , hiddenField, htmlField + , hiddenField, htmlField, checkBoxField ) import Yesod.Form.Functions ( generateFormPost, mreq, mopt, runFormPost, checkM, check ) @@ -123,7 +123,7 @@ import Foundation , MsgList, MsgCalendar, MsgMon, MsgTue, MsgWed, MsgThu, MsgFri, MsgSat, MsgSun , MsgSymbolHour, MsgSymbolMinute, MsgToday, MsgBusinessDay, MsgSortAscending , MsgSortDescending, MsgAboutUs, MsgContactUs, MsgNoContentYet, MsgContent - , MsgAlreadyExists, MsgInvalidFormData, MsgWorkSchedule + , MsgAlreadyExists, MsgInvalidFormData, MsgWorkSchedule, MsgShowSchedule ) ) @@ -139,7 +139,7 @@ import Model , businessHoursDayType ) , AboutUsId, AboutUs (AboutUs, aboutUsHtml) - , ContactUsId, ContactUs (ContactUs, contactUsHtml) + , ContactUsId, ContactUs (ContactUs, contactUsHtml, contactUsShowSchedule) , EntityField ( BusinessName, BusinessFullName, BusinessAddr, BusinessPhone, BusinessMobile , BusinessEmail, BusinessId, BusinessTzo, BusinessTz, BusinessCurrency @@ -221,14 +221,43 @@ getBusinessContactCreateR bid = do formContact :: BusinessId -> Maybe (Entity ContactUs) -> Html -> MForm Handler (FormResult ContactUs, Widget) formContact bid e extra = do + (showScheduleR,showScheduleV) <- mreq checkBoxField FieldSettings + { fsLabel = SomeMessage MsgShowSchedule + , fsTooltip = Nothing, fsId = Nothing, fsName = Nothing + , fsAttrs = [("class","mdc-checkbox__native-control")] + } (contactUsShowSchedule . entityVal <$> e) (htmlR,htmlV) <- mreq uniqueField FieldSettings { fsLabel = SomeMessage MsgContent , fsTooltip = Nothing, fsId = Nothing, fsName = Nothing , fsAttrs = [("class","mdc-text-field__input"),("rows","12")] } ( contactUsHtml . entityVal <$> e) - let r = ContactUs bid <$> htmlR + let r = ContactUs bid <$> showScheduleR <*> htmlR let v = [whamlet| #{extra} + + + ^{fvInput showScheduleV} + $with selected <- fromMaybe False ((contactUsShowSchedule . entityVal) <$> e) + + + + + + + + + + + + + + + +