Skip to content

Commit

Permalink
Testable and previewable (#912)
Browse files Browse the repository at this point in the history
* Enhancement - AddOnItem UI & UX

- Close #864
- Close #865

* Enhancement - Address UI & UX

- Close #866
- Close #867

* Fix - Button Size issue

- Close #868

* Enhancement - Select CartOrder Screen

- Close #869
- Close #870

* Enhancement - Cart Screen UI/UX

- Close #871
- Close #872

* Enhancement - Cart Order Screen UI/UX

- Close #883
- Close #884
- Close #885

* Enhancement - Category Screen UI/UX

- Close #886
- Close #887

* Enhancement - Charges Screen UI/UX

- Close #888
- Close #889

* Enhancement - Customer Screen UI/UX

- Close #890
- Close #891

* Enhancement - Employee Screen UI/UX

- Close #892
- Close #893

* Enhancement - Absent Feature UI/UX

- Close #894
- Close #895

* Enhancement - Payment Feature UI/UX

- Close #896
- Close #897
- Close #898

* Enhancement - Expense Feature UI/UX

- Close #899
- Close #900

* Enhancement - MeasureUnit Feature UI/UX

- Close #901
- Close #902

* Enhancement - MarketType Feature UI/UX

* Enhancement - MarketItem Feature UI/UX

- Close #903
- Close #904

* Enhancement - MarketListItem Feature UI/UX

- Close #905
- Close #906
- Close #907

* Enhancement - Home Feature UI/UX

- Close #908
- Close #909

* Enhancement - Product Feature UI/UX

- Close #910
- Close #911
  • Loading branch information
niyajali authored Jun 13, 2024
1 parent 7407d89 commit de31658
Show file tree
Hide file tree
Showing 256 changed files with 19,761 additions and 8,683 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/com/niyaj/poposroom/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package com.niyaj.poposroom
import android.Manifest
import android.os.Build
import android.os.Bundle
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
Expand All @@ -37,6 +36,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalContext
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.compose.LocalLifecycleOwner
Expand Down Expand Up @@ -120,6 +120,8 @@ class MainActivity : ComponentActivity() {
}
}

WindowCompat.setDecorFitsSystemWindows(window, false)

enableEdgeToEdge()

registerForActivityResult(ActivityResultContracts.StartIntentSenderForResult()) { result ->
Expand Down Expand Up @@ -156,8 +158,6 @@ class MainActivity : ComponentActivity() {
)
val isLoggedIn by appState.isLoggedIn.collectAsStateWithLifecycle()

Log.d("isLoggedIn", "$isLoggedIn")

CompositionLocalProvider(LocalAnalyticsHelper provides analyticsHelper) {
PoposRoomTheme(
darkTheme = darkTheme,
Expand Down
18 changes: 17 additions & 1 deletion app/src/main/java/com/niyaj/poposroom/navigation/PoposNavHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ import com.niyaj.cartorder.destinations.AddEditCartOrderScreenDestination
import com.niyaj.cartorder.destinations.CartOrderScreenDestination
import com.niyaj.customer.destinations.CustomerDetailsScreenDestination
import com.niyaj.customer.details.CustomerDetailsScreen
import com.niyaj.employee.destinations.AddEditEmployeeScreenDestination
import com.niyaj.employee.destinations.EmployeeDetailsScreenDestination
import com.niyaj.employee.details.EmployeeDetailsScreen
import com.niyaj.employeeAbsent.createOrUpdate.AddEditAbsentScreen
import com.niyaj.employeeAbsent.destinations.AddEditAbsentScreenDestination
import com.niyaj.employeePayment.PaymentScreen
import com.niyaj.employeePayment.destinations.AddEditPaymentScreenDestination
Expand Down Expand Up @@ -164,6 +166,20 @@ fun PoposNavHost(
onClickAddAbsent = {
navController.navigate(AddEditAbsentScreenDestination(employeeId = it))
},
paymentRecipient = resultRecipient<AddEditPaymentScreenDestination, String>(),
absentRecipient = resultRecipient<AddEditAbsentScreenDestination, String>(),
)
}

composable(AddEditAbsentScreenDestination) {
AddEditAbsentScreen(
absentId = navBackStackEntry.arguments?.getInt("absentId") ?: 0,
employeeId = navBackStackEntry.arguments?.getInt("employeeId") ?: 0,
navigator = this.destinationsNavigator,
onClickAddEmployee = {
navController.navigate(AddEditEmployeeScreenDestination())
},
resultBackNavigator = resultBackNavigator(),
)
}

Expand All @@ -180,7 +196,7 @@ fun PoposNavHost(
composable(CustomerDetailsScreenDestination) {
CustomerDetailsScreen(
customerId = navBackStackEntry.arguments?.getInt("customerId") ?: 0,
navController = destinationsNavigator,
navigator = destinationsNavigator,
onClickOrder = {
navController.navigate(OrderDetailsScreenDestination(it))
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,8 @@ private inline fun <reified T : KotlinTopLevelExtension> Project.configureKotlin
// Enable experimental coroutines APIs, including Flow
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
)
freeCompilerArgs.add(
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api"
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@ object AbsentScreenTags {

const val ABSENT_TAG = "Absent-"

const val ABSENT_SETTINGS_NOTE = "Make Sure To Import Employee Before Importing Employee Absent Dates."

const val ABSENT_SETTINGS_TITLE = "Absent Settings"

const val IMPORT_ABSENT_TITLE = "Import Absentees"
const val IMPORT_ABSENT_BTN_TEXT = "Import Absentees"
const val IMPORT_ABSENT_OPN_FILE = "Open File"
const val IMPORT_ABSENT_NOTE_TEXT = "Make sure to open absentees.json file."

const val EXPORT_ABSENT_TITLE = "Export Absentees"
const val EXPORT_ABSENT_BTN_TEXT = "Export Absentees"
const val EXPORT_ABSENT_BTN = "Export Absent"

const val EXPORT_ABSENT_FILE_NAME = "absentees"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ object AddOnTestTags {
const val ADDON_NOT_AVAILABLE = "AddOn Not Available"
const val ADDON_SEARCH_PLACEHOLDER = "Search for AddOn Items..."

const val ADDON_LOADING_INDICATOR = "addonLoadingIndicator"
const val ADDON_ITEM_LIST = "addonItemsList"

const val ADD_EDIT_ADDON_SCREEN = "Create New Addon Screen"

const val ADD_EDIT_ADDON_BUTTON = "AddEdit Addon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ object AddressTestTags {
const val ADD_EDIT_ADDRESS_BTN = "AddEdit Address"

const val CREATE_NEW_ADDRESS = "Create New Address"
const val EDIT_ADDRESS = "Update Address"

// Add Edit Address Screen Tags
const val ADDRESS_SHORT_NAME_FIELD = "Short Name"
Expand All @@ -54,11 +53,13 @@ object AddressTestTags {
const val ADDRESS_SETTINGS_TITLE = "Address Settings"

const val IMPORT_ADDRESS_TITLE = "Import Address"
const val IMPORT_ADDRESS_SUB_TITLE = "Click here to import data from file."
const val IMPORT_ADDRESS_BTN_TEXT = "Import Address"
const val IMPORT_ADDRESS_OPN_FILE = "Open File"
const val IMPORT_ADDRESS_NOTE_TEXT = "Make sure to open addresses.json file."

const val EXPORT_ADDRESS_TITLE = "Export Address"
const val EXPORT_ADDRESS_SUB_TITLE = "Click here to export address to file."
const val EXPORT_ADDRESS_BTN_TEXT = "Export Address"
const val EXPORT_ADDRESS_BTN = "Export Address"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@ object CategoryConstants {
const val CATEGORY_SETTINGS_TITLE = "Category Settings"

const val IMPORT_CATEGORY_TITLE = "Import Categories"
const val IMPORT_CATEGORY_NOTE = "Click here to import data from file."

const val IMPORT_CATEGORY_BTN_TEXT = "Import Categories"
const val IMPORT_CATEGORY_OPN_FILE = "Open File"
const val IMPORT_CATEGORY_NOTE_TEXT = "Make sure to open categories.json file."

const val EXPORT_CATEGORY_TITLE = "Export Categories"
const val EXPORT_CATEGORY_TITLE_NOTE = "Click here to export category to file."

const val EXPORT_CATEGORY_BTN_TEXT = "Export Categories"
const val EXPORT_CATEGORY_BTN = "Export Categories"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ object ChargesTestTags {

const val CHARGES_SETTINGS_TITLE = "Charges Settings"

const val IMPORT_CHARGES_TITLE = "Import Charges Item"
const val IMPORT_CHARGES_BTN_TEXT = "Import Charges"
const val IMPORT_CHARGES_SUB_TEXT = "Click here to import charges from file."
const val IMPORT_CHARGES_OPN_FILE = "Open File"
const val IMPORT_CHARGES_NOTE_TEXT = "Make sure to open charges.json file."

const val EXPORT_CHARGES_TITLE = "Export Charges Item"
const val EXPORT_CHARGES_BTN_TEXT = "Export Charges"
const val EXPORT_CHARGES_SUB_TEXT = "Click here to export charges to file."
const val EXPORT_CHARGES_BTN = "Export Charges"

const val EXPORT_CHARGES_FILE_NAME = "charges"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ object CustomerTestTags {

const val CUSTOMER_SCREEN_TITLE = "Customers"
const val CUSTOMER_NOT_AVAILABLE = "Customer Not Available"
const val NO_ITEMS_IN_CUSTOMER = "Customer Items Not Found"
const val CUSTOMER_SEARCH_PLACEHOLDER = "Search for Customer..."

const val CREATE_NEW_CUSTOMER = "Create New Customer"
Expand Down Expand Up @@ -57,14 +56,14 @@ object CustomerTestTags {

const val CUSTOMER_SETTINGS_TITLE = "Customer Settings"

const val IMPORT_CUSTOMER_TITLE = "Import Customers"
const val IMPORT_CUSTOMER_BTN_TEXT = "Import Customer"
const val IMPORT_CUSTOMER_BTN_TEXT = "Import Customers"
const val IMPORT_CUSTOMER_SUB_TITLE = "Click here to import data from file."

const val IMPORT_CUSTOMER_NOTE_TEXT = "Make sure to open customers.json file."
const val IMPORT_CUSTOMER_OPN_FILE = "Open File"

const val EXPORT_CUSTOMER_TITLE = "Export Customers"
const val EXPORT_CUSTOMER_BTN_TEXT = "Export Customer"
const val EXPORT_CUSTOMER_BTN = "Export Customer"
const val EXPORT_CUSTOMER_BTN_TEXT = "Export Customers"
const val EXPORT_CUSTOMER_SUB_TITLE = "Click here to export data from file."

const val EXPORT_CUSTOMER_FILE_NAME = "customers"
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ object EmployeeTestTags {
const val EMPLOYEE_TAG = "Customer-"

// Details screen tags
const val EMPLOYEE_DETAILS_SCREEN = "Employee DetailsScreen"
const val EMPLOYEE_DETAILS = "Employee Details"
const val REMAINING_AMOUNT_TEXT = "remainingAmount"

const val EMPLOYEE_SETTINGS_TITLE = "Employees Settings"

const val IMPORT_EMPLOYEE_TITLE = "Import Employees"
const val IMPORT_EMPLOYEE_BTN_TEXT = "Import Employees"
const val IMPORT_EMPLOYEE_SUB_TITLE = "Click here to import data from file."

const val IMPORT_EMPLOYEE_NOTE_TEXT = "Make sure to open employees.json file."
const val IMPORT_EMPLOYEE_OPN_FILE = "Open File"

const val EXPORT_EMPLOYEE_TITLE = "Export Employees"
const val EXPORT_EMPLOYEE_BTN_TEXT = "Export Employees"
const val EXPORT_EMPLOYEE_BTN = "Export Employees"
const val EXPORT_EMPLOYEE_SUB_TITLE = "Click here to export data to file."

const val EXPORT_EMPLOYEE_FILE_NAME = "employees"
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,12 @@ object ExpenseTestTags {
const val EXPENSE_SETTINGS_TITLE = "Expenses Settings"

const val IMPORT_EXPENSE_TITLE = "Import Expenses"
const val IMPORT_EXPENSE_BTN_TEXT = "Import Expenses"
const val IMPORT_EXPENSE_SUB_TITLE = "Click here to import data from file."
const val IMPORT_EXPENSE_NOTE_TEXT = "Make sure to open expenses.json file."
const val IMPORT_EXPENSE_OPN_FILE = "Open File"

const val EXPORT_EXPENSE_TITLE = "Export Expenses"
const val EXPORT_EXPENSE_BTN_TEXT = "Export Expenses"
const val EXPORT_EXPENSE_BTN = "Export Expenses"
const val EXPORT_EXPENSE_SUB_TITLE = "Click here to export expenses to file."

const val EXPORT_EXPENSE_FILE_NAME = "expenses"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ object MarketListTestTags {

const val MARKET_LIST_SCREEN_TITLE = "Market Lists"

const val ADD_EDIT_MARKET_LIST_BUTTON = "AddEdit Item"

const val CREATE_NEW_LIST = "Create New List"
const val UPDATE_LIST = "Update List"

const val TYPES_NOTE_TEXT = "Please select at least one list type."

const val MARKET_ITEM_TYPE_FIELD = "Item Type"
const val MARKET_ITEM_TYPE_FIELD = "Market Type"
const val MARKET_ITEM_TYPE_ERROR_TAG = "Item Type Error"

const val MARKET_ITEM_NAME_FIELD = "Item Name"
Expand Down Expand Up @@ -76,13 +74,10 @@ object MarketListTestTags {
const val MARKET_ITEM_SETTINGS_TITLE = "Item Settings"

const val IMPORT_MARKET_ITEM_TITLE = "Import Item"
const val IMPORT_MARKET_ITEM_BTN_TEXT = "Import Item"
const val IMPORT_MARKET_ITEM_OPN_FILE = "Open File"
const val IMPORT_MARKET_ITEM_NOTE_TEXT = "Make sure to open market-items.json file."

const val EXPORT_MARKET_ITEM_TITLE = "Export Item"
const val EXPORT_MARKET_ITEM_BTN_TEXT = "Export Item"
const val EXPORT_MARKET_ITEM_BTN = "Export Item"

const val EXPORT_MARKET_ITEM_FILE_NAME = "market-items"
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,10 @@ object MarketTypeTags {
const val MARKET_SETTINGS_TITLE = "Item Settings"

const val IMPORT_MARKET_TITLE = "Import Types"
const val IMPORT_MARKET_BTN_TEXT = "Import Types"
const val IMPORT_MARKET_OPN_FILE = "Open File"
const val IMPORT_MARKET_NOTE_TEXT = "Make sure to open market-types.json file."

const val EXPORT_MARKET_TITLE = "Export Types"
const val EXPORT_MARKET_BTN_TEXT = "Export Types"
const val EXPORT_MARKET_BTN = "Export Item"

const val EXPORT_MARKET_FILE_NAME = "market-types"
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ object MeasureUnitTestTags {
const val UNIT_SETTINGS_TITLE = "Item Settings"

const val IMPORT_UNIT_TITLE = "Import Units"
const val IMPORT_UNIT_BTN_TEXT = "Import Units"
const val IMPORT_UNIT_SUB_TITLE = "Click here to import data from file."
const val IMPORT_UNIT_OPN_FILE = "Open File"
const val IMPORT_UNIT_NOTE_TEXT = "Make sure to open measure-units.json file."

const val EXPORT_UNIT_TITLE = "Export Units"
const val EXPORT_UNIT_BTN_TEXT = "Export Units"
const val EXPORT_UNIT_BTN = "Export Item"
const val EXPORT_UNIT_SUB_TITLE = "Click here to export data to file."

const val EXPORT_UNIT_FILE_NAME = "measure-units"
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ object PaymentScreenTags {

const val PAYMENT_SCREEN_TITLE = "Payments"
const val PAYMENT_NOT_AVAILABLE = "Payments Not Available"
const val NO_ITEMS_IN_PAYMENT = "Payments Not Found"
const val PAYMENT_SEARCH_PLACEHOLDER = "Search for Payments..."

const val CREATE_NEW_PAYMENT = "Add New Payment"
Expand All @@ -33,13 +32,11 @@ object PaymentScreenTags {
const val PAYMENT_EMPLOYEE_NAME_ERROR = "Employee NameError"

const val PAYMENT_TYPE_FIELD = "Payment Type"
const val PAYMENT_TYPE_ERROR = "Payment TypeError"

const val GIVEN_DATE_FIELD = "Given Date"
const val GIVEN_DATE_ERROR = "Given DateError"

const val PAYMENT_MODE_FIELD = "Payment Mode"
const val PAYMENT_MODE_ERROR = "Payment ModeError"

const val GIVEN_AMOUNT_FIELD = "Given Amount"
const val GIVEN_AMOUNT_ERROR = "Given AmountError"
Expand Down Expand Up @@ -69,14 +66,14 @@ object PaymentScreenTags {

const val PAYMENT_SETTINGS_TITLE = "Payment Settings"

const val PAYMENT_SETTINGS_NOTE = "Make Sure To Import Employee Before Importing Employee Payments."

const val IMPORT_PAYMENT_TITLE = "Import Payments"
const val IMPORT_PAYMENT_BTN_TEXT = "Import Employee Payments"
const val IMPORT_PAYMENT_SUB_TITLE = "Click here to import data from file."
const val IMPORT_PAYMENT_OPN_FILE = "Open File"
const val IMPORT_PAYMENT_NOTE_TEXT = "Make sure to open payments.json file."

const val EXPORT_PAYMENT_TITLE = "Export Payments"
const val EXPORT_PAYMENT_BTN_TEXT = "Export Employee Payments"
const val EXPORT_PAYMENT_BTN = "Export Payment"

const val EXPORT_PAYMENT_SUB_TITLE = "Click here to export data to file."
const val EXPORT_PAYMENT_FILE_NAME = "payments"
}
19 changes: 11 additions & 8 deletions core/common/src/main/java/com/niyaj/common/tags/ProductTestTags.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,25 @@ object ProductTestTags {

const val PRODUCT_TAG = "Product-"

const val EXPORT_PRODUCTS_TITLE = "Export Products"
const val EXPORT_PRODUCTS_BTN_TEXT = "Export Products"
const val EXPORT_PRODUCTS_BTN = "Export Products"
const val PRODUCT_SETTINGS_TITLE = "Product Settings"

const val IMPORT_PRODUCTS_TITLE = "Import Products"
const val IMPORT_PRODUCTS_BTN_TEXT = "Import Products"
const val IMPORT_PRODUCTS_SUB_TITLE = "Click here to import product from file."
const val IMPORT_PRODUCTS_OPN_FILE = "Open File"
const val IMPORT_PRODUCTS_NOTE_TEXT = "Make sure to open products.json file."
const val IMPORT_PRODUCTS_NOTE = "Make sure to import categories before importing products."

const val INCREASE_PRODUCTS_TITLE = "Increase Price"
const val INCREASE_PRODUCTS_TEXT_FIELD = "Product Price"
const val INCREASE_PRODUCTS_BTN_TEXT = "Increase Price"
const val INCREASE_PRODUCTS_SUB_TITLE = "Click here to increase product price."

const val DECREASE_PRODUCTS_TITLE = "Decrease Price"
const val DECREASE_PRODUCTS_TEXT_FIELD = "Product Price"
const val DECREASE_PRODUCTS_BTN_TEXT = "Decrease Price"
const val DECREASE_PRODUCTS_SUB_TITLE = "Click here to decrease product price."
const val PRODUCT_PRICE_TEXT_FIELD = "Product Price"

const val EXPORT_PRODUCTS_TITLE = "Export Products"
const val EXPORT_PRODUCTS_SUB_TITLE = "Click here to export product to file."
const val EXPORTED_PRODUCTS_FILE_NAME = "products"

const val VIEW_CATEGORY_TITLE = "View Categories"
const val VIEW_CATEGORY_SUB_TITLE = "Click here to view categories."
}
12 changes: 12 additions & 0 deletions core/common/src/main/java/com/niyaj/common/utils/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ val String.toTime
val Date.toTime
get() = SimpleDateFormat("hh:mm a", Locale.getDefault()).format(this).toString()

val Long.toTime
get() = SimpleDateFormat("hh:mm a", Locale.getDefault()).format(this).toString()

val String.toBarDate
get() = SimpleDateFormat(
"dd MMM",
Expand Down Expand Up @@ -394,6 +397,15 @@ fun calculateEndOfDayTime(date: String = "", days: String = ""): String {
return calendar.timeInMillis.toString()
}

fun getDateInMilliseconds(hour: Int, day: Int = 0, month: Int = 0): String {
val calendar = Calendar.getInstance()
if (day != 0) calendar.add(Calendar.DAY_OF_YEAR, day)
if (month != 0) calendar.add(Calendar.DAY_OF_MONTH, month)
calendar.add(Calendar.HOUR_OF_DAY, hour)

return calendar.timeInMillis.toString()
}

fun safeString(price: String): Int {
return if (price.isEmpty()) {
0
Expand Down
Loading

0 comments on commit de31658

Please sign in to comment.