package devopsdistilled.operp.client.stock;

import javax.inject.Inject;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;
import devopsdistilled.operp.client.abstracts.TaskPane;
import devopsdistilled.operp.client.stock.controllers.StockController;
import devopsdistilled.operp.client.stock.controllers.WarehouseController;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Font;

public class StockMgmtPane extends TaskPane {

	@Inject
	private StockController stockController;

	@Inject
	private WarehouseController warehouseController;

	private JButton btnListStock;
	private JButton btnCreateStock;
	private JButton btnCreateWarehouse;
	private JButton btnListWarehouse;

	@Override
	public String toString() {
		return new String("Stock Management");
	}

	/**
	 * @wbp.parser.entryPoint
	 */

	@Override
	public JComponent getPane() {
		JPanel pane = new JPanel();
		pane.setLayout(new MigLayout("", "[]20[]", "[][][][][]"));

		JLabel lblStockManagement = new JLabel("Stock Management");
		lblStockManagement.setFont(new Font("Dialog", Font.BOLD, 16));
		pane.add(lblStockManagement, "cell 0 0 2 1,alignx center");

		btnCreateStock = new JButton("Update Stock");
		btnCreateStock.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				stockController.create();

			}

		});
		pane.add(btnCreateStock, "flowx,cell 0 1");

		btnCreateWarehouse = new JButton("Create Warehouse");
		btnCreateWarehouse.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				warehouseController.create();
			}
		});

		btnListStock = new JButton("List Stock");
		btnListStock.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				stockController.list();
			}
		});

		pane.add(btnListStock, "cell 1 1");

		pane.add(btnCreateWarehouse, "flowx,cell 0 2");

		btnListWarehouse = new JButton("List Warehouse");
		btnListWarehouse.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				warehouseController.list();
			}
		});
		pane.add(btnListWarehouse, "cell 1 2");

		return pane;

	}

}

@@ -38,16 +38,112 @@
 stock;%0A%0A
+import java.awt.Font;%0Aimport java.awt.event.ActionEvent;%0Aimport java.awt.event.ActionListener;%0A%0A
 import j
@@ -162,16 +162,16 @@
 Inject;%0A
-
 import j
@@ -271,24 +271,25 @@
 ing.JPanel;%0A
+%0A
 import net.m
@@ -520,103 +520,8 @@
 ler;
-%0Aimport java.awt.event.ActionListener;%0Aimport java.awt.event.ActionEvent;%0Aimport java.awt.Font;
 %0A%0Apu
@@ -778,16 +778,16 @@
 ehouse;%0A
-
 %09private
@@ -812,16 +812,51 @@
 rehouse;
+%0A%09private JButton btnTransferStock;
 %0A%0A%09@Over
@@ -2325,24 +2325,121 @@
 %22cell 1 2%22);
+%0A%09%09%0A%09%09btnTransferStock = new JButton(%22Transfer Stock%22);%0A%09%09pane.add(btnTransferStock, %22cell 0 4%22);
 %0A%0A%09%09return p

Add "Transfer Stock" button