|
@@ -1,5 +1,6 @@
|
|
|
const _ = require('lodash')
|
|
const _ = require('lodash')
|
|
|
const app = require('../../app')
|
|
const app = require('../../app')
|
|
|
|
|
+const { dollarIcon } = require('../../assets')
|
|
|
/**
|
|
/**
|
|
|
* @param {CrudPagesOptions} opts
|
|
* @param {CrudPagesOptions} opts
|
|
|
*/
|
|
*/
|
|
@@ -33,9 +34,19 @@ const details = (opts) => {
|
|
|
</md-input-container>
|
|
</md-input-container>
|
|
|
`
|
|
`
|
|
|
|
|
|
|
|
|
|
+ const currencyInput = column => html`
|
|
|
|
|
+ <md-input-container flex>
|
|
|
|
|
+ <label>${column.titleName}</label>
|
|
|
|
|
+ <input type="number" step="0.01" ng-model="model.${raw(column.camelName)}" />
|
|
|
|
|
+ <md-icon md-svg-src="${dollarIcon}"></md-icon>
|
|
|
|
|
+ </md-input-container>
|
|
|
|
|
+ `
|
|
|
|
|
+
|
|
|
const defaultField = column =>
|
|
const defaultField = column =>
|
|
|
column.type === 'autocomplete'
|
|
column.type === 'autocomplete'
|
|
|
? autocompleteInput(column)
|
|
? autocompleteInput(column)
|
|
|
|
|
+ : column.type === 'currency'
|
|
|
|
|
+ ? currencyInput(column)
|
|
|
: standardInput(column)
|
|
: standardInput(column)
|
|
|
|
|
|
|
|
const layout = () => {
|
|
const layout = () => {
|
|
@@ -116,7 +127,7 @@ const details = (opts) => {
|
|
|
$location.url(opts.appPrefix)
|
|
$location.url(opts.appPrefix)
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
console.error(err)
|
|
console.error(err)
|
|
|
- $mdToast.showSimple(`Could not save ${opts.titleName}: ${err.message || err}`)
|
|
|
|
|
|
|
+ $mdToast.showSimple(`Could not save ${opts.titleName}: ${err.message || err.statusText || err}`)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|