| .. | .. |
|---|
| 11 | 11 | var resources = { |
|---|
| 12 | 12 | application : $resource('/application/:appId', { |
|---|
| 13 | 13 | appId : '@id' |
|---|
| 14 | | - }, { |
|---|
| 15 | | - update : { |
|---|
| 16 | | - method : "PUT" |
|---|
| 17 | | - } |
|---|
| 18 | 14 | }), |
|---|
| 19 | 15 | user : $resource('/user/:userId', { |
|---|
| 20 | | - userId : '@id' |
|---|
| 21 | | - }, { |
|---|
| 22 | | - update : { |
|---|
| 23 | | - method : "PUT" |
|---|
| 24 | | - } |
|---|
| 16 | + userId : '@username' |
|---|
| 17 | + }), |
|---|
| 18 | + organization : $resource('/organization/:orgId', { |
|---|
| 19 | + orgId : '@id' |
|---|
| 25 | 20 | }), |
|---|
| 26 | 21 | licensetype : $resource('/licensetype/:licenseTypeId', { |
|---|
| 27 | 22 | licenseTypeId : '@id' |
|---|
| 28 | | - }, { |
|---|
| 29 | | - update : { |
|---|
| 30 | | - method : "PUT" |
|---|
| 31 | | - } |
|---|
| 32 | 23 | }) |
|---|
| 33 | 24 | } |
|---|
| 34 | 25 | |
|---|
| .. | .. |
|---|
| 96 | 87 | this.getFFF = this.getFirstFocusableField = function() { |
|---|
| 97 | 88 | if (!_current) throw new Error('There is no current catalog selected'); |
|---|
| 98 | 89 | |
|---|
| 99 | | - for(var i = i; i < _current.fields.length; i++) |
|---|
| 100 | | - if (f.readOnly) return f.name; |
|---|
| 90 | + for(var i = 0; i < _current.fields.length; i++) |
|---|
| 91 | + if (!_current.fields[i].readOnly) return _current.fields[i].name; |
|---|
| 101 | 92 | |
|---|
| 102 | 93 | return null; |
|---|
| 103 | 94 | } |
|---|
| .. | .. |
|---|
| 135 | 126 | if (!_current) throw new Error('There is no current catalog selected'); |
|---|
| 136 | 127 | |
|---|
| 137 | 128 | var resource = this.getResource(); |
|---|
| 138 | | - if (data.id && data.id !== '') |
|---|
| 139 | | - return resource.update(data, _success, _fail); |
|---|
| 140 | | - else |
|---|
| 141 | | - return resource.save(data, _success, _fail); |
|---|
| 129 | + return resource.save(data, _success, _fail); |
|---|
| 142 | 130 | } |
|---|
| 143 | 131 | this.remove = function(data) { |
|---|
| 144 | 132 | return this.getResource().remove({}, data, _success, _fail) |
|---|
| .. | .. |
|---|
| 165 | 153 | console.log('promises: ' + promises.length + ' ') |
|---|
| 166 | 154 | console.log(promises) |
|---|
| 167 | 155 | $q.all(promises).then(function() { |
|---|
| 168 | | - console.log('ALL promises OK :::::::::::::::::::::::::::: ') |
|---|
| 169 | 156 | for (var k in refs) { |
|---|
| 170 | | - var pk = that.getPk(that.getMetadata(k)) |
|---|
| 171 | | - console.log('PK for '+k+' is ' + pk); |
|---|
| 157 | + var pk = that.getPk(that.getMetadata(that.getField(k).resource)) |
|---|
| 158 | + console.log('PK field for ' + k + ' is ' + pk) |
|---|
| 172 | 159 | var comboData = [] |
|---|
| 173 | 160 | refs[k].forEach(function(row) { |
|---|
| 174 | 161 | comboData.push({ |
|---|
| 175 | 162 | id: row[pk], |
|---|
| 176 | | - label: row.label || row.name || row.code |
|---|
| 163 | + label: row.label || row.name || row.code || row.first_name + ' ' + row.last_name |
|---|
| 177 | 164 | }); |
|---|
| 178 | 165 | }) |
|---|
| 179 | 166 | refs[k] = comboData; |
|---|
| 167 | + console.log('Ready for combo for ' + k) |
|---|
| 168 | + console.log(comboData); |
|---|
| 180 | 169 | } |
|---|
| 181 | 170 | |
|---|
| 182 | 171 | }) |
|---|