@plusscommunities/pluss-maintenance-web 1.1.16-auth.0 → 1.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-maintenance-web",
3
- "version": "1.1.16-auth.0",
3
+ "version": "1.1.16",
4
4
  "description": "Extension package to enable maintenance on Pluss Communities Platform",
5
5
  "main": "dist/index.cjs.js",
6
6
  "scripts": {
@@ -9,9 +9,6 @@
9
9
  "patch": "npm version patch",
10
10
  "betaupload": "npm run build && npm publish --access public --tag beta && rm -rf node_modules",
11
11
  "betaupload:p": "npm run betapatch && npm run betaupload",
12
- "authpatch": "npm version prepatch --preid=auth",
13
- "authupload": "npm run build && npm publish --access public --tag auth && rm -rf node_modules",
14
- "authupload:p": "npm run authpatch && npm run authupload",
15
12
  "upload": "npm run build && npm publish --access public && rm -rf node_modules",
16
13
  "upload:p": "npm run patch && npm run upload"
17
14
  },
@@ -32,23 +29,23 @@
32
29
  "rollup-plugin-styles": "^3.14.1"
33
30
  },
34
31
  "dependencies": {
35
- "@babel/runtime": "^7.14.0",
36
- "@plusscommunities/pluss-core-web": "1.4.34-auth.0",
32
+ "@babel/runtime": "^7.14.0"
33
+ },
34
+ "peerDependencies": {
35
+ "@plusscommunities/pluss-core-web": "^1.4.33",
37
36
  "@fortawesome/fontawesome-svg-core": "^6.4.0",
38
37
  "@fortawesome/free-solid-svg-icons": "^6.4.0",
39
38
  "@fortawesome/react-fontawesome": "^0.2.0",
40
39
  "js-cookie": "^2.2.0",
41
40
  "lodash": "^4.17.4",
42
- "moment": "^2.18.1",
41
+ "moment": "^2.30.1",
43
42
  "react": "^16.14.0",
44
43
  "react-bootstrap": "^0.31.2",
45
44
  "react-dom": "^16.14.0",
46
45
  "react-fontawesome": "^1.6.1",
46
+ "react-redux": "^5.0.6",
47
47
  "react-router-dom": "^4.2.2",
48
48
  "react-textarea-autosize": "^7.1.0-1"
49
49
  },
50
- "peerDependencies": {
51
- "react-redux": "^7.2.9"
52
- },
53
50
  "keywords": []
54
51
  }
@@ -1,5 +1,5 @@
1
- // import * as PlussCore from '../../pluss-core/src';
2
- import * as PlussCore from '@plusscommunities/pluss-core-web';
1
+ import * as PlussCore from '../../pluss-core/src';
2
+ // import * as PlussCore from '@plusscommunities/pluss-core-web';
3
3
 
4
4
  export { PlussCore };
5
5
 
@@ -12,6 +12,7 @@ const { Actions, Components, Helper, Session } = PlussCore;
12
12
  class AddJob extends Component {
13
13
  constructor(props) {
14
14
  super(props);
15
+ this.imageInput = null;
15
16
  this.state = {
16
17
  jobId: Helper.safeReadParams(this.props, 'jobId') ? this.props.match.params.jobId : null,
17
18
  job: null,
@@ -20,6 +21,7 @@ class AddJob extends Component {
20
21
  connected: false,
21
22
  types: [],
22
23
  users: [],
24
+ images: [],
23
25
  userSearch: '',
24
26
  userFilterOpen: false,
25
27
  selectedUser: null,
@@ -65,11 +67,24 @@ class AddJob extends Component {
65
67
  profilePic: userProfilePic,
66
68
  },
67
69
  });
70
+ this.checkSetImages(res.data.images);
68
71
  } catch (error) {
69
72
  console.error('getJob', error);
70
73
  }
71
74
  };
72
75
 
76
+ checkSetImages(images) {
77
+ if (this.imageInput) {
78
+ if (!_.isEmpty(images)) {
79
+ this.imageInput.getWrappedInstance().setValue(images);
80
+ }
81
+ } else {
82
+ setTimeout(() => {
83
+ this.checkSetImage(images);
84
+ }, 100);
85
+ }
86
+ }
87
+
73
88
  getJobTypes = async () => {
74
89
  try {
75
90
  const res = await maintenanceActions.getJobTypes(this.props.auth.site);
@@ -167,7 +182,7 @@ class AddJob extends Component {
167
182
  homeText: this.state.homeText,
168
183
  type: this.state.type,
169
184
  date: null,
170
- image: this.state.image,
185
+ images: this.state.images,
171
186
  };
172
187
 
173
188
  if (this.state.id != null) {
@@ -348,6 +363,20 @@ class AddJob extends Component {
348
363
  }}
349
364
  alwaysShowLabel
350
365
  />
366
+ <div className="marginBottom-16">
367
+ <Components.Text type="formLabel" className="marginBottom-4">
368
+ Images
369
+ </Components.Text>
370
+ <Components.ImageInput
371
+ ref={(ref) => {
372
+ this.imageInput = ref;
373
+ }}
374
+ multiple
375
+ refreshCallback={(images) => {
376
+ this.setState({ images });
377
+ }}
378
+ />
379
+ </div>
351
380
  <Components.RadioButton
352
381
  label="Person must be home during work?"
353
382
  isActive={this.state.isHome}
@@ -415,6 +415,7 @@ class Job extends Component {
415
415
  }
416
416
 
417
417
  renderComment(c) {
418
+ return <Components.Comment key={c.Id} comment={c} />;
418
419
  return (
419
420
  <div key={c.Id} className="comment">
420
421
  <p className="comment_text">{Helper.toParagraphed(c.Comment)}</p>
@@ -458,15 +459,40 @@ class Job extends Component {
458
459
  );
459
460
  }
460
461
 
462
+ renderImages() {
463
+ if (_.isEmpty(this.state.job.image) && _.isEmpty(this.state.job.images)) return null;
464
+
465
+ const imagesToUse = _.isEmpty(this.state.job.image) ? this.state.job.images : [this.state.job.image];
466
+ return (
467
+ <div className="padding-60 paddingVertical-40 bottomDivideBorder">
468
+ <Components.Text type="formTitleSmall" className="marginBottom-16">
469
+ Images
470
+ </Components.Text>
471
+ <div className="imageGrid">
472
+ {imagesToUse.map((image, i) => {
473
+ return (
474
+ <a href={image} target="_blank" rel="noopener noreferrer" key={i}>
475
+ <div className="imageGrid_image" style={{ backgroundImage: `url('${Helper.get1400(image)}')` }}></div>
476
+ </a>
477
+ );
478
+ })}
479
+ </div>
480
+ </div>
481
+ );
482
+ }
483
+
461
484
  renderInner() {
462
485
  if (this.state.job == null) return null;
463
486
 
464
487
  return (
465
488
  <div style={{ paddingBottom: 40 }}>
466
489
  <div className="padding-60 paddingVertical-40 bottomDivideBorder relative">
467
- <Components.Text type="formTitleLarge" className="marginBottom-24">
490
+ <Components.Text type="formTitleLarge" className="marginBottom-8">
468
491
  {this.state.job.title || 'Request'}
469
492
  </Components.Text>
493
+ <Components.Text type="formTitleMedium" className="marginBottom-24">
494
+ Job #{this.state.job.jobId}
495
+ </Components.Text>
470
496
  <div className="marginTop-16">
471
497
  <div className={'fieldLabel'}>Request date</div>
472
498
  <div className={'fontRegular fontSize-16 text-dark marginTop-5'}>
@@ -511,25 +537,7 @@ class Job extends Component {
511
537
  </div>
512
538
  )}
513
539
  </div>
514
- {(this.state.job.image || this.state.job.images) && (
515
- <div className="padding-60 paddingVertical-40 bottomDivideBorder">
516
- <Components.Text type="formTitleSmall" className="marginBottom-16">
517
- Image
518
- </Components.Text>
519
- <div
520
- style={{
521
- marginTop: 16,
522
- height: 180,
523
- width: 260,
524
- borderRadius: 4,
525
- border: '1px solid #aaa',
526
- backgroundColor: '#ddd',
527
- backgroundImage: `url(${this.state.job.thumbnail})`,
528
- backgroundPosition: 'center',
529
- }}
530
- />
531
- </div>
532
- )}
540
+ {this.renderImages()}
533
541
  {this.renderCommentSection()}
534
542
  </div>
535
543
  );