diff --git a/app/views/items/_form.html.erb b/app/views/items/_form.html.erb index af902c3..08f258c 100644 --- a/app/views/items/_form.html.erb +++ b/app/views/items/_form.html.erb @@ -119,7 +119,7 @@ placeholder="Tippe den Namen ein..."> - <% User.all.each do |user| %> + <% User.all.order(:first_name, :last_name).each do |user| %> <% end %> @@ -142,7 +142,7 @@ placeholder="Tippe die Raumnummer ein..."> - <% Room.all.each do |room| %> + <% Room.all.order(:name).each do |room| %> <% end %> diff --git a/db/seeds.rb b/db/seeds.rb index 76ec1a7..88742d9 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -16,20 +16,29 @@ Department.destroy_all Category.destroy_all puts "Erstelle Abteilungen..." -dept_it = Department.create!(name: "IT & Infrastruktur", code: "IT") -dept_mkt = Department.create!(name: "Marketing", code: "MKT") +dept_mit = Department.create!(name: "Mitarbeiter", code: "Mit") +dept_prof = Department.create!(name: "Professor", code: "Prof") +dept_wimi = Department.create!(name: "Wissenschaftlicher Mitarbeiter", code: "WiMi") +Department.create!(name: "Studentische Hilfskraft", code: "HiWi") puts "Erstelle Benutzer..." -u1 = User.create!(first_name: "Max", last_name: "Mustermann", email: "max@firma.de", password: "password123123", department: dept_it) -u2 = User.create!(first_name: "Erika", last_name: "Mustermann", email: "erika@firma.de", password: "password123123", department: dept_mkt) +u1 = User.create!(first_name: "Max", last_name: "Mustermann", email: "max@firma.de", password: "password123123", department: dept_mit) +u2 = User.create!(first_name: "Julia", last_name: "Herhold", email: "julia.herhold@hs-rm.de", password: "password123123", department: dept_prof) + +User.create!(first_name: "Silke", last_name: "Bartsch", email: "silke.bartsch@hs-rm.de", password: "password123123", department: dept_mit) +User.create!(first_name: "Mario", last_name: "Miscioscia", email: "mario.miscioschia@hs-rm.de", password: "password123123", department: dept_wimi) puts "Erstelle Kategorien..." cat_hardware = Category.create!(name: "Hardware", description: "Laptops und Monitore") cat_furniture = Category.create!(name: "Möbel", description: "Tische und Stühle") puts "Erstelle Räume..." -room_101 = Room.create!(name: "Raum 101", building: "Hauptgebäude", floor: "1. OG") -room_lab = Room.create!(name: "Technik-Labor", building: "Werkstatt", floor: "EG") +room_101 = Room.create!(name: "D101", building: "D", floor: "EG") +room_102 = Room.create!(name: "D102", building: "D", floor: "EG") +[ "D103", "D106", "D107", "D116", "D118", "D121", "D122", "D123", "D124", "D125", "D126", "D127", "D128", "D131", "D132" ].each { |rnr| Room.create!(name: rnr, building: "D", floor: "EG") } +[ "D201", "D202" ].each { |rnr| Room.create!(name: rnr, building: "D", floor: "1. OG") } +[ "D302", "D303" ].each { |rnr| Room.create!(name: rnr, building: "D", floor: "2. OG") } +room_lab = Room.create!(name: "D301", building: "D", floor: "2.OG") puts "Erstelle Artikel..." # Artikel fest an User vergeben @@ -41,7 +50,17 @@ item_laptop = Item.create!( # Artikel fest an einen Raum vergeben item_monitor = Item.create!( name: "Dell 27\" Monitor", sku: "DELL-U27", sticker_id: "10002", serial_number: "CN-0708XX", - price: 450.00, notes: "Fest verbaut an der Wand", category: cat_hardware, room: room_101 + price: 450.00, notes: nil, category: cat_hardware, room: room_101 +) + +Item.create!( + name: "Dell 27\" Monitor", sku: "DELL-U27", sticker_id: "10003", serial_number: "CN-0748XD", + price: 450.00, notes: nil, category: cat_hardware, room: room_102 +) + +Item.create!( + name: "Dell 27\" Monitor", sku: "DELL-U27", sticker_id: "10004", serial_number: "CN-0728DD", + price: 450.00, notes: nil, category: cat_hardware, room: room_102 ) puts "🎉 Datenbank erfolgreich aufgesetzt!"