Add country select to customer in admin
							parent
							
								
									3092726cd5
								
							
						
					
					
						commit
						77c9cecaeb
					
				|  | @ -14,6 +14,12 @@ const mkdirp = require('mkdirp'); | |||
| const ObjectId = require('mongodb').ObjectID; | ||||
| const countryList = require('countries-list'); | ||||
| 
 | ||||
| // Parse country list once
 | ||||
| const countryArray = []; | ||||
| Object.keys(countryList.countries).forEach((country) => { | ||||
|     countryArray.push(countryList.countries[country].name); | ||||
| }); | ||||
| 
 | ||||
| // Allowed mime types for product images
 | ||||
| const allowedMimeType = [ | ||||
|     'image/jpeg', | ||||
|  | @ -564,10 +570,6 @@ const hooker = (order) => { | |||
| }; | ||||
| 
 | ||||
| const getCountryList = () => { | ||||
|     const countryArray = []; | ||||
|     Object.keys(countryList.countries).forEach((country) => { | ||||
|         countryArray.push(countryList.countries[country].name); | ||||
|     }); | ||||
|     return countryArray; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -170,5 +170,6 @@ | |||
| 	"Information": "Information", | ||||
| 	"Shipping options": "Shipping options", | ||||
| 	"Proceed to payment": "Proceed to payment", | ||||
| 	"Return to information": "Return to information" | ||||
| 	"Return to information": "Return to information", | ||||
| 	"Search shop": "Search shop" | ||||
| } | ||||
|  | @ -221,6 +221,7 @@ router.get('/admin/customer/view/:id?', restrict, async (req, res) => { | |||
|         session: req.session, | ||||
|         message: common.clearSessionValue(req.session, 'message'), | ||||
|         messageType: common.clearSessionValue(req.session, 'messageType'), | ||||
|         countryList: common.getCountryList(), | ||||
|         config: req.app.config, | ||||
|         editor: true, | ||||
|         helpers: req.handlebars.helpers | ||||
|  |  | |||
|  | @ -44,7 +44,12 @@ | |||
|             <div class="col-sm-10"> | ||||
|                 <div class="form-group"> | ||||
|                 <label class="control-label">{{ @root.__ "Country" }} *</label> | ||||
|                     <input type="text" class="form-control" name="country" id="country" value={{result.country}} required> | ||||
|                     <select class="form-control" id="country" name="country" required> | ||||
|                         <option value="" disabled selected>Select Country</option> | ||||
|                         {{#each countryList}} | ||||
|                         <option {{selectState this @root.result.country}} value="{{this}}">{{this}}</option> | ||||
|                         {{/each}} | ||||
|                     </select> | ||||
|                 </div> | ||||
|             </div> | ||||
|             <div class="col-sm-5"> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue