mobtest

by amindunited

HTML

<script type="text/x-handlebars" data-template-name="application">
    <h1>Application</h1>
    {{outlet}}
</script>

<script type="text/x-handlebars" data-template-name="payslip">
    {{input type='text' value=firstName placeholder='First Name'}}
    {{input type='text' value=lastName placeholder='Last Name'}}
    {{input type='text' value=salary placeholder='salary'}}
    {{input type='text' value=super placeholder='super'}}
    {{input type='text' value=startDate placeholder='startDate'}}
    
    {{#if hasSelectedEmployee}}
        {{myob-employee-payslip}}
    {{/if}}
</script>

<script type="text/x-handlebars" data-template-name="components/myob-employee-payslip">
    <table>
        <thead>
            <tr>
                <th>name</th>
                <th>pay period</th>
                <th>gross income</th>
                <th>income tax</th>
                <th>net income</th>
                <th>super</th>
            </tr>
        </thead>
    </table>
</script>

<!-- SOF src -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/pouchdb/3.2.0/pouchdb.min.js"></script>
<script src="https://rawgit.com/nolanlawson/relational-pouch/master/dist/pouchdb.relational-pouch.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ember.js/1.9.0-beta.4/ember.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.0.0-beta.12/ember-data.min.js"></script>
<script src="https://rawgit.com/nolanlawson/ember-pouch/master/dist/globals/main.js"></script>
<!-- EOF src -->

JavaScript

var App = Em.Application.create();

App.Employee = Em.Object.extend({
    firstName:'',
    lastName: '',
    salary: '',
    super:'',
    startDate: ''
});


App.Router.map(function() {
    this.resource('payslip');
});

App.IndexRoute = Ember.Route.extend({
    beforeModel: function() {
        this.transitionTo('payslip');
    }
});

App.PayslipRoute = Em.Route.extend({});

App.PayslipController = Em.Controller.extend({
    hasSelectedEmployee: false,
    allFields: function(){
        if ( this.get('firstName') && 
        this.get('lastName') &&
        this.get('salary') &&
        this.get('super') &&
        this.get('startDate')) {
            return true;
        }
    }.property('firstName', 'lastName', 'salary', 'super', 'startDate'),
    createPayslip: function(){
        
    }.observes('firstName', 'lastName', 'salary', 'super', 'startDate')
});


App.PayslipView = Em.View.extend({
    didInsertElement: function(){
        console.log("didInsert");
    }
});