@@ -38,12 +38,14 @@ const {
38
38
39
39
/* ui */
40
40
const { confirm } = Modal ;
41
- const nameSpan = { xxl : 5 , xl : 5 , lg : 5 , md : 5 , sm : 16 , xs : 14 } ;
42
- const abbreviationSpan = { xxl : 3 , xl : 3 , lg : 3 , md : 3 , sm : 4 , xs : 4 } ;
43
- const descriptionSpan = { xxl : 14 , xl : 14 , lg : 14 , md : 13 , sm : 0 , xs : 0 } ;
41
+ const nameSpan = { xxl : 4 , xl : 4 , lg : 4 , md : 4 , sm : 16 , xs : 14 } ;
42
+ const abbreviationSpan = { xxl : 4 , xl : 4 , lg : 4 , md : 4 , sm : 4 , xs : 4 } ;
43
+ const symbolSpan = { xxl : 4 , xl : 3 , lg : 4 , md : 4 , sm : 0 , xs : 0 } ;
44
+ const descriptionSpan = { xxl : 10 , xl : 10 , lg : 10 , md : 8 , sm : 0 , xs : 0 } ;
44
45
const headerLayout = [
45
46
{ ...nameSpan , header : 'Name' , title : 'Unit Name' } ,
46
47
{ ...abbreviationSpan , header : 'Abbreviation' , title : 'Unit Abbreviation' } ,
48
+ { ...symbolSpan , header : 'Symbol' , title : 'Unit Symbol' } ,
47
49
{
48
50
...descriptionSpan ,
49
51
header : 'Description' ,
@@ -115,44 +117,6 @@ class UnitList extends Component {
115
117
getUnits ( ) ;
116
118
}
117
119
118
- /**
119
- * @function handleFormOpen
120
- * @name handleFormOpen
121
- * @description Handle form opening
122
- *
123
- * @version 0.1.0
124
- * @since 0.1.0
125
- */
126
- handleFormOpen = ( ) => {
127
- openUnitForm ( ) ;
128
- } ;
129
-
130
- /**
131
- * @function handleFormClose
132
- * @name handleFormClose
133
- * @description Handle form closing
134
- *
135
- * @version 0.1.0
136
- * @since 0.1.0
137
- */
138
- handleFormClose = ( ) => {
139
- closeUnitForm ( ) ;
140
- this . setState ( { isEditForm : false } ) ;
141
- } ;
142
-
143
- /**
144
- * @function handleFormClose
145
- * @name handleFormClose
146
- * @description Handle post form close and perform cleanups
147
- *
148
- * @version 0.1.0
149
- * @since 0.1.0
150
- */
151
- handleAfterFormClose = ( ) => {
152
- selectUnit ( null ) ;
153
- this . setState ( { isEditForm : false } ) ;
154
- } ;
155
-
156
120
/**
157
121
* @function handleListSearch
158
122
* @name handleListSearch
@@ -211,6 +175,44 @@ class UnitList extends Component {
211
175
} ) ;
212
176
} ;
213
177
178
+ /**
179
+ * @function handleFormOpen
180
+ * @name handleFormOpen
181
+ * @description Handle form opening
182
+ *
183
+ * @version 0.1.0
184
+ * @since 0.1.0
185
+ */
186
+ handleFormOpen = ( ) => {
187
+ openUnitForm ( ) ;
188
+ } ;
189
+
190
+ /**
191
+ * @function handleFormClose
192
+ * @name handleFormClose
193
+ * @description Handle form closing
194
+ *
195
+ * @version 0.1.0
196
+ * @since 0.1.0
197
+ */
198
+ handleFormClose = ( ) => {
199
+ closeUnitForm ( ) ;
200
+ this . setState ( { isEditForm : false } ) ;
201
+ } ;
202
+
203
+ /**
204
+ * @function handleFormClose
205
+ * @name handleFormClose
206
+ * @description Handle post form close and perform cleanups
207
+ *
208
+ * @version 0.1.0
209
+ * @since 0.1.0
210
+ */
211
+ handleAfterFormClose = ( ) => {
212
+ selectUnit ( null ) ;
213
+ this . setState ( { isEditForm : false } ) ;
214
+ } ;
215
+
214
216
/**
215
217
* @function handleItemEdit
216
218
* @name handleItemEdit
@@ -226,16 +228,14 @@ class UnitList extends Component {
226
228
} ;
227
229
228
230
/**
229
- * @function
230
- * @name showArchiveConfirm
231
- * @description show confirm modal before archiving a unit
232
- *
231
+ * @function handleItemArchive
232
+ * @name handleItemArchive
233
+ * @description Handle list item archiving with confirmation
233
234
* @param {object } item List item
234
235
* @version 0.1.0
235
236
* @since 0.1.0
236
237
*/
237
-
238
- showArchiveConfirm = ( item ) => {
238
+ handleItemArchive = ( item ) => {
239
239
const itemId = get ( item , '_id' ) ;
240
240
const itemName = get ( item , 'strings.name.en' , 'N/A' ) ;
241
241
confirm ( {
@@ -388,7 +388,7 @@ class UnitList extends Component {
388
388
archive = { {
389
389
name : 'Archive Unit' ,
390
390
title : 'Remove unit from list of active units' ,
391
- onClick : ( ) => this . showArchiveConfirm ( item ) ,
391
+ onClick : ( ) => this . handleItemArchive ( item ) ,
392
392
} }
393
393
/>
394
394
) }
@@ -398,6 +398,7 @@ class UnitList extends Component {
398
398
< Col { ...abbreviationSpan } >
399
399
{ get ( item , 'strings.abbreviation.en' , 'N/A' ) }
400
400
</ Col >
401
+ < Col { ...symbolSpan } > { get ( item , 'strings.symbol' , 'N/A' ) } </ Col >
401
402
< Col { ...descriptionSpan } >
402
403
< span title = { get ( item , 'strings.description.en' , 'N/A' ) } >
403
404
{ truncateString (
@@ -464,15 +465,15 @@ class UnitList extends Component {
464
465
}
465
466
466
467
UnitList . propTypes = {
467
- loading : PropTypes . bool . isRequired ,
468
468
units : PropTypes . arrayOf ( PropTypes . shape ( { name : PropTypes . string } ) )
469
469
. isRequired ,
470
- unit : PropTypes . shape ( { name : PropTypes . string } ) ,
471
- page : PropTypes . number . isRequired ,
472
- searchQuery : PropTypes . string ,
473
- total : PropTypes . number . isRequired ,
470
+ loading : PropTypes . bool . isRequired ,
474
471
posting : PropTypes . bool . isRequired ,
472
+ searchQuery : PropTypes . string ,
475
473
showForm : PropTypes . bool . isRequired ,
474
+ page : PropTypes . number . isRequired ,
475
+ total : PropTypes . number . isRequired ,
476
+ unit : PropTypes . shape ( { name : PropTypes . string } ) ,
476
477
} ;
477
478
478
479
UnitList . defaultProps = {
@@ -482,11 +483,11 @@ UnitList.defaultProps = {
482
483
483
484
export default Connect ( UnitList , {
484
485
units : 'units.list' ,
485
- unit : 'units.selected' ,
486
486
loading : 'units.loading' ,
487
487
posting : 'units.posting' ,
488
- page : 'units.page ' ,
488
+ searchQuery : 'units.q ' ,
489
489
showForm : 'units.showForm' ,
490
+ page : 'units.page' ,
490
491
total : 'units.total' ,
491
- searchQuery : 'units.q ' ,
492
+ unit : 'units.selected ' ,
492
493
} ) ;
0 commit comments