Subversion Repositories SmartDukaan

Rev

Rev 35962 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<script>
$(document).ready(function() {
  $('#inactiveStore').DataTable(
  {
    "bPaginate": true,
    "bLengthChange": true,
    "bFilter": true,
    "bInfo": false,
    "bAutoWidth": false }
  );

} );

function closeStore(fofoId, storeCode) {
    var inputCode = prompt("This will PERMANENTLY close the store. This action cannot be undone.\n\nTo confirm, type the store code: " + storeCode);
    if (inputCode === null) return;
    if (inputCode.trim() === "") {
        alert("Store code is required to confirm closure.");
        return;
    }
    if (inputCode.trim() !== storeCode) {
        alert("Store code does not match. Closure cancelled.");
        return;
    }
    $.ajax({
        url: contextPath + '/closeStore',
        type: 'POST',
        data: { fofoId: fofoId, storeCode: inputCode },
        success: function(response) {
            alert("Store closed permanently.");
            location.reload();
        },
        error: function(xhr) {
            alert("Error closing store: " + (xhr.responseText || "Unknown error"));
        }
    });
}
</script>
<section class="wrapper">
        <div class="row">
                <div class="col-lg-12">
                        <h3 class="page-header"><i class="icon_document_alt"></i>INACTIVE STORE</h3>
                        <ol class="breadcrumb">
                                <li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
                                <li><i class="icon_document_alt"></i>INACTIVE-STORE</li>
                        </ol>
                </div>
        </div>
        <div id="inactive-store-table">
                <div class="row">
                <div class="col-lg-12">

                        <table class="table table-bordered" id="inactiveStore">
                        <thead>
                                                <th>PartnerId</th>
                                                <th>Store Name</th>
                                                <th>Email</th>
                                                <th>Store Code</th>
                                                <th>Status</th>
                                                <th>Days For Activation</th>

                                                <th>Action</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        #if(!$fofoStores.isEmpty())
                                        #foreach( $inactivefofoStore in $inActiveFofoStores)
                                                <tr>
                                                        <td>$inactivefofoStore.getId()</td>
                                                        #if($customRetailers.get($inactivefofoStore.getId()).getBusinessName())
                                                        <td>$customRetailers.get($inactivefofoStore.getId()).getBusinessName()</td>
                                                         #else
                                 <td>-</td> #end
                                 #if($customRetailers.get($inactivefofoStore.getId()).getEmail())
                                                        <td>$customRetailers.get($inactivefofoStore.getId()).getEmail()</td>
                                                        #else
                                <td>-</td> #end
                                                        <td>$inactivefofoStore.getCode()</td>
                                                        #if($inactivefofoStore.isClosed())
                                                        <td><span class="label label-danger">CLOSED</span></td>
                                                        <td>-</td>
                                                        <td><span class="text-muted">Permanently Closed</span></td>
                                                        #else
                                                        <td><span class="label label-warning">INACTIVE</span></td>
                                                        <td><input type="text" name="temporaryActivationStore" id="temporary-activation" value="" style=" width: 137px;">
                                                        <button class="btn btn-primary activate-store-temporary"  data-fofoid="$inactivefofoStore.getId()">Temp Activate</button></td>
                                                        <td>
                                                            <button class="btn btn-primary activate-store-forever"  data-fofoid="$inactivefofoStore.getId()">Activate</button>
                                                            <button class="btn btn-danger" onclick="closeStore($inactivefofoStore.getId(), '$inactivefofoStore.getCode()')">Close Store</button>
                                                        </td>
                                                        #end
                                                </tr>
                                        #end
                                #else
                                        <tr>
                                                <td colspan="7" style="text-align:center;">NO MATCHING DATA FOUND FOR CRITERIA</td>
                                        </tr>
                                #end
                                </tbody>
                        </table>
                </div>
            </div>
    </div>
</section>