From bfe3a5d4b978bfe3e2df32b002a19bc87ef53310 Mon Sep 17 00:00:00 2001 From: ciukstar Date: Tue, 14 Nov 2023 02:16:44 +0300 Subject: [PATCH] Add new property offerPublished --- config/models.persistentmodels | 1 + messages/en.msg | 1 + messages/fr.msg | 1 + messages/ro.msg | 1 + messages/ru.msg | 1 + src/Admin/Services.hs | 35 +- src/Demo/DemoDataEN.hs | 169 ++- src/Demo/DemoDataFR.hs | 184 ++- src/Demo/DemoDataRO.hs | 166 ++- src/Demo/DemoDataRU.hs | 167 ++- src/Handler/Appointments.hs | 2 +- src/Handler/Book.hs | 2 +- src/Handler/Requests.hs | 4 +- src/Handler/Services.hs | 14 +- static/img/Salon-ERD.svg | 1243 +++++++++-------- templates/admin/services/offer/create.cassius | 5 + templates/admin/services/offer/edit.cassius | 5 + templates/admin/services/offer/offer.hamlet | 9 +- templates/admin/services/services.hamlet | 9 +- templates/appointments/appointment.hamlet | 2 +- templates/appointments/appointments.hamlet | 19 +- templates/appointments/calendar/item.hamlet | 2 +- templates/appointments/calendar/list.hamlet | 17 +- templates/appointments/calendar/page.hamlet | 16 +- templates/book/customer/items.hamlet | 2 +- templates/book/end.hamlet | 2 +- templates/book/offers/items.hamlet | 2 +- templates/book/staff/items.hamlet | 2 +- templates/book/time/items.hamlet | 2 +- templates/requests/request.hamlet | 2 +- templates/services/field.hamlet | 2 +- templates/services/offers.hamlet | 2 +- templates/services/search/offers.hamlet | 8 +- templates/stats/offers/pop.hamlet | 2 +- 34 files changed, 1326 insertions(+), 775 deletions(-) diff --git a/config/models.persistentmodels b/config/models.persistentmodels index 3b1b1cd..9fe9819 100644 --- a/config/models.persistentmodels +++ b/config/models.persistentmodels @@ -66,6 +66,7 @@ Thumbnail Offer service ServiceId OnDeleteCascade name Text + published Bool price Centi prefix Text Maybe suffix Text Maybe diff --git a/messages/en.msg b/messages/en.msg index 7698241..828fa4c 100644 --- a/messages/en.msg +++ b/messages/en.msg @@ -1,3 +1,4 @@ +NoAppointmentsForThisDay: You have no appointments for this day Completed: Completed Pending: Pending NoBusinessAddressFound: No business address found diff --git a/messages/fr.msg b/messages/fr.msg index 5c02798..65855ec 100644 --- a/messages/fr.msg +++ b/messages/fr.msg @@ -1,3 +1,4 @@ +NoAppointmentsForThisDay: Vous n'avez pas de rendez-vous pour ce jour Completed: Terminée Pending: En attente NoBusinessAddressFound: Aucune adresse trouvée diff --git a/messages/ro.msg b/messages/ro.msg index 24e6b15..3c1163b 100644 --- a/messages/ro.msg +++ b/messages/ro.msg @@ -1,3 +1,4 @@ +NoAppointmentsForThisDay: Nu aveți programări pentru această zi Completed: Finalizată Pending: În așteptare NoBusinessAddressFound: Nu a fost găsită nicio adresă diff --git a/messages/ru.msg b/messages/ru.msg index a4a84a4..7cb63f7 100644 --- a/messages/ru.msg +++ b/messages/ru.msg @@ -1,3 +1,4 @@ +NoAppointmentsForThisDay: У вас нет записи на этот день Completed: Выполнена Pending: В ожидании NoBusinessAddressFound: Адрес не найден diff --git a/src/Admin/Services.hs b/src/Admin/Services.hs index 887c1dd..040ebf2 100644 --- a/src/Admin/Services.hs +++ b/src/Admin/Services.hs @@ -123,7 +123,7 @@ import Model , ServiceDescr, ServicePublished, ThumbnailAttribution, RoleStaff, StaffId , RoleService, RoleName, RoleId, BusinessCurrency ) - , Offer (Offer, offerName, offerPrice, offerPrefix, offerSuffix, offerDescr) + , Offer (Offer, offerName, offerPrice, offerPrefix, offerSuffix, offerDescr, offerPublished) , OfferId , ServiceStatus (ServiceStatusPulished, ServiceStatusUnpublished) , Role (Role, roleStaff, roleName, roleDuration, roleRating), StaffId @@ -428,6 +428,11 @@ formOffer sid offer extra = do , fsTooltip = Nothing, fsId = Nothing, fsName = Nothing , fsAttrs = [("class","mdc-text-field__input")] } (offerName . entityVal <$> offer) + (publishedR,publishedV) <- mreq (mdcBoolField (optionsPairs [(MsgYes,True),(MsgNo,False)])) FieldSettings + { fsLabel = SomeMessage MsgPublished + , fsTooltip = Nothing, fsId = Nothing, fsName = Nothing + , fsAttrs = [("class","mdc-radio__native-control")] + } (offerPublished . entityVal <$> offer) (priceR,priceV) <- mreq doubleField FieldSettings { fsLabel = SomeMessage MsgPrice , fsTooltip = Nothing, fsId = Nothing, fsName = Nothing @@ -449,10 +454,21 @@ formOffer sid offer extra = do , fsAttrs = [("class","mdc-text-field__input")] } (offerDescr . entityVal <$> offer) - let r = Offer sid <$> nameR <*> (realToFrac <$> priceR) <*> prefR <*> suffR <*> descrR + let r = Offer sid <$> nameR <*> publishedR <*> (realToFrac <$> priceR) <*> prefR <*> suffR <*> descrR let w = [whamlet| #{extra} + +
+ + _{MsgPublished}* + ^{fvInput publishedV} + $maybe errs <- fvErrors publishedV + + +