weapon-modal.component.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <div class="dimensions">
  2. <div class="title">
  3. @if (isUpdate) {
  4. {{ "weapons.modal.editWeapon" | translate }}
  5. } @else {
  6. {{ "weapons.modal.addWeapon" | translate }}
  7. }
  8. </div>
  9. <div class="content b-0">
  10. <div class="input-label">{{ "weapons.name" | translate }}</div>
  11. <mat-form-field appearance="outline" class="w-100">
  12. <input matInput [(ngModel)]="name" />
  13. </mat-form-field>
  14. <hr />
  15. <div class="flex-row t-1">
  16. <div class="checkbox-column">
  17. <div class="checkbox-row">
  18. <input id="proficient" type="checkbox" [(ngModel)]="proficient" />
  19. <label for="proficient">{{ "weapons.proficient" | translate }}</label>
  20. </div>
  21. <div class="checkbox-row">
  22. <input
  23. id="useAttributeModifier"
  24. type="checkbox"
  25. [(ngModel)]="useAttributeModifier"
  26. />
  27. <label for="useAttributeModifier">{{
  28. "weapons.modal.applyModifier" | translate
  29. }}</label>
  30. </div>
  31. <div class="checkbox-row">
  32. <input id="finesse" type="checkbox" [(ngModel)]="isFinesse" />
  33. <label for="finesse">{{ "weapons.finesse" | translate }}</label>
  34. </div>
  35. <div class="checkbox-row">
  36. <input id="versatile" type="checkbox" [(ngModel)]="isVersatile" />
  37. <label for="versatile">{{ "weapons.versatile" | translate }}</label>
  38. </div>
  39. <div class="checkbox-row">
  40. <input id="isTwohanded" type="checkbox" [(ngModel)]="isTwoHanded" />
  41. <label for="isTwohanded">{{ "weapons.twoHanded" | translate }}</label>
  42. </div>
  43. </div>
  44. <div class="checkbox-column">
  45. <div class="checkbox-row">
  46. <input id="hasReach" type="checkbox" [(ngModel)]="hasReach" />
  47. <label for="hasReach">{{ "weapons.range" | translate }}</label>
  48. </div>
  49. <div class="checkbox-row">
  50. <input id="isRanged" type="checkbox" [(ngModel)]="isRanged" />
  51. <label for="isRanged">{{ "weapons.ranged" | translate }}</label>
  52. </div>
  53. <div class="checkbox-row">
  54. <input id="canBeThrown" type="checkbox" [(ngModel)]="canBeThrown" />
  55. <label for="canBeThrown">{{ "weapons.throwable" | translate }}</label>
  56. </div>
  57. <div class="checkbox-row">
  58. <input id="isMagical" type="checkbox" [(ngModel)]="isMagical" />
  59. <label for="isMagical">{{ "weapons.magical" | translate }}</label>
  60. </div>
  61. <div class="checkbox-row">
  62. <input
  63. id="additionalDamage"
  64. type="checkbox"
  65. [(ngModel)]="hasAdditionalDamage"
  66. />
  67. <label for="additionalDamage">{{
  68. "weapons.modal.additionalDamage" | translate
  69. }}</label>
  70. </div>
  71. </div>
  72. </div>
  73. <hr />
  74. <!-- TAB-PANEL -->
  75. <div class="d-flex">
  76. <div
  77. ngbNav
  78. #nav="ngbNav"
  79. [(activeId)]="active"
  80. class="flex-column navigation-bar"
  81. orientation="vertical"
  82. >
  83. <ng-container ngbNavItem="damage">
  84. <button ngbNavLink>Schaden</button>
  85. <ng-template ngbNavContent>
  86. <div class="flex-row">
  87. <div class="w-50">
  88. <div class="input-label">
  89. {{ "weapons.modal.attackBonus" | translate }}
  90. </div>
  91. <mat-form-field appearance="outline">
  92. <mat-select [(ngModel)]="attackBonus">
  93. @for (attackBonus of attackBonuses; track attackBonus) {
  94. <mat-option [value]="attackBonus">{{
  95. attackBonus
  96. }}</mat-option>
  97. }
  98. </mat-select>
  99. </mat-form-field>
  100. </div>
  101. @if (isMagical) {
  102. <div>
  103. <div class="input-label">
  104. {{ "weapons.modal.magicalModifier" | translate }}
  105. </div>
  106. <mat-form-field appearance="outline">
  107. <mat-select [(ngModel)]="magicBonus">
  108. @for (magicBonus of [1, 2, 3, 4, 5]; track magicBonus) {
  109. <mat-option [value]="magicBonus">
  110. +{{ magicBonus }}
  111. </mat-option>
  112. }
  113. </mat-select>
  114. </mat-form-field>
  115. </div>
  116. }
  117. </div>
  118. <div class="flex-row t-05">
  119. @for (
  120. damageEntry of damage;
  121. let index = $index;
  122. track damageEntry
  123. ) {
  124. <div class="damage-box">
  125. <div class="subheading left t-025">
  126. @if (index == 0) {
  127. {{ "weapons.modal.damage" | translate }}
  128. } @else {
  129. {{ "weapons.modal.additionalDamage" | translate }}
  130. }
  131. </div>
  132. <div class="input-label">
  133. {{ "general.diceNumber" | translate }}
  134. </div>
  135. <mat-form-field appearance="outline">
  136. <mat-select [(ngModel)]="damageEntry.diceNumber">
  137. @for (number of numbers; track number) {
  138. <mat-option [value]="number"> {{ number }} </mat-option>
  139. }
  140. </mat-select>
  141. </mat-form-field>
  142. <div class="input-label t-05">
  143. {{ "general.diceType" | translate }}
  144. @if (isVersatile && index === 0) {
  145. ({{ "weapons.oneHanded" | translate }})
  146. }
  147. </div>
  148. <mat-form-field appearance="outline">
  149. <mat-select [(ngModel)]="damageEntry.diceType">
  150. @for (die of dice; track die) {
  151. <mat-option [value]="die">
  152. {{ "general.dice" | translate }}{{ die }}
  153. </mat-option>
  154. }
  155. </mat-select>
  156. </mat-form-field>
  157. @if (isVersatile && index === 0) {
  158. <div class="input-label t-05">
  159. {{ "general.diceType" | translate }} ({{
  160. "weapons.twoHanded" | translate
  161. }})
  162. </div>
  163. <mat-form-field appearance="outline">
  164. <mat-select [(ngModel)]="versatileDamage">
  165. @for (die of dice; track die) {
  166. <mat-option [value]="die">
  167. {{ "general.dice" | translate }}{{ die }}
  168. </mat-option>
  169. }
  170. </mat-select>
  171. </mat-form-field>
  172. }
  173. <div class="input-label t-05">
  174. {{ "general.damageType" | translate }}
  175. </div>
  176. <mat-form-field appearance="outline">
  177. <mat-select [(ngModel)]="damageEntry.damageType">
  178. @for (type of damageTypes; track type) {
  179. <mat-option [value]="type">
  180. {{ "damageTypes." + type | translate }}
  181. </mat-option>
  182. }
  183. </mat-select>
  184. </mat-form-field>
  185. @if (index !== 0) {
  186. <icon-button
  187. [icon]="'delete'"
  188. (click)="removeDamage(index)"
  189. ></icon-button>
  190. } @else if (hasAdditionalDamage) {
  191. <div class="input-label t-05">
  192. {{ "weapons.modal.additionalDamage" | translate }}
  193. </div>
  194. <mat-form-field appearance="outline">
  195. <mat-select [(ngModel)]="additionalDamage">
  196. @for (damage of additonalDamages; track damage) {
  197. <mat-option [value]="damage">
  198. +{{ damage }}
  199. </mat-option>
  200. }
  201. </mat-select>
  202. </mat-form-field>
  203. }
  204. </div>
  205. @if (damage.length < 2) {
  206. <icon-button
  207. [icon]="'add'"
  208. style="margin-top: 7rem; margin-left: 5rem"
  209. (click)="addDamage()"
  210. ></icon-button>
  211. }
  212. }
  213. </div>
  214. </ng-template>
  215. </ng-container>
  216. <ng-container ngbNavItem="range">
  217. @if (isRanged || canBeThrown) {
  218. <button ngbNavLink>{{ "weapons.range" | translate }}</button>
  219. } @else {
  220. <button class="disabled-button" disabled>
  221. {{ "weapons.range" | translate }}
  222. </button>
  223. }
  224. <ng-template ngbNavContent>
  225. <div class="numbers">
  226. @if (isRanged) {
  227. <div class="flex-row t-1">
  228. <div class="w-50">
  229. <div class="input-label">
  230. {{ "weapons.modal.normalRange" | translate }}
  231. </div>
  232. <mat-form-field appearance="outline">
  233. <input
  234. class="right"
  235. type="number"
  236. matInput
  237. [(ngModel)]="range[0]"
  238. />
  239. <span class="input-value" matTextSuffix>{{
  240. "general.feet" | translate
  241. }}</span>
  242. </mat-form-field>
  243. </div>
  244. <div>
  245. <div class="input-label">
  246. {{ "weapons.modal.extendedRange" | translate }}
  247. </div>
  248. <mat-form-field appearance="outline">
  249. <input
  250. class="right"
  251. type="number"
  252. matInput
  253. [(ngModel)]="range[1]"
  254. />
  255. <span class="input-value" matTextSuffix>{{
  256. "general.feet" | translate
  257. }}</span>
  258. </mat-form-field>
  259. </div>
  260. </div>
  261. }
  262. @if (canBeThrown) {
  263. <div class="flex-row t-2">
  264. <div class="w-50">
  265. <div class="input-label">
  266. {{ "weapons.modal.normalThrowRange" | translate }}
  267. </div>
  268. <mat-form-field appearance="outline">
  269. <input
  270. class="right"
  271. type="number"
  272. matInput
  273. [(ngModel)]="throwRange[0]"
  274. />
  275. <span class="input-value" matTextSuffix>{{
  276. "general.feet" | translate
  277. }}</span>
  278. </mat-form-field>
  279. </div>
  280. <div>
  281. <div class="input-label">
  282. {{ "weapons.modal.extendedThrowRange" | translate }}
  283. </div>
  284. <mat-form-field appearance="outline">
  285. <input
  286. class="right"
  287. type="number"
  288. matInput
  289. [(ngModel)]="throwRange[1]"
  290. />
  291. <span class="input-value" matTextSuffix>{{
  292. "general.feet" | translate
  293. }}</span>
  294. </mat-form-field>
  295. </div>
  296. </div>
  297. }
  298. </div>
  299. </ng-template>
  300. </ng-container>
  301. <ng-container ngbNavItem="description">
  302. <button ngbNavLink>{{ "general.description" | translate }}</button>
  303. <ng-template ngbNavContent>
  304. <div class="NgxEditor__Wrapper">
  305. <ngx-editor-menu [editor]="editor" [toolbar]="toolbar">
  306. </ngx-editor-menu>
  307. <ngx-editor
  308. [editor]="editor"
  309. [(ngModel)]="description"
  310. [placeholder]="'weapons.modal.placeholder' | translate"
  311. ></ngx-editor>
  312. </div>
  313. </ng-template>
  314. </ng-container>
  315. </div>
  316. <div
  317. [ngbNavOutlet]="nav"
  318. style="
  319. width: 100%;
  320. min-height: 20rem;
  321. max-height: 26rem;
  322. overflow-y: auto;
  323. overflow-x: hidden;
  324. "
  325. class="ms-4"
  326. ></div>
  327. </div>
  328. <hr style="margin-bottom: 0" />
  329. </div>
  330. <div class="horizontal-buttons">
  331. @if (isUpdate) {
  332. <ui-button
  333. [color]="'green'"
  334. [type]="'confirm'"
  335. style="width: 40%"
  336. (click)="update()"
  337. >
  338. </ui-button>
  339. } @else {
  340. <ui-button
  341. [color]="'green'"
  342. [type]="'add'"
  343. style="width: 40%"
  344. (click)="add()"
  345. >
  346. </ui-button>
  347. }
  348. <ui-button
  349. [color]="'red'"
  350. [type]="'cancel'"
  351. style="width: 40%"
  352. (click)="cancel()"
  353. >
  354. </ui-button>
  355. </div>
  356. </div>