Browse Source

Users list first version

Vova Tkach 6 years ago
parent
commit
744b4c98e0

+ 37 - 2
engine/backend/modules/module_users.go

@@ -45,9 +45,44 @@ func (this *Module) Module_users_submenu() []utils.ModuleSubMenu {
 }
 
 func (this *Module) Module_users_content() string {
-	return "Users content"
+	if this.smod == "default" {
+		// List
+		result := `<table class="table table-striped table-bordered">
+			<thead>
+				<tr>
+					<th scope="col">Email</th>
+					<th scope="col">First name</th>
+					<th scope="col">Last name</th>
+					<th scope="col">Action</th>
+				</tr>
+			</thead>
+		<tbody>`
+		rows, err := this.db.Query("SELECT `id`, `first_name`, `last_name`, `email` FROM `users`;")
+		if err == nil {
+			var id int
+			var first_name string
+			var last_name string
+			var email string
+			for rows.Next() {
+				err = rows.Scan(&id, &first_name, &last_name, &email)
+				if err == nil {
+					result += `<tr>
+						<td>` + email + `</td>
+						<td>` + first_name + `</td>
+						<td>` + last_name + `</td>
+						<td><a href="#">` + others.File_assets_sys_svg_edit + `</a> <a href="#">` + others.File_assets_sys_svg_remove + `</a></td>
+					</tr>`
+				}
+			}
+		}
+		result += `</tbody></table>`
+		return result
+	} else if this.smod == "modify" {
+		// Add/Edit
+	}
+	return ""
 }
 
 func (this *Module) Module_users_sidebar() string {
-	return "Users right sidebar"
+	return ""
 }

+ 2 - 0
engine/wrapper/resources/others/assets.sys.svg.icons.go

@@ -5,3 +5,5 @@ var File_assets_sys_svg_list = `<svg viewBox="0 0 16 16" width="16" height="16"
 var File_assets_sys_svg_plus = `<svg viewBox="0 0 16 16" width="16" height="16" class="sicon" version="1.1"><path fill-rule="evenodd" d="M12 9H7v5H5V9H0V7h5V2h2v5h5v2z"></path></svg>`
 var File_assets_sys_svg_gear = `<svg viewBox="0 0 16 16" width="16" height="16" class="sicon" version="1.1"><path fill-rule="evenodd" d="M14 8.77v-1.6l-1.94-.64-.45-1.09.88-1.84-1.13-1.13-1.81.91-1.09-.45-.69-1.92h-1.6l-.63 1.94-1.11.45-1.84-.88-1.13 1.13.91 1.81-.45 1.09L0 7.23v1.59l1.94.64.45 1.09-.88 1.84 1.13 1.13 1.81-.91 1.09.45.69 1.92h1.59l.63-1.94 1.11-.45 1.84.88 1.13-1.13-.92-1.81.47-1.09L14 8.75v.02zM7 11c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z"></path></svg>`
 var File_assets_sys_svg_user = `<svg viewBox="0 0 16 16" width="16" height="16" class="sicon" version="1.1"><path fill-rule="evenodd" d="M12 14.002a.998.998 0 0 1-.998.998H1.001A1 1 0 0 1 0 13.999V13c0-2.633 4-4 4-4s.229-.409 0-1c-.841-.62-.944-1.59-1-4 .173-2.413 1.867-3 3-3s2.827.586 3 3c-.056 2.41-.159 3.38-1 4-.229.59 0 1 0 1s4 1.367 4 4v1.002z"></path></svg>`
+var File_assets_sys_svg_edit = `<svg viewBox="0 0 16 16" width="16" height="16" class="sicon" version="1.1"><path fill-rule="evenodd" d="M0 12v3h3l8-8-3-3-8 8zm3 2H1v-2h1v1h1v1zm10.3-9.3L12 6 9 3l1.3-1.3a.996.996 0 0 1 1.41 0l1.59 1.59c.39.39.39 1.02 0 1.41z"></path></svg>`
+var File_assets_sys_svg_remove = `<svg viewBox="0 0 16 16" width="16" height="16" class="sicon" version="1.1"><path fill-rule="evenodd" d="M11 2H9c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1H2c-.55 0-1 .45-1 1v1c0 .55.45 1 1 1v9c0 .55.45 1 1 1h7c.55 0 1-.45 1-1V5c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 12H3V5h1v8h1V5h1v8h1V5h1v8h1V5h1v9zm1-10H2V3h9v1z"></path></svg>`