mirror of
https://github.com/yldio/copilot.git
synced 2024-11-14 07:10:05 +02:00
implimenting assinging status update to team memember
This commit is contained in:
parent
4d94830d30
commit
8b0e745bea
@ -12,6 +12,7 @@ const PeopleTable = (props) => {
|
|||||||
handleRoleTooltip,
|
handleRoleTooltip,
|
||||||
handleRoleUpdate,
|
handleRoleUpdate,
|
||||||
handleStatusTooltip,
|
handleStatusTooltip,
|
||||||
|
handleStatusUpdate,
|
||||||
people = [],
|
people = [],
|
||||||
orgUI = {},
|
orgUI = {},
|
||||||
orgIndex
|
orgIndex
|
||||||
@ -38,7 +39,9 @@ const PeopleTable = (props) => {
|
|||||||
const status = (person) => (
|
const status = (person) => (
|
||||||
<PersonStatus
|
<PersonStatus
|
||||||
handleStatusTooltip={handleStatusTooltip}
|
handleStatusTooltip={handleStatusTooltip}
|
||||||
|
handleStatusUpdate={handleStatusUpdate}
|
||||||
membersStatusOptions={orgUI.members_status}
|
membersStatusOptions={orgUI.members_status}
|
||||||
|
orgIndex={orgIndex}
|
||||||
person={person}
|
person={person}
|
||||||
personIndex={index}
|
personIndex={index}
|
||||||
toggledID={orgUI.member_status_tooltip}
|
toggledID={orgUI.member_status_tooltip}
|
||||||
@ -78,6 +81,7 @@ PeopleTable.propTypes = {
|
|||||||
handleRoleTooltip: React.PropTypes.func,
|
handleRoleTooltip: React.PropTypes.func,
|
||||||
handleRoleUpdate: React.PropTypes.func,
|
handleRoleUpdate: React.PropTypes.func,
|
||||||
handleStatusTooltip: React.PropTypes.func,
|
handleStatusTooltip: React.PropTypes.func,
|
||||||
|
handleStatusUpdate: React.PropTypes.func,
|
||||||
orgIndex: React.PropTypes.number,
|
orgIndex: React.PropTypes.number,
|
||||||
orgUI: React.PropTypes.object,
|
orgUI: React.PropTypes.object,
|
||||||
people: React.PropTypes.array,
|
people: React.PropTypes.array,
|
||||||
|
@ -81,6 +81,7 @@ const PersonRole = (props) => {
|
|||||||
options={membersRolesOptions}
|
options={membersRolesOptions}
|
||||||
orgIndex={orgIndex}
|
orgIndex={orgIndex}
|
||||||
person={_person}
|
person={_person}
|
||||||
|
personAttr="role"
|
||||||
personIndex={personIndex}
|
personIndex={personIndex}
|
||||||
/>
|
/>
|
||||||
: null }
|
: null }
|
||||||
|
@ -49,14 +49,26 @@ const PlainButton = styled.button`
|
|||||||
const PersonStatus = (props) => {
|
const PersonStatus = (props) => {
|
||||||
|
|
||||||
const {
|
const {
|
||||||
handleStatusTooltip,
|
|
||||||
toggledID,
|
toggledID,
|
||||||
membersStatusOptions,
|
membersStatusOptions,
|
||||||
person,
|
person,
|
||||||
|
personIndex,
|
||||||
|
handleStatusTooltip,
|
||||||
|
handleStatusUpdate,
|
||||||
|
orgIndex
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const toggled = toggledID;
|
const toggled = toggledID;
|
||||||
const handleClick = () => handleStatusTooltip(person.uuid);
|
const handleClick = () => handleStatusTooltip(person.uuid);
|
||||||
|
const handleOptionSelect = (updatedMember) =>
|
||||||
|
handleStatusUpdate(updatedMember);
|
||||||
|
|
||||||
|
// Only send relevent info as props
|
||||||
|
const _person = {
|
||||||
|
uuid: person.uuid,
|
||||||
|
status: person.status,
|
||||||
|
role: person.role
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledWrapper toggled={toggled}>
|
<StyledWrapper toggled={toggled}>
|
||||||
@ -65,7 +77,14 @@ const PersonStatus = (props) => {
|
|||||||
</PlainButton>
|
</PlainButton>
|
||||||
|
|
||||||
{ toggledID === person.uuid
|
{ toggledID === person.uuid
|
||||||
? <Tooltip options={membersStatusOptions} person={person} />
|
? <Tooltip
|
||||||
|
handleSelect={handleOptionSelect}
|
||||||
|
options={membersStatusOptions}
|
||||||
|
orgIndex={orgIndex}
|
||||||
|
person={_person}
|
||||||
|
personAttr="status"
|
||||||
|
personIndex={personIndex}
|
||||||
|
/>
|
||||||
: null }
|
: null }
|
||||||
</StyledWrapper>
|
</StyledWrapper>
|
||||||
);
|
);
|
||||||
@ -73,8 +92,11 @@ const PersonStatus = (props) => {
|
|||||||
|
|
||||||
PersonStatus.propTypes = {
|
PersonStatus.propTypes = {
|
||||||
handleStatusTooltip: React.PropTypes.func,
|
handleStatusTooltip: React.PropTypes.func,
|
||||||
|
handleStatusUpdate: React.PropTypes.func,
|
||||||
membersStatusOptions: React.PropTypes.array,
|
membersStatusOptions: React.PropTypes.array,
|
||||||
|
orgIndex: React.PropTypes.number,
|
||||||
person: React.PropTypes.object,
|
person: React.PropTypes.object,
|
||||||
|
personIndex: React.PropTypes.number,
|
||||||
toggledID: React.PropTypes.oneOfType([
|
toggledID: React.PropTypes.oneOfType([
|
||||||
React.PropTypes.string,
|
React.PropTypes.string,
|
||||||
React.PropTypes.bool,
|
React.PropTypes.bool,
|
||||||
|
@ -16,6 +16,7 @@ const arrowPosition = {
|
|||||||
module.exports = ({
|
module.exports = ({
|
||||||
handleSelect,
|
handleSelect,
|
||||||
person = {},
|
person = {},
|
||||||
|
personAttr,
|
||||||
personIndex,
|
personIndex,
|
||||||
options = [],
|
options = [],
|
||||||
orgIndex,
|
orgIndex,
|
||||||
@ -27,7 +28,8 @@ module.exports = ({
|
|||||||
person: {
|
person: {
|
||||||
uuid: person.uuid,
|
uuid: person.uuid,
|
||||||
status: person.status,
|
status: person.status,
|
||||||
role: option
|
role: person.role,
|
||||||
|
[`${personAttr}`]: option
|
||||||
},
|
},
|
||||||
personIndex,
|
personIndex,
|
||||||
orgIndex,
|
orgIndex,
|
||||||
@ -63,5 +65,6 @@ module.exports.propTypes = {
|
|||||||
options: React.PropTypes.array,
|
options: React.PropTypes.array,
|
||||||
orgIndex: React.PropTypes.number,
|
orgIndex: React.PropTypes.number,
|
||||||
person: React.PropTypes.object,
|
person: React.PropTypes.object,
|
||||||
|
personAttr: React.PropTypes.string,
|
||||||
personIndex: React.PropTypes.number,
|
personIndex: React.PropTypes.number,
|
||||||
};
|
};
|
@ -20,7 +20,8 @@ const {
|
|||||||
handleInviteToggle,
|
handleInviteToggle,
|
||||||
handlePeopleRoleTooltip,
|
handlePeopleRoleTooltip,
|
||||||
handlePeopleStatusTooltip,
|
handlePeopleStatusTooltip,
|
||||||
handleRoleUpdate
|
handleRoleUpdate,
|
||||||
|
handleStatusUpdate,
|
||||||
} = actions;
|
} = actions;
|
||||||
|
|
||||||
const People = (props) => {
|
const People = (props) => {
|
||||||
@ -47,6 +48,8 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
handleRoleTooltip: (id) => dispatch(handlePeopleRoleTooltip(id)),
|
handleRoleTooltip: (id) => dispatch(handlePeopleRoleTooltip(id)),
|
||||||
handleRoleUpdate: (updatedMember) =>
|
handleRoleUpdate: (updatedMember) =>
|
||||||
dispatch(handleRoleUpdate(updatedMember)),
|
dispatch(handleRoleUpdate(updatedMember)),
|
||||||
|
handleStatusUpdate: (updatedMember) =>
|
||||||
|
dispatch(handleStatusUpdate(updatedMember)),
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = connect(
|
module.exports = connect(
|
||||||
|
@ -22,5 +22,6 @@ module.exports = {
|
|||||||
createAction(`${APP}/HANDLE_PERSON_STATUS_TOOLTIP`),
|
createAction(`${APP}/HANDLE_PERSON_STATUS_TOOLTIP`),
|
||||||
handlePeopleRoleTooltip:
|
handlePeopleRoleTooltip:
|
||||||
createAction(`${APP}/HANDLE_PERSON_ROLE_TOOLTIP`),
|
createAction(`${APP}/HANDLE_PERSON_ROLE_TOOLTIP`),
|
||||||
handleRoleUpdate: createAction(`${APP}/HANDLE_PERSON_ROLE_UPDATE`),
|
handleMemberUpdate: createAction(`${APP}/HANDLE_PERSON_ROLE_UPDATE`),
|
||||||
|
handleStatusUpdate: createAction(`${APP}/HANDLE_PERSON_STATUS_UPDATE`),
|
||||||
};
|
};
|
||||||
|
@ -10,7 +10,8 @@ const {
|
|||||||
handleInviteToggle,
|
handleInviteToggle,
|
||||||
handlePeopleRoleTooltip,
|
handlePeopleRoleTooltip,
|
||||||
handlePeopleStatusTooltip,
|
handlePeopleStatusTooltip,
|
||||||
handleRoleUpdate
|
handleRoleUpdate,
|
||||||
|
handleStatusUpdate,
|
||||||
} = actions;
|
} = actions;
|
||||||
|
|
||||||
module.exports = handleActions({
|
module.exports = handleActions({
|
||||||
@ -75,5 +76,35 @@ module.exports = handleActions({
|
|||||||
...state.data.slice(orgIndex + 1),
|
...state.data.slice(orgIndex + 1),
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
[handleStatusUpdate.toString()]: (state, action) => {
|
||||||
|
const {
|
||||||
|
orgIndex,
|
||||||
|
person,
|
||||||
|
personIndex,
|
||||||
|
} = action.payload;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
ui: {
|
||||||
|
...state.ui,
|
||||||
|
member_status_tooltip: false,
|
||||||
|
member_role_tooltip: false
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
...state.data.slice(0, orgIndex),
|
||||||
|
{
|
||||||
|
...state.data[orgIndex],
|
||||||
|
members: [
|
||||||
|
...state.data[orgIndex].members.slice(0, personIndex),
|
||||||
|
{
|
||||||
|
...person,
|
||||||
|
},
|
||||||
|
...state.data[orgIndex].members.slice(personIndex + 1)
|
||||||
|
]
|
||||||
|
},
|
||||||
|
...state.data.slice(orgIndex + 1),
|
||||||
|
]
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}, {});
|
}, {});
|
||||||
|
Loading…
Reference in New Issue
Block a user