Skip to content

Commit

Permalink
Add documentation to new files and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
LocalNewsTV committed Jan 10, 2024
1 parent e644a8e commit 5bf9a89
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
13 changes: 7 additions & 6 deletions ipad/Models/Shift/BlowbyModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
// 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

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 = {
Expand Down Expand Up @@ -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"
Expand Down
19 changes: 17 additions & 2 deletions ipad/Models/Shift/Form Fields/ShiftFormHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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] = []

Expand Down Expand Up @@ -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] = []

Expand Down Expand Up @@ -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] = []
Expand Down
4 changes: 2 additions & 2 deletions ipad/Views/New Blowby Modal/NewBlowbyModal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 5bf9a89

Please sign in to comment.