repo_id
stringclasses
208 values
file_path
stringlengths
31
190
content
stringlengths
1
2.65M
__index_level_0__
int64
0
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/utils/test_path.py
import os,sys import shutil sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from conf import test_path_conf as conf #get details from conf file for POM src_pom_files_list = conf.src_pom_files_list dst_folder_pom = conf.dst_folder_pom #check if POM folder exists and then copy files if os.path.exists(dst_folder_pom): for every_src_pom_file in src_pom_files_list: shutil.copy2(every_src_pom_file,dst_folder_pom)
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/utils/Wrapit.py
""" Class to hold miscellaneous but useful decorators for our framework """ from inspect import getfullargspec from QA.page_objects.Base_Page import Base_Page class Wrapit(): "Wrapit class to hold decorator functions" def _exceptionHandler(f): "Decorator to handle exceptions" argspec = getfullargspec(f) def inner(*args,**kwargs): try: return f(*args,**kwargs) except Exception as e: args[0].write('You have this exception') args[0].write('Exception in method: %s'%str(f.__name__)) args[0].write('PYTHON SAYS: %s'%str(e)) #we denote None as failure case return None return inner def _screenshot(func): "Decorator for taking screenshots" #Usage: Make this the first decorator to a method (right above the 'def function_name' line) #Otherwise, we cannot name the screenshot with the name of the function that called it def wrapper(*args,**kwargs): result = func(*args,**kwargs) screenshot_name = '%003d'%args[0].screenshot_counter + '_' + func.__name__ args[0].screenshot_counter += 1 args[0].save_screenshot(screenshot_name) return result return wrapper def _check_browser_console_log(func): "Decorator to check the browser's console log for errors" def wrapper(*args,**kwargs): #As IE driver does not support retrieval of any logs, #we are bypassing the read_browser_console_log() method result = func(*args, **kwargs) if "ie" not in str(args[0].driver): result = func(*args, **kwargs) log_errors = [] new_errors = [] log = args[0].read_browser_console_log() if log != None: for entry in log: if entry['level']=='SEVERE': log_errors.append(entry['message']) if args[0].current_console_log_errors != log_errors: #Find the difference new_errors = list(set(log_errors) - set(args[0].current_console_log_errors)) #Set current_console_log_errors = log_errors args[0].current_console_log_errors = log_errors if len(new_errors)>0: args[0].failure("\nBrowser console error on url: %s\nMethod: %s\nConsole error(s):%s"%(args[0].get_current_url(),func.__name__,'\n----'.join(new_errors))) return result return wrapper _exceptionHandler = staticmethod(_exceptionHandler) _screenshot = staticmethod(_screenshot) _check_browser_console_log = staticmethod(_check_browser_console_log)
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/utils/setup_testrail.py
""" One off utility script to setup TestRail for an automated run This script can: a) Add a milestone if it does not exist b) Add a test run (even without a milestone if needed) c) Add select test cases to the test run using the setup_testrail.conf file d) Write out the latest run id to a 'latest_test_run.txt' file This script will NOT: a) Add a project if it does not exist """ import os,ConfigParser,time from .Test_Rail import Test_Rail from optparse import OptionParser def check_file_exists(file_path): #Check if the config file exists and is a file conf_flag = True if os.path.exists(file_path): if not os.path.isfile(file_path): print('\n****') print('Config file provided is not a file: ') print(file_path) print('****') conf_flag = False else: print('\n****') print('Unable to locate the provided config file: ') print(file_path) print('****') conf_flag = False return conf_flag def check_options(options): "Check if the command line options are valid" result_flag = True if options.test_cases_conf is not None: result_flag = check_file_exists(os.path.abspath(os.path.join(os.path.dirname(__file__),'..','conf',options.test_cases_conf))) return result_flag def save_new_test_run_details(filename,test_run_name,test_run_id): "Write out latest test run name and id" fp = open(filename,'w') fp.write('TEST_RUN_NAME=%s\n'%test_run_name) fp.write('TEST_RUN_ID=%s\n'%str(test_run_id)) fp.close() def setup_testrail(project_name='POM DEMO',milestone_name=None,test_run_name=None,test_cases_conf=None,description=None,name_override_flag='N',case_ids_list=None): "Setup TestRail for an automated run" #1. Get project id #2. if milestone_name is not None # create the milestone if it does not already exist #3. if test_run_name is not None # create the test run if it does not already exist # TO DO: if test_cases_conf is not None -> pass ids as parameters #4. write out test runid to latest_test_run.txt conf_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','conf')) config = ConfigParser.ConfigParser() tr_obj = Test_Rail() #1. Get project id project_id = tr_obj.get_project_id(project_name) if project_id is not None: #i.e., the project exists #2. if milestone_name is not None: # create the milestone if it does not already exist if milestone_name is not None: tr_obj.create_milestone(project_name,milestone_name) #3. if test_run_name is not None # create the test run if it does not already exist # if test_cases_conf is not None -> pass ids as parameters if test_run_name is not None: case_ids = [] #Set the case ids if case_ids_list is not None: #Getting case ids from command line case_ids = case_ids_list.split(',') else: #Getting case ids based on given description(test name) if description is not None: if check_file_exists(os.path.join(conf_dir,test_cases_conf)): config.read(os.path.join(conf_dir,test_cases_conf)) case_ids = config.get(description,'case_ids') case_ids = case_ids.split(',') #Set test_run_name if name_override_flag.lower() == 'y': test_run_name = test_run_name + "-" + time.strftime("%d/%m/%Y/%H:%M:%S") + "_for_" #Use description as test_run_name if description is None: test_run_name = test_run_name + "All" else: test_run_name = test_run_name + str(description) tr_obj.create_test_run(project_name,test_run_name,milestone_name=milestone_name,case_ids=case_ids,description=description) run_id = tr_obj.get_run_id(project_name,test_run_name) save_new_test_run_details(os.path.join(conf_dir,'latest_test_run.txt'),test_run_name,run_id) else: print('Project does not exist: ',project_name) print('Stopping the script without doing anything.') #---START OF SCRIPT if __name__=='__main__': #This script takes an optional command line argument for the TestRail run id usage = '\n----\n%prog -p <OPTIONAL: Project name> -m <OPTIONAL: milestone_name> -r <OPTIONAL: Test run name> -t <OPTIONAL: test cases conf file> -d <OPTIONAL: Test run description>\n----\nE.g.: %prog -p "Secure Code Warrior - Test" -m "Pilot NetCetera" -r commit_id -t setup_testrail.conf -d Registration\n---' parser = OptionParser(usage=usage) parser.add_option("-p","--project", dest="project_name", default="POM DEMO", help="Project name") parser.add_option("-m","--milestone", dest="milestone_name", default=None, help="Milestone name") parser.add_option("-r","--test_run_name", dest="test_run_name", default=None, help="Test run name") parser.add_option("-t","--test_cases_conf", dest="test_cases_conf", default="setup_testrail.conf", help="Test cases conf listing test names and ids you want added") parser.add_option("-d","--test_run_description", dest="test_run_description", default=None, help="The name of the test Registration_Tests/Intro_Run_Tests/Sales_Demo_Tests") parser.add_option("-n","--name_override_flag", dest="name_override_flag", default="Y", help="Y or N. 'N' if you don't want to override the default test_run_name") parser.add_option("-c","--case_ids_list", dest="case_ids_list", default=None, help="Pass all case ids with comma separated you want to add in test run") (options,args) = parser.parse_args() #Run the script only if the options are valid if check_options(options): setup_testrail(project_name=options.project_name, milestone_name=options.milestone_name, test_run_name=options.test_run_name, test_cases_conf=options.test_cases_conf, description=options.test_run_description, name_override_flag=options.name_override_flag, case_ids_list=options.case_ids_list) else: print('ERROR: Received incorrect input arguments') print(parser.print_usage())
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/utils/copy_framework_template.py
""" This script would copy the required framework files from the input source to the input destination given by the user. 1. Copy files from POM to the newly created destination directory. 2. Verify if the destination directory is created and create the sub-folder to copy files from POM\Conf. 3. Verify if the destination directory is created and create the sub-folder to copy files from POM\Page_Objects. 4. Verify if the destination directory is created and create the sub-folder to copy files from POM\Utils. """ import os,sys import shutil from optparse import OptionParser sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from conf import copy_framework_template_conf as conf def copy_framework_template(src_folder,dst_folder): "run the test" #1. Copy files from POM to the newly created destination directory. #1a. Get details from conf file src_files_list = conf.src_files_list #1b. Create the new destination directory os.makedirs(dst_folder) #1c. Check if destination folder exists and then copy files if os.path.exists(dst_folder): for every_src_file in src_files_list: shutil.copy2(every_src_file,dst_folder) #2. Verify if the destination directory is created and create the sub-folder to copy files from POM\Conf. #2a. Get details from conf file for Conf src_conf_files_list = conf.src_conf_files_list dst_folder_conf = conf.dst_folder_conf #2b. Create the conf sub-folder if os.path.exists(dst_folder): os.mkdir(dst_folder_conf) #2c. Check if conf folder exists and then copy files if os.path.exists(dst_folder_conf): for every_src_conf_file in src_conf_files_list: shutil.copy2(every_src_conf_file,dst_folder_conf) #3. Verify if the destination directory is created and create the sub-folder to copy files from POM\Page_Objects. #3a. Get details from conf file for Page_Objects src_page_objects_files_list = conf.src_page_objects_files_list dst_folder_page_objects = conf.dst_folder_page_objects #3b. Create the page_object sub-folder if os.path.exists(dst_folder): os.mkdir(dst_folder_page_objects) #3c. Check if page_object folder exists and then copy files if os.path.exists(dst_folder_page_objects): for every_src_page_objects_file in src_page_objects_files_list: shutil.copy2(every_src_page_objects_file,dst_folder_page_objects) #4. Verify if the destination directory is created and create the sub-folder to copy files from POM\Utils. #4a. Get details from conf file for Utils folder src_utils_files_list = conf.src_utils_files_list dst_folder_utils = conf.dst_folder_utils #4b. Create the utils destination directory if os.path.exists(dst_folder): os.mkdir(dst_folder_utils) #4c. Check if utils folder exists and then copy files if os.path.exists(dst_folder_utils): for every_src_utils_file in src_utils_files_list: shutil.copy2(every_src_utils_file,dst_folder_utils) #---START OF SCRIPT if __name__=='__main__': #run the test parser=OptionParser() parser.add_option("-s","--source",dest="src",help="The name of the source folder: ie, POM",default="POM") parser.add_option("-d","--destination",dest="dst",help="The name of the destination folder: ie, client name",default="Myntra") (options,args) = parser.parse_args() copy_framework_template(options.src,options.dst)
0
qxf2_public_repos/interview-scheduler/QA/utils
qxf2_public_repos/interview-scheduler/QA/utils/gmail/__init__.py
""" GMail! Woo! """ __title__ = 'gmail' __version__ = '0.1' __author__ = 'Charlie Guo' __build__ = 0x0001 __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2013 Charlie Guo' from .gmail import Gmail from .mailbox import Mailbox from .message import Message from .exceptions import GmailException, ConnectionError, AuthenticationError from .utils import login, authenticate
0
qxf2_public_repos/interview-scheduler/QA/utils
qxf2_public_repos/interview-scheduler/QA/utils/gmail/message.py
import datetime import email import re import time import os from email.header import decode_header, make_header from imaplib import ParseFlags class Message(): def __init__(self, mailbox, uid): self.uid = uid self.mailbox = mailbox self.gmail = mailbox.gmail if mailbox else None self.message = None self.headers = {} self.subject = None self.body = None self.html = None self.to = None self.fr = None self.cc = None self.delivered_to = None self.sent_at = None self.flags = [] self.labels = [] self.thread_id = None self.thread = [] self.message_id = None self.attachments = None def is_read(self): return ('\\Seen' in self.flags) def read(self): flag = '\\Seen' self.gmail.imap.uid('STORE', self.uid, '+FLAGS', flag) if flag not in self.flags: self.flags.append(flag) def unread(self): flag = '\\Seen' self.gmail.imap.uid('STORE', self.uid, '-FLAGS', flag) if flag in self.flags: self.flags.remove(flag) def is_starred(self): return ('\\Flagged' in self.flags) def star(self): flag = '\\Flagged' self.gmail.imap.uid('STORE', self.uid, '+FLAGS', flag) if flag not in self.flags: self.flags.append(flag) def unstar(self): flag = '\\Flagged' self.gmail.imap.uid('STORE', self.uid, '-FLAGS', flag) if flag in self.flags: self.flags.remove(flag) def is_draft(self): return ('\\Draft' in self.flags) def has_label(self, label): full_label = '%s' % label return (full_label in self.labels) def add_label(self, label): full_label = '%s' % label self.gmail.imap.uid('STORE', self.uid, '+X-GM-LABELS', full_label) if full_label not in self.labels: self.labels.append(full_label) def remove_label(self, label): full_label = '%s' % label self.gmail.imap.uid('STORE', self.uid, '-X-GM-LABELS', full_label) if full_label in self.labels: self.labels.remove(full_label) def is_deleted(self): return ('\\Deleted' in self.flags) def delete(self): flag = '\\Deleted' self.gmail.imap.uid('STORE', self.uid, '+FLAGS', flag) if flag not in self.flags: self.flags.append(flag) trash = '[Gmail]/Trash' if '[Gmail]/Trash' in self.gmail.labels() else '[Gmail]/Bin' if self.mailbox.name not in ['[Gmail]/Bin', '[Gmail]/Trash']: self.move_to(trash) # def undelete(self): # flag = '\\Deleted' # self.gmail.imap.uid('STORE', self.uid, '-FLAGS', flag) # if flag in self.flags: self.flags.remove(flag) def move_to(self, name): self.gmail.copy(self.uid, name, self.mailbox.name) if name not in ['[Gmail]/Bin', '[Gmail]/Trash']: self.delete() def archive(self): self.move_to('[Gmail]/All Mail') def parse_headers(self, message): hdrs = {} for hdr in message.keys(): hdrs[hdr] = message[hdr] return hdrs def parse_flags(self, headers): return list(ParseFlags(headers)) # flags = re.search(r'FLAGS \(([^\)]*)\)', headers).groups(1)[0].split(' ') def parse_labels(self, headers): if re.search(r'X-GM-LABELS \(([^\)]+)\)', headers): labels = re.search(r'X-GM-LABELS \(([^\)]+)\)', headers).groups(1)[0].split(' ') return map(lambda l: l.replace('"', '').decode("string_escape"), labels) else: return list() def parse_subject(self, encoded_subject): dh = decode_header(encoded_subject) default_charset = 'ASCII' return ''.join([ unicode(t[0], t[1] or default_charset) for t in dh ]) def parse(self, raw_message): raw_headers = raw_message[0] raw_email = raw_message[1] self.message = email.message_from_string(raw_email) self.headers = self.parse_headers(self.message) self.to = self.message['to'] self.fr = self.message['from'] self.delivered_to = self.message['delivered_to'] self.subject = self.parse_subject(self.message['subject']) if self.message.get_content_maintype() == "multipart": for content in self.message.walk(): if content.get_content_type() == "text/plain": self.body = content.get_payload(decode=True) elif content.get_content_type() == "text/html": self.html = content.get_payload(decode=True) elif self.message.get_content_maintype() == "text": self.body = self.message.get_payload() self.sent_at = datetime.datetime.fromtimestamp(time.mktime(email.utils.parsedate_tz(self.message['date'])[:9])) self.flags = self.parse_flags(raw_headers) self.labels = self.parse_labels(raw_headers) if re.search(r'X-GM-THRID (\d+)', raw_headers): self.thread_id = re.search(r'X-GM-THRID (\d+)', raw_headers).groups(1)[0] if re.search(r'X-GM-MSGID (\d+)', raw_headers): self.message_id = re.search(r'X-GM-MSGID (\d+)', raw_headers).groups(1)[0] # Parse attachments into attachment objects array for this message self.attachments = [ Attachment(attachment) for attachment in self.message._payload if not isinstance(attachment, basestring) and attachment.get('Content-Disposition') is not None ] def fetch(self): if not self.message: response, results = self.gmail.imap.uid('FETCH', self.uid, '(BODY.PEEK[] FLAGS X-GM-THRID X-GM-MSGID X-GM-LABELS)') self.parse(results[0]) return self.message # returns a list of fetched messages (both sent and received) in chronological order def fetch_thread(self): self.fetch() original_mailbox = self.mailbox self.gmail.use_mailbox(original_mailbox.name) # fetch and cache messages from inbox or other received mailbox response, results = self.gmail.imap.uid('SEARCH', None, '(X-GM-THRID ' + self.thread_id + ')') received_messages = {} uids = results[0].split(' ') if response == 'OK': for uid in uids: received_messages[uid] = Message(original_mailbox, uid) self.gmail.fetch_multiple_messages(received_messages) self.mailbox.messages.update(received_messages) # fetch and cache messages from 'sent' self.gmail.use_mailbox('[Gmail]/Sent Mail') response, results = self.gmail.imap.uid('SEARCH', None, '(X-GM-THRID ' + self.thread_id + ')') sent_messages = {} uids = results[0].split(' ') if response == 'OK': for uid in uids: sent_messages[uid] = Message(self.gmail.mailboxes['[Gmail]/Sent Mail'], uid) self.gmail.fetch_multiple_messages(sent_messages) self.gmail.mailboxes['[Gmail]/Sent Mail'].messages.update(sent_messages) self.gmail.use_mailbox(original_mailbox.name) # combine and sort sent and received messages return sorted(dict(received_messages.items() + sent_messages.items()).values(), key=lambda m: m.sent_at) class Attachment: def __init__(self, attachment): self.name = attachment.get_filename() # Raw file data self.payload = attachment.get_payload(decode=True) # Filesize in kilobytes self.size = int(round(len(self.payload)/1000.0)) def save(self, path=None): if path is None: # Save as name of attachment if there is no path specified path = self.name elif os.path.isdir(path): # If the path is a directory, save as name of attachment in that directory path = os.path.join(path, self.name) with open(path, 'wb') as f: f.write(self.payload)
0
qxf2_public_repos/interview-scheduler/QA/utils
qxf2_public_repos/interview-scheduler/QA/utils/gmail/gmail.py
from __future__ import absolute_import import re import imaplib from .mailbox import Mailbox from .utf import encode as encode_utf7, decode as decode_utf7 from .exceptions import * class Gmail(): # GMail IMAP defaults GMAIL_IMAP_HOST = 'imap.gmail.com' GMAIL_IMAP_PORT = 993 # GMail SMTP defaults # TODO: implement SMTP functions GMAIL_SMTP_HOST = "smtp.gmail.com" GMAIL_SMTP_PORT = 587 def __init__(self): self.username = None self.password = None self.access_token = None self.imap = None self.smtp = None self.logged_in = False self.mailboxes = {} self.current_mailbox = None # self.connect() def connect(self, raise_errors=True): # try: # self.imap = imaplib.IMAP4_SSL(self.GMAIL_IMAP_HOST, self.GMAIL_IMAP_PORT) # except socket.error: # if raise_errors: # raise Exception('Connection failure.') # self.imap = None self.imap = imaplib.IMAP4_SSL(self.GMAIL_IMAP_HOST, self.GMAIL_IMAP_PORT) # self.smtp = smtplib.SMTP(self.server,self.port) # self.smtp.set_debuglevel(self.debug) # self.smtp.ehlo() # self.smtp.starttls() # self.smtp.ehlo() return self.imap def fetch_mailboxes(self): response, mailbox_list = self.imap.list() if response == 'OK': for mailbox in mailbox_list: mailbox_name = mailbox.split('"/"')[-1].replace('"', '').strip() mailbox = Mailbox(self) mailbox.external_name = mailbox_name self.mailboxes[mailbox_name] = mailbox def use_mailbox(self, mailbox): if mailbox: self.imap.select(mailbox) self.current_mailbox = mailbox def mailbox(self, mailbox_name): if mailbox_name not in self.mailboxes: mailbox_name = encode_utf7(mailbox_name) mailbox = self.mailboxes.get(mailbox_name) if mailbox and not self.current_mailbox == mailbox_name: self.use_mailbox(mailbox_name) return mailbox def create_mailbox(self, mailbox_name): mailbox = self.mailboxes.get(mailbox_name) if not mailbox: self.imap.create(mailbox_name) mailbox = Mailbox(self, mailbox_name) self.mailboxes[mailbox_name] = mailbox return mailbox def delete_mailbox(self, mailbox_name): mailbox = self.mailboxes.get(mailbox_name) if mailbox: self.imap.delete(mailbox_name) del self.mailboxes[mailbox_name] def login(self, username, password): self.username = username self.password = password if not self.imap: self.connect() try: imap_login = self.imap.login(self.username, self.password) self.logged_in = (imap_login and imap_login[0] == 'OK') if self.logged_in: self.fetch_mailboxes() except imaplib.IMAP4.error: raise AuthenticationError # smtp_login(username, password) return self.logged_in def authenticate(self, username, access_token): self.username = username self.access_token = access_token if not self.imap: self.connect() try: auth_string = 'user=%s\1auth=Bearer %s\1\1' % (username, access_token) imap_auth = self.imap.authenticate('XOAUTH2', lambda x: auth_string) self.logged_in = (imap_auth and imap_auth[0] == 'OK') if self.logged_in: self.fetch_mailboxes() except imaplib.IMAP4.error: raise AuthenticationError return self.logged_in def logout(self): self.imap.logout() self.logged_in = False def label(self, label_name): return self.mailbox(label_name) def find(self, mailbox_name="[Gmail]/All Mail", **kwargs): box = self.mailbox(mailbox_name) return box.mail(**kwargs) def copy(self, uid, to_mailbox, from_mailbox=None): if from_mailbox: self.use_mailbox(from_mailbox) self.imap.uid('COPY', uid, to_mailbox) def fetch_multiple_messages(self, messages): fetch_str = ','.join(messages.keys()) response, results = self.imap.uid('FETCH', fetch_str, '(BODY.PEEK[] FLAGS X-GM-THRID X-GM-MSGID X-GM-LABELS)') for index in xrange(len(results) - 1): raw_message = results[index] if re.search(r'UID (\d+)', raw_message[0]): uid = re.search(r'UID (\d+)', raw_message[0]).groups(1)[0] messages[uid].parse(raw_message) return messages def labels(self, require_unicode=False): keys = self.mailboxes.keys() if require_unicode: keys = [decode_utf7(key) for key in keys] return keys def inbox(self): return self.mailbox("INBOX") def spam(self): return self.mailbox("[Gmail]/Spam") def starred(self): return self.mailbox("[Gmail]/Starred") def all_mail(self): return self.mailbox("[Gmail]/All Mail") def sent_mail(self): return self.mailbox("[Gmail]/Sent Mail") def important(self): return self.mailbox("[Gmail]/Important") def mail_domain(self): return self.username.split('@')[-1]
0
qxf2_public_repos/interview-scheduler/QA/utils
qxf2_public_repos/interview-scheduler/QA/utils/gmail/utils.py
from .gmail import Gmail def login(username, password): gmail = Gmail() gmail.login(username, password) return gmail def authenticate(username, access_token): gmail = Gmail() gmail.authenticate(username, access_token) return gmail
0
qxf2_public_repos/interview-scheduler/QA/utils
qxf2_public_repos/interview-scheduler/QA/utils/gmail/mailbox.py
from .message import Message from .utf import encode as encode_utf7, decode as decode_utf7 class Mailbox(): def __init__(self, gmail, name="INBOX"): self.name = name self.gmail = gmail self.date_format = "%d-%b-%Y" self.messages = {} @property def external_name(self): if "external_name" not in vars(self): vars(self)["external_name"] = encode_utf7(self.name) return vars(self)["external_name"] @external_name.setter def external_name(self, value): if "external_name" in vars(self): del vars(self)["external_name"] self.name = decode_utf7(value) def mail(self, prefetch=False, **kwargs): search = ['ALL'] kwargs.get('read') and search.append('SEEN') kwargs.get('unread') and search.append('UNSEEN') kwargs.get('starred') and search.append('FLAGGED') kwargs.get('unstarred') and search.append('UNFLAGGED') kwargs.get('deleted') and search.append('DELETED') kwargs.get('undeleted') and search.append('UNDELETED') kwargs.get('draft') and search.append('DRAFT') kwargs.get('undraft') and search.append('UNDRAFT') kwargs.get('before') and search.extend(['BEFORE', kwargs.get('before').strftime(self.date_format)]) kwargs.get('after') and search.extend(['SINCE', kwargs.get('after').strftime(self.date_format)]) kwargs.get('on') and search.extend(['ON', kwargs.get('on').strftime(self.date_format)]) kwargs.get('header') and search.extend(['HEADER', kwargs.get('header')[0], kwargs.get('header')[1]]) kwargs.get('sender') and search.extend(['FROM', kwargs.get('sender')]) kwargs.get('fr') and search.extend(['FROM', kwargs.get('fr')]) kwargs.get('to') and search.extend(['TO', kwargs.get('to')]) kwargs.get('cc') and search.extend(['CC', kwargs.get('cc')]) kwargs.get('subject') and search.extend(['SUBJECT', kwargs.get('subject')]) kwargs.get('body') and search.extend(['BODY', kwargs.get('body')]) kwargs.get('label') and search.extend(['X-GM-LABELS', kwargs.get('label')]) kwargs.get('attachment') and search.extend(['HAS', 'attachment']) kwargs.get('query') and search.extend([kwargs.get('query')]) emails = [] # print search response, data = self.gmail.imap.uid('SEARCH', *search) if response == 'OK': uids = filter(None, data[0].split(' ')) # filter out empty strings for uid in uids: if not self.messages.get(uid): self.messages[uid] = Message(self, uid) emails.append(self.messages[uid]) if prefetch and emails: messages_dict = {} for email in emails: messages_dict[email.uid] = email self.messages.update(self.gmail.fetch_multiple_messages(messages_dict)) return emails # WORK IN PROGRESS. NOT FOR ACTUAL USE def threads(self, prefetch=False, **kwargs): emails = [] response, data = self.gmail.imap.uid('SEARCH', 'ALL') if response == 'OK': uids = data[0].split(' ') for uid in uids: if not self.messages.get(uid): self.messages[uid] = Message(self, uid) emails.append(self.messages[uid]) if prefetch: fetch_str = ','.join(uids) response, results = self.gmail.imap.uid('FETCH', fetch_str, '(BODY.PEEK[] FLAGS X-GM-THRID X-GM-MSGID X-GM-LABELS)') for index in xrange(len(results) - 1): raw_message = results[index] if re.search(r'UID (\d+)', raw_message[0]): uid = re.search(r'UID (\d+)', raw_message[0]).groups(1)[0] self.messages[uid].parse(raw_message) return emails def count(self, **kwargs): return len(self.mail(**kwargs)) def cached_messages(self): return self.messages
0
qxf2_public_repos/interview-scheduler/QA/utils
qxf2_public_repos/interview-scheduler/QA/utils/gmail/exceptions.py
# -*- coding: utf-8 -*- """ gmail.exceptions ~~~~~~~~~~~~~~~~~~~ This module contains the set of Gmails' exceptions. """ class GmailException(RuntimeError): """There was an ambiguous exception that occurred while handling your request.""" class ConnectionError(GmailException): """A Connection error occurred.""" class AuthenticationError(GmailException): """Gmail Authentication failed.""" class Timeout(GmailException): """The request timed out."""
0
qxf2_public_repos/interview-scheduler/QA/utils
qxf2_public_repos/interview-scheduler/QA/utils/gmail/utf.py
# The contents of this file has been derived code from the Twisted project # (http://twistedmatrix.com/). The original author is Jp Calderone. # Twisted project license follows: # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. text_type = unicode binary_type = str PRINTABLE = set(range(0x20, 0x26)) | set(range(0x27, 0x7f)) def encode(s): """Encode a folder name using IMAP modified UTF-7 encoding. Despite the function's name, the output is still a unicode string. """ if not isinstance(s, text_type): return s r = [] _in = [] def extend_result_if_chars_buffered(): if _in: r.extend(['&', modified_utf7(''.join(_in)), '-']) del _in[:] for c in s: if ord(c) in PRINTABLE: extend_result_if_chars_buffered() r.append(c) elif c == '&': extend_result_if_chars_buffered() r.append('&-') else: _in.append(c) extend_result_if_chars_buffered() return ''.join(r) def decode(s): """Decode a folder name from IMAP modified UTF-7 encoding to unicode. Despite the function's name, the input may still be a unicode string. If the input is bytes, it's first decoded to unicode. """ if isinstance(s, binary_type): s = s.decode('latin-1') if not isinstance(s, text_type): return s r = [] _in = [] for c in s: if c == '&' and not _in: _in.append('&') elif c == '-' and _in: if len(_in) == 1: r.append('&') else: r.append(modified_deutf7(''.join(_in[1:]))) _in = [] elif _in: _in.append(c) else: r.append(c) if _in: r.append(modified_deutf7(''.join(_in[1:]))) return ''.join(r) def modified_utf7(s): # encode to utf-7: '\xff' => b'+AP8-', decode from latin-1 => '+AP8-' s_utf7 = s.encode('utf-7').decode('latin-1') return s_utf7[1:-1].replace('/', ',') def modified_deutf7(s): s_utf7 = '+' + s.replace(',', '/') + '-' # encode to latin-1: '+AP8-' => b'+AP8-', decode from utf-7 => '\xff' return s_utf7.encode('latin-1').decode('utf-7')
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/index_page.py
""" This class models the main Selenium tutorial page. URL: selenium-tutorial-main The page consists of a header, footer, form and table objects """ from page_objects.Base_Page import Base_Page from page_objects.index_object import Index_Object class Index_Page(Base_Page, Index_Object): "Page Object for the tutorial's main page" def start(self): "Use this method to go to specific URL -- if needed" url = '/' self.open(url)
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/Base_Page.py
""" Page class that all page models can inherit from There are useful wrappers for common Selenium operations """ from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.action_chains import ActionChains import unittest,time,logging,os,inspect,pytest from utils.Base_Logging import Base_Logging from inspect import getargspec from utils.BrowserStack_Library import BrowserStack_Library from .DriverFactory import DriverFactory from page_objects import PageFactory from utils import Tesults from utils.stop_test_exception_util import Stop_Test_Exception import conf.remote_credentials import conf.base_url_conf from utils import Gif_Maker class Borg: #The borg design pattern is to share state #Src: http://code.activestate.com/recipes/66531/ __shared_state = {} def __init__(self): self.__dict__ = self.__shared_state def is_first_time(self): "Has the child class been invoked before?" result_flag = False if len(self.__dict__)==0: result_flag = True return result_flag # Get the Base URL from the conf file base_url = conf.base_url_conf class Base_Page(Borg,unittest.TestCase): "Page class that all page models can inherit from" def __init__(self,base_url): "Constructor" Borg.__init__(self) if self.is_first_time(): #Do these actions if this the first time this class is initialized self.set_directory_structure() self.image_url_list = [] self.msg_list = [] self.current_console_log_errors = [] self.window_structure = {} self.testrail_flag = False self.tesults_flag = False self.images = [] self.browserstack_flag = False self.highlight_flag = False self.test_run_id = None self.reset() self.base_url = base_url self.driver_obj = DriverFactory() if self.driver is not None: self.start() #Visit and initialize xpaths for the appropriate page def reset(self): "Reset the base page object" self.driver = None self.calling_module = None self.result_counter = 0 #Increment whenever success or failure are called self.pass_counter = 0 #Increment everytime success is called self.mini_check_counter = 0 #Increment when conditional_write is called self.mini_check_pass_counter = 0 #Increment when conditional_write is called with True self.failure_message_list = [] self.screenshot_counter = 1 self.exceptions = [] self.gif_file_name = None def turn_on_highlight(self): "Highlight the elements being operated upon" self.highlight_flag = True def turn_off_highlight(self): "Turn off the highlighting feature" self.highlight_flag = False def get_failure_message_list(self): "Return the failure message list" return self.failure_message_list def switch_page(self,page_name): "Switch the underlying class to the required Page" self.__class__ = PageFactory.PageFactory.get_page_object(page_name,base_url=self.base_url).__class__ def register_driver(self,setup_db,remote_flag,os_name,os_version,browser,browser_version,remote_project_name,remote_build_name): "Register the driver with Page" self.set_screenshot_dir(os_name,os_version,browser,browser_version) # Create screenshot directory self.set_log_file() self.driver = self.driver_obj.get_web_driver(remote_flag,os_name,os_version,browser,browser_version,remote_project_name,remote_build_name) self.driver.implicitly_wait(5) self.driver.maximize_window() if conf.remote_credentials.REMOTE_BROWSER_PLATFORM == 'BS' and remote_flag.lower() == 'y': self.register_browserstack() self.session_url = self.browserstack_obj.get_session_url() self.browserstack_msg = 'BrowserStack session URL:' self.write( self.browserstack_msg + '\n' + str(self.session_url)) self.start() def get_current_driver(self): "Return current driver" return self.driver def register_testrail(self): "Register TestRail with Page" self.testrail_flag = True self.tr_obj = Test_Rail() def set_test_run_id(self,test_run_id): "Set TestRail's test run id" self.test_run_id = test_run_id def register_tesults(self): "Register Tesults with Page" self.tesults_flag = True def register_browserstack(self): "Register Browser Stack with Page" self.browserstack_flag = True self.browserstack_obj = BrowserStack_Library() def set_calling_module(self,name): "Set the test name" self.calling_module = name def get_calling_module(self): "Get the name of the calling module" if self.calling_module is None: #Try to intelligently figure out name of test when not using pytest full_stack = inspect.stack() index = -1 for stack_frame in full_stack: print(stack_frame[1],stack_frame[3]) #stack_frame[1] -> file name #stack_frame[3] -> method if 'test_' in stack_frame[1]: index = full_stack.index(stack_frame) break test_file = full_stack[index][1] test_file = test_file.split(os.sep)[-1] testname = test_file.split('.py')[0] self.set_calling_module(testname) return self.calling_module def set_directory_structure(self): "Setup the required directory structure if it is not already present" try: self.screenshots_parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','screenshots')) if not os.path.exists(self.screenshots_parent_dir): os.makedirs(self.screenshots_parent_dir) self.logs_parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','log')) if not os.path.exists(self.logs_parent_dir): os.makedirs(self.logs_parent_dir) except Exception as e: self.write("Exception when trying to set directory structure") self.write(str(e)) self.exceptions.append("Error when setting up the directory structure") def set_screenshot_dir(self,os_name,os_version,browser,browser_version): "Set the screenshot directory" try: self.screenshot_dir = self.get_screenshot_dir(os_name,os_version,browser,browser_version,overwrite_flag=True) if not os.path.exists(self.screenshot_dir): os.makedirs(self.screenshot_dir) except Exception as e: self.write("Exception when trying to set screenshot directory") self.write(str(e)) self.exceptions.append("Error when setting up the screenshot directory") def get_screenshot_dir(self,os_name,os_version,browser,browser_version,overwrite_flag=False): "Get the name of the test" if os_name == 'OS X': os_name = 'OS_X' if isinstance(os_name,list): windows_browser_combination = browser.lower() else: windows_browser_combination = os_name.lower() + '_' + str(os_version).lower() + '_' + browser.lower()+ '_' + str(browser_version) self.testname = self.get_calling_module() self.testname =self.testname.replace('<','') self.testname =self.testname.replace('>','') self.testname = self.testname + '[' + str(windows_browser_combination)+ ']' self.screenshot_dir = self.screenshots_parent_dir + os.sep + self.testname if os.path.exists(self.screenshot_dir) and overwrite_flag is True: for i in range(1,4096): if os.path.exists(self.screenshot_dir + '_'+str(i)): continue else: os.rename(self.screenshot_dir,self.screenshot_dir +'_'+str(i)) break return self.screenshot_dir def set_log_file(self): 'set the log file' self.log_name = self.testname + '.log' self.log_obj = Base_Logging(log_file_name=self.log_name,level=logging.DEBUG) def append_latest_image(self,screenshot_name): "Get image url list from Browser Stack" screenshot_url = self.browserstack_obj.get_latest_screenshot_url() image_dict = {} image_dict['name'] = screenshot_name image_dict['url'] = screenshot_url self.image_url_list.append(image_dict) def save_screenshot_reportportal(self,image_name): "Method to save image to ReportPortal" try: rp_logger = self.log_obj.setup_rp_logging() with open(image_name, "rb") as fh: image = fh.read() rp_logger.info( image_name, attachment={ "data": image, "mime": "application/octet-stream" }, ) except Exception as e: self.write("Exception when trying to get rplogger") self.write(str(e)) self.exceptions.append("Error when trying to get reportportal logger") def save_screenshot(self,screenshot_name,pre_format=" #Debug screenshot: "): "Take a screenshot" if os.path.exists(self.screenshot_dir + os.sep + screenshot_name+'.png'): for i in range(1,100): if os.path.exists(self.screenshot_dir + os.sep +screenshot_name+'_'+str(i)+'.png'): continue else: os.rename(self.screenshot_dir + os.sep +screenshot_name+'.png',self.screenshot_dir + os.sep +screenshot_name+'_'+str(i)+'.png') break screenshot_name = self.screenshot_dir + os.sep + screenshot_name+'.png' self.driver.get_screenshot_as_file(screenshot_name) #self.conditional_write(flag=True,positive= screenshot_name + '.png',negative='', pre_format=pre_format) if hasattr(pytest,'config'): if pytest.config._config.getoption('--reportportal'): self.save_screenshot_reportportal(screenshot_name) if self.browserstack_flag is True: self.append_latest_image(screenshot_name) if self.tesults_flag is True: self.images.append(screenshot_name) def open(self,url,wait_time=2): "Visit the page base_url + url" if self.base_url[-1] != '/' and url[0] != '/': url = '/' + url if self.base_url[-1] == '/' and url[0] == '/': url = url[1:] url = self.base_url + url if self.driver.current_url != url: self.driver.get(url) self.wait(wait_time) def open_url_new_tab(self,url,wait_time=2): "Visit the page base_url + url" self.driver.get(url) self.wait(wait_time) def get_current_url(self): "Get the current URL" return self.driver.current_url def get_page_title(self): "Get the current page title" return self.driver.title def get_page_paths(self,section): "Open configurations file,go to right sections,return section obj" pass def get_current_window_handle(self): "Return the latest window handle" return self.driver.current_window_handle def set_window_name(self,name): "Set the name of the current window name" try: window_handle = self.get_current_window_handle() self.window_structure[window_handle] = name except Exception as e: self.write("Exception when trying to set windows name") self.write(str(e)) self.exceptions.append("Error when setting up the name of the current window") def get_window_by_name(self,window_name): "Return window handle id based on name" window_handle_id = None for id,name in self.window_structure.iteritems(): if name == window_name: window_handle_id = id break return window_handle_id def alert_window(self): try: result_flag = True alert_obj = self.driver.switch_to.alert alert_obj.accept() result_flag = True except Exception as e: self.write("Exception when trying to alert window") self.write(str(e)) self.exceptions.append("Error when switching browser window") return result_flag def switch_window(self,name=None): "Make the driver switch to the last window or a window with a name" result_flag = False try: if name is not None: window_handle_id = self.get_window_by_name(name) else: window_handle_id = self.driver.window_handles[-1] if window_handle_id is not None: self.driver.switch_to.window(window_handle_id) result_flag = True self.conditional_write(result_flag, 'Automation switched to the browser window: %s'%name, 'Unable to locate and switch to the window with name: %s'%name, level='debug') except Exception as e: self.write("Exception when trying to switch window") self.write(str(e)) self.exceptions.append("Error when switching browser window") return result_flag def close_current_window(self): "Close the current window" result_flag = False try: before_window_count = len(self.get_window_handles()) self.driver.close() after_window_count = len(self.get_window_handles()) if (before_window_count - after_window_count) == 1: result_flag = True except Exception as e: self.write('Could not close the current window') self.write(str(e)) self.exceptions.append("Error when trying to close the current window") return result_flag def get_window_handles(self): "Get the window handles" return self.driver.window_handles def switch_frame(self,name=None,index=None,wait_time=2): "switch to iframe" self.wait(wait_time) self.driver.switch_to.default_content() if name is not None: self.driver.switch_to.frame(name) elif index is not None: self.driver.switch_to.frame(self.driver.find_elements_by_tag_name("iframe")[index]) def _get_locator(key): "fetches locator from the locator conf" value = None try: path_conf_file = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'conf', 'locators.conf')) if path_conf_file is not None: value = Conf_Reader.get_value(path_conf_file, key) except Exception as e: print (str(e)) self.exceptions.append("Error when fetching locator from the locator.conf") return value def get_element_attribute_value(self,element,attribute_name): "Return the elements attribute value if present" attribute_value = None if (hasattr(element,attribute_name)): attribute_value = element.get_attribute(attribute_name) return attribute_value def highlight_element(self,element,wait_seconds=3): "Highlights a Selenium webdriver element" original_style = self.get_element_attribute_value(element,'style') self.apply_style_to_element(element,"border: 4px solid #F6F7AD;") self.wait(wait_seconds) self.apply_style_to_element(element,original_style) def highlight_elements(self,elements,wait_seconds=3): "Highlights a group of elements" original_styles = [] for element in elements: original_styles.append(self.get_element_attribute_value(element,'style')) self.apply_style_to_element(element,"border: 4px solid #F6F7AD;") self.wait(wait_seconds) for style,element in zip(original_styles, elements) : self.apply_style_to_element(element,style) def apply_style_to_element(self,element,element_style): self.driver.execute_script("arguments[0].setAttribute('style', arguments[1])", element, element_style) def get_element(self,locator,verbose_flag=True): "Return the DOM element of the path or 'None' if the element is not found " dom_element = None try: locator = self.split_locator(locator) dom_element = self.driver.find_element(*locator) if self.highlight_flag is True: self.highlight_element(dom_element) except Exception as e: if verbose_flag is True: self.write(str(e),'debug') self.write("Check your locator-'%s,%s' in the conf/locators.conf file" %(locator[0],locator[1])) self.exceptions.append("Check your locator-'%s,%s' in the conf/locators.conf file" %(locator[0],locator[1])) return dom_element def split_locator(self,locator): "Split the locator type and locator" result = () try: result = tuple(locator.split(',',1)) except Exception as e: self.write("Error while parsing locator") self.exceptions.append("Unable to split the locator-'%s' in the conf/locators.conf file"%(locator[0],locator[1])) return result def get_elements(self,locator,msg_flag=True): "Return a list of DOM elements that match the locator" dom_elements = [] try: locator = self.split_locator(locator) dom_elements = self.driver.find_elements(*locator) if self.highlight_flag is True: self.highlight_elements(dom_elements) except Exception as e: if msg_flag==True: self.write(str(e),'debug') self.write("Check your locator-'%s,%s' in the conf/locators.conf file" %(locator[0],locator[1])) self.exceptions.append("Unable to locate the element with the xpath -'%s,%s' in the conf/locators.conf file"%(locator[0],locator[1])) return dom_elements def click_element(self,locator,wait_time=3): "Click the button supplied" result_flag = False try: link = self.get_element(locator) if link is not None: link.click() result_flag=True self.wait(wait_time) except Exception as e: self.write(str(e),'debug') self.write('Exception when clicking link with path: %s'%locator) self.exceptions.append("Error when clicking the element with path,'%s' in the conf/locators.conf file"%locator) return result_flag def set_text(self,locator,value,clear_flag=True): "Set the value of the text field" text_field = None try: text_field = self.get_element(locator) if text_field is not None and clear_flag is True: try: text_field.clear() except Exception as e: self.write(str(e),'debug') self.exceptions.append("Could not clear the text field- '%s' in the conf/locators.conf file"%locator) except Exception as e: self.write("Check your locator-'%s,%s' in the conf/locators.conf file" %(locator[0],locator[1])) result_flag = False if text_field is not None: try: text_field.send_keys(value) result_flag = True except Exception as e: self.write('Could not write to text field: %s'%locator,'debug') self.write(str(e),'debug') self.exceptions.append("Could not write to text field- '%s' in the conf/locators.conf file"%locator) return result_flag def get_text(self,locator): "Return the text for a given path or the 'None' object if the element is not found" text = '' try: text = self.get_element(locator).text print(text) except Exception as e: self.write(e) self.exceptions.append("Error when getting text from the path-'%s' in the conf/locators.conf file"%locator) return None else: return text.encode('utf-8') def get_dom_text(self,dom_element): "Return the text of a given DOM element or the 'None' object if the element has no attribute called text" text = None try: text = dom_element.text text = text.encode('utf-8') except Exception as e: self.write(e) self.exceptions.append("Error when getting text from the DOM element-'%s' in the conf/locators.conf file"%locator) return text def select_checkbox(self,locator): "Select a checkbox if not already selected" result_flag = False try: checkbox = self.get_element(locator) if checkbox.is_selected() is False: result_flag = self.toggle_checkbox(locator) else: result_flag = True except Exception as e: self.write(e) self.exceptions.append("Error when selecting checkbox-'%s' in the conf/locators.conf file"%locator) return result_flag def deselect_checkbox(self,locator): "Deselect a checkbox if it is not already deselected" result_flag = False try: checkbox = self.get_element(locator) if checkbox.is_selected() is True: result_flag = self.toggle_checkbox(locator) else: result_flag = True except Exception as e: self.write(e) self.exceptions.append("Error when deselecting checkbox-'%s' in the conf/locators.conf file"%locator) return result_flag unselect_checkbox = deselect_checkbox #alias the method def toggle_checkbox(self,locator): "Toggle a checkbox" try: return self.click_element(locator) except Exception as e: self.write(e) self.exceptions.append("Error when toggling checkbox-'%s' in the conf/locators.conf file"%locator) def select_dropdown_option(self, locator, option_text): "Selects the option in the drop-down" result_flag= False try: dropdown = self.get_element(locator) for option in dropdown.find_elements_by_tag_name('option'): if option.text == option_text: option.click() result_flag = True break except Exception as e: self.write(e) self.exceptions.append("Error when selecting option from the drop-down '%s' "%locator) return result_flag def check_element_present(self,locator): "This method checks if the web element is present in page or not and returns True or False accordingly" result_flag = False if self.get_element(locator,verbose_flag=False) is not None: result_flag = True return result_flag def check_element_displayed(self,locator): "This method checks if the web element is present in page or not and returns True or False accordingly" result_flag = False try: if self.get_element(locator) is not None: element = self.get_element(locator,verbose_flag=False) if element.is_displayed() is True: result_flag = True except Exception as e: self.write(e) self.exceptions.append("Web element not present in the page, please check the locator is correct -'%s' in the conf/locators.conf file"%locator) return result_flag def hit_enter(self,locator,wait_time=2): "Hit enter" try: element = self.get_element(locator) element.send_keys(Keys.ENTER) self.wait(wait_time) except Exception as e: self.write(str(e),'debug') self.exceptions.append("An exception occurred when hitting enter") return None def scroll_down(self,locator,wait_time=2): "Scroll down" try: element = self.get_element(locator) element.send_keys(Keys.PAGE_DOWN) self.wait(wait_time) except Exception as e: self.write(str(e),'debug') self.exceptions.append("An exception occured when scrolling down") return None def hover(self,locator,wait_seconds=2): "Hover over the element" #Note: perform() of ActionChains does not return a bool #So we have no way of returning a bool when hover is called element = self.get_element(locator) action_obj = ActionChains(self.driver) action_obj.move_to_element(element) action_obj.perform() self.wait(wait_seconds) def teardown(self): "Tears down the driver" self.driver.quit() self.reset() def write(self,msg,level='info'): "Log the message" msg = str(msg) self.msg_list.append('%-8s: '%level.upper() + msg) if self.browserstack_flag is True: if self.browserstack_msg not in msg: self.msg_list.pop(-1) #Remove the redundant BrowserStack message self.log_obj.write(msg,level) def report_to_testrail(self,case_id,test_run_id,result_flag,msg=''): "Update Test Rail" if self.testrail_flag is True: msg += '\n'.join(self.msg_list) msg = msg + "\n" if self.browserstack_flag is True: for image in self.image_url_list: msg += '\n' + '[' + image['name'] + ']('+ image['url']+')' msg += '\n\n' + '[' + 'Watch Replay On BrowserStack' + ']('+ self.session_url+')' self.tr_obj.update_testrail(case_id,test_run_id,result_flag,msg=msg) self.image_url_list = [] self.msg_list = [] def add_tesults_case(self, name, desc, suite, result_flag, msg='', files=[], params={}, custom={}): "Update Tesults with test results" if self.tesults_flag is True: result = "unknown" failReason = "" if result_flag == True: result = "pass" if result_flag == False: result = "fail" failReason = msg for image in self.images: files.append(self.screenshot_dir + os.sep + image + '.png') self.images = [] caseObj = {'name': name, 'suite': suite, 'desc': desc, 'result': result, 'reason': failReason, 'files': files, 'params': params} for key, value in custom.items(): caseObj[key] = str(value) Tesults.add_test_case(caseObj) def make_gif(self): "Create a gif of all the screenshots within the screenshots directory" self.gif_file_name = Gif_Maker.make_gif(self.screenshot_dir,name=self.calling_module) return self.gif_file_name def wait(self,wait_seconds=5,locator=None): "Performs wait for time provided" if locator is not None: self.smart_wait(wait_seconds,locator) else: time.sleep(wait_seconds) def smart_wait(self,wait_seconds,locator): "Performs an explicit wait for a particular element" result_flag = False try: path = self.split_locator(locator) WebDriverWait(self.driver, wait_seconds).until(EC.presence_of_element_located(path)) result_flag =True except Exception as e: self.conditional_write(result_flag, positive='Located the element: %s'%locator, negative='Could not locate the element %s even after %.1f seconds'%(locator,wait_seconds)) return result_flag def success(self,msg,level='info',pre_format='PASS: '): "Write out a success message" if level.lower() == 'critical': level = 'info' self.log_obj.write(pre_format + msg,level) self.result_counter += 1 self.pass_counter += 1 def failure(self,msg,level='info',pre_format='FAIL: '): "Write out a failure message" self.log_obj.write(pre_format + msg,level) self.result_counter += 1 self.failure_message_list.append(pre_format + msg) if level.lower() == 'critical': self.teardown() raise Stop_Test_Exception("Stopping test because: "+ msg) def log_result(self,flag,positive,negative,level='info'): "Write out the result of the test" if level.lower() == "inverse": if flag is True: self.failure(positive,level="error") else: self.success(negative,level="info") else: if flag is True: self.success(positive,level=level) else: self.failure(negative,level=level) def read_browser_console_log(self): "Read Browser Console log" log = None try: log = self.driver.get_log('browser') return log except Exception as e: self.write("Exception when reading Browser Console log") self.write(str(e)) return log def conditional_write(self,flag,positive,negative,level='info'): "Write out either the positive or the negative message based on flag" self.mini_check_counter += 1 if level.lower() == "inverse": if flag is True: self.write(positive,level='error') else: self.write(negative,level='info') self.mini_check_pass_counter += 1 else: if flag is True: self.write(positive,level='info') self.mini_check_pass_counter += 1 else: self.write(negative,level='error') def execute_javascript(self,js_script,*args): "Execute javascipt" try: self.driver.execute_script(js_script) result_flag = True except Exception as e: result_flag = False return result_flag def write_test_summary(self): "Print out a useful, human readable summary" self.write('\n\n************************\n--------RESULT--------\nTotal number of checks=%d'%self.result_counter) self.write('Total number of checks passed=%d\n----------------------\n************************\n\n'%self.pass_counter) self.write('Total number of mini-checks=%d'%self.mini_check_counter) self.write('Total number of mini-checks passed=%d'%self.mini_check_pass_counter) failure_message_list = self.get_failure_message_list() if len(failure_message_list) > 0: self.write('\n--------FAILURE SUMMARY--------\n') for msg in failure_message_list: self.write(msg) if len(self.exceptions) > 0: self.exceptions = list(set(self.exceptions)) self.write('\n--------USEFUL EXCEPTION--------\n') for (i,msg) in enumerate(self.exceptions,start=1): self.write(str(i)+"- " + msg) self.make_gif() if self.gif_file_name is not None: self.write("Screenshots & GIF created at %s"%self.screenshot_dir) self.write('************************') def start(self): "Overwrite this method in your Page module if you want to visit a specific URL" pass _get_locator = staticmethod(_get_locator)
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/interview_schedule_object.py
""" This class models the interview schedule on candidate side The form consists of scheduling an interview,checking google link """ import os import sys import email import datetime from datetime import datetime, timedelta from bs4 import BeautifulSoup import conf.locators_conf as locators from utils.Wrapit import Wrapit from utils.email_util import Email_Util import conf.email_conf as conf_file from conf import login_conf as login from .Base_Page import Base_Page sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) #Fetching conf details from the conf and login file imap_host = conf_file.imaphost username = conf_file.username password = conf_file.app_password email = login.email_candidates date_picker = login.date_picker date_check = login.date_check free_slot = login.free_slot email_on_link = login.email_on_link password_link = login.password_link N_DAYS_After = 7 class Interview_Schedule_Object: "Page Object for Scheduling an interview" #locators select_url = locators.select_url select_unique_code = locators.select_unique_code select_candidate_email = locators.select_candidate_email go_for_schedule = locators.go_for_schedule date_picker = locators.date_picker confirm_interview_date = locators.confirm_interview_date select_free_slot = locators.select_free_slot schedule_my_interview = locators.schedule_my_interview date_on_calendar = locators.date_on_calendar calendar_link = locators.calendar_link google_meet_link = locators.google_meet_link email_on_link = locators.email_on_link next_button = locators.next_button next_button_after_password = locators.next_button_after_password password_link = locators.password_link url = "abcd" unique_code = 0 @Wrapit._exceptionHandler @Wrapit._screenshot def fetch_email_invite(self): "Get email contents and fetch URL and unique code and schedule an interview" imap_host = conf_file.imaphost username = conf_file.username password = conf_file.app_password unique_code = 0 email_obj = Email_Util() #Connect to the IMAP host email_obj.connect(imap_host) result_flag = email_obj.login(username, password) self.conditional_write(result_flag, positive='Logged into %s' % imap_host, negative='Could not log into %s to fetch the activation email' % imap_host, level='debug') self.wait(30) if result_flag is True: result_flag = email_obj.select_folder('Inbox') self.conditional_write(result_flag, positive='Selected the folder Inbox', negative='Could not select the folder Inbox', level='critical') uid = email_obj.get_latest_email_uid(subject="Invitation to schedule an Interview with Qxf2 Services!", sender='careers@qxf2.com', wait_time=20) email_body = email_obj.fetch_email_body(uid) soup = BeautifulSoup(''.join(email_body), 'html.parser') unique_code = soup.b.text url = soup.a.get('href') result_flag = self.open_invitation_url(url) result_flag = self.set_unique_code(unique_code) result_flag = self.set_candidate_email(email) result_flag = self.click_interview_schedule() result_flag = self.get_the_date() result_flag = self.set_the_date() result_flag = self.confirm_the_date() result_flag = self.scroll_down_page() result_flag = self.slot_selection() result_flag = self.scheduling_interview() result_flag = self.checking_interview_meet_link() return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def open_invitation_url(self, url): "Open invitation url in new tab" print(self.url) result_flag = self.open_url_new_tab(self.url) self.conditional_write(result_flag, positive='Opened the new tab with link', negative='Failed to open the new tab with link', level='critical') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_unique_code(self, unique_code): "Setting unique code on url invitation" result_flag = self.set_text(self.select_unique_code, unique_code) self.conditional_write(result_flag, positive='Set unique code to: %s'% unique_code, negative='Failed to set the unique code', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_candidate_email(self, email): "Setting email on url invitation" result_flag = self.set_text(self.select_candidate_email, email) self.conditional_write(result_flag, positive='Set candidate email to: %s'% email, negative='Failed to set the email', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def click_interview_schedule(self): "Click on INterview Schedule button" result_flag = self.click_element(self.go_for_schedule) self.conditional_write(result_flag, positive='Clicked on Scheduling interview button', negative='Failed to click on Scheduling interview button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def get_the_date(self): " Getting the date on calendar" result_flag = self.click_element(self.date_picker) self.conditional_write(result_flag, positive='Get the date', negative='Failed to get the date', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_the_date(self): "Setting the date on calendar" date = datetime.now() date = date + timedelta(days=N_DAYS_After) self.date = date.day result_flag = self.click_element(self.date_on_calendar%self.date) self.conditional_write(result_flag, positive='Set the date', negative='Failed to set the date', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def confirm_the_date(self): "Confirm the date" result_flag = self.click_element(self.confirm_interview_date) self.conditional_write(result_flag, positive='Clicked on confirming interview date', negative='Failed to click on confirming interview date', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def scroll_down_page(self): "Scrolling down the page to show all available time slots for an interview" result_flag = self.scroll_down(self.confirm_interview_date) self.conditional_write(result_flag, positive='Scrolling down the page till Schedule my interview option', negative='Failed to scroll down the page till schedule my interview option', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def slot_selection(self): "Select the interview slot" result_flag = self.click_element(self.select_free_slot) self.conditional_write(result_flag, positive='Selected free interview slot', negative='Failed to select free interview slot', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def scheduling_interview(self): "Schedule an interview" result_flag = self.click_element(self.schedule_my_interview) self.conditional_write(result_flag, positive='Clicked on schedule my interview', negative='Failed to click on schedule my interview', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def click_calendar_link(self): "Click on calendar link on confirmation page" self.wait(5) result_flag = self.click_element(self.calendar_link) self.conditional_write(result_flag, positive='Clicked on calendar link', negative='Failed to click on calendar link', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_the_email(self, email_on_link): "set email to check google link" self.wait(2) self.switch_window() result_flag = self.set_text(self.email_on_link, email_on_link) self.conditional_write(result_flag, positive='Set email to: %s'% email_on_link, negative='Failed to set the email', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def click_next_button(self): "Click next button" result_flag = self.click_element(self.next_button) self.conditional_write(result_flag, positive='Clicked on Next', negative='Failed to click on Next', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_the_password_link(self, password_link): "Set password on link" self.wait(5) result_flag = self.set_text(self.password_link, password_link) self.conditional_write(result_flag, positive='Set password to: %s'% password_link, negative='Failed to set the password', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def click_next_after_password(self): "Click on next button after password" result_flag = self.click_element(self.next_button_after_password) self.conditional_write(result_flag, positive='Clicked on Next', negative='Failed to click on Next', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def click_google_meet_link(self): "Click on google link" result_flag = self.click_element(self.google_meet_link) self.conditional_write(result_flag, positive='Clicked on Google meet link', negative='Failed to click on Google meet link', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def alert_accept(self): "Click on 'Ok' alert" result_flag = self.alert_window() return result_flag self.conditional_write(result_flag, positive='Clicked on the OK', negative='Failed to click on OK', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def checking_interview_meet_link(self): "Scheduling an interview by candidate" result_flag = self.click_calendar_link() result_flag = self.set_the_email(email_on_link) result_flag = self.click_next_button() result_flag = self.set_the_password_link(password_link) result_flag = self.click_next_after_password() result_flag = self.click_google_meet_link() return result_flag
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/zero_page.py
""" This class models the first dummy page needed by the framework to start. URL: None Please do not modify or delete this page """ from .Base_Page import Base_Page class Zero_Page(Base_Page): "Page Object for the dummy page" def start(self): "Use this method to go to specific URL -- if needed" pass
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/rounds_object.py
""" This class models the form on the Selenium tutorial page The form consists of some input fields, a dropdown, a checkbox and a button """ from .Base_Page import Base_Page import conf.locators_conf as locators from utils.Wrapit import Wrapit class Rounds_Object: "Page object for the Rounds" #locators specific_round_add = locators.specific_round_add add_rounds_button = locators.add_rounds_button round_name = locators.round_name round_duration = locators.round_duration round_duration_select = locators.round_duration_select round_description = locators.round_description round_requirements = locators.round_requirements add_button = locators.add_button cancel_rounds_button = locators.cancel_rounds_button @Wrapit._exceptionHandler @Wrapit._screenshot def round_to_job(self): "Click on Add Rounds button" result_flag = self.click_element(self.specific_round_add) self.conditional_write(result_flag, positive='Clicked on the Add Rounds button', negative='Failed to click on Add Rounds button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_rounds(self): "Click on Add Rounds button" result_flag = self.click_element(self.add_rounds_button) self.conditional_write(result_flag, positive='Clicked on the Add Rounds button', negative='Failed to click on Add Rounds button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_name(self,round_name): "Set the name for round" result_flag = self.set_text(self.round_name,round_name) self.conditional_write(result_flag, positive='Set the round name to: %s'% round_name, negative='Failed to set the name', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_duration(self,round_duration_select,wait_seconds=1): "Set the duration of round" result_flag = self.click_element(self.round_duration) self.wait(wait_seconds) result_flag = self.click_element(self.round_duration_select%round_duration_select) self.conditional_write(result_flag, positive='Set the round duration to: %s'%round_duration_select, negative='Failed to set the round duration', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_description(self,round_description): "Set the description" result_flag = self.set_text(self.round_description,round_description) self.conditional_write(result_flag, positive='Set the email to: %s'%round_description, negative='Failed to set the email in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_requirements(self,round_requirements): "Set the requirements" result_flag = self.set_text(self.round_requirements,round_requirements) self.conditional_write(result_flag, positive='Set the comments to: %s'%round_requirements, negative='Failed to set comments', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def click_add_button(self): "Click on Add button" result_flag = self.click_element(self.add_button) self.conditional_write(result_flag, positive='Clicked on the Add button', negative='Failed to click on Add button', level='debug') result_flag = self.alert_accept() return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def alert_accept(self): "Click on 'Ok' alert" result_flag = self.alert_window() return result_flag self.conditional_write(result_flag, positive='Clicked on the OK', negative='Failed to click on OK', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_round_details(self,round_name,round_duration_select,round_description,round_requirements): "Add round details" result_flag = self.add_name(round_name) result_flag &= self.add_duration(round_duration_select) result_flag &= self.add_description(round_description) result_flag &= self.add_requirements(round_requirements) result_flag &= self.click_add_button() return result_flag
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/interviewers_object.py
""" This class models the form on the Selenium tutorial page The form consists of some input fields, a dropdown, a checkbox and a button """ import conf.locators_conf as locators from utils.Wrapit import Wrapit from .Base_Page import Base_Page class Interviewers_Object: "Page object for the Form" #locators add_interviewers_button = locators.add_interviewers_button interviewers_name = locators.interviewers_name interviewers_email = locators.interviewers_email interviewers_designation = locators.interviewers_designation interviewers_starttime = locators.interviewers_starttime interviewers_starttime_drop = locators.interviewers_starttime_drop interviewers_endtime = locators.interviewers_endtime interviewers_endtime_drop = locators.interviewers_endtime_drop add_time_button = locators.add_time_button save_interviewers_button = locators.save_interviewers_button cancel_interviewers_button = locators.cancel_interviewers_button close_interviewers_button = locators.close_interviewers_button delete_interviewers_button = locators.delete_interviewers_button remove_interviewers_button = locators.remove_interviewers_button search_option_interviewer = locators.search_option @Wrapit._exceptionHandler @Wrapit._screenshot def add_interviewer(self): "Click on 'Add Interviewers' button" result_flag = self.click_element(self.add_interviewers_button) self.conditional_write(result_flag, positive='Clicked on the "Add Interviewers" button', negative='Failed to click on "Add Interviewers" button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_name(self, interviewers_name): "Set the name on the form" result_flag = self.set_text(self.interviewers_name, interviewers_name) self.conditional_write(result_flag, positive='Set the name to: %s'% interviewers_name, negative='Failed to set the name in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def alert_accept(self): "Click on 'Ok' alert" result_flag = self.alert_window() return result_flag self.conditional_write(result_flag, positive='Clicked on the OK', negative='Failed to click on OK', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_email(self, interviewers_email): "Set the email" result_flag = self.set_text(self.interviewers_email, interviewers_email) self.conditional_write(result_flag, positive='Set the email to: %s'% interviewers_email, negative='Failed to set the email in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_designation(self, interviewers_designation): "Set the designation" result_flag = self.set_text(self.interviewers_designation, interviewers_designation) self.conditional_write(result_flag, positive='Set the designation to: %s'% interviewers_designation, negative='Failed to set the designation in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_starttime(self, interviewers_starttime_drop, wait_seconds=1): "Set the starttime on the form" result_flag = self.click_element(self.interviewers_starttime) self.wait(wait_seconds) result_flag &= self.click_element(self.interviewers_starttime_drop%interviewers_starttime_drop) self.conditional_write(result_flag, positive='Set the start time to: %s'% interviewers_starttime_drop, negative='Failed to set the start time in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_endtime(self, interviewers_endtime_drop, wait_seconds=1): "Set the endtime on the form" result_flag = self.click_element(self.interviewers_endtime) self.wait(wait_seconds) result_flag = self.click_element(self.interviewers_endtime_drop%interviewers_endtime_drop) self.conditional_write(result_flag, positive='Set the end time to: %s'% interviewers_endtime_drop, negative='Failed to set the end time in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_time(self): "Click on 'Add Interviewers' button" result_flag = self.click_element(self.add_time_button) self.conditional_write(result_flag, positive='Clicked on the "Add time" button', negative='Failed to click on "Add time" button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def save_interviewer(self): "Click on 'Save Interviewers' button" result_flag = self.click_element(self.save_interviewers_button) self.conditional_write(result_flag, positive='Clicked on the "Save Interviewers" button', negative='Failed to click on "Save Interviewers" button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def cancel(self): "Click on 'Cancel Interviewers' button" result_flag = self.click_element(self.cancel_interviewers_button) self.conditional_write(result_flag, positive='Clicked on the "Cancel Interviewers" button', negative='Failed to click on "Cancel Interviewers" button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def close_interviewer(self): "Click on 'Close' button" result_flag = self.click_element(self.close_interviewers_button) self.conditional_write(result_flag, positive='Clicked on the ok button', negative='Failed to click on ok button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def delete_interviewers(self): "Click on 'Delete Interviewers' button" result_flag = self.click_element(self.delete_interviewers_button) self.conditional_write(result_flag, positive='Clicked on delete interviewers button', negative='Failed to click on button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def remove_interviewers(self, search_option_interviewer): "Click on 'Delete Interviewers' button" self.search_interviewer(search_option_interviewer) self.delete_interviewers() result_flag = self.click_element(self.remove_interviewers_button) self.conditional_write(result_flag, positive='Clicked on remove interviewers button', negative='Failed to click on button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def search_interviewer(self, search_option_interviewer): "Click on 'Search' button" result_flag = self.set_text(self.search_option_interviewer, search_option_interviewer) self.conditional_write(result_flag, positive='Search for Interviewer name: %s'%search_option_interviewer, negative='Failed to Search for Interviewer name', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_interviewers_details(self, interviewers_name, interviewers_email, interviewers_designation, interviewers_starttime_drop, interviewers_endtime_drop): result_flag = self.set_name(interviewers_name) result_flag &= self.set_email(interviewers_email) result_flag &= self.set_designation(interviewers_designation) result_flag &= self.set_starttime(interviewers_starttime_drop) result_flag &= self.set_endtime(interviewers_endtime_drop) result_flag &= self.save_interviewer() result_flag &= self.close_interviewer() return result_flag
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/form_object.py
""" This class models the form on the Selenium tutorial page The form consists of some input fields, a dropdown, a checkbox and a button """ import sys import os import conf.locators_conf as locators from utils.Wrapit import Wrapit from .Base_Page import Base_Page sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) class Form_Object: "Page object for the Form" #locators username_field = locators.username_field password_field = locators.password_field user_name_field = locators.user_name_field email_field = locators.email_field password_field = locators.password_field confirm_password_field = locators.confirm_password_field login_button = locators.login_button signup_button = locators.signup_button submit_button = locators.submit_button logout_button = locators.logout_button redirect_title = "redirect" @Wrapit._exceptionHandler @Wrapit._screenshot def set_user(self, username): "Set the name on the form" result_flag = self.set_text(self.username_field, username) self.conditional_write(result_flag, positive='Set the name to: %s'%username, negative='Failed to set the name in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_password(self, password): "Set the email on the form" result_flag = self.set_text(self.password_field, password) self.conditional_write(result_flag, positive='Set the password to: %s'%password, negative='Failed to set the password in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def click_login(self): "Click on 'Login' button" result_flag = self.click_element(self.login_button) self.conditional_write(result_flag, positive='Clicked on the "Login" button', negative='Failed to click on "Login" button', level='debug') result_flag = self.alert_accept() return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def alert_accept(self): "Click on 'Ok' alert" result_flag = self.alert_window() return result_flag self.conditional_write(result_flag, positive='Clicked on the OK', negative='Failed to click on OK', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def login_page(self, username, password): "Login Wrapper method" result_flag = self.set_user(username) result_flag &= self.set_password(password) result_flag &= self.click_login() return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def signup(self): "Click on 'Signup' button" result_flag = self.click_element(self.signup_button) self.conditional_write(result_flag, positive='Clicked on the "Signup" button', negative='Failed to click on "Signup" button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_username(self, username): "Set the user name on the registration form" result_flag = self.set_text(self.user_name_field, username) self.conditional_write(result_flag, positive='Set the name to: %s'% username, negative='Failed to set the name in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_email(self, email): "Set the user name on the registration form" result_flag = self.set_text(self.email_field, email) self.conditional_write(result_flag, positive='Set the email to: %s'% email, negative='Failed to set the email in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def enter_password(self, password): "Set the password on the registration form" result_flag = self.set_text(self.password_field, password) self.conditional_write(result_flag, positive='Set the password to: %s'% password, negative='Failed to set the password in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def confirm_password(self, password): "Set the confirm password on the registration form" result_flag = self.set_text(self.confirm_password_field, password) self.conditional_write(result_flag, positive='Set the confirm password to: %s'% password, negative='Failed to set the confirm password in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def submit(self): "Click on 'Submit' button" result_flag = self.click_element(self.submit_button) self.conditional_write(result_flag, positive='Clicked on the "Submit" button', negative='Failed to click on "Submit" button', level='debug') result_flag = self.alert_accept() return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def accept_terms(self): "Accept the terms and conditions" result_flag = self.select_checkbox(self.tac_checkbox) self.conditional_write(result_flag, positive='Accepted the terms and conditions', negative='Failed to accept the terms and conditions', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def check_redirect(self): "Check if we have been redirected to the redirect page" result_flag = False if self.redirect_title in self.driver.title: result_flag = True self.switch_page("redirect") return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def submit_signup_form(self, username, email, password): "Submit the form" result_flag = self.set_username(username) result_flag &= self.set_email(email) result_flag &= self.enter_password(password) result_flag &= self.confirm_password(password) result_flag &= self.submit() return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def logout_page(self): "Click on 'Logout' button" result_flag = self.click_element(self.logout_button) self.conditional_write(result_flag, positive='Clicked on the "Logout" button', negative='Failed to click on "Logout" button', level='debug') return result_flag
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/index_object.py
""" This class models the form on the index object page The form consists of some input fields, a dropdown, a checkbox and a button """ import conf.locators_conf as locators from utils.Wrapit import Wrapit from .Base_Page import Base_Page class Index_Object: "Page object for the Form" #locators candidates_page = locators.candidates_page interviewers_page = locators.interviewers_page jobs_page = locators.jobs_page heading = locators.heading @Wrapit._exceptionHandler @Wrapit._screenshot def check_heading(self): "Check if the heading exists" result_flag = self.check_element_present(self.heading) self.conditional_write(result_flag, positive='Correct heading present on index page', negative='Heading on index page is INCORRECT!!', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def click_ok(self): "Accept the terms and conditions" alert = self.click_element(self.name) alert.accept() self.conditional_write(result_flag, positive='Accepted the terms and conditions', negative='Failed to accept the terms and conditions', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def link_to_interviewers_page(self): "Open the interviewers page" result_flag = self.click_element(self.interviewers_page) self.conditional_write(result_flag, positive='Clicked on Interviewers Page', negative='Failed to click on Interviewers Page', level='debug') return result_flag
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/jobs_page.py
""" This class models the main Selenium tutorial page. URL: selenium-tutorial-main The page consists of a header, footer, form and table objects """ from page_objects.Base_Page import Base_Page from page_objects.form_object import Form_Object from page_objects.index_object import Index_Object from page_objects.interviewers_object import Interviewers_Object from page_objects.jobs_object import Jobs_Object from page_objects.rounds_object import Rounds_Object class Jobs_Page(Base_Page, Form_Object, Index_Object, Interviewers_Object, Jobs_Object, Rounds_Object): "Page Object for the tutorial's main page" def start(self): "Use this method to go to specific URL -- if needed" url = '/jobs' self.open(url)
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/login_page.py
""" This class models the main Selenium tutorial page. URL: selenium-tutorial-main The page consists of a header, footer, form and table objects """ from page_objects.Base_Page import Base_Page from page_objects.form_object import Form_Object from page_objects.index_object import Index_Object from page_objects.interviewers_object import Interviewers_Object from page_objects.jobs_object import Jobs_Object from utils.Wrapit import Wrapit class Login_Page(Base_Page,Form_Object,Index_Object,Interviewers_Object,Jobs_Object): "Page Object for the tutorial's main page" def start(self): "Use this method to go to specific URL -- if needed" url = '/login' self.open(url)
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/DriverFactory.py
""" DriverFactory class NOTE: Change this class as you add support for: 1. SauceLabs/BrowserStack 2. More browsers like Opera """ import dotenv,os,sys,requests,json from datetime import datetime from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.webdriver.chrome import service from selenium.webdriver.remote.webdriver import RemoteConnection from appium import webdriver as mobile_webdriver from conf import remote_credentials from conf import opera_browser_conf class DriverFactory(): def __init__(self,browser='ff',browser_version=None,os_name=None): "Constructor for the Driver factory" self.browser=browser self.browser_version=browser_version self.os_name=os_name def get_web_driver(self,remote_flag,os_name,os_version,browser,browser_version,remote_project_name,remote_build_name): "Return the appropriate driver" if (remote_flag.lower() == 'y'): try: if remote_credentials.REMOTE_BROWSER_PLATFORM == 'BS': web_driver = self.run_browserstack(os_name,os_version,browser,browser_version,remote_project_name,remote_build_name) else: web_driver = self.run_sauce_lab(os_name,os_version,browser,browser_version) except Exception as e: print("\nException when trying to get remote webdriver:%s"%sys.modules[__name__]) print("Python says:%s"%str(e)) print("SOLUTION: It looks like you are trying to use a cloud service provider (BrowserStack or Sauce Labs) to run your test. \nPlease make sure you have updated ./conf/remote_credentials.py with the right credentials and try again. \nTo use your local browser please run the test with the -M N flag.\n") elif (remote_flag.lower() == 'n'): web_driver = self.run_local(os_name,os_version,browser,browser_version) else: print("DriverFactory does not know the browser: ",browser) web_driver = None return web_driver def run_browserstack(self,os_name,os_version,browser,browser_version,remote_project_name,remote_build_name): "Run the test in browser stack when remote flag is 'Y'" #Get the browser stack credentials from browser stack credentials file USERNAME = remote_credentials.USERNAME PASSWORD = remote_credentials.ACCESS_KEY if browser.lower() == 'ff' or browser.lower() == 'firefox': desired_capabilities = DesiredCapabilities.FIREFOX elif browser.lower() == 'ie': desired_capabilities = DesiredCapabilities.INTERNETEXPLORER elif browser.lower() == 'chrome': desired_capabilities = DesiredCapabilities.CHROME elif browser.lower() == 'opera': desired_capabilities = DesiredCapabilities.OPERA elif browser.lower() == 'safari': desired_capabilities = DesiredCapabilities.SAFARI desired_capabilities['os'] = os_name desired_capabilities['os_version'] = os_version desired_capabilities['browser_version'] = browser_version if remote_project_name is not None: desired_capabilities['project'] = remote_project_name if remote_build_name is not None: desired_capabilities['build'] = remote_build_name+"_"+str(datetime.now().strftime("%c")) return webdriver.Remote(RemoteConnection("http://%s:%s@hub-cloud.browserstack.com/wd/hub"%(USERNAME,PASSWORD),resolve_ip= False), desired_capabilities=desired_capabilities) def run_sauce_lab(self,os_name,os_version,browser,browser_version): "Run the test in sauce labs when remote flag is 'Y'" #Get the sauce labs credentials from sauce.credentials file USERNAME = remote_credentials.USERNAME PASSWORD = remote_credentials.ACCESS_KEY if browser.lower() == 'ff' or browser.lower() == 'firefox': desired_capabilities = DesiredCapabilities.FIREFOX elif browser.lower() == 'ie': desired_capabilities = DesiredCapabilities.INTERNETEXPLORER elif browser.lower() == 'chrome': desired_capabilities = DesiredCapabilities.CHROME elif browser.lower() == 'opera': desired_capabilities = DesiredCapabilities.OPERA elif browser.lower() == 'safari': desired_capabilities = DesiredCapabilities.SAFARI desired_capabilities['version'] = browser_version desired_capabilities['platform'] = os_name + ' '+os_version return webdriver.Remote(command_executor="http://%s:%s@ondemand.saucelabs.com:80/wd/hub"%(USERNAME,PASSWORD), desired_capabilities= desired_capabilities) def run_local(self,os_name,os_version,browser,browser_version): "Return the local driver" local_driver = None if browser.lower() == "ff" or browser.lower() == 'firefox': local_driver = webdriver.Firefox() elif browser.lower() == "ie": local_driver = webdriver.Ie() elif browser.lower() == "chrome": local_driver = webdriver.Chrome() elif browser.lower() == "opera": opera_options = None try: opera_browser_location = opera_browser_conf.location options = webdriver.ChromeOptions() options.binary_location = opera_browser_location # path to opera executable local_driver = webdriver.Opera(options=options) except Exception as e: print("\nException when trying to get remote webdriver:%s"%sys.modules[__name__]) print("Python says:%s"%str(e)) if 'no Opera binary' in str(e): print("SOLUTION: It looks like you are trying to use Opera Browser. Please update Opera Browser location under conf/opera_browser_conf.\n") elif browser.lower() == "safari": local_driver = webdriver.Safari() return local_driver def run_mobile(self,mobile_os_name,mobile_os_version,device_name,app_package,app_activity,remote_flag,device_flag,app_name,app_path,ud_id,org_id,signing_id,no_reset_flag): "Setup mobile device" #Get the remote credentials from remote_credentials file USERNAME = remote_credentials.USERNAME PASSWORD = remote_credentials.ACCESS_KEY desired_capabilities = {} desired_capabilities['platformName'] = mobile_os_name desired_capabilities['platformVersion'] = mobile_os_version desired_capabilities['deviceName'] = device_name if mobile_os_name in 'Android': if (remote_flag.lower() == 'y'): desired_capabilities['idleTimeout'] = 300 desired_capabilities['name'] = 'Appium Python Test' try: if remote_credentials.REMOTE_BROWSER_PLATFORM == 'SL': self.sauce_upload(app_path,app_name) #Saucelabs expects the app to be uploaded to Sauce storage everytime the test is run #Checking if the app_name is having spaces and replacing it with blank if ' ' in app_name: app_name = app_name.replace(' ','') print ("The app file name is having spaces, hence replaced the white spaces with blank in the file name:%s"%app_name) desired_capabilities['app'] = 'sauce-storage:'+app_name desired_capabilities['autoAcceptAlert']= 'true' driver = mobile_webdriver.Remote(command_executor="http://%s:%s@ondemand.saucelabs.com:80/wd/hub"%(USERNAME,PASSWORD), desired_capabilities= desired_capabilities) else: desired_capabilities['realMobile'] = 'true' desired_capabilities['app'] = self.browser_stack_upload(app_name,app_path) #upload the application to the Browserstack Storage driver = mobile_webdriver.Remote(command_executor="http://%s:%s@hub.browserstack.com:80/wd/hub"%(USERNAME,PASSWORD), desired_capabilities= desired_capabilities) except Exception as e: print ('\033[91m'+"\nException when trying to get remote webdriver:%s"%sys.modules[__name__]+'\033[0m') print ('\033[91m'+"Python says:%s"%str(e)+'\033[0m') print ('\033[92m'+"SOLUTION: It looks like you are trying to use a cloud service provider (BrowserStack or Sauce Labs) to run your test. \nPlease make sure you have updated ./conf/remote_credentials.py with the right credentials and try again. \nTo use your local browser please run the test with the -M N flag.\n"+'\033[0m') else: try: desired_capabilities['appPackage'] = app_package desired_capabilities['appActivity'] = app_activity if device_flag.lower() == 'y': driver = mobile_webdriver.Remote('http://localhost:4723/wd/hub', desired_capabilities) else: desired_capabilities['app'] = os.path.join(app_path,app_name) driver = mobile_webdriver.Remote('http://localhost:4723/wd/hub', desired_capabilities) except Exception as e: print ('\033[91m'+"\nException when trying to get remote webdriver:%s"%sys.modules[__name__]+'\033[0m') print ('\033[91m'+"Python says:%s"%str(e)+'\033[0m') print ('\033[92m'+"SOLUTION: It looks like you are trying to run test cases with Local Appium Setup. \nPlease make sure to run Appium Server and try again.\n"+'\033[0m') elif mobile_os_name=='iOS': if (remote_flag.lower() == 'y'): desired_capabilities['idleTimeout'] = 300 desired_capabilities['name'] = 'Appium Python Test' try: if remote_credentials.REMOTE_BROWSER_PLATFORM == 'SL': self.sauce_upload(app_path,app_name) #Saucelabs expects the app to be uploaded to Sauce storage everytime the test is run #Checking if the app_name is having spaces and replacing it with blank if ' ' in app_name: app_name = app_name.replace(' ','') print ("The app file name is having spaces, hence replaced the white spaces with blank in the file name:%s"%app_name) desired_capabilities['app'] = 'sauce-storage:'+app_name desired_capabilities['autoAcceptAlert']= 'true' driver = mobile_webdriver.Remote(command_executor="http://%s:%s@ondemand.saucelabs.com:80/wd/hub"%(USERNAME,PASSWORD), desired_capabilities= desired_capabilities) else: desired_capabilities['realMobile'] = 'true' desired_capabilities['app'] = self.browser_stack_upload(app_name,app_path) #upload the application to the Browserstack Storage driver = mobile_webdriver.Remote(command_executor="http://%s:%s@hub.browserstack.com:80/wd/hub"%(USERNAME,PASSWORD), desired_capabilities= desired_capabilities) except Exception as e: print ('\033[91m'+"\nException when trying to get remote webdriver:%s"%sys.modules[__name__]+'\033[0m') print ('\033[91m'+"Python says:%s"%str(e)+'\033[0m') print ('\033[92m'+"SOLUTION: It looks like you are trying to use a cloud service provider (BrowserStack or Sauce Labs) to run your test. \nPlease make sure you have updated ./conf/remote_credentials.py with the right credentials and try again. \nTo use your local browser please run the test with the -M N flag.\n"+'\033[0m') else: try: desired_capabilities['app'] = os.path.join(app_path,app_name) desired_capabilities['bundleId'] = app_package desired_capabilities['noReset'] = no_reset_flag if ud_id is not None: desired_capabilities['udid'] = ud_id desired_capabilities['xcodeOrgId'] = org_id desired_capabilities['xcodeSigningId'] = signing_id driver = mobile_webdriver.Remote('http://localhost:4723/wd/hub', desired_capabilities) except Exception as e: print ('\033[91m'+"\nException when trying to get remote webdriver:%s"%sys.modules[__name__]+'\033[0m') print ('\033[91m'+"Python says:%s"%str(e)+'\033[0m') print ('\033[92m'+"SOLUTION: It looks like you are trying to run test cases with Local Appium Setup. \nPlease make sure to run Appium Server or set it up properly and try again.\n"+'\033[0m') return driver def sauce_upload(self,app_path,app_name): "Upload the apk to the sauce temperory storage" USERNAME = remote_credentials.USERNAME PASSWORD = remote_credentials.ACCESS_KEY result_flag=False try: headers = {'Content-Type':'application/octet-stream'} params = os.path.join(app_path,app_name) fp = open(params,'rb') data = fp.read() fp.close() #Checking if the app_name is having spaces and replacing it with blank if ' ' in app_name: app_name = app_name.replace(' ','') print ("The app file name is having spaces, hence replaced the white spaces with blank in the file name:%s"%app_name) response = requests.post('https://saucelabs.com/rest/v1/storage/%s/%s?overwrite=true'%(USERNAME,app_name),headers=headers,data=data,auth=(USERNAME,PASSWORD)) if response.status_code == 200: result_flag=True print ("App successfully uploaded to sauce storage") except Exception as e: print (str(e)) return result_flag def browser_stack_upload(self,app_name,app_path): "Upload the apk to the BrowserStack storage if its not done earlier" USERNAME = remote_credentials.USERNAME ACESS_KEY = remote_credentials.ACCESS_KEY try: #Upload the apk apk_file = os.path.join(app_path,app_name) files = {'file': open(apk_file,'rb')} post_response = requests.post("https://api.browserstack.com/app-automate/upload",files=files,auth=(USERNAME,ACESS_KEY)) post_json_data = json.loads(post_response.text) #Get the app url of the newly uploaded apk app_url = post_json_data['app_url'] except Exception as e: print(str(e)) return app_url def get_firefox_driver(self): "Return the Firefox driver" driver = webdriver.Firefox(firefox_profile=self.get_firefox_profile()) return driver def get_firefox_profile(self): "Return a firefox profile" return self.set_firefox_profile() def set_firefox_profile(self): "Setup firefox with the right preferences and return a profile" try: self.download_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','downloads')) if not os.path.exists(self.download_dir): os.makedirs(self.download_dir) except Exception as e: print("Exception when trying to set directory structure") print(str(e)) profile = webdriver.firefox.firefox_profile.FirefoxProfile() set_pref = profile.set_preference set_pref('browser.download.folderList', 2) set_pref('browser.download.dir', self.download_dir) set_pref('browser.download.useDownloadDir', True) set_pref('browser.helperApps.alwaysAsk.force', False) set_pref('browser.helperApps.neverAsk.openFile', 'text/csv,application/octet-stream,application/pdf') set_pref('browser.helperApps.neverAsk.saveToDisk', 'text/csv,application/vnd.ms-excel,application/pdf,application/csv,application/octet-stream') set_pref('plugin.disable_full_page_plugin_for_types', 'application/pdf') set_pref('pdfjs.disabled',True) return profile
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/confirm_email.py
""" This class models the interview schedule on candidate side The form consists of scheduling an interview,checking google link """ import os import sys import email from bs4 import BeautifulSoup #from QA.utils.Wrapit import Wrapit from QA.utils.email_util import Email_Util import QA.conf.email_conf as conf_file #from QA.conf import login_conf as login #from .Base_Page import Base_Page sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) #Fetching conf details from the conf and login file imap_host = conf_file.imaphost username = conf_file.username password = conf_file.app_password unique_code = 0 url = "abcd" class Confirm_Email_Object: "Page Object for Scheduling an interview" def fetch_email_invite(self): "Confirm the email address on the link sent on email" imap_host = conf_file.imaphost username = conf_file.username password = conf_file.app_password email_obj = Email_Util() url = "abcd" unique_code = "0" #Connect to the IMAP host email_obj.connect(imap_host) result_flag = email_obj.login(username, password) print(result_flag) if result_flag is True: result_flag = email_obj.select_folder('Inbox') uid = email_obj.get_latest_email_uid(subject="Confirm Your Email Address", sender='careers@qxf2.com', wait_time=20) email_body = email_obj.fetch_email_body(uid) soup = BeautifulSoup(''.join(email_body), 'html.parser') url = soup.a.get('href') return url
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/PageFactory.py
""" PageFactory uses the factory design pattern. get_page_object() returns the appropriate page object. Add elif clauses as and when you implement new pages. Pages implemented so far: 1. Tutorial main page 2. Tutorial redirect page 3. Contact Page 4. Bitcoin main page 5. Bitcoin price page """ from page_objects.zero_page import Zero_Page from page_objects.login_page import Login_Page from page_objects.scheduler_main_page import Scheduler_Main_Page from page_objects.index_page import Index_Page from page_objects.redirect_index_page import Redirect_Index_Page from page_objects.jobs_page import Jobs_Page from page_objects.candidates_page import Candidates_Page from page_objects.interviewers_page import Interviewers_Page import conf.base_url_conf class PageFactory(): "PageFactory uses the factory design pattern." def get_page_object(page_name,base_url=conf.base_url_conf.base_url): "Return the appropriate page object based on page_name" test_obj = None page_name = page_name.lower() if page_name in ["zero","zero page","agent zero"]: test_obj = Zero_Page(base_url=base_url) elif page_name == "login page": test_obj = Login_Page(base_url=base_url) elif page_name == "scheduler main page": test_obj = Scheduler_Main_Page(base_url=base_url) elif page_name == "index page": test_obj = Index_Page(base_url=base_url) elif page_name == "redirect": test_obj = Redirect_Index_Page(base_url=base_url) elif page_name == "candidates page": test_obj = Candidates_Page(base_url=base_url) elif page_name == "jobs page": test_obj = Jobs_Page(base_url=base_url) elif page_name == "interviewers page": test_obj = Interviewers_Page(base_url=base_url) return test_obj get_page_object = staticmethod(get_page_object)
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/interviewers_page.py
""" This class models the main Selenium tutorial page. URL: selenium-tutorial-main The page consists of a header, footer, form and table objects """ from page_objects.Base_Page import Base_Page from page_objects.interviewers_object import Interviewers_Object class Interviewers_Page(Base_Page, Interviewers_Object): "Page Object for the tutorial's main page" def start(self): "Use this method to go to specific URL -- if needed" url = '/interviewers' self.open(url)
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/redirect_index_page.py
""" This class models the redirect page of the Selenium tutorial URL: selenium-tutorial-redirect The page consists of a header, footer and some text """ from .Base_Page import Base_Page import conf.locators_conf as locators from utils.Wrapit import Wrapit class Redirect_Index_Page(Base_Page): "Page Object for the tutorial's redirect page" #locators heading = locators.heading def start(self): "Use this method to go to specific URL -- if needed" url = 'index' self.open(url) @Wrapit._exceptionHandler def check_heading(self): "Check if the heading exists" result_flag = self.check_element_present(self.heading) self.conditional_write(result_flag, positive='Correct heading present on redirect page', negative='Heading on redirect page is INCORRECT!!', level='debug') return result_flag
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/candidates_object.py
""" This class models the form on candidates page The form consists of some input fields, a dropdown, a checkbox and a button to submit candidate details """ import os import sys import conf.locators_conf as locators from utils.Wrapit import Wrapit import conf.login_conf as login from .Base_Page import Base_Page sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) #Fetching conf details from the conf file email = login.email_candidates class Candidates_Object: "Page object for the Candidates" #locators add_candidates_button = locators.add_candidates_button name_candidates = locators.name_candidates email_candidates = locators.email_candidates job_applied = locators.job_applied job_applied_select = locators.job_applied_select comment_candidates = locators.comment_candidates submit_candidates_button = locators.submit_candidates_button delete_candidates_button = locators.delete_candidates_button remove_candidates_button = locators.remove_candidates_button select_candidate_button = locators.select_candidate_button search_option_candidate = locators.search_option thumbs_up_button = locators.thumbs_up_button thumbs_down_button = locators.thumbs_down_button select_round_level_scroll = locators.select_round_level_scroll send_email_button = locators.send_email_button edit_candidate_button = locators.edit_candidate_button edit_candidate_page_save_button = locators.edit_candidate_page_save_button @Wrapit._exceptionHandler @Wrapit._screenshot def add_candidates(self): "Click on Add Candidates button" result_flag = self.click_element(self.add_candidates_button) self.conditional_write(result_flag, positive='Clicked on the Add Candidates button', negative='Failed to click on Add Candidates button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_name(self, name_candidates): "Set the name for candidate" result_flag = self.set_text(self.name_candidates, name_candidates) self.conditional_write(result_flag, positive='Set the candidates name to: %s'% name_candidates, negative='Failed to set the name', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_email(self, email_candidates): "Set the email for the candidate" result_flag = self.set_text(self.email_candidates, email_candidates) self.conditional_write(result_flag, positive='Set the email to: %s'%email_candidates, negative='Failed to set the email in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_job_applied(self, job_applied_select, wait_seconds=1): "Set the email on the form" result_flag = self.click_element(self.job_applied) self.wait(wait_seconds) result_flag = self.click_element(self.job_applied_select%job_applied_select) self.conditional_write(result_flag, positive='Set the email to: %s'%job_applied_select, negative='Failed to set the email in the form', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_comments(self, comment_candidates): "Set the email on the form" result_flag = self.set_text(self.comment_candidates, comment_candidates) self.conditional_write(result_flag, positive='Set the comments to: %s'%comment_candidates, negative='Failed to set comments', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def submit(self): "Click on 'Submit' button" result_flag = self.click_element(self.submit_candidates_button) self.conditional_write(result_flag, positive='Clicked on the Submit button', negative='Failed to click on Submit button', level='debug') result_flag = self.alert_accept() return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_candidate_details(self, name_candidates, email_candidates, job_applied_select, comment_candidates): "Add all candidate details" result_flag = self.add_name(name_candidates) result_flag &= self.add_email(email_candidates) result_flag &= self.add_job_applied(job_applied_select) result_flag &= self.add_comments(comment_candidates) result_flag &= self.submit() return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def search_candidate(self, search_option_candidate): "Click on 'Search' button" result_flag = self.set_text(self.search_option_candidate, search_option_candidate) self.conditional_write(result_flag, positive='Search for Candidate name: %s'%search_option_candidate, negative='Failed to Search for Candidate name', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def delete_candidates(self): "Click on Delete Candidates button" result_flag = self.click_element(self.delete_candidates_button) self.conditional_write(result_flag, positive='Clicked on the Delete Candidates button', negative='Failed to click on Delete Candidates button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def remove_candidates(self, search_option_candidate): "Click on Remove Candidates button" self.search_candidate(search_option_candidate) self.delete_candidates() result_flag = self.click_element(self.remove_candidates_button) self.conditional_write(result_flag, positive='Clicked on the Remove Candidates button', negative='Failed to click on Remove Candidates button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def select_candidates(self): "Click on Select Candidates button" result_flag = self.click_element(self.select_candidate_button) self.conditional_write(result_flag, positive='Clicked on the Select Candidates button', negative='Failed to click on Select Candidates button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def thumbs_up(self): "Click on thumbs up button" result_flag = self.click_element(self.thumbs_up_button) self.conditional_write(result_flag, positive='Clicked on the thumbs up button', negative='Failed to click on thumbs up button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def thumbs_down(self): "Click on thumbs up button" result_flag = self.click_element(self.thumbs_down_button) self.conditional_write(result_flag, positive='Clicked on the thumbs down button', negative='Failed to click on thumbs down button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def select_round(self, select_round_level): "Set the name for round" result_flag = self.set_text(self.select_round_level_scroll, select_round_level) self.conditional_write(result_flag, positive='Set the round to: %s'% select_round_level, negative='Failed to set the round', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def send_email(self): "Click on send email button" result_flag = self.click_element(self.send_email_button) self.conditional_write(result_flag, positive='Clicked on the send email button', negative='Failed to click on send email button', level='debug') result_flag = self.alert_accept() return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def send_email_candidate(self, search_option_candidate, select_round_level): "Search candidate,select, thumbs up, select round level, send email to candidate " result_flag = self.search_candidate(search_option_candidate) result_flag &= self.select_candidates() result_flag &= self.thumbs_up() result_flag &= self.select_round(select_round_level) result_flag &= self.send_email() return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def alert_accept(self): "Click on 'Ok' alert" result_flag = self.alert_window() return result_flag self.conditional_write(result_flag, positive='Clicked on the OK', negative='Failed to click on OK', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def edit_candidates(self): "Click on edit button of Candidates page" result_flag = self.click_element(self.edit_candidate_button) self.conditional_write(result_flag, positive= 'Clicked on Edit Candidates link', negative= 'Failed to click on Edit Candidates link', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def edit_candidate_comment(self, comment_candidates): "Edit the comments of Candidate" result_flag = self.set_text(self.comment_candidates, comment_candidates, clear_flag=False) self.conditional_write(result_flag, positive='Edit the comments to: %s'%comment_candidates, negative='Failed to edit comments', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def save_edited_candidate(self): "Click the Save button to save changes applied for te candidate" result_flag = self.click_element(self.edit_candidate_page_save_button) self.conditional_write(result_flag, positive= 'Click save button after editing candidate', negative='Failed to click on save button after editing candidate', level='debug') result_flag = self.alert_accept() return result_flag
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/jobs_object.py
""" This class models the form on the Selenium tutorial page The form consists of some input fields, a dropdown, a checkbox and a button """ from .Base_Page import Base_Page import conf.locators_conf as locators from utils.Wrapit import Wrapit class Jobs_Object: "Page object for the Form" #locators add_jobs_button = locators.add_jobs_button job_role = locators.job_role job_interviewers = locators.job_interviewers submit_job_button = locators.submit_job_button delete_job_button = locators.delete_job_button remove_job_button = locators.remove_job_button search_option_job = locators.search_option @Wrapit._exceptionHandler @Wrapit._screenshot def add_jobs(self): "Click on 'Add Jobs' button" result_flag = self.click_element(self.add_jobs_button) self.conditional_write(result_flag, positive='Clicked on the "Add Jobs" button', negative='Failed to click on "Add Jobs" button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_job_role(self,job_role): "Set the name on the form" result_flag = self.set_text(self.job_role,job_role) self.conditional_write(result_flag, positive='Set the job role to: %s'% job_role, negative='Failed to set the job role', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def set_job_interviewer(self,job_interviewers): "Set the name on the form" result_flag = self.set_text(self.job_interviewers,job_interviewers) self.conditional_write(result_flag, positive='Set the email to: %s'% job_interviewers, negative='Failed to set the interviewers', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def submit_job(self): "Click on Submit button" result_flag = self.click_element(self.submit_job_button) self.conditional_write(result_flag, positive='Clicked on the "Submit Job" button', negative='Failed to click on "Submit Job" button', level='debug') result_flag = self.alert_accept() return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def delete_job(self): "Click on 'Delete Job' button" result_flag = self.click_element(self.delete_job_button) self.conditional_write(result_flag, positive='Clicked on delete job button', negative='Failed to click on button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def remove_job(self,search_option_job): "Click on 'Remove Job' button" self.search_job(search_option_job) self.delete_job() result_flag = self.click_element(self.remove_job_button) self.conditional_write(result_flag, positive='Clicked on remove job button', negative='Failed to click on button', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def search_job(self,search_option_job): "Click on 'Search' button" result_flag = self.set_text(self.search_option_job,search_option_job) self.conditional_write(result_flag, positive='Search for Job name: %s'%search_option_job, negative='Failed to Search for Job name', level='debug') return result_flag @Wrapit._exceptionHandler @Wrapit._screenshot def add_job_details(self,job_role,job_interviewers): "Add Job details" result_flag = self.set_job_role(job_role) result_flag &= self.set_job_interviewer(job_interviewers) result_flag &= self.submit_job() return result_flag
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/candidates_page.py
""" This class models the main Selenium tutorial page. URL: selenium-tutorial-main The page consists of a header, footer, form and table objects """ from .Base_Page import Base_Page from .form_object import Form_Object from .index_object import Index_Object from .candidates_object import Candidates_Object from .interview_schedule_object import Interview_Schedule_Object class Candidates_Page(Base_Page, Form_Object, Index_Object, Candidates_Object, Interview_Schedule_Object): "Page Object for the tutorial's main page" def start(self): "Use this method to go to specific URL -- if needed" url = '/candidates' self.open(url)
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/page_objects/scheduler_main_page.py
""" This class models the main Selenium tutorial page. URL: selenium-tutorial-main The page consists of a header, footer, form and table objects """ from page_objects.Base_Page import Base_Page from page_objects.form_object import Form_Object from utils.Wrapit import Wrapit class Scheduler_Main_Page(Base_Page,Form_Object): "Page Object for the tutorial's main page" def start(self): "Use this method to go to specific URL -- if needed" url = '/' self.open(url)
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/conf/tesults_conf.py
""" Conf file to hold Tesults target tokens: Create projects and targets from the Tesults configuration menu: https://www.tesults.com You can regenerate target tokens from there too. Tesults upload will fail unless the token is valid. utils/Tesults.py will use the target_token_default unless otherwise specified Find out more about targets here: https://www.tesults.com/docs?doc=target """ target_token_default = ""
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/conf/email_conf.py
#Details needed for the Gmail #Fill out the email details over here #imaphost="imap.gmail.com" #Add imap hostname of your email client #username="Add your email address or username here" imaphost="imap.gmail.com" #Add imap hostname of your email client username="test@qxf2.com" #Login has to use the app password because of Gmail security configuration # 1. Setup 2 factor authentication # 2. Follow the 2 factor authentication setup wizard to enable an app password #Src: https://support.google.com/accounts/answer/185839?hl=en #Src: https://support.google.com/mail/answer/185833?hl=en #app_password="Add app password here" app_password="Qxf2Services@12" #Details for sending pytest report smtp_ssl_host = 'smtp.gmail.com' # Add smtp ssl host of your email client smtp_ssl_port = 465 # Add smtp ssl port number of your email client sender = 'qxf2.emailutil@gmail.com' #Add senders email address here targets = ['nilaya@qxf2.com','qwe@xyz.com'] # Add recipients email address in a list
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/conf/login_conf.py
user_name = "nilaya" password = "qwerty" interviewers_name = "nilaya" interviewers_email = "nilaya@qxf2.com" interviewers_designation = "Manager QA" interviewers_starttime_drop = "11:00" interviewers_endtime_drop = "19:30" search_option_interviewer = "nilaya" job_role = "Junior QA" job_interviewers = "nilaya" search_option_job = "Junior QA" name_candidates = "test_Namitha" email_candidates = "kavya.suryaprakash9@gmail.com" job_applied_select = "Business Analyst" comment_candidates = "Through employee reference, commenting for testing purpose" #select_round_level = "Technical Round" search_option_candidate = "test_seeder_candidate" round_name = "Technical Round" round_duration_select = "45 minutes" round_description = "We will test your technical skills and give an exercise" round_requirements = "Laptop,Mobile,Headphone" date_picker = "06/08/2020" date_check = "13" free_slot = "11:30 - 12:15" email_on_link = "test@qxf2.com" password_link = "Qxf2Services@12"
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/conf/test_path_conf.py
""" This conf file would have the relative paths of the files & folders. """ import os,sys #POM #Files from src POM: src_pom_file1 = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','__init__.py')) src_pom_file2 = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','conftest.py')) src_pom_file3 = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','Readme.md')) src_pom_file4 = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','Requirements.txt')) src_pom_file5 = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','setup.cfg')) #src POM file list: src_pom_files_list = [src_pom_file1,src_pom_file2,src_pom_file3,src_pom_file4,src_pom_file5] #destination folder for POM which user has to mention. This folder should be created by user. dst_folder_pom = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','..','..','clients','Play_Arena','POM'))
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/conf/opera_browser_conf.py
""" conf file for updating Opera Browser Location """ location = "Enter the Opera Browser Location"
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/conf/api_example_conf.py
#Conf for api example #get_job_details job_details = {'role':'technical_man','interviewerlist':'["nilaya"]'} #get_candidate_details candidate_details = {'candidateName':'test_api_new12345','candidateEmail':'test_api_new+56789@gmail.com','jobApplied':'technical_man','addedcomments':'N/A'} #get_interviewer_details interviewer_details = {'name':'test_nilaya','email':'nilaya+1234@qxf2.com','designation':'Senior QA','timeObject':'{"starttime":["10:00"],"endtime":["19:00"]}'} #authentication details user_name = 'nilaya123' password = 'nilaya1234' useremail = 'test+90000@qxf2.com'
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/conf/locators_conf.py
#Common locator file for all locators ############################################ #Selectors we can use #ID #NAME #css selector #CLASS_NAME #LINK_TEXT #PARTIAL_LINK_TEXT #XPATH ########################################### #Locators for the login object username_field = "xpath,//input[@id = 'username']" password_field = "xpath,//input[@id='userpassword']" login_button = "xpath,//*[@id='loginButton']" signup_button = "xpath,//*[@id='signupButton']" user_name_field = "xpath,//input[contains(@name,'uname')]" email_field = "xpath,//input[contains(@id,'email')]" password_field = "xpath,//input[contains(@id,'password')]" confirm_password_field = "xpath,//input[contains(@id,'confirmPassword')]" submit_button = "xpath,//button[contains(@id,'addSubmit')]" logout_button = "xpath,//input[contains(@value,'log out')]" #Locators for the index object interviewers_page = "xpath,//a[contains(.,'List the interviewers')]" jobs_page = "xpath,//a[contains(.,'List the jobs')]" candidates_page = "xpath,//a[contains(.,'List the candidates')]" #Heading for index page heading = "xpath,//h2[contains(.,'Why Interview Scheduler Application?')]" #Locators for Candidates Page search_option = "xpath,//input[contains(@type,'search')]" add_candidates_button = "xpath,//input[@id='add']" delete_candidate = "xpath,//button[contains(@data-candidateid,'')]" edit_candidate_button = "xpath,//button[@id='edit']" name_candidates = "xpath,//input[@id='fname']" email_candidates = "xpath,//input[@id='email']" job_applied = "xpath,//select[contains(@id,'select1')]" job_applied_select = "xpath,//option[@value='%s']" comment_candidates = "xpath,//textarea[@id='comments']" submit_candidates_button = "xpath,//button[@id='addSubmit']" delete_candidates_button = "xpath,//button[contains(@data-candidatename,'Nayara')]" remove_candidates_button = "xpath,//button[@id='remove-button']" select_candidate_button = "xpath,//a[contains(.,'Nayara')]" thumbs_up_button = "xpath,//input[@value='Thumbs up']" thumbs_down_button = "xpath,//input[@value='Thumbs down']" select_round_level_scroll = "xpath,//select[@id='select1']" send_email_button = "xpath,//button[contains(.,'Send Email')]" select_url = "xpath,//label[@class='col-md-8'][contains(.,'http://localhost:6464/')]" select_unique_code = "xpath,//input[contains(@id,'candidate-name')]" select_candidate_email = "xpath,//input[contains(@id,'candidate-email')]" go_for_schedule = "xpath,//input[contains(@id,'submit')]" date_picker = "xpath,//input[contains(@id,'datepicker')]" date_on_calendar = "xpath,//a[contains(text(),%s)]" confirm_interview_date = "xpath,//input[contains(@id,'submit')]" select_free_slot = "xpath,/html/body/div[1]/div[1]/input" select_free_slot = "xpath,(//input[@class='btn'])[1]" schedule_my_interview = "xpath,//input[@value='Schedule my interview']" calendar_link = "xpath,//a[contains(@target,'blank')]" google_meet_link = "xpath,//a[contains(.,'Join with Google Meet')]" email_on_link = "xpath,//input[@type='email']" next_button = "xpath,//div[@class='VfPpkd-RLmnJb']" next_button_after_password = "xpath,//*[@id='passwordNext']" password_link = "xpath,//input[@type='password']" edit_candidate_page_save_button = "xpath,//button[@class= 'btn btn-info']" #Locators for Interviewers Page add_interviewers_button = "xpath,//input[contains(@onclick,'addinterviewer()')]" interviewers_name = "xpath,//input[contains(@id,'fname')]" interviewers_email = "xpath,//input[@id='email']" interviewers_designation = "xpath,//input[contains(@id,'designation')]" interviewers_starttime = "xpath,//input[contains(@id,'starttime0')]" interviewers_starttime_drop = "xpath,//a[text()='%s']" interviewers_endtime = "xpath,//input[contains(@id,'endtime0')] " interviewers_endtime_drop = "xpath,//a[text()='%s']" add_time_button = "xpath,//input[contains(@value,'Add time')]" save_interviewers_button = "xpath,//input[@id='submit']" cancel_interviewers_button = "xpath,//button[@id='clear']" close_interviewers_button = "xpath,//button[@id='close']" delete_interviewers_button = "xpath,//a[text()='nilaya']/parent::td/following-sibling::td/button[@data-toggle='modal']" remove_interviewers_button = "xpath,//button[contains(@id,'remove-button')]" #Locators for Jobs Page add_jobs_button = "xpath,//input[contains(@onclick,'addJob()')]" job_role = "xpath,//input[contains(@id,'role')]" job_interviewers = "xpath,//input[contains(@id,'interviewers')]" submit_job_button = "xpath,//button[contains(@id,'submit')]" delete_job_button = "xpath,//a[text()='Junior QA']/parent::td/following-sibling::td/button[@data-jobrole='Junior QA']" remove_job_button = "xpath,//button[@id='remove-button']" #Locators for Rounds specific_round_add = "xpath,//a[text()='Junior QA']/parent::td/following-sibling::td/button[text()='Rounds']" add_rounds_button = "xpath,//input[@value='Add Rounds']" round_name = "xpath,//input[@id='rname']" round_duration = "xpath,//select[@name='Duration']" round_duration_select = "xpath,//option[@value='%s']" round_description = "xpath,//textarea[@name='rdesc']" round_requirements = "xpath,//input[@name='rreq']" add_button = "xpath,//button[@id='addRound']" cancel_rounds_button = "xpath,//button[@id='cancelRound']"
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/conf/os_details.config
# Set up an OS details and browsers we test on. [Windows_7_Firefox] os = Windows os_version = 7 browser = Firefox browser_version = 41.0 [Windows_7_IE] os = Windows os_version = 7 browser = IE browser_version = 11.0 [Windows_7_Chrome] os = Windows os_version = 7 browser = Chrome browser_version = 43.0 [Windows_7_Opera] os = Windows os_version = 7 browser = Opera browser_version = 12.16 [OSX_Yosemite_Firefox] os = OS X os_version = Yosemite browser = Firefox browser_version = 38.0 [OSX_Yosemite_Safari] os = OS X os_version = Yosemite browser = Safari browser_version = 8.0
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/conf/base_url_conf.py
""" Conf file for base_url """ base_url = "http://localhost:6464/"
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/conf/browser_os_name_conf.py
""" Conf file to generate the cross browser cross platform test run configuration """ from . import remote_credentials as conf #Conf list for local default_browser = ["chrome"] #default browser for the tests to run against when -B option is not used local_browsers = ["firefox","chrome"] #local browser list against which tests would run if no -M Y and -B all is used #Conf list for Browserstack/Sauce Labs #change this depending on your client browsers = ["firefox","chrome","safari"] #browsers to generate test run configuration to run on Browserstack/Sauce Labs firefox_versions = ["57","58"] #firefox versions for the tests to run against on Browserstack/Sauce Labs chrome_versions = ["64","65"] #chrome versions for the tests to run against on Browserstack/Sauce Labs safari_versions = ["8"] #safari versions for the tests to run against on Browserstack/Sauce Labs os_list = ["windows","OS X"] #list of os for the tests to run against on Browserstack/Sauce Labs windows_versions = ["8","10"] #list of windows versions for the tests to run against on Browserstack/Sauce Labs os_x_versions = ["yosemite"] #list of os x versions for the tests to run against on Browserstack/Sauce Labs sauce_labs_os_x_versions = ["10.10"] #Set if running on sauce_labs instead of "yosemite" default_config_list = [("chrome","65","windows","10")] #default configuration against which the test would run if no -B all option is used def generate_configuration(browsers=browsers,firefox_versions=firefox_versions,chrome_versions=chrome_versions,safari_versions=safari_versions, os_list=os_list,windows_versions=windows_versions,os_x_versions=os_x_versions): "Generate test configuration" if conf.REMOTE_BROWSER_PLATFORM == 'SL': os_x_versions = sauce_labs_os_x_versions test_config = [] for browser in browsers: if browser == "firefox": for firefox_version in firefox_versions: for os_name in os_list: if os_name == "windows": for windows_version in windows_versions: config = [browser,firefox_version,os_name,windows_version] test_config.append(tuple(config)) if os_name == "OS X": for os_x_version in os_x_versions: config = [browser,firefox_version,os_name,os_x_version] test_config.append(tuple(config)) if browser == "chrome": for chrome_version in chrome_versions: for os_name in os_list: if os_name == "windows": for windows_version in windows_versions: config = [browser,chrome_version,os_name,windows_version] test_config.append(tuple(config)) if os_name == "OS X": for os_x_version in os_x_versions: config = [browser,chrome_version,os_name,os_x_version] test_config.append(tuple(config)) if browser == "safari": for safari_version in safari_versions: for os_name in os_list: if os_name == "OS X": for os_x_version in os_x_versions: config = [browser,safari_version,os_name,os_x_version] test_config.append(tuple(config)) return test_config #variable to hold the configuration that can be imported in the conftest.py file cross_browser_cross_platform_config = generate_configuration()
0
qxf2_public_repos/interview-scheduler/QA
qxf2_public_repos/interview-scheduler/QA/conf/remote_credentials.py
#Set REMOTE_BROWSER_PLATFROM TO BS TO RUN ON BROWSERSTACK else #SET REMOTE_BROWSER_PLATFORM TO SL TO RUN ON SAUCE LABS REMOTE_BROWSER_PLATFORM = "BS or SL" USERNAME = "Add your BrowserStack/Sauce Labs username" ACCESS_KEY = "Add your BrowserStack/Sauce Labs accesskey"
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/utils/verify_gcal_setup.py
""" This is a simple script to test the Google calendar """ from __future__ import print_function import datetime import pickle import os.path import sys from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request # If modifying these scopes, delete the file token.pickle. SCOPES = ['https://www.googleapis.com/auth/calendar.readonly'] def main(email_id): """Shows basic usage of the Google Calendar API. Prints the start and name of the next 10 events on the user's calendar. """ creds = None # The file token.pickle stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists('token.pickle'): with open('token.pickle', 'rb') as token: creds = pickle.load(token) # If there are no (valid) credentials available, let the user log in. if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: print("Your credentials to access Google Calendar are not setup correctly") service = build('calendar', 'v3', credentials=creds) # Call the Calendar API now = datetime.datetime.utcnow().isoformat() + 'Z' # 'Z' indicates UTC time print('Getting the upcoming 10 events') events_result = service.events().list(calendarId=email_id, timeMin=now, maxResults=10, singleEvents=True, orderBy='startTime').execute() events = events_result.get('items', []) if not events: print('No upcoming events found.') for event in events: start = event['start'].get('dateTime', event['start'].get('date')) print(start, event['summary']) return events if __name__ == '__main__': if len(sys.argv)>1: email_id = sys.argv[1] main(email_id) else: print("USAGE: %s your@domain.com\nEXAMPLE: %s test@qxf2.com\n"%(__file__,__file__))
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/authentication_required.py
""" Decorator for authenticating all pages """ from functools import wraps from flask import render_template, session class Authentication_Required: "Authentication for all classes" def requires_auth(func): "verify given user authentication details" @wraps(func) def decorated(*args, **kwargs): "Execute func only if authentication is valid" try: current_user = session['logged_user'] if current_user: return func(*args, **kwargs) except Exception as e: return render_template("unauthorized.html") return decorated
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/sso_google_oauth.py
""" A Flask app for Google SSO """ import os from oauthlib import oauth2 from dotenv import load_dotenv load_dotenv() CLIENT_ID = os.getenv("CLIENT_ID") CLIENT_SECRET = os.getenv("CLIENT_SECRET") redirect_uri = os.getenv("REDIRECT_URI") DATA = { 'response_type':"code", 'redirect_uri': redirect_uri , 'scope': 'https://www.googleapis.com/auth/userinfo.email', 'client_id':CLIENT_ID, 'prompt':'consent'} URL_DICT = { # Google OAuth URI 'google_oauth' : 'https://accounts.google.com/o/oauth2/v2/auth', # URI to generate token to access Google API 'token_gen' : 'https://oauth2.googleapis.com/token', # URI to get the user info 'get_user_info' : 'https://www.googleapis.com/oauth2/v3/userinfo' } CLIENT = oauth2.WebApplicationClient(CLIENT_ID) REQ_URI = CLIENT.prepare_request_uri( uri=URL_DICT['google_oauth'], redirect_uri=DATA['redirect_uri'], scope=DATA['scope'], prompt=DATA['prompt'])
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/rounds.py
from flask import render_template, url_for, flash, redirect, jsonify, request, Response from qxf2_scheduler import app import qxf2_scheduler.qxf2_scheduler as my_scheduler from qxf2_scheduler import db import json,ast,sys,os,datetime from flask_login import login_required from qxf2_scheduler.models import Jobs, Rounds, Jobround, Interviewers, Roundinterviewers def fetch_interviewers_for_rounds(round_id,job_id): "Fetch interviewers id for the rounds" # Fetch the interviewers id for the round interviewers_lst_for_rounds = [] db_interviewer_list_for_rounds = Roundinterviewers.query.filter(Roundinterviewers.job_id == job_id, Roundinterviewers.round_id == round_id).values(Roundinterviewers.interviewers_id) for each_interviewer in db_interviewer_list_for_rounds: interviewers_lst_for_rounds.append(each_interviewer.interviewers_id) return interviewers_lst_for_rounds def fetch_interviewers_names_for_rounds(round_interviewers_id): "Fetch interviewers names from id list" #Fetch the interviewers name from the interviewers id interviewers_name_list = [] for each_interviewer_id in round_interviewers_id: interviewer_name = Interviewers.query.filter(Interviewers.interviewer_id == each_interviewer_id).value(Interviewers.interviewer_name) interviewers_name_list.append({'interviewer_name':interviewer_name,'interviewer_id':each_interviewer_id}) return interviewers_name_list from qxf2_scheduler.authentication_required import Authentication_Required from qxf2_scheduler.models import Jobs, Rounds, Jobround, Interviewers @app.route("/job/<job_id>/rounds",methods=["GET","POST"]) @Authentication_Required.requires_auth def read_round_details(job_id): "read round details" if request.method == 'GET': try: rounds_list = [] db_round_list = db.session.query(Jobround, Rounds).filter(Jobround.job_id == job_id, Rounds.round_id == Jobround.round_id).group_by(Rounds.round_id).values( Rounds.round_id,Rounds.round_name,Rounds.round_time,Rounds.round_description,Rounds.round_requirement) for each_round in db_round_list: round_interviewers_id_list = fetch_interviewers_for_rounds(each_round.round_id,job_id) round_interviewers_names_list = fetch_interviewers_names_for_rounds(round_interviewers_id_list) rounds_list.append( { 'round_id':each_round.round_id, 'round_name':each_round.round_name, 'round_time' : each_round.round_time, 'round_description' : each_round.round_description, 'round_requirement' : each_round.round_requirement, 'round_interviewers':round_interviewers_names_list}) except Exception as e: print(e) return render_template("rounds.html",result=rounds_list,job_id=job_id) def fetch_all_interviewers(): "Fetch all interviewers" my_interviewers_list = [] display_interviewers = Interviewers.query.all() for each_interviewer in display_interviewers: my_interviewers_list.append({'interviewer_id':each_interviewer.interviewer_id,'interviewer_name':each_interviewer.interviewer_name}) return my_interviewers_list @app.route("/jobs/<job_id>/round/add",methods=["GET","POST"]) @Authentication_Required.requires_auth def add_rounds_details(job_id): "add rounds details" if request.method == "GET": #Fetch all the interviewers for adding rounds interviewers_list = [] interviewers_list = fetch_all_interviewers() if request.method == "POST": data = {} round_time = request.form.get('roundTime') round_description = request.form.get('roundDescription') round_requirements = request.form.get('roundRequirements') round_name = request.form.get('roundName') added_interviewers_list = request.form.getlist('addedInterviewers[]') data={'round_name':round_name,'job_id':job_id} #Adding the round details into the database add_round_object = Rounds(round_name=round_name,round_time=round_time,round_description=round_description,round_requirement=round_requirements) db.session.add(add_round_object) db.session.flush() round_id = add_round_object.round_id db.session.commit() #Adding the round and job id to the jobround table add_job_round_object = Jobround(round_id=round_id,job_id=job_id) db.session.add(add_job_round_object) db.session.commit() for each_interviewer in added_interviewers_list: add_round_interviewers = Roundinterviewers(round_id=round_id,job_id=job_id,interviewers_id=each_interviewer) db.session.add(add_round_interviewers) db.session.commit() api_response = {'data':data} return jsonify(api_response) return render_template("add-rounds.html",job_id=job_id,interviewers=interviewers_list) @app.route("/rounds/<round_id>/jobs/<job_id>/delete") @Authentication_Required.requires_auth def delete_round_details(round_id,job_id): "delete round details" delete_round = Rounds.query.filter(Rounds.round_id == round_id).first() db.session.delete(delete_round) db.session.commit() delete_job_round = Jobround.query.filter(Jobround.job_id == job_id,Jobround.round_id == round_id).first() db.session.delete(delete_job_round) db.session.commit() return jsonify(data="Deleted") def remove_interviewers_in_common(new_interviewers_list,round_interviewers_id_list): "remove interviewers in common" for each_interviewers in new_interviewers_list: if each_interviewers in round_interviewers_id_list: new_interviewers_list.remove(each_interviewers) round_interviewers_id_list.remove(each_interviewers) return new_interviewers_list, round_interviewers_id_list def deleting_old_interviewers(round_interviewers_id_list,round_id,job_id): "Delete the interviewers which is not there in the new edit" for each_remove_interviewers in round_interviewers_id_list: remove_interviewer_object = Roundinterviewers.query.filter(Roundinterviewers.interviewers_id==each_remove_interviewers,Roundinterviewers.round_id==round_id,Roundinterviewers.job_id==job_id).first() db.session.delete(remove_interviewer_object) db.session.commit() def adding_new_interviewers(new_interviewers_list,round_id,job_id): "Adding the new interviewers for the round" for each_add_interviewers in new_interviewers_list: add_new_interviewer_object = Roundinterviewers(round_id=round_id,job_id=job_id,interviewers_id=each_add_interviewers) db.session.add(add_new_interviewer_object) db.session.commit() def check_round_interviewers(round_id,job_id,new_interviewers_list,round_interviewers_id_list): "check the interviewers for round" if round_interviewers_id_list == new_interviewers_list: pass else: new_interviewers_list,round_interviewers_id_list=remove_interviewers_in_common(new_interviewers_list,round_interviewers_id_list) #deleting the old interviewers deleting_old_interviewers(round_interviewers_id_list,round_id,job_id) #Adding the new interviewers adding_new_interviewers(new_interviewers_list,round_id,job_id) @app.route("/rounds/<round_id>/jobs/<job_id>/edit",methods=["GET","POST"]) @Authentication_Required.requires_auth def edit_round_details(round_id,job_id): "Edit the round details" if request.method == "GET": rounds_list = [] db_round_list = db.session.query(Rounds).filter(Rounds.round_id == round_id).values(Rounds.round_id,Rounds.round_name,Rounds.round_time,Rounds.round_description,Rounds.round_requirement) # Fetch interviewers name list for rounds round_interviewers_id_list = fetch_interviewers_for_rounds(round_id,job_id) round_interviewers_name_list = fetch_interviewers_names_for_rounds(round_interviewers_id_list) # Fetch all interviewers interviewers_list = fetch_all_interviewers() #Removing selected interviewers for each_interviewer in round_interviewers_name_list: if each_interviewer in interviewers_list: interviewers_list.remove(each_interviewer) for each_round in db_round_list: rounds_list.append( { 'round_id':each_round.round_id, 'round_name':each_round.round_name, 'round_time' : each_round.round_time, 'round_description' : each_round.round_description, 'round_requirement' : each_round.round_requirement} ) return render_template("edit-rounds.html",result=rounds_list,job_id=job_id,interviewers_name_list=round_interviewers_name_list,interviewers_list=interviewers_list) if request.method=="POST": data = {} round_time = request.form.get('roundTime') round_description = request.form.get('roundDescription') round_requirements = request.form.get('roundRequirements') round_name = request.form.get('roundName') new_interviewers_list = request.form.getlist('editedinterviewers[]') data = {'round_name':round_name} #Fetch the existing interviewers for the rounds round_interviewers_id_list = fetch_interviewers_for_rounds(round_id,job_id) #Check tow lists are identical check_round_interviewers(round_id,job_id,new_interviewers_list,round_interviewers_id_list) edit_round_object = Rounds.query.filter(Rounds.round_id==round_id).update({'round_name':round_name,'round_time':round_time,'round_description':round_description,'round_requirement':round_requirements}) db.session.commit() api_response = {'data':data} return (jsonify(api_response)) @app.route("/roundname/get-description",methods=["GET","POST"]) @Authentication_Required.requires_auth def get_round_description(): "Get the round description" round_details = ast.literal_eval(request.form.get("round_name")) data={'round_id':round_details[0],'round_name':round_details[1]} round_description = db.session.query(Rounds).filter(Rounds.round_id==data['round_id']).scalar() round_descriptions = {'round_description':round_description.round_description,'round_id':round_details[0],'round_name':round_details[1],'round_time':round_description.round_time} return jsonify(round_descriptions)
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/models.py
from qxf2_scheduler import db import datetime from sqlalchemy import Integer, ForeignKey, String, Column,CheckConstraint,DateTime from sqlalchemy.sql import table, column from flask_seeder import Seeder, Faker, generator class Interviewers(db.Model): "Adding the interviewer" interviewer_id = db.Column(db.Integer,primary_key=True) interviewer_name = db.Column(db.String(50),nullable=False) interviewer_email = db.Column(db.String(50),nullable=False) interviewer_designation = db.Column(db.String(40),nullable=False) db.CheckConstraint(interviewer_name > 5) def __repr__(self): return f"Interviewers('{self.interviewer_name}', '{self.interviewer_email}','{self.interviewer_designation}')" class Interviewertimeslots(db.Model): "Adding the timing for interviewer" time_id = db.Column(db.Integer,primary_key=True) interviewer_id = db.Column(db.Integer,db.ForeignKey(Interviewers.interviewer_id),nullable=False) interviewer_start_time = db.Column(db.String,nullable=False) interviewer_end_time = db.Column(db.String,nullable=False) def __repr__(self): return f"Interviewertimeslots('{self.interviewer_id}', '{self.interviewer_start_time}','{self.interviewer_end_time}','{self.time_id}')" class Jobs(db.Model): "Adding the Job page" job_id = db.Column(db.Integer,primary_key=True,nullable=False) job_role = db.Column(db.String,nullable=False) job_status = db.Column(db.String) def __repr__(self): return f"Jobs('{self.job_id}','{self.job_role}')" class Jobinterviewer(db.Model): "Combine Job id and Interviewer ID" combo_id = db.Column(db.Integer,primary_key=True,autoincrement=True) job_id = db.Column(db.Integer,ForeignKey(Jobs.job_id)) interviewer_id = db.Column(db.Integer,ForeignKey(Interviewers.interviewer_id)) def __repr__(self): return f"Jobinterviewer('{self.job_id}','{self.interviewer_id}')" class Candidates(db.Model): "Adding the candidates" candidate_id = db.Column(db.Integer,primary_key=True,nullable=False) candidate_name = db.Column(db.String,nullable=False) candidate_email = db.Column(db.String,nullable=False) date_applied = db.Column(DateTime, default=datetime.datetime.utcnow) job_applied = db.Column(db.String,nullable=False) comments = db.Column(db.String) last_updated_date = db.Column(db.String) def __repr__(self): return f"Candidates('{self.candidate_name}','{self.candidate_email}')" class Rounds(db.Model): "Adding the rounds" round_id = db.Column(db.Integer,primary_key=True) round_name = db.Column(db.String,nullable=False) round_time = db.Column(db.String,nullable=False) round_description = db.Column(db.String,nullable=False) round_requirement = db.Column(db.String,nullable=False) def __repr__(self): return f"Rounds('{self.round_time}','{self.round_description}','{self.round_requirement}','{self.round_name}','{self.added_interviewers}')" class Roundinterviewers(db.Model): "Adding interviewers for rounds" combo_id = db.Column(db.Integer,primary_key=True) round_id = db.Column(db.Integer,ForeignKey(Rounds.round_id)) interviewers_id = db.Column(db.Integer,ForeignKey(Interviewers.interviewer_id)) job_id = db.Column(db.Integer,ForeignKey(Jobs.job_id)) def __repr__(self): return f"Roundinterviewers('{self.round_id}','{self.interviewers_id}')" class Jobcandidate(db.Model): "Combine Job id and Candidate ID" combo_id = db.Column(db.Integer,primary_key=True) candidate_id = db.Column(db.Integer,ForeignKey(Candidates.candidate_id)) job_id = db.Column(db.Integer,ForeignKey(Jobs.job_id)) url = db.Column(db.String) unique_code = db.Column(db.String) interview_start_time = db.Column(db.String) interview_end_time = db.Column(db.String) interview_date = db.Column(db.String) interviewer_email = db.Column(db.String) candidate_status = db.Column(db.String) def __repr__(self): return f"Jobcandidate('{self.candidate_id}','{self.job_id}','{self.url}','{self.candidate_status}','{self.interview_start_time}','{self.unique_code}')" class Jobround(db.Model): "Combine Job id and Round id" combo_id = db.Column(db.Integer,primary_key=True) job_id = db.Column(db.Integer,ForeignKey(Jobs.job_id)) round_id = db.Column(db.Integer,ForeignKey(Rounds.round_id)) def __repr__(self): return f"Jobround('{self.job_id}','{self.round_id}')" class Candidateround(db.Model): "Combine candidate id and round id" combo_id = db.Column(db.Integer,primary_key=True) job_id = db.Column(db.Integer,ForeignKey(Jobs.job_id)) candidate_id = db.Column(db.Integer,ForeignKey(Candidates.candidate_id)) round_id = db.Column(db.Integer,ForeignKey(Rounds.round_id)) round_status = db.Column(db.String) candidate_feedback = db.Column(db.String) thumbs_value = db.Column(db.String) class Candidatestatus(db.Model): "Save the status list" status_id = db.Column(db.Integer,primary_key=True) status_name = db.Column(db.String) class Updatetable(db.Model): "Store the last updated date of Jobcandidate" table_id = db.Column(db.Integer,primary_key=True) last_updated_date = db.Column(db.Integer) class Candidateinterviewer(db.Model): "Combine candidate id ,interviewer id and round id,job id" combo_id = db.Column(db.Integer,primary_key=True) job_id = db.Column(db.Integer,ForeignKey(Jobs.job_id)) candidate_id = db.Column(db.Integer,ForeignKey(Candidates.candidate_id)) interviewer_id = db.Column(db.Integer,ForeignKey(Interviewers.interviewer_id)) def __repr__(self): return f"Candidateinterviewer('{self.job_id}','{self.candidate_id}','{self.interviewer_id}')" class Interviewcount(db.Model): "Keep the number of interview count for interviewers" id = db.Column(db.Integer, primary_key=True) interviewer_id = db.Column(db.Integer,ForeignKey(Interviewers.interviewer_id)) interview_count = db.Column(db.Integer) def __repr__(self): return f"Interviewcount('{self.interviewer_id}','{self.interview_count}')"
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/security.py
from passlib.context import CryptContext pwd_context = CryptContext( schemes=["pbkdf2_sha256"], default="pbkdf2_sha256", pbkdf2_sha256__default_rounds=30000 ) def encrypt_password(password): return pwd_context.encrypt(password) def check_encrypted_password(password, hashed): return pwd_context.verify(password, hashed)
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/__init__.py
from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_mail import Mail, Message from flaskext.markdown import Markdown import qxf2_scheduler.db_config as conf import qxf2_scheduler.email_config as email_conf from flask_seeder import FlaskSeeder import os import logging app = Flask(__name__) db_file = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'data/interviewscheduler.db')) app.secret_key = "qxf2-database" app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///%s"%db_file logging.basicConfig(filename='record.log', level=logging.DEBUG, format=f'%(asctime)s %(levelname)s %(name)s %(threadName)s : %(message)s') db = SQLAlchemy(app) Markdown(app) db.init_app(app) seeder = FlaskSeeder() seeder.init_app(app,db) app.config.update( DEBUG=True, #EMAIL SETTINGS MAIL_SERVER='smtp.gmail.com', MAIL_PORT=465, MAIL_USE_SSL=True, MAIL_USE_TLS = False, MAIL_USERNAME = email_conf.MAIL_USERNAME, MAIL_PASSWORD = email_conf.MAIL_PASSWORD, MAIL_DEFAULT_SENDER = email_conf.MAIL_USERNAME ) from qxf2_scheduler import routes from qxf2_scheduler import candidates from qxf2_scheduler import rounds from qxf2_scheduler import status
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/candidate_status.py
CANDIDTATE_STATUS = ['Waiting on Qxf2','Waiting on Candidate','Interview Scheduled','No response','Reject','Hired','Waiting for new opening']
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/qxf2_scheduler.py
""" This module contains business logic that wraps around the Google calendar module We use this extensively in the routes.py of the qxf2_scheduler application """ import qxf2_scheduler.base_gcal as gcal #import base_gcal as gcal from googleapiclient.errors import HttpError import datetime from datetime import timedelta import random,sys, string from qxf2_scheduler import db from apscheduler.schedulers.background import BackgroundScheduler import pandas as pd TIMEZONE_STRING = '+05:30' FMT='%H:%M' #CHUNK_DURATION = '60' ATTENDEE = 'annapoorani@qxf2.com' DATE_TIME_FORMAT = "%m/%d/%Y%H:%M" NEW_DATE_TIME_FORMAT = "%Y-%m-%dT%H:%M:%S+05:30" from pytz import timezone from qxf2_scheduler.models import Jobcandidate,Updatetable,Interviewers,Candidates,Candidateround, Interviewcount def convert_to_timezone(date_and_time): "convert the time into current timezone" # Current time in UTC format = "%Y-%m-%d %H:%M:%S %Z%z" # Convert to Asia/Kolkata time zone now_asia = date_and_time.astimezone(timezone('Asia/Kolkata')) now_asia = now_asia.strftime(format) return now_asia def scheduler_job(): "Runs this job in the background" last_inserted_id = db.session.query(Updatetable).order_by(Updatetable.table_id.desc()).first() fetch_interview_time = Jobcandidate.query.all() for each_interview_time in fetch_interview_time: if each_interview_time.interview_start_time == None: pass else: interview_start_time = datetime.datetime.strptime(each_interview_time.interview_start_time,'%Y-%m-%dT%H:%M:%S+05:30') # Current time in UTC now_utc = datetime.datetime.now(timezone('UTC')) current_date_and_time = convert_to_timezone(now_utc) current_date_and_time = datetime.datetime.strptime(current_date_and_time,"%Y-%m-%d %H:%M:%S IST+0530") candidate_status = each_interview_time.candidate_status if interview_start_time <= current_date_and_time and int(candidate_status) == 3: update_candidate_status = Jobcandidate.query.filter(each_interview_time.candidate_id==Jobcandidate.candidate_id).update({'candidate_status':1}) db.session.commit() fetch_candidate_round_status = Candidateround.query.all() for each_round_status in fetch_candidate_round_status: if each_round_status.round_status == None: pass else: if interview_start_time <= current_date_and_time and int(candidate_status) == 1 and each_round_status.round_status == 'Interview Scheduled': update_round_status = Candidateround.query.filter(each_round_status.candidate_id == Candidateround.candidate_id).update({'round_status':'Completed'}) db.session.commit() #Running the task in the background to update the jobcandidate table sched = BackgroundScheduler(daemon=True) #sched.add_job(scheduler_job,'cron', minute='*') sched.add_job(scheduler_job,'cron',day_of_week='mon-fri', hour='*', minute='*') sched.start() def convert_string_into_time(alloted_slots): "Converting the given string into time" alloted_slots = datetime.datetime.strptime(alloted_slots,FMT) return alloted_slots def get_datetime_in_time_format(time_frame_slots): "Split the time into hours and minutes" time_frame_slots = time_frame_slots.strftime("%H") + ":" + time_frame_slots.strftime("%M") return time_frame_slots def is_past_date(date): "Is this date in the past?" result_flag = True date = gcal.process_date_string(date) today = gcal.get_today() if date >= today: result_flag = False return result_flag def is_qxf2_holiday(date): "Is this date a Qxf2 holiday?" holidays = ['2021-01-01', '2021-01-14', '2021-01-26', '2021-04-13','2021-05-14', '2021-09-10', '2021-10-15', '2021-11-01', '2021-11-05']; #Holiday date format is different to keep it consistent with the JavaScript #That way, you can copy paste the same array between the html and here holiday_format = '%Y-%m-%d' date = gcal.process_date_string(date,holiday_format) date = date.strftime(holiday_format) result_flag = True if date in holidays else False return result_flag def is_weekend(date): "Is this a weekend?" date = gcal.process_date_string(date) day = date.weekday() return True if day==5 or day==6 else False def convert_combined_string_into_isoformat(create_event_timings_and_date): "Converting the string into iso format" converted_create_event_date_and_time = datetime.datetime.strptime(create_event_timings_and_date,DATE_TIME_FORMAT).isoformat() return converted_create_event_date_and_time def combine_date_and_time(date,selected_slot): "Combine the date and selected slot into isoformat" start_time = selected_slot.split('-')[0].strip() end_time = selected_slot.split('-')[-1].strip() create_event_start_time = convert_combined_string_into_isoformat((date + start_time)) create_event_end_time = convert_combined_string_into_isoformat((date + end_time)) return create_event_start_time,create_event_end_time def append_the_create_event_info(create_event,interviewer_email_id, jitsi_link): "Appends the created event information into list" created_event_info = [] created_event_info.append({'start':create_event['start']}) created_event_info.append({'end':create_event['end']}) created_event_info.append({'Link':jitsi_link}) created_event_info.append({'interviewer_email':interviewer_email_id}) return created_event_info def convert_interviewer_time_into_string(interviewer_time): "Convert the integer into string format" interviewer_actual_time = datetime.datetime.strptime(str(interviewer_time),"%H") interviewer_actual_time = interviewer_actual_time.strftime("%H") + ":" + interviewer_actual_time.strftime("%M") return interviewer_actual_time def convert_string_into_time_new(conversion_time): "convert string into time" return datetime.datetime.strptime(conversion_time, NEW_DATE_TIME_FORMAT) def calculate_difference_in_time(start, end): "Calculate the difference between start and end busy slots" converted_start_time = convert_string_into_time_new(start) converted_end_time = convert_string_into_time_new(end) diff_time = converted_end_time-converted_start_time return diff_time def total_busy_slot_for_interviewer(busy_slots): "Calculates the total busy duration for the interviewer" t='00:00:00' total_busy_time = datetime.datetime.strptime(t,'%H:%M:%S') for each_slot in busy_slots: start_time = each_slot['start'] end_time = each_slot['end'] diff_time = calculate_difference_in_time(start_time,end_time) total_busy_time = total_busy_time + diff_time return total_busy_time def get_busy_slots_for_fetched_email_id(email_id,fetch_date,debug=False): "Get the busy slots for a given date" service = gcal.base_gcal() busy_slots = [] event_organizer_list = [] if service: all_events = gcal.get_events_for_date(service,email_id,fetch_date) if all_events: for event in all_events: event_organizer = event['organizer']['email'] event_organizer_list.append(event_organizer) busy_slots = gcal.get_busy_slots_for_date(service,email_id,fetch_date,timeZone=gcal.TIMEZONE,debug=debug) return busy_slots def total_busy_slots(attendee_email_id, date): "Find the total busy slots for all interviewers" total_busy_time_list = [] for each_attendee in attendee_email_id: busy_slots = get_busy_slots_for_fetched_email_id(each_attendee,date) total_time = total_busy_slot_for_interviewer(busy_slots) total_busy_time_list.append(total_time) return total_busy_time_list def total_count_list(attendee_email_id): "Find the total interview count for the interviewer" total_interview_count_list = [] for new_attendee in attendee_email_id: attendee_id = Interviewers.query.filter(Interviewers.interviewer_email == new_attendee).value(Interviewers.interviewer_id) #fetch the interview count for the interviewer interview_count = Interviewcount.query.filter(Interviewcount.interviewer_id == attendee_id).value(Interviewcount.interview_count) if interview_count is None: total_interview_count_list.append(0) else: total_interview_count_list.append(interview_count) return total_interview_count_list def pick_interviewer(attendee_email_id,date): "Pick the interviewer based on busy time" #Find the total busy slots for the interviewers busy_time_list = total_busy_slots(attendee_email_id, date) #Find the interview count for the interviewer interview_count_list = total_count_list(attendee_email_id) #Scoring algorithm to pick the interviewer busy_slots_rank = pd.DataFrame(busy_time_list, attendee_email_id).rank() interview_count_rank = pd.DataFrame(interview_count_list, attendee_email_id).rank(ascending=False) average_busy_interview_count = (busy_slots_rank + interview_count_rank).rank() df_rank_to_dict = average_busy_interview_count.to_dict()[0] picked_attendee_email_id = max(df_rank_to_dict, key=df_rank_to_dict.get) return picked_attendee_email_id def create_event_for_fetched_date_and_time(date,interviewer_emails,candidate_email,selected_slot,round_name,round_description): "Create an event for fetched date and time" service = gcal.base_gcal() interviewer_candidate_email = [] if ',' in interviewer_emails: attendee_email_id = interviewer_emails.split(',') picked_email_id = pick_interviewer(attendee_email_id,date) else: picked_email_id = interviewer_emails interviewer_candidate_email.append(picked_email_id) interviewer_candidate_email.append(candidate_email) #Fetch interviewers name from the email fetch_interviewer_name = Interviewers.query.filter(Interviewers.interviewer_email==picked_email_id).values(Interviewers.interviewer_name) for interviewer_name in fetch_interviewer_name: chosen_interviewer_name = interviewer_name.interviewer_name #Fetch candidate info fetch_candidate_name = Candidates.query.filter(Candidates.candidate_email==candidate_email).values(Candidates.candidate_name,Candidates.job_applied) for candidate_details in fetch_candidate_name: candidate_name = candidate_details.candidate_name candidate_job = candidate_details.job_applied res = ''.join(random.choices(string.ascii_uppercase + string.digits, k = 7)) jitsi_link = "https://meet.jit.si/interviewScheduler/%s"%res LOCATION = jitsi_link SUMMARY = candidate_name + '/' + chosen_interviewer_name + '-' + candidate_job description = "Round name : "+round_name+'\n\n'+ 'Round description : '+round_description + " Use the Jitsi link to join the meeting " + jitsi_link create_event_start_time,create_event_end_time = combine_date_and_time(date,selected_slot) create_event = gcal.create_event_for_fetched_date_and_time(service,create_event_start_time,create_event_end_time, SUMMARY,LOCATION,description,interviewer_candidate_email) created_event_info = append_the_create_event_info(create_event,picked_email_id,jitsi_link) return created_event_info def get_modified_free_slot_start(free_slot_start,marker): "Modifiying the free slot start to 00 or 30" if marker == '60' or marker == '90': if free_slot_start[-2:]=='00' or free_slot_start[-2:]=='30' or free_slot_start[-2:]=='45': modified_free_slot_start = free_slot_start elif free_slot_start[-2:] <= '30' and free_slot_start[-2] != '00': modified_free_slot_start = '{}:{}'.format(free_slot_start.split(':')[0], '30') else: free_slot_start = '{}:{}'.format(free_slot_start.split(':')[0], '00') modified_free_slot_start = convert_string_into_time(free_slot_start) + timedelta(hours=1) modified_free_slot_start = get_datetime_in_time_format(modified_free_slot_start) if marker == '45': if free_slot_start[-2:]=='00' or free_slot_start[-2:]=='30' or free_slot_start[-2:]=='45': modified_free_slot_start = free_slot_start elif free_slot_start[-2:] <= '30' and free_slot_start[-2] != '00': modified_free_slot_start = '{}:{}'.format(free_slot_start.split(':')[0], '30') elif free_slot_start[-2:] > '30'or free_slot_start[-2:] < '45': modified_free_slot_start = '{}:{}'.format(free_slot_start.split(':')[0], marker) else: free_slot_start = '{}:{}'.format(free_slot_start.split(':')[0], '00') modified_free_slot_start = convert_string_into_time(free_slot_start) + timedelta(hours=1) modified_free_slot_start = get_datetime_in_time_format(modified_free_slot_start) if marker == '30': if free_slot_start[-2:]=='00': modified_free_slot_start = free_slot_start elif free_slot_start[-2:] <= marker: modified_free_slot_start = '{}:{}'.format(free_slot_start.split(':')[0], marker) elif free_slot_start[-2:] > marker: free_slot_start = '{}:{}'.format(free_slot_start.split(':')[0], '00') modified_free_slot_start = convert_string_into_time(free_slot_start) + timedelta(hours=1) modified_free_slot_start = get_datetime_in_time_format(modified_free_slot_start) return modified_free_slot_start def get_modified_free_slot_end(free_slot_end,marker): "Modifiying the free slot start to 00 or 30" if marker == '45': if free_slot_end[-2:]=='00' or free_slot_end[-2:]==marker : modified_free_slot_end = free_slot_end elif free_slot_end[-2:] < '30' and free_slot_end[-2] != '00': modified_free_slot_end = '{}:{}'.format(free_slot_end.split(':')[0], '00') elif free_slot_end[-2:] >= '30'or free_slot_end[-2:] < '45': modified_free_slot_end = '{}:{}'.format(free_slot_end.split(':')[0], 30) elif free_slot_end[-2:] > marker: modified_free_slot_end = '{}:{}'.format(free_slot_end.split(':')[0], marker) if marker == '60' or marker == '90': if free_slot_end[-2:]=='00' or free_slot_end[-2:]=='30' or free_slot_end[-2]=='45': modified_free_slot_end = free_slot_end elif free_slot_end[-2:] <'30' and free_slot_end[-2] != '00': modified_free_slot_end = '{}:{}'.format(free_slot_end.split(':')[0], '00') elif free_slot_end[-2:] > '30': free_slot_end = '{}:{}'.format(free_slot_end.split(':')[0], '00') modified_free_slot_end = convert_string_into_time(free_slot_end) + timedelta(hours=1) modified_free_slot_end = get_datetime_in_time_format(modified_free_slot_end) if marker == '30': if free_slot_end[-2:]=='00' or free_slot_end[-2:]==marker : modified_free_slot_end = free_slot_end elif free_slot_end[-2:] < marker: modified_free_slot_end = '{}:{}'.format(free_slot_end.split(':')[0], '00') elif free_slot_end[-2:] > marker: modified_free_slot_end = '{}:{}'.format(free_slot_end.split(':')[0], marker) return modified_free_slot_end def get_chunks_in_slot(modified_free_slot_start,modified_free_slot_end,diff_between_slots_after_modified,interviewer_email_id,CHUNK_DURATION): "Divides the free slots into chunks" chunk_slots = modified_free_slot_start result_flag = True idx=0 time_delta=timedelta(minutes=int(CHUNK_DURATION)) chunk_slot_list = [] chunk_time_interval = [] if diff_between_slots_after_modified == timedelta(minutes=int(CHUNK_DURATION)): chunk_slot_list.append(modified_free_slot_start) chunk_slot_list.append(modified_free_slot_end) chunk_time_interval.append({'start':modified_free_slot_start,'end':modified_free_slot_end,'email':interviewer_email_id}) else: while result_flag: chunk_slots = convert_string_into_time(chunk_slots) chunk_slots = chunk_slots + timedelta(minutes=int(CHUNK_DURATION)) chunk_slots = get_datetime_in_time_format(chunk_slots) if idx==0: chunk_slot_list.append(modified_free_slot_start) chunk_slot_list.append(chunk_slots) chunk_slot_start = chunk_slot_list[idx] chunk_slot_end = chunk_slot_list[idx+1] chunk_time_interval.append({'start':chunk_slot_start,'end':chunk_slot_end,'email':interviewer_email_id}) else: chunk_slot_list.append(chunk_slots) chunk_slot_start = chunk_slot_list[idx] chunk_slot_end = chunk_slot_list[idx+1] chunk_time_interval.append({'start':chunk_slot_start,'end':chunk_slot_end,'email':interviewer_email_id}) idx = idx+1 modified_free_slot_start = convert_string_into_time(modified_free_slot_start) modified_free_slot_start = modified_free_slot_start + timedelta(minutes=int(CHUNK_DURATION)) modified_free_slot_start = get_datetime_in_time_format(modified_free_slot_start) diff_between_slot_start_and_end = convert_string_into_time(modified_free_slot_end) - convert_string_into_time(modified_free_slot_start) #While loop should stop if both time become equal if modified_free_slot_end == modified_free_slot_start or modified_free_slot_end <= modified_free_slot_start or diff_between_slot_start_and_end < timedelta(minutes=int(CHUNK_DURATION)): result_flag = False return chunk_time_interval def combine_multiple_chunks(divided_chunk_slots): "Combine the multiple chunks into one button" grouped_chunk_slots = {} for each_chunk in divided_chunk_slots: key = (each_chunk["start"], each_chunk["end"]) if key in grouped_chunk_slots: grouped_chunk_slots[key]["email"].append(each_chunk["email"]) else: grouped_chunk_slots[key] = each_chunk grouped_chunk_slots[key]["email"] = [each_chunk["email"]] divided_chunk_slots = list(grouped_chunk_slots.values()) return divided_chunk_slots def get_free_slots_in_chunks(free_slots,CHUNK_DURATION): "Return the free slots in 30 minutes interval" #Appending the 30 minutes slot into list divided_chunk_slots = [] if free_slots == None: print("There are no more free slots available for this user") else: for free_slot in free_slots: #Initializing the free slot start free_slot_start = free_slot['start'] #Intializing the next free slot end free_slot_end = free_slot['end'] interviewer_email_id = free_slot['email_id'] #Find the difference between start and end slot diff_between_slots = convert_string_into_time(free_slot_end) - convert_string_into_time(free_slot_start) if diff_between_slots >= timedelta(minutes=int(CHUNK_DURATION)): modified_free_slot_start = get_modified_free_slot_start(free_slot_start,marker=CHUNK_DURATION) modified_free_slot_end = get_modified_free_slot_end(free_slot_end,marker=CHUNK_DURATION) diff_between_slots_after_modified = convert_string_into_time(modified_free_slot_end) - convert_string_into_time(modified_free_slot_start) divided_chunk_slots += get_chunks_in_slot(modified_free_slot_start,modified_free_slot_end,diff_between_slots_after_modified,interviewer_email_id,CHUNK_DURATION) divided_chunk_slots = sorted(divided_chunk_slots, key=lambda k: k['start']) divided_chunk_slots = combine_multiple_chunks(divided_chunk_slots) return divided_chunk_slots def get_free_slots(busy_slots, day_start, day_end): "Return the free slots" """ Logic: 1. If busy slots are empty ... set (day_start, day_end) as the interval 2. There are 6 types of busy slots for us: a) A busy slot that ends before day start - we ignore b) A busy slot that starts after the day end - we ignore c) A busy slot that starts before the day start and ends after day end - we say there are no free slots in that day d) A busy slot that starts before day start but ends before day end - we set the start of the first free slot to the end of this busy slot e) A busy slot that starts (after day start, before day end) but ends after day end - we set the end of the last free slot to be the start of this busy slot f) A busy slot that starts after day start and ends before day end - we accept both ends points of this slot """ free_slots = [] if len(busy_slots) == 0: free_slots.append(day_start) for busy_slot in busy_slots: if busy_slot['end'] < day_start: if busy_slots[-1]==busy_slot: if len(free_slots) == 0: free_slots.append(day_start) else: continue elif busy_slot['start'] > day_end: if len(free_slots) == 0: free_slots.append(day_start) elif busy_slot['start'] <= day_start and busy_slot['end'] >= day_end: break elif busy_slot['start'] <= day_start and busy_slot['end'] < day_end: free_slots.append(busy_slot['end']) elif busy_slot['start'] > day_start and busy_slot['end'] > day_end: #At this point the day has started if len(free_slots) == 0: free_slots.append(day_start) free_slots.append(busy_slot['start']) else: #If we make it this far and free_slots is still empty #It means the start of the free slot is the start of the day if len(free_slots) == 0: free_slots.append(day_start) free_slots.append(busy_slot['start']) free_slots.append(busy_slot['end']) #If we have an odd number of values in free_slots #It means that we need to close one interval with end of day if len(free_slots)%2 == 1: if free_slots[-1]==day_end: free_slots = free_slots[:-1] else: free_slots.append(day_end) return free_slots def get_busy_slots_for_date(email_id,fetch_date,debug=False): "Get the busy slots for a given date" service = gcal.base_gcal() busy_slots = [] pto_flag = False event_organizer_list = [] if service: all_events = gcal.get_events_for_date(service,email_id,fetch_date) if all_events: for event in all_events: event_organizer = event['organizer']['email'] event_organizer_list.append(event_organizer) if 'summary' in event.keys(): event_name = event['summary'].split(':')[-1].strip() event_name = event_name.split()[0] if 'PTO'.lower() == event_name.lower(): pto_flag = True break else: pto_flag = True if pto_flag: busy_slots = gcal.make_day_busy(fetch_date) else: busy_slots = gcal.get_busy_slots_for_date(service,email_id,fetch_date,timeZone=gcal.TIMEZONE,debug=debug) return busy_slots,pto_flag def get_interviewer_email_id(interviewer_work_time_slots): "Parse the email id from the list" interviewers_email_id = [] for each_interviewer_in_row in interviewer_work_time_slots: interviewers_email_id.append(each_interviewer_in_row['interviewer_email']) return interviewers_email_id def process_free_slot(fetch_date,day_start_hour,day_end_hour,individual_interviewer_email_id,busy_slots): "Process the time" processed_free_slots = [] day_start = process_time_to_gcal(fetch_date,day_start_hour) day_end = process_time_to_gcal(fetch_date,day_end_hour) free_slots = get_free_slots(busy_slots,day_start,day_end) for i in range(0,len(free_slots),2): processed_free_slots.append({'start':process_only_time_from_str(free_slots[i]),'end':process_only_time_from_str(free_slots[i+1]),'email_id':individual_interviewer_email_id}) return processed_free_slots def get_free_slots_for_date(fetch_date,interviewer_work_time_slots,debug=False): "Return a list of free slots for a given date and email" final_processed_free_slots = [] for each_slot in interviewer_work_time_slots: individual_interviewer_email_id = each_slot['interviewer_email'] day_start_hour = each_slot['interviewer_start_time'] day_end_hour = each_slot['interviewer_end_time'] busy_slots,pto_flag = get_busy_slots_for_date(individual_interviewer_email_id,fetch_date,debug=debug) len_of_busy_slots= len(busy_slots) #If the calendar is empty and no pto if len_of_busy_slots == 0 and pto_flag == False: final_processed_free_slots += process_free_slot(fetch_date,day_start_hour,day_end_hour,individual_interviewer_email_id,busy_slots) if len_of_busy_slots >=1: final_processed_free_slots += process_free_slot(fetch_date,day_start_hour,day_end_hour,individual_interviewer_email_id,busy_slots) return final_processed_free_slots def get_events_for_date(email_id, fetch_date, maxResults=240,debug=False): "Get all the events for a fetched date" service = gcal.base_gcal() events = gcal.get_events_for_date(service,email_id,fetch_date,debug=debug) return events def process_time_to_gcal(given_date,hour_offset=None): "Process a given string to a gcal like datetime format" processed_date = gcal.process_date_string(given_date) if hour_offset is not None: time_split = hour_offset.split(":") processed_date = processed_date.replace(hour=int(time_split[0])) processed_date = processed_date.replace(minute=int(time_split[1])) processed_date = gcal.process_date_isoformat(processed_date) processed_date = str(processed_date).replace('Z',TIMEZONE_STRING) return processed_date def process_only_time_from_str(date): "Process and return only the time stamp from a given string" #Typical date string: 2019-07-29T15:30:00+05:30 timestamp = datetime.datetime.strptime(date,'%Y-%m-%dT%H:%M:%S+05:30') return timestamp.strftime('%H') + ':' + timestamp.strftime('%M') #----START OF SCRIPT if __name__ == '__main__': email = 'test@qxf2.com' date = '8/13/2019' selected_slot = '9:30-10:00' candidate_email = 'annapoorani@qxf2.com' chunk_duration = '30' interviewer_work_time_slots = [{'interviewer_start_time': '14:00', 'interviewer_end_time': '20:00'}, {'interviewer_start_time': '21:00', 'interviewer_end_time': '23:00'}] emails='test@qxf2.com' print("\n=====HOW TO GET ALL EVENTS ON A DAY=====") get_events_for_date(email, date, debug=True) print("\n=====HOW TO GET BUSY SLOTS=====") busy_slots = get_busy_slots_for_date(email,date,debug=True) print("\n=====HOW TO GET FREE SLOTS=====") free_slots = get_free_slots_for_date(date,interviewer_work_time_slots) print("Free slots for {email} on {date} are:".format(email=email, date=date)) print(free_slots) for slot in free_slots: print(slot['start'],'-',slot['end']) print("\n=====HOW TO GET FREE SLOTS IN CHUNKS=====") free_slots_in_chunks = get_free_slots_in_chunks(free_slots,chunk_duration) print("\n======CREATE AN EVENT FOR FETCHED DATE AND TIME=====") event_created_slot = create_event_for_fetched_date_and_time(date,emails,candidate_email,selected_slot,round_name,round_description) print("The event created,The details are",event_created_slot)
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/base_gcal.py
""" This is a simple script to test the Google calendar """ from __future__ import print_function import datetime from datetime import timedelta import pickle import os.path from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request from uuid import uuid4 # If modifying these scopes, delete the file token.pickle. SCOPES = ['https://www.googleapis.com/auth/calendar','https://www.googleapis.com/auth/calendar.events'] TIMEAHEAD = '+05:30' TIMEZONE = 'UTC'+TIMEAHEAD DATETIME_FORMAT = '%m/%d/%Y' EMAIL = 'test@qxf2.com' def get_today(): "Return today in a datetime format consistent with DATETIME_FORMAT" today = datetime.datetime.now() today = today.strftime(DATETIME_FORMAT) today = datetime.datetime.strptime(today,DATETIME_FORMAT) return today def process_date_string(date,format=DATETIME_FORMAT): "Return a date time object we want for a given date string format" return datetime.datetime.strptime(date,DATETIME_FORMAT) def process_date_isoformat(date,format=TIMEAHEAD): "Convert the date to isoformat" return date.isoformat() + format def base_gcal(): """Shows basic usage of the Google Calendar API. Prints the start and name of the next 10 events on the user's calendar. """ creds = None # The file token.pickle stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists('token.pickle'): with open('token.pickle', 'rb') as token: creds = pickle.load(token) # If there are no (valid) credentials available, let the user log in. if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: print("Your credentials to access Google Calendar are not setup correctly") service = build('calendar', 'v3', credentials=creds) return service def get_events_for_date(service,email_id,fetch_date,maxResults=240,debug=False): "Return up to a maximum of maxResults events for a given date and email id" start_date = process_date_string(fetch_date) end_date = start_date.replace(hour=23,minute=59) start_date = process_date_isoformat(start_date) end_date = process_date_isoformat(end_date) events = [] try: if debug: print('Getting the upto a maximum of {maxResults} upcoming events'.format(maxResults=maxResults)) events_result = service.events().list(calendarId=email_id, timeMin=start_date, maxResults=maxResults, timeMax=end_date, singleEvents=True, orderBy='startTime').execute() events = events_result.get('items', []) if debug: if not events: print('No upcoming events found.') for event in events: start = event['start'].get('dateTime', event['start'].get('date')) except Exception as HttpError: pass return events def get_busy_slots_for_date(service,email_id,fetch_date,timeZone=TIMEZONE,debug=False): "Return free/busy for a given date" start_date = process_date_string(fetch_date) end_date = start_date.replace(hour=23,minute=59) start_date = process_date_isoformat(start_date) end_date = process_date_isoformat(end_date) body = { "timeMin": start_date, "timeMax": end_date, "timeZone": TIMEZONE, "items": [{"id": email_id}] } eventsResult = service.freebusy().query(body=body).execute() busy_slots = eventsResult[u'calendars'][email_id]['busy'] if debug: print('Busy slots for {email_id} on {date} are: '.format(email_id=email_id,date=fetch_date)) for slot in busy_slots: print(slot['start'],' - ', slot['end']) return busy_slots def make_day_busy(fetch_date): "Return the entire day as busy" start_date = process_date_string(fetch_date) end_date = start_date.replace(hour=23,minute=59) start_date = process_date_isoformat(start_date) end_date = process_date_isoformat(end_date) busy_slots=[{'start':start_date,'end':end_date}] return busy_slots def create_event_for_fetched_date_and_time(service,event_start_time,event_end_time,summary,location,description,attendee): "Create an event for a particular date and time" event = { 'summary': summary, 'location': location, 'description': description, 'start': { 'dateTime': event_start_time, 'timeZone': TIMEZONE, }, 'end': { 'dateTime': event_end_time, 'timeZone': TIMEZONE, }, 'attendees': [ {'email': attendee[0]}, {'email': attendee[1]} ], 'reminders': { 'useDefault': False, 'overrides': [ {'method': 'email', 'minutes': 24 * 60}, {'method': 'popup', 'minutes': 10}, ], }, } event = service.events().insert(calendarId=EMAIL,body=event,sendUpdates="all",conferenceDataVersion=1).execute() return event
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/candidates.py
import datetime from flask import render_template, jsonify, request, session from flask_mail import Message, Mail from itsdangerous import TimedJSONWebSignatureSerializer as Serializer from qxf2_scheduler import app import qxf2_scheduler.candidate_status as status from qxf2_scheduler.authentication_required import Authentication_Required from qxf2_scheduler import db from sqlalchemy import or_ import os mail = Mail(app) from qxf2_scheduler.models import Candidates, Jobs, Jobcandidate, Jobround, Rounds, Candidateround, Candidatestatus, Candidateinterviewer DOMAIN = 'qxf2.com' base_url = 'https://interview-scheduler.qxf2.com/' def get_end_business_day(add_days, from_date): "calcuate the five business days" business_days_to_add = add_days current_date = from_date while business_days_to_add > 0: current_date += datetime.timedelta(days=1) weekday = current_date.weekday() if weekday >= 5: # sunday = 6 continue business_days_to_add -= 1 return current_date def get_hours_between(end_date, current_date): "calculate the hours between two dates" diff_between_dates = end_date - current_date days, seconds = diff_between_dates.days, diff_between_dates.seconds hours_between_dates = days * 24 + seconds // 3600 return hours_between_dates def url_gen(candidate_id, job_id): "generate random url for candidate" num_business_days = 5 current_date = datetime.datetime.now() end_business_day = get_end_business_day(num_business_days, current_date) num_hours = get_hours_between(end_business_day, current_date) s = Serializer('WEBSITE_SECRET_KEY', num_hours*3600) # 60 secs by 30 mins urllist = s.dumps({'candidate_id':candidate_id, 'job_id': job_id}).decode('utf-8') return f'{candidate_id}/{job_id}/{"".join(urllist)}',end_business_day @app.route("/regenerate/url", methods=["GET", "POST"]) def regenerate_url(): "Regenerate URL" if request.method == 'POST': try: candidate_id = request.form.get("candidateid") job_id = request.form.get("jobid") Jobcandidate.query.filter(Jobcandidate.candidate_id == candidate_id, Jobcandidate.job_id == job_id).update({'url':'','candidate_status':'1'}) db.session.commit() get_round_id = Candidateround.query.filter(Candidateround.candidate_id == candidate_id, Candidateround.job_id == job_id, Candidateround.round_status == 'Invitation Sent').values(Candidateround.round_id) for unique_round_id in get_round_id: sent_round_id = unique_round_id.round_id db.session.query(Candidateround).filter(Candidateround.candidate_id == candidate_id,Candidateround.job_id == job_id, Candidateround.round_id == sent_round_id).delete() db.session.commit() error = 'Success' except Exception as e: print(e) error = "error" data = {'candidate_id':candidate_id, 'job_id':job_id, 'error':error} return jsonify(data) def fetch_candidate_list(candidate_list_object): "Fetch the candidate list" my_candidates_list = [] for each_candidate in candidate_list_object: candidate_status_object = Candidatestatus.query.filter(Candidatestatus.status_id == each_candidate.candidate_status).values(Candidatestatus.status_name) for candidate_status in candidate_status_object: candidate_status = candidate_status.status_name my_candidates_list.append({'candidate_id':each_candidate.candidate_id, 'candidate_name':each_candidate.candidate_name, 'candidate_email':each_candidate.candidate_email, 'job_id':each_candidate.job_id, 'job_role':each_candidate.job_role, 'candidate_status':candidate_status,'last_updated_date':each_candidate.last_updated_date}) return my_candidates_list @app.route("/candidates", methods=["GET"]) @Authentication_Required.requires_auth def read_candidates(): "Read the candidates" candidates_list = [] display_candidates = db.session.query(Candidates, Jobs, Jobcandidate).filter(Jobcandidate.job_id == Jobs.job_id, Jobcandidate.candidate_id == Candidates.candidate_id, Jobs.job_status != 'Close').values(Candidates.candidate_id, Candidates.candidate_name, Candidates.candidate_email, Jobs.job_id, Jobs.job_role, Jobcandidate.candidate_status,Candidates.last_updated_date) candidates_list = fetch_candidate_list(display_candidates) return render_template("read-candidates.html", result=candidates_list) @app.route("/candidate/<candidate_id>/delete", methods=["POST"]) @Authentication_Required.requires_auth def delete_candidate(candidate_id): "Deletes a candidate" if request.method == 'POST': candidate_id_to_delete = request.form.get('candidateId') job_id_to_delete = request.form.get('jobId') #Delete the candidates from candidate table candidate_to_delete = Candidates.query.filter(Candidates.candidate_id == candidate_id_to_delete).first() data = {'candidate_name':candidate_to_delete.candidate_name, 'candidate_id':candidate_to_delete.candidate_id} db.session.delete(candidate_to_delete) db.session.commit() #Delete candidate from Jobcandidate table job_candidate_to_delete = Jobcandidate.query.filter(Jobcandidate.candidate_id == candidate_id_to_delete, Jobcandidate.job_id == job_id_to_delete).first() db.session.delete(job_candidate_to_delete) db.session.commit() #Delete candidate from candidateround table db.session.query(Candidateround).filter(Candidateround.candidate_id == candidate_id_to_delete).delete() db.session.commit() #Delete candidate from Candidateinterviewer table exists = db.session.query(db.exists().where(Candidateinterviewer.candidate_id == candidate_id_to_delete)).scalar() if exists == False: pass else: db.session.query(Candidateinterviewer).filter(Candidateinterviewer.candidate_id == candidate_id_to_delete).delete() db.session.commit() return jsonify(data) def candidate_diff_job(candidate_name, candidate_email, candidate_job_applied, job_id, comments): "Adding the candidates with different job" result_flag = False try : add_candidate_object = Candidates(candidate_name=candidate_name, candidate_email=candidate_email, job_applied=candidate_job_applied, comments=comments) db.session.add(add_candidate_object) db.session.flush() candidate_id = add_candidate_object.candidate_id db.session.commit() # Fetch the id for the candidate status 'Waiting on Qxf2' #Fetch the candidate status from status.py file also. Here we have to do the comparison so fetching from the status file candidate_status_id = Candidatestatus.query.filter(Candidatestatus.status_name == status.CANDIDTATE_STATUS[0]).values(Candidatestatus.status_id) for each_value in candidate_status_id: status_id = each_value.status_id #storing the candidate id and job id in jobcandidate table add_job_candidate_object = Jobcandidate(candidate_id=candidate_id, job_id=job_id, url='', candidate_status= status_id) db.session.add(add_job_candidate_object) db.session.commit() #Store the candidateid,jobid,roundid and round status in candidateround table result_flag = True except Exception as e: print(e) result_flag = False return result_flag #Passing the optional parameter through URL @app.route('/candidate/<job_role>/add') @app.route("/candidate/add", defaults={'job_role': None}, methods=["GET", "POST"]) @Authentication_Required.requires_auth def add_candidate(job_role): "Add a candidate" data, error = [], None job_available = Jobs.query.all() if request.method == 'GET': available_job_list = [] if job_role is None: #If the parameter is none then fetch the jobs from the database job_available = Jobs.query.filter(Jobs.job_status != 'Delete').all() for each_job in job_available: available_job_list.append(each_job.job_role) else: #Since we have come through the job page pass the exact job role available_job_list.append(job_role) return render_template("add-candidates.html", data=available_job_list) if request.method == 'POST': candidate_name = request.form.get('candidateName') candidate_email = request.form.get('candidateEmail').lower() candidate_job_applied = request.form.get('jobApplied') job_id = Jobs.query.filter(Jobs.job_role == candidate_job_applied).value(Jobs.job_id) added_comments = request.form.get('addedcomments') candidate_name = candidate_name.strip() data = {'candidate_name':candidate_name} #Check the candidate has been already added or not check_candidate_exists = db.session.query(db.exists().where(Candidates.candidate_email == candidate_email)).scalar() if check_candidate_exists == True: #check the job of the candidates if the emails are same candidate_applied_job = db.session.query(db.exists().where(Candidates.job_applied == candidate_job_applied)).scalar() if candidate_applied_job == True: error = "Failed" else: return_object = candidate_diff_job(candidate_name=candidate_name, candidate_email=candidate_email, candidate_job_applied=candidate_job_applied, job_id=job_id, comments=added_comments) if return_object == True: error = "Success" else: add_candidate_object = Candidates(candidate_name=candidate_name, candidate_email=candidate_email, job_applied=candidate_job_applied, comments=added_comments) db.session.add(add_candidate_object) db.session.flush() candidate_id = add_candidate_object.candidate_id db.session.commit() data['candidate_id'] = candidate_id # Fetch the id for the candidate status 'Waiting on Qxf2' #Fetch the candidate status from status.py file also. Here we have to do the comparison so fetching from the status file candidate_status_id = Candidatestatus.query.filter(Candidatestatus.status_name == status.CANDIDTATE_STATUS[0]).values(Candidatestatus.status_id) for each_value in candidate_status_id: status_id = each_value.status_id #storing the candidate id and job id in jobcandidate table add_job_candidate_object = Jobcandidate(candidate_id=candidate_id, job_id=job_id, url='', candidate_status= status_id) db.session.add(add_job_candidate_object) db.session.commit() error = "Success" api_response = {'data':data, 'error':error} print(api_response) return jsonify(api_response) @app.route("/candidate/url", methods=["GET", "POST"]) @Authentication_Required.requires_auth def generate_unique_url(): candidate_id = request.form.get('candidateId') job_id = request.form.get('jobId') url,link_expiry_date=url_gen(candidate_id, job_id) link_expiry_date = link_expiry_date.date() edit_url = Jobcandidate.query.filter(Jobcandidate.candidate_id == candidate_id, Jobcandidate.job_id == job_id).update({'url': url}) db.session.commit() api_response = {'url': url,'expiry_date':link_expiry_date} return jsonify(api_response) def compare_rounds(all_round_id, completed_round_id): "compare two lists of round and get pending" all_round_id = set(all_round_id) completed_round_id = set(completed_round_id) pending_round_ids = all_round_id.difference(completed_round_id) pending_round_ids = list(pending_round_ids) return pending_round_ids def get_pending_round_id(job_id, candidate_id): "Get the pending round id for the candidate" pending_round_ids = [] round_ids = [] completed_round_id = [] #Check the round is already alloted for the candidates exists = db.session.query(db.exists().where(Candidateround.candidate_id == candidate_id)).scalar() if exists == True: #Fetch all the round details for a job round_ids_for_job = Jobround.query.filter(Jobround.job_id == job_id).all() for each_round_id in round_ids_for_job: round_ids.append(each_round_id.round_id) #Check the round id is already existing in the candidateround table completed_round_ids = Candidateround.query.filter(Candidateround.candidate_id == candidate_id, Candidateround.job_id == job_id).values(Candidateround.round_id) for each_complete_round in completed_round_ids: completed_round_id.append(each_complete_round.round_id) #Compare two list pending_round_ids = compare_rounds(round_ids, completed_round_id) else: round_ids_for_job = Jobround.query.filter(Jobround.job_id == job_id).all() for each_round_id in round_ids_for_job: pending_round_ids.append(each_round_id.round_id) return pending_round_ids def get_round_id(candidate_id, job_id): "Get the round idlisted for the job" rounds_id_object = Jobround.query.filter(Jobround.job_id == job_id).all() round_id_list = [] for each_round_id in rounds_id_object: round_id = each_round_id.round_id round_id_list.append(round_id) return round_id_list def get_round_names_and_status(candidate_id, job_id, all_round_id): "Get the round name and status listed for the job" round_name_status_list = [] all_round_details = {} for every_round_id in all_round_id: #Get the round status get_round_status = Candidateround.query.filter(Candidateround.candidate_id == candidate_id, Candidateround.job_id == job_id, Candidateround.round_id == every_round_id).value(Candidateround.round_status) #Get the candidate feedback candidate_feedback = Candidateround.query.filter(Candidateround.candidate_id == candidate_id, Candidateround.job_id == job_id, Candidateround.round_id == every_round_id).values(Candidateround.candidate_feedback,Candidateround.thumbs_value) for every_candidate_feedback in candidate_feedback: candidate_feedback = {'candidate_feedback':every_candidate_feedback.candidate_feedback, 'thumbs_value':every_candidate_feedback.thumbs_value} #Get the round name get_round_name = Rounds.query.filter(Rounds.round_id==every_round_id).value(Rounds.round_name) all_round_details = {'round_name':get_round_name, 'round_status':get_round_status,'candidate_feedback':candidate_feedback,'round_id':every_round_id} round_name_status_list.append(all_round_details) return round_name_status_list @app.route("/candidate/<candidate_id>/job/<job_id>") @Authentication_Required.requires_auth def show_candidate_job(job_id, candidate_id): "Show candidate name and job role" try: round_names_list = [] round_details = {} candidate_job_data = db.session.query(Jobs, Candidates, Jobcandidate).filter(Candidates.candidate_id == candidate_id, Jobs.job_id == job_id, Jobcandidate.candidate_id == candidate_id, Jobcandidate.job_id == job_id).values(Candidates.candidate_name, Candidates.candidate_email, Candidates.date_applied, Jobs.job_role, Jobs.job_id, Candidates.candidate_id, Jobcandidate.url, Jobcandidate.candidate_status, Jobcandidate.interviewer_email, Candidates.comments, Jobcandidate.interview_start_time, Jobcandidate.interview_date) for each_data in candidate_job_data: if each_data.url== None or each_data.url == '': url = None else: url = base_url + each_data.url + '/welcome' if (each_data.interview_date == None or each_data.interview_date == ''): interview_date = None interview_start_time = None else: interview_date = each_data.interview_date interview_start_time = each_data.interview_start_time interview_start_time = datetime.datetime.strptime(interview_start_time, '%Y-%m-%dT%H:%M:%S+05:30') interview_start_time = interview_start_time.time() data = {'candidate_name':each_data.candidate_name, 'job_applied':each_data.job_role, 'candidate_id':candidate_id, 'job_id':job_id, 'url': each_data.url, 'candidate_email':each_data.candidate_email, 'interviewer_email_id':each_data.interviewer_email, 'date_applied':each_data.date_applied.date(), 'url':url,'comments':each_data.comments, 'interview_date':interview_date, 'interview_start_time':interview_start_time} candidate_status_id = each_data.candidate_status #fetch the candidate status name for the status id candidate_status_name = db.session.query(Candidatestatus).filter(Candidatestatus.status_id == candidate_status_id).scalar() data['candidate_status']=candidate_status_name.status_name pending_round_ids = get_pending_round_id(job_id, candidate_id) #Get all rounds id for the job the candidate applied all_round_id = get_round_id(candidate_id, job_id) #Get the roundstatus, feedback of the candidate job round_name_status_list = get_round_names_and_status(candidate_id, job_id, all_round_id) #Get the pending round id details from the table for each_round_id in pending_round_ids: round_detail = db.session.query(Rounds).filter(Rounds.round_id == each_round_id).scalar() round_details = {'round_name':round_detail.round_name, 'round_id':round_detail.round_id, 'round_description':round_detail.round_description, 'round_time':round_detail.round_time} round_names_list.append(round_details) except Exception as e: app.logger.error(e) with open('info_error.log','a') as fp: fp.write(repr(e)) return render_template("candidate-job-status.html", result=data, round_names=round_names_list,all_round_details=round_name_status_list) @app.route("/candidate/<candidate_id>/edit", methods=["GET", "POST"]) @Authentication_Required.requires_auth def edit_candidates(candidate_id): "Edit the candidtes" #Fetch the candidate details and equal job id if request.method == 'GET': jobs_list = [] candidate_data = {} candidate_details = Candidates.query.join(Jobcandidate, Candidates.candidate_id == Jobcandidate.candidate_id) .filter(Candidates.candidate_id == candidate_id).values(Candidates.candidate_name, Candidates.candidate_email,Candidates.candidate_id, Jobcandidate.job_id, Candidates.comments) for each_detail in candidate_details: #Fetch the job role of the candidate using job id get_job_role = db.session.query(Jobs.job_role).filter(Jobs.job_id == each_detail.job_id).first() candidate_data = {'candidate_name':each_detail.candidate_name, 'candidate_email':each_detail.candidate_email, 'candidate_id':each_detail.candidate_id, 'job_role':get_job_role.job_role, 'job_id':each_detail.job_id, 'added_comments':each_detail.comments} #Fetch all the Job roles from the Jobs table to edit the job details for the candidate job_roles = db.session.query(Jobs.job_role).all() for each_job in job_roles: jobs_list.append(each_job.job_role) candidate_data['job_roles']=jobs_list return render_template("edit-candidate.html", result=candidate_data) if request.method == 'POST': candidate_name = request.form.get('candidateName') candidate_email = request.form.get('candidateEmail') candidate_job_applied = request.form.get('jobApplied') candidate_old_job = request.form.get('existJob') exist_added_comments = request.form.get('addedcomments') data = {'candidate_name':candidate_name} #Check the candidate has been already added or not if (candidate_job_applied == candidate_old_job): Candidates.query.filter(Candidates.candidate_id == candidate_id).update({'candidate_name':candidate_name, 'candidate_email':candidate_email, 'comments':exist_added_comments}) db.session.commit() else: Candidates.query.filter(Candidates.candidate_id == candidate_id).update({'candidate_name':candidate_name, 'candidate_email':candidate_email, 'job_applied':candidate_job_applied, 'comments':exist_added_comments}) db.session.commit() edited_job_role = db.session.query(Jobs.job_id).filter(Jobs.job_role == candidate_job_applied).first() #storing the candidate id and job id in jobcandidate table Jobcandidate.query.filter(Jobcandidate.candidate_id == candidate_id).update({'candidate_id':candidate_id, 'job_id':edited_job_role.job_id, 'url':'', 'candidate_status':1}) db.session.commit() api_response = {'data':data} return jsonify(api_response) @app.route("/candidates/<candidate_id>/jobs/<job_id>/email") @Authentication_Required.requires_auth def send_email(candidate_id, job_id): # Fetch the id for the candidate status 'Waiting on Candidate' #Fetch the candidate status from status.py file also. Here we have to do the comparison so fetching from the status file candidate_status_id = db.session.query(Candidatestatus).filter(Candidatestatus.status_name == status.CANDIDTATE_STATUS[1]).scalar() candidate_status = Jobcandidate.query.filter(Jobcandidate.candidate_id == candidate_id, Jobcandidate.job_id == job_id).update({'candidate_status':candidate_status_id.status_id}) db.session.commit() candidate_name = Candidates.query.filter(Candidates.candidate_id == candidate_id).value(Candidates.candidate_name) if candidate_name != None: return jsonify(data=candidate_name) else: return jsonify(error="error"), 500 def change_status_to_noopening(candidate_id,candidate_job_applied): "Change status to no opening" try: #Update the candidate status to 'Waiting for new opening' candidate_statuses = Candidatestatus.query.all() for each_status in candidate_statuses: if each_status.status_name == status.CANDIDTATE_STATUS[6]: status_id = each_status.status_id #Change the candidate status after the invite has been sent Jobcandidate.query.filter(Jobcandidate.candidate_id == candidate_id, Jobcandidate.job_id == candidate_job_applied).update({'candidate_status':status_id}) db.session.commit() error = 'Success' except Exception as e: error = "Failed" return(str(e)) return error @app.route("/noopening/email", methods=["POST"]) @Authentication_Required.requires_auth def no_opening(): "Send a no opening email to the candidates" candidate_name = request.form.get('candidatename') candidate_email = request.form.get('candidateemail') candidate_job_applied = request.form.get('candidatejob') candidate_id = request.form.get('candidateid') logged_email = session['logged_user'] msg = Message("Career opportunity with Qxf2 Services", sender=("Qxf2 Services", "test@qxf2.com"), recipients=[candidate_email], cc=[logged_email]) msg.body = "Hi %s , \n\nThanks for applying to Qxf2 Services. We have received your application. Currently we don't have openings suitable to your background and experience. We will get back to you once we have an opening that fits you better.\n\nThanks, \nQxf2 Services"%(candidate_name) mail.send(msg) candidate_status = change_status_to_noopening(candidate_id,candidate_job_applied) last_updated_date = Candidates.query.filter(Candidates.candidate_id==candidate_id).update({'last_updated_date':datetime.date.today()}) db.session.commit() data = {'candidate_name': candidate_name, 'error': candidate_status} return jsonify(data) @app.route("/noopening/noemail",methods=["GET","POST"]) def noopeining_without_email(): "Change the status without no opening email" candidate_name = request.form.get('candidatename') candidate_email = request.form.get('candidateemail') candidate_job_applied = request.form.get('candidatejob') candidate_id = request.form.get('candidateid') status_change = change_status_to_noopening(candidate_id,candidate_job_applied) data = {'candidate_name': candidate_name, 'error': status_change} last_updated_date = Candidates.query.filter(Candidates.candidate_id==candidate_id).update({'last_updated_date':datetime.date.today()}) db.session.commit() return jsonify(data) def change_status_to_reject(candidate_id,candidate_job_applied): "Change the status to reject" try: #Update the candidate status to 'Reject' candidate_statuses = Candidatestatus.query.all() for each_status in candidate_statuses: if each_status.status_name == status.CANDIDTATE_STATUS[4]: status_id = each_status.status_id #Change the candidate status after the invite has been sent Jobcandidate.query.filter(Jobcandidate.candidate_id == candidate_id, Jobcandidate.job_id == candidate_job_applied).update({'candidate_status':status_id}) db.session.commit() error = 'Success' except Exception as e: error = "Failed" print(e) return(str(e)) return error def fetch_interviewer_email(candidate_id, job_id): "Fetch the interviewers email for the candidate" email_id = Jobcandidate.query.filter(Jobcandidate.job_id == job_id, Jobcandidate.candidate_id == candidate_id).value(Jobcandidate.interviewer_email) if email_id == None: print("The interviewer is not yet assigned for the candidate") return email_id @app.route("/reject", methods=["POST"]) @Authentication_Required.requires_auth def send_reject(): "Send reject email" candidate_name = request.form.get('candidatename') candidate_email = request.form.get('candidateemail') candidate_job_applied = request.form.get('candidatejob') candidate_id = request.form.get('candidateid') interviewer_email = fetch_interviewer_email(candidate_id, candidate_job_applied) logged_email = session['logged_user'] if interviewer_email == None: cc = [logged_email] else: cc = interviewer_email.split(',') cc.append(logged_email) msg = Message("Interview update from Qxf2 Services", sender=("Qxf2 Services", "test@qxf2.com"), cc=cc, recipients=[candidate_email]) msg.body = "Hi %s , \n\nI appreciate your interest in a career opportunity with Qxf2 Services. It was a pleasure speaking to you about your background and interests. There are many qualified applicants in the current marketplace and we are searching for those who have the most directly applicable experience to our limited number of openings. I regret we will not be moving forward with your interview process. We wish you all the best in your current search and future endeavors.\n\nThanks, \nQxf2 Services"%(candidate_name) mail.send(msg) candidate_status = change_status_to_reject(candidate_id,candidate_job_applied) last_updated_date = Candidates.query.filter(Candidates.candidate_id==candidate_id).update({'last_updated_date':datetime.date.today()}) db.session.commit() data = {'candidate_name': candidate_name, 'error': candidate_status} return jsonify(data) @app.route("/comments/save", methods=['GET', 'POST']) def save_comments(): "Save the comments" candidate_comments = request.form.get('comments') candidate_id = request.form.get('candidateid') job_id = request.form.get('jobid') Jobcandidate.query.filter(Jobcandidate.candidate_id == candidate_id, Jobcandidate.job_id == job_id).update({'comments':candidate_comments}) db.session.commit() error = 'Success' data = {'candidate_comments':candidate_comments, 'error':error} return jsonify(data) @app.route("/candidatestatus/filter", methods=['GET', 'POST']) def filter_candidate_status(): "Filter the candidates based on the status" filtered_candidates_list = [] filtered_status = request.form.get('selectedstatus') #Fetch the candidate status id for the filtered status status_id = Candidatestatus.query.filter(Candidatestatus.status_name == filtered_status).value(Candidatestatus.status_id) #Fetch the candidates who are all in that status filtered_candidates = Jobcandidate.query.filter(Jobcandidate.candidate_status == status_id).values(Jobcandidate.candidate_id, Jobcandidate.job_id) for all_candidates in filtered_candidates: candidate_id = all_candidates.candidate_id job_id = all_candidates.job_id #Fetch the job name using job id job_applied = Jobs.query.filter(Jobs.job_id == job_id).value(Jobs.job_role) #Fetch the candidate details from candidate table candidate_details = Candidates.query.filter(Candidates.candidate_id == candidate_id).values(Candidates.candidate_name, Candidates.candidate_email) for each_data in candidate_details: candidate_name=each_data.candidate_name candidate_email = each_data.candidate_email filtered_candidates_list.append({'candidate_id':candidate_id, 'candidate_name':candidate_name, 'candidate_email':candidate_email, 'job_role':job_applied, 'candidate_status':filtered_status}) len_of_filtered_candidates_list = len(filtered_candidates_list) if len_of_filtered_candidates_list > 0: return render_template("read-candidates.html", result=filtered_candidates_list) else: result = 'error' return result @app.route("/filter/job", methods=['GET', 'POST']) def job_filter(): "Filter the job for the candidates" filter_job_list = [] filtered_job = request.form.get('selectjob') candidate_job_filter = Candidates.query.filter(Candidates.job_applied == filtered_job).values(Candidates.candidate_id,Candidates.candidate_name,Candidates.job_applied,Candidates.candidate_email) for each_data in candidate_job_filter: candidate_name = each_data.candidate_name candidate_email = each_data.candidate_email candidate_job = each_data.job_applied candidate_id = each_data.candidate_id candidate_job_status_id = Jobcandidate.query.filter(Jobcandidate.candidate_id == candidate_id).value(Jobcandidate.candidate_status) candidate_job_status = Candidatestatus.query.filter(Candidatestatus.status_id == candidate_job_status_id).value(Candidatestatus.status_name) filter_job_list.append({'candidate_id':candidate_id, 'candidate_name':candidate_name, 'candidate_email':candidate_email,'job_role':candidate_job, 'candidate_status':candidate_job_status}) len_of_filtered_candidates_list = len(filter_job_list) if len_of_filtered_candidates_list > 0: return render_template("read-candidates.html", result=filter_job_list) else: result = 'error' return result @app.route("/noemail/reject",methods=["GET","POST"]) def reject_without_email(): "Change the status of the candidate without reject email" candidate_name = request.form.get('candidatename') candidate_email = request.form.get('candidateemail') candidate_job_applied = request.form.get('candidatejob') candidate_id = request.form.get('candidateid') status_change = change_status_to_reject(candidate_id,candidate_job_applied) last_updated_date = Candidates.query.filter(Candidates.candidate_id==candidate_id).update({'last_updated_date':datetime.date.today()}) db.session.commit() data = {'candidate_name': candidate_name, 'error': status_change} return jsonify(data) @app.route('/candidate/noresponse',methods=["GET","POST"]) def status_no_response(): "Change the candidate status to no response if they have not replied" if request.method == "POST": candidate_id = request.form.get("candidateid") #Update the candidate status to no response db.session.query(Jobcandidate).filter(Jobcandidate.candidate_id == candidate_id).update({'candidate_status':4}) db.session.commit() last_updated_date = Candidates.query.filter(Candidates.candidate_id==candidate_id).update({'last_updated_date':datetime.date.today()}) db.session.commit() return candidate_id @app.route('/candidate/hired',methods=["GET","POST"]) def status_to_hired(): "Change the candidate status to hiried" if request.method == "POST": candidate_id = request.form.get("candidateid") job_id = request.form.get("jobid") db.session.query(Jobcandidate).filter(Jobcandidate.candidate_id == candidate_id, Jobcandidate.job_id == job_id).update({'candidate_status':6}) db.session.commit() last_updated_date = Candidates.query.filter(Candidates.candidate_id==candidate_id).update({'last_updated_date':datetime.date.today()}) db.session.commit() return candidate_id @app.route("/candidate/<candidate_id>/round/<round_id>/add_feedback",methods=["GET","POST"]) def add_feedback(candidate_id, round_id): "Adding the feedback for the candidates by interviewers" if request.method == "GET": data = {'candidate_id':candidate_id,'round_id':round_id} return render_template("add-feedback.html",result=data) if request.method == "POST": error = "Success" added_feedback = request.form.get("addedfeedback") thumbs_value = request.form.get("thumbsvalue") combined_feed = thumbs_value + ',' + added_feedback Candidateround.query.filter(Candidateround.candidate_id==candidate_id,Candidateround.round_id==round_id).update({'candidate_feedback':added_feedback,'thumbs_value':thumbs_value}) db.session.commit() result = {'added_feedback':added_feedback, 'thumbs_value':thumbs_value, 'error': error} last_updated_date = Candidates.query.filter(Candidates.candidate_id==candidate_id).update({'last_updated_date':datetime.date.today()}) db.session.commit() return jsonify(result) @app.route("/candidate/<candidate_id>/round/<round_id>/edit_feedback",methods=["GET","POST"]) def edit_feedback(candidate_id, round_id): "Adding the feedback for the candidates by interviewers" if request.method == "GET": data = {'candidate_id':candidate_id,'round_id':round_id} added_candidate_feedback = Candidateround.query.filter(Candidateround.candidate_id == candidate_id, Candidateround.round_id==round_id).values(Candidateround.candidate_feedback,Candidateround.thumbs_value) for edit_feedback in added_candidate_feedback: if edit_feedback.candidate_feedback == None: added_candidate_feedback = None else: edit_feedback_value = (edit_feedback.thumbs_value.split('s')[0]+'s'+" "+edit_feedback.thumbs_value.split('s')[-1]).title() added_candidate_feedback={'candidate_feedback':edit_feedback.candidate_feedback, 'thumbs_value':edit_feedback_value} return render_template("edit-feedback.html",result=data,candidate_feedback=added_candidate_feedback,) if request.method == "POST": error = "Success" edited_feedback = request.form.get("editedfeedback") thumbs_value = request.form.get("thumbsvalue") combined_edit_feed = thumbs_value + ',' + edited_feedback Candidateround.query.filter(Candidateround.candidate_id==candidate_id,Candidateround.round_id==round_id).update({'candidate_feedback':edited_feedback, 'thumbs_value':thumbs_value}) db.session.commit() result = {'edited_feedback':edited_feedback, 'thumbs_value':thumbs_value, 'error': error} last_updated_date = Candidates.query.filter(Candidates.candidate_id==candidate_id).update({'last_updated_date':datetime.date.today()}) db.session.commit() return jsonify(result)
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/setup_db.py
""" Run this file to setup your database for the first time. """ import time import sys import sqlite3 import os import datetime import csv CURR_FILEPATH = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.dirname(CURR_FILEPATH) DATA_DIR = os.path.join(ROOT_DIR,'data') if not os.path.exists(DATA_DIR): os.mkdir(DATA_DIR) DB_FILE = os.path.join(ROOT_DIR,'data','interviewscheduler.db') STATUS_TABLE = 'Candidatestatus' STATUS_COL_1 = 'status_id' STATUS_COL_2 = 'status_name' def create_connection_obj(): "Return a connection object" return sqlite3.connect(DB_FILE) def setup_raw_data(db_cursor,csv_file): "Setup raw data" csv_row_data = get_csv_row_data(csv_file) db_cursor.executemany("INSERT INTO {} VALUES (?,?)".format(STATUS_TABLE),csv_row_data) return db_cursor def get_csv_row_data(csv_file): "Return csv row data in a format suitable for executemany" row_data = [] with open(csv_file,'r') as fp: all_rows = csv.DictReader(fp) row_data = [(row[STATUS_COL_1], row[STATUS_COL_2]) for row in all_rows] return row_data def create_tables(db_cursor): "Create the tables" #Status table db_cursor.execute("CREATE TABLE IF NOT EXISTS {}({} integer PRIMARY KEY, {} char(256))".format(STATUS_TABLE,STATUS_COL_1,STATUS_COL_2)) def create_db(csv_file): "Create the database for the first time" conn = create_connection_obj() db_cursor = conn.cursor() create_tables(db_cursor) db_cursor = setup_raw_data(db_cursor,csv_file) conn.commit() conn.close() def setup_database(csv_file): "Setup the database" if not os.path.exists(csv_file): print("Could not locate the CSV file to load data from: {}".format(csv_file)) return create_db(csv_file) print("Done") #----START OF SCRIPT if __name__=='__main__': csv_file = os.path.join(DATA_DIR,'candidatestatus.csv') usage = "USAGE:\npython {} <optional: path to csv data>\npython {} ../data/candidatestatus.csv".format(__file__,__file__) if len(sys.argv)>1: if not os.path.exists(sys.argv[1]): print("Could not locate the csv file {}".format(sys.argv[1])) print(usage) elif not sys.argv[1][-4:]=='.csv': print("Please provide a valid CSV file as input") print(usage) else: csv_file = os.path.abspath(sys.argv[1]) setup_database(csv_file)
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/status.py
from flask import render_template, url_for, flash, redirect, jsonify, request, Response,session from qxf2_scheduler import app import qxf2_scheduler.qxf2_scheduler as my_scheduler import qxf2_scheduler.candidate_status as status from qxf2_scheduler import db import json import string import random,sys,re from flask_login import login_required from qxf2_scheduler.models import Candidatestatus @app.route("/status",methods=["GET","POST"]) @login_required def read_status(): "Display the statuses from the database" read_status = db.session.query(Candidatestatus).all() my_status_list = [] for each_status in read_status: my_status_list.append({'status_id':each_status.status_id,'status_name':each_status.status_name}) return render_template("read-status.html",result=my_status_list) @app.route("/status/<status_id>/delete",methods=["POST"]) @login_required def delete_status(status_id): "Deletes a candidate" if request.method == 'POST': status_id_to_delete = request.form.get('statusid') #Delete the status from status table status_to_delete = Candidatestatus.query.filter(Candidatestatus.status_id==status_id_to_delete).first() data = {'status_name':status_to_delete.status_name,'status_id':status_to_delete.status_id} db.session.delete(status_to_delete) db.session.commit() return jsonify(data) def check_status_exists(status_name): "Check the status already exists in the database" fetch_existing_status_name = Candidatestatus.query.all() status_list = [] # Fetch the status name for each_status in fetch_existing_status_name: status_list.append(each_status.status_name.lower()) # Compare the job with database job list if status_name.lower() in status_list: check_status_exists = True else: check_status_exists = False return check_status_exists @app.route("/status/add",methods=["GET","POST"]) @login_required def add_status(): "Add a status through UI" if request.method == 'GET': return render_template("add-status.html") if request.method == 'POST': data ={} status_name = request.form.get("statusname") status_name = re.sub('[^A-Za-z]+',' ',status_name) status_name = status_name.strip() data = {'status_name':status_name} status_exists = check_status_exists(status_name) if status_exists == True: error = "Failed" else: add_status_object = Candidatestatus(status_name=status_name) db.session.add(add_status_object) db.session.commit() error = "Success" api_response = {'data':data,'error':error} return jsonify(api_response) @app.route("/status/<status_id>/edit",methods=["GET","POST"]) @login_required def edit_status(status_id): "Edit the status through UI" if request.method == "GET": data = {} get_edit_status_details = Candidatestatus.query.filter(Candidatestatus.status_id==status_id).first() data = {'status_name':get_edit_status_details.status_name,'status_id':get_edit_status_details.status_id} return render_template("edit-status.html",result=data) if request.method == "POST": data = {} edit_status_name = request.form.get('statusname') edit_status_name = re.sub('[^A-Za-z0-9]+',' ',edit_status_name) edit_status_name = edit_status_name.strip() check_edited_status_exists = check_status_exists(edit_status_name) if check_edited_status_exists == True: error ="Failed" else: edit_status_object = Candidatestatus.query.filter(Candidatestatus.status_id==status_id).update({"status_name":edit_status_name}) db.session.commit() data = {'status_name':edit_status_name,'status_id':status_id} error = "Success" api_response = {'data':data,'error':error} return (jsonify(api_response))
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/routes.py
""" This file contains all the endpoints exposed by the interview scheduler application """ from flask import render_template, url_for, redirect, jsonify, request, Response, session import requests from qxf2_scheduler import app import qxf2_scheduler.qxf2_scheduler as my_scheduler import qxf2_scheduler.candidate_status as status from qxf2_scheduler import db from qxf2_scheduler.security import encrypt_password,check_encrypted_password import qxf2_scheduler.sso_google_oauth as sso import json import ast,re,uuid import sys,datetime from itsdangerous import TimedJSONWebSignatureSerializer as Serializer from itsdangerous import URLSafeTimedSerializer from flask_mail import Message, Mail from qxf2_scheduler.authentication_required import Authentication_Required from pytz import timezone import flask, random, string from flask import flash mail = Mail(app) from qxf2_scheduler.models import Interviewers, Interviewertimeslots, Jobs, Jobinterviewer, Rounds, Jobround,Candidates,Jobcandidate,Candidatestatus,Candidateround,Candidateinterviewer, Interviewcount, Roundinterviewers DOMAIN = 'qxf2.com' base_url = 'https://interview-scheduler.qxf2.com/' @app.route("/") def home(): "Login page for an app" return render_template('login.html') @app.route('/callback') def callback(): "Redirect after Google login & consent" try: # Get the code after authenticating from the URL code = request.args.get('code') # Generate URL to generate token token_url, headers, body = sso.CLIENT.prepare_token_request( sso.URL_DICT['token_gen'], authorisation_response=request.url, # request.base_url is same as DATA['redirect_uri'] redirect_url=request.base_url, code=code) # Generate token to access Google API token_response = requests.post( token_url, headers=headers, data=body, auth=(sso.CLIENT_ID, sso.CLIENT_SECRET)) # Parse the token response sso.CLIENT.parse_request_body_response(json.dumps(token_response.json())) # Add token to the Google endpoint to get the user info # oauthlib uses the token parsed in the previous step uri, headers, body = sso.CLIENT.add_token(sso.URL_DICT['get_user_info']) # Get the user info response_user_info = requests.get(uri, headers=headers, data=body) info = response_user_info.json() user_info = info['email'] user_email_domain = re.search("@[\w.]+",user_info).group() except Exception as e: app.logger.error(e) if user_email_domain == '@qxf2.com': session['logged_user'] = user_info return redirect(url_for('index')) else: return render_template('unauthorized.html') @app.route("/login") def login(): "Login redirect" return redirect(sso.REQ_URI) @app.route("/logout",methods=['GET', 'POST']) def logout(): "Logout the current page" #logout_user() try: for key in list(session.keys()): session.pop(key) except Exception as e: app.logger.error(e) return redirect('/') @app.route("/index") @app.route("/") @app.route("/home") @Authentication_Required.requires_auth def index(): "The index page" return render_template('index.html') def get_id_for_emails(email_list): "Get the id for the interviewers who has interview scheduled already" interviewers_id_list = [] for interviewer_email in email_list: interviewer_id = Interviewers.query.filter(Interviewers.interviewer_email == interviewer_email).value(Interviewers.interviewer_id) interviewers_id_list.append(interviewer_id) return interviewers_id_list def check_interview_exists(date): "Fetch the interviewers wich have an interview already" interviewers_email_list = [] date = datetime.datetime.strptime(date, '%m/%d/%Y').strftime('%B %d, %Y') fetch_interviewers_email = db.session.query(Jobcandidate).filter(Jobcandidate.interview_date == date).values(Jobcandidate.interviewer_email) for each_interviewer_email in fetch_interviewers_email: interviewers_email_list.append(each_interviewer_email.interviewer_email) interviewers_id_list = get_id_for_emails(interviewers_email_list) return interviewers_id_list def fetch_interviewers_from_rounds(round_id,job_id,scheduled_interviewers_id): "Fetch interviewers from round interviewer table" job_interviewer_id = Roundinterviewers.query.filter(Roundinterviewers.round_id == round_id, Roundinterviewers.job_id == job_id).values(Roundinterviewers.interviewers_id) interviewer_id_list = [] for each_interviewer_id in job_interviewer_id: if each_interviewer_id.interviewers_id in scheduled_interviewers_id: pass else: interviewer_id_list.append(each_interviewer_id.interviewers_id) return interviewer_id_list @app.route("/get-schedule", methods=['GET', 'POST']) def date_picker(): "Dummy page to let you see a schedule" round_duration = request.form.get('roundtime') if request.method == 'GET': return render_template('get-schedule.html') if request.method == 'POST': date = request.form.get('date') round_duration = request.form.get('roundtime') round_id = request.form.get('roundid') chunk_duration = round_duration.split(' ')[0] job_id = session['candidate_info']['job_id'] candidate_id = session['candidate_info']['candidate_id'] #Check the candidate is scheduled an interview already check_scheduled_event = Candidateround.query.filter(Candidateround.candidate_id==candidate_id,Candidateround.job_id==job_id,Candidateround.round_id==round_id).values(Candidateround.round_status) for check_event in check_scheduled_event: candidate_schedule_status = check_event.round_status if candidate_schedule_status == 'Invitation Sent': #Check who are all the interviewers interviewed the candidate alloted_interviewers_id_list = [] try: alloted_interviewers_id = db.session.query(Candidateinterviewer).filter(Candidateinterviewer.candidate_id==candidate_id,Candidateinterviewer.job_id==job_id).values(Candidateinterviewer.interviewer_id) alloted_interviewers_id_list = [] for each_interviewer_id in alloted_interviewers_id: alloted_interviewers_id_list.append(each_interviewer_id.interviewer_id) except Exception as e: print("The candidate is scheduling an interview for the first time",e) #Fetch the interviewers email id which have an interview for the picked date scheduled_interviewers_id = check_interview_exists(date) #Fetch the interviewers for the candidate job interviewer_id = fetch_interviewers_from_rounds(round_id,job_id,scheduled_interviewers_id) if len(interviewer_id): interviewer_id = interviewer_id else: #Fetch the intervieweres from the job job_interviewer_id = db.session.query(Jobinterviewer).filter(Jobinterviewer.job_id==job_id).values(Jobinterviewer.interviewer_id) interviewer_id = [] for each_interviewer_id in job_interviewer_id: if each_interviewer_id.interviewer_id in scheduled_interviewers_id: pass else: interviewer_id.append(each_interviewer_id.interviewer_id) if len(alloted_interviewers_id_list) == 0: pass else: #Compare the alloted and fetched interviewers id interviewer_id = list(set(interviewer_id)-set(alloted_interviewers_id_list)) #Fetch the interviewer emails for the candidate job interviewer_work_time_slots = [] for each_id in interviewer_id: new_slot = db.session.query(Interviewers,Interviewertimeslots).filter(each_id==Interviewers.interviewer_id,each_id==Interviewertimeslots.interviewer_id).values( Interviewers.interviewer_email, Interviewertimeslots.interviewer_start_time, Interviewertimeslots.interviewer_end_time) for interviewer_email, interviewer_start_time, interviewer_end_time in new_slot: interviewer_work_time_slots.append({'interviewer_email': interviewer_email, 'interviewer_start_time': interviewer_start_time,'interviewer_end_time': interviewer_end_time}) free_slots = my_scheduler.get_free_slots_for_date( date, interviewer_work_time_slots) free_slots_in_chunks = my_scheduler.get_free_slots_in_chunks( free_slots,chunk_duration) api_response = { 'free_slots_in_chunks': free_slots_in_chunks, 'date': date} return jsonify(api_response) else: data = {'error':"Already scheduled",'candidate_id':candidate_id} return jsonify(data) @app.route("/confirm",methods=['GET','POST']) def confirm(): "Confirming the event message" if request.method == 'GET': response_value = request.args['value'] return render_template("confirmation.html", value=json.loads(response_value)) def fetch_existing_interviewer_email(candidate_id, job_id, fetched_interviewer_email): "Fect the existing email id" interviewer_email = Jobcandidate.query.filter(Jobcandidate.candidate_id == candidate_id, Jobcandidate.job_id == job_id).value(Jobcandidate.interviewer_email) if interviewer_email == None: interviewer_email = fetched_interviewer_email else: interviewer_email += ',' + fetched_interviewer_email return interviewer_email def add_interview_count(fetch_interviewer_id_value): "Update the interview count table" #db.session.query(db.exists().where(Login.username == username)).scalar() exists = db.session.query(db.exists().where(Interviewcount.interviewer_id == fetch_interviewer_id_value)).scalar() if exists: db.session.query(Interviewcount).filter_by(interviewer_id =fetch_interviewer_id_value).update({'interview_count': Interviewcount.interview_count + 1}) db.session.commit() else: add_interview_count = Interviewcount(interviewer_id=fetch_interviewer_id_value, interview_count=1) db.session.add(add_interview_count) db.session.commit() @app.route("/confirmation", methods=['GET', 'POST']) def scehdule_and_confirm(): "Schedule an event and display confirmation" if request.method == 'GET': return render_template("get-schedule.html") if request.method == 'POST': slot = request.form.get('slot') email = request.form.get('interviewerEmails') date = request.form.get('date') candidate_id = session['candidate_info']['candidate_id'] candidate_email = session['candidate_info']['candidate_email'] job_id = session['candidate_info']['job_id'] #Fetch the round id get_round_id_object = db.session.query(Candidateround).filter(Candidateround.candidate_id==candidate_id,Candidateround.job_id==job_id,Candidateround.round_status=='Invitation Sent').scalar() #Fetch the round name and description round_name_and_desc = Rounds.query.filter(Rounds.round_id==get_round_id_object.round_id).values(Rounds.round_name,Rounds.round_description) for each_round_detail in round_name_and_desc: round_name = each_round_detail.round_name round_description = each_round_detail.round_description schedule_event = my_scheduler.create_event_for_fetched_date_and_time( date, email,candidate_email, slot,round_name,round_description) date_object = datetime.datetime.strptime(date, '%m/%d/%Y').date() date = datetime.datetime.strftime(date_object, '%B %d, %Y') value = {'schedule_event': schedule_event, 'date': date, 'slot' : slot} value = json.dumps(value) candidate_status_id = db.session.query(Candidatestatus).filter(Candidatestatus.status_name==status.CANDIDTATE_STATUS[2]).scalar() #Fetch the already existing interviewer email id updated_interviewer_email = fetch_existing_interviewer_email(candidate_id, job_id, schedule_event[3]['interviewer_email']) candidate_status = Jobcandidate.query.filter(Jobcandidate.candidate_id == candidate_id, Jobcandidate.job_id == job_id).update({'candidate_status':candidate_status_id.status_id,'interview_start_time':schedule_event[0]['start']['dateTime'],'interview_end_time':schedule_event[1]['end']['dateTime'],'interview_date':date,'interviewer_email':updated_interviewer_email}) db.session.commit() #Update the round status for the candidate update_round_status = Candidateround.query.filter(Candidateround.candidate_id==candidate_id,Candidateround.job_id==job_id,Candidateround.round_id==get_round_id_object.round_id).update({'round_status':'Interview Scheduled'}) db.session.commit() #Get the interviewer email from the form alloted_interviewer_email = schedule_event[3]['interviewer_email'] #Fetch the interviewer id of the interviewer fetch_interviewer_id = db.session.query(Interviewers).filter(Interviewers.interviewer_email==alloted_interviewer_email).values(Interviewers.interviewer_id) for each_interviewer in fetch_interviewer_id: fetch_interviewer_id_value=each_interviewer.interviewer_id #Add the interviewer id, candidateid and job id to the table add_interviewer_candidate_object = Candidateinterviewer(job_id=job_id,candidate_id=candidate_id,interviewer_id=fetch_interviewer_id_value) db.session.add(add_interviewer_candidate_object) db.session.commit() #Add the count for the interviewer in the interviewcount table add_interview_count(fetch_interviewer_id_value) last_updated_date = Candidates.query.filter(Candidates.candidate_id==candidate_id).update({'last_updated_date':datetime.date.today()}) db.session.commit() return redirect(url_for('confirm', value=value)) return render_template("get-schedule.html") @app.route("/interviewers") @Authentication_Required.requires_auth def list_interviewers(): "List all the interviewer names" all_interviewers = Interviewers.query.all() my_interviewers_list = [] for each_interviewer in all_interviewers: my_interviewers_list.append({'interviewer_id': each_interviewer.interviewer_id, 'interviewer_name': each_interviewer.interviewer_name}) return render_template("list-interviewers.html", result=my_interviewers_list) def form_interviewer_timeslot(time_slot): "Parse the interviewer detail with start and end time" time_dict = {} time_dict['starttime'] = time_slot['interviewers_starttime'] time_dict['endtime'] = time_slot['interviewers_endtime'] del time_slot['interviewers_starttime'] del time_slot['interviewers_endtime'] time_slot['time'] = time_dict return time_slot def form_interviewer_details(interviewer_details): "Parsing the interviewer detals we get it from form" list_parsed_interviewer_detail = [] parsed_interviewer_details = [] for each_detail in interviewer_details: interviewer_detail = { 'interviewer_id': each_detail.interviewer_id, 'interviewers_name': each_detail.interviewer_name, 'interviewers_id': each_detail.interviewer_id, 'interviewers_email': each_detail.interviewer_email, 'interviewers_designation': each_detail.interviewer_designation, 'interviewers_starttime': each_detail.interviewer_start_time, 'interviewers_endtime': each_detail.interviewer_end_time} parsed_interviewer_detail = form_interviewer_timeslot( time_slot=interviewer_detail) list_parsed_interviewer_detail.append(parsed_interviewer_detail) for each_dict in list_parsed_interviewer_detail: if len(parsed_interviewer_details) == 0: parsed_interviewer_details.append(each_dict) parsed_interviewer_details[0]["time"] = [ parsed_interviewer_details[0]["time"]] else: parsed_interviewer_details[0]['time'].append(each_dict['time']) return parsed_interviewer_details @app.route("/interviewer/<interviewer_id>") @Authentication_Required.requires_auth def read_interviewer_details(interviewer_id): "Displays all the interviewer details" # Fetching the Interviewer detail by joining the Interviewertimeslots tables and Interviewer tables exists = db.session.query(db.exists().where( Interviewertimeslots.interviewer_id == interviewer_id)).scalar() if exists: interviewer_details = Interviewers.query.join(Interviewertimeslots, Interviewers.interviewer_id == Interviewertimeslots.interviewer_id).filter( Interviewers.interviewer_id == interviewer_id).values(Interviewers.interviewer_name, Interviewers.interviewer_email, Interviewers.interviewer_designation, Interviewers.interviewer_id, Interviewertimeslots.interviewer_start_time, Interviewertimeslots.interviewer_end_time) parsed_interviewer_details = form_interviewer_details( interviewer_details) else: interviewer_details = Interviewers.query.filter(Interviewers.interviewer_id == interviewer_id).values( Interviewers.interviewer_id, Interviewers.interviewer_name, Interviewers.interviewer_email, Interviewers.interviewer_designation) for each_detail in interviewer_details: parsed_interviewer_details = { 'interviewers_name': each_detail.interviewer_name, 'interviewers_id': each_detail.interviewer_id, 'interviewers_email': each_detail.interviewer_email, 'interviewers_designation': each_detail.interviewer_designation} return render_template("read-interviewers.html", result=parsed_interviewer_details) def add_edit_interviewers_in_time_slot_table(interviewer_name): "Adding the interviewers in the interviewer time slots table" added_edited_interviewer_id = Interviewers.query.filter( Interviewers.interviewer_name == interviewer_name).first() # Adding the new time slots in the interviewerstimeslots table interviewer_time_slots = ast.literal_eval(request.form.get('timeObject')) interviewer_start_time = interviewer_time_slots['starttime'] interviewer_end_time = interviewer_time_slots['endtime'] len_of_slots = len(interviewer_start_time) for i in range(len_of_slots): add_edit_time_slots = Interviewertimeslots(interviewer_id=added_edited_interviewer_id.interviewer_id, interviewer_start_time=interviewer_start_time[i], interviewer_end_time=interviewer_end_time[i]) db.session.add(add_edit_time_slots) db.session.commit() @app.route("/interviewer/<interviewer_id>/edit", methods=['GET', 'POST']) @Authentication_Required.requires_auth def edit_interviewer(interviewer_id): "Edit the interviewers" # This query fetch the interviewer details by joining the time slots table and interviewers table. if request.method == "GET": exists = db.session.query(db.exists().where( Interviewertimeslots.interviewer_id == interviewer_id)).scalar() if exists: interviewer_details = Interviewers.query.join(Interviewertimeslots, Interviewers.interviewer_id == Interviewertimeslots.interviewer_id).filter( Interviewers.interviewer_id == interviewer_id).values(Interviewers.interviewer_name, Interviewers.interviewer_email, Interviewers.interviewer_designation, Interviewers.interviewer_id, Interviewertimeslots.interviewer_start_time, Interviewertimeslots.interviewer_end_time) parsed_interviewer_details = form_interviewer_details( interviewer_details) else: interviewer_details = Interviewers.query.filter(Interviewers.interviewer_id == interviewer_id).values( Interviewers.interviewer_id, Interviewers.interviewer_name, Interviewers.interviewer_email, Interviewers.interviewer_designation) for each_detail in interviewer_details: parsed_interviewer_details = { 'interviewers_name': each_detail.interviewer_name, 'interviewers_id': each_detail.interviewer_id, 'interviewers_email': each_detail.interviewer_email, 'interviewers_designation': each_detail.interviewer_designation} if request.method == "POST": # Updating the interviewers table interviewer_name = request.form.get('name') time_object = request.form.get('timeObject') data = {'interviewer_name': interviewer_name} edit_interviewers = Interviewers.query.filter(Interviewers.interviewer_id == interviewer_id).update({'interviewer_name': request.form.get( 'name'), 'interviewer_email': request.form.get('email'), 'interviewer_designation': request.form.get('designation')}) db.session.commit() # Fetching the time ids of interviewer total_rows_of_interviewer_in_time_table = Interviewertimeslots.query.filter( Interviewertimeslots.interviewer_id == interviewer_id).values(Interviewertimeslots.time_id) # Store the timeid in the list for deleting at the end list_edited_time_slots = [] for each_time_id in total_rows_of_interviewer_in_time_table: list_edited_time_slots.append(each_time_id.time_id) # Filtering the interviewer id from the table to use it for interviewertimeslots table add_edit_interviewers_in_time_slot_table(interviewer_name) # Deleting the old time slots based on the timeie for each_times_id in list_edited_time_slots: delete_time_slots = Interviewertimeslots.query.filter( Interviewertimeslots.time_id == each_times_id).one() db.session.delete(delete_time_slots) db.session.commit() return jsonify(data) return render_template("edit-interviewer.html", result=parsed_interviewer_details) @app.route("/interviewer/<interviewer_id>/delete", methods=["POST"]) @Authentication_Required.requires_auth def delete_interviewer(interviewer_id): "Deletes an interviewer" if request.method == 'POST': # interviewer_to_delete = request.form.get('interviewer-id') deleted_user = Interviewers.query.filter( Interviewers.interviewer_id == interviewer_id).first() data = {'interviewer_name': deleted_user.interviewer_name, 'interviewer_id': deleted_user.interviewer_id} db.session.delete(deleted_user) db.session.commit() delete_user_timeslot = Interviewertimeslots.query.filter( Interviewertimeslots.interviewer_id == interviewer_id).delete() db.session.commit() return jsonify(data) def fetch_all_interviewers(): "Fetch all the interviewers for adding rounds" my_interviewers_list = [] display_interviewers = Interviewers.query.all() for each_interviewer in display_interviewers: my_interviewers_list.append({'interviewer_id':each_interviewer.interviewer_id,'interviewer_list':each_interviewer.interviewer_name}) return my_interviewers_list @app.route("/jobs") @Authentication_Required.requires_auth def jobs_page(): "Displays the jobs page for the interview" display_jobs = Jobs.query.all() my_job_list = [] interviewers_list = fetch_all_interviewers() for each_job in display_jobs: if each_job.job_status == None: job_status = check_job_status(each_job.job_id) my_job_list.append( {'job_id': each_job.job_id, 'job_role': each_job.job_role, 'job_status':each_job.job_status}) return render_template("list-jobs.html", result=my_job_list,interviewers=interviewers_list) def fetch_candidate_list(candidate_list_object,job_id): "Fetch the candidate list" my_candidates_list = [] for each_candidate in candidate_list_object: candidate_status_object = Candidatestatus.query.filter(Candidatestatus.status_id == each_candidate.candidate_status).values(Candidatestatus.status_name) for candidate_status in candidate_status_object: candidate_status = candidate_status.status_name my_candidates_list.append({'candidate_id':each_candidate.candidate_id, 'candidate_name':each_candidate.candidate_name, 'candidate_email':each_candidate.candidate_email, 'job_id':job_id, 'candidate_status':candidate_status}) return my_candidates_list def check_job_status(job_id): "Check the job status if it's none add the open" job_status = Jobs.query.filter(Jobs.job_id==job_id).value(Jobs.job_status) if job_status == None: add_open_to_job = Jobs.query.filter(Jobs.job_id==job_id).update({'job_status':'Open'}) db.session.commit() job_status = 'Open' return job_status @app.route("/details/job/<job_id>") @Authentication_Required.requires_auth def interviewers_for_roles(job_id): "Display the interviewers based on the job id" interviewers_list = [] rounds_list = [] candidates_list = [] # Fetch the interviewers list for the job role interviewer_list_for_roles = Interviewers.query.join(Jobinterviewer, Interviewers.interviewer_id == Jobinterviewer.interviewer_id).filter( Jobinterviewer.job_id == job_id).values(Interviewers.interviewer_name) # Fetch the job list db_round_list = db.session.query(Jobs, Jobround, Rounds).filter(Jobround.job_id == job_id, Rounds.round_id == Jobround.round_id).group_by(Rounds.round_id).values( Rounds.round_name,Rounds.round_time,Rounds.round_description,Rounds.round_requirement) #Fetch the candidate list db_candidate_list = Candidates.query.join(Jobcandidate,Candidates.candidate_id == Jobcandidate.candidate_id).filter(Jobcandidate.job_id==job_id).values(Candidates.candidate_id, Candidates.candidate_name, Candidates.candidate_email, Jobcandidate.candidate_status) """db_candidate_list = db.session.query(Candidates, Jobs, Jobcandidate).filter(Jobcandidate.job_id == job_id).values(Candidates.candidate_id, Candidates.candidate_name, Candidates.candidate_email, Jobs.job_id, Jobs.job_role, Jobcandidate.candidate_status)""" candidates_list = fetch_candidate_list(db_candidate_list,job_id) for each_interviewer in interviewer_list_for_roles: interviewers_list.append( {'interviewers_name': each_interviewer.interviewer_name}) for each_round in db_round_list: rounds_list.append( { 'round_name' : each_round.round_name, 'round_time' : each_round.round_time, 'round_description' : each_round.round_description, 'round_requirement' : each_round.round_requirement } ) #Check the job status and fetch it fetch_job_status = check_job_status(job_id) rounds_list.append({'job_id':job_id,'job_status':fetch_job_status}) return render_template("role-for-interviewers.html", round=rounds_list, result=interviewers_list,candidates=candidates_list, jobid=job_id) def check_jobs_exists(job_role): "Check the job already exists in the database" fetch_existing_job_role = Jobs.query.all() jobs_list = [] # Fetch the job role for each_job in fetch_existing_job_role: jobs_list.append(each_job.job_role.lower()) # Compare the job with database job list if job_role.lower() in jobs_list: check_job_exists = True else: check_job_exists = False return check_job_exists def check_not_existing_interviewers(interviewers,actual_interviewers_list): "remove the non existing interviewers" interviewers = set(interviewers) actual_interviewers_list = set(actual_interviewers_list) final_interviewers_list = actual_interviewers_list.intersection(interviewers) return final_interviewers_list @app.route("/jobs/add", methods=["GET", "POST"]) @Authentication_Required.requires_auth def add_job(): "Add ajob through UI" if request.method == 'GET': all_interviewers = Interviewers.query.all() interviewers_list = [] for each_interviewer in all_interviewers: interviewers_list.append(each_interviewer.interviewer_name) return render_template("add-jobs.html", result=interviewers_list) if request.method == 'POST': job_role = request.form.get("role") data = {'jobrole': job_role} check_job_exists = check_jobs_exists(job_role) # If the job is already in the database send failure # If it's not there add the new job role and return success if check_job_exists != True: #new_interviewers_list = [] interviewers = ast.literal_eval( request.form.get("interviewerlist")) # I have to remove the duplicates and removing the whitespaces which will be # added repeatedly through UI interviewers = remove_duplicate_interviewers(interviewers) #remove the interviewers if its not in the database all_interviewers_list = Interviewers.query.all() actual_interviewers_list = [] for each_interviewer in all_interviewers_list: actual_interviewers_list.append(each_interviewer.interviewer_name) interviewers = check_not_existing_interviewers(interviewers,actual_interviewers_list) job_object = Jobs(job_role=job_role,job_status='Open') db.session.add(job_object) db.session.commit() job_id = job_object.job_id # Get the id of the user from the interviewers table for each_interviewer in interviewers: interviewer_id = db.session.query(Interviewers.interviewer_id).filter( Interviewers.interviewer_name == each_interviewer.strip()).scalar() job_interviewer_object = Jobinterviewer( job_id=job_id, interviewer_id=interviewer_id) db.session.add(job_interviewer_object) db.session.commit() else: return jsonify(message='The job already exists'), 500 data = {'jobrole': job_role, 'interviewers': list(interviewers),'job_id':job_id} return jsonify(data) @app.route("/jobs/delete", methods=["POST"]) @Authentication_Required.requires_auth def delete_job(): "Deletes a job" if request.method == 'POST': job_id_to_delete = request.form.get('job-id') deleted_role = Jobs.query.filter( Jobs.job_id == job_id_to_delete).first() data = {'job_role': deleted_role.job_role, 'job_id': deleted_role.job_id} update_job_status = Jobs.query.filter(Jobs.job_id == job_id_to_delete).update({'job_status':'Delete'}) db.session.commit() return jsonify(data) def is_equal(interviewers_name_list, interviewers_list): "Check both lists are same or not" return sorted(interviewers_name_list) == sorted(interviewers_list) def get_interviewers_name_for_jobupdate(fetched_job_id): "Get the interviewers name from table using Jobid" # Fetch the interviewer id based on the job id from the Jobinterviewer table interviewers_name_list = [] get_interviewers_id = Jobinterviewer.query.filter( Jobinterviewer.job_id == fetched_job_id).all() for each_interviewer_id in get_interviewers_id: interviewer_id = each_interviewer_id.interviewer_id # Fetch the interviewer name by using the parsed interviewer id in interviewers table interviewer_name_for_role = db.session.query(Interviewers.interviewer_name).filter( Interviewers.interviewer_id == interviewer_id).scalar() interviewers_name_list.append(interviewer_name_for_role) return interviewers_name_list def remove_duplicate_interviewers(interviewers_list): "Remove the duplicates from the interviewers list" new_interviewers_list = [] for each_interviewers in interviewers_list: new_interviewers_list.append(each_interviewers.strip()) interviewers = list(set(new_interviewers_list)) return interviewers def update_job_interviewer_in_database(job_id, job_role, interviewers_list): "Update the Job and Interviewer in database based on the condition" edit_job = Jobs.query.filter( Jobs.job_id == job_id).update({'job_role': job_role}) db.session.commit() # Fetch the combo id of each row which matches with job id fetch_combo_id = Jobinterviewer.query.filter( Jobinterviewer.job_id == job_id).values(Jobinterviewer.combo_id) list_combo_id = [] for each_id in fetch_combo_id: list_combo_id.append(each_id.combo_id) # Delete the existing rows of job-id in the Jobinterviewer for each_combo_id in list_combo_id: delete_updated_job_id = Jobinterviewer.query.filter( Jobinterviewer.combo_id == each_combo_id).one() db.session.delete(delete_updated_job_id) db.session.commit() # Fetch the interviewers id from the interviewers table # Add new rows in the Jobinterviewer table with updated interviewer id for each_interviewer in interviewers_list: interviewer_id = db.session.query(Interviewers.interviewer_id).filter( Interviewers.interviewer_name == each_interviewer.strip()).scalar() job_interviewer_object = Jobinterviewer( job_id=job_id, interviewer_id=interviewer_id) db.session.add(job_interviewer_object) db.session.commit() @app.route("/job/<job_id>/edit", methods=["GET", "POST"]) @Authentication_Required.requires_auth def edit_job(job_id): "Editing the already existing job" if request.method == 'GET': # Fetch the Job role from the job table fetched_job_id = job_id get_job_role = Jobs.query.filter( Jobs.job_id == fetched_job_id).scalar() interviewers_name_list = get_interviewers_name_for_jobupdate( fetched_job_id) # I am repeating this code here to fetch all the interviewers list. # I should refactor it all_interviewers = Interviewers.query.all() interviewers_list = [] for each_interviewer in all_interviewers: interviewers_list.append(each_interviewer.interviewer_name) api_response = {'role_name': get_job_role.job_role, 'job_id': fetched_job_id, 'interviewers_name': interviewers_name_list, 'interviewers_list': interviewers_list} return render_template("edit-jobs.html", result=api_response) if request.method == 'POST': # Get the job role and Job ID,and name list job_role = request.form.get('role') job_id = request.form.get('id') data = {'job_role': job_role} interviewers_list = ast.literal_eval( request.form.get('interviewerlist')) # Fetch the interviewers list which is already exists for the job interviewers_name_list = get_interviewers_name_for_jobupdate(job_id) # Remove the duplicate interviewers interviewers_list = remove_duplicate_interviewers(interviewers_list) #Check the interviewers are there in the database all_interviewers_list = Interviewers.query.all() actual_interviewers_list = [] for each_interviewer in all_interviewers_list: actual_interviewers_list.append(each_interviewer.interviewer_name) #check the non exisiting interviewers are there interviewers_list = check_not_existing_interviewers(interviewers_list,actual_interviewers_list) #remove None from the list.Filter remos None from the list if it presents interviewers_name_list = list(filter(None,interviewers_name_list)) # Compare the two list which is fetched from UI and Database check_interviewer_list = is_equal( interviewers_name_list, interviewers_list) # Check the job already exists in the database check_job_exists = check_jobs_exists(job_role) # These are all the four conditions to be tested for editing if (check_job_exists != True and check_interviewer_list != True): update_job_interviewer_in_database( job_id, job_role, interviewers_list) return jsonify(data) elif (check_job_exists != True and check_interviewer_list == True): update_job_interviewer_in_database( job_id, job_role, interviewers_list) return jsonify(data) elif (check_job_exists == True and check_interviewer_list != True): update_job_interviewer_in_database( job_id, job_role, interviewers_list) return jsonify(data) else: return jsonify(message='The job already exists,Check before you edit the Jobs'), 500 @app.route("/interviewers/add", methods=["GET", "POST"]) @Authentication_Required.requires_auth def add_interviewers(): data = {} "Adding the interviewers" if request.method == 'GET': return render_template("add-interviewers.html") if request.method == 'POST': interviewer_name = request.form.get('name') interviewer_email = request.form.get('email').lower() interviewer_designation = request.form.get('designation') # Check the candidate has been already added or not check_interviewer_exists = db.session.query(db.exists().where( Interviewers.interviewer_email == interviewer_email)).scalar() if check_interviewer_exists == False: data = {'interviewer_name': interviewer_name} interviewer_object = Interviewers( interviewer_name=interviewer_name, interviewer_email=interviewer_email, interviewer_designation=interviewer_designation) db.session.add(interviewer_object) db.session.flush() interviewer_id = interviewer_object.interviewer_id db.session.commit() add_edit_interviewers_in_time_slot_table(interviewer_name) data['interviewer_id']=interviewer_id return jsonify(data=data) else: return jsonify(error='Interviewer already exists'), 500 def parse_interview_time(interview_time): "Parsing the string into time" parsed_interview_time = datetime.datetime.strptime(interview_time,'%Y-%m-%dT%H:%M:%S+05:30') return parsed_interview_time.strftime('%H') + ':' + parsed_interview_time.strftime('%M') def convert_to_timezone(date_and_time): "convert the time into current timezone" # Current time in UTC format = "%Y-%m-%d %H:%M:%S %Z%z" # Convert to Asia/Kolkata time zone now_asia = date_and_time.astimezone(timezone('Asia/Kolkata')) now_asia = now_asia.strftime(format) return now_asia @app.route("/<candidate_id>/<job_id>/<url>/welcome") def show_welcome(candidate_id, job_id, url): "Opens a welcome page for candidates" interview_data = {} data = {'job_id': job_id,'candidate_id':candidate_id,'url':url} s = Serializer('WEBSITE_SECRET_KEY') now_utc = datetime.datetime.now(timezone('UTC')) current_date_and_time = convert_to_timezone(now_utc) current_date_and_time = datetime.datetime.strptime(current_date_and_time,"%Y-%m-%d %H:%M:%S IST+0530") try: #check the url is valid or not fetch_candidate_unique_url = Jobcandidate.query.filter(Jobcandidate.candidate_id==candidate_id).values(Jobcandidate.url) for unique_url in fetch_candidate_unique_url: candidate_unique_url = unique_url.url candidate_unique_url = re.sub(r'^.*/','',candidate_unique_url) if candidate_unique_url == url: #This query fetches the candidate status id url = s.loads(url) get_candidate_status = db.session.query(Jobcandidate).filter(Jobcandidate.candidate_id==candidate_id).values(Jobcandidate.candidate_status,Jobcandidate.interview_start_time) for candidate_status in get_candidate_status: candidate_status_id = candidate_status.candidate_status interview_start_time = candidate_status.interview_start_time #Fetch the candidate status name from candidatestatus table candidate_status = db.session.query(Candidatestatus).filter(Candidatestatus.status_id==candidate_status_id).scalar() if(candidate_status.status_name == status.CANDIDTATE_STATUS[1]): return render_template("welcome.html",result=data) elif (candidate_status.status_name == status.CANDIDTATE_STATUS[2] and datetime.datetime.strptime(interview_start_time,"%Y-%m-%dT%H:%M:%S+05:30") > current_date_and_time): #Fetch the candidate name and email get_candidate_details = db.session.query(Candidates).filter(Candidates.candidate_id==candidate_id).values(Candidates.candidate_email,Candidates.candidate_id,Candidates.candidate_name) #Fetch the interview date and time get_interview_details = db.session.query(Jobcandidate).filter(Jobcandidate.candidate_id==candidate_id).values(Jobcandidate.interview_end_time,Jobcandidate.interview_start_time,Jobcandidate.interview_date,Jobcandidate.interviewer_email) #Parsing candidate details for candidate_detail in get_candidate_details: data = {'candidate_name':candidate_detail.candidate_name,'candidate_email':candidate_detail.candidate_email} #Parsing the round details candidate_round_details = db.session.query(Candidateround.candidate_id==candidate_id,Candidateround.round_status=='Interview Scheduled').values(Candidateround.round_id) for each_round_detail in candidate_round_details: fetched_round_id = each_round_detail.round_id round_info_object = Rounds.query.filter(Rounds.round_id==fetched_round_id).values(Rounds.round_id,Rounds.round_description,Rounds.round_name,Rounds.round_requirement,Rounds.round_time) for each_round_info in round_info_object: round_info = {'round_name':each_round_info.round_name,'round_requirements':each_round_info.round_requirement,'round_time':each_round_info.round_time,'round_description':each_round_info.round_description} #Parsing Interview details for interview_detail in get_interview_details: interview_start_time = parse_interview_time(interview_detail.interview_start_time) interview_end_time = parse_interview_time(interview_detail.interview_end_time) interview_data = {'interview_start_time':interview_start_time,'interview_end_time':interview_end_time,'interview_date':interview_detail.interview_date,'interviewer_email':interview_detail.interviewer_email,'round_time': round_info['round_time'],'round_description':round_info['round_description']} else: return render_template("expiry.html") else: return render_template("expiry.html") except Exception as e: print(e) return render_template("expiry.html") return render_template("welcome.html",result=data,interview_result=interview_data) @app.route("/<job_id>/<url>/<candidate_id>/valid",methods=['GET','POST']) def schedule_interview(job_id,url,candidate_id): "Validate candidate name and candidate email" if request.method == 'POST': candidate_unique_code = request.form.get('unique-code') candidate_unique_code = candidate_unique_code.strip() candidate_email = request.form.get('candidate-email') #url = request.form.get('url') candidate_data = Candidates.query.filter(Candidates.candidate_id == candidate_id).values(Candidates.candidate_email,Candidates.candidate_name) for each_info in candidate_data: candidate_fetch_email = each_info.candidate_email candidate_name = each_info.candidate_name return_data = {'job_id':job_id,'candidate_id':candidate_id,'url':url,'candidate_name':candidate_name} candidate_code = Jobcandidate.query.filter(Jobcandidate.candidate_id==candidate_id,Jobcandidate.job_id==job_id).value(Jobcandidate.unique_code) if candidate_fetch_email.lower() != candidate_email.lower(): err={'error':'EmailError'} return jsonify(error=err,result=return_data) elif candidate_code.lower() != candidate_unique_code.lower(): err={'error':'CodeError'} return jsonify(error=err,result=return_data) elif (candidate_code.lower() == candidate_unique_code.lower() and candidate_fetch_email.lower() == candidate_email.lower()): return_data = { 'candidate_id':candidate_id, 'candidate_unique_code':candidate_code, 'candidate_email':candidate_email, 'job_id':job_id, 'candidate_name' :candidate_name } #Fetch the candidate URL from the db and compare the url which is in the browser fetch_candidate_unique_url = Jobcandidate.query.filter(Jobcandidate.candidate_id==candidate_id).values(Jobcandidate.url) for unique_url in fetch_candidate_unique_url: candidate_unique_url = unique_url.url candidate_unique_url = re.sub(r'^.*/','',candidate_unique_url) if candidate_unique_url == url: session['candidate_info'] = return_data err={'error':'Success'} return jsonify(error=err,result=return_data) else: err={'error':'OtherError'} return_data = {'job_id':job_id,'candidate_id':candidate_id,'url':url} return jsonify(error=err,result=return_data) else: err={'error':'OtherError'} return jsonify(error=err,result=return_data) @app.route('/<job_id>/get-schedule') def redirect_get_schedule(job_id): "Redirect to the get schedule page" #Parsing the round details fetched_round_id = None candidate_round_details = Candidateround.query.filter(Candidateround.candidate_id==session['candidate_info']['candidate_id'],Candidateround.round_status=='Invitation Sent').values(Candidateround.round_id) for each_round_detail in candidate_round_details: fetched_round_id = each_round_detail.round_id if fetched_round_id == None: return render_template("expiry.html") else: round_info_object = Rounds.query.filter(Rounds.round_id==fetched_round_id).values(Rounds.round_id,Rounds.round_description,Rounds.round_name,Rounds.round_requirement,Rounds.round_time) for each_round_info in round_info_object: round_info = {'round_name':each_round_info.round_name,'round_requirements':each_round_info.round_requirement,'round_time':each_round_info.round_time,'round_description':each_round_info.round_description,'round_id':each_round_info.round_id} data = { 'candidate_id':session['candidate_info']['candidate_id'], 'candidate_name':session['candidate_info']['candidate_name'], 'candidate_email':session['candidate_info']['candidate_email'], 'job_id':session['candidate_info']['job_id'], 'round_time': round_info['round_time'], 'round_description':round_info['round_description'], 'round_id':round_info['round_id'] } return render_template("get-schedule.html",result=data) def fetch_interviewer_email(candidate_id, job_id): "Fetch the interviewers email for the candidate" email_id = Jobcandidate.query.filter(Jobcandidate.job_id == job_id, Jobcandidate.candidate_id == candidate_id).value(Jobcandidate.interviewer_email) if email_id == None: print("The interviewer is not yet assigned for the candidate") return email_id @app.route("/candidate/<candidate_id>/job/<job_id>/invite", methods=["GET", "POST"]) @Authentication_Required.requires_auth def send_invite(candidate_id, job_id): "Send an invite to schedule an interview" if request.method == 'POST': candidate_email = request.form.get("candidateemail") candidate_id = request.form.get("candidateid") candidate_name = request.form.get("candidatename") job_id = request.form.get("jobid") generated_url = request.form.get("generatedurl") expiry_date = request.form.get("expirydate") round_description = request.form.get("rounddescription") round_id = request.form.get("roundid") round_time = request.form.get("roundtime") round_name = request.form.get("roundname") round_info = {'round_time':round_time, 'round_description':round_description,'round_name':round_name} logged_email = session['logged_user'] generated_url = base_url + generated_url +'/welcome' cc = [] try: #Generate unique id to schedule an interview unique_code = str(uuid.uuid4()).split('-')[0] #Update the unique code into the table update_unique_code = Jobcandidate.query.filter(Jobcandidate.candidate_id==candidate_id,Jobcandidate.job_id==job_id).update({'unique_code':unique_code}) interviewer_email_id = fetch_interviewer_email(candidate_id, job_id) if interviewer_email_id == None: cc = [logged_email] else: cc = interviewer_email_id.split(',') cc.append(logged_email) msg = Message("Invitation to schedule an Interview with Qxf2 Services!", sender=("Qxf2 Services","test@qxf2.com"), recipients=[candidate_email], cc=cc) msg.html = render_template("send_invite.html", candidate_name=candidate_name, round_name=round_name,round_details=round_description, round_username=candidate_name, link=generated_url, unique_code=unique_code,expiry_date=expiry_date) mail.send(msg) # Fetch the id for the candidate status 'Waiting on Qxf2' #Fetch the candidate status from status.py file also. Here we have to do the comparison so fetching from the status file candidate_status_id = db.session.query(Candidatestatus).filter(Candidatestatus.status_name==status.CANDIDTATE_STATUS[1]).scalar() #Change the candidate status after the invite has been sent candidate_status = Jobcandidate.query.filter(Jobcandidate.candidate_id == candidate_id, Jobcandidate.job_id == job_id).update({'candidate_status':candidate_status_id.status_id}) db.session.commit() #Add the candidate round details in candidateround table #As of now I am adding round status as completed we can change this to 'Invite sent' """candidate_round_detail = Candidateround.query.filter(Candidateround.candidate_id == candidate_id,Candidateround.job_id == job_id).update({'round_id':round_id,'round_status':'Completed'})""" candidate_round_detail = Candidateround(candidate_id=candidate_id,job_id=job_id,round_id=round_id,round_status='Invitation Sent') db.session.add(candidate_round_detail) db.session.commit() error = 'Success' last_updated_date = Candidates.query.filter(Candidates.candidate_id==candidate_id).update({'last_updated_date':datetime.date.today()}) db.session.commit() except Exception as e: error = "Failed" return(str(e)) data = {'candidate_name': candidate_name, 'error': error} return jsonify(data) @app.route("/job/status",methods=["GET","POST"]) def job_status(): "Change the job status based on the selected dropdown" #job_status = request.form.get("jobstatus") job_id = request.form.get("jobid") #status = request.form.get("jobstatus") #Get the job status for the job id job_status_db = Jobs.query.filter(Jobs.job_id == job_id).value(Jobs.job_status) if (job_status_db == 'Close'): new_jobs_status = 'Open' job_status = Jobs.query.filter(Jobs.job_id == job_id).update({'job_status':new_jobs_status}) db.session.commit() else: new_jobs_status = 'Close' job_status = Jobs.query.filter(Jobs.job_id == job_id).update({'job_status':new_jobs_status}) db.session.commit() return jsonify({'job_status':new_jobs_status})
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler/static
qxf2_public_repos/interview-scheduler/qxf2_scheduler/static/css/qxf2_scheduler.css
body { font-size: 20px; font-family: "Open Sans", serif; } .dropdown { position: relative; display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #f1f1f1; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .logoutLblPos { position: fixed; right: 10px; top: 5px; } .dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; } .glyphicon.glyphicon-menu-hamburger { font-size: 25px; } .dropdown-content a:hover {background-color: #ddd;} .dropdown:hover .dropdown-content {display: block;} .dropdown:hover .dropbtn {background-color: #3e8e41;} .wrapper { position:absolute; top:5px; right:80px; } .buttons { background-color: #4CAF50; border: none; color: black; padding: 14px 10px; text-align: center; text-decoration: none; display: inline-block; font-size: 10px; margin: 4px 2px; cursor: pointer; height:10px } .loader { visibility: hidden; position: absolute; left: 45%; border: 10px solid #f3f3f3; border-radius: 50%; border-top: 10px solid #03a5fc; border-bottom: 10px solid #03a5fc; width: 90px; height: 90px; -webkit-animation: spin 2s linear infinite; animation: spin 2s linear infinite; } .labelbold{ font-weight:bold; } @-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); } } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .modal-megamenu { max-height: calc(100vh - 400px); overflow-y: auto; } .top-space-10 { margin-top: 10px; } .top-space-20 { margin-top: 20px; } .top-space-30 { margin-top: 30px; } .bottom-space-40 { margin-bottom: 10px; } .bottom-space-20 { margin-bottom: 20px; } .bs-example { margin: 20px; } .textarea { display: inline } .form-display { display:flex; flex-direction: row; justify-content: left; align-items: center; } .form-control{ width: 45px; /* or whatever width looks good for your purpose */ } .drop-down { display: inline; width:10px; } .select { width:80px; } href-link { color:blue;} .link-button { background: none!important; border: none; padding: 0!important; color:gray; cursor: pointer; text-decoration: underline; } label, input { display: block; } input.text { margin-bottom: 12px; width: 95%; padding: .4em; } fieldset { padding: 0; border: 0; margin-top: 25px; } h1 { font-size: 1.2em; margin: .6em 0; } div#users-contain { width: 350px; margin: 20px 0; } div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; } div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; } .ui-dialog { padding: .3em; } .validateTips { border: 1px solid transparent; padding: 0.3em; } .ui-state-error { padding: .3em; } .divtext { border: ridge 2px; padding: 5px; width: 20em; min-height: 5em; overflow: auto; } header img { float: left; width: 80px; height: 80px; position: relative; top: -12px; } header h1 { top: 18px; font-size: 30px; color: brown; text-align: center; } header { min-height: 80px; } .footer{ overflow: hidden; background-color: #333; position: fixed; right: 0; left: 0; bottom: 0; width: 100%; height: 27px; } .footer p { display: block; color: #f2f2f2; text-align: center; padding: 10px 12px; text-decoration: none; font-size: 17px; } * { box-sizing: border-box; } body { font-family: Arial, Helvetica, sans-serif; } section { max-width: 80%; margin-right: auto; margin-left: auto; } /* Create two columns/boxes that floats next to each other */ nav { float: left; width: 30%; height: 400px; /* only for demonstration, should be removed */ background: #ccc; padding: 20px; } article { float: left; padding: 20px; width: 70%; background-color: #f1f1f1; height: 400px; /* only for demonstration, should be removed */ } /* Clear floats after the columns */ section:after { content: ""; display: table; clear: both; } /* Responsive layout - makes the two columns/boxes stack on top of each other instead of next to each other, on small screens */ @media (max-width: 600px) { nav, article { width: 100%; height: auto; } } .switch { position: relative; display: inline-block; width: 90px; height: 34px; } .switch input { display: none; } .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ca2222; -webkit-transition: .4s; transition: .4s; } .slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background-color: white; -webkit-transition: .4s; transition: .4s; } input:checked+.slider { background-color: #2ab934; } input:focus+.slider { box-shadow: 0 0 1px #2196F3; } input:checked+.slider:before { -webkit-transform: translateX(55px); -ms-transform: translateX(55px); transform: translateX(55px); } /*------ ADDED CSS ---------*/ .on { display: none; } .on, .off { color: white; position: absolute; transform: translate(-50%, -50%); top: 50%; left: 50%; font-size: 10px; font-family: Verdana, sans-serif; } input:checked+.slider .on { display: block; } input:checked+.slider .off { display: none; } /*--------- END --------*/ /* Rounded sliders */ .slider.round { border-radius: 34px; } .slider.round:before { border-radius: 50%; } .morecontent span { position: absolute; visibility:hidden; display:none; } .morelink { display: block; } .not-active { pointer-events: none; cursor: default; text-decoration: none; color: black; } { font-family: 'Ubuntu', sans-serif; font-weight: bold; } .select2-container { min-width: 400px; } .select2-results__option { padding-right: 20px; vertical-align: middle; } .select2-results__option:before { content: ""; display: inline-block; position: relative; height: 20px; width: 20px; border: 2px solid #e9e9e9; border-radius: 4px; background-color: #fff; margin-right: 20px; vertical-align: middle; } .select2-results__option[aria-selected=true]:before { font-family:fontAwesome; content: "\f00c"; color: #fff; background-color: #f77750; border: 0; display: inline-block; padding-left: 3px; } .select2-container--default .select2-results__option[aria-selected=true] { background-color: #fff; } .select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: #eaeaeb; color: #272727; } .select2-container--default .select2-selection--multiple { margin-bottom: 10px; } .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple { border-radius: 4px; } .select2-container--default.select2-container--focus .select2-selection--multiple { border-color: #f77750; border-width: 2px; } .select2-container--default .select2-selection--multiple { border-width: 2px; } .select2-container--open .select2-dropdown--below { border-radius: 6px; box-shadow: 0 0 10px rgba(0,0,0,0.5); } .select2-selection .select2-selection--multiple:after { content: 'hhghgh'; } /* select with icons badges single*/ .select-icon .select2-selection__placeholder .badge { display: none; } .select-icon .placeholder { display: none; } .select-icon .select2-results__option:before, .select-icon .select2-results__option[aria-selected=true]:before { display: none !important; /* content: "" !important; */ } .select-icon .select2-search--dropdown { display: none; }
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/edit-feedback.html
<!DOCTYPE html> <html lang="en"> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Edit feedback</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <style> .bs-example { margin: 20px; } textarea { display: inline } </style> </head> <body> {% include "logout.html" %} {% if candidate_feedback == None %} <body onload="showalert()"></body> {% else %} <form class="needs-validation"> <label class="col-md-4 control-label" for="thumbsUp"> <span style="color:red">*</span> What was your opinion about the candidate? </label> <div class="col-md-4"> {% if candidate_feedback['thumbs_value'] == 'Thumbs Up' %} <select id="thumbsUp" style="width:200px; height:30px;"> <option value="thumbsup" selected>{{candidate_feedback['thumbs_value']}}</option> <option value="thumbsdown">Thumbs Down</option> </select> {% elif candidate_feedback['thumbs_value'] == 'Thumbs Down' %} <select id="thumbsUp" style="width:200px; height:30px;"> <option value="thumbsdown" selected>{{candidate_feedback['thumbs_value']}}</option> <option value="thumbsup">Thumbs Up</option> </select> {% else %} <select id="thumbsUp" style="width:200px; height:30px;"> <option value="Select thumbs up or down">Select</option> <option value="thumbsdown">Thumbs Down</option> <option value="thumbsup">Thumbs Up</option> </select> {% endif %} {% endif %} </div> <br> <div> <h2 class="grey_text text-justify">Edit feedback</h2> <label class="col-md-4 control-label" for="feedback"><span style="color:red">*</span>Edit your feedback</label> <div class="col-md-4"> <textarea id="comments" name="comments" rows="10" col="20" class="form-control" required>{{candidate_feedback['candidate_feedback']}}</textarea> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <div> <label class="col-md-4 control-label" for="save"></label> <div class="col-md-8"> <button class="btn btn-info" id="submit" type="submit">Edit</button> <button type="button" name="clear" onclick="clearEdit()" class="btn btn-danger">Cancel</button> </div> </div> <input type="hidden" id="candidateId" value={{result.candidate_id}}> <input type="hidden" id="roundId" value={{result.round_id}}> </div> </form> <script> (function () { 'use strict'; window.addEventListener('load', function () { // Fetch all the forms we want to apply custom Bootstrap validation styles to var forms = document.getElementsByClassName('needs-validation'); // Loop over them and prevent submission var validation = Array.prototype.filter.call(forms, function (form) { form.addEventListener('submit', function (event) { event.preventDefault(); event.stopPropagation(); if (form.checkValidity() === false) { } else { var dropdownValue = document.getElementById("thumbsUp"); var thumbsValue = dropdownValue.options[dropdownValue.selectedIndex].value; var editedFeedback = document.getElementById("comments").value var candidateId = document.getElementById("candidateId").value var roundId = document.getElementById("roundId").value console.log(thumbsValue); $.ajax({ type: 'POST', url: '/candidate/' + candidateId + '/round/' + roundId + '/edit_feedback', data: { 'editedfeedback': editedFeedback, 'thumbsvalue': thumbsValue }, success: function (result) { if (result.error == "Success") { alert("The feedback has been edited"); document.location.href = '/candidates' } } }) } }, false); }); }, false); })(); </script> <script> function clearEdit() { document.location.href = "/candidates" } </script> <script> function showalert(){ alert("Please add feedback before editing") document.location.href="/candidates" } </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/get-schedule.html
<html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <title> Welcome to Interview Scheduler Application </title> <meta http-equiv="cache-control" content="no-cache" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="-1" /> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.12.4.js"></script> <script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet" type="text/css"> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- Optional theme <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> --> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <style> p { word-break: break-word; } </style> </head> <body style="background-color:powderblue;"> <header class="header header-default header"> <div class="container-fluid"> <div class="header-header"> <a class="header-brand" href="#"> <img class="row top-space-2 logo img-responsive header" src="/static/img/qxf2_logo.png" alt="Qxf2 Services"></img></a> </a> <h1>Qxf2 Services-Interview Scheduler</h1> </div> </div> </header> <section> <nav> <label for='Date'><span style="color:red">*</span>Choose the interview date:</label> <!--Src for disable keyboard: https://stackoverflow.com/questions/153759/jquery-datepicker-with-text-input-that-doesnt-allow-user-input--> <input type='text' name='datefield' id='datepicker' readonly='true' placeholder="Select date..."> <br> <input class="btn btn-success" type='button' id='submit' value='Confirm your interview date'> </nav> <article> <div> <p><b>Please read the below details carefully before scheduling an interview.</b></p> <ul> <li>The duration of the round is {{result['round_time']}}</li> <li> <p class="display">{{result['round_description']}}</p> </li> <li> You should have a Laptop with proper Internet connection, headphone and webcam </li> </ul> </div> </article> </section> <input type="hidden" id="roundDuration" value="{{result['round_time']}}"> <input type="hidden" id="roundId" value="{{result['round_id']}}"> <!----<input type="hidden" id="roundDuration" value="{{result['round_description']}}">----> <div class="row top-space-30" style="margin-left:15px;" id="resultDiv"> </div> <div class="row top-space-30" style="margin-left:15px;" id="chosenSlot"></div> <div class="row top-space-30" style="margin-left:15px;" id="scheduledEvent"></div> </div> <div class="loader" id="loader" visibility="hidden"></div> <script> $(function () { //holidays in yyyy-mm-dd format var holidays = ['2021-01-01', '2021-01-14', '2021-01-26', '2021-04-13', '2021-05-14', '2021-09-10', '2021-10-15', '2021-11-01', '2021-11-05']; // src https://stackoverflow.com/questions/21669950/jquery-ui-datpicker-excluding-weekends-mindate // Calculate the next working day manually var startDate = new Date(), noOfDaysToAdd = 3, count = 1; while (count <= noOfDaysToAdd) { startDate.setDate(startDate.getDate() + 1); if (startDate.getDay() != 0 && startDate.getDay() != 6) { count++; } } var endDate = new Date(), noOfDaysToAdd = 15, count = 1; while (count <= noOfDaysToAdd) { endDate.setDate(endDate.getDate() + 1); if (endDate.getDay() != 0 && endDate.getDay() != 6) { count++; } } $("#datepicker").datepicker({ beforeShowDay: isHoliday, //beforeShowDay: $.datepicker.noWeekends, minDate: startDate, maxDate: endDate, }); function isHoliday(date) { //Src: https://stackoverflow.com/questions/501943/can-the-jquery-ui-datepicker-be-made-to-disable-saturdays-and-sundays-and-holid var day = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6; var closedDays = [[Saturday], [Sunday]]; for (var i = 0; i < closedDays.length; i++) { if (day == closedDays[i][0]) { return [false]; } } //Src: //Src for holidays: https://stackoverflow.com/questions/15400775/jquery-ui-datepicker-disable-array-of-dates var string = jQuery.datepicker.formatDate('yy-mm-dd', date); return [holidays.indexOf(string) == -1] } }); </script> <script> $("document").ready(function () { $('#submit').click(function () { var date = $('#datepicker').val(); var elements = []; var roundTime = document.getElementById("roundDuration").value; var roundId = document.getElementById("roundId").value; $("#resultDiv").empty(); document.getElementById('loader').style.visibility = 'visible'; if (date == "") { $('#datepicker').css('border', 'solid 2px red'); $('#resultDiv').css('color', 'red'); $('#resultDiv').text('Invalid date') } else { var callDetails = { type: 'POST', url: '/get-schedule', data: { 'date': date, 'roundtime': roundTime, 'roundid': roundId } }; $.ajax(callDetails).done(function (result) { $('#emailfield').css('border', 'solid 2px rgb(238,238,238)'); $('#datepicker').css('border', 'solid 2px rgb(238,238,238)'); $("#resultDiv").css('color', 'black'); freeChunkSlots = result.free_slots_in_chunks if (result.error == "Already scheduled") { alert("The interview has been already scheduled you cant reschedule it again") window.location.href = "expiry.html"; } //Src: https://stackoverflow.com/questions/49040397/print-json-array-in-js var msg = '<br>'; if (result.hasOwnProperty('error')) { msg += result.error; } else { if (freeChunkSlots.length == 0) { msg += 'There are no free slots for on ' + result.date; } else { msg = 'The free slots on ' + result.date + ' are: <br>'; for (index in freeChunkSlots) { slot = freeChunkSlots[index].start + ' - ' + freeChunkSlots[index].end; var timeSlotButton = $('<div class="col-md-2 top-space-20 text-align:left"><input type="button" onclick="displayChosenSlot(\'' + freeChunkSlots[index].email + '\', \'' + date + '\',\'' + slot + '\')" class="btn" value="' + slot + '"></div>'); elements.push(timeSlotButton); } }//end of if freeSlots is empty }//end of no error key found $("#resultDiv").html(msg); if (elements.length > 0) { $("#resultDiv").append(elements); } document.getElementById('loader').style.visibility = 'hidden'; }); } }); }); </script> <script> function displayChosenSlot(emails, date, slot) { var msg = "The chosen slot for the interviewer on " + date + " is: " + slot; var timeSlotButton = $('<div class="top-space-20"><input class="btn btn-info" type="button" onclick="scheduleEvent(\'' + emails + '\',\'' + date + '\',\'' + slot + '\')" class="btn" value="Schedule my interview"></div>'); $("#chosenSlot").html(msg); $("#chosenSlot").append(timeSlotButton); } </script> <script> function addHidden(form, name, value) { var hiddenField = document.createElement("input"); hiddenField.type = 'hidden'; hiddenField.name = name; hiddenField.value = value; form.appendChild(hiddenField) document.body.appendChild(form); } </script> <script> function scheduleEvent(emails, date, slot) { form = document.createElement("form"); form.method = "POST"; form.action = "/confirmation"; addHidden(form, 'interviewerEmails', emails) addHidden(form, 'date', date); addHidden(form, 'slot', slot); form.submit(); } </script> {% include "footer.html" %} </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/read-interviewers.html
<!DOCTYPE html> <html lang="en"> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <title>Interviewer Details</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!--Stylesheets--> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"> <link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" /> <!--JS files--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> </head> <body> {% include "logout.html" %} <div class="container col-md-offset-1"> <table class="table table-striped"> <h2 class="grey_text text-center">Interviewer Details</h2> <thead> <tr> <th scope="col">Name</th> <th scope="col">Email</th> <th scope="col col-md-2">Interviewers work hours</th> </tr> </thead> <tbody> {% for each_detail in result %} <tr> <td>{{ each_detail.interviewers_name }}</td> <td>{{ each_detail.interviewers_email }}</td> <td> {% for each_time in each_detail.time %} <p>{{each_time['starttime'] }}-{{ each_time['endtime']}}</p> {% endfor %} </td> </tr> {% endfor %} </tbody> </table> </div> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/add-candidates.html
<!DOCTYPE html> <html lang="en"> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Add Candidates</title> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <style> .bs-example { margin: 20px; } textarea { display: inline } </style> </head> <body> {% include "logout.html" %} <div> <h2 class="grey_text text-justify">Add Candidates</h2> <form class="needs-validation"> <label class="col-md-4 control-label" for="fname"><span style="color:red">*</span>Name of the candidate</label> <div class="col-md-4"> <input id="fname" name="fname" type="text" placeholder="John" class="form-control" required> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <label class="col-md-4 control-label" for="email"><span style="color:red">*</span>Email</label> <div class="col-md-4"> <input id="email" name="email" type="Email" placeholder="johndoe@example.com" class="form-control" required> <div class=" col-md-8 row top-space-30" id="resultDiv"> </div> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <label class="col-md-4 control-label" for="select1"><span style="color:red">*</span>Job applied for</label> <div class="col-md-4"> <select class="form-control" id="select1" required> <option value="">Select the below option</option> {% for each_job in data %} <option value="{{each_job}}">{{each_job}}</option> {% endfor %} </select> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <label class="col-md-4 control-label" for="comments"><span style="color:red">*</span>Add your comments</label> <div class="col-md-4"> <textarea id="comments" name="comments" rows="10" col="20" class="form-control" required></textarea> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <label class="col-md-4 control-label" for="save"></label> <div class="col-md-8"> <button class="btn btn-info" id="addSubmit" type="submit">Submit</button> <button type="button" name="clear" onclick="clearAdd()" class="btn btn-danger">Cancel</button> </div> </form> </div> <script> function clearAdd() { document.location.href = "/candidates" } </script> <script> (function () { 'use strict'; window.addEventListener('load', function () { var forms = document.getElementsByClassName('needs-validation'); var validation = Array.prototype.filter.call(forms, function (form) { form.addEventListener('submit', function (event) { event.preventDefault(); event.stopPropagation(); var candidateEmail = $("#email").val(); var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; var emailValidate = re.test(candidateEmail); $("#resultDiv").empty(); if (emailValidate === true) { if (form.checkValidity() === true) { var candidateName = $("#fname").val(); var candidateEmail = $("#email").val(); var dropdownValue = document.getElementById("select1"); var jobApplied = dropdownValue.options[dropdownValue.selectedIndex].value; var addedComments = $("#comments").val() $("#addSubmit").attr("disabled", true); $.ajax({ type: 'POST', url: '/candidate/add', data: { 'candidateName': candidateName, 'candidateEmail': candidateEmail, 'jobApplied': jobApplied, 'addedcomments': addedComments }, success: function (result) { var resultName = result.data['candidate_name']; if (result.error == "Success") { alert("The candidate has been added"); document.location.href = "/candidates"; } else { alert("The candidate already exists"); document.location.href = "/candidates"; } } }) } } else { $("#resultDiv").text("Enter the valid email address"); $("#resultDiv").css('color', 'red'); } }, false); }); }, false); })(); </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/candidate-job-status.html
<html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <title> Candidate job status </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!--Stylesheets--> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet"> <link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"> <!--JS--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"> </script> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> </head> <body> {% include "logout.html" %} <h2 class="grey_text text-center">Candidate Details</h2> <div class="container col-md-offset-1"> <div class="container col-md-offset-1"> <div id="form"> <form> <fieldset> {% if result!="" %} <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="Candidate Name:">Candidate Name:</label> <label class="col-md-4" for="candidateName">{{result.candidate_name}}</label> </div> <br> <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="Candidate Email:">Candidate Email:</label> <label class="col-md-10" for="candidateEmail">{{result.candidate_email}}</label> </div> <br> <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="Job Applied:">Job Applied:</label> <label class="col-md-10" for="jobApplied">{{result.job_applied}}</label> </div> <br> {% for each_round_name in all_round_details %} <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="roundName">Round Name( {{ each_round_name ['round_name']}}):</label> {% if (each_round_name['round_status'] == None) or (each_round_name['round_status']) == 'Invitation Sent' %} <label class="col-md-10" for="eachRound"> {{ each_round_name['round_status']}} {% else %} <label class="col-md-10" for="eachRound"> {{ each_round_name['round_status']}}&nbsp;&nbsp; {% if each_round_name['candidate_feedback']['candidate_feedback'] == None %} <a href="/candidate/{{result.candidate_id}}/round/{{each_round_name.round_id}}/add_feedback">Add feedback</a>&nbsp;&nbsp; {% else %} <a href="/candidate/{{result.candidate_id}}/round/{{each_round_name.round_id}}/edit_feedback">Edit feedback</a> </label> {% endif %} {% endif %} </div> <br> <div class="col-md-12 form-display"> <label class="col-md-2 labelbold">Interviewer Feedback:</label> {% if (each_round_name['candidate_feedback']['candidate_feedback'] == None) or (each_round_name['round_status'] == None) or (each_round_name['round_status']) == 'Invitation Sent' %} <label class="col-md-10">None</label> {% else %} {% if each_round_name['candidate_feedback']['thumbs_value']=='thumbsup' %} <label class="col-md-10"> <span class="more"> <img src="/static/img/thumbs-up.png" width="50" height="30"></img> {{each_round_name['candidate_feedback']['candidate_feedback']|markdown}} </span> </label> {% else %} <label class="col-md-10"> <span class="more"> <img src="/static/img/thumbs-down.png" width="50" height="30"></img> {{each_round_name['candidate_feedback']['candidate_feedback']|markdown}} </span> </label> {% endif %} {% endif %} </div> <br> {% endfor %} <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="Interviewer details:">Interviewer Email:</label> {% if result.interviewer_email_id == None%} <label class="col-md-10" for="interviewerDetails"> Interview not yet scheduled</label> {% else %} <label class="col-md-10" for="interviewerDetails"> <p>{{result.interviewer_email_id}}</p> </label> {% endif %} </div> <br> <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="Date Applied:">Date Applied:</label> <label class="col-md-10" for="dateApplied">{{result.date_applied}}</label> </div> <br> <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="Generated URL:">Generated URL:</label> {% if result.url == None %} <label class="col-md-10" for="interviewerDetails"> URL not yet generated</label> {% else %} <label class="col-md-10" for="interviewerDetails" style="max-width:450px; word-wrap: break-word"> {{result.url}}</label> {% endif %} </div> <br> <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="Interviewer details:">Interview date :</label> {% if result.interview_date == None%} <label class="col-md-10" for="interviewerDetails"> Interview not yet scheduled</label> {% else %} <label class="col-md-10" for="interviewerDetails"> <p>{{result.interview_date}}</p> </label> {% endif %} </div> <br> <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="Interviewer details:">Interview time :</label> <label class="col-md-10" for="interviewerDetails"> {% if result.interview_start_time == None%} Interview not yet scheduled {% else %} <p>{{result.interview_start_time}}</p> </label> {% endif %} </div> <br> <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="comments:">Added comments:</label> <label class="col-md-10">{{result.comments|markdown}}</label> </div> <br> {% if result.candidate_status == 'Waiting on Qxf2' %} <div class="col-md-12 form-display"> <label class="col-md-2 labelbold" for="Action:">Action:</label> <input class="btn btn-info" type="button" id="sendEmail" data-generated-url="{{result.url}}" data-candidate-name="{{result.candidate_name}}" data-candidate-email="{{result.candidate_email}}" data-candidate-id="{{result.candidate_id}}" data-job-id="{{result.job_id}}" value="Thumbs up"> <input type="button" data-target="#confirmdeletemodal" data-candidatename="{{ result.candidate_name }}" data-candidateid="{{ result.candidate_id }}" data-jobid="{{ result.job_id }}" data-candidateemail="{{result.candidate_email}}" data-toggle="modal" value="Thumbs down"> <br> </div> <br> {% elif result.candidate_status == 'Interview Scheduled' %} <div class="col-md-12 form-display"> <label class="col-md-2 labelbold" for="Action">Action:</label> <label class="col-md-10" for="interviewScheduled">No action needed from Qxf2</label> </div> <br> <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="Candidate Status">Candidate Status:</label> <label class="col-md-10" for="interviewScheduled">Interview Scheduled</label> </div> {% elif result.candidate_status == 'Waiting on Candidate' %} <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="Action">Action:</label> <label class="col-md-10" for="action">No action needed from Qxf2</label> </div> <br> <div class="col-md-12 form-display"> <label class="col-md-2 labelbold" for="Candidate Status">Candidate Status:</label> <label class="col-md-10" for="inviteSent">Waiting on Candidate</label> </div> <div class="col-md-12 form-display"> <input class="btn btn-info" type="button" id="regenerateUrl" onclick="regenerate()" value="Regenerate URL"> &nbsp;&nbsp; <input class="btn btn-info" type="button" id="noResponse" onclick="noresponse()" value="No response"> </div> {% elif result.candidate_status == 'Waiting for new opening' %} <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="Action">Action:</label> <label class="col-md-10" for="action">No action needed from Qxf2</label> </div> <br> <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="Candidate Status">Candidate Status:</label> <label class="col-md-10" for="inviteSent">Waiting for new opening</label> </div> <br> <div class="col-md-12 form-display"> <label class="labelbold col-md-2" for="Reopen job">Do you want to reopen this candidate?:</label> <input class="btn btn-info" type="button" id="sendEmail" data-generated-url="{{result.url}}" data-candidate-name="{{result.candidate_name}}" data-candidate-email="{{result.candidate_email}}" data-candidate-id="{{result.candidate_id}}" data-job-id="{{result.job_id}}" value="Thumbs up"> </div> {% elif result.candidate_status == 'Reject' %} <div class="col-md-12 form-display"> <label class="col-md-2 labelbold" for="Action">Action:</label> <label class="col-md-10" for="action">No action needed from Qxf2</label> </div> <br> <div class="col-md-12 form-display"> <label class="col-md-2 labelbold" for="Candidate Status">Candidate Status:</label> <label class="col-md-10" for="inviteSent">Reject</label> </div> {% elif result.candidate_status == 'Hired' %} <div class="col-md-12 form-display"> <label class="col-md-2 labelbold" for="Action">Action:</label> <label class="col-md-10" for="action">No action needed from Qxf2</label> </div> <br> <div class="col-md-12 form-display"> <label class="col-md-2 labelbold" for="Candidate Status">Candidate Status:</label> <label class="col-md-10" for="inviteSent">Hired</label> </div> {% endif %} <div class="container col-md-12"> {% if (result.candidate_status == 'Waiting on Qxf2') and (result.interviewer_email_id == None) %} <input type="button" data-target="#nopeningmodal" data-candidatename="{{ result.candidate_name }}" data-candidateid="{{ result.candidate_id }}" data-jobid="{{ result.job_id }}" data-candidateemail="{{result.candidate_email}}" data-toggle="modal" value="No opening"> <!----<input class="btn btn-info" type="button" id="hideButton" onclick="noOpening()" value="No opening">-----> {% elif result.candidate_status == 'No response' or result.candidate_status == 'Reject' %} <input class="btn btn-info" type="button" id="regenerateUrl" onclick="regenerate()" value="Regenerate URL"> {% elif result.candidate_status == 'Waiting on Qxf2' %} <div class="col-md-12"> <input class="col-md-2 btn btn-info" type="button" id="hireButton" onclick="hirebutton()" value="Hired"> </div> {% endif %} </div> </div> {% endif %} </fieldset> </form> </div> <div class="modal modal-megamenu" id="confirmdeletemodal"> <div class="modal-dialog modal-megamenu"> <div class="modal-content modal-megamenu"> <div class="modal-header modal-megamenu"> <h4 class="modal-title">Are you sure you want to thumbs down the candidate?</h4> </div> <div class="modal-body modal-megamenu"> <div class="form-display"> <input type="checkbox" name="rejectCheckbox" id="checkbox"> &nbsp <label>Check the box if you want to send a reject email.</label> </div> </div> <div class="modal-footer modal-megamenu"> <button class="btn btn-default" data-dismiss="modal" type="button">Cancel</button> <button class="btn btn-danger" id="remove-button" data-dismiss="modal" data-backdrop="false" type="submit">Reject</button> </div> </div><!-- end modal-content --> </div><!-- end modal-dialog --> </div> <div class="modal modal-megamenu" id="nopeningmodal"> <div class="modal-dialog modal-megamenu"> <div class="modal-content modal-megamenu"> <div class="modal-header modal-megamenu"> <h4 class="modal-title">Are you sure to send the no opening email to the candidate?</h4> </div> <div class="modal-body modal-megamenu"> <div class="form-display"> <input type="checkbox" name="noopeningCheckbox" id="noopeningcheckbox"> &nbsp <label>Check the box if you want to send a no opening email.</label> </div> </div> <div class="modal-footer modal-megamenu"> <button class="btn btn-default" data-dismiss="modal" type="button">Cancel</button> <button class="btn btn-danger" id="no-opening" data-dismiss="modal" data-backdrop="false" type="submit">No opening</button> </div> </div><!-- end modal-content --> </div><!-- end modal-dialog --> </div> </div> </div> <div id="dialog-form" title="Send Email Invite"> <form> <fieldset> <input type="hidden" id="candidateName" value="{{result.candidate_name}}"> <input type="hidden" id="candidateEmail" value="{{result.candidate_email}}"> <input type="hidden" id="candidateId" value="{{result.candidate_id}}"> <input type="hidden" id="jobId" value="{{result.job_id}}"> <label for="select1">Round Level</label> <div class="col-md-4"> <select required name="select1" id="select1" style="width:200px; height:30px;"> <option value="Select the round">Select the round</option> {% for each_round in round_names %} <option value="{{each_round.round_id,each_round.round_name}}">{{each_round.round_name}}</option> {% endfor %} </select> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> <input id="generateUrl" value="generate url" style="display:none;" size="40%" readonly> <input type="button" class="btn btn-info" style="display:none;" value="Generate URL" id="urlbutton"></input> </div> <div id="resultDiv"> <textarea name="rdesc" id="rdesc" style="width:200px; height:300px; display:none;" required></textarea> <input type="hidden" id="roundId"> <input type="hidden" id="roundName"> <input type="hidden" id="roundTime"> <input type="hidden" id="expiryDate"> </div> </div> <script> $("#select1").on('change', function () { $('#err-name').empty(); $("#urlbutton").click() var dropdownValue = document.getElementById("select1"); var roundName = dropdownValue.options[dropdownValue.selectedIndex].value; $("#generateUrl").show(); $.ajax({ type: 'POST', url: '/roundname/get-description', data: { 'round_name': roundName }, success: function (roundResults) { $("#rdesc").show(); $("#rdesc").text(roundResults.round_description); $("#roundId").val(roundResults.round_id); $("#roundName").val(roundResults.round_name); $("#roundTime").val(roundResults.round_time); } }) }) </script> <input type="submit" tabindex="-1" style="position:absolute; top:-1000px"> </fieldset> </form> </div> <script> var candidateId = "{{ result.candidate_id }}"; var jobId = "{{ result.job_id }}"; $("#urlbutton").click(function () { $.ajax({ type: 'POST', url: '/candidate/url', data: { 'candidateId': candidateId, 'jobId': jobId }, success: function (data) { var url_textbox = document.getElementById("generateUrl"); url_textbox.setAttribute('value', data.url); var expiryDate = data.expiry_date; document.getElementById("expiryDate").value = expiryDate; } }) }) </script> <script> var form, dialog function sendEmail() { var isValid = true; var generatedUrl = $("#generateUrl").val(); var candidateName = document.getElementById("candidateName").value; var candidateEmail = document.getElementById("candidateEmail").value; var candidateId = document.getElementById("candidateId").value; var jobId = document.getElementById("jobId").value; var roundDescription = document.getElementById("rdesc").value; var roundId = document.getElementById("roundId").value; var roundName = document.getElementById("roundName").value; var roundTime = document.getElementById("roundTime").value; var expiryDate = document.getElementById("expiryDate").value var newDate = new Date(expiryDate) var expiryDate = $.datepicker.formatDate("dd-mm-yy", newDate) $('#err-name').empty(); if (roundDescription == '') { isValid = false; $("#select1").after('<span id="err-name" class="error" style="color:red">Please select the round</span>') } if (isValid == true) { $.ajax({ type: 'POST', url: '/candidate/' + candidateId + '/job/' + jobId + '/invite', data: { 'generatedurl': generatedUrl, 'candidatename': candidateName, 'candidateid': candidateId, 'candidateemail': candidateEmail, 'jobid': jobId, 'rounddescription': roundDescription, 'roundid': roundId, 'roundname': roundName, 'roundtime': roundTime, 'expirydate': expiryDate }, success: function (result) { if (result.error == "Success") { alert("The Invite has been sent"); document.location.href = "/candidates"; } else { alert("The invite cannot be sent"); document.location.href = "/candidates"; } } }) dialog.dialog("close"); } } dialog = $("#dialog-form").dialog({ autoOpen: false, height: 400, width: 350, modal: true, buttons: { "Send Email": sendEmail, Cancel: function () { dialog.dialog("close"); } }, close: function () { dialog.dialog("close"); } }); $("#sendEmail").button().on("click", function () { var generatedUrl = $(this).attr("data-generated-url"); $("#generatedUrl").val(generatedUrl); dialog.dialog("open"); }); </script> <script> $(document).ready(function () { $("#no-opening").on('click', function (e) { var candidateName = document.getElementById("candidateName").value; var candidateEmail = document.getElementById("candidateEmail").value; var candidateId = document.getElementById("candidateId").value; var jobId = document.getElementById("jobId").value; if($('#noopeningcheckbox').prop('checked')){ $.ajax({ type: 'POST', url: "/noopening/email", data: { 'candidatename': candidateName, 'candidateid': candidateId, 'candidateemail': candidateEmail, 'candidatejob': jobId }, success: function (result) { if (result.error == "Success") { alert("The no opening email has been sent"); document.location.href = "/candidates"; ('#noOpening').attr("disabled", true) } else { alert("The no opening email cannot be sent"); document.location.href = "/candidates"; } } }) } else { $.ajax({ type: 'POST', url: '/noopening/noemail', data: { 'candidatename': candidateName, 'candidateid': candidateId, 'candidateemail': candidateEmail, 'candidatejob': jobId }, success: function (result) { if (result.error == "Success") { alert("The candidate status has been changed to No opening"); document.location.href = "/candidates"; } else { alert("The candidate status cannot be changed"); document.location.href = "/candidates"; } } }) } $("#hideButton").attr("disabled", true); }) }) </script> <script> $(document).ready(function () { $("#remove-button").on('click', function (e) { var candidateName = document.getElementById("candidateName").value; var candidateEmail = document.getElementById("candidateEmail").value; var candidateId = document.getElementById("candidateId").value; var jobId = document.getElementById("jobId").value; if ($("#checkbox").prop("checked")) { $.ajax({ type: 'POST', url: "/reject", data: { 'candidatename': candidateName, 'candidateid': candidateId, 'candidateemail': candidateEmail, 'candidatejob': jobId }, success: function (result) { if (result.error == "Success") { alert("The reject email has been sent"); document.location.href = "/candidates"; } else { alert("The reject email cannot be sent"); document.location.href = "/candidates"; } } }) } else { $.ajax({ type: 'POST', url: '/noemail/reject', data: { 'candidatename': candidateName, 'candidateid': candidateId, 'candidateemail': candidateEmail, 'candidatejob': jobId }, success: function (result) { if (result.error == "Success") { alert("The candidate status has been changed to Reject"); document.location.href = "/candidates"; } else { alert("The candidate status cannot be changed"); document.location.href = "/candidates"; } } }) } $("#thumbsDown").attr("disabled", true); }) }) $("#close-button").on('click', function () { location.reload(); }) </script> <script> function regenerate() { var candidateId = document.getElementById("candidateId").value; var jobId = document.getElementById("jobId").value; //var roundId = document.getElementById("roundId").value; var roundId = $("#roundId").val() $.ajax({ type: 'POST', url: "/regenerate/url", data: { 'candidateid': candidateId, 'jobid': jobId, 'roundid': roundId }, success: function (result) { if (result.error == "Success") { alert("The existing URL is removed"); document.location.href = "/candidate/" + candidateId + "/job/" + jobId; ('#noOpening').attr("disabled", true) } else { alert("Cannot remove the exisitng URL"); document.location.href = "/candidate/" + candidateId + "/job/" + jobId; } } }) $("#regenerateUrl").attr("disabled", true); } </script> <script> function noresponse() { candidateId = document.getElementById("candidateId").value; var jobId = document.getElementById("jobId").value; $.ajax({ type: 'POST', url: '/candidate/noresponse', data: { 'candidateid': candidateId }, success: function (result) { alert("The candidate status has been changed"); document.location.href = "/candidate/" + candidateId + "/job/" + jobId; } }) $("#noResponse").attr("disabled", true); } </script> <script> function hirebutton() { candidateId = document.getElementById("candidateId").value; var jobId = document.getElementById("jobId").value; $.ajax({ type: 'POST', url: '/candidate/hired', data: { 'candidateid': candidateId, 'jobid': jobId }, success: function (result) { alert("The candidate status has been changed to Hired"); document.location.href = "/candidate/" + candidateId + "/job/" + jobId; } }) $("#hireButton").attr("disabled", true); } </script> <script> $(document).ready(function () { // Configure/customize these variables. var showChar = 100; // How many characters are shown by default var ellipsestext = "..."; var moretext = "Show less"; var lesstext = "Show more"; $('.more').each(function () { var content = $(this).html(); if (content.length > showChar) { var c = content.substr(0, showChar); var h = content.substr(showChar, content.length - showChar); var textFeed = c + '<span class="moreellipses"></span><span class="morecontent">' + h + '</span><span>&nbsp;&nbsp;<a href="" class="morelink">' + moretext + '</a></span>'; $(this).html(textFeed); } }); $(".morelink").click(function () { if ($(this).hasClass("less")) { $(this).removeClass("less"); $(this).html(moretext); } else { $(this).addClass("less"); $(this).html(lesstext); } $(this).parent().prev().toggle(); $(this).prev().toggle(); return false; }); }) </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/index.html
<html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <title>Interview Scheduler</title> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <link rel="stylesheet" href="https://cdn.jsdelivr.net/chartist.js/latest/chartist.min.css"> <script src="https://cdn.jsdelivr.net/chartist.js/latest/chartist.min.js"></script> <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> </head> <body> {% include "header.html" %} {% include "logout.html" %} <div class="container"> <div class="row"> <h4>We have developed this application to handle large volume of candidates during our interviews. You can refer the source code <a href="https://github.com/qxf2/interview-scheduler"> here.</a></h4> <ul> <li>Allow us to handle a large volume of candidates without having to bother about scheduling</li> <li> Make the interaction with Qxf2 different from other companies</li> <li>Reduce (almost eliminate) exchange of emails between candidate and interviewer</li></ul> Interview scheduler has three main entities: <a href="./jobs">Jobs</a>, <a href="./interviewers">Interviewers</a> and <a href="./candidates">Candidates</a> <br> <h4 style="color:blue;">Adding an interviewer</h4> <ul><li>Navigate to <a href="./interviewers">interviewers</a></li> <li>Add your details like name, email id and your available time slots</li> <li>You can give any number of time slots with breaks</li></ul> <h4 style="color: blue;">Adding a candidate</h4> <ul> <li>Navigate to <a href="./candidates">candidates</a></li> <li>Add the candidates details like name, email and job applied </li> <li>Add comments about the candidates if it's specified in their resume or in the email or if somone internally referred that candidate</li></ul> <h4 style="color:blue;">Adding a job</h4> <ul> <li>Navigate to <a href="./jobs">jobs</a></li> <li>Add the Job with interviewers</li> <li>Add the rounds for the job added</li> </ul> <h4 style="color: blue;">General instructions</h4> <ul> <li>Interviewer can further take care of rescheduling through an email</li> <li> Once the interview is done, it is interviewer's responsibility to add feedback. It will be helpful for the interviwer of the next round </li> <li>If you are the interviewer of last round ,don't send any reject/accept to the candidate. We will take care of it</li> </ul>&nbsp; </div> </div> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/edit-jobs.html
<html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <title> Edit Jobs </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <!--This is to disable liveregion of multi-select,Source is https://stackoverflow.com/questions/13011127/how-to-remove-change-jquery-ui-autocomplete-helper-text--> <style> .ui-helper-hidden-accessible { position: absolute; left: -999em; } </style> </head> <body> {% include "logout.html" %} <div class="container col-md-offset-1"> <div class="row top-space-30"> <h2>Edit the Job role and Interviewers</h2> </div> <div class="row top-space-30"> <form class="needs-validation"> <div class="form-group row"> <label class="col-md-4 col-form-label text-md-right" for="jobrole"><span style="color:red">*</span>Job role:</label> <div class="col-md-6"> <input id="role" name="jobrole" type="text" placeholder="QA" value='{{ result.role_name }}' class="form-control input-md" required> <div class="valid-feedback">Valid.</div> <div class="invalid-feedback">Please fill out this field.</div> </div> </div> <input type="hidden" id="idHidden" value="{{result.job_id}}" required> <div class="form-group row"> <label class="col-md-4 col-form-label text-md-right" for="interviewers"><span style="color:red">*</span>Interviewers:</label> <div class="col-md-8"> <input class="form-control" type="text" id="interviewers" value="{% for item in result.interviewers_name %}{{item}}{% if not loop.last %},{% endif %}{% endfor %}" required> <input type="hidden" id="TestHidden" value="{{result.interviewers_list}}" required> <div class="valid-feedback">Valid.</div> <div class="invalid-feedback">Please fill out this field.</div> </div> </div> <div class="col-md-6 offset-md-4 top-space-30"> <button class="btn btn-info" type="submit" id="submit">Edit</button> <input type='button' onclick="clearEdit()" value='Cancel' class="btn btn-danger"> </div> </form> </div> </div> <script> (function () { 'use strict'; window.addEventListener('load', function () { // Fetch all the forms we want to apply custom Bootstrap validation styles to var forms = document.getElementsByClassName('needs-validation'); // Loop over them and prevent submission var validation = Array.prototype.filter.call(forms, function (form) { form.addEventListener('submit', function (event) { event.preventDefault(); event.stopPropagation(); if (form.checkValidity() === false) { } else { var jobName = $("#role").val(); var interviewersList = $("#interviewers").val(); var jobId = document.getElementById("idHidden").value; var lastString = interviewersList.charAt(interviewersList.length - 1); var lastlistChar = isLetter(lastString) if (lastlistChar == 'true') { var interviewersList = $("#interviewers").val().split(','); } else { var interviewersList = $("#interviewers").val().split(','); interviewersList.pop(); } function isLetter(lastString) { if (lastString.length === 1 && lastString.match(/[a-z]/i)) { return 'true'; } } $.ajax({ type: 'POST', url: '/jobs/edit/%d' % jobId, data: { 'role': jobName, 'id': jobId, 'interviewerlist': JSON.stringify(interviewersList) }, success: function (result, message) { alert("The job has been edited"); document.location.href = "/jobs"; }, error: function (request, status, message) { alert(request.responseJSON.message); document.location.href = "/jobs"; } }) } }, false); }); }, false); })(); </script> <script> $(function () { var availableTags = eval(document.getElementById("TestHidden").value); function split(val) { return val.split(/,\s*/); } function extractLast(term) { return split(term).pop(); } //document.getElementById("id1").style.display="none"; $("#interviewers") // don't navigate away from the field on tab when selecting an item .on("keydown", function (event) { if (event.keyCode === $.ui.keyCode.TAB && $(this).autocomplete("instance").menu.active) { event.preventDefault(); } }) .autocomplete({ minLength: 0, source: function (request, response) { // delegate back to autocomplete, but extract the last term response($.ui.autocomplete.filter( availableTags, extractLast(request.term))); }, messages: { noResults: '', results: function () { } }, focus: function () { // prevent value inserted on focus return false; }, select: function (event, ui) { var terms = split(this.value); // remove the current input terms.pop(); // add the selected item terms.push(ui.item.value); // add placeholder to get the comma-and-space at the end const index = availableTags.indexOf(ui.item.value); if (index > -1) { availableTags.splice(index, 1); } terms.push(""); this.value = terms.join(", "); return false; } }); }); </script> <script> function clearEdit() { document.location.href = "/jobs"; } </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/email_password_reset.html
You requested that the password for your Interview scheduler account be reset. Please click the link below to reset your password: <p> <a href="{{ password_reset_url }}">{{ password_reset_url }}</a> </p> <p> --<br> Questions? Comments? Email annapoorani@qxf2.com </p>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/edit-status.html
<!DOCTYPE html> <html lang="en"> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Edit status</title> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <style> .bs-example { margin: 20px; } textarea { display: inline } </style> </head> <body> {% include "logout.html" %} <div> <h2 class="grey_text text-justify">Edit Status</h2> <form class="needs-validation"> <label class="col-md-4 control-label" for="statusname">Status name</label> <div class="col-md-4"> <input id="sname" name="sname" type="text" placeholder="Status Name" class="form-control" value="{{result.status_name}}" required> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <div class="col-md-8"> <button class="btn btn-info" type="submit">Edit</button> <button name="clear" onclick="clearEdit()" class="btn btn-danger">Cancel</button> </div> </form> <input type="hidden" id="editStatus" value="{{result.status_id}}"> </div> <script> function clearEdit() { document.location.href = "/status" } </script> <script> (function () { 'use strict'; window.addEventListener('load', function () { var forms = document.getElementsByClassName('needs-validation'); var validation = Array.prototype.filter.call(forms, function (form) { form.addEventListener('submit', function (event) { event.preventDefault(); event.stopPropagation(); $("#resultDiv").empty(); if (form.checkValidity() === true) { var statusId = document.getElementById("editStatus").value; var statusName = $("#sname").val(); $.ajax({ type: 'POST', url: '/status/' + statusId + '/edit', data: { 'statusid': statusId, 'statusname': statusName, }, success: function (result) { if (result.error == "Success") { alert("The status has been edited"); document.location.href = "/status"; } else { alert("The status already exists"); document.location.href = "/status"; } } }) } }, false); }); }, false); })(); </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/confirmation.html
<html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <title> Interview Confirmation </title> <meta http-equiv="cache-control" content="no-cache" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="-1" /> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"> <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> </head> <body style="background-color:powderblue;"> {% include "header.html" %} <div class="panel panel-default" style="max-width:1000px;max-height: 800px;margin-left:auto;margin-right:auto;"> <div class="panel-heading " style="text-align: center;">Scheduled Interview details</div> <div class="panel-body" id="resultDiv"> {% if value != "" %} <div class="panel-group"> <div class="panel panel-default"> <div class="panel-body"> <label class="col-md-8" for="Date:">Date: {{ value['date'] }}</br> Time :{{value['slot']}}</label> <label class="col-md-8" for="dateApplied"></label> </div> </div> <div class="panel panel-default"> <div class="panel-body"> <label class="col-md-8" for="Interviewer email:"> Interviewer email id:{{value['schedule_event'][3]['interviewer_email']}}</label> </div> </div> <div class="panel panel-default"> <div class="panel-body"> <label class="col-md-8" for="calendar link:">Calendar Link:</label> <label class="col-md-8" for="calendar link"><a href="{{value['schedule_event'][2]['Link']}}" target="_blank">{{value['schedule_event'][2]['Link']}}</a></label> </div> </div> <div><input type="hidden" id="reloadPage" value="no"></div> </div> {% else %} <p>Hi,The interview is not scheduled please try again and also check your internet connection. Try to schedule an interview again.If it does not work please email to us.</p> {% endif %} </div> </div> <!----<script type="text/javascript"> $(document).ready(function() { function reloadPage(){ location.reload(true); ; // RELOAD PAGE ON BUTTON CLICK EVENT. // SET AUTOMATIC PAGE RELOAD TIME TO 5000 MILISECONDS (5 SECONDS). var timerId = setInterval('refreshPage()', 5000); } }); function refreshPage() { clearInterval(timerId); location.reload(); } </script>----> <!----<script> onload = function () { var e = document.getElementById("reloadPage"); if (e.value == "no") e.value = "yes"; else { e.value = "no"; location.reload(); } } </script>-----> <!---<script> window.history.pushState({ page: 1 }, "", ""); window.onpopstate = function (event) { if (event) { window.location.href = 'https://www.google.com/'; // Code to handle back button or prevent from navigation } } </script>----> <script> $(document).ready(function ($) { if (window.history && window.history.popState) { $(window).on('pushstate', function () { var hashLocation = location.hash; var hashSplit = hashLocation.split("#!/"); var hashName = hashSplit[1]; if (hashName !== '') { var hash = window.location.hash; if (hash === '') { alert('Back button was pressed.'); window.location = 'www.example.com'; return false; } } }); window.history.popState('forward', null, './#forward'); } }); </script> {% include "footer.html" %} </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/edit-rounds.html
<!DOCTYPE html> <html lang="en"> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Edit Rounds</title> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link rel="stylesheet" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.4/css/select2.min.css" rel="stylesheet" /> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.4/js/select2.min.js"></script> <style> .bs-example { margin: 20px; } textarea { display: inline } </style> </head> <body> {% include "logout.html" %} <div> <h2 class="grey_text text-justify">Edit Rounds</h2> <form class="needs-validation"> <label class="col-md-4 control-label" for="rname"><span style="color:red">*</span>Round name</label> <div class="col-md-4"> {% for each_details in result %} <input id="rname" maxlength="20" name="rname" type="text" placeholder="John" class="form-control" value="{{each_details.round_name}}" required> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <input type="hidden" value="{{each_details.round_id}}" id="roundId"> <input type="hidden" value="{{job_id}}" id="jobId"> <input type="hidden" value="{{interviewers_name_list|join(',')}}" id="interviewersList"> <label class="col-md-4 control-label" for="rtime"><span style="color:red">*</span>Round duration</label> <div class="col-md-4"> <select name="Duration" id="rtime" style="width:380px; height:30px;" required> <option value="{{each_details.round_time}}">{{each_details.round_time}}</option> <option value="30 minutes">30 minutes</option> <option value="45 minutes">45 minutes</option> <option value="60 minutes">60 minutes</option> </select> <div class=" col-md-8 row top-space-30" id="resultDiv"> </div> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <label class="col-md-4 control-label" for="rdescription"><span style="color:red">*</span>Round description</label> <div class="col-md-4"> <textarea name="rdesc" maxlength="500" id="rdesc" style="width:380px; height:300px;" required>{{each_details.round_description}}</textarea> <div class=" col-md-8 row top-space-30" id="resultDiv"> </div> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <label class="col-md-4 control-label" for="rrequirements"><span style="color:red">*</span>Round requirements</label> <div class="col-md-4"> <input id="rreq" name="rreq" type="text" value="{{each_details.round_requirement}}" placeholder="Laptop" class="form-control" required> <div class=" col-md-8 row top-space-30" id="resultDiv"> </div> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <label class="col-md-4 control-label" for="addinterviewers"><span style="color:red">*</span>Edit Interviewers</label> <div class="col-md-4"> <select id="multiSelect" class="js-select2" multiple="multiple" > {% for each_interviewer in interviewers_name_list %} <option value="{{each_interviewer.interviewer_id}}" selected="selected" data-badge=""> {{each_interviewer.interviewer_name}}</option> {% endfor %} {% for each_interviewer in interviewers_list %} <option value="{{each_interviewer.interviewer_id}}" data-badge=""> {{each_interviewer.interviewer_name}}</option> {% endfor %} </select> </div> {% endfor %} <label class="col-md-4 control-label" for="save"></label> <div class="col-md-8"> <button class="btn btn-info" type="submit">Edit</button> <button type="button" name="clear" onclick="clearEdit()" class="btn btn-danger">Cancel</button> </div> </form> </div> <script> function clearEdit() { document.location.href = "/jobs" } </script> <script> (function () { 'use strict'; window.addEventListener('load', function () { var forms = document.getElementsByClassName('needs-validation'); var validation = Array.prototype.filter.call(forms, function (form) { form.addEventListener('submit', function (event) { event.preventDefault(); event.stopPropagation(); $("#resultDiv").empty(); if (form.checkValidity() === true) { var roundName = $("#rname").val(); var roundTime = $("#rtime").val(); var roundDescription = $("#rdesc").val(); var roundRequirements = $("#rreq").val(); var roundId = document.getElementById("roundId").value; var jobId = document.getElementById("jobId").value; var editedInterviewers = $("#multiSelect").val(); $.ajax({ type: 'POST', url: '/rounds/' + roundId + '/jobs/' + jobId + '/edit', data: { 'roundName': roundName, 'roundTime': roundTime, 'roundDescription': roundDescription, 'roundRequirements': roundRequirements, 'roundId': roundId, 'editedinterviewers':editedInterviewers, }, success: function (result) { alert("The round has been edited"); document.location.href = "/job/" + jobId + "/rounds"; }, }) } }, false); }); }, false); })(); </script> <script> var uploadValue = document.getElementById("interviewersList").value; $(".js-select2").select2({ closeOnSelect : false, allowHtml: true, allowClear: true, tags: false, placeholder:{ text:"Edit interviewer", } }); $(".select2-search_field").val(uploadValue); </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/role-for-interviewers.html
<html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <title> List of interviewer details </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!--Stylesheets--> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"> <link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" /> <!--JS files--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> </head> <body> {% include "logout.html" %} <input type="hidden" value="{{jobid}}" id="jobId"> <h3 class="grey_text text-center">Interviewers list for the Job role</h3> <div class="container col-md-offset-1"> <table class="table table-striped"> <thead> <tr> <th scope="col">Interviewers Name</th> </tr> </thead> <tbody> {% for each_job in result %} <tr> <td>{{ each_job.interviewers_name }}</td> </tr> {% endfor %} </tbody> </table> </div><br /><br /> <h3 class="grey_text text-center">Candidates list for the Job role</h3> <div class="container col-md-offset-1"> <table class="table table-striped"> <thead> <tr> <th scope="col">Candidates Name</th> <th>Candidate email</th> <th>Candidate status</th> </tr> </thead> <tbody> {% for each_candidate in candidates %} <tr> <td><a href="/candidate/{{each_candidate.candidate_id}}/job/{{each_candidate.job_id}}">{{ each_candidate.candidate_name }}</a> </td> <td>{{ each_candidate.candidate_email }}</td> <td>{{ each_candidate.candidate_status }}</td> </tr> {% endfor %} </tbody> </table> </div><br></br> <h3 class="grey_text text-center">Round details</h3> <div class="container col-md-offset-1"> <table class="table table-striped"> <thead> <tr> <th scope="col">Round Name</th> <th scope="col">Time Duration</th> <th scope="col">Description</th> <th scope="col">Requirements</th> </tr> </thead> <tbody> {% for each_round in round %} <input type="hidden" value="{{each_round.job_status}}" id="jobStatus"> <tr> <td>{{ each_round.round_name}}</td> <td>{{ each_round.round_time }}</td> <td>{{ each_round.round_description }}</td> <td>{{ each_round.round_requirement }}</td> </tr> {% endfor %} </tbody> </table> {% for each_round in round %} {% for key, value in each_round.items() %} {% if value == 'Open' %} <button class="btn btn-danger" onclick="changeStatus()" id="jobButton">Close job</button> {% elif value == 'Close' %} <button class="btn btn-danger" onclick="changeStatus()" id="jobButton">Open job</button> {% endif %} {% endfor %} {% endfor %} </div> <script> function changeStatus() { var jobid = document.getElementById("jobId").value; $.ajax({ type: 'POST', url: '/job/status', data: { 'jobid': jobid }, success: function (result) { alert("The Job status is changed and it's status is " + result.job_status + " now"); } }) window.location.reload(); } </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/rounds.html
<html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <title> List of rounds </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Add,Edit,Delete rounds</title> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"> <link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> </head> <body> {% include "logout.html" %} <div id="dialog-confirm" title="Delete round?"> <p><span class="ui-icon ui-icon-alert" style="float:left; margin:12px 12px 20px 0;"></span>These round will be permanently deleted and cannot be recovered. Are you sure?</p> </div> <div class="container col-md-offset-1"> <h2 class="grey_text text-center">Rounds List</h2> <input class="btn btn-info" type="button" onclick="addRound(this)" value="Add Rounds" data-job-id="{{job_id}}"> <div class="row-fluid top-space-20"> {% if result | length == 0 %} <div> <p>There are no round details ,If you want you can add it </p> </div> {% else %} <table class="table table-striped"> <thead> <th>Round name</th> <th>Round duration</th> <th>Round Description</th> <th>Round requirements</th> <th>Round interviewers</th> <th>Actions</th> </thead> {% for each_item in result %} <tbody> <td>{{each_item.round_name}}</td> <td>{{each_item.round_time}}</td> <td>{{each_item.round_description}}</td> <td>{{each_item.round_requirement}}</td> <td>{% for each_interviewers in each_item.round_interviewers %}{{each_interviewers.interviewer_name}}<br>{% endfor %}</td> <td> <input class="btn btn-info" id="editround{{each_item.round_id}}" onclick="editRound(this)" type="button" value="Edit" data-round-id="{{each_item.round_id}}" data-round-name="{{each_item.round_name}}" data-round-description="{{each_item.round_description}}" data-round-requirement="{{each_item.round_requirement}}" data-round-duration="{{each_item.round_time}}" data-job-id="{{job_id}}"> <input type="button" class="btn btn-info" onclick="delete_round(this)" value="Delete" id="delete-button{{each_item.round_id}}" data-delete-round-id="{{each_item.round_id}}" data-delete-job-id="{{job_id}}" /> </td> </tbody> {% endfor %} {% endif %} </table> </div> </div> <script> //Confirmation message for deleteing round var round_id; var job_id; var dialog = $("#dialog-confirm").dialog({ resizable: false, height: "auto", autoOpen: false, width: 400, modal: true, buttons: { "Delete": function () { $.ajax({ type: 'GET', url: '/rounds/' + round_id + '/jobs/' + job_id + '/delete', data: { 'round_id': round_id, 'job_id': job_id }, success: function (data) { window.location.reload(); } }) $(this).dialog("close"); }, Cancel: function () { $(this).dialog("close"); } } }); function delete_round(action_delete) { round_id = action_delete.getAttribute("data-delete-round-id"); job_id = action_delete.getAttribute("data-delete-job-id"); dialog.dialog("open"); } </script> <script> function editRound(actionEdit) { round_id = actionEdit.getAttribute("data-round-id"); jobId = actionEdit.getAttribute("data-job-id"); document.location.href = "/rounds/" + round_id + '/jobs/' + jobId + '/edit'; } </script> <script> function addRound(actionAdd) { jobId = actionAdd.getAttribute("data-job-id"); document.location.href = "/jobs/" + jobId + "/round/add"; } </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/reset-password.html
<html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Interview Scheduler-Reset Password</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css" /> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> </head> <body> <div> <section class="hero is-primary is-fullheight"> <div class="hero-head"> <nav class="navbar"> <div class="container"> </div> </nav> </div> <div class="hero-body"> <div class="container has-text-centered"> <div class="column is-4 is-offset-4"> <h3 class="title">Reset Password</h3> <div class="box"> <form> <div class="field"> <div class="control"> <input class="input is-large" id="email" type="text" name="email" placeholder="Your email:email@xyz.com" autofocus=""> </div> </div> <input type="button" class="btn btn-info" id="resetButton" onclick="submitButton()" value="Submit"> <input type="button" class="btn btn-info" id="cancelButton" onclick="cancelClick()" value="Cancel"> </form> </div> </div> </div> </div> <script> function submitButton() { emailId = document.getElementById("email").value $.ajax({ type: 'POST', url: '/reset-password', data: { emailid: emailId }, success: function (result) { if (result.error == "Success") { alert("The password reset email has been sent to your confirmed email address") document.location.href = "/login"; } else { alert("The email is not confirmed Please confirm before reset the password") document.location.href = "/login"; } } }) } </script> <script> function cancelClick() { window.location.reload(); } </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/login.html
<!DOCTYPE html> <html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Interview Scheduler-Login/Signup</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css" /> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <title>Signin</title> </head> <body> <center> <div class="logo"> <img src="{{ url_for('static', filename='img/qxf2_logo.png') }}" alt="logo" /> </div> <h1><B>Qxf2 Interview Scheduler App</B></h1> <h5>Sign in to continue</h5> <h3><B><a href="/login" class="btn btn-success" >Sign in</a></B></h3> </center> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/read-candidates.html
<html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <title> List of candidate details </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!--Stylesheets--> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"> <link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" /> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.21/css/jquery.dataTables.css"> <!--JS files--> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.js"></script> </head> <body> {% include "logout.html" %} {% include "menu-bar.html" %} <div class="modal modal-megamenu" id="myModal"> <div class="modal-dialog modal-megamenu"> <div class="modal-content modal-megamenu"> <div class="modal-header modal-megamenu"> <h4 class="modal-title" id="myModalLabel">Confirmation</h4> </div> <div class="modal-body modal-megamenu"> <p>Success:</p> </div> <div class="modal-footer modal-megamenu"> <button type="button" id="close-button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> <div class="container col-md-offset-1 list"> <h3 class="grey_text text-center">Candidates Details</h2> <div> <input class="btn btn-success" type="button" id="add" onclick="addCandidate()" value="Add"> </div> <input type="hidden" value="each_candidate.candidate_id"> <div class="row-fluid top-space-20"> <table id="table" style="table-layout: width: 800%" class="table table-striped"> <thead> <tr> <th>ID</th> <th>Name</th> <th>Email</th> <th>Job</th> <th>Status</th> <th>Actions</th> <th>Date Modified</th> </tr> </thead> <tbody> {% for each_candidate in result %} <tr> <td>{{ each_candidate.candidate_id }}</td> <!-- change href--> <td><a href="/candidate/{{each_candidate.candidate_id}}/job/{{ each_candidate.job_id}}">{{ each_candidate.candidate_name }}</a> </td> <td>{{ each_candidate.candidate_email }}</td> <!--change each_candidate.job_applied--> <td>{{ each_candidate.job_role }}</td> <td>{{ each_candidate.candidate_status }}</td> <td><button class="link-button" type="button" id="edit" onclick="editCandidates({{each_candidate.candidate_id}})">Edit</button>&nbsp;&nbsp; <button class="link-button" style="color:rgba(255, 0, 0, 0.589);" type="button" data-target="#confirmdeletemodal" data-candidatename="{{ each_candidate.candidate_name }}" data-candidateid="{{ each_candidate.candidate_id }}" data-jobid="{{ each_candidate.job_id }}" data-toggle="modal">Delete</button> </td> <td>{{each_candidate.last_updated_date}}</td> </tr> {% endfor %} </tbody> </table> </div> <div class="modal modal-megamenu" id="confirmdeletemodal"> <div class="modal-dialog modal-megamenu"> <div class="modal-content modal-megamenu"> <div class="modal-header modal-megamenu"> <h4 class="modal-title">Remove candidate?</h4> </div> <div class="modal-body modal-megamenu"> <input type="text" class="form-control" id="recipient-name"> </div> <div class="modal-footer modal-megamenu"> <button class="btn btn-default" data-dismiss="modal" type="button">Cancel</button> <button class="btn btn-danger" id="remove-button" data-dismiss="modal" data-backdrop="false" type="submit">Remove</button> </div> </div><!-- end modal-content --> </div><!-- end modal-dialog --> </div> </div> </div> <script> // Remove button event trigger $('#confirmdeletemodal').on('shown.bs.modal', function (e) { var triggeringElement = $(e.relatedTarget); $(this).find('#remove-button').attr('href', $(e.relatedTarget).data('href')); var modal = $(this) var candidateId = $(e.relatedTarget).data('candidateid'); modal.find('.modal-body').text('Are you sure you wish to delete this ' + triggeringElement.data("candidatename") + ' candidate? ') $("#remove-button").on('click', function () { var jobid = triggeringElement.data('href'); $.ajax({ type: 'POST', url: '/candidate/' + candidateId + '/delete', data: { 'candidateId': $(e.relatedTarget).data('candidateid'), 'jobId': $(e.relatedTarget).data('jobid') }, success: function (data) { var msg = "The deleted candidate is " + data.candidate_name; $('#myModal').modal('show'); $('#myModal .modal-body p').html(msg); } }) }) $("#close-button").on('click', function () { location.reload(); }) }) </script> <script> function addCandidate() { document.location.href = '/candidate/add' } </script> <script> function editCandidates(candidate_id) { document.location.href = '/candidate/' + candidate_id + '/edit'; } </script> <script> $(document).ready(function () { $('#table').DataTable({ "order": [[0, "desc"]], "columnDefs": [ { "visible": false, "targets": 2 }, { "targets": [1, 2, 3, 4, 5], "orderable": false, }], initComplete: function (d) { this.api().columns([3, 4]).every(function () { var column = this; var Jobs = $("#table th").eq([d]).text(); var select = $('<select class="drop-down"><option value="" style="display:none;"></option></select>') .appendTo($(column.header())) .on('change', function () { var val = $.fn.dataTable.util.escapeRegex( $(this).val() ); column .search(val ? '^' + val + '$' : '', true, false) .draw(); }); column.data().unique().sort().each(function (d, j) { select.append('<option value="' + d + '">' + d + '</option>') }); }); } }); }); </script> <script> $("#statusFilter").on('change', function () { var dropdownvalue = document.getElementById("statusFilter") var selectStatus = dropdownvalue.options[dropdownvalue.selectedIndex].value $.ajax({ type: 'POST', url: '/candidatestatus/filter', data: { 'selectedstatus': selectStatus }, success: function (result) { if (result == 'error') { alert("There are no candidates with the filtered status value") document.location.href = "/candidates"; } else { document.write(result); } } }) $(".list").empty(); }) </script> <script> $("#jobFilter").on('change', function () { var dropdownvalue = document.getElementById("jobFilter") var selectJob = dropdownvalue.options[dropdownvalue.selectedIndex].value $.ajax({ type: 'POST', url: '/filter/job', data: { 'selectjob': selectJob }, success: function (result) { if (result == 'error') { alert("There are no candidates with the filtered job value") document.location.href = "/candidates"; } else { document.write(result); } } }) $(".list").empty(); }) </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/unauthorized.html
<html> <head> <title>Unauthorized</title> </head> <body> <h2>You are unauthorized to view this page</h2> <h3>Try with Qxf2 here : <a href="/" >Try again</a></h3> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/list-jobs.html
<html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <title> List of Jobs </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!--Stylesheets--> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"> <link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" /> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.21/css/jquery.dataTables.css"> <!--JS files--> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.js"></script> </head> <body> <div class="row"> {% include "logout.html" %} {% include "menu-bar.html" %} </div> <div class="modal modal-megamenu" id="myModal"> <div class="modal-dialog modal-megamenu"> <div class="modal-content modal-megamenu"> <div class="modal-header modal-megamenu"> <h4 class="modal-title" id="myModalLabel">Confirmation</h4> </div> <div class="modal-body modal-megamenu"> <p>Success:</p> </div> <div class="modal-footer modal-megamenu"> <button type="button" class="btn btn-default" onclick="closeButton()" data-dismiss="modal">Close</button> </div> </div> </div> </div> <div class="container col-md-offset-1"> <h3 class="grey_text text-center">Jobs Details</h2> <div> <input class="btn btn-success" type="button" id="add" onclick="addJob()" value="Add"> </div> <div class="row-fluid top-space-20"> <table id="table" class="table table-striped"> <thead> <tr> <th>ID</th> <th>Job role</th> <th>Job status</th> <th>Actions</th> </tr> </thead> <tbody> {% for each_job in result %} <tr> <td>{{ each_job.job_id }}</td> {% if each_job.job_status == 'Delete'%} <td><s><a id="deleteId" class="not-active" href="details/job/{{ each_job.job_id }}">{{ each_job.job_role }}</a></s> </td> {% else %} <td><a id="deleteId" class="href-link" href="details/job/{{ each_job.job_id }}">{{ each_job.job_role }}</a> </td> {% endif %} <td>{{ each_job.job_status }}</td> {% if each_job.job_status == 'Delete'%} <td><button class="not-active link-button" type="button" id="addCandidate" onclick="addCandidate('{{each_job.job_role}}')">Add Candidate</button> &nbsp;&nbsp; <button class="not-active link-button" type="button" onclick="editJob('{{each_job.job_id}}')" id="edit">Edit</button> &nbsp;&nbsp; <button type="button" class="not-active link-button" data-target="#confirmdeletemodal" data-jobrole="{{ each_job.job_role }}" data-href="{{ each_job.job_id }}" data-toggle="modal">Delete</button> &nbsp;&nbsp; <button class="not-active link-button" type="button" onclick="addRounds('{{ each_job.job_id }}')">Rounds</button> </td> {% else %} <td> <button class="link-button" style="color:sienna" type="button" id="addCandidate" onclick="addCandidate('{{each_job.job_role}}')">Add Candidate</button> &nbsp;&nbsp; <button class="link-button" type="button" onclick="editJob('{{each_job.job_id}}')" id="edit">Edit</button> &nbsp;&nbsp; <button type="button" style="color:rgba(255, 0, 0, 0.589);" class="link-button" data-target="#confirmdeletemodal" data-jobrole="{{ each_job.job_role }}" data-href="{{ each_job.job_id }}" data-toggle="modal">Delete</button> &nbsp;&nbsp; <button class="link-button" type="button" onclick="addRounds('{{ each_job.job_id }}')">Rounds</button> </td> {% endif %} </tr> {% endfor %} </tbody> </table> <div class="modal modal-megamenu" id="confirmdeletemodal"> <div class="modal-dialog modal-megamenu"> <div class="modal-content modal-megamenu"> <div class="modal-header modal-megamenu"> <h4 class="modal-title">Remove Job?</h4> </div> <div class="modal-body modal-megamenu"> <input type="text" class="form-control" id="recipient-name"> </div> <div class="modal-footer modal-megamenu"> <button class="btn btn-default" data-dismiss="modal" type="button">Cancel</button> <button class="btn btn-danger" id="remove-button" data-dismiss="modal" data-backdrop="false" type="submit">Remove</button> </div> </div><!-- end modal-content --> </div><!-- end modal-dialog --> </div> </div> </div> <script> // Remove button event trigger $('#confirmdeletemodal').on('shown.bs.modal', function (e) { var triggeringElement = $(e.relatedTarget); $(this).find('#remove-button').attr('href', $(e.relatedTarget).data('href')); var modal = $(this) modal.find('.modal-body').text('Are you sure you wish to delete this ' + triggeringElement.data("jobrole") + ' job? ') $("#remove-button").on('click', function () { var jobid = triggeringElement.data('href'); $.ajax({ type: 'POST', url: '/jobs/delete', data: { 'job-id': $(e.relatedTarget).data('href') }, success: function (data) { console.log("Inside"); $("#deleteId").addClass('not-active').removeAttr("href"); $('#deleteId').attr('disabled', 'disabled'); var msg = "The role deleted is " + data.job_role; $('#myModal').modal('show'); $('#myModal .modal-body p').html(msg); console.log("outside"); } }) }) }) </script> <script> function addJob() { document.location.href = '/jobs/add' } </script> <script> function editJob(jobId) { document.location.href = '/job/' + jobId + "/edit"; } function addCandidate(jobRole) { document.location.href = "/candidate/" + jobRole + "/add"; } </script> <script> function addRounds(jobId) { document.location.href = "/job/" + jobId + "/rounds"; } </script> <script> function closeButton() { window.location.reload(); } </script> <script> $(document).ready(function () { $('#table').DataTable({ "columnDefs": [ { width: 20, targets: 0 }, { "targets": [1, 2, 3], "orderable": false, }], }); }) </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/messages.html
<!doctype html> <title>My Application</title> {% with messages = get_flashed_messages() %} {% if messages %} <ul class=flashes> {% for message in messages %} <li>{{ message }}</li> {% endfor %} </ul> {% endif %} {% endwith %} {% block body %}{% endblock %}
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/expiry.html
<html> <head> <title> Link expiration </title> </head> <body> <p>The link is expired or the operation you have performed is not allowed. Please contact Qxf2 when you encounter an issue.Thank you for your cooperation</p> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/send_invite.html
<p>Hello {{candidate_name}},</p> <p>Thank you for choosing to interview with Qxf2 Services. You have been selected for the <strong>{{round_name}}</strong> of our interview. Read the below round description carefully.<br><p><strong>{{round_details}}.</strong></p> <br> Please self-schedule your interview with us by visiting this <a href={{link}}>link</a> <br><br>The link above will have the details about what to expect in this round. Choose a convenient date for your interview to see a list all the time slots we have available for your interview. Select a time slot that suits you and your interview with us will be scheduled automatically. Once you schedule your interview, you will receive a calendar invite confirming the interview.<br><br> Please use this unique code <b>{{unique_code}}</b> and your email to schedule an interview. This link will expire on <b>{{expiry_date}}.</b><br><br>The interview will be recorded and viewed by multiple decision makers within Qxf2</p> <p>Thanks,</p> <p>Qxf2 Services</p>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/list-interviewers.html
<html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <title> List of interviewer details </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!--Stylesheets--> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"> <link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" /> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.21/css/jquery.dataTables.css"> <!--JS files--> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.js"></script> </head> <body> {% include "logout.html" %} {% include "menu-bar.html" %} <div class="modal modal-megamenu" id="myModal"> <div class="modal-dialog modal-megamenu"> <div class="modal-content modal-megamenu"> <div class="modal-header modal-megamenu"> <h4 class="modal-title" id="myModalLabel">Confirmation</h4> </div> <div class="modal-body modal-megamenu"> <p>Success:</p> </div> <div class="modal-footer modal-megamenu"> <button type="button" class="btn btn-default" data-dismiss="modal" id="close-button">Close</button> </div> </div> </div> </div> <div class="container col-md-offset-1"> <h3 class="grey_text text-center">Interviewers Details</h2> <div> <input class="btn btn-success" type="button" id="add" onclick="addinterviewer()" value="Add"> </div> <br /> <table id="table" class="table table-striped" width="90%"> <thead> <tr> <th>ID</th> <th>Interviewer Name</th> <th>Actions</th> </tr> </thead> <tbody> {% for each_interviewer in result %} <tr> <td>{{ each_interviewer.interviewer_id }}</td> <td><a class="href-link" href="/interviewer/{{ each_interviewer.interviewer_id }}">{{ each_interviewer.interviewer_name }}</a> </td> <td><button class="link-button" type="button" id="edit" onclick="editinterviewer({{ each_interviewer.interviewer_id }})">Edit</button>&nbsp;&nbsp; <button type="button" style="color:rgba(255, 0, 0, 0.589);" class="link-button" data-target="#confirmdeletemodal" data-username="{{ each_interviewer.interviewers_name }}" data-href="{{ each_interviewer.interviewer_id }}" data-toggle="modal">Delete</button> </td> </tr> {% endfor %} </tbody> </table> <script> function addinterviewer() { document.location.href = '/interviewers/add' } </script> <div class="modal modal-megamenu" id="confirmdeletemodal"> <div class="modal-dialog modal-megamenu"> <div class="modal-content modal-megamenu"> <div class="modal-header modal-megamenu"> <h4 class="modal-title">Remove Interviewer?</h4> </div> <div class="modal-body modal-megamenu"> <input type="text" class="form-control" id="recipient-name"> </div> <div class="modal-footer modal-megamenu"> <button class="btn btn-default" data-dismiss="modal" type="button">Cancel</button> <button class="btn btn-danger" id="remove-button" data-dismiss="modal" data-backdrop="false" type="submit">Remove</button> </div> </div><!-- end modal-content --> </div><!-- end modal-dialog --> </div> </div> </div> <script> // Remove button event trigger $('#confirmdeletemodal').on('shown.bs.modal', function (e) { var triggeringElement = $(e.relatedTarget); $(this).find('#remove-button').attr('href', $(e.relatedTarget).data('href')); var modal = $(this) modal.find('.modal-body').text('Are you sure you wish to delete this user from the list? ') $("#remove-button").on('click', function () { $.ajax({ type: 'POST', url: '/interviewer/' + $(e.relatedTarget).data('href') + '/delete', data: { 'interviewer-id': $(e.relatedTarget).data('href') }, success: function (data) { var msg = "The user deleted is " + data.interviewer_name; $('#myModal').modal('show'); $('#myModal .modal-body p').html(msg); } }) }) $("#close-button").on('click', function () { window.location.reload(); }) }) </script> <script> function editinterviewer(interviewer_id) { document.location.href = "/interviewer/" + interviewer_id + "/edit"; } </script> <script> $(document).ready(function () { $('#table').DataTable({ "columnDefs": [ { width: 20, targets: 0 }, { width: 100, targets: 1 }, { width: 140, targets: 2 }, { "targets": [1, 2], "orderable": false, }], }); }) </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/read-status.html
<html> <head> <title> List of Status </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!--Stylesheets--> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"> <link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" /> <!--JS files--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> </head> <body> {% include "logout.html" %} <div class="modal modal-megamenu" id="myModal"> <div class="modal-dialog modal-megamenu"> <div class="modal-content modal-megamenu"> <div class="modal-header modal-megamenu"> <h4 class="modal-title" id="myModalLabel">Confirmation</h4> </div> <div class="modal-body modal-megamenu"> <p>Success:</p> </div> <div class="modal-footer modal-megamenu"> <button type="button" id="close-button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> <div class="container col-md-offset-1"> <h2 class="grey_text text-center">Status List</h2> <div> <input class="btn btn-info" type="button" id="add" onclick="addStatus()" value="Add"> </div> <div class="row-fluid top-space-20"> {% if result | length == 0 %} <div> <p>There are no status details ,If you want you can add it </p> </div> {% else %} <table class="table table-striped"> <thead> <tr> <th>Status ID</th> <th>Status Name</th> <th>Actions</th> </tr> </thead> <tbody> {% for each_status in result %} <tr> <td>{{each_status.status_id}}</td> <td>{{each_status.status_name}}</td> <td> <input class="btn btn-info" type="button" id="edit" onclick="editStatus({{each_status.status_id}})" value="Edit"> <button type="button" class="btn btn-info" data-target="#confirmdeletemodal" data-statusname="{{ each_status.status_name }}" data-statusid="{{ each_status.status_id }}" data-toggle="modal">Delete</button> </td> </tr> {% endfor %} {% endif %} </tbody> </table> <div class="modal modal-megamenu" id="confirmdeletemodal"> <div class="modal-dialog modal-megamenu"> <div class="modal-content modal-megamenu"> <div class="modal-header modal-megamenu"> <h4 class="modal-title">Remove status?</h4> </div> <div class="modal-body modal-megamenu"> <input type="text" class="form-control" id="recipient-name"> </div> <div class="modal-footer modal-megamenu"> <button class="btn btn-default" data-dismiss="modal" type="button">Cancel</button> <button class="btn btn-danger" id="remove-button" data-dismiss="modal" data-backdrop="false" type="submit">Remove</button> </div> </div><!-- end modal-content --> </div><!-- end modal-dialog --> </div> </div> </div> <script> // Remove button event trigger $('#confirmdeletemodal').on('shown.bs.modal', function (e) { var triggeringElement = $(e.relatedTarget); $(this).find('#remove-button').attr('href', $(e.relatedTarget).data('href')); var modal = $(this) var statusId = $(e.relatedTarget).data('statusid'); modal.find('.modal-body').text('Are you sure you wish to delete this ' + triggeringElement.data("statusname") + ' status? ') $("#remove-button").on('click', function () { var jobid = triggeringElement.data('href'); $.ajax({ type: 'POST', url: '/status/' + statusId + '/delete', data: { 'statusid': $(e.relatedTarget).data('statusid'), 'statusname': $(e.relatedTarget).data('statusname') }, success: function (data) { var msg = "The deleted status is " + data.status_name; $('#myModal').modal('show'); $('#myModal .modal-body p').html(msg); } }) }) $("#close-button").on('click', function () { location.reload(); }) }) </script> <script> function addStatus(){ document.location.href = '/status/add' } </script> <script> function editStatus(statusId){ document.location.href = '/status/'+statusId+'/edit' } </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/welcome.html
<!DOCTYPE html> <html lang="en"> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <title> Welcome </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <link href="https://fonts.googleapis.com/css?family=Abel|Open+Sans:400,600" rel="stylesheet"> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <style> p { word-break: break-word; } </style> </head> <body style="background-color:powderblue;"> {% include "header.html" %} <div class="container"> <div class="bs-example"> {% if 'job_id' in result %} <div class="panel panel-default" style="max-width:800px;margin-left:auto;margin-right:auto;"> <div class="panel-heading " style="text-align: center;"></div> <div class="panel-body"> <p>Thank you for applying with us. To schedule an interview please fill the below details </p> <form action="/{{ result.job_id }}/{{result.url}}/{{result.candidate_id}}/valid" method="POST"> <div class="form-group"> <div class="row"> <label class="col-md-4 control-label"><span style="color:red">*</span>Enter your unique code</label> <div class="col-md-7"> <input id="candidate-name" name="candidate-name" type="text" placeholder="xxxxx" class="input-md" required> </div> </div> </div> <div class="form-group"> <div class="row"> <label class="col-md-4 control-label"><span style="color:red">*</span>Enter your email</label> <div class="col-md-7"> <input id="candidate-email" name="candidate-email" type="email" placeholder="johndoe@example.com" class="input-md" required> </div> </div> </div> <div class="form-group"> <label class="col-md-4 control-label" for="save"></label> <div class="col-md-8"> <input class="btn btn-success show-modal" type='submit' id='submit' value='Go for schedule'> </div> </div> </div> </div> </form> </div> </div> {% else %} <div class="panel panel-default" style="max-width:1200px;max-height: 650px;margin-left:auto;margin-right:auto;top:50px"> <div class="panel-heading " style="text-align: center;">Scheduled Interview details</div> <div class="panel-body" id="resultDiv"> <div class="panel-group"> <div class="panel panel-default"> <div class="panel-body"> <label class="col-md-8" for="intervieweremail:">Interviewer Email: {{interview_result.interviewer_email}}</label> </div> </div> <div class="panel panel-default"> <div class="panel-body"> <label class="col-md-8" for="interviewerstarttime:"> Interview date & time: {{interview_result.interview_date}}<br></br> Interview start time: {{interview_result.interview_start_time}}<br><br> Interview end time: {{interview_result.interview_end_time}}</label> </div> </div> <div class="panel panel-default"> <div class="panel-body"> <label class="col-md-8" for="roundduration:">Round Duration: {{interview_result.round_time}}</label> </div> </div> <div class="panel panel-default"> <div class="panel-body"> <label class="col-md-12" for="rounddescription:">Round Description:<p> {{ interview_result.round_description}}</p></label> </div> </div> </div> {% endif %} </div> </div> <script> $("#submit").click(function () { var validValue = true; var candidate_name = $("#candidate-name").val(); var candidate_email = $("#candidate-email").val(); validValue &= candidate_name != ""; validValue &= candidate_email != ""; //var email_valid = (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/).test(candidate_email); var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; var email_valid = re.test(candidate_email) validValue &= email_valid; //Printing appropriate message $('#err-name').remove(); $('#err-email').remove(); if (candidate_name == "") { $('#candidate-name').after('<span id="err-name" class="error" style="color:red">Unique code can\'t be empty</span>'); } if (candidate_email == "") { $('#candidate-email').after('<span id="err-email" class="error" style="color:red">Email can\'t be empty</span>'); } if (email_valid == false && candidate_email != "") { $('#candidate-email').after('<span id="err-email" class="error" style="color:red">Enter a valid email</span>'); } var jobId = "{{ result.job_id }}"; var candidateId = "{{ result.candidate_id }}" var url = "{{ result.url }}" //validValue = true; //Valdidation for name and email field if (validValue == true) { $.ajax({ type: 'POST', url: "/" + jobId + "/" + url + "/" + candidateId + "/valid", data: { 'unique-code': candidate_name, 'candidate-email': candidate_email }, success: function (result) { //if (result.responseJSON.error.error == "NameError") if (result.error['error'] == "EmailError") { alert("Email or Code not found, please enter the same email or name that you used when applied for this role"); window.location.href = "/" + result.result['candidate_id'] + "/" + result.result['job_id'] + "/" + result.result['url'] + "/welcome"; } if (result.error['error'] == "CodeError") { alert("Email or Code not found, please enter the same email or name that you used when applied for this role"); window.location.href = "/" + result.result['candidate_id'] + "/" + result.result['job_id'] + "/" + result.result['url'] + "/welcome"; } if (result.error['error'] == "OtherError") { alert("Email or Code not found, Please check your unique URL you have entered is correct"); //window.location.href = "/" + result.result['candidate_id'] + "/" + result.result['job_id'] + "/" + result.result['url'] + "/welcome"; } if (result.error['error'] == "Success") { window.location.href = "/" + result.result['job_id'] + "/get-schedule"; } } } ) } return false; }) </script> {% include "footer.html" %} </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/edit-candidate.html
<!DOCTYPE html> <html lang="en"> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Add Candidates</title> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <style> .bs-example { margin: 20px; } textarea { display: inline } </style> </head> <body> {% include "logout.html" %} <div> <h2 class="grey_text text-justify">Edit Candidates</h2> <form class="needs-validation"> <label class="col-md-4 control-label" for="fname"><span style="color:red">*</span>Name of the candidate</label> <div class="col-md-4"> <input id="fname" name="fname" type="text" placeholder="John" class="form-control" value="{{result.candidate_name}}" required> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <input type="hidden" value="{{result.candidate_id}}" id="candidateId"> <label class="col-md-4 control-label" for="email"><span style="color:red">*</span>Email</label> <div class="col-md-4"> <input id="email" name="email" type="Email" value="{{result.candidate_email}}" placeholder="johndoe@example.com" class="form-control" required> <div class=" col-md-8 row top-space-30" id="resultDiv"> </div> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <input type="hidden" id="oldJob" value="{{result.job_role}}"> <label class="col-md-4 control-label" for="select1"><span style="color:red">*</span>Job applied for</label> <div class="col-md-4"> <select class="form-control" id="select1" required> <option value="{{result.job_role}}">{{result.job_role}}</option> {% for each_job in result.job_roles %} <option value="{{each_job}}">{{each_job}}</option> {% endfor %} </select> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <label class="col-md-4 control-label" for="comments"><span style="color:red">*</span>Add your comments</label> <div class="col-md-4"> <textarea id="comments" name="comments" rows="10" col="20" class="form-control" required>{{result.added_comments}}</textarea> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <label class="col-md-4 control-label" for="save"></label> <div class="col-md-8"> <button class="btn btn-info" type="submit">Edit</button> <button type="button" name="clear" onclick="clearEdit()" class="btn btn-danger">Cancel</button> </div> </form> </div> <script> function clearEdit() { document.location.href = "/candidates" } </script> <script> (function () { 'use strict'; window.addEventListener('load', function () { var forms = document.getElementsByClassName('needs-validation'); var validation = Array.prototype.filter.call(forms, function (form) { form.addEventListener('submit', function (event) { event.preventDefault(); event.stopPropagation(); var candidateEmail = $("#email").val(); var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; var emailValidate = re.test(candidateEmail); $("#resultDiv").empty(); if (emailValidate === true) { if (form.checkValidity() === true) { var candidateName = $("#fname").val(); var candidateEmail = $("#email").val(); var addedComments = $("#comments").val(); var dropdownValue = document.getElementById("select1"); var jobApplied = dropdownValue.options[dropdownValue.selectedIndex].value; var existingJob = document.getElementById("oldJob").value; var candidateId = document.getElementById("candidateId").value; $.ajax({ type: 'POST', url: '/candidate/%d/edit' % candidateId, data: { 'candidateName': candidateName, 'candidateEmail': candidateEmail, 'jobApplied': jobApplied, 'existJob': existingJob, 'addedcomments': addedComments }, success: function (result) { var resultName = result.data['candidate_name']; alert("The candidate has been edited"); document.location.href = "/candidates"; } }) } } else { $("#resultDiv").text("Enter the valid email address"); $("#resultDiv").css('color', 'red'); } }, false); }); }, false); })(); </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/edit-interviewer.html
{% extends "add-edit-interviewer-template.html" %} {% if result is mapping %} {% block content %} <input id="fname" name="fname" type="text" placeholder="John" class="form-control input-md" value="{{result.interviewers_name}}" required=""> <input id="email" name="email" type="text" placeholder="johndoe@example.com" value="{{result.interviewers_email}}" class="form-control input-md" required=""> <input id="designation" name="designation" type="text" placeholder="QA" value="{{result.interviewers_designation}}" class="form-control input-md" required=""> {% endblock %} {% else %} {{ super() }} {% endif %} </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/add-rounds.html
<!DOCTYPE html> <html lang="en"> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Add Rounds</title> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link rel="stylesheet" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.4/css/select2.min.css" rel="stylesheet" /> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.4/js/select2.min.js"></script> <style> .bs-example { margin: 20px; } textarea { display: inline } </style> </head> <body> <div> {% include "logout.html" %} <h2 class="grey_text text-justify">Add Rounds</h2> <form class="needs-validation"> <label class="col-md-4 control-label" for="rname"><span style="color:red">*</span>Round name</label> <div class="col-md-4"> <input id="rname" name="rname" maxlength="20" type="text" placeholder="John" class="form-control" required> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <label class="col-md-4 control-label" for="rtime"><span style="color:red">*</span>Round duration</label> <div class="col-md-4"> <select name="Duration" id="rtime" style="width:380px; height:30px;" required> <option value="">Select the time duration</option> <option value="30 minutes">30 minutes</option> <option value="45 minutes">45 minutes</option> <option value="60 minutes">60 minutes</option> <option value="90 minutes">90 minutes</option> </select> <div class=" col-md-8 row top-space-30" id="resultDiv"> </div> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <label class="col-md-4 control-label" for="rdescription"><span style="color:red">*</span>Round description</label> <div class="col-md-4"> <textarea name="rdesc" maxlength="500" id="rdesc" style="width:380px; height:300px;" required></textarea> <div class=" col-md-8 row top-space-30" id="resultDiv"> </div> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <label class="col-md-4 control-label" for="rrequirements"><span style="color:red">*</span>Round requirements</label> <div class="col-md-4"> <input id="rreq" name="rreq" type="text" placeholder="Laptop" class="form-control" required> <div class=" col-md-8 row top-space-30" id="resultDiv"> </div> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> </div> <label class="col-md-4 control-label" for="addinterviewers"><span style="color:red">*</span>Add interviewers</label> <div class="col-md-4"> <select id="multiSelect" class="js-select2" multiple="multiple" > {% for each_interviewer in interviewers %} <option value="{{each_interviewer.interviewer_id}}" selected="selected" data-badge=""> {{each_interviewer.interviewer_name}}</option> {% endfor %} {% for each_interviewer in interviewers_list %} <option value="{{each_interviewer.interviewer_id}}" data-badge=""> {{each_interviewer.interviewer_name}}</option> {% endfor %} </select> </div> <input type="hidden" id="jobId" value="{{job_id}}"> <div class="col-md-8"> <button class="btn btn-info" id="addRound" type="submit">Add</button> <button name="clear" id="cancelRound" type="button" onclick="clearAdd()" class="btn btn-danger">Cancel</button> </div> </form> </div> <script> function clearAdd() { document.location.href = "/jobs" } </script> <script> (function () { 'use strict'; window.addEventListener('load', function () { var forms = document.getElementsByClassName('needs-validation'); var validation = Array.prototype.filter.call(forms, function (form) { form.addEventListener('submit', function (event) { event.preventDefault(); event.stopPropagation(); $("#resultDiv").empty(); if (form.checkValidity() === true) { var roundName = $("#rname").val(); var roundDescription = $("#rdesc").val(); var roundRequirements = $("#rreq").val(); var dropdownValue = document.getElementById("rtime"); var roundTime = dropdownValue.options[dropdownValue.selectedIndex].value; var jobId = document.getElementById("jobId").value; $("#addRound").attr("disabled", true); var addedInterviewers = $("#multiSelect").val(); $.ajax({ type: 'POST', url: '/jobs/' + jobId + '/round/add', data: { 'roundName': roundName, 'roundTime': roundTime, 'roundDescription': roundDescription, 'roundRequirements': roundRequirements, 'addedInterviewers':addedInterviewers }, success: function (result) { alert("The round has been added"); document.location.href = "/job/" + jobId + '/rounds'; }, }) } }, false); }); }, false); })(); </script> <script> $(".js-select2").select2({ closeOnSelect : false, placeholder : "Add interviewers", allowHtml: true, allowClear: true, tags: true }); $('.icons_select2').select2({ width: "100%", templateSelection: iformat, templateResult: iformat, allowHtml: true, placeholder: "Add Interviewers", dropdownParent: $( '.select-icon' ), allowClear: true, multiple: false }); function iformat(icon, badge,) { var originalOption = icon.element; var originalOptionBadge = $(originalOption).data('badge'); console.log(originalOption) return $('<span><i class="fa ' + $(originalOption).data('icon') + '"></i> ' + icon.text + '<span class="badge">' + originalOptionBadge + '</span></span>'); } </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/email_confirmation.html
<html> <p> <h3>Thanks for registering with Interview Scheduler Application!</h3><br> <b>Your account on Interview scheduler application was successfully created.</b> <br>Please click the link below to confirm your email address and activate your account: <a href="{{ confirm_url }}">{{ confirm_url }}</a><br> Questions? Comments? Email annapoorani@qxf2.com. </p> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/add-status.html
<!DOCTYPE html> <html lang="en"> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Add status</title> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <style> .bs-example { margin: 20px; } textarea { display: inline } </style> </head> <body> {% include "logout.html" %} <div> <h2 class="grey_text text-justify">Add Status</h2> <form class="needs-validation"> <label class="col-md-4 control-label" for="statusname">Status name</label> <div class="col-md-4"> <input id="sname" name="sname" type="text" placeholder="Status Name" class="form-control" required> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <div class="col-md-8"> <button class="btn btn-info" type="submit">Add</button> <button name="clear" onclick="clearAdd()" class="btn btn-danger">Cancel</button> </div> </form> </div> <script> function clearAdd() { document.location.href = "/status" } </script> <script> (function () { 'use strict'; window.addEventListener('load', function () { var forms = document.getElementsByClassName('needs-validation'); var validation = Array.prototype.filter.call(forms, function (form) { form.addEventListener('submit', function (event) { event.preventDefault(); event.stopPropagation(); $("#resultDiv").empty(); if (form.checkValidity() === true) { var statusName = $("#sname").val(); $.ajax({ type: 'POST', url: '/status/add', data: { 'statusname': statusName, }, success: function (result) { if (result.error == "Success") { alert("The status has been added"); document.location.href = "/status"; } else { alert("The status already exists"); document.location.href = "/status"; } } }) } }, false); }); }, false); })(); </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/footer.html
<link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <div class="row-fluid footer"> <p> &copy; Qxf2 Services 2020 - <script>document.write(new Date().getFullYear())</script></p> </div> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'G-MKS28N8R51', 'auto'); ga('send', 'pageview'); </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/reset_password_with_token.html
<!DOCTYPE html> <html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Interview Scheduler-Reset Password</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css" /> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> </head> <body> {% include "messages.html" %} <section class="hero is-primary is-fullheight"> <div class="hero-head"> <nav class="navbar"> <div class="container"> </div> </nav> </div> <div class="hero-body"> <div class="container has-text-centered"> <div class="column is-4 is-offset-4"> <h3 class="title">Reset Password</h3> <div class="box"> <form> <div class="field"> <div class="control"> <input class="input is-large" id="userPassword" type="password" name="password" placeholder="Your Password"> </div> </div> <input type="button" class="btn btn-info" id="submitButton" value="Submit"> <input type="button" class="btn btn-info" id="cancelButton" value="Cancel"> <input type="hidden" class="btn btn-info" id="userEmail" value="{{email}}"> </form> </div> </div> </div> </div> <script> $("document").ready(function () { $('#submitButton').click(function () { newPassword = $("#userPassword").val(); userEmail = document.getElementById("userEmail").value; $.ajax({ type: 'Post', url: '/change-password', data: { newpassword: newPassword, useremail: userEmail }, success: function (result) { if (result.error == 'Success') { alert("The password is changed"); document.location.href = "/login"; } else if (result.error == 'error') { alert("Please check your username and password"); document.location.href = '/login'; } else if (result.error == 'confirmation error') { alert("Please confirm your email address") document.location.href = '/login' } } }) }) }) </script> </section> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/menu-bar.html
<div class="wrapper"> <div class="dropdown"> <i class="glyphicon glyphicon-menu-hamburger"></i> <div class="dropdown-content"> <a href="./interviewers">Interviewers</a> <a href="./jobs">Jobs</a> <a href="./candidates">Candidates</a> </div> </div> </div>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/add-jobs.html
<html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <title> Add Jobs </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <!--This is to disable liveregion of multi-select,Source is https://stackoverflow.com/questions/13011127/how-to-remove-change-jquery-ui-autocomplete-helper-text--> <style> .ui-helper-hidden-accessible { position: absolute; left: -999em; } </style> </head> <body> {% include "logout.html" %} <div class="container col-md-offset-1"> <div class="row top-space-30"> <h2>Add the Job role and Interviewers</h2> </div> <div class="row top-space-30"> <form class="needs-validation"> <div class="input-group"> <label class="col-md-3 col-form-label text-md-right" for="jobrole"><span style="color:red">*</span>Job role:</label> <div class="col-md-6"> <input id="role" name="jobrole" type="text" placeholder="QA" class="form-control input-md" required> <div class="valid-feedback">Valid.</div> <div class="invalid-feedback">Please fill out this field.</div> </div> </div> <br> <div class="input-group"> <label class="col-md-3 col-form-label text-md-right" for="interviewers"><span style="color:red">*</span>Interviewers:</label> <div class="col-md-6"> <input class="form-control" type="text" id="interviewers" required> <input type="hidden" id="TestHidden" value="{{result}}" required> <div class="valid-feedback">Valid.</div> <div class="invalid-feedback">Please fill out this field.</div> </div> <div class="col-md-2"> <button type="submit" id="submit">Submit</button> </div> </div> </form> </div> </div> <script> (function () { 'use strict'; window.addEventListener('load', function () { // Fetch all the forms we want to apply custom Bootstrap validation styles to var forms = document.getElementsByClassName('needs-validation'); // Loop over them and prevent submission var validation = Array.prototype.filter.call(forms, function (form) { form.addEventListener('submit', function (event) { event.preventDefault(); event.stopPropagation(); if (form.checkValidity() === false) { } else { var jobName = $("#role").val(); var interviewersList = $("#interviewers").val(); var lastString = interviewersList.charAt(interviewersList.length - 1); var lastlistChar = isLetter(lastString) if (lastlistChar == 'true') { var interviewersList = $("#interviewers").val().split(','); } else { var interviewersList = $("#interviewers").val().split(','); interviewersList.pop(); } function isLetter(lastString) { if (lastString.length === 1 && lastString.match(/[a-z]/i)) { return 'true'; } } var interviewerslistLength = interviewersList.length if (interviewerslistLength === 0) { alert("The interviewers should be chosen from the list"); document.location.href = "/jobs/add"; } else { $("#submit").attr("disabled", true); $.ajax({ type: 'POST', url: '/jobs/add', data: { 'role': jobName, 'interviewerlist': JSON.stringify(interviewersList) }, success: function (result) { alert("The job has been added"); document.location.href = "/jobs"; }, error: function (request, status, message) { alert(request.responseJSON.message); document.location.href = "/jobs/add"; } }) } } }, false); }); }, false); })(); </script> <script> $(function () { var availableTags = eval(document.getElementById("TestHidden").value); function split(val) { return val.split(/,\s*/); } function extractLast(term) { return split(term).pop(); } //document.getElementById("id1").style.display="none"; $("#interviewers") // don't navigate away from the field on tab when selecting an item .on("keydown", function (event) { if (event.keyCode === $.ui.keyCode.TAB && $(this).autocomplete("instance").menu.active) { event.preventDefault(); } }) .autocomplete({ minLength: 0, source: function (request, response) { // delegate back to autocomplete, but extract the last term response($.ui.autocomplete.filter( availableTags, extractLast(request.term))); }, messages: { noResults: '', results: function () { } }, focus: function () { // prevent value inserted on focus return false; }, select: function (event, ui) { var terms = split(this.value); // remove the current input terms.pop(); // add the selected item terms.push(ui.item.value); const index = availableTags.indexOf(ui.item.value); if (index > -1) { availableTags.splice(index, 1); } // add placeholder to get the comma-and-space at the end terms.push(""); this.value = terms.join(", "); return false; } }); }); </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/add-interviewers.html
<!DOCTYPE html> <html lang="en"> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Add Interviewers</title> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.css"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <style> .bs-example { margin: 20px; } textarea { display: inline } </style> </head> <body> {% include "logout.html" %} <div class="modal" id="myModal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="myModalLabel">Confirmation</h4> </div> <div class="modal-body"> <p></p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" id="close" data-dismiss="modal">Close</button> </div> </div> </div> </div> <div class="bs-example"> <form class="form-horizontal"> <!-- Form Name --> <h2 class="grey_text text-justify">Add Interviewers</h2> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="fname"><span style="color:red">*</span>Interviewer Name</label> <div class="col-md-4"> <input id="fname" name="fname" type="text" placeholder="John" class="form-control input-md" required> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="email"><span style="color:red">*</span>Email</label> <div class="col-md-4"> <input id="email" name="email" type="email" placeholder="johndoe@example.com" class="form-control input-md" required> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="designation"><span style="color:red">*</span>Designation</label> <div class="col-md-4"> <input id="designation" name="designation" type="text" placeholder="QA" class="form-control input-md" required> </div> </div> </form> <form class="form-inline"> <div class="form-group bfh-timepicker" data-mode="12h"> <label class="col-md-6 control-label" for="starttime"><span style="color:red">*</span>Start time</label> <div class="col-md-4"> <input type="time" class="form-control input-md" id="starttime0" placeholder="starttime" required> </div> </div> <div class="form-group"> <label class="col-md-6 control-label" for="endtime"><span style="color:red">*</span>End time</label> <div class="col-md-4"> <input type="time" class="form-control input-md" id="endtime0" placeholder="endtime" id="time" required> </div> </div> <div class="col-md-4" id="resultDiv0"></div> </form> <div> <input class="btn btn-info" onclick="addtextbox()" type="button" value="Add time"> </div> <div id="ToolsGroup"> </div> <!-- Button (Double) --> <form class="form-horizontal"> <div class="form-group"> <label class="col-md-4 control-label" for="save"></label> <div class="col-md-8"> <input class="btn btn-success" type='button' id='submit' value='Save'> <button type="button" id="clear" name="clear" class="btn btn-danger">Cancel</button> </div> </div> </form> </form> </div> <script> var timeObject = { starttime: [], endtime: [] }; $("#submit").click(function () { var validValue = true; var email = $("#email").val(); var name = $("#fname").val(); var designation = $("#designation").val(); timeObject = { starttime: [], endtime: [] }; for (var index = 0; index < count + 1; index++) { timeObject.starttime.push($("#starttime" + index).val()) timeObject.endtime.push($("#endtime" + index).val()) } //Validation of name email and designation starts here if (name == "") { $('#name').remove(); $('#fname').after('<span id="name" class="error" style="color:red">Name field is required</span>'); validValue = false; } if (name != "") { $('#name').remove(); validValue &= true; } if (email == "") { $('#mail').remove(); $('#email').after('<span id="mail" class="error" style="color:red">Email field is required</span>'); validValue = false; } if (email != "") { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; if (re.test(email)) { $('#mail').remove(); var idx = email.lastIndexOf('@'); if (idx > -1 && email.slice(idx + 1) !== 'qxf2.com') { validValue = false $("#mail").remove(); $('#email').after('<span id="mail" class="error" style="color:red">Email should end with qxf2.com</span>'); } } } //validation for timings for (index = 0; index <= count; index++) { starttime = $("#starttime" + index).val(); endtime = $("#endtime" + index).val(); var msg = ""; if (starttime != "" || endtime != "") { if (starttime >= endtime) { validValue = false; msg = "Start time can't be greater than or same as end time"; $("#resultDiv" + index).css('color', 'red'); $("#resultDiv" + index).html(msg); } else { validValue &= true; $("#resultDiv" + index).remove(); } } else { validValue = false; msg = "Start time and end time can't be empty"; $("#resultDiv" + index).css('color', 'red'); $("#resultDiv" + index).html(msg); } } //to check validation and not to store data in database make validValue = false in next line; //validValue = false; if (validValue == true) { $.ajax({ type: 'POST', url: '/interviewers/add', data: { 'name': name, 'email': email, 'designation': designation, 'timeObject': JSON.stringify(timeObject) }, success: function (result) { var msg = "Success: The interviewer " + ' ' + result.data.interviewer_name + ' ' + " has been added successfully"; $('#myModal').modal('show'); $('#myModal .modal-body p').html(msg); }, error: function (result) { var msg = "Failure: The interviewer" + ' ' + name + ' ' + "already exist, check email properly"; $('#myModal').modal('show'); $('#myModal .modal-body p').html(msg); } }) } }) </script> <script> var count = 0; function addtextbox() { count++; var newTextBoxDiv = document.createElement('div'); newTextBoxDiv.id = 'Tools'; document.getElementById("ToolsGroup").appendChild(newTextBoxDiv); newTextBoxDiv.innerHTML = '<form class="form-inline"><div class="form-group"><label class="col-md-6 control-label" for="starttime"><span style="color:red">*</span>Start time</label><div class="col-md-4"><input type="time" class="form-control input-md" id="starttime' + count + '" placeholder="starttime" required=""> </div></div>' + '<div class="form-group"><label class="col-md-6 control-label" for="endtime"><span style="color:red">*</span>End time</label><div class="col-md-4"><input type="time" class="form-control input-md" id="endtime' + count + '" placeholder="endtime" required=""></div></div><div class="col-md-4" id="resultDiv' + count + '"></div></form>' + '&nbsp;&nbsp;<input type="button" value="Remove" class="removeTools" onclick="removeTextArea(this);">' $('#Tools input[type=time]').timepicker({ timeFormat: 'HH:mm', interval: 30, use24hours: true, scrollbar: true, }); }; function removeTextArea(inputElement) { var el = inputElement; while (el.tagName != 'DIV') el = el.parentElement; el.parentElement.removeChild(el); count--; } </script> <script> $(document).ready(function () { $('#starttime0').timepicker({ timeFormat: 'HH:mm', interval: 30, use24hours: true, scrollbar: true, }); }); </script> <script> $(document).ready(function () { $('#endtime0').timepicker({ timeFormat: 'HH:mm', interval: 30, use24hours: true, scrollbar: true, }); }); </script> <script> $("#close").click(function () { document.location.href = "/interviewers" }) </script> <script> $("#clear").click(function () { document.location.href = "/interviewers"; }) </script> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/add-edit-interviewer-template.html
<html> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Edit Interviewers</title> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.css"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <script> $(document).ready(function () { $(".show-modal").click(function () { $("#myModal").modal({ backdrop: 'static', keyboard: false }); }); }); </script> </script> </head> <body> {% include "logout.html" %} <div class="modal" id="myModal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="myModalLabel">Confirmation</h4> </div> <div class="modal-body"> <p>Success:</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" onclick="redirectNew()" data-dismiss="modal">Close</button> </div> </div> </div> </div> <div class="bs-example"> <form class="form-horizontal"> <!-- Form Name --> <h2 class="grey_text text-justify">Edit Interviewers</h2> <!-- Text input--> {% for each_details in result %} <div class="form-group"> <label class="col-md-4 control-label" for="fname"><span style="color:red">*</span>First Name</label> <div class="col-md-4"> <input id="fname" name="fname" type="text" placeholder="John" class="form-control input-md" value="{{each_details['interviewers_name']}}" required=""> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="email"><span style="color:red">*</span>Email</label> <div class="col-md-4"> <input id="email" name="email" type="text" placeholder="johndoe@example.com" value="{{each_details['interviewers_email']}}" class="form-control input-md" required=""> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="designation"><span style="color:red">*</span>Designation</label> <div class="col-md-4"> <input id="designation" name="designation" type="text" placeholder="QA" value="{{each_details['interviewers_designation']}}" class="form-control input-md" required=""> </div> </div> </form> <form class="form-inline"> <table id="timeTable"> {% for each_slot in each_details['time'] %} <tr id="time-slot-{{loop.index}}"> <td> <label class="col-md-10 control-label" for="starttime"><span style="color:red">*</span>Start&nbsp;time</label> </td> <td> <input type="time" class="form-control bfh-timepicker input-md" id="starttime{{loop.index}}" placeholder="starttime" value="{{each_slot['starttime']}}" required=""> </td> <td> <label class="col-md-10 control-label" for="endtime"><span style="color:red">*</span>End&nbsp;time</label> </td> <td> <input type="time" class="form-control bfh-timepicker input-md" id="endtime{{loop.index}}" value="{{each_slot['endtime']}}" placeholder="endtime" required=""> </td> <td> {% if loop.index != 1 %} <input type="button" value="Remove" onclick="removeButton({{loop.index}})" class="btn btn-link"> {% endif %} </td> <td> <div id="resultDiv{{loop.index}}"></div> </td> </tr> <br /> {% endfor %} <tr> <td> {% set counter = each_details['time'] | length %} <input type="hidden" id="TestHidden" value="{{counter}}"> </td> </tr> </table> </form> <div> <input class="btn btn-link" onclick="addtextbox()" type="button" value="Add"> </div> <div id="ToolsGroup"> </div> <!-- Button (Double) --> <form class="form-horizontal"> <div class="form-group"> <label class="col-md-4 control-label" for="save"></label> <div class="col-md-8"> <input class="btn btn-success" type='button' id='submit' value='Save'> <input type='button' id="clear" value='Cancel' onclick="redirectNew()" class="btn btn-danger"> </div> </div> </form> </form> {% endfor %} </div> <script> timeObject = { starttime: [], endtime: [] }; $("#submit").click(function () { var id = $("#intid").val(); var email = $("#email").val(); var name = $("#fname").val(); var designation = $("#designation").val(); var timeSlotTable = document.getElementById("timeTable"); var count = timeSlotTable.rows.length; validValue = true; for (var index = 1; index <= count; index++) { var starttimeVal = $("#starttime" + index).val(); if (starttimeVal != undefined) { timeObject.starttime.push($("#starttime" + index).val()) timeObject.endtime.push($("#endtime" + index).val()) } } for (var index = 0; index <= 15; index++) { if (document.getElementById("dstarttime" + index) == null) { break; } var starttimeVal = $("#dstarttime" + index).val(); if (starttimeVal != undefined) { timeObject.starttime.push($("#dstarttime" + index).val()) timeObject.endtime.push($("#dendtime" + index).val()) } } //validation starts from here if (name == "") { $('#name').remove(); $('#fname').after('<span id="name" class="error" style="color:red">Name field is required</span>'); validValue = false; } if (name != "") { $('#name').remove(); validValue &= true; } if (email == "") { $('#mail').remove(); $('#email').after('<span id="mail" class="error" style="color:red">Email field is required</span>'); validValue = false; } if (email != "") { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; if (re.test(email)) { $('#mail').remove(); var idx = email.lastIndexOf('@'); if (idx > -1 && email.slice(idx + 1) !== 'qxf2.com') { validValue = false $("#mail").remove(); $('#email').after('<span id="mail" class="error" style="color:red">Email should end with qxf2.com</span>'); } } } //validation for timings for (index = 0; index <= count; index++) { starttime = $("#starttime" + index).val(); endtime = $("#endtime" + index).val(); var msg = ""; if (starttime != "" || endtime != "") { if (starttime >= endtime) { validValue = false; msg = "Start time can't be greater than or same as end time"; $("#resultDiv" + index).css('color', 'red'); $("#resultDiv" + index).html(msg); } else { validValue &= true; msg = ""; $("#resultDiv" + index).html(msg); } } else { validValue = false; msg = "Start time and end time can't be empty"; $("#resultDiv" + index).css('color', 'red'); $("#resultDiv" + index).html(msg); } } //validation for dynamic time for (index = 0; index < 20; index++) { starttime = $("#dstarttime" + index).val(); endtime = $("#dendtime" + index).val(); var msg = ""; if (starttime == null) { break; } if (starttime != "" || endtime != "") { if (starttime >= endtime) { validValue = false; msg = "Start time can't be greater than or same as end time"; $("#dresultDiv" + index).css('color', 'red'); $("#dresultDiv" + index).html(msg); } else { validValue &= true; msg = ""; $("#dresultDiv" + index).html(msg); } } else { validValue = false; msg = "Start time and end time can't be empty"; $("#dresultDiv" + index).css('color', 'red'); $("#dresultDiv" + index).html(msg); } } //validation end if (validValue == true) { $.ajax({ type: 'POST', url: '/interviewers/%d/edit' % id, data: { 'email': email, 'name': name, 'designation': designation, 'timeObject': JSON.stringify(timeObject) }, success: function (result) { var msg = " The interviewer " + ' ' + result.interviewer_name + ' ' + " has been edited successfully"; $('#myModal').modal('show'); $('#myModal .modal-body p').html(msg); } }) } }) </script> <script> var count = 0; function addtextbox() { var newTextBoxDiv = document.createElement('div'); newTextBoxDiv.id = 'Tools'; document.getElementById("ToolsGroup").appendChild(newTextBoxDiv); newTextBoxDiv.innerHTML = '<form class="form-inline"><div class="form-group"><span style="color:red">*</span><label class="col-md-4 control-label" for="starttime">Start&nbsp;time</label><div class="col-md-4"><input type="time" class="form-control input-md" id="dstarttime' + count + '" placeholder="starttime" required> </div></div>' + '<div class="form-group"><span style="color:red">*</span><label class="col-md-4 control-label" for="endtime">End&nbsp;time</label><div class="col-md-4"><input type="time" class="form-control input-md" id="dendtime' + count + '" placeholder="endtime"></div></div>' + '<input type="button" value="Remove" class="btn btn-link" onclick="removeTextArea(this);"></div><div id="dresultDiv' + count + '"></div></form>' count++; $('#Tools input[type=time]').timepicker({ timeFormat: 'HH:mm', interval: 30, use24hours: true, scrollbar: true, }); }; function removeTextArea(inputElement) { var el = inputElement; while (el.tagName != 'DIV') el = el.parentElement; el.parentElement.removeChild(el); counter--; } </script> <script> function redirectNew() { document.location.href = "/interviewers" } </script> <script> function removeButton(loopIndex) { var row_id = "time-slot-" + loopIndex; var elem = document.getElementById(row_id); elem.parentNode.removeChild(elem); } </script> <script> $(document).ready(function () { $('#starttime0').timepicker({ timeFormat: 'HH:mm', interval: 30, use24hours: true, scrollbar: true, }); }); </script> <script> $(document).ready(function () { $('#endtime0').timepicker({ timeFormat: 'HH:mm', interval: 30, use24hours: true, scrollbar: true, }); }); </script> </body>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/logout.html
<form align="right" name="form1" method="post" action="{{ url_for('logout') }}"> <label class="logoutLblPos"> <input name="submit2" type="submit" id="submit2" value="log out"> </label> </form>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/header.html
<html> <head> <title>Qxf2 Services-Interview Scheduler</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <!-- Bootstrap --> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" /> <link href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet" /> <link href="https://fonts.googleapis.com/css?family=Abel|Open+Sans:400,600" rel="stylesheet"> </head> <body> <!-- Fixed navbar Src: https://getbootstrap.com/examples/navbar-fixed-top/#--> <header class="header header-default header"> <div class="container-fluid"> <div class="header-header"> <a class="header-brand" href="#"> <img class="row top-space-2 logo img-responsive header" src="/static/img/qxf2_logo.png" alt="Qxf2 Services"></img></a> </a> <h1>Qxf2 Services-Interview Scheduler</h1> </div> </div> </header> </body> </html>
0
qxf2_public_repos/interview-scheduler/qxf2_scheduler
qxf2_public_repos/interview-scheduler/qxf2_scheduler/templates/add-feedback.html
<!DOCTYPE html> <html lang="en"> <head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-MKS28N8R51"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-MKS28N8R51'); </script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Add feedback</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link href="/static/css/qxf2_scheduler.css" rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <style> .bs-example { margin: 20px; } textarea { display: inline } </style> </head> <body> {% include "logout.html" %} <form class="needs-validation"> <label class="col-md-4 control-label" for="thumbsUp"> <span style="color:red">*</span> What was your opinion about the candidate? </label> <div class="col-md-4"> <select id="thumbsUp" style="width:200px; height:30px;"> <option value="thumbsup">Thumbs Up</option> <option value="thumbsdown">Thumbs Down</option> </select> </div> <br> <div> <h2 class="grey_text text-justify">Add feedback</h2> <label class="col-md-4 control-label" for="feedback"><span style="color:red">*</span>Add your feedback</label> <div class="col-md-4"> <textarea id="comments" name="comments" rows="10" col="20" class="form-control" required></textarea> <div class="valid-feedback">Valid</div> <div class="invalid-feedback">Please fill out this field</div> </div> <div> <label class="col-md-4 control-label" for="save"></label> <div class="col-md-8"> <button class="btn btn-info" id="submit" type="submit">Submit</button> <button type="button" name="clear" onclick="clearAdd()" class="btn btn-danger">Cancel</button> </div> </div> <input type="hidden" id="candidateId" value={{result.candidate_id}}> <input type="hidden" id="roundId" value={{result.round_id}}> </div> </form> <script> (function () { 'use strict'; window.addEventListener('load', function () { // Fetch all the forms we want to apply custom Bootstrap validation styles to var forms = document.getElementsByClassName('needs-validation'); // Loop over them and prevent submission var validation = Array.prototype.filter.call(forms, function (form) { form.addEventListener('submit', function (event) { event.preventDefault(); event.stopPropagation(); if (form.checkValidity() === false) { } else { var dropdownValue = document.getElementById("thumbsUp"); var thumbsValue = dropdownValue.options[dropdownValue.selectedIndex].value; var addedFeedback = document.getElementById("comments").value var candidateId = document.getElementById("candidateId").value var roundId = document.getElementById("roundId").value $.ajax({ type: 'POST', url: '/candidate/' + candidateId + '/round/' + roundId + '/add_feedback', data: { 'addedfeedback': addedFeedback, 'thumbsvalue': thumbsValue }, success: function (result) { if (result.error == "Success") { alert("The feedback has been added") document.location.href = '/candidates' } } }) } }, false); }); }, false); })(); </script> <script> function clearAdd() { document.location.href = "/candidates" } </script> </body> </html>
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/seeds/demo.py
from flask_seeder import Seeder, Faker, generator from qxf2_scheduler import db import datetime from sqlalchemy import DateTime from qxf2_scheduler.security import encrypt_password class Jobs(db.Model): "Adding the Job page" def __init__(self,job_id=None,job_role=None,job_status=None): self.job_id = job_id self.job_role = job_role self.job_status = job_status def __str__(self): return "job_id=%d, job_role=%s, job_status=%s" % (self.job_id, self.job_role, self.job_status) class Candidates(db.Model): "Adding the candidates" def __init__(self,candidate_id=None, candidate_name=None, candidate_email=None,job_applied=None,comments=None): self.candidate_id = candidate_id self.candidate_name = candidate_name self.candidate_email = candidate_email self.job_applied = job_applied self.comments = comments def __str__(self): return "candidate_id=%d, candidate_name=%s, candidate_email=%s, date_applied=%d, job_applied=%s, comments=%s" %(self.candidate_id, self.candidate_name, self.candidate_email, self.job_applied, self.comments) class Jobcandidate(db.Model): "Combine Job id and Candidate ID" def __init__(self, combo_id=None, candidate_id=None, job_id=None, url=None, unique_code=None, interview_start_time=None, interview_end_time=None, interview_date=None, interviewer_email=None, candidate_status=None): self.combo_id = combo_id self.candidate_id = candidate_id self.job_id = job_id self.url = url self.unique_code = unique_code self.interview_start_time = interview_start_time self.interview_end_time = interview_end_time self.interview_date = interview_date self.interviewer_email = interviewer_email self.candidate_status = candidate_status def __str__(self): return "combo_id=%d, candidate_id=%d, job_id=%d, url=%s, unique_code=%s, interview_start_time=%s, interview_end_time=%s, interview_date=%s, interviewer_email=%s, candidate_status=%d"%(self.combo_id, self.candidate_id, self.job_id, self.url, self.unique_code, self.interview_start_time, self.interview_end_time, self.interview_date, self.interviewer_email, self.candidate_status) class Login(db.Model): "Creates username and password" def __init__(self, id=None, username=None, password=None, email=None, email_confirmation_sent_on=None, email_confirmed=None, email_confirmed_on=None): self.id = id self.username = username self.password = password self.email = email self.email_confirmation_sent_on = email_confirmation_sent_on self.email_confirmed = email_confirmed self.email_confirmed_on = email_confirmed_on def __str__(self): return "id=%d, username=%s, password=%s, email=%s, email_confirmation_sent_on=%s, email_confirmed=%s, email_confirmed_on=%s"%(self.id, self.username, self.password, self.email, self.email_confirmation_sent_on, self.email_confirmed, self.email_confirmed_on) class DemoSeeder(Seeder): "Creates seeder class" def run(self): "Create new faker and creates data" #Adding user to login print("Hi how are you") self.login = Login(id=3,username='nilaya', password=encrypt_password("qwerty"), email="nilaya@qxf2.com",email_confirmed=1) print(f'Login object{self.login}{type(self.login)}') self.db.session.add(self.login) self.db.session.commit() #Adding jobs self.job = Jobs(job_role='Junior QA',job_status='Open') self.db.session.add(self.job) self.db.session.commit() #Adding candidates self.add_candidate = Candidates(candidate_name="test_seeder_candidate", candidate_email="annupriyan27+220220212@gmail.com", job_applied="Junior QA", comments="Hi I am the comment. You can add,edit or delete me. Thankyou.") self.db.session.add(self.add_candidate) self.db.session.commit() #Adding candidate status self.job_candidate= Jobcandidate(candidate_id=self.add_candidate.candidate_id, job_id=self.job.job_id, url='', candidate_status= 1) self.db.session.add(self.job_candidate) self.db.session.commit()
0
qxf2_public_repos/interview-scheduler
qxf2_public_repos/interview-scheduler/.vscode/settings.json
{ "python.pythonPath": "venv-gcal\\Scripts\\python.exe", //wordwrap "editor.wordWrap": "wordWrapColumn", "[python]": {}, "window.zoomLevel": 0, //Indentation "editor.wrappingIndent": "same", "editor.tabSize": 4, "editor.insertSpaces": 4, //Trailing spaces "files.trimTrailingWhitespace": true , "trailing-spaces.highlightCurrentLine": false, "trailing-spaces.deleteModifiedLinesOnly": true, "trailing-spaces.trimOnSave": true, "trailing-spaces.deleteTrailingSpaces": true, }
0
qxf2_public_repos
qxf2_public_repos/sample-lambda-heart-rate/LICENSE
MIT License Copyright (c) 2018 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0
qxf2_public_repos
qxf2_public_repos/sample-lambda-heart-rate/requirements.txt
Flask==0.12.2 boto3==1.9.49
0
qxf2_public_repos
qxf2_public_repos/sample-lambda-heart-rate/README.md
# Sample web application (Python Flask) invoking a Lambda function This sample web application invokes a AWS Lambda function for calculating the maximum heart rate and based on this maximum heart rate calculates the target heart rate. All the backend logic is implemented in a Lambda function. This application was designed by [Qxf2 Services](https://www.qxf2.com/?utm_source=sample-lambda-heart-rate&utm_medium=click&utm_campaign=Sample%20lambda%20heart%20rate). Qxf2 provides QA for startups. For convenience, this app will be shortly hosted at pythonanywhere.com ## Features of the Sample Lambda heart rate application 1. This app takes Name and Age as inputs 2. It invokes a Lambda function to calculate the maximum heart rate and target heart rate based on Age. 3. Displays the returned response(target heart rate range) on the browser. ## Setup This app will be shortly hosted at pythonanywhere.com *Prerequisites:* 1) Need to have a AWS account with console access. 2) Clone the repo - https://github.com/qxf2/sample-lambda-heart-rate 3) Update the conf/credentials.py file with the aws credentials(access_key and secret_key) and region(For eg:- If your region is "Oregion", enter 'us-west-2' in the region field) 4) Create a AWS Lambda function with name 'patient_health_record' and paste the below code in inline editor. Update the conf/credentials.py file with the lambda function name details. If you are new to AWS Lambda functions, please refer this [link](https://docs.aws.amazon.com/lambda/latest/dg/get-started-create-function.html) and follow the instructions. <pre lang='python'> import json def lambda_handler(event, context): #lambda handler function print "handler started" age = event['age'] calculate_max_heart_rate(age) calculate_low_heart_rate_range(event,context) calculate_high_heart_rate_range(event,context) return { "low": round(low_heart_rate_range), "high":round(high_heart_rate_range)} def calculate_max_heart_rate(age): # caculates maximum heart rate global max_heart_rate max_heart_rate = 220 - age return max_heart_rate def calculate_low_heart_rate_range(event,context): # calculates the low heart rate range global low_heart_rate_range low_heart_rate_range = max_heart_rate * .7 return low_heart_rate_range def calculate_high_heart_rate_range(event,context): # calculates the high heart rate range global high_heart_rate_range high_heart_rate_range = max_heart_rate * .85 return high_heart_rate_range </pre> Follow this setup if you want to use a local copy of this application. 1. `pip install requirements.txt` ## How to run the Sample Lambda heart rate application To start the application, 1. Run `python sample_lambda_heart_rate.py` from the console. 2. Visit `localhost:6464` in your browser. 3. Give the inputs and click on the 'Calculate THR Range!' button ## What the application does The application calculates target heart rate for the given user. We have exactly one page with: * two text boxes * one submit button * a page title * three hyperlinks * a copyright message
0
qxf2_public_repos
qxf2_public_repos/sample-lambda-heart-rate/sample_lambda_heart_rate.py
""" This is a Flask application which calculates the target heart rate range based on the age of the user. """ from flask import Flask, jsonify, render_template, request import json import boto3 import logging import conf.credentials as conf # create lambda client client = boto3.client('lambda', region_name= conf.region, aws_access_key_id=conf.aws_access_key_id, aws_secret_access_key=conf.aws_secret_access_key) app = Flask(__name__) app.logger.setLevel(logging.ERROR) @app.route("/", methods=['GET', 'POST']) @app.route("/calculate_heartrate_range", methods=['GET', 'POST']) def calculate_heartrate_range(): "Endpoint for calculating the heart rate range" if request.method == 'GET': #return the form return render_template('sample_lambda.html') if request.method == 'POST': #return the range age = int(request.form.get('age')) payload = {"age":age} #Invoke a lambda function which calculates the max heart rate and gives the target heart rate range result = client.invoke(FunctionName=conf.lambda_function_name, InvocationType='RequestResponse', Payload=json.dumps(payload)) range = result['Payload'].read() api_response = json.loads(range) return jsonify(api_response) #---START OF SCRIPT if __name__ == '__main__': app.run(host='127.0.0.1', port=6464, debug= True)
0