From 5bf9a894bfbe8213b0c863456fe7bf86678b3481 Mon Sep 17 00:00:00 2001 From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com> Date: Wed, 10 Jan 2024 14:44:59 -0800 Subject: [PATCH] Add documentation to new files and functions --- ipad/Models/Shift/BlowbyModel.swift | 13 +++++++------ .../Shift/Form Fields/ShiftFormHelper.swift | 19 +++++++++++++++++-- .../New Blowby Modal/NewBlowbyModal.swift | 4 ++-- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ipad/Models/Shift/BlowbyModel.swift b/ipad/Models/Shift/BlowbyModel.swift index f84b0d5..4b0b961 100644 --- a/ipad/Models/Shift/BlowbyModel.swift +++ b/ipad/Models/Shift/BlowbyModel.swift @@ -2,8 +2,8 @@ // BlowbyModel.swift // ipad // -// Created by Matthew Logan on 2024-01-02. -// Copyright © 2024 Amir Shayegh. All rights reserved. +// Created by Sustainment Team on 2024-01-02. +// Copyright © Sustainment Team. All rights reserved. // import Foundation @@ -11,6 +11,7 @@ import Foundation import Realm import RealmSwift +/// Model for displaying Blowbys that occur during a shift, complies with Realm protocols class BlowbyModel: Object, BaseRealmObject { @objc dynamic var userId: String = "" @objc dynamic var localId: String = { @@ -95,11 +96,11 @@ class BlowbyModel: Object, BaseRealmObject { return BlowByFormHelper.getBlowByFields(for: self, editable: editable, modalSize: modalSize) } - /// <#Description#> + /// Creates a formatted Date time object for displaying Blowby Data /// - Parameters: - /// - time: <#time description#> - /// - date: <#date description#> - /// - Returns: <#description#> + /// - time: Value from the TimeInput field + /// - date: Value from the Date Input field + /// - Returns: Date object taking the calendar date from date object, and time value from time String func formattedDateTime(time: String, date: Date) -> String? { let timeFormatter = DateFormatter() timeFormatter.dateFormat = "YYYY-MM-dd HH:mm:ss" diff --git a/ipad/Models/Shift/Form Fields/ShiftFormHelper.swift b/ipad/Models/Shift/Form Fields/ShiftFormHelper.swift index 6e71fd5..d2f4cb6 100644 --- a/ipad/Models/Shift/Form Fields/ShiftFormHelper.swift +++ b/ipad/Models/Shift/Form Fields/ShiftFormHelper.swift @@ -8,8 +8,16 @@ import Foundation + +/// Helper class for producing input fields for Shiftmodels class ShiftFormHelper { - + + /// Gets the required Input objects needed for the ShiftStartFields section of shift + /// - Parameters: + /// - object: Instance of the ShiftModel + /// - editable: Will forms be editable, or viewable only + /// - modalSize: Small rendering of components, or regular size rendering of components + /// - Returns: [InputItems] Form input items static func getShiftStartFields(for object: ShiftModel? = nil, editable: Bool? = true, modalSize: Bool? = false) -> [InputItem] { var sectionItems: [InputItem] = [] @@ -52,7 +60,11 @@ class ShiftFormHelper { return sectionItems } - + /// Gets the required Input objects needed for the ShiftEndFields section of shift + /// - Parameters: + /// - object: Instance of the ShiftModel + /// - editable: Will forms be editable, or viewable only + /// - Returns: [InputItems] Form input items static func getShiftEndFields(for object: ShiftModel? = nil, editable: Bool? = true) -> [InputItem] { var sectionItems: [InputItem] = [] @@ -94,6 +106,9 @@ class ShiftFormHelper { return sectionItems } + + /// Return the columns for displaying Shift Overview information + /// - Returns: [TableViewColumnConfig] Array of table column configuration objects func getTableColumns() -> [TableViewColumnConfig] { // Create Column Config var columns: [TableViewColumnConfig] = [] diff --git a/ipad/Views/New Blowby Modal/NewBlowbyModal.swift b/ipad/Views/New Blowby Modal/NewBlowbyModal.swift index 4ac760e..12281cf 100644 --- a/ipad/Views/New Blowby Modal/NewBlowbyModal.swift +++ b/ipad/Views/New Blowby Modal/NewBlowbyModal.swift @@ -10,6 +10,7 @@ import Foundation import Modal import UIKit +/// Modal for displaying and editing Blowby information occuring in a shift class NewBlowbyModal: ModalView, Theme { // MARK: Variables @@ -82,7 +83,6 @@ class NewBlowbyModal: ModalView, Theme { present(); style(); - //Give the modal a refernce to the current shift, and set the Blowby self.model = shift; self.newBlowBy = newBlowby; // since a valid modal would have a timeStamp passed in, we can determine if this is an empty model or an existing one @@ -98,7 +98,7 @@ class NewBlowbyModal: ModalView, Theme { accessibilityValue = "newShiftModal"; } - /// Changes Buttons in view to reflect that we are editing a modal, to help differentiate that we are not creating a modal. + /// Changes Buttons and Headers in Modal to reflect we are editing a Blowby. private func editingMode() { cancelButton.setTitle("Delete", for: .normal); cancelButton.removeTarget(nil, action: #selector(cancelAction(_:)), for: .touchUpInside)