<div class="top-pad"></div>

<div class="content-padding" ng-show="ready">

	<h1 class="left title"><i class="fa fa-coffee"></i>{{restaurant.name}} - Payment Info</h1>

	<div class="divider"></div>

	<div class="support-box-wrap box-content2">

		<form name="formStripeAccount" novalidate>

			<div class="support-box-wrap-header">
				<h1>Required Info</h1>
				<div class="divider"></div>
			</div>

			<div class="no-box-content-color">

				<ul ng-class="{'submitted':stripeAccountSubmitted}" class="ul-inputs" ng-if="restaurant.stripeAccount.formStripe">

					<li class="li-input" ng-class="{'error':formStripeAccount.legalNamePayment.$invalid}">
						<div class="label">Legal Name for Payment:</div>
						<div class="input"><input type="text" required name="legalNamePayment" maxlength="250" ng-model="restaurant.payment_type.legal_name_payment" placeholder=""></div>
						<div class="box-error">
							<small ng-show="formStripeAccount.legalNamePayment.$error.required">Required.</small>
						</div>
					</li>

					<li class="li-input" ng-class="{'error':formStripeAccount.accountType.$invalid}">
						<div class="label">Type</div>
						<select name="accountType" required ng-model="restaurant.stripeAccount.account_type" ng-options="opt.value as opt.label for opt in accountType"></select>
						<div class="box-error">
							<small ng-show="formStripeAccount.accountType.$error.required">Required.</small>
						</div>
					</li>

					<li class="li-input" ng-class="{'error':formStripeAccount.taxID.$invalid}">
						<div class="label">SSN or EIN:</div>
						<div class="input"><input type="text" name="taxID" maxlength="250" ng-model="restaurant.payment_type.tax_id" placeholder=""></div>
						<div class="box-error">
							<small ng-show="formStripeAccount.taxID.$error.required">Required.</small>
						</div>
					</li>

					<li class="li-input" ng-class="{'error':formStripeAccount.routingNumber.$invalid}">
						<div class="label">Routing Number:</div>
						<div class="input"><input type="text" name="routingNumber" maxlength="250" ng-model="restaurant.stripeAccount.routing_number" placeholder=""></div>
						<div class="box-error">
							<small ng-show="formStripeAccount.routingNumber.$error.required">Required.</small>
						</div>
					</li>

					<li class="li-input" ng-class="{'error':formStripeAccount.accountNumber.$invalid}">
						<div class="label">Account Number:</div>
						<div class="input"><input type="text" name="accountNumber" maxlength="250" ng-model="restaurant.stripeAccount.account_number" placeholder=""></div>
						<div class="box-error">
							<small ng-show="formStripeAccount.accountNumber.$error.required">Required.</small>
						</div>
					</li>

					<li class="li-input" ng-show="!isSavingStripeAccount">

						<div>
							<button class="button save" ng-click="saveStripeAccount();">Save To Stripe</button>
							<span class="orange link" ng-show="isBeta" ng-click="testAccount()">Test account</span>
						</div>

					</li>

					<li class="li-input" ng-show="isSavingStripeAccount">
						<i class="fa fa-circle-o-notch fa-spin"></i>
					</li>

				</ul>

				<ul class="ul-inputs" ng-if="!restaurant.stripeAccount.formStripe && restaurant.payment_type.stripe_id">

					<li class="li-input">
						<div class="label">
							This restaurant already has a Stripe Account
						</div>
						<div class="input">
							<span class="link" ng-click="restaurant.stripeAccount.formStripe=true">Edit Stripe Account</span>
						</div>
					</li>

				</ul>

				<ul ng-class="{'submitted':stripeAccountSubmitted}" class="ul-inputs" ng-show="restaurant.stripeAccount.formStripeMigrate && !restaurant.stripeAccount.formStripe && !restaurant.payment_type.stripe_account_id">

					<li class="li-input" ng-show="!isMigrating">

						<span ng-show="restaurant.payment_type.stripe_id && restaurant.payment_type.stripe_account_id" class="link" ng-click="restaurant.stripeAccount.formStripe = false">Cancel Edit Stripe Account</span>

						<span class="link" ng-click="restaurant.stripeAccount.formStripe=true">Show Stripe create form</span>

					</li>

					<li class="li-input" ng-show="isMigrating">
						<i class="fa fa-circle-o-notch fa-spin"></i>
					</li>

				</ul>

			</div>
		</form>

	</div>

	<div class="support-box-wrap box-content2" ng-if="restaurant.payment_type.stripe_id">

			<div class="support-box-wrap-header">
				<h1>Verification</h1>
				<div class="divider"></div>
			</div>

			<div class="no-box-content-color">

				<ul class="ul-inputs">

					<li class="li-input">
						<div class="label" ng-if="restaurant.payment_type.verified">
							<i class="fa fa-smile-o"></i>&nbsp;&nbsp;This account is verified!
						</div>
						<div class="label" ng-if="!restaurant.payment_type.verified">
							<i class="fa fa-meh-o"></i>&nbsp;&nbsp;This account is not verified!
						</div>
					</li>

					<li class="li-input" ng-show="!stripe_processing">
						<button ng-click="verifyStatus();" class="button button-empty button-border button-blue"><i class="fa fa-cc-stripe"></i>&nbsp;&nbsp;Get Stripe Status</button>
						<button ng-show="!restaurant.payment_type.verified" ng-click="verifyAccount();" class="button button-empty button-border button-green"><i class="fa fa fa-check-circle-o"></i>&nbsp;&nbsp;Send Verification Info</button>
					</li>

					<li class="li-input" ng-show="stripe_processing">
						<i class="fa fa-spinner fa-spin"></i> Working!
					</li>

				</ul>

			</div>

		</div>

	<form name="formUpdateEntityName" novalidate>
		<div class="support-box-wrap box-content2">

			<div class="support-box-wrap-header">
				<h1>Update Legal Entity Name to Restaurant Account on Stripe</h1>
				<div class="divider"></div>
			</div>

			<div class="no-box-content-color">

				<ul ng-class="{'submitted':submittedEntityName}" class="ul-inputs">

					<li class="li-input" ng-class="{'error':formUpdateEntityName.name.$invalid}">
						<div class="label">Name:</div>
						<div class="input"><input type="text" name="name" maxlength="250" ng-model="restaurant.payment_type.legal_name_payment"></div>
						<div class="box-error">
							<small ng-show="formUpdateEntityName.name.$error.required">Required.</small>
						</div>
					</li>

					<li class="li-input" ng-show="!isUpdating">
						<button class="button save" ng-click="updateEntityName();">Update</button>

					</li>
					<li class="li-input" ng-show="isUpdating">
						<i class="fa fa-circle-o-notch fa-spin"></i>
					</li>

				</ul>

			</div>

		</div>

	</form>

	<form name="formBasic" novalidate>

		<div class="support-box-wrap box-content2">

			<div class="support-box-wrap-header">
				<h1>Basic Info</h1>
				<div class="divider"></div>
			</div>

			<div class="no-box-content-color">

				<ul ng-class="{'submitted':submitted}" class="ul-inputs">

					<li class="li-input" ng-class="{'error':formBasic.summaryEmail.$invalid}" ng-if="restaurant.payment_type.summary_method == 'email'">
						<div class="label">Summary Email:</div>
						<div class="input"><input type="email" ng-required="restaurant.payment_type.summary_method == 'email'" name="summaryEmail" maxlength="250" ng-model="restaurant.payment_type.summary_email"></div>
						<div class="box-error">
							<small ng-show="formBasic.summaryEmail.$error.required">Required.</small>
						</div>
					</li>

					<li class="li-input" ng-class="{'error':formBasic.paymentMethod.$invalid}">
						<div class="label">Payment Method</div>
						<select name="paymentMethod" required ng-model="restaurant.payment_type.payment_method" ng-options="opt.value as opt.label for opt in paymentMethod"></select>
						<div class="box-error">
							<small ng-show="formBasic.paymentMethod.$error.required">Required.</small>
						</div>
					</li>

				</ul>

			</div>

		</div>

		<div class="support-box-wrap box-content2">

			<div class="support-box-wrap-header">
				<h1>Address</h1>
				<div class="divider"></div>
			</div>

			<div class="no-box-content-color">

				<ul ng-class="{'submitted':submitted}" class="ul-inputs">

					<li class="li-input">
						<div class="label">Address:</div>
						<div class="input"><input type="text" name="checkAddress" maxlength="250" ng-model="restaurant.payment_type.check_address" placeholder=""></div>
					</li>

					<li class="li-input">
						<div class="label">City:</div>
						<div class="input"><input type="text" name="checkAddressCity" maxlength="50" ng-model="restaurant.payment_type.check_address_city" placeholder=""></div>
					</li>

					<li class="li-input">
						<div class="label">State:</div>
						<div class="input"><input type="text" name="checkAddressState" maxlength="50" ng-model="restaurant.payment_type.check_address_state" placeholder=""></div>
					</li>

					<li class="li-input">
						<div class="label">Zip:</div>
						<div class="input"><input type="text" name="checkAddressZip" maxlength="20" ng-model="restaurant.payment_type.check_address_zip" placeholder=""></div>
					</li>

					<li class="li-input">
						<div class="label">Country:</div>
						<div class="input"><input type="text" name="checkAddressCountry" maxlength="20" ng-model="restaurant.payment_type.check_address_country" placeholder=""></div>
					</li>
				</ul>
			</div>
		</div>

		<div class="support-box-wrap box-content2">

			<div class="support-box-wrap-header">
				<h1>Payment Info</h1>
				<div class="divider"></div>
			</div>
			<div class="no-box-content-color">

				<ul ng-class="{'submitted':submitted}" class="ul-inputs">

					<li class="li-input" ng-class="{'error':formBasic.chargeCreditFee.$invalid}">
						<div class="label">Charge Credit Fees</div>
						<select name="chargeCreditFee" required ng-model="restaurant.payment_type.charge_credit_fee" ng-options="opt.value as opt.label for opt in yesNo"></select>
						<div class="box-error">
							<small ng-show="formBasic.chargeCreditFee.$error.required">Required.</small>
						</div>
					</li>

					<li class="li-input" ng-class="{'error':formBasic.waiveFeeFirstMonth.$invalid}">
						<div class="label">Waive Fee 1st Month?</div>
						<select name="waiveFeeFirstMonth" required ng-model="restaurant.payment_type.waive_fee_first_month" ng-options="opt.value as opt.label for opt in yesNo"></select>
						<div class="box-error">
							<small ng-show="formBasic.waiveFeeFirstMonth.$error.required">Required.</small>
						</div>
					</li>

					<li class="li-input" ng-class="{'error':formBasic.payApologyCredits.$invalid}">
						<div class="label">Pay For Apology Credits?</div>
						<select name="payApologyCredits" required ng-model="restaurant.payment_type.pay_apology_credits" ng-options="opt.value as opt.label for opt in yesNo"></select>
						<div class="box-error">
							<small ng-show="formBasic.payApologyCredits.$error.required">Required.</small>
						</div>
					</li>

					<li class="li-input">
						<div class="label">Max Apology Credit:</div>
						<div class="input"><input type="number" name="maxApologyCredit" ignore-mouse-wheel ng-model="restaurant.payment_type.max_apology_credit" placeholder=""></div>
					</li>

					<li class="li-input">
						<div class="label">Max Promotion Paying:</div>
						<div class="input"><input type="number" name="maxPayPromotion" ignore-mouse-wheel ng-model="restaurant.payment_type.max_pay_promotion" placeholder=""></div>
					</li>

					<li class="li-input">
						<div class="label">Contact Name:</div>
						<div class="input"><input type="text" name="contactName" maxlength="250" ng-model="restaurant.payment_type.contact_name" placeholder=""></div>
					</li>

					<li class="li-input" ng-class="{'error':formBasic.summaryMethod.$invalid}">
						<div class="label">Summary Method:</div>
						<select name="summaryMethod" required ng-model="restaurant.payment_type.summary_method" ng-options="opt.value as opt.label for opt in summaryMethod"></select>
						<div class="box-error">
							<small ng-show="formBasic.summaryMethod.$error.required">Required.</small>
						</div>
					</li>

					<li class="li-input" ng-class="{'error':formBasic.paymentMethod.$invalid}" ng-if="restaurant.payment_type.summary_method == 'email'">
						<div class="label">Summary Email:</div>
						<div class="input"><input type="text" ng-required="restaurant.payment_type.summary_method == 'email'" name="summaryEmail" maxlength="250" ng-model="restaurant.payment_type.summary_email"></div>
						<div class="box-error">
							<small ng-show="formBasic.summaryEmail.$error.required">Required.</small>
						</div>
					</li>

					<li class="li-input" ng-show="restaurant.payment_type.summary_method == 'fax'">
						<div class="label">Summary Fax:</div>
						<div class="input"><input type="text" name="summaryFax" maxlength="250" ng-model="restaurant.payment_type.summary_fax" placeholder=""></div>
					</li>

					<li class="li-input">
						<div class="label">Summary Frequency:</div>
						<div class="input"><input type="number" name="maxPayPromotion" ignore-mouse-wheel ng-model="restaurant.payment_type.summary_frequency" placeholder=""></div>
					</li>

				</ul>

			</div>
		</div>
	</form>

	<br>

	<ul class="ul-inputs">
		<li class="li-input" ng-show="!isSaving">
			<button class="button save" ng-click="save();">Save</button>

		</li>
		<li class="li-input" ng-show="isSaving">
			<i class="fa fa-circle-o-notch fa-spin"></i>
		</li>
	</ul>

</div>

<spinner-loading></spinner-loading>
<hack-expand-content></hack-expand-content>
