Comments (4)
Hey, thanks for the elaborate explanation.
Can you also add the js code for the addTaskForm template?
from meteor-wizard.
Thanks for your quick reply
This plugin save lots of time, thank you very much.
Javascript
/**
* Created by Sibin Xavier on 2/10/2016.
*/
Meteor.startup(function(){
Wizard.useRouter('kadira:flow-router');
Template.addTaskForm.onCreated(function(){
Schemas.workingFor = new SimpleSchema({
working_for:{
type: String,
label:'Working For'
}
});
Schemas.Quantify = new SimpleSchema({
quantify: {
type: String,
label: 'Quantify'
}
});
Schemas.Achieve = new SimpleSchema({
achieved: {
type: String,
label: 'Achieve'
}
});
Schemas.SlowDown = new SimpleSchema({
slow_down: {
type: String,
label: 'Slow Down'
}
});
Schemas.Resolve = new SimpleSchema({
resolve: {
type: String,
label: 'Resolved'
}
});
Schemas.Tomorrow = new SimpleSchema({
tomorrow:{
type: String,
label:'Tomorrow'
}
});
Tasks.attachSchema([
Schemas.workingFor,
Schemas.quantify,
Schemas.Achieve,
Schemas.SlowDown,
Schemas.Resolve,
Schemas.Tomorrow
]);
});
});
Template.addTaskForm.helpers({
steps: function(){
var todayDate = moment().format('DD/MM/YYYY');
var getLatestOne = Tasks.findOne({
date: todayDate,
user_id: Meteor.userId()
},{
fields : {
working_for: 1,
quantity: 1,
achieved: 1,
resolve: 1,
slow_down: 1,
tomorrow: 1
}
});
return [
{
id:'working_for',
title:'Working On',
schema: Schemas.workingFor,
data: getLatestOne,
formId:'working_for-form',
template: 'wizardWidget',
onSubmit: function(data, wizard){
saveOrUpdateWizard(data,wizard)
wizard.next(data)
}
},
{
id: 'quantify',
title: 'Quantify',
schema: Schemas.Quantify,
data: getLatestOne,
formId:'quantify-form',
template: 'wizardWidget',
onSubmit: function(data,wizard){
saveOrUpdateWizard(data,wizard);
// if time is less than 11:00 AM, then
// redirect to home page, else
// continue
if(moment().hour() > 11){
wizard.next(data)
}else{
wizard.show('quantify')
}
}
},
{
id: 'achieved',
title: 'Achieved',
schema: Schemas.Achieve,
data: getLatestOne,
formId: 'achieved-form',
template: 'wizardWidget',
onSubmit: function(data, wizard){
saveOrUpdateWizard(data,wizard)
wizard.next(data)
}
},
{
id: 'slow_down',
title: 'Slow Down',
schema: Schemas.SlowDown,
data: getLatestOne,
formId:'slow_down-form',
template: 'wizardWidget',
onSubmit: function(data, wizard){
saveOrUpdateWizard(data,wizard)
wizard.next(data)
}
},
{
id: 'resolve',
title: 'Resolve',
schema: Schemas.Resolve,
data: getLatestOne,
formId: 'resolve-form',
template: 'wizardWidget',
onSubmit: function(data, wizard){
saveOrUpdateWizard(data,wizard)
wizard.next(data)
}
},
{
id: 'tomorrow',
title: 'Tomorrow',
schema: Schemas.Tomorrow,
data: getLatestOne,
formId: 'tomorrow-form',
template: 'wizardWidget',
onSubmit: function(data, wizard){
var complete_data =_.extend(wizard.mergedData(),data);
Meteor.call('saveTask',complete_data, Meteor.user(), function(err, result){
if(typeof result!="undefined" && result!=""){
FlowRouter.go('/')
}
})
}
}
]
}
});
saveOrUpdateWizard = function(data, wizard){
var completeData = _.extend(wizard.mergedData(), data)
Meteor.call('saveTask', completeData, Meteor.user(), function(err, result){
if(result){
// result
}
if(err){
console.log(err)
}
})
};
When i set data to each steps it now working ( i'm not sure, sometime it won't work ),
Live Demo : teamreporter.herokuapp.com ( old code without data attribute on each step)
Also i'm very new to meteor, not an expert...
from meteor-wizard.
Did you manage to solve the problem?
from meteor-wizard.
var getLatestOne = Tasks.findOne({
date: todayDate,
user_id: Meteor.userId()
},{
fields : {
working_for: 1,
quantity: 1,
achieved: 1,
resolve: 1,
slow_down: 1,
tomorrow: 1
}
});
return [
{
id:'working_for',
title:'Working On',
schema: Schemas.workingFor,
data: getLatestOne,
formId:'working_for-form',
template: 'wizardWidget',
onSubmit: function(data, wizard){
saveOrUpdateWizard(data,wizard)
wizard.next(data)
}
}]
getLatestOne
getLatestOne = Last filled data ( daily task of user )
I have added data property for each step, now i think it working( lgetLatestOne), it working.
If i add doc = data (same data, in autoform ), I think it only work if we don't do hard refresh or use any new browser ( After filling fields, if i use any other browser or open a tab in private mode, it won't work but it work after i adding data property for each step).
Thanks for your valuable support.
from meteor-wizard.
Related Issues (20)
- i18n not working for buttons HOT 1
- Example of using onSubmit hook? HOT 1
- Doesn't work for more than two (2) steps HOT 1
- ...
- Multi step form: clicking back then next from 2nd step loses 2nd step's data HOT 2
- Route not updated, when opening an invalid step. HOT 1
- How to initial data for update form? HOT 8
- Can't get updated value of "wizard.mergedData()" for previous step when submit update form. HOT 24
- pathForStep helper adds step ID but link doesn't do anything HOT 5
- Iron Router pathFor helper not working as expected when using Wizard route HOT 2
- wizard.mergedData() return {} HOT 7
- wizard is not cleared for new order HOT 1
- values from previous steps HOT 1
- Wizard undefined HOT 1
- Autoform 6 --allow-incompatible-update HOT 5
- Still working? HOT 3
- Setting to remove steps <ol>? HOT 2
- Not working link in docs
- Implement custom steps template
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 meteor-wizard.