Skip to content
This repository has been archived by the owner on Apr 27, 2024. It is now read-only.

Commit

Permalink
Updated start view and job details
Browse files Browse the repository at this point in the history
  • Loading branch information
carlobortolan committed Sep 10, 2023
1 parent a8314fc commit bc7e8d2
Show file tree
Hide file tree
Showing 13 changed files with 418 additions and 85 deletions.
8 changes: 8 additions & 0 deletions mobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
2216EA812A8D761700C970DD /* PostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2216EA802A8D761700C970DD /* PostView.swift */; };
2216EA832A8D762400C970DD /* ExploreView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2216EA822A8D762400C970DD /* ExploreView.swift */; };
2216EA862A8D765500C970DD /* StartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2216EA852A8D765500C970DD /* StartView.swift */; };
2221CE2D2AAE0E2C00E94A50 /* JobDetail2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2221CE2C2AAE0E2C00E94A50 /* JobDetail2.swift */; };
2221CE312AAE5CA700E94A50 /* ContactAndDirections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2221CE302AAE5CA700E94A50 /* ContactAndDirections.swift */; };
22430F952AAA5C2D00747827 /* ImagePickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22430F942AAA5C2D00747827 /* ImagePickerView.swift */; };
22430F982AAA5CEC00747827 /* ImagePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22430F972AAA5CEC00747827 /* ImagePicker.swift */; };
22430F9C2AAAB3C400747827 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22430F9B2AAAB3C400747827 /* SettingsView.swift */; };
Expand Down Expand Up @@ -114,6 +116,8 @@
2216EA802A8D761700C970DD /* PostView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostView.swift; sourceTree = "<group>"; };
2216EA822A8D762400C970DD /* ExploreView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExploreView.swift; sourceTree = "<group>"; };
2216EA852A8D765500C970DD /* StartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartView.swift; sourceTree = "<group>"; };
2221CE2C2AAE0E2C00E94A50 /* JobDetail2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JobDetail2.swift; sourceTree = "<group>"; };
2221CE302AAE5CA700E94A50 /* ContactAndDirections.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactAndDirections.swift; sourceTree = "<group>"; };
22430F942AAA5C2D00747827 /* ImagePickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImagePickerView.swift; sourceTree = "<group>"; };
22430F972AAA5CEC00747827 /* ImagePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImagePicker.swift; sourceTree = "<group>"; };
22430F9B2AAAB3C400747827 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -321,12 +325,14 @@
227E9C942AABB83700049CAB /* ApplicationDetail.swift */,
227E9C962AABB91300049CAB /* ApplicationPopup.swift */,
226B63852AA78C1F004620EE /* ApplicationPreview.swift */,
2221CE302AAE5CA700E94A50 /* ContactAndDirections.swift */,
22430F972AAA5CEC00747827 /* ImagePicker.swift */,
226B637B2AA78A85004620EE /* JobPosting.swift */,
226B637D2AA78AB4004620EE /* JobItem.swift */,
22DC3AEF2AACC20F00B783E8 /* JobCard.swift */,
22DC3AEA2AACBF7500B783E8 /* JobCarusel.swift */,
22B8041C2AA891ED008D7108 /* JobDetail.swift */,
2221CE2C2AAE0E2C00E94A50 /* JobDetail2.swift */,
22DC3AF72AAD31ED00B783E8 /* JobMapAnnotation.swift */,
226B637F2AA78ACD004620EE /* JobPreview.swift */,
228E0CEA2AADFF8100AEF8A2 /* JobsMapAnnotation.swift */,
Expand Down Expand Up @@ -625,6 +631,7 @@
22B8046B2AA91D4B008D7108 /* OwnJobsView.swift in Sources */,
22B804672AA91D37008D7108 /* ProfileView.swift in Sources */,
2216EA6F2A8D262400C970DD /* ErrorHandlingManager.swift in Sources */,
2221CE2D2AAE0E2C00E94A50 /* JobDetail2.swift in Sources */,
2216EA712A8D2E7D00C970DD /* KeyChainManager.swift in Sources */,
22DC3AF62AAD2F6800B783E8 /* JobMapView.swift in Sources */,
22B804612AA90EB7008D7108 /* ApplicationHandler.swift in Sources */,
Expand All @@ -637,6 +644,7 @@
2216EA812A8D761700C970DD /* PostView.swift in Sources */,
227E9C992AABBB4100049CAB /* JobManager.swift in Sources */,
228E0CEB2AADFF8100AEF8A2 /* JobsMapAnnotation.swift in Sources */,
2221CE312AAE5CA700E94A50 /* ContactAndDirections.swift in Sources */,
22B8045F2AA90E9C008D7108 /* JobHandler.swift in Sources */,
22E73EC62A8BFDDF0042CF01 /* mobileApp.swift in Sources */,
);
Expand Down
20 changes: 20 additions & 0 deletions mobile/Assets.xcassets/NoticeColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF4",
"green" : "0x84",
"red" : "0x00"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
11 changes: 10 additions & 1 deletion mobile/Models/JobModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ struct Job: Codable, Hashable, Identifiable {
let jobValue: String
let allowedCvFormat: [String]
let imageUrl: String
let employerEmail: String?
let employerPhone: Double?
let employerName: String?

var id: Int { jobId }

Expand Down Expand Up @@ -114,6 +117,9 @@ struct Job: Codable, Hashable, Identifiable {
case jobValue = "job_value"
case allowedCvFormat = "allowed_cv_format"
case imageUrl = "image_url"
case employerPhone = "employer_phone"
case employerEmail = "employer_email"
case employerName = "employer_name"
}

func toJSON() -> String? {
Expand Down Expand Up @@ -199,7 +205,10 @@ class JobModel {
cvRequired: true,
jobValue: "Random Job Value",
allowedCvFormat: [".pdf", ".docx"],
imageUrl: "https://cdn.mos.cms.futurecdn.net/ohsXtgy8Hmi9PzDNpKhJ5N.jpg"
imageUrl: "https://cdn.mos.cms.futurecdn.net/ohsXtgy8Hmi9PzDNpKhJ5N.jpg",
employerEmail: "[email protected]",
employerPhone: 15225237383.0,
employerName: "Employer Name"
)
return randomJob
}
Expand Down
2 changes: 1 addition & 1 deletion mobile/Models/UserModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ struct User: Codable {
self.imageURL = "https://embloy.onrender.com/assets/img/features_3.png"
self.phone = nil
self.degree = nil
}
}

init(userId: Int, email: String, passwordDigest: String, activityStatus: Int, firstName: String, lastName: String, longitude: Double?, latitude: Double?, countryCode: String?, postalCode: String?, city: String?, address: String?, dateOfBirth: Date?, userType: String, viewCount: Int, createdAt: String, updatedAt: String, applicationsCount: Int, jobsCount: Int, userRole: String, applicationNotifications: Bool, twitterURL: String?, facebookURL: String?, instagramURL: String?, linkedinURL: String?, imageURL: String?, phone: String?, degree: String?) {
self.userId = userId
Expand Down
1 change: 1 addition & 0 deletions mobile/Views/Components/ApplicationButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import SwiftUI
struct ApplicationButton: View {
var body: some View {
RoundedRectangle(cornerRadius: 10)
.stroke(Color("FgColor"), lineWidth: 5)
.frame(height: 60)
.foregroundColor(Color("FeedBgColor"))
.border(Color("FgColor"), width: 3)
Expand Down
58 changes: 58 additions & 0 deletions mobile/Views/Components/ContactAndDirections.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// SwiftUIView.swift
// mobile
//
// Created by cb on 10.09.23.
//

import SwiftUI

struct ContactAndDirections: View {
let job: Job

var body: some View {
HStack {
if let phone = job.employerPhone {
Spacer()
Link(destination: URL(string: "tel://\(phone)")!) {
Image(systemName: "phone")
.font(.title)
.foregroundColor(.blue)
}
Spacer()
}

if let email = job.employerEmail {
Spacer()
Link(destination: URL(string: "mailto:\(email)")!) {
Image(systemName: "envelope")
.font(.title)
.foregroundColor(.blue)
}
Spacer()
}
Spacer()
Link(destination: getDirectionsURL()) {
Image(systemName: "arrow.right.circle")
.font(.title)
.foregroundColor(.blue)
}
Spacer()
}.padding()
}

// Function to generate directions URL
private func getDirectionsURL() -> URL {
let destinationLat = job.latitude
let destinationLong = job.longitude
let googleMapsURL = "https://www.google.com/maps/dir/?api=1&destination=\(destinationLat),\(destinationLong)"

return URL(string: googleMapsURL)!
}
}

struct Previews_ContactAndDirections_Previews: PreviewProvider {
static var previews: some View {
ContactAndDirections(job: JobModel.generateRandomJob())
}
}
2 changes: 1 addition & 1 deletion mobile/Views/Components/JobCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct JobCardView: View {
var job: Job

var body: some View {
NavigationLink(destination: JobDetail(job: job)) {
NavigationLink(destination: JobDetail2(job: job)) {
ZStack(alignment: .center) {
RoundedRectangle(cornerRadius: 10) // Add a RoundedRectangle with a corner radius
.stroke(Color("FgColor"), lineWidth: 1) // Set border color and width
Expand Down
159 changes: 81 additions & 78 deletions mobile/Views/Components/JobDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,63 +22,67 @@ struct JobDetail: View {
@State var job: Job

var body: some View {
VStack(alignment: .leading, spacing: 10) {
RoundedRectangle(cornerRadius: 10)
.frame(height: 300)
.foregroundColor(Color("FeedBgColor"))
.border(Color("FgColor"), width: 3)
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.padding(.all)
.frame(height: 300)
.foregroundColor(Color("FeedBgColor"))
.border(Color("FgColor"), width: 3)
.padding(.horizontal, 10.0)
.overlay(
VStack(alignment: .center, spacing: 10) {
Text(job.title)
.font(.title)
.padding(.horizontal)
Divider()
.padding()

Text("Job Type: \(job.jobType)")
.font(.title3)
.padding(.horizontal)

Text("Salary: \(job.salary) \(job.currency) for \(job.duration) h")
.font(.title3)
.padding(.horizontal)

Text("Duration: \(job.duration) months")
.font(.title3)
.padding(.horizontal)
Divider()
.padding()

Text("Location: \(job.city), \(job.countryCode)")
.font(.subheadline)
.padding(.horizontal)
}
)
)

RoundedRectangle(cornerRadius: 10)
.frame(height: 200)
.foregroundColor(Color("FeedBgColor"))
.border(Color("FgColor"), width: 3)
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.frame(height: 200)
.foregroundColor(Color("FeedBgColor"))
.border(Color("FgColor"), width: 3)
.padding(.horizontal, 10.0)
.overlay(
JobMapView(job: job).padding()
)
)
VStack(alignment: .leading, spacing: 10) {
ScrollView {
VStack(alignment: .leading, spacing: 10) {
RoundedRectangle(cornerRadius: 10)
.stroke(Color("FgColor"), lineWidth: 5)
.frame(height: 300)
.foregroundColor(Color("FeedBgColor"))
.border(Color("FgColor"), width: 3)
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.padding(.all)
.frame(height: 300)
.foregroundColor(Color("FeedBgColor"))
.border(Color("FgColor"), width: 3)
.padding(.horizontal, 10.0)
.overlay(
VStack(alignment: .center, spacing: 10) {
Text(job.title)
.font(.title)
.padding(.horizontal)
Divider()
.padding()

Text("Job Type: \(job.jobType)")
.font(.title3)
.padding(.horizontal)

Text("Salary: \(job.salary) \(job.currency) for \(job.duration) h")
.font(.title3)
.padding(.horizontal)

Text("Duration: \(job.duration) months")
.font(.title3)
.padding(.horizontal)
Divider()
.padding()

Text("Location: \(job.city), \(job.countryCode)")
.font(.subheadline)
.padding(.horizontal)
}
)
)

RoundedRectangle(cornerRadius: 10)
.stroke(Color("FgColor"), lineWidth: 5)
.frame(height: 200)
.foregroundColor(Color("FeedBgColor"))
.border(Color("FgColor"), width: 3)
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.frame(height: 200)
.foregroundColor(Color("FeedBgColor"))
.border(Color("FgColor"), width: 3)
.padding(.horizontal, 10.0)
.overlay(
JobMapView(job: job).padding()
)
)}}
Button(action: {
isApplicationPopupVisible.toggle()
}) {
Expand All @@ -88,29 +92,28 @@ struct JobDetail: View {
ApplicationButton()
}
}
}
.onAppear() {
hasApplication = applicationManager.hasApplication(forUserId:
authenticationManager.current.userId, andJobId: job.jobId)
}
.padding()
.sheet(isPresented: $isApplicationPopupVisible) {
if hasApplication {
ApplicationDetail(jobId: job.jobId)
} else {
NavigationView {
ApplicationPopup(isVisible: $isApplicationPopupVisible, message: $applicationMessage, job: job)
.navigationBarItems(trailing: Button("Close") {
isApplicationPopupVisible.toggle()
})
.navigationBarTitle("\(job.title)", displayMode: .inline)
}
.onDisappear {
hasApplication = applicationManager.hasApplication(forUserId: authenticationManager.current.userId, andJobId: job.jobId)
print("Sheet disappeared - test")
.onAppear() {
hasApplication = applicationManager.hasApplication(forUserId:
authenticationManager.current.userId, andJobId: job.jobId)
}
.sheet(isPresented: $isApplicationPopupVisible) {
if hasApplication {
ApplicationDetail(jobId: job.jobId)
} else {
NavigationView {
ApplicationPopup(isVisible: $isApplicationPopupVisible, message: $applicationMessage, job: job)
.navigationBarItems(trailing: Button("Close") {
isApplicationPopupVisible.toggle()
})
.navigationBarTitle("\(job.title)", displayMode: .inline)
}
.onDisappear {
hasApplication = applicationManager.hasApplication(forUserId: authenticationManager.current.userId, andJobId: job.jobId)
print("Sheet disappeared - test")
}
}
}
}
}
}
}

Expand Down
Loading

0 comments on commit bc7e8d2

Please sign in to comment.