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. 4
      src/containers/Taxonomy/index.jsx
  14. 4
      src/containers/User/components/Contexmenu/index.jsx

3
__build_prod.bat

@ -0,0 +1,3 @@ @@ -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' @@ -3,28 +3,13 @@ import PropTypes from 'prop-types'
import { Select } from 'antd';
import SubType from './components/SubType';
import Actions from './components/Actions';
import { connect } from 'react-redux'
class Item extends Component {
constructor(props) {
super(props)
}
componentWillMount() {
}
componentDidMount() {
}
componentWillReceiveProps(nextProps) {
}
componentWillUnmount() {
}
onChange = (name, value_item) => {
let {index, values, value, onChange} = this.props;
if(index == 'new'){
@ -45,7 +30,7 @@ class Item extends Component { @@ -45,7 +30,7 @@ class Item extends Component {
}
render() {
let {value, users, factories} = this.props;
let {value, users, factories, profile} = this.props;
return (
<div className='field-group-permission item'>
@ -64,7 +49,7 @@ class Item extends Component { @@ -64,7 +49,7 @@ class Item extends Component {
>
<Select.Option value={'factory'}>Підприємство</Select.Option>
<Select.Option value={'user'}>Користувачі</Select.Option>
<Select.Option value={'tabs'}>Сторінки</Select.Option>
{profile.role == 'admin' && <Select.Option value={'tabs'}>Сторінки</Select.Option>}
</Select>
</div>
<SubType {...this.props} onChange={this.onChange}/>
@ -90,4 +75,13 @@ Item.propTypes = { @@ -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"; @@ -16,13 +16,41 @@ import { messaging } from "../../init-fcm";
const registerPushListener = pushNotification =>
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");
}
// 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);
}
}
if(data && data.firebaseMessaging && data.firebaseMessaging.payload && data.firebaseMessaging.payload.notification){
return pushNotification(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 { @@ -19,23 +19,6 @@ class FormFactory extends Component {
}
componentWillMount() {
}
componentDidMount() {
}
componentWillReceiveProps(nextProps) {
}
componentWillUnmount() {
}
submit = (values) => {
if(values.id){
this.props.updateFactory(values.id, values);
@ -68,7 +51,7 @@ class FormFactory extends Component { @@ -68,7 +51,7 @@ class FormFactory extends Component {
component={TreeSelectField}
placeholder="Батьківська категорія"
label="Батьківська категорія"
tree={genTree(_.cloneDeep(factory))}
tree={genTree(_.cloneDeep(factory), undefined, undefined, 'parent_factory')}
/>
<Field
name='director'
@ -96,13 +79,21 @@ FormFactory = reduxForm({ @@ -96,13 +79,21 @@ FormFactory = reduxForm({
{name: 'name', 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);
const mapStateToProps = (state, ownProps) => ({
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,
})

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

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

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

@ -105,7 +105,7 @@ class FilterTask extends Component { @@ -105,7 +105,7 @@ class FilterTask extends Component {
return user_permissions.hasOwnProperty(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'
component={TreeSelectField}
label="Підприємство"

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

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

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

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

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

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

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

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

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

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

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

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

4
src/containers/Taxonomy/index.jsx

@ -59,8 +59,10 @@ class Taxonomy extends Component { @@ -59,8 +59,10 @@ class Taxonomy extends Component {
}}><i className="fal fa-book"></i> Створити</Button>
</div>
</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}/> */}
<TreeTaxonomy type={this.props.match.params.type}/>
</CardBody>
</Card>
</Col>

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

@ -222,7 +222,7 @@ class Contexmenu extends Component { @@ -222,7 +222,7 @@ class Contexmenu extends Component {
{getPermissionCheck('user', 'ban', profile) && selectedUserIds.length == 1 ?
<Item key='ban'>
<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>
</Item>
: null}
@ -238,7 +238,7 @@ class Contexmenu extends Component { @@ -238,7 +238,7 @@ class Contexmenu extends Component {
{getPermissionCheck('user', 'ban', profile) && selectedUserIds.length > 1 && is_unblocked_only_user ?
<Item key='ban_all'>
<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>
</Item>
: null}

Loading…
Cancel
Save