entity.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. {% extends "layout.html" %}
  2. {% block title %}{% if entity.name.len() > 0 %}{{entity.name}}{%else%}Create Entity{% endif %}{% endblock %}
  3. {% block description %}{{entity.description}}{% endblock %}
  4. {% block head %}
  5. <style>
  6. </style>
  7. {% endblock %}
  8. {% block content %}
  9. <div class="container">
  10. <div class="row justified">
  11. <div class="backed col-sm-12 col-md-12 col-lg-12">
  12. <h1>Entity {{entity.name}}</h1>
  13. <div class="row justified">
  14. <div class="content">
  15. {% if entity.key.to_string() != "00000000-0000-0000-0000-000000000000" %}
  16. <a class="button" href="/contact/add/{{entity.key}}">➕ Add Contact</a>
  17. <a class="button center" href="/note/add/Entity/{{entity.key}}">➕ Add Note</a>
  18. <a class="button center" href="/file/add/Entity/{{entity.key}}">➕ Attach File</a>
  19. <button id="delete" class="delete_button center">🗑️ Delete</button>
  20. {% endif %}
  21. {% if entity.external_accounting_id != "" %}
  22. <a class="button" href="/entity/invoices/{{entity.key}}/{{entity.external_accounting_id}}">View Invoices</a>
  23. {%endif%}
  24. <div class="tabbed">
  25. <input type="radio" id="tab1" name="css-tabs" checked>
  26. <input type="radio" id="tab2" name="css-tabs">
  27. <input type="radio" id="tab3" name="css-tabs">
  28. <ul class="tabs">
  29. <li class="tab"><label for="tab1">Details</label></li>
  30. <li class="tab"><label for="tab2">Contacts</label></li>
  31. <li class="tab"><label for="tab3">Documents</label></li>
  32. </ul>
  33. <div class="tab-content">
  34. <form id="add_entity_form">
  35. <div>
  36. <label for="name">Name</label>
  37. <input type="text" name="name" id="name" placeholder="Name" value="{{entity.name}}" />
  38. </div>
  39. <div>
  40. <label for="description">Description</label>
  41. <textarea name="description" id="description" placeholder="Description"
  42. value="{{entity.description}}">{{entity.description}}</textarea>
  43. </div>
  44. <div>
  45. <label for="name">Web URL (https:://acme.com)</label>
  46. <input type="text" name="web_url" id="web_url" placeholder="Web URL" value="{{entity.web_url}}" />
  47. </div>
  48. <div>
  49. <label for="matrix_room_url">Matrix Server Room URL (https://matrix.to/#/#SanturceSoftware:matrix.org)
  50. </label>
  51. <input type="text" name="matrix_room_url" id="matrix_room_url" placeholder="matrix_room_url"
  52. value="{{entity.matrix_room_url}}" />
  53. </div>
  54. <div>
  55. <label for="web_url">Web URL</label>
  56. <input type="text" name="web_url" id="web_url" placeholder="Web URL" value="{{entity.web_url}}" />
  57. </div>
  58. <div>
  59. <label for="avatar_url">avatar_url</label>
  60. <input type="text" name="avatar_url" id="avatar_url" placeholder="avatar_url"
  61. value="{{entity.avatar_url}}" />
  62. </div>
  63. <div>
  64. <label for="address_primary">Address</label>
  65. <input type="text" name="address_primary" id="address_primary" placeholder="Address"
  66. value="{{entity.address_primary}}" />
  67. </div>
  68. <div>
  69. <label for="address_unit">Unit</label>
  70. <input type="text" name="address_unit" id="address_unit" placeholder="Unit"
  71. value="{{entity.address_unit}}" />
  72. </div>
  73. <div>
  74. <label for="city">City</label>
  75. <input type="text" name="city" id="city" placeholder="City" value="{{entity.city}}" />
  76. </div>
  77. <div>
  78. <label for="state">State</label>
  79. <input type="text" name="state" id="state" placeholder="State" value="{{entity.state}}" />
  80. </div>
  81. <div>
  82. <label for="zip_code">Zip</label>
  83. <input type="text" name="zip_code" id="zip_code" placeholder="Zipcode" value="{{entity.zip_code}}" />
  84. </div>
  85. <div>
  86. <label for="country">Country</label>
  87. <input type="text" name="country" id="country" placeholder="Country" value="{{entity.country}}" />
  88. </div>
  89. <div>
  90. <input type="submit" class="add_button"
  91. value="{% if entity.name.len() == 0 %}Create entity!{%else%}Update entity{% endif %}" />
  92. </div>
  93. </form>
  94. </div>
  95. <div class="tab-content">
  96. {% if contacts.len() > 0 %}
  97. <h3>Contacts</h3>
  98. <ul class="pick_list">
  99. {% for contact in contacts %}
  100. <li><a class="button" href="/contact/{{contact.key}}">{{contact.first_name}} {{contact.last_name}}</a>
  101. </li>
  102. {% endfor %}
  103. </ul>
  104. {% endif %}
  105. </div>
  106. <div class="tab-content">
  107. <div class="row justified ">
  108. <div class="col-sm-12 col-md-6 col-lg-6">
  109. {% if notes.len() > 0 %}
  110. <h3>Notes & Docs</h3>
  111. {% for note in notes %}
  112. <div class="white-backed bump col-sm-12 col-md-4 col-lg-3">
  113. <a href="/note/{{note.key}}">
  114. <p><b>{{note.title}}</b></p>
  115. </a>
  116. </div>
  117. {% endfor %}
  118. {%else%}
  119. <div class="white-backed">
  120. <div class="col-sm-12 col-md-12 col-lg-12">
  121. <h3>Add Your First Note</h3>
  122. <h4>Create a note about this entity, these are private to you and allow you to keep internal notes on vendors, clients, contractors or any other entitys you keep track of</h4>
  123. </div>
  124. <div class="col-sm-12 col-md-12 col-lg-12">
  125. <a class="button" href="/note/add/Entity/{{entity.key}}">Add Note</a>
  126. </div>
  127. </div>
  128. {% endif %}
  129. </div>
  130. <div class="col-sm-12 col-md-6 col-lg-6">
  131. {% if files.len() > 0 %}
  132. <h3>Files</h3>
  133. {% for file in files %}
  134. <div class="white-backed bump col-sm-12 col-md-4 col-lg-3">
  135. <a href="/file/{{file.key}}">
  136. <p><b>{{file.name}}</b></p>
  137. <hr />
  138. <p>{{file.description}}</p>
  139. </a>
  140. </div>
  141. {% endfor %}
  142. {%else%}
  143. <div class="white-backed">
  144. <div class="col-sm-12 col-md-12 col-lg-12">
  145. <h3>Attach Your First File</h3>
  146. <h4>Attach a file relating to this entity. Anything from receipts to documents that you want organized with this entity.
  147. </h4>
  148. </div>
  149. <div class="col-sm-12 col-md-12 col-lg-12">
  150. <a class="button" href="/file/add/Entity/{{entity.key}}">Add File</a>
  151. </div>
  152. </div>
  153. {% endif %}
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. <script>
  163. window.addEventListener('load', function () {
  164. {% if entity.key.to_string() != "00000000-0000-0000-0000-000000000000" %}
  165. send_delete("delete", "/entity/{{entity.key}}", (deleted, res) => {
  166. if (deleted) {
  167. window.location.href = `/`
  168. }
  169. })
  170. {% endif %}
  171. post_form("add_entity_form", "/entity", data => {
  172. const key = "{{entity.key}}"
  173. data.key = key == "" ? "00000000-0000-0000-0000-000000000000" : key
  174. data.organization_key = "{{user.organization_key}}"
  175. data.external_accounting_id = data.external_accounting_id || "{{entity.external_accounting_id}}"
  176. data.owner_key = "{{user.key}}"
  177. data.entity_type = data.entity_type || "Client";
  178. data.name = data.name || "";
  179. data.description = data.description || "";
  180. data.matrix_room_url = data.matrix_room_url || "";
  181. data.web_url = data.web_url || "";
  182. data.avatar_url = data.avatar_url || "";
  183. data.address_primary = data.address_primary || "";
  184. data.address_unit = data.address_unit || "";
  185. data.city = data.city || "";
  186. data.state = data.state || "";
  187. data.zip_code = data.zip_code || "";
  188. data.country = data.country || "";
  189. data.created = data.created || 0;
  190. data.updated = data.updated || 0;
  191. return data;
  192. }, (response_text) => {
  193. const object = JSON.parse(response_text);
  194. window.location.href = `/entity/${object.key}`
  195. });
  196. })
  197. </script>
  198. {% endblock %}