Ensure sales are recorded to the correct store based on user selection

Fixes sales creation logic to correctly send storeId and updates admin role check.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 4b008663-bd72-492b-b0b6-fa252367e730
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/4b008663-bd72-492b-b0b6-fa252367e730/mXpFFH6
This commit is contained in:
michaelschal committed 2025-07-19 16:48:28 +00:00
1 parent c909650566
commit be78e1497c
3 files changed
+36 -27

No files matched your search

+1 -1
View File
@@ -88,7 +88,7 @@ export default function NewSaleForm() {
mutationFn: async (saleData: any) => {
const dataToSend = {
...saleData,
...(user?.role === 'admin' && selectedStoreId && { storeId: selectedStoreId })
...(user?.role === 'administrator' && selectedStoreId && { storeId: selectedStoreId })
};
const response = await apiRequest('/api/sales', {
+1 -1
View File
@@ -71,7 +71,7 @@ export default function NewSaleFormMulti() {
mutationFn: async (saleData: any) => {
const dataToSend = {
...saleData,
...(user?.role === 'admin' && selectedStoreId && { storeId: selectedStoreId })
...(user?.role === 'administrator' && selectedStoreId && { storeId: selectedStoreId })
};
const response = await apiRequest('/api/sales', {