mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
be5ef010a5
- added empty archive screen - added indication of archive offer on detail page - set default dropdown style to non-selected - removed archive button for new offers
242 lines
14 KiB
Handlebars
242 lines
14 KiB
Handlebars
<section class="gh-canvas circle-bg" {{did-insert this.setup}}>
|
||
<GhCanvasHeader class="gh-canvas-header">
|
||
<h2 class="gh-canvas-title" data-test-screen-title>
|
||
<LinkTo @route="offers" data-test-link="offers-back">Offers</LinkTo>
|
||
<span>{{svg-jar "arrow-right"}}</span>
|
||
{{#if this.offer.isNew}}
|
||
New Offer
|
||
{{else}}
|
||
{{this.offer.name}}
|
||
{{#if (eq this.offer.status "archived")}}
|
||
<span class="gh-badge gh-badge-title">Archived</span>
|
||
{{/if}}
|
||
{{/if}}
|
||
</h2>
|
||
<section class="view-actions">
|
||
<GhTaskButton @class="gh-btn gh-btn-primary gh-btn-icon" @type="button" @task={{this.saveTask}} @data-test-button="save" />
|
||
</section>
|
||
</GhCanvasHeader>
|
||
|
||
<section class="view-container">
|
||
<div class="gh-main-layout content-preview">
|
||
<form>
|
||
<div class="gh-main-section gh-offer-form">
|
||
<div class="gh-main-section-block no-margin">
|
||
<h4 class="gh-main-section-header small bn">Basic</h4>
|
||
<div class="gh-main-section-content grey">
|
||
<GhFormGroup @errors={{this.errors}} @property="name" class="no-margin">
|
||
<label for="name" class="fw6">Name</label>
|
||
<GhTextInput
|
||
@name="name"
|
||
@placeholder="Black Friday"
|
||
@id="name"
|
||
@value={{this.offer.name}}
|
||
@input={{this.setOfferName}}
|
||
data-test-input="offer-name"
|
||
@class="gh-input" />
|
||
<GhErrorMessage @errors={{this.errors}} @property="name" />
|
||
<p>Will be shown to members on the Stripe Checkout page</p>
|
||
</GhFormGroup>
|
||
</div>
|
||
|
||
<h4 class="gh-main-section-header small bn">Discount info</h4>
|
||
<div class="gh-main-section-content grey">
|
||
<GhFormGroup @errors={{this.errors}} @property="product-cadence">
|
||
<label for="product-cadence" class="fw6">Tier – cadence</label>
|
||
<span class="gh-select">
|
||
<OneWaySelect
|
||
@value={{this.cadence}}
|
||
@options={{this.cadences}}
|
||
@optionValuePath="name"
|
||
@optionLabelPath="label"
|
||
@optionTargetPath="name"
|
||
@disabled={{this.isDiscountSectionDisabled}}
|
||
@update={{this.updateCadence}}
|
||
/>
|
||
{{svg-jar "arrow-down-small"}}
|
||
</span>
|
||
<GhErrorMessage @errors={{this.errors}} @property="product-cadence" />
|
||
</GhFormGroup>
|
||
<div class="gh-offer-discount">
|
||
<GhFormGroup @errors={{this.errors}} @property="amount">
|
||
<label for="amount" class="fw6">Amount off</label>
|
||
<div class="gh-offer-value percentage">
|
||
{{#if (eq this.offer.type 'fixed')}}
|
||
<GhTextInput
|
||
@name="amount"
|
||
@type="number"
|
||
@placeholder=""
|
||
@disabled={{this.isDiscountSectionDisabled}}
|
||
@value={{readonly (gh-price-amount this.offer.amount)}}
|
||
@input={{this.setDiscountAmount}}
|
||
@id="amount"
|
||
@class="gh-input"
|
||
/>
|
||
{{else}}
|
||
<GhTextInput
|
||
@name="amount"
|
||
@type="number"
|
||
@placeholder=""
|
||
@disabled={{this.isDiscountSectionDisabled}}
|
||
@value={{readonly this.offer.amount}}
|
||
@input={{this.setDiscountAmount}}
|
||
@id="amount"
|
||
@class="gh-input"
|
||
/>
|
||
{{/if}}
|
||
<GhErrorMessage @errors={{this.errors}} @property="amount" />
|
||
</div>
|
||
</GhFormGroup>
|
||
<div class="gh-offer-type">
|
||
<GhFormGroup @errors={{this.errors}} @property="offer-type" class="no-margin">
|
||
<span class="gh-select">
|
||
<OneWaySelect
|
||
@value={{this.offer.type}}
|
||
@options={{this.offertypes}}
|
||
@optionValuePath="offertype"
|
||
@disabled={{this.isDiscountSectionDisabled}}
|
||
@optionLabelPath="label"
|
||
@optionTargetPath="offertype"
|
||
@update = {{this.setDiscountType}}
|
||
/>
|
||
{{svg-jar "arrow-down-small"}}
|
||
</span>
|
||
<GhErrorMessage @errors={{this.errors}} @property="duration" />
|
||
</GhFormGroup>
|
||
</div>
|
||
</div>
|
||
<div class="gh-offer-duration">
|
||
<GhFormGroup @errors={{this.errors}} @property="duration">
|
||
<label for="product-cadence" class="fw6">Duration</label>
|
||
<span class="gh-select">
|
||
<OneWaySelect
|
||
@value={{this.offer.duration}}
|
||
@options={{this.durations}}
|
||
@optionValuePath="duration"
|
||
@disabled={{this.isDiscountSectionDisabled}}
|
||
@optionLabelPath="label"
|
||
@optionTargetPath="duration"
|
||
@update = {{this.updateDuration}}
|
||
/>
|
||
{{svg-jar "arrow-down-small"}}
|
||
</span>
|
||
<GhErrorMessage @errors={{this.errors}} @property="duration" />
|
||
</GhFormGroup>
|
||
{{#if (eq this.offer.duration "repeating")}}
|
||
<GhFormGroup @errors={{this.errors}} @property="duration-months" @class="duration-months">
|
||
<label for="duration-months" class="fw6">Number of months</label>
|
||
<GhTextInput
|
||
@name="duration-months"
|
||
@value={{this.offer.durationInMonths}}
|
||
@input={{this.setDurationInMonths}}
|
||
@disabled={{this.isDiscountSectionDisabled}}
|
||
@id="duration-months"
|
||
@class="gh-input" />
|
||
<GhErrorMessage @errors={{this.errors}} @property="duration-months" />
|
||
</GhFormGroup>
|
||
{{/if}}
|
||
</div>
|
||
</div>
|
||
|
||
<h4 class="gh-main-section-header small bn">Portal settings</h4>
|
||
<div class="gh-main-section-content grey">
|
||
<div class="form-col2">
|
||
<GhFormGroup @errors={{this.errors}} @property="display-title">
|
||
<label for="display-title" class="fw6">Display title</label>
|
||
<GhTextInput
|
||
@name="display-title"
|
||
@value={{this.offer.displayTitle}}
|
||
@input={{this.setPortalTitle}}
|
||
@placeholder="Black Friday Special"
|
||
@id="display-title"
|
||
@class="gh-input" />
|
||
<GhErrorMessage @errors={{this.errors}} @property="display-title" />
|
||
</GhFormGroup>
|
||
<GhFormGroup @errors={{this.errors}} @property="code">
|
||
<label for="code" class="fw6">Offer code</label>
|
||
<GhTextInput
|
||
@name="code"
|
||
@placeholder="black-friday"
|
||
@value={{this.offer.code}}
|
||
@input={{this.setOfferCode}}
|
||
@id="code"
|
||
@class="gh-input" />
|
||
<GhErrorMessage @errors={{this.errors}} @property="code" />
|
||
</GhFormGroup>
|
||
</div>
|
||
<GhFormGroup @errors={{this.errors}} @property="url" @class="gh-offer-url">
|
||
<label for="url" class="fw6">URL</label>
|
||
<div class="gh-input-group">
|
||
<GhTextInput
|
||
@name="url"
|
||
@value={{this.offerUrl}}
|
||
@id="url"
|
||
@disabled="disabled"
|
||
@class="gh-input" />
|
||
|
||
<GhTaskButton
|
||
@buttonText="Copy link"
|
||
@task={{this.copyOfferUrl}}
|
||
@successText="Link copied"
|
||
@class="gh-btn gh-btn-icon" />
|
||
</div>
|
||
<GhErrorMessage @errors={{this.errors}} @property="url" />
|
||
</GhFormGroup>
|
||
<GhFormGroup @errors={{this.errors}} @property="description" class="no-margin">
|
||
<label for="description" class="fw6">Description</label>
|
||
<GhTextarea
|
||
@id="description"
|
||
@name="description"
|
||
@value={{this.offer.displayDescription}}
|
||
@input={{this.setPortalDescription}}
|
||
@stopEnterKeyDownPropagation="true"
|
||
/>
|
||
<GhErrorMessage @errors={{this.errors}} @property="description" />
|
||
</GhFormGroup>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
|
||
<div class="gh-offer-portal-preview">
|
||
<div>
|
||
<h4 class="gh-main-section-header small bn">Preview</h4>
|
||
<div class="gh-offer-portal-preview-mock">Portal preview</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="gh-main-section">
|
||
<div class="gh-main-section-block">
|
||
{{#if (eq this.offer.status "active")}}
|
||
{{#if (not this.offer.isNew)}}
|
||
<button
|
||
type="button"
|
||
class="gh-btn gh-btn-red gh-btn-icon"
|
||
{{on "click" this.openConfirmArchiveModal}}
|
||
>
|
||
<span>Archive offer</span>
|
||
</button>
|
||
{{/if}}
|
||
{{else}}
|
||
<button
|
||
type="button"
|
||
class="gh-btn gh-btn-black gh-btn-icon"
|
||
{{on "click" this.openConfirmUnarchiveModal}}
|
||
>
|
||
<span>Reactivate offer</span>
|
||
</button>
|
||
{{/if}}
|
||
</div>
|
||
</div>
|
||
</section>
|
||
</section>
|
||
|
||
{{#if this.showUnsavedChangesModal}}
|
||
<GhFullscreenModal
|
||
@modal="leave-settings"
|
||
@confirm={{this.leaveScreen}}
|
||
@close={{this.toggleUnsavedChangesModal}}
|
||
@modifier="action wide" />
|
||
{{/if}}
|