Skip to content

Commit d25feb0

Browse files
committed
Fix staff items rates display, add Android 13+ notification permission, add Firestore index
1 parent b453923 commit d25feb0

5 files changed

Lines changed: 50 additions & 5 deletions

File tree

android/app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939

4040
<uses-permission android:name="android.permission.INTERNET" />
4141

42+
<!-- Notification permission for Android 13+ -->
43+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
44+
4245
<!-- Bluetooth permissions for Android 12+ -->
4346
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
4447
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
package com.hitesh.aadhat;
22

3+
import android.os.Build;
4+
import android.os.Bundle;
5+
import android.Manifest;
6+
import androidx.core.app.ActivityCompat;
7+
import androidx.core.content.ContextCompat;
8+
import android.content.pm.PackageManager;
9+
310
import com.getcapacitor.BridgeActivity;
411

5-
public class MainActivity extends BridgeActivity {}
12+
public class MainActivity extends BridgeActivity {
13+
14+
private static final int NOTIFICATION_PERMISSION_REQUEST_CODE = 1001;
15+
16+
@Override
17+
protected void onCreate(Bundle savedInstanceState) {
18+
super.onCreate(savedInstanceState);
19+
20+
// Request notification permission for Android 13+
21+
if (Build.VERSION.SDK_INT >= 33) {
22+
if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS)
23+
!= PackageManager.PERMISSION_GRANTED) {
24+
ActivityCompat.requestPermissions(
25+
this,
26+
new String[]{Manifest.permission.POST_NOTIFICATIONS},
27+
NOTIFICATION_PERMISSION_REQUEST_CODE
28+
);
29+
}
30+
}
31+
}
32+
}

firebase.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"firestore": {
3-
"rules": "firestore.rules"
3+
"rules": "firestore.rules",
4+
"indexes": "firestore.indexes.json"
45
},
56
"hosting": {
67
"public": "www",

firestore.indexes.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"indexes": [
3+
{
4+
"collectionGroup": "notifications",
5+
"queryScope": "COLLECTION",
6+
"fields": [
7+
{ "fieldPath": "userId", "order": "ASCENDING" },
8+
{ "fieldPath": "read", "order": "ASCENDING" },
9+
{ "fieldPath": "timestamp", "order": "DESCENDING" }
10+
]
11+
}
12+
],
13+
"fieldOverrides": []
14+
}

www/js/modules/items.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,16 +584,16 @@ const ItemsManager = {
584584
row.onclick = () => this.openEditModal(itemIndex);
585585
}
586586

587-
// Staff view: show item name, sale rates, and avg rate
587+
// Staff view: show item name, purchase rates, and retail sale rates
588588
// Non-staff view: show item name, purchase rates, sale rates, wholesale rates
589589
if (isStaff) {
590590
row.innerHTML = `
591591
<td style="padding: 16px; font-weight: 600; color: #1f2937; font-size: 15px; border-right: 1px solid #f3f4f6;">
592592
${displayName || item.name || '-'}
593593
${itemFrequency > 0 ? `<span style="margin-left: 8px; padding: 3px 10px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border-radius: 12px; font-size: 11px; font-weight: 600; box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);">${itemFrequency}</span>` : ''}
594594
</td>
595-
<td style="padding: 16px; color: #28a745; font-size: 14px; font-weight: 600; border-right: 1px solid #f3f4f6;">${saleRates}</td>
596-
<td style="padding: 16px; color: #6366f1; font-size: 14px; font-weight: 600;">${avgRate}</td>
595+
<td style="padding: 16px; color: #007bff; font-size: 14px; font-weight: 600; border-right: 1px solid #f3f4f6;">${purchaseRates}</td>
596+
<td style="padding: 16px; color: #28a745; font-size: 14px; font-weight: 600;">${saleRates}</td>
597597
`;
598598
} else {
599599
row.innerHTML = `

0 commit comments

Comments
 (0)