#include "login.h"
#include "ui_login.h"
#include<QMessageBox>
#include<QtMultimediaWidgets>
#include"admin.h"
#include"gestion_caisse.h"
#include"rayonprincipale.h"
#include "chariot_principale.h"
#include "parking_principale.h"
#include"stock_principale.h"

login::login(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::login)
{
    ui->setupUi(this);

}

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

void login::on_pushButton_clicked()
{
    if (ui->lineEdit->text() == "admin" &&  ui->lineEdit_2->text() == "admin")  {
   ui->stackedWidget->hide();
   a=new admin(this);
   a->show();
      // ui->tabWidget->show();
    }
  else if ( ui->lineEdit->text() == "youssef" &&  ui->lineEdit_2->text() == "ghedas")  {
                ui->stackedWidget->hide();
                gc=new gestion_caisse(this);
                gc->show();
            }
    else if ( ui->lineEdit->text() == "cyrine" &&  ui->lineEdit_2->text() == "charrad")  {
                  ui->stackedWidget->hide();
                  sp=new stock_principale(this);
                  sp->show();
              }
    else if ( ui->lineEdit->text() == "kais" &&  ui->lineEdit_2->text() == "kasmi")  {
                  ui->stackedWidget->hide();
                  r=new rayonprincipale(this);
                  r->show();
              }
    else if ( ui->lineEdit->text() == "rayen" &&  ui->lineEdit_2->text() == "goucha")  {
                  ui->stackedWidget->hide();
                  ch=new chariot_principale(this);
                  ch->show();
              }
    else if ( ui->lineEdit->text() == "skander" &&  ui->lineEdit_2->text() == "frini")  {
                  ui->stackedWidget->hide();
                  pp=new parking_principale(this);
                  pp->show();
              }
    else {
           QMessageBox::information(nullptr, QObject::tr("Modifier l'etat"),
                           QObject::tr("Utilisateur ou mot de passe incorrect \n"
                                       "Click Cancel to exit."), QMessageBox::Cancel);
}
}
