UNPKG

kpi-header

Version:

KPI-header plugin for KPI NINJA react UI

2 lines 5.51 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _react=_interopRequireWildcard(require("react")),_reactVerticalTimelineComponent=require("react-vertical-timeline-component"),_reactPerfectScrollbar=_interopRequireDefault(require("react-perfect-scrollbar")),_NotificationService=require("../Services/NotificationService");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _interopRequireWildcard(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};d.get||d.set?Object.defineProperty(b,c,d):b[c]=a[c]}return b["default"]=a,b}function _typeof(a){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}function _possibleConstructorReturn(a,b){return b&&("object"===_typeof(b)||"function"==typeof b)?b:_assertThisInitialized(a)}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&_setPrototypeOf(a,b)}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var ChatExample=/*#__PURE__*/function(a){function b(a){var c;return _classCallCheck(this,b),c=_possibleConstructorReturn(this,_getPrototypeOf(b).call(this,a)),_defineProperty(_assertThisInitialized(c),"notificationAPI",function(a){(0,_NotificationService.notificationAfterLoginEventAPI)(c.props.userApi,a).then(function(a){var b=c.state.notificationList,d=a.data.NotificationList;10>d.length&&c.setState({callMethod:!1}),d=b.concat(d),c.setState({count:c.state.count+10,notificationList:d})})}),_defineProperty(_assertThisInitialized(c),"showMorNotificationEvent",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!c.state.callMethod){a.next=3;break}return a.next=3,c.notificationAPI(c.state.count+10);case 3:case"end":return a.stop();}},a)}))),c.state={// modal: false, notificationList:[],header:"",title:"",time:"",logo:"",cat:"",description:"",attachment:"",notes:"",count:0,counter:1,flag:!1,flag1:!1,notificationId:"",callMethod:!0},c}return _inherits(b,a),_createClass(b,[{key:"componentDidMount",value:function componentDidMount(){var a=this;(0,_NotificationService.notificationAfterLoginEventAPI)(this.props.userApi,this.state.count).then(function(b){a.setState({notificationList:b.data.NotificationList,flag:!0})})}},{key:"render",value:function render(){var a=this;return _react["default"].createElement(_react.Fragment,null,_react["default"].createElement("div",{className:"scroll-area-md",id:"test"},_react["default"].createElement(_reactPerfectScrollbar["default"],{onYReachEnd:function onYReachEnd(){return a.showMorNotificationEvent()}},_react["default"].createElement("div",{className:"p-3"},_react["default"].createElement(_reactVerticalTimelineComponent.VerticalTimeline,{layout:"1-column",className:"vertical-without-time"},this.state.notificationList&&this.state.notificationList.map(function(b){return _react["default"].createElement("div",{onClick:function onClick(){return a.props.openModal(b)}},_react["default"].createElement(_reactVerticalTimelineComponent.VerticalTimelineElement,{style:{cursor:"pointer"},className:"vertical-timeline-item",icon:_react["default"].createElement("i",{className:"badge badge-dot badge-dot-xl badge-primary"}," ")},_react["default"].createElement("h4",{className:"timeline-title"},b.title,"\xA0\xA0",1===parseInt(b.read_status,10)?null:_react["default"].createElement("div",{className:"badge badge-dot badge-dot-sm badge-danger"},"n ")),_react["default"].createElement("p",null,b.category_logo.split(",").map(function(a){return _react["default"].createElement("i",{className:a}," ")})," ",b.created_date)))}))))))}}]),b}(_react.Component);exports["default"]=ChatExample,module.exports=exports.default;