@@ -56,7 +56,7 @@ import {
5656import pjson from '../../package.json' ;
5757import { store } from '../store' ;
5858
59- const useStyles = makeStyles ( ( theme ) => ( {
59+ const useStyles = makeStyles ( theme => ( {
6060 list : {
6161 width : 250 ,
6262 } ,
@@ -91,33 +91,21 @@ const App = styled(AppBar)({
9191 margin : '0 0 20px 0' ,
9292} ) ;
9393
94- const AppItem = ( {
95- address, label, icon, subtitle,
96- } ) => (
94+ const AppItem = ( { address, label, icon, subtitle } ) => (
9795 < ListItem button component = { Link } to = { address } >
9896 < ListItemIcon > { icon } </ ListItemIcon >
99- < ListItemText
100- primary = { label }
101- secondary = { subtitle }
102- />
97+ < ListItemText primary = { label } secondary = { subtitle } />
10398 </ ListItem >
10499) ;
105100
106- const AppItemAction = ( {
107- label, action, icon, subtitle,
108- } ) => (
101+ const AppItemAction = ( { label, action, icon, subtitle } ) => (
109102 < ListItem button onClick = { action } >
110103 < ListItemIcon > { icon } </ ListItemIcon >
111- < ListItemText
112- primary = { label }
113- secondary = { subtitle }
114- />
104+ < ListItemText primary = { label } secondary = { subtitle } />
115105 </ ListItem >
116106) ;
117107
118- function Menu ( {
119- title, values, dispatch, history,
120- } ) {
108+ function Menu ( { title, values, dispatch, history } ) {
121109 const classes = useStyles ( ) ;
122110 const [ state , setState ] = React . useState ( {
123111 top : false ,
@@ -126,10 +114,10 @@ function Menu({
126114 right : false ,
127115 } ) ;
128116
129- const toggleDrawer = ( side , open ) => ( event ) => {
117+ const toggleDrawer = ( side , open ) => event => {
130118 if (
131- event . type === 'keydown'
132- && ( event . key === 'Tab' || event . key === 'Shift' )
119+ event . type === 'keydown' &&
120+ ( event . key === 'Tab' || event . key === 'Shift' )
133121 ) {
134122 return ;
135123 }
@@ -156,6 +144,15 @@ function Menu({
156144 await dispatch ( destroy ( 'infoReduxForm' ) ) ;
157145 await store . dispatch ( change ( 'infoReduxForm' , 'login' , true ) ) ;
158146 await store . dispatch ( change ( 'infoReduxForm' , 'sync_date' , sync_date ) ) ;
147+ await store . dispatch ( change ( 'infoReduxForm' , 'payment_type' , false ) ) ;
148+ await store . dispatch ( change ( 'infoReduxForm' , 'contrato' , 'nao' ) ) ;
149+ await store . dispatch (
150+ change (
151+ 'infoReduxForm' ,
152+ 'data_pc' ,
153+ new Date ( ) . toISOString ( ) . substring ( 0 , 10 ) ,
154+ ) ,
155+ ) ;
159156 await store . dispatch ( ProductCreators . resetProduct ( ) ) ;
160157 await store . dispatch ( PaymentCreators . resetPayment ( ) ) ;
161158 await store . dispatch ( SelectCreators . resetSelect ( ) ) ;
@@ -189,7 +186,15 @@ function Menu({
189186 handleClose ( ) ;
190187 }
191188
192- const sideList = ( side ) => (
189+ async function UpdateServiceWorker ( ) {
190+ handleOpen ( ) ;
191+ await navigator . serviceWorker . register ( '/sw.js' ) . then ( reg => {
192+ reg . update ( ) ;
193+ } ) ;
194+ handleClose ( ) ;
195+ }
196+
197+ const sideList = side => (
193198 < div
194199 className = { classes . list }
195200 role = "presentation"
@@ -248,7 +253,7 @@ function Menu({
248253 < Divider />
249254 < List >
250255 < AppItemAction
251- label = "Sincronizar Dados "
256+ label = "Sincronizar Dados"
252257 subtitle = { dataAtualFormatada (
253258 values === undefined ? null : values . sync_date ,
254259 ) }
@@ -262,9 +267,10 @@ function Menu({
262267 />
263268 < AppItemAction label = "Sair" icon = { < ExitToAppIcon /> } action = { logout } />
264269 </ List >
265- < AppItem
270+ < AppItemAction
266271 icon = { < SettingsApplicationsIcon /> }
267272 subtitle = { `v${ pjson . version } ` }
273+ action = { UpdateServiceWorker }
268274 address = { ( ) => { } }
269275 />
270276 </ div >
@@ -325,7 +331,7 @@ function Menu({
325331 ) ;
326332}
327333
328- const mapStateToProps = ( state ) => ( {
334+ const mapStateToProps = state => ( {
329335 values : getFormValues ( 'infoReduxForm' ) ( state ) ,
330336} ) ;
331337
0 commit comments