Skip to content

Commit fc08b0e

Browse files
author
Jovert Lota Palonpon
committed
wip
1 parent 7a2f56c commit fc08b0e

File tree

13 files changed

+75292
-195
lines changed

13 files changed

+75292
-195
lines changed

public/assets.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"js/backoffice.js": "js/backoffice.bundle.55554000828c6880bf25.js",
3-
"js/vendor.js": "js/vendor.bundle.86f41802dd6246f92186.js"
2+
"js/backoffice.js": "js/backoffice.bundle.641bb19e1c6de2294267.js",
3+
"js/vendor.js": "js/vendor.bundle.60bab7ed0c4b898e6cd4.js"
44
}

public/js/backoffice.bundle.55554000828c6880bf25.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/js/backoffice.bundle.641bb19e1c6de2294267.js

Lines changed: 857 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/vendor.bundle.60bab7ed0c4b898e6cd4.js

Lines changed: 74270 additions & 0 deletions
Large diffs are not rendered by default.

public/js/vendor.bundle.86f41802dd6246f92186.js

Lines changed: 0 additions & 134 deletions
This file was deleted.

resources/js/views/__backoffice/layouts/Master.js

Lines changed: 76 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
withStyles,
1111
} from '@material-ui/core';
1212

13+
import { Snackbar, Modal } from '../../../ui';
1314
import { Header, Sidebar } from '../partials';
1415

1516
class Master extends Component {
@@ -49,7 +50,15 @@ class Master extends Component {
4950
};
5051

5152
render() {
52-
const { classes, children, history, location, loading } = this.props;
53+
const {
54+
classes,
55+
children,
56+
history,
57+
location,
58+
loading,
59+
message,
60+
alert,
61+
} = this.props;
5362

5463
const { mobileOpen } = this.state;
5564

@@ -67,62 +76,73 @@ class Master extends Component {
6776
);
6877

6978
return (
70-
<div className={classes.root}>
71-
<CssBaseline />
72-
73-
<nav className={classes.drawer}>
74-
<Hidden smUp implementation="js">
75-
<Sidebar
76-
PaperProps={{ style: { width: drawerWidth } }}
77-
variant="temporary"
78-
open={mobileOpen}
79-
onClose={this.handleDrawerToggled}
80-
locationPathname={location.pathname}
81-
navigate={path => history.push(path)}
79+
<>
80+
<div className={classes.root}>
81+
<CssBaseline />
82+
83+
<nav className={classes.drawer}>
84+
<Hidden smUp implementation="js">
85+
<Sidebar
86+
PaperProps={{ style: { width: drawerWidth } }}
87+
variant="temporary"
88+
open={mobileOpen}
89+
onClose={this.handleDrawerToggled}
90+
locationPathname={location.pathname}
91+
navigate={path => history.push(path)}
92+
/>
93+
</Hidden>
94+
95+
<Hidden xsDown implementation="css">
96+
<Sidebar
97+
PaperProps={{ style: { width: drawerWidth } }}
98+
locationPathname={location.pathname}
99+
navigate={path => history.push(path)}
100+
/>
101+
</Hidden>
102+
</nav>
103+
104+
<div className={classes.contentWrapper}>
105+
<Header
106+
parentProps={{
107+
...this.props,
108+
...this.state,
109+
onDrawerToggle: this.handleDrawerToggled,
110+
onNavLinkMenuToggle: this
111+
.handleNavLinkMenuToggled,
112+
}}
82113
/>
83-
</Hidden>
84114

85-
<Hidden xsDown implementation="css">
86-
<Sidebar
87-
PaperProps={{ style: { width: drawerWidth } }}
88-
locationPathname={location.pathname}
89-
navigate={path => history.push(path)}
90-
/>
91-
</Hidden>
92-
</nav>
93-
94-
<div className={classes.contentWrapper}>
95-
<Header
96-
parentProps={{
97-
...this.props,
98-
...this.state,
99-
onDrawerToggle: this.handleDrawerToggled,
100-
onNavLinkMenuToggle: this.handleNavLinkMenuToggled,
101-
}}
102-
/>
103-
104-
<main className={classes.content}>
105-
{loading ? (
106-
renderLoading
107-
) : (
108-
<Grid container>{children}</Grid>
109-
)}
110-
</main>
111-
112-
<footer className={classes.footer}>
113-
<p>
114-
{Lang.get('navigation.citation')}{' '}
115-
<Link
116-
href="https://github.com/palonponjovertlota"
117-
target="_blank"
118-
rel="noreferrer"
119-
>
120-
@palonponjovertlota
121-
</Link>
122-
</p>
123-
</footer>
115+
<main className={classes.content}>
116+
{loading ? (
117+
renderLoading
118+
) : (
119+
<Grid container>{children}</Grid>
120+
)}
121+
</main>
122+
123+
<footer className={classes.footer}>
124+
<p>
125+
{Lang.get('navigation.citation')}{' '}
126+
<Link
127+
href="https://github.com/palonponjovertlota"
128+
target="_blank"
129+
rel="noreferrer"
130+
>
131+
@palonponjovertlota
132+
</Link>
133+
</p>
134+
</footer>
135+
</div>
124136
</div>
125-
</div>
137+
138+
{message && message.hasOwnProperty('type') > 0 && (
139+
<Snackbar {...message} />
140+
)}
141+
142+
{alert && alert.hasOwnProperty('type') > 0 && (
143+
<Modal {...alert} />
144+
)}
145+
</>
126146
);
127147
}
128148
}
@@ -131,6 +151,8 @@ Master.propTypes = {
131151
classes: PropTypes.object.isRequired,
132152
pageProps: PropTypes.object.isRequired,
133153
pageTitle: PropTypes.string.isRequired,
154+
message: PropTypes.object,
155+
alert: PropTypes.object,
134156
primaryAction: PropTypes.object,
135157
tabs: PropTypes.array,
136158
};

resources/js/views/__backoffice/users/List.js

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,45 @@ class List extends Component {
1818
type: 'asc',
1919
},
2020
filters: {},
21-
message: null,
21+
selectedResources: [],
22+
activeResource: 0,
23+
message: {},
24+
alert: {},
2225
};
2326

27+
/**
28+
* Event listener that is triggered when a resource delete button is clicked.
29+
* This should prompt for confirmation.
30+
*
31+
* @param {string} resource
32+
*
33+
* @return {undefined}
34+
*/
35+
handleDeleteClick = resource => {
36+
this.setState({
37+
alert: {
38+
type: 'confirmation',
39+
title: Lang.get('resources.delete_confirmation_title', {
40+
name: 'User',
41+
}),
42+
body: Lang.get('resources.delete_confirmation_body', {
43+
name: 'User',
44+
}),
45+
confirmText: Lang.get('resources.continue'),
46+
confirmed: () => alert('Deleting User:' + resource),
47+
cancelled: () => this.setState({ alert: {} }),
48+
},
49+
});
50+
};
51+
52+
/**
53+
* Event listener that is triggered when a filter is removed.
54+
* This should re-fetch the resource & also update the queryString.
55+
*
56+
* @param {string} key
57+
*
58+
* @return {undefined}
59+
*/
2460
handleFilterRemove = async key => {
2561
const { filters: prevFilters } = this.state;
2662

@@ -194,10 +230,11 @@ class List extends Component {
194230
this.setState({
195231
loading: false,
196232
message: {
233+
type: 'error',
197234
body: 'Error fetching users!',
235+
closed: () => this.setState({ message: {} }),
198236
actionText: 'Retry',
199237
action: async () => await this.fetchUsers(),
200-
close: () => this.setState({ message: null }),
201238
},
202239
});
203240
}
@@ -225,7 +262,15 @@ class List extends Component {
225262
}
226263

227264
render() {
228-
const { loading, pagination, sorting, filters, message } = this.state;
265+
const {
266+
loading,
267+
pagination,
268+
sorting,
269+
filters,
270+
message,
271+
alert,
272+
} = this.state;
273+
229274
const {
230275
data: rawData,
231276
total,
@@ -283,7 +328,12 @@ class List extends Component {
283328
name: 'User',
284329
})}
285330
>
286-
<IconButton color="secondary">
331+
<IconButton
332+
color="secondary"
333+
onClick={() =>
334+
this.handleDeleteClick(user.id)
335+
}
336+
>
287337
<DeleteIcon />
288338
</IconButton>
289339
</Tooltip>
@@ -300,6 +350,7 @@ class List extends Component {
300350
tabs={tabs}
301351
loading={loading}
302352
message={message}
353+
alert={alert}
303354
>
304355
{!loading && data && (
305356
<Table

resources/js/views/auth/SignIn.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ class SignIn extends Component {
266266
id="username"
267267
name="username"
268268
label="Username"
269+
placeholder="jovert123"
269270
value={values.username}
270271
onChange={handleChange}
271272
variant="outlined"
@@ -307,6 +308,7 @@ class SignIn extends Component {
307308
id="password"
308309
name="password"
309310
label="Password"
311+
placeholder="secret"
310312
value={values.password}
311313
onChange={handleChange}
312314
variant="outlined"

resources/lang/en/navigation.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
'forgot_email' => 'Forgot Email?',
1818
'forgot_password' => 'Forgot Password?',
1919
'next' => 'Next',
20+
'previous' => 'Previous',
2021
'password_request_title' => 'Account Recovery',
2122
'password_request_subtitle' => "Enter your email and we'll send a recovery link",
2223
'signin' => 'Sign in instead',

resources/lang/en/resources.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,11 @@
1515
'show' => 'View :name',
1616
'edit' => 'Edit :name',
1717
'delete' => 'Delete :name',
18+
19+
'confirm' => 'Confirm',
20+
'cancel' => 'Cancel',
21+
'continue' => 'Continue',
22+
23+
'delete_confirmation_title' => 'You are deleting a :name',
24+
'delete_confirmation_body' => "If not undone, the :name won't be recovered anymore.",
1825
];

0 commit comments

Comments
 (0)