productquality.html.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace zin;
  3. $buildProductQuality = function() use($productQuality, $lang)
  4. {
  5. $thead = h::thead
  6. (
  7. setClass('text-left'),
  8. h::tr
  9. (
  10. h::th(set::rowspan(2), $lang->milestone->quality->identify),
  11. isset($productQuality['stages']) ? h::th(setClass('text-center'), set::colspan(count($productQuality['stages'])), $lang->milestone->quality->injection) : null,
  12. h::th(set::rowspan(2), $lang->milestone->quality->scale),
  13. h::th(set::rowspan(2), $lang->milestone->quality->identifyRate)
  14. ),
  15. isset($productQuality['stages']) ? h::tr(array_map(function($stage){ return h::th(set::title($stage['name']), $stage['name']); }, $productQuality['stages'])) : null
  16. );
  17. $trList = array();
  18. if(isset($productQuality['reviews']))
  19. {
  20. $trList = array_map(function($reviewID, $review) use($productQuality)
  21. {
  22. return h::tr
  23. (
  24. h::td($review['name']),
  25. array_map(function($stage) use($reviewID) { return h::td($stage[$reviewID]['counts']); }, $productQuality['stages']),
  26. h::td($review['reviewEstimate']),
  27. h::td($review['identifyRate'])
  28. );
  29. }, array_keys($productQuality['reviews']), $productQuality['reviews']);
  30. }
  31. $trList[] = h::tr
  32. (
  33. h::th(setClass('text-left'), $lang->milestone->quality->total),
  34. isset($productQuality['stages']) ? array_map(function($stage){ return h::td($stage['total']); }, $productQuality['stages']) : null,
  35. isset($productQuality['totalEstimate']) ? h::td($productQuality['totalEstimate']) : null,
  36. isset($productQuality['totalIdentifyRate']) ? h::td($productQuality['totalIdentifyRate']) : null
  37. );
  38. $trList[] = h::tr
  39. (
  40. h::th(setClass('text-left'), $lang->milestone->quality->injectionRate),
  41. isset($productQuality['stages']) ? array_map(function($stage){ return h::td($stage['injection']); }, $productQuality['stages']) : null,
  42. h::td(),
  43. h::td()
  44. );
  45. $tbody = h::tbody($trList);
  46. return h::table(setClass('table bordered bg-white mb-4'), $thead, $tbody);
  47. };