Comments (2)
- Make a link between employee and user
select entity employee
add field SalesRep related to user using login
- In Customer route, execute a promise to select employee ID for current user ; something like...
var promises = [];
promises.push(new Promise(function(resolve, reject){
var query = "SELECT id AS employee_id"
+ " FROM 1_e_employee"
+ " WHERE fk_id_user_employee=" + req.session.passport.user.id;
models.sequelize.query(query, {type: models.sequelize.QueryTypes.SELECT}).then(function (result) {
if(result[0].employee_id === null) employee_id = "";
resolve({employee_id: result});
});
}));
Promise.all(promises).then(function (results) {
for (var i = 0; i < results.length; i++)
for (var prop in results[i])
data[prop] = results[i][prop];
data.toastr = req.session.toastr;
req.session.toastr = [];
res.render('e_employee/create_form', data);
});
- Send data to page and set value of SalesRep with ID you have retrieved
<input name="f_salesrep" value="{employee_id}" />
from newmips.
Ok, Let me ask the question with a different wording:
I have an entity Assuance
with a field Contact
referring to an other entity. Naturally, the Contact
depends on the login user.
How much would it cost to teach Mipsy to write the code mentioned in the part 2 of your solution ?
Naturally, this cost will probably include the analysis and public discussion required to make the solution sufficiently generic to be worth to include in the OpenSource code.
from newmips.
Related Issues (20)
- Default value for related to field HOT 1
- Format for Numeric fields in list HOT 1
- Menu logout not visible enough HOT 2
- Filter references lists HOT 2
- How to know the mother entity of a existing Sub-entity HOT 4
- How to jump to the mother entity of a sub-entity HOT 2
- Bug: Boolean/Checkbox does not work HOT 1
- Bug: Iwas able to create two projects with the same name. HOT 1
- Undo on the studio HOT 2
- locales for ID HOT 6
- list fields
- field for %
- Nombre d'éléments à afficher HOT 4
- Default language HOT 2
- installation : Port mysql HOT 10
- Linux centric (=non windows) command in last release HOT 4
- Bug : List field HOT 1
- Défaut dans la sécurité HOT 5
- Bug: Import thème css HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from newmips.