Skip to content

Instantly share code, notes, and snippets.

@NoiseEee
Last active August 24, 2016 19:12
Show Gist options
  • Save NoiseEee/130b26b3a4bdf715ae2900a7d664f243 to your computer and use it in GitHub Desktop.
Save NoiseEee/130b26b3a4bdf715ae2900a7d664f243 to your computer and use it in GitHub Desktop.
New Twiddle
import DS from 'ember-data';
import ENV from '../config/environment';
export default DS.JSONAPIAdapter.extend({
host: ENV.apiHost
});
/* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'site-tech-check-in',
environment: environment,
rootURL: '/',
locationType: 'auto',
apiHost: 'http://api.debian-vm/siteTechCheckIn',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
};
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === 'test') {
// Testem prefers this...
ENV.locationType = 'none';
ENV.apiHost = '';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
}
if (environment === 'production') {
ENV.apiHost = 'https://api.realSite.com/siteTechCheckIn';
}
return ENV;
};
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
export default Model.extend({
firstName: DS.attr(),
lastName: DS.attr(),
fullName: Ember.computed('firstName','lastName', function() {
return `${this.get('firstName')} ${this.get('lastName')}`;
}),
equipmentItems: DS.hasMany('equipment-item'),
jobs: DS.hasMany('job'),
key: DS.attr()
});
import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
export default Model.extend({
name: DS.attr(),
key: DS.attr(),
shortName: DS.attr(),
isScanner: DS.attr('boolean'),
isLaser: DS.attr('boolean'),
inventoryCount: DS.attr('number'),
admin: DS.belongsTo('admin')
});
import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
export default Model.extend({
key: DS.attr(),
client: DS.attr(),
contact: DS.attr(),
address: DS.attr(),
jobNumber: DS.attr(),
admin: DS.belongsTo('admin')
});
import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
export default Model.extend({
key: DS.attr(),
name: DS.attr(),
subtext: DS.attr(),
answerRequired: DS.attr('boolean'),
allowMultipleAnswers: DS.attr('boolean'),
displayOrder: DS.attr('number'),
preAnswersHint: DS.attr('string'),
postAnswersHint: DS.attr('string'),
placeholder: DS.attr(),
answerOptions: DS.attr(),
selectedAnswer: DS.attr(),
section: DS.belongsTo('survey-section')
});
import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
export default Model.extend({
name: DS.attr(),
text: DS.attr(),
isRequired: DS.attr('boolean'),
displayOrder: DS.attr(),
survey: DS.belongsTo('survey'),
questions: DS.hasMany('question')
});
import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
export default Model.extend({
name: DS.attr(),
instructions: DS.attr(),
type: DS.attr(),
key: DS.attr(),
sections: DS.hasMany('survey-section')
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('surveys', function() {
this.route('survey', { path: ':id'});
});
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
beforeModel() {
this.transitionTo('surveys');
}
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.store.findAll('survey');
},
redirect(model) {
if(model.get('length') === 1) {
this.transitionTo('surveys.survey', model.get('firstObject'));
}
}
});
import Ember from 'ember';
import RSVP from 'rsvp';
export default Ember.Route.extend({
model(params) {
return RSVP.hash({
survey: this.get('store').findRecord('survey', params.id),
sections: this.get('store').findAll('survey-section', params.id)
});
/*
console.log('Model hook called for `surveys.survey` with ', params.id);
var survey = this.get('store').findRecord('survey', params.id);
return survey;
*/
}
});
<h1>Surveys, eh</h1>
<span>{{#link-to "surveys"}}surveys{{/link-to}}</span>
{{ outlet }}
<ul class="surveys">
{{#each model as |survey|}}
<li>{{#link-to "surveys.survey" survey}}
{{survey.name}}
{{/link-to}}</li>
{{/each}}
</ul>
<div class="survey">
{{ outlet }}
</div>
<div class="page">
<aside>
<header>
<h1>{{ model.admin.fullName }} - Daily Check-In</h1>
<h2>Tuesday August 12, 2016</h2>
</header>
<section class="jobs today">
<h3>Todays Jobs - Check-In before Midnight</h3>
<dl>
<dd>
<a href="#" class="job">
<span class="jobNumber">#M4211</span>
<span class="jobAddress">12 Saunders Lane</span>
</a>
<div class="jobActions">
<button class="jobSurvey complete">Report</button>
<button class="jobUpload complete">Upload</button>
</div>
</dd>
<dd>
<a href="#" class="job">
<span class="jobNumber">#M4211</span>
<span class="jobAddress">12 Saunders Lane</span>
</a>
<div class="jobActions">
<button class="jobSurvey incomplete">Report</button>
<button class="jobUpload complete">Upload</button>
</div>
</dd>
<dd>
<a href="#" class="job">
<span class="jobNumber">#M4211</span>
<span class="jobAddress">12 Saunders Lane</span>
</a>
<div class="jobActions">
<button class="jobSurvey incomplete">Report</button>
<button class="jobUpload incomplete">Upload</button>
</div>
</dd>
<dd class="dailyExpenses"><!--can open, but can't make entries until all surveys and uploads are complete-->
<i>Complete Surveys &amp; Uploads to Unlock</i>
<button class="locked incomplete">Daily Expenses</button>
</dd>
</dl>
</section>
<!--<section class="upcomingJobs">
<dl>
<dt>Upcoming Jobs</dt>
Maybe expand on this later... full head-up info including travel, maps, distance, uploads info etc - tailored for site techs
</dl>
</section>-->
<section class="yourSetup serviceRequestOn">
<h3>My Site Setup</h3>
<!-- database equipment name and serial number which is optional input but doesn't display here - equipment is added to admin/employee module -->
<dl>
<dd>
Leica Disto 5920
</dd>
<dd>
Zeb Revo
</dd>
<dd>
Lenovo T-430 Laptop
</dd>
<dd>
Archicad 19
</dd>
<dd>
FARO Focus X330
</dd>
<dd>
Avenger Stand
</dd>
<dd>
RAM Tough Tray
</dd>
<dd>
Tape Measure
</dd>
<dd>
Panasonic Camera
</dd>
<dd>
2 Medium XM Shirts
</dd>
<dd>
1 Medium XM Sweatshirts
</dd>
</dl>
<button class="toggleTrigger" data-toggletrigger="toggle01">Request Service or Replacement</button>
<div class="toggleContent" data-toggletarget="toggle01">
<textarea placeholder="Please describe the problem"></textarea>
<button>Submit Request</button>
<button>Cancel</button>
</div>
</section>
</aside>
<div class="activeContent">
<header>
<span>{{ survey.name }}</span>
<span>Tuesday, August 12, 2016</span>
<span>Job #M4211</span>
<span>12 Saunders Lane, Toronto, Ontario, Canada</span>
</header>
<div class="scrollBox">
<form id="report">
<section class="step-1 attendance">
<div class="question q01">
<h3>Did you attend this job today as scheduled?</h3>
<label>
<input type="radio" name="delays"/>
Yes
</label>
<label>
<input type="radio" name="delays"/>
No
</label>
</div>
<div class="ifYes">
<i>If Yes...</i>
<div class="question q02">
<h3>Approximately what time did you arrive on-site?</h3>
<input type="time" name="techTimeOnSite">
</div>
<div class="question q03">
<h3>Approximately how many hours were you on-site?</h3>
<input type="number"/>
</div>
</div>
<div class="ifNo">
<i>If No...</i>
<div class="question q04">
<h3>Why not?</h3>
<textarea placeholder="ie. My dog was sick"></textarea>
</div>
<div class="question q05">
<h3>Did you inform the office?</h3>
<div class="answer">
<label>
<input type="radio" name="delays"/>
Yes
</label>
<label>
<input type="radio" name="delays"/>
No
</label>
</div>
</div>
</div>
<button class="advance">Continue...</button>
</section>
<section class="step-2 complexity">
<h3>Rate the overall difficulty of this job today</h3>
<div class="question q01">
<h4>Curves &amp; Angles</h4>
<div class="rating">
<em>Few Curves &amp; Angles</em>
<label class="rating-1">
<input type="radio" name="curvesAngles"/>
<span>1</span>
</label>
<label class="rating-2">
<input type="radio" name="curvesAngles"/>
<span>2</span>
</label>
<label class="rating-3">
<input type="radio" name="curvesAngles"/>
<span>3</span>
</label>
<label class="rating-4">
<input type="radio" name="curvesAngles"/>
<span>4</span>
</label>
<label class="rating-5">
<input type="radio" name="curvesAngles"/>
<span>5</span>
</label>
<em>Many Curves &amp; Angles</em>
</div>
</div>
<div class="question q02">
<h4>Wall Density</h4>
<div class="rating">
<em>Few Walls</em>
<label class="rating-1">
<input type="radio" name="wallDensity"/>
<span>1</span>
</label>
<label class="rating-2">
<input type="radio" name="wallDensity"/>
<span>2</span>
</label>
<label class="rating-3">
<input type="radio" name="wallDensity"/>
<span>3</span>
</label>
<label class="rating-4">
<input type="radio" name="wallDensity"/>
<span>4</span>
</label>
<label class="rating-5">
<input type="radio" name="wallDensity"/>
<span>5</span>
</label>
<em>Many Walls</em>
</div>
</div>
<div class="question q03">
<h4>Level of Detail</h4>
<div class="rating">
<em>Low LOD</em>
<label class="rating-1">
<input type="radio" name="levelOfDetail"/>
<span>1</span>
</label>
<label class="rating-2">
<input type="radio" name="levelOfDetail"/>
<span>2</span>
</label>
<label class="rating-3">
<input type="radio" name="levelOfDetail"/>
<span>3</span>
</label>
<label class="rating-4">
<input type="radio" name="levelOfDetail"/>
<span>4</span>
</label>
<label class="rating-5">
<input type="radio" name="levelOfDetail"/>
<span>5</span>
</label>
<em>High LOD</em>
</div>
</div>
<div class="question q04">
<h4>Building / Room Access</h4>
<div class="rating">
<em>Easy to Access</em>
<label class="rating-1">
<input type="radio" name="access"/>
<span>1</span>
</label>
<label class="rating-2">
<input type="radio" name="access"/>
<span>2</span>
</label>
<label class="rating-3">
<input type="radio" name="access"/>
<span>3</span>
</label>
<label class="rating-4">
<input type="radio" name="access"/>
<span>4</span>
</label>
<label class="rating-5">
<input type="radio" name="access"/>
<span>5</span>
</label>
<em>Hard to Access</em>
</div>
</div>
<button class="advance">Continue...</button>
</section>
<section class="step-3 delay">
<div class="question q01">
<h3>Did you encounter any significant delays on the job?</h3>
<label>
<input type="radio" name="delays"/>
Yes
</label>
<label>
<input type="radio" name="delays"/>
No
</label>
</div>
<div class="ifYes">
<i>If Yes...</i>
<div class="question q02">
<!-- I want to do a fault system here - xmFault, techFault, clientFault, or noFault, but probably not classed like I have it - system shouldn't be inspectable-->
<h3>Why were you delayed?</h3>
<div class="checkList">
<label class="xmFault">
<input type="checkbox">
The building address in the job order is inccorrect or misleading
</label>
<label class="xmFault">
<input type="checkbox">
The job order did not contain adequate entry information
</label>
<label class="techFault">
<input type="checkbox">
At first I couldn't find the building, but I eventually found it
</label>
<label class="clientFault">
<input type="checkbox">
Tenants weren't informed we were coming
</label>
<label class="clientFault">
<input type="checkbox">
Tenants wouldn't let me in
</label>
<label class="clientFault">
<input type="checkbox">
Tenants weren't cooperative
</label>
<label class="clientFault">
<input type="checkbox">
My site contact was late
</label>
<label class="clientFault">
<input type="checkbox">
My site contact didn't show up
</label>
<label class="clientFault">
<input type="checkbox">
Security wouldn't let me in
</label>
<label class="clientFault">
<input type="checkbox">
I had to do safety training/orientation
</label>
<label class="clientFault">
<input type="checkbox">
Construction and/or other hazards prevented access
</label>
<label class="clientFault">
<input type="checkbox">
Parts of the job site were inaccessible or impassable
</label>
<label class="noFault">
<input type="checkbox">
There was heavy traffic
</label>
<label class="noFault">
<input type="checkbox">
There was bad weather
</label>
<label class="techFault">
<input type="checkbox">
My car broke down
</label>
<label class="noFault">
<input type="checkbox">
My flight was delayed
</label>
<label class="techFault">
<input type="checkbox">
I missed my scheduled flight
</label>
<label class="xmFault">
<input type="checkbox">
I had hardware and/or software problems
</label>
<label class="techFault">
<input type="checkbox">
My batteries ran out
</label>
<label class="techFault">
<input type="checkbox">
I was sick
</label>
<label class="techFault">
<input type="checkbox">
I had to attend to a personal/family matter
</label>
<label>
<input type="checkbox">
Other
</label>
<textarea class="delayComment" placeholder="Please elaborate..."></textarea>
</div>
<div class="question q03">
<h3>Approximately how many hours were you delayed in total?</h3>
<input type="number"/>
</div>
</div>
<button class="advance">Continue...</button>
</div>
</section>
<section class="step-4 lasers">
<div class="question q01">
<h3>What lasers do you currently have in your posession?</h3>
<div class="checkList"> <!--prechecked based on previous entry-->
<label>
<input type="checkbox"/>
Leica Disto Distancemeter
</label>
<label>
<input type="checkbox"/>
Zeb Revo Mobile Laser Scanner
</label>
<label>
<input type="checkbox"/>
FARO 130 (grey and silver) 3D Laser Scanner
</label>
<label>
<input type="checkbox"/>
FARO X330 (blue and silver) 3D Laser Scanner
</label>
<label>
<input type="checkbox"/>
Other Scanner - rental, loaner, test-unit etc...
</label>
</div>
</div>
<i>If they have scanners...</i>
<div class="ifScanner">
<div class="question q02">
<h3>Did you use any laser scanners on this job today?</h3>
<label>
<input type="radio" name="useScanners"/>
Yes
</label>
<label>
<input type="radio" name="useScanners"/>
No
</label>
</div>
<div class="ifYes">
<i>if yes...</i>
<div class="question q03">
<h3>Approximately how many scans did you take?</h3>
<div class="checkList">
<!-- list any scanners that they have in their posession -->
<label>
<input type="number" placeholder="Number of Scans"/>
GeoSLAM Zeb Revo Mobile Laser Scanner
</label>
<label>
<input type="number" placeholder="Number of Scans"/>
FARO X330 (blue and silver) 3D Laser Scanner
</label>
</div>
</div>
</div>
</div>
<div class="question q04">
<h3>How are you delivering the scans to the office?</h3>
<div class="checkList">
<label>
<input type="checkbox"/>
Uploading the scans here
</label>
<label>
<input type="checkbox"/>
Uploading the scans to the xmeasures FTP
</label>
<label>
<input type="checkbox"/>
Personally drop off scans a drive
</label>
<label>
<input type="checkbox"/>
Courier/mail scans on a drive
</label>
</div>
</div>
<button class="advance">Continue...</button>
</section>
<section class="step-5 endDate">
<div class="question">
<h3>Did you complete this job today?</h3>
<label>
<input type="radio" name="endJob"/>
Yes, I completed this job today
</label>
<label>
<input type="radio" name="endJob"/>
No, I need more time on-site
</label>
<div class="ifNo">
<i>if no...</i>
<div class="moreTime">
<h3>Estimate the number of work days you need to complete site work
<br/>
and adjust your scheduled end-date if required.
</h3>
<div class="datePicker">
<div class="back timeShift"></div>
<div class="month m1"></div>
<div class="month m2"></div>
<div class="forward timeShift"></div>
</div>
</div>
</div>
</div>
<input type="submit" value="Submit Report"/>
</section>
</form>
<form id="uploads">
<section class="uploader">
<h3>Upload Files to Office</h3>
<div class="uploadMachine">
<div class="uploadDrop">
<div id="uploadProgress" class="progress" style="display:none">
<span role="progressbar" class="meter" style="width: 2%"></span>
</div>
<p>Drag and Drop File</p>
</div>
<div class="fileControl">
<select class="fileCategorize">
<option>Daily Backup</option>
<option>Final - Post Processing</option>
<option>Photographs</option>
<option>Site Support</option>
</select>
<textarea class="fileUploadNote">File Note</textarea>
<button>Upload File</button>
</div>
</div>
</section>
<section class="uploaded">
<h3>Files Uploaded</h3><!--latest to oldest-->
<dl>
<!-- show recent files to older -->
<!-- don't show category if no files -->
<dt>Final - Post Processing</dt>
<dd>
<ul>
<li>Filename</li>
<li>Uploaded By</li>
<li>Timestamp</li>
<li>Notes</li>
<li>Delete</li>
</ul>
</dd>
<dt>Photographs</dt>
<dd>
<ul>
<li>Filename</li>
<li>Uploaded By</li>
<li>Timestamp</li>
<li>Notes</li>
<li>Delete</li>
</ul>
</dd>
<dt>Site Support</dt>
<dd>
<ul>
<li>Filename</li>
<li>Uploaded By</li>
<li>Timestamp</li>
<li>Notes</li>
<li>Delete</li>
</ul>
</dd>
<dt>Daily Backup</dt>
<dd>
<ul>
<li>Filename</li>
<li>Uploaded By</li>
<li>Timestamp</li>
<li>Notes</li>
<li>Delete</li>
</ul>
</dd>
</dl>
</section>
</form>
<form id="expenses">
<h3>Expenses</h3>
<table class="todaysExpenses">
<thead>
<tr>
<td>Date</td>
<td>Project</td>
<td>Overnight</td>
<td>Overtime Hours</td>
<td>Kilometers</td>
<td>Parking Costs</td>
<td>Other Costs</td>
<td>Notes</td>
</tr>
</thead>
<tbody>
<tr>
<td>Wed Jun 1, 16</td>
<td>12 Saunders Lane</td>
<td>
<input type="checkbox"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<textarea></textarea>
</td>
</tr>
<tr>
<td>Wed Jun 1, 16</td>
<td>12 Saunders Lane</td>
<td>
<input type="checkbox"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<textarea></textarea>
</td>
</tr>
<tr>
<td>Wed Jun 1, 16</td>
<td>12 Saunders Lane</td>
<td>
<input type="checkbox"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<textarea></textarea>
</td>
</tr>
</tbody>
</table>
<div id="expenseControl">
<button>Add a Job</button>
<button>Submit Expenses</button>
</div>
<table id="submittedExpenses">
<thead>
<tr>
<td>Date</td>
<td>Project</td>
<td>Overnight</td>
<td>Overtime Hours</td>
<td>Kilometers</td>
<td>Parking Costs</td>
<td>Other Costs</td>
<td>Notes</td>
</tr>
</thead>
<tbody>
<tr>
<td>Wed Jun 1, 16</td>
<td>12 Saunders Lane</td>
<td>
<input type="checkbox" disabled/>
</td>
<td>
<input type="text" disabled/>
</td>
<td>
<input type="text" disabled/>
</td>
<td>
<input type="text" disabled/>
</td>
<td>
<input type="text" disabled/>
</td>
<td>
<textarea disabled></textarea>
</td>
</tr>
<tr>
<td>Wed Jun 1, 16</td>
<td>12 Saunders Lane</td>
<td>
<input type="checkbox" disabled/>
</td>
<td>
<input type="text" disabled/>
</td>
<td>
<input type="text" disabled/>
</td>
<td>
<input type="text" disabled/>
</td>
<td>
<input type="text" disabled/>
</td>
<td>
<textarea disabled></textarea>
</td>
</tr>
<tr>
<td>Wed Jun 1, 16</td>
<td>12 Saunders Lane</td>
<td>
<input type="checkbox" disabled/>
</td>
<td>
<input type="text" disabled/>
</td>
<td>
<input type="text" disabled/>
</td>
<td>
<input type="text" disabled/>
</td>
<td>
<input type="text" disabled/>
</td>
<td>
<textarea disabled></textarea>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div>
{
"version": "0.10.4",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment