You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

116 line
3.6 KiB

  1. {% extends "templates/web.html" %}
  2. {% block title %} {{ title }} {% endblock %}
  3. {% block breadcrumbs %}
  4. {% include "templates/includes/breadcrumbs.html" %}
  5. {% endblock %}
  6. {% block page_content %}
  7. {% from "erpnext/templates/includes/macros.html" import product_image %}
  8. {% from "erpnext/templates/includes/macros.html" import media_image %}
  9. <div class="bom-content" style="margin-top:20px;">
  10. <div class="bom-page-content" itemscope itemtype="http://schema.org/Product">
  11. <div class="row">
  12. <div class="col-sm-12">
  13. <h1 itemprop="name" style="margin-top: 0px;">{{ name }}</h1>
  14. <p class="text-muted">
  15. {{ _("Item") }}: <span itemprop="itemName">{{ item_name }}</span></p>
  16. <br>
  17. </div>
  18. </div>
  19. <div class="row">
  20. <div class="col-sm-4">
  21. {{ media_image(website_image, item_name, "product-full-image") }}
  22. <br>
  23. </div>
  24. <div class="col-sm-offset-1 col-sm-4">
  25. <p>{{ _("Quantity") }}: <span itemprop="productID">{{ quantity }}</span></p>
  26. <br>
  27. </div>
  28. </div>
  29. {% if show_items -%}
  30. <div class="row items" style="margin-top: 40px">
  31. <div class="col-md-12">
  32. <h3>{{ _("Items") }}</h3>
  33. <hr>
  34. {% for d in items -%}
  35. <div class="row">
  36. <div class="col-sm-4">{{ media_image(d.image, d.item_name, "product-full-image") }}</div>
  37. <div class="col-sm-4"><div><b>{{ d.item_name }}</b></div>
  38. {% if d.item_name != d.item_code -%}
  39. <div class="text-muted">{{ d.item_code }}</div>
  40. {%- endif %}
  41. <br>
  42. {{ d.description }}
  43. </div>
  44. <div class="col-sm-4">{{ _("Qty") }}: {{ d.qty }}</div>
  45. </div>
  46. <hr>
  47. {%- endfor %}
  48. </div>
  49. </div>
  50. {%- endif %}
  51. {% if show_operations -%}
  52. <div class="row operations" style="margin-top: 40px">
  53. <div class="col-md-12">
  54. <h3>{{ _("Operations") }}</h3>
  55. <hr>
  56. {% for d in operations -%}
  57. <div class="row">
  58. <div class="col-sm-3 bom-spec">{{ media_image(d.image, d.operation, "product-full-image") }}</div>
  59. <div class="col-sm-3 bom-spec"><div>{{ d.operation }}</div>
  60. <div class="text-muted">{{ d.description }}</div>
  61. </div>
  62. <div class="col-sm-3 bom-spec"><b>{{ _("Workstation") }}</b><br>{{ d.workstation }}</div>
  63. <div class="col-sm-3 bom-spec"><b>{{ _("Time(in mins)") }}</b><br><div class="duration"><span class="duration-bar">
  64. <span class="duration-value">{{ d.time_in_mins }}</span></span></div></div>
  65. </div>
  66. <hr>
  67. {%- endfor %}
  68. </div>
  69. </div>
  70. {%- endif %}
  71. <div class="row" style="margin-top: 30px;">
  72. <div class="col-sm-12">
  73. <br>
  74. <div class="h6 text-uppercase">{{ _("Description") }}</div>
  75. <div itemprop="description" class="item-desc">
  76. {{ web_long_description or _("No description given") }}</div>
  77. <br>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. <script>
  83. frappe.ready(function() {
  84. var max_width = $(".duration").width() * 0.8;
  85. var durations = [];
  86. $(".duration .duration-bar").each(function() {
  87. durations.push($(this).find(".duration-value").html());
  88. });
  89. var max_duration = Math.max(...durations);
  90. var width_factor = max_width/max_duration;
  91. $(".duration .duration-bar").each(function() {
  92. var duration = $(this).find(".duration-value").html();
  93. $(this).width(duration * width_factor);
  94. if($(this).width() < $(this).find(".duration-value").width()) {
  95. var html = $($(this).html());
  96. html.addClass("duration-bar");
  97. html.addClass("bar-outer-text");
  98. $(this).find(".duration-value").removeClass("duration-value").addClass("duration-invisible");
  99. $(this).closest(".duration").append(html);
  100. }
  101. });
  102. })
  103. </script>
  104. {% endblock %}