Skip to content

Commit

Permalink
Add docs for section Business
Browse files Browse the repository at this point in the history
  • Loading branch information
ciukstar committed Nov 2, 2023
1 parent 367def9 commit 8c7a256
Show file tree
Hide file tree
Showing 32 changed files with 923 additions and 136 deletions.
10 changes: 10 additions & 0 deletions README.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ Chaque service peut avoir plusieurs offres avec des prix et des devises correspo

Une fois le service et ses offres définis, le service peut être publié. La prestation et les offres seront présentées au client dans la rubrique [« Services »](https://salonfr-w3cpovaqka-de.a.run.app/services) et disponibles à la réservation dans la rubrique [« Prenez rendez-vous »](https://salonfr-w3cpovaqka-de.a.run.app/book).

# Entités de base

## Entreprise

Des informations détaillées sur l'entreprise peuvent être fournies dans la section [« Entreprise »](https://salonfr-w3cpovaqka-de.a.run.app/admin/business) du groupe « Données » du menu principal.

De plus, dans la section [« Entreprise »](https://salonfr-w3cpovaqka-de.a.run.app/admin/business), l'horaire de travail de l'organisation pour chaque jour peut être ajouté.

Actuellement, l'application ne prend en charge qu'une seule entreprise. Un support multi-métiers est prévu pour les futures versions de l'application.

## Diagramme ERD

![Diagramme entité-relation](static/img/Salon-ERD.svg)
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ Each service can have multiple offers with corresponding prices and currencies.

Once the service and its offerings are defined, the service can be published. The service and offers will be displayed to the customer in the section ["Services"](https://salon-w3cpovaqka-de.a.run.app/services) and available for booking in the section ["Book appointment"](https://salon-w3cpovaqka-de.a.run.app/book).

# Basic Entities

## Business

Detailed information about the business can be provided in the section ["Business"](https://salon-w3cpovaqka-de.a.run.app/admin/business) of the group "Data" in the main menu.

Additionally, in the section ["Business"](https://salon-w3cpovaqka-de.a.run.app/admin/business), the organization's work schedule for each day can be added.

Currently, the app only supports one business. Multi-business support is planned for future versions of the application.

## ERD Diagram

![Entity Relationship Diagram](static/img/Salon-ERD.svg)
Expand Down
10 changes: 10 additions & 0 deletions README.ro.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ Fiecare serviciu poate avea mai multe oferte cu prețuri și valute corespunzăt

Odată ce serviciul și ofertele sale sunt definite, serviciul poate fi publicat. Serviciul și ofertele vor fi afișate clientului în secțiunea [„Servicii”](https://salonro-w3cpovaqka-de.a.run.app/services) și disponibile pentru rezervare în secțiunea [„Rezervă o programare”](https://salonro-w3cpovaqka-de.a.run.app/book).

# Entităţile de bază

## Afacere

Informații detaliate despre afacere pot fi furnizate în secțiunea [„Afacere”](https://salonro-w3cpovaqka-de.a.run.app/admin/business) din grupul „Date” din meniul principal.

În plus, în secțiunea [„Afaceri”](https://salonro-w3cpovaqka-de.a.run.app/admin/business), poate fi adăugat programul de lucru al organizației pentru fiecare zi.

În prezent, aplicația acceptă o singură afacere. Asistența multi-business este planificată pentru versiunile viitoare ale aplicației.

## Diagrama ERD

![Diagrama Entitate-Relație](static/img/Salon-ERD.svg)
Expand Down
10 changes: 10 additions & 0 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@

После определения службы и ее предложений ее можно опубликовать. Услуга и предложения будут отображены клиенту в разделе [«Услуги»](https://salonru-w3cpovaqka-de.a.run.app/services) и доступны для бронирования в разделе [«Записаться на приём»](https://salonru-w3cpovaqka-de.a.run.app/book).

# Основные сущности

## Организация

Подробную информацию об организации можно предоставить в разделе [«Организация»](https://salonru-w3cpovaqka-de.a.run.app/admin/business) группы «Данные» главного меню.

Дополнительно в разделе [«Организация»](https://salonru-w3cpovaqka-de.a.run.app/admin/business) можно добавить график работы организации на каждый день.

В настоящее время приложение поддерживает только один бизнес. Поддержка нескольких организаций планируется в будущих версиях приложения.

## ER-диаграмма

![Диаграмма отношений сущностей](static/img/Salon-ERD.svg)
Expand Down
2 changes: 1 addition & 1 deletion config/routes.yesodroutes
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/requests/#BookId RequestR GET POST
/requests RequestsR GET

/search/appointments AppointmentsSearchR GET
/search/appointments AppointmentsSearchR GET
/appointments/#BookId/approve AppointmentApproveR POST
/appointments/#BookId/reschedule AppointmentRescheduleR GET
/appointments/#BookId/cancel AppointmentCancelR POST
Expand Down
13 changes: 12 additions & 1 deletion messages/en.msg
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
BasicEntities: Basic Entities
BusinessDay: Business day
SortDescending: Sort descending
SortAscending: Sort ascending
Sort: Sort
Workday: Workday
TimeSlot: Time slot
CustomerRanking: Customer ranking
Expand Down Expand Up @@ -304,4 +309,10 @@ Doc002 hrefServices@Text: The services to be advertised are defined and publishe

Doc003: Each service can have multiple offers with corresponding prices and currencies. Offers are defined for each Service in the “Services” section in the “Data” group.

Doc004 hrefServices@Text hrefBook@Text: Once the service and its offerings are defined, the service can be published. The service and offers will be displayed to the customer in the section <a href=#{hrefServices}>"Services"</a> and available for booking in the section <a href=#{hrefBook}>"Book appointment"</a>.
Doc004 hrefServices@Text hrefBook@Text: Once the service and its offerings are defined, the service can be published. The service and offers will be displayed to the customer in the section <a href=#{hrefServices}>"Services"</a> and available for booking in the section <a href=#{hrefBook}>"Book appointment"</a>.

Doc005 hrefBusiness@Text: Detailed information about the business can be provided in the section <a href=#{hrefBusiness}>"Business"</a> of the group "Data" in the main menu.

Doc006 hrefBusiness@Text: Additionally, in the section <a href=#{hrefBusiness}>"Business"</a>, the organization's work schedule for each day can be added.

Doc007: Currently, the app only supports one business. Multi-business support is planned for future versions of the application.
13 changes: 12 additions & 1 deletion messages/fr.msg
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
BasicEntities: Entités de base
BusinessDay: Jour ouvrable
SortDescending: Trier par ordre décroissant
SortAscending: Trier par ordre croissant
Sort: Trier
Workday: Journée de travail
TimeSlot: Créneau horaire
CustomerRanking: Classement des clients
Expand Down Expand Up @@ -304,4 +309,10 @@ Doc002 hrefServices: Les services à annoncer sont définis et publiés dans la

Doc003: Chaque service peut avoir plusieurs offres avec des prix et des devises correspondants. Les offres sont définies pour chaque Service dans la rubrique « Services » du groupe « Données ».

Doc004 hrefServices hrefBook: Une fois le service et ses offres définis, le service peut être publié. La prestation et les offres seront présentées au client dans la rubrique <a href=#{hrefServices}>« Services »</a> et disponibles à la réservation dans la rubrique <a href=#{hrefBook}>« Prenez rendez-vous »</a>.
Doc004 hrefServices hrefBook: Une fois le service et ses offres définis, le service peut être publié. La prestation et les offres seront présentées au client dans la rubrique <a href=#{hrefServices}>« Services »</a> et disponibles à la réservation dans la rubrique <a href=#{hrefBook}>« Prenez rendez-vous »</a>.

Doc005 hrefBusiness: Des informations détaillées sur l'entreprise peuvent être fournies dans la section <a href=#{hrefBusiness}>« Entreprise »</a> du groupe « Données » du menu principal.

Doc006 hrefBusiness: De plus, dans la section <a href=#{hrefBusiness}>« Affaires »</a>, l'horaire de travail de l'organisation pour chaque jour peut être ajouté.

Doc007: Actuellement, l'application ne prend en charge qu'une seule entreprise. Un support multi-métiers est prévu pour les futures versions de l'application.
13 changes: 12 additions & 1 deletion messages/ro.msg
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
BasicEntities: Entităţile de bază
BusinessDay: Zi de lucru
SortDescending: Sortează descrescător
SortAscending: Sortare ascendentă
Sort: Sortează
Workday: Zi de lucru
TimeSlot: Interval de timp
CustomerRanking: Clasamentul clienților
Expand Down Expand Up @@ -304,4 +309,10 @@ Doc002 hrefServices: Serviciile care vor fi promovate sunt definite și publicat

Doc003: Fiecare serviciu poate avea mai multe oferte cu prețuri și valute corespunzătoare. Ofertele sunt definite pentru fiecare Serviciu în secțiunea „Servicii” din grupul „Date”.

Doc004 hrefServices hrefBook: Odată ce serviciul și ofertele sale sunt definite, serviciul poate fi publicat. Serviciul și ofertele vor fi afișate clientului în secțiunea <a href=#{hrefServices}>„Servicii”</a> și disponibile pentru rezervare în secțiunea <a href=#{hrefBook}>„Rezervă o programare”</a>.
Doc004 hrefServices hrefBook: Odată ce serviciul și ofertele sale sunt definite, serviciul poate fi publicat. Serviciul și ofertele vor fi afișate clientului în secțiunea <a href=#{hrefServices}>„Servicii”</a> și disponibile pentru rezervare în secțiunea <a href=#{hrefBook}>„Rezervă o programare”</a>.

Doc005 hrefBusiness: Informații detaliate despre afacere pot fi furnizate în secțiunea <a href=#{hrefBusiness}>„Afacere”</a> din grupul „Date” din meniul principal.

Doc006 hrefBusiness: În plus, în secțiunea <a href=#{hrefBusiness}>„Afaceri”</a>, poate fi adăugat programul de lucru al organizației pentru fiecare zi.

Doc007: În prezent, aplicația acceptă o singură afacere. Asistența multi-business este planificată pentru versiunile viitoare ale aplicației.
13 changes: 12 additions & 1 deletion messages/ru.msg
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
BasicEntities: Основные сущности
BusinessDay: Рабочий день
SortDescending: Сортировать по убыванию
SortAscending: Сортировать по возрастанию
Sort: Сортировать
Workday: Рабочий день
TimeSlot: Временной интервал
CustomerRanking: Рейтинг клиентов
Expand Down Expand Up @@ -304,4 +309,10 @@ Doc002 hrefServices: Рекламируемые услуги определен

Doc003: Каждая услуга может иметь несколько предложений с соответствующими ценами и валютами. Предложения определены для каждой Услуги в разделе «Услуги» в группе «Данные».

Doc004 hrefServices hrefBook: После определения службы и ее предложений ее можно опубликовать. Услуга и предложения будут отображены клиенту в разделе <a href=#{hrefServices}>«Услуги»</a> и доступны для бронирования в разделе <a href=#{hrefBook}>«Записаться на приём»</a>.
Doc004 hrefServices hrefBook: После определения службы и ее предложений ее можно опубликовать. Услуга и предложения будут отображены клиенту в разделе <a href=#{hrefServices}>«Услуги»</a> и доступны для бронирования в разделе <a href=#{hrefBook}>«Записаться на приём»</a>.

Doc005 hrefBusiness: Подробную информацию об организации можно предоставить в разделе <a href=#{hrefBusiness}>«Организация»</a> группы «Данные» главного меню.

Doc006 hrefBusiness: Дополнительно в разделе <a href=#{hrefBusiness}>«Организация»</a> можно добавить график работы организации на каждый день.

Doc007: В настоящее время приложение поддерживает только один бизнес. Поддержка нескольких организаций планируется в будущих версиях приложения.
24 changes: 16 additions & 8 deletions src/Admin/Business.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ import Control.Monad.IO.Class (liftIO)
import Data.Bifunctor (first)
import Data.Fixed (mod')
import qualified Data.Map.Lazy as M (fromListWith, lookup)
import Data.Maybe (isNothing, isJust)
import Data.Maybe (isNothing, isJust, fromMaybe)
import Data.Text (Text, pack, unpack, intercalate)
import Text.Shakespeare.I18N (renderMessage)
import Data.Time.Clock
( NominalDiffTime, getCurrentTime, utctDay, secondsToNominalDiffTime )
import Data.Time.Calendar
Expand All @@ -50,13 +49,18 @@ import Data.Time.LocalTime
)
import Data.Time.Format (formatTime, defaultTimeLocale)
import Text.Hamlet (Html)
import Text.Shakespeare.I18N (renderMessage)
import Text.Read (readMaybe)
import Yesod.Auth (maybeAuth, Route (LoginR))
import Yesod.Core
( Yesod(defaultLayout), getMessages, SomeMessage (SomeMessage)
, redirect, addMessageI, newIdent
)
import Yesod.Core.Handler (setUltDestCurrent, getCurrentRoute, getYesod, languages)
import Yesod.Core.Handler
( setUltDestCurrent, getCurrentRoute, getYesod, languages
)
import Yesod.Core.Widget (setTitleI)
import Yesod.Form.Input (runInputGet, iopt)
import Yesod.Form.Fields
( textField, emailField, textareaField, intField, dayField, timeField
, hiddenField
Expand Down Expand Up @@ -101,7 +105,8 @@ import Foundation
, MsgNoBusinessScheduleYet, MsgBusinessHours, MsgStartTime, MsgEndTime
, MsgDayType, MsgWeekday, MsgWeekend, MsgHoliday, MsgInvalidTimeInterval
, MsgList, MsgCalendar, MsgMon, MsgTue, MsgWed, MsgThu, MsgFri, MsgSat, MsgSun
, MsgSymbolHour, MsgSymbolMinute, MsgToday
, MsgSymbolHour, MsgSymbolMinute, MsgToday, MsgBusinessDay, MsgSortAscending
, MsgSortDescending
)
)

Expand All @@ -123,6 +128,7 @@ import Model
, BusinessHoursDayType
)
, DayType (Weekday, Weekend, Holiday)
, SortOrder (SortOrderAsc, SortOrderDesc)
)

import Settings (widgetFile)
Expand All @@ -136,7 +142,6 @@ getBusinessCalendarSlotR bid day sid = do
where_ $ x ^. BusinessHoursId ==. val sid
return x
dlgSlotDelete <- newIdent
let month = (\(y,m,_) -> YearMonth y m) . toGregorian
defaultLayout $ do
setTitleI MsgBusinessHours
$(widgetFile "admin/business/calendar/slots/slot")
Expand Down Expand Up @@ -243,12 +248,11 @@ getBusinessCalendarSlotsR bid day = do
x <- from $ table @BusinessHours
where_ $ x ^. BusinessHoursDay ==. val day
return x
dlgSlotDelete <- newIdent
let month = (\(y,m,_) -> YearMonth y m) . toGregorian
fabSlotCreate <- newIdent
msgs <- getMessages
defaultLayout $ do
setTitleI MsgBusinessHours
setTitleI MsgBusinessDay
$(widgetFile "admin/business/calendar/slots/slots")


Expand Down Expand Up @@ -389,15 +393,19 @@ postBusinessHoursR bid = do

getBusinessHoursR :: BusinessId -> Handler Html
getBusinessHoursR bid = do
sort <- fromMaybe SortOrderDesc . (readMaybe . unpack =<<) <$> runInputGet (iopt textField "sort")
slots <- runDB $ select $ do
x <- from $ table @BusinessHours
orderBy [desc (x ^. BusinessHoursDay), asc (x ^. BusinessHoursOpen)]
case sort of
SortOrderAsc -> orderBy [asc (x ^. BusinessHoursDay), asc (x ^. BusinessHoursOpen)]
_ -> orderBy [desc (x ^. BusinessHoursDay), desc (x ^. BusinessHoursOpen)]
return x
user <- maybeAuth
curr <- getCurrentRoute
month <- (\(y,m,_) -> YearMonth y m) . toGregorian . utctDay <$> liftIO getCurrentTime
setUltDestCurrent
msgs <- getMessages
toolbarTop <- newIdent
fabBusinessHoursCreate <- newIdent
defaultLayout $ do
setTitleI MsgBusinessDays
Expand Down
13 changes: 10 additions & 3 deletions src/Admin/Staff.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import Data.Time.Clock
import Data.Time.Format (formatTime, defaultTimeLocale, parseTimeM)
import Data.Time.LocalTime (TimeOfDay, LocalTime (LocalTime), diffLocalTime)
import Text.Hamlet (Html)
import Text.Read (readMaybe)
import Data.FileEmbed (embedFile)
import Data.Maybe (isJust, fromMaybe)
import Control.Monad (forM)
Expand Down Expand Up @@ -142,7 +143,7 @@ import Foundation
, MsgWorkingHours, MsgDay, MsgStartTime, MsgEndTime, MsgDetails, MsgToday
, MsgInvalidTimeInterval, MsgMon, MsgTue, MsgWed, MsgThu, MsgFri, MsgSat
, MsgSun, MsgSymbolHour, MsgSymbolMinute, MsgInvalidFormData, MsgAdd
, MsgCompletionTime, MsgWorkday
, MsgCompletionTime, MsgWorkday, MsgSortAscending, MsgSortDescending
)
)

Expand All @@ -161,6 +162,7 @@ import Model
, ServiceId, Service (Service)
, UserId, User (User), UserPhoto (UserPhoto)
, EmplStatus (EmplStatusUnavailable, EmplStatusAvailable)
, SortOrder (SortOrderAsc, SortOrderDesc)
)

import Settings.StaticFiles (img_add_photo_alternate_FILL0_wght400_GRAD0_opsz48_svg)
Expand Down Expand Up @@ -299,7 +301,6 @@ $forall (v,icon) <- [(startV,"schedule"),(endV,"schedule")]

getEmplCalendarSlotR :: StaffId -> ScheduleId -> Day -> Handler Html
getEmplCalendarSlotR eid wid day = do
let month = (\(y,m,_) -> YearMonth y m) . toGregorian
slot <- runDB $ selectOne $ do
x <- from $ table @Schedule
where_ $ x ^. ScheduleId ==. val wid
Expand Down Expand Up @@ -401,6 +402,8 @@ getAdmEmplCalendarR eid month = do
let next = addMonths 1 month
let prev = addMonths (-1) month
today <- (\(y,m,_) -> YearMonth y m) . toGregorian . utctDay <$> liftIO getCurrentTime
toolbarTop <- newIdent
calendarPage <- newIdent
defaultLayout $ do
setTitleI MsgEmployee
$(widgetFile "admin/staff/empl/calendar/calendar")
Expand All @@ -412,6 +415,7 @@ getAdmEmplCalendarR eid month = do

getAdmScheduleR :: StaffId -> Handler Html
getAdmScheduleR eid = do
sort <- fromMaybe SortOrderDesc . (readMaybe . unpack =<<) <$> runInputGet (iopt textField "sort")
mwid <- runInputGet $ iopt textField "wid"
scrollY <- runInputGet $ iopt textField "y"
stati <- reqGetParams <$> getRequest
Expand All @@ -423,12 +427,15 @@ getAdmScheduleR eid = do
schedule <- runDB $ select $ do
x <- from $ table @Schedule
where_ $ x ^. ScheduleStaff ==. val eid
orderBy [desc (x ^. ScheduleWorkDay), desc (x ^. ScheduleWorkStart), desc (x ^. ScheduleWorkEnd)]
case sort of
SortOrderAsc -> orderBy [asc (x ^. ScheduleWorkDay), asc (x ^. ScheduleWorkStart)]
_ -> orderBy [desc (x ^. ScheduleWorkDay), desc (x ^. ScheduleWorkStart)]
return x
curr <- getCurrentRoute
msgs <- getMessages
touchTargetWrapperAddSchedule <- newIdent
month <- (\(y,m,_) -> YearMonth y m) . toGregorian . utctDay <$> liftIO getCurrentTime
toolbarTop <- newIdent
defaultLayout $ do
setTitleI MsgEmployee
$(widgetFile "admin/staff/empl/schedule")
Expand Down
6 changes: 6 additions & 0 deletions src/Demo/DemoDataEN.hs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ We will continue to offer the latest treatments, the most innovative techniques
, scheduleWorkEnd = TimeOfDay 18 0 0
}

insert_ $ Schedule { scheduleStaff = e1
, scheduleWorkDay = addDays 2 today
, scheduleWorkStart = TimeOfDay 9 0 0
, scheduleWorkEnd = TimeOfDay 18 0 0
}

pass2 <- liftIO $ makePassword "marylopez" 17
let user2 = User { userName = "marylopez"
, userPassword = decodeUtf8 pass2
Expand Down
Loading

0 comments on commit 8c7a256

Please sign in to comment.