parent
5102f7a2da
commit
5f8e5ffd26
Binary file not shown.
@ -0,0 +1,50 @@
|
||||
//
|
||||
// UeDetails.swift
|
||||
// CalculMoy
|
||||
//
|
||||
// Created by etudiant on 13/06/2023.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct UeDetails: View {
|
||||
|
||||
@ObservedObject var managerVM: ManagerVM
|
||||
@ObservedObject var ue:UeVM
|
||||
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading){
|
||||
Text(ue.ueName)
|
||||
.font(.title)
|
||||
.padding(.bottom)
|
||||
UEView(ueVm: ue, managerVm: managerVM)
|
||||
Divider()
|
||||
ScrollView{
|
||||
|
||||
ForEach (0..<ue.moduleVMs.count){module in
|
||||
//Text(managerVM.ueList[ue].ueName)
|
||||
|
||||
ModuleView(moduleVM: ue.moduleVMs[module], ueVm: ue, managerVm: managerVM)
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}.padding()
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
struct UeDetails_Previews: PreviewProvider {
|
||||
static var managerData:ManagerVM=ManagerVM(
|
||||
manager: Manager(ues: Stub.uesData)
|
||||
)
|
||||
static var previews: some View {
|
||||
UeDetails(managerVM: managerData,ue: managerData.ueList[0])
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
//
|
||||
// UesList.swift
|
||||
// CalculMoy
|
||||
//
|
||||
// Created by etudiant on 13/06/2023.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct UesList: View {
|
||||
|
||||
@ObservedObject var managerVM: ManagerVM
|
||||
|
||||
var body: some View {
|
||||
NavigationStack{
|
||||
ScrollView(){
|
||||
|
||||
VStack(alignment: .leading){
|
||||
Text("Blocs")
|
||||
.font(.title)
|
||||
.padding(.bottom)
|
||||
|
||||
Text("Vous devez avoir la moyenne à chacun de ces blocs pour avoir votre diplôme.")
|
||||
.font(.subheadline)
|
||||
.padding(.bottom)
|
||||
|
||||
|
||||
if let moyGen = managerVM.getMoyGeneral(){
|
||||
HStack {
|
||||
Text("Total")
|
||||
Spacer()
|
||||
Text(String(format: "%.2f",moyGen))
|
||||
Image(systemName: moyGen >= 10 ? "graduationcap.fill" : "exclamationmark.bubble.fill")
|
||||
}
|
||||
}else{
|
||||
Text("noData")
|
||||
}
|
||||
|
||||
|
||||
|
||||
}.padding()
|
||||
|
||||
|
||||
VStack(alignment: .leading){
|
||||
|
||||
|
||||
Text("UEs")
|
||||
.font(.title)
|
||||
.padding(.bottom)
|
||||
|
||||
// for ue in managerVM.ueList {
|
||||
// Text(ue.ueName)
|
||||
// }
|
||||
|
||||
ForEach (0..<managerVM.ueList.count){ue in
|
||||
//Text(managerVM.ueList[ue].ueName)
|
||||
NavigationLink(destination:
|
||||
UeDetails(managerVM: managerVM,ue: managerVM.ueList[ue])
|
||||
){
|
||||
UEView(ueVm: managerVM.ueList[ue], managerVm: managerVM)
|
||||
}
|
||||
}
|
||||
|
||||
}.padding()
|
||||
|
||||
}.navigationTitle("Calculette")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct UesList_Previews: PreviewProvider {
|
||||
static var managerData:ManagerVM=ManagerVM(
|
||||
manager: Manager(ues: Stub.uesData)
|
||||
)
|
||||
static var previews: some View {
|
||||
UesList(managerVM: managerData)
|
||||
}
|
||||
}
|
Loading…
Reference in new issue