|  | 
| 5 | 5 |   import Input from "@requestnetwork/shared-components/input.svelte"; | 
| 6 | 6 |   import Labels from "@requestnetwork/shared-components/labels.svelte"; | 
| 7 | 7 |   import Accordion from "@requestnetwork/shared-components/accordion.svelte"; | 
|  | 8 | +  import SearchableDropdown from "@requestnetwork/shared-components/searchable-dropdown.svelte"; | 
| 8 | 9 | 
 | 
| 9 | 10 |   // Icons | 
| 10 | 11 |   import Trash from "@requestnetwork/shared-icons/trash.svelte"; | 
|  | 
| 410 | 411 |             </div> | 
| 411 | 412 |           </Accordion> | 
| 412 | 413 |         </div> | 
| 413 |  | -        <Dropdown | 
| 414 |  | -          {config} | 
| 415 |  | -          placeholder="Payment chain" | 
| 416 |  | -          selectedValue={network} | 
| 417 |  | -          options={networks | 
| 418 |  | -            .filter((networkItem) => networkItem) | 
| 419 |  | -            .map((networkItem) => ({ | 
| 420 |  | -              value: networkItem, | 
| 421 |  | -              label: networkItem[0]?.toUpperCase() + networkItem?.slice(1), | 
| 422 |  | -            }))} | 
| 423 |  | -          onchange={handleNetworkChange} | 
| 424 |  | -        /> | 
| 425 |  | -        <Dropdown | 
| 426 |  | -          {config} | 
| 427 |  | -          selectedValue={invoiceCurrency | 
| 428 |  | -            ? `${invoiceCurrency.symbol} ${invoiceCurrency?.network ? `(${invoiceCurrency?.network})` : ""}` | 
| 429 |  | -            : undefined} | 
| 430 |  | -          placeholder="Invoice currency (labeling)" | 
| 431 |  | -          options={defaultCurrencies | 
| 432 |  | -            ?.filter((curr) => { | 
| 433 |  | -              if (!curr) return false; | 
| 434 |  | -              return ( | 
| 435 |  | -                curr.type === Types.RequestLogic.CURRENCY.ISO4217 || | 
| 436 |  | -                (curr.network && curr.network === network) | 
| 437 |  | -              ); | 
| 438 |  | -            }) | 
| 439 |  | -            .map((currency) => ({ | 
|  | 414 | + | 
|  | 415 | +        <div class="searchable-dropdown-container"> | 
|  | 416 | +          <SearchableDropdown | 
|  | 417 | +            getValue={(currency) => currency.value.symbol} | 
|  | 418 | +            getDisplayValue={(currency) => | 
|  | 419 | +              `${currency.value.symbol} ${currency.value.network ? `(${currency.value.network})` : ""}`} | 
|  | 420 | +            placeholder="Invoice currency" | 
|  | 421 | +            items={defaultCurrencies | 
|  | 422 | +              ?.filter((curr) => { | 
|  | 423 | +                if (!curr) return false; | 
|  | 424 | +                return ( | 
|  | 425 | +                  curr.type === Types.RequestLogic.CURRENCY.ISO4217 || | 
|  | 426 | +                  (curr.network && curr.network === network) | 
|  | 427 | +                ); | 
|  | 428 | +              }) | 
|  | 429 | +              .map((currency) => ({ | 
|  | 430 | +                value: currency, | 
|  | 431 | +                label: `${currency?.symbol ?? "Unknown"} ${currency?.network ? `(${currency.network})` : ""}`, | 
|  | 432 | +                type: "invoiceCurrency", | 
|  | 433 | +              })) ?? []} | 
|  | 434 | +            onSelect={handleInvoiceCurrencyChange} | 
|  | 435 | +          /> | 
|  | 436 | +          <SearchableDropdown | 
|  | 437 | +            items={networks | 
|  | 438 | +              .filter((networkItem) => networkItem) | 
|  | 439 | +              .map((networkItem) => { | 
|  | 440 | +                return { | 
|  | 441 | +                  value: networkItem, | 
|  | 442 | +                  label: networkItem[0]?.toUpperCase() + networkItem?.slice(1), | 
|  | 443 | +                  type: "network", | 
|  | 444 | +                }; | 
|  | 445 | +              })} | 
|  | 446 | +            placeholder="Payment chain" | 
|  | 447 | +            getValue={(network) => network.value} | 
|  | 448 | +            getDisplayValue={(network) => network.label} | 
|  | 449 | +            onSelect={handleNetworkChange} | 
|  | 450 | +          /> | 
|  | 451 | +          <SearchableDropdown | 
|  | 452 | +            items={filteredSettlementCurrencies.map((currency) => ({ | 
| 440 | 453 |               value: currency, | 
| 441 |  | -              label: `${currency?.symbol ?? "Unknown"} ${currency?.network ? `(${currency.network})` : ""}`, | 
| 442 |  | -            })) ?? []} | 
| 443 |  | -          onchange={handleInvoiceCurrencyChange} | 
| 444 |  | -        /> | 
| 445 |  | -        <Dropdown | 
| 446 |  | -          {config} | 
| 447 |  | -          placeholder="Settlement currency" | 
| 448 |  | -          selectedValue={currency | 
| 449 |  | -            ? `${currency.symbol ?? "Unknown"} (${currency?.network ?? "Unknown"})` | 
| 450 |  | -            : undefined} | 
| 451 |  | -          options={filteredSettlementCurrencies.map((currency) => ({ | 
| 452 |  | -            value: currency, | 
| 453 |  | -            label: `${currency.symbol ?? "Unknown"} (${currency?.network ?? "Unknown"})`, | 
| 454 |  | -          }))} | 
| 455 |  | -          onchange={handleCurrencyChange} | 
| 456 |  | -        /> | 
| 457 |  | -        {#if cipherProvider} | 
| 458 |  | -          <Input | 
| 459 |  | -            type="checkbox" | 
| 460 |  | -            id="isEncrypted" | 
| 461 |  | -            label="Encrypt invoice" | 
| 462 |  | -            bind:checked={formData.isEncrypted} | 
|  | 454 | +              type: "settlementCurrency", | 
|  | 455 | +            }))} | 
|  | 456 | +            placeholder="Payment currency" | 
|  | 457 | +            getValue={(currency) => currency.value.symbol} | 
|  | 458 | +            getDisplayValue={(currency) => | 
|  | 459 | +              `${currency.value.symbol} (${currency.value.network})`} | 
|  | 460 | +            onSelect={handleCurrencyChange} | 
|  | 461 | +          /> | 
|  | 462 | +          {#if cipherProvider} | 
|  | 463 | +            <Input | 
|  | 464 | +              type="checkbox" | 
|  | 465 | +              id="isEncrypted" | 
|  | 466 | +              label="Encrypt invoice" | 
|  | 467 | +              bind:checked={formData.isEncrypted} | 
| 463 | 468 |             /> | 
| 464 |  | -        {/if} | 
|  | 469 | +          {/if} | 
|  | 470 | +        </div> | 
| 465 | 471 |       </div> | 
| 466 | 472 |     </div> | 
| 467 |  | -    <div class="invoice-form-dates"> | 
| 468 |  | -      <Input | 
| 469 |  | -        id="issuedOn" | 
| 470 |  | -        type="date" | 
| 471 |  | -        value={inputDateFormat(new Date())} | 
| 472 |  | -        label="Issued Date" | 
| 473 |  | -        {handleInput} | 
| 474 |  | -      /> | 
| 475 |  | -      <Input | 
| 476 |  | -        id="dueDate" | 
| 477 |  | -        type="date" | 
| 478 |  | -        min={inputDateFormat(formData.issuedOn)} | 
| 479 |  | -        value={new Date(formData.issuedOn).getTime() + 24 * 60 * 60 * 1000} | 
| 480 |  | -        label="Due Date" | 
| 481 |  | -        {handleInput} | 
| 482 |  | -      /> | 
| 483 |  | -    </div> | 
| 484 | 473 |   </div> | 
| 485 | 474 |   <div class="invoice-form-table-section"> | 
| 486 | 475 |     <div class="invoice-form-table-wrapper"> | 
|  | 
| 592 | 581 |         </div> | 
| 593 | 582 |       </Button> | 
| 594 | 583 |     </div> | 
|  | 584 | +    <div class="invoice-form-dates"> | 
|  | 585 | +      <Input | 
|  | 586 | +        id="issuedOn" | 
|  | 587 | +        type="date" | 
|  | 588 | +        value={inputDateFormat(new Date())} | 
|  | 589 | +        label="Issued Date" | 
|  | 590 | +        {handleInput} | 
|  | 591 | +      /> | 
|  | 592 | +      <Input | 
|  | 593 | +        id="dueDate" | 
|  | 594 | +        type="date" | 
|  | 595 | +        min={inputDateFormat(formData.issuedOn)} | 
|  | 596 | +        value={inputDateFormat( | 
|  | 597 | +          new Date(new Date(formData.issuedOn).getTime() + 24 * 60 * 60 * 1000) | 
|  | 598 | +        )} | 
|  | 599 | +        label="Due Date" | 
|  | 600 | +        {handleInput} | 
|  | 601 | +      /> | 
|  | 602 | +    </div> | 
|  | 603 | + | 
| 595 | 604 |     <div class="invoice-form-label-wrapper"> | 
| 596 | 605 |       <Input | 
| 597 | 606 |         max={200} | 
|  | 
| 635 | 644 |     box-shadow: 0 4px 4px rgba(0, 0, 0, 0.06); | 
| 636 | 645 |     gap: 20px; | 
| 637 | 646 |     box-sizing: border-box; | 
| 638 |  | -    min-width: 700px; | 
|  | 647 | +    min-width: 760px; | 
| 639 | 648 |   } | 
| 640 | 649 | 
 | 
| 641 | 650 |   .invoice-form-container { | 
|  | 
| 658 | 667 | 
 | 
| 659 | 668 |   .invoice-form-dates { | 
| 660 | 669 |     display: flex; | 
| 661 |  | -    flex-direction: column; | 
| 662 |  | -    gap: 9px; | 
| 663 |  | -    margin-left: auto; | 
| 664 |  | -    width: 260px; | 
|  | 670 | +    gap: 16px; | 
|  | 671 | +    width: 100%; | 
|  | 672 | +  } | 
|  | 673 | +
 | 
|  | 674 | +  :global(.invoice-form-dates .input-wrapper) { | 
|  | 675 | +    width: 100%; | 
| 665 | 676 |   } | 
| 666 | 677 | 
 | 
| 667 | 678 |   @media only screen and (max-width: 1300px) { | 
| 668 | 679 |     .invoice-form-dates { | 
| 669 |  | -      margin-left: 0; | 
|  | 680 | +      flex-direction: column; | 
| 670 | 681 |     } | 
| 671 | 682 | 
 | 
| 672 | 683 |     .invoice-form-container { | 
|  | 
| 781 | 792 |   } | 
| 782 | 793 | 
 | 
| 783 | 794 |   .invoice-form-table-body-quantity { | 
| 784 |  | -    width: 80px !important; | 
|  | 795 | +    width: 180px !important; | 
| 785 | 796 |   } | 
| 786 | 797 | 
 | 
| 787 | 798 |   .invoice-form-table-body-amount { | 
|  | 
| 868 | 879 |   :global(.invoice-form-close-recipient-button div) { | 
| 869 | 880 |     padding: 4px !important; | 
| 870 | 881 |   } | 
|  | 882 | +
 | 
|  | 883 | +  .searchable-dropdown-container { | 
|  | 884 | +    display: grid; | 
|  | 885 | +    grid-template-columns: repeat(3, minmax(0, 1fr)); | 
|  | 886 | +    gap: 30px; | 
|  | 887 | +  } | 
|  | 888 | +
 | 
|  | 889 | +  @media only screen and (max-width: 1300px) { | 
|  | 890 | +    .searchable-dropdown-container { | 
|  | 891 | +      grid-template-columns: repeat(2, minmax(0, 1fr)); | 
|  | 892 | +    } | 
|  | 893 | +  } | 
|  | 894 | +
 | 
|  | 895 | +  :global(.danger) { | 
|  | 896 | +    color: #ff0000; | 
|  | 897 | +  } | 
| 871 | 898 | </style> | 
0 commit comments