You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
854 B
C++

#include "campseller.h"
#include "campwizard.h"
#include "campservice.h"
#include "data/camp-data.h"
#include "campshopitem.h"
CampSeller::CampSeller(QObject *parent)
:ISeller(parent)
{
}
void CampSeller::prepareItem()
{
CampWizard *wizard = new CampWizard();
wizard->setAttribute(Qt::WA_DeleteOnClose);
CampService srv;
CampDataPtr data = srv.create();
wizard->setData(data);
wizard->setNewRecord(true);
wizard->show();
connect(wizard, &QDialog::accepted, [this, data](){
SettingsService settSrv("CAMP");
CampSettingsPtr settings = settSrv.loadSettings<CampSettings>();
CampShopItemPtr item(new CampShopItem);
item->setUnitPrice(data->totalPrice());
item->setId(data->id());
item->setVatType(settings->vatType());
emit itemPrepared(item, 1);
});
}