Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ext.ns('SearchJobsForm'); // register our namespace
- var serverAdd = 'localhost';
- var port = '3000';
- var dataReceivedFromServer=' ';
- /* BUTTON HANDLERS */
- var resetButtonHandler = function (btn, evt) {
- this.getComponent('keywords').reset();
- this.getComponent('dposted').reset();
- this.getComponent('jtitle').reset();
- this.getComponent('jcategory').reset();
- this.getComponent('salaryf').reset();
- this.getComponent('salaryt').reset();
- this.getComponent('jscategory').reset();
- this.getComponent('ptype').reset();
- }
- /*This function takes the search criteria and sends it to the server to receive filtered search results
- */
- var submitButtonHandler = function(btn,evt) {
- var form = this.el.up('.x-panel');
- var searchCriteria = {
- 'keywords':form.down('.x-input-text[name=keywords]').getValue(),
- 'job_title': form.down('.x-input-text[name=jtitle]').getValue(),
- 'job_category':form.down('.x-input-text[name=jcategory]').getValue(),
- 'job_subcategory':form.down('.x-input-text[name=jscategory]').getValue(),
- 'position_type':form.down('.x-input-text[name=ptype]').getValue(),
- 'salary_from': form.down('.x-input-text[name=salaryf]').getValue(),
- 'salary_to': form.down('.x-input-text[name=salaryto]').getValue(),
- 'posting_age':form.down('.x-input-text[name=dposted]').getValue()
- };
- globalvar = form;
- connect(searchCriteria);
- }
- var globalvar = null;
- //connection to the server
- var connect = function(searchCriteria){
- Ext.util.JSONP.request({
- url: "http://"+serverAdd+":"+ port+"/users/searchresults.json",
- format: 'json',
- callbackKey: 'callback',
- params : searchCriteria,
- callback: function(data) {
- //Do something with the results. Construct another interface for showing the results.
- //alert(data);
- dataReceivedFromServer = data;
- Ext.apply(this, {jobsList: new SearchJobsForm.jobsList()});
- },
- failure: function ( result) {
- alert('Failed');
- }
- });
- }//end of connect function
- /* THE LIST OF JOBS */
- SearchJobsForm.jobsList = Ext.extend(Ext.Panel,{
- initComponent: function(){
- Ext.apply(this, {
- floating: true,
- width: 250,
- height: 370,
- scroll: 'vertical',
- centered: true,
- dockedItems : [ {
- xtype : 'toolbar',
- title : 'WTJ',
- dock : 'top',
- items : [ {
- xtype : 'button',
- text : 'Back',
- ui : 'back',
- handler : function() {
- //back button controller
- },
- scope : this
- } ]
- } ],
- items : [ {
- xtype : 'list',
- emptyText : 'No data available.',
- store : 'jobStore',
- itemTpl : '<div class="list-item-title">{title}</div>'
- +
- '<div class="list-item-narrative">{narrative}</div>',
- onItemDisclosure : function(record) {
- },
- grouped : false,
- scroll : 'vertical',
- fullscreen : true
- } ]
- });
- SearchJobsForm.jobsList.superclass.initComponent.apply(this, arguments);
- },
- });
- /* ****** MODEL ****** */
- Ext.regModel('jobSummary', {
- fields: [
- {name: 'title', type: 'string'}
- /*
- ,
- {name: 'brief_description', type: 'string'},
- {name: 'company', type: 'string'},
- {name: 'category', type: 'string'},
- {name: 'posting_date', type: 'string' },
- {name: 'sub_category', type: 'string'},
- {name: 'department', type: 'string'},
- {name: 'reference_num', type: 'string'},
- {name: 'province', type: 'string'},
- {name: 'country', type: 'string'},
- {name: 'full_description', type: 'string'},
- {name: 'requirements', type: 'string'},
- {name: 'relocation_covered', type: 'string'},
- {name: 'salary', type: 'string'},
- {name: 'travel_req', type: 'string'},
- {name: 'call_allowed', type: 'string'},
- {name: 'term', type: 'string'},
- {name: 'experience', type: 'string'},
- {name: 'call_allowed', type: 'string'}
- */
- ]
- });
- /* ****** STORE ****** */
- var store = new Ext.data.Store({
- model: 'jobSummary',
- storeId: 'jobStore',
- /*
- proxy: {
- type:'scripttag',
- url:'temp.json',
- reader: {
- type: 'json'
- }
- },
- */
- data : [{title: 'This is test'},
- {title: 'This is test2'},
- {title: 'This is test3'}]
- });
- /*
- *******SEARCH FORM******
- */
- SearchJobsForm.form = Ext.extend(Ext.Panel,{
- initComponent: function(){
- Ext.apply(this, {
- floating: true,
- width: 250,
- height: 370,
- scroll: 'vertical',
- centered: true,
- modal: true,
- hideOnMaskTap: false,
- items: [{
- xtype: 'textfield',
- itemId: 'keywords',
- label: 'Keywords',
- labelAlign: 'top',
- labelWidth: '100%',
- name: 'keywords'
- },{
- xtype: 'textfield',
- label: 'Job Title',
- itemId: 'jtitle',
- labelAlign: 'top',
- labelWidth: '100%',
- name: 'jtitle'
- },{
- xtype: 'selectfield',
- label: 'Job Category',
- itemId: 'jcategory',
- labelAlign: 'top',
- labelWidth: '100%',
- name: 'jcategory',
- options: [{
- text: 'Any', value: 'ANY'
- }, {
- text: 'Technical', value: 'Technical'
- }, {
- text: 'Non-Technical', value: 'Non-Technical'
- }, {
- text: 'Tech Start-up', value: 'Tech Start-up'
- }, {
- text: 'Life Science', value: 'Life Science'
- }, {
- text: 'Digital Media', value: 'Digital Media'
- }, {
- text: 'Accelerator Centre', value: 'Accelerator Centre'
- }
- ]
- },{
- xtype: 'selectfield',
- label: 'Job Sub-Category',
- itemId: 'jscategory',
- labelAlign: 'top',
- labelWidth: '100%',
- name: 'jscategory',
- options: [{
- text: 'Any', value: 'ANY'
- }, {
- text: 'Developer', value: 'Developer'
- }, {
- text: 'Quality Assurance', value: 'Quality Assurance'
- }, {
- text: 'Project Manager', value: 'Project Manager'
- }, {
- text: 'Tester', value: 'Tester'
- }, {
- text: 'IT Help Desk', value: 'IT Help Desk'
- }, {
- text: 'Health Care', value: 'Health Care'
- }, {
- text: 'Transportation and Logistics', value: 'Transportation and Logistics'
- }, {
- text: 'Management', value: 'Management'
- }, {
- text: 'Network', value: 'Network'
- }, {
- text: 'Administration', value: 'Administration'
- }, {
- text: 'General', value: 'General'
- }
- ]
- },{
- xtype: 'selectfield',
- label: 'Position Type',
- itemId: 'ptype',
- labelAlign: 'top',
- labelWidth: '100%',
- name: 'ptype',
- options: [{
- text: 'Any', value: 'ANY'
- }, {
- text: 'Part Time', value: 'Part Time'
- }, {
- text: 'Part Time Contract', value: 'Part Time Contract'
- }, {
- text: 'Full Time', value: 'Full Time'
- }, {
- text: 'Full Time Contract', value: 'Full Time Contract'
- }
- ]
- },{
- xtype: 'selectfield',
- label: 'Salary (CAD$): From',
- itemId: 'salaryf',
- labelAlign: 'top',
- labelWidth: '100%',
- name:'salaryf',
- options: [{
- text: 'Any', value: 'ANY'
- }, {
- text: '20000', value: '20000'
- }, {
- text: '30000', value: '30000'
- }, {
- text: '40000', value: '40000'
- },{
- text: '50000', value: '50000'
- }, {
- text: '60000', value: '60000'
- }, {
- text: '70000', value: '70000'
- }, {
- text: '80000', value: '80000'
- }, {
- text: '90000', value: '90000'
- }, {
- text: '100000', value: '100000'
- }, {
- text: '100000+', value: '100000+'
- }
- ]
- },{
- xtype: 'selectfield',
- label: 'to',
- itemId: 'salaryt',
- labelAlign: 'top',
- labelWidth: '100%',
- name: 'salaryto',
- options: [{
- text: 'Any', value: 'ANY'
- }, {
- text: '20000', value: '20000'
- }, {
- text: '30000', value: '30000'
- }, {
- text: '40000', value: '40000'
- },{
- text: '50000', value: '50000'
- }, {
- text: '60000', value: '60000'
- }, {
- text: '70000', value: '70000'
- }, {
- text: '80000', value: '80000'
- }, {
- text: '90000', value: '90000'
- }, {
- text: '100000', value: '100000'
- }, {
- text: '100000+', value: '100000+'
- }
- ]
- },{
- xtype: 'selectfield',
- label: 'Posted in last (Days):',
- itemId: 'dposted',
- labelAlign: 'top',
- labelWidth: '100%',
- name:'dposted',
- options: [{
- text: '30', value: '30'
- }, {
- text: '60', value: '60'
- }, {
- text: '90', value: '90'
- }
- ]
- }
- ],
- dockedItems: [{
- xtype: 'toolbar',
- itemId: 'toolbar',
- dock: 'bottom',
- height: '36',
- items: [
- { xtype: 'button', text: 'Reset',itemId: 'reset',scope: this,
- handler: resetButtonHandler },
- { xtype: 'spacer'},
- { xtype: 'button', text: 'Submit',
- handler: submitButtonHandler }
- ]
- }]
- });
- SearchJobsForm.form.superclass.initComponent.call(this);
- }
- });
- Ext.setup({
- tabletStartupScreen: 'tablet_startup.png',
- phoneStartupScreen: 'phone_startup.png',
- icon: 'icon.png',
- glossOnIcon: false,
- onReady: function(){
- var form = new SearchJobsForm.form();
- form.show();
- //var jobList = new SearchJobsForm.jobsList;
- // jobList.show();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement