Browse Source

fixes 16.06

old_master
Listat.an 4 years ago
parent
commit
29a9e22fee
  1. 3
      __build_prod.bat
  2. 32
      src/components/PermissionsField/components/Item/index.jsx
  3. 38
      src/containers/App/App.jsx
  4. 31
      src/containers/Factory/components/FormFactory/index.jsx
  5. 2
      src/containers/Factory/components/TreeFactory/index.jsx
  6. 2
      src/containers/Layout/sidebar/filter_task/index.jsx
  7. 4
      src/containers/Logs/components/Contexmenu/index.jsx
  8. 8
      src/containers/Profile/components/Actions/index.jsx
  9. 2
      src/containers/Task/components/PrintComponent/components/Item/index.jsx
  10. 2
      src/containers/Taxonomy/components/Data/index.jsx
  11. 16
      src/containers/Taxonomy/components/Form/index.jsx
  12. 1
      src/containers/Taxonomy/components/TreeTaxonomy/index.jsx
  13. 6
      src/containers/Taxonomy/index.jsx
  14. 4
      src/containers/User/components/Contexmenu/index.jsx

3
__build_prod.bat

@ -0,0 +1,3 @@
SET REACT_APP_API_URL=https://api-tasks.ubg.ua
yarn build

32
src/components/PermissionsField/components/Item/index.jsx

@ -3,28 +3,13 @@ import PropTypes from 'prop-types'
import { Select } from 'antd'; import { Select } from 'antd';
import SubType from './components/SubType'; import SubType from './components/SubType';
import Actions from './components/Actions'; import Actions from './components/Actions';
import { connect } from 'react-redux'
class Item extends Component { class Item extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
} }
componentWillMount() {
}
componentDidMount() {
}
componentWillReceiveProps(nextProps) {
}
componentWillUnmount() {
}
onChange = (name, value_item) => { onChange = (name, value_item) => {
let {index, values, value, onChange} = this.props; let {index, values, value, onChange} = this.props;
if(index == 'new'){ if(index == 'new'){
@ -45,7 +30,7 @@ class Item extends Component {
} }
render() { render() {
let {value, users, factories} = this.props; let {value, users, factories, profile} = this.props;
return ( return (
<div className='field-group-permission item'> <div className='field-group-permission item'>
@ -64,7 +49,7 @@ class Item extends Component {
> >
<Select.Option value={'factory'}>Підприємство</Select.Option> <Select.Option value={'factory'}>Підприємство</Select.Option>
<Select.Option value={'user'}>Користувачі</Select.Option> <Select.Option value={'user'}>Користувачі</Select.Option>
<Select.Option value={'tabs'}>Сторінки</Select.Option> {profile.role == 'admin' && <Select.Option value={'tabs'}>Сторінки</Select.Option>}
</Select> </Select>
</div> </div>
<SubType {...this.props} onChange={this.onChange}/> <SubType {...this.props} onChange={this.onChange}/>
@ -90,4 +75,13 @@ Item.propTypes = {
} }
export default Item
const mapStateToProps = (state, ownProps) => ({
profile: state.auth.profile,
})
const mapDispatchToProps = {
}
export default connect(mapStateToProps, mapDispatchToProps)(Item)

38
src/containers/App/App.jsx

@ -16,13 +16,41 @@ import { messaging } from "../../init-fcm";
const registerPushListener = pushNotification => const registerPushListener = pushNotification =>
navigator.serviceWorker.addEventListener("message", ({data}) =>{ navigator.serviceWorker.addEventListener("message", ({data}) =>{
console.log("data", data)
if(!pushNotification){
return; // Let's check if the browser supports notifications
if (!("Notification" in window)) {
console.log("This browser does not support desktop notification");
} }
if(data && data.firebaseMessaging && data.firebaseMessaging.payload && data.firebaseMessaging.payload.notification){
return pushNotification(data.firebaseMessaging.payload.notification.body) // Let's check whether notification permissions have alredy been granted
else if (Notification.permission === "granted") {
// If it's okay let's create a notification
if(data && data.firebaseMessaging && data.firebaseMessaging.payload && data.firebaseMessaging.payload.notification){
// return pushNotification(data.firebaseMessaging.payload.notification.body);
var notification = new Notification(data.firebaseMessaging.payload.notification.body);
}
} }
// Otherwise, we need to ask the user for permission
else if (Notification.permission !== 'denied' || Notification.permission === "default") {
Notification.requestPermission(function (permission) {
// If the user accepts, let's create a notification
if (permission === "granted") {
if(data && data.firebaseMessaging && data.firebaseMessaging.payload && data.firebaseMessaging.payload.notification){
// return pushNotification(data.firebaseMessaging.payload.notification.body);
var notification = new Notification(data.firebaseMessaging.payload.notification.body);
}
}
});
}
// console.log("data", data)
// if(!pushNotification){
// return;
// }
} }

31
src/containers/Factory/components/FormFactory/index.jsx

@ -19,23 +19,6 @@ class FormFactory extends Component {
} }
componentWillMount() {
}
componentDidMount() {
}
componentWillReceiveProps(nextProps) {
}
componentWillUnmount() {
}
submit = (values) => { submit = (values) => {
if(values.id){ if(values.id){
this.props.updateFactory(values.id, values); this.props.updateFactory(values.id, values);
@ -68,7 +51,7 @@ class FormFactory extends Component {
component={TreeSelectField} component={TreeSelectField}
placeholder="Батьківська категорія" placeholder="Батьківська категорія"
label="Батьківська категорія" label="Батьківська категорія"
tree={genTree(_.cloneDeep(factory))} tree={genTree(_.cloneDeep(factory), undefined, undefined, 'parent_factory')}
/> />
<Field <Field
name='director' name='director'
@ -96,13 +79,21 @@ FormFactory = reduxForm({
{name: 'name', rules: [{name: 'required', message: 'Заповнити обовязково'}]}, {name: 'name', rules: [{name: 'required', message: 'Заповнити обовязково'}]},
// {name: 'password', rules: [{name: 'required', message: 'Заповнити обовязково'}]}, // {name: 'password', rules: [{name: 'required', message: 'Заповнити обовязково'}]},
] ]
return validationFields(fields, values)
let error = validationFields(fields, values);
if(values.id == values.parent_factory && values.parent_factory){
error.parent_factory = 'Невірна батьківська категорія'
}
return error;
} }
})(FormFactory); })(FormFactory);
const mapStateToProps = (state, ownProps) => ({ const mapStateToProps = (state, ownProps) => ({
factory: state.factory.data, factory: state.factory.data,
initialValues: Object.assign({}, state.factory.item_factory, {parent_factory: state.factory.active_factory}) , initialValues: Object.assign({}, state.factory.item_factory) ,
users: state.factory.users, users: state.factory.users,
}) })

2
src/containers/Factory/components/TreeFactory/index.jsx

@ -26,6 +26,8 @@ class TreeFactory extends Component {
let {profile} = this.props; let {profile} = this.props;
return <div className="tree-title" onDoubleClick={() => { return <div className="tree-title" onDoubleClick={() => {
console.log("TreeFactory -> renderTitle -> item", item)
this.props.setItemFactory(item); this.props.setItemFactory(item);
this.props.showModal(true); this.props.showModal(true);
}}> }}>

2
src/containers/Layout/sidebar/filter_task/index.jsx

@ -105,7 +105,7 @@ class FilterTask extends Component {
return user_permissions.hasOwnProperty(user.id); return user_permissions.hasOwnProperty(user.id);
}).map(user => ({title: user.name, value: user.id}))} }).map(user => ({title: user.name, value: user.id}))}
/> />
{[].indexOf(profile.id) > -1 && <Field {[92,134, 90, 348, 95, 4, 20, 21, 22].indexOf(profile.id) > -1 && <Field
name='factory' name='factory'
component={TreeSelectField} component={TreeSelectField}
label="Підприємство" label="Підприємство"

4
src/containers/Logs/components/Contexmenu/index.jsx

@ -244,8 +244,8 @@ class Contexmenu extends Component {
{getPermissionCheck('user', 'update', profile) && selectedUserIds.length == 1 && !is_white_ip ? {getPermissionCheck('user', 'update', profile) && selectedUserIds.length == 1 && !is_white_ip ?
<Item key='white_ip'> <Item key='white_ip'>
<Tooltip placement="bottom" title={mode != "vertical" ? ' Добавити в білий список' : null}> <Tooltip placement="bottom" title={mode != "vertical" ? ' Додати у білий список' : null}>
<i className="fal fa-lock-open-alt"></i>{mode == "vertical" ? ' Добавити в білий список' : null} <i className="fal fa-lock-open-alt"></i>{mode == "vertical" ? ' Додати у білий список' : null}
</Tooltip> </Tooltip>
</Item> </Item>
: null} : null}

8
src/containers/Profile/components/Actions/index.jsx

@ -27,17 +27,17 @@ class Actions extends Component {
{/* {profile.id == login_profile.id && <div> {/* {profile.id == login_profile.id && <div>
Ваш IP: <strong>{(login_profile.ip || '').replace('::ffff:', '')}</strong> Ваш IP: <strong>{(login_profile.ip || '').replace('::ffff:', '')}</strong>
</div>} */} </div>} */}
<Button color={profile.is_ban ? "success" : "danger"} onClick={() => { {getPermissionCheck('user', 'ban', login_profile) && <Button color={profile.is_ban ? "success" : "danger"} onClick={() => {
this.props.updateUser(profile.id, {is_ban: !profile.is_ban}); this.props.updateUser(profile.id, {is_ban: !profile.is_ban});
if(!profile.is_ban){ if(!profile.is_ban){
this.props.logoutUser(profile.id); this.props.logoutUser(profile.id);
} }
}} className="icon profile__btn" }} className="icon profile__btn"
title={!profile.is_ban ? 'Заблокувати користувача' : 'Розблокувати користувача'} title={!profile.is_ban ? 'Заблокувати користувача' : 'Розблокувати користувача'}
>{!profile.is_ban ? 'Заблокувати' : 'Розблокувати'}</Button> >{!profile.is_ban ? 'Заблокувати' : 'Розблокувати'}</Button>}
<Button color={"danger"} onClick={() => { {getPermissionCheck('user', 'logout', login_profile) && <Button color={"danger"} onClick={() => {
this.props.logoutUser(profile.id); this.props.logoutUser(profile.id);
}} className="icon profile__btn" title="Розлогінити на всіх пристроях">Розлогінити</Button> }} className="icon profile__btn" title="Розлогінити на всіх пристроях">Розлогінити</Button>}
</CardBody> </CardBody>
</Card> </Card>
</Col> </Col>

2
src/containers/Task/components/PrintComponent/components/Item/index.jsx

@ -33,7 +33,7 @@ class Item extends Component {
let user_done = {}, user_created = {}, user_iniciator = {}; let user_done = {}, user_created = {}, user_iniciator = {};
let type = task.type; let type = task.type;
let base = task.base || '-'; let base = task.base || '';
users.forEach(user => { users.forEach(user => {
if(user.id == task.user_created){ if(user.id == task.user_created){

2
src/containers/Taxonomy/components/Data/index.jsx

@ -134,6 +134,8 @@ class Data extends Component {
onDoubleClick: (event) => { onDoubleClick: (event) => {
// history.push('/profile/' + record.id) // history.push('/profile/' + record.id)
if(getPermissionCheck('taxonomy', 'update', profile)){ if(getPermissionCheck('taxonomy', 'update', profile)){
console.log("Data -> render -> record", record)
this.props.setItemTaxonomy(record); this.props.setItemTaxonomy(record);
this.props.showModal(true); this.props.showModal(true);
} }

16
src/containers/Taxonomy/components/Form/index.jsx

@ -24,22 +24,7 @@ class FormPermissions extends Component {
} }
} }
componentWillMount() {
}
componentDidMount() {
}
componentWillReceiveProps(nextProps) {
}
componentWillUnmount() {
}
submit = (values) => { submit = (values) => {
if(values.id){ if(values.id){
@ -65,6 +50,7 @@ class FormPermissions extends Component {
{type == 'task' ? <div style={{position: 'relative'}}> {type == 'task' ? <div style={{position: 'relative'}}>
<ImageField <ImageField
defaultImg="/img/group_icon.png" defaultImg="/img/group_icon.png"
validModal
label='Аватар' label='Аватар'
onChange={(file) => {this.setState({image: file})}} onChange={(file) => {this.setState({image: file})}}
image={taxonomyItem.icon} image={taxonomyItem.icon}

1
src/containers/Taxonomy/components/TreeTaxonomy/index.jsx

@ -19,6 +19,7 @@ class TreeTaxonomy extends Component {
let {profile} = this.props; let {profile} = this.props;
return <div className="tree-title" onDoubleClick={() => { return <div className="tree-title" onDoubleClick={() => {
if(getPermissionCheck('taxonomy', 'update', profile)){ if(getPermissionCheck('taxonomy', 'update', profile)){
this.props.setItemTaxonomy(item); this.props.setItemTaxonomy(item);
this.props.showModal(true); this.props.showModal(true);

6
src/containers/Taxonomy/index.jsx

@ -58,9 +58,11 @@ class Taxonomy extends Component {
this.props.showModal(true); this.props.showModal(true);
}}><i className="fal fa-book"></i> Створити</Button> }}><i className="fal fa-book"></i> Створити</Button>
</div> </div>
</Row> : null} </Row> : null}
{
this.props.match.params.type == 'reasons_task' ? <Data type={this.props.match.params.type}/> : <TreeTaxonomy type={this.props.match.params.type}/>
}
{/* <Data type={this.props.match.params.type}/> */} {/* <Data type={this.props.match.params.type}/> */}
<TreeTaxonomy type={this.props.match.params.type}/>
</CardBody> </CardBody>
</Card> </Card>
</Col> </Col>

4
src/containers/User/components/Contexmenu/index.jsx

@ -222,7 +222,7 @@ class Contexmenu extends Component {
{getPermissionCheck('user', 'ban', profile) && selectedUserIds.length == 1 ? {getPermissionCheck('user', 'ban', profile) && selectedUserIds.length == 1 ?
<Item key='ban'> <Item key='ban'>
<Tooltip placement="bottom" title={mode != "vertical" ? user.is_ban ? ' Розблокувати' : ' Заблокувати' : null}> <Tooltip placement="bottom" title={mode != "vertical" ? user.is_ban ? ' Розблокувати' : ' Заблокувати' : null}>
{user.is_ban ? <i className="fal fa-lock-open"></i> : <i className="fal fa-lock"></i>}{mode == "vertical" ? user.is_ban ? ' Розблокувати' : ' Заблокувати' : null} {user.is_ban ? <i className="fal fa-lock-open"></i> : <i className="fal fa-user-lock"></i>}{mode == "vertical" ? user.is_ban ? ' Розблокувати' : ' Заблокувати' : null}
</Tooltip> </Tooltip>
</Item> </Item>
: null} : null}
@ -238,7 +238,7 @@ class Contexmenu extends Component {
{getPermissionCheck('user', 'ban', profile) && selectedUserIds.length > 1 && is_unblocked_only_user ? {getPermissionCheck('user', 'ban', profile) && selectedUserIds.length > 1 && is_unblocked_only_user ?
<Item key='ban_all'> <Item key='ban_all'>
<Tooltip placement="bottom" title={mode != "vertical" ? ' Заблокувати' : null}> <Tooltip placement="bottom" title={mode != "vertical" ? ' Заблокувати' : null}>
<i className="fal fa-lock"></i>{mode == "vertical" ? ' Заблокувати' : null} <i className="fal fa-user-lock"></i>{mode == "vertical" ? ' Заблокувати' : null}
</Tooltip> </Tooltip>
</Item> </Item>
: null} : null}

Loading…
Cancel
Save