Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function () {
- var t = {
- "# of Dye Lot batches": 18,
- "# of Dye Lots/meter": 19,
- "% of Cotton in the Fabric": 20,
- "Care label information": "",
- "Fabric / Yarn Mill Order #": 15,
- "Fabric / Yarn Mill Ref #": 16,
- "Fabric or Yarn Mill Name": 14,
- "Factory Code": 13,
- "Factory Name": 12,
- "Finished Garment Weight / Fabric GSM": 7,
- "Meter of Fabric Ordered for the PO": 17,
- "Mills Oeko Tex Ref #": 1,
- "Package name": "",
- "Previous report No": 9,
- "RAG BRAND": 2,
- "RAG PO #": 4,
- "RAG Style #": 3,
- "Shipment Date": 5,
- "Size": "",
- "Supplier Code": 11,
- "Supplier Name": 10,
- "Test request": "",
- "Yarn Content %": 8,
- "Yarn Count / Construction Required": 6
- };
- var fluid = document.querySelectorAll("#customFieldForm .row-fluid")[2];
- var adddiv = document.createElement("div");
- adddiv.style = "margin-bottom:10px;";
- Array.from(fluid.querySelectorAll(".col-sm-5,.col-md-5,.col-sm-7")).filter(e => e.parentNode === fluid).forEach(e => {
- adddiv.appendChild(e.cloneNode(true));
- e.parentNode.removeChild(e);
- });
- fluid.appendChild(adddiv);
- var saver = [], sink = [],idx = 1;
- fluid.querySelectorAll(".col-md-5,.col-sm-5").forEach(e => {
- if (t.hasOwnProperty(e.innerText)) {
- if (typeof t[e.innerText] == "number") {
- saver.push({
- order: t[e.innerText],
- html: e.parentNode.innerHTML
- });
- e.parentNode.setAttribute("id", `orderid-${idx++}`);
- e.parentNode.innerHTML = "";
- }
- else {
- sink.push(e.parentNode.cloneNode(true));
- fluid.removeChild(e.parentNode);
- }
- }
- });
- saver.sort((a, b) => a.order - b.order).forEach(e => {
- fluid.querySelector(`#orderid-${e.order}`).innerHTML = e.html;
- });
- sink.forEach(e => {
- fluid.appendChild(e);
- });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement