NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name UTC Workflow // @author @shjaisw // @version 1.02 // @run-at document-body // @match https://argus.aka.amazon.com/* // @include https://argus.aka.amazon.com/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js // @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @require https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.es6.min.js // @require https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js // @updateURL https://openuserjs.org/meta/kalpdev.1/UTC_Workflow.meta.js // @downloadURL https://openuserjs.org/install/kalpdev.1/UTC_Workflow.user.js // @license MIT //@require https://cdn.jsdelivr.net/npm/sweetalert2@10 // @grant GM_addStyle // @match http://pnq-412gv7q.ant.amazon.com:8087/* // @grant GM_xmlhttpRequest // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_getValue // ==/UserScript== /*- The @grant directive is needed to work around a design change introduced in GM 1.0. It restores the sandbox. */ const swalWithBootstrapButtons = Swal.mixin({ customClass: { confirmButton: 'btn btn-success', cancelButton: 'btn btn-danger' }, buttonsStyling: false }) function addCustomSearchResult (jNode) { //$(".submit-product-card-classification").hide (); $('#dt-select-100-UTC').click(function(){ setTimeout(function(){ add_description(); }, 100); function add_description(){ swalWithBootstrapButtons.fire({ text: "Select the UTC Flow chart", showCancelButton: true, confirmButtonText: 'Document Attached', cancelButtonText: 'No Document', allowOutsideClick: false, allowEscapeKey: false, reverseButtons: true }).then((result) => { if (result.isConfirmed) { swalWithBootstrapButtons.fire({ text: "Path : Document Attached - Uploaded By", showCancelButton: true, confirmButtonText: 'Seller/ASHA', cancelButtonText: 'ARGUS/SCOT', allowOutsideClick: true, allowEscapeKey: true, footer : 'Seller Includes - Pandash, Seller Central, Vendor Central, ASHA, msds_upload, Rakshaka Bulk Upload, eupc.msds_upload, doc.com', reverseButtons: true }).then((result) => { if (result.isConfirmed) { swalWithBootstrapButtons.fire({ text: "Path : Document Attached - Seller - Product Type", showCancelButton: true, confirmButtonText: 'KIT ', cancelButtonText: 'Single Product', allowOutsideClick: true, allowEscapeKey: true, reverseButtons: true }).then((result) => { if (result.isConfirmed) { swalWithBootstrapButtons.fire({ text: "Path: Document Attached - Seller Uploaded - Kit - Document Type", showCancelButton: true, confirmButtonText: 'Valid Doc', cancelButtonText: 'InValid Doc', allowOutsideClick: true, allowEscapeKey: true, footer: 'Select Valid document when all attached documents are valid, but you need ES/SDS for more items.', reverseButtons: true }).then((result) => { if (result.isConfirmed) { swal.fire( '<p>Path: Document Attached - Seller Uploaded - Kit - Valid Doc </p> <h1>Classify U or UB</h1>', ) } else if ( /* Read more about handling dismissals below */ result.dismiss === Swal.DismissReason.cancel ) { swalWithBootstrapButtons.fire( '<h3>Classify as per Table</h3> <br> <head> <style> table { font-family:serif; border-collapse: collapse; text-size: 3; width: 30%; } td, th { border: 2px solid #7c5353; text-align: left; } tr:nth-child(even) { background-color: #dddddd; } </style> </head> <body> <table> <tr> <th>Kit-Type</th> <th>Condition</th> <th>Classification</th> </tr> <tr> <td>All Non-Battery</td> <td>At least one doc is missing OR at least one doc is invalid</td> <td>U</td> </tr> <tr> <td>Battery + Non-Battery</td> <td>All battery docs Valid AND Non-Battery Doc is not attached</td> <td>U</td> </tr> <tr> <td>Battery + Non-Battery</td> <td>All non-battery docs Valid AND Battery Doc is not attached</td> <td>UB</td> </tr> <tr> <td>Battery + Non-Battery</td> <td>Both (battery/non-battery) docs attached AND either doc (battery/non-battery) invalid</td> <td>U3A/U3B</td> </tr> </table> </body></br>', ) } }) } else if ( /* Read more about handling dismissals below */ result.dismiss === Swal.DismissReason.cancel ) { swalWithBootstrapButtons.fire( '<p>Path: Document Attached - Seller Uploaded - Single Product </p> <h1> Classify U3A or U3B </h1> <br> <i>1. If ES has compressed gas question checked/answered YES then classify U as per ES SOP section 3.13.7 , 2. If ES attached is 2018 battery format filled with Lead Acid and Spillability is Unknown classify as U as per ES SOP section 2.3.6.9 </i></br> ', ) } }) } else if ( /* Read more about handling dismissals below */ result.dismiss === Swal.DismissReason.cancel ) { swalWithBootstrapButtons.fire( '<p> Path : Document Attached - Argus </p> Invalid SDS - U or Invalid ES - U3A/U3B', ) } }) } else if ( /* Read more about handling dismissals below */ result.dismiss === Swal.DismissReason.cancel ) { swalWithBootstrapButtons.fire( '<p>Path : No Document</p> Classify U or UB', ) } }); //console.log("Heyyyyyyy"); ////var active_data = $('.ng-isolate-scope').text(); //console.log("Active string is : " + active_data); ////var batt = $('.md-dg-theme').text(); ////console.log("Bat Attri is : " + batt); } //alert("Hey"); //console.log("Heyyyyyyy"); }); } var url= window.location.href; var isArgusDG = /^https:\/\/argus.aka.amazon.com\/#!\/dg(.*)/i.test(url); if (isArgusDG){ console.log("This is an Argus DG Page!"); waitForKeyElements ("#dt-select-100-UTC", addCustomSearchResult); }else{ console.log("This is not an Argus DG Page!"); }