Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- import m from "mithril";
- import { deliveries, productList } from "../models/deliveries.js";
- import { Menu } from "./menu";
- var form = {
- oninit: productList.getListProduct,
- view: function(){
- return m("main.container", [
- m("h1", "Ny inleverans"),
- m("form", {
- onsubmit: function (event) {
- event.preventDefault();
- deliveries.save();
- m.route.set("/");
- }
- }, [
- m("label.input-label", "Produkt"),
- m("select", {
- onchange: function (e) {
- deliveries.currentDelivery.product_id = parseInt(e.target.value.split("-")[1]);
- }
- }, productList.currentList.map(function(product){
- return m("option", {id_product:product.id}, product.name + "-" +product.id);
- })
- ),
- m("label.input-label", "Leveransdarum"),
- m("input[type=date].input", {
- oninput: function (e) {
- deliveries.currentDelivery.delivery_date = e.target.value;
- }
- }),
- m("label.input-label", "Antal"),
- m("input[type=number].input", {
- oninput: function (e) {
- deliveries.currentDelivery.amount = parseInt(e.target.value);
- }
- }),
- m("label.input-label", "Kommentar"),
- m("textarea[placeholder=Comment].textarea", {
- oninput: function (e) {
- deliveries.currentDelivery.comment = e.target.value;
- }
- }),
- m("input[type=submit][value=Spara].button","Spara"),
- m(Menu),
- ]),
- ]);
- }
- }
- export { form };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement