3 Commits

Author SHA1 Message Date
c8f8f82535 resolve commit and fix 2023-11-27 08:45:48 +01:00
0f5a0ed5ab improve 2023-11-27 07:26:21 +01:00
275c8b1999 comments replace in go.mod 2023-08-07 10:52:29 +02:00
8 changed files with 79 additions and 970 deletions

View File

@@ -19,8 +19,8 @@ COPY . .
RUN go mod download && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /server RUN go mod download && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /server
# RUN rm -r themes/* RUN rm -r themes/*
RUN git clone -b dev --depth 1 https://git.coopgo.io/coopgo-apps/parcoursmob-default-theme themes/default RUN git clone --depth 1 https://git.coopgo.io/coopgo-apps/parcoursmob-default-theme themes/default
RUN git clone -b spie06 --depth 1 https://git.coopgo.io/coopgo-apps/parcoursmob-default-theme themes/spie06 RUN git clone -b spie06 --depth 1 https://git.coopgo.io/coopgo-apps/parcoursmob-default-theme themes/spie06
FROM scratch FROM scratch

22
go.mod
View File

@@ -2,7 +2,7 @@ module git.coopgo.io/coopgo-apps/parcoursmob
go 1.18 go 1.18
// replace git.coopgo.io/coopgo-platform/mobility-accounts => ../../coopgo-platform/mobility-accounts/ replace git.coopgo.io/coopgo-platform/mobility-accounts => ../../coopgo-platform/mobility-accounts/
// replace git.coopgo.io/coopgo-platform/groups-management => ../../coopgo-platform/groups-management/ // replace git.coopgo.io/coopgo-platform/groups-management => ../../coopgo-platform/groups-management/
@@ -30,11 +30,11 @@ require (
) )
require ( require (
git.coopgo.io/coopgo-platform/agenda v0.0.0-20230222135722-e55cf41e203b git.coopgo.io/coopgo-platform/agenda v0.0.0-20230310121901-ef3add576f86
git.coopgo.io/coopgo-platform/emailing v0.0.0-20221017030337-c71888d90c15 git.coopgo.io/coopgo-platform/emailing v0.0.0-20221017030337-c71888d90c15
git.coopgo.io/coopgo-platform/fleets v0.0.0-20230519092636-41bf03682ca9 git.coopgo.io/coopgo-platform/fleets v0.0.0-20230310144446-feb935f8bf4e
git.coopgo.io/coopgo-platform/groups-management v0.0.0-20230117140716-312200e21063 git.coopgo.io/coopgo-platform/groups-management v0.0.0-20230310123255-5ef94ee0746c
git.coopgo.io/coopgo-platform/mobility-accounts v0.0.0-20221107003506-e2ff98094b81 git.coopgo.io/coopgo-platform/mobility-accounts v0.0.0-20230329105908-a76c0412a386
github.com/gorilla/securecookie v1.1.1 github.com/gorilla/securecookie v1.1.1
github.com/minio/minio-go/v7 v7.0.43 github.com/minio/minio-go/v7 v7.0.43
github.com/ory/viper v1.7.5 github.com/ory/viper v1.7.5
@@ -42,7 +42,6 @@ require (
) )
require ( require (
github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 // indirect
github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect
@@ -55,16 +54,12 @@ require (
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/protobuf v1.5.2 // indirect github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.1 // indirect github.com/golang/snappy v0.0.1 // indirect
github.com/gorilla/csrf v1.7.1 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.15.9 // indirect github.com/klauspost/compress v1.15.9 // indirect
github.com/klauspost/cpuid/v2 v2.1.0 // indirect github.com/klauspost/cpuid/v2 v2.1.0 // indirect
github.com/leodido/go-urn v1.2.1 // indirect github.com/leodido/go-urn v1.2.1 // indirect
github.com/magiconair/properties v1.8.6 // indirect github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/goveralls v0.0.6 // indirect
github.com/mb0/wkt v0.0.0-20170420051526-a30afd545ee1 // indirect github.com/mb0/wkt v0.0.0-20170420051526-a30afd545ee1 // indirect
github.com/minio/md5-simd v1.1.2 // indirect github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect github.com/minio/sha256-simd v1.0.0 // indirect
@@ -73,11 +68,6 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
github.com/ory/fosite v0.42.2 // indirect
github.com/ory/go-acc v0.2.6 // indirect
github.com/ory/go-convenience v0.1.0 // indirect
github.com/ory/x v0.0.214 // indirect
github.com/pborman/uuid v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
@@ -89,7 +79,6 @@ require (
github.com/sirupsen/logrus v1.9.0 // indirect github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/afero v1.8.2 // indirect github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.0.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.1 // indirect github.com/subosito/gotenv v1.4.1 // indirect
@@ -112,7 +101,6 @@ require (
golang.org/x/sync v0.1.0 // indirect golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.7.0 // indirect golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect golang.org/x/text v0.9.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/appengine v1.6.7 // indirect google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect

922
go.sum

File diff suppressed because it is too large Load Diff

View File

@@ -47,6 +47,7 @@ func (h *ApplicationHandler) Dashboard(w http.ResponseWriter, r *http.Request) {
for _, account := range resp.Accounts[min:] { for _, account := range resp.Accounts[min:] {
if filterAccount(r, account) { if filterAccount(r, account) {
fmt.Println(account)
a := account.ToStorageType() a := account.ToStorageType()
accounts = append([]any{a}, accounts...) accounts = append([]any{a}, accounts...)
} }

View File

@@ -467,6 +467,25 @@ func (h ApplicationHandler) VehiclesFleetMakeUnavailable(w http.ResponseWriter,
// fmt.Println(vehicles) // fmt.Println(vehicles)
// h.Renderer.UnbookingVehicles(w, r, vehicles) // h.Renderer.UnbookingVehicles(w, r, vehicles)
// } // }
func (h *ApplicationHandler) DeleteBooking(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
bookingid := vars["bookingid"]
request := &fleets.DeleteBookingRequest{
Id: bookingid,
}
_, err := h.services.GRPC.Fleets.DeleteBooking(context.TODO(), request)
if err != nil {
fmt.Println(err)
w.WriteHeader(http.StatusInternalServerError)
return
}
http.Redirect(w, r, "/app/vehicles-management/bookings/", http.StatusSeeOther)
}
func (h *ApplicationHandler) UnbookingVehicle(w http.ResponseWriter, r *http.Request) { func (h *ApplicationHandler) UnbookingVehicle(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r) vars := mux.Vars(r)
bookingid := vars["bookingid"] bookingid := vars["bookingid"]
@@ -481,9 +500,12 @@ func (h *ApplicationHandler) UnbookingVehicle(w http.ResponseWriter, r *http.Req
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
return return
} }
now := time.Now() // now := time.Now()
date := now.Format("2006-01-02") // date := now.Format("2006-01-02")
date := "1970-01-01"
unavailableto, _ := time.Parse("2006-01-02", date) unavailableto, _ := time.Parse("2006-01-02", date)
unavailablefrom := unavailableto
current_group, err := h.currentGroup(r) current_group, err := h.currentGroup(r)
if err != nil { if err != nil {
@@ -548,7 +570,7 @@ func (h *ApplicationHandler) UnbookingVehicle(w http.ResponseWriter, r *http.Req
Driver: resp.Booking.Driver, Driver: resp.Booking.Driver,
Startdate: resp.Booking.Startdate, Startdate: resp.Booking.Startdate,
Enddate: resp.Booking.Enddate, Enddate: resp.Booking.Enddate,
Unavailablefrom: resp.Booking.Unavailablefrom, Unavailablefrom: timestamppb.New(unavailablefrom),
Unavailableto: timestamppb.New(unavailableto), Unavailableto: timestamppb.New(unavailableto),
Data: datapb, Data: datapb,
}, },

View File

@@ -3,6 +3,9 @@ package exports
import ( import (
"context" "context"
"fmt" "fmt"
"net/http"
"sort"
"git.coopgo.io/coopgo-apps/parcoursmob/utils/sorting" "git.coopgo.io/coopgo-apps/parcoursmob/utils/sorting"
agenda "git.coopgo.io/coopgo-platform/agenda/grpcapi" agenda "git.coopgo.io/coopgo-platform/agenda/grpcapi"
agendastorage "git.coopgo.io/coopgo-platform/agenda/storage" agendastorage "git.coopgo.io/coopgo-platform/agenda/storage"
@@ -12,8 +15,6 @@ import (
accountsstorage "git.coopgo.io/coopgo-platform/mobility-accounts/storage" accountsstorage "git.coopgo.io/coopgo-platform/mobility-accounts/storage"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/xuri/excelize/v2" "github.com/xuri/excelize/v2"
"net/http"
"sort"
) )
func (h *ExportsHandler) Agenda(filter string) func(w http.ResponseWriter, r *http.Request) { func (h *ExportsHandler) Agenda(filter string) func(w http.ResponseWriter, r *http.Request) {
@@ -141,7 +142,10 @@ func (h *ExportsHandler) generateExcel(events []agendastorage.Event, groups map[
f.SetCellValue("Sheet1", "F1", "Numéro allocataire / Pole emploi") f.SetCellValue("Sheet1", "F1", "Numéro allocataire / Pole emploi")
f.SetCellValue("Sheet1", "G1", "Prescipteur") f.SetCellValue("Sheet1", "G1", "Prescipteur")
f.SetCellValue("Sheet1", "H1", "Prescipteur Nom") f.SetCellValue("Sheet1", "H1", "Prescipteur Nom")
f.SetCellValue("Sheet1", "I1", "Gestionnaire événement") f.SetCellValue("Sheet1", "I1", "Prescipteur Email")
f.SetCellValue("Sheet1", "J1", "Gestionnaire événement")
// f.SetCellValue("Sheet1", "I1", "Prescripteur téléphone")
i := 2 i := 2
for _, e := range events { for _, e := range events {
if len(e.Owners) == 0 { if len(e.Owners) == 0 {
@@ -149,11 +153,13 @@ func (h *ExportsHandler) generateExcel(events []agendastorage.Event, groups map[
} }
admin := groups[e.Owners[0]] admin := groups[e.Owners[0]]
for _, s := range e.Subscriptions {
subscribedbygroup := "" subscribedbygroup := ""
subscribedbyuser := "" subscribedbyuser := ""
if v, ok := e.Data["subscribed_by"].(map[string]any); ok { subscribedbyemail := ""
if v, ok := s.Data["subscribed_by"].(map[string]any); ok {
if v2, ok := v["group"].(map[string]any); ok { if v2, ok := v["group"].(map[string]any); ok {
if v3, ok := v2["id"].(string); ok { if v3, ok := v2["name"].(string); ok {
subscribedbygroup = v3 subscribedbygroup = v3
} }
@@ -162,12 +168,13 @@ func (h *ExportsHandler) generateExcel(events []agendastorage.Event, groups map[
if v5, ok := v4["display_name"].(string); ok { if v5, ok := v4["display_name"].(string); ok {
subscribedbyuser = v5 subscribedbyuser = v5
} }
if v6, ok := v4["email"].(string); ok {
subscribedbyemail = v6
}
} }
} }
for _, s := range e.Subscriptions {
beneficiary := beneficiaries_map[s.Subscriber] beneficiary := beneficiaries_map[s.Subscriber]
f.SetCellValue("Sheet1", fmt.Sprintf("A%d", i), e.Name) f.SetCellValue("Sheet1", fmt.Sprintf("A%d", i), e.Name)
@@ -176,9 +183,10 @@ func (h *ExportsHandler) generateExcel(events []agendastorage.Event, groups map[
f.SetCellValue("Sheet1", fmt.Sprintf("D%d", i), beneficiary.Data["last_name"]) f.SetCellValue("Sheet1", fmt.Sprintf("D%d", i), beneficiary.Data["last_name"])
f.SetCellValue("Sheet1", fmt.Sprintf("E%d", i), beneficiary.Data["first_name"]) f.SetCellValue("Sheet1", fmt.Sprintf("E%d", i), beneficiary.Data["first_name"])
f.SetCellValue("Sheet1", fmt.Sprintf("F%d", i), beneficiary.Data["file_number"]) f.SetCellValue("Sheet1", fmt.Sprintf("F%d", i), beneficiary.Data["file_number"])
f.SetCellValue("Sheet1", fmt.Sprintf("G%d", i), groups[subscribedbygroup].Data["name"]) f.SetCellValue("Sheet1", fmt.Sprintf("G%d", i), subscribedbygroup)
f.SetCellValue("Sheet1", fmt.Sprintf("H%d", i), subscribedbyuser) f.SetCellValue("Sheet1", fmt.Sprintf("H%d", i), subscribedbyuser)
f.SetCellValue("Sheet1", fmt.Sprintf("I%d", i), admin.Data["name"]) f.SetCellValue("Sheet1", fmt.Sprintf("I%d", i), subscribedbyemail)
f.SetCellValue("Sheet1", fmt.Sprintf("J%d", i), admin.Data["name"])
i = i + 1 i = i + 1
} }

View File

@@ -45,7 +45,6 @@ func (h *ExportsHandler) Bookings(w http.ResponseWriter, r *http.Request) {
} }
groups := map[string]groupsstorage.Group{} groups := map[string]groupsstorage.Group{}
admingroups, err := h.services.GRPC.GroupsManagement.GetGroups(context.TODO(), &groupsmanagement.GetGroupsRequest{ admingroups, err := h.services.GRPC.GroupsManagement.GetGroups(context.TODO(), &groupsmanagement.GetGroupsRequest{
@@ -94,8 +93,10 @@ func (h *ExportsHandler) Bookings(w http.ResponseWriter, r *http.Request) {
f.SetCellValue("Sheet1", "H1", "Fin de mise Ă  disposition") f.SetCellValue("Sheet1", "H1", "Fin de mise Ă  disposition")
f.SetCellValue("Sheet1", "I1", "Début indisponibilité") f.SetCellValue("Sheet1", "I1", "Début indisponibilité")
f.SetCellValue("Sheet1", "J1", "Fin indisponibilité") f.SetCellValue("Sheet1", "J1", "Fin indisponibilité")
f.SetCellValue("Sheet1", "K1", "Retrait par le gestionnaire") f.SetCellValue("Sheet1", "K1", "Véhicule retiré")
f.SetCellValue("Sheet1", "L1", "Commentaire") f.SetCellValue("Sheet1", "L1", "Commentaire - Retrait véhicule")
f.SetCellValue("Sheet1", "M1", "Réservation supprimée")
f.SetCellValue("Sheet1", "N1", "Motif de la suppression")
i := 2 i := 2
for _, b := range bookings { for _, b := range bookings {
@@ -139,6 +140,14 @@ func (h *ExportsHandler) Bookings(w http.ResponseWriter, r *http.Request) {
adminunavailability = true adminunavailability = true
} }
deleted := ""
v, ok := b.Data["Deleted"]
fmt.Println(v)
fmt.Println(ok)
if b.Deleted || (ok && v.(bool)) {
deleted = "DELETED"
}
f.SetCellValue("Sheet1", fmt.Sprintf("A%d", i), vehicle.Data["licence_plate"]) f.SetCellValue("Sheet1", fmt.Sprintf("A%d", i), vehicle.Data["licence_plate"])
f.SetCellValue("Sheet1", fmt.Sprintf("B%d", i), vehicle.Type) f.SetCellValue("Sheet1", fmt.Sprintf("B%d", i), vehicle.Type)
f.SetCellValue("Sheet1", fmt.Sprintf("C%d", i), admin.Data["name"]) f.SetCellValue("Sheet1", fmt.Sprintf("C%d", i), admin.Data["name"])
@@ -151,6 +160,8 @@ func (h *ExportsHandler) Bookings(w http.ResponseWriter, r *http.Request) {
f.SetCellValue("Sheet1", fmt.Sprintf("J%d", i), b.Unavailableto.Format("2006-01-02")) f.SetCellValue("Sheet1", fmt.Sprintf("J%d", i), b.Unavailableto.Format("2006-01-02"))
f.SetCellValue("Sheet1", fmt.Sprintf("K%d", i), adminunavailability) f.SetCellValue("Sheet1", fmt.Sprintf("K%d", i), adminunavailability)
f.SetCellValue("Sheet1", fmt.Sprintf("L%d", i), b.Data["comment"]) f.SetCellValue("Sheet1", fmt.Sprintf("L%d", i), b.Data["comment"])
f.SetCellValue("Sheet1", fmt.Sprintf("M%d", i), deleted)
f.SetCellValue("Sheet1", fmt.Sprintf("N%d", i), b.Data["motif"])
i = i + 1 i = i + 1
} }

View File

@@ -110,6 +110,7 @@ func main() {
application.HandleFunc("/vehicles-management/bookings/{bookingid}/change-vehicle", applicationHandler.VehicleManagementBookingChangeVehicle) application.HandleFunc("/vehicles-management/bookings/{bookingid}/change-vehicle", applicationHandler.VehicleManagementBookingChangeVehicle)
/////////////////////////////////////Remove booking vehicle///////////////////////////////////////// /////////////////////////////////////Remove booking vehicle/////////////////////////////////////////
application.HandleFunc("/vehicles-management/bookings/{bookingid}/delete", applicationHandler.UnbookingVehicle) application.HandleFunc("/vehicles-management/bookings/{bookingid}/delete", applicationHandler.UnbookingVehicle)
// application.HandleFunc("/vehicles-management/bookings/{bookingid}/delete", applicationHandler.DeleteBooking)
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
application.HandleFunc("/vehicles-management/bookings/{bookingid}/documents/{document}", applicationHandler.BookingDocumentDownload) application.HandleFunc("/vehicles-management/bookings/{bookingid}/documents/{document}", applicationHandler.BookingDocumentDownload)
application.HandleFunc("/agenda/", applicationHandler.AgendaHome) application.HandleFunc("/agenda/", applicationHandler.AgendaHome)