#include "PrintTicketSelectForm.h"
#include "ui_PrintTicketSelectForm.h"
#include <QDebug>
#include "QsLog.h"

PrintTicketSelectForm::PrintTicketSelectForm(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::PrintTicketSelectForm)
{
    ui->setupUi(this);
    setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint);
    this->setModal(true);
    ui->BtnOk->setEnabled(false);
}


PrintTicketSelectForm::~PrintTicketSelectForm()
{
    QLOG_INFO() << QString("[<<<<---PrintTicketSelectForm::~PrintTicketSelectForm: begin--->>>>]");
    delete ui;
    QLOG_INFO() << QString("[<<<<---PrintTicketSelectForm::~PrintTicketSelectForm: end--->>>>]");
}


void PrintTicketSelectForm::on_BtnCancle_clicked()
{
    this->reject();
}


void PrintTicketSelectForm::on_BtnOk_clicked()
{
    this->accept();
}

void PrintTicketSelectForm::on_allTicket_toggled(bool checked)
{
    if(checked)
    {
        ui->BtnOk->setEnabled(true);
        m_printTicketTypeStr = QString::fromLocal8Bit(TICKET_ALL);
        m_printTicketTypeCode=1;
    }
}

void PrintTicketSelectForm::on_summaryTicket_toggled(bool checked)
{
    if(checked)
    {
        ui->BtnOk->setEnabled(true);
        m_printTicketTypeStr = QString::fromLocal8Bit(TICKET_SUMMARY);
        m_printTicketTypeCode = 2;
    }
}


void PrintTicketSelectForm::on_cupTicket_toggled(bool checked)
{
    if(checked)
    {
        ui->BtnOk->setEnabled(true);
        m_printTicketTypeStr = QString::fromLocal8Bit(TICKET_CUP);
        m_printTicketTypeCode=3;
    }
}


void PrintTicketSelectForm::on_reserveTicket_toggled(bool checked)
{
    if(checked)
    {
        ui->BtnOk->setEnabled(true);
        m_printTicketTypeStr = QString::fromLocal8Bit(TICKET_RESERVE);
        m_printTicketTypeCode=4;
    }
}


void PrintTicketSelectForm::on_curbsideTicket_toggled(bool checked)
{
    if(checked)
    {
        ui->BtnOk->setEnabled(true);
        m_printTicketTypeStr = QString::fromLocal8Bit(TICKET_CURBSIDE);
        m_printTicketTypeCode=5;
    }
}


void  PrintTicketSelectForm::clearAllRadioBtnCheck(){
    QLOG_INFO() << QString("[<<<<---PrintTicketSelectForm::clearAllRadioBtnCheck  Clear All Check --->>>>]");
    ui->summaryTicket->setAutoExclusive(false);
    ui->summaryTicket->setChecked(false);
    ui->summaryTicket->setAutoExclusive(true);

    ui->cupTicket->setAutoExclusive(false);
    ui->cupTicket->setChecked(false);
    ui->cupTicket->setAutoExclusive(true);

    ui->reserveTicket->setAutoExclusive(false);
    ui->reserveTicket->setChecked(false);
    ui->reserveTicket->setAutoExclusive(true);

    ui->curbsideTicket->setAutoExclusive(false);
    ui->curbsideTicket->setChecked(false);
    ui->curbsideTicket->setAutoExclusive(true);

    ui->allTicket->setAutoExclusive(false);
    ui->allTicket->setChecked(false);
    ui->allTicket->setAutoExclusive(true);
}
