Commit 22ca578e authored by Wei Han's avatar Wei Han

code update

parent ee616b19
...@@ -11,20 +11,20 @@ ...@@ -11,20 +11,20 @@
44006126336D83DB220E7214 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; }; 44006126336D83DB220E7214 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; };
761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; }; 761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
950A967506366138996B34BA /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 08C95BC9A5B6BC17979676EC /* libPods-example.a */; }; C23D2D55B148EE1D6FC72852 /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E39174A7BBC525ECB6AE459E /* libPods-example.a */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
08C95BC9A5B6BC17979676EC /* libPods-example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
13B07F961A680F5B00A75B9A /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 13B07F961A680F5B00A75B9A /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = example/Images.xcassets; sourceTree = "<group>"; }; 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = example/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = example/Info.plist; sourceTree = "<group>"; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = example/Info.plist; sourceTree = "<group>"; };
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = example/PrivacyInfo.xcprivacy; sourceTree = "<group>"; }; 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = example/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
690F9972D97F745507217F02 /* Pods-example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.release.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.release.xcconfig"; sourceTree = "<group>"; };
761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = example/AppDelegate.swift; sourceTree = "<group>"; }; 761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = example/AppDelegate.swift; sourceTree = "<group>"; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = example/LaunchScreen.storyboard; sourceTree = "<group>"; }; 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = example/LaunchScreen.storyboard; sourceTree = "<group>"; };
E9E0F976F970803123876068 /* Pods-example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.release.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.release.xcconfig"; sourceTree = "<group>"; }; B9F2E44A1B314258ABABFD33 /* Pods-example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.debug.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.debug.xcconfig"; sourceTree = "<group>"; };
E39174A7BBC525ECB6AE459E /* libPods-example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
FA5C9464D4270BCB5E2B5606 /* Pods-example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.debug.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
950A967506366138996B34BA /* libPods-example.a in Frameworks */, C23D2D55B148EE1D6FC72852 /* libPods-example.a in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
ED297162215061F000B7C4FE /* JavaScriptCore.framework */, ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
08C95BC9A5B6BC17979676EC /* libPods-example.a */, E39174A7BBC525ECB6AE459E /* libPods-example.a */,
); );
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -92,8 +92,8 @@ ...@@ -92,8 +92,8 @@
BBD78D7AC51CEA395F1C20DB /* Pods */ = { BBD78D7AC51CEA395F1C20DB /* Pods */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
FA5C9464D4270BCB5E2B5606 /* Pods-example.debug.xcconfig */, B9F2E44A1B314258ABABFD33 /* Pods-example.debug.xcconfig */,
E9E0F976F970803123876068 /* Pods-example.release.xcconfig */, 690F9972D97F745507217F02 /* Pods-example.release.xcconfig */,
); );
path = Pods; path = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -105,13 +105,13 @@ ...@@ -105,13 +105,13 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "example" */; buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "example" */;
buildPhases = ( buildPhases = (
82370A9BDD9AA0D77C19EFC8 /* [CP] Check Pods Manifest.lock */, 890064CE3093270C24794A65 /* [CP] Check Pods Manifest.lock */,
13B07F871A680F5B00A75B9A /* Sources */, 13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */, 13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */, 13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
E574563129899784DB9E58BA /* [CP] Embed Pods Frameworks */, 7E9430E69C9A5F57AD35CC5A /* [CP] Embed Pods Frameworks */,
D34FB6FAC9791DDA2B8870A6 /* [CP] Copy Pods Resources */, DB2FCD814B6946290F8F7B0A /* [CP] Copy Pods Resources */,
); );
buildRules = ( buildRules = (
); );
...@@ -183,7 +183,24 @@ ...@@ -183,7 +183,24 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n"; shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
}; };
82370A9BDD9AA0D77C19EFC8 /* [CP] Check Pods Manifest.lock */ = { 7E9430E69C9A5F57AD35CC5A /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
890064CE3093270C24794A65 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
...@@ -205,7 +222,7 @@ ...@@ -205,7 +222,7 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
D34FB6FAC9791DDA2B8870A6 /* [CP] Copy Pods Resources */ = { DB2FCD814B6946290F8F7B0A /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
...@@ -222,23 +239,6 @@ ...@@ -222,23 +239,6 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources.sh\"\n"; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources.sh\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
E574563129899784DB9E58BA /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = { 13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = FA5C9464D4270BCB5E2B5606 /* Pods-example.debug.xcconfig */; baseConfigurationReference = B9F2E44A1B314258ABABFD33 /* Pods-example.debug.xcconfig */;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
}; };
13B07F951A680F5B00A75B9A /* Release */ = { 13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = E9E0F976F970803123876068 /* Pods-example.release.xcconfig */; baseConfigurationReference = 690F9972D97F745507217F02 /* Pods-example.release.xcconfig */;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
......
...@@ -47,6 +47,20 @@ ...@@ -47,6 +47,20 @@
[self setupOwnerScrollView]; [self setupOwnerScrollView];
[self showSummary]; // default tab [self showSummary]; // default tab
NSLog(@"📦 Received Appointment Data: %@", self.appointmentData);
NSString *text = [NSString stringWithFormat:@"%@", self.appointmentData];
NSString *docsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
NSString *filePath = [docsPath stringByAppendingPathComponent:@"appointData.txt"];
// Convert issueData to a readable string
NSString *plainText = [NSString stringWithFormat:@"%@", self.appointmentData];
// Write as plain UTF-8 text
[plainText writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:nil];
// Log the path so you can find it
NSLog(@"📁 appointData saved as plain text to: %@", filePath);
} }
#pragma mark - NavBar #pragma mark - NavBar
...@@ -107,7 +121,7 @@ ...@@ -107,7 +121,7 @@
[header addSubview:unitNumber]; [header addSubview:unitNumber];
UILabel *unitType = [[UILabel alloc] init]; UILabel *unitType = [[UILabel alloc] init];
unitType.text = self.appointmentData[@"unit_type"]; unitType.text = self.appointmentData[@"unit_layout_type"];
unitType.font = [UIFont systemFontOfSize:14]; unitType.font = [UIFont systemFontOfSize:14];
unitType.textColor = UIColor.grayColor; unitType.textColor = UIColor.grayColor;
unitType.translatesAutoresizingMaskIntoConstraints = NO; unitType.translatesAutoresizingMaskIntoConstraints = NO;
...@@ -237,10 +251,10 @@ ...@@ -237,10 +251,10 @@
}; };
self.typeField = makeField(@"Type:", self.appointmentData[@"appointment_type"]); self.typeField = makeField(@"Type:", self.appointmentData[@"appointment_type"]);
self.dateField = makeField(@"Date:", self.appointmentData[@"appointment_date"]); self.dateField = makeField(@"Date:", self.appointmentData[@"start_date"]);
self.slotField = makeField(@"Time Slot:", self.appointmentData[@"appointment_time"]); self.slotField = makeField(@"Time Slot:", self.appointmentData[@"start_time"]);
self.locField = makeField(@"Location:", self.appointmentData[@"location"]); self.locField = makeField(@"Location:", self.appointmentData[@"location"]); //hmm wtf
self.termsField = makeField(@"Terms & Conditions:", @"View Here"); self.termsField = makeField(@"Terms &\nConditions:", @"View Here");
[NSLayoutConstraint activateConstraints:@[ [NSLayoutConstraint activateConstraints:@[
[self.summaryCard.topAnchor constraintEqualToAnchor:self.summaryContentView.topAnchor constant:20], [self.summaryCard.topAnchor constraintEqualToAnchor:self.summaryContentView.topAnchor constant:20],
...@@ -250,7 +264,6 @@ ...@@ -250,7 +264,6 @@
[titleLabel.topAnchor constraintEqualToAnchor:self.summaryCard.topAnchor constant:16], [titleLabel.topAnchor constraintEqualToAnchor:self.summaryCard.topAnchor constant:16],
[titleLabel.leadingAnchor constraintEqualToAnchor:self.summaryCard.leadingAnchor constant:16], [titleLabel.leadingAnchor constraintEqualToAnchor:self.summaryCard.leadingAnchor constant:16],
[titleLabel.trailingAnchor constraintEqualToAnchor:self.summaryCard.trailingAnchor constant:-16], [titleLabel.trailingAnchor constraintEqualToAnchor:self.summaryCard.trailingAnchor constant:-16],
[titleLabel.bottomAnchor constraintEqualToAnchor:self.summaryCard.bottomAnchor constant:-16],
[self.typeField.topAnchor constraintEqualToAnchor:titleLabel.bottomAnchor constant:12], [self.typeField.topAnchor constraintEqualToAnchor:titleLabel.bottomAnchor constant:12],
[self.typeField.leadingAnchor constraintEqualToAnchor:self.summaryCard.leadingAnchor constant:16], [self.typeField.leadingAnchor constraintEqualToAnchor:self.summaryCard.leadingAnchor constant:16],
...@@ -271,6 +284,8 @@ ...@@ -271,6 +284,8 @@
[self.termsField.topAnchor constraintEqualToAnchor:self.locField.bottomAnchor constant:12], [self.termsField.topAnchor constraintEqualToAnchor:self.locField.bottomAnchor constant:12],
[self.termsField.leadingAnchor constraintEqualToAnchor:self.summaryCard.leadingAnchor constant:16], [self.termsField.leadingAnchor constraintEqualToAnchor:self.summaryCard.leadingAnchor constant:16],
[self.termsField.trailingAnchor constraintEqualToAnchor:self.summaryCard.trailingAnchor constant:-16], [self.termsField.trailingAnchor constraintEqualToAnchor:self.summaryCard.trailingAnchor constant:-16],
[self.summaryCard.bottomAnchor constraintEqualToAnchor:self.termsField.bottomAnchor constant:16]
]]; ]];
// Cancel button // Cancel button
...@@ -283,7 +298,7 @@ ...@@ -283,7 +298,7 @@
[self.summaryContentView addSubview:self.summaryCancelBtn]; [self.summaryContentView addSubview:self.summaryCancelBtn];
[NSLayoutConstraint activateConstraints:@[ [NSLayoutConstraint activateConstraints:@[
[self.summaryCancelBtn.topAnchor constraintEqualToAnchor:self.termsField.bottomAnchor constant:20], [self.summaryCancelBtn.topAnchor constraintEqualToAnchor:self.termsField.bottomAnchor constant:40],
[self.summaryCancelBtn.leadingAnchor constraintEqualToAnchor:self.summaryContentView.leadingAnchor constant:16], [self.summaryCancelBtn.leadingAnchor constraintEqualToAnchor:self.summaryContentView.leadingAnchor constant:16],
[self.summaryCancelBtn.trailingAnchor constraintEqualToAnchor:self.summaryContentView.trailingAnchor constant:-16], [self.summaryCancelBtn.trailingAnchor constraintEqualToAnchor:self.summaryContentView.trailingAnchor constant:-16],
[self.summaryCancelBtn.heightAnchor constraintEqualToConstant:55], [self.summaryCancelBtn.heightAnchor constraintEqualToConstant:55],
...@@ -316,17 +331,17 @@ ...@@ -316,17 +331,17 @@
[self.ownerContentView.widthAnchor constraintEqualToAnchor:self.ownerScrollView.widthAnchor], [self.ownerContentView.widthAnchor constraintEqualToAnchor:self.ownerScrollView.widthAnchor],
]]; ]];
NSArray *owners = self.appointmentData[@"owners"]; // Array of dictionaries
UIView *previousCard = nil; UIView *previousCard = nil;
for (NSDictionary *ownerData in owners) { // Primary Owner
UIView *card = [self createOwnerCardWithData:ownerData]; NSArray *primaryOwners = self.appointmentData[@"primary_buyer"];
for (NSDictionary *owner in primaryOwners) {
UIView *card = [self createOwnerCardWithData:owner isPrimary:YES];
[self.ownerContentView addSubview:card]; [self.ownerContentView addSubview:card];
[NSLayoutConstraint activateConstraints:@[ [NSLayoutConstraint activateConstraints:@[
[card.leadingAnchor constraintEqualToAnchor:self.ownerContentView.leadingAnchor constant:16], [card.leadingAnchor constraintEqualToAnchor:self.ownerContentView.leadingAnchor constant:16],
[card.trailingAnchor constraintEqualToAnchor:self.ownerContentView.trailingAnchor constant:-16], [card.trailingAnchor constraintEqualToAnchor:self.ownerContentView.trailingAnchor constant:-16],
[card.heightAnchor constraintEqualToConstant:120],
]]; ]];
if (previousCard) { if (previousCard) {
...@@ -337,7 +352,26 @@ ...@@ -337,7 +352,26 @@
previousCard = card; previousCard = card;
} }
// Cancel button at the bottom // Joint Owners
NSArray *jointOwners = self.appointmentData[@"joint_buyer"];
for (NSDictionary *owner in jointOwners) {
UIView *card = [self createOwnerCardWithData:owner isPrimary:NO];
[self.ownerContentView addSubview:card];
[NSLayoutConstraint activateConstraints:@[
[card.leadingAnchor constraintEqualToAnchor:self.ownerContentView.leadingAnchor constant:16],
[card.trailingAnchor constraintEqualToAnchor:self.ownerContentView.trailingAnchor constant:-16],
]];
if (previousCard) {
[card.topAnchor constraintEqualToAnchor:previousCard.bottomAnchor constant:16].active = YES;
} else {
[card.topAnchor constraintEqualToAnchor:self.ownerContentView.topAnchor constant:20].active = YES;
}
previousCard = card;
}
// Cancel button
self.ownerCancelBtn = [UIButton buttonWithType:UIButtonTypeCustom]; self.ownerCancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self.ownerCancelBtn setTitle:@"Cancel Appointment" forState:UIControlStateNormal]; [self.ownerCancelBtn setTitle:@"Cancel Appointment" forState:UIControlStateNormal];
self.ownerCancelBtn.backgroundColor = [UIColor systemRedColor]; self.ownerCancelBtn.backgroundColor = [UIColor systemRedColor];
...@@ -355,8 +389,8 @@ ...@@ -355,8 +389,8 @@
]]; ]];
} }
#pragma mark - Helper: Create Owner Card // Updated createOwnerCardWithData
- (UIView *)createOwnerCardWithData:(NSDictionary *)ownerData { - (UIView *)createOwnerCardWithData:(NSDictionary *)ownerData isPrimary:(BOOL)isPrimary {
UIView *card = [[UIView alloc] init]; UIView *card = [[UIView alloc] init];
card.backgroundColor = UIColor.whiteColor; card.backgroundColor = UIColor.whiteColor;
card.layer.cornerRadius = 12; card.layer.cornerRadius = 12;
...@@ -369,23 +403,41 @@ ...@@ -369,23 +403,41 @@
nameLabel.font = [UIFont boldSystemFontOfSize:16]; nameLabel.font = [UIFont boldSystemFontOfSize:16];
nameLabel.translatesAutoresizingMaskIntoConstraints = NO; nameLabel.translatesAutoresizingMaskIntoConstraints = NO;
UILabel *typeLabel = [[UILabel alloc] init]; UILabel *secondLabel = [[UILabel alloc] init];
typeLabel.text = [NSString stringWithFormat:@"Type: %@", ownerData[@"type"]]; // Primary/Joint secondLabel.font = [UIFont systemFontOfSize:14];
typeLabel.font = [UIFont systemFontOfSize:14]; secondLabel.textColor = UIColor.darkGrayColor;
typeLabel.textColor = UIColor.darkGrayColor; secondLabel.translatesAutoresizingMaskIntoConstraints = NO;
typeLabel.translatesAutoresizingMaskIntoConstraints = NO;
UILabel *thirdLabel = [[UILabel alloc] init];
thirdLabel.font = [UIFont systemFontOfSize:14];
thirdLabel.textColor = UIColor.darkGrayColor;
thirdLabel.translatesAutoresizingMaskIntoConstraints = NO;
if (isPrimary) {
secondLabel.text = [NSString stringWithFormat:@"NRIC/Passport: %@", ownerData[@"ic_passport"]];
thirdLabel.text = [NSString stringWithFormat:@"Contact No: %@", ownerData[@"contact"]];
} else {
secondLabel.text = [NSString stringWithFormat:@"Email: %@", ownerData[@"email"]];
thirdLabel.text = [NSString stringWithFormat:@"Contact No: %@", ownerData[@"contact"]];
}
[card addSubview:nameLabel]; [card addSubview:nameLabel];
[card addSubview:typeLabel]; [card addSubview:secondLabel];
[card addSubview:thirdLabel];
[NSLayoutConstraint activateConstraints:@[ [NSLayoutConstraint activateConstraints:@[
[nameLabel.topAnchor constraintEqualToAnchor:card.topAnchor constant:16], [nameLabel.topAnchor constraintEqualToAnchor:card.topAnchor constant:16],
[nameLabel.leadingAnchor constraintEqualToAnchor:card.leadingAnchor constant:16], [nameLabel.leadingAnchor constraintEqualToAnchor:card.leadingAnchor constant:16],
[nameLabel.trailingAnchor constraintEqualToAnchor:card.trailingAnchor constant:-16], [nameLabel.trailingAnchor constraintEqualToAnchor:card.trailingAnchor constant:-16],
[typeLabel.topAnchor constraintEqualToAnchor:nameLabel.bottomAnchor constant:8], [secondLabel.topAnchor constraintEqualToAnchor:nameLabel.bottomAnchor constant:8],
[typeLabel.leadingAnchor constraintEqualToAnchor:card.leadingAnchor constant:16], [secondLabel.leadingAnchor constraintEqualToAnchor:card.leadingAnchor constant:16],
[typeLabel.trailingAnchor constraintEqualToAnchor:card.trailingAnchor constant:-16], [secondLabel.trailingAnchor constraintEqualToAnchor:card.trailingAnchor constant:-16],
[thirdLabel.topAnchor constraintEqualToAnchor:secondLabel.bottomAnchor constant:8],
[thirdLabel.leadingAnchor constraintEqualToAnchor:card.leadingAnchor constant:16],
[thirdLabel.trailingAnchor constraintEqualToAnchor:card.trailingAnchor constant:-16],
[thirdLabel.bottomAnchor constraintEqualToAnchor:card.bottomAnchor constant:-16]
]]; ]];
return card; return card;
......
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