Last active
July 8, 2024 01:02
-
-
Save NaveenDA/64c8ce07461e0c2f9feb6dabd1dcf00a to your computer and use it in GitHub Desktop.
stem infra template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Stem's Infra Template | |
// @namespace http://tampermonkey.net/ | |
// @source https://gist.github.com/NaveenDA/64c8ce07461e0c2f9feb6dabd1dcf00a | |
// @updateURL https://gist.githubusercontent.com/raw/64c8ce07461e0c2f9feb6dabd1dcf00a/main.js | |
// @downloadURL https://gist.githubusercontent.com/raw/64c8ce07461e0c2f9feb6dabd1dcf00a/main.js | |
// @version 2024-07-12 | |
// @description try to take over the world! | |
// @author naveenda | |
// @match https://web.whatsapp.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=whatsapp.com | |
// @run-at document-idle | |
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js | |
// ==/UserScript== | |
(function () { | |
"use strict"; | |
let dataImage = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAIAAAC1w6d9AAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAACAxJREFUeJzt13tMW9cZAPBsk/bQNlWVWmnaX6s0TdoqTdpUddXWbZWSVI06YCFLCiNv0qQUSCClJCENjAbWQJuShEASTAgJj4YmECCERwzjYRy/jY0xxk/84Pr9uva1r+/1tdlnbuZQOh5Ok3bS+HR0dDncc+7vnnO+c+UN8/+rseGbBiwb67LEY12WeKzLEo91WeLxfyajyIBHx4ISjYQfe5AnJYuSASdq4FhEjdr+InXvCa+eg3vnHDP9j437qjICNbkVXXOsSm3PYcXnu6bbdlrETeGg26UelN86KL6WapHc/lplYczmlDaaBgu13ZmaO3tV7XuUt3fPsc/hbj1mndIOlEiubxM3pAgZSQJGsk3WPR+Nfh0yKuS1sssMvYdme96mZbrePFTPgqmySVoUtzKlN/4maUx9KK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ZMSgRgRhqkDEl4gmdhqea6XjAUiFzjUMDoFyD7BGRiobhS/KFL9q00aAwGS/33ZXOaq0eN9S9Ir7RYYcjHqywslAgJWFKRqcmoUUyqwUuzA2c0nC8Tep1MMigRDwsk0BishVy6As3JCj75mJdlnisyxKPdVnisS5LPNZlice/ATy4gUJixr6ZAAAAAElFTkSuQmCC`; | |
const style = ` | |
.stem-table { | |
margin-top: 3px; | |
width: 100%; | |
border-collapse: collapse; | |
} | |
.stem-table td { | |
padding: 5px 10px; | |
border: 1px solid #c9c9c9; | |
} | |
.stem-table tr:nth-child(odd) { | |
background-color: #f2f2f2; | |
} | |
.stem-table tr:nth-child(even) { | |
background-color: #fff; | |
} | |
.stem-table input { | |
width: 90%; | |
padding: 5px; | |
border: 1px solid #c9c9c9; | |
} | |
.stem-table tr td:first-child { | |
width: 50%; | |
} | |
.stem-table tr:hover { | |
background-color: #4caf5045; | |
} | |
[data-stem-modal="true"] h1 { | |
margin: 10px 0; | |
} | |
[data-stem-modal="true"] h2 { | |
margin: 5px 0; | |
font-weight: bold; | |
margin-top: 16px; | |
} | |
input[type="date"]::-webkit-calendar-picker-indicator { | |
background: transparent; | |
bottom: 0; | |
color: transparent; | |
cursor: pointer; | |
height: auto; | |
left: 0; | |
position: absolute; | |
right: 0; | |
top: 0; | |
width: auto; | |
} | |
`; | |
function insertTextWithNewlines(text) { | |
const textarea = document.querySelector('#main div[contenteditable="true"]'); // WhatsApp Web's input box | |
if (!textarea) return; | |
const lines = text.split("\n"); | |
console.log(lines.length); | |
for (let i = 0; i < lines.length; i++) { | |
// Insert text using the `document.execCommand` API | |
document.execCommand("insertText", false, lines[i]); | |
// skip last line | |
if (i === lines.length - 1) continue; | |
const shiftEnterEvent = new KeyboardEvent("keydown", { | |
bubbles: true, | |
cancelable: true, | |
key: "Enter", | |
code: "Enter", | |
shiftKey: true, | |
}); | |
textarea.dispatchEvent(shiftEnterEvent); | |
} | |
} | |
// Your code here... | |
// data-icon="attach-menu-plus" | |
let selector = 'span[data-icon="attach-menu-plus"]'; | |
jQuery("body").on("click", "[data-sales-report]", function () { | |
// add backdrop to the body | |
jQuery("body").append( | |
'<div style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 999999999;" data-stem-background="true"></div>', | |
); | |
/** | |
⭐ 1 Star | |
🚀 T͟O͟D͟A͟Y͟ ͟S͟A͟L͟E͟S͟ ͟R͟E͟P͟O͟R͟T͟ | |
Date: 06/07/2024 | |
Day: Saturday | |
🎯 TODAY | |
Material = 717.87 MT | |
Boulders = 2466.94 MT | |
🎯 WEEKLY GROWTH (7/7) | |
6475.53 / 15000 | |
🎯 MONTHLY GROWTH (06/30) | |
= 6304.38 / 60000 | |
📈 D͟A͟I͟L͟Y͟ | |
❒ Sunday - 171.15 | |
❒ Monday - 938.98 | |
❒ Tuesday - 752.64 | |
❒ Wednesday - 1214.86 | |
❒ Thursday - 1521.88 | |
❒ Friday - 1158.15 | |
❒ Saturday - 717.87 | |
📈 W͟E͟E͟K͟L͟Y͟ | |
➢ Week 1 - 6475.53 | |
➢ Week 2 - | |
➢ Week 3 - | |
➢ Week 4 - | |
➢ Week 5 - | |
🪨 M͟A͟T͟E͟R͟I͟A͟L͟ ͟R͟E͟P͟O͟R͟T͟ | |
TOTAL TRIP = 24 | |
1) 12+20 MM - 11 Trip |Ton 339.98 MT | |
2) 12 MM- Trip | Ton MT | |
3) All Mix GSB - Trip | Ton MT | |
4) DUST - 4 Trip | Ton | |
150.25 MT | |
5) 6 MIX- 7 Trip | Ton 181.59 MT | |
6) 6MM - Trip | Ton MT | |
7) 20 MM - Trip 2 | Ton 46.05 MT | |
8) WMM - Trip | Ton MT | |
9) Boulders - 83 Trip | Ton 2466.94 MT | |
10) Soil - Trip | Ton MT | |
Remarks | |
| Rating | Production | | |
| ------ | ---------- | | |
| No Star | 0 - 500 | | |
| 1 Star | 501 - 1000 | | |
| 2 Star | 1001 - 1500 | | |
| 3 Star | 1501 - 2000 | | |
| 4 Star | 2001 - 2500 | | |
| 5 Star | 2501 - More | | |
*/ | |
// number of weeks in the current month | |
const today = new Date(); | |
const dd = String(today.getDate()).padStart(2, "0"); | |
const mm = String(today.getMonth() + 1).padStart(2, "0"); //January is 0! | |
const yyyy = today.getFullYear(); | |
const number_of_weeks = Math.ceil(today.getDate() / 7); | |
// week_day_count: sunday is 7, monday is 1, tuesday is 2, wednesday is 3, thursday is 4, friday is 5, saturday is 6 | |
const week_day_count = today.getDay() + 1; | |
// total number of days in the current month | |
const total_days = new Date(today.getFullYear(), today.getMonth() + 1, 0).getDate(); | |
// total weeks in the current month | |
const total_weeks = Math.ceil(total_days / 7); | |
const contnet = `<style> | |
${style} | |
</style> | |
<div class="input-container" style="background-color: white; padding:0px; z-index: 9999999999; width:60vw;color:#000;" | |
data-stem-modal="true" data-stem-main="true"> | |
<h2>🚀 S͟A͟L͟E͟S͟ ͟R͟E͟P͟O͟R͟T͟</h2> | |
<div style=" | |
text-align: right; | |
position: relative; | |
top: -20px; | |
"> | |
<input data-date-sales="true" type="date" name="date" style="position:relative;" id="date" value="${yyyy}-${mm}-${dd}"> | |
</div> | |
<div style="display: flex; gap: 12px;"> | |
<div style="width: 50%;"> | |
<h2>🎯 TODAY</h2> | |
<table class="stem-table"> | |
<tbody> | |
<tr> | |
<td>Material</td> | |
<td><input type="text" name="material" id="material" value="0" autofocus /></td> | |
</tr> | |
<tr> | |
<td>Boulders</td> | |
<td><input type="text" name="boulders" id="boulders" value="0" /></td> | |
</tr> | |
</tbody> | |
</table> | |
<h2>🎯 WEEKLY GROWTH (<span id="week_day_count">${week_day_count}</span>/7)</h2> | |
<table class="stem-table"> | |
<tbody> | |
<tr> | |
<td style="display: flex; width: auto; gap: 4px; align-items: center;"> | |
<input type="text" name="weekly_growth" id="weekly_growth" value="0" style="width: 50%;" /> / <input type="text" name="weekly_total" id="weekly_total" value="0" style="width: 50%;" /> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
<h2>🎯 MONTHLY GROWTH <span id="monthly-growth">(${mm + "/" + total_days})</span></h2> | |
<table class="stem-table"> | |
<tbody> | |
<tr> | |
<td style="display: flex; width: auto; align-items: center; gap: 5px;"> | |
<input type="text" name="monthly_growth" id="monthly_growth" value="0" /> / <input type="text" name="monthly_total" id="monthly_total" value="0" /> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
<h2>📈 D͟A͟I͟L͟Y͟</h2> | |
<table class="stem-table"> | |
<tbody> | |
<tr> | |
<td>Sunday</td> | |
<td><input type="text" name="sunday" id="sunday" value="0" /></td> | |
</tr> | |
<tr> | |
<td>Monday</td> | |
<td><input type="text" name="monday" id="monday" value="0" /></td> | |
</tr> | |
<tr> | |
<td>Tuesday</td> | |
<td><input type="text" name="tuesday" id="tuesday" value="0" /></td> | |
</tr> | |
<tr> | |
<td>Wednesday</td> | |
<td><input type="text" name="wednesday" id="wednesday" value="0" /></td> | |
</tr> | |
<tr> | |
<td>Thursday</td> | |
<td><input type="text" name="thursday" id="thursday" value="0" /></td> | |
</tr> | |
<tr> | |
<td>Friday</td> | |
<td><input type="text" name="friday" id="friday" value="0" /></td> | |
</tr> | |
<tr> | |
<td>Saturday</td> | |
<td><input type="text" name="saturday" id="saturday" value="0" /></td> | |
</tr> | |
</tbody> | |
</table> | |
<h2>📈 W͟E͟E͟K͟L͟Y͟</h2> | |
<table class="stem-table"> | |
<tbody> | |
${Array.from({ length: total_weeks }).map((_, i) => `<tr> | |
<td>Week ${i + 1}</td> | |
<td><input type="text" name="week_${i + 1}" id="week_${i + 1}" value="0" /></td> | |
</tr>`).join("")} | |
</tbody> | |
</table> | |
</div> | |
<div style="width: 50%;"> | |
<h2>🪨 M͟A͟T͟E͟R͟I͟A͟L͟ ͟R͟E͟P͟O͟R͟T͟</h2> | |
<table class="stem-table"> | |
<tbody> | |
<tr> | |
<td>Total Trip</td> | |
<td><input type="text" name="total_trip" id="total_trip" value="0" /></td> | |
</tr> | |
<tr> | |
<td>12+20 MM</td> | |
<td style="display: flex; width: auto; align-items: center; gap: 5px;"> | |
<input type="text" name="mm_12_20_trip" id="mm_12_20_trip" value="" placeholder="Trip" style="width: 50%;" /> | <input type="text" name="mm_12_20_ton" id="mm_12_20_ton" value="" placeholder="Ton" style="width: 50%;" /> | |
</td> | |
</tr> | |
<tr> | |
<td>12 MM</td> | |
<td style="display: flex; width: auto; align-items: center; gap: 5px;"> | |
<input type="text" name="mm_12_trip" id="mm_12_trip" value="" placeholder="Trip" style="width: 50%;" /> | <input type="text" name="mm_12_ton" id="mm_12_ton" value="" placeholder="Ton" style="width: 50%;" /> | |
</td> | |
</tr> | |
<tr> | |
<td>All Mix GSB</td> | |
<td style="display: flex; width: auto; align-items: center; gap: 5px;"> | |
<input type="text" name="mix_trip" id="mix_trip" value="" placeholder="Trip" style="width: 50%;" /> | <input type="text" name="mix_ton" id="mix_ton" value="" placeholder="Ton" style="width: 50%;" /> | |
</td> | |
</tr> | |
<tr> | |
<td>DUST</td> | |
<td style="display: flex; width: auto; align-items: center; gap: 5px;"> | |
<input type="text" name="dust_trip" id="dust_trip" value="" placeholder="Trip" style="width: 50%;" /> | <input type="text" name="dust_ton" id="dust_ton" value="" placeholder="Ton" style="width: 50%;" /> | |
</td> | |
</tr> | |
<tr> | |
<td>6 MIX</td> | |
<td style="display: flex; width: auto; align-items: center; gap: 5px;"> | |
<input type="text" name="mix_6_trip" id="mix_6_trip" value="" placeholder="Trip" style="width: 50%;" /> | <input type="text" name="mix_6_ton" id="mix_6_ton" value="" placeholder="Ton" style="width: 50%;" /> | |
</td> | |
</tr> | |
<tr> | |
<td>6MM</td> | |
<td style="display: flex; width: auto; align-items: center; gap: 5px;"> | |
<input type="text" name="mm_6_trip" id="mm_6_trip" value="" placeholder="Trip" style="width: 50%;" /> | <input type="text" name="mm_6_ton" id="mm_6_ton" value="" placeholder="Ton" style="width: 50%;" /> | |
</td> | |
</tr> | |
<tr> | |
<td>20 MM</td> | |
<td style="display: flex; width: auto; align-items: center; gap: 5px;"> | |
<input type="text" name="mm_20_trip" id="mm_20_trip" value="" placeholder="Trip" style="width: 50%;" /> | <input type="text" name="mm_20_ton" id="mm_20_ton" value="" placeholder="Ton" style="width: 50%;" /> | |
</td> | |
</tr> | |
<tr> | |
<td>WMM</td> | |
<td style="display: flex; width: auto; align-items: center; gap: 5px;"> | |
<input type="text" name="wmm_trip" id="wmm_trip" value="" placeholder="Trip" style="width: 50%;" /> | <input type="text" name="wmm_ton" id="wmm_ton" value="" placeholder="Ton" style="width: 50%;" /> | |
</td> | |
</tr> | |
<tr> | |
<td>Boulders</td> | |
<td style="display: flex; width: auto; align-items: center; gap: 5px;"> | |
<input type="text" name="boulders_trip" id="boulders_trip" value="" placeholder="Trip" style="width: 50%;" /> | <input type="text" name="boulders_ton" id="boulders_ton" value="" placeholder="Ton" style="width: 50%;" /> | |
</td> | |
<tr> | |
<td>Soil</td> | |
<td style="display: flex; width: auto; align-items: center; gap: 5px;"> | |
<input type="text" name="soil_trip" id="soil_trip" value="" placeholder="Trip" style="width: 50%;" /> | <input type="text" name="soil_ton" id="soil_ton" value="" placeholder="Ton" style="width: 50%;" /> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
<h2>Remarks</h2> | |
<textarea name="remarks" id="remarks" cols="30" rows="21" style="width: 100%;"></textarea> | |
</div> | |
</div> | |
`; | |
// add modal to the body | |
jQuery("body").append( | |
`<div style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: white; padding: 20px; z-index: 9999999999; width:60vw; height:80vh; overflow:hidden; overflow-y:auto; box-shadow: 0 17px 50px 0 rgba(11, 20, 26, .19), 0 12px 15px 0 rgba(11, 20, 26, .24); | |
border-radius: 12px;" data-stem-modal="true"> | |
${contnet} | |
<div style="width:100%;text-align:right;"> | |
<button | |
data-stem-close="true" | |
style="padding: 10px 20px; border: 1px solid #0b141a !important; border: none; cursor: pointer; border-radius: 5px;">Close</button> | |
| |
<button | |
data-submit-sales="true" | |
style="padding: 10px 20px; background-color: #4CAF50; color: white; border: none; cursor: pointer; border-radius: 5px;">Submit</button> | |
</div> | |
</div>`, | |
); | |
setTimeout(() => { | |
jQuery("#material").focus(); | |
}, 100); | |
}); | |
jQuery("body").on("click", "[data-operational-report]", function () { | |
// add backdrop to the body | |
jQuery("body").append( | |
'<div style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 999999999;" data-stem-background="true"></div>', | |
); | |
/** | |
* | |
👷🏼♂️ O͟P͟E͟R͟A͟T͟I͟O͟N͟A͟L͟ ͟R͟E͟P͟O͟R͟T͟ | |
Date: 03/07/2024 | |
Day: Wednesday | |
⏳ K͟P͟I͟s | |
➪ J-Ton per Hour = 105.97 | |
➪ C-Ton per Hour = 104.52 | |
➪ Trip per hour = 3.58 | |
➪ Quarry Today = 1536.58 | |
➪ Quarry Weekly (4/7) = 5424.66 | |
➪ Quarry Monthly (03/31) = 4437.17 | |
================= | |
🏭 C͟R͟U͟S͟H͟E͟R | |
➢ JAW D/N Hours = 14.5 | |
➢ CONE D/N Hours = 14.7 | |
➢ LABOUR | |
❒ Day - 6 | |
❒ Night - 6 | |
============= | |
⛰️ Q͟U͟A͟R͟R͟Y͟ | |
🪨 BOULDERS TO CRUSHER | |
➢ Total Trips = 52 Trips | |
➢ Total Tons = | |
1536.58 MT | |
🗜️ COMPRESSOR | |
Holes = 1311 | |
Feet = 6530 | |
💥 BLASTING | |
Time = 6 PM | |
🚚 TIPPER | |
Working = 3 | |
Halt = 0 | |
Shed = 1 | |
🚜 MACHINERY | |
Working = 5 | |
Halt = 1 | |
Shed = 1 | |
*/ | |
// today's date in dd/mm/yyyy format | |
const today = new Date(); | |
const dd = String(today.getDate()).padStart(2, "0"); | |
const mm = String(today.getMonth() + 1).padStart(2, "0"); //January is 0! | |
const yyyy = today.getFullYear(); | |
const contnet = `<style> | |
${style} | |
</style> | |
<div class="input-container" style="background-color: white; padding:0px; z-index: 9999999999; width:60vw;color:#000;" | |
data-stem-modal="true" data-stem-main="true"> | |
<h1>👷🏼♂️ O͟P͟E͟R͟A͟T͟I͟O͟N͟A͟L͟ ͟R͟E͟P͟O͟R͟T͟</h1> | |
<div style=" | |
text-align: right; | |
position: relative; | |
top: -20px; | |
"> | |
<input type="date" name="date" style="position:relative;" id="date" value="${yyyy}-${mm}-${dd}"> | |
</div> | |
<div style="display:flex;gap:12px;"> | |
<div style="width:50%"> | |
<h2>⏳ K͟P͟I͟s</h2> | |
<table class="stem-table"> | |
<tr> | |
<td>J-Ton per Hour</td> | |
<td><input type="text" name="jton" id="jton" value="0" autofocus></td> | |
</tr> | |
<tr> | |
<td> C-Ton per Hour</td> | |
<td><input type="text" name="cton" id="cton" value="0"></td> | |
</tr> | |
<tr> | |
<td> Trip per hour</td> | |
<td><input type="text" name="trip" id="trip" value="0"></td> | |
</tr> | |
<tr> | |
<td> Quarry Today</td> | |
<td><input type="text" name="quarry_today" id="quarry_today" value="0"></td> | |
</tr> | |
<tr> | |
<td> Quarry Weekly</td> | |
<td><input type="text" name="quarry_weekly" id="quarry_weekly" value="0"></td> | |
</tr> | |
<tr> | |
<td> Quarry Monthly</td> | |
<td><input type="text" name="quarry_monthly" id="quarry_monthly" value="0"></td> | |
</tr> | |
</table> | |
</div> | |
<div style="width:50%"> | |
<h2>🏭 C͟R͟U͟S͟H͟E͟R</h2> | |
<table class="stem-table"> | |
<tr> | |
<td>JAW D/N Hours</td> | |
<td><input type="text" name="jaw" id="jaw" value="0"></td> | |
</tr> | |
<tr> | |
<td>CONE D/N Hours</td> | |
<td><input type="text" name="cone" id="cone" value="0"></td> | |
</tr> | |
<tr> | |
<td>LABOUR</td> | |
<td> | |
<ul style="padding:0;"> | |
<li>Day <input type="text" name="day" id="day" value="0"></li> | |
<li>Night <input type="text" name="night" id="night" value="0"></li> | |
</ul> | |
</td> | |
</tr> | |
</table> | |
</div> | |
</div> | |
<h1>⛰️ Q͟U͟A͟R͟R͟Y͟</h1> | |
<div style="display:flex;gap:12px;"> | |
<div style="width:50%"> | |
<h2>🪨 BOULDERS TO CRUSHER</h2> | |
<table class="stem-table"> | |
<tr> | |
<td>Total Trips</td> | |
<td><input type="text" name="total_trips" id="total_trips" value="0"></td> | |
</tr> | |
<tr> | |
<td>Total Tons</td> | |
<td><input type="text" name="total_tons" id="total_tons" value="0"></td> | |
</tr> | |
</table> | |
<h2>💥 BLASTING</h2> | |
<table class="stem-table"> | |
<tr> | |
<td>Time</td> | |
<td><input type="text" name="time" id="time" value="0"></td> | |
</tr> | |
</table> | |
<h2>🚜 MACHINERY</h2> | |
<table class="stem-table"> | |
<tr> | |
<td>Working</td> | |
<td><input type="text" name="working" id="working" value="0"></td> | |
</tr> | |
<tr> | |
<td>Halt</td> | |
<td><input type="text" name="halt" id="halt" value="0"></td> | |
</tr> | |
<tr> | |
<td>Shed</td> | |
<td><input type="text" name="shed" id="shed" value="0"></td> | |
</tr> | |
</table> | |
</div> | |
<div style="width:50%"> | |
<h2>🗜️ COMPRESSOR</h2> | |
<table class="stem-table"> | |
<tr> | |
<td>Holes</td> | |
<td><input type="text" name="holes" id="holes" value="0"></td> | |
</tr> | |
<tr> | |
<td>Feet</td> | |
<td><input type="text" name="feet" id="feet" value="0"></td> | |
</tr> | |
</table> | |
<h2>🚚 TIPPER</h2> | |
<table class="stem-table"> | |
<tr> | |
<td>Working</td> | |
<td><input type="text" name="working" id="working" value="0"></td> | |
</tr> | |
<tr> | |
<td>Halt</td> | |
<td><input type="text" name="halt" id="halt" value="0"></td> | |
</tr> | |
<tr> | |
<td>Shed</td> | |
<td><input type="text" name="shed" id="shed" value="0"></td> | |
</tr> | |
</table> | |
</div> | |
</div> | |
</div> | |
`; | |
// add modal to the body | |
jQuery("body").append( | |
`<div style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: white; padding: 20px; z-index: 9999999999; width:60vw; height:80vh; overflow:hidden; overflow-y:auto; box-shadow: 0 17px 50px 0 rgba(11, 20, 26, .19), 0 12px 15px 0 rgba(11, 20, 26, .24); | |
border-radius: 12px;" data-stem-modal="true"> | |
${contnet} | |
<div style="width:100%;text-align:right;"> | |
<button | |
data-stem-close="true" | |
style="padding: 10px 20px; border: 1px solid #0b141a !important; border: none; cursor: pointer; border-radius: 5px;">Close</button> | |
| |
<button | |
data-submit-operantional="true" | |
style="padding: 10px 20px; background-color: #4CAF50; color: white; border: none; cursor: pointer; border-radius: 5px;">Submit</button> | |
</div> | |
</div>`, | |
); | |
setTimeout(() => { | |
jQuery("#jton").focus(); | |
}, 100); | |
}); | |
// close | |
jQuery("body").on("click", "[data-stem-close]", function () { | |
jQuery("[data-stem-modal]").remove(); | |
jQuery("[data-stem-background]").remove(); | |
}); | |
// submit - operational | |
jQuery("body").on("click", "[data-submit-operational]", function () { | |
// remove the previous alert | |
// get all the input values | |
const date = jQuery("#date").val(); | |
const jton = jQuery("#jton").val(); | |
const cton = jQuery("#cton").val(); | |
const trip = jQuery("#trip").val(); | |
const quarry_today = jQuery("#quarry_today").val(); | |
const quarry_weekly = jQuery("#quarry_weekly").val(); | |
const quarry_monthly = jQuery("#quarry_monthly").val(); | |
const jaw = jQuery("#jaw").val(); | |
const cone = jQuery("#cone").val(); | |
const day = jQuery("#day").val(); | |
const night = jQuery("#night").val(); | |
const total_trips = jQuery("#total_trips").val(); | |
const total_tons = jQuery("#total_tons").val(); | |
const time = jQuery("#time").val(); | |
const working = jQuery("#working").val(); | |
const halt = jQuery("#halt").val(); | |
const shed = jQuery("#shed").val(); | |
const holes = jQuery("#holes").val(); | |
const feet = jQuery("#feet").val(); | |
const selected_date = new Date(date); | |
const selected_day = selected_date.getDay() || 0; | |
const days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; | |
const dd = String(selected_date.getDate()).padStart(2, "0"); | |
const mm = String(selected_date.getMonth() + 1).padStart(2, "0"); //January is 0! | |
const yyyy = selected_date.getFullYear(); | |
// if there is no date selected show the alert | |
if (!date) { | |
alert("Please select the date"); | |
return; | |
} | |
// week number sunday = 1, | |
const week_number = Math.ceil(selected_date.getDate() / 7); | |
// number of days in the current month | |
const number_of_days = new Date( | |
selected_date.getFullYear(), | |
selected_date.getMonth() + 1, | |
0, | |
).getDate(); | |
const current_date_number = selected_date.getDate(); | |
// create a string | |
let content = ` | |
👷🏼♂️ *O͟P͟E͟R͟A͟T͟I͟O͟N͟A͟L͟ ͟R͟E͟P͟O͟R͟T͟* | |
*Date:* ${dd}/${mm}/${yyyy} | |
*Day:* ${days[selected_day]}\n | |
*⏳ K͟P͟I͟s* | |
*➪ J-Ton per Hour* = ${jton} | |
*➪ C-Ton per Hour* = ${cton} | |
*➪ Trip per hour* = ${trip} | |
*➪ Quarry Today* = ${quarry_today} | |
*➪ Quarry Weekly* (${week_number}/7) = ${quarry_weekly} | |
*➪ Quarry Monthly* (${current_date_number}/${number_of_days}) = ${quarry_monthly}\n | |
=================\n | |
🏭 *C͟R͟U͟S͟H͟E͟R* | |
*➢ JAW D/N Hours* = ${jaw} | |
*➢ CONE D/N Hours* = ${cone}\n | |
*➢ LABOUR* | |
\`❒ Day\` - ${day} | |
\`❒ Night\` - ${night} | |
=============\n | |
⛰️ *Q͟U͟A͟R͟R͟Y͟*\n | |
🪨 *BOULDERS TO CRUSHER* | |
\`➢ Total Trips\` = ${total_trips} Trips | |
\`➢ Total Tons\` = ${total_tons} MT\n | |
💥 *BLASTING* | |
\`Time\` = ${time}\n | |
🚚 *TIPPER* | |
\`Working\` = ${working} | |
\`Halt\` = ${halt} | |
\`Shed\` = ${shed} | |
🚜 *MACHINERY*\n | |
\`Working\` = ${working} | |
\`Halt\` = ${halt} | |
\`Shed\` = ${shed} | |
`; | |
// add \n\r | |
// copy to clipboard | |
// focus on the textarea | |
var k = jQuery('#main [contenteditable="true"]'); | |
k.focus(); | |
// paste the content | |
insertTextWithNewlines(content); | |
// close the modal | |
jQuery("[data-stem-modal]").remove(); | |
jQuery("[data-stem-background]").remove(); | |
// click #aria-label="Send" | |
jQuery('[aria-label="Send"]').click(); | |
}); | |
// submit - sales | |
jQuery("body").on("click", "[data-submit-sales]", function () { | |
// calculate the star | |
let material = jQuery("#material").val(); | |
material = parseInt(material) || 0; | |
let boulders = jQuery("#boulders").val(); | |
const weekly_growth = jQuery("#weekly_growth").val(); | |
const weekly_total = jQuery("#weekly_total").val(); | |
const monthly_growth = jQuery("#monthly_growth").val(); | |
const monthly_total = jQuery("#monthly_total").val(); | |
const sunday = jQuery("#sunday").val(); | |
const monday = jQuery("#monday").val(); | |
const tuesday = jQuery("#tuesday").val(); | |
const wednesday = jQuery("#wednesday").val(); | |
const thursday = jQuery("#thursday").val(); | |
const friday = jQuery("#friday").val(); | |
const saturday = jQuery("#saturday").val(); | |
// weekly | |
const week_1 = jQuery("#week_1").val(); | |
const week_2 = jQuery("#week_2").val(); | |
const week_3 = jQuery("#week_3").val(); | |
const week_4 = jQuery("#week_4").val(); | |
const week_5 = jQuery("#week_5").val(); | |
// material report | |
const total_trip = jQuery("#total_trip").val(); | |
const mm_12_20_trip = jQuery("#mm_12_20_trip").val(); | |
const mm_12_20_ton = jQuery("#mm_12_20_ton").val(); | |
const mm_12_trip = jQuery("#mm_12_trip").val(); | |
const mm_12_ton = jQuery("#mm_12_ton").val(); | |
const mix_trip = jQuery("#mix_trip").val(); | |
const mix_ton = jQuery("#mix_ton").val(); | |
const dust_trip = jQuery("#dust_trip").val(); | |
const dust_ton = jQuery("#dust_ton").val(); | |
const mm_6_trip = jQuery("#mm_6_trip").val(); | |
const mm_6_ton = jQuery("#mm_6_ton").val(); | |
const mix_6_trip = jQuery("#mix_6_trip").val(); | |
const mix_6_ton = jQuery("#mix_6_ton").val(); | |
const mm_20_trip = jQuery("#mm_20_trip").val(); | |
const mm_20_ton = jQuery("#mm_20_ton").val(); | |
const wmm_trip = jQuery("#wmm_trip").val(); | |
const wmm_ton = jQuery("#wmm_ton").val(); | |
const soil_trip = jQuery("#soil_trip").val(); | |
const soil_ton = jQuery("#soil_ton").val(); | |
const remarks = jQuery("#remarks").val(); | |
// | |
const boulders_trip = jQuery("#boulders_trip").val(); | |
const boulders_ton = jQuery("#boulders_ton").val(); | |
const selectedDay = new Date(jQuery("#date").val()).getDay(); | |
const selected_date = new Date(jQuery("#date").val()); | |
const dd = String(selected_date.getDate()).padStart(2, "0"); | |
const mm = String(selected_date.getMonth() + 1).padStart(2, "0"); //January is 0! | |
const yyyy = selected_date.getFullYear(); | |
const week_day_count = jQuery("#week_day_count").text(); | |
const number_of_days = new Date( new Date(jQuery("#date").val()).getFullYear(), new Date(jQuery("#date").val()).getMonth() + 1, 0).getDate(); | |
const days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; | |
// if there is no date selected show the alert | |
if (!jQuery("#date").val()) { | |
alert("Please select the date"); | |
return; | |
} | |
// calculate the star | |
let star = "⬜️⬜️⬜️⬜️⬜️"; | |
if (material >= 0 && material <= 500) { | |
star = "⬜️⬜️⬜️⬜️⬜️" | |
} else if (material >= 501 && material <= 1000) { | |
star = "⭐️⬜️⬜️⬜️⬜️"; | |
} | |
else if (material >= 1001 && material <= 1500) { | |
star = "⭐️⭐️⬜️⬜️⬜️"; | |
} | |
else if (material >= 1501 && material <= 2000) { | |
star = "⭐️⭐️⭐️⬜️⬜️"; | |
} | |
else if (material >= 2001 && material <= 2500) { | |
star = "⭐️⭐️⭐️⭐️⬜️"; | |
} | |
else if (material >= 2501) { | |
star = "⭐️⭐️⭐️⭐️⭐️"; | |
} | |
const message = ` | |
${star}\n | |
🚀 *T͟O͟D͟A͟Y͟ ͟S͟A͟L͟E͟S͟ ͟R͟E͟P͟O͟R͟T͟* | |
Date: ${dd}/${mm}/${yyyy} | |
Day: ${days[selectedDay]}\n | |
🎯 *TODAY* | |
- Material = ${material} MT | |
- Boulders = ${boulders} MT\n | |
🎯 *WEEKLY GROWTH(${week_day_count}/7)* - ${weekly_growth} / ${weekly_total}\n | |
🎯 *MONTHLY GROWTH(${new Date(jQuery("#date").val()).getDate()}/${number_of_days})* - ${monthly_growth} / ${monthly_total}\n | |
📈 *D͟A͟I͟L͟Y͟* | |
❒ Sunday - ${sunday} | |
❒ Monday - ${monday} | |
❒ Tuesday - ${tuesday} | |
❒ Wednesday - ${wednesday} | |
❒ Thursday - ${thursday} | |
❒ Friday - ${friday} | |
❒ Saturday - ${saturday}\n | |
📈 *W͟E͟E͟K͟L͟Y͟* | |
➢ Week 1 - ${week_1} | |
➢ Week 2 - ${week_2} | |
➢ Week 3 - ${week_3} | |
➢ Week 4 - ${week_4} | |
➢ Week 5 - ${week_5}\n | |
🪨 *M͟A͟T͟E͟R͟I͟A͟L͟ ͟R͟E͟P͟O͟R͟T͟* | |
➢ Total Trip = ${total_trip} ${total_trip > 1 ? "Trips" : "Trip"} | |
➢ 12+20 MM - ${mm_12_20_trip? mm_12_20_trip +' Trip':''} ${mm_12_20_trip>0?'s':''} ${mm_12_20_ton} Ton | |
➢ 12 MM - ${mm_12_trip? mm_12_trip +' Trip':''} ${mm_12_20_trip>0?'s':''} ${mm_12_ton} Ton | |
➢ All Mix GSB - ${mix_trip? mix_trip +' Trip':''} ${mix_6_trip>0?'s':''} ${mix_ton} Ton | |
➢ DUST - ${dust_trip? dust_trip +' Trip':''} ${dust_trip>0?'s':''} ${dust_ton} Ton | |
➢ 6 MIX - ${mix_6_trip? mix_6_trip +' Trip':''} ${mix_6_trip>0?'s':''} ${mix_6_ton} Ton | |
➢ 6MM - ${mm_6_trip? mm_6_trip +' Trip':''} ${mm_6_trip>0?'s':''} ${mm_6_ton} Ton | |
➢ 20 MM - ${mm_20_trip? mm_20_trip +' Trip':''} ${mm_12_20_trip>0?'s':''} ${mm_20_ton} Ton | |
➢ WMM - ${wmm_trip? wmm_trip +' Trip':''} ${wmm_trip>0?'s':''} ${wmm_ton} Ton | |
➢ Boulders - ${boulders_trip?boulders_trip+' Trip':''} ${boulders_trip>0?'s':''} ${boulders_ton} Ton | |
➢ Soil - ${soil_trip? soil_trip +' Trip':''} ${soil_trip>0?'s':''} ${soil_ton} Ton\n | |
${remarks ? "📝 *Remarks*" : ""} | |
${remarks} | |
`; | |
// add \n\r | |
// copy to clipboard | |
// focus on the textarea | |
var k = jQuery('#main [contenteditable="true"]'); | |
k.focus(); | |
// paste the content | |
insertTextWithNewlines(message); | |
// close the modal | |
jQuery("[data-stem-modal]").remove(); | |
jQuery("[data-stem-background]").remove(); | |
// click #aria-label="Send" | |
jQuery('[aria-label="Send"]').click(); | |
}); | |
jQuery("body").on("click", selector, function () { | |
// wait for 2 seconds | |
setTimeout(function () { | |
// data-animate-dropdown-item="true" | |
let dropdown = 'li[data-animate-dropdown-item="true"]'; | |
let dropdownParent = jQuery(dropdown).eq(0).parent(); | |
let dropdownParentClone = dropdownParent.clone(); | |
// replace svg with img | |
dropdownParentClone | |
.find("svg") | |
.replaceWith(`<img src="${dataImage}" style="width: 20px; height: 20px;">`); | |
// replace text with text's span | |
dropdownParentClone.find("span").text("Operational Report"); | |
// add [data-operational-report] attribute | |
dropdownParentClone.attr("data-operational-report", "true"); | |
// prepend the dropdown to the parent | |
dropdownParent.parent().prepend(dropdownParentClone); | |
// add Sales Report | |
let salesReport = dropdownParent.clone(); | |
// replace svg with img | |
salesReport.find("svg").replaceWith(`<img src="${dataImage}" style="width: 20px; height: 20px;">`); | |
salesReport.find("span").text("Sales Report"); | |
salesReport.attr("data-sales-report", "true"); | |
dropdownParent.parent().prepend(salesReport); | |
}, 200); | |
}); | |
jQuery("body").on("change", '[data-date-sales="true"]', function () { | |
// get the value of the date | |
const date = jQuery(this).val(); | |
// WEEKLY GROWTH #week_day_count | |
const selected_date = new Date(date); | |
const week_day_count = selected_date.getDay() + 1; | |
jQuery("#week_day_count").text(week_day_count); | |
// MONTHLY GROWTH | |
const number_of_days = new Date(selected_date.getFullYear(), selected_date.getMonth() + 1, 0).getDate(); | |
jQuery("#monthly-growth").text(`(${selected_date.getDate()}/${number_of_days})`); | |
}); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Update and Download URL Metadata Test | |
// @version 1 | |
// @updateURL https://gist.github.com/raw/3906612/update-meta-test.meta.js | |
// @downloadURL https://gist.github.com/raw/3906612/update-meta-test.user.js | |
// ==/UserScript== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment