Commits

Stephan Oudmaijer  committed 973afb5

Added lots of domain classes.

  • Participants
  • Parent commits 47999b5

Comments (0)

Files changed (16)

File src/main/java/com/oudmaijer/administratie/domain/Invoice.groovy

-package com.oudmaijer.administratie.domain;
-
-@Immutable final class Invoice {
-    Long id;
-    String remark;
-    Date invoiceDate;
-}

File src/main/java/com/oudmaijer/administratie/domain/invoice/Invoice.groovy

+package com.oudmaijer.administratie.domain.invoice
+
+import com.oudmaijer.administratie.domain.payment.Payment
+import com.oudmaijer.administratie.domain.tax.TaxItem;
+
+class Invoice {
+    Long id;
+    String comment;
+    Date invoiceDate;
+    Payment payment;
+    Double amount;
+    InvoiceType type;
+    InvoiceCategory category;
+    List<InvoiceAttachment> attachments;
+    List<TaxItem> taxItems;
+}

File src/main/java/com/oudmaijer/administratie/domain/invoice/InvoiceAttachment.groovy

+package com.oudmaijer.administratie.domain.invoice
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Stephan
+ * Date: 10-5-12
+ * Time: 19:42
+ * To change this template use File | Settings | File Templates.
+ */
+class InvoiceAttachment {
+}

File src/main/java/com/oudmaijer/administratie/domain/invoice/InvoiceCategory.groovy

+package com.oudmaijer.administratie.domain.invoice
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Stephan
+ * Date: 10-5-12
+ * Time: 19:46
+ * To change this template use File | Settings | File Templates.
+ */
+class InvoiceCategory {
+}

File src/main/java/com/oudmaijer/administratie/domain/invoice/InvoiceType.groovy

+package com.oudmaijer.administratie.domain.invoice
+
+public enum InvoiceType {
+    INCOMING, OUTGOING;
+}

File src/main/java/com/oudmaijer/administratie/domain/payment/Payment.groovy

+package com.oudmaijer.administratie.domain.payment
+
+class Payment {
+}

File src/main/java/com/oudmaijer/administratie/domain/relations/Client.groovy

+package com.oudmaijer.administratie.domain.relations
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Stephan
+ * Date: 10-5-12
+ * Time: 20:09
+ * To change this template use File | Settings | File Templates.
+ */
+class Client {
+}

File src/main/java/com/oudmaijer/administratie/domain/relations/Creditor.groovy

+package com.oudmaijer.administratie.domain.relations
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Stephan
+ * Date: 10-5-12
+ * Time: 20:08
+ * To change this template use File | Settings | File Templates.
+ */
+class Creditor {
+}

File src/main/java/com/oudmaijer/administratie/domain/relations/Deptor.groovy

+package com.oudmaijer.administratie.domain.relations
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Stephan
+ * Date: 10-5-12
+ * Time: 20:08
+ * To change this template use File | Settings | File Templates.
+ */
+class Deptor {
+}

File src/main/java/com/oudmaijer/administratie/domain/tax/TaxItem.groovy

+package com.oudmaijer.administratie.domain.tax
+
+class TaxItem {
+    TaxType taxType;
+    Double amount;
+}

File src/main/java/com/oudmaijer/administratie/domain/tax/TaxType.groovy

+package com.oudmaijer.administratie.domain.tax
+
+public class TaxType {
+    String description;
+    Double percentage;
+}

File src/main/java/com/oudmaijer/administratie/domain/timesheet/TimeEntry.groovy

+package com.oudmaijer.administratie.domain.timesheet
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Stephan
+ * Date: 10-5-12
+ * Time: 20:07
+ * To change this template use File | Settings | File Templates.
+ */
+class TimeEntry {
+}

File src/main/java/com/oudmaijer/administratie/domain/timesheet/Timesheet.groovy

+package com.oudmaijer.administratie.domain.timesheet
+
+class Timesheet {
+    List<TimeEntry> timeEntries;
+}

File src/main/java/com/oudmaijer/administratie/web/InvoiceController.groovy

 package com.oudmaijer.administratie.web
 
 import org.springframework.web.bind.annotation.RequestMapping
-import com.oudmaijer.administratie.domain.Invoice
+import com.oudmaijer.administratie.domain.invoice.Invoice
 import org.springframework.ui.Model
 import org.springframework.web.bind.annotation.ResponseBody
 import org.springframework.web.bind.annotation.RequestMethod
 import org.springframework.stereotype.Controller
+import org.springframework.web.bind.annotation.PathVariable
 
 @Controller
 @RequestMapping("/invoice")
 public class InvoiceController {
 
-    @RequestMapping(value="/list",  method = RequestMethod.GET)
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
     @ResponseBody
     public Model listInvoices(Model model) {
         List<Invoice> invoices = new ArrayList<Invoice>();
-        def invoice = new Invoice(0, "", new Date());
+        def invoice = new Invoice(id: 0, comment: "", invoiceDate: new Date());
         invoices.add(invoice);
         model.addAttribute("invoices", invoices);
         model.addAttribute("result", "invoice/list");
         return model;
     }
 
-    @RequestMapping("/new")
-    public String newInvoice() {
-        return "invoice/new";
+    @RequestMapping(value = "/new", method = RequestMethod.GET)
+    @ResponseBody
+    public Model newInvoice(Model model) {
+        model.addAttribute("result", "invoice/new");
+        return model;
     }
 
-    @RequestMapping("/add")
-    public String addInvoice() {
-        return "invoice/list";
+    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
+    @ResponseBody
+    public Model showInvoice(Model model, @PathVariable("id") int id) {
+        model.addAttribute("result", "invoice/new");
+        return model;
     }
 
+    @RequestMapping(value = "/add", method = RequestMethod.PUT)
+    @ResponseBody
+    public Model addInvoice(Model model) {
+        model.addAttribute("result", "invoice/list");
+        return model;
+    }
+
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    @ResponseBody
+    public Model updateInvoice(Model model) {
+        model.addAttribute("result", "invoice/list");
+        return model;
+    }
 }
 

File src/main/webapp/WEB-INF/vm/invoice/list.vm

     <table>
         #foreach($item in $invoices)
             <tr>
-                <td>${item.id}</td>
-                <td>${item.date}</td>
-                <td>${item.remarks}</td>
+                <td>$!item.id</td>
+                <td>$!item.date</td>
+                <td>$!item.remarks</td>
             </tr>
         #end
     </table>

File src/main/webapp/WEB-INF/vm/invoice/new.vm

-new jaja
+Nieuwe factuur