Add fully-functional administration panel for administrators and dispatchers
This commit is contained in:
parent
bf599549ea
commit
ff6901e3a9
22 changed files with 1257 additions and 42 deletions
|
|
@ -4,6 +4,10 @@ QString Profession::title() const {
|
|||
return mTitle;
|
||||
}
|
||||
|
||||
void Profession::setTitle(const QString &newTitle) {
|
||||
mTitle = newTitle;
|
||||
}
|
||||
|
||||
PID Profession::pID() const {
|
||||
return mPID;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ public:
|
|||
Profession() = default;
|
||||
|
||||
QString title() const;
|
||||
void setTitle(const QString &newTitle);
|
||||
PID pID() const;
|
||||
|
||||
static Profession createProfession(const QString &title);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,14 @@ QString User::patronymic() const {
|
|||
return mPatronymic;
|
||||
}
|
||||
|
||||
QString User::getFullName() const {
|
||||
return QString("%1 %2 %3").arg(mSecondName).arg(mFirstName).arg(mPatronymic);
|
||||
}
|
||||
|
||||
QString User::getFullNameShortForm() const {
|
||||
return QString("%1 %2.%3.").arg(mSecondName).arg(mFirstName[0]).arg(mPatronymic[0]);
|
||||
}
|
||||
|
||||
ProfessionsList User::getProfessions() const {
|
||||
return mProfessions;
|
||||
}
|
||||
|
|
@ -69,11 +77,9 @@ bool User::addProfession(PID pid, ProfRank rank) {
|
|||
|
||||
if (mProfessions.size() >= 4) {
|
||||
if (mCurrentProfession == mProfessions[0].getProfession()) {
|
||||
mProfessions.remove(1);
|
||||
}
|
||||
else {
|
||||
mProfessions.remove(0);
|
||||
return false;
|
||||
}
|
||||
mProfessions.remove(0);
|
||||
}
|
||||
UserProfession up(pid, rank);
|
||||
|
||||
|
|
@ -91,12 +97,14 @@ bool User::setCurrentProfession(PID pid) {
|
|||
}
|
||||
|
||||
void User::removeProfession(PID pid) {
|
||||
auto pred = [pid](UserProfession p) {
|
||||
return p.getProfession() == pid;
|
||||
};
|
||||
|
||||
mProfessions.erase(std::remove_if(mProfessions.begin(), mProfessions.end(), pred),
|
||||
mProfessions.end());
|
||||
auto pred = [pid](UserProfession p) { return p.getProfession() == pid; };
|
||||
if (pid == mCurrentProfession) {
|
||||
mCurrentProfession = 0;
|
||||
}
|
||||
mProfessions.erase(
|
||||
std::remove_if(mProfessions.begin(), mProfessions.end(), pred),
|
||||
mProfessions.end()
|
||||
);
|
||||
}
|
||||
|
||||
bool operator==(const User &l, const User &r) {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ public:
|
|||
QString firstName() const;
|
||||
QString secondName() const;
|
||||
QString patronymic() const;
|
||||
QString getFullName() const;
|
||||
QString getFullNameShortForm() const;
|
||||
ProfessionsList getProfessions() const;
|
||||
PID getCurrentProfession() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
UserProfession::UserProfession(PID pid, ProfRank rank) {
|
||||
mProfession = pid;
|
||||
mRank = rank;
|
||||
mAcquired = QDate::currentDate();
|
||||
}
|
||||
|
||||
PID UserProfession::getProfession() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue