<!-- Content Header (Page header) -->
<section class="content-header">
	<div class="container-fluid">
		<div class="row mb-2">
			<div class="col-sm-6">
				<h1 class="m-0">Customer</h1>
			</div>

			<div class="col-sm-6">
				<ol class="breadcrumb float-sm-right">
					<li class="breadcrumb-item"><a href="dashboard">Dashboard</a></li>
					<li class="breadcrumb-item"><a href="inventory">Inventory</a></li>
					<li class="breadcrumb-item"><a href="inventory/customer-list">Customer</a></li>
					<li class="breadcrumb-item active"><?php if ( count( $customer ) > 0 ): ?>Edit<?php else: ?>Add New<?php endif;?> Customer</li>
				</ol>
			</div>
		</div>
	</div>
</section>

<!-- Main content -->
<section class="content">
	<div class="container-fluid">
		<!-- Small boxes (Stat box) -->
		<div class="row">
			<div class="col-md-12">
				<form id="frmCustomer" action="inventory/customer-save" method="post">
					<div class="card card-primary">
						<div class="card-header">
							<h3 class="card-title"><?php if ( count( $customer ) > 0 ): ?>Edit<?php else: ?>Add New<?php endif;?> Customer</h3>
						</div>

						<div class="card-body">
							<div class="row">
								<div class="col-md-6">
									<div class="form-group">
										<label for="code">Customer Code</label>
										<input type="text" name="code" id="code" class="form-control" placeholder="Customer Code" value="<?php if ( count( $customer ) > 0 ) {echo $customer['code'];} else {echo $code;}?>"> Digit Only
									</div>
									<div class="form-group">
										<label for="name">Customer Name</label>
										<input type="text" name="name" id="name" class="form-control" placeholder="Customer Name" value="<?php if ( count( $customer ) > 0 ) {echo $customer['name'];}?>">
									</div>
									<div class="form-group">
										<label for="address">Address</label>
										<textarea name="address" id="address" class="form-control" placeholder="Customer Address" ><?php if ( count( $customer ) > 0 ) {echo $customer['address'];}?></textarea>
									</div>
									<div class="form-group">
										<label for="mobile">Mobile</label>
										<input type="text" name="mobile" id="mobile" class="form-control" placeholder="Customer Mobile Number" value="<?php if ( count( $customer ) > 0 ) {echo $customer['mobile'];}?>">
									</div>
								</div>

								<div class="col-md-6">
									<div class="form-group">
										<label for="country">Country</label>
										<input type="text" name="country" id="country" class="form-control" placeholder="Country" value="<?php if ( count( $customer ) > 0 ) {echo $customer['country'];}?>">
									</div>
									<div class="form-group">
										<label for="email">Email</label>
										<input type="text" name="email" id="email" class="form-control" placeholder="Email" value="<?php if ( count( $customer ) > 0 ) {echo $customer['email'];}?>">
									</div>
									<div class="form-group">
										<label for="notes">Notes</label>
										<textarea name="notes" id="notes" class="form-control" placeholder="Customer Notes"><?php if ( count( $customer ) > 0 ) {echo $customer['notes'];}?></textarea>
									</div>
									<div class="form-group">
										<label for="status">Select Status</label>
										<select  name="status" id="status" class="form-control select2">
											<option value="active" <?php if ( count( $customer ) > 0 && $customer['status'] == 'active' ) {echo 'selected';}?>>Active</option>
											<option value="inactive" <?php if ( count( $customer ) > 0 && $customer['status'] == 'inactive' ) {echo 'selected';}?>>Inactive</option>
										</select>
									</div>
								</div>
							</div>
						</div>

						<input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
						<?php if ( count( $customer ) > 0 ): ?>
							<input type="hidden" name="id" value="<?php echo $customer['id']; ?>">
						<?php endif;?>

						<div class="card-footer">
							<input type="submit" class="btn bg-gradient-primary" value="Save Changes">
							<input type="reset" class="btn bg-gradient-danger" value="Cancel">
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</section>