diff --git a/__build_prod.bat b/__build_prod.bat
new file mode 100644
index 0000000..cd7555e
--- /dev/null
+++ b/__build_prod.bat
@@ -0,0 +1,3 @@
+SET REACT_APP_API_URL=https://api-tasks.ubg.ua
+
+yarn build
\ No newline at end of file
diff --git a/src/components/PermissionsField/components/Item/index.jsx b/src/components/PermissionsField/components/Item/index.jsx
index 890c8d4..70aa341 100644
--- a/src/components/PermissionsField/components/Item/index.jsx
+++ b/src/components/PermissionsField/components/Item/index.jsx
@@ -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 {
}
render() {
- let {value, users, factories} = this.props;
+ let {value, users, factories, profile} = this.props;
return (
@@ -64,7 +49,7 @@ class Item extends Component {
>
Підприємство
Користувачі
- Сторінки
+ {profile.role == 'admin' && Сторінки}
@@ -90,4 +75,13 @@ Item.propTypes = {
}
-export default Item
\ No newline at end of file
+
+const mapStateToProps = (state, ownProps) => ({
+ profile: state.auth.profile,
+})
+
+const mapDispatchToProps = {
+
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(Item)
\ No newline at end of file
diff --git a/src/containers/App/App.jsx b/src/containers/App/App.jsx
index 70e9955..d721e68 100644
--- a/src/containers/App/App.jsx
+++ b/src/containers/App/App.jsx
@@ -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");
}
- 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;
+ // }
+
}
diff --git a/src/containers/Factory/components/FormFactory/index.jsx b/src/containers/Factory/components/FormFactory/index.jsx
index 506b8a5..4f569a1 100644
--- a/src/containers/Factory/components/FormFactory/index.jsx
+++ b/src/containers/Factory/components/FormFactory/index.jsx
@@ -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 {
component={TreeSelectField}
placeholder="Батьківська категорія"
label="Батьківська категорія"
- tree={genTree(_.cloneDeep(factory))}
+ tree={genTree(_.cloneDeep(factory), undefined, undefined, 'parent_factory')}
/>
({
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,
})
diff --git a/src/containers/Factory/components/TreeFactory/index.jsx b/src/containers/Factory/components/TreeFactory/index.jsx
index 0c4ab2f..c6c4433 100644
--- a/src/containers/Factory/components/TreeFactory/index.jsx
+++ b/src/containers/Factory/components/TreeFactory/index.jsx
@@ -26,6 +26,8 @@ class TreeFactory extends Component {
let {profile} = this.props;
return {
+
+ console.log("TreeFactory -> renderTitle -> item", item)
this.props.setItemFactory(item);
this.props.showModal(true);
}}>
diff --git a/src/containers/Layout/sidebar/filter_task/index.jsx b/src/containers/Layout/sidebar/filter_task/index.jsx
index 92b4d04..1dd6e26 100644
--- a/src/containers/Layout/sidebar/filter_task/index.jsx
+++ b/src/containers/Layout/sidebar/filter_task/index.jsx
@@ -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 &&
-1 &&
-
- {mode == "vertical" ? ' Добавити в білий список' : null}
+
+ {mode == "vertical" ? ' Додати у білий список' : null}
: null}
diff --git a/src/containers/Profile/components/Actions/index.jsx b/src/containers/Profile/components/Actions/index.jsx
index b4ad427..dfe89bf 100644
--- a/src/containers/Profile/components/Actions/index.jsx
+++ b/src/containers/Profile/components/Actions/index.jsx
@@ -27,17 +27,17 @@ class Actions extends Component {
{/* {profile.id == login_profile.id &&
Ваш IP: {(login_profile.ip || '').replace('::ffff:', '')}
} */}
- }
diff --git a/src/containers/Task/components/PrintComponent/components/Item/index.jsx b/src/containers/Task/components/PrintComponent/components/Item/index.jsx
index 21ad866..1fe7ceb 100644
--- a/src/containers/Task/components/PrintComponent/components/Item/index.jsx
+++ b/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 type = task.type;
- let base = task.base || '-';
+ let base = task.base || '';
users.forEach(user => {
if(user.id == task.user_created){
diff --git a/src/containers/Taxonomy/components/Data/index.jsx b/src/containers/Taxonomy/components/Data/index.jsx
index f3f68fd..55b7a3a 100644
--- a/src/containers/Taxonomy/components/Data/index.jsx
+++ b/src/containers/Taxonomy/components/Data/index.jsx
@@ -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);
}
diff --git a/src/containers/Taxonomy/components/Form/index.jsx b/src/containers/Taxonomy/components/Form/index.jsx
index e7e80c6..8dca682 100644
--- a/src/containers/Taxonomy/components/Form/index.jsx
+++ b/src/containers/Taxonomy/components/Form/index.jsx
@@ -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 {
{type == 'task' ?
{this.setState({image: file})}}
image={taxonomyItem.icon}
diff --git a/src/containers/Taxonomy/components/TreeTaxonomy/index.jsx b/src/containers/Taxonomy/components/TreeTaxonomy/index.jsx
index c0a9ca8..8b68eec 100644
--- a/src/containers/Taxonomy/components/TreeTaxonomy/index.jsx
+++ b/src/containers/Taxonomy/components/TreeTaxonomy/index.jsx
@@ -19,6 +19,7 @@ class TreeTaxonomy extends Component {
let {profile} = this.props;
return {
+
if(getPermissionCheck('taxonomy', 'update', profile)){
this.props.setItemTaxonomy(item);
this.props.showModal(true);
diff --git a/src/containers/Taxonomy/index.jsx b/src/containers/Taxonomy/index.jsx
index 09e2a42..0d76d1e 100644
--- a/src/containers/Taxonomy/index.jsx
+++ b/src/containers/Taxonomy/index.jsx
@@ -58,9 +58,11 @@ class Taxonomy extends Component {
this.props.showModal(true);
}}> Створити
- : null}
+ : null}
+ {
+ this.props.match.params.type == 'reasons_task' ? :
+ }
{/* */}
-
diff --git a/src/containers/User/components/Contexmenu/index.jsx b/src/containers/User/components/Contexmenu/index.jsx
index a859ced..8729a48 100644
--- a/src/containers/User/components/Contexmenu/index.jsx
+++ b/src/containers/User/components/Contexmenu/index.jsx
@@ -222,7 +222,7 @@ class Contexmenu extends Component {
{getPermissionCheck('user', 'ban', profile) && selectedUserIds.length == 1 ?
-
- {user.is_ban ? : }{mode == "vertical" ? user.is_ban ? ' Розблокувати' : ' Заблокувати' : null}
+ {user.is_ban ? : }{mode == "vertical" ? user.is_ban ? ' Розблокувати' : ' Заблокувати' : null}
: null}
@@ -238,7 +238,7 @@ class Contexmenu extends Component {
{getPermissionCheck('user', 'ban', profile) && selectedUserIds.length > 1 && is_unblocked_only_user ?
-
- {mode == "vertical" ? ' Заблокувати' : null}
+ {mode == "vertical" ? ' Заблокувати' : null}
: null}