Skip to content

unrestricted checkout#32

Merged
rishal-ERPGULF merged 2 commits into
mainfrom
unrestricted-checkout
May 20, 2026
Merged

unrestricted checkout#32
rishal-ERPGULF merged 2 commits into
mainfrom
unrestricted-checkout

Conversation

@Muhsina13
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new configuration flag (unrestricted_checkout_location) (read from QR + persisted in AsyncStorage) to allow check-out (“OUT”) without enforcing location restrictions, while keeping location restriction behavior unchanged for check-in (“IN”).

Changes:

  • Parse and persist a new QR field: “Unrestricted Checkout Location”unrestricted_checkout_location.
  • Skip office location fetch / radius enforcement when type === "OUT" and unrestricted_checkout_location === "1" (service + camera flow).
  • Update AttendanceAction button disable/opacity logic to allow checkout while “out of bound” when the new flag is enabled.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
services/api/attendance.service.js Skips location restriction checks for checkout when unrestricted_checkout_location is enabled.
screens/QrScan.jsx Adds QR parsing + AsyncStorage persistence for the new unrestricted checkout flag.
screens/AttendanceCamera.jsx Avoids location validation calls for checkout when unrestricted checkout is enabled.
screens/AttendanceAction.jsx Allows the checkout action button even when out-of-bound if unrestricted checkout is enabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread screens/QrScan.jsx
Comment on lines +113 to +116
console.log(
"QR UNRESTRICTED VALUE:",
cleanedData.unrestricted_checkout_location,
);
Comment thread screens/QrScan.jsx
Comment on lines 47 to 66
const KEYS = [
"Company",
"Employee_Code",
"Full_Name",
"Photo",
"Restrict Location", // :point_left: NEW FIELD
"Restrict Location",
"Unrestricted Checkout Location",
"User_id",
"API",
"App_key",
];
// :one: Decode Base64
let value = utf8.decode(base64.decode(data));
// :two: Clean up weird characters
value = value
.replace(/[\u0000-\u001F\u00A0]+/g, " ")
.replace(
/[%#;]+(?:\s+)?(Company|Employee_Code|Full_Name|Photo|Restrict Location|User_id|API|App_key)(?:\s*[:=])/g,
(_, key) => `${key}:`
/[%#;]+(?:\s+)?(Company|Employee_Code|Full_Name|Photo|Restrict Location|Unrestricted Checkout Location|User_id|API|App_key)(?:\s*[:=])/g,
(_, key) => `${key}:`,
)
Comment on lines +751 to +753
const allowCheckoutAnywhere =
checkin === true && unrestrictedCheckout === "1";

Comment on lines +949 to +960
} ${
restrictLocation === "1" &&
!inTarget &&
!allowCheckoutAnywhere
? "opacity-50"
: ""
}`}
disabled={
actionLoading || (restrictLocation === "1" && !inTarget)
actionLoading ||
(restrictLocation === "1" &&
!inTarget &&
!allowCheckoutAnywhere)
Comment on lines +202 to +217
const unrestrictedCheckout = (
await AsyncStorage.getItem("unrestricted_checkout_location")
)?.trim();

let nearest = null;
let radius = null;

// 📍 Location restriction is enabled
if (restrictLocation && restrictLocation.toString() === "1") {
const shouldSkipLocationRestriction =
type === "OUT" && unrestrictedCheckout === "1";

if (
!shouldSkipLocationRestriction &&
restrictLocation &&
restrictLocation.toString() === "1"
) {
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread screens/QrScan.jsx
Comment on lines +113 to +116
console.log(
"QR UNRESTRICTED VALUE:",
cleanedData.unrestricted_checkout_location,
);
Comment on lines +751 to +753
const allowCheckoutAnywhere =
checkin === true && unrestrictedCheckout === "1";

Comment on lines +949 to +960
} ${
restrictLocation === "1" &&
!inTarget &&
!allowCheckoutAnywhere
? "opacity-50"
: ""
}`}
disabled={
actionLoading || (restrictLocation === "1" && !inTarget)
actionLoading ||
(restrictLocation === "1" &&
!inTarget &&
!allowCheckoutAnywhere)
@rishal-ERPGULF rishal-ERPGULF merged commit ddc33eb into main May 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants