Search in sources :

Example 11 with OkCancelDialog

use of eu.ggnet.dwoss.util.OkCancelDialog in project dwoss by gg-net.

the class SpecListPanel method main.

// End of variables declaration//GEN-END:variables
public static void main(String[] args) {
    SpecListController controller;
    ProductProcessorStub stub = new ProductProcessorStub();
    controller = new SpecListController(stub.getSpecAgentStub());
    OkCancelDialog<SpecListPanel> panel = new OkCancelDialog<>("blub", new SpecListPanel(controller));
    panel.setVisible(true);
    System.exit(0);
}
Also used : OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) ProductProcessorStub(eu.ggnet.dwoss.receipt.stub.ProductProcessorStub)

Example 12 with OkCancelDialog

use of eu.ggnet.dwoss.util.OkCancelDialog in project dwoss by gg-net.

the class SalesProductChooserCask method main.

// End of variables declaration//GEN-END:variables
public static void main(String[] args) {
    SalesProduct salesProduct1 = new SalesProduct("AS.ASASD.ASD", "Test SalesProduct", 10D, 1, "SalesProduct Test Descritpion");
    SalesProduct salesProduct2 = new SalesProduct("AS.1234.ASD", "Test SalesProduct2", 1D, 2, "SalesProduct Test Descritpion2");
    List<SalesProduct> products = new ArrayList<>();
    products.add(salesProduct1);
    products.add(salesProduct2);
    SalesProductChooserCask view = new SalesProductChooserCask(products);
    OkCancelDialog<SalesProductChooserCask> dialog = new OkCancelDialog<>("Sample", view);
    dialog.setVisible(true);
    System.out.println(view.getProduct());
}
Also used : ArrayList(java.util.ArrayList) OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) SalesProduct(eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)

Example 13 with OkCancelDialog

use of eu.ggnet.dwoss.util.OkCancelDialog in project dwoss by gg-net.

the class CreditMemoAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Calendar release = Calendar.getInstance();
    release.setTime(doc.getHistory().getRelease());
    Calendar beforeOneYear = Calendar.getInstance();
    beforeOneYear.set(Calendar.YEAR, Calendar.getInstance().get(Calendar.YEAR) - 1);
    if (beforeOneYear.after(release) && JOptionPane.CANCEL_OPTION == JOptionPane.showConfirmDialog(parent, "Der Vorgang ist über ein Jahr alt und die Garantie ist abgelaufen!\nMöchten sie fortfahren?", "Garantie Warnung", JOptionPane.OK_CANCEL_OPTION)) {
        return;
    }
    List<AfterInvoicePosition> creditPositions = new ArrayList<>();
    for (Position position : doc.getPositions().values()) {
        if (position.getType() != PositionType.COMMENT)
            creditPositions.add(new AfterInvoicePosition(position));
    }
    CreditMemoView view = new CreditMemoView(creditPositions);
    OkCancelDialog<CreditMemoView> dialog = new OkCancelDialog<>("Test", view);
    dialog.setLocationRelativeTo(parent);
    dialog.setVisible(true);
    if (dialog.getCloseType() == CloseType.OK) {
        doc.removeAllPositions();
        for (Position position : view.getPositions()) {
            doc.append(position);
        }
        doc.setType(DocumentType.CREDIT_MEMO);
        doc.setDirective(Directive.BALANCE_REPAYMENT);
        Document d = Dl.remote().lookup(RedTapeWorker.class).update(doc, view.getStockLocation(), Dl.local().lookup(Guardian.class).getUsername());
        controller.reloadSelectionOnStateChange(d.getDossier());
    }
}
Also used : AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition) Position(eu.ggnet.dwoss.redtape.ee.entity.Position) AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition) OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) RedTapeWorker(eu.ggnet.dwoss.redtapext.ee.RedTapeWorker) Document(eu.ggnet.dwoss.redtape.ee.entity.Document) CreditMemoView(eu.ggnet.dwoss.redtapext.ui.cao.document.annulation.CreditMemoView)

Example 14 with OkCancelDialog

use of eu.ggnet.dwoss.util.OkCancelDialog in project dwoss by gg-net.

the class DefaultStateTransitionAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    // Invoice
    if (((RedTapeStateTransition) transition).getHints().contains(RedTapeStateTransition.Hint.CREATES_INVOICE)) {
        int confirmInvoice = JOptionPane.showOptionDialog(parent, "Eine Rechnung wird unwiederruflich erstellt. Möchten Sie fortfahren?", "Rechnungserstellung", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
        if (confirmInvoice == JOptionPane.CANCEL_OPTION)
            return;
    }
    // Cancel
    if (((RedTapeStateTransition) transition).equals(RedTapeStateTransitions.CANCEL)) {
        int confirmInvoice = JOptionPane.showOptionDialog(parent, "Der Vorgang wird storniert.\nMöchten Sie fortfahren?", "Abbrechen des Vorganges", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
        if (confirmInvoice == JOptionPane.NO_OPTION)
            return;
    }
    if (((RedTapeStateTransition) transition).getHints().contains(RedTapeStateTransition.Hint.ADDS_SETTLEMENT)) {
        SettlementViewCask view = new SettlementViewCask();
        OkCancelDialog<SettlementViewCask> dialog = new OkCancelDialog<>(parent, "Zahlung hinterlegen", view);
        dialog.setVisible(true);
        if (dialog.getCloseType() == CloseType.OK) {
            for (Document.Settlement settlement : view.getSettlements()) {
                cdoc.getDocument().add(settlement);
            }
        } else {
            return;
        }
    }
    if (((RedTapeStateTransition) transition).getHints().contains(RedTapeStateTransition.Hint.UNIT_LEAVES_STOCK)) {
        for (Position p : cdoc.getDocument().getPositions(PositionType.PRODUCT_BATCH).values()) {
            // TODO not the best but fastest solution for now, this must be changed later
            if (StringUtils.isBlank(p.getRefurbishedId())) {
                if (JOptionPane.showConfirmDialog(parent, "Der Vorgang enthält Neuware, wurden alle Seriennummern erfasst?", "Bitte verifizieren", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION)
                    return;
            }
        }
    }
    Optional.of(Dl.remote().lookup(RedTapeWorker.class).stateChange(cdoc, transition, Dl.local().lookup(Guardian.class).getUsername())).filter(Ui.failure()::handle).map(Reply::getPayload).map(Document::getDossier).ifPresent(d -> controller.reloadSelectionOnStateChange(d));
}
Also used : Position(eu.ggnet.dwoss.redtape.ee.entity.Position) OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) Guardian(eu.ggnet.saft.core.auth.Guardian) Reply(eu.ggnet.saft.api.Reply) Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Example 15 with OkCancelDialog

use of eu.ggnet.dwoss.util.OkCancelDialog in project dwoss by gg-net.

the class SalesProductUpdateCask method main.

// End of variables declaration//GEN-END:variables
public static void main(String[] args) {
    SalesProduct product = new SalesProduct("none", "none", 0d, 0, "none");
    SalesProductUpdateCask cask = new SalesProductUpdateCask(product);
    OkCancelDialog<SalesProductUpdateCask> ocd = new OkCancelDialog<>("ProductBatchUpdateCask", cask);
    ocd.setVisible(true);
    SalesProduct finished = ocd.getSubContainer().salesProduct;
    System.out.println(finished);
}
Also used : OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) SalesProduct(eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)

Aggregations

OkCancelDialog (eu.ggnet.dwoss.util.OkCancelDialog)20 ProductProcessorStub (eu.ggnet.dwoss.receipt.stub.ProductProcessorStub)6 Position (eu.ggnet.dwoss.redtape.ee.entity.Position)5 Document (eu.ggnet.dwoss.redtape.ee.entity.Document)4 AfterInvoicePosition (eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition)4 RedTapeWorker (eu.ggnet.dwoss.redtapext.ee.RedTapeWorker)3 CreditMemoView (eu.ggnet.dwoss.redtapext.ui.cao.document.annulation.CreditMemoView)3 OldCustomer (eu.ggnet.dwoss.customer.ee.priv.OldCustomer)2 OldCustomerAgent (eu.ggnet.dwoss.customer.ee.priv.OldCustomerAgent)2 Mandators (eu.ggnet.dwoss.mandator.Mandators)2 SalesProduct (eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)2 SpecAgent (eu.ggnet.dwoss.spec.ee.SpecAgent)2 ProductSpec (eu.ggnet.dwoss.spec.ee.entity.ProductSpec)2 ArrayList (java.util.ArrayList)2 AbstractGuardian (eu.ggnet.dwoss.common.AbstractGuardian)1 AddressService (eu.ggnet.dwoss.customer.opi.AddressService)1 CustomerMetaData (eu.ggnet.dwoss.customer.opi.CustomerMetaData)1 CustomerService (eu.ggnet.dwoss.customer.opi.CustomerService)1 UiCustomer (eu.ggnet.dwoss.customer.opi.UiCustomer)1 CustomerCreateWithSearchController (eu.ggnet.dwoss.customer.ui.old.CustomerCreateWithSearchController)1