This repository was archived by the owner on Mar 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
2,071 additions
and
712 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import PosStorage from "../database/PosStorage"; | ||
|
||
export const SET_REMOTE_RECEIPTS = 'SET_REMOTE_RECEIPTS'; | ||
export const ADD_REMOTE_RECEIPT = 'ADD_REMOTE_RECEIPT'; | ||
export const SET_LOCAL_RECEIPTS = 'SET_LOCAL_RECEIPTS'; | ||
export const UPDATE_REMOTE_RECEIPT = 'UPDATE_REMOTE_RECEIPT'; | ||
export const UPDATE_LOCAL_RECEIPT = 'UPDATE_LOCAL_RECEIPT'; | ||
export const UPDATE_RECEIPT_LINE_ITEM = 'UPDATE_RECEIPT_LINE_ITEM'; | ||
export const REMOVE_LOCAL_RECEIPT = 'REMOVE_LOCAL_RECEIPT'; | ||
|
||
export function setRemoteReceipts(remoteReceipts) { | ||
console.log("setRemoteReceipts - action"); | ||
return (dispatch) => { dispatch({ type: SET_REMOTE_RECEIPTS, data: { remoteReceipts } }) }; | ||
} | ||
|
||
export function addRemoteReceipt(receipt) { | ||
console.log('addRemoteReceipt - action'); | ||
return dispatch => { dispatch({ type: ADD_REMOTE_RECEIPT, data: { receipt } }) }; | ||
} | ||
|
||
export function setLocalReceipts(localReceipts) { | ||
console.log('setLocalReceipts - action'); | ||
return dispatch => { dispatch({ type: SET_LOCAL_RECEIPTS, data: { localReceipts } }) }; | ||
} | ||
|
||
export function removeLocalReceipt(receiptId) { | ||
console.log(`removeLocalReceipt - action ${receiptId}`); | ||
return dispatch => { dispatch({ type: REMOVE_LOCAL_RECEIPT, data: { receiptId } }) }; | ||
} | ||
|
||
export function updateRemoteReceipt(receiptIndex, updatedFields) { | ||
console.log('updateRemoteReceipt - action'); | ||
return dispatch => { | ||
dispatch({ | ||
type: UPDATE_REMOTE_RECEIPT, | ||
data: { | ||
remoteReceiptIndex: receiptIndex, | ||
updatedRemoteFields: updatedFields | ||
} | ||
}) | ||
}; | ||
} | ||
|
||
export function updateReceiptLineItem(receiptIndex, lineItemIndex, updatedFields) { | ||
console.log('updateRemoteReceipt - action'); | ||
return dispatch => { | ||
dispatch({ | ||
type: UPDATE_RECEIPT_LINE_ITEM, | ||
data: { | ||
receiptIndex, | ||
lineItemIndex, | ||
updatedLineItemFields: updatedFields | ||
} | ||
}) | ||
}; | ||
} | ||
|
||
// export function updateLocalReceipt(item, updatedFields) { | ||
// console.log('updateLocalReceipt - action'); | ||
|
||
// PosStorage._loadPendingSale(item.id).then((sale) => { | ||
// return ({ key: item.id, sale }); | ||
// }) | ||
// .then(receipt => { | ||
// const saleData = { | ||
// key: item.id, | ||
// sale: { | ||
// ...receipt.sale, | ||
// ...updatedFields | ||
// } | ||
// } | ||
|
||
// PosStorage.updatePendingSale(item.id, saleData); | ||
// }); | ||
|
||
// return dispatch => { | ||
// dispatch({ | ||
// type: UPDATE_LOCAL_RECEIPT, | ||
// data: { | ||
// localReceiptIndex: item.index, | ||
// updatedLocalFields: updatedFields | ||
// } | ||
// }) | ||
// }; | ||
// } |
Oops, something went wrong.