Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
#447 Update row status
Browse files Browse the repository at this point in the history
  • Loading branch information
damianprzygodzki committed Mar 7, 2017
1 parent c98d962 commit 4f89ec4
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 6 deletions.
15 changes: 13 additions & 2 deletions src/actions/WindowActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,18 @@ export function initDataSuccess(data, scope, docId, saveStatus) {
export function addRowData(data, scope) {
return {
type: types.ADD_ROW_DATA,
data: data,
scope: scope
data,
scope
}
}

export function updateRowStatus(scope, tabid, rowid, saveStatus) {
return {
type: types.UPDATE_ROW_STATUS,
scope,
tabid,
rowid,
saveStatus
}
}

Expand Down Expand Up @@ -342,6 +352,7 @@ function mapDataToState(data, isModal, rowId, id, windowType) {
if (rowId === 'NEW') {
dispatch(addNewRow(item, item.tabid, item.rowId, 'master'))
} else {
dispatch(updateRowStatus(getScope(isModal), item.tabid, item.rowId, item.saveStatus));
item.fields.map(field => {
if (rowId && !isModal) {
dispatch(updateRowSuccess(field, item.tabid, item.rowId, getScope(isModal)));
Expand Down
7 changes: 4 additions & 3 deletions src/assets/css/table.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
* Feel really sorry about that, but it is hard to get over
* table styles in bootstrap and avoid !important.
*/
.table-striped tbody tr {
border-left: 3px solid transparent;
}
.table-striped tbody tr.tr-odd:nth-child(even) {
background-color: $brand-super-light-color;
}
Expand All @@ -84,16 +87,14 @@

.row-not-saved {
background-color: #FEDADA !important;
border-top: 2px solid #e78484;
border-bottom: 2px solid #e78484;
}

.row-selected {
background-color: #d5e3ec !important;
}

.row-selected.row-not-saved {
background-color: #d6a4a4 !important;
border-left: 3px solid #e78484;
}

.table-sub-summary-row {
Expand Down
1 change: 1 addition & 0 deletions src/components/table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ class Table extends Component {
includedDocuments={item[key].includedDocuments}
lastSibling={item[key].lastChild}
contextType={item[key].type}
notSaved={!item[key].saveStatus.saved}
/>
</tbody>
);
Expand Down
1 change: 0 additions & 1 deletion src/components/table/TableItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ class TableItem extends Component {
((item.processed && lastSibling && !includedDocuments) ?
'row-boundary ': ''
) +
// TODO: waiting for API
(notSaved ? 'row-not-saved ': '')
}
>
Expand Down
1 change: 1 addition & 0 deletions src/constants/ActionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const UPDATE_ROW_SUCCESS = 'UPDATE_ROW_SUCCESS';
export const UPDATE_DATA_SUCCESS = 'UPDATE_DATA_SUCCESS';
export const UPDATE_DATA_PROPERTY = 'UPDATE_DATA_PROPERTY';
export const UPDATE_ROW_PROPERTY = 'UPDATE_ROW_PROPERTY';
export const UPDATE_ROW_STATUS = 'UPDATE_ROW_STATUS';
// END OF SCOPED ACTIONS

// INDICATOR ACTIONS
Expand Down
13 changes: 13 additions & 0 deletions src/reducers/windowHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,19 @@ export default function windowHandler(state = initialState, action) {
}
}
})

case types.UPDATE_ROW_STATUS:
return update(state, {
[action.scope]: {
rowData: {
[action.tabid]: {
[action.rowid]: {
saveStatus: {$set: action.saveStatus}
}
}
}
}
})

case types.UPDATE_DATA_SUCCESS:
return Object.assign({}, state, {
Expand Down

0 comments on commit 4f89ec4

Please sign in to comment.