<!--pages/index/edit.wxml-->
<view>
  <view class="padding">
    <view class="row padding">
      <view class="flex flex-center flex-justify-between">
        <view class="flex flex-center flex-justify-start">
          <view >
            <view class="container">
              <image wx:if="{{info.pic}}" src="{{info.pic}}" mode="aspectFill" class="bg"></image>
              <image wx:else src="https://res.catter.cn/pub/2025/09/30/20250930143920286.png" mode="aspectFill" class="bg"></image>
              <view class="tips ">
                <view style="background-color: #34343442;height: 100%; width: 100%" class="flex flex-center" bind:tap="upload">
                  <t-icon name="camera" style="color: white;" size="48rpx"></t-icon>
                </view>
              </view>
            </view>
          </view>
          <view class="padding">
            <view>
              {{info.name}}
            </view>
            <view class="font-12 grey">
              {{info.latinName}}
            </view>
          </view>
        </view>
        <view style="width: 60rpx;height: 60rpx;" class="flex flex-justify-end flex-center" bind:tap="changeDialog">
          <t-icon name="edit"></t-icon>
        </view>
      </view>
    </view>

    <view class="white-bg mt-32 " style="border-radius: 16rpx;">
      <view style=" padding-top: 16rpx; padding-bottom: 16rpx;">
        <picker wx:for="{{info.farms}}" title="{{item.name}}" value="{{item.cycleDays}}" prop="{{item.id}}" bind:ok="updateFarms"></picker>
      </view>
    </view>

  </view>
  <view class="flex  flex-center">
    <t-button theme="danger" icon="delete" shape="round" style="width: 80%;" variant="outline" bind:tap="del">删除植物</t-button>
  </view>


  <t-dialog visible="{{showDialog}}" title="更改名称" confirm-btn="确定" cancel-btn="取消" bind:confirm="update" bind:cancel="changeDialog">
    <t-input borderless clearable slot="content" placeholder="请输入新的名称" bind:change="onInput" />
  </t-dialog>

</view>