invoice-fs
Version:
Nostalgic command-line invoicing application producing plain text invoices and JSON data structures. Uses the file system as a database
35 lines (32 loc) • 1.24 kB
JavaScript
var Customer = require('../lib/customer'),
out = require('../lib/out'),
router = require('route-cli'),
EditFlow = require('../lib/editFlow'),
EditFlowStep = require('../lib/editFlowStep');
module.exports = function(command, extraArguments, flags) {
var customerCode = extraArguments[0] || "NEW";
out.writeCliTitle("Edit Customer");
var model = new Customer(customerCode),
flow = new EditFlow({
model: model,
steps: [
new EditFlowStep({
label: "Company Code",
property: "code",
format: function(value) {
return value.toUpperCase();
},
default: customerCode
}),
new EditFlowStep("Company Name", 'companyName'),
new EditFlowStep("Address Line 1", 'address1'),
new EditFlowStep("Address Line 2", 'address2'),
new EditFlowStep("A.B.N", 'abn')
],
onSave: function() {
out.notification("CUSTOMER WAS SAVED");
router.execute(['show', 'customer', model.data.code]);
}
});
flow.start();
};