summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/settings/autofill_page/credit_card_edit_dialog.html
blob: 30f32f21490c027eba317789fdfe141427c45706 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<link rel="import" href="chrome://resources/html/polymer.html">

<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/md_select_css.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="../settings_vars_css.html">

<dom-module id="settings-credit-card-edit-dialog">
  <template>
    <style include="cr-shared-style settings-shared md-select">
      cr-input {
        --cr-input-error-display: none;
        margin-bottom: var(--cr-form-field-bottom-spacing);
        width: var(--settings-input-max-width);
      }

      .md-select + .md-select {
        margin-inline-start: 8px;
      }

      /* Prevent focus-outline from being chopped by bottom of dialog body. */
      .md-select {
        margin-bottom: 2px;
      }

      #expired {
        align-items: center;
        background-color: var(--paper-red-50);
        color: var(--settings-error-color);
        display: flex;
        height: 40px;
        margin-top: 12px;
        padding: 0 0 0 8px;
      }

      @media (prefers-color-scheme: dark) {
        #expired {
          background-color: unset;
          font-weight: bold;
          padding: 0;
        }
      }

      #month {
        width: 70px;
      }

      #saved-to-this-device-only-label {
        margin-top: var(--cr-form-field-bottom-spacing);
      }

      #year {
        width: 100px;
      }
    </style>
    <cr-dialog id="dialog" close-text="$i18n{close}">
      <div slot="title">[[title_]]</div>
      <div slot="body">
        <cr-input id="nameInput" label="$i18n{creditCardName}"
            value="{{creditCard.name}}" autofocus spellcheck="false"
            on-input="onCreditCardNameOrNumberChanged_">
        </cr-input>
        <cr-input id="numberInput" label="$i18n{creditCardNumber}"
            value="{{creditCard.cardNumber}}"
            on-input="onCreditCardNameOrNumberChanged_">
        </cr-input>
        <label id="creditCardExpiration" class="cr-form-field-label">
          $i18n{creditCardExpiration}
        </label>
        <select class="md-select" id="month" value="[[expirationMonth_]]"
            on-change="onMonthChange_"
            aria-labelledby="creditCardExpiration">
          <template is="dom-repeat" items="[[monthList_]]">
            <option>[[item]]</option>
          </template>
        </select>
        <select class="md-select" id="year" value="[[expirationYear_]]"
            on-change="onYearChange_"
            aria-label="$i18n{creditCardExpirationYear}">
          <template is="dom-repeat" items="[[yearList_]]">
            <option>[[item]]</option>
          </template>
        </select>
        <span id="expired"
            hidden="[[!checkIfCardExpired_(expirationMonth_, expirationYear_)]]"
            >
          $i18n{creditCardExpired}
        </span>
        <div id="saved-to-this-device-only-label">
          $i18n{savedToThisDeviceOnly}
        </div>
      </div>
      <div slot="button-container">
        <cr-button id="cancelButton" class="cancel-button"
            on-click="onCancelButtonTap_">$i18n{cancel}</cr-button>
        <cr-button id="saveButton" class="action-button"
            on-click="onSaveButtonTap_" disabled>$i18n{save}</cr-button>
      </div>
    </cr-dialog>
  </template>
  <script src="credit_card_edit_dialog.js"></script>
</dom-module>