Done with createClassView
This commit is contained in:
parent
4a295b9b88
commit
4ee81cf2ea
BIN
Schedule ICTIS/Fonts/Montserrat-Black.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-Black.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-BlackItalic.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-BlackItalic.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-Bold.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-Bold.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-BoldItalic.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-BoldItalic.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-ExtraBold.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-ExtraBold.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-ExtraBoldItalic.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-ExtraBoldItalic.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-ExtraLight.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-ExtraLight.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-ExtraLightItalic.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-ExtraLightItalic.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-Italic.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-Italic.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-Light.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-Light.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-LightItalic.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-LightItalic.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-Medium.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-Medium.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-MediumItalic.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-MediumItalic.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-Regular.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-Regular.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-SemiBold.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-SemiBold.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-SemiBoldItalic.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-SemiBoldItalic.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-Thin.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-Thin.ttf
Executable file
Binary file not shown.
BIN
Schedule ICTIS/Fonts/Montserrat-ThinItalic.ttf
Executable file
BIN
Schedule ICTIS/Fonts/Montserrat-ThinItalic.ttf
Executable file
Binary file not shown.
@ -9,12 +9,11 @@ import SwiftUI
|
||||
|
||||
struct AuditoryFieldView: View {
|
||||
@Binding var text: String
|
||||
var nameOfImage: String
|
||||
var labelForField: String
|
||||
@FocusState var isFocused: Bool
|
||||
var body: some View {
|
||||
HStack(spacing: 0) {
|
||||
Image(systemName: nameOfImage)
|
||||
Image(systemName: "mappin.and.ellipse")
|
||||
.foregroundColor(Color.gray)
|
||||
.padding(.leading, 12)
|
||||
.padding(.trailing, 7)
|
||||
@ -44,5 +43,5 @@ struct AuditoryFieldView: View {
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ContentView()
|
||||
AuditoryFieldView(text: .constant(""), labelForField: "Корпус-аудитория")
|
||||
}
|
||||
|
@ -9,12 +9,11 @@ import SwiftUI
|
||||
|
||||
struct ProfessorFieldView: View {
|
||||
@Binding var text: String
|
||||
var nameOfImage: String
|
||||
var labelForField: String
|
||||
@FocusState var isFocused: Bool
|
||||
var body: some View {
|
||||
HStack(spacing: 0) {
|
||||
Image(systemName: nameOfImage)
|
||||
Image(systemName: "graduationcap")
|
||||
.foregroundColor(Color.gray)
|
||||
.padding(.leading, 12)
|
||||
.padding(.trailing, 7)
|
||||
@ -44,5 +43,5 @@ struct ProfessorFieldView: View {
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ContentView()
|
||||
ProfessorFieldView(text: .constant(""), labelForField: "Преподаватель")
|
||||
}
|
||||
|
@ -10,12 +10,11 @@ import SwiftUI
|
||||
struct SubjectFieldView: View {
|
||||
@Binding var text: String
|
||||
@Binding var isShowingSubjectFieldRed: Bool
|
||||
var nameOfImage: String
|
||||
@Binding var labelForField: String
|
||||
@FocusState var isFocused: Bool
|
||||
var body: some View {
|
||||
HStack(spacing: 0) {
|
||||
Image(systemName: nameOfImage)
|
||||
Image(systemName: "book")
|
||||
.foregroundColor(Color.gray)
|
||||
.padding(.leading, 12)
|
||||
.padding(.trailing, 7)
|
||||
@ -62,5 +61,5 @@ struct SubjectFieldView: View {
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ContentView()
|
||||
SubjectFieldView(text: .constant(""), isShowingSubjectFieldRed: .constant(false), labelForField: .constant("Предмет"))
|
||||
}
|
||||
|
@ -11,10 +11,11 @@ struct MainView: View {
|
||||
@State private var searchText: String = ""
|
||||
@State private var isShowingMonthSlider: Bool = false
|
||||
@ObservedObject var vm: ScheduleViewModel
|
||||
@FocusState private var isFocusedSearchBar: Bool
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
SearchBarView(text: $searchText, vm: vm)
|
||||
SearchBarView(text: $searchText, isFocused: _isFocusedSearchBar, vm: vm)
|
||||
|
||||
if (vm.isFirstStartOffApp && vm.isLoading) {
|
||||
LoadingView(isLoading: $vm.isLoading)
|
||||
@ -33,6 +34,9 @@ struct MainView: View {
|
||||
Text(error.failureReason)
|
||||
}
|
||||
.background(Color("background"))
|
||||
.onTapGesture {
|
||||
isFocusedSearchBar = false
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
|
@ -9,7 +9,7 @@ import SwiftUI
|
||||
|
||||
struct SearchBarView: View {
|
||||
@Binding var text: String
|
||||
@FocusState private var isFocused: Bool
|
||||
@FocusState var isFocused: Bool
|
||||
@State private var isShowingSheet: Bool = false
|
||||
@ObservedObject var vm: ScheduleViewModel
|
||||
|
||||
|
@ -27,7 +27,7 @@ struct CreateEditClassView: View {
|
||||
NavigationView {
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
VStack {
|
||||
SubjectFieldView(text: $vm._class.subject, isShowingSubjectFieldRed: $isShowingSubjectFieldRed, nameOfImage: "book", labelForField: $textForLabelInSubjectField, isFocused: _isFocusedSubject)
|
||||
SubjectFieldView(text: $vm._class.subject, isShowingSubjectFieldRed: $isShowingSubjectFieldRed, labelForField: $textForLabelInSubjectField, isFocused: _isFocusedSubject)
|
||||
.padding(.bottom, 10)
|
||||
HStack {
|
||||
Text("Тип")
|
||||
@ -50,7 +50,7 @@ struct CreateEditClassView: View {
|
||||
|
||||
ZStack {
|
||||
if vm._class.online == "Оффлайн" {
|
||||
AuditoryFieldView(text: $vm._class.auditory, nameOfImage: "mappin.and.ellipse", labelForField: "Корпус-аудитория", isFocused: _isFocusedAuditory)
|
||||
AuditoryFieldView(text: $vm._class.auditory, labelForField: "Корпус-аудитория", isFocused: _isFocusedAuditory)
|
||||
.padding(.bottom, 10)
|
||||
.transition(.asymmetric(
|
||||
insertion: .offset(y: -50).combined(with: .identity),
|
||||
@ -65,7 +65,7 @@ struct CreateEditClassView: View {
|
||||
value: vm._class.online
|
||||
)
|
||||
|
||||
ProfessorFieldView(text: $vm._class.professor, nameOfImage: "book", labelForField: "Преподаватель", isFocused: _isFocusedProfessor)
|
||||
ProfessorFieldView(text: $vm._class.professor, labelForField: "Преподаватель", isFocused: _isFocusedProfessor)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
HStack {
|
||||
@ -108,14 +108,6 @@ struct CreateEditClassView: View {
|
||||
self.isIncorrectDate2 = false
|
||||
}
|
||||
}
|
||||
// .overlay {
|
||||
// if isIncorrectDate1 {
|
||||
// Rectangle()
|
||||
// .frame(maxWidth: 300, maxHeight: 1)
|
||||
// .foregroundColor(.red)
|
||||
// .padding(.horizontal)
|
||||
// }
|
||||
// }
|
||||
Spacer()
|
||||
StartEndTimeFieldView(isIncorrectDate: $isIncorrectDate2, selectedDay: $vm._class.day, selectedTime: $vm._class.endtime, imageName: "clock.badge.xmark", text: "Конец", isTimeSelected: $isSelectedTime2)
|
||||
.onChange(of: vm._class.endtime) { oldValue, newValue in
|
||||
@ -131,14 +123,6 @@ struct CreateEditClassView: View {
|
||||
self.isIncorrectDate2 = false
|
||||
}
|
||||
}
|
||||
// .overlay {
|
||||
// if isIncorrectDate2 {
|
||||
// Rectangle()
|
||||
// .frame(maxWidth: 300, maxHeight: 1)
|
||||
// .foregroundColor(.red)
|
||||
// .padding(.horizontal)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
.frame(height: 40)
|
||||
.padding(.bottom, 10)
|
||||
@ -238,8 +222,20 @@ struct CreateEditClassView: View {
|
||||
.navigationTitle(vm.isNew ? "Новая пара" : "Изменить данные")
|
||||
.background(Color("background"))
|
||||
.onAppear {
|
||||
if day >= Calendar.current.startOfDay(for: Date()) {
|
||||
let temp = Calendar.current.date(byAdding: .hour, value: 1, to: Date.init())
|
||||
if let endTime = temp {
|
||||
if (!hoursMinutesAreEqual(date1: vm._class.starttime, isEqualTo: Date()) && !hoursMinutesAreEqual(date1: vm._class.endtime, isEqualTo: endTime)) {
|
||||
self.isSelectedTime1 = true
|
||||
self.isSelectedTime2 = true
|
||||
print(vm._class.starttime)
|
||||
print(vm._class.endtime)
|
||||
print(endTime)
|
||||
print(Date())
|
||||
}
|
||||
}
|
||||
if day > Calendar.current.startOfDay(for: Date()) {
|
||||
vm._class.day = day
|
||||
print(34)
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
|
@ -2,7 +2,7 @@
|
||||
// WeekTabView.swift
|
||||
// Schedule ICTIS
|
||||
//
|
||||
// Created by G412 on 10.12.2024.
|
||||
// Created by Mironov Egor on 10.12.2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
@ -2,7 +2,7 @@
|
||||
// WeekViewForMonth.swift
|
||||
// Schedule ICTIS
|
||||
//
|
||||
// Created by G412 on 20.12.2024.
|
||||
// Created by Mironov Egor on 20.12.2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
@ -2,7 +2,7 @@
|
||||
// WeekView.swift
|
||||
// Schedule ICTIS
|
||||
//
|
||||
// Created by G412 on 20.12.2024.
|
||||
// Created by Mironov Egor on 20.12.2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
21
Schedule ICTIS/Preview Content/Assets.xcassets/auditoryImage.imageset/Contents.json
vendored
Normal file
21
Schedule ICTIS/Preview Content/Assets.xcassets/auditoryImage.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "auditoryImage.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
Schedule ICTIS/Preview Content/Assets.xcassets/auditoryImage.imageset/auditoryImage.png
vendored
Normal file
BIN
Schedule ICTIS/Preview Content/Assets.xcassets/auditoryImage.imageset/auditoryImage.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 549 B |
21
Schedule ICTIS/Preview Content/Assets.xcassets/bookImage.imageset/Contents.json
vendored
Normal file
21
Schedule ICTIS/Preview Content/Assets.xcassets/bookImage.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "bookImage.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
Schedule ICTIS/Preview Content/Assets.xcassets/bookImage.imageset/bookImage.png
vendored
Normal file
BIN
Schedule ICTIS/Preview Content/Assets.xcassets/bookImage.imageset/bookImage.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 466 B |
21
Schedule ICTIS/Preview Content/Assets.xcassets/professorHatImage.imageset/Contents.json
vendored
Normal file
21
Schedule ICTIS/Preview Content/Assets.xcassets/professorHatImage.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "professorHatImage.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
Schedule ICTIS/Preview Content/Assets.xcassets/professorHatImage.imageset/professorHatImage.png
vendored
Normal file
BIN
Schedule ICTIS/Preview Content/Assets.xcassets/professorHatImage.imageset/professorHatImage.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 716 B |
@ -71,6 +71,15 @@ extension View {
|
||||
}
|
||||
}
|
||||
|
||||
func hoursMinutesAreEqual(date1: Date, isEqualTo date2: Date) -> Bool {
|
||||
let calendar = Calendar.current
|
||||
|
||||
let components1 = calendar.dateComponents([.day, .hour, .minute], from: date1)
|
||||
let components2 = calendar.dateComponents([.day, .hour, .minute], from: date2)
|
||||
|
||||
return components1.day == components2.day && components1.hour == components2.hour && components1.minute == components2.minute
|
||||
}
|
||||
|
||||
// MARK: ScheduleView
|
||||
func daysAreEqual(_ date1: Date, _ date2: Date) -> Bool {
|
||||
let calendar = Calendar.current
|
||||
|
38
Schedule-ICTIS-Info.plist
Normal file
38
Schedule-ICTIS-Info.plist
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>UIAppFonts</key>
|
||||
<array>
|
||||
<string>Montserrat-Black.ttf</string>
|
||||
<string>Montserrat-BlackItalic.ttf</string>
|
||||
<string>Montserrat-Bold.ttf</string>
|
||||
<string>Montserrat-BoldItalic.ttf</string>
|
||||
<string>Montserrat-ExtraBold.ttf</string>
|
||||
<string>Montserrat-ExtraBoldItalic.ttf</string>
|
||||
<string>Montserrat-ExtraLight.ttf</string>
|
||||
<string>Montserrat-ExtraLightItalic.ttf</string>
|
||||
<string>Montserrat-Italic.ttf</string>
|
||||
<string>Montserrat-Light.ttf</string>
|
||||
<string>Montserrat-LightItalic.ttf</string>
|
||||
<string>Montserrat-Medium.ttf</string>
|
||||
<string>Montserrat-MediumItalic.ttf</string>
|
||||
<string>Montserrat-Regular.ttf</string>
|
||||
<string>Montserrat-SemiBold.ttf</string>
|
||||
<string>Montserrat-SemiBoldItalic.ttf</string>
|
||||
<string>Montserrat-Thin.ttf</string>
|
||||
<string>Montserrat-ThinItalic.ttf</string>
|
||||
</array>
|
||||
<key>UTImportedTypeDeclarations</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UTTypeIconFiles</key>
|
||||
<array/>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string></string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict/>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
Loading…
x
Reference in New Issue
Block a user