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.

110 lines
3.3 KiB

  1. ::use 'design.mtt'::
  2. <div class="span12">
  3. <div class="article">
  4. <h2>::_("Import products")::</h2>
  5. ::if step==1::
  6. <form action="/product/import/::contract.id::" method="POST" enctype="multipart/form-data">
  7. <p>
  8. <input name="file" type="file"/>
  9. </p>
  10. <p>
  11. <input type="submit" class="btn btn-primary" value="::_("Import")::"/>
  12. </p>
  13. </form>
  14. ::elseif step==2::
  15. <h4>Produits à importer</h4>
  16. <div style="margin-bottom:24px;">
  17. ::if !csv.isEmpty()::
  18. <table class="table table-bordered" style="/*font-size:11px;*/background-color:#FFF;">
  19. <tr>
  20. ::foreach h csv.getHeaders()::
  21. <th>::_(h)::</th>
  22. ::end::
  23. </tr>
  24. ::foreach d csv.getDatas()::
  25. <tr>
  26. ::foreach r d::
  27. <td>
  28. ::if r!=null:: ::r:: ::end::
  29. </td>
  30. ::end::
  31. </tr>
  32. ::end::
  33. </table>
  34. <div class="alert alert-error">
  35. <b>::_("Warning")::</b>
  36. <p>
  37. ::raw _("Before validating the import, please check if the table above is correctly filled.<br/>If data are not in line or not corresponding to the right column, it means that your CSV file is not correct.")::
  38. </p>
  39. <a href="/product/import/::contract.id::">Recommencer</a>
  40. </div>
  41. <a href="/product/import/::contract.id::?confirm=1" class="btn btn-danger">::_("Import these products in the database")::</a>
  42. ::else::
  43. <div class="alert alert-error">
  44. <b>::_("Ouch!")::</b>
  45. <p>::_("It seems that there is no data to import.")::</p>
  46. <a href="/product/import/::contract.id::">Recommencer</a>
  47. </div>
  48. ::end::
  49. </div>
  50. <!--<div ::cond data2.length > 0:: >
  51. <h4>::_("Products already available in the database")::</h4>
  52. <table class="table" style="font-size:11px;color:#666666;background-color:#FFF;">
  53. <tr>
  54. <th>::_("Name")::</th>
  55. <th>::_("Price")::</th>
  56. </tr>
  57. ::foreach d data2::
  58. <tr>
  59. ::foreach r d::
  60. <td>
  61. ::if r!=null:: ::r:: ::end::
  62. </td>
  63. ::end::
  64. </tr>
  65. ::end::
  66. </table>
  67. </div>-->
  68. ::elseif step==3::
  69. ::if numImported>0::
  70. <div class="alert alert-success">
  71. <b>::__("Congratulations! You have imported ::num:: products in your database", {num:numImported})::</b>
  72. </div>
  73. ::else::
  74. <p>::_("You did not import anything in your database because your file was empty or contained products already present in the database.")::</p>
  75. ::end::
  76. <a href="/contractAdmin/products/::contract.id::">::_("Back to the management of products")::</a>
  77. ::end::
  78. </div>
  79. <div class="block">
  80. <h3>::_("Help")::</h3>
  81. ::_("This page will allow you to import a large number of products in your database from an Excel file.")::
  82. <br/>
  83. <ul>
  84. <li>::raw _("To start, <a href=\"/produits.xls\">Download this demo file</a>")::</li>
  85. <li>::raw _("Fill correctly this file, or modify your existing file to respect strictly the order of columns")::</li>
  86. <li>::raw _("When your file is ready, click on\"Save as\" in your Excel sheet and choose the format CSV")::</li>
  87. <li>::raw _("Choose the following options: separation characters: <b>comma</b>, encoding: <b>Unicode UTF8<b/>"):: </li>
  88. <li>::raw _("Save your file")::</li>
  89. <li>::raw _("Then click on the button above \"Choose a file\" and send your file"):: </li>
  90. </ul>
  91. </div>
  92. </div>
  93. ::end::