attr-extraction.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. {% load static %}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Attribute Extraction</title>
  8. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
  9. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource/source-sans-3@5.0.12/index.css"
  10. integrity="sha256-tXJfXfp6Ewt1ilPzLDtQnJV4hclT9XuaZUKyUvmyr+Q=" crossorigin="anonymous">
  11. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/overlayscrollbars@2.3.0/styles/overlayscrollbars.min.css"
  12. integrity="sha256-dSokZseQNT08wYEWiz5iLI8QPlKxG+TswNRD8k35cpg=" crossorigin="anonymous">
  13. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.min.css"
  14. integrity="sha256-Qsx5lrStHZyR9REqhUF8iQt73X06c8LGIUPzpOhwRrI=" crossorigin="anonymous">
  15. <link rel="stylesheet" href="{% static './css/adminlte.css' %}">
  16. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  17. <link rel="stylesheet" href="{% static './css/select2-bootstrap4.min.css' %}">
  18. <link rel="stylesheet" href="{% static 'css/custom.css' %}">
  19. <link rel="stylesheet" href="{% static 'css/attr-extraction.css' %}">
  20. <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
  21. </head>
  22. <body class="layout-fixed sidebar-expand-lg sidebar-mini app-loaded sidebar-collapse">
  23. <div class="app-wrapper"> <!--begin::Header-->
  24. {% include 'header.html' %}
  25. {% include 'sidebar.html' %}
  26. <main class="app-main"> <!--begin::App Content Header-->
  27. <div class="app-content-header"> <!--begin::Container-->
  28. <div class="container-fluid"> <!--begin::Row-->
  29. <!-- Full Page Loader -->
  30. <div id="full-page-loader" style="display: none;">
  31. <div class="loader-overlay">
  32. <div class="spinner-border text-light" role="status">
  33. <!-- <span class="sr-only">Loading...</span> -->
  34. </div>
  35. </div>
  36. </div>
  37. <div class="row">
  38. <div class="col-sm-6">
  39. <h3 class="mb-0">⛏️ Attribute Extraction
  40. &nbsp;<span><a href="./../media/examples/actual_product_list.xlsx" title="Example file" download><i class="bi bi-download"></i></a></span>
  41. </h3>
  42. </div>
  43. <div class="col-sm-6">
  44. <ol class="breadcrumb float-sm-end">
  45. <li class="breadcrumb-item"><a href="{% url 'file-upload' %}">Home</a></li>
  46. <li class="breadcrumb-item active" aria-current="page"><a href="{% url 'generate-video' %}"></a>
  47. ⛏️ Attribute Extraction</a>
  48. </li>
  49. </ol>
  50. </div>
  51. </div> <!--end::Row-->
  52. </div> <!--end::Container-->
  53. </div>
  54. <div class="app-content-header"> <!--begin::Container-->
  55. <div class="container-fluid "> <!--begin::Row-->
  56. <!-- attr -->
  57. <div class="container">
  58. <header class="hero">
  59. <div class="title">
  60. <div class="title-logo" aria-hidden="true">
  61. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
  62. <path d="M5 12c0-3.866 3.134-7 7-7 2.7 0 5.06 1.486 6.3 3.69L12 12l-6.3 3.69C3.74 13.486 5 10.7 5 12z" fill="white" fill-opacity=".95"/>
  63. <path d="M12 12l6.3-3.69C20.26 10.514 19 13.3 19 12c0 3.866-3.134 7-7 7-2.7 0-5.06-1.486-6.3-3.69L12 12z" fill="#9FECE2"/>
  64. </svg>
  65. </div>
  66. <div>
  67. <h1>Product Inventory</h1>
  68. </div>
  69. </div>
  70. <div class="actions">
  71. <!-- Checkbox: Extract Additional -->
  72. <div class="form-check me-3" style="padding: 10px;">
  73. <input class="form-check-input" checked type="checkbox" id="extract_additional" name="extract_additional">
  74. <label class="form-check-label" for="extract_additional">
  75. &nbsp; Extract Additional
  76. </label>
  77. </div>
  78. <!-- Checkbox: Process Image -->
  79. <div class="form-check me-3" style="padding: 10px;">
  80. <input class="form-check-input" checked type="checkbox" id="process_image" name="process_image">
  81. <label class="form-check-label" for="process_image">
  82. &nbsp; Process Image
  83. </label>
  84. </div>
  85. <!-- <input type="checkbox" id="extract_additional" name="extract_additional"/>
  86. <input type="checkbox" id="process_image" name="process_image"/> -->
  87. <button id="btnSubmit" class="btn btn-primary" title="AI Suggested">View Attributes</button>
  88. <button id="btnReset" class="btn btn-secondary">Reset</button>
  89. <button id="btnSelectAll" class="btn btn-primary">Select all</button>
  90. <!-- Upload trigger button -->
  91. <button id="btnUpload" type="button"
  92. class="btn btn-info"
  93. data-bs-toggle="modal"
  94. data-bs-target="#uploadModal">
  95. Upload
  96. </button>
  97. </div>
  98. </header>
  99. <div class="grid">
  100. <section class="card" id="api-summary" style="display: none;">
  101. <div class="card-header">
  102. <h2>API Summary</h2>
  103. </div>
  104. <div class="card-body">
  105. <div class="summary">
  106. <div class="stat"><div class="label">Total products</div><div class="value" id="statTotal">0</div></div>
  107. <div class="stat"><div class="label">Successful</div><div class="value" id="statOk">0</div></div>
  108. <div class="stat"><div class="label">Failed</div><div class="value" id="statKo">0</div></div>
  109. </div>
  110. </div>
  111. </section>
  112. <section class="card">
  113. <div class="card-header">
  114. <h2>Products</h2>
  115. <div class="toolbar">
  116. <span class="pill" id="selectionInfo">No products selected</span>
  117. <div class="seg" role="tablist" aria-label="Layout toggle">
  118. <button id="btnCards" class="active" role="tab" aria-selected="true">Cards</button>
  119. <button id="btnTable" role="tab" aria-selected="false">Table</button>
  120. </div>
  121. </div>
  122. <div><p>Select multiple :<select id="mandatory-attributes" name="mandatoryAttributes[]" aria-labelledby="select a attribute for which multiple data required" multiple="multiple" style="width: 100%;"></select></p></div>
  123. <div style="display: none;">
  124. <label for="thresholdRange">Threshold:</label>
  125. <input type="range" id="thresholdRange" min="0" max="1" step="0.01" value="0.5">
  126. <span id="thresholdValue">0.5</span>
  127. </div>
  128. </div>
  129. <div class="card-body">
  130. <!-- Cards layout container -->
  131. <div id="cardsContainer" class="list" aria-live="polite"></div>
  132. <!-- Table layout container -->
  133. <!-- table-wrap -->
  134. <div id="tableContainer" class="table-responsive" style="display:none" aria-live="polite"></div>
  135. <!-- Pagination bar -->
  136. <div id="paginationBar" class="pagination-bar" aria-label="Pagination" style="display: none;"></div>
  137. </div>
  138. </section>
  139. </div>
  140. <!-- <footer> -->
  141. <!-- <small>Tip: Select products and click <strong>Submit</strong>—attributes render inline under each selected product. Toggle <strong>Cards</strong>/<strong>Table</strong> views.</small> -->
  142. <!-- </footer> -->
  143. </div>
  144. <!-- Upload Modal (Bootstrap) -->
  145. <div class="modal fade" id="uploadModal" tabindex="-1" aria-labelledby="uploadTitle" aria-hidden="true">
  146. <div class="modal-dialog modal-dialog-centered modal-lg">
  147. <div class="modal-content">
  148. <div class="modal-header">
  149. <h5 class="modal-title" id="uploadTitle">Upload files</h5>
  150. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  151. </div>
  152. <div class="modal-body">
  153. <!-- Drag & drop + file picker -->
  154. <div id="dropzone" class="dropzone rounded-3" tabindex="0">
  155. <strong>Drag & drop</strong> files here or
  156. <label for="uploadFiles" class="text-primary text-decoration-underline" style="cursor:pointer;">browse</label>
  157. <input id="uploadFiles" type="file" multiple class="d-none" />
  158. <div id="fileInfo" class="file-info mt-2">No files selected.</div>
  159. </div>
  160. <!-- Progress bar (Bootstrap) -->
  161. <div class="progress mt-3" role="progressbar" aria-label="Upload progress" aria-valuemin="0" aria-valuemax="100">
  162. <div id="uploadBar" class="progress-bar" style="width: 0%"></div>
  163. </div>
  164. <!-- Status -->
  165. <div id="uploadStatus" class="mt-2 text-secondary"></div>
  166. </div>
  167. <div class="modal-footer">
  168. <button type="button" id="uploadCancel" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
  169. <button type="button" id="uploadStart" class="btn btn-success">Start upload</button>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. <!-- attr -->
  175. </div>
  176. </div>
  177. </main>
  178. {% include 'footer.html' %}
  179. </div>
  180. <script src="https://cdn.jsdelivr.net/npm/overlayscrollbars@2.3.0/browser/overlayscrollbars.browser.es6.min.js"
  181. ></script>
  182. <!--end::Third Party Plugin(OverlayScrollbars)--><!--begin::Required Plugin(popperjs for Bootstrap 5)-->
  183. <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js"
  184. ></script>
  185. <!--end::Required Plugin(popperjs for Bootstrap 5)--><!--begin::Required Plugin(Bootstrap 5)-->
  186. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js"
  187. ></script>
  188. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  189. <!--end::Required Plugin(Bootstrap 5)--><!--begin::Required Plugin(AdminLTE)-->
  190. <script src="{% static './js/adminlte.js' %}"></script>
  191. <script>
  192. // $(document).ready(function() {
  193. // // Your jQuery code here, e.g.,
  194. // $('#full-page-loader').show();
  195. // });
  196. const SELECTOR_SIDEBAR_WRAPPER = ".sidebar-wrapper";
  197. const Default = {
  198. scrollbarTheme: "os-theme-light",
  199. scrollbarAutoHide: "leave",
  200. scrollbarClickScroll: true,
  201. };
  202. document.addEventListener("DOMContentLoaded", function () {
  203. const sidebarWrapper = document.querySelector(SELECTOR_SIDEBAR_WRAPPER);
  204. if (
  205. sidebarWrapper &&
  206. typeof OverlayScrollbarsGlobal?.OverlayScrollbars !== "undefined"
  207. ) {
  208. OverlayScrollbarsGlobal.OverlayScrollbars(sidebarWrapper, {
  209. scrollbars: {
  210. theme: Default.scrollbarTheme,
  211. autoHide: Default.scrollbarAutoHide,
  212. clickScroll: Default.scrollbarClickScroll,
  213. },
  214. });
  215. }
  216. });
  217. $('#mandatory-attributes').select2({
  218. placeholder: 'Select mandatory attributes',
  219. allowClear: true,
  220. width: '200px' // or 'resolve' if dynamically sized
  221. });
  222. // In your Javascript (external .js resource or <script> tag)
  223. // $(document).ready(function() {
  224. // // jQuery('#mandatory-attributes').select2();
  225. // });
  226. </script>
  227. <script src="{% static 'js/attr-extraction.js' %}"></script>
  228. </body>
  229. </html>