Skip to content

Commit

Permalink
techs now from a comma seperated attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
cchance27 committed Apr 14, 2020
1 parent 1af9e42 commit 8ae7c0f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
TODO:
- Migrate the fixed technicians to a span or some other more modifiable method
- Possibility to add google calendar creation trigger
- Possibility to trigger email to technician
7 changes: 2 additions & 5 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ class cnArcherWorkorder extends HTMLElement {
constructor() {
super();
// Technicians that will be populated into the tech drop down of the modal window.
this.techNames = [
"Andy",
"Malcolm"
];
this.techNames = this.getAttribute('techs').split(',');

// Put all our attributes in a object we can pass around and access easily.
// Some basic cleanup like removing netherlands antilles, and removing - from phone to be compatible with cnArcher import.
Expand Down Expand Up @@ -80,7 +77,7 @@ class cnArcherWorkorder extends HTMLElement {
blank.disabled = true;
blank.appendChild(document.createTextNode("Select..."));
technician.appendChild(blank);

// Fill in the technicians in the option drop down from the techNames array.
this.techNames.forEach(tech => {
var tOpt = document.createElement("option", { value: tech });
Expand Down
3 changes: 2 additions & 1 deletion static/pageextension-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cnJS.src = '/adminPortal/cnArcher/bundle.js'; // After our bundle has been loade
cnJS.onload = function () {
console.log('cnArcher Bundle Loaded...');
var cnFirmware = "16.2.1";
var technicians = "Tech1,Tech2,Tech3";
var cnDevices = [].slice.call(document.getElementsByClassName('noticeicon'));
var cnName = document.querySelector("#DetailsContactName").innerText;
var cnCompany = document.querySelector("#DetailsContactCompany") != null ? document.querySelector("#DetailsContactCompany").innerText : '';
Expand All @@ -25,7 +26,7 @@ cnJS.onload = function () {
var cnUser = match !== null ? match[1] : '';
match = item.outerHTML.match(/VlanID = ([\d]{1,3})/);
var cnVlan = match !== null ? match[1] : '';
item.insertAdjacentHTML("afterend", "<cn-workorder esn=\"".concat(cnEsn, "\" name=\"").concat(cnName, "\" company=\"").concat(cnCompany, "\" accid=\"").concat(cnAccId, "\" address=\"").concat(cnAddress, "\" eip=\"").concat(cnEIPAcc, "\" phone=\"").concat(cnPhone, "\" package=\"").concat(cnPackage, "\" firmware=\"").concat(cnFirmware, "\" username=\"").concat(cnUser, "\" password=\"").concat(cnPass, "\" vlan=\"").concat(cnVlan, "\"></cn-workorder>"));
item.insertAdjacentHTML("afterend", "<cn-workorder esn=\"".concat(cnEsn, "\" name=\"").concat(cnName, "\" techs=\"").concat(technicians, "\" company=\"").concat(cnCompany, "\" accid=\"").concat(cnAccId, "\" address=\"").concat(cnAddress, "\" eip=\"").concat(cnEIPAcc, "\" phone=\"").concat(cnPhone, "\" package=\"").concat(cnPackage, "\" firmware=\"").concat(cnFirmware, "\" username=\"").concat(cnUser, "\" password=\"").concat(cnPass, "\" vlan=\"").concat(cnVlan, "\"></cn-workorder>"));
};
});
};
Expand Down
1 change: 1 addition & 0 deletions static/sample.htm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</head>
<body>
<cn-workorder
techs="bob,chris,james,west,someone"
esn="00-0a-04-44-44-55"
name="Bob West"
address="Somewhere Rd, Sint Maarten, Netherlands Antilles"
Expand Down

0 comments on commit 8ae7c0f

Please sign in to comment.