Hello All,
My purpose is to build a singular UI plugin for a commercial purpose.
This is a simple bill manager. (with its display later)
1/ My datas description is like this :
_product:{
name:"",
price:0,
quantity:0,
taxId:"0"
},
_taxRow:{
name:"notax",
rate:1
},
_footer:{},
_defaults:function(){
return {
bill: {
taxRows:{"0":this._taxRow},
header:{
billID:"0",
billDate:Date()
},
rows:{'0':this._product},
footer:this._footer
}
}
}
2/ Purposes :
- Data defaults must not be changed by the user developper. (So I set this in a undescored function)
- Three methods are built and are exposed :
- sum_tax(taxid) //Taxid is optionnal
- sum_net()
- sum_full()
- display() method will be written later
All of that runs as well :
1/ var billRows={
'2154F':{'name':"fork model 54",'price':25,'quantity':10,taxId:"1"},
'4678K':{'name':"knife model 78",'price':36,'quantity':10,taxId:"2"}
}; //Plugin parameter declaratives
2/ billX=$("#bill").bill({bill:{rows:billRows}}); // instantiate plugin
Ok from here but now :
I should write :billX.bill("sum_tax",1) or billX.bill("sum_tax")
I would prefered to write like this
billX.bill.sum_tax(1) or billX.bill.sum_tax()
Is it possible ?
Thanks