<?php
/*
* Plugin-Name: Product Designer App
* Plugin-URI: https://productdesignerapp.com
* Author: productdesignerapp
* Template
*/

if (!defined('ABSPATH'))
{
    exit;
}
?>
<template v-if="modal.type == 'crop'">
    <div class="modal-body">
        <div class="pdapp-cropbox">
            <div class="pdapp-croparea">
                <img class="pdapp-cropimage" :src="modal.data.blob" :data-width="modal.data.width" :data-height="modal.data.height" :data-newW="modal.data.newW" :data-newH="modal.data.newH">
                <div class="pdapp-cropmask" :style="'background-image: url('+ modal.data.blob +');'"></div>
            </div>
        </div>
    </div>

    <div class="modal-footer pb-1 pt-1 justify-content-between align-items-center gap-2">
        <div class="d-flex">
            <select v-if="!modal.replace" class="form-select d-flex align-items-center justify-content-center" v-model="modal.data.ratio" @change="changeCropRatio">
                <option v-for="(ratio, rid) in listCropRatio" :key="rid" :value="ratio">
                    <template v-if="ratio == 'area_ratio' || ratio == 'free_ratio'">{{ langs.options[ratio] }}</template>
                    <template v-else>{{ ratio }}</template>
                </option>
            </select>
        </div>
        <div class="d-flex gap-1 m-0">
            <button v-if="!modal.replace" type="button" class="btn btn-light d-lg-block d-none" @click="modal.show = false">{{ langs.cancel }}</button>
            <div class="d-flex gap-1 align-items-center">
                <button type="button" class="btn btn-light" @click="useOriginPhoto()" v-if="!modal.replace">{{ langs.options.use_origin_photo }}</button>
                <button id="pdapp-crop-btn" type="button" class="btn btn-primary" @click="cropPhoto()" :disabled="waitDesign">
                    <span v-if="waitDesign" class="spinner-border spinner-border-sm"></span>
                    <span v-else>{{ langs.options.crop }}</span>
                </button>
            </div>
        </div>
    </div>
</template>