Initial commit

This commit is contained in:
alyanirmala 2025-08-13 10:19:48 +07:00
commit 0987072190
152 changed files with 9789 additions and 0 deletions

1
salon-booking-api Submodule

@ -0,0 +1 @@
Subproject commit 91c25f66f2f79bb4ab607c2e049b740f393a9810

BIN
salon-booking-api.zip Normal file

Binary file not shown.

45
salonbooking/.gitignore vendored Normal file
View File

@ -0,0 +1,45 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release

45
salonbooking/.metadata Normal file
View File

@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: "c23637390482d4cf9598c3ce3f2be31aa7332daf"
channel: "stable"
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
- platform: android
create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
- platform: ios
create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
- platform: linux
create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
- platform: macos
create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
- platform: web
create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
- platform: windows
create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'

16
salonbooking/README.md Normal file
View File

@ -0,0 +1,16 @@
# salonbooking
A new Flutter project.
## Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

View File

@ -0,0 +1,31 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
errors:
depend_on_referenced_packages: ignore
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

14
salonbooking/android/.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
.cxx/
# Remember to never publicly share your keystore.
# See https://flutter.dev/to/reference-keystore
key.properties
**/*.keystore
**/*.jks

View File

@ -0,0 +1,44 @@
plugins {
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
android {
namespace = "com.example.salonbooking"
compileSdk = 35
ndkVersion = "27.0.12077973"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.salonbooking"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
}
}
}
flutter {
source = "../.."
}

View File

@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

View File

@ -0,0 +1,51 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:label="salonbooking"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
</manifest>

View File

@ -0,0 +1,5 @@
package com.example.salonbooking
import io.flutter.embedding.android.FlutterActivity
class MainActivity : FlutterActivity()

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

View File

@ -0,0 +1,21 @@
allprojects {
repositories {
google()
mavenCentral()
}
}
val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
rootProject.layout.buildDirectory.value(newBuildDir)
subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir)
}
subprojects {
project.evaluationDependsOn(":app")
}
tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}

View File

@ -0,0 +1,3 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip

View File

@ -0,0 +1,25 @@
pluginManagement {
val flutterSdkPath = run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.7.0" apply false
id("org.jetbrains.kotlin.android") version "1.8.22" apply false
}
include(":app")

34
salonbooking/ios/.gitignore vendored Normal file
View File

@ -0,0 +1,34 @@
**/dgph
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/ephemeral/
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>12.0</string>
</dict>
</plist>

View File

@ -0,0 +1 @@
#include "Generated.xcconfig"

View File

@ -0,0 +1 @@
#include "Generated.xcconfig"

View File

@ -0,0 +1,616 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
proxyType = 1;
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
remoteInfo = Runner;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
331C8082294A63A400263BE5 /* RunnerTests */ = {
isa = PBXGroup;
children = (
331C807B294A618700263BE5 /* RunnerTests.swift */,
);
path = RunnerTests;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "<group>";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
331C8082294A63A400263BE5 /* RunnerTests */,
);
sourceTree = "<group>";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
331C8081294A63A400263BE5 /* RunnerTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
331C8080294A63A400263BE5 /* RunnerTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
buildPhases = (
331C807D294A63A400263BE5 /* Sources */,
331C807F294A63A400263BE5 /* Resources */,
);
buildRules = (
);
dependencies = (
331C8086294A63A400263BE5 /* PBXTargetDependency */,
);
name = RunnerTests;
productName = RunnerTests;
productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
);
buildRules = (
);
dependencies = (
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C8080294A63A400263BE5 = {
CreatedOnToolsVersion = 14.0;
TestTargetID = 97C146ED1CF9000F007C117D;
};
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 1100;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
331C8080294A63A400263BE5 /* RunnerTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
331C807F294A63A400263BE5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
331C807D294A63A400263BE5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
331C8086294A63A400263BE5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 97C146ED1CF9000F007C117D /* Runner */;
targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Profile;
};
249021D4217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.salonbooking;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
};
331C8088294A63A400263BE5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.salonbooking.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
};
name = Debug;
};
331C8089294A63A400263BE5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.salonbooking.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
};
name = Release;
};
331C808A294A63A400263BE5 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.salonbooking.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
};
name = Profile;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
97C147061CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.salonbooking;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
};
97C147071CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.salonbooking;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
331C8088294A63A400263BE5 /* Debug */,
331C8089294A63A400263BE5 /* Release */,
331C808A294A63A400263BE5 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147031CF9000F007C117D /* Debug */,
97C147041CF9000F007C117D /* Release */,
249021D3217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147061CF9000F007C117D /* Debug */,
97C147071CF9000F007C117D /* Release */,
249021D4217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "331C8080294A63A400263BE5"
BuildableName = "RunnerTests.xctest"
BlueprintName = "RunnerTests"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

View File

@ -0,0 +1,13 @@
import Flutter
import UIKit
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}

View File

@ -0,0 +1,122 @@
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

View File

@ -0,0 +1,5 @@
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
</resources>
</document>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Salonbooking</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>salonbooking</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1 @@
#import "GeneratedPluginRegistrant.h"

View File

@ -0,0 +1,12 @@
import Flutter
import UIKit
import XCTest
class RunnerTests: XCTestCase {
func testExample() {
// If you add code to the Runner application, consider adding tests here.
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
}
}

View File

@ -0,0 +1,71 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
class ApiService {
final String baseUrl = "http://127.0.0.1:8000/api"; // Ganti dengan URL API kamu
Future<Map<String, dynamic>> register(String name, String email, String password) async {
final response = await http.post(
Uri.parse("$baseUrl/register"),
headers: {"Content-Type": "application/json"},
body: jsonEncode({
"name": name,
"email": email,
"password": password,
}),
);
if (response.statusCode == 201) {
return jsonDecode(response.body);
} else {
throw Exception("Gagal melakukan registrasi");
}
}
Future<Map<String, dynamic>> login(String email, String password) async {
final response = await http.post(
Uri.parse("$baseUrl/login"),
headers: {"Content-Type": "application/json"},
body: jsonEncode({
"email": email,
"password": password,
}),
);
if (response.statusCode == 200) {
return jsonDecode(response.body);
} else {
throw Exception("Email atau password salah");
}
}
// Fetch categories
Future<List<dynamic>> getCategories() async {
final response = await http.get(
Uri.parse("$baseUrl/categories"),
headers: {"Content-Type": "application/json"},
);
if (response.statusCode == 200) {
final data = jsonDecode(response.body);
return data['categories']; // Mengembalikan daftar kategori
} else {
throw Exception("Gagal mengambil data kategori");
}
}
// Fetch services
Future<List<dynamic>> getServices() async {
final response = await http.get(
Uri.parse("$baseUrl/services"),
headers: {"Content-Type": "application/json"},
);
if (response.statusCode == 200) {
final data = jsonDecode(response.body);
return data['services']; // Mengembalikan daftar layanan
} else {
throw Exception("Gagal mengambil data layanan");
}
}
}

View File

@ -0,0 +1,291 @@
// ... (import tetap sama)
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:intl/intl.dart';
class BookingsKaryawanPage extends StatefulWidget {
final String token;
const BookingsKaryawanPage({Key? key, required this.token}) : super(key: key);
@override
State<BookingsKaryawanPage> createState() => _BookingsKaryawanPageState();
}
class _BookingsKaryawanPageState extends State<BookingsKaryawanPage> {
List<dynamic> bookings = [];
bool loading = false;
final NumberFormat currencyFormat = NumberFormat.currency(locale: 'id_ID', symbol: 'Rp');
@override
void initState() {
super.initState();
fetchBookings();
}
Future<void> fetchBookings() async {
setState(() => loading = true);
try {
final response = await http.get(
Uri.parse('http://angeliasalon.my.id/api/bookings'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final data = json.decode(response.body);
setState(() {
bookings = data;
});
} else {
throw Exception('Gagal memuat data booking');
}
} catch (e) {
print('Fetch error: $e');
} finally {
setState(() => loading = false);
}
}
Future<void> updateStatusByUserAndTanggal(int userId, String tanggal, String status) async {
setState(() => loading = true);
try {
final response = await http.put(
Uri.parse('http://angeliasalon.my.id/api/bookings'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: jsonEncode({
'user_id': userId,
'tanggal_booking': tanggal,
'status': status,
}),
);
final body = json.decode(response.body);
if (response.statusCode == 200) {
await fetchBookings();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(body['message']), backgroundColor: Colors.green),
);
} else {
throw Exception(body['message'] ?? 'Gagal mengubah status');
}
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error: $e'), backgroundColor: Colors.red),
);
} finally {
setState(() => loading = false);
}
}
Map<int, List<dynamic>> groupBookingsByUser(List<dynamic> data) {
final Map<int, List<dynamic>> grouped = {};
for (var booking in data) {
final user = booking['user'];
if (user == null) continue;
final userId = user['id'];
grouped.putIfAbsent(userId, () => []).add(booking);
}
return grouped;
}
Icon getServiceIcon(String? namaLayanan) {
final name = namaLayanan?.toLowerCase() ?? '';
if (name.contains('makeup') || name.contains('rias') || name.contains('make up')) {
return const Icon(Icons.brush, color: Colors.deepPurple);
} else {
return const Icon(Icons.content_cut, color: Colors.pink);
}
}
@override
Widget build(BuildContext context) {
final groupedByUser = groupBookingsByUser(bookings);
return Scaffold(
backgroundColor: const Color(0xFFFDEEF4),
appBar: AppBar(
backgroundColor: Colors.pink.shade300,
title: const Text('Data Booking (Karyawan)'),
centerTitle: true,
),
body: loading
? const Center(child: CircularProgressIndicator())
: bookings.isEmpty
? const Center(
child: Text(
'Belum ada booking',
style: TextStyle(fontSize: 18, color: Colors.black54),
),
)
: ListView(
padding: const EdgeInsets.all(12),
children: groupedByUser.entries.map((entry) {
final userId = entry.key;
final bookingsList = entry.value;
final userName = bookingsList.first['user']?['name'] ?? 'Tidak diketahui';
final Map<String, List<dynamic>> byTanggal = {};
for (var b in bookingsList) {
final tanggal = b['tanggal_booking'];
byTanggal.putIfAbsent(tanggal, () => []).add(b);
}
return Card(
elevation: 4,
margin: const EdgeInsets.symmetric(vertical: 10),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
child: ExpansionTile(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
tilePadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
title: Text(
'$userName (ID: $userId)',
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
childrenPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
children: byTanggal.entries.map((tanggalEntry) {
final tanggal = tanggalEntry.key;
final list = tanggalEntry.value;
final totalHarga = list.fold<double>(
0,
(sum, item) => sum + (item['service']?['price']?.toDouble() ?? 0),
);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider(thickness: 1.2, color: Colors.grey),
Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Text(
'📅 Tanggal Booking: $tanggal',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.pink.shade700),
),
),
Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('🧾 Total layanan: ${list.length}'),
Text('💰 Total harga: ${currencyFormat.format(totalHarga)}'),
],
),
),
...list.map((booking) {
final service = booking['service'];
final namaLayanan = service?['name'] ?? 'Layanan tidak ditemukan';
final harga = service?['price'] ?? 0;
final jam = booking['jam'] ?? '-';
final status = booking['status'];
IconData icon;
Color chipColor;
Color iconColor;
switch (status) {
case 'diterima':
icon = Icons.check_circle;
chipColor = Colors.green.shade100;
iconColor = Colors.green.shade800;
break;
case 'ditolak':
icon = Icons.cancel;
chipColor = Colors.red.shade100;
iconColor = Colors.red.shade800;
break;
default:
icon = Icons.hourglass_top;
chipColor = Colors.orange.shade100;
iconColor = Colors.orange.shade800;
}
return Container(
margin: const EdgeInsets.only(bottom: 8),
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: Colors.black12,
blurRadius: 2,
offset: Offset(0, 1),
)
],
),
child: ListTile(
contentPadding: EdgeInsets.zero,
leading: getServiceIcon(namaLayanan),
title: Text(namaLayanan),
subtitle: Text('Jam: $jam\nHarga: ${currencyFormat.format(harga)}'),
trailing: Chip(
avatar: Icon(icon, size: 16, color: iconColor),
label: Text(status, style: TextStyle(color: iconColor)),
backgroundColor: chipColor,
),
),
);
}).toList(),
Padding(
padding: const EdgeInsets.only(top: 8, bottom: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton.icon(
onPressed: () =>
updateStatusByUserAndTanggal(userId, tanggal, 'diterima'),
icon: const Icon(Icons.check),
label: const Text('Terima'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.green.shade600,
padding: const EdgeInsets.symmetric(horizontal: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
),
),
const SizedBox(width: 12),
ElevatedButton.icon(
onPressed: () =>
updateStatusByUserAndTanggal(userId, tanggal, 'ditolak'),
icon: const Icon(Icons.close),
label: const Text('Tolak'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red.shade600,
padding: const EdgeInsets.symmetric(horizontal: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
),
),
],
),
),
],
);
}).toList(),
),
);
}).toList(),
),
);
}
}

View File

@ -0,0 +1,213 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:salonbooking/karyawan/bookings_karyawan_page.dart';
import 'package:salonbooking/karyawan/riwayat_bookings_karyawan.dart';
import 'package:salonbooking/main.dart';
import 'package:salonbooking/pemilik/home_pemilik.dart';
import 'package:salonbooking/pelanggan/main_navigation.dart';
class KaryawanHomePage extends StatelessWidget {
final String name;
final String token;
final Map user;
const KaryawanHomePage(this.name, {Key? key, required this.token, required this.user}) : super(key: key);
void logout(BuildContext context) async {
final prefs = await SharedPreferences.getInstance();
await prefs.remove('token');
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (_) => HomeSelector(
onLoginSuccess: (token, user) {
final navigator = navigatorKey.currentState!;
switch (user['role']) {
case 'pelanggan':
navigator.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => MainNavigation(
userName: user['name'] ?? 'User',
token: token,
user: user,
),
),
(route) => false,
);
break;
case 'karyawan':
navigator.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => KaryawanHomePage(
user['name'] ?? 'User',
token: token,
user: user,
),
),
(route) => false,
);
break;
case 'pemilik':
navigator.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => PemilikHomePage(
name: user['name'] ?? 'User',
token: token,
),
),
(route) => false,
);
break;
default:
navigator.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => const Scaffold(
body: Center(child: Text('Role tidak dikenal')),
),
),
(route) => false,
);
}
},
),
),
(route) => false,
);
}
@override
Widget build(BuildContext context) {
final primaryColor = const Color(0xFFF06292);
final backgroundColor = const Color(0xFFFFF0F5);
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
title: const Text('Home Karyawan'),
backgroundColor: primaryColor,
elevation: 5,
actions: [
IconButton(
icon: const Icon(Icons.logout),
onPressed: () {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('Konfirmasi Logout'),
content: const Text('Apakah Anda yakin ingin logout?'),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('Batal'),
),
TextButton(
onPressed: () {
Navigator.pop(context);
logout(context);
},
child: const Text(
'Logout',
style: TextStyle(color: Colors.red),
),
),
],
),
);
},
)
],
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 36),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Selamat datang, $name',
style: TextStyle(
fontSize: 26,
fontWeight: FontWeight.bold,
color: primaryColor,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
'(Karyawan)',
style: TextStyle(
fontSize: 18,
color: primaryColor.withOpacity(0.7),
fontStyle: FontStyle.italic,
),
),
const SizedBox(height: 40),
Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
elevation: 6,
shadowColor: primaryColor.withOpacity(0.3),
child: SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
icon: const Icon(Icons.list, size: 28),
label: const Padding(
padding: EdgeInsets.symmetric(vertical: 14),
child: Text(
'Lihat Daftar Booking Pelanggan',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
),
style: ElevatedButton.styleFrom(
backgroundColor: primaryColor,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => BookingsKaryawanPage(token: token),
),
);
},
),
),
),
const SizedBox(height: 24),
Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
elevation: 6,
shadowColor: primaryColor.withOpacity(0.3),
child: SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
icon: const Icon(Icons.history, size: 28),
label: const Padding(
padding: EdgeInsets.symmetric(vertical: 14),
child: Text(
'Riwayat Booking',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
),
style: ElevatedButton.styleFrom(
backgroundColor: primaryColor,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => RiwayatBookingsKaryawanPage(token: token),
),
);
},
),
),
),
],
),
),
),
);
}
}

View File

@ -0,0 +1,218 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
class RiwayatBookingsKaryawanPage extends StatefulWidget {
final String token;
const RiwayatBookingsKaryawanPage({Key? key, required this.token}) : super(key: key);
@override
State<RiwayatBookingsKaryawanPage> createState() => _RiwayatBookingsKaryawanPageState();
}
class _RiwayatBookingsKaryawanPageState extends State<RiwayatBookingsKaryawanPage> {
Map<String, Map<String, List>> groupedBookings = {};
bool loading = true;
String? error;
final Color primaryColor = const Color(0xFFF06292);
@override
void initState() {
super.initState();
fetchAcceptedBookings();
}
Future<void> fetchAcceptedBookings() async {
setState(() {
loading = true;
error = null;
});
try {
final response = await http.get(
Uri.parse('http://angeliasalon.my.id/api/bookings/accepted'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final List data = json.decode(response.body);
final Map<String, Map<String, List>> tempGrouped = {};
for (var booking in data) {
final pelangganName = booking['user']?['name'] ?? 'Tidak diketahui';
final tanggalBooking = booking['tanggal_booking'] ?? '-';
tempGrouped.putIfAbsent(pelangganName, () => {});
tempGrouped[pelangganName]!.putIfAbsent(tanggalBooking, () => []);
tempGrouped[pelangganName]![tanggalBooking]!.add(booking);
}
final sortedPelanggan = tempGrouped.keys.toList()..sort();
final Map<String, Map<String, List>> sortedGrouped = {};
for (var pelanggan in sortedPelanggan) {
final tanggalMap = tempGrouped[pelanggan]!;
final sortedTanggal = tanggalMap.keys.toList()..sort();
sortedGrouped[pelanggan] = {
for (var tgl in sortedTanggal) tgl: tanggalMap[tgl]!,
};
}
setState(() {
groupedBookings = sortedGrouped;
loading = false;
});
} else {
setState(() {
error = 'Failed to load accepted bookings, status code: ${response.statusCode}';
loading = false;
});
}
} catch (e) {
setState(() {
error = 'Error fetching accepted bookings: $e';
loading = false;
});
}
}
Widget bookingItem(Map booking) {
final service = booking['service'];
final jam = booking['jam'] ?? '-';
final status = booking['status'] ?? '-';
Color statusColor;
switch (status.toLowerCase()) {
case 'diterima':
statusColor = Colors.green.shade700;
break;
case 'menunggu':
statusColor = Colors.orange.shade700;
break;
case 'ditolak':
statusColor = Colors.red.shade700;
break;
default:
statusColor = Colors.grey.shade600;
}
return ListTile(
contentPadding: const EdgeInsets.symmetric(vertical: 4, horizontal: 0),
leading: const Icon(Icons.content_cut, color: Colors.pinkAccent),
title: Text(
service?['name'] ?? 'Layanan tidak diketahui',
style: const TextStyle(fontWeight: FontWeight.w600),
),
subtitle: Row(
children: [
Text('Jam: $jam', style: const TextStyle(fontSize: 13)),
const SizedBox(width: 16),
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
decoration: BoxDecoration(
color: statusColor,
borderRadius: BorderRadius.circular(12),
),
child: Text(
status.toUpperCase(),
style: const TextStyle(color: Colors.white, fontWeight: FontWeight.w600, fontSize: 12),
),
)
],
),
);
}
Widget bookingGroupCard(String pelangganName, Map<String, List> tanggalMap) {
return Card(
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
elevation: 4,
shadowColor: Colors.black26,
child: ExpansionTile(
tilePadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
childrenPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
expandedCrossAxisAlignment: CrossAxisAlignment.start,
title: Text(
pelangganName,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: primaryColor),
),
children: tanggalMap.entries.map((entry) {
final tanggal = entry.key;
final bookings = entry.value;
return Padding(
padding: const EdgeInsets.only(left: 16.0, bottom: 10),
child: Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
elevation: 2,
shadowColor: Colors.grey.withOpacity(0.2),
child: ExpansionTile(
tilePadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
childrenPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
title: Text(
'Tanggal: $tanggal',
style: TextStyle(
fontWeight: FontWeight.w600,
color: Colors.pink.shade400,
),
),
children: bookings.map((b) => bookingItem(b)).toList(),
),
),
);
}).toList(),
),
);
}
void openRiwayat() {
// optional navigation or leave empty
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Riwayat Booking Karyawan'),
backgroundColor: primaryColor,
elevation: 5,
),
body: loading
? Center(child: CircularProgressIndicator(color: primaryColor, strokeWidth: 3))
: error != null
? Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Text(error!,
style: TextStyle(fontSize: 16, color: Colors.red.shade700),
textAlign: TextAlign.center),
),
)
: groupedBookings.isEmpty
? const Center(
child: Text(
'Belum ada riwayat booking',
style: TextStyle(fontSize: 18, color: Colors.black54),
),
)
: RefreshIndicator(
onRefresh: fetchAcceptedBookings,
child: ListView(
physics: const AlwaysScrollableScrollPhysics(),
children: groupedBookings.entries
.map((e) => bookingGroupCard(e.key, e.value))
.toList(),
),
),
);
}
}

239
salonbooking/lib/main.dart Normal file
View File

@ -0,0 +1,239 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:salonbooking/page/login_page.dart';
import 'package:salonbooking/page/register_page.dart';
import 'package:salonbooking/page/splash_screen.dart';
import 'package:salonbooking/pelanggan/main_navigation.dart';
import 'package:salonbooking/karyawan/home_karyawan.dart';
import 'package:salonbooking/pemilik/home_pemilik.dart';
import 'dart:convert';
// Navigator global
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
void main() => runApp(const MyApp());
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool showSplash = true;
void _handleLogin(String token, Map user) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setString('token', token);
await prefs.setString('user', jsonEncode(user));
_navigateToRolePage(token, user);
}
void _handleSplashComplete() {
setState(() {
showSplash = false;
});
}
static void _navigateToRolePage(String token, Map user) {
switch (user['role']) {
case 'pelanggan':
navigatorKey.currentState!.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => MainNavigation(
userName: user['name'] ?? 'User',
token: token,
user: user,
),
),
(route) => false,
);
break;
case 'karyawan':
navigatorKey.currentState!.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => KaryawanHomePage(
user['name'] ?? 'User',
token: token,
user: user,
),
),
(route) => false,
);
break;
case 'pemilik':
navigatorKey.currentState!.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => PemilikHomePage(
name: user['name'] ?? 'User',
token: token,
),
),
(route) => false,
);
break;
default:
navigatorKey.currentState!.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => const Scaffold(
body: Center(child: Text('Role tidak dikenal')),
),
),
(route) => false,
);
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Salon App',
theme: ThemeData(
primarySwatch: Colors.pink,
scaffoldBackgroundColor: const Color(0xFFFFF6F9),
appBarTheme: const AppBarTheme(
backgroundColor: Color(0xFFF48FB1),
foregroundColor: Colors.white,
elevation: 2,
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFFF06292),
padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
textStyle: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
),
),
debugShowCheckedModeBanner: false,
navigatorKey: navigatorKey,
home: showSplash
? SplashScreen(onInitializationComplete: _handleSplashComplete)
: HomeSelector(onLoginSuccess: _handleLogin),
);
}
}
class HomeSelector extends StatefulWidget {
final Function(String token, Map user) onLoginSuccess;
const HomeSelector({super.key, required this.onLoginSuccess});
@override
State<HomeSelector> createState() => _HomeSelectorState();
}
class _HomeSelectorState extends State<HomeSelector> {
bool isLoading = true;
@override
void initState() {
super.initState();
checkLoginStatus();
}
Future<void> checkLoginStatus() async {
final prefs = await SharedPreferences.getInstance();
final token = prefs.getString('token');
final userJson = prefs.getString('user');
if (token != null && userJson != null) {
final user = jsonDecode(userJson);
widget.onLoginSuccess(token, user);
} else {
setState(() => isLoading = false);
}
}
@override
Widget build(BuildContext context) {
if (isLoading) {
return const Scaffold(
body: Center(child: CircularProgressIndicator()),
);
}
return Scaffold(
appBar: AppBar(title: const Text('Salon Booking App')),
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
decoration: BoxDecoration(
color: const Color(0xFFFADADD),
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: const Color(0xFFFADADD).withOpacity(0.6),
spreadRadius: 5,
blurRadius: 15,
offset: const Offset(0, 8),
),
],
),
padding: const EdgeInsets.all(24),
child: const Icon(
Icons.content_cut,
size: 72,
color: Color(0xFFF06292),
),
),
const SizedBox(height: 40),
const Text(
'Welcome to Salon Booking',
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Color(0xFF880E4F),
),
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
const Text(
'Manage your salon bookings with ease',
style: TextStyle(
fontSize: 16,
color: Color(0xFFA51164),
),
textAlign: TextAlign.center,
),
const SizedBox(height: 40),
ElevatedButton.icon(
icon: const Icon(Icons.login),
label: const Text('Login'),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => LoginPage(onLoginSuccess: widget.onLoginSuccess)),
),
),
const SizedBox(height: 20),
ElevatedButton.icon(
icon: const Icon(Icons.person_add),
label: const Text('Register'),
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFFF8BBD0),
padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
textStyle: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
foregroundColor: const Color(0xFF880E4F),
),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => RegisterPage()),
),
),
],
),
),
),
);
}
}

View File

@ -0,0 +1,26 @@
// models/service.dart
class Service {
final int id;
final String name;
final int price;
final String? description;
final int categoryId; // ubah ke categoryId (int)
Service({
required this.id,
required this.name,
required this.price,
this.description,
required this.categoryId,
});
factory Service.fromJson(Map<String, dynamic> json) {
return Service(
id: json['id'],
name: json['name'],
price: json['price'],
description: json['description'],
categoryId: json['category_id'],
);
}
}

View File

@ -0,0 +1,17 @@
class User {
final int id;
final String name;
final String email;
final String role;
User({required this.id, required this.name, required this.email, required this.role});
factory User.fromJson(Map<String, dynamic> json) {
return User(
id: json['id'],
name: json['name'],
email: json['email'],
role: json['role'],
);
}
}

View File

@ -0,0 +1,183 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';
import 'dart:convert';
class LoginPage extends StatefulWidget {
final Function(String token, Map user) onLoginSuccess;
LoginPage({required this.onLoginSuccess});
@override
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
final _formKey = GlobalKey<FormState>();
final _email = TextEditingController();
final _password = TextEditingController();
bool _obscurePassword = true;
Future<void> login() async {
if (!_formKey.currentState!.validate()) return;
final response = await http.post(
Uri.parse('http://angeliasalon.my.id/api/login'),
headers: {'Content-Type': 'application/json'},
body: jsonEncode({
'email': _email.text.trim(),
'password': _password.text,
}),
);
if (response.statusCode == 200) {
final body = jsonDecode(response.body);
final user = body['user'];
// Cek hanya jika user adalah karyawan
if (user['role'] == 'karyawan' && user['is_approved'] == 0) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Akun Anda belum disetujui oleh pemilik.'),
backgroundColor: Colors.orange,
),
);
return;
}
final prefs = await SharedPreferences.getInstance();
await prefs.setString('token', body['access_token']);
widget.onLoginSuccess(body['access_token'], body['user']);
} else {
try {
final body = jsonDecode(response.body);
String message = 'Login gagal.';
if (body['message'] != null) {
message = body['message'];
} else if (response.statusCode == 401) {
message = 'Email atau password salah';
}
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(message), backgroundColor: Colors.red),
);
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Terjadi kesalahan. Silakan coba login kembali.'),
backgroundColor: Colors.red,
),
);
}
}
}
@override
Widget build(BuildContext context) {
final primaryColor = const Color(0xFFF06292);
final backgroundColor = const Color(0xFFFFF6F9);
final inputFillColor = const Color(0xFFFADADD);
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
title: const Text('Login'),
backgroundColor: const Color(0xFFF48FB1),
elevation: 2,
),
body: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 24),
child: Form(
key: _formKey,
child: Column(
children: [
Text(
'Welcome Back',
style: TextStyle(
fontSize: 26,
fontWeight: FontWeight.bold,
color: primaryColor,
),
),
const SizedBox(height: 32),
TextFormField(
controller: _email,
decoration: InputDecoration(
labelText: 'Email',
filled: true,
fillColor: inputFillColor,
prefixIcon: const Icon(Icons.email, color: Colors.pinkAccent),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide: BorderSide.none,
),
),
keyboardType: TextInputType.emailAddress,
validator: (value) {
if (value == null || value.isEmpty) return 'Please enter your email';
final emailRegex = RegExp(r'^[^@]+@[^@]+\.[^@]+');
if (!emailRegex.hasMatch(value)) return 'Please enter a valid email';
return null;
},
),
const SizedBox(height: 16),
TextFormField(
controller: _password,
decoration: InputDecoration(
labelText: 'Password',
filled: true,
fillColor: inputFillColor,
prefixIcon: const Icon(Icons.lock, color: Colors.pinkAccent),
suffixIcon: IconButton(
icon: Icon(
_obscurePassword ? Icons.visibility_off : Icons.visibility,
color: Colors.pinkAccent,
),
onPressed: () {
setState(() {
_obscurePassword = !_obscurePassword;
});
},
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide: BorderSide.none,
),
),
obscureText: _obscurePassword,
validator: (value) =>
(value == null || value.isEmpty) ? 'Please enter your password' : null,
),
const SizedBox(height: 32),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: login,
style: ElevatedButton.styleFrom(
backgroundColor: primaryColor,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
textStyle: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
elevation: 5,
),
child: const Text('Login'),
),
),
],
),
),
),
);
}
}

View File

@ -0,0 +1,90 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
class LogoutPage extends StatefulWidget {
final String token;
const LogoutPage({Key? key, required this.token}) : super(key: key);
@override
State<LogoutPage> createState() => _LogoutPageState();
}
class _LogoutPageState extends State<LogoutPage> {
bool isLoading = false;
String message = '';
Future<void> logout() async {
setState(() {
isLoading = true;
message = '';
});
final url = Uri.parse('http://angeliasalon.my.id/api/logout');
try {
final response = await http.post(
url,
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer ${widget.token}',
},
);
if (response.statusCode == 200) {
setState(() {
message = 'Logout berhasil';
});
// Kembali ke halaman login atau halaman lain
Navigator.pushReplacementNamed(context, '/login');
} else {
final data = jsonDecode(response.body);
setState(() {
message = data['message'] ?? 'Logout gagal';
});
}
} catch (e) {
setState(() {
message = 'Terjadi kesalahan: $e';
});
} finally {
setState(() {
isLoading = false;
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Logout'),
),
body: Center(
child: isLoading
? const CircularProgressIndicator()
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'Apakah anda yakin ingin logout?',
style: TextStyle(fontSize: 18),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: logout,
child: const Text('Logout'),
),
const SizedBox(height: 20),
Text(
message,
style: const TextStyle(color: Colors.red),
)
],
),
),
);
}
}

View File

@ -0,0 +1,270 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
class RegisterPage extends StatefulWidget {
@override
_RegisterPageState createState() => _RegisterPageState();
}
class _RegisterPageState extends State<RegisterPage> {
final _formKey = GlobalKey<FormState>();
final _name = TextEditingController();
final _email = TextEditingController();
final _password = TextEditingController();
final _confirmPassword = TextEditingController();
String _role = 'pelanggan';
bool _obscurePassword = true;
bool _obscureConfirmPassword = true;
Future<void> register() async {
if (!_formKey.currentState!.validate()) return;
try {
final response = await http.post(
Uri.parse('http://angeliasalon.my.id/api/register'),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: jsonEncode({
'name': _name.text.trim(),
'email': _email.text.trim(),
'password': _password.text,
'password_confirmation': _confirmPassword.text,
'role': _role,
}),
);
if (response.statusCode == 201) {
final loginResponse = await http.post(
Uri.parse('http://angeliasalon.my.id/api/login'),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: jsonEncode({
'email': _email.text.trim(),
'password': _password.text,
}),
);
if (loginResponse.statusCode == 200) {
final data = jsonDecode(loginResponse.body);
final token = data['access_token'];
final verifyResponse = await http.post(
Uri.parse('http://angeliasalon.my.id/api/email/verification-notification'),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer $token',
},
);
if (verifyResponse.statusCode == 200) {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text('Verifikasi Email'),
content: Text(
'Registrasi berhasil!\nKami telah mengirimkan email verifikasi ke ${_email.text.trim()}.\nSilakan cek email dan klik link verifikasi.',
),
actions: [
TextButton(
onPressed: () {
Navigator.pop(context); // Tutup dialog
Navigator.pop(context); // Kembali ke login
},
child: Text('OK'),
),
],
),
);
} else {
throw Exception('Gagal mengirim link verifikasi email.');
}
} else {
final err = jsonDecode(loginResponse.body);
throw Exception(err['message'] ?? 'Login gagal setelah registrasi');
}
} else {
final body = jsonDecode(response.body);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(body['message'] ?? 'Registrasi gagal'),
backgroundColor: Colors.red,
),
);
}
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Terjadi kesalahan: ${e.toString()}'),
backgroundColor: Colors.red,
),
);
}
}
@override
Widget build(BuildContext context) {
final primaryColor = const Color(0xFFF06292);
final backgroundColor = const Color(0xFFFFF6F9);
final inputFillColor = const Color(0xFFFADADD);
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
title: const Text('Register'),
backgroundColor: const Color(0xFFF48FB1),
),
body: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 24),
child: Form(
key: _formKey,
child: Column(
children: [
Text(
'Create Your Account',
style: TextStyle(
fontSize: 26,
fontWeight: FontWeight.bold,
color: primaryColor,
),
),
const SizedBox(height: 24),
// Name
TextFormField(
controller: _name,
decoration: _inputDecoration('Name', Icons.person, inputFillColor),
validator: (value) => (value == null || value.isEmpty) ? 'Nama wajib diisi' : null,
),
const SizedBox(height: 16),
// Email
TextFormField(
controller: _email,
decoration: _inputDecoration('Email', Icons.email, inputFillColor),
keyboardType: TextInputType.emailAddress,
validator: (value) {
if (value == null || value.isEmpty) return 'Email wajib diisi';
final emailRegex = RegExp(r'^[^@]+@[^@]+\.[^@]+');
if (!emailRegex.hasMatch(value)) return 'Format email tidak valid';
return null;
},
),
const SizedBox(height: 16),
// Password
TextFormField(
controller: _password,
obscureText: _obscurePassword,
decoration: _inputDecorationWithToggle(
'Password',
Icons.lock,
inputFillColor,
_obscurePassword,
() => setState(() => _obscurePassword = !_obscurePassword),
),
validator: (value) => (value == null || value.length < 6) ? 'Minimal 6 karakter' : null,
),
const SizedBox(height: 16),
// Confirm Password
TextFormField(
controller: _confirmPassword,
obscureText: _obscureConfirmPassword,
decoration: _inputDecorationWithToggle(
'Confirm Password',
Icons.lock_outline,
inputFillColor,
_obscureConfirmPassword,
() => setState(() => _obscureConfirmPassword = !_obscureConfirmPassword),
),
validator: (value) => (value != _password.text) ? 'Password tidak sama' : null,
),
const SizedBox(height: 20),
// Role Dropdown
DropdownButtonFormField<String>(
value: _role,
items: ['pelanggan', 'karyawan'].map((role) {
return DropdownMenuItem(
value: role,
child: Text(role[0].toUpperCase() + role.substring(1)),
);
}).toList(),
onChanged: (val) => setState(() => _role = val!),
decoration: _inputDecoration('Role', Icons.group, inputFillColor),
),
const SizedBox(height: 32),
// Register Button
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: register,
style: ElevatedButton.styleFrom(
backgroundColor: primaryColor,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
textStyle: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
elevation: 5,
),
child: const Text('Register'),
),
),
],
),
),
),
);
}
InputDecoration _inputDecoration(String label, IconData icon, Color fillColor) {
return InputDecoration(
labelText: label,
filled: true,
fillColor: fillColor,
prefixIcon: Icon(icon, color: Colors.pinkAccent),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide: BorderSide.none,
),
);
}
InputDecoration _inputDecorationWithToggle(
String label,
IconData icon,
Color fillColor,
bool isObscured,
VoidCallback toggle,
) {
return InputDecoration(
labelText: label,
filled: true,
fillColor: fillColor,
prefixIcon: Icon(icon, color: Colors.pinkAccent),
suffixIcon: IconButton(
icon: Icon(
isObscured ? Icons.visibility_off : Icons.visibility,
color: Colors.pinkAccent,
),
onPressed: toggle,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide: BorderSide.none,
),
);
}
}

View File

@ -0,0 +1,52 @@
// lib/page/splash_screen.dart
import 'package:flutter/material.dart';
import 'dart:async';
class SplashScreen extends StatefulWidget {
final VoidCallback onInitializationComplete;
const SplashScreen({super.key, required this.onInitializationComplete});
@override
State<SplashScreen> createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
@override
void initState() {
super.initState();
_startDelay();
}
void _startDelay() {
Timer(const Duration(seconds: 3), () {
widget.onInitializationComplete();
});
}
@override
Widget build(BuildContext context) {
return const Scaffold(
backgroundColor: Color(0xFFFFF6F9),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.content_cut, size: 100, color: Color(0xFFF06292)),
SizedBox(height: 20),
Text(
'Salon Booking',
style: TextStyle(
fontSize: 26,
fontWeight: FontWeight.bold,
color: Color(0xFF880E4F),
),
),
SizedBox(height: 10),
CircularProgressIndicator(color: Color(0xFFF06292)),
],
),
),
);
}
}

View File

@ -0,0 +1,336 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:salonbooking/main.dart';
import 'package:salonbooking/karyawan/home_karyawan.dart';
import 'package:salonbooking/pemilik/home_pemilik.dart';
import 'package:salonbooking/pelanggan/main_navigation.dart';
class Service {
final int id;
final String name;
final int price;
final String? imageUrl;
Service({
required this.id,
required this.name,
required this.price,
this.imageUrl,
});
factory Service.fromJson(Map<String, dynamic> json) {
return Service(
id: json['id'],
name: json['name'],
price: json['price'],
imageUrl: json['image'],
);
}
}
class PelangganHomePage extends StatefulWidget {
final String name;
final String token;
final Future<void> Function() onCartUpdated;
const PelangganHomePage(
this.name, {
super.key,
required this.token,
required this.onCartUpdated,
});
@override
State<PelangganHomePage> createState() => _PelangganHomePageState();
}
class _PelangganHomePageState extends State<PelangganHomePage> {
List categories = [];
Map<int, List<Service>> servicesByCategory = {};
int? selectedCategoryId;
bool loadingCategories = true;
bool loadingServices = false;
@override
void initState() {
super.initState();
fetchCategories();
}
Future<void> fetchCategories() async {
setState(() => loadingCategories = true);
try {
final response = await http.get(
Uri.parse('http://angeliasalon.my.id/api/categories'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final data = json.decode(response.body);
setState(() {
categories = data is List ? data : data['categories'];
if (categories.isNotEmpty) {
selectedCategoryId = categories[0]['id'];
fetchServicesByCategory(selectedCategoryId!);
}
});
}
} catch (e) {
print(e);
} finally {
setState(() => loadingCategories = false);
}
}
Future<void> fetchServicesByCategory(int categoryId) async {
setState(() => loadingServices = true);
try {
final response = await http.get(
Uri.parse('http://angeliasalon.my.id/api/services?category_id=$categoryId'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final data = json.decode(response.body);
final List<Service> services = (data as List)
.map((item) => Service.fromJson(item))
.toList();
setState(() {
servicesByCategory[categoryId] = services;
});
}
} catch (e) {
print(e);
} finally {
setState(() => loadingServices = false);
}
}
void selectCategory(int categoryId) async {
if (selectedCategoryId == categoryId) return;
setState(() => selectedCategoryId = categoryId);
await fetchServicesByCategory(categoryId);
}
void toggleCart(Service service) async {
try {
final response = await http.post(
Uri.parse('http://angeliasalon.my.id/api/cart'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: json.encode({
'service_id': service.id,
'quantity': 1,
}),
);
if (response.statusCode == 200 || response.statusCode == 201) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Berhasil ditambahkan ke keranjang')),
);
widget.onCartUpdated();
} else {
print(response.body);
throw Exception('Gagal menambahkan ke keranjang');
}
} catch (e) {
print(e);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Terjadi kesalahan')),
);
}
}
/// Fungsi Logout
void logout() async {
final prefs = await SharedPreferences.getInstance();
await prefs.remove('token');
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (_) => HomeSelector(
onLoginSuccess: (token, user) {
final navigator = navigatorKey.currentState!;
switch (user['role']) {
case 'pelanggan':
navigator.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => MainNavigation(
userName: user['name'] ?? 'User',
token: token,
user: user,
),
),
(route) => false,
);
break;
case 'karyawan':
navigator.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => KaryawanHomePage(
user['name'] ?? 'User',
token: token,
user: user,
),
),
(route) => false,
);
break;
case 'pemilik':
navigator.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => PemilikHomePage(
name: user['name'] ?? 'User',
token: token,
),
),
(route) => false,
);
break;
default:
navigator.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => const Scaffold(
body: Center(child: Text('Role tidak dikenal')),
),
),
(route) => false,
);
}
},
),
),
(route) => false,
);
}
@override
Widget build(BuildContext context) {
final primaryColor = const Color(0xFFF06292);
final backgroundColor = const Color(0xFFFFF6F9);
final services = selectedCategoryId != null
? (servicesByCategory[selectedCategoryId!] ?? [])
: [];
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
title: Text('Halo, ${widget.name}'),
backgroundColor: primaryColor,
actions: [
IconButton(
icon: const Icon(Icons.logout),
onPressed: () {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('Konfirmasi Logout'),
content: const Text('Apakah Anda yakin ingin logout?'),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('Batal'),
),
TextButton(
onPressed: () {
Navigator.pop(context);
logout();
},
child: const Text(
'Logout',
style: TextStyle(color: Colors.red),
),
),
],
),
);
},
)
],
),
body: Column(
children: [
SizedBox(
height: 60,
child: loadingCategories
? const Center(child: CircularProgressIndicator())
: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: categories.length,
itemBuilder: (context, index) {
final category = categories[index];
final isSelected = category['id'] == selectedCategoryId;
return GestureDetector(
onTap: () => selectCategory(category['id']),
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 8, vertical: 10),
padding: const EdgeInsets.symmetric(horizontal: 20),
decoration: BoxDecoration(
color: isSelected ? primaryColor : Colors.pink.shade100,
borderRadius: BorderRadius.circular(20),
),
child: Center(
child: Text(
category['name'],
style: TextStyle(
color: isSelected ? Colors.white : Colors.black,
fontWeight: FontWeight.bold,
),
),
),
),
);
},
),
),
const Divider(),
Expanded(
child: loadingServices
? const Center(child: CircularProgressIndicator())
: ListView.builder(
itemCount: services.length,
itemBuilder: (context, index) {
final service = services[index];
return Card(
child: ListTile(
leading: service.imageUrl != null && service.imageUrl!.isNotEmpty
? Image.network(
service.imageUrl!,
width: 60,
height: 60,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) =>
const Icon(Icons.broken_image, size: 60),
)
: const Icon(Icons.image, size: 60),
title: Text(service.name),
subtitle: Text("Rp ${service.price}"),
trailing: IconButton(
icon: const Icon(Icons.add_shopping_cart),
onPressed: () => toggleCart(service),
),
),
);
},
),
),
],
),
);
}
}

View File

@ -0,0 +1,253 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
class KeranjangPage extends StatefulWidget {
final String token;
final Function onCartUpdated;
const KeranjangPage({
super.key,
required this.token,
required this.onCartUpdated,
});
@override
State<KeranjangPage> createState() => _KeranjangPageState();
}
class _KeranjangPageState extends State<KeranjangPage> {
List cartItems = [];
bool loading = true;
DateTime? selectedDate;
TimeOfDay? selectedTime;
@override
void initState() {
super.initState();
fetchCart();
}
Future<void> fetchCart() async {
setState(() => loading = true);
try {
final response = await http.get(
Uri.parse('http://angeliasalon.my.id/api/cart'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final data = json.decode(response.body);
setState(() {
cartItems = data is List ? data : data['cart'] ?? [];
});
widget.onCartUpdated(); // Update jumlah cart
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Gagal mengambil keranjang')),
);
}
} catch (e) {
print(e);
}
setState(() => loading = false);
}
Future<void> deleteItem(int id) async {
try {
final response = await http.delete(
Uri.parse('http://angeliasalon.my.id/api/cart/$id'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
await fetchCart(); // Panggil fetchCart agar jumlah update
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Gagal menghapus item')),
);
}
} catch (e) {
print(e);
}
}
int getTotalHarga() {
return cartItems.fold(
0,
(total, item) => total + (item['service']['price'] as int),
);
}
Future<void> pickDate() async {
final picked = await showDatePicker(
context: context,
initialDate: selectedDate ?? DateTime.now(),
firstDate: DateTime.now(),
lastDate: DateTime.now().add(const Duration(days: 365)),
);
if (picked != null) setState(() => selectedDate = picked);
}
Future<void> pickTime() async {
final picked = await showTimePicker(
context: context,
initialTime: selectedTime ?? TimeOfDay.now(),
builder: (context, child) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true),
child: child!,
);
},
);
if (picked != null) setState(() => selectedTime = picked);
}
Future<void> checkout() async {
if (selectedDate == null || selectedTime == null) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text("Harap pilih tanggal dan waktu booking")),
);
return;
}
final tanggalBooking =
"${selectedDate!.year}-${selectedDate!.month.toString().padLeft(2, '0')}-${selectedDate!.day.toString().padLeft(2, '0')}";
final jamBooking =
"${selectedTime!.hour.toString().padLeft(2, '0')}:${selectedTime!.minute.toString().padLeft(2, '0')}";
try {
final response = await http.post(
Uri.parse('http://angeliasalon.my.id/api/cart/checkout'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: json.encode({
'tanggal_booking': tanggalBooking,
'jam': jamBooking,
}),
);
if (response.statusCode == 200 || response.statusCode == 201) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text("Booking berhasil!")),
);
setState(() {
cartItems.clear();
selectedDate = null;
selectedTime = null;
});
widget.onCartUpdated(); // Update jumlah cart setelah checkout
} else if (response.statusCode == 409) {
final message = jsonDecode(response.body)['message'];
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Gagal booking: $message")),
);
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text("Terjadi kesalahan saat booking")),
);
}
} catch (e) {
print(e);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text("Terjadi error jaringan")),
);
}
}
@override
Widget build(BuildContext context) {
final primaryColor = const Color(0xFFF06292);
return Scaffold(
appBar: AppBar(
title: const Text("Keranjang Anda"),
backgroundColor: primaryColor,
),
body: loading
? const Center(child: CircularProgressIndicator())
: cartItems.isEmpty
? const Center(child: Text("Keranjang kosong"))
: Column(
children: [
Expanded(
child: ListView.builder(
itemCount: cartItems.length,
itemBuilder: (context, index) {
final item = cartItems[index];
final service = item['service'];
return Card(
margin: const EdgeInsets.symmetric(
horizontal: 12, vertical: 6),
child: ListTile(
title: Text(service['name'] ?? 'Layanan'),
subtitle: Text(
"Harga: Rp ${service['price'] ?? 0}"),
trailing: IconButton(
icon: const Icon(Icons.delete,
color: Colors.red),
onPressed: () => deleteItem(item['id']),
),
),
);
},
),
),
const Divider(),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
"Total: Rp ${getTotalHarga()}",
style: const TextStyle(
fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 8),
ElevatedButton.icon(
onPressed: pickDate,
icon: const Icon(Icons.date_range),
label: Text(selectedDate == null
? 'Pilih Tanggal Booking'
: 'Tanggal: ${selectedDate!.year}-${selectedDate!.month.toString().padLeft(2, '0')}-${selectedDate!.day.toString().padLeft(2, '0')}'),
),
const SizedBox(height: 8),
ElevatedButton.icon(
onPressed: pickTime,
icon: const Icon(Icons.access_time),
label: Text(selectedTime == null
? 'Pilih Waktu Booking'
: 'Waktu: ${selectedTime!.hour.toString().padLeft(2, '0')}:${selectedTime!.minute.toString().padLeft(2, '0')}'),
),
const SizedBox(height: 16),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: primaryColor,
padding:
const EdgeInsets.symmetric(vertical: 14),
),
onPressed: checkout,
child: const Text("Checkout",
style: TextStyle(fontSize: 16)),
)
],
),
),
],
),
);
}
}

View File

@ -0,0 +1,128 @@
import 'package:flutter/material.dart';
import 'package:salonbooking/pelanggan/home_pelanggan.dart';
import 'package:salonbooking/pelanggan/keranjang_page.dart';
import 'package:salonbooking/pelanggan/riwayat_bookings_page.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
class MainNavigation extends StatefulWidget {
final String userName;
final String token;
const MainNavigation({
Key? key,
required this.userName,
required this.token,
required Map user,
}) : super(key: key);
@override
State<MainNavigation> createState() => _MainNavigationState();
}
class _MainNavigationState extends State<MainNavigation> {
int _selectedIndex = 0;
int cartItemCount = 0;
@override
void initState() {
super.initState();
fetchCartCount();
}
Future<void> fetchCartCount() async {
try {
final response = await http.get(
Uri.parse('http://angeliasalon.my.id/api/cart'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final data = json.decode(response.body);
final List cart = data is List ? data : data['cart'] ?? [];
setState(() {
cartItemCount = cart.length;
});
}
} catch (e) {
print('Error: $e');
}
}
@override
Widget build(BuildContext context) {
final pages = [
PelangganHomePage(
widget.userName,
token: widget.token,
onCartUpdated: fetchCartCount,
),
RiwayatBookingPage(token: widget.token), // Kirim token di sini
KeranjangPage(
token: widget.token,
onCartUpdated: fetchCartCount,
),
];
return Scaffold(
body: pages[_selectedIndex],
bottomNavigationBar: BottomNavigationBar(
currentIndex: _selectedIndex,
onTap: (index) {
setState(() {
_selectedIndex = index;
});
},
type: BottomNavigationBarType.fixed,
selectedItemColor: const Color(0xFFF06292),
items: [
const BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Beranda',
),
const BottomNavigationBarItem(
icon: Icon(Icons.history),
label: 'Riwayat',
),
BottomNavigationBarItem(
icon: Stack(
clipBehavior: Clip.none,
children: [
const Icon(Icons.shopping_cart),
if (cartItemCount > 0)
Positioned(
right: -6,
top: -4,
child: Container(
padding: const EdgeInsets.all(2),
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
constraints: const BoxConstraints(
minWidth: 16,
minHeight: 16,
),
child: Text(
'$cartItemCount',
style: const TextStyle(
color: Colors.white,
fontSize: 10,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
],
),
label: 'Keranjang',
),
],
),
);
}
}

View File

@ -0,0 +1,188 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'package:intl/intl.dart';
class RiwayatBookingPage extends StatefulWidget {
final String token;
const RiwayatBookingPage({super.key, required this.token});
@override
State<RiwayatBookingPage> createState() => _RiwayatBookingPageState();
}
class _RiwayatBookingPageState extends State<RiwayatBookingPage> {
Map<String, List<dynamic>> groupedBookings = {};
bool loading = true;
@override
void initState() {
super.initState();
fetchBookings();
}
Future<void> fetchBookings() async {
setState(() => loading = true);
try {
final response = await http.get(
Uri.parse('http://angeliasalon.my.id/api/bookings'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final data = json.decode(response.body);
List bookings = data is List ? data : data['bookings'] ?? [];
// Kelompokkan berdasarkan tanggal_booking
Map<String, List<dynamic>> tempGrouped = {};
for (var booking in bookings) {
String tanggal = booking['tanggal_booking'];
if (!tempGrouped.containsKey(tanggal)) {
tempGrouped[tanggal] = [];
}
tempGrouped[tanggal]!.add(booking);
}
setState(() {
groupedBookings = tempGrouped;
});
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Gagal mengambil riwayat booking')),
);
}
} catch (e) {
print(e);
}
setState(() => loading = false);
}
@override
Widget build(BuildContext context) {
final primaryColor = const Color(0xFFF06292);
final formatCurrency =
NumberFormat.currency(locale: 'id_ID', symbol: 'Rp ', decimalDigits: 0);
return Scaffold(
appBar: AppBar(
title: const Text('Riwayat Booking'),
backgroundColor: primaryColor,
),
body: loading
? const Center(child: CircularProgressIndicator())
: groupedBookings.isEmpty
? const Center(child: Text('Tidak ada riwayat booking'))
: ListView(
padding: const EdgeInsets.all(12),
children: groupedBookings.entries.map((entry) {
String tanggal = entry.key;
List bookings = entry.value;
int totalHarga = 0;
return Card(
margin: const EdgeInsets.only(bottom: 16),
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'📅 Tanggal Booking: $tanggal',
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
const SizedBox(height: 12),
Table(
columnWidths: const {
0: FlexColumnWidth(2), // Layanan
1: FlexColumnWidth(2), // Jam (lebih kecil)
2: FlexColumnWidth(2.5), // Status (lebih lebar)
3: FlexColumnWidth(2.5), // Harga
},
border: TableBorder.all(color: Colors.grey.shade300),
children: [
const TableRow(
decoration: BoxDecoration(color: Color(0xFFF8BBD0)),
children: [
Padding(
padding: EdgeInsets.all(8.0),
child: Text('Layanan', style: TextStyle(fontWeight: FontWeight.bold)),
),
Padding(
padding: EdgeInsets.all(8.0),
child: Text('Jam', style: TextStyle(fontWeight: FontWeight.bold)),
),
Padding(
padding: EdgeInsets.all(8.0),
child: Text('Status', style: TextStyle(fontWeight: FontWeight.bold)),
),
Padding(
padding: EdgeInsets.all(8.0),
child: Text('Harga', style: TextStyle(fontWeight: FontWeight.bold)),
),
],
),
...bookings.map((booking) {
final service = booking['service'];
final name = service['name'];
final jam = booking['jam'];
final status = booking['status'];
final price = int.tryParse(service['price'].toString()) ?? 0;
totalHarga += price;
return TableRow(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(name),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(jam),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(status),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(formatCurrency.format(price)),
),
],
);
}).toList(),
],
),
const SizedBox(height: 12),
Align(
alignment: Alignment.centerRight,
child: Text(
'Total Harga: ${formatCurrency.format(totalHarga)}',
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
),
],
),
),
);
}).toList(),
),
);
}
}

View File

@ -0,0 +1,311 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
class DataKaryawanPage extends StatefulWidget {
final String token;
const DataKaryawanPage({super.key, required this.token});
@override
State<DataKaryawanPage> createState() => _DataKaryawanPageState();
}
class _DataKaryawanPageState extends State<DataKaryawanPage> with SingleTickerProviderStateMixin {
late TabController _tabController;
List karyawan = [];
bool loading = true;
final TextEditingController nameController = TextEditingController();
final TextEditingController emailController = TextEditingController();
final TextEditingController passwordController = TextEditingController();
final Color primaryColor = const Color(0xFFF06292); // pink terang (hot pink)
final Color backgroundColor = const Color(0xFFFFF6F9); // pink pucat banget
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
fetchKaryawan();
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
Future<void> fetchKaryawan() async {
setState(() => loading = true);
try {
final response = await http.get(
Uri.parse('http://angeliasalon.my.id/api/karyawan'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
setState(() {
karyawan = json.decode(response.body);
loading = false;
});
} else {
throw Exception('Gagal memuat data');
}
} catch (e) {
setState(() => loading = false);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error: $e')),
);
}
}
Future<void> tambahKaryawan() async {
try {
final response = await http.post(
Uri.parse('http://angeliasalon.my.id/api/karyawan'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
body: {
'name': nameController.text,
'email': emailController.text,
'password': passwordController.text,
},
);
if (response.statusCode == 201) {
fetchKaryawan();
nameController.clear();
emailController.clear();
passwordController.clear();
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Karyawan berhasil ditambahkan')),
);
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Gagal menambahkan karyawan')),
);
}
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error: $e')),
);
}
}
Future<void> hapusKaryawan(int id) async {
try {
final response = await http.delete(
Uri.parse('http://angeliasalon.my.id/api/karyawan/$id'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
fetchKaryawan();
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Karyawan berhasil dihapus')),
);
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Gagal menghapus karyawan')),
);
}
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error: $e')),
);
}
}
Future<void> setujuiKaryawan(int id) async {
try {
final response = await http.put(
Uri.parse('http://angeliasalon.my.id/api/karyawan/$id/approve'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
fetchKaryawan();
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Karyawan berhasil disetujui')),
);
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Gagal menyetujui karyawan')),
);
}
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error: $e')),
);
}
}
Widget buildKaryawanCard(Map karyawan) {
final bool isApproved = karyawan['is_approved'] == 1;
return Container(
margin: const EdgeInsets.symmetric(vertical: 8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: const [
BoxShadow(
color: Colors.black12,
blurRadius: 8,
offset: Offset(0, 3),
)
],
),
child: ListTile(
leading: CircleAvatar(
backgroundColor: isApproved ? Colors.green : Colors.orange,
child: Text(
karyawan['name'] != null && karyawan['name'].isNotEmpty
? karyawan['name'][0].toUpperCase()
: '?',
style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
),
title: Text(
karyawan['name'] ?? '',
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(karyawan['email'] ?? ''),
const SizedBox(height: 4),
Text(
isApproved ? 'Disetujui' : 'Menunggu Persetujuan',
style: TextStyle(
fontWeight: FontWeight.bold,
color: isApproved ? Colors.green : Colors.orange,
),
),
],
),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (!isApproved)
IconButton(
icon: const Icon(Icons.check_circle_outline, color: Colors.green),
tooltip: 'Setujui',
onPressed: () => setujuiKaryawan(karyawan['id']),
),
IconButton(
icon: const Icon(Icons.delete_outline, color: Colors.red),
tooltip: 'Hapus',
onPressed: () => hapusKaryawan(karyawan['id']),
),
],
),
),
);
}
Widget buildInputForm() {
return Padding(
padding: const EdgeInsets.all(24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Form Tambah Karyawan',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
const SizedBox(height: 20),
TextField(
controller: nameController,
decoration: const InputDecoration(
labelText: 'Nama',
prefixIcon: Icon(Icons.person),
border: OutlineInputBorder(),
),
),
const SizedBox(height: 15),
TextField(
controller: emailController,
decoration: const InputDecoration(
labelText: 'Email',
prefixIcon: Icon(Icons.email),
border: OutlineInputBorder(),
),
),
const SizedBox(height: 15),
TextField(
controller: passwordController,
obscureText: true,
decoration: const InputDecoration(
labelText: 'Password',
prefixIcon: Icon(Icons.lock),
border: OutlineInputBorder(),
),
),
const SizedBox(height: 20),
Center(
child: ElevatedButton.icon(
onPressed: tambahKaryawan,
icon: const Icon(Icons.person_add),
label: const Text('Tambah Karyawan'),
style: ElevatedButton.styleFrom(
backgroundColor: primaryColor,
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
),
),
],
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
title: const Text('Manajemen Karyawan'),
backgroundColor: primaryColor,
bottom: TabBar(
controller: _tabController,
indicatorColor: Colors.white,
tabs: const [
Tab(icon: Icon(Icons.people), text: 'Daftar Karyawan'),
Tab(icon: Icon(Icons.person_add_alt_1), text: 'Tambah Karyawan'),
],
),
),
body: TabBarView(
controller: _tabController,
children: [
loading
? const Center(child: CircularProgressIndicator())
: RefreshIndicator(
onRefresh: fetchKaryawan,
child: ListView.builder(
padding: const EdgeInsets.all(16),
itemCount: karyawan.length,
itemBuilder: (context, index) {
final k = karyawan[index];
return buildKaryawanCard(k);
},
),
),
SingleChildScrollView(child: buildInputForm()),
],
),
);
}
}

View File

@ -0,0 +1,408 @@
// Lengkap: CRUD layanan Flutter (Tanpa Edit)
import 'dart:convert';
import 'dart:io';
import 'package:http_parser/http_parser.dart';
import 'package:mime/mime.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:http/http.dart' as http;
class Service {
final int id;
final String name;
final int price;
final String? imageUrl;
Service({
required this.id,
required this.name,
required this.price,
this.imageUrl,
});
factory Service.fromJson(Map<String, dynamic> json) {
return Service(
id: json['id'],
name: json['name'],
price: json['price'],
imageUrl: json['image'],
);
}
}
class DataLayananPage extends StatefulWidget {
final String token;
const DataLayananPage({super.key, required this.token});
@override
State<DataLayananPage> createState() => _DataLayananPageState();
}
class _DataLayananPageState extends State<DataLayananPage> {
List categories = [];
Map<int, List<Service>> servicesByCategory = {};
int? selectedCategoryId;
bool loadingCategories = true;
bool loadingServices = false;
String? imagePath;
@override
void initState() {
super.initState();
fetchCategories();
}
Future<void> fetchCategories() async {
setState(() => loadingCategories = true);
try {
final response = await http.get(
Uri.parse('http://angeliasalon.my.id/api/categories'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final data = json.decode(response.body);
setState(() {
categories = data is List ? data : data['categories'];
if (categories.isNotEmpty) {
selectedCategoryId = categories[0]['id'];
fetchServicesByCategory(selectedCategoryId!);
}
});
}
} catch (e) {
print(e);
} finally {
setState(() => loadingCategories = false);
}
}
Future<void> fetchServicesByCategory(int categoryId) async {
setState(() => loadingServices = true);
try {
final response = await http.get(
Uri.parse('http://angeliasalon.my.id/api/services?category_id=$categoryId'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final data = json.decode(response.body);
final List<Service> services = (data as List)
.map((item) => Service.fromJson(item))
.toList();
setState(() {
servicesByCategory[categoryId] = services;
});
}
} catch (e) {
print(e);
} finally {
setState(() => loadingServices = false);
}
}
Future<void> addService({
required String name,
required String price,
required String description,
required String duration,
required int categoryId,
required File? imageFile,
}) async {
final url = Uri.parse('http://angeliasalon.my.id/api/services');
final request = http.MultipartRequest('POST', url);
request.headers.addAll({
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
});
request.fields['name'] = name;
request.fields['category_id'] = categoryId.toString();
request.fields['price'] = price;
request.fields['description'] = description;
request.fields['duration'] = duration;
if (imageFile != null) {
final mimeType = lookupMimeType(imageFile.path); // butuh: import 'package:mime/mime.dart';
final fileStream = http.ByteStream(imageFile.openRead());
final length = await imageFile.length();
final multipartFile = http.MultipartFile(
'image', fileStream, length,
filename: imageFile.path.split('/').last,
contentType: MediaType.parse(mimeType ?? 'image/jpeg'), // butuh: import 'package:http_parser/http_parser.dart';
);
request.files.add(multipartFile);
}
final response = await request.send();
final respStr = await response.stream.bytesToString();
print("Response: $respStr");
if (response.statusCode == 201) {
print("Layanan berhasil ditambahkan.");
await fetchServicesByCategory(categoryId);
} else {
print("Gagal tambah layanan: $respStr");
}
}
Future<void> deleteService(int id, int categoryId) async {
final url = Uri.parse('http://angeliasalon.my.id/api/services/$id');
final response = await http.delete(
url,
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
print("Layanan berhasil dihapus.");
await fetchServicesByCategory(categoryId);
} else {
print("Gagal hapus layanan: ${response.body}");
}
}
void showAddServiceDialog() {
final nameController = TextEditingController();
final priceController = TextEditingController();
final descriptionController = TextEditingController();
final durationController = TextEditingController(); // Tambahan durasi
int? selectedDialogCategoryId = selectedCategoryId;
String? previewImagePath;
imagePath = null;
showDialog(
context: context,
builder: (context) => StatefulBuilder(
builder: (context, setStateDialog) {
return AlertDialog(
title: const Text('Tambah Layanan'),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
DropdownButtonFormField<int>(
value: selectedDialogCategoryId,
items: categories.map<DropdownMenuItem<int>>((category) {
return DropdownMenuItem<int>(
value: category['id'],
child: Text(category['name']),
);
}).toList(),
onChanged: (value) => setStateDialog(() => selectedDialogCategoryId = value),
decoration: const InputDecoration(labelText: 'Kategori'),
),
TextField(
controller: nameController,
decoration: const InputDecoration(labelText: 'Nama Layanan'),
),
TextField(
controller: priceController,
keyboardType: TextInputType.number,
decoration: const InputDecoration(labelText: 'Harga'),
),
TextField(
controller: descriptionController,
decoration: const InputDecoration(labelText: 'Deskripsi'),
),
TextField(
controller: durationController, // Durasi dalam menit
keyboardType: TextInputType.number,
decoration: const InputDecoration(labelText: 'Durasi (menit)'),
),
ElevatedButton(
onPressed: () async {
final picker = ImagePicker();
final pickedFile = await picker.pickImage(source: ImageSource.gallery);
if (pickedFile != null) {
setStateDialog(() {
previewImagePath = pickedFile.path;
imagePath = pickedFile.path;
});
}
},
child: const Text('Pilih Gambar'),
),
if (previewImagePath != null)
Image.file(File(previewImagePath!), height: 100),
],
),
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('Batal'),
),
ElevatedButton(
onPressed: () async {
if (nameController.text.isEmpty ||
priceController.text.isEmpty ||
descriptionController.text.isEmpty ||
durationController.text.isEmpty ||
selectedDialogCategoryId == null) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Semua field harus diisi')),
);
return;
}
await addService(
name: nameController.text,
price: priceController.text,
description: descriptionController.text,
duration: durationController.text, // kirim durasi
categoryId: selectedDialogCategoryId!,
imageFile: imagePath != null ? File(imagePath!) : null,
);
Navigator.pop(context);
},
child: const Text('Simpan'),
),
],
);
},
),
);
}
void selectCategory(int categoryId) async {
if (selectedCategoryId == categoryId) return;
setState(() => selectedCategoryId = categoryId);
await fetchServicesByCategory(categoryId);
}
@override
Widget build(BuildContext context) {
final Color primaryColor = const Color(0xFFF06292); // pink terang (hot pink)
final Color backgroundColor = const Color(0xFFFFF6F9); // pink pucat banget
final services = selectedCategoryId != null ? (servicesByCategory[selectedCategoryId!] ?? []) : [];
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(title: const Text('Data Layanan'), backgroundColor: primaryColor),
floatingActionButton: FloatingActionButton(
backgroundColor: primaryColor,
onPressed: showAddServiceDialog,
child: const Icon(Icons.add),
),
body: Column(
children: [
SizedBox(
height: 60,
child: loadingCategories
? const Center(child: CircularProgressIndicator())
: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: categories.length,
itemBuilder: (context, index) {
final category = categories[index];
final isSelected = category['id'] == selectedCategoryId;
return GestureDetector(
onTap: () => selectCategory(category['id']),
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 8, vertical: 10),
padding: const EdgeInsets.symmetric(horizontal: 20),
decoration: BoxDecoration(
color: isSelected ? primaryColor : Colors.pink.shade100,
borderRadius: BorderRadius.circular(20),
),
child: Center(
child: Text(
category['name'],
style: TextStyle(
color: isSelected ? Colors.white : Colors.black,
fontWeight: FontWeight.bold,
),
),
),
),
);
},
),
),
const Divider(),
Expanded(
child: loadingServices
? const Center(child: CircularProgressIndicator())
: services.isEmpty
? const Center(child: Text('Belum ada layanan.'))
: ListView.builder(
itemCount: services.length,
itemBuilder: (context, index) {
final service = services[index];
return Card(
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
elevation: 4,
child: ListTile(
contentPadding: const EdgeInsets.all(10),
leading: service.imageUrl != null && service.imageUrl!.isNotEmpty
? ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Image.network(
service.imageUrl!,
width: 60,
height: 60,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) => const Icon(Icons.broken_image, size: 60),
),
)
: const Icon(Icons.image, size: 60, color: Colors.grey),
title: Text(service.name, style: const TextStyle(fontWeight: FontWeight.bold)),
subtitle: Text("Rp ${service.price}"),
trailing: IconButton(
icon: const Icon(Icons.delete, color: Colors.red),
onPressed: () async {
final confirm = await showDialog<bool>(
context: context,
builder: (context) => AlertDialog(
title: const Text('Hapus Layanan'),
content: const Text('Apakah Anda yakin ingin menghapus layanan ini?'),
actions: [
TextButton(onPressed: () => Navigator.pop(context, false), child: const Text('Batal')),
ElevatedButton(onPressed: () => Navigator.pop(context, true), child: const Text('Hapus')),
],
),
);
if (confirm == true) {
await deleteService(service.id, selectedCategoryId!);
}
},
),
),
);
},
),
),
],
),
);
}
}

View File

@ -0,0 +1,269 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
class DataPelangganPage extends StatefulWidget {
final String token;
const DataPelangganPage({super.key, required this.token});
@override
State<DataPelangganPage> createState() => _DataPelangganPageState();
}
class _DataPelangganPageState extends State<DataPelangganPage> {
List<dynamic> bookings = [];
bool isLoading = false;
final Color primaryColor = const Color(0xFFF06292);
final Color backgroundColor = const Color(0xFFFFF6F9);
@override
void initState() {
super.initState();
fetchBookings();
}
Future<void> fetchBookings() async {
setState(() => isLoading = true);
try {
final response = await http.get(
Uri.parse('http://angeliasalon.my.id/api/bookings'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final data = json.decode(response.body);
setState(() {
bookings = data;
isLoading = false;
});
} else {
throw Exception('Gagal memuat data booking');
}
} catch (e) {
setState(() => isLoading = false);
_showErrorSnackBar('Error: $e');
}
}
void _showErrorSnackBar(String message) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(message), backgroundColor: Colors.red),
);
}
Icon getServiceIcon(String serviceName) {
final name = serviceName.toLowerCase();
if (name.contains('make')) {
return const Icon(Icons.brush, color: Colors.pinkAccent);
} else if (name.contains('rambut') ||
name.contains('hair') ||
name.contains('cut') ||
name.contains('blow')) {
return const Icon(Icons.content_cut, color: Colors.pinkAccent);
} else {
return const Icon(Icons.content_cut, color: Colors.pinkAccent);
}
}
String getInitials(String name) {
final parts = name.trim().split(' ');
if (parts.length == 1) return parts[0][0].toUpperCase();
return '${parts[0][0]}${parts[1][0]}'.toUpperCase();
}
Map<String, List<dynamic>> getBookingsByPelanggan() {
Map<String, List<dynamic>> result = {};
for (var booking in bookings) {
final pelangganName = booking['user']['name'] ?? 'Tidak diketahui';
result.putIfAbsent(pelangganName, () => []);
result[pelangganName]!.add(booking);
}
return result;
}
Map<String, List<dynamic>> getBookingsByTanggal(List<dynamic> bookings) {
Map<String, List<dynamic>> result = {};
for (var booking in bookings) {
final tanggal = booking['tanggal_booking'] ?? 'Tidak diketahui';
result.putIfAbsent(tanggal, () => []);
result[tanggal]!.add(booking);
}
return result;
}
int getTotalHarga(List<dynamic> bookingsPerTanggal) {
int total = 0;
for (var booking in bookingsPerTanggal) {
final harga = (booking['service']?['price'] ?? 0) as int;
total += harga;
}
return total;
}
String formatTanggal(String tanggal) {
try {
final parts = tanggal.split('-');
if (parts.length == 3) {
return '${parts[2]}-${parts[1]}-${parts[0]}';
}
return tanggal;
} catch (e) {
return tanggal;
}
}
String formatRupiah(int angka) {
return 'Rp ${angka.toString().replaceAllMapped(
RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'),
(Match m) => '${m[1]}.',
)}';
}
@override
Widget build(BuildContext context) {
final pelangganMap = getBookingsByPelanggan();
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
title: const Text('Riwayat Booking Pelanggan'),
backgroundColor: primaryColor,
elevation: 0,
),
body: isLoading
? const Center(child: CircularProgressIndicator())
: pelangganMap.isEmpty
? const Center(child: Text('Tidak ada data booking'))
: RefreshIndicator(
onRefresh: fetchBookings,
child: ListView(
padding: const EdgeInsets.all(12),
children: pelangganMap.entries.map((pelangganEntry) {
final namaPelanggan = pelangganEntry.key;
final bookingsList = pelangganEntry.value;
final bookingsByTanggal =
getBookingsByTanggal(bookingsList);
return Card(
color: Colors.white,
margin: const EdgeInsets.symmetric(vertical: 8),
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
child: ExpansionTile(
leading: CircleAvatar(
backgroundColor: primaryColor,
child: Text(
getInitials(namaPelanggan),
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
title: Text(
namaPelanggan,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,
color: Colors.black87,
),
),
children: bookingsByTanggal.entries.map((tanggalEntry) {
final tanggal = tanggalEntry.key;
final bookingsPerTanggal = tanggalEntry.value;
final totalHarga = getTotalHarga(bookingsPerTanggal);
return ExpansionTile(
tilePadding:
const EdgeInsets.symmetric(horizontal: 16),
title: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'Tanggal: ${formatTanggal(tanggal)}',
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.w600,
),
),
Text(
formatRupiah(totalHarga),
style: const TextStyle(
color: Colors.black87,
fontWeight: FontWeight.w500,
),
),
],
),
children: bookingsPerTanggal.map((booking) {
final harga = booking['service']?['price'] ?? 0;
return ListTile(
leading: CircleAvatar(
backgroundColor: Colors.pink.shade100,
child: getServiceIcon(
booking['service']?['name'] ?? '',
),
),
title: Text(
booking['service']?['name'] ?? 'Layanan tidak diketahui',
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 4),
Row(
children: [
const Icon(Icons.access_time, size: 14, color: Colors.grey),
const SizedBox(width: 4),
Text('Jam: ${booking['jam']}'),
],
),
const SizedBox(height: 2),
Row(
children: [
const Icon(Icons.monetization_on, size: 14, color: Colors.grey),
const SizedBox(width: 4),
Text('Harga: ${formatRupiah(harga as int)}'),
],
),
],
),
trailing: Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
decoration: BoxDecoration(
color: booking['status'] == 'diterima'
? Colors.green
: booking['status'] == 'ditolak'
? Colors.red
: Colors.grey,
borderRadius: BorderRadius.circular(20),
),
child: Text(
booking['status'].toString().toUpperCase(),
style: const TextStyle(color: Colors.white, fontSize: 12),
),
),
);
}).toList(),
);
}).toList(),
),
);
}).toList(),
),
),
);
}
}

View File

@ -0,0 +1,214 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:salonbooking/main.dart';
import 'package:salonbooking/pemilik/data_pelanggan_page.dart';
import 'package:salonbooking/pemilik/data_karyawan_page.dart';
import 'package:salonbooking/pemilik/data_layanan_page.dart';
import 'package:salonbooking/pemilik/rekapan.dart';
import 'package:salonbooking/pemilik/pendapatan.dart';
import 'package:salonbooking/karyawan/home_karyawan.dart';
import 'package:salonbooking/pelanggan/main_navigation.dart';
class PemilikHomePage extends StatelessWidget {
final String name;
final String token;
const PemilikHomePage({super.key, required this.name, required this.token});
void logout(BuildContext context) async {
final prefs = await SharedPreferences.getInstance();
await prefs.remove('token');
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (_) => HomeSelector(
onLoginSuccess: (token, user) {
final navigator = navigatorKey.currentState!;
switch (user['role']) {
case 'pelanggan':
navigator.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => MainNavigation(
userName: user['name'] ?? 'User',
token: token,
user: user,
),
),
(route) => false,
);
break;
case 'karyawan':
navigator.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => KaryawanHomePage(
user['name'] ?? 'User',
token: token,
user: user,
),
),
(route) => false,
);
break;
case 'pemilik':
navigator.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => PemilikHomePage(
name: user['name'] ?? 'User',
token: token,
),
),
(route) => false,
);
break;
default:
navigator.pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => const Scaffold(
body: Center(child: Text('Role tidak dikenal')),
),
),
(route) => false,
);
}
},
),
),
(route) => false,
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Home Pemilik - $name'),
backgroundColor: Colors.pinkAccent,
actions: [
IconButton(
icon: const Icon(Icons.logout),
onPressed: () {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('Konfirmasi Logout'),
content: const Text('Apakah Anda yakin ingin logout?'),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('Batal'),
),
TextButton(
onPressed: () {
Navigator.pop(context);
logout(context);
},
child: const Text(
'Logout',
style: TextStyle(color: Colors.red),
),
),
],
),
);
},
),
],
),
body: Center(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 32),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ElevatedButton.icon(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => DataPelangganPage(token: token),
),
);
},
icon: const Icon(Icons.people),
label: const Text('Data Pelanggan'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.pinkAccent,
padding: const EdgeInsets.symmetric(vertical: 16),
),
),
const SizedBox(height: 20),
ElevatedButton.icon(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => DataKaryawanPage(token: token),
),
);
},
icon: const Icon(Icons.person),
label: const Text('Data Karyawan'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.pinkAccent,
padding: const EdgeInsets.symmetric(vertical: 16),
),
),
const SizedBox(height: 20),
ElevatedButton.icon(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => DataLayananPage(token: token),
),
);
},
icon: const Icon(Icons.design_services),
label: const Text('Data Layanan'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.pinkAccent,
padding: const EdgeInsets.symmetric(vertical: 16),
),
),
const SizedBox(height: 20),
ElevatedButton.icon(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => RekapanPage(token: token),
),
);
},
icon: const Icon(Icons.insert_chart_outlined_rounded),
label: const Text('Rekapan Bulanan'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.pinkAccent,
padding: const EdgeInsets.symmetric(vertical: 16),
),
),
const SizedBox(height: 20),
ElevatedButton.icon(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => PendapatanPage(token: token),
),
);
},
icon: const Icon(Icons.attach_money),
label: const Text('Pendapatan'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.pinkAccent,
padding: const EdgeInsets.symmetric(vertical: 16),
),
),
],
),
),
),
);
}
}

View File

@ -0,0 +1,430 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:typed_data';
import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart';
import 'package:pdf/pdf.dart';
class PendapatanPage extends StatefulWidget {
final String token;
const PendapatanPage({super.key, required this.token});
@override
State<PendapatanPage> createState() => _PendapatanPageState();
}
class _PendapatanPageState extends State<PendapatanPage> {
List<dynamic> bookings = [];
bool isLoading = false;
final Color primaryColor = const Color(0xFFF06292);
final Color backgroundColor = const Color(0xFFFFF6F9);
@override
void initState() {
super.initState();
fetchBookings();
}
Future<void> fetchBookings() async {
setState(() => isLoading = true);
try {
final response = await http.get(
Uri.parse('http://angeliasalon.my.id/api/bookings'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final data = json.decode(response.body);
setState(() {
bookings = data;
isLoading = false;
});
} else {
throw Exception('Gagal memuat data booking');
}
} catch (e) {
setState(() => isLoading = false);
_showErrorSnackBar('Error: $e');
}
}
void _showErrorSnackBar(String message) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(message), backgroundColor: Colors.red.shade600),
);
}
Map<String, List<dynamic>> groupBookingsByMonth() {
Map<String, List<dynamic>> result = {};
for (var booking in bookings) {
final tanggal = booking['tanggal_booking'] ?? '0000-00-00';
final bulan = tanggal.substring(0, 7); // yyyy-MM
result.putIfAbsent(bulan, () => []);
result[bulan]!.add(booking);
}
return result;
}
int getTotalPendapatanPerMonth(List<dynamic> bookingsInMonth) {
int total = 0;
for (var booking in bookingsInMonth) {
total += (booking['service']?['price'] ?? 0) as int;
}
return total;
}
String formatRupiah(int angka) {
return 'Rp ${angka.toString().replaceAllMapped(
RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'),
(m) => '${m[1]}.',
)}';
}
String getNamaBulan(String bulanAngka) {
const namaBulan = {
'01': 'Januari',
'02': 'Februari',
'03': 'Maret',
'04': 'April',
'05': 'Mei',
'06': 'Juni',
'07': 'Juli',
'08': 'Agustus',
'09': 'September',
'10': 'Oktober',
'11': 'November',
'12': 'Desember',
};
try {
final parts = bulanAngka.split('-'); // yyyy-MM
if (parts.length == 2) {
final tahun = parts[0];
final bulan = namaBulan[parts[1]] ?? parts[1];
return '$bulan $tahun';
}
return bulanAngka;
} catch (_) {
return bulanAngka;
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
title: const Text('Pendapatan'),
backgroundColor: primaryColor,
foregroundColor: Colors.white,
),
body: isLoading
? const Center(child: CircularProgressIndicator())
: bookings.isEmpty
? const Center(child: Text('Tidak ada data booking'))
: RefreshIndicator(
onRefresh: fetchBookings,
child: ListView(
padding: const EdgeInsets.all(12),
children: [
...groupBookingsByMonth().entries.map((entry) {
final bulan = entry.key;
final bookingsInMonth = entry.value;
final total = getTotalPendapatanPerMonth(bookingsInMonth);
return Card(
margin: const EdgeInsets.symmetric(vertical: 8),
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
child: ListTile(
title: Text(
'Bulan: ${getNamaBulan(bulan)}',
style: TextStyle(
fontWeight: FontWeight.bold,
color: primaryColor,
),
),
subtitle: Text('Total: ${formatRupiah(total)}'),
trailing: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => DetailPendapatanPage(
bulan: bulan,
bookingsInMonth: bookingsInMonth,
primaryColor: primaryColor,
),
),
);
},
style: ElevatedButton.styleFrom(
backgroundColor: primaryColor,
foregroundColor: Colors.white,
),
child: const Text('Detail'),
),
),
);
}),
],
),
),
);
}
}
class DetailPendapatanPage extends StatelessWidget {
final String bulan;
final List<dynamic> bookingsInMonth;
final Color primaryColor;
const DetailPendapatanPage({
super.key,
required this.bulan,
required this.bookingsInMonth,
required this.primaryColor,
});
String formatRupiah(int angka) {
return 'Rp ${angka.toString().replaceAllMapped(
RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'),
(m) => '${m[1]}.',
)}';
}
String formatTanggal(String tanggal) {
try {
final parts = tanggal.split('-');
if (parts.length == 3) {
return '${parts[2]}-${parts[1]}-${parts[0]}';
}
return tanggal;
} catch (_) {
return tanggal;
}
}
String getNamaBulan(String bulanAngka) {
const namaBulan = {
'01': 'Januari',
'02': 'Februari',
'03': 'Maret',
'04': 'April',
'05': 'Mei',
'06': 'Juni',
'07': 'Juli',
'08': 'Agustus',
'09': 'September',
'10': 'Oktober',
'11': 'November',
'12': 'Desember',
};
try {
final parts = bulanAngka.split('-'); // yyyy-MM
if (parts.length == 2) {
final tahun = parts[0];
final bulan = namaBulan[parts[1]] ?? parts[1];
return '$bulan $tahun';
}
return bulanAngka;
} catch (_) {
return bulanAngka;
}
}
Future<Uint8List> generatePdf(BuildContext context) async {
final pdf = pw.Document();
final groupedByDate = <String, List<dynamic>>{};
for (var booking in bookingsInMonth) {
final tanggal = booking['tanggal_booking'] ?? 'Tidak diketahui';
groupedByDate.putIfAbsent(tanggal, () => []);
groupedByDate[tanggal]!.add(booking);
}
int totalBulan = 0;
pdf.addPage(
pw.MultiPage(
pageFormat: PdfPageFormat.a4,
build: (context) {
List<pw.Widget> widgets = [
pw.Text(
'Laporan Pendapatan Bulan ${getNamaBulan(bulan)}',
style: pw.TextStyle(fontSize: 18, fontWeight: pw.FontWeight.bold),
),
pw.SizedBox(height: 10),
];
for (var entry in groupedByDate.entries) {
final tanggal = entry.key;
final layananMap = <String, List<dynamic>>{};
for (var booking in entry.value) {
final nama = booking['service']?['name'] ?? 'Tidak diketahui';
layananMap.putIfAbsent(nama, () => []);
layananMap[nama]!.add(booking);
}
int totalTanggal = 0;
layananMap.forEach((_, list) {
final price = list[0]['service']?['price'] ?? 0;
totalTanggal += (price as int) * list.length;
});
totalBulan += totalTanggal;
widgets.addAll([
pw.Text(
formatTanggal(tanggal),
style: pw.TextStyle(fontWeight: pw.FontWeight.bold),
),
pw.SizedBox(height: 4),
...layananMap.entries.map((e) {
final nama = e.key;
final list = e.value;
final harga = list[0]['service']?['price'] ?? 0;
return pw.Row(
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
children: [
pw.Text('$nama (${list.length}x)'),
pw.Text(formatRupiah((harga as int) * list.length)),
],
);
}),
pw.SizedBox(height: 6),
pw.Container(
alignment: pw.Alignment.centerRight,
child: pw.Text(
'Total: ${formatRupiah(totalTanggal)}',
style: pw.TextStyle(fontWeight: pw.FontWeight.bold),
),
),
pw.SizedBox(height: 10),
pw.Divider(),
]);
}
// Tambahkan total keseluruhan di akhir
widgets.addAll([
pw.SizedBox(height: 16),
pw.Divider(),
pw.Container(
alignment: pw.Alignment.centerRight,
child: pw.Text(
'Total Pendapatan Bulan Ini: ${formatRupiah(totalBulan)}',
style: pw.TextStyle(fontSize: 16, fontWeight: pw.FontWeight.bold),
),
),
]);
return widgets;
},
),
);
return pdf.save();
}
@override
Widget build(BuildContext context) {
final groupedByDate = <String, List<dynamic>>{};
for (var booking in bookingsInMonth) {
final tanggal = booking['tanggal_booking'] ?? 'Tidak diketahui';
groupedByDate.putIfAbsent(tanggal, () => []);
groupedByDate[tanggal]!.add(booking);
}
return Scaffold(
appBar: AppBar(
title: Text('Detail Bulan ${getNamaBulan(bulan)}'),
backgroundColor: primaryColor,
foregroundColor: Colors.white,
actions: [
IconButton(
icon: const Icon(Icons.picture_as_pdf),
onPressed: () async {
final pdfData = await generatePdf(context);
await Printing.layoutPdf(onLayout: (format) async => pdfData);
},
),
],
),
body: ListView(
padding: const EdgeInsets.all(16),
children: groupedByDate.entries.map((entry) {
final tanggal = entry.key;
final layananMap = <String, List<dynamic>>{};
for (var booking in entry.value) {
final nama = booking['service']?['name'] ?? 'Tidak diketahui';
layananMap.putIfAbsent(nama, () => []);
layananMap[nama]!.add(booking);
}
int totalTanggal = 0;
layananMap.forEach((_, list) {
final price = list[0]['service']?['price'] ?? 0;
totalTanggal += (price as int) * list.length;
});
return Card(
margin: const EdgeInsets.only(bottom: 16),
elevation: 3,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
formatTanggal(tanggal),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: primaryColor,
),
),
const SizedBox(height: 8),
...layananMap.entries.map((e) {
final nama = e.key;
final list = e.value;
final harga = list[0]['service']?['price'] ?? 0;
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('$nama (${list.length}x)'),
Text(formatRupiah((harga as int) * list.length)),
],
);
}),
const SizedBox(height: 6),
Align(
alignment: Alignment.centerRight,
child: Text(
'Total: ${formatRupiah(totalTanggal)}',
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
),
],
),
),
);
}).toList(),
),
);
}
}

View File

@ -0,0 +1,195 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
class RekapanPage extends StatefulWidget {
final String token;
const RekapanPage({super.key, required this.token});
@override
State<RekapanPage> createState() => _RekapanPageState();
}
class _RekapanPageState extends State<RekapanPage> {
List<dynamic> bookings = [];
bool isLoading = false;
final List<String> namaBulan = [
'',
'Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni',
'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember',
];
final Color primaryColor = const Color(0xFFF06292);
final Color backgroundColor = const Color(0xFFFFF6F9);
@override
void initState() {
super.initState();
fetchBookings();
}
Future<void> fetchBookings() async {
setState(() => isLoading = true);
try {
final response = await http.get(
Uri.parse('http://angeliasalon.my.id/api/bookings'),
headers: {
'Authorization': 'Bearer ${widget.token}',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
final data = json.decode(response.body);
setState(() {
bookings = data;
isLoading = false;
});
} else {
throw Exception('Gagal memuat data booking');
}
} catch (e) {
setState(() => isLoading = false);
_showErrorSnackBar('Error: $e');
}
}
void _showErrorSnackBar(String message) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(message), backgroundColor: Colors.red.shade600),
);
}
Map<String, Map<String, int>> getYearlyMonthlyRecap() {
final now = DateTime.now();
Map<String, Map<String, int>> result = {};
for (int month = 1; month <= 12; month++) {
final label = '${namaBulan[month]} ${now.year}';
result[label] = {};
}
for (var booking in bookings) {
// Lewati jika status booking ditolak
if (booking['status']?.toLowerCase() == 'ditolak') continue;
final tanggalStr = booking['tanggal_booking'];
if (tanggalStr == null) continue;
DateTime bookingDate;
try {
bookingDate = DateTime.parse(tanggalStr);
} catch (_) {
continue;
}
if (bookingDate.year == now.year) {
final label = '${namaBulan[bookingDate.month]} ${bookingDate.year}';
final layanan = booking['service']?['name'] ?? 'Tidak diketahui';
result[label]![layanan] = (result[label]![layanan] ?? 0) + 1;
}
}
return result;
}
@override
Widget build(BuildContext context) {
final recapData = getYearlyMonthlyRecap();
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
title: const Text('Rekapan Booking Tahunan'),
backgroundColor: primaryColor,
foregroundColor: Colors.white,
actions: [
IconButton(
onPressed: fetchBookings,
icon: const Icon(Icons.refresh),
tooltip: 'Refresh',
)
],
),
body: isLoading
? const Center(child: CircularProgressIndicator())
: bookings.isEmpty
? const Center(child: Text('Tidak ada data booking'))
: RefreshIndicator(
onRefresh: fetchBookings,
child: ListView.builder(
padding: const EdgeInsets.all(16),
itemCount: recapData.length,
itemBuilder: (context, index) {
final key = recapData.keys.elementAt(index);
final data = recapData[key]!;
return Container(
width: double.infinity,
margin: const EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.pink.shade100,
blurRadius: 6,
offset: const Offset(0, 2),
)
],
),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'📅 $key',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: primaryColor,
),
),
const SizedBox(height: 12),
data.isEmpty
? const Center(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 16),
child: Text(
'Belum ada booking di bulan ini.',
style: TextStyle(
color: Colors.black54,
fontStyle: FontStyle.italic,
),
),
),
)
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: data.entries.map((e) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: Text(
'${e.key}: ${e.value} booking',
style: const TextStyle(
fontSize: 16,
color: Colors.black87,
),
),
);
}).toList(),
),
],
),
),
);
},
),
),
);
}
}

1
salonbooking/linux/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
flutter/ephemeral

View File

@ -0,0 +1,128 @@
# Project-level configuration.
cmake_minimum_required(VERSION 3.13)
project(runner LANGUAGES CXX)
# The name of the executable created for the application. Change this to change
# the on-disk name of your application.
set(BINARY_NAME "salonbooking")
# The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "com.example.salonbooking")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
cmake_policy(SET CMP0063 NEW)
# Load bundled libraries from the lib/ directory relative to the binary.
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
# Root filesystem for cross-building.
if(FLUTTER_TARGET_PLATFORM_SYSROOT)
set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()
# Define build configuration options.
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Debug" CACHE
STRING "Flutter build mode" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Profile" "Release")
endif()
# Compilation settings that should be applied to most targets.
#
# Be cautious about adding new options here, as plugins use this function by
# default. In most cases, you should add new options to specific targets instead
# of modifying this function.
function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_14)
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
endfunction()
# Flutter library and tool build rules.
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
add_subdirectory(${FLUTTER_MANAGED_DIR})
# System-level dependencies.
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
# Application build; see runner/CMakeLists.txt.
add_subdirectory("runner")
# Run the Flutter tool portions of the build. This must not be removed.
add_dependencies(${BINARY_NAME} flutter_assemble)
# Only the install-generated bundle's copy of the executable will launch
# correctly, since the resources must in the right relative locations. To avoid
# people trying to run the unbundled copy, put it in a subdirectory instead of
# the default top-level location.
set_target_properties(${BINARY_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
)
# Generated plugin build rules, which manage building the plugins and adding
# them to the application.
include(flutter/generated_plugins.cmake)
# === Installation ===
# By default, "installing" just makes a relocatable bundle in the build
# directory.
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()
# Start with a clean build bundle directory every time.
install(CODE "
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
" COMPONENT Runtime)
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime)
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
install(FILES "${bundled_library}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endforeach(bundled_library)
# Copy the native assets provided by the build.dart from all packages.
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/")
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
install(CODE "
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
" COMPONENT Runtime)
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
# Install the AOT library on non-Debug builds only.
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()

View File

@ -0,0 +1,88 @@
# This file controls Flutter-level build steps. It should not be edited.
cmake_minimum_required(VERSION 3.10)
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
# Configuration provided via flutter tool.
include(${EPHEMERAL_DIR}/generated_config.cmake)
# TODO: Move the rest of this into files in ephemeral. See
# https://github.com/flutter/flutter/issues/57146.
# Serves the same purpose as list(TRANSFORM ... PREPEND ...),
# which isn't available in 3.10.
function(list_prepend LIST_NAME PREFIX)
set(NEW_LIST "")
foreach(element ${${LIST_NAME}})
list(APPEND NEW_LIST "${PREFIX}${element}")
endforeach(element)
set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
endfunction()
# === Flutter Library ===
# System-level dependencies.
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
# Published to parent scope for install step.
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
list(APPEND FLUTTER_LIBRARY_HEADERS
"fl_basic_message_channel.h"
"fl_binary_codec.h"
"fl_binary_messenger.h"
"fl_dart_project.h"
"fl_engine.h"
"fl_json_message_codec.h"
"fl_json_method_codec.h"
"fl_message_codec.h"
"fl_method_call.h"
"fl_method_channel.h"
"fl_method_codec.h"
"fl_method_response.h"
"fl_plugin_registrar.h"
"fl_plugin_registry.h"
"fl_standard_message_codec.h"
"fl_standard_method_codec.h"
"fl_string_codec.h"
"fl_value.h"
"fl_view.h"
"flutter_linux.h"
)
list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
add_library(flutter INTERFACE)
target_include_directories(flutter INTERFACE
"${EPHEMERAL_DIR}"
)
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
target_link_libraries(flutter INTERFACE
PkgConfig::GTK
PkgConfig::GLIB
PkgConfig::GIO
)
add_dependencies(flutter flutter_assemble)
# === Flutter tool backend ===
# _phony_ is a non-existent file to force this command to run every time,
# since currently there's no way to get a full input/output list from the
# flutter tool.
add_custom_command(
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/_phony_
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
"${FLUTTER_LIBRARY}"
${FLUTTER_LIBRARY_HEADERS}
)

View File

@ -0,0 +1,19 @@
//
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
#include <file_selector_linux/file_selector_plugin.h>
#include <printing/printing_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
g_autoptr(FlPluginRegistrar) printing_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "PrintingPlugin");
printing_plugin_register_with_registrar(printing_registrar);
}

View File

@ -0,0 +1,15 @@
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_
#include <flutter_linux/flutter_linux.h>
// Registers Flutter plugins.
void fl_register_plugins(FlPluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_

View File

@ -0,0 +1,25 @@
#
# Generated file, do not edit.
#
list(APPEND FLUTTER_PLUGIN_LIST
file_selector_linux
printing
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)

View File

@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.13)
project(runner LANGUAGES CXX)
# Define the application target. To change its name, change BINARY_NAME in the
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
# work.
#
# Any new source files that you add to the application should be added here.
add_executable(${BINARY_NAME}
"main.cc"
"my_application.cc"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
)
# Apply the standard set of build settings. This can be removed for applications
# that need different build settings.
apply_standard_settings(${BINARY_NAME})
# Add preprocessor definitions for the application ID.
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
# Add dependency libraries. Add any application-specific dependencies here.
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")

View File

@ -0,0 +1,6 @@
#include "my_application.h"
int main(int argc, char** argv) {
g_autoptr(MyApplication) app = my_application_new();
return g_application_run(G_APPLICATION(app), argc, argv);
}

View File

@ -0,0 +1,130 @@
#include "my_application.h"
#include <flutter_linux/flutter_linux.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#include "flutter/generated_plugin_registrant.h"
struct _MyApplication {
GtkApplication parent_instance;
char** dart_entrypoint_arguments;
};
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
// Implements GApplication::activate.
static void my_application_activate(GApplication* application) {
MyApplication* self = MY_APPLICATION(application);
GtkWindow* window =
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
// Use a header bar when running in GNOME as this is the common style used
// by applications and is the setup most users will be using (e.g. Ubuntu
// desktop).
// If running on X and not using GNOME then just use a traditional title bar
// in case the window manager does more exotic layout, e.g. tiling.
// If running on Wayland assume the header bar will work (may need changing
// if future cases occur).
gboolean use_header_bar = TRUE;
#ifdef GDK_WINDOWING_X11
GdkScreen* screen = gtk_window_get_screen(window);
if (GDK_IS_X11_SCREEN(screen)) {
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
use_header_bar = FALSE;
}
}
#endif
if (use_header_bar) {
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar));
gtk_header_bar_set_title(header_bar, "salonbooking");
gtk_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
} else {
gtk_window_set_title(window, "salonbooking");
}
gtk_window_set_default_size(window, 1280, 720);
gtk_widget_show(GTK_WIDGET(window));
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
FlView* view = fl_view_new(project);
gtk_widget_show(GTK_WIDGET(view));
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
gtk_widget_grab_focus(GTK_WIDGET(view));
}
// Implements GApplication::local_command_line.
static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
MyApplication* self = MY_APPLICATION(application);
// Strip out the first argument as it is the binary name.
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
g_autoptr(GError) error = nullptr;
if (!g_application_register(application, nullptr, &error)) {
g_warning("Failed to register: %s", error->message);
*exit_status = 1;
return TRUE;
}
g_application_activate(application);
*exit_status = 0;
return TRUE;
}
// Implements GApplication::startup.
static void my_application_startup(GApplication* application) {
//MyApplication* self = MY_APPLICATION(object);
// Perform any actions required at application startup.
G_APPLICATION_CLASS(my_application_parent_class)->startup(application);
}
// Implements GApplication::shutdown.
static void my_application_shutdown(GApplication* application) {
//MyApplication* self = MY_APPLICATION(object);
// Perform any actions required at application shutdown.
G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application);
}
// Implements GObject::dispose.
static void my_application_dispose(GObject* object) {
MyApplication* self = MY_APPLICATION(object);
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
}
static void my_application_class_init(MyApplicationClass* klass) {
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
G_APPLICATION_CLASS(klass)->startup = my_application_startup;
G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
}
static void my_application_init(MyApplication* self) {}
MyApplication* my_application_new() {
// Set the program name to the application ID, which helps various systems
// like GTK and desktop environments map this running application to its
// corresponding .desktop file. This ensures better integration by allowing
// the application to be recognized beyond its binary name.
g_set_prgname(APPLICATION_ID);
return MY_APPLICATION(g_object_new(my_application_get_type(),
"application-id", APPLICATION_ID,
"flags", G_APPLICATION_NON_UNIQUE,
nullptr));
}

View File

@ -0,0 +1,18 @@
#ifndef FLUTTER_MY_APPLICATION_H_
#define FLUTTER_MY_APPLICATION_H_
#include <gtk/gtk.h>
G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
GtkApplication)
/**
* my_application_new:
*
* Creates a new Flutter-based application.
*
* Returns: a new #MyApplication.
*/
MyApplication* my_application_new();
#endif // FLUTTER_MY_APPLICATION_H_

7
salonbooking/macos/.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/
# Xcode-related
**/dgph
**/xcuserdata/

View File

@ -0,0 +1 @@
#include "ephemeral/Flutter-Generated.xcconfig"

View File

@ -0,0 +1 @@
#include "ephemeral/Flutter-Generated.xcconfig"

View File

@ -0,0 +1,20 @@
//
// Generated file. Do not edit.
//
import FlutterMacOS
import Foundation
import file_selector_macos
import path_provider_foundation
import printing
import shared_preferences_foundation
import sqflite_darwin
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
PrintingPlugin.register(with: registry.registrar(forPlugin: "PrintingPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
}

Some files were not shown because too many files have changed in this diff Show More