Commit e54ac633 authored by Wei Han's avatar Wei Han

code update

parent cb977eab
......@@ -7,9 +7,9 @@
objects = {
/* Begin PBXBuildFile section */
0DB59E54C0AC880864FE2DED /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C76E4DA09BCDA64E6AB1EC44 /* libPods-example.a */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
44006126336D83DB220E7214 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; };
5F4A3CC64B2ECE3AC87E1244 /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CAD4EDE547AF420693D76574 /* libPods-example.a */; };
761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
......@@ -21,9 +21,9 @@
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = example/PrivacyInfo.xcprivacy; 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>"; };
8A486A6AB07608F834FB5B89 /* 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>"; };
917B7F7F64B2B22022FAD12E /* 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>"; };
C76E4DA09BCDA64E6AB1EC44 /* libPods-example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
BF80FACDA71FF077CAE23907 /* 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>"; };
C0D6DDD20DAAEA10C6999BD6 /* 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>"; };
CAD4EDE547AF420693D76574 /* 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; };
/* End PBXFileReference section */
......@@ -32,7 +32,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0DB59E54C0AC880864FE2DED /* libPods-example.a in Frameworks */,
5F4A3CC64B2ECE3AC87E1244 /* libPods-example.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -55,7 +55,7 @@
isa = PBXGroup;
children = (
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
C76E4DA09BCDA64E6AB1EC44 /* libPods-example.a */,
CAD4EDE547AF420693D76574 /* libPods-example.a */,
);
name = Frameworks;
sourceTree = "<group>";
......@@ -92,8 +92,8 @@
BBD78D7AC51CEA395F1C20DB /* Pods */ = {
isa = PBXGroup;
children = (
8A486A6AB07608F834FB5B89 /* Pods-example.debug.xcconfig */,
917B7F7F64B2B22022FAD12E /* Pods-example.release.xcconfig */,
C0D6DDD20DAAEA10C6999BD6 /* Pods-example.debug.xcconfig */,
BF80FACDA71FF077CAE23907 /* Pods-example.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
......@@ -105,13 +105,13 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "example" */;
buildPhases = (
D1A8819C404F13A442A1FDE8 /* [CP] Check Pods Manifest.lock */,
19EDDD902D7748F2DDB86B4D /* [CP] Check Pods Manifest.lock */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
4B89C01D6158CC79657F83B1 /* [CP] Embed Pods Frameworks */,
91AD97B7843DEC6888B2EDE6 /* [CP] Copy Pods Resources */,
B56BFE2E5078044A567DF3A0 /* [CP] Embed Pods Frameworks */,
788C036C201D78CD57E01EDA /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -183,24 +183,29 @@
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";
};
4B89C01D6158CC79657F83B1 /* [CP] Embed Pods Frameworks */ = {
19EDDD902D7748F2DDB86B4D /* [CP] Check Pods Manifest.lock */ = {
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";
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-example-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks.sh\"\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;
};
91AD97B7843DEC6888B2EDE6 /* [CP] Copy Pods Resources */ = {
788C036C201D78CD57E01EDA /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
......@@ -217,26 +222,21 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
D1A8819C404F13A442A1FDE8 /* [CP] Check Pods Manifest.lock */ = {
B56BFE2E5078044A567DF3A0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-example-checkManifestLockResult.txt",
"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
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 = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
......@@ -255,7 +255,7 @@
/* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8A486A6AB07608F834FB5B89 /* Pods-example.debug.xcconfig */;
baseConfigurationReference = C0D6DDD20DAAEA10C6999BD6 /* Pods-example.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
......@@ -283,7 +283,7 @@
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 917B7F7F64B2B22022FAD12E /* Pods-example.release.xcconfig */;
baseConfigurationReference = BF80FACDA71FF077CAE23907 /* Pods-example.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
......
......@@ -8,32 +8,32 @@
<key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
......
......@@ -5,6 +5,7 @@
@interface AppointmentAPIClient : NSObject
+ (void)fetchAppointment:(void (^)(NSDictionary *data, NSError *error))completion;
+ (void)fetchGeneralInfo:(void (^)(NSDictionary *data, NSError *error))completion;
@end
......@@ -69,4 +69,68 @@
[task resume];
}
+ (void)fetchGeneralInfo:(void (^)(NSDictionary *data, NSError *error))completion {
// ✅ URL
NSString *urlString = @"https://kitadev.commudesk.com/api/owner/appointment/getUnitInfo?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImF0aGlyYWh6YWlkaUBjb252ZXAuY29tIiwicGFzc3dvcmQiOiIkMnkkMTAkNU9xYklqMnZ6UHJwckJrcVd5c3I2LmJCc1hVYS9Hd014eUhnL3RhUUhPUkNQcGdmTG8yakciLCJzdWIiOjIxNzAsImlzcyI6Imh0dHBzOi8va2l0YWRldi5jb21tdWRlc2suY29tL2FwaS9vd25lci9hdXRoL3Bhc3N3b3JkbGVzc19sb2dpbiIsImlhdCI6MTc2MDMxNTM1MiwiZXhwIjoyMDc1ODg0ODcyLCJuYmYiOjE3NjAzMTUzNTIsImp0aSI6IktoQmNyQnJEdDVNdDZlWmMifQ.JnxGbZ7hTeoOr6oibIzZMphgyKtTo2Aq9Efx6mrGfFA";
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
// ✅ JSON headers
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
// ✅ Build JSON body
NSDictionary *jsonBody = @{
@"data": @{
@"os": @"AND",
@"drawing_plan_id": @"135"
}
};
// ✅ Convert dictionary → NSData
NSError *jsonError;
NSData *bodyData = [NSJSONSerialization dataWithJSONObject:jsonBody options:0 error:&jsonError];
if (jsonError) {
NSLog(@"❌ JSON Serialization Error: %@", jsonError);
if (completion) completion(nil, jsonError);
return;
}
request.HTTPBody = bodyData;
// 🧭 Debug logs
NSLog(@"🌍 URL: %@", urlString);
NSLog(@"📦 Body JSON: %@", jsonBody);
// ✅ Make request
NSURLSessionDataTask *task = [[NSURLSession sharedSession]
dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"❌ Network Error: %@", error);
dispatch_async(dispatch_get_main_queue(), ^{
if (completion) completion(nil, error);
});
return;
}
NSError *jsonParseError;
NSDictionary *jsonResponse = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonParseError];
if (jsonParseError) {
NSLog(@"⚠️ JSON Parse Error: %@", jsonParseError);
} else {
NSLog(@"✅ General Info API Response:\n%@", jsonResponse);
}
dispatch_async(dispatch_get_main_queue(), ^{
if (completion) completion(jsonResponse, jsonParseError);
});
}];
[task resume];
}
@end
// AppointmentTimeSlotViewController.h
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface AppointmentTimeSlotViewController : UIViewController
// Set this before pushing/presenting the VC:
@property (nonatomic, strong) NSDictionary *appointmentInfo;
// Optional callback for when user completes selection
@property (nonatomic, copy) void (^didSelectAppointment)(NSDictionary *appointmentInfo);
@property (nonatomic, strong) NSString *projectId;
@property (nonatomic, strong) NSString *projectName;
@property (nonatomic, strong) NSString *drawingPlanId;
@property (nonatomic, strong) NSString *unitName;
@property (nonatomic, strong) NSString *appointmentType;
@property (nonatomic, strong) NSArray *timeSlot;
@property (nonatomic, strong) NSString *termsAndCondition;
@property (nonatomic, strong) NSArray *representativeList;
@end
NS_ASSUME_NONNULL_END
......@@ -9,6 +9,13 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong) NSString *projectName;
@property (nonatomic, strong) NSString *projectId;
@property (nonatomic, strong) NSArray *allSlots; // Equivalent to rawSlots
@property (nonatomic, strong) NSMutableArray *aryTimeSlot; // Equivalent to aryTimeSlotTemp
@property (nonatomic, strong) NSString *selectedDateString;
@property (nonatomic, strong) NSDictionary *markedDates;
@property (nonatomic, strong) UICollectionView *timeSlotCollectionView;
@end
NS_ASSUME_NONNULL_END
......@@ -24,6 +24,8 @@ NS_ASSUME_NONNULL_BEGIN
// currently selected date
@property (nonatomic, strong, nullable) NSDate *selectedDate;
@property (nonatomic, strong, readonly) UICollectionView *collectionView;
// set starting month (default = today)
- (void)setDisplayedMonth:(NSDate *)monthAnimated:(BOOL)animated;
......
......@@ -191,11 +191,15 @@ static const NSInteger kColumns = 7;
}
#pragma mark - collection view datasource
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
CalendarDayCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kDayCellId forIndexPath:indexPath];
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
CalendarDayCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kDayCellId
forIndexPath:indexPath];
NSDate *d = [self dateForIndexPathItem:indexPath.item];
BOOL inMonth = (d != nil);
NSNumber *dayNumber = nil;
if (d) {
NSCalendar *cal = [NSCalendar currentCalendar];
......@@ -203,17 +207,37 @@ static const NSInteger kColumns = 7;
dayNumber = @(c.day);
}
BOOL enabled = YES;
if (d && self.minDate) {
if ([d compare:self.minDate] == NSOrderedAscending) {
enabled = NO;
}
}
NSString *status = [self statusForDate:d];
BOOL selected = (d && self.selectedDate && [d isSameDayAsDate:self.selectedDate]);
// Configure day number / selection AFTER color & userInteraction are set
[cell configureWithDay:dayNumber
inMonth:inMonth
enabled:YES // always pass YES here; past/today handled above
status:status
selected:selected];
// Reset cell to defaults
cell.layer.borderWidth = 0;
cell.layer.borderColor = nil;
cell.dayLabel.textColor = [UIColor blackColor];
cell.userInteractionEnabled = YES;
NSDate *today = [NSDate date];
NSCalendar *cal = [NSCalendar currentCalendar];
[cell configureWithDay:dayNumber inMonth:inMonth enabled:enabled status:status selected:selected];
// Grey out past dates
if (d && [d compare:today] == NSOrderedAscending) {
cell.dayLabel.textColor = [UIColor lightGrayColor];
cell.userInteractionEnabled = NO;
}
// Highlight today (not selectable)
BOOL isToday = d && [cal isDate:d inSameDayAsDate:today];
if (isToday) {
cell.dayLabel.textColor = [UIColor systemBlueColor];
cell.userInteractionEnabled = NO;
}
return cell;
}
......@@ -222,10 +246,11 @@ static const NSInteger kColumns = 7;
NSDate *d = [self dateForIndexPathItem:indexPath.item];
if (!d) return;
NSString *status = [self statusForDate:d];
if (self.minDate && [d compare:self.minDate] == NSOrderedAscending) return;
// allow selection only if not unavailable? (you can change)
NSString *status = [self statusForDate:d];
// if unavailable, ignore
if ([status isEqualToString:@"unavailable"]) {
return;
......
......@@ -8,32 +8,32 @@
<key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
......
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