Esempio n. 1
0
class Requests(_D.Model):
    id = _D.Column(_D.Integer, primary_key=True)
    date_added = _D.Column(_D.String(20), nullable=False)
    requested_by = _D.Column(_D.Integer, _D.ForeignKey('employee.id'), nullable=False)
    # requested_date = _D.Column(_D.String(20), nullable=False)
    requested_date = _D.Column(_D.Integer, _D.ForeignKey('the_days.id'), nullable=False)
    requested_time = _D.Column(_D.String(20), nullable=False, default='All day')
    status = _D.Column(_D.String(10), nullable=False, default='pending')
    review_date = _D.Column(_D.String(20))
    review_by = _D.Column(_D.Integer, _D.ForeignKey('employee.id'))
Esempio n. 2
0
class Event(_D.Model):
    id = _D.Column(_D.Integer, primary_key=True)
    date_added = _D.Column(_D.String(20), nullable=False, default=datetime.today().strftime('%Y-%m-%d'))
    added_by = _D.Column(_D.Integer, _D.ForeignKey('employee.id'), nullable=False)
    event_date = _D.Column(_D.Integer, _D.ForeignKey('the_days.id'), nullable=False)
    event_name = _D.Column(_D.String(30), nullable=False)
    event_desc = _D.Column(_D.String(350), nullable=False, default='No description added yet.')
    setup_date = _D.Column(_D.Integer, _D.ForeignKey('the_days.id'), default=1)
    pickup_date = _D.Column(_D.Integer, _D.ForeignKey('the_days.id'), default=1)
    after_hours_setup = _D.Column(_D.String(5))
    after_hours_pickup = _D.Column(_D.String(5))

    def __repr__(self):
        return f'[EVENT{self.id}] :: {self.event_name}'
Esempio n. 3
0
class Schedule(_D.Model):
    id = _D.Column(_D.Integer, primary_key=True)
    date_added = _D.Column(_D.String(20), nullable=False, default=datetime.today().strftime('%Y-%m-%d'))
    added_by = _D.Column(_D.Integer, _D.ForeignKey('employee.id'), nullable=False)
    work_date = _D.Column(_D.Integer, _D.ForeignKey('the_days.id'), nullable=False)
    emp_id = _D.Column(_D.Integer, _D.ForeignKey('employee.id'), nullable=False)
    on_off = _D.Column(_D.String(5), nullable=False, default='ON')
    start_time = _D.Column(_D.String(5), default='TBD')
    end_time = _D.Column(_D.String(5))

    def __repr__(self):
        day = TheDays.query.filter_by(id=self.work_date).first()
        guy = Employee.query.filter_by(id=self.emp_id).first()
        if self.on_off == 'ON':
            on = 'working'
        else:
            on = self.on_off
        label_guy = (guy.first_name + ' ' + guy.last_name)
        label_day = (day.day_name + ' ' + utils.month_num_to_abr(day.calid.the_month) + ' ' + str(day.day_num) + ', ' + str(day.calid.the_year))
        return f"[WORK{self.id}] :: {label_guy} is {on} on {label_day}"
Esempio n. 4
0
class Available(_D.Model):
    id = _D.Column(_D.Integer, primary_key=True)
    emp_id = _D.Column(_D.Integer, _D.ForeignKey('employee.id'), nullable=False)
    monday = _D.Column(_D.String(20), nullable=False, default='1')
    tuesday = _D.Column(_D.String(20), nullable=False, default='1')
    wednesday = _D.Column(_D.String(20), nullable=False, default='1')
    thursday = _D.Column(_D.String(20), nullable=False, default='1')
    friday = _D.Column(_D.String(20), nullable=False, default='1')
    saturday = _D.Column(_D.String(20), nullable=False, default='1')
    sunday = _D.Column(_D.String(20), nullable=False, default='1')
    return_date = _D.Column(_D.String(20))
    leave_date = _D.Column(_D.String(20))

    def __repr__(self):
        return f'[AVAIL//GUY{self.emp_id}] :: M -> {self.monday} | Tu -> {self.tuesday} | W -> {self.wednesday} | Th -> {self.thursday} | F -> {self.friday} | Sa -> {self.saturday} | Su -> {self.sunday}'
Esempio n. 5
0
class TheDays(_D.Model):
    id = _D.Column(_D.Integer, primary_key=True)
    cal_id = _D.Column(_D.Integer, _D.ForeignKey('the_calendar.id'), nullable=False)
    day_name = _D.Column(_D.String(10), nullable=False)
    day_num = _D.Column(_D.Integer, nullable=False)
    schedule = _D.relationship('Schedule', backref='workdate', lazy=True)
    requests = _D.relationship('Requests', backref='requesteddate', lazy=True)
    events = _D.relationship('Event', backref='eventdate', lazy=True, foreign_keys='Event.event_date')
    event_setup = _D.relationship('Event', backref='setupdate', lazy=True, foreign_keys='Event.setup_date')
    event_pickup = _D.relationship('Event', backref='pickupdate', lazy=True, foreign_keys='Event.pickup_date')

    def __repr__(self):
        cal = TheCalendar.query.filter_by(id=self.cal_id).first()
        mon = utils.month_num_to_abr(cal.the_month)
        return f"[DAY{self.id}] :: {self.day_name}, {mon} {self.day_num}, {cal.the_year}"