Unverified Commit db05ad47 authored by Zach Knox's avatar Zach Knox
Browse files

real days of the week and category labels

coming up next: real times
parent 95eca621
......@@ -5,7 +5,7 @@
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......@@ -226,6 +226,7 @@
</constraints>
<size key="customSize" width="300" height="131"/>
<connections>
<outlet property="categoryLabel" destination="uhu-6U-8Tx" id="VbH-qG-9cN"/>
<outlet property="nameLabel" destination="6QR-8Q-n4s" id="Nbh-eh-fDp"/>
<outlet property="openClosedLabel" destination="DEx-BH-Fun" id="9dP-3e-Hcy"/>
<outlet property="timeDescriptionLabel" destination="o7N-To-w50" id="gAW-xD-mws"/>
......@@ -570,6 +571,7 @@
</barButtonItem>
</navigationItem>
<connections>
<outlet property="CategoryLabel" destination="jN2-Me-tgL" id="O8r-Lq-Zvs"/>
<outlet property="NameLabel" destination="W3q-KN-OAm" id="hKO-vT-1Py"/>
<outlet property="OpenLabel" destination="BoH-CV-Nfo" id="Syj-CD-neJ"/>
<outlet property="OpenTimesList" destination="N1f-XR-xpn" id="8WA-Q4-slc"/>
......
......@@ -13,7 +13,8 @@ class FacilityCollectionViewCell: UICollectionViewCell {
@IBOutlet var nameLabel: UILabel!
@IBOutlet var timeDescriptionLabel: UILabel!
@IBOutlet var openClosedLabel: UILabel!
var facility: Facility!
@IBOutlet var categoryLabel: UILabel!
var facility: Facility!
internal let tapRecognizer: UITapGestureRecognizer = UITapGestureRecognizer()
override func awakeFromNib() {
......
......@@ -37,7 +37,28 @@ class Utilities: NSObject {
return open
}
static func getDayOfWeek() -> Int? {
static func getDayOfWeek(_ day: Day) -> String? {
switch day {
case .Monday:
return "Monday"
case .Tuesday:
return "Tuesday"
case .Wednesday:
return "Wednesday"
case .Thursday:
return "Thursday"
case .Friday:
return "Friday"
case .Saturday:
return "Saturday"
case .Sunday:
return "Sunday"
default:
return nil
}
}
static func getCurrentDayOfWeek() -> Int? {
let todayDate = NSDate()
let myCalendar = NSCalendar(calendarIdentifier: NSCalendar.Identifier.gregorian)
let myComponents = myCalendar?.components(.weekday, from: todayDate as Date)
......@@ -62,7 +83,7 @@ class Utilities: NSObject {
let scheduleValid = special ? self.isSpecialSchedule(facility) : self.isMainSchedule(facility: facility)
let scheduleOpenTimes = special ? facility.specialSchedule!.openTimes : facility.mainSchedule!.openTimes
let currentDay = getDayOfWeek()
let currentDay = getCurrentDayOfWeek()
if(scheduleValid) {
for openTime in scheduleOpenTimes {
if(currentDay! >= openTime.startDay && currentDay! <= openTime.endDay) {
......
......@@ -202,6 +202,7 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
let facility = dataArray[indexPath.row]
cell.facility = facility
cell.nameLabel.text = facility.facilityName
cell.categoryLabel.text = facility.category?.categoryName.uppercased()
let open = Utilities.isOpen(facility: facility)
if(open == true) {
......
......@@ -13,7 +13,8 @@ class FacilityDetailViewController: UIViewController, UITableViewDelegate, UITab
@IBOutlet var NameLabel: UILabel!
@IBOutlet var PlaceLabel: UILabel!
@IBOutlet var OpenLabel: UILabel!
@IBOutlet var CategoryLabel: UILabel!
@IBOutlet var OpenTimesList: UITableView!
@IBOutlet var detailStackView: UIStackView!
......@@ -37,10 +38,10 @@ class FacilityDetailViewController: UIViewController, UITableViewDelegate, UITab
modalPresentationCapturesStatusBarAppearance = true
//NameLabel.text = facility.name
//PlaceLabel.text = facility.location
NameLabel.text = "Test"
PlaceLabel.text = "123"
NameLabel.text = facility.facilityName
PlaceLabel.text = facility.facilityLocation!.building
CategoryLabel.text = facility.category?.categoryName.uppercased()
let open = Utilities.isOpen(facility: facility)
if(open) {
......@@ -70,12 +71,15 @@ class FacilityDetailViewController: UIViewController, UITableViewDelegate, UITab
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return 7
return (facility.mainSchedule?.openTimes.count)!
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = OpenTimesList.dequeueReusableCell(withIdentifier: "LocationDetailCell", for: indexPath)
let openTime = facility.mainSchedule?.openTimes[indexPath.row]
cell.textLabel?.text = Utilities.getDayOfWeek(Day(rawValue: openTime!.startDay)!)
cell.detailTextLabel?.text = "12:00 AM - 11:59 PM"
// Configure the cell...
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment