#include "accserviceform.h"
#include "ui_accserviceform.h"

AccServiceForm::AccServiceForm(QWidget *parent) :
    AutoForm<AccService>(parent),
    ui(new Ui::AccServiceForm)
{
    ui->setupUi(this);
    registerBinding(ui->accServiceName);
    registerBinding(ui->price);
    registerBinding(ui->salePossible);
    registerBinding(ui->active);

}

AccServiceForm::~AccServiceForm()
{
    delete ui;
}

void AccServiceForm::bindOtherToUi()
{
    ui->serviceType->clear();
    ui->serviceType->addItems(QStringList()<<tr("Car")<<tr("Tent")<<tr("Other"));
    ui->serviceType->setCurrentIndex(this->entity()->serviceType());
}

bool AccServiceForm::bindOtherToData()
{
    this->entity()->setServiceType((AccService::ServiceType)ui->serviceType->currentIndex());
    return true;
}
