hhh
This commit is contained in:
parent
78392b7817
commit
6711beb653
@ -381,7 +381,16 @@ func AdminConversationThread(db *gorm.DB) http.HandlerFunc {
|
|||||||
id, _ := strconv.Atoi(idStr)
|
id, _ := strconv.Atoi(idStr)
|
||||||
|
|
||||||
var convs []models.Conversation
|
var convs []models.Conversation
|
||||||
db.Where("user_id = ?", id).Order("created_at asc").Find(&convs)
|
query := db.Order("created_at asc")
|
||||||
|
|
||||||
|
if id != 0 {
|
||||||
|
query = query.Where("user_id = ?", id)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := query.Find(&convs).Error; err != nil {
|
||||||
|
http.Error(w, "Erreur lors du chargement des conversations", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
"Conversations": convs,
|
"Conversations": convs,
|
||||||
@ -390,6 +399,7 @@ func AdminConversationThread(db *gorm.DB) http.HandlerFunc {
|
|||||||
renderPartial(w, "admin_conversations_thread", data)
|
renderPartial(w, "admin_conversations_thread", data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Dashboard(db *gorm.DB) http.HandlerFunc {
|
func Dashboard(db *gorm.DB) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
val := r.Context().Value("ssoid")
|
val := r.Context().Value("ssoid")
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
<select id="userSelect"
|
<select id="userSelect"
|
||||||
name="user"
|
name="user"
|
||||||
onchange="location.href='/admin/user/' + this.value + '/conversations'">
|
onchange="location.href='/admin/user/' + this.value + '/conversations'">
|
||||||
<option value="">Tous les utilisateurs</option>
|
<option value="0">Tous les utilisateurs</option>
|
||||||
{{ range .Clients }}
|
{{ range .Clients }}
|
||||||
<option value="{{ .ID }}" {{ if eq $.UserID (printf "%d" .ID) }}selected{{ end }}>
|
<option value="{{ .ID }}" {{ if eq $.UserID (printf "%d" .ID) }}selected{{ end }}>
|
||||||
{{ .Email }}
|
{{ .Email }}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user